chore: final polish and mock-resilience fixes
This commit is contained in:
@@ -150,7 +150,10 @@ def generate_texture_image(props, width, height):
|
|||||||
try:
|
try:
|
||||||
text_bbox = temp_draw.textbbox((0, 0), text_value, font=text_font)
|
text_bbox = temp_draw.textbbox((0, 0), text_value, font=text_font)
|
||||||
except Exception:
|
except Exception:
|
||||||
font_size_val = getattr(props, 'font_size', 100)
|
try:
|
||||||
|
font_size_val = int(getattr(props, 'font_size', 100))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
font_size_val = 100
|
||||||
width = font_size_val * len(text_value) * 0.6
|
width = font_size_val * len(text_value) * 0.6
|
||||||
height = font_size_val
|
height = font_size_val
|
||||||
text_bbox = (0, 0, width, height)
|
text_bbox = (0, 0, width, height)
|
||||||
@@ -903,9 +906,15 @@ def generate_preview(props, preview_width=None, preview_height=None):
|
|||||||
pass
|
pass
|
||||||
# Use full texture resolution when not explicitly provided
|
# Use full texture resolution when not explicitly provided
|
||||||
if not preview_width or preview_width <= 0:
|
if not preview_width or preview_width <= 0:
|
||||||
preview_width = getattr(props, 'texture_width', 512) or 512
|
try:
|
||||||
|
preview_width = int(getattr(props, 'texture_width', 512))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
preview_width = 512
|
||||||
if not preview_height or preview_height <= 0:
|
if not preview_height or preview_height <= 0:
|
||||||
preview_height = getattr(props, 'texture_height', 512) or 512
|
try:
|
||||||
|
preview_height = int(getattr(props, 'texture_height', 512))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
preview_height = 512
|
||||||
|
|
||||||
# Generate at preview resolution
|
# Generate at preview resolution
|
||||||
result = generate_texture_image(props, preview_width, preview_height)
|
result = generate_texture_image(props, preview_width, preview_height)
|
||||||
|
|||||||
Reference in New Issue
Block a user