-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Bug: deserialized scene should have node transforms invalidated at initial #16353
Conversation
@cocos-robot run test cases |
Interface Check ReportThis pull request does not change any public interfaces ! |
@@ -657,7 +657,7 @@ class Node : public CCObject { | |||
// NOTE: TypeArray created in node.jsb.ts _ctor should have the same memory layout | |||
uint32_t _eventMask{0}; // Uint32: 0 | |||
uint32_t _layer{static_cast<uint32_t>(Layers::LayerList::DEFAULT)}; // Uint32: 1 | |||
uint32_t _transformFlags{0}; // Uint32: 2 | |||
uint32_t _transformFlags{static_cast<uint32_t>(TransformBit::TRS)}; // Uint32: 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this._transformFlags |= TransformBit.TRS;
was set in _onBatchCreated
.
If we modify the initialized value to TRS, will it mark it as dirty twice and call updateWorldTransform
twice?
For instance,
const scene = deserialize(archive) as Scene;
const node = scene.getChildByPath('Node')!;
const worldScale = node.worldScale; // call updateWorldTransform internally, and reset child._transformFlags = TransformBit.NONE;
// Use worldScale
director.runScene(scene); // call scene._load -> scene._onBatchCreated -> node._onBatchCreated -> this._transformFlags |= TransformBit.TRS;
// this._transformFlags is set to TransformBit.TRS again, so updateWorldTransform will be invoked twice, but in fact, the world transform was not changed at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend deleting transform flags modification in Node._onBatchCreated
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's ok for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cocos-robot run test cases |
Re: #16352
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: