PDA

View Full Version : Generated Box Node only shows as a point? Help!


madjeter
01-14-2009, 08:02 AM
Hi all:
I am using Max SDK to create some plugin to generate a bounding box for one node. I learn the INode creation from SDK documents which is at:
3ds max programmer's guide -> working with Objects -> Working with nodes -> object creation Methods

I copied the first example codes. and change it to generate box INode. And I remove modifier things.

Then I tried in Max and sadly found that the generated box is only shown as a point. The shape is not displayed!

At the beginning, I guessed that I set a wrong and tiny size. But I was right. The size is big enough. So, what did I miss?

Please help and thanks!

Here is my codes:

CreateBoxNode(Point3 dimension, Point3 position)
{
INode* ret = NULL;
// Create a new object through the CreateInstance() API
Interface* ip = GetCOREInterface();
Object *obj = (Object*) ip->CreateInstance(GEOMOBJECT_CLASS_ID, Class_ID(BOXOBJ_CLASS_ID,0));
assert(obj);
// Get a hold of the parameter block
IParamArray * params = obj->GetParamBlock();
assert(params);
// Set the value of width, length, height.
int id = obj->GetParamBlockIndex(BOXOBJ_WIDTH);
assert(id >= 0);
params->SetValue(id, TimeValue(0), dimension.x);
id = obj->GetParamBlockIndex(BOXOBJ_LENGTH);
assert(id >= 0);
params->SetValue(id, TimeValue(0), dimension.y);
id = obj->GetParamBlockIndex(BOXOBJ_HEIGHT);
assert(id >= 0);
params->SetValue(id, TimeValue(0), dimension.z);
id = obj->GetParamBlockIndex(BOXOBJ_WSEGS);
assert(id>=0);
params->SetValue(id,TimeValue(0), 1);
id = obj->GetParamBlockIndex(BOXOBJ_LSEGS);
assert(id>=0);
params->SetValue(id,TimeValue(0), 1);

id = obj->GetParamBlockIndex(BOXOBJ_HSEGS);
assert(id>=0);
params->SetValue(id,TimeValue(0), 1);
// Create a derived object that references the cylinder
//IDerivedObject *dobj = CreateDerivedObject(obj);
// Create a node in the scene that references the derived object
ret = ip->CreateObjectNode(obj);
Matrix3 pose;
pose.SetRow(3, position);
ret->SetNodeTM(TimeValue(0), pose);
// Redraw the viewports
ip->RedrawViews(ip->GetTime());
return ret;
}

CGTalk Moderation
01-14-2009, 08:02 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.