Respect group lock and hide state

This commit is contained in:
pullusb
2024-12-16 17:29:27 +01:00
parent 1c39d81ef1
commit cf3f39b730
12 changed files with 47 additions and 63 deletions
+12 -7
View File
@@ -4,7 +4,12 @@ import mathutils
from mathutils import Vector, Matrix, geometry
from bpy_extras import view3d_utils
from time import time
from .utils import get_gp_draw_plane, location_to_region, region_to_location
from .utils import (get_gp_draw_plane,
location_to_region,
region_to_location,
is_locked,
is_hidden)
### passing by 2D projection
def get_3d_coord_on_drawing_plane_from_2d(context, co):
@@ -79,7 +84,7 @@ class GP_OT_pick_closest_material(Operator):
if context.scene.tool_settings.use_grease_pencil_multi_frame_editing:
for l in self.gp.layers:
if l.hide:# l.lock or
if is_hidden(l):# is_locked(l) or
continue
for f in l.frames:
if not f.select:
@@ -88,9 +93,9 @@ 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.current_frame().stokes]
# [s for l in self.gp.layers if not is_locked(l) and not is_hidden(l) for s in l.current_frame().stokes]
for l in self.gp.layers:
if l.hide or not l.current_frame():# l.lock or
if is_hidden(l) or not l.current_frame():# is_locked(l) or
continue
for s in l.current_frame().drawing.strokes:
self.stroke_list.append(s)
@@ -235,7 +240,7 @@ class GP_OT_pick_closest_material(Operator):
if context.scene.tool_settings.use_grease_pencil_multi_frame_editing:
for l in gp.layers:
if l.hide:# l.lock or
if is_hidden(l):# is_locked(l) or
continue
for f in l.frames:
if not f.select:
@@ -244,9 +249,9 @@ 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.current_frame().stokes]
# [s for l in gp.layers if not is_locked(l) and not is_hidden(l) for s in l.current_frame().stokes]
for l in gp.layers:
if l.hide or not l.current_frame():# l.lock or
if is_hidden(l) or not l.current_frame():# is_locked(l) or
continue
for s in l.current_frame().drawing.strokes:
self.stroke_list.append(s)