Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/ui/properties_physics_cloth.py')
-rw-r--r--release/scripts/ui/properties_physics_cloth.py117
1 files changed, 48 insertions, 69 deletions
diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py
index 8761e8a38c0..099711f6dec 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 = 180
-
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):
@@ -36,22 +34,23 @@ class CLOTH_MT_presets(bpy.types.Menu):
'''
bl_label = "Cloth Presets"
preset_subdir = "cloth"
- preset_operator = "script.python_file_run"
+ preset_operator = "script.execute_preset"
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,10 +58,8 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
md = context.cloth
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
- split.operator_context = 'EXEC_DEFAULT'
if md:
# remove modifier + settings
@@ -70,15 +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.column()
-
- split.operator_context = 'INVOKE_DEFAULT'
+ split.label()
if md:
cloth = md.settings
@@ -90,9 +84,9 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
col = split.column()
col.label(text="Presets:")
- sub = col.row(align=True).split(percentage=0.75)
- sub.menu("CLOTH_MT_presets", text="Presets")
- sub.operator("cloth.preset_add", text="Add")
+ sub = col.row(align=True)
+ sub.menu("CLOTH_MT_presets", text=bpy.types.CLOTH_MT_presets.bl_label)
+ sub.operator("cloth.preset_add", text="", icon="ZOOMIN")
col.label(text="Quality:")
col.prop(cloth, "quality", text="Steps", slider=True)
@@ -102,17 +96,16 @@ 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.prop_object(cloth, "mass_vertex_group", ob, "vertex_groups", text="")
+ sub.active = cloth.use_pin_cloth
+ sub.prop_search(cloth, "mass_vertex_group", ob, "vertex_groups", text="")
sub.prop(cloth, "pin_stiffness", text="Stiffness")
col.label(text="Pre roll:")
@@ -133,73 +126,74 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
if key:
col.label(text="Rest Shape Key:")
- col.prop_object(cloth, "rest_shape_key", key, "keys", text="")
+ col.prop_search(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
+ bl_options = {'DEFAULT_CLOSED'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return context.cloth
def draw(self, context):
md = context.cloth
- point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 0, 0)
+ 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
+ bl_options = {'DEFAULT_CLOSED'}
- 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
+ bl_options = {'DEFAULT_CLOSED'}
- 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
@@ -207,29 +201,28 @@ 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()
col = split.column()
col.label(text="Structural Stiffness:")
- col.prop_object(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(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_search(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
+ bl_options = {'DEFAULT_CLOSED'}
- def poll(self, context):
+ @classmethod
+ def poll(cls, context):
return (context.cloth)
def draw(self, context):
@@ -237,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()