MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do you switch the camera in python ?

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
748 Views, 6 Replies

How do you switch the camera in python ?

Hi,

I am using the following to switch the camera in script:

...
app.SwitchViewerCamera( camera )

...

Unfortunately, it appears to switch the camera *after* the script is done.

In the mean time, the is using the camera that is active in the UI.

Any thoughts on what I'm doing wrong?

BTW, the is app.FileRender() stuff, so choosing the appropriate camera is important to me.

Thanx!
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

Hi,

FBRenderer.CurrentCamera attribute enable you to switch camera used by the render...

I hope this help...
Message 3 of 7
Anonymous
in reply to: Anonymous

Hey, thanx!

I tried that, but I didn't get any results. It seems to suggest then that I'm not using the right "renderer" maybe ??

Anyway, still trying....

🙂
Message 4 of 7
Anonymous
in reply to: Anonymous

Here is a script that switch cam between render...


from pyfbsdk import *
import time
app = FBApplication()
sys = FBSystem()
app.FileNew()
app.FileOpen(r'c:\temp.fbx')
rend = sys.Renderer
cams =

for x in range(len(cams)):
cams.Translation=FBVector3d(0,0,(x*10))
cams.Show=True
cams.ResolutionMode = FBCameraResolutionMode.kFBResolutionCustom
rend.CurrentCamera=cams
cams.ResolutionWidth = 320
cams.ResolutionHeight = 240
options = FBVideoGrabber().GetOptions()
print dir(options)
options.TimeSpan = FBTimeSpan(FBTime(0, 0, 0, x+1), FBTime(0, 0, 0, x+1))
options.TimeSteps = FBTime(0, 0, 0, 1)
options.OutputFileName=r"c:\temp.tif"
sys.Scene.Evaluate()
app.FileRender(options)

17109_fhJW2WevSzgQcXr2f9zq.zip

Message 5 of 7
Anonymous
in reply to: Anonymous

Hey, thanx for the code!

Just ran it, and for all the images i get the "producer perspective", not the translated cam.

I know i'm being a bonehead, so I'll keep investigating this.

BTW, which version of MOBU are you using?

Thanx again...
Message 6 of 7
Anonymous
in reply to: Anonymous

Hi gosha1128,

This script render with the specified cam on c:\temp.tif... but you can't see the renderer.currentcamera in the viewer...

I tried this script on 7.52 and It worked well...

Hope this is what you want to do...
Message 7 of 7
Anonymous
in reply to: Anonymous

Hey, an update...

I just tried the exact same thing in MOBU2009 and it works fine as well. So, maybe my version was too old (vanilla 7.5).

Thanx again!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report