4 class PhysicButtonsPanel(bpy.types.Panel):
5 __space_type__ = 'PROPERTIES'
6 __region_type__ = 'WINDOW'
7 __context__ = "physics"
9 def poll(self, context):
11 rd = context.scene.render_data
12 return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
14 class PHYSICS_PT_cloth(PhysicButtonsPanel):
17 def draw(self, context):
23 split = layout.split()
24 split.operator_context = 'EXEC_DEFAULT'
27 # remove modifier + settings
28 split.set_context_pointer("modifier", md)
29 split.itemO("object.modifier_remove", text="Remove")
31 row = split.row(align=True)
32 row.itemR(md, "render", text="")
33 row.itemR(md, "realtime", text="")
36 split.item_enumO("object.modifier_add", "type", 'CLOTH', text="Add")
42 split = layout.split()
45 col.itemL(text="Quality:")
46 col.itemR(cloth, "quality", text="Steps",slider=True)
47 col.itemL(text="Gravity:")
48 col.itemR(cloth, "gravity", text="")
50 col.itemR(cloth, "pin_cloth", text="Pin")
51 sub = col.column(align=True)
52 sub.active = cloth.pin_cloth
53 sub.itemR(cloth, "pin_stiffness", text="Stiffness")
54 sub.item_pointerR(cloth, "mass_vertex_group", ob, "vertex_groups", text="")
57 col.itemL(text="Presets...")
58 col.itemL(text="TODO!")
59 col.itemL(text="Material:")
60 sub = col.column(align=True)
61 sub.itemR(cloth, "mass")
62 sub.itemR(cloth, "structural_stiffness", text="Structural")
63 sub.itemR(cloth, "bending_stiffness", text="Bending")
64 col.itemL(text="Damping:")
65 sub = col.column(align=True)
66 sub.itemR(cloth, "spring_damping", text="Spring")
67 sub.itemR(cloth, "air_damping", text="Air")
71 if cloth.mass_vertex_group:
72 layout.itemL(text="Goal:")
74 col = layout.column_flow()
75 col.itemR(cloth, "goal_default", text="Default")
76 col.itemR(cloth, "goal_spring", text="Stiffness")
77 col.itemR(cloth, "goal_friction", text="Friction")
80 class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
81 __label__ = "Cloth Cache"
82 __default_closed__ = True
84 def poll(self, context):
85 return (context.cloth != None)
87 def draw(self, context):
90 cache = context.cloth.point_cache
91 layout.set_context_pointer("PointCache", cache)
94 row.template_list(cache, "point_cache_list", cache, "active_point_cache_index")
95 col = row.column(align=True)
96 col.itemO("ptcache.add_new", icon='ICON_ZOOMIN', text="")
97 col.itemO("ptcache.remove", icon='ICON_ZOOMOUT', text="")
100 row.itemR(cache, "name")
103 row.itemR(cache, "start_frame")
104 row.itemR(cache, "end_frame")
108 if cache.baked == True:
109 row.itemO("ptcache.free_bake", text="Free Bake")
111 row.item_booleanO("ptcache.bake", "bake", True, text="Bake")
114 subrow.enabled = cache.frames_skipped or cache.outdated
115 subrow.itemO("ptcache.bake", "bake", False, text="Calculate to Current Frame")
118 #row.enabled = particle_panel_enabled(psys)
119 row.itemO("ptcache.bake_from_cache", text="Current Cache to Bake")
120 row.itemR(cache, "step");
123 #row.enabled = particle_panel_enabled(psys)
124 row.itemR(cache, "quick_cache")
125 row.itemR(cache, "disk_cache")
127 layout.itemL(text=cache.info)
132 row.itemO("ptcache.bake_all", "bake", True, text="Bake All Dynamics")
133 row.itemO("ptcache.free_bake_all", text="Free All Bakes")
134 layout.itemO("ptcache.bake_all", "bake", False, text="Update All Dynamics to current frame")
136 class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
137 __label__ = "Cloth Collision"
138 __default_closed__ = True
140 def poll(self, context):
141 return (context.cloth != None)
143 def draw_header(self, context):
145 cloth = context.cloth.collision_settings
147 layout.itemR(cloth, "enable_collision", text="")
149 def draw(self, context):
151 cloth = context.cloth.collision_settings
152 split = layout.split()
154 layout.active = cloth.enable_collision
157 col.itemR(cloth, "collision_quality", slider=True, text="Quality")
158 col.itemR(cloth, "min_distance", slider=True, text="Distance")
159 col.itemR(cloth, "friction")
162 col.itemR(cloth, "enable_self_collision", text="Self Collision")
164 col.active = cloth.enable_self_collision
165 col.itemR(cloth, "self_collision_quality", slider=True, text="Quality")
166 col.itemR(cloth, "self_min_distance", slider=True, text="Distance")
168 class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
169 __label__ = "Cloth Stiffness Scaling"
170 __default_closed__ = True
172 def poll(self, context):
173 return (context.cloth != None)
175 def draw_header(self, context):
177 cloth = context.cloth.settings
179 layout.itemR(cloth, "stiffness_scaling", text="")
181 def draw(self, context):
184 cloth = context.cloth.settings
186 layout.active = cloth.stiffness_scaling
188 split = layout.split()
191 col.itemL(text="Structural Stiffness:")
192 sub = col.column(align=True)
193 sub.itemR(cloth, "structural_stiffness_max", text="Max")
194 sub.item_pointerR(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="")
197 col.itemL(text="Bending Stiffness:")
198 sub = col.column(align=True)
199 sub.itemR(cloth, "bending_stiffness_max", text="Max")
200 sub.item_pointerR(cloth, "bending_vertex_group", ob, "vertex_groups", text="")
202 bpy.types.register(PHYSICS_PT_cloth)
203 bpy.types.register(PHYSICS_PT_cloth_cache)
204 bpy.types.register(PHYSICS_PT_cloth_collision)
205 bpy.types.register(PHYSICS_PT_cloth_stiffness)