Sfoglia il codice sorgente

Rework IsStop and Mune

Also tweak derived BaseDrag components to have a consistent Initialize
method signature
habeebweeb 4 anni fa
parent
commit
45c2695e0a

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MaidIKPane.cs

@@ -36,7 +36,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (updating) return;
             if (toggle == IKToggle.IK) this.meidoManager.ActiveMeido.SetIKActive(value);
-            else if (toggle == IKToggle.Release) this.meidoManager.ActiveMeido.IKRelease();
+            else if (toggle == IKToggle.Release) this.meidoManager.ActiveMeido.IsStop = false;
             else if (toggle == IKToggle.Bone) this.meidoManager.ActiveMeido.IsBone = value;
         }
 

+ 28 - 28
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/DragPointManager.cs

@@ -90,9 +90,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public bool Active { get; set; }
         public DragPointManager(Meido meido)
         {
-            meido.BodyLoad += Initialize;
             this.meido = meido;
             this.maid = meido.Maid;
+            this.meido.BodyLoad += Initialize;
         }
 
         public void Initialize(object sender, EventArgs args)
@@ -112,8 +112,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 GameObject.Destroy(dragPoint.Value);
             }
-            DragPoint = null;
-            BoneTransform = null;
+            DragPoint.Clear();
+            BoneTransform.Clear();
             Initialized = false;
             this.Active = false;
         }
@@ -231,7 +231,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 GameObject dragPoint = GameObject.CreatePrimitive(primitive);
                 dragPoint.transform.localScale = scale;
-                if (material != null) dragPoint.GetComponent<Renderer>().material = material;
+                dragPoint.GetComponent<Renderer>().material = material;
                 dragPoint.layer = 8;
                 return dragPoint;
             };
@@ -245,14 +245,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 }
 
                 DragJointForearm dragUpper = dragPoints[0].AddComponent<DragJointForearm>();
-                dragUpper.Initialize(upper, false, maid, () => upper[2].position, () => Vector3.zero);
-                dragUpper.DragEvent += OnDragEvent;
+                dragUpper.Initialize(upper, false, meido, () => upper[2].position, () => Vector3.zero);
+                // dragUpper.DragEvent += OnDragEvent;
                 DragJointForearm dragMiddle = dragPoints[1].AddComponent<DragJointForearm>();
-                dragMiddle.Initialize(middle, leg, maid, () => middle[2].position, () => Vector3.zero);
-                dragMiddle.DragEvent += OnDragEvent;
+                dragMiddle.Initialize(middle, leg, meido, () => middle[2].position, () => Vector3.zero);
+                // dragMiddle.DragEvent += OnDragEvent;
                 DragJointHand dragLower = dragPoints[2].AddComponent<DragJointHand>();
-                dragLower.Initialize(lower, leg, maid, () => lower[2].position, () => Vector3.zero);
-                dragLower.DragEvent += OnDragEvent;
+                dragLower.Initialize(lower, leg, meido, () => lower[2].position, () => Vector3.zero);
+                // dragLower.DragEvent += OnDragEvent;
                 return dragPoints;
             };
 
@@ -260,7 +260,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             DragPoint[Bone.Cube] = MakeDragPoint(PrimitiveType.Cube, new Vector3(0.12f, 0.12f, 0.12f), transparentBlue2);
 
             DragPoint[Bone.Cube].AddComponent<DragBody>()
