fix initial frame offset
- remove bone place after use - add debug flag in operatormaster
parent
13614cec24
commit
23811bf752
|
@ -1,7 +1,7 @@
|
||||||
bl_info = {
|
bl_info = {
|
||||||
"name": "gp interpolate",
|
"name": "gp interpolate",
|
||||||
"author": "Christophe Seux, Samuel Bernou",
|
"author": "Christophe Seux, Samuel Bernou",
|
||||||
"version": (0, 2, 1),
|
"version": (0, 3, 0),
|
||||||
"blender": (3, 6, 0),
|
"blender": (3, 6, 0),
|
||||||
"location": "Sidebar > Gpencil Tab > Interpolate",
|
"location": "Sidebar > Gpencil Tab > Interpolate",
|
||||||
"description": "Interpolate Grease pencil strokes over 3D",
|
"description": "Interpolate Grease pencil strokes over 3D",
|
||||||
|
|
|
@ -47,6 +47,7 @@ class GP_OT_interpolate_stroke(bpy.types.Operator):
|
||||||
next : bpy.props.BoolProperty(name='Next', default=True, options={'SKIP_SAVE'})
|
next : bpy.props.BoolProperty(name='Next', default=True, options={'SKIP_SAVE'})
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
|
debug=False
|
||||||
settings = context.scene.gp_interpo_settings
|
settings = context.scene.gp_interpo_settings
|
||||||
scn = bpy.context.scene
|
scn = bpy.context.scene
|
||||||
|
|
||||||
|
@ -126,15 +127,14 @@ class GP_OT_interpolate_stroke(bpy.types.Operator):
|
||||||
# (bpy.context.scene.render, 'simplify_subdivision', 0),
|
# (bpy.context.scene.render, 'simplify_subdivision', 0),
|
||||||
]
|
]
|
||||||
|
|
||||||
# FIXME : Fix below filter so it does not exclude collections containing rig
|
# TODO : Customize below filter to use in geo mode as well
|
||||||
# Also: Use in Bone mode only
|
# so it does not exclude collections containing rig
|
||||||
|
if settings.method == 'BONE':
|
||||||
## Exclude other collection for faster animation (PROBLEM)
|
for vlc in context.view_layer.layer_collection.children:
|
||||||
# for vlc in context.view_layer.layer_collection.children:
|
store_list.append(
|
||||||
# store_list.append(
|
(vlc, 'exclude', vlc.name not in included_cols),
|
||||||
# (vlc, 'exclude', vlc.name not in included_cols),
|
# (vlc, 'hide_viewport', vlc.name not in included_cols), # viewport viz
|
||||||
# # (vlc, 'hide_viewport', vlc.name not in included_cols), # viewport viz
|
)
|
||||||
# )
|
|
||||||
|
|
||||||
# print(f'Preparation {time()-start:.4f}s')
|
# print(f'Preparation {time()-start:.4f}s')
|
||||||
|
|
||||||
|
@ -221,6 +221,7 @@ class GP_OT_interpolate_stroke(bpy.types.Operator):
|
||||||
|
|
||||||
strokes_data.append(stroke_data)
|
strokes_data.append(stroke_data)
|
||||||
|
|
||||||
|
if debug:
|
||||||
scan_time = time()-start
|
scan_time = time()-start
|
||||||
print(f'Scan time {scan_time:.4f}s')
|
print(f'Scan time {scan_time:.4f}s')
|
||||||
|
|
||||||
|
@ -277,11 +278,18 @@ class GP_OT_interpolate_stroke(bpy.types.Operator):
|
||||||
wm.progress_end() # Pgs
|
wm.progress_end() # Pgs
|
||||||
|
|
||||||
|
|
||||||
## TODO: Remove plane on the fly
|
if debug:
|
||||||
print(f"Paste'n'place time {time()-start - scan_time}s")
|
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:
|
if len(frames_to_jump) > 1:
|
||||||
self.report({'INFO'}, f'{len(frames_to_jump)} interpolated frame(s) ({time()-start:.3f}s)')
|
self.report({'INFO'}, f'{len(frames_to_jump)} interpolated frame(s) ({time()-start:.3f}s)')
|
||||||
print('Done')
|
|
||||||
|
# print('Done')
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
|
7
utils.py
7
utils.py
|
@ -368,12 +368,13 @@ def get_gp_draw_plane(obj=None):
|
||||||
## --- Animation
|
## --- Animation
|
||||||
|
|
||||||
def following_keys(forward=True, all_keys=False) -> list:# -> list[int] | list | None:
|
def following_keys(forward=True, all_keys=False) -> list:# -> list[int] | list | None:
|
||||||
'''return a lsit of int or an empty list'''
|
'''Return a list of int or an empty list'''
|
||||||
direction = 1 if forward else -1
|
direction = 1 if forward else -1
|
||||||
cur_frame = bpy.context.scene.frame_current
|
cur_frame = bpy.context.scene.frame_current
|
||||||
settings = bpy.context.scene.gp_interpo_settings
|
settings = bpy.context.scene.gp_interpo_settings
|
||||||
|
|
||||||
if settings.mode == 'FRAME':
|
if settings.mode == 'FRAME':
|
||||||
|
jump = settings.padding * direction
|
||||||
if all_keys:
|
if all_keys:
|
||||||
scn = bpy.context.scene
|
scn = bpy.context.scene
|
||||||
if forward:
|
if forward:
|
||||||
|
@ -383,10 +384,10 @@ def following_keys(forward=True, all_keys=False) -> list:# -> list[int] | list |
|
||||||
|
|
||||||
limit += direction # offset by one for limit to be in range
|
limit += direction # offset by one for limit to be in range
|
||||||
|
|
||||||
return list(range(cur_frame + direction , limit, settings.padding * direction))
|
return list(range(cur_frame + jump , limit, jump))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return [cur_frame + (settings.padding * direction)]
|
return [cur_frame + jump]
|
||||||
|
|
||||||
elif settings.mode == 'GPKEY':
|
elif settings.mode == 'GPKEY':
|
||||||
layers = bpy.context.object.data.layers
|
layers = bpy.context.object.data.layers
|
||||||
|
|
Loading…
Reference in New Issue