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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-06-24 15:57:52 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-06-24 19:46:36 +0300
commita5ff780065bf6768811bf459953a1a1eabe989c1 (patch)
tree484c17b31a114495164e2a2979b91c2a266b05fc /source/blender/blenkernel/intern/library.c
parent7d3a28d2d9a568f020ab57ca9504d3dccba18e5b (diff)
Fix T63828, T62005: copy/paste or append loses rigid body object
Previously settings were removed, now add to the rigid body world automatically even if it's a bit ill defined, since this is confusing for users. Fundamentally the concept of a rigid body world collection could be revised, and left only as an optional thing.
Diffstat (limited to 'source/blender/blenkernel/intern/library.c')
-rw-r--r--source/blender/blenkernel/intern/library.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 5e54344c80e..974c6d6e0a6 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -57,6 +57,7 @@
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_lightprobe_types.h"
+#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_speaker_types.h"
@@ -2038,6 +2039,10 @@ void BKE_library_make_local(Main *bmain,
id_clear_lib_data_ex(bmain, id, true);
BKE_id_expand_local(bmain, id);
id->tag &= ~LIB_TAG_DOIT;
+
+ if (GS(id->name) == ID_OB) {
+ BKE_rigidbody_ensure_local_object(bmain, (Object *)id);
+ }
}
else {
/* In this specific case, we do want to make ID local even if it has no local usage yet...
@@ -2053,6 +2058,10 @@ void BKE_library_make_local(Main *bmain,
}
if (id->newid) {
+ if (GS(id->newid->name) == ID_OB) {
+ BKE_rigidbody_ensure_local_object(bmain, (Object *)id->newid);
+ }
+
/* Reuse already allocated LinkNode (transferring it from todo_ids to copied_ids). */
BLI_linklist_prepend_nlink(&copied_ids, id, it);
}
@@ -2178,25 +2187,6 @@ void BKE_library_make_local(Main *bmain,
}
}
- /* Reset rigid body objects. */
- for (LinkNode *it = copied_ids; it; it = it->next) {
- ID *id = it->link;
- if (GS(id->name) == ID_OB) {
- Object *ob = (Object *)id;
-
- /* If there was ever any rigidbody settings in the object, we reset it. */
- if (ob->rigidbody_object) {
- for (Scene *scene_iter = bmain->scenes.first; scene_iter;
- scene_iter = scene_iter->id.next) {
- if (scene_iter->rigidbody_world) {
- BKE_rigidbody_remove_object(bmain, scene_iter, ob);
- }
- }
- BKE_rigidbody_free_object(ob, NULL);
- }
- }
- }
-
#ifdef DEBUG_TIME
printf("Hack: Forcefully rebuild armature object poses: Done.\n");
TIMEIT_VALUE_PRINT(make_local);