|
@@ -179,5 +179,43 @@ def unregister():
|
|
|
bpy.types.INFO_MT_file_export.remove(menu_func)
|
|
|
|
|
|
|
|
|
+def export(filename, overrides=None):
|
|
|
+ """A function to allow build systems to invoke this script more easily
|
|
|
+ with a call to io_scene_godot.export(filename).
|
|
|
+ The overrides property allows the config of the exporter to be controlled
|
|
|
+ keys should be the various properties defined in the ExportGodot class.
|
|
|
+ Eg:
|
|
|
+ io_scene_godot.export(
|
|
|
+ filename,
|
|
|
+ {
|
|
|
+ 'material_search_path':'EXPORT_DIR',
|
|
|
+ 'use_mesh_modifiers':True,
|
|
|
+ }
|
|
|
+ )
|
|
|
+
|
|
|
+ Anything not overridden will use the default properties
|
|
|
+ """
|
|
|
+
|
|
|
+ default_settings = dict()
|
|
|
+ for attr_name in ExportGodot.__dict__:
|
|
|
+ attr = ExportGodot.__dict__[attr_name]
|
|
|
+ # This introspection is not very robust and may break in future blende
|
|
|
+ # versions. This is becase for some reason you can't compare against
|
|
|
+ # bpy.types.Property because. well, they end up not being subclasses
|
|
|
+ # of that!!!
|
|
|
+ if issubclass(type(attr), tuple):
|
|
|
+ default_settings[attr_name] = attr[1]['default']
|
|
|
+ if overrides is not None:
|
|
|
+ default_settings.update(overrides)
|
|
|
+
|
|
|
+ class FakeOp:
|
|
|
+ """Fake blender operator"""
|
|
|
+ def __init__(self):
|
|
|
+ self.report = print
|
|
|
+
|
|
|
+ from . import export_godot
|
|
|
+ export_godot.save(FakeOp(), bpy.context, filename, **default_settings)
|
|
|
+
|
|
|
+
|
|
|
if __name__ == "__main__":
|
|
|
register()
|