kirkjr2 Posted August 22, 2019 Share Posted August 22, 2019 Let's say I have an OBJ with 4 pieces of geo. Is there anyway to split these objects up so I can randomly copy to points? My next OBJ could have 16 objects and I don't want to create a blast node and manually select the group every time. I've managed to figure out how to select the group through an expression and a for loop using `arg(primgrouplist("../OBJ"),detail("../repeat_begin2_metadata1/",iteration,0)). The Transform is in there for a placeholder but I'd like to center each object at the origin so it isn't offset when it's copied. Quote Link to comment Share on other sites More sharing options...
dgani Posted August 22, 2019 Share Posted August 22, 2019 Use the connectivity sop to get an attribute that you can split them with if they're disconnected. I think there's actually a for loop preset called for each connected piece that does the work for you. Quote Link to comment Share on other sites More sharing options...
davpe Posted August 22, 2019 Share Posted August 22, 2019 dgani > connectivity can't actually split the geo, it will just identify pieces and then you have to split it by hand or by some other method. my solution would be to use Python script that can do blast SOP (or a new geo container) per group. i've posted it the thread below. i can imagine you could do that with TOP network as well... Quote Link to comment Share on other sites More sharing options...
kirkjr2 Posted August 22, 2019 Author Share Posted August 22, 2019 Thank you for the feedback! Is there a way to randomly copy each group to a point without splitting them up and using a switch? Quote Link to comment Share on other sites More sharing options...
davpe Posted August 22, 2019 Share Posted August 22, 2019 hey, yeah that's certainly possible. steps you need to do: 1 - turn group names into a string names 2 - loop over names and pack each name into a packed prim (useful if you want to deal with chunks of geometry as if they were a single points) 3 - on your template points generate an attribute that specifies which instance number is supposed to be copied onto each point 4 - before copying the geometry on points, refer to that instance number attribute and delete all packed prims that don't match that number 5 - loop over the template points and for each of them copy matching packed prims check the hip file for an example. obj_instance_groups.hiplc Quote Link to comment Share on other sites More sharing options...
kirkjr2 Posted August 22, 2019 Author Share Posted August 22, 2019 Awesome that is exactly what I was looking to do! Quote Link to comment Share on other sites More sharing options...
AntoineSfx Posted August 23, 2019 Share Posted August 23, 2019 (edited) I learned so much from this one: (timestamp to jump to the for each block). I had to watch that part several times, especially the spare parameters which are so useful if not absolutely mandatory. Spare inputs at the 0:51:50 mark Edited August 23, 2019 by AntoineSfx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.