update to gpv3 context modes
parent
f5a78601b6
commit
eae69b6f75
|
@ -58,7 +58,7 @@ class GPTB_OT_brush_set(bpy.types.Operator):
|
|||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.object and context.mode == 'PAINT_GPENCIL'
|
||||
return context.object and context.mode == 'PAINT_GREASE_PENCIL'
|
||||
|
||||
def execute(self, context):
|
||||
brush = bpy.data.brushes.get(self.brush_name)
|
||||
|
@ -72,12 +72,12 @@ class GPTB_OT_brush_set(bpy.types.Operator):
|
|||
|
||||
def load_brush_ui(self, context):
|
||||
prefs = get_addon_prefs()
|
||||
if context.mode == 'PAINT_GPENCIL':
|
||||
if context.mode == 'PAINT_GREASE_PENCIL':
|
||||
self.layout.operator('gp.load_brushes', icon='KEYTYPE_JITTER_VEC').filepath = prefs.brush_path
|
||||
|
||||
def load_brush_top_bar_ui(self, context):
|
||||
prefs = get_addon_prefs()
|
||||
if context.mode == 'PAINT_GPENCIL':
|
||||
if context.mode == 'PAINT_GREASE_PENCIL':
|
||||
self.layout.operator('gp.load_brushes').filepath = prefs.brush_path
|
||||
|
||||
classes = (
|
||||
|
|
|
@ -259,7 +259,7 @@ class GPTB_OT_eraser(Operator):
|
|||
#bpy.data.materials.remove(self.hld_mat)
|
||||
|
||||
|
||||
bpy.ops.object.mode_set(mode='EDIT_GPENCIL')
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
context.scene.tool_settings.gpencil_selectmode_edit = 'POINT'
|
||||
#context.scene.tool_settings.gpencil_selectmode_edit = 'POINT'
|
||||
|
||||
|
@ -358,9 +358,9 @@ class GPTB_OT_eraser(Operator):
|
|||
|
||||
#bpy.ops.object.mode_set(mode='OBJECT')
|
||||
context.scene.tool_settings.gpencil_selectmode_edit = self.gpencil_selectmode_edit
|
||||
bpy.ops.object.mode_set(mode='PAINT_GPENCIL')
|
||||
bpy.ops.object.mode_set(mode='PAINT_GREASE_PENCIL')
|
||||
#selected_strokes = [s for s in self.gp_frame.strokes if s.select]
|
||||
#bpy.ops.object.mode_set(mode='PAINT_GPENCIL')
|
||||
#bpy.ops.object.mode_set(mode='PAINT_GREASE_PENCIL')
|
||||
|
||||
def modal(self, context, event):
|
||||
self.mouse = Vector((event.mouse_region_x, event.mouse_region_y))
|
||||
|
|
|
@ -120,7 +120,7 @@ class GPTB_OT_file_checker(bpy.types.Operator):
|
|||
setattr(area.spaces[0], 'show_locked_time', True)
|
||||
|
||||
## set cursor type
|
||||
if context.mode in ("EDIT_GPENCIL", "SCULPT_GPENCIL"):
|
||||
if context.mode in ("EDIT_GREASE_PENCIL", "SCULPT_GREASE_PENCIL"):
|
||||
tool = fix.select_active_tool
|
||||
if tool != 'none':
|
||||
if bpy.context.workspace.tools.from_space_view3d_mode(bpy.context.mode, create=False).idname != tool:
|
||||
|
|
|
@ -132,12 +132,12 @@ class GPTB_OT_batch_flat_reproject(bpy.types.Operator):
|
|||
### -- MENU ENTRY --
|
||||
|
||||
def flat_reproject_clean_menu(self, context):
|
||||
if context.mode == 'EDIT_GPENCIL':
|
||||
if context.mode == 'EDIT_GREASE_PENCIL':
|
||||
self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup (also works with 'INVOKE_DEFAULT')
|
||||
self.layout.operator('gp.batch_flat_reproject', icon='KEYTYPE_JITTER_VEC')
|
||||
|
||||
def flat_reproject_context_menu(self, context):
|
||||
if context.mode == 'EDIT_GPENCIL' and context.scene.tool_settings.gpencil_selectmode_edit == 'STROKE':
|
||||
if context.mode == 'EDIT_GREASE_PENCIL' and context.scene.tool_settings.gpencil_selectmode_edit == 'STROKE':
|
||||
self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup
|
||||
self.layout.operator('gp.batch_flat_reproject', icon='KEYTYPE_JITTER_VEC')
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ class GPTB_OT_go_to_object(bpy.types.Operator):
|
|||
self.report({'INFO'}, f'Back to pose mode, {obj.name}')
|
||||
|
||||
elif obj.type == 'GREASEPENCIL':
|
||||
bpy.ops.object.mode_set(mode='PAINT_GPENCIL', toggle=False)
|
||||
bpy.ops.object.mode_set(mode='PAINT_GREASE_PENCIL', toggle=False)
|
||||
|
||||
else:
|
||||
self.report({'INFO'}, f'Back to object mode, {obj.name}')
|
||||
|
|
|
@ -557,7 +557,7 @@ def layer_name_builder_ui(self, context):
|
|||
return
|
||||
|
||||
layout = self.layout
|
||||
# {'EDIT_GPENCIL', 'PAINT_GPENCIL','SCULPT_GPENCIL','WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}
|
||||
# {'EDIT_GREASE_PENCIL', 'PAINT_GREASE_PENCIL','SCULPT_GREASE_PENCIL','WEIGHT_GREASE_PENCIL', 'VERTEX_GPENCIL'}
|
||||
# layout.separator()
|
||||
col = layout.column()
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class GP_OT_pick_closest_layer(Operator):
|
|||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.object and context.object.type == 'GREASEPENCIL' and context.mode == 'PAINT_GPENCIL'
|
||||
return context.object and context.object.type == 'GREASEPENCIL' and context.mode == 'PAINT_GREASE_PENCIL'
|
||||
|
||||
stroke_filter : bpy.props.EnumProperty(name='Target',
|
||||
default='STROKE',
|
||||
|
|
|
@ -33,7 +33,7 @@ class GP_OT_pick_closest_material(Operator):
|
|||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.object and context.object.type == 'GREASEPENCIL' and context.mode == 'PAINT_GPENCIL'
|
||||
return context.object and context.object.type == 'GREASEPENCIL' and context.mode == 'PAINT_GREASE_PENCIL'
|
||||
|
||||
fill_only : bpy.props.BoolProperty(default=False, options={'SKIP_SAVE'})
|
||||
|
||||
|
@ -159,7 +159,7 @@ class GP_OT_pick_closest_material(Operator):
|
|||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.object and context.object.type == 'GREASEPENCIL' and context.mode == 'PAINT_GPENCIL'
|
||||
return context.object and context.object.type == 'GREASEPENCIL' and context.mode == 'PAINT_GREASE_PENCIL'
|
||||
|
||||
# fill_only : bpy.props.BoolProperty(default=False, options={'SKIP_SAVE'})
|
||||
stroke_filter : bpy.props.EnumProperty(default='FILL',
|
||||
|
|
|
@ -25,7 +25,7 @@ if all_strokes:
|
|||
l.hide = False
|
||||
l.lock = False
|
||||
l.lock_frame = False
|
||||
bpy.ops.object.mode_set(mode='EDIT_GPENCIL')
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
|
||||
for fnum in frame_list:
|
||||
|
@ -432,12 +432,12 @@ class GPTB_OT_batch_reproject_all_frames(bpy.types.Operator):
|
|||
### -- MENU ENTRY --
|
||||
|
||||
def reproject_clean_menu(self, context):
|
||||
if context.mode == 'EDIT_GPENCIL':
|
||||
if context.mode == 'EDIT_GREASE_PENCIL':
|
||||
self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup (also works with 'INVOKE_DEFAULT')
|
||||
self.layout.operator('gp.batch_reproject_all_frames', icon='KEYTYPE_JITTER_VEC')
|
||||
|
||||
def reproject_context_menu(self, context):
|
||||
if context.mode == 'EDIT_GPENCIL' and context.scene.tool_settings.gpencil_selectmode_edit == 'STROKE':
|
||||
if context.mode == 'EDIT_GREASE_PENCIL' 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='KEYTYPE_JITTER_VEC')
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from .utils import get_addon_prefs
|
|||
|
||||
class GPTB_WT_eraser(WorkSpaceTool):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_context_mode = 'PAINT_GPENCIL'
|
||||
bl_context_mode = 'PAINT_GREASE_PENCIL'
|
||||
|
||||
# The prefix of the idname should be your add-on name.
|
||||
bl_idname = "gp.eraser_tool"
|
||||
|
|
|
@ -425,7 +425,7 @@ def palette_manager_menu(self, context):
|
|||
"""Palette menu to append in existing menu"""
|
||||
# GPENCIL_MT_material_context_menu
|
||||
layout = self.layout
|
||||
# {'EDIT_GPENCIL', 'PAINT_GPENCIL','SCULPT_GPENCIL','WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}
|
||||
# {'EDIT_GREASE_PENCIL', 'PAINT_GREASE_PENCIL','SCULPT_GREASE_PENCIL','WEIGHT_GREASE_PENCIL', 'VERTEX_GPENCIL'}
|
||||
layout.separator()
|
||||
prefs = get_addon_prefs()
|
||||
|
||||
|
@ -658,7 +658,7 @@ class GPTB_PT_tools_grease_pencil_interpolate(Panel):
|
|||
# settings = context.tool_settings.gpencil_interpolate # old 2.92 global settings
|
||||
## access active tool settings
|
||||
# settings = context.workspace.tools[0].operator_properties('gpencil.interpolate')
|
||||
settings = context.workspace.tools.from_space_view3d_mode('PAINT_GPENCIL').operator_properties('gpencil.interpolate')
|
||||
settings = context.workspace.tools.from_space_view3d_mode('PAINT_GREASE_PENCIL').operator_properties('gpencil.interpolate')
|
||||
|
||||
## custom curve access (still in gp interpolate tools)
|
||||
interpolate_settings = context.tool_settings.gpencil_interpolate
|
||||
|
|
Loading…
Reference in New Issue