]> git.tdb.fi Git - libs/gl.git/blob - blender/io_mspgl/properties.py
Check the flat qualifier from the correct member
[libs/gl.git] / blender / io_mspgl / properties.py
1 import bpy
2
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"
8         bl_context = "data"
9
10         @classmethod
11         def poll(cls, context):
12                 return context.active_object.type=="MESH"
13
14         def draw(self, context):
15                 mesh = context.active_object.data
16
17                 self.layout.prop(mesh, "winding_test")
18                 self.layout.prop(mesh, "smoothing")
19
20                 self.layout.separator()
21
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")
27
28                 self.layout.separator()
29
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")
35
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"
41         bl_context = "object"
42
43         def draw(self, context):
44                 obj = context.active_object
45
46                 self.layout.prop(obj, "compound")
47                 self.layout.prop(obj, "lod_for_parent")
48                 if obj.lod_for_parent:
49                         self.layout.prop(obj, "lod_index")
50
51 class MspGLMaterialProperties(bpy.types.Panel):
52         bl_idname = "MATERIAL_PT_mspgl_properties"
53         bl_label = "MspGL properties"
54         bl_space_type = "PROPERTIES"
55         bl_region_type = "WINDOW"
56         bl_context = "material"
57
58         @classmethod
59         def poll(cls, context):
60                 return context.active_object.active_material is not None
61
62         def draw(self, context):
63                 mat = context.active_object.active_material
64                 if not mat:
65                         return
66
67                 self.layout.prop(mat, "technique")
68                 self.layout.prop(mat, "inherit_tech")
69                 if mat.inherit_tech:
70                         self.layout.prop(mat, "override_material")
71                 self.layout.prop(mat, "srgb_colors")
72                 self.layout.prop(mat, "array_atlas")
73                 if mat.array_atlas:
74                         self.layout.prop(mat, "array_layer")
75                 self.layout.prop(mat, "material_map")
76
77 class MspGLTextureProperties(bpy.types.Panel):
78         bl_idname = "TEXTURE_PT_mspgl_properties"
79         bl_label = "MspGL properties"
80         bl_space_type = "PROPERTIES"
81         bl_region_type = "WINDOW"
82         bl_context = "texture"
83
84         @classmethod
85         def poll(cls, context):
86                 mat = context.active_object.active_material
87                 return mat is not None and mat.active_texture is not None
88
89         def draw(self, context):
90                 tex = context.active_object.active_material.active_texture
91                 if not tex:
92                         return
93
94                 self.layout.prop(tex, "default_filter")
95
96 def register_properties():
97         bpy.types.Mesh.winding_test = bpy.props.BoolProperty(name="Winding test", description="Perform winding test to skip back faces")
98         bpy.types.Mesh.smoothing = bpy.props.EnumProperty(name="Smoothing", description="Smoothing method to use", default="MSPGL",
99                 items=(("NONE", "None", "No smoothing"),
100                         ("BLENDER", "Blender", "Use Blender's vertex normals"),
101                         ("MSPGL", "MspGL", "Compute vertex normals internally")))
102         bpy.types.Mesh.use_lines = bpy.props.BoolProperty(name="Include lines", description="Include edges without faces as lines", default=False)
103         bpy.types.Mesh.vertex_groups = bpy.props.BoolProperty(name="Vertex groups", description="Include vertex groups and weights", default=False)
104         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)
105         bpy.types.Mesh.use_uv = bpy.props.EnumProperty(name="Use UV", description="Use UV coordinates", default="UNIT0",
106                 items=(("NONE", "None", "Ignore all UV coordinates"),
107                         ("UNIT0", "Unit 0", "Use UV coordinates for unit 0"),
108                         ("ALL", "All", "Use all UV coordinates")))
109         bpy.types.Mesh.tbn_vecs = bpy.props.BoolProperty(name="TBN vectors", description="Compute tangent and binormal vectors for vertices", default=False)
110         bpy.types.Mesh.tbn_uvtex = bpy.props.StringProperty(name="TBN UV layer", description="UV layer to use as basis for TBN vectors", default="")
111
112         bpy.types.Object.compound = bpy.props.BoolProperty(name="Compound with parent", description="Join this object to its parent when exporting")
113         bpy.types.Object.lod_for_parent = bpy.props.BoolProperty(name="LoD for parent", description="This object is a level of detail for its parent")
114         bpy.types.Object.lod_index = bpy.props.IntProperty(name="LoD index", description="Index of the level of detail", min=1, max=16, default=1)
115
116         bpy.types.Material.technique = bpy.props.StringProperty(name="Technique", description="Name of an external technique to use for rendering")
117         bpy.types.Material.inherit_tech = bpy.props.BoolProperty(name="Inherit technique", description="Inherit from the technique to customize textures")
118         bpy.types.Material.override_material = bpy.props.BoolProperty(name="Override material", description="Override material in the inherited technique as well", default=True)
119         bpy.types.Material.srgb_colors = bpy.props.BoolProperty(name="sRGB colors", description="Export material colors as sRGB instead of linear", default=True)
120         bpy.types.Material.array_atlas = bpy.props.BoolProperty(name="Texture array atlas", description="The material is stored in a texture array")
121         bpy.types.Material.array_layer = bpy.props.IntProperty("Texture array layer", description="Layer of the texture array atlas to use")
122         bpy.types.Material.material_map = bpy.props.BoolProperty(name="Material map", description="Make this material part of a material map")
123
124         bpy.types.Texture.default_filter = bpy.props.BoolProperty(name="Default filter", description="Let the loading program determine filtering options")