2025-12-01

This commit is contained in:
2026-03-17 14:58:51 -06:00
parent 183e865f8b
commit 4b82b57113
6846 changed files with 954887 additions and 162606 deletions
@@ -0,0 +1,66 @@
bl_info = {
"name": "Swap Render Orientation",
"blender": (4, 2, 0),
"category": "Render",
"author": "Nathan Designs UK",
"version": (2, 1, 0),
"description": "Swap Render Resolution X/Y Oritentation (Shortcut: F8)",
"location": "Properties > Output Properties > Format, or F8",
"warning": "",
"doc_url": "https://www.nathandesigns.uk",
"tracker_url": "",
"support": "COMMUNITY"
}
import bpy
class SWAP_OT_Orientation(bpy.types.Operator):
"""Swap Between Portrait and Landscape X/Y Resolution"""
bl_idname = "render.swap_orientation"
bl_label = "Swap Render Resolution (Portrait/Landscape)"
bl_description = "Toggle X and Y resolution values (Shortcut: F8)"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
render_settings = context.scene.render
res_x, res_y = render_settings.resolution_x, render_settings.resolution_y
render_settings.resolution_x, render_settings.resolution_y = res_y, res_x
return {'FINISHED'}
# Function to add the button in the correct location
def draw_swap_button(self, context):
layout = self.layout
col = layout.column(align=True)
col.separator()
col.operator("render.swap_orientation", icon="FILE_REFRESH", text="Swap Render Resolution (Portrait/Landscape)")
col.separator()
addon_keymaps = []
def register():
bpy.utils.register_class(SWAP_OT_Orientation)
# Ensure the function is only appended once
if draw_swap_button not in bpy.types.RENDER_PT_format.__dict__.get('__annotations__', {}):
bpy.types.RENDER_PT_format.append(draw_swap_button)
# Add keyboard shortcut (F8)
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name="Screen", space_type="EMPTY")
kmi = km.keymap_items.new("render.swap_orientation", type="F8", value="PRESS")
addon_keymaps.append((km, kmi))
def unregister():
bpy.utils.unregister_class(SWAP_OT_Orientation)
# Remove the function from the Format panel draw method safely
if draw_swap_button in bpy.types.RENDER_PT_format.__dict__.get('__annotations__', {}):
bpy.types.RENDER_PT_format.remove(draw_swap_button)
# Remove the shortcut
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()
@@ -0,0 +1,16 @@
schema_version = "1.0.0"
id = "swap_render_orientation"
version = "2.1.0"
name = "Swap Render Orientation"
tagline = "Quickly swap X/Y resolution in Blender with one click or F8."
maintainer = "Nathan Designs UK"
type = "add-on"
website = "https://www.nathandesigns.uk"
tags = ["Render", "Resolution", "Orientation", "Camera", "Shortcut", "Addon"]
blender_version_min = "4.2.0"
license = ["SPDX:GPL-3.0-or-later"]