diff options
Diffstat (limited to 'release/ui/buttons_physics_cloth.py')
-rw-r--r-- | release/ui/buttons_physics_cloth.py | 93 |
1 files changed, 63 insertions, 30 deletions
diff --git a/release/ui/buttons_physics_cloth.py b/release/ui/buttons_physics_cloth.py index 5cdca3c2c74..f34077c758a 100644 --- a/release/ui/buttons_physics_cloth.py +++ b/release/ui/buttons_physics_cloth.py @@ -1,14 +1,9 @@ import bpy -from buttons_particle import point_cache_ui - -def cloth_panel_enabled(md): - return md.point_cache.baked==False - class PhysicButtonsPanel(bpy.types.Panel): - __space_type__ = 'PROPERTIES' - __region_type__ = 'WINDOW' + __space_type__ = "PROPERTIES" + __region_type__ = "WINDOW" __context__ = "physics" def poll(self, context): @@ -43,8 +38,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel): if md: cloth = md.settings - - layout.active = cloth_panel_enabled(md) split = layout.split() @@ -89,35 +82,77 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel): __default_closed__ = True def poll(self, context): - return (context.cloth) + return (context.cloth != None) def draw(self, context): - md = context.cloth - point_cache_ui(self, md.point_cache, cloth_panel_enabled(md), 0, 0) + layout = self.layout + + cache = context.cloth.point_cache + layout.set_context_pointer("PointCache", cache) + + row = layout.row() + row.template_list(cache, "point_cache_list", cache, "active_point_cache_index") + col = row.column(align=True) + col.itemO("ptcache.add_new", icon="ICON_ZOOMIN", text="") + col.itemO("ptcache.remove", icon="ICON_ZOOMOUT", text="") + + row = layout.row() + row.itemR(cache, "name") + + row = layout.row() + row.itemR(cache, "start_frame") + row.itemR(cache, "end_frame") + + row = layout.row() + + if cache.baked == True: + row.itemO("ptcache.free_bake", text="Free Bake") + else: + row.item_booleanO("ptcache.bake", "bake", True, text="Bake") + + subrow = row.row() + subrow.enabled = cache.frames_skipped or cache.outdated + subrow.itemO("ptcache.bake", "bake", False, text="Calculate to Current Frame") + + row = layout.row() + #row.enabled = particle_panel_enabled(psys) + row.itemO("ptcache.bake_from_cache", text="Current Cache to Bake") + row.itemR(cache, "step"); + + row = layout.row() + #row.enabled = particle_panel_enabled(psys) + row.itemR(cache, "quick_cache") + row.itemR(cache, "disk_cache") + + layout.itemL(text=cache.info) + + layout.itemS() + + row = layout.row() + row.itemO("ptcache.bake_all", "bake", True, text="Bake All Dynamics") + row.itemO("ptcache.free_bake_all", text="Free All Bakes") + layout.itemO("ptcache.bake_all", "bake", False, text="Update All Dynamics to current frame") class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): __label__ = "Cloth Collision" __default_closed__ = True def poll(self, context): - return (context.cloth) + return (context.cloth != None) def draw_header(self, context): + layout = self.layout cloth = context.cloth.collision_settings - - self.layout.active = cloth_panel_enabled(context.cloth) - self.layout.itemR(cloth, "enable_collision", text="") + + layout.itemR(cloth, "enable_collision", text="") def draw(self, context): layout = self.layout - cloth = context.cloth.collision_settings - md = context.cloth - - layout.active = cloth.enable_collision and cloth_panel_enabled(md) - split = layout.split() + layout.active = cloth.enable_collision + col = split.column() col.itemR(cloth, "collision_quality", slider=True, text="Quality") col.itemR(cloth, "min_distance", slider=True, text="Distance") @@ -125,10 +160,10 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): col = split.column() col.itemR(cloth, "enable_self_collision", text="Self Collision") - sub = col.column() - sub.active = cloth.enable_self_collision - sub.itemR(cloth, "self_collision_quality", slider=True, text="Quality") - sub.itemR(cloth, "self_min_distance", slider=True, text="Distance") + col = col.column() + col.active = cloth.enable_self_collision + col.itemR(cloth, "self_collision_quality", slider=True, text="Quality") + col.itemR(cloth, "self_min_distance", slider=True, text="Distance") class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): __label__ = "Cloth Stiffness Scaling" @@ -138,19 +173,17 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): return (context.cloth != None) def draw_header(self, context): + layout = self.layout cloth = context.cloth.settings - self.layout.active = cloth_panel_enabled(context.cloth) - self.layout.itemR(cloth, "stiffness_scaling", text="") + layout.itemR(cloth, "stiffness_scaling", text="") def draw(self, context): layout = self.layout - - md = context.cloth ob = context.object cloth = context.cloth.settings - layout.active = cloth.stiffness_scaling and cloth_panel_enabled(md) + layout.active = cloth.stiffness_scaling split = layout.split() |