How to rename selected objects except active object? I wrote a script to rename selected objects except for active objects but it's renaming the active object.
I want the operator button to disable/inactive when the objects are not selected.
Here is my script:
import bpy

C = bpy.context
ao = C.object
name = ao.name
so = C.selected_objects
ao.select_set(False)
for obj in so:
    C.view_layer.objects.active = obj
    obj.name = &quot;SM_&quot;+name
just check if it is the selected object and ignore it
import bpy

C = bpy.context
ao = C.object
for obj in C.selected_objects:
    if obj != ao:
        obj.name = &quot;SM_&quot;+ao.name