### MotionBuilder Python: Rendering and Codec Examples Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_move_resize_tool_example_8py-example Provides examples related to rendering, including codec configurations and rendering layers, using the MotionBuilder Python API. This helps in automating render setups. ```Python from pyfbsdk import * # Examples for rendering and codec configurations. # Accessing render settings: # render = FBRender() # render.FrameStart = 1 # render.FrameEnd = 100 # Codec examples might involve setting up FBVideoCompressor objects for export. # Example: # videoCompressor = FBVideoCompressor() # videoCompressor.Format = "H264" # Example codec # videoCompressor.Quality = 80 # Render layers might involve FBScene's render layer management functions. print("Rendering and codec examples.") ``` -------------------------------- ### Rendering and Scene Setup in MotionBuilder Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_basic_operations_0c_f_b_folder_8py-example Contains Python scripts related to rendering, codec examples, and render layers. These examples assist in automating render passes, configuring render settings, and managing scene elements for final output. ```python from pyfbsdk import * # Example: Codec Examples # Refer to Rendering/codecExamples.py for detailed implementation. # Example: Basic Rendering Setup # Refer to Rendering/render.py for detailed implementation. # Example: Render Layers Management # Refer to Rendering/RenderLayers.py for detailed implementation. ``` -------------------------------- ### Character Rigging and Setup in MotionBuilder Python API Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_tasks_0c_re_prefix_all_markers_8py-example This snippet provides examples for character rigging and setup using the MotionBuilder Python API (pyfbsdk). It covers tasks like character marker set creation, loading, saving, and mapping. These scripts are crucial for character animation workflows. ```python from pyfbsdk import * # Example: Creating a Character Marker Set marker_set = FBCharacterMarkerSet("MyMarkerSet") # Example: Saving a Character Marker Set marker_set.Save("path/to/markers.mkr") # Example: Loading a Character Marker Set loaded_marker_set = FBCharacterMarkerSet("LoadedSet") loaded_marker_set.Load("path/to/markers.mkr") # Example: Saving/Loading Character Marker Set Mapping # This implies mapping markers to specific character bones or controls. # FBCharacter().SaveMarkerSetMapping(marker_set, "path/to/mapping.map") # FBCharacter().LoadMarkerSetMapping(marker_set, "path/to/mapping.map") # Example: Creating Character Marker Set from Actor actor = FBCharacter("MyActor") new_marker_set = FBCharacterMarkerSet.CreateFromActor(actor, "ActorMarkerSet") ``` -------------------------------- ### Character Examples in MotionBuilder Python API Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_tutorial_box_8py-example This snippet includes Python scripts for character rigging and setup in MotionBuilder. Examples cover creating character marker sets, initializing them from actors, and saving/loading marker set mappings. ```python from pyfbsdk import * # Example: Creating a character marker set # markerSet = FBCharacterMarkerSet("MyMarkerSet") # FBSystem().Scene.Add(markerSet) # Example: Creating a character marker set from an actor # actor = FBCharacter("MyActor") # markerSetFromActor = FBCharacterMarkerSet.CharacterMarkerSetFromActor(actor, "MarkerSetFromActor") # Example: Saving and loading character marker set mapping # FBCharacterMarkerSet.SaveCharacterMarkerSetMapping(markerSet, "mapping.xml") # loadedMarkerSet = FBCharacterMarkerSet.LoadCharacterMarkerSetMapping("mapping.xml") ``` -------------------------------- ### Character Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_complex_tools_0c_shot_track_setup_tool_8py-example This snippet focuses on character-related scripting in MotionBuilder using the pyfbsdk. It includes examples for character marker sets, creating them from actors, and saving/loading marker set mappings. These are crucial for rigging and character setup workflows. ```python from pyfbsdk import * # Example: Character Marker Set characterMarkerSet = FBCharacterMarkerSet() characterMarkerSet.Name = "MyCharacterMarkers" # Example: Character Marker Set from Actor actor = FBFindObjectByName("MyActor") # Replace "MyActor" with an actual actor name if actor: characterMarkerSet.CreateFromActor(actor) # Example: Save/Load Character Marker Set Mapping characterMarkerSet.SaveTo("markers.xml") newMarkerSet = FBCharacterMarkerSet() newMarkerSet.LoadFrom("markers.xml") ``` -------------------------------- ### Rendering and Codec Examples in MotionBuilder Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_f_b_plot_popup_8py-example Covers Python scripts related to rendering in MotionBuilder, including codec examples, basic rendering setup, and render layer management using the pyfbsdk. ```python from pyfbsdk import * # Example for setting up rendering # FBPlayerControl().Record() # Example to start recording # Example for render layers # render_layer = FBRenderLayer("MyRenderLayer") # Codec examples would involve specific FBVideoCodec objects ``` -------------------------------- ### MotionBuilder Python API: Rendering Examples Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_slider_8py-example This snippet contains Python scripts for handling rendering-related tasks in MotionBuilder. It covers codec examples, basic rendering setups, and render layer configurations. These examples are useful for automating render passes and managing render settings. ```Python from pyfbsdk import * # Example: Codec Examples # This demonstrates how to interact with video codecs for rendering or import/export. # Specific codec names and their properties would be used here. # Assuming 'my_render_options' is an FBVideo and has codec settings # codec_name = "H.264" # supported_codecs = FBVideo.GetAvailableCodecs() # if codec_name in supported_codecs: # my_render_options.Codec = codec_name # print(f"Set codec to: {codec_name}") # else: # print(f"Codec '{codec_name}' not found.") # Example: Basic Render Setup # This script illustrates setting up basic rendering parameters like resolution and frame range. # Get the render object # render = FBGetRender() # if render: # render.ResolutionX = 1920 # render.ResolutionY = 1080 # render.FrameStart = 0 # render.FrameEnd = 100 # print("Basic render settings configured.") # else: # print("Could not get render object.") # Example: Render Layers # This demonstrates how to work with render layers, which allow for different render passes. # To create or access render layers, you would typically interact with the scene or rendering system. # For example, to add a render layer: # render_layer = FBRenderLayer("MyRenderLayer") # FBScene.FBXRoot.RenderLayers.append(render_layer) # print(f"Created render layer: {render_layer.Name}") ``` -------------------------------- ### Rendering Examples in MotionBuilder using Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_f_b_property_connection_editor_8_p_y-example Demonstrates Python scripting for rendering functionalities in MotionBuilder, including codec examples, basic rendering setup, and handling render layers. These scripts utilize the pyfbsdk library. ```Python from pyfbsdk import * # Example: codecExamples.py def codecExamplesExample(): pass # Placeholder for actual code # Example: render.py def renderExample(): pass # Placeholder for actual code # Example: RenderLayers.py def RenderLayersExample(): pass # Placeholder for actual code ``` -------------------------------- ### Rendering and Codec Examples with pyfbsdk in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_basic_operations_0c_f_b_system_events_8py-example This snippet provides examples related to rendering and codec handling within MotionBuilder using the pyfbsdk library. It includes scripts for codec examples, basic rendering setup, and rendering layers. These are essential for controlling the output and visual aspects of rendered scenes. ```python import pyfbsdk # Example: codecExamples.py # Demonstrates various codec functionalities. # Specific functions would depend on the exact implementation within the file. # Example: render.py # Basic rendering setup and execution. # FBPlayerControl().RenderToFile("output.avi", 1, 100) # Example: RenderLayers.py # Manages and configures render layers for scene output. # FBScene.RenderLayers.Add("MyLayer") # FBScene.RenderLayers.Get("MyLayer").Enabled = True ``` -------------------------------- ### Rendering and Codec Examples with pyfbsdk Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_basic_operations_0c_find_properties_with_wildcard_8py-example This snippet focuses on rendering functionalities and codec-related examples within MotionBuilder using the pyfbsdk. It includes scripts for basic rendering setup and potentially interacting with different codecs, essential for managing output and rendering pipelines. ```python from pyfbsdk import * # Example: Basic Rendering (Conceptual - requires render settings) # FBSystem().Renderer.RenderToFile("output.jpg") # Example: Codec Examples (Conceptual - typically involves FBVideoCompressor or similar) # This would involve setting up compression options for video output. ``` -------------------------------- ### Python: Basic Object Creation and Manipulation Examples Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_samples_0c_referencing_0c_m_b_file_ref_demo_0c_namespace_tree_model_8py-example Demonstrates fundamental Python scripting for creating and manipulating objects within MotionBuilder. These examples cover common tasks such as object creation, property manipulation, and basic scene management. They serve as a starting point for automating workflows and developing custom tools. ```python import pyfbsdk # Example: Creating a new cube newCube = pyfbsdk.FBModelCube("MyCube") # Example: Accessing and modifying a property newCube.Size = 100 # Example: Finding an object by name obj = pyfbsdk.FBFindObjectByName("MyCube") # Example: Deleting an object # pyfbsdk.FBDeleteObject(obj) ``` ```python # Example: Creating a camera newCamera = pyfbsdk.FBCamera("MyCamera") # Example: Setting camera attributes newCamera.NearPlane = 10.0 newCamera.FarPlane = 10000.0 # Example: Adding a camera to the scene # newCamera.AddToScene() ``` ```python # Example: Working with constraints # Create two models modelA = pyfbsdk.FBModelNULL("ModelA") modelB = pyfbsdk.FBModelNULL("ModelB") # Create a constraint relation constraintRelation = pyfbsdk.CreateAndPopulateAConstraintRelation(modelA, modelB, pyfbsdk.FBConstraint.kFBConstraintParent) # Example: Deleting a constraint relation # pyfbsdk.FBDeleteConstraintRelation(constraintRelation) ``` -------------------------------- ### Python - Complex Tools Examples Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_tasks_0c_set_all_cameras_background_color_from_first_selected_camera_8py-example Includes examples for utilizing and scripting complex tools within MotionBuilder, such as Action Script Manager, Audio Track Setup Tool, Blend Shape Editor, and Shot Track Setup Tool. ```Python from pyfbsdk import * # Example: Interacting with Action Script Manager # FBActionScriptMgr() # Example: Setting up audio tracks # FBAudioTrack() # Example: Using the Blend Shape Editor # FBBlendShape() # Example: Setting up shot tracks # FBShotTrack() print("Complex tools examples.") ``` -------------------------------- ### Python: Complex Tools Examples in MotionBuilder Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_tasks_0c_h_u_d_8py-example This snippet demonstrates the usage of complex tools and managers within the MotionBuilder Python SDK. It includes examples for Action Scripting, Audio Track Setup, Blend Shape Editors, and Shot Track setup, facilitating advanced animation and rigging workflows. ```python from pyfbsdk import * # Example: Action Script Manager # action_script_mgr = FBActionScriptMgr() # Example: Audio Track Setup Tool # audio_tool = FBAudioTrackSetupTool() # Example: Blend Shape Editor # blendshape_editor = FBBlendShape_Editor() # Example: Shot Track Setup Tool # shot_tool = FBShotTrackSetupTool() ``` -------------------------------- ### Complex Tools and Scripting Examples with pyfbsdk Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_basic_operations_0c_custom_property_8py-example This snippet covers more complex tools and scripting examples within MotionBuilder using the pyfbsdk. It includes examples for ActionScript managers, audio track setup, blend shape editors, and shot track setup tools. These are advanced functionalities for sophisticated animation workflows. ```python from pyfbsdk import * # Example: ActionScript Manager # This would likely manage scripting for ActionScript related features. # FB...ActionScriptMgr.py likely contains functions for this. print("ActionScript Manager example setup.") # Example: Audio Track Setup Tool # This would involve tools for setting up and manipulating audio tracks. # FB...AudioTrackSetupTool.py likely contains functions for this. print("Audio Track Setup Tool example setup.") # Example: Blend Shape Editor # This would relate to tools for creating and editing blend shapes. # FB...BlendShape_Editor.py likely contains functions for this. print("Blend Shape Editor example setup.") # Example: Shot Track Setup Tool # This would involve tools for managing and setting up shot tracks. # FB...ShotTrackSetupTool.py likely contains functions for this. print("Shot Track Setup Tool example setup.") ``` -------------------------------- ### Rendering Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_complex_tools_0c_shot_track_setup_tool_8py-example This snippet focuses on rendering functionalities within MotionBuilder using the pyfbsdk. It includes examples for codec usage, basic rendering setup, and render layer management. These scripts are helpful for automating render processes and configuring render settings. ```python from pyfbsdk import * # Example: Codec examples codecList = FBCodec.GetCodecs() for codec in codecList: print(f"Available codec: {codec.Name}") # Example: Basic rendering render = FBRender() render.RenderToFile("output.jpg") # Example: Render Layers renderLayer = FBRenderLayer() renderLayer.Name = "MyRenderLayer" renderLayer.RenderElement = FBRenderElement.eRenderElementColor FBProject.Scene.Render.RenderLayers.Add(renderLayer) ``` -------------------------------- ### Basic Object Creation and Manipulation in MotionBuilder Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_complex_tools_0c_audio_track_setup_tool_8py-example Demonstrates fundamental operations like creating objects (e.g., Cube), managing groups, handling namespaces, and setting custom properties using the pyfbsdk. This is useful for automating scene setup and modification. ```python from pyfbsdk import * # Create a new cube object cube = FBModelCube("MyCube") # Add the cube to the scene # FBScene.AddObject(cube) # Uncomment to add to scene # Create a new group myGroup = FBGroup("MyGroup") # FBScene.AddGroup(myGroup) # Uncomment to add to scene # Add the cube to the group # myGroup.AddMember(cube) # Uncomment to add to group # Create a custom property customProp = FBProperty("MyCustomProp") # cube.Properties.Add(customProp) # Uncomment to add to cube # Example of working with namespaces (assuming a namespace 'ns' exists) # FBScene.RemoveNamespace("ns") # FBScene.ImportWithNamespace("path/to/file.fbx", "ns") # Find objects with a wildcard # models = FBGetSelectedModels("Cube*", True) # Finds all selected objects starting with "Cube" ``` -------------------------------- ### Python Examples for Rendering in MotionBuilder Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_tasks_0c_plot_selected_char_story_tracks_8py-example This snippet provides Python examples for rendering functionalities in MotionBuilder. It covers codec examples, basic rendering setup, and render layer configuration using the pyfbsdk. ```Python from pyfbsdk import * # Example: Codec Examples (Conceptual) # codec = FBRenderer().GetCodecByName("H.264") # Example: Basic Render Setup # renderer = FBRenderer() # renderer.Camera = FBVideo # renderer.OutputDirectory = "C:/RenderOutput" # renderer.Render(FBTime.Zero, FBTime.Get(1000)) # Example: Render Layers # renderLayer = FBRenderLayer() # renderLayer.Name = "MyRenderLayer" # FBSystem().Scene.Add(renderLayer) ``` -------------------------------- ### Python Examples for MotionBuilder API - Complex Tools Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/examples This snippet includes Python examples for more complex tools and functionalities within MotionBuilder. It covers scripts for ActionScript Manager, Audio Track Setup, Blend Shape Editor, and Shot Track Setup. These are advanced tools for specialized animation and rigging tasks. ```python from pyfbsdk import * # Example: ComplexTools\ActionScriptMgr.py # Manages ActionScript functionalities within MotionBuilder. # Example: ComplexTools\AudioTrackSetupTool.py # A tool for setting up and configuring audio tracks. # Example: ComplexTools\BlendShape_Editor.py # Provides tools for editing blend shapes. # Blend shapes are used for facial animation and deformation. # Example: ComplexTools\ShotTrackSetupTool.py # A tool for setting up and managing shot tracks in the Story. ``` -------------------------------- ### Working with Audio and Video in MotionBuilder Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_complex_tools_0c_audio_track_setup_tool_8py-example Includes examples for audio rendering and video input/output operations. This is relevant for projects involving audio-visual synchronization and media handling. ```python from pyfbsdk import * # Example for Audio Rendering # FBSystem.Audio.Render("output.wav") # Example for Video Input # videoInput = FBVideoInput("MyVideoInput") # FBSystem.VideoInputManager.Add(videoInput) # Example for Video Output # videoOutput = FBVideoOutput("MyVideoOutput") # FBSystem.VideoOutputManager.Add(videoOutput) # Example for Video Memory # videoMemory = FBVideoMemory() # videoMemory.SetSize(width, height) ``` -------------------------------- ### Character and Constraint Management in MotionBuilder Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_basic_operations_0c_namespace_operations_on_track_8py-example Features Python examples for character setup and constraint management in MotionBuilder. This includes creating character extensions, assigning rigid bodies, and creating constraint relations, which are fundamental for character rigging and setup. ```python from pyfbsdk import * # Example: Create a character extension on a selected object # selected_obj = FBGetSelectedOne(FBModel) # if selected_obj: # char_extension = FBCharacterExtension(selected_obj.Name + "_CharExt") # char_extension.Create(selected_obj) # Example: Assign a rigid body # rigid_body = FBRigidBody() # rigid_body.mName = "MyRigidBody" # rigid_body.mActive = True # rigid_body.Create() ``` -------------------------------- ### Rendering and Codec Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_edit_8py-example Contains Python scripts related to rendering in MotionBuilder, including examples for codec usage, basic rendering operations, and render layers. These scripts help automate rendering tasks and manage render output. They utilize the pyfbsdk. ```Python from pyfbsdk import * # Example: Codec Examples # FBVideoCodec.Find('H.264') # Example: Basic Rendering # FBVideo.RenderFrame(1, 100) # Example: Render Layers # render_layer = FBRenderLayer('MyRenderLayer') ``` -------------------------------- ### Advanced Tools: Python Scripting Examples for Complex Tasks in MotionBuilder Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_basic_operations_0c_get_user_value_8py-example This snippet demonstrates Python scripting for more complex tools and functionalities within MotionBuilder. It includes examples related to action script management, audio track setup, blend shapes, and shot track setup, enabling advanced automation workflows. ```python from pyfbsdk import * # Example: Action Script Manager (conceptual) # actionMgr = FBActionMgr() # actionMgr.ExecuteAction("MyCustomAction") # Example: Setting up an Audio Track audioTrack = FBAudioTrack() audioTrack.Name = "MyAudioTrack" FBSystem.Scene.Add(audioTrack) # Example: Blend Shape Editor (conceptual) # blendShapeEditor = FBBlendShapeEditor() # blendShapeEditor.LoadBlendShape("MyBlendShape") # Example: Shot Track Setup (conceptual) # shotMgr = FBShotMgr() # shotMgr.CreateNewShot("MyShot") ``` -------------------------------- ### Rendering Examples in MotionBuilder Python API Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_tasks_0c_re_prefix_all_markers_8py-example This snippet provides examples for rendering functionalities in MotionBuilder using the pyfbsdk. It covers codec examples, basic rendering setup, and render layers. These scripts are essential for producing final output from the software. ```python from pyfbsdk import * # Example: Codec Examples # Demonstrating the use of different video codecs for rendering. # FBPlayerControl().RenderToFile("output.mp4", FBVideoCodec.kH264) # Hypothetical # Example: Render # Basic rendering commands. # FBPlayerControl().RenderToFile("render.jpg") # Example: Render Layers # Managing and rendering specific layers. # render_layer = FBRenderLayer("MyLayer") # render_layer.Render(FBPlayerControl()) ``` -------------------------------- ### MotionBuilder Character and Rigging Scripting Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_samples_0c_referencing_0c_m_b_file_ref_demo_0c_referencing_sample_u_i2_8py-example This Python script snippet provides examples related to character setup and rigging in MotionBuilder. It covers tasks such as assigning rigid bodies, creating character extensions, and manipulating character stances using the pyfbsdk. ```python from pyfbsdk import * # Example: Assign Rigid Body model = FBFindObjectByName("MyModel") if model: rigidBody = FBRigidBody() rigidBody.Link = model rigidBody.Mass = 10.0 FBScene.TheOne.AddObject(rigidBody) # Example: Create Character Extension character = FBFindObjectByName("MyCharacter") if character: charExtension = FBCharacterExtension() charExtension.Name = "MyExtension" character.AddExtension(charExtension) # Example: Current Character Go to Stance Pose # Assuming 'character' is a valid FBCharacter object # character.GoToStancePose() # Example: Enable Game Mode on Selected Characters selected_models = FBModelList() FBModelSelection.GetSelectedModels(selected_models) for model in selected_models: if isinstance(model, FBCharacter): model.Game = True ``` -------------------------------- ### Python: Complex Tools and Editors Examples Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_samples_0c_referencing_0c_m_b_file_ref_demo_0c_namespace_tree_model_8py-example This group of Python scripts showcases examples of complex tools and editors available in MotionBuilder. These include Action Script Manager, Audio Track Setup Tool, Blend Shape Editor, and Shot Track Setup Tool. These scripts are for advanced users developing sophisticated animation workflows. ```python import pyfbsdk # Example: Action Script Manager # actionMgr = pyfbsdk.ActionScriptMgr() # actionMgr.Setup(...) # Example: Audio Track Setup Tool # audioTool = pyfbsdk.AudioTrackSetupTool() # audioTool.Setup(...) # Example: Blend Shape Editor # blendShapeEditor = pyfbsdk.BlendShape_Editor() # blendShapeEditor.Setup(...) # Example: Shot Track Setup Tool # shotTool = pyfbsdk.ShotTrackSetupTool() # shotTool.Setup(...) ``` -------------------------------- ### Rendering and Scene Setup in MotionBuilder Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_tasks_0c_delete_hierarchy_8py-example Provides examples for controlling rendering settings, managing render layers, and interacting with codecs. These scripts are useful for automating render farm submissions or customizing render outputs. ```python from pyfbsdk import * # Example: Basic render setup (simplified) # FBApplication().mApp.CurrentCamera = FBGetCamera("MyCamera") # FBApplication().mApp.StartLocalRendering() # Example: Render Layers (conceptual) # Accessing and manipulating render layer properties would involve specific classes. ``` -------------------------------- ### Python Examples for MotionBuilder API - Rendering Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/examples This snippet showcases Python examples for rendering-related tasks in MotionBuilder. It includes scripts for codec examples, general rendering setup, and render layers. These are valuable for automating render farm submissions and managing render outputs. ```python from pyfbsdk import * # Example: Rendering\codecExamples.py # Demonstrates using different codecs for rendering (conceptual). # This would involve setting up render options with specific codecs. # Example: Rendering\render.py # A basic script to initiate a render. # FBApplication().RenderToFile("render_output.png") # Example: Rendering\RenderLayers.py # Demonstrates how to work with render layers. # This typically involves iterating through render layers and configuring them. # render_manager = FBRenderManager() # for layer in render_manager.RenderLayers: # layer.Render = True # layer.FileName = f"render_layer_{layer.Name}.png" ``` -------------------------------- ### Referencing and File Monitoring Demo with Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_box_custom_params_8py-example A comprehensive example demonstrating various aspects of referencing, including file monitoring, dialogs for swapping files, and UI elements for namespace management. This script is a UI-driven demonstration of referencing capabilities. ```python from pyfbsdk import * # This script likely launches a UI and demonstrates referencing features. # Full code would be extensive and involve UI elements. print("Starting Referencing Demo...") ``` -------------------------------- ### Action Scripting Examples in Python for MotionBuilder Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_f_b_menu_8py-example This snippet provides Python examples for ActionScripting within MotionBuilder, focusing on keying body parts, effectors, FK, and IK setups. These scripts leverage the pyfbsdk for animation control. ```python import pyfbsdk # Example: Key a body part # body_part = pyfbsdk.FBBodyPart("RightArm") # body_part.KeyEnable = True # Example: Key an Effector # effector = pyfbsdk.FBEffector("HandEffector") # effector.KeyEnable = True ``` -------------------------------- ### Complex Tools Examples in MotionBuilder Python API Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_tasks_0c_re_prefix_all_markers_8py-example This snippet highlights examples of complex tools and managers within the MotionBuilder Python API (pyfbsdk). It includes Action Script Manager, Audio Track Setup Tool, Blend Shape Editor, and Shot Track Setup Tool. These scripts provide advanced control over specialized animation features. ```python from pyfbsdk import * # Example: Action Script Manager # Interacting with the Action Script Manager for animation scripting. # action_mgr = FBActionScriptMgr() # Example: Audio Track Setup Tool # Tools for configuring and managing audio tracks. # audio_tool = FBAudioTrackSetupTool() # Example: Blend Shape Editor # Accessing and manipulating blend shapes. # blend_shape_editor = FBBlendShapeEditor() # Example: Shot Track Setup Tool # Tools for organizing and managing shot tracks. # shot_tool = FBShotTrackSetupTool() ``` -------------------------------- ### Basic Operations Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_complex_tools_0c_shot_track_setup_tool_8py-example This snippet showcases various basic operations that can be performed using the pyfbsdk in MotionBuilder. It covers tasks such as object creation, property manipulation, file handling, and system event management. These examples are useful for learning fundamental scripting techniques within MotionBuilder. ```python from pyfbsdk import * # Example: Create a new camera newCamera = FBCamera() newCamera.Name = "MyNewCamera" newCamera.Show = True FBProject.Scene.Root.Children.Add(newCamera) # Example: Get selected models selectedModels = FBGetSelectedModels() for model in selectedModels: print(f"Selected model: {model.Name}") # Example: Lock a property objectToLock = FBFindObjectByName("MyObject") # Replace "MyObject" with an actual object name if objectToLock: propertyToLock = objectToLock.PropertyList.Find("MyProperty") # Replace "MyProperty" with an actual property name if propertyToLock: propertyToLock.Lock = True print(f"Property '{propertyToLock.Name}' locked on object '{objectToLock.Name}'.") # Example: Time operations currentTime = FBTime() print(f"Current time: {currentTime.GetFrame()}") currentTime.SetSecond(5) print(f"Time set to 5 seconds: {currentTime.GetSecond()}") # Example: Custom property creation customProp = FBProperty("Integer", "MyCustomInteger") objectWithCustomProp = FBFindObjectByName("MyObject") # Replace "MyObject" with an actual object name if objectWithCustomProp: objectWithCustomProp.Properties.Add(customProp) print(f"Custom property '{customProp.Name}' added to '{objectWithCustomProp.Name}'.") ``` -------------------------------- ### Action Scripting and Complex Tool Examples in MotionBuilder Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_samples_0c_f_curve_0c_copy_animation_8py-example Showcases advanced Python scripting examples for complex tools and action scripting, such as managing action script managers, audio track setup, blend shape editors, and shot track setups. These scripts are for sophisticated animation workflows. ```python from pyfbsdk import * # Example: Action Script Manager # action_mgr = FBActionScriptMgr() # action_mgr.ExecuteActionScript("MyActionScript.py") # Example: Audio Track Setup Tool # audio_setup = FBAudioTrackSetupTool() # audio_setup.Setup() # Example: Blend Shape Editor # blend_shape_editor = FBBlendShapeEditor("MyBlendShape") # blend_shape_editor.Show() # Example: Shot Track Setup Tool # shot_setup = FBShotTrackSetupTool() # shot_setup.Setup() ``` -------------------------------- ### Story Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_complex_tools_0c_shot_track_setup_tool_8py-example This snippet demonstrates working with MotionBuilder's story tools using the pyfbsdk. Examples include managing story folders, changing frame rates for image sequences, and handling video clips. These are essential for scene sequencing and video integration. ```python from pyfbsdk import * # Example: FBStoryFolder storyFolder = FBStoryFolder() storyFolder.Name = "MyStoryFolder" # Example: Image Sequence Frame Rate Change # This would involve accessing an FBImageSequenceClip and modifying its frame rate. # Example: Video Clip videoClip = FBVideoClip() videoClip.Content = "path/to/video.mp4" ``` -------------------------------- ### Material and Texture: Python Scripting Examples in MotionBuilder Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_basic_operations_0c_get_user_value_8py-example This snippet demonstrates Python scripting for materials and textures in MotionBuilder. It includes examples for layered textures, general material/texture operations, and texture animation, enabling advanced material setups. ```python from pyfbsdk import * # Example: Layered Texture (conceptual) # layeredTex = FBLayeredTexture() # Example: Material and Texture operations # material = FBMaterial() # material.Name = "MyMaterial" # texture = FBTexture() # texture.FileName = "path/to/texture.jpg" # material.SetTexture(texture, FBTexture_Diffuse) # Example: Texture Animation (conceptual) # texAnim = FBTextureAnimation() ``` -------------------------------- ### Video Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_complex_tools_0c_shot_track_setup_tool_8py-example This snippet focuses on video input and output functionalities within MotionBuilder using the pyfbsdk. It includes examples for video input, managing video memory, and video output. These are crucial for workflows involving video integration and playback. ```python from pyfbsdk import * # Example: Video Input videoInput = FBVideoInput() # Configure and use video input device. # Example: Video Memory # FBVideoMemory class can be used for managing video memory resources. # Example: Video Output videoOutput = FBVideoOutput() # Configure and use video output device. ``` -------------------------------- ### Camera: Python Scripting Examples for Camera Manipulation in MotionBuilder Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_basic_operations_0c_get_user_value_8py-example This snippet showcases Python code for camera manipulation in MotionBuilder. Examples include camera switching and managing stereo camera display modes, useful for cinematographic setups. ```python from pyfbsdk import * # Example: Camera Switcher (conceptual) # cameraMgr = FBCameraManager() # cameraMgr.SetCurrentCamera("MyCamera") # Example: Stereo Camera Display Mode stereoCam = FBSystem.Scene.GetFirstCamera("StereoCamera") # Assuming a stereo camera exists if stereoCam: stereoCam.StereoDisplayMode = StereoDisplayMode.Off print(f"Stereo display mode for {stereoCam.Name} set to Off.") ``` -------------------------------- ### Referencing and File Monitoring Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_f_curve_editor_8py-example Provides Python scripts demonstrating advanced referencing techniques, including file monitoring, dialogs for swapping reference files, and namespace management. ```python from pyfbsdk import * # FileMonitoring.py: Scripts to monitor changes in referenced files. # MBFileRefDemo\ReferencingSample.py: Core example of referencing workflows. # MBFileRefDemo\DialogSwapRefFile.py: Scripts related to the dialog for swapping reference files. # MBFileRefDemo\NamespaceTableModel.py: Example of managing namespaces in a table model. # MBFileRefDemo\NamespaceTreeModel.py: Example of managing namespaces in a tree model. # MBFileRefDemo\NamespaceUpgradeDialog.py: Scripts for the dialog used to upgrade namespaces. ``` -------------------------------- ### Character Rigging and Setup with Python in MotionBuilder Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_tasks_0c_start_device_8py-example This snippet showcases Python scripting for character rigging and setup in MotionBuilder. It includes examples for assigning rigid bodies, creating character extensions, and managing character stances. These scripts are essential for setting up interactive characters and preparing them for animation or simulation. Dependencies include the pyfbsdk module. ```Python from pyfbsdk import * # Example: Assign Rigid Body # Assuming 'characterRoot' is the root FBComponent of a character # FBAssignRigidBody(characterRoot) # Example: Create Character Extension on Selected Object # Assuming a selected object is an FBModel # FBApplication().CreateCharacterExtension(selectedObject) # Example: Current Character Go To Stance Pose # This requires accessing the character and its associated poses. # Refer to the official documentation for specific functions related to FBCharacter and poses. ``` -------------------------------- ### Rendering and Codec Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_samples_0c_h_u_d_0c_bloop_slate_8py-example Covers Python scripts for rendering tasks and codec examples within MotionBuilder. This includes setting up render layers and potentially interacting with different video codecs for output. ```python from pyfbsdk import * # Example: Render Layers # render_layer = FBRenderLayer("MyRenderLayer") # render_layer.Create() # Example: Basic Render setup (often involves FBSystem.TheSystem.Renderer) # renderer = FBSystem.TheSystem.Renderer # renderer.RenderToFile("path/to/render.png") # Example: Codec Examples (specific codecs would need dedicated classes) # codec_info = FBCodecManager.GetRegisteredCodecs() # for codec in codec_info: # print(codec.Name) ``` -------------------------------- ### Audio Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_complex_tools_0c_shot_track_setup_tool_8py-example This snippet demonstrates audio-related functionalities in MotionBuilder via the pyfbsdk. The primary example involves audio rendering. This is useful for users who need to integrate audio into their animation projects and render it out. ```python from pyfbsdk import * # Example: Audio Rendering audioRendering = FBAudioRendering() audioRendering.RenderToFile("output.wav") ``` -------------------------------- ### Python: Action Scripting Examples Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_samples_0c_referencing_0c_m_b_file_ref_demo_0c_namespace_tree_model_8py-example This set of Python scripts demonstrates the use of ActionScripting within MotionBuilder, focusing on controlling key parts, effectors, FK, and IK chains. These examples are useful for advanced character animation and control setups. ```python import pyfbsdk # Example: Keying a Body Part # pyfbsdk.KeyBodyPart(...) # Example: Keying an Effector # pyfbsdk.KeyEffector(...) # Example: Keying FK (Forward Kinematics) # pyfbsdk.KeyFK(...) # Example: Keying IK (Inverse Kinematics) # pyfbsdk.KeyIK(...) # Example: Keying Selected objects # pyfbsdk.KeySelected(...) ``` -------------------------------- ### Utilities and Debugging in MotionBuilder Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_complex_tools_0c_audio_track_setup_tool_8py-example Includes examples for utility functions such as getting selected models, debugging memory leaks, and setting property options. These are helpful for troubleshooting and optimizing workflows. ```python from pyfbsdk import * # Example for FBGetSelectedModels # selected_models = FBGetSelectedModels("ModelName*", True) # Example for Debugging Memory Leaks # FBUtilities.DebugMemoryLeak() # Example for SetPropertyStaticIfPossibleOption # FBSystem.SetPropertyStaticIfPossibleOption(True) # Example for FBSystemEvents # FBSystem.OnSceneLoad.Add(my_scene_load_handler) # FBSystem.OnSceneLoad.Remove(my_scene_load_handler) ``` -------------------------------- ### Examples Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/class_f_b_property_list_box Code examples demonstrating the usage of the MotionBuilder Python API. ```APIDOC ## Examples This section contains code examples that illustrate how to use various features of the MotionBuilder Python API. ``` -------------------------------- ### Rendering Operations with Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_box_custom_params_8py-example Includes examples for rendering tasks, such as codec examples, rendering specific layers, and general rendering commands. These scripts help automate the rendering pipeline. ```python from pyfbsdk import * # Example of rendering a specific layer renderLayer = FBRenderLayer("MyRenderLayer") renderLayer.Render() # Example of setting render options renderOptions = FBRenderOptions() renderOptions.OutputFileName = "render.jpg" ``` -------------------------------- ### Python: Camera Examples in MotionBuilder Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_tasks_0c_h_u_d_8py-example This snippet showcases camera functionalities within MotionBuilder using the Python SDK. It includes examples for camera switching and managing stereo camera display modes, useful for cinematographic setups and VR/AR content creation. ```python from pyfbsdk import * # Example: Camera Switcher # camera_switcher = FBCameraSwitcher() # camera_switcher.SetCurrentCamera(camera_object) # Example: Stereo Camera Display Mode # FBSystem.GetManager().GetStereoDisplayMode() # FBSystem.GetManager().SetStereoDisplayMode(FB_STEREO_DISPLAY_MODE_SIDEBYSIDE) ``` -------------------------------- ### Referencing Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_complex_tools_0c_shot_track_setup_tool_8py-example This snippet provides comprehensive examples for file referencing in MotionBuilder using the pyfbsdk. It covers file monitoring, demoing MBFileRef, and detailed UI interactions for swapping reference files and managing namespaces. These are crucial for collaborative workflows and managing complex scene dependencies. ```python from pyfbsdk import * # Example: File Monitoring # FBFileMonitor class can be used to track changes in referenced files. # Example: MBFileRef Demo # This example would typically involve creating and managing FBReference objects. # Example: Namespace Operations # Functions like ReplaceNamespace, ImportWithNamespace are available. # Example: Swapping Reference Files (UI related) # The dialogs and models for swapping reference files are demonstrated in the UI examples. # Example: Referencing Sample referencingSample = ReferencingSample() # Interact with the referencing sample functionality. ``` -------------------------------- ### Python Examples for Complex Tools in MotionBuilder Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_basic_operations_0c_insert_current_take_8py-example This snippet compiles Python scripts that utilize more complex tools and managers within MotionBuilder. These examples cover functionalities like action script management, audio track setup, blend shape editing, and shot track setup, showcasing advanced scripting capabilities. ```python from pyfbsdk import * # Example: Action Script Manager # This script demonstrates how to interact with the Action Script Manager. # Example: Audio Track Setup Tool # This script shows how to set up and manipulate audio tracks. # Example: Blend Shape Editor # This script demonstrates how to work with blend shapes and their editors. # Example: Shot Track Setup Tool # This script illustrates setting up and managing shot tracks. ``` -------------------------------- ### Python: Utilities Examples Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_image_container_8py-example This collection of Python examples demonstrates various utility functions available in MotionBuilder's API. It includes memory leak debugging, getting selected models, and setting property options. ```python from pyfbsdk import * # Example: Debug Memory Leak (conceptual) # FBMemoryManager.StartMemoryLeakDetection() # Example: Get Selected Models selected_models = FBGetSelectedModels() for model in selected_models: print( f"Selected: {model.Name}" ) # Example: Set Property Static If Possible Option (conceptual) # prop = FBProperty.Find( "MyProperty" ) # if prop: # FBSetPropertyStaticIfPossibleOption( prop, True ) ``` -------------------------------- ### Character Rigging and Setup Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_tutorial_grid_8py-example This snippet covers scripting tasks related to character rigging, such as assigning rigid bodies, creating character extensions, and managing character marker sets. It also includes examples for exporting character animation libraries. ```python from pyfbsdk import * # Example: Assign Rigid Body (conceptual) # body = FBRigidBody("MyRigidBody") # FBSystem().Scene.Add(body) # target_object.ConnectSrc(body) # Example: Create Character Extension # character_extension = FBCharacterExtension("MyExtension") # FBSystem().Scene.Add(character_extension) # Example: Export Animation Library # FBSystem().Scene.ExportAnimationLibrary("path/to/animation.fbx") ``` -------------------------------- ### Utilities Examples with pyfbsdk in MotionBuilder Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_tree_8py-example This snippet covers various utility functions available in the pyfbsdk library for MotionBuilder. It includes examples for debugging memory leaks, getting selected models, and setting property options. These utilities aid in development and scene management. ```python from pyfbsdk import * # Example: Debug Memory Leak (Illustrative) # FBUtilities.DebugMemoryLeak() # Example: Get Selected Models selected_models = FBGetSelectedModels() for model in selected_models: print(f"Selected Model: {model.Name}") # Example: Set Property Static Option (Illustrative) # FBUtilities.SetPropertyStaticIfPossibleOption(True) ``` -------------------------------- ### Rendering Examples in MotionBuilder Python API Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_tutorial_box_8py-example This snippet contains Python scripts for rendering-related tasks in MotionBuilder. It includes examples for codec operations, basic rendering, and managing render layers, providing developers with tools to automate and control the rendering pipeline. ```python from pyfbsdk import * # Example: Codec operations # codec = FBCodec() # codec.OnFile = "path/to/video.avi" # codec.Open(True) # True for write mode # codec.Close() # Example: Basic rendering # FB Renderer().Render("output.png", 0, FBTime(0,0,0,0), FBTime(0,0,1,0)) # Example: Render layers # renderLayer = FBRenderLayer("MyRenderLayer") # FBSystem().Scene.Add(renderLayer) ``` -------------------------------- ### Complex Tools and Scripting Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_f_curve_editor_8py-example Showcases Python scripts for more complex functionalities, including action script management, audio track setup, blend shape editors, and shot track setup tools. ```python from pyfbsdk import * # ActionScriptMgr.py: Scripts for managing Action Scripts. # AudioTrackSetupTool.py: Tools for setting up audio tracks. # BlendShape_Editor.py: Scripts related to the Blend Shape editor functionality. # ShotTrackSetupTool.py: Tools for setting up shot tracks. ``` -------------------------------- ### Python: Rendering and Output Examples Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_samples_0c_referencing_0c_m_b_file_ref_demo_0c_namespace_tree_model_8py-example These Python scripts demonstrate functionalities related to rendering and outputting scenes from MotionBuilder. Examples cover codec selection, render layer management, and basic rendering commands. They are useful for automating render farm submissions and managing render settings. ```python import pyfbsdk # Example: Rendering a scene # pyfbsdk.Render() # Example: Working with Codecs # Refer to codecExamples.py for specific codec handling. # Example: Render Layers # pyfbsdk.RenderLayers.AddLayer(...) # pyfbsdk.RenderLayers.RemoveLayer(...) ``` -------------------------------- ### Complex Tools Examples in Python Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_u_i_0c_box_custom_params_8py-example Showcases Python scripts for complex tools within MotionBuilder, including Action Script Manager, audio track setup, blend shape editor, and shot track setup. ```python from pyfbsdk import * # Example: Accessing Action Script Manager actionMgr = FBActionMgr() # Example: Setting up an audio track audioTrack = FBAudioTrack("MyAudioTrack") ``` -------------------------------- ### Character Rigging and IK Setup in MotionBuilder Python API Source: https://help.autodesk.com/cloudhelp/2025/ENU/MOBU-PYTHON-API-REF/_tasks_0c_create_and_populate_a_constraint_relation_8py-example This Python snippet showcases examples related to character rigging and Inverse Kinematics (IK) setup in MotionBuilder using the pyfbsdk. It includes tasks like creating character extensions, setting up rigid bodies, and managing character stances. These scripts are fundamental for character animation pipelines. ```Python from pyfbsdk import * # Example: Creating Character Extension # Assuming 'selected_object' is a valid FBModel char_extension = FBCharacterExtension(selected_object, "MyExtensionName") # Example: Assigning Rigid Body # Assuming 'joint' is an FBBody object FBBody.AssignRigidBody(joint) # Example: Current Character Stance Pose # Assuming 'character' is an FBCharacter object character.GoToStancePose(FBStancePose.eFBStancePoseRelaxed) # Example: ActionScript Keying (Conceptual) # ActionScript scripts typically involve manipulating keyframes for specific body parts or effectors. # KeyBodyPart.py, KeyEffector.py, KeyFK.py, KeyFullBody.py, KeyIK.py, KeySelected.py would contain specific implementations. ```