-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 thinInstanceCount setter to work with mesh clone #12434
Fix thinInstanceCount setter to work with mesh clone #12434
Conversation
Please make sure to tag your PR with "bug", "new feature" or "breaking change" tags. |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12434/merge/index.html#WGZLGJ#4600 To test the snapshot in the playground itself use (for example): https://playground.babylonjs.com/?snapshot=refs/pull/12434/merge#BCU1XR#0 |
Please make sure to tag your PR with "bug", "new feature" or "breaking change" tags. |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12434/merge/index.html#WGZLGJ#4600 To test the snapshot in the playground itself use (for example): https://playground.babylonjs.com/?snapshot=refs/pull/12434/merge#BCU1XR#0 |
Please make sure to tag your PR with "bug", "new feature" or "breaking change" tags. |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/12434/merge/index.html#WGZLGJ#4600 To test the snapshot in the playground itself use (for example): https://playground.babylonjs.com/?snapshot=refs/pull/12434/merge#BCU1XR#0 |
This is a breaking change, as now the cloned mesh will be displayed with the same thin instances than the source mesh. But it does not seem unreasonable to me to expect this behaviour when cloning a mesh with thin instances. And if we don't want the thin instances in the cloned mesh, we can call Let's see what the Babylon.js team think about this. |
It won't be thou unless you explicitly set the clone's thinInstanceCount to the number of thin instances that you want displayed for it. Otherwise the behavior should be the same as it is now AFAIK. Because the only change after the PR should be that E.G. when you set it to 3 on the clone, you get the first 3 thin instances displayed for it as expected, if you set it to 2 you get just the first 2 as expected, etc, for the clone. Currently nothing would happen at all (the setter just returns), which seems pretty unexpected IMO... |
After cloning a mesh that has thin instances, setting thinInstanceCount on the clone currently doesn't work (unless it is set to 0 the setter will return without updating the internal instanceCount).
With this PR, if a mesh doesn't have the thin instance matrixData, then it checks to see if the mesh's source has it before defaulting the max instance count to 0.
PG Repro: https://playground.babylonjs.com/#217750#76
Forum: https://forum.babylonjs.com/t/cant-set-thininstancecount-for-clone/29674