Kaynağa Gözat

Revamp Prop spawner GUI and manager and add items

Menu file props can be loaded now as per adding hand items
Backgrounds can be spawned now
Prop spawner is moved to the BG2 tab and is categorized
habeebweeb 4 yıl önce
ebeveyn
işleme
cc4afee44f

+ 185 - 82
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Constants.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
@@ -31,13 +32,27 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public static readonly List<string> PoseGroupList;
         public static readonly Dictionary<string, List<string>> PoseDict;
         public static readonly Dictionary<string, List<KeyValuePair<string, string>>> CustomPoseDict;
-        public static int CustomPoseGroupsIndex { get; private set; } = -1;
-        public static int MyRoomCustomBGIndex { get; private set; } = -1;
         public static readonly List<string> FaceBlendList;
         public static readonly List<string> BGList;
         public static readonly List<KeyValuePair<string, string>> MyRoomCustomBGList;
-        public static readonly List<string> DoguList;
-        public static readonly List<string> OtherDoguList;
+        public static event EventHandler<MenuFilesEventArgs> MenuFilesChange;
+        public static int CustomPoseGroupsIndex { get; private set; } = -1;
+        public static int MyRoomCustomBGIndex { get; private set; } = -1;
+        public static List<string> doguCategories { get; private set; }
+        public static readonly Dictionary<string, List<string>> DoguDict;
+        public enum DoguCategory
+        {
+            Other, Mob, Desk, HandItem, BGSmall
+        }
+        public static readonly Dictionary<DoguCategory, string> customDoguCategories =
+            new Dictionary<DoguCategory, string>()
+            {
+                [DoguCategory.Other] = "other",
+                [DoguCategory.Mob] = "mob",
+                [DoguCategory.Desk] = "desk",
+                [DoguCategory.HandItem] = "handItem",
+                [DoguCategory.BGSmall] = "bgSmall"
+            };
 
         static Constants()
         {
@@ -63,8 +78,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             BGList = new List<string>();
             MyRoomCustomBGList = new List<KeyValuePair<string, string>>();
-            DoguList = new List<string>();
-            OtherDoguList = new List<string>();
+            // DoguList = new List<string>();
+            // OtherDoguList = new List<string>();
+            DoguDict = new Dictionary<string, List<string>>();
         }
 
         public static void Initialize()
