Esempio n. 1
0
        private void HandPoseInspector(HandTarget handTarget)
        {
            EditorGUILayout.BeginHorizontal();
            showHandPoses = EditorGUILayout.Foldout(showHandPoses, "Hand Pose", true);

            EditorGUI.indentLevel++;
            GetPoseNames();
            int poseIx = EditorGUILayout.Popup(handTarget.poseMixer.currentPoseIx, poseNames);

            if (poseIx != handTarget.poseMixer.currentPoseIx)
            {
                handTarget.poseMixer.currentPoseIx = poseIx;
                handTarget.poseMixer.SetPoseValue(poseIx);
                SceneView.RepaintAll();
            }
            EditorGUI.indentLevel--;

            EditorGUILayout.EndHorizontal();
            if (showHandPoses)
            {
                EditorGUI.indentLevel++;
                Pose_Editor.PoseMixerInspector(handTarget.poseMixer, humanoid);
                EditorGUI.indentLevel--;
            }

            if (!Application.isPlaying)
            {
                handTarget.poseMixer.ShowPose(humanoid, handTarget.isLeft ? Side.Left : Side.Right);
            }
        }
Esempio n. 2
0
        public static void ExpressionsInspector(FaceTarget faceTarget)
        {
            EditorGUILayout.BeginHorizontal();
            showExpressions = EditorGUILayout.Foldout(showExpressions, "Expression", true);

            EditorGUI.indentLevel++;
            string[] poseNames = faceTarget.poseMixer.GetPoseNames();
            int      poseIx    = EditorGUILayout.Popup(faceTarget.pose, poseNames);

            if (poseIx != faceTarget.pose)
            {
                faceTarget.pose = poseIx;
                faceTarget.poseMixer.SetPoseValue(poseIx);
            }
            EditorGUI.indentLevel--;
            EditorGUILayout.EndHorizontal();

            if (showExpressions)
            {
                EditorGUI.indentLevel++;
                Pose_Editor.PoseMixerInspector(faceTarget.poseMixer, faceTarget.headTarget.humanoid);
                EditorGUI.indentLevel--;
            }

            if (!Application.isPlaying)
            {
                faceTarget.poseMixer.ShowPose(faceTarget.headTarget.humanoid);
                faceTarget.UpdateMovements();
                SceneView.RepaintAll();
            }
        }
Esempio n. 3
0
        public void OnSceneGUI()
        {
            HandTarget handTarget = (HandTarget)target;

            if (humanoid == null)
            {
                return;
            }

            if (Application.isPlaying)
            {
                return;
            }

            Pose_Editor.UpdateScene(humanoid, handTarget.fingers, handTarget.poseMixer, ref selectedBone, handTarget.isLeft ? Side.Left : Side.Right);

            handTarget.poseMixer.ShowPose(humanoid, handTarget.side);
            if (humanoid.pose != null)
            {
                if (humanoid.editPose)
                {
                    humanoid.pose.UpdatePose(humanoid);
                }
                else
                {
                    humanoid.pose.Show(humanoid);
                    handTarget.CopyRigToTarget();
                }
            }

            // update the target rig from the current hand target
            handTarget.CopyTargetToRig();
            // update the avatar bones from the target rig
            humanoid.UpdateMovements();
            // match the target rig with the new avatar pose
            humanoid.MatchTargetsToAvatar();
            // and update all targets to match the target rig
            humanoid.CopyRigToTargets();

            // Update the sensors to match the updated targets
            humanoid.UpdateSensorsFromTargets();
#if false
            if (!Application.isPlaying)
            {
                if (handTarget.transform.position != handPosition)
                {
                    handTarget.hand.target.transform.rotation = handTarget.forearm.bone.targetRotation * handLocalRotation;
                    handTarget.transform.rotation             = handTarget.hand.target.transform.rotation;
                }
                else
                {
                    handLocalRotation = Quaternion.Inverse(handTarget.forearm.bone.targetRotation) * handTarget.transform.rotation;
                }
                handPosition = handTarget.transform.position;
            }
#endif
        }
Esempio n. 4
0
        public static void UpdateScene(FaceTarget faceTarget)
        {
            if (Application.isPlaying)
            {
                return;
            }

            Pose_Editor.UpdateScene(faceTarget.headTarget.humanoid, faceTarget, faceTarget.poseMixer, ref selectedBone);

            //faceTarget.UpdateMovements();
        }