Beispiel #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);
        }
Beispiel #2
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);
 }
        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);
        }
Beispiel #4
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);
 }
        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);
        }
        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);
            }));
        }
Beispiel #7
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);
        }
 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);
 }
Beispiel #9
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);
        }