# Path: psychoblend/util.py
# def escape_name(name):
#     name = name.replace("\\", "\\\\")
#     name = name.replace(" ", "\\ ")
#     name = name.replace("$", "\\$")
#     name = name.replace("[", "\\[")
#     name = name.replace("]", "\\]")
#     name = name.replace("{", "\\{")
#     name = name.replace("}", "\\}")
#     return name
# 
# def mat2str(m):
#     """ Converts a matrix into a single-line string of values.
#     """
#     s = ""
#     for j in range(4):
#         for i in range(4):
#             s += (" %f" % m[i][j])
#     return s[1:]
# 
# def needs_def_mb(ob):
#     """ Determines if the given object needs to be exported with
#         deformation motion blur or not.
#     """
#     anim = ob.animation_data
#     no_anim_data = anim == None or (anim.action == None and len(anim.nla_tracks) == 0 and len(anim.drivers) == 0)
# 
#     for mod in ob.modifiers:
#         if mod.type == 'SUBSURF':
#             pass
#         elif mod.type == 'MULTIRES':
#             pass
#         elif mod.type == 'MIRROR':
#             if mod.mirror_object == None:
#                 pass
#             else:
#                 return True
#         elif mod.type == 'BEVEL' and no_anim_data:
#             pass
#         elif mod.type == 'EDGE_SPLIT' and no_anim_data:
#             pass
#         elif mod.type == 'SOLIDIFY' and no_anim_data:
#             pass
#         elif mod.type == 'MASK' and no_anim_data:
#             pass
#         elif mod.type == 'REMESH' and no_anim_data:
#             pass
#         elif mod.type == 'TRIANGULATE' and no_anim_data:
#             pass
#         elif mod.type == 'WIREFRAME' and no_anim_data:
#             pass
#         else:
#             return True
# 
#     if ob.type == 'MESH':
#         if ob.data.shape_keys == None:
#             pass
#         else:
#             return True
# 
#     return False
# 
# def needs_xform_mb(ob):
#     """ Determines if the given object needs to be exported with
#         transformation motion blur or not.
#     """
#     if ob.animation_data != None:
#         return True
# 
#     if len(ob.constraints) > 0:
#         return True
# 
#     if ob.parent != None:
#         return needs_xform_mb(ob.parent)
# 
#     return False
# 
# class ExportCancelled(Exception):
#     """ Indicates that the render was cancelled in the middle of exporting
#         the scene file.
#     """
#     pass


import bpy
from .util import escape_name, mat2str, needs_def_mb, needs_xform_mb, ExportCancelled
                if ms != None:
                    if ms.material.name not in self.material_names:
                        self.material_names.add(ms.material.name)
                        self.materials += [Material(self.render_engine, ms.material)]

            return mesh_name
        else:
            return None


    def get_sphere_lamp(self, ob, group_prefix):
        name = group_prefix + "__" + escape_name(ob.name)
        self.objects += [SphereLamp(self.render_engine, ob, name)]
        return name

    def get_rect_lamp(self, ob, group_prefix):
        name = group_prefix + "__" + escape_name(ob.name)
        self.objects += [RectLamp(self.render_engine, ob, name)]
        return name


#=========================================================================


class Mesh:
    """ Holds data for a mesh to be exported.
    """
    def __init__(self, render_engine, ob, name):
        self.ob = ob
        self.name = name

# Path: psychoblend/util.py
# def escape_name(name):
#     name = name.replace("\\", "\\\\")
#     name = name.replace(" ", "\\ ")
#     name = name.replace("$", "\\$")
#     name = name.replace("[", "\\[")
#     name = name.replace("]", "\\]")
#     name = name.replace("{", "\\{")
#     name = name.replace("}", "\\}")
#     return name
# 
# def mat2str(m):
#     """ Converts a matrix into a single-line string of values.
#     """
#     s = ""
#     for j in range(4):
#         for i in range(4):
#             s += (" %f" % m[i][j])
#     return s[1:]
# 
# def needs_def_mb(ob):
#     """ Determines if the given object needs to be exported with
#         deformation motion blur or not.
#     """
#     anim = ob.animation_data
#     no_anim_data = anim == None or (anim.action == None and len(anim.nla_tracks) == 0 and len(anim.drivers) == 0)
# 
#     for mod in ob.modifiers:
#         if mod.type == 'SUBSURF':
#             pass
#         elif mod.type == 'MULTIRES':
#             pass
#         elif mod.type == 'MIRROR':
#             if mod.mirror_object == None:
#                 pass
#             else:
#                 return True
#         elif mod.type == 'BEVEL' and no_anim_data:
#             pass
#         elif mod.type == 'EDGE_SPLIT' and no_anim_data:
#             pass
#         elif mod.type == 'SOLIDIFY' and no_anim_data:
#             pass
#         elif mod.type == 'MASK' and no_anim_data:
#             pass
#         elif mod.type == 'REMESH' and no_anim_data:
#             pass
#         elif mod.type == 'TRIANGULATE' and no_anim_data:
#             pass
#         elif mod.type == 'WIREFRAME' and no_anim_data:
#             pass
#         else:
#             return True
# 
#     if ob.type == 'MESH':
#         if ob.data.shape_keys == None:
#             pass
#         else:
#             return True
# 
#     return False
# 
# def needs_xform_mb(ob):
#     """ Determines if the given object needs to be exported with
#         transformation motion blur or not.
#     """
#     if ob.animation_data != None:
#         return True
# 
#     if len(ob.constraints) > 0:
#         return True
# 
#     if ob.parent != None:
#         return needs_xform_mb(ob.parent)
# 
#     return False
# 
# class ExportCancelled(Exception):
#     """ Indicates that the render was cancelled in the middle of exporting
#         the scene file.
#     """
#     pass


# Path: psychoblend/assembly.py
import bpy
from .util import escape_name, mat2str, needs_def_mb, needs_xform_mb, ExportCancelled

                if ms != None:
                    if ms.material.name not in self.material_names:
                        self.material_names.add(ms.material.name)
                        self.materials += [Material(self.render_engine, ms.material)]

            return mesh_name
        else:
            return None


    def get_sphere_lamp(self, ob, group_prefix):
        name = group_prefix + "__" + escape_name(ob.name)
        self.objects += [SphereLamp(self.render_engine, ob, name)]
        return name

    def get_rect_lamp(self, ob, group_prefix):
        name = group_prefix + "__" + escape_name(ob.name)
        self.objects += [RectLamp(self.render_engine, ob, name)]
        return name


#=========================================================================


class Mesh:
    """ Holds data for a mesh to be exported.
    """
    def __init__(self, render_engine, ob, name):
        self.ob = ob
        self.name = name

        self.needs_mb = needs_def_mb(self.ob)