Esempio n. 1
0
        public void CreateNodesRecursive(NetworkViewModel model, Cut previous_cut)
        {
            Name = EventDefinitionManager.GetCutDisplayName(Cut.ParentActor.Name, Cut.Name);
            GenerateContextMenu();

            // Add ourselves to the node network
            model.Nodes.Edit(x => x.Add(this));

            // If this is the first node in the chain, create the "Begin" node.
            if (previous_cut == null)
            {
                Position = new System.Windows.Point(Position.X + 400, Position.Y);

                CreateBeginNode(model);
            }
            else
            {
                Position = new System.Windows.Point(previous_cut.NodeViewModel.Position.X + 400, previous_cut.NodeViewModel.Position.Y);

                // If this node is blocked, create a blocking node and insert it between the previous node and this node.
                if (Cut.IsBlocked())
                {
                    CreateBlockingNode(model, previous_cut.NodeViewModel);
                }
                // Otherwise, just connect the previous to this node.
                else
                {
                    // Create a connection between this cut and the next cut in the list.
                    ConnectionViewModel cut_connection = new ConnectionViewModel(
                        model,
                        Inputs.Items.First(),
                        previous_cut.NodeViewModel.Outputs.Items.First());

                    // Add the connection to the node network.
                    model.Connections.Edit(x => x.Add(cut_connection));
                }
            }

            // Now that our position is finalized, we can add our property nodes to the graph.
            AddPropertiesToNode();

            if (Cut.NextCut != null)
            {
                Cut.NextCut.NodeViewModel.CreateNodesRecursive(model, Cut);
            }
        }
Esempio n. 2
0
        private void OnRequestCreateActorNode(string cut_name)
        {
            NetworkView view = PlacementTarget as NetworkView;

            Cut c = new Cut(cut_name);

            c.ParentActor = m_Actor;

            CutNodeViewModel cv = new CutNodeViewModel(c);

            cv.Name     = EventDefinitionManager.GetCutDisplayName(m_Actor.Name, cut_name);
            cv.Position = GetMouseLocation(view);
            cv.EnableConnectionUpdates = true;
            cv.GenerateContextMenu();

            view.ViewModel.Nodes.Edit(x => x.Add(cv));
        }