コード例 #1
0
        public void RessetInstancesPath()
        {
            var constellationsToRemove = new List <ConstellationScriptInfos>();

            foreach (var constellationScriptInfo in OpenedScripts)
            {
                if (constellationScriptInfo.IsIstance)
                {
                    AssetDatabase.DeleteAsset(constellationScriptInfo.InstancePath);
                }
            }

            if (OpenedScripts != null)
            {
                foreach (var path in OpenedScripts)
                {
                    ConstellationScript t = (ConstellationScript)AssetDatabase.LoadAssetAtPath(path.ScriptPath, typeof(ConstellationScript));
                    if (t == null)
                    {
                        constellationsToRemove.Add(path);
                    }
                }

                foreach (var constellationToRemove in constellationsToRemove)
                {
                    OpenedScripts.Remove(constellationToRemove);
                }
            }
            if (Directory.Exists(tempPath))
            {
                Directory.Delete(tempPath, true);
            }
            Directory.CreateDirectory(tempPath);
            SaveEditorData();
        }
コード例 #2
0
 public LinkView(IGUI _gui, NodeEditorPanel _editor, ConstellationScript _constellationScript, NodeConfig _nodeConfig, LinkRemoved _onLinkRemoved)
 {
     constellationScript = _constellationScript;
     editor         = _editor;
     nodeConfig     = _nodeConfig;
     OnLinkRemoved += _onLinkRemoved;
 }
コード例 #3
0
        public ConstellationScript New()
        {
            Script = ScriptableObject.CreateInstance <ConstellationBehaviourScript>();
            var path = EditorUtility.SaveFilePanel("Save Constellation", Application.dataPath, "NewConstellation" + ".asset", "asset");

            if (path.StartsWith(Application.dataPath))
            {
                path = "Assets" + path.Substring(Application.dataPath.Length);
            }

            if (path == null || path == "")
            {
                return(null);
            }
            AssetDatabase.CreateAsset(Script, path);
            if (OpenedScripts == null)
            {
                OpenedScripts = new List <ConstellationScriptInfos>(EditorData.LastOpenedConstellationPath.ToArray());
            }

            OpenedScripts.Insert(0, new ConstellationScriptInfos(path, ConstellationScriptInfos.ConstellationScriptTag.NoTag, false));
            var name = Path.GetFileNameWithoutExtension(path.Split('/').Last());

            Script.script.Name = name;
            SaveEditorData();
            SaveScripts();
            RefreshConstellationEditorDataList();
            return(Script);
        }
コード例 #4
0
 public NodeEditorNodes(EditorWindow _editorWindow,
                        NodeConfig _nodeConfig,
                        ConstellationScript _constellationScript,
                        IUndoable _undoable,
                        NodeEditorSelection _nodeEditorSelection,
                        ILinkEditor _linkEditor,
                        IGUI _gui,
                        IVisibleObject _visibleObject,
                        NodeAdded _nodeAdded,
                        NodeRemoved _nodeRemoved,
                        HelpClicked _helpClicked)
 {
     linkEditor          = _linkEditor;
     editorWindow        = _editorWindow;
     Nodes               = new List <NodeView> ();
     nodeConfig          = _nodeConfig;
     constellationScript = _constellationScript;
     isInstance          = constellationScript.IsInstance;
     nodesFactory        = new NodesFactory();
     undoable            = _undoable;
     nodeEditorSelection = _nodeEditorSelection;
     GUI            = _gui;
     visibleObject  = _visibleObject;
     OnNodeAdded   += _nodeAdded;
     OnNodeRemoved += _nodeRemoved;
     OnHelpClicked += _helpClicked;
     SetNodes();
 }
コード例 #5
0
        public ConstellationScript New()
        {
            Script = ScriptableObject.CreateInstance <ConstellationScript> ();
            var path = EditorUtility.SaveFilePanel("Save Constellation", Application.dataPath, "NewConstellation" + ".asset", "asset");

            if (path.StartsWith(Application.dataPath))
            {
                path = "Assets" + path.Substring(Application.dataPath.Length);
            }

            if (path == null || path == "")
            {
                Script = null;
                return(Script);
            }
            AssetDatabase.CreateAsset(Script, path);
            if (currentPath == null)
            {
                currentPath = new List <string> (EditorData.LastOpenedConstellationPath.ToArray());
            }

            currentPath.Insert(0, path);
            SaveEditorData();
            return(Script);
        }
