Fix T65134: Duplicated proxies in several scenes don't work

This is something which worked in Blender 2.79.
Need to do special trickery to ensure peoxy_from points to a
proper object.

Differential Revision: https://developer.blender.org/D6040
This commit is contained in:
Sergey Sharybin 2019-10-10 15:40:25 +02:00
parent 1857aa32bd
commit eac0f35845
Notes: blender-bot 2023-02-14 05:52:32 +01:00
Referenced by issue #65134, Duplicates of linked groups/collections with proxy armatures no longer function independantly in separate scenes
3 changed files with 15 additions and 1 deletions

View File

@ -643,6 +643,10 @@ void BKE_pose_eval_init(struct Depsgraph *depsgraph, Scene *UNUSED(scene), Objec
}
BLI_assert(pose->chan_array != NULL || BLI_listbase_is_empty(&pose->chanbase));
if (object->proxy != NULL) {
object->proxy->proxy_from = object;
}
}
void BKE_pose_eval_init_ik(struct Depsgraph *depsgraph, Scene *scene, Object *object)

View File

@ -527,6 +527,9 @@ void DepsgraphNodeBuilder::build_object(int base_index,
eDepsNode_LinkedState_Type linked_state,
bool is_visible)
{
if (object->proxy != NULL) {
object->proxy->proxy_from = object;
}
const bool has_object = built_map_.checkIsBuiltAndTag(object);
/* Skip rest of components if the ID node was already there. */
if (has_object) {

View File

@ -511,6 +511,14 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph, const bool do_ti
* to evaluation though) with `do_time=true`. This means early output checks should be aware of
* this. */
for (DEG::IDNode *id_node : graph->id_nodes) {
const ID_Type id_type = GS(id_node->id_orig->name);
if (id_type == ID_OB) {
Object *object_orig = reinterpret_cast<Object *>(id_node->id_orig);
if (object_orig->proxy != NULL) {
object_orig->proxy->proxy_from = object_orig;
}
}
if (!id_node->visible_components_mask) {
/* ID has no components which affects anything visible.
* No need bother with it to tag or anything. */
@ -537,7 +545,6 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph, const bool do_ti
* other type of cache).
*
* TODO(sergey): Need to generalize this somehow. */
const ID_Type id_type = GS(id_node->id_orig->name);
if (id_type == ID_OB) {
flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
}