This message was originally posted by Kenton McHenry on 10/20/2008 13:19:41
I have the following python script which converts a file \"tmp.obj\" to \"tmp.k3d\":
#python
import k3d
doc = k3d.application.new_document();
source = doc.new_node(\"OBJMeshInput\");
source.file = \"tmp.obj\";
target = doc.new_node(\"K3DMeshOutput\");
target.file = \"tmp.k3d\";
doc.set_dependency(target.get_property(\"input_mesh\"), source.get_property(\"output_mesh\"));
This script uses the two \"document plugins\", OBJMeshInput and K3DMeshOutput to perform the conversion.
I notice there are other format import/export plugins:
GTSReader
GTSWriter
RAWReader
RAWWriter
RIBReader
MFXReader
OFFReader
These are however identified as \"Application plugins\" as opposed to \"Document plugins\".
From the documentation it seems that an application plugin is instantiated as follows:
source = k3d.create_plugin(\"RAWReader\");
This doesn’t crash the script so I assume it works. My problem is that from here I do not
know how to use this plugin to actually load the file. I can’t seem to find any documentation
on these plugins. I have tried something like this:
source.file = \"tmp.raw\"
but file is not a valid member of RAWReader. Any help or pointers to documentation would be appreciated.