Exemplo n.º 1
0
 protected override void Setup()
 {
     wantsMouseMove            = true;
     canDrawUI                 = false;
     WindowInstance            = this as ConstellationUnityWindow;
     SceneManager.sceneLoaded += OnSceneLoaded;
     EditorApplication.playModeStateChanged += OnPlayStateChanged;
     if (scriptDataService != null)
     {
         nodeEditorPanel = new NodeEditorPanel(this,
                                               this,
                                               scriptDataService.GetCurrentScript(),
                                               this,
                                               scriptDataService.GetEditorData().clipBoard,
                                               scriptDataService.GetLastEditorScrollPositionX(), scriptDataService.GetLastEditorScrollPositionY(), // Saved editor position
                                               OnLinkAdded, OnLinkRemoved, OnNodeAdded, OnNodeRemoved, OnHelpRequested,                            // callBacks
                                               SaveConstellationInstance);
         nodeTabPanel = new ConstellationsTabPanel(this);
         if (scriptDataService.GetCurrentScript() != null)
         {
             WindowInstance.titleContent.text = scriptDataService.GetCurrentScript().name;
         }
         else
         {
             WindowInstance.titleContent.text = "Constellation";
         }
         scriptDataService.ClearActions();
     }
     nodeSelector = new NodeSelectorPanel(OnNodeAddRequested);
 }
Exemplo n.º 2
0
 public LinkView(IGUI _gui, NodeEditorPanel _editor, ConstellationScript _constellationScript, NodeConfig _nodeConfig, LinkRemoved _onLinkRemoved)
 {
     constellationScript = _constellationScript;
     editor         = _editor;
     nodeConfig     = _nodeConfig;
     OnLinkRemoved += _onLinkRemoved;
 }
Exemplo n.º 3
0
 protected void RefreshNodeEditor()
 {
     canDrawUI = false;
     if (scriptDataService != null)
     {
         previousSelectedGameObject = null;
         nodeEditorPanel            = new NodeEditorPanel(this, this, scriptDataService.GetCurrentScript(), this, scriptDataService.GetEditorData().clipBoard, scriptDataService.GetLastEditorScrollPositionX(), scriptDataService.GetLastEditorScrollPositionY(), OnLinkAdded, OnNodeAdded, OnNodeRemoved);
         nodeTabPanel = new ConstellationTabPanel(this);
     }
 }
Exemplo n.º 4
0
 public NodeEditorLinks(ConstellationScript _constellationScript,
                        bool _isInstance,
                        IGUI _gui,
                        NodeConfig _nodeConfig,
                        LinkAdded _onLinkAdded, LinkRemoved _onLinkRemoved,
                        NodeEditorPanel _nodeEditorPannel,
                        IUndoable _undoable)
 {
     OnLinkAdded        += _onLinkAdded;
     OnLinkRemoved      += _onLinkRemoved;
     undoable            = _undoable;
     constellationScript = _constellationScript;
     isInstance          = _isInstance;
     GUI       = _gui;
     LinksView = new LinkView(GUI, _nodeEditorPannel, constellationScript, _nodeConfig, linkRemoved);
 }
Exemplo n.º 5
0
 protected void RefreshNodeEditor()
 {
     canDrawUI = false;
     if (scriptDataService != null)
     {
         previousSelectedGameObject = null;
         nodeEditorPanel            = new NodeEditorPanel(this,
                                                          this,
                                                          scriptDataService.GetCurrentScript(),
                                                          this,
                                                          scriptDataService.GetEditorData().clipBoard,
                                                          scriptDataService.GetLastEditorScrollPositionX(), scriptDataService.GetLastEditorScrollPositionY(), // Editor Position
                                                          OnLinkAdded, OnLinkRemoved, OnNodeAdded, OnNodeRemoved, OnHelpRequested, SaveConstellationInstance,
                                                          scriptDataService.GetAllNestableScriptsInProject());                                                // CallBacks
         nodeTabPanel = new ConstellationsTabPanel(this);
     }
 }
Exemplo n.º 6
0
        protected override void Setup()
        {
            wantsMouseMove            = true;
            canDrawUI                 = false;
            WindowInstance            = this as ConstellationUnityWindow;
            SceneManager.sceneLoaded += OnSceneLoaded;
            EditorApplication.playModeStateChanged += OnPlayStateChanged;
            scriptDataService     = new ConstellationEditorDataService();
            ConstellationCompiler = new ConstellationCompiler();
            scriptDataService.RefreshConstellationEditorDataList();

            if (scriptDataService.OpenEditorData().LastOpenedConstellationPath == null)
            {
                return;
            }

            if (scriptDataService.OpenEditorData().LastOpenedConstellationPath.Count != 0)
            {
                var scriptData = scriptDataService.Recover(scriptDataService.OpenEditorData().LastOpenedConstellationPath[0]);
            }
            RequestCompilation();
            if (scriptDataService != null)
            {
                nodeEditorPanel = new NodeEditorPanel(this,
                                                      this,
                                                      scriptDataService.GetCurrentScript(),
                                                      this,
                                                      scriptDataService.GetEditorData().clipBoard,
                                                      scriptDataService.GetLastEditorScrollPositionX(), scriptDataService.GetLastEditorScrollPositionY(), // Saved editor position
                                                      OnLinkAdded, OnLinkRemoved, OnNodeAdded, OnNodeRemoved, OnHelpRequested,                            // callBacks
                                                      SaveConstellationInstance,
                                                      scriptDataService.GetAllNestableScriptsInProject());
                nodeTabPanel = new ConstellationsTabPanel(this);
                if (scriptDataService.GetCurrentScript() != null)
                {
                    WindowInstance.titleContent.text = scriptDataService.GetCurrentScript().name;
                }
                else
                {
                    WindowInstance.titleContent.text = "Constellation";
                }
                scriptDataService.ClearActions();
            }
            nodeSelector = new NodeSelectorPanel(OnNodeAddRequested, scriptDataService.GetAllCustomNodesNames());
        }
Exemplo n.º 7
0
        public NodeView(NodeData _node, NodeEditorPanel _editor, NodeConfig _nodeConfig, ConstellationScript _constellation)
        {
            nodeConfig = _nodeConfig;
            var nodeWidth = nodeConfig.NodeWidth;

            if (_node.GetAttributes().Length > 0)
            {
                nodeWidth = nodeConfig.NodeWidthAsAttributes;
            }
            Rect   = new Rect(_node.XPosition, _node.YPosition, nodeWidth, (Mathf.Max(Mathf.Max(_node.Inputs.Count, _node.Outputs.Count), _node.AttributesData.Count) * nodeConfig.InputSize) + nodeConfig.TopMargin);
            node   = _node;
            editor = _editor;
            constellationScript = _constellation;

            foreach (var attribute in node.AttributesData)
            {
                attribute.Value = AttributeStyleFactory.Reset(attribute.Type, attribute.Value);
            }
        }
Exemplo n.º 8
0
 public LinkView(IGUI _gui, NodeEditorPanel _editor, ConstellationScript _constellationScript, NodeConfig _nodeConfig)
 {
     constellationScript = _constellationScript;
     editor     = _editor;
     nodeConfig = _nodeConfig;
 }