本文整理汇总了C++中IDerivedObject::GetObjRef方法的典型用法代码示例。如果您正苦于以下问题:C++ IDerivedObject::GetObjRef方法的具体用法?C++ IDerivedObject::GetObjRef怎么用?C++ IDerivedObject::GetObjRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDerivedObject
的用法示例。
在下文中一共展示了IDerivedObject::GetObjRef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
Modifier *CMaxMesh::FindPhysiqueModifier(INode *pINode)
{
// 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 physique modifier
if(pModifier->ClassID() == Class_ID(PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B)) return pModifier;
}
// continue with next derived object
pObject = pDerivedObject->GetObjRef();
}
return 0;
}
示例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: 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;
}
示例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: 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;
}
示例6: 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;
}
示例7:
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;
}
示例8: return
Object *GetBaseObjectFromNode (INode *node)
{
Object *ob;
IDerivedObject *od;
SClass_ID cid;
ob=node->GetObjectRef();
if (ob)
cid=ob->SuperClassID();
else return (NULL);
while ((cid==GEN_DERIVOB_CLASS_ID) && (ob))
{
od=(IDerivedObject *)ob;
ob=od->GetObjRef();
cid=ob->SuperClassID();
}
return(ob);
}
示例9: 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;
}
示例10: 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();
}
}
}
示例11: while
Modifier *FindSkinModifier (INode *node)
{
Object* ObjectPtr = node->GetObjectRef();
if (!ObjectPtr) return NULL;
while (ObjectPtr->SuperClassID() == GEN_DERIVOB_CLASS_ID && ObjectPtr)
{
IDerivedObject *DerivedObjectPtr = (IDerivedObject *)(ObjectPtr);
int ModStackIndex = 0;
while (ModStackIndex < DerivedObjectPtr->NumModifiers())
{
Modifier* ModifierPtr = DerivedObjectPtr->GetModifier(ModStackIndex);
if (ModifierPtr->ClassID() == SKIN_CLASSID)
return ModifierPtr;
ModStackIndex++;
}
ObjectPtr = DerivedObjectPtr->GetObjRef();
}
return NULL;
}
示例12: RecursePipeAndMatch
BOOL RecursePipeAndMatch(LocalPatchData *smd, Object *obj)
{
SClass_ID sc;
IDerivedObject* dobj;
Object *currentObject = obj;
if ((sc = obj->SuperClassID()) == GEN_DERIVOB_CLASS_ID)
{
dobj = (IDerivedObject*)obj;
while (sc == GEN_DERIVOB_CLASS_ID)
{
for (int j = 0; j < dobj->NumModifiers(); j++)
{
ModContext *mc = dobj->GetModContext(j);
if (mc->localData == smd)
{
return TRUE;
}
}
dobj = (IDerivedObject*)dobj->GetObjRef();
currentObject = (Object*) dobj;
sc = dobj->SuperClassID();
}
}
int bct = currentObject->NumPipeBranches(FALSE);
if (bct > 0)
{
for (int bi = 0; bi < bct; bi++)
{
Object* bobj = currentObject->GetPipeBranch(bi,FALSE);
if (RecursePipeAndMatch(smd, bobj)) return TRUE;
}
}
return FALSE;
}
示例13: GetPhysiqueModifier
// --[ Method ]---------------------------------------------------------------
//
// - Class : CStravaganzaMaxTools
//
// - prototype : Modifier* GetPhysiqueModifier(INode* pMaxNode)
//
// - Purpose : Returns the Physique modifier of a given node if present.
//
// -----------------------------------------------------------------------------
Modifier* CStravaganzaMaxTools::GetPhysiqueModifier(INode* pMaxNode)
{
Object* pMaxObject = pMaxNode->GetObjectRef();
if(!pMaxObject)
{
return NULL;
}
while(pMaxObject->SuperClassID() == GEN_DERIVOB_CLASS_ID && pMaxObject)
{
// Yes -> Cast.
IDerivedObject* pMaxDerivedObject = (IDerivedObject *)(pMaxObject);
// Iterate over all entries of the modifier stack.
int nModStackIndex = 0;
while(nModStackIndex < pMaxDerivedObject->NumModifiers())
{
// Get current modifier.
Modifier* pMaxModifier = pMaxDerivedObject->GetModifier(nModStackIndex);
// Is this Physique?
if(pMaxModifier->ClassID() == Class_ID(PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B))
{
return pMaxModifier;
}
nModStackIndex++;
}
pMaxObject = pMaxDerivedObject->GetObjRef();
}
// Not found.
return NULL;
}
示例14: GetCustomAWDObjectSettings
CustomAttributes_struct MaxAWDExporter::GetCustomAWDObjectSettings(IDerivedObject * node_der,Animatable *obj)
{
CustomAttributes_struct returnData;
returnData.export_this=true;
returnData.export_this_children=true;
if(node_der!=NULL){
int nMods = node_der->NumModifiers();
for (int m = 0; m<nMods; m++){
Modifier* node_mod = node_der->GetModifier(m);
if (node_mod->IsEnabled()){
MSTR className;
node_mod->GetClassName(className);
char * className_ptr=W2A(className);
if (ATTREQ(className_ptr,"AWDObjectSettings")){
IParamBlock2* pb = GetParamBlock2ByIndex((ReferenceMaker*)node_mod, 0);
if(pb!=NULL){
int numBlockparams=pb->NumParams();
int p=0;
for (p=0; p<numBlockparams; p++) {
ParamID pid = pb->IndextoID(p);
ParamDef def = pb->GetParamDef(pid);
ParamType2 paramtype = pb->GetParameterType(pid);
char * paramName_ptr=W2A(def.int_name);
if (ATTREQ(paramName_ptr, "thisAWDID")){
//if (paramtype==TYPE_STRING)
// skeletonMod_ptr=W2A(pb->GetStr(pid));
}
if (ATTREQ(paramName_ptr, "Export")){
if (paramtype==TYPE_BOOL)
returnData.export_this=(0 != pb->GetInt(pid));
}
if (ATTREQ(paramName_ptr, "ExportChildren")){
if (paramtype==TYPE_BOOL)
returnData.export_this_children=(0 != pb->GetInt(pid));
}
}
}
free (className_ptr);
return returnData;
}
free (className_ptr);
}
}
Object * thisOBJ=(Object *)node_der->GetObjRef();
if(thisOBJ!=NULL){
if((thisOBJ->SuperClassID() == GEN_DERIVOB_CLASS_ID) || (thisOBJ->SuperClassID() == WSM_DERIVOB_CLASS_ID) || (thisOBJ->SuperClassID() == DERIVOB_CLASS_ID )){
IDerivedObject* thisDerObj=( IDerivedObject* ) thisOBJ;
if(thisDerObj!=NULL){
int nMods = thisDerObj->NumModifiers();
for (int m = 0; m<nMods; m++){
Modifier* node_mod = thisDerObj->GetModifier(m);
if (node_mod->IsEnabled()){
MSTR className;
node_mod->GetClassName(className);
char * className_ptr=W2A(className);
if (ATTREQ(className_ptr,"AWDObjectSettings")){
IParamBlock2* pb = GetParamBlock2ByIndex((ReferenceMaker*)node_mod, 0);
if(pb!=NULL){
int numBlockparams=pb->NumParams();
int p=0;
for (p=0; p<numBlockparams; p++) {
ParamID pid = pb->IndextoID(p);
ParamDef def = pb->GetParamDef(pid);
ParamType2 paramtype = pb->GetParameterType(pid);
char * paramName_ptr=W2A(def.int_name);
if (ATTREQ(paramName_ptr, "thisAWDID")){
//if (paramtype==TYPE_STRING)
// skeletonMod_ptr=W2A(pb->GetStr(pid));
}
if (ATTREQ(paramName_ptr, "export")){
if (paramtype==TYPE_BOOL)
returnData.export_this=(0 != pb->GetInt(pid));
}
if (ATTREQ(paramName_ptr, "exportChildren")){
if (paramtype==TYPE_BOOL)
returnData.export_this_children=(0 != pb->GetInt(pid));
}
}
}
free (className_ptr);
return returnData;
}
free (className_ptr);
}
}
}
}
}
}
while(obj->SuperClassID() != BASENODE_CLASS_ID) {
if (obj->SuperClassID() == GEN_DERIVOB_CLASS_ID) {
IDerivedObject *dobj = (IDerivedObject *)obj;
obj = dobj->GetObjRef(); // Get next object down mod-stack.
}
else {
break; // Failed.
}
}
ICustAttribContainer *attributes = obj->GetCustAttribContainer();
//.........这里部分代码省略.........
示例15: makeHavokRigidBody
void HavokExport::makeHavokRigidBody(NiNodeRef parent, INode *ragdollParent, float scale) {
this->scale = scale;
Object *Obj = ragdollParent->GetObjectRef();
Modifier* rbMod = nullptr;
Modifier* shapeMod = nullptr;
Modifier* constraintMod = nullptr;
SimpleObject* havokTaperCapsule = nullptr;
//get modifiers
while (Obj->SuperClassID() == GEN_DERIVOB_CLASS_ID) {
IDerivedObject *DerObj = static_cast<IDerivedObject *> (Obj);
const int nMods = DerObj->NumModifiers(); //it is really the last modifier on the stack, and not the total number of modifiers
for (int i = 0; i < nMods; i++)
{
Modifier *Mod = DerObj->GetModifier(i);
if (Mod->ClassID() == HK_RIGIDBODY_MODIFIER_CLASS_ID) {
rbMod = Mod;
}
if (Mod->ClassID() == HK_SHAPE_MODIFIER_CLASS_ID) {
shapeMod = Mod;
}
if (Mod->ClassID() == HK_CONSTRAINT_RAGDOLL_CLASS_ID || Mod->ClassID() == HK_CONSTRAINT_HINGE_CLASS_ID) {
constraintMod = Mod;
}
}
if (Obj->SuperClassID() == GEOMOBJECT_CLASS_ID) {
havokTaperCapsule = (SimpleObject*)Obj;
}
Obj = DerObj->GetObjRef();
}
if (!rbMod) {
throw exception(FormatText("No havok rigid body modifier found on %s", ragdollParent->GetName()));
}
if (!shapeMod) {
throw exception(FormatText("No havok shape modifier found on %s", ragdollParent->GetName()));
}
// Object* taper = ragdollParent->GetObjectRef();
IParamBlock2* taperParameters = Obj->GetParamBlockByID(PB_TAPEREDCAPSULE_OBJ_PBLOCK);
float radius;
enum
{
// GENERAL PROPERTIES ROLLOUT
PA_TAPEREDCAPSULE_OBJ_RADIUS = 0,
PA_TAPEREDCAPSULE_OBJ_TAPER,
PA_TAPEREDCAPSULE_OBJ_HEIGHT,
PA_TAPEREDCAPSULE_OBJ_VERSION_INTERNAL,
};
taperParameters->GetValue(PA_TAPEREDCAPSULE_OBJ_RADIUS, 0, radius, FOREVER);
int shapeType;
if (IParamBlock2* shapeParameters = shapeMod->GetParamBlockByID(PB_SHAPE_MOD_PBLOCK)) {
shapeParameters->GetValue(PA_SHAPE_MOD_SHAPE_TYPE,0,shapeType,FOREVER);
}
//Havok Shape
bhkShapeRef shape;
if (shapeType == 2) {
// Capsule
bhkCapsuleShapeRef capsule = new bhkCapsuleShape();
capsule->SetRadius(radius/scale);
capsule->SetRadius1(radius/scale);
capsule->SetRadius2(radius/scale);
float length;
taperParameters->GetValue(PA_TAPEREDCAPSULE_OBJ_HEIGHT, 0, length, FOREVER);
//get the normal
Matrix3 axis(true);
ragdollParent->GetObjOffsetRot().MakeMatrix(axis);
Point3 normalAx = axis.GetRow(2);
//capsule center
Point3 center = ragdollParent->GetObjOffsetPos();
//min and max points
Point3 pt1 = center - normalAx*(length/2);
Point3 pt2 = center + normalAx*(length/2);
capsule->SetFirstPoint(TOVECTOR3(pt1)/scale);
capsule->SetSecondPoint(TOVECTOR3(pt2)/scale);
capsule->SetMaterial(HAV_MAT_SKIN);
shape = StaticCast<bhkShape>(capsule);
}
else {
// Sphere
//CalcBoundingSphere(node, tm.GetTrans(), radius, 0);
bhkSphereShapeRef sphere = new bhkSphereShape();
sphere->SetRadius(radius/scale);
//.........这里部分代码省略.........