Esempio n. 1
0
        public void TS_ClearNode(String NodeName)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            foreach (var item in node_m.InputSlot)
            {
                DeleteLine(item.LineName);
            }
            foreach (var item in node_m.OutputSlot)
            {
                DeleteLine(item.LineName);
            }
            node_v.ClearSlot();
            node_m.InputSlot.Clear();
            node_m.OutputSlot.Clear();
        }
Esempio n. 2
0
        public void TS_DeleteNode(String NodeName)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            foreach (var item in node_m.InputSlot)
            {
                DeleteLine(item.LineName);
            }
            foreach (var item in node_m.OutputSlot)
            {
                DeleteLine(item.LineName);
            }
            m_FunctionNodeModels.Remove(NodeName);
            m_FunctionNodeViews.Remove(NodeName);
            C_MAIN_CANVAS.Children.Remove(node_v);
            m_SelectedFunctionNodeModels.Clear();
            m_FromSlot = null;
            m_ToSlot   = null;
        }
Esempio n. 3
0
        public void TS_AddLine(String LineName, String from_node, int from_slot_index, String to_node, int to_slot_index)
        {
            if (from_node == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(from_node))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel from_node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[from_node];

            if (to_node == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(to_node))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel to_node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[to_node];


            AddLine(LineName, from_node_m.OutputSlot[from_slot_index], to_node_m.InputSlot[to_slot_index]);
        }
Esempio n. 4
0
        private void NODE_OnSlotClicked(Model.TrickerStarNodeSoltDetail slot_detail)
        {
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[slot_detail.NodeName];
            if (slot_detail.SlotSide == TrickerStarSlotSide.INPUT)
            {
                DeleteLine(node_m.InputSlot[slot_detail.SlotIndex].LineName);
            }
            if (slot_detail.SlotSide == TrickerStarSlotSide.OUTPUT)
            {
                DeleteLine(node_m.OutputSlot[slot_detail.SlotIndex].LineName);
            }

            if (slot_detail.SlotSide == TrickerStarSlotSide.INPUT)
            {
                if (m_FromSlot != null)
                {
                    if (m_FromSlot.SlotType == (slot_detail.SlotType))
                    {
                        m_ToSlot = slot_detail;
                    }
                }
                else
                {
                    m_ToSlot = slot_detail;
                }
            }
            if (slot_detail.SlotSide == TrickerStarSlotSide.OUTPUT)
            {
                if (m_ToSlot != null)
                {
                    if (m_ToSlot.SlotType == (slot_detail.SlotType))
                    {
                        m_FromSlot = slot_detail;
                    }
                }
                else
                {
                    m_FromSlot = slot_detail;
                }
            }
            ///////////////////////////////////////////////////////////
            if (m_FromSlot != null && m_ToSlot != null)
            {
                AddLine(m_FromSlot, m_ToSlot);
                m_FromSlot            = null; m_ToSlot = null;
                m_TempPath.Visibility = Visibility.Collapsed;
            }
            if (m_FromSlot == null && m_ToSlot == null)
            {
                //m_TempPath.Visibility = Visibility.Collapsed;
            }
            if ((m_FromSlot == null && m_ToSlot != null) || (m_FromSlot != null && m_ToSlot == null))
            {
                //m_TempPath.Visibility = Visibility.Visible;
            }
        }
Esempio n. 5
0
 private void NODE_OnSlotValueChanged(TrickerStarNodeSoltDetail slot_detail)
 {
     Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[slot_detail.NodeName];
     if (slot_detail.SlotSide == TrickerStarSlotSide.INPUT)
     {
         node_m.InputSlot[slot_detail.SlotIndex].SlotValue = slot_detail.SlotValue;
     }
     if (slot_detail.SlotSide == TrickerStarSlotSide.OUTPUT)
     {
         node_m.OutputSlot[slot_detail.SlotIndex].SlotValue = slot_detail.SlotValue;
     }
     m_FunctionNodeModels[slot_detail.NodeName] = node_m;
 }
Esempio n. 6
0
        public String TS_GetSlotValue(String NodeName, int SlotIndex, Model.TrickerStarSlotSide Side)
        {
            if (NodeName == null)
            {
                return("");
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return("");
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            return(node_v.GetSlotValue(Side, SlotIndex));
        }
Esempio n. 7
0
        public void TS_SetNodeTitle(String NodeName, String Title)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            node_m.NodeTitle = Title;
            node_v.SetNodeTitle(Title);
        }
Esempio n. 8
0
        public void TS_UnselectNode(String NodeName)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            Canvas.SetZIndex(node_v, 4);
            m_SelectedFunctionNodeModels.Remove(node_m.NodeName);
            node_v.Select(false);
        }
