Ejemplo n.º 1
0
 /// <summary>
 /// Generate graph sync data based on the input Dynamo custom node information.
 /// Return false if all nodes are clean.
 /// </summary>
 /// <param name="def"></param>
 /// <param name="nodes"></param>
 /// <param name="outputs"></param>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public bool GenerateGraphSyncDataForCustomNode(
     CustomNodeDefinition def,
     IEnumerable <NodeModel> nodes,
     IEnumerable <AssociativeNode> outputs,
     IEnumerable <string> parameters)
 {
     lock (macroMutex)
     {
         astBuilder.CompileCustomNodeDefinition(def, nodes, outputs, parameters);
         return(VerifyGraphSyncData());
     }
 }
Ejemplo n.º 2
0
        internal GraphSyncData ComputeSyncData(CompileCustomNodeParams initParams)
        {
            astBuilder.CompileCustomNodeDefinition(
                initParams.Definition,
                initParams.Nodes,
                initParams.Outputs,
                initParams.Parameters);

            if (!VerifyGraphSyncData() || ((graphSyncDataQueue.Count <= 0)))
            {
                return(null);
            }

            return(graphSyncDataQueue.Dequeue());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Generate graph sync data based on the input Dynamo custom node information.
        /// Return false if all nodes are clean.
        /// </summary>
        /// <param name="nodes"></param>
        /// <param name="definition"></param>
        /// <param name="verboseLogging"></param>
        /// <returns></returns>
        public bool GenerateGraphSyncDataForCustomNode(IEnumerable <NodeModel> nodes, CustomNodeDefinition definition, bool verboseLogging)
        {
            lock (macroMutex)
            {
                // Any graph updates through the scheduler no longer store their
                // GraphSyncData in 'graphSyncDataQueue' (any such entry will be
                // withdrawn from the queue and get associated with an AsyncTask.
                // This check is to ensure that such case does not exist.
                //
                if (graphSyncDataQueue.Count > 0)
                {
                    throw new InvalidOperationException(
                              "'graphSyncDataQueue' is not empty");
                }

                astBuilder.CompileCustomNodeDefinition(
                    definition.FunctionId,
                    definition.ReturnKeys,
                    definition.FunctionName,
                    definition.FunctionBody,
                    definition.OutputNodes,
                    definition.Parameters,
                    verboseLogging);

                if (!VerifyGraphSyncData(nodes) || (graphSyncDataQueue.Count == 0))
                {
                    return(false);
                }

                // GraphSyncData objects accumulated through the compilation above
                // will be stored in 'pendingCustomNodeSyncData'. Entries in this
                // queue will be used to update custom node graph prior to updating
                // the graph for the home workspace.
                //
                while (graphSyncDataQueue.Count > 0)
                {
                    var graphSyncData = graphSyncDataQueue.Dequeue();
                    pendingCustomNodeSyncData.Enqueue(graphSyncData);
                }

                return(true);
            }
        }