Fix (unreported) wrong behavior of constraints in liboverrides.
All constraints were 'made local', including the ones comming from the reference linked object.
This commit is contained in:
parent
de3fda29c7
commit
83e245023c
|
@ -123,6 +123,9 @@ enum {
|
|||
LIB_ID_COPY_CD_REFERENCE = 1 << 20,
|
||||
/** Do not copy id->override_library, used by ID datablock override routines. */
|
||||
LIB_ID_COPY_NO_LIB_OVERRIDE = 1 << 21,
|
||||
/** When copying local sub-data (like constraints or modifiers), do not set their "library
|
||||
* override local data" flag. */
|
||||
LIB_ID_COPY_NO_LIB_OVERRIDE_LOCAL_DATA_FLAG = 1 << 22,
|
||||
|
||||
/* *** XXX Hackish/not-so-nice specific behaviors needed for some corner cases. *** */
|
||||
/* *** Ideally we should not have those, but we need them for now... *** */
|
||||
|
|
|
@ -6022,7 +6022,6 @@ bConstraint *BKE_constraint_duplicate_ex(bConstraint *src, const int flag, const
|
|||
bConstraint *dst = MEM_dupallocN(src);
|
||||
constraint_copy_data_ex(dst, src, flag, do_extern);
|
||||
dst->next = dst->prev = NULL;
|
||||
dst->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
@ -6057,7 +6056,9 @@ void BKE_constraints_copy_ex(ListBase *dst, const ListBase *src, const int flag,
|
|||
for (con = dst->first, srccon = src->first; con && srccon;
|
||||
srccon = srccon->next, con = con->next) {
|
||||
constraint_copy_data_ex(con, srccon, flag, do_extern);
|
||||
con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
if ((flag & LIB_ID_COPY_NO_LIB_OVERRIDE_LOCAL_DATA_FLAG) == 0) {
|
||||
con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2874,7 +2874,10 @@ void BKE_lib_override_library_update(Main *bmain, ID *local)
|
|||
* Not impossible to do, but would rather see first if extra useless usual user handling
|
||||
* is actually a (performances) issue here. */
|
||||
|
||||
ID *tmp_id = BKE_id_copy(bmain, local->override_library->reference);
|
||||
ID *tmp_id = BKE_id_copy_ex(bmain,
|
||||
local->override_library->reference,
|
||||
NULL,
|
||||
LIB_ID_COPY_DEFAULT | LIB_ID_COPY_NO_LIB_OVERRIDE_LOCAL_DATA_FLAG);
|
||||
|
||||
if (tmp_id == NULL) {
|
||||
return;
|
||||
|
|
|
@ -1449,7 +1449,9 @@ void ED_object_constraint_link(Main *bmain, Object *ob_dst, ListBase *dst, ListB
|
|||
|
||||
void ED_object_constraint_copy_for_object(Main *bmain, Object *ob_dst, bConstraint *con)
|
||||
{
|
||||
BKE_constraint_copy_for_object(ob_dst, con);
|
||||
bConstraint *copy_con = BKE_constraint_copy_for_object(ob_dst, con);
|
||||
copy_con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
|
||||
ED_object_constraint_dependency_tag_update(bmain, ob_dst, con);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, ob_dst);
|
||||
}
|
||||
|
@ -1459,7 +1461,9 @@ void ED_object_constraint_copy_for_pose(Main *bmain,
|
|||
bPoseChannel *pchan,
|
||||
bConstraint *con)
|
||||
{
|
||||
BKE_constraint_copy_for_pose(ob_dst, pchan, con);
|
||||
bConstraint *copy_con = BKE_constraint_copy_for_pose(ob_dst, pchan, con);
|
||||
copy_con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
|
||||
ED_object_constraint_dependency_tag_update(bmain, ob_dst, con);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, ob_dst);
|
||||
}
|
||||
|
@ -1654,6 +1658,8 @@ static int constraint_copy_exec(bContext *C, wmOperator *op)
|
|||
/* Couldn't remove due to some invalid data. */
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
copy_con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
|
||||
/* Move constraint to correct position. */
|
||||
const int new_index = BLI_findindex(constraints, con) + 1;
|
||||
const int current_index = BLI_findindex(constraints, copy_con);
|
||||
|
@ -1731,7 +1737,9 @@ static int constraint_copy_to_selected_exec(bContext *C, wmOperator *op)
|
|||
continue;
|
||||
}
|
||||
|
||||
BKE_constraint_copy_for_pose(ob, chan, con);
|
||||
bConstraint *copy_con = BKE_constraint_copy_for_pose(ob, chan, con);
|
||||
copy_con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
|
||||
/* Update flags (need to add here, not just copy). */
|
||||
chan->constflag |= pchan->constflag;
|
||||
|
||||
|
@ -1753,7 +1761,9 @@ static int constraint_copy_to_selected_exec(bContext *C, wmOperator *op)
|
|||
continue;
|
||||
}
|
||||
|
||||
BKE_constraint_copy_for_object(ob, con);
|
||||
bConstraint *copy_con = BKE_constraint_copy_for_object(ob, con);
|
||||
copy_con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | ID_RECALC_TRANSFORM);
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
|
|
@ -1673,6 +1673,7 @@ static bConstraint *rna_Object_constraints_copy(Object *object, Main *bmain, Poi
|
|||
{
|
||||
bConstraint *con = con_ptr->data;
|
||||
bConstraint *new_con = BKE_constraint_copy_for_object(object, con);
|
||||
new_con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
|
||||
ED_object_constraint_tag_update(bmain, object, new_con);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object);
|
||||
|
|
|
@ -650,6 +650,7 @@ static bConstraint *rna_PoseChannel_constraints_copy(ID *id,
|
|||
Object *ob = (Object *)id;
|
||||
bConstraint *con = con_ptr->data;
|
||||
bConstraint *new_con = BKE_constraint_copy_for_pose(ob, pchan, con);
|
||||
new_con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
|
||||
ED_object_constraint_dependency_tag_update(bmain, ob, new_con);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, id);
|
||||
|
|
Loading…
Reference in New Issue