Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / SDK / Moving faces via SDK
  RSS 2.0 ATOM  

Moving faces via SDK
Rate this thread
 
62528
 
Permlink of this thread  
avatar
  • Total Posts: 2
  • Joined: 05 December 2011 01:52 AM

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"truefalsetruefalseNULL00)
INode 
pNode SceneNodeByNameCache::GetInst().GetSceneNodeByName("Box001"truefalse);
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(100FALSEpluginInstance->ip->GetTime());
 
ep->MoveSelection(EP_SL_FACEpluginInstance->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?



Replies: 0
avatar
  • Seggaeman
  • Posted: 06 December 2011 07:56 AM

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(99FALSEpluginInstance->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.



Replies: 0
avatar
  • Seggaeman
  • Posted: 06 December 2011 08:02 AM

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.



Replies: 0
avatar

Thanks for your reply and help!

Seggaeman 06 December 2011 07:56 AM

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.



Replies: 0
avatar
  • Seggaeman
  • Posted: 07 December 2011 07:14 PM

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>


Replies: 0