1
0
mirror of synced 2024-11-12 01:00:46 +01:00

Better logging for rendering cycle.

This commit is contained in:
Jennifer Taylor 2021-05-16 19:39:25 +00:00
parent 428ee8a063
commit 604b987f90

View File

@ -366,7 +366,9 @@ class AFPRenderer(VerboseOutput):
else:
raise Exception(f"Failed to process tag: {tag}")
def __render_object(self, img: Image.Image, renderable: PlacedObject, parent_transform: Matrix, parent_origin: Point) -> Image.Image:
def __render_object(self, img: Image.Image, renderable: PlacedObject, parent_transform: Matrix, parent_origin: Point, prefix: str="") -> Image.Image:
self.vprint(f"{prefix} Rendering placed object ID {renderable.object_id} from sprite {renderable.source.tag_id} onto Depth {renderable.depth}")
# Compute the affine transformation matrix for this object.
transform = parent_transform.multiply(renderable.transform)
@ -388,8 +390,7 @@ class AFPRenderer(VerboseOutput):
key=lambda obj: obj.depth,
)
for obj in objs:
self.vprint(f" Rendering placed object ID {obj.object_id} from sprite {obj.source.tag_id} onto Depth {obj.depth}")
img = self.__render_object(img, obj, transform, parent_origin.add(renderable.rotation_offset))
img = self.__render_object(img, obj, transform, parent_origin.add(renderable.rotation_offset), prefix=prefix + " ")
elif isinstance(renderable, PlacedShape):
# This is a shape draw reference.
shape = renderable.source
@ -561,7 +562,6 @@ class AFPRenderer(VerboseOutput):
clip = self.__find_renderable(root_clip, visible_tag)
if clip:
for obj in sorted(clip.placed_objects, key=lambda obj: obj.depth):
self.vprint(f" Rendering placed object ID {obj.object_id} from sprite {obj.source.tag_id} onto Depth {obj.depth}")
curimage = self.__render_object(curimage, obj, root_clip.transform, root_clip.rotation_offset)
else:
# Nothing changed, make a copy of the previous render.