Compare commits
3 Commits
rename-eve
...
34cfaea0c1
Author | SHA1 | Date | |
---|---|---|---|
34cfaea0c1 | |||
5ffe61e81d | |||
95955d2dfd |
24
common.py
24
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
|
||||
@ -62,6 +73,16 @@ def createFcurve(context, bone_name, transform, index_int):
|
||||
pass
|
||||
|
||||
|
||||
def findKeyframe(context, bone, active_frame):
|
||||
arm_object, pose_library = getArmatureData(context)
|
||||
|
||||
for fcu in pose_library.fcurves:
|
||||
if fcu.data_path.startswith('pose.bones["'+bone.name+'"]'):
|
||||
for kp in fcu.keyframe_points:
|
||||
if kp.co.x == active_frame:
|
||||
return fcu.data_path
|
||||
|
||||
|
||||
def createKeyframe(context, bone_name, transform, index_int, new_marker, loc):
|
||||
arm_object, pose_library = getArmatureData(context)
|
||||
pose_markers = pose_library.pose_markers
|
||||
@ -149,6 +170,9 @@ def setBonesfromKeyframes(context, arm_object, active_marker):
|
||||
if bone.bone.select or none_selected == True:
|
||||
bone_name = bone.name
|
||||
|
||||
if findKeyframe(context, bone, active_marker.frame) is None:
|
||||
continue
|
||||
|
||||
if bone.rotation_mode == "XYZ":
|
||||
rot_mode = "rotation_euler"
|
||||
elif bone.rotation_mode == "YZX":
|
||||
|
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