[Bf-extensions-cvs] [7e798783] master: Bool Tool: use more descriptive icons

Mikhail Rachinskiy noreply at git.blender.org
Tue Sep 17 11:03:01 CEST 2019


Commit: 7e79878338be4a2895d0a24e2afdaebee2df35df
Author: Mikhail Rachinskiy
Date:   Tue Sep 17 13:02:45 2019 +0400
Branches: master
https://developer.blender.org/rBA7e79878338be4a2895d0a24e2afdaebee2df35df

Bool Tool: use more descriptive icons

Also put additional panels under the main panel and mark unported code for TODO.

===================================================================

M	object_boolean_tools.py

===================================================================

diff --git a/object_boolean_tools.py b/object_boolean_tools.py
index b14263e2..dc0012f0 100644
--- a/object_boolean_tools.py
+++ b/object_boolean_tools.py
@@ -330,98 +330,98 @@ def ApplyThisBrush(context, brush):
 
 # ------------------ Bool Tool OPERATORS --------------------------------------
 
-
-class BTool_DrawPolyBrush(Operator):
-    bl_idname = "btool.draw_polybrush"
-    bl_label = "Draw Poly Brush"
-    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
-        if self.count == 1:
-            actObj.select_set(state=True)
-            bpy.ops.gpencil.draw("INVOKE_DEFAULT", mode="DRAW_POLY")
-
-        if event.type == "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"
-                    bpy.context.view_layer.objects.active = obj
-                    bpy.ops.object.select_all(action="DESELECT")
-                    obj.select_set(state=True)
-                    bpy.ops.object.convert(target="MESH")
-                    bpy.ops.object.mode_set(mode="EDIT")
-                    bpy.ops.mesh.select_all(action="SELECT")
-                    bpy.ops.mesh.edge_face_add()
-                    bpy.ops.mesh.flip_normals()
-                    bpy.ops.object.mode_set(mode="OBJECT")
-                    bpy.ops.object.origin_set(type="ORIGIN_CENTER_OF_MASS")
-                    bpy.ops.object.modifier_add(type="SOLIDIFY")
-                    for mod in obj.modifiers:
-                        if mod.name == "Solidify":
-                            mod.name = "BTool_PolyBrush"
-                            mod.thickness = 1
-                            mod.offset = 0
-                    obj["BoolToolPolyBrush"] = True
-
-                    bpy.ops.object.select_all(action="DESELECT")
-                    bpy.context.view_layer.objects.active = actObj
-                    bpy.context.view_layer.update()
-                    actObj.select_set(state=True)
-                    obj.select_set(state=True)
-
-                    bpy.context.view_layer.grease_pencil.clear()
-                    bpy.ops.gpencil.data_unlink()
-
-            return {"FINISHED"}
-
-        if event.type == "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:
-            self.report({"WARNING"}, "No active object, could not finish")
-            return {"CANCELLED"}
+# TODO
+# class BTool_DrawPolyBrush(Operator):
+#     bl_idname = "btool.draw_polybrush"
+#     bl_label = "Draw Poly Brush"
+#     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
+#         if self.count == 1:
+#             actObj.select_set(state=True)
+#             bpy.ops.gpencil.draw("INVOKE_DEFAULT", mode="DRAW_POLY")
+
+#         if event.type == "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"
+#                     bpy.context.view_layer.objects.active = obj
+#                     bpy.ops.object.select_all(action="DESELECT")
+#                     obj.select_set(state=True)
+#                     bpy.ops.object.convert(target="MESH")
+#                     bpy.ops.object.mode_set(mode="EDIT")
+#                     bpy.ops.mesh.select_all(action="SELECT")
+#                     bpy.ops.mesh.edge_face_add()
+#                     bpy.ops.mesh.flip_normals()
+#                     bpy.ops.object.mode_set(mode="OBJECT")
+#                     bpy.ops.object.origin_set(type="ORIGIN_CENTER_OF_MASS")
+#                     bpy.ops.object.modifier_add(type="SOLIDIFY")
+#                     for mod in obj.modifiers:
+#                         if mod.name == "Solidify":
+#                             mod.name = "BTool_PolyBrush"
+#                             mod.thickness = 1
+#                             mod.offset = 0
+#                     obj["BoolToolPolyBrush"] = True
+
+#                     bpy.ops.object.select_all(action="DESELECT")
+#                     bpy.context.view_layer.objects.active = actObj
+#                     bpy.context.view_layer.update()
+#                     actObj.select_set(state=True)
+#                     obj.select_set(state=True)
+
+#                     bpy.context.view_layer.grease_pencil.clear()
+#                     bpy.ops.gpencil.data_unlink()
+
+#             return {"FINISHED"}
+
+#         if event.type == "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:
+#             self.report({"WARNING"}, "No active object, could not finish")
+#             return {"CANCELLED"}
 
 
 # Fast Transform
