Browse Source

Hide more dragpoints when taking screenshot

habeebweeb 4 năm trước cách đây
mục cha
commit
885aee1ea4

+ 24 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/LightManager.cs

@@ -8,6 +8,20 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class LightManager : IManager, ISerializable
     {
         public const string header = "LIGHT";
+        private static bool cubeActive = true;
+        public static bool CubeActive
+        {
+            get => cubeActive;
+            set
+            {
+                if (value != cubeActive)
+                {
+                    cubeActive = value;
+                    CubeActiveChange?.Invoke(null, EventArgs.Empty);
+                }
+            }
+        }
+        private static event EventHandler CubeActiveChange;
         private List<DragPointLight> lightList = new List<DragPointLight>();
         private int selectedLightIndex = 0;
         public int SelectedLightIndex
@@ -32,7 +46,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public event EventHandler Scale;
         public event EventHandler ListModified;
         public event EventHandler Select;
-        // TODO: enabling and disabling gizmos for a variety of dragpoints
 
         public void Serialize(System.IO.BinaryWriter binaryWriter)
         {
@@ -60,6 +73,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             GameMain.Instance.MainCamera.GetComponent<Camera>().backgroundColor = Color.black;
             AddLight(GameMain.Instance.MainLight.gameObject, true);
+            CubeActiveChange += OnCubeActive;
         }
 
         public void Deactivate()
@@ -76,6 +90,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             Light mainLight = GameMain.Instance.MainLight.GetComponent<Light>();
             mainLight.type = LightType.Directional;
             DragPointLight.SetLightProperties(mainLight, new LightProperty());
+            CubeActiveChange -= OnCubeActive;
         }
 
         public void Update() { }
@@ -198,5 +213,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             ListModified?.Invoke(this, EventArgs.Empty);
         }
+
+        private void OnCubeActive(object sender, EventArgs args)
+        {
+            foreach (DragPointLight dragPoint in lightList)
+            {
+                dragPoint.gameObject.SetActive(CubeActive);
+            }
+        }
     }
 }

+ 9 - 4
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/PropManager.cs

@@ -163,12 +163,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public void Activate()
         {
             CubeSmallChange += OnCubeSmall;
+            CubeActiveChange += OnCubeActive;
         }
 
         public void Deactivate()
         {
             ClearDogu();
             CubeSmallChange -= OnCubeSmall;
+            CubeActiveChange -= OnCubeActive;
         }
 
         public void Update() { }
@@ -545,14 +547,17 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             }
         }
 
-        private void OnDoguListChange()
+        private void OnCubeActive(object sender, EventArgs args)
         {
-            this.DoguListChange?.Invoke(this, EventArgs.Empty);
+            foreach (DragPointDogu dragPoint in doguList)
+            {
+                dragPoint.gameObject.SetActive(CubeActive);
+            }
         }
 
-        public void SaveConfiguration()
+        private void OnDoguListChange()
         {
-
+            this.DoguListChange?.Invoke(this, EventArgs.Empty);
         }
     }
 }

+ 0 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointChain.cs

@@ -39,7 +39,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         protected override void ApplyDragType()
         {
-            // TODO: All the dragpoints
             DragType current = CurrentDragType;
             bool isBone = IsBone;
             if (CurrentDragType == DragType.Ignore) ApplyProperties();

+ 17 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MeidoPhotoStudio.cs

@@ -245,8 +245,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             sysShortcut.SetActive(false);
             uiActive = false;
 
-            // TODO: Hide cubes for bg, maid, lights etc.
-
             List<Meido> activeMeidoList = this.meidoManager.ActiveMeidoList;
             bool[] isIK = new bool[activeMeidoList.Count];
             bool[] isVisible = new bool[activeMeidoList.Count];
@@ -259,6 +257,18 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 if (args.HideMaids) meido.Maid.Visible = false;
             }
 
+            bool[] isCubeActive = {
+                MeidoDragPointManager.CubeActive,
+                PropManager.CubeActive,
+                LightManager.CubeActive,
+                EnvironmentManager.CubeActive
+            };
+
+            MeidoDragPointManager.CubeActive = false;
+            PropManager.CubeActive = false;
+            LightManager.CubeActive = false;
+            EnvironmentManager.CubeActive = false;
+
             GizmoRender.UIVisible = false;
 
             yield return new WaitForEndOfFrame();
@@ -292,6 +302,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 if (args.HideMaids && isVisible[i]) meido.Maid.Visible = true;
             }
 
+            MeidoDragPointManager.CubeActive = isCubeActive[0];
+            PropManager.CubeActive = isCubeActive[1];
+            LightManager.CubeActive = isCubeActive[2];
+            EnvironmentManager.CubeActive = isCubeActive[3];
+
             GizmoRender.UIVisible = true;
         }