I'd like to change the name of a scenenode that I've already created, but looking through the headers, there only seems to be a way to get the name, not set it (after creation).
This is obviously a pretty simple change I could make, but I'm wondering if there's any reason that this isn't already in the code? Will Ogre have problems if a scenenode changes names?
Thanks
Changing name of sceneNode
- haffax
- OGRE Retired Moderator

- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 8
- Contact:
There is a subtle problem with this. SceneManager stores its nodes in a map and the key is the name of the nodes. When you change the node name, then this map will be inconsistent, when you query for a node by name, it won't be found.
Ogre 2.0 will overhaul this whole system and the naming problem will be addressed then too. Though next version of Ogre won't be 2.0 and so far there is no date set for 2.0.
Ogre 2.0 will overhaul this whole system and the naming problem will be addressed then too. Though next version of Ogre won't be 2.0 and so far there is no date set for 2.0.
-
3dmacuser
- Greenskin
- Posts: 128
- Joined: Tue Mar 22, 2005 8:18 pm
Hmmm, that is a problem.
Would there be anyway to change the key in the map after I change the name?
I'm not going to be changing the name often, and not really during gameplay, just during level initialization.
If I simply don't ever query for a scenenode by name, will any other problems pop up?
(The reason I want to do this is I'm going to be using an object-persistence framework to store my levels, but I won't have any guarantee as to what order various attributes get restored from a file. So if I'm creating a scenenode, its position might be read from the file before the name is. My solution is to generate the scenenode generically the first time it is needed (just child of root node, and automatically generated name) and then assign the name, parent, etc, as they're loaded.)
Would there be anyway to change the key in the map after I change the name?
I'm not going to be changing the name often, and not really during gameplay, just during level initialization.
If I simply don't ever query for a scenenode by name, will any other problems pop up?
(The reason I want to do this is I'm going to be using an object-persistence framework to store my levels, but I won't have any guarantee as to what order various attributes get restored from a file. So if I'm creating a scenenode, its position might be read from the file before the name is. My solution is to generate the scenenode generically the first time it is needed (just child of root node, and automatically generated name) and then assign the name, parent, etc, as they're loaded.)
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
You could use the old iD technique of just storing individual object structures together (e.g. all nodes, then all materials, all entities etc), then having a 'linking up' pass at the end. This solves 2 problems - it keeps blocks of data homogenous so you can read them very quickly with a bulk data transfer, and you don't have ordering issues.
-
3dmacuser
- Greenskin
- Posts: 128
- Joined: Tue Mar 22, 2005 8:18 pm
That's a good idea, but I'm not sure if it works well in this case, since my ordering problems are between different types of objects (like nodes, entities, etc) as much as they are within objects. (like setting the position of a node before setting its name.)
In case you're curious, I'm trying to do a "component based" system using CoreData, so I can make a nice cocoa game editor, with bindings, undo support, and all the other nice goodies in os x
In case you're curious, I'm trying to do a "component based" system using CoreData, so I can make a nice cocoa game editor, with bindings, undo support, and all the other nice goodies in os x
-
3dmacuser
- Greenskin
- Posts: 128
- Joined: Tue Mar 22, 2005 8:18 pm
Hmmm, looking into this more, it looks like I'm going to have similar issues with all my components.
For example, after you create an entity with a given meshname, you can't change that mesh later.
I might have to go about this a different way. Any ideas? (And maybe this should be moved to Using Ogre in Practice now?)
One context I'm imagining a lot while designing my engine is how it will be used while editing the levels.
I'd like to have a very dynamic editor, where the user is free to experiment, and change stuff around easily.
For example, they could create a scenenode component, give it a name, and later on realize that they would prefer a different name, and be able the change the name without changing any other properties or the node.
Or, they create a new entity component, and attach it to an existing scenenode. The user hasen't specified a mesh yet, so a simple cube or sphere appears. The user then puts in a placeholder model, something simple to use while developing the game and testing out ideas.
Later on, when they have better assets, they can edit that entity component, and change the mesh to the actual model, and they don't have change any of the other properties of the entity.
I guess I can do all this very manually, by recreating everything anytime the user makes a large change (such as changing the name of a node, or the mesh of an entity). I can create a new node, with the given name, and then copy over every attribute of the old node (position, rotation, child nodes, attached entities, etc), and then delete the old node... that seems to be a pretty huge operation just to change a name!
And I could do likewise for changing the mesh of an entity, etc. It just seems clunky to me to have to delete and recreate everything whenever the user makes a simple change.
Does anyone else have any ideas how I could allow the user to make changes in the editor like this? How have other ogre editors handled this issue?
For example, after you create an entity with a given meshname, you can't change that mesh later.
I might have to go about this a different way. Any ideas? (And maybe this should be moved to Using Ogre in Practice now?)
One context I'm imagining a lot while designing my engine is how it will be used while editing the levels.
I'd like to have a very dynamic editor, where the user is free to experiment, and change stuff around easily.
For example, they could create a scenenode component, give it a name, and later on realize that they would prefer a different name, and be able the change the name without changing any other properties or the node.
Or, they create a new entity component, and attach it to an existing scenenode. The user hasen't specified a mesh yet, so a simple cube or sphere appears. The user then puts in a placeholder model, something simple to use while developing the game and testing out ideas.
Later on, when they have better assets, they can edit that entity component, and change the mesh to the actual model, and they don't have change any of the other properties of the entity.
I guess I can do all this very manually, by recreating everything anytime the user makes a large change (such as changing the name of a node, or the mesh of an entity). I can create a new node, with the given name, and then copy over every attribute of the old node (position, rotation, child nodes, attached entities, etc), and then delete the old node... that seems to be a pretty huge operation just to change a name!
And I could do likewise for changing the mesh of an entity, etc. It just seems clunky to me to have to delete and recreate everything whenever the user makes a simple change.
Does anyone else have any ideas how I could allow the user to make changes in the editor like this? How have other ogre editors handled this issue?
-
3dmacuser
- Greenskin
- Posts: 128
- Joined: Tue Mar 22, 2005 8:18 pm
I'm reposting this in "using ogre in practice" since it's not really a feature request anymore.
Here's the link to the other thread.
http://www.ogre3d.org/phpBB2/viewtopic. ... 220#254220
Edit: How do I close this thread?
Here's the link to the other thread.
http://www.ogre3d.org/phpBB2/viewtopic. ... 220#254220
Edit: How do I close this thread?
