[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2762] trunk/py/scripts/addons/ add_curve_sapling/__init__.py: Fix for 2 bugs:

Andrew Hale TrumanBlending at gmail.com
Sat Dec 10 12:33:44 CET 2011


Revision: 2762
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2762
Author:   trumanblending
Date:     2011-12-10 11:33:25 +0000 (Sat, 10 Dec 2011)
Log Message:
-----------
Fix for 2 bugs:
 - Setting any of the branch lengths to 0.0 results in divide by zero. Min value for the length setting is now 0.000001
 - Preset export failed with the change to the way that vector properties were stored. Now we just store a slice copy of the vector in the export.

Modified Paths:
--------------
    trunk/py/scripts/addons/add_curve_sapling/__init__.py

Modified: trunk/py/scripts/addons/add_curve_sapling/__init__.py
===================================================================
--- trunk/py/scripts/addons/add_curve_sapling/__init__.py	2011-12-10 08:09:42 UTC (rev 2761)
+++ trunk/py/scripts/addons/add_curve_sapling/__init__.py	2011-12-10 11:33:25 UTC (rev 2762)
@@ -197,7 +197,7 @@
         default=3, update=update_tree)
     length = FloatVectorProperty(name='Length',
         description='The relative lengths of each branch level (nLength)',
-        min=0.0,
+        min=0.000001,
         default=[1, 0.3, 0.6, 0.45],
         size=4, update=update_tree)
     lengthV = FloatVectorProperty(name='Length Variation',
@@ -432,12 +432,12 @@
             # so we need something custom. This is it
             data = []
             for a, b in (self.as_keywords(ignore=("chooseSet", "presetName", "limitImport", "do_update"))).items():
-                # If the property is a vector property then evaluate it and
-                # convert to a string
-                if (repr(b))[:3] == 'bpy':
-                    data.append((a, eval('(self.' + a + ')[:]')))
+                # If the property is a vector property then add the slice to the list
+                try:
+                    len(b)
+                    data.append((a, b[:]))
                 # Otherwise, it is fine so just add it
-                else:
+                except:
                     data.append((a, b))
             # Create the dict from the list
             data = dict(data)



More information about the Bf-extensions-cvs mailing list