diff --git a/GP_guided_colorize/OP_line_closer.py b/GP_guided_colorize/OP_line_closer.py index d39438a..01d12a6 100644 --- a/GP_guided_colorize/OP_line_closer.py +++ b/GP_guided_colorize/OP_line_closer.py @@ -110,7 +110,7 @@ def create_gap_stroke(f, ob, tol=10, mat_id=None): print(f'{ctl} line created') -##test_call: #create_gap_stroke(C.object.data.layers.active.active_frame, C.object, mat_id=C.object.active_material_index) +##test_call: #create_gap_stroke(C.object.data.layers.active.current_frame(), C.object, mat_id=C.object.active_material_index) def create_closing_line(tolerance=0.2): for ob in bpy.context.selected_objects: @@ -131,7 +131,7 @@ def create_closing_line(tolerance=0.2): ## filter on selected if not l.select:continue# comment this line for all # for f in l.frames:#not all for now - f = l.active_frame + f = l.current_frame() ## create gap stroke create_gap_stroke(f, ob, tol=tolerance, mat_id=mat_id) @@ -213,7 +213,7 @@ def extend_all_strokes_tips(ob, frame, length=10, selected=False): return # TODO need custom filters or go in GP refine strokes... - # frame = ob.data.layers.active.active_frame + # frame = ob.data.layers.active.current_frame() if not frame: return ct = 0 @@ -284,10 +284,10 @@ class GPSTK_OT_extend_lines(bpy.types.Operator): fct = 0 for l in lays: - if not l.active_frame: + if not l.current_frame(): print(f'{l.name} has no active frame') continue - fct += extend_all_strokes_tips(ob, l.active_frame, length = self.length, selected = self.selected) + fct += extend_all_strokes_tips(ob, l.current_frame(), length = self.length, selected = self.selected) if not fct: mess = "No strokes extended... see console" @@ -345,10 +345,10 @@ class GPSTK_OT_change_closeline_length(bpy.types.Operator): fct = 0 for l in lays: - if not l.active_frame: + if not l.current_frame(): print(f'{l.name} has no active frame') continue - fct += change_extension_length(ob, [s for s in l.active_frame.strokes], length = self.length, selected = self.selected) + fct += change_extension_length(ob, [s for s in l.current_frame().strokes], length = self.length, selected = self.selected) if not fct: mess = "No extension modified... see console" @@ -377,8 +377,8 @@ class GPSTK_OT_comma_finder(bpy.types.Operator): ob = context.object lays = [l for l in ob.data.layers if not l.hide and not l.lock] for l in lays: - if not l.active_frame:continue - for s in l.active_frame.strokes: + if not l.current_frame():continue + for s in l.current_frame().strokes: if is_deviating_by(s, context.scene.gpcolor_props.deviation_tolerance): ct+=1 diff --git a/OP_copy_paste.py b/OP_copy_paste.py index 7f2bc50..e07c9e0 100644 --- a/OP_copy_paste.py +++ b/OP_copy_paste.py @@ -169,7 +169,7 @@ def copycut_strokes(layers=None, copy=True, keep_empty=True): stroke_list = [] # one stroke list for all layers. for l in layers: - f = l.active_frame + f = l.current_frame() if f: # active frame can be None if not copy: @@ -268,7 +268,7 @@ def copy_all_strokes(layers=None): stroke_list = []# one stroke list for all layers. for l in layers: - f = l.active_frame + f = l.current_frame() if not f: continue# active frame can be None @@ -308,7 +308,7 @@ def copy_all_strokes_in_frame(frame=None, layers=None, obj=None, stroke_list = [] for l in layers: - f = l.active_frame + f = l.current_frame() if not f: continue# active frame can be None @@ -389,7 +389,7 @@ def add_multiple_strokes(stroke_list, layer=None, use_current_frame=True, select fnum = scene.frame_current target_frame = False - act = layer.active_frame + act = layer.current_frame() ## set frame if needed if act: if use_current_frame or act.frame_number == fnum: diff --git a/OP_eraser_brush.py b/OP_eraser_brush.py index 23f128d..2626ba2 100644 --- a/OP_eraser_brush.py +++ b/OP_eraser_brush.py @@ -441,7 +441,7 @@ class GPTB_OT_eraser(Operator): t0 = time() gp_mats = gp.data.materials gp_layers = [l for l in gp.data.layers if not l.lock or l.hide] - self.gp_frames = [l.active_frame for l in gp_layers] + self.gp_frames = [l.current_frame() for l in gp_layers] ''' points_data = [(s, f, gp_mats[s.material_index]) for f in gp_frames for s in f.strokes] points_data = [(s, f, m) for s, f, m in points_data if not m.grease_pencil.hide or m.grease_pencil.lock] diff --git a/OP_flat_reproject.py b/OP_flat_reproject.py index 726b91e..9bbf10c 100644 --- a/OP_flat_reproject.py +++ b/OP_flat_reproject.py @@ -96,7 +96,7 @@ def batch_flat_reproject(obj): plane_co = scn.cursor.location for l in obj.data.layers: - f = l.active_frame + f = l.current_frame() if not f: # No active frame continue diff --git a/OP_helpers.py b/OP_helpers.py index dbb02f6..29c1f31 100644 --- a/OP_helpers.py +++ b/OP_helpers.py @@ -619,7 +619,7 @@ class GPTB_OT_clear_active_frame(Operator): if not l: self.report({'ERROR'}, 'No layers') return {'CANCELLED'} - f = l.active_frame + f = l.current_frame() if not f: self.report({'ERROR'}, 'No active frame') return {'CANCELLED'} diff --git a/OP_key_duplicate_send.py b/OP_key_duplicate_send.py index e7a6051..95e6095 100644 --- a/OP_key_duplicate_send.py +++ b/OP_key_duplicate_send.py @@ -148,7 +148,7 @@ def register(): bpy.utils.register_class(cls) register_keymaps() - bpy.types.DOPESHEET_MT_gpencil_key.append(menu_duplicate_and_send_to_layer) + bpy.types.DOPESHEET_MT_key.append(menu_duplicate_and_send_to_layer) bpy.types.DOPESHEET_MT_context_menu.append(menu_duplicate_and_send_to_layer) @@ -157,7 +157,7 @@ def unregister(): return bpy.types.DOPESHEET_MT_context_menu.remove(menu_duplicate_and_send_to_layer) - bpy.types.DOPESHEET_MT_gpencil_key.remove(menu_duplicate_and_send_to_layer) + bpy.types.DOPESHEET_MT_key.remove(menu_duplicate_and_send_to_layer) unregister_keymaps() for cls in reversed(classes): diff --git a/OP_layer_picker.py b/OP_layer_picker.py index 69b85a4..d23cf00 100644 --- a/OP_layer_picker.py +++ b/OP_layer_picker.py @@ -89,11 +89,11 @@ class GP_OT_pick_closest_layer(Operator): self.point_pair += [(Vector((*location_to_region(mat @ p.position), 0)), layer_id) for p in s.points] else: - # [s for l in gp.layers if not l.lock and not l.hide for s in l.active_frame.stokes] + # [s for l in gp.layers if not l.lock and not l.hide for s in l.current_frame().stokes] for layer_id, l in enumerate(gp.layers): - if l.hide or not l.active_frame:# l.lock or + if l.hide or not l.current_frame():# l.lock or continue - for s in l.active_frame.strokes: + for s in l.current_frame().strokes: if self.stroke_filter == 'STROKE' and not self.ob.data.materials[s.material_index].grease_pencil.show_stroke: continue elif self.stroke_filter == 'FILL' and not self.ob.data.materials[s.material_index].grease_pencil.show_fill: diff --git a/OP_material_picker.py b/OP_material_picker.py index 3942c49..7043510 100644 --- a/OP_material_picker.py +++ b/OP_material_picker.py @@ -88,11 +88,11 @@ class GP_OT_pick_closest_material(Operator): self.stroke_list.append(s) else: - # [s for l in self.gp.layers if not l.lock and not l.hide for s in l.active_frame.stokes] + # [s for l in self.gp.layers if not l.lock and not l.hide for s in l.current_frame().stokes] for l in self.gp.layers: - if l.hide or not l.active_frame:# l.lock or + if l.hide or not l.current_frame():# l.lock or continue - for s in l.active_frame.strokes: + for s in l.current_frame().strokes: self.stroke_list.append(s) if self.fill_only: @@ -244,11 +244,11 @@ class GP_OT_pick_closest_material(Operator): self.stroke_list.append(s) else: - # [s for l in gp.layers if not l.lock and not l.hide for s in l.active_frame.stokes] + # [s for l in gp.layers if not l.lock and not l.hide for s in l.current_frame().stokes] for l in gp.layers: - if l.hide or not l.active_frame:# l.lock or + if l.hide or not l.current_frame():# l.lock or continue - for s in l.active_frame.strokes: + for s in l.current_frame().strokes: self.stroke_list.append(s) if self.stroke_filter == 'FILL': diff --git a/utils.py b/utils.py index c241c7d..fc764f5 100644 --- a/utils.py +++ b/utils.py @@ -440,7 +440,7 @@ def get_active_frame(layer_name=None): if layer_name: lay = bpy.context.scene.grease_pencil.layers.get(layer_name) if lay: - frame = lay.active_frame + frame = lay.current_frame() if frame: return frame else: @@ -449,7 +449,7 @@ def get_active_frame(layer_name=None): print('no layers named', layer_name, 'in scene layers') else:#active layer - frame = bpy.context.scene.grease_pencil.layers.active.active_frame + frame = bpy.context.scene.grease_pencil.layers.active.current_frame() if frame: return frame else: