Skip to content

Instantly share code, notes, and snippets.

View OmniZ3D's full-sized avatar

Jason Barnidge OmniZ3D

View GitHub Profile
@OmniZ3D
OmniZ3D / FBX_Scene.py
Last active June 1, 2024 04:14 — forked from Meatplowz/FBX_Scene.py
This is a wrapper FBX class useful in accessing and modifying the FBX Scene
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a helper FBX class useful in accessing and modifying the FBX Scene
Documentation for the FBX SDK
http://help.autodesk.com/view/FBX/2015/ENU/?guid=__cpp_ref_index_html
Examples:
# instantiate the class, as seen below with a path to an FBX file
fbx_file = FBX_Class(r'c:\my_path\character.fbx')
@OmniZ3D
OmniZ3D / FBX Wrapper.py
Created October 3, 2017 22:16 — forked from theodox/FBX Wrapper.py
FBXWrapper
'''
FBXWrapper
This module provides a python wrapper for every method exposed in the FBX plugin.
The arguments for the calls are the same as for the equivalent mel calls, however they can be passed with typical
python syntax, which is translated to mel-style flags and arguments under the hood. The actual flags and arguments
are documented here:
usage:
@OmniZ3D
OmniZ3D / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
from PIL import Image
width, height = 256, 32
image = Image.new("RGB", (width, height))
pixels = image.load()
for i in range(image.size[0]):
for j in range(image.size[1]):
pixels[i,j] = (i, i, i)
image.save("Linear_Ramp.png", "PNG")
@OmniZ3D
OmniZ3D / getSelectedOrder.py
Created June 27, 2013 10:00
getSelectedOrder (MotionBuilder) snippet function via pyfbsdk FBGetSelectedModels
from pyfbsdk import *
def getSelectedOrder():
# selectionOrder selection order
# Get the current selection
lModelList = FBModelList()
pParent = None
pSelected = True
pSortSelectedOrder = True
FBGetSelectedModels( lModelList, pParent, pSelected, pSortSelectedOrder )
@OmniZ3D
OmniZ3D / ezTD_mobuSetup.py
Created April 27, 2013 12:09
Easily setup & maintain a standardized pipeline for Animators in MotionBuilder Also helpful when/if a MotionBuilder bug resets the config files. Making a copy of your "..\Documents\MB\[version]\config" directory is recommended to back up your personal preferences.
########################################################################################
## ezTD_mobuSetup.py
## version: 2.0
## Author: Jason Barnidge
## jbarnidge [at] OmniZed.com
## www.OmniZed.com
## Description:
## Easily setup & maintain a standardized pipeline for Animators in MotionBuilder
## Also helpful when/if a MotionBuilder bug resets the config files
########################################################################################
@OmniZ3D
OmniZ3D / mobuCurrentFrRange.py
Created March 6, 2013 00:59
gets the current frame range / "zoom slider" from mobu
## snippet function
from pyfbsdk import *
from pyfbsdk_additions import *
def getZoomStartEndFrames():
""" getFrameRange of Zoom Slider
returns start and end """
lPlayer = FBPlayerControl()
lStartFr = lPlayer.ZoomWindowStart.GetTimeString()
lEndFr = lPlayer.ZoomWindowStop.GetTimeString()
@OmniZ3D
OmniZ3D / SelectPythonFileInExplorer.py
Created August 28, 2012 04:43
Select current python file in explorer
# Select current python file in explorer
import os, sys, subprocess, inspect
subprocess.Popen(r'explorer /select,%s' % os.path.abspath(inspect.getfile(inspect.currentframe())))
## or...
pFileName = os.path.abspath(inspect.getfile(inspect.currentframe()))
pFileDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
print 'pFileName = %s\n' % pFileName
@OmniZ3D
OmniZ3D / changeMoBuTxtrs.py
Created August 24, 2012 20:12
Example for changing / repathing texture files in MotionBuilder via python
from pyfbsdk import *
for v in FBSystem().Scene.VideoClips:
print v.Filename
v.Filename = r'C:\someDir\txtrFile.tga'
@OmniZ3D
OmniZ3D / transferKeys.py
Created January 22, 2012 11:37
MoBu: Copy keys to FBModel
from pyfbsdk import *
mySource = FBFindModelByName("cube_source")
myDestination = FBFindModelByName("cube_destination")
print mySource.Name,myDestination.Name
myDestination.Translation.GetAnimationNode().Nodes[0].FCurve = mySource.Translation.GetAnimationNode().Nodes[0].FCurve
myDestination.Translation.GetAnimationNode().Nodes[1].FCurve = mySource.Translation.GetAnimationNode().Nodes[1].FCurve
myDestination.Translation.GetAnimationNode().Nodes[2].FCurve = mySource.Translation.GetAnimationNode().Nodes[2].FCurve