浏览代码

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 年之前
父节点
当前提交
386fb1f4cb
共有 1 个文件被更改,包括 7 次插入1 次删除
  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;
         }