50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
|
bl_info = {
|
||
|
"name": "Resolution Swapper",
|
||
|
"author": "Anish Lakhwara",
|
||
|
"version": (1, 0, 0),
|
||
|
"blender": (2, 78, 0),
|
||
|
"description": "Simple button to swap X & Y resolution size",
|
||
|
"category": "Properties",
|
||
|
}
|
||
|
|
||
|
import bpy
|
||
|
|
||
|
class ResSwapButton(bpy.types.Operator):
|
||
|
bl_idname = "resswap.button"
|
||
|
bl_label = "Swap Resolution"
|
||
|
|
||
|
def execute(self, context):
|
||
|
x = context.scene.render.resolution_y
|
||
|
y = context.scene.render.resolution_x
|
||
|
context.scene.render.resolution_y = y
|
||
|
context.scene.render.resolution_x = x
|
||
|
|
||
|
return {'FINISHED'}
|
||
|
|
||
|
def menu_func(self, context):
|
||
|
self.layout.operator(ResSwapButton.bl_idname)
|
||
|
|
||
|
class ResSwapPanel(bpy.types.Panel):
|
||
|
"""Creates a Panel in the scene context of the properties editor"""
|
||
|
bl_label = "Resolution Swaper"
|
||
|
bl_idname = "SCENE_PT_layout"
|
||
|
bl_space_type = 'PROPERTIES'
|
||
|
bl_region_type = 'WINDOW'
|
||
|
bl_context = "output"
|
||
|
|
||
|
def draw(self, context):
|
||
|
scene = context.scene
|
||
|
self.layout.operator(ResSwapButton.bl_idname)
|
||
|
|
||
|
def register():
|
||
|
bpy.utils.register_class(ResSwapButton)
|
||
|
bpy.types.RENDER_PT_format.append(menu_func)
|
||
|
#bpy.utils.register_class(ResSwapPanel)
|
||
|
|
||
|
|
||
|
def unregister():
|
||
|
bpy.utils.unregister_class(ResSwapButton)
|
||
|
#bpy.utils.unregister_class(ResSwapPanel)
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
register()
|