I've got some trouble with bpy.ops.object.proxy_make().

To resume:

  • my script import a character who has a rig.

  • this character is imported as a link then I make it a proxy of the armature.

My script run fine on blender scripting area, run fine with batch but if i execute-it from panel or menu it stuck on bpy.ops.object.proxy_make().

This script is placed on a folder, call from init.py - this folder is on blender addons folder.

__init__.py call-it

from . import myScript

    class simpleClass(bpy.types.Operator):
    bl_idname = "myPanel.simple_class"
    bl_label = "my simple script"
    bl_description = "simple script"

    def execute(self, context):
        return {'FINISHED'}

...register stuff

myScript.py i've juste pasted essential

scene = bpy.context.scene
with bpy.data.libraries.load(currentPath, link=True) as (data_from, data_to):
            data_to.collections = data_from.collections

        for new_coll in data_to.collections:
            if new_coll.name.endswith('.anim'):
                instance = bpy.data.objects.new(new_coll.name, None)
                instance.instance_type = 'COLLECTION'
                instance.instance_collection = new_coll
                armature = new_coll.name.split("_")[0] + "_armature"
                ob = scene.objects[new_coll.name]
                bpy.context.view_layer.objects.active = ob

terminal :

location: <unknown location>:-1
Error: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 2.82\2.82\scripts\addons\myFolder\__init__.py", line 132, in execute
  File "C:\Program Files\Blender Foundation\Blender 2.82\2.82\scripts\modules\bpy\ops.py", line 201, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.object.proxy_make.poll() failed, context is incorrect

location: <unknown location>:-1

Tested on centOS7 & Win10, blender 2.82

I turn around long time before posting here... i've found this thread & more precisely answser of @pullup

Making Proxy on a Linked Rig via the API

But i don't know how to override this. and i don't know if the right way ?

Thanks for reading,


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.