Change Entities name after creation?
-
mude
- Halfling
- Posts: 47
- Joined: Tue Dec 21, 2010 1:46 pm
Change Entities name after creation?
Is it possible? I can't find anything about it, why it's not allowed?
-
Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
Re: Change Entities name after creation?
All entities are stored in a map, using the name as the key. It's not possible to change the key of an item in a map (it would break the tree hierarchy used for searching).
-
bstone
- OGRE Expert User

- Posts: 1920
- Joined: Sun Feb 19, 2012 9:24 pm
- Location: Russia
- x 201
Re: Change Entities name after creation?
Yeah, if you want to associate entity with a name that can be updated you could use Entity::setUserAny() and Entity::getUserAny().
-
mmixLinus
- Silver Sponsor

- Posts: 199
- Joined: Thu Apr 21, 2011 3:08 pm
- Location: Lund, Sweden
- x 12
Re: Change Entities name after creation?
Or, if you REALLY want to use the Entity by a different name, clone it:
Code: Select all
//Entity * clone (const String &newName) const
renamedEntity = oldEntity->clone("NewName");Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook