Retrieving dynamic fields from c++ code
by Bryan "daerid" Ross · in Torque Game Engine · 12/07/2001 (2:12 pm) · 9 replies
how would you do it?
ie: say, you add a dynamic field 'status' to a clientconnection object ( meaning it's not part of that class by default ).
How would you then access that value from c++ code?
ie: say, you add a dynamic field 'status' to a clientconnection object ( meaning it's not part of that class by default ).
How would you then access that value from c++ code?
#2
12/10/2001 (11:35 pm)
I find it a bit disheartening that there isn't a reply to this yet :(
#5
12/11/2001 (10:48 am)
Been a little behind on the forums... but it looks like this one is solved :)
#7
I cannot make it work...
edit: btw, sorry for the necro thread rising...
12/01/2007 (11:26 am)
Someone know if this is currently valid/working?I cannot make it work...
edit: btw, sorry for the necro thread rising...
#8
Just about by definition, if c++ code needs access to a field, then that field should be a persistent field, assigned in the class' ::initPersistFields(..) method. There are very few, if any (other than editors) reason why c++ would want to access a dynamic field.
The way to do it now as far as I can remember (I've never had reason to do this in all my prototyping and development work) is the SimObject::get/setDataField(..) methods.
12/01/2007 (11:41 am)
It's changed since way back when, but I'd first suggest an analysis of why you want to access a dynamic field from c++.Just about by definition, if c++ code needs access to a field, then that field should be a persistent field, assigned in the class' ::initPersistFields(..) method. There are very few, if any (other than editors) reason why c++ would want to access a dynamic field.
The way to do it now as far as I can remember (I've never had reason to do this in all my prototyping and development work) is the SimObject::get/setDataField(..) methods.
#9
12/01/2007 (11:47 am)
Thanks Stephen. You are right indeed, I was just trying make a shortcut, but yes, a persistent field is the right way of do it.
(Sorry, really bad pun/inside joke.)
Torque Owner Bryan "daerid" Ross
Come on, this has GOT to be an easy one for any of GG's staff :)