I'm currently working on an Addon that handles polyhedra and I need to change the faces' indices in order to keep my structure coherent when the user does operations like extrusion, etc...
So far I have this Operator that basically modifies the index of every face that is selected by the user.
class Extrude(Operator):
def execute(self, context):
context = bpy.context
obj = context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)
# list of selected faces
selfaces = [f for f in bm.faces if f.select]
if selfaces:
for f in selfaces :
f.index = something
return {'FINISHED'}
During the method's execution the indices are modified, but at the end the indices are back to their original values. I tried using bm.faces.index_update() but it still does not work. Is their a way to make these index changes permanent ?
Thank you in advance.
if selfaces:sincefor x in []:will not do anything anyway. – batFINGER Aug 02 '21 at 13:55