Jump to content
gemini

Starting a Flipbook to a Specified Folder in Python

Recommended Posts

Before all, OpenGL ROP. You may find it more convenient to work with this node using Python.

 

hou.GeometryViewport.saveFlipbook() still not in H15, but you can invoke HScript command viewwrite from Python. Example:

import hou
import toolutils


def viewname(viewer):
    viewname = {
        'desktop' : viewer.pane().desktop().name(),
        'pane' : viewer.name(),
        'type' :'world',
        'viewport': viewer.curViewport().name()
    }
    return '{desktop}.{pane}.{type}.{viewport}'.format(**viewname)


def viewwrite(options='', outpath='ip'):
    current_view = viewname(toolutils.sceneViewer())
    hou.hscript('viewwrite {} {} {}'.format(options, current_view, outpath))


viewwrite('-q 4 -f 1 10', "$HIP/flipbook/'$F3'.jpg")

Share this post


Link to post
Share on other sites
On 4/12/2016 at 4:46 PM, f1480187 said:

Hi,

Colud You tell why it's not working reading the files back.

THX

G

 

import hou

import toolutils

 

hou.hscript( "loadseq -r a:/Projects/HoudiniTests/Python/flipbook/'$F3'.jpg")

print 1

 

Edited by gemini
Sorry I unfortunately I edited your code

Share this post


Link to post
Share on other sites

Hi,
Colud You tell why this code is not working for reading the captures files back.
THX
G
 -- code --
import hou
import toolutils
 
hou.hscript( "loadseq -r a:/Projects/HoudiniTests/Python/flipbook/'$F3'.jpg")
print 1

Edited by gemini

Share this post


Link to post
Share on other sites

Looks like it's MPlay-specific. Houdini doesn't know about loadseq command. Forum search says that you are first living human trying to use this command. hou.Mplay functionality still not implemented at all, like flipbook generaition classes, so, you are out of luck even with HScript, probably.

From Houdini Textport:

/ -> help loadseq
No installed command matches loadseq

From MPlay Textport:

mplay -> help loadseq
loadseq

    Loads a sequence of files into mplay.

 

But it is extremely easy to directly call MPlay as a program using Python:

import subprocess
import hou

ip = hou.expandString('$HB/mplay')
seq = hou.expandString('$HIP/flipbook/*.jpg')
subprocess.Popen([ip, seq])

 

Edited by f1480187

Share this post


Link to post
Share on other sites

Thanks,

It is easy, but you know any easy method to bring mplay app to front? ;)

Thanks in advance!

G

Edited by gemini

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

×