Пример #1
0
        public RCActionCompositorNodeInit(RendererContext rc, CompositorNode node)
        {
            RendererContext = rc;
            Node = node;

            WasCalled = false;
        }
Пример #2
0
 public void AddNode(CompositorNode node)
 {
     lock (graphLock)
     {
         node.Active = true;
         _Nodes.Add(_CompositorGraph.AddNode(node));
     }
 }
Пример #3
0
        public void AddConnection(CompositorNode begin, CompositorNode end, int begin_slot = 0, int end_slot = 0)
        {
            lock (graphLock)
            {                
                //This f**k is f*****g crazy.... 
                CompositorEdgeDescription desc = new CompositorEdgeDescription();
                desc.InputSlotIndex = end_slot;
                desc.OutputSlotIndex = begin_slot;
                desc.Active = true;
                desc.Input = begin;
                desc.Output = end;
               
                if (begin == null || end == null)
                {
                    Logger.Log.AddLogEntry(LogLevel.Error, "BasicCompositor", Status.Meh);
                    return;
                }
                    
                DirectedWeightedEdge<CompositorNode, CompositorEdgeDescriptionListWrapper> gedge = null;

                DirectedWeightedNode<CompositorNode, CompositorEdgeDescriptionListWrapper> gnode_begin = null;
                DirectedWeightedNode<CompositorNode, CompositorEdgeDescriptionListWrapper> gnode_end = null;

                //Find begin and end node
                _Nodes.ForEach(x => {if(x.Data.ID == begin.ID) gnode_begin = x;});
                _Nodes.ForEach(x =>
                    {
                        if (x.Data.ID == end.ID)
                            gnode_end = x;
                    });

                if (gnode_begin == null || gnode_end == null)
                {
                    Logger.Log.AddLogEntry(LogLevel.Error, "BasicCompositor", Status.BadArgument);
                    return;
                }



                if ((gnode_begin.Data.OutputSlots != null && gnode_begin.Data.OutputSlots.Length <= begin_slot) || 
                    (gnode_end.Data.InputSlots != null && gnode_end.Data.InputSlots.Length <= end_slot))
                {
                    Logger.Log.AddLogEntry(LogLevel.Error, "BasicCompositor", Status.BadArgument);
                    return;
                }
                    
                //Is there an edge with this nodes?
                _Edges.ForEach(x =>
                    {
                        if(x.SourceNode.InstId == gnode_begin.InstId && x.DestinationNode.InstId == gnode_end.InstId)
                            gedge = x;
                    });

                if (gedge == null)
                {
                    CompositorEdgeDescriptionListWrapper wrap = new CompositorEdgeDescriptionListWrapper();
                    wrap.Descriptions.Add(desc);
                    _Edges.Add(_CompositorGraph.AddEdge(gnode_begin, gnode_end, wrap));
                }
                else
                    gedge.Weight.Descriptions.Add(desc);
            }
        }
Пример #4
0
        public void DeleteNode(CompositorNode node)
        {
            lock (graphLock)
            {
                DirectedWeightedNode<CompositorNode, CompositorEdgeDescriptionListWrapper> gnode = null;

                _Nodes.ForEach(x =>
                    {
                        if (x.Data.ID == node.ID)
                            gnode = x;
                    });

                _CompositorGraph.RemoveNode(gnode);
            }
        }