Last active
May 21, 2023 18:34
-
-
Save p2or/0d6546cdd53aa7a053f34776119d9b0a to your computer and use it in GitHub Desktop.
New Flipbook based on https://www.sidefx.com/forum/topic/42808/ #Houdini
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
custom_range = (0,10) | |
filename = "~/flipbook/flip_$F4.png" | |
cur_desktop = hou.ui.curDesktop() | |
scene = cur_desktop.paneTabOfType(hou.paneTabType.SceneViewer) | |
flip_options = scene.flipbookSettings().stash() | |
flip_options.frameRange(custom_range) | |
flip_options.output(filename) | |
scene.flipbook(scene.curViewport(), flip_options) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import gmtime, strftime | |
# GET VIEWPORT CAMERA PATH | |
cur_desktop = hou.ui.curDesktop() | |
desktop = cur_desktop.name() | |
panetab = cur_desktop.paneTabOfType(hou.paneTabType.SceneViewer).name() | |
persp = cur_desktop.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().name() | |
camera_path = desktop + "." + panetab + "." + "world" "." + persp | |
# BUILD DEFAULT FILE NAME FROM CURRENT TIME | |
default_filename = strftime("screenshot_%d_%b_%Y_%H_%M_%S.jpg", gmtime()) | |
# SELECT FILE | |
filename = hou.ui.selectFile( title='Select Screenshot File', default_value=default_filename, file_type=hou.fileType.Image ) | |
# WRITE TO FILE | |
if filename is not None: | |
frame = hou.frame() | |
hou.hscript( "viewwrite -f %d %d %s '%s'" % (frame, frame, camera_path, filename) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment