Selaa lähdekoodia

Revert "Update readme changelog"

This reverts commit 87274d535ed8a02ebfe0217ab564ecf410f0173d.
habeebweeb 2 vuotta sitten
vanhempi
commit
4e23438ee1

+ 0 - 4
Documentation/readme.adoc

@@ -275,10 +275,6 @@ longer offset from maid body.
 * Fix message box and text disappearing after leaving edit mode
 * Fix background switcher breaking when `MyRoom` directory is missing from game root
 * Fix blur effect not turning off properly
-* Fix issue where loading a scene that uses a non-existent pose breaks the pose selector
-* Fix MPS naively restoring edit mode's OK button's original functionality
-** Other plugins may have hooked onto the OK button and MPS restoring original functionality effectively removes those
-hooks
 
 === {pluginname}.1.0.0-beta.4
 

+ 1 - 1
src/MeidoPhotoStudio.Converter/MeidoPhotoStudio.Converter.csproj

@@ -1,8 +1,8 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFramework>net35</TargetFramework>
+    <FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
     <ProjectGuid>{19D28B0C-3537-4FEE-B7B3-1ABF70B16D5E}</ProjectGuid>
-    <LangVersion>latest</LangVersion>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="..\..\lib\Assembly-CSharp.dll" />

+ 4 - 5
src/MeidoPhotoStudio.Plugin/DragPoint/DragPoint.cs

@@ -14,7 +14,7 @@ namespace MeidoPhotoStudio.Plugin
         private Func<Vector3> rotation;
         private Collider collider;
         private Renderer renderer;
-        protected bool ReinitializeDrag { get; private set; }
+        private bool reinitializeDrag;
         protected bool Transforming => CurrentDragType >= DragType.MoveXZ;
         protected bool Special => CurrentDragType == DragType.Select || CurrentDragType == DragType.Delete;
         protected bool Moving => CurrentDragType == DragType.MoveXZ || CurrentDragType == DragType.MoveY;
@@ -72,7 +72,7 @@ namespace MeidoPhotoStudio.Plugin
                 if (value != oldDragType)
                 {
                     currentDragType = value;
-                    ReinitializeDrag = true;
+                    reinitializeDrag = true;
                     oldDragType = currentDragType;
                     ApplyDragType();
                 }
