bundle svg
This commit is contained in:
@@ -6,6 +6,8 @@ Core functionality for generating texture images with text overlays.
|
||||
import math
|
||||
|
||||
import bpy
|
||||
from array import array
|
||||
|
||||
from ..utils.constants import has_text_fitting
|
||||
from ..utils.overlay_assets import (
|
||||
SVGConversionError,
|
||||
@@ -662,13 +664,13 @@ def generate_texture_image(props, width, height):
|
||||
|
||||
# Convert PIL image to Blender format (flip vertically to fix mirroring)
|
||||
pil_img = pil_img.transpose(Image.FLIP_TOP_BOTTOM) # Fix mirroring issue
|
||||
pil_pixels = list(pil_img.getdata())
|
||||
blender_pixels = []
|
||||
for r, g, b, a in pil_pixels:
|
||||
pass
|
||||
blender_pixels.extend([r/255.0, g/255.0, b/255.0, a/255.0])
|
||||
|
||||
blender_img.pixels[:] = blender_pixels
|
||||
raw_bytes = pil_img.tobytes()
|
||||
normalized = array('f', (channel / 255.0 for channel in raw_bytes))
|
||||
pixels_attr = getattr(blender_img, "pixels", None)
|
||||
if hasattr(pixels_attr, "foreach_set"):
|
||||
pixels_attr.foreach_set(normalized)
|
||||
else:
|
||||
blender_img.pixels[:] = normalized.tolist()
|
||||
return blender_img, None
|
||||
except ImportError as e:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user