コード例 #6
0
        public NodeEditorPanel(IGUI _gui,
                               EditorWindow _editorWindow,
                               ConstellationScript _script,
                               IUndoable _undoable,
                               ClipBoard _editorClipBoard,
                               float positionX,
                               float positionY,
                               LinkAdded linkAdded,
                               NodeAdded nodeAdded,
                               NodeRemoved nodeRemoved)
        {
            nodesFactory        = new NodesFactory();
            constellationScript = _script;
            undoable            = _undoable;
            Nodes            = new List <NodeView> ();
            GUI              = _gui;
            EditorWindow     = _editorWindow;
            editorScrollSize = new Vector2(500, 500);
            Background       = AssetDatabase.LoadAssetAtPath(editorPath + "background.png", typeof(Texture2D)) as Texture2D;
            var allNodes = NodesFactory.GetAllNodes();

            nodes           = new string[allNodes.Length];
            editorScrollPos = new Vector2(positionX, positionY);
            for (var i = 0; i < allNodes.Length; i++)
            {
                nodes[i] = allNodes[i];
            }
            OnLinkAdded        += linkAdded;
            OnNodeAdded        += nodeAdded;
            OnNodeRemoved      += nodeRemoved;
            nodeEditorSelection = new NodeEditorSelection(GUI, _editorClipBoard);
        }
コード例 #7
0
    public void OpenConstellationInstance <T>(Constellation.Constellation constellation, string path) where T : ConstellationScript
    {
        ScriptDataService.OpenConstellationInstance <T>(constellation, path);
        ConstellationScript = ScriptDataService.Script;
        ConstellationScript.ScriptAssembly = ScriptDataService.GetEditorData().ScriptAssembly;

        SetupNodeWindow();
    }
コード例 #8
0
    public void New()
    {
        var newConstellation = ScriptDataService.New();

        if (newConstellation != null)
        {
            ConstellationScript = newConstellation;
            SetupNodeWindow();
            RequestRepaint();
        }
    }
コード例 #9
0
    public void Open(ConstellationScriptInfos _path)
    {
        var openedConstellation = ScriptDataService.OpenConstellation(_path);

        if (openedConstellation != null)
        {
            ConstellationScript = openedConstellation;
            SetupNodeWindow();
            Save();
        }
    }
コード例 #10
0
        public void OpenConstellationInstance(Constellation.Constellation constellation, string instanceSourcePath)
        {
            var constellationScript = ScriptableObject.CreateInstance <ConstellationScript> ();

            constellationScript.IsInstance = true;
            var path = "Assets/Constellation/Editor/EditorData/Temp/" + constellation.Name + "(Instance).asset";

            if (path == null || path == "")
            {
                Script = null;
                return;
            }

            Script = constellationScript;
            AssetDatabase.CreateAsset(constellationScript, path);

            var nodes = constellation.GetNodes();
            var links = constellation.GetLinks();

            if (EditorData.CurrentInstancePath == null)
            {
                EditorData.CurrentInstancePath = new List <ConstellationInstanceObject> ();
            }

            currentInstancePath = new List <ConstellationInstanceObject> (EditorData.CurrentInstancePath);
            var newInstanceObject = new ConstellationInstanceObject(path, instanceSourcePath);

            currentInstancePath.Add(newInstanceObject);

            currentPath = new List <string> (EditorData.LastOpenedConstellationPath);
            if (!currentPath.Contains(path))
            {
                currentPath.Insert(0, path);
            }
            else
            {
                currentPath.Remove(path);
                currentPath.Insert(0, path);
            }

            foreach (var node in nodes)
            {
                Script.AddNode(node);
            }

            foreach (var link in links)
            {
                Script.AddLink(link);
            }

            SaveEditorData();
        }
