Skip to content

Commit c1cca0f

Browse files
sohailshafiiWkfacebook-github-bot
authored andcommitted
fix(Runtime): Don't check for animator initialized state in constraints
Summary: Checking for `isInitialized` on Animator caused the animator to not be used by constraints, since a constraint might initialize before the Animator has a chance to. It should be fine to access an animator's bone transforms before initialization. I've accessed bone transforms like the Hip on an un-initialized Animator and the Animator still returns a valid reference. Reviewed By: tseglevskiy Differential Revision: D46580909 fbshipit-source-id: ea20f616d296adc1c9a24eee47b860056ad7a713
1 parent 6761a7e commit c1cca0f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Runtime/Scripts/AnimationRigging/DeformationConstraint.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,15 @@ private bool SkeletonOrAnimatorValid()
344344
{
345345
return
346346
(_customSkeleton != null && _customSkeleton.IsInitialized) ||
347-
(_animator != null && _animator.isInitialized) ||
347+
(_animator != null) ||
348348
(_skeleton != null && _skeleton.IsInitialized);
349349
}
350350

351351
/// <inheritdoc />
352352
public bool IsBoneTransformsDataValid()
353353
{
354354
return (_customSkeleton != null && _customSkeleton.IsDataValid) ||
355-
(_animator != null && _animator.isInitialized) ||
355+
(_animator != null) ||
356356
(_skeleton != null && _skeleton.IsDataValid);
357357
}
358358

Runtime/Scripts/AnimationRigging/GroundingConstraint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public void SetDefaultValues()
416416
public bool IsBoneTransformsDataValid()
417417
{
418418
return (_skeleton != null && _skeleton.IsDataValid) ||
419-
(_animator != null && _animator.isInitialized);
419+
(_animator != null);
420420
}
421421
}
422422

Runtime/Scripts/AnimationRigging/TwistDistributionConstraint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ private static Vector3 Convert(Axis axis, bool inverted)
277277
public bool IsBoneTransformsDataValid()
278278
{
279279
return (_skeleton != null && _skeleton.IsDataValid) ||
280-
(_animator != null && _animator.isInitialized);
280+
(_animator != null);
281281
}
282282

283283
bool IAnimationJobData.IsValid()

0 commit comments

Comments
 (0)