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