4 class PhysicButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
7 __context__ = "physics"
9 def cloth_modifier(self, context):
10 ob = context.active_object
11 for md in ob.modifiers:
12 if md.type == 'CLOTH':
17 def poll(self, context):
18 md = self.cloth_modifier(context)
21 class Physic_PT_cloth(PhysicButtonsPanel):
22 __idname__ = "Physic_PT_cloth"
25 def draw(self, context):
27 md = self.cloth_modifier(context)
30 split = layout.split()
33 col.itemR(cloth, "quality", slider=True)
34 col.itemR(cloth, "gravity")
35 col.itemR(cloth, "mass")
36 col.itemR(cloth, "mass_vertex_group", text="Vertex Group")
39 col.itemL(text="Stiffness:")
40 col.itemR(cloth, "structural_stiffness", text="Structural")
41 col.itemR(cloth, "bending_stiffness", text="Bending")
42 col.itemL(text="Damping:")
43 col.itemR(cloth, "spring_damping", text="Spring")
44 col.itemR(cloth, "air_damping", text="Air")
48 if cloth.mass_vertex_group:
49 layout.itemL(text="Goal:")
51 col = layout.column_flow()
52 col.itemR(cloth, "goal_default", text="Default")
53 col.itemR(cloth, "goal_spring", text="Stiffness")
54 col.itemR(cloth, "goal_friction", text="Friction")
57 class Physic_PT_cloth_collision(PhysicButtonsPanel):
58 __idname__ = "Physic_PT_clothcollision"
59 __label__ = "Cloth Collision"
61 def draw_header(self, context):
63 md = self.cloth_modifier(context)
64 cloth = md.collision_settings
66 layout.itemR(cloth, "enable_collision", text="")
68 def draw(self, context):
70 md = self.cloth_modifier(context)
71 cloth = md.collision_settings
73 col = layout.column_flow()
74 col.itemR(cloth, "collision_quality", slider=True)
75 col.itemR(cloth, "friction")
76 col.itemR(cloth, "min_distance", text="MinDistance")
79 layout.itemR(cloth, "enable_self_collision", text="Self Collision")
81 col = layout.column_flow()
82 col.itemR(cloth, "self_collision_quality", slider=True)
83 col.itemR(cloth, "self_min_distance", text="MinDistance")
85 class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
86 __idname__ = "Physic_PT_stiffness"
87 __label__ = "Cloth Stiffness Scaling"
89 def draw_header(self, context):
91 md = self.cloth_modifier(context)
94 layout.itemR(cloth, "stiffness_scaling", text="")
96 def draw(self, context):
98 md = self.cloth_modifier(context)
101 split = layout.split()
104 sub.itemL(text="Structural Stiffness:")
105 sub.column().itemR(cloth, "structural_stiffness_vertex_group", text="VGroup")
106 sub.itemR(cloth, "structural_stiffness_max", text="Max")
109 sub.itemL(text="Bending Stiffness:")
110 sub.column().itemR(cloth, "bending_vertex_group", text="VGroup")
111 sub.itemR(cloth, "bending_stiffness_max", text="Max")
113 bpy.types.register(Physic_PT_cloth)
114 bpy.types.register(Physic_PT_cloth_collision)
115 bpy.types.register(Physic_PT_cloth_stiffness)