fix some batch reproject issues
1.6.8 - fix: reproject GP repeating projection on same frames - fix: batch reproject all frame not poping dialog menugpv2
parent
ea772b297a
commit
d4ea39fb40
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
1.6.8
|
||||
|
||||
- fix: reproject GP repeating projection on same frames
|
||||
- fix: batch reproject all frame not poping dialog menu
|
||||
|
||||
1.6.7
|
||||
|
||||
- fix: error with operator `OP_key_duplicate_send` poll flooding console
|
||||
|
|
|
@ -33,16 +33,51 @@ def batch_reproject(obj, proj_type='VIEW', all_strokes=True, restore_frame=False
|
|||
|
||||
bpy.ops.object.mode_set(mode='EDIT_GPENCIL')
|
||||
|
||||
|
||||
frame_list = [f.frame_number for l in obj.data.layers for f in l.frames if len(f.strokes)]
|
||||
frame_list = list(set(frame_list))
|
||||
frame_list.sort()
|
||||
for fnum in frame_list:
|
||||
bpy.context.scene.frame_current = fnum
|
||||
bpy.ops.gpencil.select_all(action='SELECT')
|
||||
bpy.ops.gpencil.reproject(type=proj_type) # 'INVOKE_DEFAULT'
|
||||
bpy.ops.gpencil.select_all(action='DESELECT')
|
||||
|
||||
|
||||
#print('fnum: ', fnum)
|
||||
|
||||
# bpy.context.scene.frame_set(fnum)
|
||||
# bpy.context.scene.frame_current = fnum
|
||||
# bpy.ops.gpencil.select_all(action='SELECT')
|
||||
# bpy.ops.gpencil.reproject(type=proj_type) # default is VIEW
|
||||
# # bpy.ops.gpencil.select_all(action='DESELECT')
|
||||
# bpy.ops.object.mode_set(mode='OBJECT')
|
||||
# bpy.ops.object.mode_set(mode='EDIT_GPENCIL')
|
||||
# bpy.context.view_layer.update()
|
||||
|
||||
"""
|
||||
for l in obj.data.layers:
|
||||
for f in l.frames:
|
||||
if not len(f.strokes):
|
||||
continue
|
||||
bpy.context.scene.frame_set(f.frame_number)
|
||||
# bpy.context.scene.frame_current = f.frame_number
|
||||
|
||||
## / attempt update trigger for failing reproject surface mode
|
||||
# bpy.ops.object.mode_set(mode='OBJECT')
|
||||
# bpy.ops.object.mode_set(mode='EDIT_GPENCIL')
|
||||
# bpy.context.view_layer.update()
|
||||
# for a in bpy.context.screen.areas:
|
||||
# a.tag_redraw()
|
||||
# dg = bpy.context.evaluated_depsgraph_get()
|
||||
# obj.evaluated_get(dg)
|
||||
## /
|
||||
|
||||
# switch to edit to reproject through ops
|
||||
bpy.ops.gpencil.select_all(action='SELECT')
|
||||
bpy.ops.gpencil.reproject(type=proj_type) # default is VIEW
|
||||
bpy.ops.gpencil.select_all(action='DESELECT')
|
||||
"""
|
||||
|
||||
# restore
|
||||
if all_strokes:
|
||||
|
@ -356,10 +391,12 @@ class GPTB_OT_batch_reproject_all_frames(bpy.types.Operator):
|
|||
|
||||
def reproject_clean_menu(self, context):
|
||||
if context.mode == 'EDIT_GPENCIL':
|
||||
self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup (also works with 'INVOKE_DEFAULT')
|
||||
self.layout.operator('gp.batch_reproject_all_frames', icon='SMALL_TRI_RIGHT_VEC') # KEYTYPE_JITTER_VEC
|
||||
|
||||
def reproject_context_menu(self, context):
|
||||
if context.mode == 'EDIT_GPENCIL' and context.scene.tool_settings.gpencil_selectmode_edit == 'STROKE':
|
||||
self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup
|
||||
self.layout.operator('gp.batch_reproject_all_frames', icon='SMALL_TRI_RIGHT_VEC') # KEYTYPE_JITTER_VEC
|
||||
|
||||
classes = (
|
||||
|
|
|
@ -15,7 +15,7 @@ bl_info = {
|
|||
"name": "GP toolbox",
|
||||
"description": "Set of tools for Grease Pencil in animation production",
|
||||
"author": "Samuel Bernou, Christophe Seux",
|
||||
"version": (1, 6, 7),
|
||||
"version": (1, 6, 8),
|
||||
"blender": (2, 91, 0),
|
||||
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
||||
"warning": "",
|
||||
|
|
Loading…
Reference in New Issue