the dope sheet shows blank frames at frame 3 and 5
Asked
Active
Viewed 856 times
0
-
Is the question "how to display the odd numbers in the frame numbers at the bottom of the screen?" Odd numbers exist, they are just not appear on the scale. The scale for the timeline depends on the level of magnification for the window.(https://i.stack.imgur.com/6wdbM.gif ) The green cursor will display the current frame (https://i.stack.imgur.com/iAOrD.gif). – Jun 04 '18 at 17:59
1 Answers
1
answer based on previous question
import bpy
import math
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.object.select_all(action='SELECT')
# get keyframes of object list
def get_keyframes(obj_list):
keyframes = []
for obj in obj_list:
anim = obj.animation_data
if anim is not None and anim.action is not None:
for fcu in anim.action.fcurves:
for keyframe in fcu.keyframe_points:
x, y = keyframe.co
if x not in keyframes:
keyframes.append((math.ceil(x)))
return keyframes
def get_without_keyframes(frames):
s = bpy.context.scene.frame_start
e = bpy.context.scene.frame_end
k =[]
while s <=e:
if s not in frames:
k.append(s)
s+=1
return k
# get all selected objects
selection = bpy.context.selected_objects
# check if selection is not empty
if selection:
# get all frames with assigned keyframes
keys = get_keyframes(selection)
# print all keyframes
print ("WHIT: ",keys.sort())
print ("WHITout: ",get_without_keyframes(keys))
# print first and last keyframe
print ("{} {}".format("first keyframe:", keys[0]))
print ("{} {}".format("last keyframe:", keys[-1]))
else:
print ('nothing selected')
yhoyo
- 2,285
- 13
- 32
