Browse Source

Regenerate CacheBoneDataArray when appropriate.

NPR Shader seems to do something that nulls the cache bone data so when
getting the cache, check if the bone data is null and regenerate.
habeebweeb 4 years ago
parent
commit
386fb1f4cb
1 changed files with 7 additions and 1 deletions
  1. 7 1
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/Meido.cs

+ 7 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/Meido.cs

@@ -677,10 +677,16 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private CacheBoneDataArray GetCacheBoneData()
         {
             CacheBoneDataArray cache = Maid.gameObject.GetComponent<CacheBoneDataArray>();
+            void CreateCache() => cache.CreateCache(Body.GetBone("Bip01"));
             if (cache == null)
             {
                 cache = Maid.gameObject.AddComponent<CacheBoneDataArray>();
-                cache.CreateCache(Body.GetBone("Bip01"));
+                CreateCache();
+            }
+            if (cache.bone_data?.transform == null)
+            {
+                Utility.LogDebug("Cache bone_data is null");
+                CreateCache();
             }
             return cache;
         }