From 1ca94b05aa150886cd83c60df84548a653a4953e Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Tue, 19 Jul 2022 01:22:46 +0200 Subject: Pose library: replace f-strings by format for I18n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unfortunately, messages cannot be properly extracted from f-strings. Use format() method instead. Reviewed By: Sybren A. Stüvel, Campbell Barton Differential Revision: https://developer.blender.org/D15615 --- pose_library/operators.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/pose_library/operators.py b/pose_library/operators.py index a1cccd2c..73fca59d 100644 --- a/pose_library/operators.py +++ b/pose_library/operators.py @@ -30,6 +30,7 @@ from bpy.types import ( Operator, ) from bpy_extras import asset_utils +from bpy.app.translations import pgettext_tip as tip_ class PoseAssetCreator: @@ -141,7 +142,7 @@ class POSELIB_OT_create_pose_asset(PoseAssetCreator, Operator): return action.use_fake_user = True - self.report({'WARNING'}, "Action %s marked Fake User to prevent loss" % action.name) + self.report({'WARNING'}, tip_("Action %s marked Fake User to prevent loss") % action.name) class POSELIB_OT_restore_previous_action(Operator): @@ -292,7 +293,7 @@ class POSELIB_OT_paste_asset(Operator): self.report({"ERROR"}, "Did not find any assets on clipboard") return {"CANCELLED"} - self.report({"INFO"}, "Pasted %d assets" % len(assets)) + self.report({"INFO"}, tip_("Pasted %d assets") % len(assets)) bpy.ops.asset.library_refresh() @@ -340,13 +341,13 @@ class PoseAssetUser: self.report( # type: ignore {"ERROR"}, # TODO: Add some way to get the library name from the library reference (just asset_library_ref.name?). - f"Selected asset {asset.name} could not be located inside the asset library", + tip_("Selected asset %s could not be located inside the asset library") % asset.name, ) return {"CANCELLED"} if asset.id_type != 'ACTION': self.report( # type: ignore {"ERROR"}, - f"Selected asset {asset.name} is not an Action", + tip_("Selected asset %s is not an Action") % asset.name, ) return {"CANCELLED"} @@ -370,8 +371,11 @@ class POSELIB_OT_pose_asset_select_bones(PoseAssetUser, Operator): def use_pose(self, context: Context, pose_asset: Action) -> Set[str]: arm_object: Object = context.object pose_usage.select_bones(arm_object, pose_asset, select=self.select, flipped=self.flipped) - verb = "Selected" if self.select else "Deselected" - self.report({"INFO"}, f"{verb} bones from {pose_asset.name}") + if self.select: + msg = tip_("Selected bones from %s") % pose_asset.name + else: + msg = tip_("Deselected bones from %s") % pose_asset.name + self.report({"INFO"}, msg) return {"FINISHED"} @classmethod @@ -446,7 +450,7 @@ class POSELIB_OT_convert_old_poselib(Operator): cls.poll_message_set("Active object has no Action") return False if not action.pose_markers: - cls.poll_message_set("Action %r is not a legacy pose library" % action.name) + cls.poll_message_set(tip_("Action %r is not a legacy pose library") % action.name) return False return True @@ -460,7 +464,7 @@ class POSELIB_OT_convert_old_poselib(Operator): self.report({'ERROR'}, "Unable to convert to pose assets") return {'CANCELLED'} - self.report({'INFO'}, "Converted %d poses to pose assets" % len(new_actions)) + self.report({'INFO'}, tip_("Converted %d poses to pose assets") % len(new_actions)) return {'FINISHED'} @@ -480,7 +484,7 @@ class POSELIB_OT_convert_old_object_poselib(Operator): cls.poll_message_set("Active object has no pose library Action") return False if not action.pose_markers: - cls.poll_message_set("Action %r is not a legacy pose library" % action.name) + cls.poll_message_set(tip_("Action %r is not a legacy pose library") % action.name) return False return True @@ -494,7 +498,7 @@ class POSELIB_OT_convert_old_object_poselib(Operator): self.report({'ERROR'}, "Unable to convert to pose assets") return {'CANCELLED'} - self.report({'INFO'}, "Converted %d poses to pose assets" % len(new_actions)) + self.report({'INFO'}, tip_("Converted %d poses to pose assets") % len(new_actions)) return {'FINISHED'} -- cgit v1.2.3 From a28c3f9cc009958695e33c929a4524d10e0d31e0 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 10 Nov 2022 11:07:05 +0100 Subject: Fix T102396: ValueError: matrix does not have an inverse Refactor the matrix stack in a way that does not require matrix inversion. Basically, store the state of the final transform in the stack. Technically this makes regression test to fail with Blender Icons, but the new code gives more correct icons. So the reference image is to simply be regenerated. --- io_curve_svg/import_svg.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/io_curve_svg/import_svg.py b/io_curve_svg/import_svg.py index c6461852..97dad798 100644 --- a/io_curve_svg/import_svg.py +++ b/io_curve_svg/import_svg.py @@ -964,16 +964,17 @@ class SVGGeometry: Push transformation matrix """ - self._context['transform'].append(matrix) - self._context['matrix'] = self._context['matrix'] @ matrix + current_matrix = self._context['matrix'] + self._context['matrix_stack'].append(current_matrix) + self._context['matrix'] = current_matrix @ matrix def _popMatrix(self): """ Pop transformation matrix """ - matrix = self._context['transform'].pop() - self._context['matrix'] = self._context['matrix'] @ matrix.inverted() + old_matrix = self._context['matrix_stack'].pop() + self._context['matrix'] = old_matrix def _pushStyle(self, style): """ @@ -1822,9 +1823,9 @@ class SVGLoader(SVGGeometryContainer): rect = (0, 0) self._context = {'defines': {}, - 'transform': [], 'rects': [rect], 'rect': rect, + 'matrix_stack': [], 'matrix': m, 'materials': {}, 'styles': [None], -- cgit v1.2.3