-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Anim Component] Fix for the normalizeWeights property #4203
Conversation
// clear all targets from previous binding | ||
this._targets = {}; | ||
} | ||
|
||
resetStateGraph() { | ||
const assetId = this._stateGraphAsset; |
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.
Was this tested against the model component when it isn't playing?
this.removeStateGraph(); | ||
if (this.stateGraphAsset) { | ||
if (assetId) { | ||
const stateGraph = this.system.app.assets.get(this.stateGraphAsset).resource; |
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.
const stateGraph = this.system.app.assets.get(this.stateGraphAsset).resource; | |
const stateGraph = this.system.app.assets.get(assetId).resource; |
Should this be assetId
instead?
@@ -475,6 +474,14 @@ class AnimComponent extends Component { | |||
} | |||
} | |||
|
|||
unbind() { | |||
if (!this._normalizeWeights) { |
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.
Given the function name unbind
, it would imply it would unbind regardless of _normalizeWeights
. Do we want the if check here or in the setter of normalizeWeights
?
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.
We'd want this check any time unbind is called (currently changing the normalizeWeights property or removing the state graph).
if (this.stateGraphAsset) { | ||
const stateGraph = this.system.app.assets.get(this.stateGraphAsset).resource; | ||
if (assetId) { | ||
const stateGraph = this.system.app.assets.get(assetId).resource; | ||
this.loadStateGraph(stateGraph); |
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.
_stateGraphAsset
is still null after this call. Should we set this prior to the call?
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.
LGTM
* fix for the normalizeWeights anim component property
Previously when setting the normalizeWeights property, the state graph was reset in order to unbind any dirty targets it contained. This PR moves the target unbinding to its own function so that the normalizeWeights setter can call it directly. It also removes the resetStateGraph function which is no longer necessary.
Fixes #4189
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.