Load and Save Blend file with phyton

Hi,

I’m doing a Java tool that document blend files and generates documentation with all textures, linked files, missing files, zip projects, etc. This tool is very usefull for big projects with a lot of linked files.

My idea is to give this tool for free with source code.

I have used Java to get a full GUI, instead of a command line.

I haven’t problems to call blender from Java and get the information, but now I want to open a blend file, run a phyton and save the chages. My idea is something like this:

  1. Call blender with: blender.exe -b myblendfile.blend -P myphyton.py
  2. the phyton makes some changes in myblendfile.blend
  3. How can I save the changes in the blend file?

Any idea?
Antonio

I would also like to do the same.

Here is a bpy.ops call to saving a file.


bpy.ops.wm.save_as_mainfile(filepath=render_filename, check_existing=False, copy=True)

http://www.blender.org/documentation/blender_python_api_2_69_7/bpy.ops.wm.html?highlight=save_as_mainfile#bpy.ops.wm.save_as_mainfile