Esempio n. 9
0
        public Point TS_GetNodePosition(String NodeName)
        {
            if (NodeName == null)
            {
                return(new Point());
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return(new Point());
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            node_m.Pos.X = node_v.Translation.X;
            node_m.Pos.Y = node_v.Translation.Y;
            return(node_m.Pos);
        }
Esempio n. 10
0
        public void TS_SetNodePosition(String NodeName, Point pos)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];


            node_v.Translation = new System.Numerics.Vector3((float)(node_v.Translation.X + pos.X), (float)(node_v.Translation.Y + pos.Y), node_v.Translation.Z);
            node_m.Pos.X       = node_v.Translation.X;
            node_m.Pos.Y       = node_v.Translation.Y;
        }
Esempio n. 11
0
        public void TS_AddSlot(String NodeName, Model.TrickerStarSlotType typename, String slotname, Model.TrickerStarSlotSide side)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            if (side == TrickerStarSlotSide.INPUT)
            {
                node_v.AddInpusStack(typename, slotname);
                //node_v.AddInputLabel(typename,placeholder);
                node_m.InputSlot.Add(new TrickerStarNodeSoltDetail()
                {
                    NodeName  = node_v.m_NodeName,
                    SlotIndex = node_m.InputSlot.Count,
                    SlotSide  = TrickerStarSlotSide.INPUT,
                    SlotName  = slotname,
                    SlotType  = typename,
                });
            }
            if (side == TrickerStarSlotSide.OUTPUT)
            {
                node_v.AddOutpusStack(typename, slotname);
                // node_v.AddOutputLabel(typename,placeholder);
                node_m.OutputSlot.Add(new TrickerStarNodeSoltDetail()
                {
                    NodeName  = node_v.m_NodeName,
                    SlotIndex = node_m.OutputSlot.Count,
                    SlotSide  = TrickerStarSlotSide.OUTPUT,
                    SlotName  = slotname,
                    SlotType  = typename,
                });
            }
            m_FunctionNodeModels[NodeName] = node_m;
            m_FunctionNodeViews[NodeName]  = node_v;
        }
Esempio n. 12
0
        public void TS_SetSlotValue(String NodeName, int SlotIndex, Model.TrickerStarSlotSide Side, String value)
        {
            if (value == null)
            {
                return;
            }
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            node_v.SetSlotValue(Side, SlotIndex, value);
            return;
        }
Esempio n. 13
0
        public void TS_FocusNode(String NodeName)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];


            Point offset = new Point(0, 0);

            offset.X = node_v.Translation.X - C_MAINSCROLLVIEWER.ActualWidth / 2;
            offset.Y = node_v.Translation.Y - C_MAINSCROLLVIEWER.ActualHeight / 2;
            C_MAINSCROLLVIEWER.ChangeView(offset.X, offset.Y, 1);
        }
Esempio n. 14
0
        public void TS_AddNode(String NodeName)
        {
            Model.TrickerStarFunctionNodeModel node_m = new Model.TrickerStarFunctionNodeModel();
            node_m.NodeName = NodeName;

            TrickerStarFunctionNode node_v = new TrickerStarFunctionNode();

            Canvas.SetZIndex(node_v, 999);
            node_v.m_NodeName  = NodeName;
            node_v.DataContext = node_m;
            node_v.SetNodeTitle(node_m.NodeName);
            C_MAIN_CANVAS.Children.Add(node_v);
            node_v.PointerPressed     += Node_PointerPressed;
            node_v.PointerReleased    += Node_PointerReleased;
            node_v.PointerMoved       += Node_PointerMoved;
            node_v.OnSlotClicked      += NODE_OnSlotClicked;
            node_v.OnNodeClose        += NODE_OnNodeClose;
            node_v.OnSlotValueChanged += NODE_OnSlotValueChanged;
            m_FunctionNodeViews.Add(NodeName, node_v);
            m_FunctionNodeModels.Add(NodeName, node_m);
        }
Esempio n. 15
0
        private void Node_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            if (m_ShiftPressed == false)
            {
                UnselectNodes();
                m_SelectedFunctionNodeModels.Clear();
            }
            m_Pressed  = true;
            m_OldPoint = e.GetCurrentPoint(this).Position;

            m_OldTranslation.X = C_MAINSCROLLVIEWER.HorizontalOffset;
            m_OldTranslation.Y = C_MAINSCROLLVIEWER.VerticalOffset;

            m_ActiveElementType = ACTIVE_ELEMENT_TYPE.NODE;
            TrickerStarFunctionNode node = sender as TrickerStarFunctionNode;

            Canvas.SetZIndex(node, 5);
            Model.TrickerStarFunctionNodeModel node_m = node.DataContext as TrickerStarFunctionNodeModel;
            m_SelectedFunctionNodeModels[node_m.NodeName] = node_m;
            node.Select(true);
            e.Handled = true;
        }
Esempio n. 16
0
 public Model.TrickerStarFunctionNodeModel TS_GetNode(String NodeName)
 {
     Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
     return(node_m);
 }