Created
January 20, 2012 15:58
-
-
Save aruslan/1648002 to your computer and use it in GitHub Desktop.
Code I see almost everywhere -- is it from somewhere in 3DSMAX SDK?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Modifier* FindPhysiqueModifier(AXNode* nodePtr) | |
{ | |
// Get object from node. Abort if no object. | |
Object* ObjectPtr =((INode*)nodePtr)->GetObjectRef(); | |
//DebugBox("* Find Physiqye Modifier"); | |
if (!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); | |
DebugBox("Modifier Testing: %i \n",ModStackIndex); | |
// Is this Physique ? | |
if (ModifierPtr->ClassID() == Class_ID(PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B)) | |
{ | |
DebugBox("physique modifier found"); | |
// Yes -> Exit. | |
return ModifierPtr; | |
} | |
// Next modifier stack entry. | |
ModStackIndex++; | |
} | |
} | |
// Not found. | |
return NULL; | |
} | |
Modifier* FindMaxSkinModifier( AXNode* nodePtr) | |
{ | |
// Get object from node. Abort if no object. | |
Object* ObjectPtr =((INode*)nodePtr)->GetObjectRef(); | |
if (!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); | |
//DebugBox("Modifier Testing: %i \n",ModStackIndex); | |
// Is this Physique ? | |
if( ModifierPtr->ClassID() == Class_ID(SKIN_CLASSID) ) //PHYSIQUE_CLASS_ID_A, PHYSIQUE_CLASS_ID_B)) | |
{ | |
DebugBox("Skin modifier found"); | |
// Yes -> Exit. | |
return ModifierPtr; | |
} | |
// Next modifier stack entry. | |
ModStackIndex++; | |
} | |
} | |
// Not found. | |
return NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment