[Bf-funboard] Associating 3D models with Blender
Campbell Barton
cbarton at metavr.com
Thu Aug 2 14:00:50 CEST 2007
Since blender can load a fair few model formats.
it would be nice to be able to associate blender with these files in the
operating system.
so you could for instance associate blender with PLY, 3DS, OBJ... etc.
This basically means making
blender.exe c:\home\me\mymodel.obj
...call the correct python script rather then saying the file isnt knowm.
There are 2 ways this could be done,
1) have a script that runs when the filetype is not known, this script
would check which importer to use deal with calling the right script
with the filename arg.
This would be easy to implement, just call an external script's function
with the file as an argument, the rest is done in python.
2) have 2 functions in each importer...
* file_is_compat(path) - returns true if the importer can load this file.
* file_load(path) - loads the file into blender. it may work differently
then running the script from the menu (no popup UI for instance).
This way is better because if you write your own importer or download
one thats not included in blender, as long as it has those 2 functions
will insure that file association works the same as other formats.
- This would run whenever the file format wasn't known by
blender.looking through all the scripts in the import menu and running
the ones that have the file_is_compat(path) and file_load(path)
functions defined.
This might allow blenders File->Open to open 3ds, obj etc (a design
decision, maybe we dont want this)
and is a step towards having drag and drop into the 3d view.
--
Campbell J Barton (ideasman42)
More information about the Bf-funboard
mailing list