Basic Start of Armature Selection
This commit is contained in:
@@ -4,7 +4,7 @@ from typing import List, Optional
|
||||
import re
|
||||
from bpy.types import Operator, Context, Object
|
||||
from ..core.dictionaries import bone_names
|
||||
from ..core.common import get_armature, simplify_bonename
|
||||
from ..core.common import get_selected_armature, simplify_bonename
|
||||
from ..functions.translations import t
|
||||
|
||||
@register_wrap
|
||||
@@ -16,12 +16,13 @@ class ConvertToResonite(Operator):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context: Context) -> bool:
|
||||
if not get_armature(context):
|
||||
return False
|
||||
return True
|
||||
return get_selected_armature(context) is not None
|
||||
|
||||
def execute(self, context: Context) -> set:
|
||||
armature = get_armature(context)
|
||||
armature = get_selected_armature(context)
|
||||
if not armature:
|
||||
self.report({'WARNING'}, "No armature selected")
|
||||
return {'CANCELLED'}
|
||||
|
||||
translate_bone_fails = 0
|
||||
untranslated_bones = set()
|
||||
@@ -89,8 +90,6 @@ class ConvertToResonite(Operator):
|
||||
'thumb_3_r': "thumb3.R"
|
||||
}
|
||||
|
||||
|
||||
|
||||
context.view_layer.objects.active = armature
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
@@ -111,5 +110,4 @@ class ConvertToResonite(Operator):
|
||||
else:
|
||||
self.report({'INFO'}, "Successfully translated all bones to humanoid names")
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
return {'FINISHED'}
|
||||
|
||||
Reference in New Issue
Block a user