From eb52350f371462b43408a526d9de1acd1cf149fd Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Jun 2019 17:34:40 +0300 Subject: [PATCH] Hotfix: Fixed Rescaling of Avatar --- hifi_tools/__init__.py | 2 +- hifi_tools/utils/bones/bones_builder.py | 7 ++++--- hifi_tools/utils/ui/panels.py | 8 ++++++-- package.py | 3 ++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/hifi_tools/__init__.py b/hifi_tools/__init__.py index b8bdabe..dc7e43b 100644 --- a/hifi_tools/__init__.py +++ b/hifi_tools/__init__.py @@ -20,7 +20,7 @@ bl_info = { "name": "HiFi Blender Add-on", "author": "Matti 'Menithal' Lahtinen", - "version": (1, 4, 2), + "version": (1, 4, 3), "blender": (2, 80, 0), "location": "File > Import-Export, Materials, Armature", "description": "Blender tools to allow for easier Content creation for Metaverses, such as High Fidelity", diff --git a/hifi_tools/utils/bones/bones_builder.py b/hifi_tools/utils/bones/bones_builder.py index b5a5fae..a449f02 100644 --- a/hifi_tools/utils/bones/bones_builder.py +++ b/hifi_tools/utils/bones/bones_builder.py @@ -540,7 +540,7 @@ def reset_scale_rotation(obj): bpy.ops.object.select_all(action="DESELECT") obj.select_set(state=True) - bpy.context.view_layer.objects.active = obj + bpy.ops.object.origin_set(type="ORIGIN_CURSOR") bpy.ops.object.transform_apply(location=False, rotation=True, scale=True) @@ -551,7 +551,9 @@ def correct_scale_rotation(obj, rotation): str_angle = -90 * pi/180 if rotation: obj.rotation_euler = Euler((str_angle, 0, 0), "XYZ") - bpy.ops.object.transform_apply(location=False, rotation=True, scale=True) + + reset_scale_rotation(obj) + obj.scale = Vector((0.01, 0.01, 0.01)) if rotation: obj.rotation_euler = Euler((-str_angle, 0, 0), "XYZ") @@ -610,7 +612,6 @@ def clear_pose(selected): def retarget_armature(options, selected, selected_only=False): - armature = find_armature(selected) if armature is not None: # Center Children First diff --git a/hifi_tools/utils/ui/panels.py b/hifi_tools/utils/ui/panels.py index e696042..b226f2c 100644 --- a/hifi_tools/utils/ui/panels.py +++ b/hifi_tools/utils/ui/panels.py @@ -310,9 +310,13 @@ class OBJECT_OT_METAV_TOOLSET_Fix_Scale_Operator(bpy.types.Operator): bl_category = "High Fidelity" def execute(self, context): - - for selected in context.selected_objects: + selected_objects = bpy.context.selected_objects + for selected in selected_objects: bones_builder.correct_scale_rotation(selected, True) + + bpy.ops.object.select_all(action="DESELECT") + for selected in selected_objects: + selected.select_set(state=True) return {'FINISHED'} diff --git a/package.py b/package.py index b4cd22e..9f1729d 100644 --- a/package.py +++ b/package.py @@ -19,4 +19,5 @@ f = os.path.join(path,f) zip.write(os.path.realpath(f),f) -zip.close() \ No newline at end of file +zip.close() +print("Packaged into Projects Folder") \ No newline at end of file