3 class MspGLMeshProperties(bpy.types.Panel):
4 bl_idname = "MESH_PT_mspgl_properties"
5 bl_label = "MspGL properties"
6 bl_space_type = "PROPERTIES"
7 bl_region_type = "WINDOW"
11 def poll(cls, context):
12 return context.active_object.type=="MESH"
14 def draw(self, context):
15 mesh = context.active_object.data
17 self.layout.prop(mesh, "winding_test")
18 self.layout.prop(mesh, "smoothing")
20 self.layout.separator()
22 col = self.layout.column()
23 col.label("Data selection")
24 col.prop(mesh, "use_lines")
25 col.prop(mesh, "vertex_groups")
26 col.prop(mesh, "max_groups_per_vertex")
28 self.layout.separator()
30 col = self.layout.column()
31 col.label("Texturing")
32 col.prop(mesh, "use_uv")
33 col.prop(mesh, "tbn_vecs")
34 col.prop(mesh, "tbn_uvtex")
36 class MspGLObjectProperties(bpy.types.Panel):
37 bl_idname = "OBJECT_PT_mspgl_properties"
38 bl_label = "MspGL properties"
39 bl_space_type = "PROPERTIES"
40 bl_region_type = "WINDOW"
43 def draw(self, context):
44 obj = context.active_object
46 self.layout.prop(obj, "technique");
47 self.layout.prop(obj, "inherit_tech");
49 self.layout.prop(obj, "override_material");
50 self.layout.prop(obj, "material_tex")
51 self.layout.prop(obj, "compound");
52 self.layout.prop(obj, "lod_for_parent")
53 if obj.lod_for_parent:
54 self.layout.prop(obj, "lod_index")
56 class MspGLMaterialProperties(bpy.types.Panel):
57 bl_idname = "MATERIAL_PT_mspgl_properties"
58 bl_label = "MspGL properties"
59 bl_space_type = "PROPERTIES"
60 bl_region_type = "WINDOW"
61 bl_context = "material"
64 def poll(cls, context):
65 return context.active_object.active_material is not None
67 def draw(self, context):
68 mat = context.active_object.active_material
72 self.layout.prop(mat, "srgb_colors")
73 self.layout.prop(mat, "array_atlas");
75 self.layout.prop(mat, "array_layer");
77 def register_properties():
78 bpy.types.Mesh.winding_test = bpy.props.BoolProperty(name="Winding test", description="Perform winding test to skip back faces")
79 bpy.types.Mesh.smoothing = bpy.props.EnumProperty(name="Smoothing", description="Smoothing method to use", default="MSPGL",
80 items=(("NONE", "None", "No smoothing"),
81 ("BLENDER", "Blender", "Use Blender's vertex normals"),
82 ("MSPGL", "MspGL", "Compute vertex normals internally")))
83 bpy.types.Mesh.use_lines = bpy.props.BoolProperty(name="Include lines", description="Include edges without faces as lines", default=False)
84 bpy.types.Mesh.vertex_groups = bpy.props.BoolProperty(name="Vertex groups", description="Include vertex groups and weights", default=False)
85 bpy.types.Mesh.max_groups_per_vertex = bpy.props.IntProperty(name="Max groups", description="Maximum amount of groups per vertex", min=1, max=4, default=2)
86 bpy.types.Mesh.use_uv = bpy.props.EnumProperty(name="Use UV", description="Use UV coordinates", default="UNIT0",
87 items=(("NONE", "None", "Ignore all UV coordinates"),
88 ("UNIT0", "Unit 0", "Use UV coordinates for unit 0"),
89 ("ALL", "All", "Use all UV coordinates")))
90 bpy.types.Mesh.tbn_vecs = bpy.props.BoolProperty(name="TBN vectors", description="Compute tangent and binormal vectors for vertices", default=False)
91 bpy.types.Mesh.tbn_uvtex = bpy.props.StringProperty(name="TBN UV layer", description="UV layer to use as basis for TBN vectors", default="")
93 bpy.types.Object.technique = bpy.props.StringProperty(name="Technique", description="Name of the technique to use for rendering")
94 bpy.types.Object.inherit_tech = bpy.props.BoolProperty(name="Inherit technique", description="Inherit from the technique to customize textures")
95 bpy.types.Object.override_material = bpy.props.BoolProperty(name="Override material", description="Override material in the inherited technique as well", default=True)
96 bpy.types.Object.material_tex = bpy.props.BoolProperty(name="Material texture", description="Generate a texture based on material colors", default=False)
97 bpy.types.Object.compound = bpy.props.BoolProperty(name="Compound with parent", description="Join this object to its parent when exporting")
98 bpy.types.Object.lod_for_parent = bpy.props.BoolProperty(name="LoD for parent", description="This object is a level of detail for its parent")
99 bpy.types.Object.lod_index = bpy.props.IntProperty(name="LoD index", description="Index of the level of detail", min=1, max=16, default=1)
101 bpy.types.Material.srgb_colors = bpy.props.BoolProperty(name="sRGB colors", description="Export material colors as sRGB instead of linear", default=True)
102 bpy.types.Material.array_atlas = bpy.props.BoolProperty(name="Texture array atlas", description="The material is stored in a texture array")
103 bpy.types.Material.array_layer = bpy.props.IntProperty("Texture array layer", description="Layer of the texture array atlas to use")