1
$\begingroup$

I'm making a rig that has a python interface and I was wondering if their was anyway to append the rig and the script at the same time so the script runs as soon as it's appended.

$\endgroup$
1
$\begingroup$

If you do this manually, you need to run the script after it is linked. The script auto-runs only on file open/reload (if it is registered).

You can write an addon, that will link your character, create proxy rig from it, link the script and run the script:

  • Here is how you link stuff with python

  • You make proxy rig like this:

    # get your linked group object
    objects = bpy.context.scene.objects
    group_ob = objects.get('Character')   # <- you probably have this from linking already
    # create proxy rig
    objects.active = group_ob
    bpy.ops.object.proxy_make()
    # get the proxy object if you need
    proxy_ob = bpy.context.active_object
    
  • Running the script is easy:

    script = bpy.data.texts.get("rig_script.py")   # <- you have this from linking
    exec(script.as_string())
    
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.