Merge branch 'blender-v3.0-release'

This commit is contained in:
Omar Emara 2021-11-19 15:58:37 +02:00
commit 0852805ed7
11 changed files with 64 additions and 10 deletions

View File

@ -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... *** */

View File

@ -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;
}
}
}

View File

@ -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;

View File

@ -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;

View File

@ -4313,9 +4313,7 @@ void node_draw_link_bezier(const bContext *C,
}
if (snode->overlay.flag & SN_OVERLAY_SHOW_OVERLAYS &&
snode->overlay.flag & SN_OVERLAY_SHOW_WIRE_COLORS &&
((link->fromsock == nullptr || link->fromsock->typeinfo->type >= 0) &&
(link->tosock == nullptr || link->tosock->typeinfo->type >= 0))) {
snode->overlay.flag & SN_OVERLAY_SHOW_WIRE_COLORS) {
PointerRNA from_node_ptr, to_node_ptr;
RNA_pointer_create((ID *)snode->edittree, &RNA_Node, link->fromnode, &from_node_ptr);
RNA_pointer_create((ID *)snode->edittree, &RNA_Node, link->tonode, &to_node_ptr);

View File

@ -3474,6 +3474,15 @@ void RNA_def_constraint(BlenderRNA *brna)
RNA_def_property_enum_items(prop, rna_enum_constraint_type_items);
RNA_def_property_ui_text(prop, "Type", "");
prop = RNA_def_boolean(srna,
"is_override_data",
false,
"Override Constraint",
"In a local override object, whether this constraint comes from the "
"linked reference object, or is local to the override");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_OVERRIDE_LIBRARY_LOCAL);
RNA_define_lib_overridable(true);
prop = RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);

View File

@ -3738,6 +3738,16 @@ void RNA_def_greasepencil_modifier(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface");
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
prop = RNA_def_boolean(srna,
"is_override_data",
false,
"Override Modifier",
"In a local override object, whether this modifier comes from the linked "
"reference object, or is local to the override");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_negative_sdna(
prop, NULL, "flag", eGpencilModifierFlag_OverrideLibrary_Local);
/* types */
rna_def_modifier_gpencilnoise(brna);
rna_def_modifier_gpencilsmooth(brna);

View File

@ -7245,6 +7245,15 @@ void RNA_def_modifier(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Active", "The active modifier in the list");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
prop = RNA_def_boolean(srna,
"is_override_data",
false,
"Override Modifier",
"In a local override object, whether this modifier comes from the linked "
"reference object, or is local to the override");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", eModifierFlag_OverrideLibrary_Local);
prop = RNA_def_property(srna, "use_apply_on_spline", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_ApplyOnSpline);
RNA_def_property_ui_text(

View File

@ -885,6 +885,15 @@ static void rna_def_nlatrack(BlenderRNA *brna)
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(prop, "NLA Strips", "NLA Strips on this NLA-track");
prop = RNA_def_boolean(srna,
"is_override_data",
false,
"Override Track",
"In a local override data, whether this NLA track comes from the linked "
"reference data, or is local to the override");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", NLATRACK_OVERRIDELIBRARY_LOCAL);
rna_api_nlatrack_strips(brna, prop);
RNA_define_lib_overridable(true);

View File

@ -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);

View File

@ -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);