Fix T72820: Linked objects jumping around during render

Was caused by 6183688c35 (thanks ronsn for nailing it down!).

The issue is that order of copy-on-write operations is not defined, so
can not use flags set by that operation to make decision.
This commit is contained in:
Sergey Sharybin 2020-01-02 16:45:18 +01:00
parent 461261c18d
commit 2e06a6bec3
Notes: blender-bot 2023-02-14 02:27:56 +01:00
Referenced by issue #72820, Linked objects jumping around during render
3 changed files with 12 additions and 4 deletions

View File

@ -55,6 +55,12 @@ extern "C" {
namespace DEG {
bool deg_check_id_in_depsgraph(const Depsgraph *graph, ID *id_orig)
{
IDNode *id_node = graph->find_id_node(id_orig);
return id_node != NULL;
}
bool deg_check_base_in_depsgraph(const Depsgraph *graph, Base *base)
{
Object *object_orig = base->base_orig->object;

View File

@ -24,6 +24,7 @@
#pragma once
struct Base;
struct ID;
struct Main;
struct Object;
struct bPoseChannel;
@ -53,6 +54,7 @@ class DepsgraphBuilder {
DepsgraphBuilderCache *cache_;
};
bool deg_check_id_in_depsgraph(const Depsgraph *graph, ID *id_orig);
bool deg_check_base_in_depsgraph(const Depsgraph *graph, Base *base);
void deg_graph_build_finalize(Main *bmain, Depsgraph *graph);

View File

@ -759,17 +759,17 @@ void update_animation_data_after_copy(const ID *id_orig, ID *id_cow)
/* Some builders (like motion path one) will ignore proxies from being built. This code makes it so
* proxy and proxy_group pointers never point to an original objects, preventing evaluation code
* from assign evaluated pointer to an original proxy->proxy_from. */
void update_proxy_pointers_after_copy(const Depsgraph * /*depsgraph*/,
const Object * /*object_orig*/,
void update_proxy_pointers_after_copy(const Depsgraph *depsgraph,
const Object *object_orig,
Object *object_cow)
{
if (object_cow->proxy != NULL) {
if ((object_cow->proxy->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0) {
if (!deg_check_id_in_depsgraph(depsgraph, &object_orig->proxy->id)) {
object_cow->proxy = NULL;
}
}
if (object_cow->proxy_group != NULL) {
if ((object_cow->proxy_group->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0) {
if (!deg_check_id_in_depsgraph(depsgraph, &object_orig->proxy_group->id)) {
object_cow->proxy_group = NULL;
}
}