Parent-child hierarchy issues with the same component

Happy day to all of you!
Regarding this question, it started because, I wanted to do an automation using python, but I suddenly realized that I can’t seem to control the Node hierarchy as much as I thought I could.

comp = getComponent()
node1 = comp.createNode(VC_NODE, “link_1”)
node2 = node1.createNode(VC_NODE, “link_2”)

I know I can do the following structure using the above code:

comp
| node1
|| node2

But what about the other way around? I mean, what if I want to achieve the following structure:

comp
| node2
|| node1

Note: node1 is always generated before node2.
Looking forward to anyone’s reply, thanks in advance!

Hy,
I would try to create node1 and node2 as child of comp by: comp.createNode(VC_NODE, “name”) and afterwards use .attach() to build the relations?

Regards

1 Like

Thank you for your reply!
Yes, I had thought about that, but the truth is, it doesn’t seem to be working. :melting_face:

Hy,

I think thats exactly what you want achieve?

Regards

1 Like

Of course it is, thank you very much! But can it only run on OnRun()? I can’t get it to run in a stopped environment, but I’d love to!
In fact, the reason I asked this question was that I saw a video posted by idkfa on Youtube about a bending machine, I was very interested and had already spent a day or two making a demo, but I quickly realized the problem, when I first started making it, I hadn’t intentionally thought about how to make a second cut, in fact, my initial effort was just to try to make a bending effect, but when When I did make it, I realized that, oh no, there was a problem with the second cut, because there were no layers, the second cut would not move with the first cut when it bent, so I started working on the layer effect, and in the video idkfa generates the layers directly after hitting the cut button, instead of onRun (I may be spinning my wheels a little bit, but I thought about it a lot or so! want to achieve basically the same effect) that’s why I wanted to know more people’s opinion on how this is done.
Thanks again and I look forward to your reply! (I apologize for writing back so late, as I’m already on my off time. :grinning:)
Attached is a link to the video:

Hy,

try to put the stuff in a button_clicked event like he do?

Regards

1 Like

UMMM, that does sound like something possible, maybe I really should have put that part in events instead of compilation triggers, so it seems like I didn’t do a very good job with this demo. :joy:
I’m sorry I can’t give results soon as my own home computer is a total entertainment computer with no VC installed, but I’m currently listening to your ideas it feels like it should be, I’ll try it as soon as I can, thank you very much for your reply!
I wish you all the best! :smile:

Yes it’s very true, I’ve already made the first version of the bender and it’s very interesting!
Thanks again from the bottom of my heart for your reply and help! :grin:

1 Like