示例#1
0
 public void PasteValue(BoneModifier modifier)
 {
     Scale      = modifier.Scale;
     Rotation   = modifier.Rotation;
     Position   = modifier.Position;
     isScale    = modifier.isScale;
     isRotate   = modifier.isRotate;
     isPosition = modifier.isPosition;
 }
示例#2
0
 public void PasteValue(BoneModifier modifier)
 {
     this.Scale      = modifier.Scale;
     this.Rotation   = modifier.Rotation;
     this.Position   = modifier.Position;
     this.isScale    = modifier.isScale;
     this.isRotate   = modifier.isRotate;
     this.isPosition = modifier.isPosition;
 }
示例#3
0
        void BoneModifierEditor(Bone bone)
        {
            if (bone == null)
            {
                EmptyPage(new GUIContent("Select a bone. "));
                return;
            }
            var boneModifier = selectedChara.boneModifiers[bone.ID];

            GUILayout.BeginHorizontal();
            GUILayout.Label(bone.transform.name, titlestyle2);
            if (GUILayout.Button(" Copy value ", buttonstyleNoStretch))
            {
                clonedValue = boneModifier.Clone();
            }
            if (clonedValue != null)
            {
                if (GUILayout.Button(" Paste value ", buttonstyleNoStretch))
                {
                    boneModifier.PasteValue(clonedValue);
                }
            }
            GUILayout.EndHorizontal();

            ToggleGUITitle(ref boneModifier.isScale, new GUIContent("Scale"));
            if (boneModifier.isScale)
            {
                SliderGUI(ref boneModifier.Scale.x, scaleMin, scaleMax, 1f, " x ", valuedecimals: "N5");
                SliderGUI(ref boneModifier.Scale.y, scaleMin, scaleMax, 1f, " y ", valuedecimals: "N5");
                SliderGUI(ref boneModifier.Scale.z, scaleMin, scaleMax, 1f, " z ", valuedecimals: "N5");
            }
            ToggleGUITitle(ref boneModifier.isPosition, new GUIContent("Position"));
            if (boneModifier.isPosition)
            {
                TweakGUI(ref boneModifier.Position.x, positionRange, " x ", valuedecimals: "N5");
                TweakGUI(ref boneModifier.Position.y, positionRange, " y ", valuedecimals: "N5");
                TweakGUI(ref boneModifier.Position.z, positionRange, " z ", valuedecimals: "N5");
            }
            ToggleGUITitle(ref boneModifier.isRotate, new GUIContent("Rotation"));
            if (boneModifier.isRotate)
            {
                TweakGUI(ref boneModifier.Rotation.x, rotationRange, " x ");
                TweakGUI(ref boneModifier.Rotation.y, rotationRange, " y ");
                TweakGUI(ref boneModifier.Rotation.z, rotationRange, " z ");
            }
        }
示例#4
0
        public void AddBoneModifier(string bonename)
        {
            if (boneModifiers.ContainsKey(Animator.StringToHash(bonename)))
            {
                return;
            }
            var t = Transform_Utility.FindTransform(human.body.AnimatedBoneRoot, bonename);

            if (t != null)
            {
                var bone = new Bone(t);
                targetBones.Add(bone);
                BoneModifier boneModifer = new BoneModifier(bonename)
                {
                    Scale    = bone.transform.localScale,
                    Rotation = bone.transform.localEulerAngles,
                    Position = bone.transform.localPosition
                };
                originalBones.Add(bone.ID, boneModifer);
                boneModifiers.Add(bone.ID, new BoneModifier(bonename));
                Console.WriteLine(Name + " has a new bone to modify: " + bonename);
            }
        }
示例#5
0
        private void _UpdateCache()
        {
            LoadBoneModifers();
            targetBones.Clear();
            originalBones.Clear();
            var transforms = human.body.AnimatedBoneRoot.GetComponentsInChildren <Transform>();

            foreach (var transform in transforms)
            {
                if (transform.name != null && boneModifiers.ContainsKey(Animator.StringToHash(transform.name)))
                {
                    var Bone = new Bone(transform);
                    targetBones.Add(Bone);
                    BoneModifier boneModifer = new BoneModifier(transform.name)
                    {
                        Scale    = Bone.transform.localScale,
                        Rotation = Bone.transform.localEulerAngles,
                        Position = Bone.transform.localPosition
                    };
                    originalBones.Add(Bone.ID, boneModifer);
                    Console.WriteLine(Name + "'s Bone to modify: " + transform.name);
                }
            }
        }