I have a Lattice object that applied as modifier in multiple objects. I want to change modifier strength for that objects simultaneously, but appears property for every object.
for o in bpy.data.objects:
for modifier in o.modifiers:
if modifier.type == 'LATTICE':
layout.prop(modifier, "strength", text="Strength")
how to change to show one parameter for all objects?
Menu code:
import bpy
prepend_menus = [
bpy.types.VIEW3D_MT_edit_lattice_context_menu,
]
def cont_menu(self, context):
layout = self.layout
layout.separator()
for o in bpy.data.objects:
for modifier in o.modifiers:
if modifier.type == 'LATTICE':
layout.prop(modifier, "strength", text="Strength")
layout.separator()
def register():
for menu in prepend_menus:
menu.prepend(cont_menu)
def unregister():
for menu in prepend_menus:
menu.remove(cont_menu)
if __name__ == "__main__":
register()