コード例 #11
0
        public ConstellationScript ConvertToConstellationNodeScript()
        {
            OpenedScripts[0].ScriptTag = ConstellationScriptInfos.ConstellationScriptTag.Tutorial;
            var scriptPath    = OpenedScripts[0].ScriptPath;
            var tutorialAsset = ScriptableObject.CreateInstance <ConstellationStaticNodeScript>();

            tutorialAsset.script = Script.script;
            AssetDatabase.DeleteAsset(scriptPath);
            AssetDatabase.CreateAsset(tutorialAsset, scriptPath);
            Script = tutorialAsset;
            RefreshConstellationEditorDataList();
            return(Script);
        }
コード例 #12
0
        public void SetConstellation(ConstellationScript script, ConstellationScriptData[] constellationScripts)
        {
            if (isInitialized) // do not initialize twice
            {
                return;
            }

            constellation = new Constellation();

            if (ConstellationComponent.eventSystem == null)
            {
                eventSystem = new ConstellationEventSystem();
            }

            if (NodesFactory.Current == null)
            {
                nodesFactory = new NodesFactory(constellationScripts);
            }
            else
            {
                nodesFactory = NodesFactory.Current;
            }

            var nodes = ConstellationData.GetNodes();

            constellation = new Constellation();
            //SetNodes(nodes);

            var links = ConstellationData.GetLinks();

            foreach (LinkData link in links)
            {
                var input  = constellation.GetInput(link.Input.Guid);
                var output = constellation.GetOutput(link.Output.Guid);
                if (input != null && output != null)
                {
                    constellation.AddLink(new Link(constellation.GetInput(link.Input.Guid),
                                                   constellation.GetOutput(link.Output.Guid),
                                                   constellation.GetOutput(link.Output.Guid).Type, link.GUID));
                }
            }

            //SetUnityObject();
            constellation.Initialize(System.Guid.NewGuid().ToString(), ConstellationData.name);
            if (constellation.GetInjector() is IAwakable)
            {
                constellation.GetInjector().OnAwake();
            }

            isInitialized = true;
        }
コード例 #13
0
        public ConstellationScript ConvertCurrentConstellationToTutorial()
        {
            OpenedScripts[0].ScriptTag = ConstellationScriptInfos.ConstellationScriptTag.Tutorial;
            var scriptPath    = OpenedScripts[0].ScriptPath;
            var tutorialAsset = ScriptableObject.CreateInstance <ConstellationTutorialScript>();

            tutorialAsset.script = Script.script;
            AssetDatabase.DeleteAsset(scriptPath);
            AssetDatabase.CreateAsset(tutorialAsset, scriptPath);
            Script = tutorialAsset;
            Script.CanChangeType = false;
            RefreshConstellationEditorDataList();
            return(Script);
        }
コード例 #14
0
 protected void OnNodeRemoved(NodeData node)
 {
     if (node.Name == Constellation.ConstellationTypes.Tutorial.NAME)
     {
         ConstellationScript = ScriptDataService.ConvertToConstellationScript();
     }
     else if (node.Name == Constellation.ConstellationTypes.StaticConstellationNode.NAME)
     {
         ConstellationScript = ScriptDataService.ConvertToConstellationScript();
     }
     if (Application.isPlaying && previousSelectedGameObject != null && ConstellationScript.IsInstance)
     {
         currentEditableConstellation.RemoveNode(node);
         ConstellationScript.IsDifferentThanSource = true;
     }
 }
コード例 #15
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);
 }
コード例 #16
0
        public ConstellationScript OpenConstellation(string _path = "", bool save = true)
        {
            var path = "";

            if (_path == "")
            {
                path = EditorUtility.OpenFilePanel("Load constellation", Application.dataPath, "asset");
                if (path.Length == 0)
                {
                    return(null);
                }
            }
            else
            {
                path = _path;
            }

            if (path.StartsWith(Application.dataPath))
            {
                path = "Assets" + path.Substring(Application.dataPath.Length);
            }
            ConstellationScript t = (ConstellationScript)AssetDatabase.LoadAssetAtPath(path, typeof(ConstellationScript));

            Script = t;
            if (Script == null)
            {
                throw new ScriptNotFoundAtPath(_path);
            }

            currentPath = new List <string> (EditorData.LastOpenedConstellationPath);
            if (!currentPath.Contains(path))
            {
                currentPath.Insert(0, path);
            }
            else
            {
                currentPath.Remove(path);
                currentPath.Insert(0, path);
            }

            if (save)
            {
                SaveEditorData();
            }

            return(t);
        }
