コード例 #1
0
        static uint AddOperationToGraph(IOperation op, DataGraph <IOperation> graph, uint parentID)
        {
            if (op == null)
            {
                return(0);
            }

            // We link this node to parent (and potencially create it if it does not exist).
            uint id;

            if (!graph.Contains(op, out id))
            {
                id = graph.AddNode(op);
            }

            // We add link only if parent exists and the link does not yet exist.
            if (parentID != uint.MaxValue && !graph.LinkExistsDirectional(parentID, id))
            {
                graph.LinkDirectional(parentID, id);
            }

            // We do recursevelly for children.
            foreach (Pin p in op.Inputs)
            {
                AddOperationToGraph(p.Owner, graph, id);
            }

            // We return self id.
            return(id);
        }
コード例 #2
0
    protected virtual DataGraphNode OnCreateDataNode()
    {
        DataGraphNode newNode = CreateInstance <DataGraphNode>();

        AssetDatabase.AddObjectToAsset(newNode, assetPath + Path.DirectorySeparatorChar + dataGraph.name + ".asset");

        newNode.uiSettings = null;

        dataGraph.AddNode(newNode);
        OnNodeEditorDataChange();

        Debug.Log(newNode.uiSettings);

        return(newNode);
    }