Пример #1
0
        /***********************************************
        *  override
        ***********************************************/

        public override void OnTargetChange()
        {
            if (target == null)
            {
                PSLogger.Log("Target is null");
                return;
            }

            EditorCurveBinding[] bindings = AnimationUtility.GetAnimatableBindings(target, target);
            bindingList.Clear();

            for (int i = 0; i < this.propertyMuscleName.Length; i++)
            {
                for (int j = 0; j < bindings.Length; j++)
                {
                    EditorCurveBinding binding = bindings [j];
                    if (binding.type.Equals(typeof(Animator)) && binding.propertyName == this.propertyMuscleName [i])
                    {
                        bindingList.Add(binding);
                        break;
                    }
                }
            }
            curveBindings = bindingList.ToArray();
        }
Пример #2
0
        public override void OnUpdateValue()
        {
            if (target == null || clip == null)
            {
                PSLogger.Log("Target or clip is null");
                return;
            }

            this.muscleToggle = new bool[this.muscleCount];
            this.muscleValue  = new float[this.muscleCount];
            rootValue         = new float[PSMuscleDefine.rootProperty.Length];
            rootToggle        = new bool[PSMuscleDefine.rootProperty.Length];
            rootT             = false;
            rootQ             = false;

            foreach (EditorCurveBinding binding in AnimationUtility.GetCurveBindings(clip))
            {
                if (!binding.type.Equals(typeof(Animator)))
                {
                    continue;
                }
                //Debug.Log(binding.propertyName);
                for (int i = 0, len = PSMuscleDefine.rootProperty.Length; i < len; i++)
                {
                    if (binding.propertyName == PSMuscleDefine.rootProperty [i])
                    {
                        AnimationUtility.GetFloatValue(target, binding, out rootValue [i]);
                        rootToggle [i] = true;
                        if (i < 3)
                        {
                            rootT = true;
                        }
                        else
                        {
                            rootQ = true;
                        }
                        break;
                    }
                }

                for (int i = 0, len = this.propertyMuscleName.Length; i < len; i++)
                {
                    if (binding.propertyName == this.propertyMuscleName [i])
                    {
                        AnimationUtility.GetFloatValue(target, binding, out muscleValue [i]);
                        muscleToggle [i] = true;
                        break;
                    }
                }
            }
        }