Added IExecutable and ISlotContainer interface.

Changed SlotContainerNode to ExecutableNode
This commit is contained in:
Misaki
2024-11-05 02:25:15 +09:00
parent 7eec130b39
commit c853994bf5
51 changed files with 443 additions and 400 deletions

View File

@@ -0,0 +1,54 @@
using System.Reflection;
using UnityEditor;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.UIElements;
namespace Misaki.GraphView.Editor
{
public sealed class GraphInspectorView : GraphSubWindow
{
private const string UI_Document_Path = "Packages/com.misaki.graph-view/Editor/Views/Inspector/GraphInspectorView.uxml";
private readonly Label _header;
private readonly VisualElement _inspectorPropertiesContainer;
private Vector2 _startMousePosition;
private Vector2 _startElementPosition;
public GraphInspectorView()
{
style.minWidth = 300;
style.minHeight = 500;
var uiDocument = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(UI_Document_Path);
var inspectorView = uiDocument.Instantiate();
inspectorView.style.flexGrow = 1;
_header = inspectorView.Q<Label>("node-name-label");
_header.text = string.Empty;
_inspectorPropertiesContainer = inspectorView.Q<VisualElement>("inspector-properties-container");
Add(inspectorView);
}
private void ClearInspector()
{
_header.text = string.Empty;
_inspectorPropertiesContainer.Clear();
}
public void OnNodeSelectionChanged(IInspectable selection)
{
ClearInspector();
if (selection == null)
{
return;
}
_header.text = selection.InspectorName ?? "Inspector";
_inspectorPropertiesContainer.Add(selection.CreateInspector());
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8290ebaa6d394b13bda6bc4cc94763e8
timeCreated: 1730376321

View File

@@ -0,0 +1,13 @@
<engine:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:engine="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<engine:VisualElement picking-mode="Ignore" style="flex-grow: 1; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-left-color: rgba(0, 0, 0, 0.35); border-right-color: rgba(0, 0, 0, 0.35); border-top-color: rgba(0, 0, 0, 0.35); border-bottom-color: rgba(0, 0, 0, 0.35); overflow: hidden; background-color: rgb(46, 46, 46); margin-top: 8px; margin-right: 8px; margin-bottom: 8px; margin-left: 8px;">
<engine:VisualElement style="padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; background-color: rgba(255, 255, 255, 0.05);">
<engine:Label text="Graph Inspector" name="header" style="font-size: 14px; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px;" />
</engine:VisualElement>
<engine:ScrollView>
<engine:VisualElement style="flex-grow: 1; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px;">
<engine:Label text="Label" name="node-name-label" style="-unity-font-style: bold; margin-bottom: 8px;" />
<engine:VisualElement name="inspector-properties-container" style="flex-grow: 1; margin-left: 8px;" />
</engine:VisualElement>
</engine:ScrollView>
</engine:VisualElement>
</engine:UXML>

View File

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