@@ -225,14 +241,95 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public static void InitializeDogu()
         {
+            foreach (string customCategory in customDoguCategories.Values)
+            {
+                DoguDict[customCategory] = new List<string>();
+            }
+
             InitializeDeskItems();
             InitializePhotoBGItems();
-            // InitializeHandItems();
+            InitializeOtherDogu();
+
+            if (MenuFileUtility.MenuFilesReady) InitializeHandItems();
+            else MenuFileUtility.MenuFilesReadyChange += (s, a) => InitializeHandItems();
+
+            doguCategories = new List<string>();
+
+            foreach (KeyValuePair<string, UnityEngine.Object> keyValuePair in PhotoBGObjectData.popup_category_list)
+            {
+                string category = keyValuePair.Key;
+                if (category == "マイオブジェクト") continue;
+                doguCategories.Add(keyValuePair.Key);
+            }
+
+            foreach (DoguCategory category in Enum.GetValues(typeof(DoguCategory)))
+            {
+                doguCategories.Add(customDoguCategories[category]);
+            }
+        }
+
+        private static void InitializeOtherDogu()
+        {
+            DoguDict[customDoguCategories[DoguCategory.BGSmall]] = BGList;
+
+            DoguDict[customDoguCategories[DoguCategory.Mob]].AddRange(new[] {
+                "Mob_Man_Stand001", "Mob_Man_Stand002", "Mob_Man_Stand003", "Mob_Man_Sit001", "Mob_Man_Sit002",
+                "Mob_Man_Sit003", "Mob_Girl_Stand001", "Mob_Girl_Stand002", "Mob_Girl_Stand003", "Mob_Girl_Sit001",
+                "Mob_Girl_Sit002", "Mob_Girl_Sit003", "Salon:65", "Salon:63", "Salon:69"
+            });
+
+            List<string> DoguList = DoguDict[customDoguCategories[DoguCategory.Other]];
+
+            string ignoreListPath = Path.Combine(configPath, "mm_ignore_list.json");
+            string ignoreListJson = File.ReadAllText(ignoreListPath);
+            string[] ignoreList = JsonConvert.DeserializeObject<IEnumerable<string>>(ignoreListJson).ToArray();
+
+            // bg object extend
+            HashSet<string> doguHashSet = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
+
+            doguHashSet.UnionWith(BGList);
+            doguHashSet.UnionWith(ignoreList);
+            foreach (KeyValuePair<string, List<string>> keyValuePair in DoguDict)
+            {
+                doguHashSet.UnionWith(keyValuePair.Value);
+            }
+
+            string[] com3d2BgList = GameUty.FileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
+            foreach (string path in com3d2BgList)
+            {
+                if (Path.GetExtension(path) == ".asset_bg" && !path.Contains("myroomcustomize"))
+                {
+                    string file = Path.GetFileNameWithoutExtension(path);
+                    if (!doguHashSet.Contains(file) && !file.EndsWith("_hit"))
+                    {
+                        DoguList.Add(file);
+                        doguHashSet.Add(file);
+                    }
+                }
+            }
+
+            // Get cherry picked dogu that I can't find in the game files
+            string doguExtendPath = Path.Combine(configPath, "mm_dogu_extend.json");
+            string doguExtendJson = File.ReadAllText(doguExtendPath);
+
+            DoguList.AddRange(JsonConvert.DeserializeObject<IEnumerable<string>>(doguExtendJson));
+
+            string[] cm3d2BgList = GameUty.FileSystemOld.GetList("bg", AFileSystemBase.ListType.AllFile);
+            foreach (string path in cm3d2BgList)
+            {
+                if (Path.GetExtension(path) == ".asset_bg")
+                {
+                    string file = Path.GetFileNameWithoutExtension(path);
+                    if (!doguHashSet.Contains(file) && !file.EndsWith("_not_optimisation"))
+                    {
+                        DoguList.Add(file);
+                    }
+                }
+            }
         }
 
         private static void InitializeDeskItems()
         {
-            // enabled id
             HashSet<int> enabledIDs = new HashSet<int>();
             CsvCommonIdManager.ReadEnabledIdList(
                 CsvCommonIdManager.FileSystemType.Normal, true, "desk_item_enabled_id", ref enabledIDs
@@ -241,11 +338,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 CsvCommonIdManager.FileSystemType.Old, true, "desk_item_enabled_id", ref enabledIDs
             );
 
-            List<string> com3d2DeskDogu = new List<string>(new[] {
-                "Mob_Man_Stand001", "Mob_Man_Stand002", "Mob_Man_Stand003", "Mob_Man_Sit001", "Mob_Man_Sit002",
-                "Mob_Man_Sit003", "Mob_Girl_Stand001", "Mob_Girl_Stand002", "Mob_Girl_Stand003", "Mob_Girl_Sit001",
-                "Mob_Girl_Sit002", "Mob_Girl_Sit003", "Salon:65", "Salon:63", "Salon:69"
-            });
+            List<string> com3d2DeskDogu = DoguDict[customDoguCategories[DoguCategory.Desk]];
 
             Action<AFileSystemBase> GetDeskItems = fs =>
             {
@@ -279,9 +372,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             };
 
             GetDeskItems(GameUty.FileSystem);
-            // GetDeskItems(GameUty.FileSystemOld);
-
-            OtherDoguList.AddRange(com3d2DeskDogu);
         }
 
         private static void InitializePhotoBGItems()
@@ -289,104 +379,96 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             PhotoBGObjectData.Create();
             List<PhotoBGObjectData> photoBGObjectList = PhotoBGObjectData.data;
 
-            List<string> particleList = new List<string>();
+            List<string> doguCategories = new List<string>();
+            HashSet<string> addedCategories = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
 
