It deletes location rotation and scale keyframes fine but when I set a shader property like roughness and set key frame… it won’t delete those keyframes …any help is appreciated on this i’ve been trying to figure this out for awhile and I can’t find anything online… yeah if you can make it so it deletes no matter what keyframe I throw at it even graph editor and dope sheet that would be cool
class FAST_OT_delete_keyframe(bpy.types.Operator):
"""Deletes keyframe(s) from the selected object(s)."""
bl_idname = "fast.delete_keyframe"
bl_label = "Delete Keyframe"
bl_options = {"REGISTER", "UNDO"}
@classmethod
def poll(cls, context):
return len(context.selected_objects) == 1 and \
(context.area.type == 'DOPESHEET_EDITOR' or context.area.type == 'GRAPH_EDITOR' or context.area.type == 'TIMELINE')
def execute(self, context):
obj = context.selected_objects[0]
# ensure animation data and action exist
if obj.animation_data and obj.animation_data.action:
fcurves = obj.animation_data.action.fcurves
# iterate over all fcurves of the action
for fcurve in fcurves:
# use a while-loop to safely remove selected keyframes
i = 0
while i < len(fcurve.keyframe_points):
if fcurve.keyframe_points[i].select_control_point:
fcurve.keyframe_points.remove(fcurve.keyframe_points[i])
else:
i += 1
self.report({'INFO'}, "Selected keyframe(s) removed.")
else:
self.report({'INFO'}, "No keyframes to delete.")
# force a redraw of the UI regardless of whether keyframes are deleted
for area in bpy.context.screen.areas:
if area.type in {'DOPESHEET_EDITOR', 'GRAPH_EDITOR', 'TIMELINE'}:
area.tag_redraw()
return {'FINISHED'}