X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fmaterial.py;h=f7f2c5eb6138d20099975259578cbc9100bdf81f;hb=5bf3c7175c359ad8509702a4e0790609b39e6aec;hp=e97561b795f5ffd6ffa5ec915c0e8c15cfc5fe1d;hpb=147f7097b77e591197dc38b2b263add57d69e4fc;p=libs%2Fgl.git diff --git a/blender/io_mspgl/material.py b/blender/io_mspgl/material.py index e97561b7..f7f2c5eb 100644 --- a/blender/io_mspgl/material.py +++ b/blender/io_mspgl/material.py @@ -122,24 +122,24 @@ class Material: return prop -class MaterialMap: +class MaterialAtlas: def __init__(self, materials): self.render_mode = materials[0].render_mode if self.render_mode=='EXTERNAL': - raise Exception("Material map with external render mode does not make sense") + raise Exception("Material atlas with external render mode does not make sense") self.shader = materials[0].shader if self.shader: - self.name = "material_map_"+os.path.splitext(self.shader)[0] + self.name = "material_atlas_"+os.path.splitext(self.shader)[0] else: - self.name = "material_map" + self.name = "material_atlas" self.materials = materials self.material_names = [m.name for m in self.materials] for m in self.materials: if m.render_mode!=self.render_mode: - raise Exception("Conflicting render modes in MaterialMap constructor") + raise Exception("Conflicting render modes in MaterialAtlas constructor") if self.render_mode=='CUSTOM' and m.shader!=self.shader: - raise Exception("Conflicting shaders in MaterialMap constructor") + raise Exception("Conflicting shaders in MaterialAtlas constructor") count = len(self.materials) size = 1 @@ -156,7 +156,7 @@ class MaterialMap: self.base_color_data = "" for m in map(Material, self.materials): if any(p.texture for p in m.properties): - raise Exception("Texturing is incompatible with material map") + raise Exception("Texturing is incompatible with material atlas") base_color = [int(cm(c)*255) for c in m.base_color.value] self.base_color_data += "\\x{:02X}\\x{:02X}\\x{:02X}\\xFF".format(*base_color) self.base_color_data += "\\x00\\x00\\x00\\x00"*(self.size[0]*self.size[1]-count) @@ -167,16 +167,16 @@ class MaterialMap: y = index//self.size[0] return ((x+0.5)/self.size[0], (y+0.5)/self.size[1]) -def create_material_map(context, material): - if not material.material_map: - raise Exception("Material is not part of a material map") +def create_material_atlas(context, material): + if not material.material_atlas: + raise Exception("Material is not part of a material atlas") shader = material.shader materials = [] for m in context.blend_data.materials: - if m.material_map and m.shader==shader: + if m.material_atlas and m.shader==shader: materials.append(m) - mat_map = MaterialMap(materials) + mat_map = MaterialAtlas(materials) return mat_map