-            List<string> doguPrefabList = new List<string>();
-            List<string> doguAssetList = new List<string>();
-            List<string> directFileList = new List<string>();
-
-            foreach (PhotoBGObjectData photoBgObject in photoBGObjectList)
+            foreach (PhotoBGObjectData photoBGObject in photoBGObjectList)
             {
-                if (!string.IsNullOrEmpty(photoBgObject.create_prefab_name))
+                string category = photoBGObject.category;
+
+                if (!addedCategories.Contains(category))
+                {
+                    addedCategories.Add(category);
+                    doguCategories.Add(category);
+                }
+
+                if (!DoguDict.ContainsKey(category))
                 {
-                    List<string> list = photoBgObject.category == "パーティクル"
-                        ? particleList
-                        : doguPrefabList;
-                    list.Add(photoBgObject.create_prefab_name);
+                    DoguDict[category] = new List<string>();
                 }
-                else if (!string.IsNullOrEmpty(photoBgObject.create_asset_bundle_name))
+
+                string dogu = String.Empty;
+                if (!string.IsNullOrEmpty(photoBGObject.create_prefab_name))
                 {
-                    doguAssetList.Add(photoBgObject.create_asset_bundle_name);
+                    dogu = photoBGObject.create_prefab_name;
                 }
-                else if (!string.IsNullOrEmpty(photoBgObject.direct_file))
+                else if (!string.IsNullOrEmpty(photoBGObject.create_asset_bundle_name))
                 {
-                    directFileList.Add(photoBgObject.direct_file);
+                    dogu = photoBGObject.create_asset_bundle_name;
+                }
+                else if (!string.IsNullOrEmpty(photoBGObject.direct_file))
+                {
+                    dogu = photoBGObject.direct_file;
+                }
+
+                if (!string.IsNullOrEmpty(dogu))
+                {
+                    DoguDict[category].Add(dogu);
                 }
             }
 
-            OtherDoguList.AddRange(new[] {
+            DoguDict["パーティクル"].AddRange(new[] {
                 "Particle/pLineY", "Particle/pLineP02", "Particle/pHeart01",
                 "Particle/pLine_act2", "Particle/pstarY_act2"
             });
+        }
 
-            OtherDoguList.AddRange(particleList);
-
-            DoguList.AddRange(doguPrefabList);
-            DoguList.AddRange(doguAssetList);
-            DoguList.AddRange(directFileList);
+        private static void InitializeHandItems()
+        {
+            MenuDataBase menuDataBase = GameMain.Instance.MenuDataBase;
 
             string ignoreListPath = Path.Combine(configPath, "mm_ignore_list.json");
             string ignoreListJson = File.ReadAllText(ignoreListPath);
             string[] ignoreList = JsonConvert.DeserializeObject<IEnumerable<string>>(ignoreListJson).ToArray();
 
-            // bg object extend
             HashSet<string> doguHashSet = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
-            foreach (string bg in BGList)
-            {
-                doguHashSet.Add(bg);
-            }
-            foreach (string bg in ignoreList)
-            {
-                doguHashSet.Add(bg);
-            }
-            foreach (string dogu in DoguList)
-            {
-                doguHashSet.Add(dogu);
-            }
-            foreach (string dogu in OtherDoguList)
-            {
-                doguHashSet.Add(dogu);
-            }
 
-            string[] com3d2BgList = GameUty.FileSystem.GetList("bg", AFileSystemBase.ListType.AllFile);
-            foreach (string path in com3d2BgList)
+            doguHashSet.UnionWith(BGList);
+            doguHashSet.UnionWith(ignoreList);
+            foreach (KeyValuePair<string, List<string>> keyValuePair in DoguDict)
             {
-                if (Path.GetExtension(path) == ".asset_bg" && !path.Contains("myroomcustomize"))
-                {
-                    string file = Path.GetFileNameWithoutExtension(path);
-                    if (!doguHashSet.Contains(file) && !file.EndsWith("_hit"))
-                    {
-                        DoguList.Add(file);
-                        doguHashSet.Add(file);
-                    }
-                }
+                doguHashSet.UnionWith(keyValuePair.Value);
             }
 
-            // Get cherry picked dogu that I can't find in the game files
-            string doguExtendPath = Path.Combine(configPath, "mm_dogu_extend.json");
-            string doguExtendJson = File.ReadAllText(doguExtendPath);
-
-            DoguList.AddRange(JsonConvert.DeserializeObject<IEnumerable<string>>(doguExtendJson));
+            string category = customDoguCategories[DoguCategory.HandItem];
 
-            string[] cm3d2BgList = GameUty.FileSystemOld.GetList("bg", AFileSystemBase.ListType.AllFile);
-            foreach (string path in cm3d2BgList)
+            for (int i = 0; i < menuDataBase.GetDataSize(); i++)
             {
-                if (Path.GetExtension(path) == ".asset_bg")
+                menuDataBase.SetIndex(i);
+                MPN mpn = (MPN)menuDataBase.GetCategoryMpn();
+                if (mpn == MPN.handitem)
                 {
-                    string file = Path.GetFileNameWithoutExtension(path);
-                    if (!doguHashSet.Contains(file) && !file.EndsWith("_not_optimisation"))
+                    string menuFileName = menuDataBase.GetMenuFileName();
+                    if (menuDataBase.GetBoDelOnly() || menuFileName.EndsWith("_del.menu")) continue;
+
+                    string handItemAsOdogu = Utility.HandItemToOdogu(menuFileName);
+                    string isolatedHandItem = menuFileName.Substring(menuFileName.IndexOf('_') + 1);
+
+                    if (!doguHashSet.Contains(handItemAsOdogu) && !doguHashSet.Contains(isolatedHandItem))
                     {
-                        DoguList.Add(file);
+                        doguHashSet.Add(isolatedHandItem);
+                        DoguDict[category].Add(menuFileName);
+
+                        // Check for a half deck of cards to add the full deck as well
+                        if (menuFileName == "handitemd_cards_i_.menu")
+                        {
+                            DoguDict[category].Add("handiteml_cards_i_.menu");
+                        }
                     }
                 }
             }
-        }
 
-        private static void InitializeHandItems()
-        {
-            List<string> handItems = new List<string>(
-                GameUty.MenuFiles.Where(menu => menu.StartsWith("handiteml") || menu.StartsWith("handitemr"))
-            );
+            OnMenuFilesChange(MenuFilesEventArgs.HandItems);
         }
 
         private static CsvParser OpenCsvParser(string nei, AFileSystemBase fs)
@@ -416,10 +498,31 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             File.WriteAllLines(Path.Combine(configPath, name), list.ToArray());
         }
 