@@ -210,10 +210,9 @@ namespace MeidoPhotoStudio.Plugin
 
         protected virtual void OnMouseDrag()
         {
-            if (ReinitializeDrag)
+            if (reinitializeDrag)
             {
-                // NOTE: Order matters here.
-                ReinitializeDrag = false;
+                reinitializeDrag = false;
                 OnMouseDown();
             }
 

+ 10 - 13
src/MeidoPhotoStudio.Plugin/DragPoint/DragPointGeneral.cs

@@ -91,19 +91,16 @@ namespace MeidoPhotoStudio.Plugin
 
         protected override void OnMouseDown()
         {
-            if (!ReinitializeDrag)
-            {
-                if (Deleting)
-                {
-                    OnDelete();
-                    return;
-                }
-
-                if (Selecting)
-                {
-                    OnSelect();
-                    return;
-                }
+            if (Deleting)
+            {
+                OnDelete();
+                return;
+            }
+
+            if (Selecting)
+            {
+                OnSelect();
+                return;
             }
 
             base.OnMouseDown();

+ 1 - 2
src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointHead.cs

@@ -51,8 +51,7 @@ namespace MeidoPhotoStudio.Plugin
         {
             base.OnMouseDown();
 
-            if (Selecting && !ReinitializeDrag)
-                Select?.Invoke(this, EventArgs.Empty);
+            if (CurrentDragType == DragType.Select) Select?.Invoke(this, EventArgs.Empty);
 
             headRotation = MyObject.rotation;
 

+ 33 - 40
src/MeidoPhotoStudio.Plugin/Meido/Meido.cs

@@ -120,7 +120,7 @@ namespace MeidoPhotoStudio.Plugin
                 {
                     Body.boEyeToCam = true;
                     Body.boHeadToCam = true;
-                    SetPose(CachedPose);
+                    SetPose(CachedPose.Pose);
                 }
 
                 OnUpdateMeido();
@@ -337,7 +337,7 @@ namespace MeidoPhotoStudio.Plugin
             Maid.Visible = false;
 
             IKManager.Destroy();
-
+            
             Active = false;
         }
 
@@ -359,24 +359,26 @@ namespace MeidoPhotoStudio.Plugin
 
         public void SetPose(PoseInfo poseInfo)
         {
-            if (!Body.isLoadedBody)
-                return;
+            CachedPose = poseInfo;
+            SetPose(poseInfo.Pose);
+        }
+
+        public void SetPose(string pose)
+        {
+            if (!Body.isLoadedBody) return;
 
-            if (poseInfo.CustomPose)
+            if (pose.StartsWith(Constants.customPosePath))
             {
+                string poseFilename = Path.GetFileNameWithoutExtension(pose);
                 try
                 {
-                    var poseData = File.ReadAllBytes(poseInfo.Pose);
-                    var poseHash = Path.GetFileName(poseInfo.Pose).GetHashCode().ToString();
-
-                    Body.CrossFade(poseHash, poseData, loop: true, fade: 0f);
-
-                    SetMune(true, true);
-                    SetMune(true);
+                    byte[] poseBuffer = File.ReadAllBytes(pose);
+                    string hash = Path.GetFileName(pose).GetHashCode().ToString();
+                    Body.CrossFade(hash, poseBuffer, loop: true, fade: 0f);
                 }
-                catch (IOException ioException)
+                catch (Exception e) when (e is DirectoryNotFoundException || e is FileNotFoundException)
                 {
-                    Utility.LogWarning($"Could not open {poseInfo.Pose} because {ioException.Message}");
+                    Utility.LogWarning($"{poseFilename}: Could not open because {e.Message}");
                     Constants.InitializeCustomPoses();
                     SetPose(PoseInfo.DefaultPose);
                     OnUpdateMeido();
@@ -384,47 +386,31 @@ namespace MeidoPhotoStudio.Plugin
                 }
                 catch (Exception e)
                 {
-                    Utility.LogWarning($"Could not apply pose {poseInfo.Pose} because {e.Message}");
+                    Utility.LogWarning($"{poseFilename}: Could not apply pose because {e.Message}");
                     SetPose(PoseInfo.DefaultPose);
                     OnUpdateMeido();
                     return;
                 }
+                SetMune(true, left: true);
+                SetMune(true, left: false);
             }
             else
             {
-                const int poseName = 0;
-                const int poseTime = 1;
-                const char componentSeparator = ',';
-
-                var poseComponents = poseInfo.Pose.Split(componentSeparator);
-
-                var poseFilename = poseComponents[poseName] + ".anm";
+                string[] poseComponents = pose.Split(',');
+                pose = poseComponents[0] + ".anm";
 
-                var animeTag = Maid.CrossFade(poseFilename, loop: true, val: 0f);
-
-                if (string.IsNullOrEmpty(animeTag))
-                    return;
-
-                var animation = Maid.GetAnimation();
-                animation.Play();
+                Maid.CrossFade(pose, loop: true, val: 0f);
+                Maid.GetAnimation().Play();
 
                 if (poseComponents.Length > 1)
                 {
-                    if (float.TryParse(poseComponents[poseTime], out var animationTime))
-                    {
-                        animation[animeTag].time = animationTime;
-                        animation[animeTag].speed = 0f;
-                    }
+                    Maid.GetAnimation()[pose].time = float.Parse(poseComponents[1]);
+                    Maid.GetAnimation()[pose].speed = 0f;
                 }
-
-                var momiOrPaizuri = CachedPose.Pose.Contains("_momi") || CachedPose.Pose.Contains("paizuri_");
-                SetMune(!momiOrPaizuri, true);
-                SetMune(!momiOrPaizuri);
+                SetPoseMune();
             }
 
             Maid.SetAutoTwistAll(true);
-
-            CachedPose = poseInfo;
         }
 
         public KeyValuePair<bool, bool> SetFrameBinary(byte[] poseBuffer)
@@ -453,6 +439,13 @@ namespace MeidoPhotoStudio.Plugin
             }
         }
 
+        private void SetPoseMune()
+        {
+            bool momiOrPaizuri = CachedPose.Pose.Contains("_momi") || CachedPose.Pose.Contains("paizuri_");
+            SetMune(!momiOrPaizuri, left: true);
+            SetMune(!momiOrPaizuri, left: false);
+        }
+
         public void SetHandPreset(string filename, bool right)
         {
             string faceFilename = Path.GetFileNameWithoutExtension(filename);