-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
257 changed files
with
53,309 additions
and
4,874 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
Editor/AnimationRigging/CaptureAnimationConstraintEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) Meta Platforms, Inc. and affiliates. | ||
|
||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Oculus.Movement.AnimationRigging | ||
{ | ||
/// <summary> | ||
/// Custom editor for the capture animation constraint. | ||
/// </summary> | ||
[CustomEditor(typeof(CaptureAnimationConstraint)), CanEditMultipleObjects] | ||
public class CaptureAnimationConstraintEditor : Editor | ||
{ | ||
/// <inheritdoc /> | ||
public override void OnInspectorGUI() | ||
{ | ||
var constraint = (CaptureAnimationConstraint)target; | ||
ICaptureAnimationData constraintData = constraint.data; | ||
if (constraintData.ConstraintAnimator == null) | ||
{ | ||
if (GUILayout.Button("Find Animator")) | ||
{ | ||
Undo.RecordObject(constraint, "Find Animator"); | ||
var animator = constraint.GetComponentInParent<Animator>(); | ||
constraint.data.AssignAnimator(animator); | ||
} | ||
} | ||
|
||
if (constraintData.CurrentPose == null || | ||
constraintData.ReferencePose == null || | ||
constraintData.CurrentPose.Length < (int)HumanBodyBones.LastBone || | ||
constraintData.ReferencePose.Length < (int)HumanBodyBones.LastBone) | ||
{ | ||
if (GUILayout.Button("Setup pose arrays")) | ||
{ | ||
Undo.RecordObject(constraint, "Setup pose arrays"); | ||
constraint.data.SetupPoseArrays(); | ||
} | ||
} | ||
|
||
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing); | ||
|
||
DrawDefaultInspector(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Editor/AnimationRigging/CaptureAnimationConstraintEditor.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Developed by Tom Kail at Inkle | ||
// Released under the MIT Licence as held at https://opensource.org/licenses/MIT | ||
// | ||
// From https://gist.github.com/tomkail/ba4136e6aa990f4dc94e0d39ec6a058c |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.