Instantly share code, notes, and snippets.

View gist:38ffd8cbf2f7c736554907d4b7805b77
struct SComponentListHolder
{
public:
// a constructor
SComponentListHolder()
{
component_list = FBCreateComponentList();
}
~SComponentListHolder()
{
View gist:1a57cdca9493493b98ba59fe9aeca207
// 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();
View gist:fee0f3c4ab42f2c2f938de26a7749199
/*
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);
View gist:eeebdb9cdf800995bb1257c35f5078e6
lTime = FBTime(0,0,0,-1710)
strValue = lTime.GetTimeString()
print strValue
lTime2 = FBTime(0)
lTime2.SetTimeString(strValue)
frameIdx = lTime2.GetFrame()
View FbxStoreRetrieve
// 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
View mobu_HWND
char windowTitle[128];
HWND FindInParent(HWND wnd)
{
if (wnd == nullptr)
return nullptr;
GetWindowText( wnd, windowTitle, 128 );
if (strstr( windowTitle, "MotionBuilder" ) != nullptr )
View gist:a47bab01c0279d9244c3
#Get the effector node id
for k, v in FBEffectorId.names.iteritems():
print v
View renderToFBO
// on some create
mRenderer = new FBRenderer(0);
FBViewingOptions *pViewingOptions = mRenderer->GetViewingOptions();
pViewingOptions->PickingMode() = kFBPickingModeModelsOnly;
pViewingOptions->ShadingMode() = kFBModelShadingAll;
pViewingOptions->ShowTimeCode() = false;
pViewingOptions->ShowCameraLabel() = false;
View IsPowerOfTwo
/**
* @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); }
View ORSDK_CreateAndDeleteConstraint
// two ways for constraint creation
//
/// 1 - make it from constraint manager and show up in the scene constraints
pConstraint = FBConstraintManager::TheOne().TypeCreateConstraint( "Some constraint" );
/// 2 - make it for internal use (hiden from users)
pConstraint = new FBSomeConstraint( constraintName );