Skip to content

Instantly share code, notes, and snippets.

@Neill3d
Neill3d / ResetSkinBindPose
Created September 1, 2013 09:06
MEL Script for reseting skin bind pose.
//
// Reset bind pose for selected mesh with skin cluster
//
// it will copy object, bind with the same weights, copy weights, delete old object
//
// Author Sergey Solohin (Neill3d) 2013, e-mail to: s@neill3d.com
// www.neill3d.com
//
string $selection[] = `ls -sl`;
@Neill3d
Neill3d / gist:6682005
Last active December 23, 2015 19:19
MotionBuilder SDK Snippet - get pointer to a geometry model from the constraint input node
if( mSourceTranslation && mConstrainedTranslation )
{
FBComponent *pComp = nullptr;
int count = mSourceTranslation->GetSrcCount();
if (count)
{
pComp = (FBComponent*) mSourceTranslation->GetSrc(0)->GetOwner();
}
@Neill3d
Neill3d / gist:7582093
Last active December 28, 2015 23:49
MotionBuilder - making custom property view for your plugin
//I took that from HIK example
// 1 - in header declare some static procedure
static void AddPropertiesToPropertyViewManager();
// 2 - in source implement your custom view set
// where ORCONSTRAINTEXTRACTION__CLASSSTR - is your plugin class name
//
// you can add some folders and pack there your plugin properties
//
@Neill3d
Neill3d / gist:7667826
Created November 26, 2013 22:58
MotionBuilder Python: How to find a parent track for given story clip
from pyfbsdk import *
lStory = FBStory()
for lTrack in lStory.RootFolder.Tracks:
for lClip in lTrack.Clips:
print lClip.Name
if len(lClip.Parents):
for lParent in lClip.Parents:
print lParent.Name
@Neill3d
Neill3d / gist:8159117
Created December 28, 2013 12:38
OR SDK Constraint without input node
// NOTE:
// Usually input animation node should be assigned to constrained object,
// but this plug-in create an animation node which assigned to «Camera Switcher» to solve this constraint
// before other types of constraints such as ‘Path constraint’
// beacuse MotionBuilder dones’t have deformer propagation system.
if ( FBFindModelByName( »Camera Switcher» ) ){
mDummy_AnimationNode = AnimationNodeInCreate ( 0/*Curve_UserId*/, FBFindModelByName( »Camera Switcher» ), ANIMATIONNODE_TYPE_TRANSLATION );
@Neill3d
Neill3d / gist:8177642
Created December 30, 2013 03:58
Take care about model pointer in OR SDK (MotionBuilder)
//
// 1 - desclare pointer to a model with special class
//
HdlFBPlugTemplate<FBModel> mHdlModel;
//
// 2 - use it and check if pointer is actual
//
@Neill3d
Neill3d / gist:8302900
Created January 7, 2014 17:24
MoBu Python: Go throught timeline markers
time = FBPlayerControl().LoopStart
nextTime = time
FBPlayerControl().Goto(time)
nextTime = FBPlayerControl().NextMarker
while time.Get() < nextTime.Get():
print( 'Marker Frame - ' + str(nextTime.GetFrame(True)) )
time = nextTime
@Neill3d
Neill3d / gist:8349436
Last active January 2, 2016 19:19
MotionBuilder SDK bug in ClosestRayIntersection function (FBModel class)
// use FBTVector instead of FBNormal - !! BUG in function declare arguments
FBTVector n;
if (mModel->ClosestRayIntersection( lOrig, lDir, pos, (FBNormal&) n ) )
{
///
}
@Neill3d
Neill3d / gist:8535020
Created January 21, 2014 05:53
OR SDK: remove constraint animation nodes
/************************************************
* Removed all of the animation nodes.
************************************************/
void ORConstraint_CarPhysics::RemoveAllAnimationNodes()
{
/*
* If nodes have been bound to deformations, remove the binding.
*/
/*
if (mDummy_AnimationNode)
@Neill3d
Neill3d / ORSDK_ConfigFile
Last active August 29, 2015 13:56
MoBu OR SDK: how to work with config file
FBConfigFile lFile( "@MyConfig.txt", true );
FBString strDefault( "false" );
const char *szDefault = strDefault;
lFile.GetOrSet( "MyCategory", "MyParameter", szDefault, "This is default comment on parameter, value (true / false)" );
return ( strstr(szDefault, "true") != nullptr );