The last selected is the context object. Some operators work on only the context object, it appears proxy_make is one of them.
Try this.
import bpy
context = bpy.context
scene = context.scene
for obj in context.selected_objects:
scene.objects.active = obj # make it the context object
bpy.ops.object.proxy_make()
So i’m trying to make a button for this script just below the Make Proxy button in the Relations tab, but nothing shows up on the tool shelf. Can you please point out my mistakes? By the way i’m copied some part of code from space_view3d_toolbar.py to implemented in this script. Thanks
import bpy
from bpy.types import Panel
class View3DPanel:
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
class Proxified(View3DPanel, Panel):
bl_category = "Relations"
bl_context = "objectmode"
bl_label = "Relations"
context = bpy.context
scene = context.scene
for obj in context.selected_objects:
scene.objects.active = obj # make it the context object
bpy.ops.object.proxy_make()
def draw(self, context):
layout = self.layout
col.label(text="Linked Objects:")
col.operator("object.proxy_make", text="Make Proxy to All Selected")