@@ -834,30 +834,30 @@ class VIEW3D_MT_booltool_menu(Menu):
         layout = self.layout
 
         layout.label(text="Auto Boolean")
-        layout.operator(OBJECT_OT_BoolTool_Auto_Difference.bl_idname, text="Difference", icon="PIVOT_ACTIVE")
-        layout.operator(OBJECT_OT_BoolTool_Auto_Union.bl_idname, text="Union", icon="PIVOT_INDIVIDUAL")
-        layout.operator(OBJECT_OT_BoolTool_Auto_Intersect.bl_idname, text="Intersect", icon="PIVOT_MEDIAN")
-        layout.operator(OBJECT_OT_BoolTool_Auto_Slice.bl_idname, text="Slice", icon="PIVOT_MEDIAN")
+        layout.operator(OBJECT_OT_BoolTool_Auto_Difference.bl_idname, text="Difference", icon="SELECT_SUBTRACT")
+        layout.operator(OBJECT_OT_BoolTool_Auto_Union.bl_idname, text="Union", icon="SELECT_EXTEND")
+        layout.operator(OBJECT_OT_BoolTool_Auto_Intersect.bl_idname, text="Intersect", icon="SELECT_INTERSECT")
+        layout.operator(OBJECT_OT_BoolTool_Auto_Slice.bl_idname, text="Slice", icon="SELECT_DIFFERENCE")
 
         layout.separator()
 
         layout.label(text="Brush Boolean")
-        layout.operator(BTool_Diff.bl_idname, icon="PIVOT_ACTIVE")
-        layout.operator(BTool_Union.bl_idname, icon="PIVOT_INDIVIDUAL")
-        layout.operator(BTool_Inters.bl_idname, icon="PIVOT_MEDIAN")
-        layout.operator(BTool_Slice.bl_idname, icon="PIVOT_MEDIAN")
+        layout.operator(BTool_Diff.bl_idname, text="Difference", icon="SELECT_SUBTRACT")
+        layout.operator(BTool_Union.bl_idname, text="Union", icon="SELECT_EXTEND")
+        layout.operator(BTool_Inters.bl_idname, text="Intersect", icon="SELECT_INTERSECT")
+        layout.operator(BTool_Slice.bl_idname, text="Slice", icon="SELECT_DIFFERENCE")
 
         if isCanvas(context.active_object):
             layout.separator()
             layout.operator(BTool_AllBrushToMesh.bl_idname, icon="MOD_LATTICE", text="Apply All")
-            Rem = layout.operator(BTool_Remove.bl_idname, icon="CANCEL", text="Remove All")
+            Rem = layout.operator(BTool_Remove.bl_idname, icon="X", text="Remove All")
             Rem.thisObj = ""
             Rem.Prop = "CANVAS"
 
         if isBrush(context.active_object):
             layout.separator()
             layout.operator(BTool_BrushToMesh.bl_idname, icon="MOD_LATTICE", text="Apply Brush")
-            Rem = layout.operator(BTool_Remove.bl_idname, icon="CANCEL", text="Remove Brush")
+            Rem = layout.operator(BTool_Remove.bl_idname, icon="X", text="Remove Brush")
  

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list