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.
44 lines
1.4 KiB
44 lines
1.4 KiB
using UnityEditor;
|
|
using UnityEditor.Experimental.GraphView;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace TNodeGraphViewImpl.Editor.NodeGraphView{
|
|
public class SimpleGraphSubWindow:GraphElement{
|
|
private readonly Dragger _dragger = new Dragger();
|
|
|
|
protected void ConstructWindowBasicSetting(){
|
|
|
|
RegisterCallback<WheelEvent>(evt => { evt.StopPropagation(); });
|
|
focusable = false;
|
|
capabilities |= Capabilities.Movable | Capabilities.Resizable;
|
|
this.AddManipulator(_dragger);
|
|
}
|
|
protected void BuildWindow(VisualTreeAsset visualTreeAsset){
|
|
if(visualTreeAsset != null){
|
|
visualTreeAsset.CloneTree(this);
|
|
}
|
|
}
|
|
|
|
public SimpleGraphSubWindow(string defaultUxml=null){
|
|
style.position = new StyleEnum<Position>(Position.Absolute);
|
|
ConstructWindowBasicSetting();
|
|
if (defaultUxml != null){
|
|
var uxml = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(defaultUxml);
|
|
BuildWindow(uxml);
|
|
}
|
|
}
|
|
public SimpleGraphSubWindow(VisualTreeAsset visualTreeAsset){
|
|
style.position = new StyleEnum<Position>(Position.Absolute);
|
|
ConstructWindowBasicSetting();
|
|
BuildWindow(visualTreeAsset);
|
|
}
|
|
|
|
public string GetPersistenceId(){
|
|
throw new System.NotImplementedException();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} |