1 Commits

Author SHA1 Message Date
3dc5cff0a2 Move apply logic to common and eliminate selected bool 2024-12-27 02:28:38 -06:00
2 changed files with 11 additions and 10 deletions

View File

@ -116,7 +116,7 @@ def setKeyframesFromBones(context, arm_object, new_marker):
elif bone.rotation_mode == "QUATERNION": elif bone.rotation_mode == "QUATERNION":
rot_mode = "rotation_quaternion" rot_mode = "rotation_quaternion"
else: else:
self.report({'WARNING'}, "DSPL: Unsupported bone: " + bone.name + ": " + bone.rotation_mode) print("Unsupported bone!")
rot_mode = None rot_mode = None
loc_x = bone.location[0] loc_x = bone.location[0]
@ -181,7 +181,7 @@ def setBonesfromKeyframes(context, arm_object, active_marker):
elif bone.rotation_mode == "QUATERNION": elif bone.rotation_mode == "QUATERNION":
rot_mode = "rotation_quaternion" rot_mode = "rotation_quaternion"
else: else:
self.report({'WARNING'}, "DSPL: Unsupported bone: " + bone.name + ": " + bone.rotation_mode) print("Unsupported bone!")
rot_mode = None rot_mode = None
loc_x = findFcurve(context, bone_name, "location", 0) or 0.0 loc_x = findFcurve(context, bone_name, "location", 0) or 0.0

View File

@ -154,6 +154,7 @@ class DSPL_OT_AddPose(bpy.types.Operator):
# Check for duplicate names # Check for duplicate names
while pose_markers.find(new_name) > -1: while pose_markers.find(new_name) > -1:
print("Duplicate posename detected")
new_name = self.posename + ".{:03d}".format(counter) new_name = self.posename + ".{:03d}".format(counter)
counter += 1 counter += 1
else: else:
@ -167,7 +168,7 @@ class DSPL_OT_AddPose(bpy.types.Operator):
action_object.pose_markers.active = pose_markers[pose_name] action_object.pose_markers.active = pose_markers[pose_name]
bpy.context.area.tag_redraw() bpy.context.area.tag_redraw()
self.report({'INFO'}, "DSPL: Added " + pose_markers[new_name].name + " to frame " + str(pose_markers[new_name].frame)) print("Added pose - " + pose_markers[new_name].name + " to frame " + str(pose_markers[new_name].frame))
else: else:
arm_object = getArmatureObject(context) arm_object = getArmatureObject(context)
@ -191,7 +192,7 @@ class DSPL_OT_AddPose(bpy.types.Operator):
setKeyframesFromBones(context, arm_object, new_marker) setKeyframesFromBones(context, arm_object, new_marker)
self.report({'INFO'}, "DSPL: Replaced " + pose_markers[new_name].name + " on frame " + str(pose_markers[new_name].frame))
return {'FINISHED'} return {'FINISHED'}
@ -237,11 +238,10 @@ class DSPL_OT_RemovePose(bpy.types.Operator):
pose_markers.remove(marker=active_marker) pose_markers.remove(marker=active_marker)
print(next_index)
action_object.pose_markers.active = next_marker action_object.pose_markers.active = next_marker
action_object.pose_markers.active_index = next_index action_object.pose_markers.active_index = next_index
self.report({'INFO'}, "DSPL: Removed " + self.posename)
return {'FINISHED'} return {'FINISHED'}
@ -448,7 +448,7 @@ class DSPL_OT_BrowsePoses(bpy.types.Operator):
self.pose_lib = getPoseLib(context) self.pose_lib = getPoseLib(context)
if self.pose_lib is None: if self.pose_lib is None:
self.report({'WARNING'}, "DSPL: Pose Library not active") self.report({'WARNING'}, "Pose Library not active")
return {'CANCELLED'} return {'CANCELLED'}
self.arm_object.pose.backup_create(self.pose_lib) self.arm_object.pose.backup_create(self.pose_lib)
@ -456,11 +456,12 @@ class DSPL_OT_BrowsePoses(bpy.types.Operator):
bpy.ops.dspl.apply_pose() bpy.ops.dspl.apply_pose()
if context.area.type == 'VIEW_3D': if context.area.type == 'VIEW_3D':
self.report({'INFO'}, "DSPL: Browsing Poses") print("Starting modal")
args = (self, context) args = (self, context)
self._handle = bpy.types.SpaceView3D.draw_handler_add(self.draw_callback_px, args, 'WINDOW', 'POST_PIXEL') self._handle = bpy.types.SpaceView3D.draw_handler_add(self.draw_callback_px, args, 'WINDOW', 'POST_PIXEL')
context.window_manager.modal_handler_add(self) context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'} return {'RUNNING_MODAL'}
print("not in 3d")
return {'CANCELLED'} return {'CANCELLED'}
@ -523,7 +524,7 @@ class DSPL_OT_ProtectOrphanPoseLibrary(bpy.types.Operator):
if orphaned_act: if orphaned_act:
for act in orphaned_act: for act in orphaned_act:
if "_loc" in act.name or "PoseLib" in act.name: if "_loc" in act.name or "PoseLib" in act.name:
self.report({'INFO'}, "DSPL: Protecting orphaned action: " + act.name) print("Protecting orphaned action: " + act.name)
act.use_fake_user = True act.use_fake_user = True
return {'FINISHED'} return {'FINISHED'}