-                .Initialize(maid,
+                .Initialize(meido,
                     () => maid.transform.position,
                     () => maid.transform.eulerAngles
                 );
@@ -269,7 +269,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             DragPoint[Bone.Body] = MakeDragPoint(PrimitiveType.Capsule, new Vector3(0.2f, 0.3f, 0.24f), transparentBlue);
 
             DragBody dragBody = DragPoint[Bone.Body].AddComponent<DragBody>();
-            dragBody.Initialize(maid,
+            dragBody.Initialize(meido,
                 () => new Vector3(
                     (BoneTransform[Bone.Hip].position.x + BoneTransform[Bone.Spine0a].position.x) / 2f,
                     (BoneTransform[Bone.Spine1].position.y + BoneTransform[Bone.Spine0a].position.y) / 2f,
@@ -286,7 +286,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             // Head Dragpoint
             DragPoint[Bone.Head] = MakeDragPoint(PrimitiveType.Sphere, new Vector3(0.2f, 0.24f, 0.2f), transparentBlue);
             DragHead dragHead = DragPoint[Bone.Head].AddComponent<DragHead>();
-            dragHead.Initialize(BoneTransform[Bone.Neck], maid,
+            dragHead.Initialize(BoneTransform[Bone.Neck], meido,
                 () => new Vector3(
                     BoneTransform[Bone.Head].position.x,
                     (BoneTransform[Bone.Head].position.y * 1.2f + BoneTransform[Bone.HeadNub].position.y * 0.8f) / 2f,
@@ -295,7 +295,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 () => new Vector3(BoneTransform[Bone.Head].eulerAngles.x, BoneTransform[Bone.Head].eulerAngles.y, BoneTransform[Bone.Head].eulerAngles.z + 90f)
             );
             dragHead.Select += (s, a) => OnMeidoSelect(new MeidoChangeEventArgs(meido.ActiveSlot, true, false));
-            dragHead.DragEvent += OnDragEvent;
+            // dragHead.DragEvent += OnDragEvent;
 
             // Torso Dragpoint
             DragPoint[Bone.Torso] = MakeDragPoint(PrimitiveType.Capsule, new Vector3(0.2f, 0.19f, 0.24f), transparentBlue);
@@ -308,7 +308,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 BoneTransform[Bone.Spine]
             };
             DragTorso dragTorso = DragPoint[Bone.Torso].AddComponent<DragTorso>();
-            dragTorso.Initialize(maid, spineParts,
+            dragTorso.Initialize(spineParts, meido,
                 () => new Vector3(
                     spineTrans1.position.x,
                     (spineTrans2.position.y * 2f) / 2f,
@@ -320,14 +320,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     spineTrans1.eulerAngles.z + 90f
                 )
             );
-            dragTorso.DragEvent += OnDragEvent;
+            // dragTorso.DragEvent += OnDragEvent;
 
             // Pelvis Dragpoint
             DragPoint[Bone.Pelvis] = MakeDragPoint(PrimitiveType.Capsule, new Vector3(0.2f, 0.15f, 0.24f), transparentBlue);
             Transform pelvisTrans = BoneTransform[Bone.Pelvis];
             Transform spineTrans = BoneTransform[Bone.Spine];
             DragPelvis dragPelvis = DragPoint[Bone.Pelvis].AddComponent<DragPelvis>();
-            dragPelvis.Initialize(maid, BoneTransform[Bone.Pelvis],
+            dragPelvis.Initialize(BoneTransform[Bone.Pelvis], meido,
                 () => new Vector3(
                     pelvisTrans.position.x,
                     (pelvisTrans.position.y + spineTrans.position.y) / 2f,
@@ -339,7 +339,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     pelvisTrans.eulerAngles.z
                 )
             );
-            dragPelvis.DragEvent += OnDragEvent;
+            // dragPelvis.DragEvent += OnDragEvent;
 
             // Left Mune Dragpoint
             DragPoint[Bone.MuneL] = MakeDragPoint(PrimitiveType.Sphere, new Vector3(0.12f, 0.12f, 0.12f), transparentBlue);
@@ -349,11 +349,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 BoneTransform[Bone.MuneL],
                 BoneTransform[Bone.MuneSubL]
             };
-            dragMuneL.Initialize(muneIKChainL, maid,
+            dragMuneL.Initialize(muneIKChainL, meido,
                 () => (BoneTransform[Bone.MuneL].position + BoneTransform[Bone.MuneSubL].position) / 2f,
                 () => Vector3.zero
             );
-            dragMuneL.DragEvent += OnDragEvent;
+            // dragMuneL.DragEvent += OnDragEvent;
 
             // Right Mune Dragpoint
             DragPoint[Bone.MuneR] = MakeDragPoint(PrimitiveType.Sphere, new Vector3(0.12f, 0.12f, 0.12f), transparentBlue);
@@ -363,11 +363,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 BoneTransform[Bone.MuneR],
                 BoneTransform[Bone.MuneSubR]
             };
-            dragMuneR.Initialize(muneIKChainR, maid,
+            dragMuneR.Initialize(muneIKChainR, meido,
                 () => (BoneTransform[Bone.MuneR].position + BoneTransform[Bone.MuneSubR].position) / 2f,
                 () => Vector3.zero
             );
-            dragMuneR.DragEvent += OnDragEvent;
+            // dragMuneR.DragEvent += OnDragEvent;
 
             // Left Arm Dragpoint
             GameObject[] ikChainArmL = MakeIKChainDragPoint(
@@ -469,11 +469,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 Transform pos = BoneTransform[bone];
                 DragPoint[bone] = MakeDragPoint(PrimitiveType.Sphere, limbDragPointSize, transparentBlue);
                 DragSpine dragSpine = DragPoint[bone].AddComponent<DragSpine>();
-                dragSpine.Initialize(BoneTransform[bone], maid,
+                dragSpine.Initialize(BoneTransform[bone], meido,
                     () => pos.position,
                     () => Vector3.zero
                 );
-                dragSpine.DragEvent += OnDragEvent;
+                // dragSpine.DragEvent += OnDragEvent;
             }
 
             // Finger Dragpoints
@@ -491,8 +491,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     Func<Vector3> pos = () => BoneTransform[bone].position;
                     bool baseFinger = i == 0;
                     DragJointFinger dragJointFinger = DragPoint[bone].AddComponent<DragJointFinger>();
-                    dragJointFinger.Initialize(trans, baseFinger, maid, pos, () => Vector3.zero);
-                    dragJointFinger.DragEvent += OnDragEvent;
+                    dragJointFinger.Initialize(trans, baseFinger, meido, pos, () => Vector3.zero);
+                    // dragJointFinger.DragEvent += OnDragEvent;
                 }
             }
 
@@ -511,8 +511,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     Func<Vector3> pos = () => BoneTransform[bone].position;
                     bool baseFinger = i == 0;
                     DragJointFinger dragJointFinger = DragPoint[bone].AddComponent<DragJointFinger>();
-                    dragJointFinger.Initialize(trans, baseFinger, maid, pos, () => Vector3.zero);
-                    dragJointFinger.DragEvent += OnDragEvent;
+                    dragJointFinger.Initialize(trans, baseFinger, meido, pos, () => Vector3.zero);
+                    // dragJointFinger.DragEvent += OnDragEvent;
                 }
             }
 

+ 7 - 5
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/BaseDrag.cs

@@ -12,6 +12,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         protected const int upperArmRot = 0;
         protected const int handRot = 1;
         protected Maid maid;
+        protected Meido meido;
         protected Func<Vector3> position;
         protected Func<Vector3> rotation;
         protected Renderer dragPointRenderer;
@@ -58,16 +59,17 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             Scale
         }
 
-        public virtual void Initialize(Maid maid, Func<Vector3> position, Func<Vector3> rotation)
+        public virtual void Initialize(Meido meido, Func<Vector3> position, Func<Vector3> rotation)
         {
-            this.maid = maid;
+            this.meido = meido;
+            this.maid = meido.Maid;
             this.position = position;
             this.rotation = rotation;
             this.dragPointRenderer = GetComponent<Renderer>();
             this.dragPointCollider = GetComponent<Collider>();
             this.dragPointRenderer.enabled = true;
 
-            isPlaying = maid.GetAnimation().isPlaying;
+            isPlaying = !meido.IsStop;
         }
 
         protected void InitializeGizmo(GameObject target, float scale = 0.25f)
@@ -89,7 +91,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             worldPoint = Camera.main.WorldToScreenPoint(transform.position);
             mousePos = Input.mousePosition;
 
-            isPlaying = maid.GetAnimation().isPlaying;
+            isPlaying = !meido.IsStop;
         }
 
         protected virtual void DoubleClick() { }
@@ -125,7 +127,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 {
                     if (isPlaying && IsGizmoDrag)
                     {
-                        maid.GetAnimation().Stop();
+                        meido.IsStop = true;
                         isPlaying = false;
                     }
                 }

+ 3 - 7
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragHead.cs

@@ -14,9 +14,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private Vector3 mousePosOther;
         public event EventHandler Select;
 
-        public void Initialize(Transform head, Maid maid, Func<Vector3> posFunc, Func<Vector3> rotFunc)
+        public void Initialize(Transform head, Meido meido, Func<Vector3> posFunc, Func<Vector3> rotFunc)
         {
-            base.Initialize(maid, posFunc, rotFunc);
+            base.Initialize(meido, posFunc, rotFunc);
             this.head = head;
 
             // default eye rotations
@@ -80,11 +80,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             if (!(dragType == DragType.MoveXZ || dragType == DragType.MoveY))
             {
-                if (isPlaying)
-                {
-                    maid.GetAnimation().Stop();
-                    OnDragEvent();
-                }
+                if (isPlaying) meido.IsStop = true;
             }
 
             Vector3 pos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z);

+ 3 - 7
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragJointFinger.cs

@@ -13,9 +13,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private Vector3 off2;
         private bool baseFinger;
 
-        public void Initialize(Transform[] ikChain, bool baseFinger, Maid maid, Func<Vector3> position, Func<Vector3> rotation)
+        public void Initialize(Transform[] ikChain, bool baseFinger, Meido meido, Func<Vector3> position, Func<Vector3> rotation)
         {
-            base.Initialize(maid, position, rotation);
+            base.Initialize(meido, position, rotation);
             this.ikChain = ikChain;
             this.baseFinger = baseFinger;
 
@@ -67,11 +67,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         protected override void Drag()
         {
-            if (isPlaying)
-            {
-                maid.GetAnimation().Stop();
-                OnDragEvent();
-            }
+            if (isPlaying) meido.IsStop = true;
 
             IKCtrlData ikData = maid.body0.IKCtrl.GetIKData("左手");
             Vector3 pos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z)) + off - off2;

+ 3 - 7
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragJointForearm.cs

@@ -13,9 +13,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private Vector3 off2;
         private bool knee = false;
 
-        public void Initialize(Transform[] ikChain, bool knee, Maid maid, Func<Vector3> position, Func<Vector3> rotation)
+        public void Initialize(Transform[] ikChain, bool knee, Meido meido, Func<Vector3> position, Func<Vector3> rotation)
         {
-            base.Initialize(maid, position, rotation);
+            base.Initialize(meido, position, rotation);
             this.ikChain = ikChain;
             this.knee = knee;
 
@@ -65,11 +65,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         protected override void Drag()
         {
-            if (isPlaying)
-            {
-                maid.GetAnimation().Stop();
-                OnDragEvent();
-            }
+            if (isPlaying) meido.IsStop = true;
 
             IKCtrlData ikData = maid.body0.IKCtrl.GetIKData("左手");
             Vector3 pos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z)) + off - off2;

+ 3 - 7
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragJointHand.cs

@@ -14,9 +14,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private Vector3 off2;
         private int foot = 1;
 
-        public void Initialize(Transform[] ikChain, bool foot, Maid maid, Func<Vector3> position, Func<Vector3> rotation)
+        public void Initialize(Transform[] ikChain, bool foot, Meido meido, Func<Vector3> position, Func<Vector3> rotation)
         {
-            base.Initialize(maid, position, rotation);
+            base.Initialize(meido, position, rotation);
             this.ikChain = ikChain;
             this.foot = foot ? -1 : 1;
             this.ikChainLock = new Transform[3] {
@@ -84,11 +84,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         protected override void Drag()
         {
-            if (isPlaying)
-            {
-                maid.GetAnimation().Stop();
-                OnDragEvent();
-            }
+            if (isPlaying) meido.IsStop = true;
 
             IKCtrlData ikData = maid.body0.IKCtrl.GetIKData("左手");
             Vector3 pos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z)) + off - off2;

+ 5 - 19
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragMune.cs

@@ -12,9 +12,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private Vector3 off;
         private Vector3 off2;
 
-        public void Initialize(Transform[] ikChain, Maid maid, Func<Vector3> position, Func<Vector3> rotation)
+        public void Initialize(Transform[] ikChain, Meido meido, Func<Vector3> position, Func<Vector3> rotation)
         {
-            base.Initialize(maid, position, rotation);
+            base.Initialize(meido, position, rotation);
             this.ikChain = ikChain;
 
             for (int i = 0; i < things.Length; i++)
@@ -46,13 +46,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         protected override void DoubleClick()
         {
-            if (dragType == DragType.RotLocalXZ)
-            {
-                maid.body0.MuneYureL(1f);
-                maid.body0.MuneYureR(1f);
-                maid.body0.jbMuneL.enabled = true;
-                maid.body0.jbMuneR.enabled = true;
-            }
+            if (dragType == DragType.RotLocalXZ) meido.SetMune();
         }
 
         protected override void InitializeDrag()
@@ -67,22 +61,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             jointRotation[upperArmRot] = ikChain[upperArm].localEulerAngles;
             jointRotation[handRot] = ikChain[hand].localEulerAngles;
-            maid.body0.MuneYureL(0f);
-            maid.body0.MuneYureR(0f);
-            maid.body0.jbMuneL.enabled = false;
-            maid.body0.jbMuneR.enabled = false;
+            meido.SetMune(true);
         }
 
         protected override void Drag()
         {
             if (dragType == DragType.None) return;
 
-            if (isPlaying)
-            {
-                maid.GetAnimation().Stop();
-                OnDragEvent();
-            }
-
+            if (isPlaying) meido.IsStop = true;
             IKCtrlData ikData = maid.body0.IKCtrl.GetIKData("左手");
             Vector3 pos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z)) + off - off2;
 

+ 3 - 7
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPelvis.cs

@@ -8,9 +8,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private Transform pelvis;
         private Vector3 pelvisRotation;
 
-        public void Initialize(Maid maid, Transform pelvis, Func<Vector3> position, Func<Vector3> rotation)
+        public void Initialize(Transform pelvis, Meido meido, Func<Vector3> position, Func<Vector3> rotation)
         {
-            base.Initialize(maid, position, rotation);
+            base.Initialize(meido, position, rotation);
             this.pelvis = pelvis;
         }
 
@@ -37,11 +37,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (dragType == DragType.None) return;
 
-            if (isPlaying)
-            {
-                maid.GetAnimation().Stop();
-                OnDragEvent();
-            }
+            if (isPlaying) meido.IsStop = true;
 
             Vector3 pos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z);
             Vector3 vec31 = Input.mousePosition - mousePos;

+ 3 - 7
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragSpine.cs

@@ -8,9 +8,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private Transform spine;
         private Vector3 rotate;
 
-        public void Initialize(Transform spine, Maid maid, Func<Vector3> position, Func<Vector3> rotation)
+        public void Initialize(Transform spine, Meido meido, Func<Vector3> position, Func<Vector3> rotation)
         {
-            base.Initialize(maid, position, rotation);
+            base.Initialize(meido, position, rotation);
             this.spine = spine;
 
             InitializeGizmo(this.spine);
@@ -29,11 +29,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         protected override void Drag()
         {
-            if (isPlaying)
-            {
-                maid.GetAnimation().Stop();
-                OnDragEvent();
-            }
+            if (isPlaying) meido.IsStop = true;
 
             if (dragType == DragType.None)
             {

+ 3 - 7
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragTorso.cs

@@ -8,9 +8,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private Transform[] spine;
         private Vector3[] spineRotation = new Vector3[4];
 
-        public void Initialize(Maid maid, Transform[] spine, Func<Vector3> position, Func<Vector3> rotation)
+        public void Initialize(Transform[] spine, Meido meido, Func<Vector3> position, Func<Vector3> rotation)
         {
-            base.Initialize(maid, position, rotation);
+            base.Initialize(meido, position, rotation);
             this.spine = spine;
         }
 
@@ -41,11 +41,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (dragType == DragType.None) return;
 
-            if (isPlaying)
-            {
-                maid.GetAnimation().Stop();
-                OnDragEvent();
-            }
+            if (isPlaying) meido.IsStop = true;
 
             Vector3 pos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z);
             Vector3 vec31 = Input.mousePosition - mousePos;

+ 15 - 25
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/Meido.cs

@@ -30,15 +30,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => this.isIK;
             private set => this.isIK = value;
         }
-        private bool isStop = false;
         public bool IsStop
         {
-            get => isStop;
+            get => !Maid.GetAnimation().isPlaying;
             set
             {
-                isStop = value;
+                if (!value) this.SetPose(this.poseInfo.PoseName);
+                else Maid.GetAnimation().Stop();
                 this.AnimeChange?.Invoke(this, EventArgs.Empty);
-                if (!isStop) this.SetPose(this.poseInfo.PoseName);
             }
         }
         public bool IsBone { get; set; } = false;
@@ -187,16 +186,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 Maid.GetAnimation()[pose].speed = 0f;
             }
 
-            if (pose.Contains("_momi") || pose.Contains("paizuri_"))
-            {
-                Maid.body0.MuneYureL(0f);
-                Maid.body0.MuneYureR(0f);
-            }
-            else
-            {
-                Maid.body0.MuneYureL(1f);
-                Maid.body0.MuneYureR(1f);
-            }
+            SetMune();
         }
 
         public void SetPoseCustom(string path)
