hopbin9 Posted May 4, 2011 Share Posted May 4, 2011 Hi, I'm creating a wall of TVs and each TV will have a different image displayed on. So I want to change the image sequence being shown based upon a random value. My problem is that each sequence is a different number of files, and I need the video to loop. I can do something like this $HIP/images/video`ch('video')`/image_`padzero(3,wrap($F,1,500))`.png Where 500 is the length of the video sequence. Is there an hscript expression that will tell me how long the sequence is? Quote Link to comment Share on other sites More sharing options...
anim Posted May 4, 2011 Share Posted May 4, 2011 (edited) if you read your sequence into File COP and then using expression like: seqlength() or in Python sequenceFrameLength() will tell you that so to be more effective, create little python script that will loop all your sequences, get their lengths by loading them to a single File COP one by one and outputs lengths to file or to some node as custom data or somewhere or if you do it in Python SOP, then you can store that data directly to corresponding points of your TV grid Just make sure it's not realtime, but as a callback script for some button Edited May 4, 2011 by anim Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted May 4, 2011 Share Posted May 4, 2011 Haven't testing it, just a quick sketch, but something like this should work in text filed import os HIP = hou.expandString("$HIP") videoFolder = "video_%d" % 1 # random number here pathToSeq = "%s/images/%s" % (HIP,videoFolder) # fullPath to video folder seqLength = len(os.listdir(pathToSeq)) F = int(hou.hmath.wrap(hou.frame(),1,seqLength)) #frame wraping F = str(F).zfill(4) #padding fileName = "image_%s.png" % F fullPath = "%s/%s" % (pathToSeq,fileName) return fullPath 1 Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted May 4, 2011 Author Share Posted May 4, 2011 thanks guys Quote Link to comment Share on other sites More sharing options...
lukeiamyourfather Posted May 4, 2011 Share Posted May 4, 2011 Haven't testing it, just a quick sketch, but something like this should work in text filed import os HIP = hou.expandString("$HIP") videoFolder = "video_%d" % 1 # random number here pathToSeq = "%s/images/%s" % (HIP,videoFolder) # fullPath to video folder seqLength = len(os.listdir(pathToSeq)) F = int(hou.hmath.wrap(hou.frame(),1,seqLength)) #frame wraping F = str(F).zfill(4) #padding fileName = "image_%s.png" % F fullPath = "%s/%s" % (pathToSeq,fileName) return fullPath To clean things up a bit, that could be put into the session module as a function. Then call the function with hou.session.defNameHere(argsHere). The session module gets saved into the scene file. http://www.sidefx.com/docs/houdini11.0/hom/session If a Python expression is going to take more than a single line then I will put it into the session module (or an external module) to keep things as organized as possible. If you find you need it later in a another scene then the session can be exported as a stand alone Python script and then imported into another scene. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.