1. Owen Nelson
  2. pander

Commits

Owen Nelson  committed 3c77e8d

adding a test runner for the functions triggered by the UI

  • Participants
  • Parent commits 5964624
  • Branches default

Comments (0)

Files changed (2)

File pander/exporter.py

View file
  • Ignore whitespace
 import bpy
 from bpy.props import StringProperty, BoolProperty
-import os
 from pander import egg
 
 
 def export_egg(filepath, *args, **kwargs):
     print(args)
     print(kwargs)
-    context = kwargs.pop('context')
+#    context = kwargs.pop('context')
 
     with open(filepath, 'w') as fh:
         fh.write(str(egg.CoordinateSystem('Z-up')))
-        for obj in context.selected_objects:
+        for obj in bpy.context.selected_objects:
             grp = egg.Group(obj.name)
             for mat_slot in obj.material_slots:
                 for tex_slot in mat_slot.material.texture_slots:
                         grp.append(egg.Texture(tex_slot.texture.image.filepath.replace('//', ''),
                                                name=tex_slot.texture.name))
             fh.write(str(grp))
+
+        fh.write('\n') # it's only civil to end with a blank line.
                     
 
 class EggExporter(bpy.types.Operator):

File test_export.py

View file
  • Ignore whitespace
+from pander.exporter import export_egg
+
+if __name__ == '__main__':
+    export_egg('./foo.egg')