Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijenstina <lijenstina@gmail.com>2017-08-11 02:48:17 +0300
committerlijenstina <lijenstina@gmail.com>2017-08-11 02:48:17 +0300
commitf8d7d611fc68d06f7e2ab9035bf68c291eaaa9ef (patch)
treef72949b7698bd4f5432ea0d5324b5f315ace8ad3
parentb07c8ff94974feca77ce5007ad19147c9e58a983 (diff)
Fix T52321: Draw Poly Brush allow Grease Pencil right click
Bumped version to 0.3.8 Allow passing of the Right Click to bpy.ops.gpencil.draw as it is used for the eraser functionality Add a message about user abort Temporary switch on the continuous drawing for GP as if it is False will stop as right click is pressed Correct the tooltip, so it is more clear
-rw-r--r--object_boolean_tools.py37
1 files changed, 30 insertions, 7 deletions
diff --git a/object_boolean_tools.py b/object_boolean_tools.py
index 0e75ef10..ad01c402 100644
--- a/object_boolean_tools.py
+++ b/object_boolean_tools.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "Bool Tool",
"author": "Vitor Balbio, Mikhail Rachinskiy, TynkaTopi, Meta-Androcto",
- "version": (0, 3, 7),
+ "version": (0, 3, 8),
"blender": (2, 78, 0),
"location": "View3D > Toolshelf",
"description": "Bool Tools Hotkey: Ctrl Shift B",
@@ -45,7 +45,7 @@ from bpy.props import (
)
-# ------------------- Bool Tool FUNCTIONS------------------------------
+# ------------------- Bool Tool FUNCTIONS -------------------------
# Utils:
# Hide boolean objects
@@ -398,20 +398,32 @@ def HandleScene(scene):
GCollector(ob)
-# ------------------ Bool Tool OPERATORS-----------------------------------------------------
+# ------------------ Bool Tool OPERATORS --------------------------------------
class BTool_DrawPolyBrush(Operator):
bl_idname = "btool.draw_polybrush"
bl_label = "Draw Poly Brush"
- bl_description = ("Draw Polygonal Mask, can be applyied to Canvas > Brush "
- "or Directly. ESC to Exit")
+ bl_description = ("Draw Polygonal Mask, can be applied to Canvas > Brush or Directly\n"
+ "Note: ESC to Cancel, Enter to Apply, Right Click to erase the Lines")
count = 0
+ store_cont_draw = False
@classmethod
def poll(cls, context):
return context.active_object is not None
+ def set_cont_draw(self, context, start=False):
+ # store / restore GP continuous drawing (see T52321)
+ scene = context.scene
+ tool_settings = scene.tool_settings
+ continuous = tool_settings.use_gpencil_continuous_drawing
+ if start:
+ self.store_cont_draw = continuous
+ tool_settings.use_gpencil_continuous_drawing = True
+ else:
+ tool_settings.use_gpencil_continuous_drawing = self.store_cont_draw
+
def modal(self, context, event):
self.count += 1
actObj = bpy.context.active_object
@@ -419,9 +431,15 @@ class BTool_DrawPolyBrush(Operator):
actObj.select = True
bpy.ops.gpencil.draw('INVOKE_DEFAULT', mode="DRAW_POLY")
+ if event.type in {'RIGHTMOUSE'}:
+ # use this to pass to the Grease Pencil eraser (see T52321)
+ pass
+
if event.type in {'RET', 'NUMPAD_ENTER'}:
bpy.ops.gpencil.convert(type='POLY')
+ self.set_cont_draw(context)
+
for obj in context.selected_objects:
if obj.type == "CURVE":
obj.name = "PolyDraw"
@@ -448,7 +466,7 @@ class BTool_DrawPolyBrush(Operator):
bpy.context.scene.update()
actObj.select = True
obj.select = True
- # try:
+
bpy.context.scene.grease_pencil.clear()
bpy.ops.gpencil.data_unlink()
@@ -456,12 +474,17 @@ class BTool_DrawPolyBrush(Operator):
if event.type in {'ESC'}:
bpy.ops.ed.undo() # remove o Grease Pencil
+ self.set_cont_draw(context)
+
+ self.report({'INFO'},
+ "Draw Poly Brush: Operation Cancelled by User")
return {'CANCELLED'}
return {'RUNNING_MODAL'}
def invoke(self, context, event):
if context.object:
+ self.set_cont_draw(context, start=True)
context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
else:
@@ -747,7 +770,7 @@ class Auto_Subtract(AutoBoolean, Operator):
class BTool_FindBrush(Operator):
bl_idname = "btool.find_brush"
bl_label = ""
- bl_description = "Find the this brush"
+ bl_description = "Find the selected brush"
obj = StringProperty("")