Jump to content
Developer Wiki and Function Reference Links ×

Repeat / Loop a wrapped script


Recommended Posts

Hi all,

 

Just looking at Marionette for the first time for an upcoming project so apologies if I'm missing something obvious!

 

What I'm trying to create is a network which will generate a series of semi random tiles within a given set of paramaters. Something kind of like this:

 

image.thumb.png.b179d21d571fd2f20005ac38eecc394c.png

 

I've created a network which creates the first tile, then takes the top two vertices of that tile, adds a space, and uses those as the starting points for a new tile. Then the resulting tile is fed into a copy of the network and so on:

 

image.thumb.png.0e79ed8343d0e9c816971f98f773c1a3.png

 

So it's somewhat working. :) My question is, is there a way to get the wrapped script to repeat automatically, so it's not just copied and pasted like I have done, or is this a python job? Essentially it would be a for / while loop which keeps going untill the top vetex of a tile hits a maximum and then stops.

 

Thanks!

 

- Mick

 

Link to comment
  • Marionette Maven

There's not a traditional method of looping in Marionette, but if you incorporate the Sequence/Range/Series nodes, they can help to facilitate behavior similar to a loop.

Take a look at those, and if you need some guidance let me know and I'll try to find some time on Monday to help guide you 🙂

 

This will just be a matter of list manipulation, so check out all of the Data Flow nodes.

Link to comment

Thanks Marissa! I've had a look at those nodes, but I still can't quite figure it I'm afraid so any pointers would be great. My issue is that my wrapped network needs to be ran each time to generate the new starting points for the next tile, and I can't see how to implement this with any of the existing nodes. 

 

My network takes two starting points a and b then adds a random amount to the y value of each to make points c and d - to make the four points of a quad. Then it takes c and d, adds a vertical spacing amount to each, and then the new c and d should be the start of the next tile, but I'm at a loss as to how to get this to happen, without my original solution of just putting copies of the wrapped network one after the other. 

Link to comment
  • 1 month later...
  • Vectorworks, Inc Employee

I've actually done it. It doesn't convert to an object node. The "Set 2D Vertex" node fails inside the object node. @Marissa Farrell can you confirm?

@mickcullinan you need to pick the offset values out of a list of random values and apply those offsets to the vertices in each poly. Looks a bit messy because I was not able to enter more than one value for the "Set 2D Vertex" node. I think that is actually supposed to work. I suppose you want the top and bottom rows to remain flat on the outside. The "Remove At" node is good for picking every nth value. Careful if you have more offset values than polygons because the last poly will receive the last value in the list. Better to strip the excess ones using "Split List" (although that's kinda hacky).

This can probably be done more elegantly but it works.

image.thumb.png.27da1dcd1bd325b62bf2db1c6445868a.pngimage.thumb.png.a616ff3aa2be89cadafbaa755e037da9.png

Array.vwx

Link to comment
  • Vectorworks, Inc Employee

Added some numbering and introduced a second random parameter. Now, each of the four vertices is randomly moved in y direction. It's actually something I needed as well so you're in luck 🙂. I have filed a bug about the object node not playing nice with the "Set 2D Vertex" node so once that's fixed this will be quite a fun object to play with.

image.thumb.png.a6080980246b1a5facbd5d26e0f5f311.png

 

image.thumb.png.2a67f37e12896459f7614bc0305a1f22.png

Array-IT1.vwx

  • Like 2
Link to comment
  • Vectorworks, Inc Employee

After some major refactoring (actually, a rewrite), the network has become more elegant and much smaller. Modifying the points before they are fed into the polygon proves much faster and more manageable. Now, it's also easier to add more options (movement of vertices along the x axis?). And since the "Set 2D vertex" node is now redundant, the whole Marionette works as an object.

1952482740_WallPanel.thumb.gif.bb056892cf0cabd9e4c67c4f80fbd377.gif

 

image.thumb.png.bf7b87319d401b2b1c084f658d1191fd.png

Array-IT2.vwx

Edited by Stephan Moenninghoff
  • Like 1
Link to comment
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...