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/ui/buttons_physics_softbody.py')
-rw-r--r--release/ui/buttons_physics_softbody.py215
1 files changed, 87 insertions, 128 deletions
diff --git a/release/ui/buttons_physics_softbody.py b/release/ui/buttons_physics_softbody.py
index 2beba8c95a0..703977a056f 100644
--- a/release/ui/buttons_physics_softbody.py
+++ b/release/ui/buttons_physics_softbody.py
@@ -1,6 +1,11 @@
import bpy
+from buttons_particle import point_cache_ui
+
+def softbody_panel_enabled(md):
+ return md.point_cache.baked==False
+
class PhysicButtonsPanel(bpy.types.Panel):
__space_type__ = 'PROPERTIES'
__region_type__ = 'WINDOW'
@@ -41,6 +46,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel):
# General
split = layout.split()
+ split.enabled = softbody_panel_enabled(md)
col = split.column()
col.itemL(text="Object:")
@@ -60,179 +66,132 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel):
return (context.soft_body)
def draw(self, context):
- layout = self.layout
-
- cache = context.soft_body.point_cache
- layout.set_context_pointer("PointCache", cache)
-
- row = layout.row()
- row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2)
- 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")
-
- sub = row.row()
- sub.enabled = cache.frames_skipped or cache.outdated
- sub.itemO("ptcache.bake", "bake", False, text="Calculate to Current Frame")
+ md = context.soft_body
+ point_cache_ui(self, md.point_cache, softbody_panel_enabled(md), 0, 0)
- row = layout.row()
- row.itemO("ptcache.bake_from_cache", text="Current Cache to Bake")
- row.itemR(cache, "step");
-
- row = layout.row()
- 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_softbody_goal(PhysicButtonsPanel):
__label__ = "Soft Body Goal"
+ __default_closed__ = True
def poll(self, context):
return (context.soft_body)
def draw_header(self, context):
- layout = self.layout
-
softbody = context.soft_body.settings
- layout.itemR(softbody, "use_goal", text="")
+ self.layout.active = softbody_panel_enabled(context.soft_body)
+ self.layout.itemR(softbody, "use_goal", text="")
def draw(self, context):
layout = self.layout
md = context.soft_body
+ softbody = md.settings
ob = context.object
+
+ layout.active = softbody.use_goal and softbody_panel_enabled(md)
split = layout.split()
-
- if md:
- softbody = md.settings
- layout.active = softbody.use_goal
- # Goal
- split = layout.split()
+ # Goal
+ split = layout.split()
- col = split.column()
- col.itemL(text="Goal Strengths:")
- col.itemR(softbody, "goal_default", text="Default")
- sub = col.column(align=True)
- sub.itemR(softbody, "goal_min", text="Minimum")
- sub.itemR(softbody, "goal_max", text="Maximum")
+ col = split.column()
+ col.itemL(text="Goal Strengths:")
+ col.itemR(softbody, "goal_default", text="Default")
+ sub = col.column(align=True)
+ sub.itemR(softbody, "goal_min", text="Minimum")
+ sub.itemR(softbody, "goal_max", text="Maximum")
- col = split.column()
- col.itemL(text="Goal Settings:")
- col.itemR(softbody, "goal_spring", text="Stiffness")
- col.itemR(softbody, "goal_friction", text="Damping")
+ col = split.column()
+ col.itemL(text="Goal Settings:")
+ col.itemR(softbody, "goal_spring", text="Stiffness")
+ col.itemR(softbody, "goal_friction", text="Damping")
- layout.item_pointerR(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group")
+ layout.item_pointerR(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group")
class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
__label__ = "Soft Body Edges"
+ __default_closed__ = True
def poll(self, context):
return (context.soft_body)
def draw_header(self, context):
- layout = self.layout
-
softbody = context.soft_body.settings
- layout.itemR(softbody, "use_edges", text="")
+ self.layout.active = softbody_panel_enabled(context.soft_body)
+ self.layout.itemR(softbody, "use_edges", text="")
def draw(self, context):
layout = self.layout
md = context.soft_body
+ softbody = md.settings
ob = context.object
+
+ layout.active = softbody.use_edges and softbody_panel_enabled(md)
- if md:
- softbody = md.settings
-
- layout.active = softbody.use_edges
-
- split = layout.split()
-
- col = split.column()
- col.itemL(text="Springs:")
- col.itemR(softbody, "pull")
- col.itemR(softbody, "push")
- col.itemR(softbody, "damp")
- col.itemR(softbody, "plastic")
- col.itemR(softbody, "bending")
- col.itemR(softbody, "spring_length", text="Length")
-
- col = split.column()
- col.itemR(softbody, "stiff_quads")
- sub = col.column()
- sub.active = softbody.stiff_quads
- sub.itemR(softbody, "shear")
+ split = layout.split()
- col.itemR(softbody, "new_aero", text="Aero")
- sub = col.column()
- sub.enabled = softbody.new_aero
- sub.itemR(softbody, "aero", text="Factor")
-
- col.itemL(text="Collision:")
- col.itemR(softbody, "edge_collision", text="Edge")
- col.itemR(softbody, "face_collision", text="Face")
+ col = split.column()
+ col.itemL(text="Springs:")
+ col.itemR(softbody, "pull")
+ col.itemR(softbody, "push")
+ col.itemR(softbody, "damp")
+ col.itemR(softbody, "plastic")
+ col.itemR(softbody, "bending")
+ col.itemR(softbody, "spring_length", text="Length")
+
+ col = split.column()
+ col.itemR(softbody, "stiff_quads")
+ sub = col.column()
+ sub.active = softbody.stiff_quads
+ sub.itemR(softbody, "shear")
+
+ col.itemR(softbody, "new_aero", text="Aero")
+ sub = col.column()
+ sub.enabled = softbody.new_aero
+ sub.itemR(softbody, "aero", text="Factor")
+
+ col.itemL(text="Collision:")
+ col.itemR(softbody, "edge_collision", text="Edge")
+ col.itemR(softbody, "face_collision", text="Face")
class PHYSICS_PT_softbody_collision(PhysicButtonsPanel):
__label__ = "Soft Body Collision"
+ __default_closed__ = True
def poll(self, context):
return (context.soft_body)
def draw_header(self, context):
- layout = self.layout
-
softbody = context.soft_body.settings
- layout.itemR(softbody, "self_collision", text="")
+ self.layout.active = softbody_panel_enabled(context.soft_body)
+ self.layout.itemR(softbody, "self_collision", text="")
def draw(self, context):
layout = self.layout
md = context.soft_body
+ softbody = md.settings
ob = context.object
-
- if md:
- softbody = md.settings
- layout.active = softbody.self_collision
+ layout.active = softbody.self_collision and softbody_panel_enabled(md)
- layout.itemL(text="Collision Type:")
- layout.itemR(softbody, "collision_type", expand=True)
+ layout.itemL(text="Collision Type:")
+ layout.itemR(softbody, "collision_type", expand=True)
- col = layout.column(align=True)
- col.itemL(text="Ball:")
- col.itemR(softbody, "ball_size", text="Size")
- col.itemR(softbody, "ball_stiff", text="Stiffness")
- col.itemR(softbody, "ball_damp", text="Dampening")
+ col = layout.column(align=True)
+ col.itemL(text="Ball:")
+ col.itemR(softbody, "ball_size", text="Size")
+ col.itemR(softbody, "ball_stiff", text="Stiffness")
+ col.itemR(softbody, "ball_damp", text="Dampening")
class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
__label__ = "Soft Body Solver"
+ __default_closed__ = True
def poll(self, context):
return (context.soft_body)
@@ -241,28 +200,28 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel):
layout = self.layout
md = context.soft_body
+ softbody = md.settings
ob = context.object
-
- if md:
- softbody = md.settings
- # Solver
- split = layout.split()
+ layout.active = softbody_panel_enabled(md)
+
+ # Solver
+ split = layout.split()
- col = split.column(align=True)
- col.itemL(text="Step Size:")
- col.itemR(softbody, "minstep")
- col.itemR(softbody, "maxstep")
- col.itemR(softbody, "auto_step", text="Auto-Step")
+ col = split.column(align=True)
+ col.itemL(text="Step Size:")
+ col.itemR(softbody, "minstep")
+ col.itemR(softbody, "maxstep")
+ col.itemR(softbody, "auto_step", text="Auto-Step")
- col = split.column()
- col.itemR(softbody, "error_limit")
- col.itemL(text="Helpers:")
- col.itemR(softbody, "choke")
- col.itemR(softbody, "fuzzy")
+ col = split.column()
+ col.itemR(softbody, "error_limit")
+ col.itemL(text="Helpers:")
+ col.itemR(softbody, "choke")
+ col.itemR(softbody, "fuzzy")
- layout.itemL(text="Diagnostics:")
- layout.itemR(softbody, "diagnose")
+ layout.itemL(text="Diagnostics:")
+ layout.itemR(softbody, "diagnose")
bpy.types.register(PHYSICS_PT_softbody)
bpy.types.register(PHYSICS_PT_softbody_cache)