-
-
Save Simon-L/5095654 to your computer and use it in GitHub Desktop.
This file contains 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
# Render Test | |
import bpy | |
from bpy.props import * | |
#Setup Radio Button Enum Props | |
bpy.types.Scene.rtSizeEnum = bpy.props.EnumProperty( \ | |
items = [('Half', 'Half', 'Half the size of the render rez'),\ | |
('Quarter', 'Quarter', 'Quarter the size of the render rez'),\ | |
('Thumbnail', 'Thumbnail', 'Thumbnail size of the render rez')],\ | |
name = 'trSize', default = 'Quarter') | |
class RenderTestPanel(bpy.types.Panel): | |
bl_label = "Render Test" | |
bl_space_type = "PROPERTIES" | |
bl_region_type = "WINDOW" | |
bl_context = "render" | |
def draw(self, context): | |
layout = self.layout | |
scn = bpy.context.scene | |
rd = scn.render | |
# Size selection | |
row = layout.row() | |
row.label(text="Reduce resolution to:") | |
row = layout.row(align=True) | |
row.alignment = 'EXPAND' | |
layout.row().prop(context.scene,'rtSizeEnum', expand=True) | |
split = layout.split() | |
col = split.column() | |
sub = col.column(align=True) | |
sub.label(text="Resolution:") | |
sub.prop(rd, "resolution_x", text="X") | |
sub.prop(rd, "resolution_y", text="Y") | |
sub.prop(rd, "resolution_percentage", text="") | |
# Segment range set, default all | |
layout.label(text="Segment Range:") | |
row = layout.row(align=True) | |
row.prop(scn, "frame_start") | |
row.prop(scn, "frame_end") | |
# Call render | |
row = layout.row() | |
#row.operator( "render.render" ) | |
row.operator( "bpt.render_test_op" ) | |
#if context.scene.rtSizeEnum == 'Half': | |
class RenderTestOperator(bpy.types.Operator): | |
bl_idname = "bpt.render_test_op" | |
bl_label = "Render Test" | |
def execute(self, context): | |
self.report({'INFO'}, "Test Render initiated! ") | |
print(context.scene.rtSizeEnum) | |
# note .ops. scope change from panel button version | |
#bpy.ops.render.render(scene="Scene") NOPE! | |
#bpy.ops.render.render(text="Render") NOPE! | |
#rnl = context.scene.render.layers.active NOPE! | |
#bpy.ops.scene.render NOPE! | |
#context.scene.render NOPE! | |
#context.scene.render.render NOPE! | |
#context.scene.render() NOPE! | |
#context.scene.render.render() NOPE! | |
#bpy.ops.render.render() NOPE! | |
#bpy.ops.render.view_show() NOPE! | |
# NOTE: set output path edit box with a filename other wise it will write .png as a hidden file | |
scn = bpy.context.window.screen.scene | |
bpy.ops.render.render(animation=False, write_still=True, layer="", scene=scn.name) | |
#bpy.ops.render.view_show() | |
# below works also all filled in... | |
#bpy.ops.render.render(animation=False, write_still=True, layer="", scene=bpy.context.window.screen.scene.name) | |
return {'FINISHED'} | |
def register(): | |
bpy.utils.register_class( RenderTestPanel ) | |
bpy.utils.register_class( RenderTestOperator ) | |
def unregister(): | |
bpy.utils.register_class( RenderTestPanel ) | |
bpy.utils.register_class( RenderTestOperator ) | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment