col.prop(self, "compound")
col.prop(self, "smoothing")
col.prop(self, "export_groups")
+ self.general_col = col
self.layout.separator()
filename_ext = ".object"
+ external_tech = bpy.props.BoolProperty(name="External technique", description="Use an external technique specified in the object", default=True)
+
textures = bpy.props.EnumProperty(name="Textures", description="Export textures", default="REF",
items=(("NONE", "None", "Ignore textures"),
("REF", "Referenced", "Reference external data"),
srgb_colors = bpy.props.BoolProperty(name="sRGB colors", description="Export material colors as sRGB instead of linear", default=True)
separate_mesh = bpy.props.BoolProperty(name="Separate mesh", description="Write mesh data into a separate file", default=False)
+ separate_tech = bpy.props.BoolProperty(name="Separate technique", description="Write technique data into a separate file", default=False)
+ shared_tech = bpy.props.BoolProperty(name="Shared technique", description="Use material name for technique file to enable sharing", default=True)
def create_exporter(self):
from .export_object import ObjectExporter
def draw(self, context):
super().draw(context)
+ col = self.general_col
+ col.prop(self, "external_tech")
+
col = self.texturing_col
col.prop(self, "textures")
col.prop(self, "material_tex")
col = self.layout.column()
col.label("Files")
col.prop(self, "separate_mesh")
+ col.prop(self, "separate_tech")
+ if self.separate_tech:
+ col.prop(self, "shared_tech")
class ExportMspGLArmature(bpy.types.Operator, ExportMspGLBase):
bl_idname = "export.mspgl_armature"
self.srgb_colors = True
self.textures = "REF"
self.separate_mesh = False
+ self.separate_tech = False
+ self.external_tech = True
+ self.shared_tech = True
def export(self, context, out_file):
+ obj = context.active_object
+
from .outfile import open_output
out_file = open_output(out_file)
mesh = mesh_export.export(context, out_file)
out_file.end()
- out_file.begin("technique")
+ if self.external_tech and obj.technique:
+ out_file.write("technique", '"{}"'.format(obj.technique))
+ elif self.separate_tech:
+ path, base = os.path.split(out_file.filename)
+ if self.shared_tech and mesh.materials:
+ tech_name = mesh.materials[0].name+".tech"
+ else:
+ base, ext = os.path.splitext(base)
+ tech_name = base+".tech"
+ tech_out = open_output(os.path.join(path, tech_name))
+ self.export_technique(mesh, tech_out)
+ out_file.write("technique", '"{}"'.format(tech_name))
+ else:
+ out_file.begin("technique")
+ self.export_technique(mesh, out_file)
+ out_file.end()
+
+ def export_technique(self, mesh, out_file):
out_file.begin("pass", '""')
if mesh.materials:
if self.srgb_colors:
out_file.end()
out_file.end()
- out_file.end()
def draw(self, context):
obj = context.active_object
+ self.layout.prop(obj, "technique");
self.layout.prop(obj, "compound");
def register_properties():
+ bpy.types.Object.technique = bpy.props.StringProperty(name="Technique", description="Name of the technique to use for rendering")
bpy.types.Object.compound = bpy.props.BoolProperty(name="Compound with parent", description="Join this object to its parent when exporting")