Search the Community
Showing results for tags 'automatic'.
-
Theory I recently wanted to try and use/adapt the official Blender exporter addon for Babylon to allow for parsing a directory of source models (FBX) and have Blender batch export them to the Babylon Json format. I know that there is a C++ CLI tool to do exactly this but (correct me if I'm wrong) it seems like it will only run on Windows (no OSX or Linux). So I wanted to be add this functionality via Python scripting in Blender to be able to do this no matter the platform. Disclaimer, Python is not my native language. I taken some inspiration from a few existing scripts and adapted a simple one that : Looks for files ending with FBX in the input path. Imports them (one by one) via the Blender FBX operator : bpy.ops.import_scene.fbx(filepath=file) Exports them (one by one) via the BabylonJS operator : bpy.ops.bjs.main(filepath=file) Problem Sadly here I am getting an error. Perhaps I'm being naive here by thinking that I can access a non-standard issue addon via scripting ? That is what the error seems to indicate at least : Traceback (most recent call last): File "/BatchConvert.py", line 54, in <module> File "/BatchConvert.py", line 44, in convert_recursive File "/Users/ozeki/Library/Application Support/Steam/steamapps/common/Blender/blender.app/Contents/MacOS/../Resources/2.78/scripts/modules/bpy/ops.py", line 189, in __call__ ret = op_call(self.idname_py(), None, kw) AttributeError: Calling operator "bpy.ops.bjs.main" error, could not be found location: <unknown location>:-1 Solution ? Is this doable with the way the Babylon Blender addon is setup and if so what am I doing wrong? I have attached my current code to this post. I've also added a list of references for the scripts that I have looked at or adapted from originally. References https://github.com/BabylonJS/Babylon.js/blob/master/Exporters/Blender/io_export_babylon.py#L202 https://github.com/BabylonJS/Babylon.js/blob/master/Exporters/Blender/src/babylon-js/__init__.py#L66 http://blender.stackexchange.com/a/47000 http://blender.stackexchange.com/a/34539 https://github.com/pjezek/blender/blob/master/unity_tools/__init__.py https://github.com/RH2/TD_B3D-UDK/blob/master/main.py#L152 BatchConvert.py