[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2155] branches/ivygen/truman_ivy/ add_curve_ivygen.py: - Added a check to make sure the point was not on the surface as this can cause infinite loop
Andrew Hale
TrumanBlending at gmail.com
Thu Jul 21 07:51:02 CEST 2011
Revision: 2155
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2155
Author: trumanblending
Date: 2011-07-21 05:51:02 +0000 (Thu, 21 Jul 2011)
Log Message:
-----------
- Added a check to make sure the point was not on the surface as this can cause infinite loop
Modified Paths:
--------------
branches/ivygen/truman_ivy/add_curve_ivygen.py
Modified: branches/ivygen/truman_ivy/add_curve_ivygen.py
===================================================================
--- branches/ivygen/truman_ivy/add_curve_ivygen.py 2011-07-21 05:48:36 UTC (rev 2154)
+++ branches/ivygen/truman_ivy/add_curve_ivygen.py 2011-07-21 05:51:02 UTC (rev 2155)
@@ -516,12 +516,20 @@
# Get the seeding point
seedPoint = context.scene.cursor_location
-
- if (ob.closest_point_on_mesh(seedPoint)[0] -
- seedPoint).length > self.maxFloatLength/2:
+
+ # Find the distance to the closest point
+ dist = (ob.closest_point_on_mesh(seedPoint)[0] - seedPoint).length
+
+ # If the distance is too far, cancel the operator
+ if dist > (radius * self.maxFloatLength / 2):
print("Invalid Root Location")
return {'CANCELLED'}
+ # If the point is on the surface move it outward slightly
+ if dist == 0.0:
+ seedPoint += (radius * self.maxFloatLength/10 *
+ ob.closest_point_on_mesh(seedPoint)[1])
+
# Fix the random seed
rand_seed(self.randomSeed)
More information about the Bf-extensions-cvs
mailing list