diff options
Diffstat (limited to 'release/scripts/ui/properties_physics_cloth.py')
-rw-r--r-- | release/scripts/ui/properties_physics_cloth.py | 88 |
1 files changed, 35 insertions, 53 deletions
diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py index 61e1fe81812..30619de5814 100644 --- a/release/scripts/ui/properties_physics_cloth.py +++ b/release/scripts/ui/properties_physics_cloth.py @@ -19,15 +19,13 @@ # <pep8 compliant> import bpy -narrowui = bpy.context.user_preferences.view.properties_width_check - from properties_physics_common import point_cache_ui from properties_physics_common import effector_weights_ui def cloth_panel_enabled(md): - return md.point_cache.baked is False + return md.point_cache.is_baked is False class CLOTH_MT_presets(bpy.types.Menu): @@ -40,18 +38,19 @@ class CLOTH_MT_presets(bpy.types.Menu): draw = bpy.types.Menu.draw_preset -class PhysicButtonsPanel(bpy.types.Panel): +class PhysicButtonsPanel(): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "physics" - def poll(self, context): + @classmethod + def poll(cls, context): ob = context.object rd = context.scene.render return (ob and ob.type == 'MESH') and (not rd.use_game_engine) -class PHYSICS_PT_cloth(PhysicButtonsPanel): +class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel): bl_label = "Cloth" def draw(self, context): @@ -59,7 +58,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel): md = context.cloth ob = context.object - wide_ui = context.region.width > narrowui split = layout.split() @@ -69,13 +67,12 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel): split.operator("object.modifier_remove", text="Remove") row = split.row(align=True) - row.prop(md, "render", text="") - row.prop(md, "realtime", text="") + row.prop(md, "show_render", text="") + row.prop(md, "show_viewport", text="") else: # add modifier split.operator("object.modifier_add", text="Add").type = 'CLOTH' - if wide_ui: - split.label() + split.label() if md: cloth = md.settings @@ -99,16 +96,15 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel): col.prop(cloth, "structural_stiffness", text="Structural") col.prop(cloth, "bending_stiffness", text="Bending") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Damping:") col.prop(cloth, "spring_damping", text="Spring") col.prop(cloth, "air_damping", text="Air") - col.prop(cloth, "pin_cloth", text="Pinning") + col.prop(cloth, "use_pin_cloth", text="Pinning") sub = col.column() - sub.active = cloth.pin_cloth + sub.active = cloth.use_pin_cloth sub.prop_object(cloth, "mass_vertex_group", ob, "vertex_groups", text="") sub.prop(cloth, "pin_stiffness", text="Stiffness") @@ -133,11 +129,12 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel): col.prop_object(cloth, "rest_shape_key", key, "keys", text="") -class PHYSICS_PT_cloth_cache(PhysicButtonsPanel): +class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel): bl_label = "Cloth Cache" bl_default_closed = True - def poll(self, context): + @classmethod + def poll(cls, context): return context.cloth def draw(self, context): @@ -145,58 +142,58 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel): point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 'CLOTH') -class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): +class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel): bl_label = "Cloth Collision" bl_default_closed = True - def poll(self, context): + @classmethod + def poll(cls, context): return context.cloth def draw_header(self, context): cloth = context.cloth.collision_settings self.layout.active = cloth_panel_enabled(context.cloth) - self.layout.prop(cloth, "enable_collision", text="") + self.layout.prop(cloth, "use_collision", text="") def draw(self, context): layout = self.layout cloth = context.cloth.collision_settings md = context.cloth - wide_ui = context.region.width > narrowui - layout.active = cloth.enable_collision and cloth_panel_enabled(md) + layout.active = cloth.use_collision and cloth_panel_enabled(md) split = layout.split() col = split.column() col.prop(cloth, "collision_quality", slider=True, text="Quality") - col.prop(cloth, "min_distance", slider=True, text="Distance") + col.prop(cloth, "distance_min", slider=True, text="Distance") col.prop(cloth, "friction") - if wide_ui: - col = split.column() - col.prop(cloth, "enable_self_collision", text="Self Collision") + col = split.column() + col.prop(cloth, "use_self_collision", text="Self Collision") sub = col.column() - sub.active = cloth.enable_self_collision + sub.active = cloth.use_self_collision sub.prop(cloth, "self_collision_quality", slider=True, text="Quality") - sub.prop(cloth, "self_min_distance", slider=True, text="Distance") + sub.prop(cloth, "self_distance_min", slider=True, text="Distance") layout.prop(cloth, "group") -class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): +class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel): bl_label = "Cloth Stiffness Scaling" bl_default_closed = True - def poll(self, context): + @classmethod + def poll(cls, context): return context.cloth def draw_header(self, context): cloth = context.cloth.settings self.layout.active = cloth_panel_enabled(context.cloth) - self.layout.prop(cloth, "stiffness_scaling", text="") + self.layout.prop(cloth, "use_stiffness_scale", text="") def draw(self, context): layout = self.layout @@ -204,9 +201,8 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): md = context.cloth ob = context.object cloth = context.cloth.settings - wide_ui = context.region.width > narrowui - layout.active = cloth.stiffness_scaling and cloth_panel_enabled(md) + layout.active = cloth.use_stiffness_scale and cloth_panel_enabled(md) split = layout.split() @@ -215,18 +211,18 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): col.prop_object(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="") col.prop(cloth, "structural_stiffness_max", text="Max") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Bending Stiffness:") col.prop_object(cloth, "bending_vertex_group", ob, "vertex_groups", text="") col.prop(cloth, "bending_stiffness_max", text="Max") -class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel): +class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, bpy.types.Panel): bl_label = "Cloth Field Weights" bl_default_closed = True - def poll(self, context): + @classmethod + def poll(cls, context): return (context.cloth) def draw(self, context): @@ -234,26 +230,12 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel): effector_weights_ui(self, context, cloth.effector_weights) -classes = [ - CLOTH_MT_presets, - - PHYSICS_PT_cloth, - PHYSICS_PT_cloth_cache, - PHYSICS_PT_cloth_collision, - PHYSICS_PT_cloth_stiffness, - PHYSICS_PT_cloth_field_weights] - - def register(): - register = bpy.types.register - for cls in classes: - register(cls) + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": register() |