Hey Ali, apologies for not replying sooner.
It’s great that you’ve come up with your own add-on to solve your workflow issue! I’ve tested it and it works as you described. I can see a lot of potential for being able to quickly replace objects.
Firstly, some questions for you:
- How does it fit into your workflow? Can you give an example of when you use it?
- Do you have much experience with working with Python in Blender?
- Do you plan on adding any other features?
I will give some feedback/suggestions on ways the current version could be improved, if you were interested in developing it further. I hope you will take them as constructive/positive ideas and not as a negative criticism of your work so far.
- I would note that it is important to be clear about the distinction between a Mesh and an Object. I note this distinction as some of my feedback specifically relates to it. (I do not mean to be pedantic)
Perhaps you already know this, but I will explain briefly: An Object does not contain the Mesh/geometry data (the “Mesh data-block”), but instead contains a “reference” to it. If you look in the “Object Data Properties” tab in the Properties window, you will see the name of the Mesh at the top. Many Objects can reference a single Mesh, like when you use “Duplicate Linked”, both Objects reference the same Mesh. So when you edit one, all the duplicates also change, as they share the same Mesh data.
I think replacing the word “Mesh” with “Object” would be more accurate (like, “Replace Object with Sphere”)
I noticed that if you try to use the buttons while in Edit Mode, it causes an error message (because you cannot delete an Object while you are editing it). My suggestion here would be to check whether we are in Edit Mode or Object Mode and either:
– Disable the buttons while in Edit Mode or
– if in Edit Mode, only replace the Mesh and not the entire Object. (here you could keep the “Replace Mesh With…” wording)
If multiple Objects are selected, pressing the buttons will delete/replace all of the selected Objects with a single new Object. Is this intended? My suggestion would be to either:
– Replace only the Active Object or
– Replace all selected the Objects with new Objects. Being able to replace multiple Objects with one button press would be a great speed increase!
In your code, you could use descriptive names for your functions/operators. For example, “SimpleOperator” doesn’t describe what the operator does in a meaningful way. A better name might be something like “DeleteSelectedObject”. This is good programming habit, it helps other programmers to understand what your functions do.
Lastly I will offer some ideas/suggestions for new features that could be useful in a future version:
You could add a “Edit Last Operation” popup that allows the user to modify the settings of the new Object (like the options you get when adding a Sphere). That would allow for specifying the size and the subdivisions.
You could copy the rotation, scale, and location of the old Object to the new Object. That would save time and not require having to re-position the new Object to match the old one. You could even calculate the “bounding box” size of the old Object and scale the new Object to match.
You could also add calc_uvs=True to your bpy.ops.mesh.primitive_* functions, so that the Mesh will automatically be UV unwrapped and ready for texturing when it is created. This will save time later.
I note that you said that you found using the popup menus to be slow, but many users work only in the 3D View. Personally I would find it slower to have to open the Properties window and find the Object Properties tab, and then click a button. My suggestion here would be to add the operators to either the Object menu (in the 3D View header) or in the Object Context Menu, or in a tab at the side of the 3D View. Of course, you could add them to all these places, but it might be best to choose just one.
You could add keyboard shortcuts. These would be much quicker than menus or buttons!
I hope that feedback is useful.