better ui and modal cancel interaction
- add range in ui when animation is checked - fix rig target collection UI - add camera frames in rig mode - fix animated interpolation frame range in rig mode - add redraw timer to refresh view
This commit is contained in:
@@ -191,6 +191,8 @@ def plane_on_bone(bone, arm=None, cam=None, set_rotation=True, mesh=True):
|
||||
plane = bpy.data.objects.get('interpolation_plane')
|
||||
if not plane:
|
||||
plane = create_plane(name='interpolation_plane')
|
||||
# Display type as Wire for a discrete XP
|
||||
plane.display_type = 'WIRE'
|
||||
|
||||
if plane.name not in col.objects:
|
||||
col.objects.link(plane)
|
||||
@@ -394,18 +396,18 @@ def following_keys(forward=True, all_keys=False) -> list:# -> list[int] | list |
|
||||
direction = 1 if forward else -1
|
||||
cur_frame = bpy.context.scene.frame_current
|
||||
settings = bpy.context.scene.gp_interpo_settings
|
||||
|
||||
|
||||
scn = bpy.context.scene
|
||||
if forward:
|
||||
limit = scn.frame_preview_end if scn.use_preview_range else scn.frame_end
|
||||
else:
|
||||
limit = scn.frame_preview_start if scn.use_preview_range else scn.frame_start
|
||||
|
||||
frames = []
|
||||
if settings.mode == 'FRAME':
|
||||
jump = settings.padding * direction
|
||||
if all_keys:
|
||||
scn = bpy.context.scene
|
||||
if forward:
|
||||
limit = scn.frame_preview_end if scn.use_preview_range else scn.frame_end
|
||||
else:
|
||||
limit = scn.frame_preview_start if scn.use_preview_range else scn.frame_start
|
||||
|
||||
limit += direction # offset by one for limit to be in range
|
||||
|
||||
return list(range(cur_frame + jump , limit, jump))
|
||||
|
||||
else:
|
||||
@@ -419,10 +421,17 @@ def following_keys(forward=True, all_keys=False) -> list:# -> list[int] | list |
|
||||
col = settings.target_collection
|
||||
if not col:
|
||||
col = bpy.context.scene.collection
|
||||
for arm in [o for o in col.all_objects if o.type == 'ARMATURE']:
|
||||
if not arm.animation_data or not arm.animation_data.action:
|
||||
|
||||
objs = [o for o in col.all_objects if o.type == 'ARMATURE']
|
||||
# Add camera moves detection
|
||||
objs += [bpy.context.scene.camera]
|
||||
|
||||
for obj in objs:
|
||||
print(obj.name)
|
||||
if not obj.animation_data or not obj.animation_data.action:
|
||||
continue
|
||||
frames = [k.co.x for fc in arm.animation_data.action.fcurves for k in fc.keyframe_points]
|
||||
frames += [k.co.x for fc in obj.animation_data.action.fcurves for k in fc.keyframe_points]
|
||||
|
||||
|
||||
if not frames:
|
||||
return []
|
||||
@@ -433,9 +442,9 @@ def following_keys(forward=True, all_keys=False) -> list:# -> list[int] | list |
|
||||
if all_keys:
|
||||
frames = list(set(frames))
|
||||
if forward:
|
||||
frame_list = [int(f) for f in frames if f > cur_frame]
|
||||
frame_list = [int(f) for f in frames if f > cur_frame and f <= limit]
|
||||
else:
|
||||
frame_list = [int(f) for f in frames if f < cur_frame]
|
||||
frame_list = [int(f) for f in frames if f < cur_frame and f >= limit]
|
||||
return frame_list
|
||||
|
||||
if forward:
|
||||
|
||||
Reference in New Issue
Block a user