Hi,
I want to import a file directly from the command-line for simplified usage.
The following seems to work:
C:\Program Files\Blender Foundation\Blender\blender -P "C:\Documents and Settings\KIAaze\Application Data\Blender Foundation\Blender\.blender\scripts\IMPORT_SCRIPT" -- FILE
However, when I open Blender that way, directly importing a file, it keeps importing that same file whenever I run the same import script via “file->import”.
Otherwise, if blender is opened normally, the import script asks for the file as it should.
My import script looks like this at the moment:
# arg[0]='blender'
# arg[1]='-P'
# arg[2]='scriptname'
# arg[3]='--'
if len(sys.argv)>4:
for i in range(len(sys.argv)- 4):
print 'Importing ', sys.argv[4+i];
importFunc(sys.argv[4+i]);
else:
Blender.Window.FileSelector(importFunc, "Import file...", default_path);
Basically, I need to get rid of the sys arguments or find a way to figure out if the script is called via the CLI or the GUI.
System info:
Blender v2.49b
Python 2.6.2
OS: Windows XP
edit: Please move it to “Python & Plugins” if you think it’s more appropriate there.