+        private static void OnMenuFilesChange(MenuFilesEventArgs args)
+        {
+            MenuFilesChange?.Invoke(null, args);
+        }
+
         private class SerializePoseList
         {
             public string UIName { get; set; }
             public List<string> PoseList { get; set; }
         }
     }
+
+    public class MenuFilesEventArgs : EventArgs
+    {
+        public EventType Type { get; }
+        public enum EventType
+        {
+            HandItems, MenuFiles
+        }
+        public static MenuFilesEventArgs HandItems => new MenuFilesEventArgs(EventType.HandItems);
+        public static MenuFilesEventArgs MenuFiles => new MenuFilesEventArgs(EventType.MenuFiles);
+
+        public MenuFilesEventArgs(EventType type)
+        {
+            this.Type = type;
+        }
+    }
 }

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/DropDown.cs

@@ -63,7 +63,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             this.elementSize = Vector2.zero;
 
             // TODO: Calculate scrollpos position maybe
-            if ((selectedItemIndex != this.selectedItemIndex) && (itemList.Length != this.DropdownList?.Length))
+            if ((selectedItemIndex != this.selectedItemIndex) || (itemList.Length != this.DropdownList?.Length))
             {
                 this.scrollPos = Vector2.zero;
             }

+ 120 - 32
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/PropsPane.cs

@@ -1,59 +1,79 @@
 using UnityEngine;