@@ -206,8 +196,17 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             string hash = Path.GetFileName(path).GetHashCode().ToString();
             Maid.body0.CrossFade(hash, bytes, false, true, false, 0f);
             Maid.SetAutoTwistAll(true);
-            Maid.body0.MuneYureL(1f);
-            Maid.body0.MuneYureR(1f);
+            SetMune();
+        }
+
+        public void SetMune(bool drag = false)
+        {
+            bool isMomiOrPaizuri = poseInfo.PoseName.Contains("_momi") || poseInfo.PoseName.Contains("paizuri_");
+            float onL = (drag || isMomiOrPaizuri) ? 0f : 1f;
+            Maid.body0.MuneYureL(onL);
+            Maid.body0.MuneYureR(onL);
+            Maid.body0.jbMuneL.enabled = !drag;
+            Maid.body0.jbMuneR.enabled = !drag;
         }
 
         public void SetFaceBlend(string blendValue)
@@ -279,15 +278,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             }
         }
 
-        public void IKRelease()
-        {
-            if (!Maid.GetAnimation().isPlaying)
-            {
-                this.IsStop = false;
-                this.SetPose(this.poseInfo.PoseName);
-            }
-        }
-
         private void OnBodyLoad()
         {
             BodyLoad?.Invoke(this, EventArgs.Empty);