コード例 #1
0
 /// <summary>
 /// Remove a SceneNodeDefinition from the children.
 /// </summary>
 /// <param name="child">The child to remove.</param>
 public void removeChildNode(SceneNodeDefinition child)
 {
     childNodes.Remove(child.Name);
     child.setParentNode(null);
     if (editInterface != null)
     {
         editInterface.removeSubInterface(child);
     }
 }
コード例 #2
0
 /// <summary>
 /// Add a SceneNodeDefinition as a child node.
 /// </summary>
 /// <param name="child">The child to add.</param>
 public void addChildNode(SceneNodeDefinition child)
 {
     childNodes.Add(child.Name, child);
     child.setParentNode(this);
     if (editInterface != null)
     {
         addChildNodeEdit(child);
     }
 }
コード例 #3
0
        /// <summary>
        /// Helper function to recursivly save scene node definitions for all
        /// children.
        /// </summary>
        /// <returns>A new SceneNodeDefinition for this node.</returns>
        private SceneNodeDefinition saveToSceneNodeDefinition()
        {
            SceneNodeDefinition definition = new SceneNodeDefinition(Name);

            definition.LocalTranslation = sceneNode.getPosition();
            definition.LocalRotation    = sceneNode.getOrientation();
            foreach (MovableObjectContainer movable in nodeObjects.Values)
            {
                definition.addMovableObjectDefinition(movable.createDefinition());
            }
            foreach (SceneNodeElement child in children)
            {
                definition.addChildNode(child.saveToSceneNodeDefinition());
            }
            return(definition);
        }
コード例 #4
0
        /// <summary>
        /// Callback to add a child node.
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="command"></param>
        private void addChildNode(EditUICallback 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);
                }
                SceneNodeDefinition topLevel = findTopLevelNode();
                if (input == topLevel.Name || topLevel.isNodeNameTaken(input))
                {
                    errorPrompt = "That name is already in use. Please provide another.";
                    return(false);
                }

                addChildNode(new SceneNodeDefinition(input));
                return(true);
            });
        }
コード例 #5
0
 /// <summary>
 /// Helper function to set the parent node of this node.
 /// </summary>
 /// <param name="parent">The parent SceneNodeDefinition to set.</param>
 private void setParentNode(SceneNodeDefinition parent)
 {
     this.parentNode = parent;
 }
コード例 #6
0
 private void addChildNodeEdit(SceneNodeDefinition child)
 {
     editInterface.addSubInterface(child, child.getEditInterface());
 }
コード例 #7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="instance">The SimObject that will have the product constructed added to it.</param>
 /// <param name="definition">The definition class that will build part of the sim object.</param>
 public OgreFactoryEntry(SimObjectBase instance, SceneNodeDefinition definition)
 {
     this.instance   = instance;
     this.definition = definition;
 }
コード例 #8
0
 /// <summary>
 /// Add a SceneNodeDefinition.
 /// </summary>
 /// <param name="instance">The SimObject that will get the product built by definition.</param>
 /// <param name="definition">The definition to build.</param>
 public void addSceneNodeDefinition(SimObjectBase instance, SceneNodeDefinition definition)
 {
     sceneNodes.AddLast(new OgreFactoryEntry(instance, definition));
 }