I've created a script which takes the user's selection and selects an edge pattern based on the how many edges they currently have selected. For example if they select 3 edges in a ring it will select the entire ring and leave a gap of 3 and then select the next 3, etc.
I'd like to extend the script to work on faces, but I can't seem to figure out how to do this. If someone could point me in the right direction that would be great, it feels like I should store the entire selection of the ring of faces in an array, and then somehow select every nth face in the array, but I'm not sure where I should be looking to learn how to do that, searched google quite a bit and come up empty.
You need to crawl the faces. So say all the selected faces are quads, you would do something like this:
1. Get all 4 of the faces border edges. 2. Go through each of those edges and find which one is connected to both your current face and the new face. 3. repeat until you reach the end of the face ring, storing the faces in order as you go. 4. Perform a loop on the in-order array of faces, where every other face gets deselected.
There are some more nuances to it, but thats the gist.
Now if not all the faces are quads, or if you want to support multiple overlapping ring selections, then things become a bit more tricky.
That's way beyond my level at this point, where should I look to even figure out how to step through an array. I'll start posting any new questions to the new forum.
Replies
1. Get all 4 of the faces border edges.
2. Go through each of those edges and find which one is connected to both your current face and the new face.
3. repeat until you reach the end of the face ring, storing the faces in order as you go.
4. Perform a loop on the in-order array of faces, where every other face gets deselected.
There are some more nuances to it, but thats the gist.
Now if not all the faces are quads, or if you want to support multiple overlapping ring selections, then things become a bit more tricky.
Also, we have a new section for questions like these: https://polycount.com/categories/coding-scripting-shader-writing
https://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mel/for_in_loop.html