diff options
author | Julian Eisel <julian@blender.org> | 2020-08-10 14:52:39 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-08-10 14:52:39 +0300 |
commit | 659f7f1981bb4f943329a895723e41f47dbb2385 (patch) | |
tree | 1f751d68715c23bffff2214e738a4b14a25438f9 | |
parent | 9c1f140a4735712de47a8b207fd8b3f007a0464a (diff) | |
parent | 2e5c877056926a1f3713d90f5a8920d1b121d823 (diff) |
Merge branch 'blender-v2.90-release'
4 files changed, 34 insertions, 5 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 6d76829fa1d..37b23833e00 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1012,6 +1012,9 @@ void DepsgraphRelationBuilder::build_object_pointcache(Object *object) /* Check which components needs the point cache. */ int flag = -1; if (ptcache_id->type == PTCACHE_TYPE_RIGIDBODY) { + if (object->rigidbody_object->type == RBO_TYPE_PASSIVE) { + continue; + } flag = FLAG_TRANSFORM; OperationKey transform_key( &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_SIMULATION_INIT); @@ -1728,8 +1731,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) /* Geometry must be known to create the rigid body. RBO_MESH_BASE * uses the non-evaluated mesh, so then the evaluation is * unnecessary. */ - if (object->rigidbody_object != nullptr && - object->rigidbody_object->mesh_source != RBO_MESH_BASE) { + if (rigidbody_object_depends_on_evaluated_geometry(object->rigidbody_object)) { /* NOTE: We prefer this relation to be never killed, to avoid * access partially evaluated mesh from solver. */ ComponentKey object_geometry_key(&object->id, NodeType::GEOMETRY); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h index d4c28060878..b853ecd8e56 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h @@ -27,6 +27,7 @@ #include "DNA_ID.h" #include "DNA_object_types.h" +#include "DNA_rigidbody_types.h" namespace blender { namespace deg { @@ -126,6 +127,19 @@ Relation *DepsgraphRelationBuilder::add_node_handle_relation(const KeyType &key_ return nullptr; } +static bool rigidbody_object_depends_on_evaluated_geometry(const RigidBodyOb *rbo) +{ + if (rbo == nullptr) { + return false; + } + if (ELEM(rbo->shape, RB_SHAPE_CONVEXH, RB_SHAPE_TRIMESH)) { + if (rbo->mesh_source != RBO_MESH_BASE) { + return true; + } + } + return false; +} + template<typename KeyTo> Relation *DepsgraphRelationBuilder::add_depends_on_transform_relation(ID *id, const KeyTo &key_to, @@ -134,7 +148,7 @@ Relation *DepsgraphRelationBuilder::add_depends_on_transform_relation(ID *id, { if (GS(id->name) == ID_OB) { Object *object = reinterpret_cast<Object *>(id); - if (object->rigidbody_object != nullptr) { + if (rigidbody_object_depends_on_evaluated_geometry(object->rigidbody_object)) { OperationKey transform_key(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); return add_relation(transform_key, key_to, description, flags); } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f4d36a15d30..b002b23a7f3 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4414,7 +4414,7 @@ static void screen_animation_region_tag_redraw(ScrArea *area, * We do need to redraw when this area is in full screen as no other areas * will be tagged for redrawing. */ if ((region->regiontype == RGN_TYPE_WINDOW) && - (ELEM(area->spacetype, SPACE_GRAPH, SPACE_NLA, SPACE_ACTION, SPACE_SEQ)) && !area->full) { + (ELEM(area->spacetype, SPACE_GRAPH, SPACE_NLA, SPACE_ACTION)) && !area->full) { return; } ED_region_tag_redraw(region); diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 450d148d8a3..fb550b38b31 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 */ @@ -223,6 +225,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); } @@ -238,6 +241,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 */ @@ -1031,7 +1044,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); |