xormenter / Blender-Anno-.cfg-Import-Addon

Parses Anno (1800) .cfg files and automatically imports and positions all models, props, particles and decals in the scene.
GNU General Public License v3.0
19 stars 4 forks source link

How could we able to import .cfg using python? #18

Closed UuPhan closed 1 year ago

UuPhan commented 1 year ago

Hello,

I'm trying to batch export .cfg to .glb but get stuck at import because don't know import syntax in python. Attemp to try with this and some other silly syntax: bpy.ops.import_scene.cfg(filepath='./path/to/file.cfg')

Python: Traceback (most recent call last):
  File "\script.py", line 5, in <module>
  File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\scripts\modules\bpy\ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), None, kw)
AttributeError: Calling operator "bpy.ops.import_scene.cfg" error, could not be found

I changed bl_idname value to "import_scene.cfg" of class ImportAnnoCfg in your operators.py then error was gone but nothing happened or imported

Would you mind to show me the syntax to import in python, please?

UuPhan commented 1 year ago

Seem when import only .cfg file that function import_cfg_file() in loop in ImportAnnoCfg class not trigger for any reason. Since I don't need import any other than .cfg then get rid of for loop and it just work!

Although we may not get supported but thank you for provide us this addon anyway.