fix initial frame offset

- remove bone place after use
- add debug flag in operator
This commit is contained in:
pullusb
2024-01-11 11:49:10 +01:00
parent 13614cec24
commit 23811bf752
3 changed files with 27 additions and 18 deletions
+22 -14
View File
@@ -47,6 +47,7 @@ class GP_OT_interpolate_stroke(bpy.types.Operator):
next : bpy.props.BoolProperty(name='Next', default=True, options={'SKIP_SAVE'})
def execute(self, context):
debug=False
settings = context.scene.gp_interpo_settings
scn = bpy.context.scene
@@ -126,15 +127,14 @@ class GP_OT_interpolate_stroke(bpy.types.Operator):
# (bpy.context.scene.render, 'simplify_subdivision', 0),
]
# FIXME : Fix below filter so it does not exclude collections containing rig
# Also: Use in Bone mode only
## Exclude other collection for faster animation (PROBLEM)
# for vlc in context.view_layer.layer_collection.children:
# store_list.append(
# (vlc, 'exclude', vlc.name not in included_cols),
# # (vlc, 'hide_viewport', vlc.name not in included_cols), # viewport viz
# )
# TODO : Customize below filter to use in geo mode as well
# so it does not exclude collections containing rig
if settings.method == 'BONE':
for vlc in context.view_layer.layer_collection.children:
store_list.append(
(vlc, 'exclude', vlc.name not in included_cols),
# (vlc, 'hide_viewport', vlc.name not in included_cols), # viewport viz
)
# print(f'Preparation {time()-start:.4f}s')
@@ -221,8 +221,9 @@ class GP_OT_interpolate_stroke(bpy.types.Operator):
strokes_data.append(stroke_data)
scan_time = time()-start
print(f'Scan time {scan_time:.4f}s')
if debug:
scan_time = time()-start
print(f'Scan time {scan_time:.4f}s')
# Copy stroke selection
bpy.ops.gpencil.copy()
@@ -277,11 +278,18 @@ class GP_OT_interpolate_stroke(bpy.types.Operator):
wm.progress_end() # Pgs
## TODO: Remove plane on the fly
print(f"Paste'n'place time {time()-start - scan_time}s")
if debug:
print(f"Paste'n'place time {time()-start - scan_time}s")
else:
if settings.method == 'BONE':
## Remove Plane and it's collection after use
bpy.data.objects.remove(plane)
bpy.data.collections.remove(col)
if len(frames_to_jump) > 1:
self.report({'INFO'}, f'{len(frames_to_jump)} interpolated frame(s) ({time()-start:.3f}s)')
print('Done')
# print('Done')
return {'FINISHED'}