Skip to content

Instantly share code, notes, and snippets.

@awforsythe
Created April 5, 2013 20:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awforsythe/5322163 to your computer and use it in GitHub Desktop.
Save awforsythe/5322163 to your computer and use it in GitHub Desktop.
Deletes all components in a MotionBuilder namespace. Slight adaptation of a script by Marcus Krautwurst: http://www.marcuskrautwurst.com/2013/04/deleting-objects-in-motionbuilder.html
def DeleteNamespace(namespace):
in_namespace = lambda c: ('%s:' % namespace) in c.LongName
delete_comp = lambda c: c.FBDelete()
delete_in_namespace = lambda cs: map(delete_comp, filter(in_namespace, cs))
scene = FBSystem().Scene
map(delete_in_namespace, [
scene.Constraints,
scene.Handles,
scene.UserObjects,
scene.ControlSets,
scene.CharacterExtensions,
scene.Characters,
[c for c in scene.Components if isinstance(c, FBModel)],
scene.Materials,
scene.Shaders,
scene.Textures,
scene.Folders,
scene.Groups,
scene.ObjectPoses,
scene.CharacterPoses,
scene.Components
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment