Exemple #1
0
        /// <summary>
        /// Initializes search window for a given graph and editor window
        /// </summary>
        /// <param name="editorWindow"></param>
        /// <param name="graphView"></param>
        public void Init(BTEditorWindow editorWindow, BTGraphView graphView)
        {
            _editorWindow = editorWindow;
            _graphView    = graphView;

            // This is a hack to avoid wacky indentation because of wack unity stuff
            _indentationIcon = new Texture2D(1, 1);
            _indentationIcon.SetPixel(0, 0, new Color(0, 0, 0, 0));
            _indentationIcon.Apply();
        }
Exemple #2
0
        // Initialize graphview with manipulater presets
        public BTGraphView(BTEditorWindow editorWindow)
        {
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());

            contextField = new ObjectField {
                objectType = typeof(GlobalData)
            };

            AddElement(GenerateEntryPointNode("Top Node"));
            AddNodeSearchWindow(editorWindow);
        }
Exemple #3
0
        /// <summary>
        /// Loads savedata into graph view (overwrites active graph)
        /// </summary>
        /// <param name="fileName"></param>
        public void LoadGraph(string fileName)
        {
            // Load data based on filename
            _containerCache = Resources.Load <BTDataContainer>(fileName);

            BTEditorWindow.SetFileLoadFieldValue(_containerCache);

            if (_containerCache == null)
            {
                EditorUtility.DisplayDialog("File Not Found", "Given file does not exist :(", "Ok");
                return;
            }

            ClearGraph();
            CreateNodes();
            ConnectNodes();
            _targetGraphView.contextField.value = _containerCache.globalData;
        }
Exemple #4
0
 // Generates and adds a search window to a given editorwindow
 private void AddNodeSearchWindow(BTEditorWindow editorWindow)
 {
     _addNodeSearchWindow = ScriptableObject.CreateInstance <AddNodeSearchWindow>();
     _addNodeSearchWindow.Init(editorWindow, this);
     nodeCreationRequest = context => SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), _addNodeSearchWindow);
 }