4 class PhysicButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
7 __context__ = "physics"
9 def poll(self, context):
10 return (context.cloth != None)
12 class Physic_PT_cloth(PhysicButtonsPanel):
13 __idname__ = "Physic_PT_cloth"
16 def draw(self, context):
18 cloth = context.cloth.settings
20 split = layout.split()
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")
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")
38 if cloth.mass_vertex_group:
39 layout.itemL(text="Goal:")
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")
47 class Physic_PT_cloth_collision(PhysicButtonsPanel):
48 __idname__ = "Physic_PT_clothcollision"
49 __label__ = "Cloth Collision"
51 def draw_header(self, context):
53 cloth = context.cloth.collision_settings
55 layout.itemR(cloth, "enable_collision", text="")
57 def draw(self, context):
59 cloth = context.cloth.collision_settings
61 layout.active = cloth.enable_collision
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")
69 layout.itemR(cloth, "enable_self_collision", text="Self Collision")
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")
76 class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
77 __idname__ = "Physic_PT_stiffness"
78 __label__ = "Cloth Stiffness Scaling"
80 def draw_header(self, context):
82 cloth = context.cloth.settings
84 layout.itemR(cloth, "stiffness_scaling", text="")
86 def draw(self, context):
88 cloth = context.cloth.settings
90 layout.active = cloth.stiffness_scaling
92 split = layout.split()
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")
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")
104 bpy.types.register(Physic_PT_cloth)
105 bpy.types.register(Physic_PT_cloth_collision)
106 bpy.types.register(Physic_PT_cloth_stiffness)