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, "compound")
51 self.layout.prop(obj, "lod_for_parent")
52 if obj.lod_for_parent:
53 self.layout.prop(obj, "lod_index")
55 class MspGLMaterialProperties(bpy.types.Panel):
56 bl_idname = "MATERIAL_PT_mspgl_properties"
57 bl_label = "MspGL properties"
58 bl_space_type = "PROPERTIES"
59 bl_region_type = "WINDOW"
60 bl_context = "material"
63 def poll(cls, context):
64 return context.active_object.active_material is not None
66 def draw(self, context):
67 mat = context.active_object.active_material
71 self.layout.prop(mat, "srgb_colors")
72 self.layout.prop(mat, "array_atlas")
74 self.layout.prop(mat, "array_layer")
76 def register_properties():
77 bpy.types.Mesh.winding_test = bpy.props.BoolProperty(name="Winding test", description="Perform winding test to skip back faces")
78 bpy.types.Mesh.smoothing = bpy.props.EnumProperty(name="Smoothing", description="Smoothing method to use", default="MSPGL",
79 items=(("NONE", "None", "No smoothing"),
80 ("BLENDER", "Blender", "Use Blender's vertex normals"),
81 ("MSPGL", "MspGL", "Compute vertex normals internally")))
82 bpy.types.Mesh.use_lines = bpy.props.BoolProperty(name="Include lines", description="Include edges without faces as lines", default=False)
83 bpy.types.Mesh.vertex_groups = bpy.props.BoolProperty(name="Vertex groups", description="Include vertex groups and weights", default=False)
84 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)
85 bpy.types.Mesh.use_uv = bpy.props.EnumProperty(name="Use UV", description="Use UV coordinates", default="UNIT0",
86 items=(("NONE", "None", "Ignore all UV coordinates"),
87 ("UNIT0", "Unit 0", "Use UV coordinates for unit 0"),
88 ("ALL", "All", "Use all UV coordinates")))
89 bpy.types.Mesh.tbn_vecs = bpy.props.BoolProperty(name="TBN vectors", description="Compute tangent and binormal vectors for vertices", default=False)
90 bpy.types.Mesh.tbn_uvtex = bpy.props.StringProperty(name="TBN UV layer", description="UV layer to use as basis for TBN vectors", default="")
92 bpy.types.Object.technique = bpy.props.StringProperty(name="Technique", description="Name of the technique to use for rendering")
93 bpy.types.Object.inherit_tech = bpy.props.BoolProperty(name="Inherit technique", description="Inherit from the technique to customize textures")
94 bpy.types.Object.override_material = bpy.props.BoolProperty(name="Override material", description="Override material in the inherited technique as well", default=True)
95 bpy.types.Object.compound = bpy.props.BoolProperty(name="Compound with parent", description="Join this object to its parent when exporting")
96 bpy.types.Object.lod_for_parent = bpy.props.BoolProperty(name="LoD for parent", description="This object is a level of detail for its parent")
97 bpy.types.Object.lod_index = bpy.props.IntProperty(name="LoD index", description="Index of the level of detail", min=1, max=16, default=1)
99 bpy.types.Material.srgb_colors = bpy.props.BoolProperty(name="sRGB colors", description="Export material colors as sRGB instead of linear", default=True)
100 bpy.types.Material.array_atlas = bpy.props.BoolProperty(name="Texture array atlas", description="The material is stored in a texture array")
101 bpy.types.Material.array_layer = bpy.props.IntProperty("Texture array layer", description="Layer of the texture array atlas to use")