]> git.tdb.fi Git - libs/gl.git/blob - blender/io_mspgl/properties.py
f5a57cb7e7aa64e6f6e217d1089ba7502587166d
[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
19 class MspGLObjectProperties(bpy.types.Panel):
20         bl_idname = "OBJECT_PT_mspgl_properties"
21         bl_label = "MspGL properties"
22         bl_space_type = "PROPERTIES"
23         bl_region_type = "WINDOW"
24         bl_context = "object"
25
26         def draw(self, context):
27                 obj = context.active_object
28
29                 self.layout.prop(obj, "technique");
30                 self.layout.prop(obj, "inherit_tech");
31                 if obj.inherit_tech:
32                         self.layout.prop(obj, "override_material");
33                 self.layout.prop(obj, "compound");
34                 self.layout.prop(obj, "lod_for_parent")
35                 if obj.lod_for_parent:
36                         self.layout.prop(obj, "lod_index")
37
38 class MspGLMaterialProperties(bpy.types.Panel):
39         bl_idname = "MATERIAL_PT_mspgl_properties"
40         bl_label = "MspGL properties"
41         bl_space_type = "PROPERTIES"
42         bl_region_type = "WINDOW"
43         bl_context = "material"
44
45         @classmethod
46         def poll(cls, context):
47                 return context.active_object.active_material is not None
48
49         def draw(self, context):
50                 mat = context.active_object.active_material
51                 if not mat:
52                         return
53
54                 self.layout.prop(mat, "array_atlas");
55                 if mat.array_atlas:
56                         self.layout.prop(mat, "array_layer");
57
58 def register_properties():
59         bpy.types.Mesh.winding_test = bpy.props.BoolProperty(name="Winding test", description="Perform winding test to skip back faces")
60         bpy.types.Object.technique = bpy.props.StringProperty(name="Technique", description="Name of the technique to use for rendering")
61         bpy.types.Object.inherit_tech = bpy.props.BoolProperty(name="Inherit technique", description="Inherit from the technique to customize textures")
62         bpy.types.Object.override_material = bpy.props.BoolProperty(name="Override material", description="Override material in the inherited texture as well", default=True)
63         bpy.types.Object.compound = bpy.props.BoolProperty(name="Compound with parent", description="Join this object to its parent when exporting")
64         bpy.types.Object.lod_for_parent = bpy.props.BoolProperty(name="LoD for parent", description="This object is a level of detail for its parent")
65         bpy.types.Object.lod_index = bpy.props.IntProperty(name="LoD index", description="Index of the level of detail", min=1, default=1)
66         bpy.types.Material.array_atlas = bpy.props.BoolProperty(name="Texture array atlas", description="The material is stored in a texture array")
67         bpy.types.Material.array_layer = bpy.props.IntProperty("Texture array layer", description="Layer of the texture array atlas to use")