diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-01-23 09:56:44 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-01-23 09:56:44 +0400 |
commit | 2d8637946b047a8a9cc3fb6fe6d146b9961f92a6 (patch) | |
tree | ff566a91ca6c45d67b310fec8c990b801a7f0ba2 /release/scripts/startup/bl_ui/properties_scene.py | |
parent | 089cf12435dfbc4b934a73b73ecd617b27ac678d (diff) |
rigidbody: Add rigid body simulation
Add operators to add/remove rigid body world and objects.
Add UI scripts.
The rigid body simulation works on scene level and overrides the
position/orientation of rigid bodies when active.
It does not deform meshes or generate data so there is no modifier.
Usage:
* Add rigid body world in the scene tab
* Create a group
* Add objects to the group
* Assign group to the rigid body world
* Play animation
For convenience the rigid body tools operators in the tools panel of the 3d view
will add a world, group and add objects to the group automatically so you only have
to press one button to add/remove rigid bodies to the simulation.
Part of GSoC 2010 and 2012.
Authors: Joshua Leung (aligorith), Sergej Reich (sergof)
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_scene.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_scene.py | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 5fe3923f0e9..73de00fdd40 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -21,6 +21,10 @@ import bpy from bpy.types import Panel, UIList from rna_prop_ui import PropertyPanel +from bl_ui.properties_physics_common import ( + point_cache_ui, + effector_weights_ui, + ) class SCENE_UL_keying_set_paths(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): @@ -242,6 +246,83 @@ class SCENE_PT_physics(SceneButtonsPanel, Panel): layout.prop(scene, "gravity", text="") +class SCENE_PT_rigid_body_world(SceneButtonsPanel, Panel): + bl_label = "Rigid Body World" + COMPAT_ENGINES = {'BLENDER_RENDER'} + + @classmethod + def poll(cls, context): + rd = context.scene.render + scene = context.scene + return scene and (rd.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + scene = context.scene + + rbw = scene.rigidbody_world + + if not rbw: + layout.operator("rigidbody.world_add") + else: + split = layout.split() + split.operator("rigidbody.world_remove") + layout.separator() + layout.prop(context.scene.rigidbody_world, "enabled") + layout.active = rbw.enabled + + col = layout.column() + col.prop(rbw, "group") + col.prop(rbw, "constraints") + + split = layout.split() + + col = split.column() + col.prop(rbw, "time_scale", text="Speed") + col.prop(rbw, "use_split_impulse") + + col = split.column() + col.prop(rbw, "steps_per_second", text="Steps Per Second") + col.prop(rbw, "num_solver_iterations", text="Solver Iterations") + + +class SCENE_PT_rigid_body_cache(SceneButtonsPanel, Panel): + bl_label = "Rigid Body Cache" + bl_options = {'DEFAULT_CLOSED'} + COMPAT_ENGINES = {'BLENDER_RENDER'} + + @classmethod + def poll(cls, context): + rd = context.scene.render + scene = context.scene + return scene and scene.rigidbody_world and (rd.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + scene = context.scene + rbw = scene.rigidbody_world + + point_cache_ui(self, context, rbw.point_cache, rbw.point_cache.is_baked is False and rbw.enabled, 'RIGID_BODY') + + +class SCENE_PT_rigid_body_field_weights(SceneButtonsPanel, Panel): + bl_label = "Rigid Body Field Weights" + bl_options = {'DEFAULT_CLOSED'} + COMPAT_ENGINES = {'BLENDER_RENDER'} + + @classmethod + def poll(cls, context): + rd = context.scene.render + scene = context.scene + return scene and scene.rigidbody_world and (rd.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + scene = context.scene + rbw = scene.rigidbody_world + + effector_weights_ui(self, context, rbw.effector_weights, 'RIGID_BODY') + + class SCENE_PT_simplify(SceneButtonsPanel, Panel): bl_label = "Simplify" COMPAT_ENGINES = {'BLENDER_RENDER'} |