Moving faces via SDK

Moving faces via SDK

Anonymous
Not applicable
340 Views
4 Replies
Message 1 of 5

Moving faces via SDK

Anonymous
Not applicable
Hi everyone,

I'm dealing with SDK for the first time and have a problem. The goal is to change objects' thickness by moving its "bottom" faces via SDK. For example, there is a box and two its faces have material ID set to 100. I'm trying to select them by ID and move them:

pluginInstance->ip->MergeFromFile("D:\\test.max", true, false, true, false, NULL, 0, 0)
INode * pNode = SceneNodeByNameCache::GetInst().GetSceneNodeByName("Box001", true, false);
Object * obj = pNode->GetObjectRef();
if (obj->ClassID() == EPOLYOBJ_CLASS_ID)
{
PolyObject * po = (PolyObject *)obj;
EPoly * ep = (EPoly *)po->GetInterface(EPOLY_INTERFACE);
ep->SetEPolySelLevel(EP_SL_FACE);
ep->EpfnSelectByMat(100, FALSE, pluginInstance->ip->GetTime());
ep->MoveSelection(EP_SL_FACE, pluginInstance->ip->GetTime(), Matrix3(true), Matrix3(true), Point3(200,200,200), TRUE);
}


The code in "if" block is executed, doesn't give errors, but nothing happens. The box is loaded but not modified. What's the mistake?
0 Likes
341 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Solved.

Notice that the material IDs in the Polygon MaterialIDs floater start from 1. But internally (for the SDK at least)these are zero based. Therefore a material ID of 100 in the rollout corresponds to 99 in code. Try changing 100 to 99 and watch the result. 😉

i.e.

ep->EpfnSelectByMat(99, FALSE, pluginInstance->ip->GetTime());


Btw in which header is SceneNodeByNameCache? It is certainly not in define_implementations.h. Had to use InterfacePtr->GetSelNode(0) to test the code.
0 Likes
Message 3 of 5

Anonymous
Not applicable
I cannot avoid feeling that this is a very unhelpful forum. I am not a professional 3ds max developer (and even less a professional programmer), yet I am answering questions.
0 Likes
Message 4 of 5

Anonymous
Not applicable
Thanks for your reply and help!

Solved.
Btw in which header is SceneNodeByNameCache? It is certainly not in define_implementations.h. Had to use InterfacePtr->GetSelNode(0) to test the code.


SceneNodeByNameCache is located in pathname.h.
0 Likes
Message 5 of 5

Anonymous
Not applicable
No problem. I myself could use some help now. How to adjust skin envelopes through the SDK?
What I am looking for is the equivalent of these MAXScript instructions.


skinOps.SetInnerRadius <Skin> \
<bone_integer> <CrossSectionID_integer> <Radius_float>


and


skinOps.SetOuterRadius <Skin> \
<bone_integer> <CrossSectionID_integer> <Radius_float>
0 Likes