コード例 #17
0
        public ConstellationScript Recover(string _path)
        {
            ConstellationScript t = (ConstellationScript)AssetDatabase.LoadAssetAtPath(_path, typeof(ConstellationScript));

            Script = t;
            if (t != null)
            {
                currentPath = new List <string> (EditorData.LastOpenedConstellationPath);
                currentPath.Remove(_path);
                currentPath.Insert(0, _path);
                return(t);
            }
            else
            {
                return(null);
            }
        }
コード例 #18
0
        public ConstellationScript Recover(ConstellationScriptInfos _scriptInfos)
        {
            ConstellationScript t = (ConstellationScript)AssetDatabase.LoadAssetAtPath(_scriptInfos.ScriptPath, typeof(ConstellationScript));

            Script = t;
            if (t != null)
            {
                OpenedScripts = new List <ConstellationScriptInfos>(EditorData.LastOpenedConstellationPath);
                OpenedScripts.Remove(_scriptInfos);
                OpenedScripts.Insert(0, _scriptInfos);
                return(t);
            }
            else
            {
                throw new ScriptNotFoundAtPath(_scriptInfos.ScriptPath);
            }
        }
コード例 #19
0
        public void SaveInstance()
        {
            var newScript = ScriptableObject.CreateInstance <ConstellationScript> ();
            var path      = "";

            foreach (var instancePath in currentInstancePath)
            {
                if (instancePath.InstancePath == currentPath[0])
                {
                    path = instancePath.ScriptPath;
                }
            }
            AssetDatabase.CreateAsset(newScript, path);
            newScript.script = Script.script;
            Save();
            Script = newScript;
        }
コード例 #20
0
        public NodeWindow(string _editorPath, ConstellationScript _constellationScript)
        {
            var backgroundTexture = AssetDatabase.LoadAssetAtPath(editorPath + "background.png", typeof(Texture2D)) as Texture2D;

            background          = new NodeEditorBackground(backgroundTexture);
            editorPath          = _editorPath;
            SelectedNodes       = new List <NodeView>();
            Nodes               = new List <NodeView>();
            ConstellationScript = _constellationScript;
            Links               = new LinksView(ConstellationScript);
            NodeFactory         = new NodesFactory(ConstellationScript?.ScriptAssembly?.GetAllScriptData());

            foreach (var node in _constellationScript.GetNodes())
            {
                DisplayNode(node);
            }
        }
コード例 #21
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);
            }
        }
コード例 #22
0
        public NodeEditorPanel(IGUI _gui,
                               EditorWindow _editorWindow,
                               ConstellationScript _script,
                               IUndoable _undoable,
                               ClipBoard _editorClipBoard,
                               float positionX,
                               float positionY,
                               NodeEditorLinks.LinkAdded linkAdded,
                               NodeEditorLinks.LinkRemoved onLinkRemoved,
                               NodeEditorNodes.NodeAdded nodeAdded,
                               NodeEditorNodes.NodeRemoved nodeRemoved,
                               NodeEditorNodes.HelpClicked onHelpClicked,
                               ApplyInstanceChanges applyInstanceChanges,
                               ConstellationScriptData[] _constellationScripts)
        {
            constellationScripts = _constellationScripts;
            constellationScript  = _script;
            undoable             = _undoable;
            GUI              = _gui;
            EditorWindow     = _editorWindow;
            editorScrollSize = new Vector2(500, 500);
            var backgroundTexture = AssetDatabase.LoadAssetAtPath(editorPath + "background.png", typeof(Texture2D)) as Texture2D;

            Background = new NodeEditorBackground(GUI, backgroundTexture);

            var allNodes = NodesFactory.GetAllNodes();

            nodes           = new string[allNodes.Length];
            editorScrollPos = new Vector2(positionX, positionY);

            for (var i = 0; i < allNodes.Length; i++)
            {
                nodes[i] = allNodes[i];
            }
            OnLinkAdded            += linkAdded;
            OnNodeAdded            += nodeAdded;
            OnNodeRemoved          += nodeRemoved;
            OnApplyInstanceChanges += applyInstanceChanges;
            OnHelpClicked          += onHelpClicked;
            OnLinkRemoved          += onLinkRemoved;
            nodeEditorSelection     = new NodeEditorSelection(GUI, _editorClipBoard);
            RequestSetup();
        }
