def SendSelectedToStory(): lfoldername = fb.FBSystem().CurrentTake.Name lFolder = fb.FBStoryFolder() lFolder.Label = lfoldername ## Character Track lCharTrack = fb.FBStoryTrack(fb.FBStoryTrackType.kFBStoryTrackCharacter, lFolder) # Assign our CurrentCharacter to the track lCharTrack.Details.append(fb.FBApplication().CurrentCharacter) # Set Character Track name to Current Character Name lCharTrack.Label = fb.FBApplication().CurrentCharacter.LongName # Insert current take in the newly created track lCharTrack.CopyTakeIntoTrack(fb.FBSystem().CurrentTake.LocalTimeSpan, fb.FBSystem().CurrentTake)
def get_scene_name_and_path(): """ Returns the name and path of the current open 3ds Max scene :return: str """ return pyfbsdk.FBApplication().FBXFileName
def plotSelectedDecision(pPlotWhere): # Defining our Characater as the currnetly selected one lCharacter = fb.FBApplication().CurrentCharacter # Defining the Plot option that will be used PlotCtrlRigTakeOptions = fb.FBPlotOptions() # To use Constant Key Reduction on the plot (True or False) PlotCtrlRigTakeOptions.ConstantKeyReducerKeepOneKey = False # To go through all takes in the scene and plot the data (True or False) PlotCtrlRigTakeOptions.PlotAllTakes = False # Do you wish to plot onto frames (True or False) PlotCtrlRigTakeOptions.PlotOnFrame = True # Set the plot period PlotCtrlRigTakeOptions.PlotPeriod = fb.FBTime(0, 0, 0, 1) PlotCtrlRigTakeOptions.PlotTranslationOnRootOnly = False PlotCtrlRigTakeOptions.PreciseTimeDiscontinuities = False # What filter to use on the plot (Unroll, GimabalKill or None) PlotCtrlRigTakeOptions.RotationFilterToApply = fb.FBRotationFilter.kFBRotationFilterUnroll # Use Constant Kye Reduction (True or False) PlotCtrlRigTakeOptions.UseConstantKeyReducer = False if pPlotWhere == "skeleton": lCharacter.PlotAnimation( fb.FBCharacterPlotWhere.kFBCharacterPlotOnControlRig, PlotCtrlRigTakeOptions) elif pPlotWhere == "ctrlrig": lCharacter.PlotAnimation( fb.FBCharacterPlotWhere.kFBCharacterPlotOnSkeleton, PlotCtrlRigTakeOptions)
def get_scene_name(): """ Returns the name of the current open 3ds Max scene :return: str """ path_drive, path_tail = os.path.split( pyfbsdk.FBApplication().FBXFileName()) return path_tail.split('.')[0]
def _saveBuffer(savePath, tmpImgExtension="tif"): app = fb.FBApplication() take = fb.FBSystem().CurrentTake current = fb.FBTime(fb.FBPlayerControl().GetEditCurrentTime()) next = fb.FBTime(fb.FBPlayerControl().GetEditCurrentTime() + 1) opts = fb.FBVideoGrabber().GetOptions() videoManager = fb.FBVideoCodecManager() videoManager.VideoCodecMode = fb.FBVideoCodecMode.FBVideoCodecUncompressed opts.OutputFileName = savePath opts.RenderAudio = False opts.BitsPerPixel = fb.FBVideoRenderDepth.FBVideoRender32Bits opts.TimeSpan = fb.FBTimeSpan(current, next) opts.TimeStep = fb.FBTime(0, 0, 0, 1, 0) app.FileRender( opts )
def __init__(self, **kwargs): super(MotionBuilder, self).__init__(**kwargs) self.app = pyfbsdk.FBApplication()
except ImportError: from functools import wraps class ContextDecorator(object): """contextlib.ContextDecorator backport.""" def __call__(self, func): @wraps(func) def decorated(*args, **kwargs): with self: return func(*args, **kwargs) return decorated # ------------------------------------------------------------------------------ lapp = pyfbsdk.FBApplication() lsys = pyfbsdk.FBSystem() lplayer = pyfbsdk.FBPlayerControl() lundo = pyfbsdk.FBUndoManager() # ------------------------------------------------------------------------------ class SuspendRefresh(ContextDecorator): def __enter__(self): pyfbsdk.FBBeginChangeAllModels() def __exit__(self, exc_type, exc_val, exc_tb): pyfbsdk.FBEndChangeAllModels() return False
import sys import os import pyfbsdk as fb import pyfbsdk_additions as fba from pyfbsdk import FBMessageBox import re import random as rand from functools import partial from time import gmtime, strftime from PySide import QtCore, QtGui, QtUiTools from PySide.QtCore import Signal mobuApp = fb.FBApplication() mobuSys = fb.FBSystem() mobuGrp = fb.FBSystem().Scene.Groups mobuMat = fb.FBSystem().Scene.Materials colorMat = [] def clearSelection(): for i in fb.FBSystem().Scene.Components: i.Selected = False def clearMaterialSelection(): for i in fb.FBSystem().Scene.Materials: i.Selected = False
def __init__(self): self._fbapp = mob.FBApplication() super(MotionBuilderApplication, self).__init__()
def __init__( self ): self._fbapp = mob.FBApplication() AbstractScene.__init__( self )