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
/** | |
* @fn IsPowerOfTwo(int n) | |
* @brief Returns true if /param n is an integer power of 2. | |
* | |
* Taken from Steve Baker's Cute Code Collection. | |
* http://www.sjbaker.org/steve/software/cute_code.html | |
*/ | |
static bool IsPowerOfTwo(int n) { return ((n&(n-1))==0); } |
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
// on some create | |
mRenderer = new FBRenderer(0); | |
FBViewingOptions *pViewingOptions = mRenderer->GetViewingOptions(); | |
pViewingOptions->PickingMode() = kFBPickingModeModelsOnly; | |
pViewingOptions->ShadingMode() = kFBModelShadingAll; | |
pViewingOptions->ShowTimeCode() = false; | |
pViewingOptions->ShowCameraLabel() = false; |
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
#Get the effector node id | |
for k, v in FBEffectorId.names.iteritems(): | |
print v |
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
char windowTitle[128]; | |
HWND FindInParent(HWND wnd) | |
{ | |
if (wnd == nullptr) | |
return nullptr; | |
GetWindowText( wnd, windowTitle, 128 ); | |
if (strstr( windowTitle, "MotionBuilder" ) != nullptr ) |
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
// In SDK samples in most cases, store and retrive use this kind of condition | |
if( pStoreWhat == kAttributes ) | |
{ | |
//... | |
} | |
// This is not correct, cause kAttributes is a bit flag and it could be used with kMerge (in merge pass) | |
// So better to use this kind of condition instead |
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
lTime = FBTime(0,0,0,-1710) | |
strValue = lTime.GetTimeString() | |
print strValue | |
lTime2 = FBTime(0) | |
lTime2.SetTimeString(strValue) | |
frameIdx = lTime2.GetFrame() |
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
/* | |
super important to initialize oriIndex variable with value like 0. | |
Othewise ShapeGetDiffPoint will not work and return false !!! | |
*/ | |
int oriIndex=0; | |
FBVertex posDiff; | |
FBNormal normalDiff; | |
pGeometry->ShapeGetDiffPoint(i, j, oriIndex, posDiff, normalDiff); |
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
// don't forget to check for VBO offsets | |
FBModelVertexData *pVertexData = pModel->ModelVertexData; | |
if (pVertexData == nullptr || pVertexData->IsDrawable() == false) | |
return false; | |
const unsigned int positionId = pVertexData->GetVertexArrayVBOId(kFBGeometryArrayID_Point); | |
const unsigned int normalId = pVertexData->GetVertexArrayVBOId(kFBGeometryArrayID_Normal ); | |
const unsigned int uvId = pVertexData->GetUVSetVBOId(); |
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
struct SComponentListHolder | |
{ | |
public: | |
// a constructor | |
SComponentListHolder() | |
{ | |
component_list = FBCreateComponentList(); | |
} | |
~SComponentListHolder() | |
{ |
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
# script is running inside the same context, so it could be splitted into initialization step and evaluation step | |
# here is an example | |
try: | |
initialize > 0 | |
print "evaluating" | |
except (NameError,),e: | |
initialize = 1 | |
print "initilize" |