Exemplo n.º 1
0
        public EditInterface getEditInterface()
        {
            if (editInterface == null)
            {
                editInterface = new EditInterface(name);
                editInterface.addCommand(new EditInterfaceCommand("Create Group", createGroupCallback));
                editInterface.addCommand(new EditInterfaceCommand("Create Sim Object", createSimObjectCallback));
                editInterface.addCommand(new EditInterfaceCommand("Show All", showAllCallback));
                editInterface.addCommand(new EditInterfaceCommand("Hide All", hideAllCallback));
                editInterface.addCommand(new EditInterfaceCommand("Import Positions", importPositionsCallback));
                editInterface.IconReferenceTag = AnomalyIcons.Folder;
                GenericClipboardEntry clipboardEntry = new GenericClipboardEntry(typeof(InstanceGroup));
                clipboardEntry.PasteFunction = pasteCallback;
                clipboardEntry.SupportsPastingTypeFunction = supportsPasteType;
                editInterface.ClipboardEntry = clipboardEntry;

                var groupManager = editInterface.createEditInterfaceManager <InstanceGroup>();
                groupManager.addCommand(new EditInterfaceCommand("Remove", destroyGroupCallback));
                var instanceFileManager = editInterface.createEditInterfaceManager <InstanceFileInterface>();
                instanceFileManager.addCommand(new EditInterfaceCommand("Remove", destroySimObjectCallback));
                instanceFileManager.addCommand(new EditInterfaceCommand("Rename", renameSimObjectCallback));
                foreach (InstanceGroup group in groups.Values)
                {
                    addGroupSubInterface(group);
                }
                foreach (InstanceFileInterface file in instanceFiles.Values)
                {
                    onInstanceFileAdded(file);
                }
            }
            return(editInterface);
        }
Exemplo n.º 2
0
        private EditInterface setupEditInterface(SlideAction editingAction, Slide slide)
        {
            currentAction = editingAction;
            EditInterface editInterface = editingAction.getEditInterface();

            editingAction.ChangesMade += editingAction_ChangesMade;
            editInterface.addCommand(new EditInterfaceCommand("Change Type", callback =>
            {
                callback.showBrowser <Func <String, SlideAction> >(actionTypeBrowser, delegate(Func <String, SlideAction> result, ref string errorPrompt)
                {
                    currentAction.ChangesMade -= editingAction_ChangesMade;
                    SlideAction newAction      = result(currentAction.Name);
                    newAction.ChangesMade     += editingAction_ChangesMade;
                    actionEditor.EditInterface = setupEditInterface(newAction, slide);
                    editingAction_ChangesMade(newAction);
                    errorPrompt = "";
                    return(true);
                });
            }));
            if (editingAction.AllowPreview)
            {
                editInterface.addCommand(new EditInterfaceCommand("Preview", callback =>
                {
                    previewTriggerAction.clear();
                    currentAction.setupAction(slide, previewTriggerAction);
                    if (PreviewTrigger != null)
                    {
                        PreviewTrigger.Invoke();
                    }
                }));
            }
            return(editInterface);
        }
Exemplo n.º 3
0
        public override void customizeEditInterface(EditInterface editInterface, EditInterfaceManager <ButtonDefinitionBase> itemEdits)
        {
            addItemCreation("Add Button", delegate(String name)
            {
                return(new ButtonDefinition(name));
            });

            editInterface.addCommand(new EditInterfaceCommand("Add Close Button", callback =>
            {
                if (!hasItem("Close"))
                {
                    add(new CloseButtonDefinition("Close"));
                }
            }));

            editInterface.addCommand(new EditInterfaceCommand("Add Navigation Buttons", callback =>
            {
                if (!hasItem("Cancel") &&
                    !hasItem("Previous") &&
                    !hasItem("Next") &&
                    !hasItem("Finish"))
                {
                    add(new ButtonDefinition("Cancel", "Common/Cancel"));
                    add(new ButtonDefinition("Previous", "Common/Previous"));
                    add(new ButtonDefinition("Next", "Common/Next"));
                    add(new ButtonDefinition("Finish", "Common/Finish"));
                }
            }));

            addItemMovementCommands(itemEdits);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Get the EditInterface for this SceneNode.
 /// </summary>
 /// <returns>The node's EditInterface.</returns>
 protected override EditInterface createEditInterface()
 {
     if (editInterface == null)
     {
         editInterface = ReflectedEditInterface.createEditInterface(this, memberScanner, Name + " Scene Node", null);
         var movableObjectEdits = editInterface.createEditInterfaceManager <MovableObjectDefinition>();
         var childNodeEdits     = editInterface.createEditInterfaceManager <SceneNodeDefinition>();
         editInterface.addCommand(new EditInterfaceCommand("Add Entity", addEntity));
         editInterface.addCommand(new EditInterfaceCommand("Add Light", addLight));
         editInterface.addCommand(new EditInterfaceCommand("Add Camera", addCamera));
         editInterface.addCommand(new EditInterfaceCommand("Add Manual Object", addManualObject));
         editInterface.addCommand(new EditInterfaceCommand("Add Child Node", addChildNode));
         editInterface.IconReferenceTag = EngineIcons.Node;
         movableObjectEdits.addCommand(new EditInterfaceCommand("Remove", removeMovableObject));
         childNodeEdits.addCommand(new EditInterfaceCommand("Remove", removeChildNode));
         foreach (MovableObjectDefinition movable in movableObjects.Values)
         {
             addMovableObjectEdit(movable);
         }
         foreach (SceneNodeDefinition child in childNodes.Values)
         {
             addChildNodeEdit(child);
         }
     }
     return(editInterface);
 }
 public EditInterface getEditInterface(string memberName, MemberScanner scanner)
 {
     if (editInterface == null)
     {
         editInterface = ReflectedEditInterface.createEditInterface(this, scanner, memberName, null);
         editInterface.addCommand(new EditInterfaceCommand("Capture Layers", callback => captureState()));
         editInterface.addCommand(new EditInterfaceCommand("Preview", callback => apply()));
     }
     return(editInterface);
 }
Exemplo n.º 6
0
 protected override void customizeEditInterface(EditInterface editInterface)
 {
     base.customizeEditInterface(editInterface);
     editInterface.addCommand(new EditInterfaceCommand("Keep Open", callback =>
     {
         callback.runOneWayCustomQuery <ShowPropAction>(CustomQueries.KeepOpenToggle, this);
     }));
     editInterface.addCommand(new EditInterfaceCommand("Move to Start Position", callback =>
     {
         moveToPropStartPosition();
     }));
 }
Exemplo n.º 7
0
        protected override void customizeEditInterface(EditInterface editInterface)
        {
            editInterface.addCommand(new EditInterfaceCommand("Capture Start State", cb =>
            {
                cb.runCustomQuery <PresetState>(CustomEditQueries.CapturePresetState, startStateResult);
            }));

            editInterface.addCommand(new EditInterfaceCommand("Capture End State", cb =>
            {
                cb.runCustomQuery <PresetState>(CustomEditQueries.CapturePresetState, endStateResult);
            }));
        }
Exemplo n.º 8
0
 public EditInterface getEditInterface(string memberName, MemberScanner scanner)
 {
     if (editInterface == null)
     {
         editInterface = ReflectedEditInterface.createEditInterface(this, scanner, memberName, null);
         editInterface.addCommand(new EditInterfaceCommand("Capture Camera Position", captureCameraPosition));
         editInterface.addCommand(new EditInterfaceCommand("Preview", callback =>
         {
             callback.runOneWayCustomQuery(CustomEditQueries.PreviewCameraPosition, this);
         }));
     }
     return(editInterface);
 }
Exemplo n.º 9
0
 protected override void customizeEditInterface(EditInterface editInterface)
 {
     base.customizeEditInterface(editInterface);
     editInterface.addCommand(new EditInterfaceCommand("Record", callback =>
     {
         callback.runCustomQuery <String, String>(CustomQueries.Record, (String soundFileName, ref String errorPrompt) =>
         {
             SoundFile = soundFileName;
             return(true);
         }, SoundFile);
     }));
     editInterface.addCommand(new EditInterfaceCommand("Edit Externally", callback =>
     {
         callback.runOneWayCustomQuery(CustomQueries.EditExternally, SoundFile);
     }));
 }
Exemplo n.º 10
0
        protected override void customizeEditInterface(EditInterface editInterface)
        {
            base.customizeEditInterface(editInterface);

            this.editInterface = editInterface;

            editInterface.addSubInterfaceForObject(tags, new StringListlikeEditInterface(tags, "Tags",
                                                                                         validateCallback: () =>
            {
                if (this.Tags.Any(t => String.IsNullOrWhiteSpace(t)))
                {
                    throw new ValidationException("Cannot accept blank tags. Please remove any blank entries.");
                }
            }));
            editInterface.addSubInterfaceForObject(systems, new StringListlikeEditInterface(systems, "Systems",
                                                                                            validateCallback: () =>
            {
                if (this.systems.Any(t => String.IsNullOrWhiteSpace(t)))
                {
                    throw new ValidationException("Cannot accept blank systems. Please remove any blank entries.");
                }
            }));
            editInterface.addSubInterfaceForObject(connections, new StringListlikeEditInterface(connections, "Connections",
                                                                                                validateCallback: () =>
            {
                if (this.connections.Any(t => String.IsNullOrWhiteSpace(t)))
                {
                    throw new ValidationException("Cannot accept blank connections. Please remove any blank entries.");
                }
            }));

            //Commands
            EditInterface commandsEditInterface = new EditInterface("Commands");

            commandsEditInterface.addCommand(new EditInterfaceCommand("Add Command", cb =>
            {
                if (anatomyCommandBrowser == null)
                {
                    anatomyCommandBrowser = new AnatomyCommandBrowser();
                }
                cb.showBrowser(anatomyCommandBrowser, delegate(Object result, ref String errorMessage)
                {
                    Type commandType = result as Type;
                    if (commandType != null)
                    {
                        this.addCommand((AnatomyCommand)Activator.CreateInstance(commandType));
                        return(true);
                    }
                    return(false);
                });
            }));

            var commandEditInterfaces = commandsEditInterface.createEditInterfaceManager <AnatomyCommand>(i => i.createEditInterface(), Commands);

            commandEditInterfaces.addCommand(new EditInterfaceCommand("Remove", cb => this.removeCommand(commandsEditInterface.resolveSourceObject <AnatomyCommand>(cb.getSelectedEditInterface()))));
            editInterface.addSubInterfaceForObject(commands, commandsEditInterface);
        }
Exemplo n.º 11
0
 public override EditInterface getEditInterface()
 {
     if (editInterface == null)
     {
         editInterface = ReflectedEditInterface.createEditInterface(this, "Setup Scene");
         editInterface.addCommand(new EditInterfaceCommand("Capture Start", callback =>
         {
             captureStartState(callback);
             fireChangesMade();
         }));
         editInterface.addCommand(new EditInterfaceCommand("Capture End", callback =>
         {
             captureEndState(callback);
             fireChangesMade();
         }));
     }
     return(editInterface);
 }
Exemplo n.º 12
0
 protected override void customizeEditInterface(EditInterface editInterface)
 {
     editInterface.IconReferenceTag = "MvcContextEditor/IndividualViewIcon";
     editInterface.addCommand(new EditInterfaceCommand("Create Controller", uiCallback =>
     {
         uiCallback.runOneWayCustomQuery(CustomQueries.AddControllerForView, this);
     }));
     base.customizeEditInterface(editInterface);
 }
Exemplo n.º 13
0
 protected override void customizeEditInterface(EditInterface editInterface)
 {
     base.customizeEditInterface(editInterface);
     editInterface.addCommand(new EditInterfaceCommand("Set Color", callback =>
     {
         callback.runCustomQuery <Color>(CustomQueries.ChooseColor, delegate(Color color, ref String message)
         {
             setSelectionColor(color);
             return(true);
         });
     }));
 }
Exemplo n.º 14
0
 public override EditInterface getEditInterface()
 {
     if (editInterface == null)
     {
         editInterface = new EditInterface("Play Timeline");
         editInterface.addCommand(new EditInterfaceCommand("Edit Timeline", callback =>
         {
             callback.runOneWayCustomQuery(CustomActions.EditTimeline, this);
         }));
     }
     return(editInterface);
 }
        public EditInterface getEditInterface()
        {
            if (editInterface == null)
            {
                preActionEdit  = new TimelinePreActionEditInterface(timeline);
                postActionEdit = new TimelinePostActionEditInterface(timeline);

                editInterface = ReflectedEditInterface.createEditInterface(this, ReflectedEditInterface.DefaultScanner, "Timeline", null);
                editInterface.addSubInterface(preActionEdit.getEditInterface());
                editInterface.addSubInterface(postActionEdit.getEditInterface());

                editInterface.addCommand(new EditInterfaceCommand("Reverse Sides", callback => timeline.reverseSides()));
            }
            return(editInterface);
        }
Exemplo n.º 16
0
 /// <summary>
 /// Get the EditInterface.
 /// </summary>
 /// <returns>The EditInterface</returns>
 internal EditInterface getEditInterface()
 {
     if (editInterface == null)
     {
         editInterface = new EditInterface(name);
         editInterface.addCommand(new EditInterfaceCommand("Add Group", addResourceGroup));
         var groupEdits = editInterface.createEditInterfaceManager <ResourceGroup>();
         groupEdits.addCommand(new EditInterfaceCommand("Remove", destroyResourceGroup));
         foreach (ResourceGroup group in resourceGroups.Values)
         {
             addResourceGroupEditInterface(group);
         }
     }
     return(editInterface);
 }
Exemplo n.º 17
0
        public MaterialController(OgreModelEditorController controller)
        {
            this.controller = controller;

            editInterface = ReflectedEditInterface.createEditInterface(this, "Materials");
            editInterface.addCommand(new EditInterfaceCommand("Add", () =>
            {
                createMaterial("NewMaterial");
            }));
            var descriptionManager = editInterface.createEditInterfaceManager <MaterialDescription>(i => i.getEditInterface());

            descriptionManager.addCommand(new EditInterfaceCommand("Remove", cb =>
            {
                var desc = descriptionManager.resolveSourceObject(cb.getSelectedEditInterface());
                removeMaterial(desc);
            }));
        }
        public EditInterface getEditInterface()
        {
            if (editInterface == null)
            {
                editInterface = ReflectedEditInterface.createUnscannedEditInterface("Pre Actions", null);
                editInterface.addCommand(new EditInterfaceCommand("Add Pre Action", addAction));

                var actionManager = editInterface.createEditInterfaceManager <TimelineInstantAction>();
                actionManager.addCommand(new EditInterfaceCommand("Remove", removeAction));

                foreach (TimelineInstantAction action in timeline.PreActions)
                {
                    preActionAdded(action);
                }
            }
            return(editInterface);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Get the EditInterface.
        /// </summary>
        /// <returns>The EditInterface.</returns>
        public EditInterface getEditInterface()
        {
            if (editInterface == null)
            {
                editInterface = ReflectedEditInterface.createEditInterface(this, genericSimObjectScanner, name, null);
                editInterface.IconReferenceTag = EngineIcons.SimObject;
                var elementEditInterfaces = editInterface.createEditInterfaceManager <SimElementDefinition>();
                elementEditInterfaces.addCommand(new EditInterfaceCommand("Remove", removeSimElementDefinition));
                foreach (SimElementDefinition definition in definitions)
                {
                    createElementInterface(definition);
                }
                foreach (AddSimElementCommand command in PluginManager.Instance.getCreateSimElementCommands())
                {
                    editInterface.addCommand(new EditInterfaceCommand(command.Name, callback =>
                    {
                        callback.getInputString("Enter a name.", delegate(String result, ref String errorPrompt)
                        {
                            if (result == null || result == "")
                            {
                                errorPrompt = "Please enter a non empty name.";
                                return(false);
                            }
                            foreach (SimElementDefinition definition in definitions)
                            {
                                if (definition.Name == result)
                                {
                                    errorPrompt = "That name is already in use. Please provide another.";
                                    return(false);
                                }
                            }

                            command.execute(result, callback, this);

                            return(true);
                        });
                    }));
                }

                GenericClipboardEntry clipboardEntry = new GenericClipboardEntry(typeof(SimElementDefinition));
                clipboardEntry.PasteFunction = pasteObject;
                editInterface.ClipboardEntry = clipboardEntry;
            }
            return(editInterface);
        }
Exemplo n.º 20
0
 public override void customizeEditInterface(EditInterface editInterface, EditInterfaceManager <MvcModel> itemEdits)
 {
     editInterface.addCommand(new EditInterfaceCommand("Add Model", callback =>
     {
         callback.runCustomQuery(CustomQueries.CreateModelBrowser, delegate(Browser modelBrowser, ref string errorPrompt)
         {
             callback.showInputBrowser(modelBrowser, delegate(Type returnedTypeInfo, String name, ref string error)
             {
                 if (!hasItem(name))
                 {
                     add((MvcModel)Activator.CreateInstance(returnedTypeInfo, name));
                     return(true);
                 }
                 error = String.Format("A model named {0} already exists. Please input another name.", name);
                 return(false);
             });
             return(true);
         });
     }));
 }
Exemplo n.º 21
0
 public override void customizeEditInterface(EditInterface editInterface, EditInterfaceManager <View> itemEdits)
 {
     editInterface.IconReferenceTag = "MvcContextEditor/OverallViewIcon";
     editInterface.addCommand(new EditInterfaceCommand("Add View", callback =>
     {
         callback.runCustomQuery(CustomQueries.CreateViewBrowser, delegate(Browser browser, ref string errorPrompt)
         {
             callback.showInputBrowser(browser, delegate(CreateView createView, String name, ref string err)
             {
                 if (!hasItem(name))
                 {
                     add(createView(name));
                     return(true);
                 }
                 err = String.Format("A view named {0} already exists. Please input another name.", name);
                 return(false);
             });
             return(true);
         });
     }));
 }
 internal EditInterface getEditInterface()
 {
     if (editInterface == null)
     {
         editInterface = ReflectedEditInterface.createEditInterface(this, ReflectedEditInterface.DefaultScanner, Name + " - IK Solver", null);
         editInterface.addCommand(new EditInterfaceCommand("Add Child Solver", callback =>
         {
             addChildSolver(new BEPUikSolverDefinition()
             {
                 Name = "Child"
             });
         }));
         childSolversManager = editInterface.createEditInterfaceManager <BEPUikSolverDefinition>();
         childSolversManager.addCommand(new EditInterfaceCommand("Remove", callback =>
         {
             removeChildSolver(childSolversManager.resolveSourceObject(callback.getSelectedEditInterface()));
         }));
         foreach (var child in childSolvers)
         {
             childSolversManager.addSubInterface(child, child.getEditInterface());
         }
     }
     return(editInterface);
 }
Exemplo n.º 23
0
        /// <summary>
        /// Get the EditInterface for this SimSceneDefinition.
        /// </summary>
        /// <returns>The EditInterface for this SimSceneDefinition.</returns>
        public EditInterface getEditInterface()
        {
            if (editInterface == null)
            {
                editInterface = ReflectedEditInterface.createEditInterface(this, ReflectedEditInterface.DefaultScanner, "Sim Scene", () =>
                {
                    if (hasSimSubSceneDefinitions())
                    {
                        if (DefaultSubScene == null)
                        {
                            throw new ValidationException("Please specify one of the Subscenes as the default.");
                        }
                        if (!hasSimSubSceneDefinition(DefaultSubScene))
                        {
                            throw new ValidationException("{0} is not a valid Subscene. Please specify an existing scene.", DefaultSubScene);
                        }
                    }
                });
                editInterface.IconReferenceTag = EngineIcons.Scene;

                simElementEditor = new EditInterface("Sim Element Managers");
                var elementManagerInterfaces = simElementEditor.createEditInterfaceManager <SimElementManagerDefinition>();
                elementManagerInterfaces.addCommand(new EditInterfaceCommand("Destroy", destroySimElementManagerDefinition));
                foreach (AddSimElementManagerCommand command in PluginManager.Instance.getCreateSimElementManagerCommands())
                {
                    simElementEditor.addCommand(new EditInterfaceCommand(command.Name, callback =>
                    {
                        callback.getInputString("Enter a name.", delegate(String input, ref String errorPrompt)
                        {
                            if (input == null || input == "")
                            {
                                errorPrompt = "Please enter a non empty name.";
                                return(false);
                            }
                            if (this.hasSimElementManagerDefinition(input))
                            {
                                errorPrompt = "That name is already in use. Please provide another.";
                                return(false);
                            }

                            SimElementManagerDefinition def = command.execute(input, callback);
                            this.addSimElementManagerDefinition(def);

                            return(true);
                        });
                    }));
                }
                editInterface.addSubInterface(simElementEditor);

                subScenes = new EditInterface("Subscenes");
                var subSceneInterfaces = subScenes.createEditInterfaceManager <SimSubSceneDefinition>();
                subSceneInterfaces.addCommand(new EditInterfaceCommand("Destroy", destroySimSubSceneDefinition));
                EditInterfaceCommand createSubSceneCommand = new EditInterfaceCommand("Create Subscene", createSimSubSceneDefinition);
                subScenes.addCommand(createSubSceneCommand);
                editInterface.addSubInterface(subScenes);

                foreach (SimElementManagerDefinition elementDef in elementManagers)
                {
                    createEditInterface(elementDef);
                }
                foreach (SimSubSceneDefinition subSceneDef in subSceneDefinitions.Values)
                {
                    createEditInterface(subSceneDef);
                }
            }
            return(editInterface);
        }
 protected override void customizeEditInterface(EditInterface editInterface)
 {
     editInterface.addCommand(new EditInterfaceCommand("Capture State", captureState));
 }
Exemplo n.º 25
0
 protected override void customizeEditInterface(EditInterface editInterface)
 {
     editInterface.addCommand(new EditInterfaceCommand("Edit", callback => callback.runOneWayCustomQuery(CustomQueries.OpenFileInRmlViewer, RmlFile)));
     base.customizeEditInterface(editInterface);
 }
Exemplo n.º 26
0
 protected override void customizeEditInterface(EditInterface editInterface)
 {
     base.customizeEditInterface(editInterface);
     editInterface.addCommand(new EditInterfaceCommand("Capture", capture));
 }