Jump to content
Sign in to follow this  
Rikrok

Execute render with python

Recommended Posts

I'm trying to write out multiple variations of the same object as fbx's (I have to use fbx), the object is set to change every frame. Unfortunately when you set a frame range on the the Filmbox FBX ROP you don't get multiple fbx's, you just get one with a point cache.

I put a script on the object to change the start and end frame of the ROP to the current frame (which works), followed by
hou.parm('/out/filmboxfbx1/execute').pressButton()
Which when pressing play writes out a bunch of fbx's but unfortunately they're all empty; the script gives an infinite recursion in evaluation error.

I then tried making a tool that runs a script
for n in range (1, 101):
       hou.setFrame(n)

       hou.parm('/out/filmboxfbx1/execute').pressButton()

This only writes out 1 frame. I even tried using threading and sleep incase it was because it was executing the render button too quickly, no dice.

Does anyone know how I can achieve this?

Share this post


Link to post
Share on other sites

Have you tried the basic frame number in the Output file name?

$HIP/out_$F4.fbx

 

Share this post


Link to post
Share on other sites
57 minutes ago, Atom said:

Have you tried the basic frame number in the Output file name?


$HIP/out_$F4.fbx

 

That's the first thing I did

Share this post


Link to post
Share on other sites

Maybe you could try a post-processing rename on the file that is written out? At this link is some code where I re-write an OBJ file right after it is written. A python rename might do the trick?

Share this post


Link to post
Share on other sites

The issue is with the Filmbox ROP - if you tell it to write more than one frame it will under no circumstances write out multiple fbx's; it assumes you want one fbx with a cache. Therefore I need to set it to write one frame, render, change the frame, render, etc.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×