Getting a ShapeBase datablock value
by Chris B · in Torque Game Engine · 10/13/2004 (10:29 pm) · 4 replies
Hi,
I'm have defined in my flyingvehicle datablock the value displayName = "whatever";
I have made an object selection option in GameTSCtrl, based off the one in the world editor which allows me to drag and make selections.
These selections are stored in a Selection object, as a SceneObject.
What I would like to do, is display the datablock value displayName, above the model.
I have everything working now except for that.
My problem is that I do not know how to get the displayName datablock value, stored in the ShapeBaseData, whilst my object is a SceneObject.
Is there a way that I can get a either the datablocks value via a SceneObject, or create a new ShapeBaseData object which contains my models datablock values.
I hope this makes sense, as always any help is gratefully appreciated.
Thanks
I'm have defined in my flyingvehicle datablock the value displayName = "whatever";
I have made an object selection option in GameTSCtrl, based off the one in the world editor which allows me to drag and make selections.
These selections are stored in a Selection object, as a SceneObject.
What I would like to do, is display the datablock value displayName, above the model.
I have everything working now except for that.
My problem is that I do not know how to get the displayName datablock value, stored in the ShapeBaseData, whilst my object is a SceneObject.
Is there a way that I can get a either the datablocks value via a SceneObject, or create a new ShapeBaseData object which contains my models datablock values.
I hope this makes sense, as always any help is gratefully appreciated.
Thanks
#2
Thanks for the response.
I'm actually trying to do this in the engine code - I have seen some docs on calling console methods from engine code and will investigate doing it that way :)
10/13/2004 (10:45 pm)
Hi Edward,Thanks for the response.
I'm actually trying to do this in the engine code - I have seen some docs on calling console methods from engine code and will investigate doing it that way :)
#3
Basically, what you're going to want to do is declare the variable in flyingVehicle.h as a member of the flyingVehicleData class. Then in flyingVehicleData::initPersistFields() expose the variable to script with addField. At this point you should be able to access the variable both in script through your datablock and in the engine as a member of flyingVehicleData.
10/13/2004 (11:01 pm)
Check out this section of the documentation. About halfway down the page it talks about the addField function.Basically, what you're going to want to do is declare the variable in flyingVehicle.h as a member of the flyingVehicleData class. Then in flyingVehicleData::initPersistFields() expose the variable to script with addField. At this point you should be able to access the variable both in script through your datablock and in the engine as a member of flyingVehicleData.
#4
thats the bit i'm not sure how to do :)
edit:
this is the object I have to reference from by the way:
SceneObject * obj = selected_objects[i];
10/13/2004 (11:11 pm)
I have already added the datablock variable with initPersistFields - it is accessible from that class, but: Quote:and in the engine as a member of flyingVehicleData.
thats the bit i'm not sure how to do :)
edit:
this is the object I have to reference from by the way:
SceneObject * obj = selected_objects[i];
Associate Edward F. Maurina III
Roaming Gamer LLC
In script, if you have the ID of the object (assuming it is stored in %obj), just use the following:
I hope I understood your question properly...
[HOW]EdM|EGTGE