diff options
author | Jacques Lucke <jacques@blender.org> | 2020-08-10 11:54:28 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-08-10 11:54:28 +0300 |
commit | 342a6b5f9339c31931f4d2c87d9f47b88307e8cc (patch) | |
tree | 7406159ce80c51f235a6f0430e25d2ed89544bd8 /source/blender/makesrna | |
parent | f15d33d585d0c98f29aff3dee1e77c79e84c24c0 (diff) |
Fix T77685: object transforms from rigid body simulation are ignored by modifiers
This does not fix all the cases in the bug report, because there are multiple
different issues. Only the first two are fixed. The third is probably a known
issue for now.
Before this patch, the rigid body simulation was always done after modifiers
are evaluated, because to perform the simulation, the final geometry of the
object was required. However, the geometry is not required in all cases,
depending on the selected collisions shape.
This patch changes it so that when the simulation does not need the
evaluated geometry, the simulation will be done before the modifiers
are evaluated. This gives the modifiers access to the simulated positions.
When the rigid body simulation does depend on the evaluated geometry,
it will still be performed after modifiers are evaluated.
The simulation will be performed after modifiers are evaluated, iff
the collision shape is "Convex Hull" or "Mesh" and the source is set
to "Deform" or "Final".
Reviewers: sergey
Differential Revision: https://developer.blender.org/D8487
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_rigidbody.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 325c4e3caa9..264b0da8e0a 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -35,6 +35,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "DEG_depsgraph_build.h" + #include "WM_types.h" /* roles of objects in RigidBody Sims */ @@ -218,6 +220,7 @@ static void rna_RigidBodyOb_shape_update(Main *bmain, Scene *scene, PointerRNA * Object *ob = (Object *)ptr->owner_id; rna_RigidBodyOb_reset(bmain, scene, ptr); + DEG_relations_tag_update(bmain); WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); } @@ -233,6 +236,16 @@ static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *scene, Point } } +static void rna_RigidBodyOb_mesh_source_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Object *ob = (Object *)ptr->owner_id; + + rna_RigidBodyOb_reset(bmain, scene, ptr); + DEG_relations_tag_update(bmain); + + WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob); +} + static char *rna_RigidBodyOb_path(PointerRNA *UNUSED(ptr)) { /* NOTE: this hardcoded path should work as long as only Objects have this */ @@ -1026,7 +1039,7 @@ static void rna_def_rigidbody_object(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Mesh Source", "Source of the mesh used to create collision shape"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset"); + RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_mesh_source_update"); /* booleans */ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); |