Hello, Ive been working on a simple script lately to learn coding and Ive run into an issue. The script works fine on one object, but when i have multiple objects selected it only executes correctly on one object in the selection. It seems to getting tripped up specifically on the quad_star_fill function I think…
To summarize Its designed to fill selected holes in your mesh with a quad star (even if you have multiple objects selected in edit mode.
The main building blocks are:
quad_star_fill(obj):
Creates the quad star geometry by scaling the components to 0
Checker deselecting, and dissolving edges, and removing doubles.
quad_star_selection(obj):
Finds all selected vertices in the object.
Groups connected vertices into linked selections.
Calls quad_star_fill(obj) for each linked selection.
quad_star_objects(): This function:
Extrudes the selected region of the mesh.
Finds all selected mesh objects.
Calls quad_star_selection(obj) for each object.
I’m sure its something very simple, if someone could quickly look over the script I have attached and let me know whats causing this issue I would greatly appreciate it! working_03.py (3.3 KB)
it is not clear what you want. You want to have several objects in edit mode, from edit mode, you have several holes selected (so edge/vertex loops?), and you want them filled separately, right?
you ask to go to edit mode several times in your script, but it seems that you have to be in edit mode to be in the proper context to run the script?
does it work better if you set the active object in your “on selected object loop”?
Sorry for the confusion, yes you are right, there was no point in specifying edit mode in the script as the user will be in edit mode when its run.
I also tried setting object/s I am looping over to active but didnt seem to make a difference.
To summarize, you select multiple objects, enter edit mode, and you select the holes you want to fill with a quad star - run script
-It will first extrude all the selected edges of every object
-Then loop over the necessary functions to fill the selected holes with a quad star
It works great on a single object (even with multiple hole selections within that object).
The objects seem to be reading into the quad_star_selection function as expected. But its getting tripped up on the quad_star_fill function inside inside of it.
If I add a print statement to the quad_star_fill function, it only ever prints a single object. I just cant see any reason why it would be. Could it be something to do with using bmesh not updating correctly?
in quad_star_selection, obj.name changes at each iteration? same in quad_star_fill.
if it does change as expected, you can check the location of the center of the selected loops, to see if they also change with the objects.
if not, try going back to object mode, changing the active, and going back to edit mode in quad_star_objects.
You could also print the names of the objects in that selected objects list you make to be sure, but there should be no issue there
I tested the quad_star_selection function by printing the objects names and it is working as expected, however, only one object ever gets printed through the quad_star_fill function.
I tried your other suggestions about setting the active object and the EDIT/OBJECT mode, however this didn’t have any effect.