asmdef 一覧の Toggle

This commit is contained in:
naninunenoy 2020-11-26 00:41:49 +09:00
parent 9c0e3deac3
commit c6aafef7ae
14 changed files with 189 additions and 6 deletions

View File

@ -5,6 +5,7 @@ using UnityEditor.Compilation;
namespace AsmdefHelper.DependencyGraph.Editor { namespace AsmdefHelper.DependencyGraph.Editor {
public class AsmdefGraphEditorWindow : EditorWindow { public class AsmdefGraphEditorWindow : EditorWindow {
static AsmdefSelectionView selectionWindow;
[MenuItem("AsmdefHelper/Open DependencyGraph", priority = 2000)] [MenuItem("AsmdefHelper/Open DependencyGraph", priority = 2000)]
public static void Open() { public static void Open() {
GetWindow<AsmdefGraphEditorWindow>("Asmdef Dependency"); GetWindow<AsmdefGraphEditorWindow>("Asmdef Dependency");
@ -18,6 +19,18 @@ namespace AsmdefHelper.DependencyGraph.Editor {
style = { flexGrow = 1 } style = { flexGrow = 1 }
}; };
rootVisualElement.Add(graphView); rootVisualElement.Add(graphView);
// 選択ウィンドウも作成
selectionWindow = GetWindow<AsmdefSelectionView>("Asmdef Selection");
selectionWindow.SetAsmdef(asmdefs);
}
// 片方を閉じる
void OnDestroy() {
if (selectionWindow != null) {
selectionWindow.Close();
}
selectionWindow = null;
} }
} }
} }

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 686371b55f14bdb4ca1a0ee236361071
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,55 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;
using UnityEngine.UIElements;
namespace AsmdefHelper.DependencyGraph.Editor {
public class AsmdefSelectionView : EditorWindow {
static EditorWindow graphWindow;
public void OnEnable() {
graphWindow = GetWindow<AsmdefGraphEditorWindow>();
}
VisualTreeAsset LoadVisualTreeAsset() {
// Import UXML
var visualTree =
AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(
"Assets/AsmdefHelper/DependencyGraph/Editor/AsmdefSelectionView/AsmdefSelectionView.uxml");
if (visualTree == null) {
visualTree =
AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(
"Packages/dev.n5y.asmdefhelper/AsmdefHelper/DependencyGraph/Editor/AsmdefSelectionView/AsmdefSelectionView.uxml");
}
return visualTree;
}
public void SetAsmdef(Assembly[] assemblies) {
VisualElement scroll = new ScrollView();
rootVisualElement.Add(scroll);
var sorted = assemblies.OrderBy(x => x.name);
foreach (var assembly in sorted) {
var elm = LoadVisualTreeAsset().Instantiate();
var toggle = elm.Q<Toggle>(className: "CheckBox");
var label = elm.Q<Label>(className: "NameLabel");
toggle.value = true;
label.text = assembly.name;
scroll.Add(elm);
}
}
// 片方を閉じる
async void OnDestroy() {
// 同フレームで OnDestroy を呼ぶと警告が出るので遅延実行
await Task.Delay(1);
if (graphWindow != null) {
graphWindow.Close();
}
graphWindow = null;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 69bee09693f54d46954fb60401f58b66
timeCreated: 1606312787

View File

@ -0,0 +1,5 @@
Label {
font-size: 20px;
-unity-font-style: bold;
color: rgb(68, 138, 255);
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7906d8f1d4e539745bf53fba8fc20d3a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<engine:UXML
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:engine="UnityEngine.UIElements"
xmlns:editor="UnityEditor.UIElements"
xsi:noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd"
>
<engine:Toggle class="CheckBox">
<engine:Label class="NameLabel"/>
</engine:Toggle>
</engine:UXML>

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 24d749776c208f4408be0cfccb02d1c7
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.UIElements.Debugger" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.Experimental.GraphView" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="UnityEngine.UIElements.xsd" namespace="UnityEngine.UIElements" /> <xs:import schemaLocation="UnityEngine.UIElements.xsd" namespace="UnityEngine.UIElements" />
<xs:import schemaLocation="UnityEditor.PackageManager.UI.xsd" namespace="UnityEditor.PackageManager.UI" /> <xs:import schemaLocation="UnityEditor.PackageManager.UI.xsd" namespace="UnityEditor.PackageManager.UI" />
<xs:import schemaLocation="UnityEditor.UIElements.xsd" namespace="UnityEditor.UIElements" /> <xs:import schemaLocation="UnityEditor.UIElements.xsd" namespace="UnityEditor.UIElements" />
<xs:import schemaLocation="UnityEditor.UIElements.Debugger.xsd" namespace="UnityEditor.UIElements.Debugger" /> <xs:import schemaLocation="UnityEditor.UIElements.Debugger.xsd" namespace="UnityEditor.UIElements.Debugger" />
<xs:import schemaLocation="UnityEditor.Experimental.GraphView.xsd" namespace="UnityEditor.Experimental.GraphView" />
</xs:schema> </xs:schema>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.Experimental.GraphView" elementFormDefault="qualified" targetNamespace="UnityEditor.Experimental.GraphView" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="UnityEngine.UIElements.xsd" namespace="UnityEngine.UIElements" />
<xs:complexType name="PillType">
<xs:complexContent mixed="false">
<xs:restriction base="engine:VisualElementType">
<xs:attribute default="" name="name" type="xs:string" use="optional" />
<xs:attribute default="" name="view-data-key" type="xs:string" use="optional" />
<xs:attribute default="Position" name="picking-mode" type="engine:VisualElement_picking-mode_Type" use="optional" />
<xs:attribute default="" name="tooltip" type="xs:string" use="optional" />
<xs:attribute default="None" name="usage-hints" type="engine:VisualElement_usage-hints_Type" use="optional" />
<xs:attribute default="0" name="tabindex" type="xs:int" use="optional" />
<xs:attribute default="false" name="focusable" type="xs:boolean" use="optional" />
<xs:attribute default="" name="class" type="xs:string" use="optional" />
<xs:attribute default="" name="content-container" type="xs:string" use="optional" />
<xs:attribute default="" name="style" type="xs:string" use="optional" />
<xs:attribute default="false" name="highlighted" type="xs:boolean" use="optional" />
<xs:attribute default="" name="text" type="xs:string" use="optional" />
<xs:anyAttribute processContents="lax" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="Pill" substitutionGroup="engine:VisualElement" type="PillType" />
<xs:complexType name="ResizableElementType">
<xs:complexContent mixed="false">
<xs:restriction base="engine:VisualElementType">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="engine:VisualElement" />
</xs:sequence>
<xs:attribute default="" name="name" type="xs:string" use="optional" />
<xs:attribute default="" name="view-data-key" type="xs:string" use="optional" />
<xs:attribute default="Position" name="picking-mode" type="engine:VisualElement_picking-mode_Type" use="optional" />
<xs:attribute default="" name="tooltip" type="xs:string" use="optional" />
<xs:attribute default="None" name="usage-hints" type="engine:VisualElement_usage-hints_Type" use="optional" />
<xs:attribute default="0" name="tabindex" type="xs:int" use="optional" />
<xs:attribute default="false" name="focusable" type="xs:boolean" use="optional" />
<xs:attribute default="" name="class" type="xs:string" use="optional" />
<xs:attribute default="" name="content-container" type="xs:string" use="optional" />
<xs:attribute default="" name="style" type="xs:string" use="optional" />
<xs:anyAttribute processContents="lax" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="ResizableElement" substitutionGroup="engine:VisualElement" type="ResizableElementType" />
<xs:complexType name="StickyNoteType">
<xs:complexContent mixed="false">
<xs:restriction base="engine:VisualElementType">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="engine:VisualElement" />
</xs:sequence>
<xs:attribute default="" name="name" type="xs:string" use="optional" />
<xs:attribute default="" name="view-data-key" type="xs:string" use="optional" />
<xs:attribute default="Position" name="picking-mode" type="engine:VisualElement_picking-mode_Type" use="optional" />
<xs:attribute default="" name="tooltip" type="xs:string" use="optional" />
<xs:attribute default="None" name="usage-hints" type="engine:VisualElement_usage-hints_Type" use="optional" />
<xs:attribute default="0" name="tabindex" type="xs:int" use="optional" />
<xs:attribute default="false" name="focusable" type="xs:boolean" use="optional" />
<xs:attribute default="" name="class" type="xs:string" use="optional" />
<xs:attribute default="" name="content-container" type="xs:string" use="optional" />
<xs:attribute default="" name="style" type="xs:string" use="optional" />
<xs:anyAttribute processContents="lax" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="StickyNote" substitutionGroup="engine:VisualElement" type="StickyNoteType" />
</xs:schema>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.UIElements.Debugger" elementFormDefault="qualified" targetNamespace="UnityEditor.PackageManager.UI" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.Experimental.GraphView" elementFormDefault="qualified" targetNamespace="UnityEditor.PackageManager.UI" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="UnityEngine.UIElements.xsd" namespace="UnityEngine.UIElements" /> <xs:import schemaLocation="UnityEngine.UIElements.xsd" namespace="UnityEngine.UIElements" />
<xs:complexType name="AlertType"> <xs:complexType name="AlertType">
<xs:complexContent mixed="false"> <xs:complexContent mixed="false">

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.UIElements.Debugger" elementFormDefault="qualified" targetNamespace="UnityEditor.UIElements.Debugger" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.Experimental.GraphView" elementFormDefault="qualified" targetNamespace="UnityEditor.UIElements.Debugger" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="UnityEngine.UIElements.xsd" namespace="UnityEngine.UIElements" /> <xs:import schemaLocation="UnityEngine.UIElements.xsd" namespace="UnityEngine.UIElements" />
<xs:complexType name="EventTypeSelectFieldType"> <xs:complexType name="EventTypeSelectFieldType">
<xs:complexContent mixed="false"> <xs:complexContent mixed="false">
@ -23,5 +23,5 @@
</xs:restriction> </xs:restriction>
</xs:complexContent> </xs:complexContent>
</xs:complexType> </xs:complexType>
<xs:element name="EventTypeSelectField" substitutionGroup="engine:VisualElement" type="EventTypeSelectFieldType" /> <xs:element name="EventTypeSelectField" substitutionGroup="engine:VisualElement" xmlns:q1="UnityEditor.UIElements.Debugger" type="q1:EventTypeSelectFieldType" />
</xs:schema> </xs:schema>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.UIElements.Debugger" elementFormDefault="qualified" targetNamespace="UnityEditor.UIElements" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.Experimental.GraphView" elementFormDefault="qualified" targetNamespace="UnityEditor.UIElements" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="UnityEngine.UIElements.xsd" namespace="UnityEngine.UIElements" /> <xs:import schemaLocation="UnityEngine.UIElements.xsd" namespace="UnityEngine.UIElements" />
<xs:simpleType name="PropertyControl_value-type_Type"> <xs:simpleType name="PropertyControl_value-type_Type">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.UIElements.Debugger" elementFormDefault="qualified" targetNamespace="UnityEngine.UIElements" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements" xmlns="UnityEditor.Experimental.GraphView" elementFormDefault="qualified" targetNamespace="UnityEngine.UIElements" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="UXMLType"> <xs:complexType name="UXMLType">
<xs:complexContent mixed="false"> <xs:complexContent mixed="false">
<xs:restriction base="xs:anyType"> <xs:restriction base="xs:anyType">