コード例 #1
0
        /// <summary> Creates a copy of the original node in the graph </summary>
        public virtual Node CopyNode(Node original)
        {
            Node.graphHotfix = this;
            Node node = ScriptableObject.Instantiate(original);

            node.graph = this;
            node.ClearConnections();
            nodes.Add(node);
            return(node);
        }
コード例 #2
0
ファイル: NodeGraph.cs プロジェクト: Kristianhj/xNode
        /// <summary> Safely remove a node and all its connections </summary>
        /// <param name="node"> The node to remove </param>
        public virtual void RemoveNode(Node node)
        {
            node.ClearConnections();
            nodes.Remove(node);
#if !NON_SCRIPTABLE
            if (Application.isPlaying)
            {
                Destroy(node);
            }
#endif
        }
コード例 #3
0
ファイル: NodeGraph.cs プロジェクト: geekrelief/xNode
        /// <summary> Safely remove a node and all its connections </summary>
        /// <param name="node"></param>
        public void RemoveNode(Node node)
        {
            node.ClearConnections();
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                DestroyImmediate(node, true);
                UnityEditor.AssetDatabase.SaveAssets();
            }
#endif
            nodes.Remove(node);
        }
コード例 #4
0
        /// <summary> Safely remove a node and all its connections </summary>
        /// <param name="node"></param>
        public void RemoveNode(Node node)
        {
#if UNITY_EDITOR
            UnityEditor.Undo.RecordObject(this, "Remove Node");
#endif
            node.ClearConnections();
            nodes.Remove(node);
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                DestroyImmediate(node, true);
            }
            UnityEditor.EditorUtility.SetDirty(this);
#endif
        }
コード例 #5
0
ファイル: NodeGraph.cs プロジェクト: geekrelief/xNode
        /// <summary> Creates a copy of the original node in the graph </summary>
        public virtual Node CopyNode(Node original)
        {
            Node node = ScriptableObject.Instantiate(original);

            node.ClearConnections();
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                UnityEditor.AssetDatabase.AddObjectToAsset(node, this);
                UnityEditor.AssetDatabase.SaveAssets();
            }
#endif
            nodes.Add(node);
            node.graph = this;
            return(node);
        }
コード例 #6
0
        /// <summary> Creates a copy of the original node in the graph </summary>
        public virtual INode CopyNode(INode original)
        {
            Node castedNode = original as Node;

            if (castedNode == null)
            {
                throw new ArgumentException("NodeGraph can only copy nodes scriptable objects");
            }

            Node.graphHotfix = this;
            Node node = ScriptableObject.Instantiate(castedNode);

            node.graph = this;
            node.ClearConnections();
            nodes.Add(node);
            return(node);
        }
コード例 #7
0
        /// <summary> Creates a copy of the original node in the graph </summary>
        public virtual Node CopyNode(Node original)
        {
#if UNITY_EDITOR
            UnityEditor.Undo.RecordObject(this, "Copy Node");
#endif
            Node node = ScriptableObject.Instantiate(original);
            node.ClearConnections();
            nodes.Add(node);
            node.graph = this;
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                UnityEditor.AssetDatabase.AddObjectToAsset(node, this);
                node.name = UnityEditor.ObjectNames.NicifyVariableName(node.name);
            }
            UnityEditor.EditorUtility.SetDirty(this);
#endif
            return(node);
        }
コード例 #8
0
ファイル: NodeGraph.cs プロジェクト: liuruoyu1981/xNode
 /// <summary> Safely remove a node and all its connections </summary>
 /// <param name="node"></param>
 public void RemoveNode(Node node)
 {
     node.ClearConnections();
     nodes.Remove(node);
 }