daedalean
04-09-2012, 02:35 AM
I'm writing a scene exporter and I need to get parameter information from objects created by simple plugin scripts. I've got a INode* and an Object* for each of these objects, but I can't figure out how to extract the parameter information from them.
If I call object->NumParamBlocks(), I get a value of 1. However, if I call object->GetParamBlock(), I end up getting a null pointer. There's also a Object::GetParamBlockByID method I could try but I have no idea what the ID value is or how to define them in the script.
Here is the script I made for one of the custom objects. The other objects are very similar.
plugin simpleObject nbox_plugin_def
name:"NBox"
classID:#(0x5f70880,0x7a5612b3)
category:"NPhysics"
(
local box1
parameters main rollout:params
(
length type:#worldUnits ui:length default:1E-3
width type:#worldUnits ui:width default:1E-3
height type:#worldUnits ui:height default:1E-3
mass type:#float ui:mass default:1
)
rollout params "NBox Parameters"
(
spinner height "Height" type:#worldUnits range:[1E-3,1E9,1E-3]
spinner width "Width" type:#worldUnits range:[1E-3,1E9,1E-3]
spinner length "Length" type:#worldUnits range:[-1E9,1E9,1E-3]
spinner mass "Mass" type:#float
)
on buildMesh do
(
if box1 == undefined do
(box1 = createInstance box)
box1.height = height
box1.width = width
box1.length = length
mesh = box1.mesh
)
tool create
(
on mousePoint click do
case click of
(
1: nodeTM.translation = gridPoint
3: #stop
)
on mouseMove click do
case click of
(
2: (width = abs gridDist.x; length = abs gridDist.y)
3: height = gridDist.z
)
)
)
For this "NBox," I need to access the values of all four parameters.
Any help would be much appreciated. Thanks!
If I call object->NumParamBlocks(), I get a value of 1. However, if I call object->GetParamBlock(), I end up getting a null pointer. There's also a Object::GetParamBlockByID method I could try but I have no idea what the ID value is or how to define them in the script.
Here is the script I made for one of the custom objects. The other objects are very similar.
plugin simpleObject nbox_plugin_def
name:"NBox"
classID:#(0x5f70880,0x7a5612b3)
category:"NPhysics"
(
local box1
parameters main rollout:params
(
length type:#worldUnits ui:length default:1E-3
width type:#worldUnits ui:width default:1E-3
height type:#worldUnits ui:height default:1E-3
mass type:#float ui:mass default:1
)
rollout params "NBox Parameters"
(
spinner height "Height" type:#worldUnits range:[1E-3,1E9,1E-3]
spinner width "Width" type:#worldUnits range:[1E-3,1E9,1E-3]
spinner length "Length" type:#worldUnits range:[-1E9,1E9,1E-3]
spinner mass "Mass" type:#float
)
on buildMesh do
(
if box1 == undefined do
(box1 = createInstance box)
box1.height = height
box1.width = width
box1.length = length
mesh = box1.mesh
)
tool create
(
on mousePoint click do
case click of
(
1: nodeTM.translation = gridPoint
3: #stop
)
on mouseMove click do
case click of
(
2: (width = abs gridDist.x; length = abs gridDist.y)
3: height = gridDist.z
)
)
)
For this "NBox," I need to access the values of all four parameters.
Any help would be much appreciated. Thanks!
