Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: renderlayers get updated with stale data from material manager #4550

Merged
merged 2 commits into from
May 29, 2024

Conversation

christjt
Copy link
Contributor

Type of change

Bug

Jira ticket 📘

https://cognitedata.atlassian.net/browse/BND3D-4264

Description 📝

Cad node is updating the renderlayers based on when the node appearance provider triggers a change, but the material manager throttles (yields), and may have stale data when the render layers are computed. So correct behaviour is to rather listen for when the material manager updates.

How has this been tested? 🔍

Can be reproduced with the follow visual test setup (Default.VisualTest.ts)

export default class DefaultVisualTest extends ViewerVisualTestFixture {
  public async setup({ models, viewer }: ViewerTestFixtureComponents): Promise<void> {
    const model = models[0] as CogniteCadModel;
    const a = new TreeIndexNodeCollection([1]);
    const b = new TreeIndexNodeCollection([2]);
    const appearance: NodeAppearance = { renderInFront: true, color: new Color('red') };
    model.assignStyledNodeCollection(b, appearance);
    model.unassignStyledNodeCollection(b);
    await new Promise(resolve => setTimeout(resolve, 0));
    model.assignStyledNodeCollection(a, appearance);
  }
}

@christjt christjt requested a review from a team as a code owner May 29, 2024 11:23
@christjt christjt enabled auto-merge (squash) May 29, 2024 11:49
Copy link
Contributor

@pramodcog pramodcog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
Appreciate the help.

@christjt christjt merged commit f2a2050 into master May 29, 2024
14 checks passed
@christjt christjt deleted the christjt/BND3D-4264 branch May 29, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants