void _applyProgramChanges() { if (prog == null) { return; } prog.importTriggeredByInspector = true; // 1st erase the store program if (storedProg) { KMImportSettings.RemoveProgram(storedProg); } // now store the prog in memory to the asset KMImportSettings.AddProgram(prog); // Trigger mesh reimport -> import processor will execute program EditorUtility.DisplayProgressBar(KMImportProcessor.ProgressTitle(prog), "Unity3D reimports model file", 0.0f); KMImportSettings.IncrementMasterImportRevision(); // float dt = Time.realtimeSinceStartup; AssetDatabase.ImportAsset(assetPath); // dt = ; //Debug.LogError("Reimport took " + (Time.realtimeSinceStartup - dt)*1000.0f + " ms."); hasChanges = false; EditorUtility.ClearProgressBar(); // Reload prog _initializeProgram(); }
// Called from progGUI public void DeleteProgram() { if (prog == null) { return; } bool del = true; if (prog.processors.Length > 0) { del = EditorUtility.DisplayDialog("Delete Import Program", "Do you want to permanently delete this mesh import program?", "Delete", "Cancel"); } if (del) { if (storedProg != null) { EditorUtility.DisplayProgressBar(KMImportProcessor.ProgressTitle(prog), "Unity3D reimports model file", 0.0f); KMImportSettings.RemoveProgram(storedProg); // Trigger model reimport AssetDatabase.ImportAsset(assetPath); EditorUtility.ClearProgressBar(); } prog = null; progGUI = null; storedProg = null; } }