Dynamic field
by Andrea Ceglia · in Torque Game Engine · 04/24/2005 (7:31 am) · 6 replies
Hello. I would like use dynamic field(script) in c++ torque engine.
I want use hudshapename without use name class but use a dynamic field (i want set it in real time).
Tnx & Bye.
I want use hudshapename without use name class but use a dynamic field (i want set it in real time).
Tnx & Bye.
#2
04/24/2005 (7:31 pm)
Where is GetFieldValue?.I don't find it.
#3
04/24/2005 (11:43 pm)
It's getDataField, and it's implemented on line 706 of simBase.cc.
#5
12/03/2009 (1:02 am)
use the getFieldDictionary and StringTable together; something like:// C++ Code Fragment
ScriptObject * student;
student = new ScriptObject();
student->registerObject();
student->getFieldDictionary()->setFieldValue(
StringTable->insert("studentId"), studentId);
student->getFieldDictionary()->setFieldValue(
StringTable->insert("studentName"), studentName);
#6
12/03/2009 (2:14 am)
for My previous post, you will get an unhandled exception because the internal field dictionary does not exist in the sim object if you do not call the setDataField method at least once. What I did was, I modified simBase.h at line 597 with a simple lazy-loading pattern./// Get reference to the dictionary containing dynamic fields.
///
/// See @ref simobject_console "here" for a detailed discussion of what this
/// function does.
///
/// This dictionary can be iterated over using a SimFieldDictionaryIterator.
SimFieldDictionary * getFieldDictionary()
{
if( mFieldDictionary == NULL )
mFieldDictionary = new SimFieldDictionary;
return(mFieldDictionary);
}
Associate Kyle Carter