Merge pull request 'Function to select bones in pose' (#24) from select-button into develop
Reviewed-on: #24
This commit is contained in:
11
common.py
11
common.py
@ -37,6 +37,17 @@ def searchPoseMarker(context, posename, type):
|
||||
pass
|
||||
|
||||
|
||||
def selectBonesinPose(context, posename, active_marker):
|
||||
try:
|
||||
arm_object, pose_library = getArmatureData(context)
|
||||
for bone in arm_object.pose.bones:
|
||||
bone.bone.select = False
|
||||
if findKeyframe(context, bone, active_marker.frame):
|
||||
bone.bone.select = True
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def findFcurve(context, bone_name, transform, index_int):
|
||||
arm_object, pose_library = getArmatureData(context)
|
||||
pose_markers = pose_library.pose_markers
|
||||
|
13
operators.py
13
operators.py
@ -254,7 +254,7 @@ class DSPL_OT_MovePose(bpy.types.Operator):
|
||||
class DSPL_OT_ApplyPose(bpy.types.Operator):
|
||||
bl_idname = "dspl.apply_pose"
|
||||
bl_label = "Apply Pose"
|
||||
bl_description = "Apply Pose (Ctrl+Click to select, Shift+Click to rename, Alt+Click to remove)"
|
||||
bl_description = "Apply Pose (Ctrl+Click to select bones, Shift+Click to rename, Alt+Click to remove)"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
posename: bpy.props.StringProperty()
|
||||
@ -283,9 +283,16 @@ class DSPL_OT_ApplyPose(bpy.types.Operator):
|
||||
|
||||
def invoke(self, context, event):
|
||||
if event.ctrl:
|
||||
# Select
|
||||
# Select bones
|
||||
arm_object, pose_library = getArmatureData(context)
|
||||
pose_library.pose_markers.active_index = searchPoseMarker(context, posename=self.posename, type="index")
|
||||
active_marker = searchPoseMarker(context, posename=self.posename, type="marker")
|
||||
|
||||
arm_object.select = True
|
||||
bpy.context.view_layer.objects.active = arm_object
|
||||
bpy.ops.object.mode_set(mode='POSE')
|
||||
selectBonesinPose(context, self.posename, active_marker)
|
||||
|
||||
self.execute(context)
|
||||
return {'FINISHED'}
|
||||
elif event.alt:
|
||||
# Remove
|
||||
|
Reference in New Issue
Block a user