[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1079] trunk/py/scripts/addons/ add_curve_aceous_galore.py: == Curve Galore ==

Florian Meyer florianfelix at web.de
Sun Sep 26 03:00:22 CEST 2010


Revision: 1079
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1079
Author:   testscreenings
Date:     2010-09-26 03:00:22 +0200 (Sun, 26 Sep 2010)

Log Message:
-----------
== Curve Galore ==
- added rounded rectangle to miscCurve (with some minor enhancements)
- some spell checking and cleanup

Modified Paths:
--------------
    trunk/py/scripts/addons/add_curve_aceous_galore.py

Modified: trunk/py/scripts/addons/add_curve_aceous_galore.py
===================================================================
--- trunk/py/scripts/addons/add_curve_aceous_galore.py	2010-09-24 03:50:13 UTC (rev 1078)
+++ trunk/py/scripts/addons/add_curve_aceous_galore.py	2010-09-26 01:00:22 UTC (rev 1079)
@@ -181,9 +181,9 @@
 
 ##------------------------------------------------------------
 # 2DCurve: Miscellaneous.: Diamond, Arrow1, Arrow2, Square, ....
-def MiscCurve(type=1, a=1.0, b=0.5, c=90.0):
+def MiscCurve(type=1, a=1.0, b=0.5, c=1.0):
     """
-    MiscCurve( type=1, a=1.0, b=0.5, c=90.0 )
+    MiscCurve( type=1, a=1.0, b=0.5, c=1.0 )
     
     Create miscellaneous curves
     
@@ -205,28 +205,51 @@
     newpoints = []
     a*=0.5
     b*=0.5
-    if type ==1:
+    if type == 1:
         ## diamond:
         newpoints = [ [ 0.0, b, 0.0 ], [ a, 0.0, 0.0 ], [ 0.0, -b, 0.0 ], [ -a, 0.0, 0.0 ]  ]
-    elif type ==2:
+    elif type == 2:
         ## Arrow1:
         newpoints = [ [ -a, b, 0.0 ], [ a, 0.0, 0.0 ], [ -a, -b, 0.0 ], [ 0.0, 0.0, 0.0 ]  ]
-    elif type ==3:
+    elif type == 3:
         ## Arrow2:
         newpoints = [ [ -1.0, b, 0.0 ], [ -1.0+a, b, 0.0 ],
         [ -1.0+a, 1.0, 0.0 ], [ 1.0, 0.0, 0.0 ],
         [ -1.0+a, -1.0, 0.0 ], [ -1.0+a, -b, 0.0 ],
         [ -1.0, -b, 0.0 ] ]
-    elif type ==4:
+    elif type == 4:
         ## Rounded square:
         newpoints = [ [ -a, b-b*0.2, 0.0 ], [ -a+a*0.05, b-b*0.05, 0.0 ], [ -a+a*0.2, b, 0.0 ],
         [ a-a*0.2, b, 0.0 ], [ a-a*0.05, b-b*0.05, 0.0 ], [ a, b-b*0.2, 0.0 ],
         [ a, -b+b*0.2, 0.0 ], [ a-a*0.05, -b+b*0.05, 0.0 ], [ a-a*0.2, -b, 0.0 ],
         [ -a+a*0.2, -b, 0.0 ], [ -a+a*0.05, -b+b*0.05, 0.0 ], [ -a, -b+b*0.2, 0.0 ] ]
+    elif type == 5:
+        ## Rounded Rectangle II:
+        newpoints = []
+        x = a / 2
+        y = b / 2
+        r = c / 2
+        
+        if r > x:
+            r = x - 0.0001
+        if r > y:
+            r = y - 0.0001
+        
+        if r>0:
+            newpoints.append([-x+r,y,0])
+            newpoints.append([x-r,y,0])
+            newpoints.append([x,y-r,0])
+            newpoints.append([x,-y+r,0])
+            newpoints.append([x-r,-y,0])
+            newpoints.append([-x+r,-y,0])
+            newpoints.append([-x,-y+r,0])
+            newpoints.append([-x,y-r,0])
+        else:
+            newpoints.append([-x,y,0])
+            newpoints.append([x,y,0])
+            newpoints.append([x,-y,0])
+            newpoints.append([-x,-y,0])
 
-    #elif type ==15:
-        ## :
-        #newpoints = [ [ x,y,z ] ]
     else:
         ## Square:
         newpoints = [ [ -a, b, 0.0 ], [ a, b, 0.0 ], [ a, -b, 0.0 ], [ -a, -b, 0.0 ]  ]
@@ -814,18 +837,19 @@
     #### MiscCurve properties
     MiscCurveType = IntProperty(name="Type",
                     min=1, soft_min=1,
-                    max=5, soft_max=5,
+                    max=6, soft_max=6,
                     default=1,
-                    description="Type of ProfileCurve")
+                    description="Type of MiscCurve")
     MiscCurvevar1 = FloatProperty(name="var_1",
                     default=1.0,
-                    description="var1 of ProfileCurve")
+                    description="var1 of MiscCurve")
     MiscCurvevar2 = FloatProperty(name="var_2",
                     default=0.5,
-                    description="var2 of ProfileCurve")
-    MiscCurvevar3 = FloatProperty(name="var_3", # doesn't seem to do anything
-                    default=90.0,
-                    description="var3 of ProfileCurve")
+                    description="var2 of MiscCurve")
+    MiscCurvevar3 = FloatProperty(name="var_3",
+                    default=0.1,
+                    min=0, soft_min=0,
+                    description="var3 of MiscCurve")
                     
     #### Common properties
     innerRadius = FloatProperty(name="Inner radius",
@@ -973,7 +997,7 @@
         # general options        
         col = layout.column()
         col.prop(self, 'GalloreType')
-        col.label(text=self.GalloreType+" Options")
+        col.label(text=self.GalloreType + " Options")
 
         # options per GalloreType
         box = layout.box()
@@ -983,9 +1007,10 @@
             box.prop(self, 'ProfileCurvevar2')
         if self.GalloreType == 'Miscellaneous':
             box.prop(self, 'MiscCurveType')
-            box.prop(self, 'MiscCurvevar1')
-            box.prop(self, 'MiscCurvevar2')
-            #box.prop(self, 'MiscCurvevar3') # doesn't seem to do anything
+            box.prop(self, 'MiscCurvevar1', text='Width')
+            box.prop(self, 'MiscCurvevar2', text='Height')
+            if self.MiscCurveType == 5:
+                box.prop(self, 'MiscCurvevar3', text='Rounded')
         if self.GalloreType == 'Flower':
             box.prop(self, 'petals')
             box.prop(self, 'petalWidth')




More information about the Bf-extensions-cvs mailing list