OBJ exporter working (Python 3.0), but needs testing and fixing.
[blender.git] / release / ui / buttons_physic_cloth.py
1
2 import bpy
3
4 class PhysicButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "physics"
8
9         def poll(self, context):
10                 return (context.cloth != None)
11                 
12 class Physic_PT_cloth(PhysicButtonsPanel):
13         __idname__ = "Physic_PT_cloth"
14         __label__ = "Cloth"
15
16         def draw(self, context):
17                 layout = self.layout
18                 cloth = context.cloth.settings
19                 
20                 split = layout.split()
21                 
22                 col = split.column()
23                 col.itemR(cloth, "quality", slider=True)
24                 col.itemR(cloth, "gravity")
25                 col.itemR(cloth, "mass")
26                 col.itemR(cloth, "mass_vertex_group", text="Vertex Group")
27
28                 col = split.column()
29                 col.itemL(text="Stiffness:")
30                 col.itemR(cloth, "structural_stiffness", text="Structural")
31                 col.itemR(cloth, "bending_stiffness", text="Bending")
32                 col.itemL(text="Damping:")
33                 col.itemR(cloth, "spring_damping", text="Spring")
34                 col.itemR(cloth, "air_damping", text="Air")
35                 
36                 # Disabled for now
37                 """
38                 if cloth.mass_vertex_group:
39                         layout.itemL(text="Goal:")
40                 
41                         col = layout.column_flow()
42                         col.itemR(cloth, "goal_default", text="Default")
43                         col.itemR(cloth, "goal_spring", text="Stiffness")
44                         col.itemR(cloth, "goal_friction", text="Friction")
45                 """
46         
47 class Physic_PT_cloth_collision(PhysicButtonsPanel):
48         __idname__ = "Physic_PT_clothcollision"
49         __label__ = "Cloth Collision"
50         
51         def draw_header(self, context):
52                 layout = self.layout
53                 cloth = context.cloth.settings
54         
55                 layout.itemR(cloth, "enable_collision", text="")
56
57         def draw(self, context):
58                 layout = self.layout
59                 cloth = context.cloth.settings
60                 
61                 layout.active = cloth.enable_collision  
62                 
63                 col = layout.column_flow()
64                 col.itemR(cloth, "collision_quality", slider=True)
65                 col.itemR(cloth, "friction")
66                 col.itemR(cloth, "min_distance", text="MinDistance")
67                 
68                 
69                 layout.itemR(cloth, "enable_self_collision", text="Self Collision")
70                 
71                 col = layout.column_flow()
72                 col.active = cloth.enable_self_collision
73                 col.itemR(cloth, "self_collision_quality", slider=True)
74                 col.itemR(cloth, "self_min_distance", text="MinDistance")
75
76 class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
77         __idname__ = "Physic_PT_stiffness"
78         __label__ = "Cloth Stiffness Scaling"
79         
80         def draw_header(self, context):
81                 layout = self.layout
82                 cloth = context.cloth.settings
83         
84                 layout.itemR(cloth, "stiffness_scaling", text="")
85
86         def draw(self, context):
87                 layout = self.layout
88                 cloth = context.cloth.settings
89                 
90                 layout.active = cloth.stiffness_scaling 
91                 
92                 split = layout.split()
93                 
94                 sub = split.column()
95                 sub.itemL(text="Structural Stiffness:")
96                 sub.column().itemR(cloth, "structural_stiffness_vertex_group", text="VGroup")
97                 sub.itemR(cloth, "structural_stiffness_max", text="Max")
98                 
99                 sub = split.column()
100                 sub.itemL(text="Bending Stiffness:")
101                 sub.column().itemR(cloth, "bending_vertex_group", text="VGroup")
102                 sub.itemR(cloth, "bending_stiffness_max", text="Max")
103                 
104 bpy.types.register(Physic_PT_cloth)
105 bpy.types.register(Physic_PT_cloth_collision)
106 bpy.types.register(Physic_PT_cloth_stiffness)