point attribute co to position
This commit is contained in:
+10
-10
@@ -39,14 +39,14 @@ class GP_OT_pick_closest_material(Operator):
|
||||
|
||||
def filter_stroke(self, context):
|
||||
# get stroke under mouse using kdtree
|
||||
point_pair = [(p.co, s) for s in self.stroke_list for p in s.points] # local space
|
||||
point_pair = [(p.position, s) for s in self.stroke_list for p in s.points] # local space
|
||||
|
||||
kd = mathutils.kdtree.KDTree(len(point_pair))
|
||||
for i, pair in enumerate(point_pair):
|
||||
kd.insert(pair[0], i)
|
||||
kd.balance()
|
||||
|
||||
## Get 3D coordinate on drawing plane according to mouse 2d.co on flat 2d drawing
|
||||
## Get 3D coordinate on drawing plane according to mouse 2d.position on flat 2d drawing
|
||||
_ob, hit, _plane_no = get_3d_coord_on_drawing_plane_from_2d(context, self.init_mouse)
|
||||
|
||||
if not hit:
|
||||
@@ -62,7 +62,7 @@ class GP_OT_pick_closest_material(Operator):
|
||||
## find point index in stroke
|
||||
self.idx = None
|
||||
for i, p in enumerate(s.points):
|
||||
if p.co == co:
|
||||
if p.position == co:
|
||||
self.idx = i
|
||||
break
|
||||
|
||||
@@ -116,8 +116,8 @@ class GP_OT_pick_closest_material(Operator):
|
||||
self.report({'WARNING'}, 'No coord found')
|
||||
return {'CANCELLED'}
|
||||
|
||||
self.depth = self.ob.matrix_world @ self.stroke.points[self.idx].co
|
||||
self.init_pos = [p.co.copy() for p in self.stroke.points] # need a copy otherwise vector is updated
|
||||
self.depth = self.ob.matrix_world @ self.stroke.points[self.idx].position
|
||||
self.init_pos = [p.position.copy() for p in self.stroke.points] # need a copy otherwise vector is updated
|
||||
## directly use world position ?
|
||||
# self.pos_world = [self.ob.matrix_world @ co for co in self.init_pos]
|
||||
self.pos_2d = [location_to_region(self.ob.matrix_world @ co) for co in self.init_pos]
|
||||
@@ -144,7 +144,7 @@ class GP_OT_pick_closest_material(Operator):
|
||||
|
||||
# if event.type in {'RIGHTMOUSE', 'ESC'}:
|
||||
# # for i, p in enumerate(self.stroke.points): # reset position
|
||||
# # self.stroke.points[i].co = self.init_pos[i]
|
||||
# # self.stroke.points[i].position = self.init_pos[i]
|
||||
# context.area.tag_redraw()
|
||||
# return {'CANCELLED'}
|
||||
|
||||
@@ -172,7 +172,7 @@ class GP_OT_pick_closest_material(Operator):
|
||||
|
||||
def filter_stroke(self, context):
|
||||
# get stroke under mouse using kdtree
|
||||
point_pair = [(p.co, s) for s in self.stroke_list for p in s.points] # local space
|
||||
point_pair = [(p.position, s) for s in self.stroke_list for p in s.points] # local space
|
||||
|
||||
kd = mathutils.kdtree.KDTree(len(point_pair))
|
||||
for i, pair in enumerate(point_pair):
|
||||
@@ -195,7 +195,7 @@ class GP_OT_pick_closest_material(Operator):
|
||||
## find point index in stroke
|
||||
self.idx = None
|
||||
for i, p in enumerate(s.points):
|
||||
if p.co == co:
|
||||
if p.position == co:
|
||||
self.idx = i
|
||||
break
|
||||
|
||||
@@ -274,8 +274,8 @@ class GP_OT_pick_closest_material(Operator):
|
||||
self.report({'WARNING'}, 'No coord found')
|
||||
return {'CANCELLED'}
|
||||
|
||||
# self.depth = self.ob.matrix_world @ stroke.points[self.idx].co
|
||||
# self.init_pos = [p.co.copy() for p in stroke.points] # need a copy otherwise vector is updated
|
||||
# self.depth = self.ob.matrix_world @ stroke.points[self.idx].position
|
||||
# self.init_pos = [p.position.copy() for p in stroke.points] # need a copy otherwise vector is updated
|
||||
# self.pos_2d = [location_to_region(self.ob.matrix_world @ co) for co in self.init_pos]
|
||||
# self.plen = len(stroke.points)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user