Skip to content

Commit

Permalink
[Automated] Merged dev into main
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 16, 2023
2 parents 9aaa97b + 8d5f1bb commit 3c00952
Show file tree
Hide file tree
Showing 257 changed files with 53,309 additions and 4,874 deletions.
46 changes: 46 additions & 0 deletions Editor/AnimationRigging/CaptureAnimationConstraintEditor.cs
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 Editor/AnimationRigging/CaptureAnimationConstraintEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion Editor/AnimationRigging/DeformationConstraintEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@ public override void OnInspectorGUI()
if (GUILayout.Button("Find Hips To Head Bones"))
{
Undo.RecordObject(constraint, "Find Hips To Head Bones");
constraint.data.SetUpHipsAndHeadBones();
constraint.data.SetUpHipsToHeadBones();
EditorUtility.SetDirty(target);
}
}
if (constraintData.HipsToHeadBoneTargets == null ||
constraintData.HipsToHeadBoneTargets.Length == 0)
{
if (GUILayout.Button("Find Hips To Head Bone Targets"))
{
Undo.RecordObject(constraint, "Find Hips To Head Bone Targets");
constraint.data.SetUpHipsToHeadBoneTargets(constraint.transform);
EditorUtility.SetDirty(target);
}
}
Expand Down
7 changes: 5 additions & 2 deletions Editor/AnimationRigging/GroundingConstraintEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,20 @@ private void FindHips(GroundingConstraint constraint)
{
IGroundingData groundingData = constraint.data;
Transform hipsTransform = null;
bool isFullSkeleton = groundingData.ConstraintSkeleton.GetSkeletonType() == OVRSkeleton.SkeletonType.FullBody;

if (groundingData.ConstraintSkeleton != null)
{
hipsTransform = RiggingUtilities.FindBoneTransformFromCustomSkeleton(
groundingData.ConstraintSkeleton,
OVRSkeleton.BoneId.Body_Hips);
isFullSkeleton ? OVRSkeleton.BoneId.FullBody_Hips : OVRSkeleton.BoneId.Body_Hips);
}
else
{
hipsTransform = RiggingUtilities.FindBoneTransformAnimator(
groundingData.ConstraintAnimator,
OVRSkeleton.BoneId.Body_Hips);
isFullSkeleton ? OVRSkeleton.BoneId.FullBody_Hips : OVRSkeleton.BoneId.Body_Hips,
groundingData.ConstraintAnimator.GetComponent<OVRSkeleton>().GetSkeletonType() == OVRSkeleton.SkeletonType.FullBody);
}
if (hipsTransform == null)
{
Expand Down
32 changes: 30 additions & 2 deletions Editor/AnimationRigging/HipPinningConstraintEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,44 @@ public override void OnInspectorGUI()
{
var constraint = (HipPinningConstraint)target;
IHipPinningData constraintData = constraint.data;
if (constraintData.ConstraintSkeleton == null)
if (constraintData.ConstraintSkeleton == null &&
constraintData.AnimatorComponent == null)
{
if (GUILayout.Button("Find OVR Skeleton"))
{
Undo.RecordObject(constraint, "Find OVR Skeleton");
var skeleton = constraint.GetComponentInParent<OVRCustomSkeleton>();
constraint.data.AssignOVRSkeleton(skeleton);
EditorUtility.SetDirty(target);
}
if (GUILayout.Button("Find Animator"))
{
Undo.RecordObject(constraint, "Find Animator");
var animatorComp = constraint.GetComponentInParent<Animator>();
constraint.data.AssignAnimator(animatorComp);
EditorUtility.SetDirty(target);
}
}
else if (!constraintData.ObtainedProperReferences)
{
if (GUILayout.Button("Set up data"))
{
Undo.RecordObject(constraint, "Set up data");
constraint.data.SetUpBoneReferences();
EditorUtility.SetDirty(target);
}
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
}
else if (constraintData.ObtainedProperReferences)
{
if (GUILayout.Button("Clear data"))
{
Undo.RecordObject(constraint, "Clear data");
constraint.data.ClearSetupReferences();
EditorUtility.SetDirty(target);
}
}

GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
DrawDefaultInspector();
}
}
Expand Down
1 change: 1 addition & 0 deletions Editor/Meta.Movement.Editor.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"rootNamespace": "",
"references": [
"GUID:502e28d01b3ebaf4689df96d8655467c",
"GUID:2a230cb87a1d3ba4a98bdc0ddae76e6c",
"GUID:f64c9ebcd7899c3448a08dc9f9ddbe30",
"GUID:d2761a0af0f567748a72629d4bb18a26",
"GUID:7305c54a43f3814439df347c7519653e",
Expand Down
8 changes: 8 additions & 0 deletions Editor/ThirdParty.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Editor/ThirdParty/LICENSE.txt
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
7 changes: 7 additions & 0 deletions Editor/ThirdParty/LICENSE.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3c00952

Please sign in to comment.