[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [799] branches/ivygen/ivy_test.py: added many comments

Florian Meyer florianfelix at web.de
Fri Jul 16 19:30:30 CEST 2010


Revision: 799
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=799
Author:   testscreenings
Date:     2010-07-16 19:30:30 +0200 (Fri, 16 Jul 2010)

Log Message:
-----------
added many comments

Modified Paths:
--------------
    branches/ivygen/ivy_test.py

Modified: branches/ivygen/ivy_test.py
===================================================================
--- branches/ivygen/ivy_test.py	2010-07-16 17:24:21 UTC (rev 798)
+++ branches/ivygen/ivy_test.py	2010-07-16 17:30:30 UTC (rev 799)
@@ -36,7 +36,7 @@
             radius = bb_v.length
     return [center, radius]
 
-class IvyNode():
+class IvyNode(): #IvyNode Baseclass
     position = mathutils.Vector()
     primaryDir = mathutils.Vector((0,0,0,5))
     adhesionVector = mathutils.Vector()
@@ -46,7 +46,7 @@
     climb = True
 
 
-class IvyRoot(IvyNode):
+class IvyRoot(IvyNode): #not sure about this. why subclassing. can put everything into IvyNode
     nodes = []
     alive = True
     parents = 0
@@ -54,38 +54,14 @@
 
 
 class Ivy():
-    #the ivy size factor, influences the grow behaviour [0..0,1]
-    ivy_Size = 0.0
-    #leaf size factor [0..0,1]
-    ivy_LeafSize = 0.0
-    #branch size factor [0..0,1]
-    ivyBranchSize = 0.0
-    #ma_ximum length of an ivy branch segment that is freely floating [0..1]
-    ivy_MaxFloatLength = 1.0
-    #maximum distance for adhesion of scene object [0..1]
-    #ivy_MaxAdhesionDistance = 1.0 <<< from props
-    #weight for the primary grow vector [0..1]
-    #ivy_PrimaryWeight = 0.5 <<< from props
-    #weight for the random influence vector
-    #ivy_RandomWeight = 0.5 <<< from props
-    #weight for the gravity vector [0..1]
-    #ivy_GravityWeight = 0.5 <<< from props
-    #weight for the adhesion vector [0..1]
-    #ivy_AdhesionWeight = 0.5 <<< from props
-    #the probability of producing a new ivy root per iteration [0..1]
-    ivy_BranchingProbability = 0.25
-    #the probability of creating a new ivy leaf [0..1]
-    ivy_LeafProbability = 0.5
+
     #the ivyRoots
     ivy_Roots = []
-    '''
-    def __init__():
-        #probably a good idea to have this?
-        pass
-    '''
+
     def resetSettings(self):
         #probably resets the settings :)
         pass
+
     #initialize a new ivy root
     def seed(self):
         tmpSeed = IvyRoot()
@@ -96,7 +72,7 @@
     def grow(self, props):
         tmpRoot = IvyRoot() # create new RootNode
 
-        #generate random Vector
+        #generate random Vector wit slight upvector
         randVector = (mathutils.Vector((random.random()-0.5, random.random()-0.5, random.random()-0.5)) +
                      mathutils.Vector((0,0,0.2)))
 
@@ -108,9 +84,10 @@
         if tmpRoot.chainNumber == 0 or tmpRoot.chainNumber == self.ivy_Roots[-1].chainNumber:
             tmpRoot.chainNumber = self.ivy_Roots[-1].chainNumber + 1
         #print(self.ivy_Roots[-1].chainNumber, self.ivy_Roots[-1].position)
-        self.ivy_Roots.append(tmpRoot)
 
+        self.ivy_Roots.append(tmpRoot) #put into list of IvyNodes
 
+
     #compute the adhesion of scene objects at a point pos
     def computeAdhesion(self, position):
         pass
@@ -132,16 +109,16 @@
     upVector = mathutils.Vector((0,0,1))  #not used yet
     random.seed(props.ivySeed)  #controlling the random seed
 
-    IVY = Ivy()
+    IVY = Ivy() #create main IvyObject stores all the IvyNodes
     IVY.ivy_Roots = [] #empty the roots list
 
-    IVY.seed()
+    IVY.seed() #set inital IvyNode
 
-    for i in range(props.ivyIter):
+    for i in range(props.ivyIter): #for now usercontrollable growiterations
         IVY.grow(props)
 
 
-    createIvy(context, IVY)
+    createIvy(context, IVY) # create emptis at IvyRoots
 
 
     return




More information about the Bf-extensions-cvs mailing list