if you do naming via a tree it is a nice way to point to objects.
menuDeck.mainMenu.quitButton
the problem is that if you reparent, the pointer is no longer valid. the solution might be to use another naming convention called 'owner'. this gives a unique identity to an object because in theory the object could live in multiple parents. now you could just enforce a single parent and that works for a lot of things, but not for glyphs. in theory you might what to fiddle with a glyph at runtime. it might change all of the other instances, but you should be able to do it. with the owner concept you could. you could never allowed manipulation via full dotted names, but instead asked for the real object by dotted name. once you have the real
object you don't care about its dotted name anymore. however, since you can drive up the owner tree you can get back the dotted name to an object at anytime. this is good for saving things out.
gbGeom* seat=universe->findByName("golfCart00.base.seat");
you could go.
seat->dotOwner()->dotOwner()->dotName() and that would be "golfCart00"
how about for motor controls
gbMotor* motor=dynamic_cast
motor->message("targetSpeed=93");
float targetSpeed=motor->_targetSpeed;
or from lua.
gameUniverse.golfCart00.leftFrontWheelMotor.targetSpeed=3
i guess you could call the dot interface gbDotable
class gbDotable
{
public:
virtual gbDotable* dotMember(const char* name)=0;
virtual void dotMembers(std::vector
virtual std::string dotName()=0;
virtual gbDotable* dotOwner()=0;
virtual gbDotableValue* dotValue()=0;
};
class gbDotableValue
{
virtual bool call(const char* args[],std::string& out_result)=0;
virtual std::string get()=0;
virtual bool set(const char* value)=0;
virtual std::string type()=0;
};
all of the universe things are going to need a common base class so you can throw them in a single list. that might as well be gbDotable.
if universe needs to keep separate lists that is fine, both those are just cached somewhere.
so when you save out things, you save out the universe which represents the state of everything except resources. resources could also be gbDotable.
typically the gui will live in its own universe.