public RootSOTreeView(RootSO rootSO, EditorWindow editor) { _rootSO = rootSO; style.flexGrow = 1; style.flexShrink = 1; SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale); Insert(0, new GridBackground()); var contentDragger = new ContentDragger(); //default activator requires Alt key. Alt key is tired. contentDragger.activators.Add(new ManipulatorActivationFilter() { button = MouseButton.LeftMouse, }); // item dragging is prior to view dragging. this.AddManipulator(new SelectionDragger()); this.AddManipulator(contentDragger); var provider = ScriptableObject.CreateInstance <NodeSearchWindowProvider>(); provider.Initialize(this, editor); nodeCreationRequest += context => { SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), provider); }; }
public static void Show(RootSO rootSO) { var window = Create(rootSO); window.Show(); window.Focus(); }
private static void StructGraphView(GraphEditorWindow window, RootSO behaviorTree) { window.rootVisualElement.Clear(); var graphView = new RootSOTreeView(behaviorTree, window); graphView.Restore(); window.rootVisualElement.Add(window.CreateToolBar(graphView)); window.rootVisualElement.Add(graphView); }
public RootNode() { SetBehavior(typeof(Root)); title = "Root"; Child = CreateChildPort(); outputContainer.Add(Child); RootSO rootSO = ScriptableObject.CreateInstance <RootSO>(); rootSO.name = "New Behavior Root"; }
private static GraphEditorWindow Create(RootSO root) { var key = root.GetInstanceID(); if (cache.ContainsKey(key)) { return(cache[key]); } var window = CreateInstance <GraphEditorWindow>(); StructGraphView(window, root); window.titleContent = new GUIContent($"BehaviorTree Editor({root.name})"); window.key = key; cache[key] = window; return(window); }
public void PostCommit(RootSO rootSO) { rootSO.SetRoot(NodeBehavior as Root); }