Jump to content

Exporting from blender within a script?


Recommended Posts

I am trying to call the blender exporter addon from within another script in blender. The idea is that, when someone saves the blender file, a .babylon file is also created, alongside the .blend file. 


Within blender, I can add a function to the post_save array, which will be called after every save.

def save_handler(dummy):    scene = bpy.context.scene    // Trying to export the babylon file here    bpy.ops.scene.babylon()bpy.app.handlers.save_post.append(save_handler)

But bpy.ops.scene.babylon() doesn't seem to work. I'm just unsure of how to call the export function for babylon in other scripts etc... I have got as far as adding an 'Autosave' setting to the babylonjs settings panel, but cannot run the export script within the save_post function.


Any pointers on how to get this going? I hate having to manually export the babylon file from blender each time I make changes to a file, and I thought that automatically exporting on each save would be a nice feature to the addon. Will hopefully submit a pull request if I get a decent solution.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...