Hopefully a not too stupid question but why can’t I import the 3ds_export script in my own script. It works for other exporters but not for 3ds_export
I’m writing a script to convert my obj object to 3ds format.
It works import obj and exporting obj again:
import Blender
from Blender import Scene, Object, Material
import import_obj
import export_obj
scene = Scene.New('ExportScene')
scene.makeCurrent()
import_obj.load_obj('/home/test/scan_faceFrnt_scl8_tst02.obj',CLAMP_SIZE=10.0)
obs = [ob for ob in scene.objects if ob.type == 'Mesh']
export_obj.write('/home/test/test.obj',obs);
#for ob in scene.objects: export_obj.write('/home/test/test.obj',ob)
But trying the 3ds_export script it just won’t work.
import Blender
from Blender import Scene, Object, Material
import import_obj
import 3ds_export
scene = Scene.New('ExportScene')
scene.makeCurrent()
import_obj.load_obj('/home/test/scan_faceFrnt_scl8_tst02.obj',CLAMP_SIZE=10.0)
obs = [ob for ob in scene.objects if ob.type == 'Mesh']
3ds_export.safe_3ds('/home/test/test.3ds');
#for ob in scene.objects: export_obj.write('/home/test/test.obj',ob)
File "import_objtest.py", line 4
import 3ds_export
^
SyntaxError: invalid syntax
To me it seems the 3ds_exporter is not importable???
Not a stupid question at all. In fact, thank-you very much for it! I had no idea you could import scripts just as easy as that.
Do you work with syntax highlighting on? I just tried your code then, and the first thing that struck me, was that “3ds_export” was marked in blue. - the usual colour for numbers.
If you rename 3ds_export.py to export_3ds.py, you can import it, though “Richard Lärkäng” on line 10 causes errors due to the accents on the a’s - change 'em to normal a’s and the script progresses as expected.
Well, the word “safe” is not contained in any of the files in my script directory.
How is this function being called, and is the containing file in the scripts directory, are the only two things I can think of at the moment.
## optimze meshes in scene
## settings used by optimizer
# Defaults and system settings
if os.environ.has_key('BC_HOME'):
BC_HOME = os.environ['BC_HOME']
else:
BC_HOME = '/home/arnaud/Documents/z25/bodycount/'
PREF_REDUX= Draw.Create(0.1)
PREF_DO_UV= Draw.Create(1)