Unity graph tool solution based on different implementation now focused on Unity.Experimental.Graphview
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.9 KiB

using System.Linq;
using TNodeCore.Editor.EditorPersistence;
using UnityEditor;
3 years ago
using UnityEditor.Experimental.GraphView;
using UnityEngine.UIElements;
namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{
public class SimpleGraphSubWindow:GraphElement,IGraphViewPersistence{
3 years ago
private readonly Dragger _dragger = new Dragger();
protected void ConstructWindowBasicSetting(){
3 years ago
RegisterCallback<WheelEvent>(evt => { evt.StopPropagation(); });
focusable = false;
capabilities |= Capabilities.Movable | Capabilities.Resizable;
this.AddManipulator(_dragger);
}
protected void BuildWindow(VisualTreeAsset visualTreeAsset){
3 years ago
if(visualTreeAsset != null){
visualTreeAsset.CloneTree(this);
}
}
public SimpleGraphSubWindow(string defaultUxml=null){
style.position = new StyleEnum<Position>(Position.Absolute);
3 years ago
ConstructWindowBasicSetting();
if (defaultUxml != null){
var uxml = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(defaultUxml);
BuildWindow(uxml);
}
}
public SimpleGraphSubWindow(VisualTreeAsset visualTreeAsset){
style.position = new StyleEnum<Position>(Position.Absolute);
3 years ago
ConstructWindowBasicSetting();
BuildWindow(visualTreeAsset);
}
public string GetPersistenceId(){
throw new System.NotImplementedException();
}
public void ResetPos(GraphEditorData editorData){
var res = editorData.graphElementsData.FirstOrDefault(x => x.guid == this.GetPersistenceId());
}
public void SavePos(GraphEditorData editorData){
}
public void OnRemoveFromGraph(GraphEditorData editorData){
}
3 years ago
}
3 years ago
}