コード例 #23
0
        public void RessetInstancesPath()
        {
            var constellationsToRemove = new List <string> ();

            if (currentInstancePath != null)
            {
                foreach (var constellationInstanceObject in currentInstancePath)
                {
                    AssetDatabase.DeleteAsset(constellationInstanceObject.InstancePath);
                }
            }

            if (currentPath != null)
            {
                foreach (var path in currentPath)
                {
                    ConstellationScript t = (ConstellationScript)AssetDatabase.LoadAssetAtPath(path, typeof(ConstellationScript));
                    if (t == null)
                    {
                        throw new ConstellationScriptDataDoesNotExist();
                    }
                    if (t.IsInstance)
                    {
                        constellationsToRemove.Add(path);
                    }
                }

                foreach (var constellationToRemove in constellationsToRemove)
                {
                    currentPath.Remove(constellationToRemove);
                }
            }
            currentInstancePath = new List <ConstellationInstanceObject> ();
            if (Directory.Exists(tempPath))
            {
                Directory.Delete(tempPath, true);
            }
            Directory.CreateDirectory(tempPath);
            SaveEditorData();
        }
コード例 #24
0
        public void OpenConstellationInstance <T> (Constellation.Constellation constellation, string instanceSourcePath) where T : ConstellationScript
        {
            var constellationScript = ScriptableObject.CreateInstance <T>();

            constellationScript.IsInstance    = true;
            constellationScript.CanChangeType = false;
            var path = "Assets/Constellation/Editor/EditorData/Temp/" + constellation.Name + "(Instance).asset";

            Script = constellationScript;
            AssetDatabase.CreateAsset(constellationScript, path);

            var nodes = constellation.GetNodes();
            var links = constellation.GetLinks();

            var newInstanceObject = new ConstellationScriptInfos(instanceSourcePath, ConstellationScriptInfos.ConstellationScriptTag.NoTag, true, path);

            OpenedScripts = new List <ConstellationScriptInfos>(EditorData.LastOpenedConstellationPath);
            if (!OpenedScripts.Contains(newInstanceObject))
            {
                OpenedScripts.Insert(0, newInstanceObject);
            }
            else
            {
                OpenedScripts.Remove(newInstanceObject);
                OpenedScripts.Insert(0, newInstanceObject);
            }

            foreach (var node in nodes)
            {
                Script.AddNode(node);
            }

            foreach (var link in links)
            {
                Script.AddLink(link);
            }

            SaveEditorData();
        }
コード例 #25
0
ファイル: NodeWindow.cs プロジェクト: rhl2073/Constellation
        public NodeWindow(string _editorPath, ConstellationEditorDataService _constellationEditorData, Vector2 windowSize, Vector2 scrollPosition)
        {
            farNodeX         = windowSize.x;
            farNodeY         = windowSize.y;
            editorScrollSize = new Vector2(farNodeX + 400, farNodeY + 400);
            ScrollPosition   = scrollPosition;
            var backgroundTexture = AssetDatabase.LoadAssetAtPath(editorPath + "background.png", typeof(Texture2D)) as Texture2D;

            background          = new NodeEditorBackground(backgroundTexture);
            editorPath          = _editorPath;
            SelectedNodes       = new List <NodeView>();
            Nodes               = new List <NodeView>();
            EditorData          = _constellationEditorData;
            ConstellationScript = EditorData.Script;
            Links               = new LinksView(ConstellationScript);
            NodeFactory         = new NodesFactory(ConstellationScript.ScriptAssembly.GetAllStaticScriptData());

            foreach (var node in ConstellationScript.GetNodes())
            {
                DisplayNode(node);
            }
        }
