Filecache: pre-frame Script (skip existing)

   4706   5   1
User Avatar
Member
100 posts
Joined: Sept. 2006
Offline
Hello Gang!

Id love to skip already cached frames in Houdini 17
Trying to squeeze in this code into pre-frame Script (Python):
execfile(“fullpath/testcode.py”)

--------------testcode.py------------------
import os

filepath = hou.pwd().parent().evalParm('file')

config = os.path.isfile( filepath )

if config:
   print( 'SKIPPING' )
   hou.pwd().parent().bypass(1)
else:
   print( 'WRITE')
   hou.pwd().parent().bypass(0)

-----------------------------------------------

Needless to say, ‘bypass’ isnt the way forward. Cant think of anything better.
Any insights would be super appreciated!
Al
Edited by axelsp - April 9, 2019 08:49:41
User Avatar
Member
738 posts
Joined: Dec. 2006
Offline
I think it would be better to do a pre-render script instead. Just query the destination dir, see what frames are there and then change the frame range in the driver.
Sean Lewkiw
CG Supervisor
Machine FX - Cinesite MTL
User Avatar
Member
100 posts
Joined: Sept. 2006
Offline
Not a bad idea at all, Thanks a lot! Love the out of the box (my box) thinking.
Problem will be the Frame range list. I know hscript ‘render’ command has a ‘consolidade list’ arg. which i never played with. So it seems the time has come to check it out

I am not accepting the fact you cant just skip a frame tho.. lol. There must be a way.
I mean ultimately write ur won ROP then. lol

Ill try ur idea for sure and come back with it.
Cheers!
Edited by axelsp - April 9, 2019 09:59:58
User Avatar
Member
738 posts
Joined: Dec. 2006
Offline
I had to actually do just this today, (render only missing frames). This still needs a bit of work to make it less hard-codey, but you can source this in a python shell and it renders only missing frames:

import os
import hou

dirn  = "/path/to/dir"
name  = "logo"
ROP   = "/out/logo"

def doit(start,end,ROP=ROP):
	while start <= end:
		filename = "%s.%s.%s" % (name,start,"exr")
		file = os.path.join(dirn,filename)
		if os.path.exists(file):
			print "x Skip %s" % file
		else:
			print "o Render %s" % file
			n = hou.node(ROP)
			
			# switch to current frame mode
			p = n.parm("trange")
			p.set(0)
			
			# turn off "non blocking current frame rendering" for Redshift
			try:
				p = n.parm("RS_nonBlockingRendering")
				p.set(0)
			except:
				pass
			
			# move to current frame
			hou.setFrame(start)
			# press button
			button = "%s/%s" % (ROP,"execute")
			hou.parm(button).pressButton()
		start = start + 1
Sean Lewkiw
CG Supervisor
Machine FX - Cinesite MTL
User Avatar
Member
100 posts
Joined: Sept. 2006
Offline
That's inspiring stuff, thanks very much!
I will still need to find a way to skip frames on a per-frame basis.
The idea is to cache using as many machines avail. as possible. So all frames are missing theoretically before i press ‘the button’.
I just need to write a 1k file pre-frame, while houdini builds the cache of that frame on a given machine. (Sidefx could have done this already if im honest - request?)
Since my first post above, I couldnt find the time to research this topic again. But I will as soon as im in front of the pc next week.
Your code tells me Im better off writing my own ‘File cache ROP’. And thats exciting and frustrating at the same time.
Cheers!
User Avatar
Member
9416 posts
Joined: July 2007
Online
or you can use TOPs, where ROP Geometry Output TOP or more generally ROP Fetch TOP can skip existing outputs if Cache Mode set to Automatic
Edited by tamte - April 12, 2019 11:53:28
Tomas Slancik
CG Supervisor
Framestore, NY
  • Quick Links