[Bf-extensions-cvs] [c86080a] master: Add mesh extra objects: Update to version 0.3.1

lijenstina noreply at git.blender.org
Fri Dec 30 20:34:53 CET 2016


Commit: c86080a455579a8c770545e33b95513b43e1a43b
Author: lijenstina
Date:   Fri Dec 30 20:33:05 2016 +0100
Branches: master
https://developer.blender.org/rBAc86080a455579a8c770545e33b95513b43e1a43b

Add mesh extra objects: Update to version 0.3.1

General Pep8 cleanup
Removed unused variables and imports
Removed a panel from add_empty_as_parent
Standardized the property definitions
across all the scripts
Moved scene props from third_domes_panel_271
to init for proper removal
Added a Enum prop for mesh type in teapot
Fixed a small issue with Geodesic domes self.reports
(problem with value fields message spam)
Fixed props names in Geodesic domes
Consistent tooltips
Reorganized menus:
Mechanical Menu including Pipe joints, Mesh gear
Added separators

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

M	add_mesh_extra_objects/Blocks.py
M	add_mesh_extra_objects/Wallfactory.py
M	add_mesh_extra_objects/__init__.py
M	add_mesh_extra_objects/add_empty_as_parent.py
M	add_mesh_extra_objects/add_mesh_3d_function_surface.py
M	add_mesh_extra_objects/add_mesh_beam_builder.py
M	add_mesh_extra_objects/add_mesh_gears.py
M	add_mesh_extra_objects/add_mesh_gemstones.py
M	add_mesh_extra_objects/add_mesh_honeycomb.py
M	add_mesh_extra_objects/add_mesh_menger_sponge.py
M	add_mesh_extra_objects/add_mesh_pipe_joint.py
M	add_mesh_extra_objects/add_mesh_pyramid.py
M	add_mesh_extra_objects/add_mesh_round_brilliant.py
M	add_mesh_extra_objects/add_mesh_round_cube.py
M	add_mesh_extra_objects/add_mesh_solid.py
M	add_mesh_extra_objects/add_mesh_star.py
M	add_mesh_extra_objects/add_mesh_supertoroid.py
M	add_mesh_extra_objects/add_mesh_teapot.py
M	add_mesh_extra_objects/add_mesh_torusknot.py
M	add_mesh_extra_objects/add_mesh_twisted_torus.py
M	add_mesh_extra_objects/add_mesh_vertex.py
M	add_mesh_extra_objects/geodesic_domes/__init__.py
M	add_mesh_extra_objects/geodesic_domes/add_shape_geodesic.py
M	add_mesh_extra_objects/geodesic_domes/forms_271.py
M	add_mesh_extra_objects/geodesic_domes/geodesic_classes_271.py
M	add_mesh_extra_objects/geodesic_domes/third_domes_panel_271.py
M	add_mesh_extra_objects/geodesic_domes/vefm_271.py

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

diff --git a/add_mesh_extra_objects/Blocks.py b/add_mesh_extra_objects/Blocks.py
index 36ef5c0..f798cf5 100644
--- a/add_mesh_extra_objects/Blocks.py
+++ b/add_mesh_extra_objects/Blocks.py
@@ -1,29 +1,5 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you may redistribute it, and/or
-# modify it, under the terms of the GNU General Public License
-# as published by the Free Software Foundation - either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, write to:
-#
-#   the Free Software Foundation Inc.
-#   51 Franklin Street, Fifth Floor
-#   Boston, MA 02110-1301, USA
-#
-# or go online at: http://www.gnu.org/licenses/ to view license options.
-#
-# ***** END GPL LICENCE BLOCK *****
+# GPL # "author":
 
-
-##
-#
 # Module notes:
 #
 # Grout needs to be implemented.
@@ -38,30 +14,25 @@
 # Negative grout width creates a pair of phantom blocks, seperated by grout
 #   width, inside the edges.
 # if block width variance is 0, and edging is on, right edge blocks create a "vertical seam".
-#
-##
 
-# <pep8-80 compliant>
 
-import bpy, time, math
+import bpy
 from random import random
-from math import fmod, sqrt, sin, cos, atan
+from math import fmod, sqrt, sin, cos, atan, pi as PI
 
-#A few constants
+# A few constants
 SMALL = 0.000000000001
-NOTZERO = 0.01 # for values that must be != 0; see UI options/variables -
-# sort of a bug to be fixed.
-PI = math.pi
+NOTZERO = 0.01  # for values that must be != 0; see UI options/variables - sort of a bug to be fixed.
 
-#global variables
+# global variables
 