コード例 #26
0
        public ConstellationScript OpenConstellation(ConstellationScriptInfos _path = null, bool save = true)
        {
            ConstellationScriptInfos newScriptInfos;

            if (_path == null)
            {
                newScriptInfos = new ConstellationScriptInfos(EditorUtility.OpenFilePanel("Load constellation", Application.dataPath, "asset"),
                                                              ConstellationScriptInfos.ConstellationScriptTag.NoTag,
                                                              false);
                if (newScriptInfos.ScriptPath.Length == 0)
                {
                    return(null);
                }
            }
            else
            {
                newScriptInfos = _path;
            }

            if (newScriptInfos.ScriptPath.StartsWith(Application.dataPath))
            {
                newScriptInfos.ScriptPath = "Assets" + newScriptInfos.ScriptPath.Substring(Application.dataPath.Length);
            }
            ConstellationScript t = (ConstellationScript)AssetDatabase.LoadAssetAtPath(newScriptInfos.ScriptPath, typeof(ConstellationScript));

            Script = t;
            if (Script == null)
            {
                throw new ScriptNotFoundAtPath(_path.ScriptPath);
            }

            OpenedScripts = new List <ConstellationScriptInfos>(EditorData.LastOpenedConstellationPath);
            var isAlreadyOpened = false;
            var openedIndex     = 0;

            foreach (var openedScripts in OpenedScripts)
            {
                if (openedScripts.ScriptPath == newScriptInfos.ScriptPath)
                {
                    isAlreadyOpened = true;
                    break;
                }
                openedIndex++;
            }
            //Debug.Log(openedIndex);
            if (!isAlreadyOpened)
            {
                OpenedScripts.Insert(0, newScriptInfos);
            }
            else
            {
                OpenedScripts.Remove(OpenedScripts[openedIndex]);
                OpenedScripts.Insert(0, newScriptInfos);
            }

            var name = Path.GetFileNameWithoutExtension(newScriptInfos.ScriptPath.Split('/').Last());

            Script.script.Name = name;

            if (save)
            {
                SaveEditorData();
            }

            return(t);
        }
コード例 #27
0
 public LinksView(ConstellationScript _constellationScript, ConstellationEditorRules _constellationRules)
 {
     constellationScript = _constellationScript;
     constellationRules  = _constellationRules;
 }
コード例 #28
0
 public LinkView(IGUI _gui, NodeEditorPanel _editor, ConstellationScript _constellationScript, NodeConfig _nodeConfig)
 {
     constellationScript = _constellationScript;
     editor     = _editor;
     nodeConfig = _nodeConfig;
 }
コード例 #29
0
ファイル: ClipBoard.cs プロジェクト: HustLion/Constellation
        public NodeData[] PasteClipBoard(ConstellationScript constellation)
        {
            if (nodes == null)
            {
                return(null);
            }

            if (nodes.Count == 0)
            {
                return(null);
            }
            var pastedNodes = new List <NodeData> ();
            var pastedLinks = new List <LinkData> ();

            foreach (var node in nodes)
            {
                var newNode = new NodeData(node);
                newNode.XPosition = node.XPosition;
                newNode.YPosition = node.YPosition;
                pastedNodes.Add(newNode);
            }

            foreach (var link in links)
            {
                InputData  input  = null;
                OutputData output = null;
                for (var i = 0; i < nodes.Count; i++)
                {
                    for (var j = 0; j < nodes[i].GetInputs().Length; j++)
                    {
                        if (link.Input.Guid == nodes[i].GetInputs() [j].Guid)
                        {
                            input = nodes[i].GetInputs() [j];
                        }
                    }

                    for (var k = 0; k < nodes[i].GetOutputs().Length; k++)
                    {
                        if (link.Output.Guid == nodes[i].GetOutputs() [k].Guid)
                        {
                            output = nodes[i].GetOutputs() [k];
                        }
                    }
                }
                if (input != null && output != null)
                {
                    pastedLinks.Add(new LinkData(input, output));
                }
            }
            foreach (var node in pastedNodes)
            {
                constellation.AddNode(node);
            }

            foreach (var link in pastedLinks)
            {
                constellation.AddLink(link);
            }

            nodes = null;
            links = null;

            return(pastedNodes.ToArray());
        }
コード例 #30
0
 public LinksView(ConstellationScript _constellationScript)
 {
     constellationScript = _constellationScript;
 }