+using System.Collections.Generic;
+using System.Linq;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class PropsPane : BasePane
     {
+        private const string translationPrefix = "doguCategory";
         private PropManager propManager;
-        private Dropdown otherDoguDropdown;
+        private string currentCategory;
+        private string SelectedCategory => Constants.doguCategories[this.doguCategoryDropdown.SelectedItemIndex];
+        private Dropdown doguCategoryDropdown;
         private Dropdown doguDropdown;
         private Button addDoguButton;
-        private Button addOtherDoguButton;
         private Button nextDoguButton;
         private Button prevDoguButton;
-        private Button nextOtherDoguButton;
-        private Button prevOtherDoguButton;
+        private Button nextDoguCategoryButton;
+        private Button prevDoguCategoryButton;
+        private string header;
+        private static bool handItemsReady = false;
+        private bool itemSelectorEnabled = true;
 
         public PropsPane(PropManager propManager)
         {
+            this.header = Translation.Get("propsPane", "header");
+
             this.propManager = propManager;
 
-            this.doguDropdown = new Dropdown(Translation.GetArray("props1Dropdown", Constants.DoguList));
+            handItemsReady = MenuFileUtility.MenuFilesReady;
+            if (!handItemsReady) Constants.MenuFilesChange += InitializeHandItems;
 
-            this.otherDoguDropdown = new Dropdown(Translation.GetArray("props2Dropdown", Constants.OtherDoguList));
+            this.doguCategoryDropdown = new Dropdown(Translation.GetArray("doguCategories", Constants.doguCategories));
+            this.doguCategoryDropdown.SelectionChange += (s, a) => ChangeDoguCategory(SelectedCategory);
 
-            this.addOtherDoguButton = new Button("+");
-            this.addOtherDoguButton.ControlEvent += (s, a) =>
-            {
-                string assetName = Constants.OtherDoguList[this.otherDoguDropdown.SelectedItemIndex];
-                this.propManager.SpawnObject(assetName);
-            };
+            this.doguDropdown = new Dropdown(new[] { string.Empty });
 
             this.addDoguButton = new Button("+");
-            this.addDoguButton.ControlEvent += (s, a) =>
-            {
-                string assetName = Constants.DoguList[this.doguDropdown.SelectedItemIndex];
-                this.propManager.SpawnObject(assetName);
-            };
+            this.addDoguButton.ControlEvent += (s, a) => SpawnObject();
 
             this.nextDoguButton = new Button(">");
             this.nextDoguButton.ControlEvent += (s, a) => this.doguDropdown.Step(1);
 
-
             this.prevDoguButton = new Button("<");
             this.prevDoguButton.ControlEvent += (s, a) => this.doguDropdown.Step(-1);
 
-            this.nextOtherDoguButton = new Button(">");
-            this.nextOtherDoguButton.ControlEvent += (s, a) => this.otherDoguDropdown.Step(1);
+            this.nextDoguCategoryButton = new Button(">");
+            this.nextDoguCategoryButton.ControlEvent += (s, a) => this.doguCategoryDropdown.Step(1);
+
+            this.prevDoguCategoryButton = new Button("<");
+            this.prevDoguCategoryButton.ControlEvent += (s, a) => this.doguCategoryDropdown.Step(-1);
 
-            this.prevOtherDoguButton = new Button("<");
-            this.prevOtherDoguButton.ControlEvent += (s, a) => this.otherDoguDropdown.Step(-1);
+            ChangeDoguCategory(SelectedCategory);
         }
 
         protected override void ReloadTranslation()
         {
-            this.doguDropdown.SetDropdownItems(Translation.GetArray("props1Dropdown", Constants.DoguList));
-            this.otherDoguDropdown.SetDropdownItems(Translation.GetArray("props2Dropdown", Constants.OtherDoguList));
+            this.header = Translation.Get("propsPane", "header");
+
+            this.doguCategoryDropdown.SetDropdownItems(
+                Translation.GetArray("doguCategories", Constants.doguCategories)
+            );
+
+            string category = SelectedCategory;
+
+            string[] translationArray;
+
+            if (category == Constants.customDoguCategories[Constants.DoguCategory.HandItem] && !handItemsReady)
+            {
+                translationArray = new[] { Translation.Get("systemMessage", "initializing") };
+            }
+            else
+            {
+                translationArray = GetTranslations(category);
+            }
+            doguDropdown.SetDropdownItems(translationArray);
         }
 
         public override void Draw()
@@ -71,21 +91,89 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 GUILayout.Width(dropdownButtonWidth)
             };
 
-            MiscGUI.Header("Props 1");
+            MiscGUI.Header(this.header);
+            MiscGUI.WhiteLine();
+
+            GUILayout.BeginHorizontal();
+            this.prevDoguCategoryButton.Draw(arrowLayoutOptions);
+            this.doguCategoryDropdown.Draw(dropdownLayoutOptions);
+            this.nextDoguCategoryButton.Draw(arrowLayoutOptions);
+            GUILayout.EndHorizontal();
+
+            GUI.enabled = itemSelectorEnabled;
             GUILayout.BeginHorizontal();
             this.doguDropdown.Draw(dropdownLayoutOptions);
             this.prevDoguButton.Draw(arrowLayoutOptions);
             this.nextDoguButton.Draw(arrowLayoutOptions);
             this.addDoguButton.Draw(arrowLayoutOptions);
             GUILayout.EndHorizontal();