-#General masonry Settings
+# General masonry Settings
 settings = {'w': 1.2, 'wv': 0.3, 'h': .6, 'hv': 0.3, 'd': 0.3, 'dv': 0.1,
             'g': 0.1, 'gv': 0.07, 'gd': 0.01, 'gdv': 0.0, 'b': 0, 'bv': 0,
-            'f': 0.0, 'fv': 0.0, 't': 0.0, 'sdv': 0.1, 'hwt': 0.5, 'aln':0,
-            'wm': 0.8, 'hm': 0.3, 'dm':0.1,
-            'woff':0.0, 'woffv':0.0, 'eoff':0.3, 'eoffv':0.0, 'rwhl':1,
-            'hb':0, 'ht':0, 'ge':0, 'physics':0}
+            'f': 0.0, 'fv': 0.0, 't': 0.0, 'sdv': 0.1, 'hwt': 0.5, 'aln': 0,
+            'wm': 0.8, 'hm': 0.3, 'dm': 0.1,
+            'woff': 0.0, 'woffv': 0.0, 'eoff': 0.3, 'eoffv': 0.0, 'rwhl': 1,
+            'hb': 0, 'ht': 0, 'ge': 0, 'physics': 0}
 # 'w':width 'wv':widthVariation
 # 'h':height 'hv':heightVariation
 # 'd':depth 'dv':depthVariation
