Skip to content

Commit

Permalink
Change setup slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
keenanlang committed Aug 7, 2024
1 parent 61046ff commit c4af65e
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions gestalt/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,8 @@ class LayoutNode(GroupNode):
def __init__(self, name=None, layout={}, loc=None):
super(LayoutNode, self).__init__("Layout", name=name, layout=layout, loc=loc)

self.makeInternal(String, "repeat-over", "")
self.makeInternal(String, "index-variable", "N")
self.makeInternal(String, "value-variable", "val")
self.makeInternal(String, "repeat-over", "")
self.makeInternal(String, "variable", "N")
self.makeInternal(Number, "start-at", 0)
self.makeInternal(Number, "padding", 0)

Expand All @@ -371,12 +370,12 @@ def apply(self, generator, data={}):
#repeat.apply(data)

macrolist = data.get(str(repeat))

try:
if not macrolist:
macrolist = [ {str(index_var) : x} for x in range(int(start_at), int(start_at) + int(repeat)) ]
macrolist = range(int(start_at), int(start_at) + int(repeat))
elif not isinstance(macrolist, list):
macrolist = [ {str(index_var) : x} for x in range(int(start_at), int(start_at) + int(macrolist)) ]
macrolist = range(int(start_at), int(start_at) + int(macrolist))
except:
macrolist = List(repeat).val()

Expand All @@ -386,15 +385,15 @@ def apply(self, generator, data={}):
self["last-y"] = 0

if macrolist:
for macroset in macrolist:
for item in macrolist:
geom = output["geometry"].val()

child_macros = copy.copy(data)

if isinstance(macroset, dict):
child_macros.update(macroset)
if isinstance(item, dict):
child_macros.update(item)
else:
child_macros.update({str(value_var) : macroset})
child_macros.update({str(value_var) : item})

child_macros.update({
"__parentx__" : int(geom["x"]),
Expand Down

0 comments on commit c4af65e

Please sign in to comment.