Depsgraph: Fix missing relation from proxy_form's ID properties

Hopefully this will fix issue with camera rig where camera properties
(like, near/far clip) are driven by custom properties from bones, and
those bones are actually belong to proxied armature.
This commit is contained in:
Sergey Sharybin 2018-07-20 15:13:48 +02:00
parent 4a79b46b9c
commit 72cbf966fb
Notes: blender-bot 2023-02-14 08:08:54 +01:00
Referenced by commit 788bbac5bd, Depsgraph: fix handling of driver variable dependencies with proxies.
2 changed files with 26 additions and 0 deletions

View File

@ -829,8 +829,19 @@ void DepsgraphNodeBuilder::build_driver_variables(ID * id, FCurve *fcurve)
LISTBASE_FOREACH (DriverVar *, dvar, &fcurve->driver->variables) {
DRIVER_TARGETS_USED_LOOPER(dvar)
{
if (dtar->id == NULL) {
continue;
}
build_id(dtar->id);
build_driver_id_property(dtar->id, dtar->rna_path);
/* Corresponds to dtar_id_ensure_proxy_from(). */
if ((GS(dtar->id->name) == ID_OB) &&
(((Object *)dtar->id)->proxy_from != NULL))
{
Object *proxy_from = ((Object *)dtar->id)->proxy_from;
build_id(&proxy_from->id);
build_driver_id_property(&proxy_from->id, dtar->rna_path);
}
}
DRIVER_TARGETS_LOOPER_END
}

View File

@ -1351,6 +1351,14 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
continue;
}
build_id(dtar->id);
/* Initialize relations coming to proxy_from. */
Object *proxy_from = NULL;
if ((GS(dtar->id->name) == ID_OB) &&
(((Object *)dtar->id)->proxy_from != NULL))
{
proxy_from = ((Object *)dtar->id)->proxy_from;
build_id(&proxy_from->id);
}
/* Special handling for directly-named bones. */
if ((dtar->flag & DTAR_FLAG_STRUCT_REF) &&
(((Object *)dtar->id)->type == OB_ARMATURE) &&
@ -1398,6 +1406,13 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
continue;
}
add_relation(variable_key, driver_key, "RNA Target -> Driver");
if (proxy_from != NULL) {
RNAPathKey proxy_from_variable_key(&proxy_from->id,
dtar->rna_path);
add_relation(proxy_from_variable_key,
variable_key,
"Proxy From -> Variable");
}
}
else {
if (dtar->id == id) {