+            GUI.enabled = true;
+        }
 
-            MiscGUI.Header("Props 2");
-            GUILayout.BeginHorizontal();
-            this.otherDoguDropdown.Draw(dropdownLayoutOptions);
-            this.prevOtherDoguButton.Draw(arrowLayoutOptions);
-            this.nextOtherDoguButton.Draw(arrowLayoutOptions);
-            this.addOtherDoguButton.Draw(arrowLayoutOptions);
-            GUILayout.EndHorizontal();
+        private void InitializeHandItems(object sender, MenuFilesEventArgs args)
+        {
+            if (args.Type == MenuFilesEventArgs.EventType.HandItems)
+            {
+                handItemsReady = true;
+                string selectedCategory = SelectedCategory;
+                if (selectedCategory == Constants.customDoguCategories[Constants.DoguCategory.HandItem])
+                {
+                    ChangeDoguCategory(selectedCategory, true);
+                }
+            }
+        }
+
+        private void ChangeDoguCategory(string category, bool force = false)
+        {
+            if (category != currentCategory || force)
+            {
+                currentCategory = category;
+
+                string[] translationArray;
+
+                if (category == Constants.customDoguCategories[Constants.DoguCategory.HandItem] && !handItemsReady)
+                {
+                    translationArray = new[] { Translation.Get("systemMessage", "initializing") };
+                    itemSelectorEnabled = false;
+                }
+                else
+                {
+                    translationArray = GetTranslations(category);
+                    itemSelectorEnabled = true;
+                }
+                doguDropdown.SetDropdownItems(translationArray, 0);
+            }
+        }
+
+        private string[] GetTranslations(string category)
+        {
+            IEnumerable<string> itemList = Constants.DoguDict[category];
+            if (category == Constants.customDoguCategories[Constants.DoguCategory.HandItem])
+            {
+                itemList = itemList.Select(item =>
+                {
+                    string handItemAsOdogu = Utility.HandItemToOdogu(item);
+
+                    if (Translation.Has("propNames", handItemAsOdogu)) return handItemAsOdogu;
+                    else return item;
+                });
+            }
+
+            string translationCategory = category == Constants.customDoguCategories[Constants.DoguCategory.BGSmall]
+                ? "bgNames"
+                : "propNames";
+
+            return Translation.GetArray(translationCategory, itemList);
+        }
+
+        private void SpawnObject()
+        {
+            string assetName = Constants.DoguDict[SelectedCategory][this.doguDropdown.SelectedItemIndex];
+            if (SelectedCategory == Constants.customDoguCategories[Constants.DoguCategory.BGSmall])
+            {
+                assetName = "BG_" + assetName;
+            }
+            this.propManager.SpawnObject(assetName);
         }
     }
 }

+ 11 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/BG2WindowPane.cs

@@ -6,15 +6,25 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class BG2WindowPane : BaseWindowPane
     {
+        private PropsPane propsPane;
         EnvironmentManager environmentManager;
         public BG2WindowPane(EnvironmentManager environmentManager)
         {
             this.environmentManager = environmentManager;
+
+            this.propsPane = new PropsPane(this.environmentManager.PropManager);
         }
         public override void Draw()
         {
+            this.propsPane.Draw();
+        }
 
-            GUILayout.Label("bg2");
+        public override void UpdatePanes()
+        {
+            if (ActiveWindow)
+            {
+                this.propsPane.UpdatePane();
+            }
         }
     }
 }

+ 0 - 4
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/BGWindowPane.cs