@@ -83,21 +54,21 @@ settings = {'w': 1.2, 'wv': 0.3, 'h': .6, 'hv': 0.3, 'd': 0.3, 'dv': 0.1,
 # 'physics': set up for physics
 
 # dims = area of wall (face)
-dims = {'s':0, 'e':PI*3/2, 'b':0.1, 't':12.3} # radial
+dims = {'s': 0, 'e': PI * 3 / 2, 'b': 0.1, 't': 12.3}  # radial
 # 's':start x or theta 'e':end x or theta 'b':bottom z or r 't':top z or r
 # 'w' = e-s and h = t-b; calculated to optimize for various operations/usages
-#dims = {'s':-12, 'e':15, 'w':27, 'b':-15., 't':15., 'h':30}
-#dims = {'s':-bayDim/2, 'e':bayDim/2, 'b':-5., 't':10.} # bay settings?
+# dims = {'s':-12, 'e':15, 'w':27, 'b':-15., 't':15., 'h':30}
+# dims = {'s':-bayDim/2, 'e':bayDim/2, 'b':-5., 't':10.} # bay settings?
 
-radialized = 0 # Radiating from one point - round/disc; instead of square
-slope = 0 # Warp/slope; curved over like a vaulted tunnel
+radialized = 0  # Radiating from one point - round/disc; instead of square
+slope = 0  # Warp/slope; curved over like a vaulted tunnel
 # 'bigblock': merge adjacent blocks into single large blocks
-bigBlock = 0 # Merge blocks
+bigBlock = 0  # Merge blocks
 
 # Gaps in blocks for various apertures.
-#openingSpecs = []
-openingSpecs = [{'w':0.5, 'h':0.5, 'x':0.8, 'z':2.7, 'rp':1, 'b':0.0,
-                 'v':0, 'vl':0, 't':0, 'tl':0}]
+# openingSpecs = []
+openingSpecs = [{'w': 0.5, 'h': 0.5, 'x': 0.8, 'z': 2.7, 'rp': 1, 'b': 0.0,
+                 'v': 0, 'vl': 0, 't': 0, 'tl': 0}]
 # 'w': opening width, 'h': opening height,
 # 'x': horizontal position, 'z': vertical position,
 # 'rp': make multiple openings, with a spacing of x,
@@ -107,55 +78,59 @@ openingSpecs = [{'w':0.5, 'h':0.5, 'x':0.8, 'z':2.7, 'rp':1, 'b':0.0,
 
 # Add blocks to make platforms.
 shelfExt = 0
-#shelfSpecs = []
-shelfSpecs = {'w':0.5, 'h':0.5, 'd': 0.3, 'x':0.8, 'z':2.7}
+shelfSpecs = {'w': 0.5, 'h': 0.5, 'd': 0.3, 'x': 0.8, 'z': 2.7}
 # 'w': block width, 'h': block height, 'd': block depth (shelf size; offset from wall)
 # 'x': horizontal start position, 'z': vertical start position
 
 # Add blocks to make steps.
 stepMod = 0
-stepSpecs = {'x':0.0, 'z':-10, 'w':10.0, 'h':10.0,
-    'v':0.7, 't':1.0, 'd':1.0 }
+stepSpecs = {'x': 0.0, 'z': -10, 'w': 10.0, 'h': 10.0,
+            'v': 0.7, 't': 1.0, 'd': 1.0}
 # 'x': horizontal start position, 'z': vertical start position,
 # 'w': step area width, 'h': step area height,
 # 'v': riser height, 't': tread width, 'd': block depth (step size; offset from wall)
 
 
-    #easier way to get to the random function
-def rnd(): return random()
+# easier way to get to the random function
+def rnd():
+    return random()
+
 
-    #random number from -0.5 to 0.5
-def rndc(): return (random() - 0.5)
+# random number from -0.5 to 0.5
+def rndc():
+    return (random() - 0.5)
 
-    #random number from -1.0 to 1.0
-def rndd(): return (random() - 0.5)*2.0
 
+# random number from -1.0 to 1.0
+def rndd():
+    return (random() - 0.5) * 2.0
 
-#Opening Test suite
-#opening test function
 
-def test(TestN = 13):
-    dims = {'s':-29., 'e':29., 'b':-6., 't':TestN*7.5}
+# Opening Test suite
+# opening test function
+
+def test(TestN=13):
+    dims = {'s': -29., 'e': 29., 'b': -6., 't': TestN * 7.5}
     openingSpecs = []
     for i in range(TestN):
         x = (random() - 0.5) * 6
-        z = i*7.5
-        v = .2 + i*(3./TestN)
-        vl = 3.2 - i*(3./TestN)
+        z = i * 7.5
+        v = .2 + i * (3. / TestN)
+        vl = 3.2 - i * (3. / TestN)
         t = 0.3 + random()
         tl = 0.3 + random()
-        rn = random()*2
-        openingSpecs += [{'w':3.1 + rn, 'h':0.3 + rn, 'x':float(x),
-                          'z':float(z), 'rp':0, 'b':0.,
-                          'v':float(v), 'vl':float(vl),
-                          't':float(t), 'tl':float(tl)}]
+        rn = random() * 2
+        openingSpecs += [{'w': 3.1 + rn, 'h': 0.3 + rn, 'x': float(x),
+                          'z': float(z), 'rp': 0, 'b': 0.,
+                          'v': float(v), 'vl': float(vl),
+                          't': float(t), 'tl': float(tl)}]
     return dims, openingSpecs
 
-#dims, openingSpecs = test(15)
+# dims, openingSpecs = test(15)
 
 
-#For filling a linear space with divisions
-def fill(left, right, avedst, mindst=0.0, dev=0.0, pad=(0.0,0.0), num=0,
+# For filling a linear space with divisions
+def fill(left, right, avedst, mindst=0.0, dev=0.0, pad=(0.0, 0.0), num=0,
          center=0):
     __doc__ = """\
     Fills a linear range with points and returns an ordered list of those points
@@ -172,32 +147,34 @@ def fill(left, right, avedst, mindst=0.0, dev=0.0, pad=(0.0,0.0), num=0,
     num: substitutes a numerical limit for the right limit.  fill will then make
         a num+1 element list
     center: flag to center the elements in the range, 0 == disabled
-        """
+    """
 
     poslist = [left]
-    curpos = left+pad[0]
+    curpos = left + pad[0]
 
     # Set offset by average spacing, then add blocks (fall through);
     # if not at right edge.
     if center:
-        curpos += ((right-left-mindst*2)%avedst)/2+mindst
-        if curpos-poslist[-1]<mindst: curpos = poslist[-1]+mindst+rnd()*dev/2
+        curpos += ((right - left - mindst * 2) % avedst) / 2 + mindst
+        if curpos - poslist[-1] < mindst:
+            curpos = poslist[-1] + mindst + rnd() * dev / 2
 
         # clip to right edge.
-        if (right-curpos<mindst) or (right-curpos< mindst-pad[1]):
+        if (right - curpos < mindst) or (right - curpos < mindst - pad[1]):
             poslist.append(right)
             return poslist
 
-        else: poslist.append(curpos)
+        else:
+            poslist.append(curpos)
 
-    #unused... for now.
+    # unused... for now.
     if num:
         idx = len(poslist)
 
-        while idx<num+1:
-            curpos += avedst+rndd()*dev
-            if curpos-poslist[-1]<mindst:
-                curpos = poslist[-1]+mindst+rnd()*dev/2
+        while idx < num + 1:
+            curpos += avedst + rndd() * dev
+            if curpos - poslist[-1] < mindst:
+                curpos = poslist[-1] + mindst + rnd() * dev / 2
             poslist.append(curpos)
             idx += 1
 
@@ -205,19 +182,19 @@ def fill(left, right, avedst, mindst=0.0, dev=0.0, pad=(0.0,0.0), num=0,
 
     # make block edges
     else:
-        while True: # loop for blocks
-            curpos += avedst+rndd()*dev
-            if curpos-poslist[-1]<mindst:
-                curpos = poslist[-1]+mindst+rnd()*dev/2
+        while True:  # loop for blocks
+            curpos += avedst + rndd() * dev
+            if curpos - poslist[-1] < mindst:
+                curpos = poslist[-1] + mindst + rnd() * dev / 2
             # close off edges at limit
-            if (right-curpos<mindst) or (right-curpos< mindst-pad[1]):
+            if (right - curpos < mindst) or (right - curpos < mindst - pad[1]):
                 poslist.append(right)
                 return poslist
-
-            else: poslist.append(curpos)
+            else:
+                poslist.append(curpos)
 
 
-#For generating block geometry
+# For generating block geometry
 def MakeABlock(bounds, segsize, vll=0, Offsets=None, FaceExclude=[],
                bevel=0, xBevScl=1):
     __doc__ = """\
@@ -241,68 +218,76 @@ def MakeABlock(bounds, segsize, vll=0, Offsets=None, FaceExclude=[],
             7:right_top_front,
             ]
     FaceExclude: list of faces to exclude from the faces list.  see bounds above for indices
-    xBevScl: how much to divide the end (+-

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list