Move simpify_bonename to dictionaries

This commit is contained in:
Yusarina
2025-04-01 00:45:56 +01:00
parent bc034c5308
commit 1ca45ad901
2 changed files with 3 additions and 6 deletions
-5
View File
@@ -383,11 +383,6 @@ def clear_unused_data_blocks() -> int:
if isinstance(getattr(bpy.data, attr), bpy.types.bpy_prop_collection)) if isinstance(getattr(bpy.data, attr), bpy.types.bpy_prop_collection))
return initial_count - final_count 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]: 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. """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.""" 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."""
+3 -1
View File
@@ -5,7 +5,9 @@
# Note2: Remove all "_", ".", and " " (space) from your values array or it will also not ever find a match!!!! # Note2: Remove all "_", ".", and " " (space) from your values array or it will also not ever find a match!!!!
# Taken from Tuxedo/Cats # 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 = { bone_names = {
# Right side bones # Right side bones