@@ -6,7 +6,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class BGWindowPane : BaseWindowPane
     {
         private BackgroundSelectorPane backgroundSelectorPane;
-        private PropsPane propsPane;
         private LightsPane lightsPane;
         private EffectsPane effectsPane;
         private DragPointPane dragPointPane;
@@ -15,7 +14,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             this.backgroundSelectorPane = new BackgroundSelectorPane(environmentManager);
             this.dragPointPane = new DragPointPane();
-            this.propsPane = new PropsPane(environmentManager.PropManager);
             this.lightsPane = new LightsPane(environmentManager);
 
             EffectManager effectManager = environmentManager.EffectManager;
@@ -32,7 +30,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public override void Draw()
         {
             this.backgroundSelectorPane.Draw();
-            this.propsPane.Draw();
             this.dragPointPane.Draw();
             this.scrollPos = GUILayout.BeginScrollView(this.scrollPos);
             this.lightsPane.Draw();
@@ -44,7 +41,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (ActiveWindow)
             {
-                this.propsPane.UpdatePane();
                 this.lightsPane.UpdatePane();
                 this.effectsPane.UpdatePane();
             }

+ 37 - 3
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/PropManager.cs

@@ -106,7 +106,32 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             // TODO: Add a couple more things to ignore list
             GameObject dogu = null;
-            if (assetName.StartsWith("mirror"))
+            string doguName = assetName;
+            Vector3 doguPosition = new Vector3(0f, 0f, 0.5f);
+            Vector3 doguScale = Vector3.one;
+
+            if (assetName.EndsWith(".menu"))
+            {
+                dogu = MenuFileUtility.LoadModel(assetName);
+            }
+            else if (assetName.StartsWith("BG_"))
+            {
+                assetName = assetName.Remove(0, 3);
+                GameObject obj = GameMain.Instance.BgMgr.CreateAssetBundle(assetName);
+                if (obj == null)
+                {
+                    obj = (Resources.Load("BG/" + assetName) ?? Resources.Load("BG/2_0/" + assetName)) as GameObject;
+                }
+
+                if (obj != null)
+                {
+                    dogu = GameObject.Instantiate(obj);
+                    doguPosition = Vector3.zero;
+                    doguScale = Vector3.one * 0.1f;
+                }
+
+            }
+            else if (assetName.StartsWith("mirror"))
             {
                 Material mirrorMaterial = new Material(Shader.Find("Mirror"));
                 dogu = GameObject.CreatePrimitive(PrimitiveType.Plane);
@@ -162,7 +187,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 MeshRenderer[] meshRenderers = dogu.GetComponentsInChildren<MeshRenderer>();
                 for (int i = 0; i < meshRenderers.Length; i++)
                 {
-                    if (meshRenderers[i] != null)
+                    if (meshRenderers[i] != null
+                        && meshRenderers[i].gameObject.name.ToLower().IndexOf("castshadow") < 0
+                    )
                     {
                         meshRenderers[i].shadowCastingMode = ShadowCastingMode.Off;
                     }
@@ -216,10 +243,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 GameObject deploymentObject = GetDeploymentObject();
                 GameObject finalDogu = new GameObject();
 
+                dogu.transform.localScale = doguScale;
+
                 dogu.transform.SetParent(finalDogu.transform, true);
                 finalDogu.transform.SetParent(deploymentObject.transform, false);
 
-                finalDogu.transform.position = new Vector3(0f, 0f, 0.5f);
+                finalDogu.transform.position = doguPosition;
+                finalDogu.name = doguName;
 
                 GameObject dragPoint = BaseDrag.MakeDragPoint(
                     PrimitiveType.Cube, Vector3.one * 0.12f, BaseDrag.LightBlue
@@ -232,6 +262,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 doguList.Add(dragDogu);
                 dragDogu.DragPointScale = dragDogu.BaseScale * (CubeSmall ? 0.4f : 1f);
             }
+            else
+            {
+                Debug.LogError($"Could not spawn object '{assetName}'");
+            }
         }
 
         private void DeleteDogu()

+ 9 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Utility.cs

@@ -1,5 +1,6 @@
 using System;
 using System.IO;
+using System.Collections.Generic;
 using System.Reflection;
 using UnityEngine;
 
@@ -94,5 +95,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             MouseExposition mouseExposition = MouseExposition.GetObject();
             mouseExposition.SetText(text, time);
         }
+
+        public static string HandItemToOdogu(string menu)
+        {
+            menu = menu.Substring(menu.IndexOf('_') + 1);
+            menu = menu.Substring(0, menu.IndexOf("_i_.menu"));
+            menu = $"odogu_{menu}";
+            return menu;
+        }
     }
 }