[Bf-extensions-cvs] [3111292] master: Fix T50456: Carver MT update to 1.1.6

lijenstina noreply at git.blender.org
Sat Jan 28 05:05:40 CET 2017


Commit: 31112922764d65181f310f2e9d5541afe7c01ce3
Author: lijenstina
Date:   Sat Jan 28 05:04:05 2017 +0100
Branches: master
https://developer.blender.org/rBA31112922764d65181f310f2e9d5541afe7c01ce3

Fix T50456: Carver MT update to 1.1.6

Patch by Ted Milker (TedMilker) with minor modification, thanks.
Bump Version to 1.1.6
Add In-scene profiles, brush depth adjustment, fix rotation bug
Add the possibility of switching Solver between BMesh and Carve
(default key is v)
Minor style clean up and translation to English of comments
Update some descriptions
Switch the type for Enable_Tab_01 and 02 from scene properties to
add-on preferences
Add traceback to the modal except message

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

M	mesh_carver.py

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

diff --git a/mesh_carver.py b/mesh_carver.py
index 5320b68..9fbb6ef 100644
--- a/mesh_carver.py
+++ b/mesh_carver.py
@@ -20,8 +20,8 @@
 bl_info = {
     "name": "Carver MT",
     "category": "Object",
-    "author": "Pixivore, Cédric LEPILLER",
-    "version": (1, 1, 5),
+    "author": "Pixivore, Cedric LEPILLER, Ted Milker",
+    "version": (1, 1, 6),
     "blender": (2, 77, 0),
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
                 "Scripts/Modeling/Carver",
@@ -455,8 +455,16 @@ UNION = 1
 class CarverPrefs(bpy.types.AddonPreferences):
     bl_idname = __name__
 
-    bpy.types.Scene.Enable_Tab_01 = bpy.props.BoolProperty(default=False)
-    bpy.types.Scene.Enable_Tab_02 = bpy.props.BoolProperty(default=False)
+    Enable_Tab_01 = bpy.props.BoolProperty(
+        name="Info",
+        description="Some general information and settings about the add-on",
+        default=False
+        )
+    Enable_Tab_02 = bpy.props.BoolProperty(
+        name="Hotkeys",
+        description="List of the shortcuts used during carving",
+        default=False
+        )
 
     bpy.types.Scene.Key_Create = bpy.props.StringProperty(
         name="Object creation",
@@ -529,6 +537,12 @@ class CarverPrefs(bpy.types.AddonPreferences):
         maxlen=1,
         default="D",
     )
+    bpy.types.Scene.Key_BrushDepth = bpy.props.StringProperty(
+        name="Brush Depth",
+        description="Brush depth",
+        maxlen=1,
+        default="C",
+    )
     bpy.types.Scene.Key_Subadd = bpy.props.StringProperty(
         name="Add subdivision",
         description="Add subdivision",
@@ -547,19 +561,48 @@ class CarverPrefs(bpy.types.AddonPreferences):
         maxlen=1,
         default="R",
     )
+    bpy.types.Scene.Key_Solver = bpy.props.StringProperty(
+        name="Solver",
+        description="Switch between Carve and BMesh Boolean solver\n"
+                    "depending on a specific use case",
+        maxlen=1,
+        default="V",
+    )
+    bpy.types.Scene.ProfilePrefix = bpy.props.StringProperty(
+        name="Profile prefix",
+        description="Prefix to look for profiles with",
+        default="Carver_Profile-"
+    )
+    bpy.types.Scene.CarverSolver = bpy.props.EnumProperty(
+        name="Boolean Solver",
+        description="Boolean solver to use by default\n",
+        default="CARVE",
+        items=(
+            ('CARVE', 'Carve', "Carve solver, as the legacy one, can handle\n"
+                               "basic coplanar but can often fail with\n"
+                               "non-closed geometry"),
+            ('BMESH', 'BMesh', "BMesh solver is faster, but cannot handle\n"
+                               "coplanar and self-intersecting geometry")
+        )
+    )
 
     def draw(self, context):
         scene = context.scene
         layout = self.layout
 
-        layout.prop(context.scene, "Enable_Tab_01", text="Info", icon="QUESTION")
-        if scene.Enable_Tab_01:
-            row = layout.row()
-            layout.label(text="Carver Operator")
-            layout.label(text="Select object and [CTRL]+[SHIFT]+[X] to carve")
+        layout.prop(self, "Enable_Tab_01", text="Info and Settings", icon="QUESTION")
+        if self.Enable_Tab_01:
+            layout.label(text="Carver Operator:", icon="LAYER_ACTIVE")
+            layout.label(text="Select a Mesh Object and press [CTRL]+[SHIFT]+[X] to carve",
+                         icon="LAYER_USED")
+            layout.label(text="To finish carving press [ESC] or [RIGHT CLICK]",
+                         icon="LAYER_USED")
 
-        layout.prop(scene, "Enable_Tab_02", text="Keys", icon="KEYINGSET")
-        if scene.Enable_Tab_02:
+            layout.prop(scene, "ProfilePrefix", text="Profile prefix")
+            layout.prop(scene, "CarverSolver", text="Solver")
+
+        layout.prop(self, "Enable_Tab_02", text="Keys", icon="KEYINGSET")
+        if self.Enable_Tab_02:
             split = layout.split()
             col = split.column()
             col.label("Object Creation:")
@@ -568,6 +611,8 @@ class CarverPrefs(bpy.types.AddonPreferences):
             col.prop(scene, "Key_Update", text="")
             col.label("Boolean operation type:")
             col.prop(scene, "Key_Bool", text="")
+            col.label("Solver:")
+            col.prop(scene, "Key_Solver", text="")
 
             col = split.column()
             col.label("Brush Mode:")
@@ -576,6 +621,8 @@ class CarverPrefs(bpy.types.AddonPreferences):
             col.prop(scene, "Key_Help", text="")
             col.label("Instantiate object:")
             col.prop(scene, "Key_Instant", text="")
+            col.label("Brush Depth:")
+            col.prop(scene, "Key_BrushDepth", text="")
 
             col = split.column()
             col.label("Close polygonal shape:")
@@ -605,7 +652,7 @@ class CarverPrefs(bpy.types.AddonPreferences):
 # Draw Text (Center position)
 def DrawCenterText(text, xt, yt, Size, Color, self):
     font_id = 0
-    # Decalage Ombre
+    # Offset Shadow
     Sshadow_x = 2
     Sshadow_y = -2
 
@@ -626,7 +673,7 @@ def DrawCenterText(text, xt, yt, Size, Color, self):
 # Draw text (Left position)
 def DrawLeftText(text, xt, yt, Size, Color, self):
     font_id = 0
-    # Decalage Ombre
+    # Offset Shadow
     Sshadow_x = 2
     Sshadow_y = -2
 
@@ -646,7 +693,7 @@ def DrawLeftText(text, xt, yt, Size, Color, self):
 # Draw text (Right position)
 def DrawRightText(text, xt, yt, Size, Color, self):
     font_id = 0
-    # Decalage Ombre
+    # Offset Shadow
     Sshadow_x = 2
     Sshadow_y = -2
 
@@ -815,7 +862,7 @@ def draw_callback_px(self, context):
             DrawLeftText(BoolStr, xLeftP, y, IFontSize, Color1, self)
 
     else:
-        #---INSTANTIATE:
+        # INSTANTIATE:
         TypeStr = "Instantiate [" + context.scene.Key_Instant + "] : "
         if self.Instantiate:
             BoolStr = "(ON)"
@@ -829,7 +876,7 @@ def draw_callback_px(self, context):
         DrawLeftText(TypeStr, xLeft, yCmd, IFontSize, Color0, self)
         DrawLeftText(BoolStr, xLeftP, yCmd, IFontSize, Color1, self)
 
-    #---RANDOM ROTATION:
+        # RANDOM ROTATION:
         if self.alt:
             TypeStr = "Random Rotation [" + context.scene.Key_Randrot + "] : "
             if self.RandomRotation:
@@ -844,7 +891,7 @@ def draw_callback_px(self, context):
             DrawLeftText(TypeStr, xLeft, yCmd - yInterval, IFontSize, Color0, self)
             DrawLeftText(BoolStr, xLeftP, yCmd - yInterval, IFontSize, Color1, self)
 
-    #---THICKNESS:
+        # THICKNESS:
         if self.BrushSolidify:
             TypeStr = "Thickness [" + context.scene.Key_Depth + "] : "
             if self.ProfileMode:
@@ -863,9 +910,9 @@ def draw_callback_px(self, context):
                 DrawLeftText(TypeStr, xLeft, yCmd - yInterval, IFontSize, Color0, self)
                 DrawLeftText(BoolStr, xLeftP, yCmd - yInterval, IFontSize, Color1, self)
 
-    #---BRUSH DEPTH:
+        # BRUSH DEPTH:
         if (self.ObjectMode):
-            TypeStr = "Brush Depth [" + context.scene.Key_Depth + "] : "
+            TypeStr = "Carve Depth [" + context.scene.Key_Depth + "] : "
             BoolStr = str(round(self.ObjectBrush.data.vertices[0].co.z, 2))
             OpsStr = TypeStr + BoolStr
             blf.size(font_id, IFontSize, 72)
@@ -879,6 +926,20 @@ def draw_callback_px(self, context):
                 DrawLeftText(TypeStr, xLeft, yCmd - yInterval, IFontSize, Color0, self)
                 DrawLeftText(BoolStr, xLeftP, yCmd - yInterval, IFontSize, Color1, self)
 
+            TypeStr = "Brush Depth [" + context.scene.Key_BrushDepth + "] : "
+            BoolStr = str(round(self.BrushDepthOffset, 2))
+            OpsStr = TypeStr + BoolStr
+            blf.size(font_id, IFontSize, 72)
+            TotalWidth = blf.dimensions(font_id, OpsStr)[0]
+            xLeft = region.width / 2 - TotalWidth / 2
+            xLeftP = xLeft + blf.dimensions(font_id, TypeStr)[0]
+            if self.alt:
+                DrawLeftText(TypeStr, xLeft, yCmd - yInterval * 3, IFontSize, Color0, self)
+                DrawLeftText(BoolStr, xLeftP, yCmd - yInterval * 3, IFontSize, Color1, self)
+            else:
+                DrawLeftText(TypeStr, xLeft, yCmd - yInterval * 2, IFontSize, Color0, self)
+                DrawLeftText(BoolStr, xLeftP, yCmd - yInterval * 2, IFontSize, Color1, self)
+
     bgl.glEnable(bgl.GL_BLEND)
     if region.width >= 850:
         if self.AskHelp == False:
@@ -895,7 +956,7 @@ def draw_callback_px(self, context):
             if region.width >= 850:
                 Help_FontSize = 15
                 Help_Interval = 20
-                yHelp = 200
+                yHelp = 220
 
             if self.ObjectMode or self.ProfileMode:
                 if self.ProfileMode:
@@ -912,9 +973,9 @@ def draw_callback_px(self, context):
                              Help_Interval * 2, Help_FontSize, UIColor, self)
                 DrawLeftText(": Profil Brush", 150 + t_panel_width, yHelp +
                              Help_Interval * 2, Help_FontSize, None, self)
-                DrawLeftText("[Ctrl + LMB]", xHelp, yHelp - Help_Interval * 5, Help_FontSize, UIColor, self)
+                DrawLeftText("[Ctrl + LMB]", xHelp, yHelp - Help_Interval * 6, Help_FontSize, UIColor, self)
                 DrawLeftText(": Move Cursor", 150 + t_panel_width, yHelp -
-                             Help_Interval * 5, Help_FontSize, None, self)
+                             Help_Interval * 6, Help_FontSize, None, self)
 
             if (self.ObjectMode == False) and (self.ProfileMode == False):
                 if self.CreateMode == False:
@@ -930,8 +991,10 @@ def draw_callback_px(self, context):
                 if self.CutMode == RECTANGLE:
                     DrawLeftText("MouseMove", xHelp, yHelp, Help_FontSize, UIColor, self)
                     DrawLeftText("[Alt]", xHelp, yHelp - Help_Interval, Help_FontSize, UIColor, self)
+                    DrawLeftText("[" + context.scene.Key_Solver + "]", xHelp, yHelp - Help_Interval * 2, Help_FontSize, UIColor, self)
                     DrawLeftText(": Dimension", 150 + t_panel_width, yHelp, Help_FontSize, None, self)
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list