add intermediate stroke container - strokes to drawing.strokes

This commit is contained in:
pullusb
2024-11-11 17:48:11 +01:00
parent 4732110b93
commit 1dfb8cff9c
13 changed files with 56 additions and 56 deletions
+7 -7
View File
@@ -29,7 +29,7 @@ def get_matrix(ob) :
return ob.matrix_world.copy()
def set_matrix(gp_frame,mat):
for stroke in gp_frame.strokes :
for stroke in gp_frame.drawing.strokes :
for point in stroke.points :
point.position = mat @ point.position
@@ -160,7 +160,7 @@ def simple_draw_gp_stroke(pts, frame, width = 2, mat_id = 0):
draw basic stroke by passing list of point 3D coordinate
the frame to draw on and optional width parameter (default = 2)
'''
stroke = frame.strokes.new()
stroke = frame.drawing.strokes.new()
stroke.line_width = width
stroke.display_mode = '3DSPACE'
stroke.material_index = mat_id
@@ -178,7 +178,7 @@ def simple_draw_gp_stroke(pts, frame, width = 2, mat_id = 0):
## OLD - need update
def draw_gp_stroke(loop_info, frame, palette, width = 2) :
stroke = frame.strokes.new(palette)
stroke = frame.drawing.strokes.new(palette)
stroke.line_width = width
stroke.display_mode = '3DSPACE'# old -> draw_mode
@@ -472,14 +472,14 @@ def get_stroke_2D_coords(stroke):
def get_all_stroke_2D_coords(frame):
'''return a list of lists with all strokes's points 2D location'''
## using modification from get_stroke_2D_coords func'
return [get_stroke_2D_coords(s) for s in frame.strokes]
return [get_stroke_2D_coords(s) for s in frame.drawing.strokes]
## direct
#return[[location_to_region(p.position) for p in s.points] for s in frame.strokes]
#return[[location_to_region(p.position) for p in s.points] for s in frame.drawing.strokes]
def selected_strokes(frame):
'''return all stroke having a point selected as a list of strokes objects'''
stlist = []
for i, s in enumerate(frame.strokes):
for i, s in enumerate(frame.drawing.strokes):
if any(pt.select for pt in s.points):
stlist.append(s)
return stlist
@@ -491,7 +491,7 @@ def copy_stroke_to_frame(s, frame, select=True):
return created stroke
'''
ns = frame.strokes.new()
ns = frame.drawing.strokes.new()
## Set strokes attr
stroke_attr = [