Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / Change Camera Attributes via Python
  RSS 2.0 ATOM  

Change Camera Attributes via Python
Rate this thread
 
63793
 
Permlink of this thread  
avatar
  • Location: Orange County, CA
  • Total Posts: 4
  • Joined: 22 August 2006 09:36 PM

I am relatively new to python in mobu and am trying to change attributes of a certain camera via python. Specifically the Focal Length and toggling items such as Title Safe and the grid.

What i can’t figure out is how to select a camera based on its name and then proceed to change its attributes.

Any suggestions?

Thanks!



Replies: 0
avatar

Hi,

here is a quick example how to get access to the cameras in your mobu-scene:

from pyfbsdk import *

# we are getting an object instance of the whole scene
myScene FBSystem().Scene

# we know that myScene.Cameras is a list of objects, the cameras
# Therefore we iterate through this list by every object and print out the name
for obj in myScene.Cameras:
    print 
obj.Name

This is a very simple way to get any information about your scene. Look up “FBScene” in the Mobu SDK Help(Mobu-Menu->Help->Motionbuilder SDK Help). There you can find any other attributes or functions this class holds or can execute if it is instanced as an object we have access to via python.
If you look for FBCamera(the camera object class) you will find a huge amount of camera attributes you can reach, e.g. FocalLength. :)
If we add this knowledge to our little script:

from pyfbsdk import *

myScene FBSystem().Scene

for obj in myScene.Cameras:
    
#prints out the name
    
print obj.Name
    
#prints out the FocalLength
    
print obj.FocalLength

That’s it for the start. :)

Cheers,

Chris



Replies: 0