Example #1
0
        public void GenerateContextMenu()
        {
            CutContextMenu = new ContextMenu();

            if (EventDefinitionManager.CanActionCopyFromViewport(Cut.ParentActor.Name, Cut.Name))
            {
                MenuItem CopyItem = new MenuItem()
                {
                    Header = "Copy Camera from Viewport"
                };
                CopyItem.Click += (x, y) =>
                {
                    CopyCameraFromViewportEventArgs NewArgs = new CopyCameraFromViewportEventArgs();
                    NewArgs.RequestingCut = this;

                    Cut.ParentActor.ParentEvent.OnCutRequestCopyFromViewport(NewArgs);
                };

                CutContextMenu.Items.Add(CopyItem);
                CutContextMenu.Items.Add(new Separator());
            }

            if (EventDefinitionManager.CanActionCopyStartFromViewport(Cut.ParentActor.Name, Cut.Name))
            {
                MenuItem CopyItem = new MenuItem()
                {
                    Header = "Copy Start Camera from Viewport"
                };
                CopyItem.Click += (x, y) =>
                {
                    CopyCameraFromViewportEventArgs NewArgs = new CopyCameraFromViewportEventArgs();
                    NewArgs.RequestingCut = this;
                    NewArgs.IsStart       = true;

                    Cut.ParentActor.ParentEvent.OnCutRequestCopyFromViewport(NewArgs);
                };

                CutContextMenu.Items.Add(CopyItem);
                CutContextMenu.Items.Add(new Separator());
            }

            Dictionary <string, string> properties = EventDefinitionManager.GetPropertiesForAction(Cut.ParentActor.Name, Cut.Name);

            foreach (KeyValuePair <string, string> prop_str in properties)
            {
                string        SubDefault = "";
                SubstanceType SubType    = EventDefinitionManager.GetPropertyTypeAndDefaultValue(Cut.ParentActor.Name, Cut.Name, prop_str.Key, out SubDefault);

                CutContextMenu.Items.Add(new MenuItem()
                {
                    Header           = prop_str.Key,
                    Command          = CreatePropertyCommand,
                    CommandParameter = new Tuple <string, string, SubstanceType>(prop_str.Value, SubDefault, SubType)
                });
            }
        }
Example #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));
        }
Example #3
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);
            }
        }
Example #4
0
        public ActorTabContextMenu(Staff actor) : base()
        {
            m_Actor = actor;

            MenuItem add_block = new MenuItem()
            {
                Header = "Blocking Node"
            };

            add_block.Click += Add_block_Click;

            Items.Add(add_block);
            Items.Add(new Separator());

            Dictionary <string, string> actions = EventDefinitionManager.GetActionsForActor(actor.Name);

            foreach (KeyValuePair <string, string> str in actions)
            {
                Items.Add(new MenuItem()
                {
                    Header = str.Value, Command = CreateNodeCommand, CommandParameter = str.Key
                });
            }
        }