all apply and close
This commit is contained in:
parent
81e410fdb4
commit
5e258294bf
@ -8,6 +8,8 @@ using UnityEngine;
|
||||
|
||||
namespace AsmdefHelper.MultipleEdit.Editor {
|
||||
public class AsmdefMultiEditWindow : EditorWindow {
|
||||
static IList<InspectorWindowWrapper> windows = new List<InspectorWindowWrapper>();
|
||||
|
||||
[MenuItem("Window/Asmdef Helper/Find all asmdef in project")]
|
||||
public static void Search() {
|
||||
var browser = CreateInstance<ProjectBrowserWrapper>();
|
||||
@ -23,13 +25,33 @@ namespace AsmdefHelper.MultipleEdit.Editor {
|
||||
return;
|
||||
}
|
||||
|
||||
CloseWindows();
|
||||
foreach (var adf in asmdefs) {
|
||||
Selection.objects = new[] { adf };
|
||||
var w = CreateInstance<InspectorWindowWrapper>();
|
||||
w.GetInspectorWindow();
|
||||
// LockすることでInspectorWindowの表示を固定する
|
||||
w.Lock(true);
|
||||
}
|
||||
windows.Add(w);
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Window/Asmdef Helper/Apply all asmdef and close")]
|
||||
public static void Apply() {
|
||||
foreach (var w in windows) {
|
||||
w.AllApply();
|
||||
w.CloseInspectorWindow();
|
||||
}
|
||||
|
||||
windows.Clear();
|
||||
}
|
||||
|
||||
static void CloseWindows() {
|
||||
foreach (var w in windows) {
|
||||
w.CloseInspectorWindow();
|
||||
}
|
||||
|
||||
windows.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.AssetImporters;
|
||||
|
||||
namespace AsmdefHelper.UnityInternal {
|
||||
public class InspectorWindowWrapper : EditorWindow{
|
||||
@ -13,5 +14,21 @@ namespace AsmdefHelper.UnityInternal {
|
||||
inspectorWindow.isLocked = isLock;
|
||||
}
|
||||
}
|
||||
|
||||
public void AllApply() {
|
||||
foreach (var editor in inspectorWindow.tracker.activeEditors) {
|
||||
var assetImporterEditor = editor as AssetImporterEditor;
|
||||
|
||||
if (assetImporterEditor != null && assetImporterEditor.HasModified()) {
|
||||
assetImporterEditor.ApplyAndImport();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseInspectorWindow() {
|
||||
if (inspectorWindow != null) {
|
||||
inspectorWindow.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user