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:
authorBastien Montagne <bastien@blender.org>2021-10-05 11:45:28 +0300
committerBastien Montagne <bastien@blender.org>2021-10-05 11:48:10 +0300
commitb6ad0735a6b0a84aaee20d072bf218e262e8bb89 (patch)
treed949032b823faa025abc90468ef7cffe8a43dbb3 /source/blender/windowmanager/intern/wm_files_link.c
parent7df6f66ea202b93ae1abd9fe0b505bcd1b8511c2 (diff)
Fix T86379: When using "Append" not handling properly RigidBody constraints
This was simply never handled apparently. Also fixes a regression from recent append refactor that prevented RB objects to to properly handled too (since we instantiate loose objects in append step now, we need to handle RigidBody ones after that instantiation stage, otherwise nothing will happen since loose objects won't be in any scene).
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files_link.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index a73bea31669..cf3536213d2 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -579,6 +579,16 @@ static void wm_append_loose_data_instantiate(WMLinkAppendData *lapp_data,
id->tag &= ~LIB_TAG_DOIT;
}
+
+ /* Finally, add rigid body objects and constraints to current RB world(s). */
+ for (itemlink = lapp_data->items.list; itemlink; itemlink = itemlink->next) {
+ WMLinkAppendDataItem *item = itemlink->link;
+ ID *id = wm_append_loose_data_instantiate_process_check(item);
+ if (id == NULL || GS(id->name) != ID_OB) {
+ continue;
+ }
+ BKE_rigidbody_ensure_local_object(bmain, (Object *)id);
+ }
}
/** \} */
@@ -773,9 +783,6 @@ static void wm_append_do(WMLinkAppendData *lapp_data,
local_appended_new_id);
}
- if (GS(local_appended_new_id->name) == ID_OB) {
- BKE_rigidbody_ensure_local_object(bmain, (Object *)local_appended_new_id);
- }
if (set_fakeuser) {
if (!ELEM(GS(local_appended_new_id->name), ID_OB, ID_GR)) {
/* Do not set fake user on objects nor collections (instancing). */