[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2157] branches/ivygen/pkhg_ivy/ testditNew.py: There is more debugging output available
Peter K.H. Gragert
pkhgragert at gmail.com
Thu Jul 21 17:42:09 CEST 2011
Revision: 2157
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2157
Author: pkhg
Date: 2011-07-21 15:42:09 +0000 (Thu, 21 Jul 2011)
Log Message:
-----------
There is more debugging output available
Put the console window besides the Blender window to see
what happens.
Modified Paths:
--------------
branches/ivygen/pkhg_ivy/testditNew.py
Modified: branches/ivygen/pkhg_ivy/testditNew.py
===================================================================
--- branches/ivygen/pkhg_ivy/testditNew.py 2011-07-21 10:26:50 UTC (rev 2156)
+++ branches/ivygen/pkhg_ivy/testditNew.py 2011-07-21 15:42:09 UTC (rev 2157)
@@ -21,14 +21,14 @@
bl_info = {
"name": "IvyGen",
"author": "testscreenings, PKHG, TrumanBlending",
- "version": (0, 0, 2),
+ "version": (0, 0, 3),
"blender": (2, 5, 8),
- "api": 38479,
+ "api": 38554, #21 July 2011 SVN compiled
"location": "toolspanel! (View3D T if needed)",
"description": "Adds generated ivy to an object.",
"warning": "Script in Beta",
- "wiki_url": "",
- "tracker_url": "",
+ "wiki_url": "http://www.petergragert.info/pmwiki/pmwiki.php/Ivy/Source",
+ "tracker_url": "http://www.petergragert.info/pmwiki/pmwiki.php/Ivy/Source",
"category": "Add Curve"}
@@ -152,13 +152,24 @@
scene = bpy.context.scene
print("\n======= start Ivy Curves")
startTime = time()
+ counter = -1
# Loop over all roots to generate its nodes
for root in IVY.ivyRoots:
+ timeNow = time()
# Only grow if more than one node
+ counternew = int(timeNow - startTime) #only full seconds printed
+ if counternew > counter:
+ print("time used Curves", counternew)
+ counter = counternew
+ if timeNow - startTime > scene.maxTimeCreateIvyCurves:
+ break
+ print("L166 len(root.ivyNodes) = ",len(root.ivyNodes))
if len(root.ivyNodes) > 1:
timeNow = time()
- if timeNow - startTime > scene.maxTimeCreateIvyCurves:
- break
+ if counternew > counter:
+ print("time used Curves L170", counternew)
+ counter = counternew
+
# Calculate the local radius
local_ivyBranchRadius = 1 / (root.parents + 1) + 1
splineVerts = deque()
@@ -167,6 +178,11 @@
appendR = splineRadii.append
# Loop over all nodes in the root
for i, n in enumerate(root.ivyNodes):
+ timeNow = time()
+ if counternew > counter:
+ print("time used Curves L170,i,n ", counternew, i, n)
+ counter = counternew
+
# Calculate the weighting for the node
weight = n.length / root.ivyNodes[-1].length
ivyRad = (local_ivyBranchRadius *
@@ -432,15 +448,16 @@
self.maxFloatLength = 1
self.randomSeed = 0
self.maxIvyLength = 0.2
- @classmethod
- def poll(self, context):
- # Check if there's an object and whether it's a mesh
- ob = context.active_object
- if (ob is not None) and\
- (ob.type == 'MESH') and\
- (context.mode == 'OBJECT'):
- return True
- return False
+
+# @classmethod
+# def poll(self, context):
+# # Check if there's an object and whether it's a mesh
+# ob = context.active_object
+# if (ob is not None) and\
+# (ob.type == 'MESH') and\
+# (context.mode == 'OBJECT'):
+# return True
+# return False
def execute(self, context):
scene = bpy.context.scene
@@ -449,6 +466,7 @@
self.maxIvyLength = scene.maxIvyLength
print("\n====== Start IvyGen")
startTime = time()
+ counter = -1
# Get the selected object
ob = context.active_object
@@ -462,15 +480,15 @@
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 dist > (radius * self.maxFloatLength / 2 + 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])
-
+ print("dbg L474 seedPoint",seedPoint)
# Fix the random seed
rand_seed(self.randomSeed)
@@ -482,13 +500,16 @@
checkAlive = True
maxLength = radius * self.maxIvyLength
-
+ print("dbg L486 maxLength - IVY.maxLength",maxLength - IVY.maxLength)
# Grow until 200 roots is reached or backup counter exceeds limit
#timelimit exceeded (prevent a too long loop)
while checkAlive and (IVY.maxLength < maxLength):
IVY.grow(radius, ob)
timeNow = time()
- print("time used", timeNow - startTime)
+ counternew = int(timeNow - startTime) #only full seconds printed
+ if counternew > counter:
+ print("time used", counternew)
+ counter = counternew
# if timeNow - startTime > 10:
if timeNow - startTime > scene.maxTimeIvyGeneration:
break
More information about the Bf-extensions-cvs
mailing list