def AdjustmentBlendCharacter(character = None): if not character: character = FBApplication().CurrentCharacter if character: take = FBSystem().CurrentTake if take.GetLayerCount() > 1: characterObjs = GetCharacterEffectorsAndExtensions(character) for obj in characterObjs: if obj: AdjustmentBlendObject(obj) else: FBMessageBox("Error...", "No additive layer found. Adjustment blending affects interpolation between keys on the the top most additive layer.", "OK") else: FBMessageBox("Error...", "No additive layer found. Adjustment blending affects interpolation between keys on the top most additive layer.", "OK")
def _emit_log_message(self, handler, record): """ Called by the engine to log messages in Mobu script editor. All log messages from the toolkit logging namespace will be passed to this method. :param handler: Log handler that this message was dispatched from. Its default format is "[levelname basename] message". :type handler: :class:`~python.logging.LogHandler` :param record: Standard python logging record. :type record: :class:`~python.logging.LogRecord` """ # Give a standard format to the message: # Shotgun <basename>: <message> # where "basename" is the leaf part of the logging record name, # for example "tk-multi-shotgunpanel" or "qt_importer". if record.levelno < logging.INFO: formatter = logging.Formatter("Debug: Shotgun %(basename)s: %(message)s") else: formatter = logging.Formatter("Shotgun %(basename)s: %(message)s") msg = formatter.format(record) if record.levelno < logging.ERROR: print msg else: # for errors, pop up a modal msgbox FBMessageBox("Shotgun Error", str(msg), "OK")
def bootstrap_tank(): try: import tank except Exception, e: FBMessageBox("Shotgun: Error", "Could not import sgtk! Disabling for now: %s" % e, "Ok") return
def OnMenuClick(eventName): if eventName == "Start Mobu Server": startMotionbuilderServer() elif eventName == "Send To Maya": showSendToMayaUI() else: FBMessageBox("Error...", "Menu Error: This option hasn't been set up yet.", "OK")
def __show_tank_disabled_message(details): """ Message when user clicks the shotgun is disabled menu """ msg = ("Shotgun integration is currently disabled because the file you " "have opened is not recognized - Shotgun cannot " "determine which Context the currently open file belongs to. " "In order to enable the Shotgun functionality, try opening another " "file. <br><br><i>Details:</i> %s" % details) FBMessageBox("Shotgun Error", msg, "OK")
def bootstrap_tank(): try: import tank except Exception as e: FBMessageBox("Shotgun: Error", "Could not import sgtk! Disabling for now: %s" % e, "Ok") return if not "TANK_ENGINE" in os.environ: FBMessageBox("Shotgun: Error", "Missing required environment variable TANK_ENGINE.", "Ok") return engine_name = os.environ.get("TANK_ENGINE") try: context = tank.context.deserialize(os.environ.get("TANK_CONTEXT")) except Exception as e: FBMessageBox( "Shotgun: Error", "Could not create context! Shotgun Pipeline Toolkit will be disabled. Details: %s" % e, "Ok", ) return try: engine = tank.platform.start_engine(engine_name, context.tank, context) except Exception as e: FBMessageBox("Shotgun: Error", "Could not start engine: %s" % e, "Ok") return # if a file was specified, load it now file_to_open = os.environ.get("TANK_FILE_TO_OPEN") if file_to_open: FBApplication.FileOpen(file_to_open) # clean up temp env vars for var in ["TANK_ENGINE", "TANK_CONTEXT", "TANK_FILE_TO_OPEN"]: if var in os.environ: del os.environ[var]
def OnMenuClick(eventName): if eventName == "Adjustment Blend": AdjustmentBlendCharacter() elif eventName == "Center Selected Story Clips": CenterSelectedClips() elif eventName == "Copy Selected Story Clips To Tracks": CopySelectedStoryClipsToTracks() elif eventName == "Copy Selected Story Clips To Takes": CopySelectedStoryClipsToTakes(False) elif eventName == "Copy Selected Story Clips To Takes - Centered": CopySelectedStoryClipsToTakes() else: FBMessageBox("Error...", "Menu Error: This option hasn't been set up yet.", "OK")
def loadBVH(): lFp = FBFilePopup() lFp.Caption = "Select a BVH File to be Retargeted" lFp.Style = FBFilePopupStyle.kFBFilePopupOpen lFp.Filter = "*" # Set the default path. lFp.Path = r"C:\Users" # Get the GUI to show. lRes = lFp.Execute() # If we select files, show them, otherwise indicate that the selection was canceled if lRes: return lFp.Path + "/" + lFp.FileName else: FBMessageBox("Invalid selection", "Selection canceled", "OK", None, None)
def fbxPopup(): from pyfbsdk import FBFilePopup, FBFilePopupStyle, FBMessageBox lFp2 = FBFilePopup() fbxName = None lFp2.Caption = "Select an FBX File for the Retargeting" lFp2.Style = FBFilePopupStyle.kFBFilePopupOpen lFp2.Filter = "*" # Set the default path. lFp2.Path = GetMotionBuilderInstallationDirectory()+"Tutorials" # Get the GUI to show. lRes = lFp2.Execute() # If we select files, show them, otherwise indicate that the selection was canceled if lRes: fbxName = lFp2.Path + "/" + lFp2.FileName else: FBMessageBox( "Invalid selection", "Selection canceled", "OK", None, None ) # Cleanup. del( lFp2, lRes, FBFilePopup, FBFilePopupStyle, FBMessageBox ) return fbxName
def log_error(self, msg): FBMessageBox("Shotgun Error", str(msg), "OK")
lRotation[0] = -lRotation[0] lRotation[1] = -lRotation[1] lRotation[2] = -lRotation[2] #Setting the values for the corresponding opposite link dstList[i][0].SetVector(lRotation, FBModelTransformationType.kModelRotation, True) ## Calling the functions ## #The current character is the one used lChar = FBApplication().CurrentCharacter if not lChar: FBMessageBox("Warning", "No character is currently selected.", "Ok") print "Script terminated. No character selected." if lChar: if lChar.GetCharacterize(): FBMessageBox( "Warning", "Characterization is already locked.\n Changes will likely be lost.", "Ok") # User input lDirection = FBMessageBox("Mirror Characterization - Select Direction", "(Hips must be facing +Z axis)", "Left to Right", "Right to Left", "Cancel") if lDirection < 3:
m = float(dist / 100) return abs(float(m / sec)) # Grab a reference to the Scene scene = FBSystem().Scene # Create a list and populate it with the selected objects models = FBModelList() FBGetSelectedModels(models) # Check if any objects are selected if len(models) == 0: FBMessageBox("Model Selection Error:", "No selected models found\n Select a model and try again!", "Ok") else: key_list = [] # Get access to the X,Y,Z translation node keys for model in models: translationNode = model.Translation.GetAnimationNode() if has_keys_check(translationNode): for animNode in translationNode.Nodes: key_list.append(animNode) # Get the chosen move axis direction key list move_axis_keys = find_move_axis(key_list) # Get distance and frames and pump out the result
from pyfbsdk import FBMessageBox, FBApplication def bootstrap_tank(): try: import tank except Exception, e: FBMessageBox("Shotgun: Error", "Could not import sgtk! Disabling for now: %s" % e, "Ok") return if not "TANK_ENGINE" in os.environ: FBMessageBox("Shotgun: Error", "Missing required environment variable TANK_ENGINE.", "Ok") return engine_name = os.environ.get("TANK_ENGINE") try: context = tank.context.deserialize(os.environ.get("TANK_CONTEXT")) except Exception, e: FBMessageBox( "Shotgun: Error", "Could not create context! Shotgun Pipeline Toolkit will be disabled. Details: %s" % e, "Ok") return try: engine = tank.platform.start_engine(engine_name, context.tank, context)
def menu_event(control, event): FBMessageBox("Shotgun Error", message, "OK")
Created: Apr 15, 2012 Module: startup.pcsGlobalSetup Purpose: Adds paths to Mobu env ''' import os import sys import xml.etree.ElementTree as ET #@UnresolvedImport import inspect #@UnresolvedImport from pyfbsdk import FBMessageBox, FBSystem #@UnresolvedImport # assumes system/user PYTHONPATH contains path to ./PipelineConstructionSet/python try: import common.core.globalVariables as gv except: FBMessageBox( "PYTHONPATH setup", "Please add system variable PYTHONPATH to\nlocation of ./PipelineConstructionSet/python", "OK", None, None, 1) _MAINTENANCE = False # find app version version = None appPath = FBSystem().ApplicationPath if len(appPath) > 2: appName = appPath.split('\\')[3] if len(appName) > 0: version = int(appName.split(' ')[1]) if not version: FBMessageBox("Version failure", "Failed to find MoBu version.\n\nSkipping ArtMonkey boot.", "OK", None, None, 1, False)