本文整理汇总了C++中IDerivedObject::NumModifiers方法的典型用法代码示例。如果您正苦于以下问题:C++ IDerivedObject::NumModifiers方法的具体用法?C++ IDerivedObject::NumModifiers怎么用?C++ IDerivedObject::NumModifiers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDerivedObject
的用法示例。
在下文中一共展示了IDerivedObject::NumModifiers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindSkinModifier
//// FindSkinModifier ///////////////////////////////////////////////////////
// Given an INode, gets the ISkin object of that node, or nil if there is
// none. Taken from the Max4 SDK, ISkin.h
ISkin* plMaxNodeBase::FindSkinModifier()
{
int modStackIndex;
// Get object from node. Abort if no object.
Object *pObj = GetObjectRef();
if( pObj == nil )
return nil;
// Is derived object ?
while( pObj->SuperClassID() == GEN_DERIVOB_CLASS_ID )
{
IDerivedObject *pDerObj = (IDerivedObject *)pObj;
// Iterate over all entries of the modifier stack.
for( modStackIndex = 0; modStackIndex < pDerObj->NumModifiers(); modStackIndex++ )
{
// Get current modifier.
Modifier *mod = pDerObj->GetModifier( modStackIndex );
// Is this Skin ?
if( mod->ClassID() == SKIN_CLASSID )
{
ISkin* skin = (ISkin*)mod->GetInterface(I_SKIN);
if( skin->GetNumBones() > 0 )
return skin;
}
}
pObj = pDerObj->GetObjRef();
}
// Not found.
return nil;
}
示例2: FindSkinModifier
ISkin* MaxExportPlugin::FindSkinModifier(INode* node)
{
Object* object = node->GetObjectRef();
if (!object)
return 0;
while (object->SuperClassID() == GEN_DERIVOB_CLASS_ID && object)
{
IDerivedObject* derivedObject = (IDerivedObject*)object;
int modStackId = 0;
while (modStackId < derivedObject->NumModifiers())
{
Modifier* mod = derivedObject->GetModifier(modStackId);
//file << "MODIFIER: " << std::to_wstring(mod->ClassID().PartA()) << " " << std::to_wstring(mod->ClassID().PartB()) << "\n";
if (mod->ClassID() == SKIN_CLASS_ID)
{
return (ISkin*)(mod->GetInterface(I_SKIN));
}
modStackId++;
}
object = derivedObject->GetObjRef();
}
return 0;
}
示例3: while
Modifier *CMaxMesh::FindSkinModifier(INode *pINode)
{
#if MAX_RELEASE >= 4000
// get the object reference of the node
Object *pObject;
pObject = pINode->GetObjectRef();
if(pObject == 0) return 0;
// loop through all derived objects
while(pObject->SuperClassID() == GEN_DERIVOB_CLASS_ID)
{
IDerivedObject *pDerivedObject;
pDerivedObject = static_cast<IDerivedObject *>(pObject);
// loop through all modifiers
int stackId;
for(stackId = 0; stackId < pDerivedObject->NumModifiers(); stackId++)
{
// get the modifier
Modifier *pModifier;
pModifier = pDerivedObject->GetModifier(stackId);
// check if we found the skin modifier
if(pModifier->ClassID() == SKIN_CLASSID) return pModifier;
}
// continue with next derived object
pObject = pDerivedObject->GetObjRef();
}
#endif
return 0;
}
示例4: CollectModifiers
//----------------------------------------------------------------------------
void SceneBuilder::CollectModifiers (INode *node,
std::vector<Modifier*> &modifiers)
{
// 确定这个节点是否有修改器。如果有,存储起来。
//
// node:
// Max场景中节点指针。
// modifiers:
// 存储所有修改器指针。
Object *obj = node->GetObjectRef();
if (!obj)
return;
while (obj->SuperClassID() == GEN_DERIVOB_CLASS_ID)
{
IDerivedObject* derObj = static_cast<IDerivedObject*>(obj);
int modStackIndex = 0;
while (modStackIndex < derObj->NumModifiers())
{
Modifier *mod = derObj->GetModifier(modStackIndex);
if (mod)
{
modifiers.push_back(mod);
}
modStackIndex++;
}
obj = derObj->GetObjRef();
}
}
示例5: findPhysiqueModifier
Modifier* PhyExportUtil::findPhysiqueModifier( INode* node )
{
// Get object from node. Abort if no object.
::Object* obj = node->GetObjectRef();
if ( !obj )
return 0;
// Is derived object ?
while ( obj->SuperClassID() == GEN_DERIVOB_CLASS_ID && obj )
{
// Yes -> Cast.
IDerivedObject* derivedObj = static_cast<IDerivedObject*>( obj );
// Iterate over all entries of the modifier stack.
for ( int modStackIndex = 0 ; modStackIndex < derivedObj->NumModifiers() ; ++modStackIndex )
{
// Get current modifier.
Modifier* modPtr = derivedObj->GetModifier( modStackIndex );
// Is this Physique ?
if ( modPtr->ClassID() == Class_ID(PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B) )
{
// Yes -> Exit.
return modPtr;
}
}
obj = derivedObj->GetObjRef();
}
// Not found.
return 0;
}
示例6: FindModifier
Modifier* SGP_MaxInterface::FindModifier(INode *pINode, Class_ID id)
{
// get the object reference of the node
Object *pObject;
pObject = pINode->GetObjectRef();
if(pObject == NULL)
return NULL;
// loop through all derived objects
while(pObject->SuperClassID() == GEN_DERIVOB_CLASS_ID)
{
IDerivedObject *pDerivedObject;
pDerivedObject = static_cast<IDerivedObject *>(pObject);
// loop through all modifiers
int stackId;
for(stackId = 0; stackId < pDerivedObject->NumModifiers(); stackId++)
{
// get the modifier
Modifier *pModifier;
pModifier = pDerivedObject->GetModifier(stackId);
// check if we found the modifier
if(pModifier->ClassID() == id)
return pModifier;
}
// continue with next derived object
pObject = pDerivedObject->GetObjRef();
}
return NULL;
}
示例7: FindPhysiqueModifier
// ================================================== FindPhysiqueModifier()
// Find if a given node contains a Physique Modifier
// DerivedObjectPtr requires you include "modstack.h" from the MAX SDK
Modifier* FindPhysiqueModifier (INode* nodePtr)
{
// Get object from node. Abort if no object.
Object* ObjectPtr = nodePtr->GetObjectRef();
if ( NULL == ObjectPtr) return NULL;
// Is derived object ?
if (ObjectPtr->SuperClassID() == GEN_DERIVOB_CLASS_ID){
// Yes -> Cast.
IDerivedObject* DerivedObjectPtr = static_cast<IDerivedObject*>(ObjectPtr);
// Iterate over all entries of the modifier stack.
int ModStackIndex = 0;
while (ModStackIndex < DerivedObjectPtr->NumModifiers()){
// Get current modifier.
Modifier* ModifierPtr = DerivedObjectPtr->GetModifier(ModStackIndex);
Class_ID clsid = ModifierPtr->ClassID();
// Is this Physique ?
if (ModifierPtr->ClassID() == Class_ID(PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B))
{
// Yes -> Exit.
return ModifierPtr;
}
// Next modifier stack entry.
ModStackIndex++;
}
}
// Not found.
return NULL;
}
示例8: NotifyPostCollapse
// We want to survive a collapsed stack so we reapply ourselves here
void EditFaceDataMod::NotifyPostCollapse(INode *node,Object *obj, IDerivedObject *derObj, int index) {
if (mCollapsable) return;
Object *bo = node->GetObjectRef();
IDerivedObject *derob = NULL;
if(bo->SuperClassID() != GEN_DERIVOB_CLASS_ID) {
derob = CreateDerivedObject(obj);
node->SetObjectRef(derob);
} else derob = (IDerivedObject*) bo;
// Add ourselves to the top of the stack
derob->AddModifier(this,NULL,derob->NumModifiers());
// Reinsert our local mod data
ModContext* mc = derob->GetModContext(derob->NumModifiers()-1);
mc->localData = mpModDataCollapseCache;
mpModDataCollapseCache = NULL;
// Reengage modification:
mDisabled = false;
}
示例9: FindModContext
ModContext* FindModContext(INode* pNode, Modifier* mod)
{
IDerivedObject *derivObj;
if( pNode->GetObjectRef()->SuperClassID() == GEN_DERIVOB_CLASS_ID )
derivObj = (IDerivedObject*)pNode->GetObjectRef();
else return NULL;
int i=0, count=derivObj->NumModifiers();
for( i=0; i<count; i++ )
if( (derivObj->GetModifier(i)) == mod ) break;
if( i==count ) return NULL; //the search failed
return derivObj->GetModContext(i);
}
示例10:
PaintDefromModData *PaintDeformTest::GetPMD(INode *pNode)
{
ModContext *mc = NULL;
Object* pObj = pNode->GetObjectRef();
if (!pObj) return NULL;
while (pObj->SuperClassID() == GEN_DERIVOB_CLASS_ID && mc == NULL)
{
IDerivedObject* pDerObj = (IDerivedObject *)(pObj);
int Idx = 0;
while (Idx < pDerObj->NumModifiers())
{
// Get the modifier.
Modifier* mod = pDerObj->GetModifier(Idx);
if (mod->ClassID() == PAINTDEFORMTEST_CLASS_ID)
{
// is this the correct Physique Modifier based on index?
PaintDeformTest *pmod = (PaintDeformTest*)mod;
if (pmod == this)
{
mc = pDerObj->GetModContext(Idx);
break;
}
}
Idx++;
}
pObj = pDerObj->GetObjRef();
}
if(!mc) return NULL;
if ( !mc->localData ) return NULL;
PaintDefromModData *bmd = (PaintDefromModData *) mc->localData;
return bmd;
}
示例11: NotifyPostCollapse
// We want to survive a collapsed stack so we reapply ourselves here
void FaceDataToColorMod::NotifyPostCollapse(INode *node,Object *obj, IDerivedObject *derObj, int index) {
BOOL collapsable;
mpParams->GetValue (pb_collapsable, TimeValue(0), collapsable, FOREVER);
if (collapsable) return;
Object *bo = node->GetObjectRef();
IDerivedObject *derob = NULL;
if(bo->SuperClassID() != GEN_DERIVOB_CLASS_ID) {
derob = CreateDerivedObject(obj);
node->SetObjectRef(derob);
} else derob = (IDerivedObject*) bo;
// Add ourselves to the top of the stack
derob->AddModifier(this,NULL,derob->NumModifiers());
// Reengage modification:
mDisabled = false;
}
示例12: NotifyPostCollapse
void XModifier::NotifyPostCollapse(INode *node,Object *obj, IDerivedObject *derObj, int index)
{
// We don't allow a stack collapse, to delete us.
// We're going to apply ourselves to the collapsed object
Object *bo = node->GetObjectRef();
IDerivedObject *derob = NULL;
if(bo->SuperClassID() != GEN_DERIVOB_CLASS_ID)
{
derob = CreateDerivedObject(obj);
node->SetObjectRef(derob);
}
else
derob = (IDerivedObject*) bo;
derob->AddModifier(this,NULL,derob->NumModifiers());
bModDisabled = false;
}
示例13: MeshModStackIsValid
bool RBExport::MeshModStackIsValid( INode* node )
{
Object* pObj = node->GetObjectRef();
if (pObj->SuperClassID() == GEN_DERIVOB_CLASS_ID)
{
IDerivedObject* pDerivedObj = (IDerivedObject*)pObj;
int nMod = pDerivedObj->NumModifiers();
if (nMod == 0) return true;
if (nMod > 1) return false;
Class_ID id = pDerivedObj->GetModifier( 0 )->ClassID();
return (id == SKIN_CLASSID || id == Class_ID( PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B ));
}
else
{
return true;
}
return false;
} // RBExport::MeshModStackIsValid
示例14: HandleRagdollOnNonAccum
void HavokImport::HandleRagdollOnNonAccum(INode* accumChild, INode* ragdollParent)
{
const int MaxChar = 512;
char buffer[MaxChar];
//Fix for nonaccumNodes
//TSTR name(A2THelper(buffer, parent->GetName().c_str(), _countof(buffer)));
ragdollParent->SetName(FormatText(TEXT("Ragdoll_%s"), accumChild->GetName()));
Object *Obj = ragdollParent->GetObjectRef();
if (Obj->SuperClassID() == GEN_DERIVOB_CLASS_ID)
{
while (Obj->SuperClassID() == GEN_DERIVOB_CLASS_ID) {
IDerivedObject *DerObj = static_cast<IDerivedObject *> (Obj);
const int nMods = DerObj->NumModifiers();
for (int i = 0; i < nMods; i++)
{
Modifier *Mod = DerObj->GetModifier(i);
if (Mod->ClassID() == HK_RIGIDBODY_MODIFIER_CLASS_ID)
{
ICustAttribContainer* cc = Mod->GetCustAttribContainer();
if (cc)
{
//reset
Mod->DeleteCustAttribContainer();
}
Mod->AllocCustAttribContainer();
cc = Mod->GetCustAttribContainer();
CustAttrib* c = (CustAttrib*)CreateInstance(CUST_ATTRIB_CLASS_ID, Class_ID(0x6e663460, 0x32682c72));
IParamBlock2* custModParameters = c->GetParamBlock(0);
custModParameters->SetValue(0, 0, accumChild, 0);
cc->InsertCustAttrib(0, c);
}
}
Obj = DerObj->GetObjRef();
}
}
}
示例15: getISkinPtr
ISkin* CExporter::getISkinPtr(Object* object)
{
assert(object != NULL);
while (GEN_DERIVOB_CLASS_ID == object->SuperClassID())
{
IDerivedObject* pDerObj = static_cast<IDerivedObject*>(object);
for (int i = 0; i < pDerObj->NumModifiers(); ++i)
{
Modifier* mod = pDerObj->GetModifier(i);
if (SKIN_CLASSID == mod->ClassID())
{
return (ISkin*)(mod->GetInterface(I_SKIN));
}
}
object = pDerObj->GetObjRef();
}
return NULL;
}