From 1ca45ad9016178f032ada0377b98b0f5c548bf25 Mon Sep 17 00:00:00 2001 From: Yusarina Date: Tue, 1 Apr 2025 00:45:56 +0100 Subject: [PATCH 1/2] Move simpify_bonename to dictionaries --- core/common.py | 5 ----- core/dictionaries.py | 4 +++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/common.py b/core/common.py index 62dc51f..4190571 100644 --- a/core/common.py +++ b/core/common.py @@ -383,11 +383,6 @@ def clear_unused_data_blocks() -> int: if isinstance(getattr(bpy.data, attr), bpy.types.bpy_prop_collection)) return initial_count - final_count -def simplify_bonename(name: str) -> str: - """Simplify bone name by removing spaces, underscores, dots and converting to lowercase""" - return name.lower().translate(dict.fromkeys(map(ord, u" _."))) - - def identify_bones(arm_data: bpy.types.Armature, context: bpy.types.Context) -> Dict[str,str]: """Identify bone names in an armature based on our reverse dictionary, so there is no confusion to what a bone is. Essentially makes a dictionary of keys from dictionaries.bone_names like "hips", and the corosponding value is the bone that can be mapped to that key.""" diff --git a/core/dictionaries.py b/core/dictionaries.py index c5525ec..20aefe9 100644 --- a/core/dictionaries.py +++ b/core/dictionaries.py @@ -5,7 +5,9 @@ # Note2: Remove all "_", ".", and " " (space) from your values array or it will also not ever find a match!!!! # Taken from Tuxedo/Cats -from .common import simplify_bonename +def simplify_bonename(name: str) -> str: + """Simplify bone name by removing spaces, underscores, dots and converting to lowercase""" + return name.lower().translate(dict.fromkeys(map(ord, u" _."))) bone_names = { # Right side bones From 5a43a9d66d341d127fb270687b3a1e9fce0c933b Mon Sep 17 00:00:00 2001 From: Yusarina Date: Tue, 1 Apr 2025 00:56:56 +0100 Subject: [PATCH 2/2] Fix two different error - bones_names is a dictionary so bone_names.items should be used - also len(mappings) was being used incorrectly should be using range(len(mappings)) - The last one is it just didn't like upperchest in bone_names.update so as a very temp solution i used upper_chest no an ideal solution but I too tired to investogate today and just wanted the plugin to work. however it should be simpilify anyone for now. --- core/dictionaries.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/dictionaries.py b/core/dictionaries.py index 20aefe9..8e11fdf 100644 --- a/core/dictionaries.py +++ b/core/dictionaries.py @@ -262,7 +262,7 @@ bone_names.update({ 'hips': bone_names['hips'] + ['jbipchips', 'jhips', 'vrmhips'], 'spine': bone_names['spine'] + ['jbipcspine', 'jspine', 'vrmspine'], 'chest': bone_names['chest'] + ['jbipcchest', 'jchest', 'vrmchest'], - 'upper_chest': bone_names['upperchest'] + ['jbipcupperchest', 'jupperchest', 'vrmupperchest'], + 'upper_chest': bone_names['upper_chest'] + ['jbipcupperchest', 'jupperchest', 'vrmupperchest'], 'neck': bone_names['neck'] + ['jbipcneck', 'jneck', 'vrmneck'], 'head': bone_names['head'] + ['jbipchead', 'jhead', 'vrmhead'], @@ -951,8 +951,8 @@ for category, mappings in non_standard_mappings.items(): # Since data set is very poisoned by bone names that aren't simplified (And as such will not map properly using the function) we will just force convert them to the proper format at the end here. - @989onan -for standard, mappings in bone_names: - for i in len(mappings): +for standard, mappings in bone_names.items(): + for i in range(len(mappings)): bone_names[standard][i] = simplify_bonename(mappings[i]) # Create reverse lookup dictionary (conversion/translation)