コード例 #1
0
 protected override void OnDisable()
 {
     base.OnDisable();
     if (!EditorApplication.isPlaying && !InternalEditorUtility.ignoreInspectorChanges && this.m_MightHaveModified)
     {
         this.m_MightHaveModified = false;
         string[]             array   = new string[base.targets.GetLength(0)];
         int                  num     = 0;
         UnityEngine.Object[] targets = base.targets;
         for (int i = 0; i < targets.Length; i++)
         {
             ProceduralTexture proceduralTexture = (ProceduralTexture)targets[i];
             string            assetPath         = AssetDatabase.GetAssetPath(proceduralTexture);
             SubstanceImporter substanceImporter = AssetImporter.GetAtPath(assetPath) as SubstanceImporter;
             if (substanceImporter)
             {
                 substanceImporter.OnTextureInformationsChanged(proceduralTexture);
             }
             assetPath = AssetDatabase.GetAssetPath(proceduralTexture.GetProceduralMaterial());
             bool flag = false;
             for (int j = 0; j < num; j++)
             {
                 if (array[j] == assetPath)
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 array[num++] = assetPath;
             }
         }
         for (int k = 0; k < num; k++)
         {
             SubstanceImporter substanceImporter2 = AssetImporter.GetAtPath(array[k]) as SubstanceImporter;
             if (substanceImporter2 && EditorUtility.IsDirty(substanceImporter2.GetInstanceID()))
             {
                 AssetDatabase.ImportAsset(array[k], ImportAssetOptions.ForceUncompressedImport);
             }
         }
     }
 }
コード例 #2
0
        protected override void OnDisable()
        {
            base.OnDisable();
            if (EditorApplication.isPlaying || InternalEditorUtility.ignoreInspectorChanges || !this.m_MightHaveModified)
            {
                return;
            }
            this.m_MightHaveModified = false;
            string[] strArray = new string[this.targets.GetLength(0)];
            int      num      = 0;

            foreach (ProceduralTexture target in this.targets)
            {
                SubstanceImporter atPath = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath((Object)target)) as SubstanceImporter;
                if ((bool)((Object)atPath))
                {
                    atPath.OnTextureInformationsChanged(target);
                }
                string assetPath = AssetDatabase.GetAssetPath((Object)target.GetProceduralMaterial());
                bool   flag      = false;
                for (int index = 0; index < num; ++index)
                {
                    if (strArray[index] == assetPath)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    strArray[num++] = assetPath;
                }
            }
            for (int index = 0; index < num; ++index)
            {
                SubstanceImporter atPath = AssetImporter.GetAtPath(strArray[index]) as SubstanceImporter;
                if ((bool)((Object)atPath) && EditorUtility.IsDirty(atPath.GetInstanceID()))
                {
                    AssetDatabase.ImportAsset(strArray[index], ImportAssetOptions.ForceUncompressedImport);
                }
            }
        }
コード例 #3
0
 protected override void OnDisable()
 {
     base.OnDisable();
     if ((!EditorApplication.isPlaying && !InternalEditorUtility.ignoreInspectorChanges) && this.m_MightHaveModified)
     {
         this.m_MightHaveModified = false;
         string[] strArray = new string[base.targets.GetLength(0)];
         int      num      = 0;
         foreach (ProceduralTexture texture in base.targets)
         {
             SubstanceImporter atPath = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(texture)) as SubstanceImporter;
             if (atPath != null)
             {
                 atPath.OnTextureInformationsChanged(texture);
             }
             string assetPath = AssetDatabase.GetAssetPath(texture.GetProceduralMaterial());
             bool   flag      = false;
             for (int j = 0; j < num; j++)
             {
                 if (strArray[j] == assetPath)
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 strArray[num++] = assetPath;
             }
         }
         for (int i = 0; i < num; i++)
         {
             SubstanceImporter importer2 = AssetImporter.GetAtPath(strArray[i]) as SubstanceImporter;
             if ((importer2 != null) && EditorUtility.IsDirty(importer2.GetInstanceID()))
             {
                 AssetDatabase.ImportAsset(strArray[i], ImportAssetOptions.ForceUncompressedImport);
             }
         }
     }
 }