Jump to content
Developer Wiki and Function Reference Links ×

How to loop/repeat nodes across multiple objects properly?


ASag

Recommended Posts

Hello All,

 

I’m still new to Marionette, but I’m trying to automate parts of our team's workflow. I’ve built multiple marionette networks that work perfectly for a single object, but the problem is that I need them to work across multiple/variable numbers of objects. The moment I try introducing multiple starting objects, I fall flat on my face.

 

I have multiple examples I could post, but if someone can point me in a direction with 1 of them, that will allow me to understand the proper way to do it for my other ones.

 

The attached file (2022 File) is basically a copy + paste of an example I found on another thread here weeks ago, but it is part of what we do in our workflow. I need to take polygons that we created and break them into individual lines. I realize this is easy to do with a menu command (convert to lines), but it is a small part of a bigger network we are trying to make.

In the attached marionette, I have 4 polygons and the script only works properly on 1 of them (the most recently made one). Looking at the code/debug, I think I understand the fundamental issue, but I have been unable to figure out how to actually make it work properly...

If someone could directionally point me on how to solve this, I think it would answer a lot of other nodes where I am currently stuck on similar issues.

Screenshot 2023-06-02 at 9.46.05 AM.png

ScriptExample2022.vwx

Link to comment

Hello,

 

sometimes it can be tricky to manage lists in Marionette networks. Fortunately in this case its an easy fix.

Here is how the network could look like:

grafik.thumb.png.a5ba228eb70d49d6aef52fda55c01cee.png

 

First of all there was an error in your network. The "Sequence" node generated one index too much, so i replaced it with the "Series" node.

 

 

Apart from that you have to manage the inputs of the "Get 2D Edge" node to make this network run correctly.

Here are your inputs to the "Get 2D Edge" node before the fix:

grafik.thumb.png.a90d42d176787716533066afd0ab9cd1.png 

As you can see you have a mismatch of handles to a polygon and the indices. So what you get is the first edge of the first polygon, the second edge of the second polygon, the third edge of the third polyogn and the first edge of the fourth polygon. But now you "ran our of polygons" so i think Marionette just repeats the last polygon from the list like this:

grafik.thumb.png.e293758e1c91b54b2aa7e73dbe842f9d.png

Thats why one Polyogn (the last one) was done "correctly" (even though some edges were done multiple times).

 

This is easily fixed if we repeat the handle of each polygon by the amount of its vertecies. This can be done with the "Repeat" node.

Now the inputs of the "Get 2D Edge" look like this:

 

grafik.png.eb15625ddf006328c436a2665f19e911.png

 

I hope i could help you a bit. Unfortunately my english reaches its limits when trying to explain things like this.

 

Regards,

Letti

  • Like 3
Link to comment

@Letti R - Wow! Thank you so much for the detailed explanation! Looking at the solution here makes me realize I went down multiple, highly confusing paths to try to solve this issue. I am going to see if I can solve some of my other situations that, on the surface, appear to be very similar!

 

I am going to make this a part 2 of my original post:

After looking at situations like the one posted, I was highly convinced I needed to understand the Index node to get the desired result. In many cases, I've found that feeding my objects into a list and then making a "list explode" allowed me to get the desired result, but I needed to duplicate the following nodes on each object. After some googling and chatGPT, it sounded like Indexing was the alternative that would let me feed a variable amount of objects through an individual set of actions.

 

In this specific case, it wasn't required, but can someone give me insight into the Index node and how it is appropriately used? I have found very few examples online of the index node being used, and the wording of the node's description doesn't provide me any clarity.

Link to comment

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...