Skip to content

Commit f63e750

Browse files
author
Gemini
committed
remove properties for direct data class access
1 parent 99a1bc5 commit f63e750

File tree

5 files changed

+31
-236
lines changed

5 files changed

+31
-236
lines changed

examples/Camp_Envy_tie_prune_label.lpy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class Branch(BasicWood):
122122
self.contour = create_noisy_circle_curve(1, .2, 30)
123123

124124
def is_bud_break(self, num_buds_segment):
125-
return (rd.random() < 0.01*(1 - self.num_buds_segment/self.max_buds_segment))
125+
return (rd.random() < 0.01*(1 - self.num_buds_segment/self.growth.max_buds_segment))
126126

127127
def create_branch(self):
128128
self.num_buds_segment += 1
@@ -154,7 +154,7 @@ class Trunk(BasicWood):
154154
self.contour = create_noisy_circle_curve(1, .2, 30)
155155

156156
def is_bud_break(self, num_buds_segment):
157-
if (rd.random() > 0.2*(1 - num_buds_segment/self.max_buds_segment)):
157+
if (rd.random() > 0.2*(1 - num_buds_segment/self.growth.max_buds_segment)):
158158
return False
159159
return True
160160

@@ -186,7 +186,7 @@ class NonTrunk(BasicWood):
186186
self.contour = create_noisy_circle_curve(1, .2, 30)
187187

188188
def is_bud_break(self, num_buds_segment):
189-
return (rd.random() < 0.02*(1 - num_buds_segment/self.max_buds_segment))
189+
return (rd.random() < 0.02*(1 - num_buds_segment/self.growth.max_buds_segment))
190190

191191
def create_branch(self):
192192
if rd.random()>0.9:
@@ -291,7 +291,7 @@ def pruning_strategy(lstring): #Remove remnants of cut
291291
for j,i in enumerate(lstring):
292292
if i.name == 'C' and i[0].type.info.age > 6 and i[0].type.tying.has_tied == False and i[0].type.info.cut == False:
293293

294-
i[0].type.cut = True
294+
i[0].type.info.cut = True
295295
#print("Cutting", i[0].type.name)
296296
lstring = cut_using_string_manipulation(j, lstring)
297297
return True
@@ -528,7 +528,7 @@ bud(t) :
528528
parent_child_dict[t.type.name].append(new_object)
529529
#Store new object somewhere
530530
t.num_buds+=1
531-
t.type.num_branches+=1
531+
t.type.info.num_branches+=1
532532

533533
# set a different cross section for every branch
534534
if 'Leaf' not in new_object.name and 'Apple' not in new_object.name:

examples/Envy_tie_prune_label.lpy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Spur(BasicWood):
3636

3737
# Keep count of number of leaves to not go over max_leaves
3838
self.num_leaves = 0
39-
self.prunable = False
39+
self.info.prunable = False
4040

4141
# Every branch gets its own contour when it is constructed to ensure
4242
# branches each having a unique profile curve
@@ -77,7 +77,7 @@ class Branch(BasicWood):
7777
def is_bud_break(self, num_break_buds):
7878
if num_break_buds >= 1:
7979
return False
80-
return (rd.random() < 0.5*(1 - self.num_buds_segment/self.max_buds_segment))
80+
return (rd.random() < 0.5*(1 - self.num_buds_segment/self.growth.max_buds_segment))
8181

8282
def create_branch(self):
8383
self.num_buds_segment += 1
@@ -141,7 +141,7 @@ class NonTrunk(BasicWood):
141141
if not name:
142142
self.name = str(self.__class__.__name__) +'_'+ str(self.__class__.count)
143143
Branch.count+=1
144-
self.prunable = False
144+
self.info.prunable = False
145145

146146
# Every branch gets its own contour when it is constructed to ensure
147147
# branches each having a unique profile curve
@@ -255,7 +255,7 @@ def pruning_strategy(lstring): # Remove remnants of cut
255255
cut = False # Initialize the cut flag
256256
for j, i in enumerate(lstring): # Loop through each element in the lstring
257257
if i.name == 'C' and i[0].type.info.age > 6 and i[0].type.tying.has_tied == False and i[0].type.info.cut == False and i[0].type.info.prunable and i[0].type.tying.guide_target==-1:
258-
i[0].type.cut = True # Set the cut flag to True
258+
i[0].type.info.cut = True # Set the cut flag to True
259259
lstring = cut_from(j, lstring) # Cut the branch using string manipulation
260260
#TODO: Remove branch from parent_child dict and wire
261261
#if i[0].type.guide_target!=-1:
@@ -361,7 +361,7 @@ bud(t) :
361361
parent_child_dict[t.type.name].append(new_object)
362362
#Store new object somewhere
363363
t.num_buds+=1
364-
t.type.num_branches+=1
364+
t.type.info.num_branches+=1
365365

366366
# Set a curve for tertiary branches to follow as they grow
367367
if 'NonTrunk' in new_object.name:

examples/UFO_tie_prune_label.lpy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class Branch(BasicWood):
102102
def is_bud_break(self, num_buds_segment):
103103
if num_buds_segment >= 2:
104104
return False
105-
if (rd.random() < 0.2*(1 - self.num_buds/self.max_buds_segment)):
105+
if (rd.random() < 0.2*(1 - self.num_buds/self.growth.max_buds_segment)):
106106

107107
return True
108108

@@ -319,7 +319,7 @@ bud(t) :
319319
parent_child_dict[t.type.name].append(new_object)
320320
#Store new object somewhere
321321
t.num_buds+=1
322-
t.type.num_branches+=1
322+
t.type.info.num_branches+=1
323323

324324
if 'LittleBranch' in new_object.name:
325325
import time

0 commit comments

Comments
 (0)