diff options
Diffstat (limited to 'release/ui/buttons_physics_cloth.py')
-rw-r--r-- | release/ui/buttons_physics_cloth.py | 93 |
1 files changed, 30 insertions, 63 deletions
diff --git a/release/ui/buttons_physics_cloth.py b/release/ui/buttons_physics_cloth.py index f34077c758a..5cdca3c2c74 100644 --- a/release/ui/buttons_physics_cloth.py +++ b/release/ui/buttons_physics_cloth.py @@ -1,9 +1,14 @@ 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): @@ -38,6 +43,8 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel): if md: cloth = md.settings + + layout.active = cloth_panel_enabled(md) split = layout.split() @@ -82,76 +89,34 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel): __default_closed__ = True def poll(self, context): - return (context.cloth != None) + return (context.cloth) def draw(self, context): - 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") + md = context.cloth + point_cache_ui(self, md.point_cache, cloth_panel_enabled(md), 0, 0) class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): __label__ = "Cloth Collision" __default_closed__ = True def poll(self, context): - return (context.cloth != None) + return (context.cloth) def draw_header(self, context): - layout = self.layout cloth = context.cloth.collision_settings - - layout.itemR(cloth, "enable_collision", text="") + + self.layout.active = cloth_panel_enabled(context.cloth) + self.layout.itemR(cloth, "enable_collision", text="") def draw(self, context): layout = self.layout + cloth = context.cloth.collision_settings - split = layout.split() + md = context.cloth - layout.active = cloth.enable_collision + layout.active = cloth.enable_collision and cloth_panel_enabled(md) + + split = layout.split() col = split.column() col.itemR(cloth, "collision_quality", slider=True, text="Quality") @@ -160,10 +125,10 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): col = split.column() col.itemR(cloth, "enable_self_collision", text="Self Collision") - 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") + 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") class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): __label__ = "Cloth Stiffness Scaling" @@ -173,17 +138,19 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): return (context.cloth != None) def draw_header(self, context): - layout = self.layout cloth = context.cloth.settings - layout.itemR(cloth, "stiffness_scaling", text="") + self.layout.active = cloth_panel_enabled(context.cloth) + self.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 + layout.active = cloth.stiffness_scaling and cloth_panel_enabled(md) split = layout.split() |