diff --git a/GP_guided_colorize/OP_create_empty_frames.py b/GP_guided_colorize/OP_create_empty_frames.py index 79aa9b8..63d6c8b 100644 --- a/GP_guided_colorize/OP_create_empty_frames.py +++ b/GP_guided_colorize/OP_create_empty_frames.py @@ -57,7 +57,7 @@ class GP_OT_create_empty_frames(bpy.types.Operator): @classmethod def poll(cls, context): - return context.active_object is not None and context.active_object.type == 'GPENCIL' + return context.active_object is not None and context.active_object.type == 'GREASEPENCIL' def invoke(self, context, event): # Possible preset with shortcut diff --git a/GP_guided_colorize/OP_line_closer.py b/GP_guided_colorize/OP_line_closer.py index 8ebcb0d..dc35af3 100644 --- a/GP_guided_colorize/OP_line_closer.py +++ b/GP_guided_colorize/OP_line_closer.py @@ -111,7 +111,7 @@ def create_gap_stroke(f, ob, tol=10, mat_id=None): def create_closing_line(tolerance=0.2): for ob in bpy.context.selected_objects: - if ob.type != 'GPENCIL': + if ob.type != 'GREASEPENCIL': continue mat_id = get_closeline_mat(ob)# get a the closing material @@ -241,7 +241,7 @@ class GPSTK_OT_extend_lines(bpy.types.Operator): @classmethod def poll(cls, context): - return context.active_object is not None and context.active_object.type == 'GPENCIL' + return context.active_object is not None and context.active_object.type == 'GREASEPENCIL' # mode : bpy.props.StringProperty( # name="mode", description="Set mode for operator", default="render", maxlen=0, subtype='NONE', options={'ANIMATABLE'}) @@ -306,7 +306,7 @@ class GPSTK_OT_change_closeline_length(bpy.types.Operator): @classmethod def poll(cls, context): - return context.active_object is not None and context.active_object.type == 'GPENCIL' + return context.active_object is not None and context.active_object.type == 'GREASEPENCIL' layer_tgt : bpy.props.EnumProperty( name="Extend layers", description="Choose which layer to target", @@ -367,7 +367,7 @@ class GPSTK_OT_comma_finder(bpy.types.Operator): @classmethod def poll(cls, context): - return context.active_object is not None and context.active_object.type == 'GPENCIL' + return context.active_object is not None and context.active_object.type == 'GREASEPENCIL' def execute(self, context): ct = 0 @@ -397,7 +397,7 @@ class GPSTK_PT_line_closer_panel(bpy.types.Panel): @classmethod def poll(cls, context): - return (context.object is not None)# and context.object.type == 'GPENCIL' + return (context.object is not None)# and context.object.type == 'GREASEPENCIL' ## draw stuff inside the header (place before main label) # def draw_header(self, context): @@ -414,7 +414,7 @@ class GPSTK_PT_line_closer_panel(bpy.types.Panel): layout.operator("gp.extend_close_lines", icon = 'SNAP_MIDPOINT') #diplay closeline visibility - if context.object.type == 'GPENCIL' and context.object.data.materials.get('closeline'): + if context.object.type == 'GREASEPENCIL' and context.object.data.materials.get('closeline'): row=layout.row() row.prop(context.object.data.materials['closeline'].grease_pencil, 'hide', text='Stop lines') row.operator("gp.change_close_lines_extension", text='Length', icon = 'DRIVER_DISTANCE') diff --git a/OP_brushes.py b/OP_brushes.py index d8db3ae..f24dcd5 100644 --- a/OP_brushes.py +++ b/OP_brushes.py @@ -27,7 +27,7 @@ class GPTB_OT_load_brushes(bpy.types.Operator, ImportHelper): # @classmethod # def poll(cls, context): - # return context.object and context.object.type == 'GPENCIL' + # return context.object and context.object.type == 'GREASEPENCIL' filename_ext = '.blend' diff --git a/OP_copy_paste.py b/OP_copy_paste.py index 48d86e2..cd64426 100644 --- a/OP_copy_paste.py +++ b/OP_copy_paste.py @@ -423,10 +423,10 @@ class GPCLIP_OT_copy_strokes(bpy.types.Operator): #copy = bpy.props.BoolProperty(default=True) @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): - # if not context.object or not context.object.type == 'GPENCIL': + # if not context.object or not context.object.type == 'GREASEPENCIL': # self.report({'ERROR'},'No GP object selected') # return {"CANCELLED"} @@ -452,10 +452,10 @@ class GPCLIP_OT_cut_strokes(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): - # if not context.object or not context.object.type == 'GPENCIL': + # if not context.object or not context.object.type == 'GREASEPENCIL': # self.report({'ERROR'},'No GP object selected') # return {"CANCELLED"} @@ -477,10 +477,10 @@ class GPCLIP_OT_paste_strokes(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): - # if not context.object or not context.object.type == 'GPENCIL': + # if not context.object or not context.object.type == 'GREASEPENCIL': # self.report({'ERROR'},'No GP object selected to paste on') # return {"CANCELLED"} @@ -510,7 +510,7 @@ class GPCLIP_OT_copy_multi_strokes(bpy.types.Operator): #copy = bpy.props.BoolProperty(default=True) @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' pressure : bpy.props.BoolProperty(name='pressure', default=True, description='Dump point pressure attribute (already skipped if at default value)') @@ -633,7 +633,7 @@ class GPCLIP_OT_paste_multi_strokes(bpy.types.Operator): #copy = bpy.props.BoolProperty(default=True) @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): org_frame = context.scene.frame_current diff --git a/OP_cursor_snap_canvas.py b/OP_cursor_snap_canvas.py index 5c4a85c..3135233 100644 --- a/OP_cursor_snap_canvas.py +++ b/OP_cursor_snap_canvas.py @@ -13,7 +13,7 @@ class GPTB_OT_cusor_snap(bpy.types.Operator): # @classmethod # def poll(cls, context): - # return context.object and context.object.type == 'GPENCIL' + # return context.object and context.object.type == 'GREASEPENCIL' def invoke(self, context, event): #print('-!SNAP!-') @@ -23,7 +23,7 @@ class GPTB_OT_cusor_snap(bpy.types.Operator): return {"FINISHED"} def execute(self, context): - if not context.object or context.object.type != 'GPENCIL': + if not context.object or context.object.type != 'GREASEPENCIL': self.report({'INFO'}, 'Not GP, Cursor surface project') bpy.ops.view3d.cursor3d('INVOKE_DEFAULT', use_depth=True, orientation='NONE')#'NONE', 'VIEW', 'XFORM', 'GEOM' return {"FINISHED"} diff --git a/OP_file_checker.py b/OP_file_checker.py index f652265..4253f7a 100755 --- a/OP_file_checker.py +++ b/OP_file_checker.py @@ -145,7 +145,7 @@ class GPTB_OT_file_checker(bpy.types.Operator): ## GP Use light disable if fix.set_gp_use_lights_off: - gp_with_lights = [o for o in context.scene.objects if o.type == 'GPENCIL' and o.use_grease_pencil_lights] + gp_with_lights = [o for o in context.scene.objects if o.type == 'GREASEPENCIL' and o.use_grease_pencil_lights] if gp_with_lights: problems.append(f'Disable "Use Lights" on {len(gp_with_lights)} Gpencil objects') if apply: @@ -181,7 +181,7 @@ class GPTB_OT_file_checker(bpy.types.Operator): if fix.list_gp_mod_vis_conflict: mod_viz_ct = 0 for o in context.scene.objects: - if o.type == 'GPENCIL': + if o.type == 'GREASEPENCIL': for m in o.grease_pencil_modifiers: if m.show_viewport != m.show_render: vp = 'Yes' if m.show_viewport else 'No' @@ -201,7 +201,7 @@ class GPTB_OT_file_checker(bpy.types.Operator): ## check if GP modifier have broken layer targets if fix.list_broken_mod_targets: - for o in [o for o in bpy.context.scene.objects if o.type == 'GPENCIL']: + for o in [o for o in bpy.context.scene.objects if o.type == 'GREASEPENCIL']: lay_name_list = [l.info for l in o.data.layers] for m in o.grease_pencil_modifiers: if not hasattr(m, 'layer'): @@ -277,7 +277,7 @@ class GPTB_OT_file_checker(bpy.types.Operator): # problems.append(f"{fix_kf_type} GP onion skin filter to 'All type'") # for ob in context.scene.objects:#from object - # if ob.type == 'GPENCIL': + # if ob.type == 'GREASEPENCIL': # ob.data.onion_keyframe_type = 'ALL' #### --- print fix/problems report @@ -574,7 +574,7 @@ class GPTB_OT_list_modifier_visibility(bpy.types.Operator): def invoke(self, context, event): self.ob_list = [] for o in context.scene.objects: - if o.type != 'GPENCIL': + if o.type != 'GREASEPENCIL': continue if not len(o.grease_pencil_modifiers): continue @@ -612,7 +612,7 @@ class GPTB_OT_list_modifier_visibility(bpy.types.Operator): def invoke(self, context, event): self.ob_list = [] for o in context.scene.objects: - if o.type == 'GPENCIL': + if o.type == 'GREASEPENCIL': if not len(o.grease_pencil_modifiers): continue mods = [] diff --git a/OP_flat_reproject.py b/OP_flat_reproject.py index c8eb260..b7d4ef3 100644 --- a/OP_flat_reproject.py +++ b/OP_flat_reproject.py @@ -119,11 +119,11 @@ class GPTB_OT_batch_flat_reproject(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): for o in context.selected_objects: - if o.type != 'GPENCIL' or not o.select_get(): + if o.type != 'GREASEPENCIL' or not o.select_get(): continue batch_flat_reproject(o) diff --git a/OP_follow_curve.py b/OP_follow_curve.py index bdb5f0e..9c1e573 100644 --- a/OP_follow_curve.py +++ b/OP_follow_curve.py @@ -135,7 +135,7 @@ class GPTB_OT_go_to_object(bpy.types.Operator): bpy.ops.object.mode_set(mode='POSE', toggle=False) self.report({'INFO'}, f'Back to pose mode, {obj.name}') - elif obj.type == 'GPENCIL': + elif obj.type == 'GREASEPENCIL': bpy.ops.object.mode_set(mode='PAINT_GPENCIL', toggle=False) else: diff --git a/OP_helpers.py b/OP_helpers.py index c1e7238..dbb02f6 100644 --- a/OP_helpers.py +++ b/OP_helpers.py @@ -79,7 +79,7 @@ class GPTB_OT_rename_data_from_obj(Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): if not self.rename_all: @@ -93,7 +93,7 @@ class GPTB_OT_rename_data_from_obj(Operator): else: oblist = [] for o in context.scene.objects: - if o.type == 'GPENCIL': + if o.type == 'GREASEPENCIL': if o.name == o.data.name: continue oblist.append(f'{o.data.name} -> {o.name}') @@ -250,7 +250,7 @@ class GPTB_OT_draw_cam(Operator): drawcam.parent = act vec = Vector((0,1,0)) - if act.type == 'GPENCIL': + if act.type == 'GREASEPENCIL': #change vector according to alignement vec = get_gp_alignement_vector(context) @@ -427,15 +427,15 @@ class GPTB_OT_toggle_mute_animation(Operator): pool = context.scene.objects for o in pool: - if self.mode == 'GPENCIL' and o.type != 'GPENCIL': + if self.mode == 'GREASEPENCIL' and o.type != 'GREASEPENCIL': continue - if self.mode == 'OBJECT' and o.type in ('GPENCIL', 'CAMERA'): + if self.mode == 'OBJECT' and o.type in ('GREASEPENCIL', 'CAMERA'): continue if self.mode == 'CAMERA' and o.type != 'CAMERA': continue # mute attribute animation for GP and cameras - if o.type in ('GPENCIL', 'CAMERA') and o.data.animation_data: + if o.type in ('GREASEPENCIL', 'CAMERA') and o.data.animation_data: gp_act = o.data.animation_data.action if gp_act: print(f'\n---{o.name} data:') @@ -473,7 +473,7 @@ class GPTB_OT_toggle_hide_gp_modifier(Operator): else: pool = context.scene.objects for o in pool: - if o.type != 'GPENCIL': + if o.type != 'GREASEPENCIL': continue for m in o.grease_pencil_modifiers: # skip modifier that are not visible in render @@ -506,12 +506,12 @@ class GPTB_OT_list_disabled_anims(Operator): pool = context.scene.objects for o in pool: - # if self.skip_gp and o.type == 'GPENCIL': + # if self.skip_gp and o.type == 'GREASEPENCIL': # continue - # if self.skip_obj and o.type != 'GPENCIL': + # if self.skip_obj and o.type != 'GREASEPENCIL': # continue - if o.type == 'GPENCIL': + if o.type == 'GREASEPENCIL': if o.data.animation_data: gp_act = o.data.animation_data.action if gp_act: @@ -611,7 +611,7 @@ class GPTB_OT_clear_active_frame(Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): obj = context.object @@ -644,7 +644,7 @@ class GPTB_OT_check_canvas_alignement(Operator): @classmethod def poll(cls, context): # if lock_axis is 'VIEW' then the draw axis is always aligned - return context.object and context.object.type == 'GPENCIL'# and context.scene.tool_settings.gpencil_sculpt.lock_axis != 'VIEW' + return context.object and context.object.type == 'GREASEPENCIL'# and context.scene.tool_settings.gpencil_sculpt.lock_axis != 'VIEW' def execute(self, context): if context.scene.tool_settings.gpencil_sculpt.lock_axis == 'VIEW': @@ -673,7 +673,7 @@ class GPTB_OT_step_select_frames(Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' start : bpy.props.IntProperty(name='Start Frame', description='Start frame of the step animation', diff --git a/OP_key_duplicate_send.py b/OP_key_duplicate_send.py index 6c1c915..aeb4fb1 100644 --- a/OP_key_duplicate_send.py +++ b/OP_key_duplicate_send.py @@ -40,8 +40,8 @@ class GPTB_OT_duplicate_send_to_layer(Operator) : @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL'\ - and context.space_data.bl_rna.identifier == 'SpaceDopeSheetEditor' and context.space_data.ui_mode == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL'\ + and context.space_data.bl_rna.identifier == 'SpaceDopeSheetEditor' and context.space_data.ui_mode == 'GREASEPENCIL' # history : bpy.props.StringProperty(default='', options={'SKIP_SAVE'}) # need to have a variable to store (to get it in self) @@ -131,7 +131,7 @@ def unregister_keymaps(): def menu_duplicate_and_send_to_layer(self, context): - if context.space_data.ui_mode == 'GPENCIL': + if context.space_data.ui_mode == 'GREASEPENCIL': self.layout.operator_context = 'INVOKE_REGION_WIN' self.layout.operator('gp.duplicate_send_to_layer', text='Move Keys To Layer').delete_source = True self.layout.operator('gp.duplicate_send_to_layer', text='Copy Keys To Layer') diff --git a/OP_keyframe_jump.py b/OP_keyframe_jump.py index 1b5fa20..7d1484e 100644 --- a/OP_keyframe_jump.py +++ b/OP_keyframe_jump.py @@ -10,7 +10,7 @@ class GPTB_OT_jump_gp_keyframe(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' next : BoolProperty( name="Next GP keyframe", description="Go to next active GP keyframe", diff --git a/OP_layer_manager.py b/OP_layer_manager.py index fc31069..73fd7e2 100644 --- a/OP_layer_manager.py +++ b/OP_layer_manager.py @@ -261,9 +261,9 @@ def build_layers_targets_from_dopesheet(context): if dopeset.show_only_selected: - pool = [o for o in context.selected_objects if o.type == 'GPENCIL'] + pool = [o for o in context.selected_objects if o.type == 'GREASEPENCIL'] else: - pool = [o for o in context.scene.objects if o.type == 'GPENCIL'] + pool = [o for o in context.scene.objects if o.type == 'GREASEPENCIL'] if not dopeset.show_hidden: pool = [o for o in pool if o.visible_get()] @@ -292,7 +292,7 @@ class GPTB_OT_select_set_same_prefix(Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' mode : EnumProperty(default='SELECT', options={'SKIP_SAVE'}, items=( @@ -380,7 +380,7 @@ class GPTB_OT_select_set_same_color(Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' mode : EnumProperty(default='SELECT', options={'SKIP_SAVE'}, items=( @@ -507,7 +507,7 @@ class GPTB_OT_rename_gp_layer(Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' find: StringProperty(name="Find", description="Name to replace", default="", maxlen=0, options={'ANIMATABLE'}, subtype='NONE') replace: StringProperty(name="Repl", description="New name placed", default="", maxlen=0, options={'ANIMATABLE'}, subtype='NONE') @@ -633,7 +633,7 @@ def gpencil_dopesheet_header(self, context): '''to append in DOPESHEET_HT_header''' layout = self.layout st = context.space_data - if st.mode != 'GPENCIL': + if st.mode != 'GREASEPENCIL': return row = layout.row(align=True) @@ -653,7 +653,7 @@ def gpencil_layer_dropdown_menu(self, context): def obj_layer_name_callback(): '''assign layer name properties so user an tweak it''' ob = bpy.context.object - if not ob or ob.type != 'GPENCIL': + if not ob or ob.type != 'GREASEPENCIL': return if not ob.data.layers.active: return @@ -736,7 +736,7 @@ class GPTB_OT_add_gp_layer_with_rename(Operator): bl_options = {"REGISTER", "UNDO"} @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): add_layer(context) @@ -750,7 +750,7 @@ class GPTB_OT_add_gp_layer(Operator): bl_options = {"REGISTER", "UNDO"} @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): add_layer(context) diff --git a/OP_layer_picker.py b/OP_layer_picker.py index d4e46f3..675506b 100644 --- a/OP_layer_picker.py +++ b/OP_layer_picker.py @@ -14,7 +14,7 @@ class GP_OT_pick_closest_layer(Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' and context.mode == 'PAINT_GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' and context.mode == 'PAINT_GPENCIL' stroke_filter : bpy.props.EnumProperty(name='Target', default='STROKE', diff --git a/OP_material_move_to_layer.py b/OP_material_move_to_layer.py index 03addb1..57f7b8d 100644 --- a/OP_material_move_to_layer.py +++ b/OP_material_move_to_layer.py @@ -39,7 +39,7 @@ class GPTB_OT_move_material_to_layer(Operator) : @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def invoke(self, context, event): if self.layer_name: @@ -82,7 +82,7 @@ class GPTB_OT_move_material_to_layer(Operator) : return {'CANCELLED'} ## Active + selection - pool = [o for o in bpy.context.selected_objects if o.type == 'GPENCIL'] + pool = [o for o in bpy.context.selected_objects if o.type == 'GREASEPENCIL'] if not context.object in pool: pool.append(context.object) @@ -165,7 +165,7 @@ class GPTB_OT_move_material_to_layer(Operator) : # def menu_duplicate_and_send_to_layer(self, context): -# if context.space_data.ui_mode == 'GPENCIL': +# if context.space_data.ui_mode == 'GREASEPENCIL': # self.layout.operator_context = 'INVOKE_REGION_WIN' # self.layout.operator('gp.duplicate_send_to_layer', text='Move Keys To Layer').delete_source = True # self.layout.operator('gp.duplicate_send_to_layer', text='Copy Keys To Layer') diff --git a/OP_material_picker.py b/OP_material_picker.py index f78b6c5..e7d9ea5 100644 --- a/OP_material_picker.py +++ b/OP_material_picker.py @@ -33,7 +33,7 @@ class GP_OT_pick_closest_material(Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' and context.mode == 'PAINT_GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' and context.mode == 'PAINT_GPENCIL' 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 == 'GPENCIL' and context.mode == 'PAINT_GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' and context.mode == 'PAINT_GPENCIL' # fill_only : bpy.props.BoolProperty(default=False, options={'SKIP_SAVE'}) stroke_filter : bpy.props.EnumProperty(default='FILL', diff --git a/OP_palettes.py b/OP_palettes.py index 8c64d0a..f69aff7 100644 --- a/OP_palettes.py +++ b/OP_palettes.py @@ -42,7 +42,7 @@ class GPTB_OT_load_default_palette(bpy.types.Operator): # path_to_pal : bpy.props.StringProperty(name="paht to palette", description="path to the palette", default="") @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): # Start Clean (delete unuesed sh*t) @@ -82,7 +82,7 @@ class GPTB_OT_load_palette(bpy.types.Operator, ImportHelper): # path_to_pal : bpy.props.StringProperty(name="paht to palette", description="path to the palette", default="") @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' filename_ext = '.json' @@ -110,7 +110,7 @@ class GPTB_OT_save_palette(bpy.types.Operator, ExportHelper): # path_to_pal : bpy.props.StringProperty(name="paht to palette", description="path to the palette", default="") @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' filter_glob: bpy.props.StringProperty(default='*.json', options={'HIDDEN'})#*.jpg;*.jpeg;*.png;*.tif;*.tiff;*.bmp @@ -169,7 +169,7 @@ def load_blend_palette(context, filepath): print(f'-- import palette from : {filepath} --') for ob in context.selected_objects: - if ob.type != 'GPENCIL': + if ob.type != 'GREASEPENCIL': print(f'{ob.name} not a GP object') continue @@ -224,7 +224,7 @@ class GPTB_OT_load_blend_palette(bpy.types.Operator, ImportHelper): # path_to_pal : bpy.props.StringProperty(name="paht to palette", description="path to the palette", default="") @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' filename_ext = '.blend' @@ -252,7 +252,7 @@ class GPTB_OT_copy_active_to_selected_palette(bpy.types.Operator): # path_to_pal : bpy.props.StringProperty(name="paht to palette", description="path to the palette", default="") @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def execute(self, context): ob = context.object @@ -260,7 +260,7 @@ class GPTB_OT_copy_active_to_selected_palette(bpy.types.Operator): self.report({'ERROR'}, 'No materials to transfer') return {"CANCELLED"} - selection = [o for o in context.selected_objects if o.type == 'GPENCIL' and o != ob] + selection = [o for o in context.selected_objects if o.type == 'GREASEPENCIL' and o != ob] if not selection: self.report({'ERROR'}, 'Need to have other Grease pencil objects selected to receive active object materials') @@ -313,7 +313,7 @@ class GPTB_OT_clean_material_stack(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' def invoke(self, context, event): self.ob = context.object @@ -354,7 +354,7 @@ class GPTB_OT_clean_material_stack(bpy.types.Operator): import re diff_ct = 0 todel = [] - if ob.type != 'GPENCIL': + if ob.type != 'GREASEPENCIL': return if not hasattr(ob, 'material_slots'): return diff --git a/OP_palettes_linker.py b/OP_palettes_linker.py index 46c2093..bd0d85a 100644 --- a/OP_palettes_linker.py +++ b/OP_palettes_linker.py @@ -45,7 +45,7 @@ class GPTB_OT_import_obj_palette(Operator): def execute(self, context): ## get targets - selection = [o for o in context.selected_objects if o.type == 'GPENCIL'] + selection = [o for o in context.selected_objects if o.type == 'GREASEPENCIL'] if not selection: self.report({'ERROR'}, 'Need to have at least one GP object selected in scene') return {"CANCELLED"} @@ -98,7 +98,7 @@ class GPTB_OT_import_obj_palette(Operator): return {"CANCELLED"} for i in range(len(linked_objs))[::-1]: # reversed(range(len(l))) / range(len(l))[::-1] - if linked_objs[i].type != 'GPENCIL': + if linked_objs[i].type != 'GREASEPENCIL': print(f'{linked_objs[i].name} type is "{linked_objs[i].type}"') bpy.data.objects.remove(linked_objs.pop(i)) diff --git a/OP_realign.py b/OP_realign.py index 2016b6c..9f74ebf 100644 --- a/OP_realign.py +++ b/OP_realign.py @@ -267,7 +267,7 @@ class GPTB_OT_realign(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' reproject : bpy.props.BoolProperty( name='Reproject', default=True, @@ -365,7 +365,7 @@ class GPTB_OT_batch_reproject_all_frames(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object and context.object.type == 'GPENCIL' + return context.object and context.object.type == 'GREASEPENCIL' all_strokes : bpy.props.BoolProperty( name='All Strokes', default=True, diff --git a/UI_tools.py b/UI_tools.py index b9d5fe6..400cbc0 100644 --- a/UI_tools.py +++ b/UI_tools.py @@ -144,7 +144,7 @@ class GPTB_PT_sidebar_panel(Panel): col.prop(context.scene.gptoolprops, 'keyframe_type', text='Jump On') # Keyframe Jump # col.prop(context.space_data.overlay, 'use_gpencil_onion_skin') # not often used - if context.object and context.object.type == 'GPENCIL': + if context.object and context.object.type == 'GREASEPENCIL': # col.prop(context.object.data, 'use_autolock_layers') # not often used col.prop(context.object, 'show_in_front') # text='In Front' @@ -191,23 +191,23 @@ class GPTB_PT_anim_manager(Panel): # import time # t0 = time.perf_counter() - # objs = [o for o in context.scene.objects if o.type not in ('GPENCIL', 'CAMERA')] - # gps = [o for o in context.scene.objects if o.type == 'GPENCIL'] + # objs = [o for o in context.scene.objects if o.type not in ('GREASEPENCIL', 'CAMERA')] + # gps = [o for o in context.scene.objects if o.type == 'GREASEPENCIL'] # cams = [o for o in context.scene.objects if o.type == 'CAMERA'] objs = [] gps = [] cams = [] for o in context.scene.objects: - if o.type not in ('GPENCIL', 'CAMERA'): + if o.type not in ('GREASEPENCIL', 'CAMERA'): objs.append(o) - elif o.type == 'GPENCIL': + elif o.type == 'GREASEPENCIL': gps.append(o) elif o.type == 'CAMERA': cams.append(o) # print(f'{time.perf_counter() - t0:.8f}s') - return {'OBJECT': objs, 'GPENCIL': gps, 'CAMERA': cams} + return {'OBJECT': objs, 'GREASEPENCIL': gps, 'CAMERA': cams} def draw(self, context): @@ -221,7 +221,7 @@ class GPTB_PT_anim_manager(Panel): col.operator('gp.list_disabled_anims') ## Show Enable / Disable anims - for cat, cat_type in [('Obj anims:', 'OBJECT'), ('Cam anims:', 'CAMERA'), ('Gp anims:', 'GPENCIL')]: + for cat, cat_type in [('Obj anims:', 'OBJECT'), ('Cam anims:', 'CAMERA'), ('Gp anims:', 'GREASEPENCIL')]: on_icon, off_icon = anim_status(obj_types[cat_type]) subcol = col.column() @@ -242,7 +242,7 @@ class GPTB_PT_anim_manager(Panel): row = subcol.row(align=True) row.label(text='Gp modifiers:') - on_icon, off_icon = gp_modifier_status(obj_types['GPENCIL']) + on_icon, off_icon = gp_modifier_status(obj_types['GREASEPENCIL']) # subcol.alert = off_icon == 'LAYER_ACTIVE' # Turn red row.operator('gp.toggle_hide_gp_modifier', text='ON', icon=on_icon).show = True row.operator('gp.toggle_hide_gp_modifier', text='OFF', icon=off_icon).show = False @@ -734,7 +734,7 @@ def interpolate_header_ui(self, context): layout = self.layout obj = context.active_object - if obj and obj.type == 'GPENCIL' and context.gpencil_data: + if obj and obj.type == 'GREASEPENCIL' and context.gpencil_data: gpd = context.gpencil_data else: return diff --git a/__init__.py b/__init__.py index 59b3dbb..d71a6bd 100755 --- a/__init__.py +++ b/__init__.py @@ -4,8 +4,8 @@ bl_info = { "name": "GP toolbox", "description": "Tool set for Grease Pencil in animation production", "author": "Samuel Bernou, Christophe Seux", -"version": (3, 3, 0), -"blender": (4, 0, 0), +"version": (4, 0, 0), +"blender": (4, 3, 0), "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "warning": "", "doc_url": "https://git.autourdeminuit.com/autour_de_minuit/gp_toolbox", diff --git a/properties.py b/properties.py index 10cb2f2..31b7a1b 100755 --- a/properties.py +++ b/properties.py @@ -21,7 +21,7 @@ def update_layer_name(self, context): if not self.layer_name: # never replace by nothing (since there should be prefix/suffix) return - if not context.object or context.object.type != 'GPENCIL': + if not context.object or context.object.type != 'GREASEPENCIL': return if not context.object.data.layers.active: return diff --git a/utils.py b/utils.py index 05914ea..f796462 100644 --- a/utils.py +++ b/utils.py @@ -372,24 +372,24 @@ def create_gp_palette(gp_data_block,info) : def get_gp_objects(selection=True): '''return selected objects or only the active one''' - if not bpy.context.active_object or bpy.context.active_object.type != 'GPENCIL': + if not bpy.context.active_object or bpy.context.active_object.type != 'GREASEPENCIL': print('No active GP object') return [] active = bpy.context.active_object if selection: - selection = [o for o in bpy.context.selected_objects if o.type == 'GPENCIL'] + selection = [o for o in bpy.context.selected_objects if o.type == 'GREASEPENCIL'] if not active in selection: selection += [active] return selection - if bpy.context.active_object and bpy.context.active_object.type == 'GPENCIL': + if bpy.context.active_object and bpy.context.active_object.type == 'GREASEPENCIL': return [active] return [] def get_gp_datas(selection=True): '''return selected objects or only the active one''' - if not bpy.context.active_object or bpy.context.active_object.type != 'GPENCIL': + if not bpy.context.active_object or bpy.context.active_object.type != 'GREASEPENCIL': print('No active GP object') return [] @@ -397,15 +397,15 @@ def get_gp_datas(selection=True): if selection: selected = [] for o in bpy.context.selected_objects: - if o.type == 'GPENCIL': + if o.type == 'GREASEPENCIL': if o.data not in selected: selected.append(o.data) - # selected = [o.data for o in bpy.context.selected_objects if o.type == 'GPENCIL'] + # selected = [o.data for o in bpy.context.selected_objects if o.type == 'GREASEPENCIL'] if not active_data in selected: selected += [active_data] return selected - if bpy.context.active_object and bpy.context.active_object.type == 'GPENCIL': + if bpy.context.active_object and bpy.context.active_object.type == 'GREASEPENCIL': return [active_data] print('EOL. No active GP object') @@ -1206,7 +1206,7 @@ def all_anim_enabled(objects) -> bool: if fcu.mute: return False - if o.type in ('GPENCIL', 'CAMERA'): + if o.type in ('GREASEPENCIL', 'CAMERA'): if o.data.animation_data and o.data.animation_data.action: ## Check if object data attributes fcurves are muted for fcu in o.animation_data.action.fcurves: @@ -1219,7 +1219,7 @@ def all_anim_enabled(objects) -> bool: def all_object_modifier_enabled(objects) -> bool: '''Return False if one modifier of one object has GP modifier disabled in viewport but enabled in render''' for o in objects: - if o.type != 'GPENCIL': + if o.type != 'GREASEPENCIL': continue for m in o.grease_pencil_modifiers: if m.show_render and not m.show_viewport: @@ -1247,7 +1247,7 @@ def has_fully_enabled_anim(o): if fcu.mute: return False - if o.type in ('GPENCIL', 'CAMERA'): + if o.type in ('GREASEPENCIL', 'CAMERA'): if o.data.animation_data and o.data.animation_data.action: ## Check if object data attributes fcurves are muted for fcu in o.animation_data.action.fcurves: @@ -1292,7 +1292,7 @@ def anim_status(objects) -> tuple((str, str)): on_count += 1 count += 1 - if o.type in ('GPENCIL', 'CAMERA'): + if o.type in ('GREASEPENCIL', 'CAMERA'): datablock = o.data if datablock.animation_data is None: continue @@ -1320,7 +1320,7 @@ def gp_modifier_status(objects) -> tuple((str, str)): '''return icons on/off tuple''' on_count = off_count = count = 0 for o in objects: - if o.type != 'GPENCIL': + if o.type != 'GREASEPENCIL': continue ## Skip hided object if o.hide_get() and o.hide_render: