correct pressure
parent
81e21bb428
commit
060fa8ff92
|
@ -204,8 +204,8 @@ class GPTB_OT_eraser(Operator):
|
|||
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
|
||||
shader.bind()
|
||||
shader.uniform_float("color", (1, 1, 1, 1))
|
||||
for mouse in self.mouse_path:
|
||||
circle_co = circle(*mouse, self.radius, 24)
|
||||
for mouse, radius in self.mouse_path:
|
||||
circle_co = circle(*mouse, radius, 24)
|
||||
batch = batch_for_shader(shader, 'TRI_FAN', {"pos": circle_co})
|
||||
batch.draw(shader)
|
||||
|
||||
|
@ -272,21 +272,21 @@ class GPTB_OT_eraser(Operator):
|
|||
t0 = time()
|
||||
print()
|
||||
|
||||
#print('Number of cuts', len(self.mouse_path))
|
||||
print('Number of cuts', len(self.mouse_path))
|
||||
|
||||
for mouse in self.mouse_path:
|
||||
for mouse, radius in self.mouse_path:
|
||||
t1 = time()
|
||||
|
||||
print()
|
||||
x, y = mouse
|
||||
bpy.ops.gpencil.select_all(action='DESELECT')
|
||||
bpy.ops.gpencil.select_circle(x=x, y=y, radius=self.radius, wait_for_input=False)
|
||||
bpy.ops.gpencil.select_circle(x=x, y=y, radius=radius, wait_for_input=False)
|
||||
|
||||
strokes = [s for f in self.gp_frames for s in f.strokes]
|
||||
#print('select_circle', time()-t1)
|
||||
|
||||
t2 = time()
|
||||
cut_data = get_cuts_data(strokes, mouse, self.radius)
|
||||
cut_data = get_cuts_data(strokes, mouse, radius)
|
||||
#print('get_cuts_data', time()-t2)
|
||||
|
||||
#print([s for s in strokes if s.select])
|
||||
|
@ -328,7 +328,7 @@ class GPTB_OT_eraser(Operator):
|
|||
|
||||
|
||||
bpy.ops.gpencil.select_all(action='DESELECT')
|
||||
bpy.ops.gpencil.select_circle(x=x, y=y, radius=self.radius-4, wait_for_input=False)
|
||||
bpy.ops.gpencil.select_circle(x=x, y=y, radius=radius-4, wait_for_input=False)
|
||||
|
||||
'''
|
||||
selected_strokes = [s for f in self.gp_frames for s in f.strokes if s.select]
|
||||
|
@ -371,7 +371,7 @@ class GPTB_OT_eraser(Operator):
|
|||
|
||||
if event.type == 'LEFTMOUSE':
|
||||
#self.mouse = mouse
|
||||
self.mouse_path.append(self.mouse)
|
||||
self.mouse_path.append((self.mouse, self.radius))
|
||||
#self.erase(context, event)
|
||||
bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
|
||||
return {'FINISHED'}
|
||||
|
@ -383,7 +383,7 @@ class GPTB_OT_eraser(Operator):
|
|||
|
||||
if event.type in {'MOUSEMOVE', 'INBETWEEN_MOUSEMOVE'}:
|
||||
#self.draw_holdout(context, event)
|
||||
self.mouse_path.append(self.mouse)
|
||||
self.mouse_path.append((self.mouse, self.radius))
|
||||
#self.update_cuts_data(context, event)
|
||||
#self.erase(context, event)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
@ -398,8 +398,9 @@ class GPTB_OT_eraser(Operator):
|
|||
gp = context.object
|
||||
matrix = gp.matrix_world
|
||||
|
||||
self.mouse_prev = Vector((event.mouse_region_x, event.mouse_region_y))
|
||||
self.mouse_path = [self.mouse_prev]
|
||||
self.radius = self.get_radius(context, event)
|
||||
self.mouse_prev = self.mouse = Vector((event.mouse_region_x, event.mouse_region_y))
|
||||
self.mouse_path = [(self.mouse_prev, self.radius)]
|
||||
|
||||
area = context.area
|
||||
region = context.region
|
||||
|
@ -415,7 +416,7 @@ class GPTB_OT_eraser(Operator):
|
|||
#print('ORG', org)
|
||||
#print('view_mat', view_mat)
|
||||
|
||||
self.radius = self.get_radius(context, event)
|
||||
|
||||
self.cuts_data = []
|
||||
|
||||
#org = self.view_mat @ Vector((0, 0, -10))
|
||||
|
|
Loading…
Reference in New Issue