Namespace Troubles
by Eric Robinson · in Torque Game Builder · 04/17/2007 (8:33 pm) · 2 replies
I'm trying to dynamically set the namespace for an object in my game onLevelLoaded(). The issue is that any updates made appear to have no effect.
Are the namespace members "class" and "superClass" ONLY used on object creation? Is there anyway to modify the namespace hierarchy after object initialization?
Are the namespace members "class" and "superClass" ONLY used on object creation? Is there anyway to modify the namespace hierarchy after object initialization?
#2
I've started getting confused as to which fields will cause an immediate update upon set and which require the get/set member functions (I'm making heavy use of t2dTextObjects). Is this going to get generally standardized to one or the other? In 1.5 perhaps?
I figured out the new-object-&-copy method... it worked okay but was a bit out-of-the-way. Out of curiosity, how do you specify an object to copy without naming the new object explicitly? Does the following work?
Heh, all of this makes a real good argument for installing this resource.
04/17/2007 (11:05 pm)
@Stephen: Ahh, that's too bad... seeing that you can change them as you can any other variable (%obj.class and %obj.superClass), you'd almost expect them to update dynamically. Too bad there's no "const" in script, eh? ;DI've started getting confused as to which fields will cause an immediate update upon set and which require the get/set member functions (I'm making heavy use of t2dTextObjects). Is this going to get generally standardized to one or the other? In 1.5 perhaps?
I figured out the new-object-&-copy method... it worked okay but was a bit out-of-the-way. Out of curiosity, how do you specify an object to copy without naming the new object explicitly? Does the following work?
%newObj = new t2dStaticSprite( : %oldObj)
{
superClass = HurrayForNewSuperclass;
};Heh, all of this makes a real good argument for installing this resource.
Torque 3D Owner Stephen Zepp
What you can do is to replace an object with a new object, and copy over the values, but have the new object be given the namespaces you need.