From a3be6e879e3068b815053d70b17ad7bfb2584f0d Mon Sep 17 00:00:00 2001 From: Jesse Yurkovich Date: Wed, 11 Oct 2023 18:27:44 -0700 Subject: [PATCH 1/2] UV Export: Allow larger sizes to be exported --- io_mesh_uv_layout/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_mesh_uv_layout/__init__.py b/io_mesh_uv_layout/__init__.py index e875a22ee..db35226a6 100644 --- a/io_mesh_uv_layout/__init__.py +++ b/io_mesh_uv_layout/__init__.py @@ -75,7 +75,7 @@ class ExportUVLayout(bpy.types.Operator): size: IntVectorProperty( size=2, default=(1024, 1024), - min=8, max=32768, + min=8, max=65536, description="Dimensions of the exported file", ) opacity: FloatProperty( -- 2.30.2 From 511db63151d768fa88e4dbe04cc9d2985e2c7194 Mon Sep 17 00:00:00 2001 From: Jesse Yurkovich Date: Wed, 11 Oct 2023 21:21:31 -0700 Subject: [PATCH 2/2] Make experience a bit friendlier --- io_mesh_uv_layout/__init__.py | 12 ++++++++---- io_mesh_uv_layout/export_uv_png.py | 7 +++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/io_mesh_uv_layout/__init__.py b/io_mesh_uv_layout/__init__.py index db35226a6..b0c7347f4 100644 --- a/io_mesh_uv_layout/__init__.py +++ b/io_mesh_uv_layout/__init__.py @@ -136,10 +136,14 @@ class ExportUVLayout(bpy.types.Operator): obj_eval.to_mesh_clear() export = self.get_exporter() - export(filepath, polygon_data, different_colors, self.size[0], self.size[1], self.opacity) - - if is_editmode: - bpy.ops.object.mode_set(mode='EDIT', toggle=False) + try: + export(filepath, polygon_data, different_colors, self.size[0], self.size[1], self.opacity) + except ValueError as ex: + self.report({'ERROR'}, str(ex)) + return {'CANCELLED'} + finally: + if is_editmode: + bpy.ops.object.mode_set(mode='EDIT', toggle=False) return {'FINISHED'} diff --git a/io_mesh_uv_layout/export_uv_png.py b/io_mesh_uv_layout/export_uv_png.py index 784337be4..a5ae14e39 100644 --- a/io_mesh_uv_layout/export_uv_png.py +++ b/io_mesh_uv_layout/export_uv_png.py @@ -16,8 +16,11 @@ except ImportError: def export(filepath, face_data, colors, width, height, opacity): - offscreen = gpu.types.GPUOffScreen(width, height) - offscreen.bind() + try: + offscreen = gpu.types.GPUOffScreen(width, height) + offscreen.bind() + except RuntimeError: + raise ValueError("Texture allocation failed. Try using a smaller size for export.") try: fb = gpu.state.active_framebuffer_get() -- 2.30.2