diff options
author | Bastien Montagne <bastien@blender.org> | 2022-08-02 13:55:29 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-08-02 13:55:29 +0300 |
commit | 33e4ecc7509ced4b9499c4005114ca5865717b7b (patch) | |
tree | 6235cd1aaf4da8b31b1b968f0c235887056d74db | |
parent | bb7747e7caee59a8c98cd7d9abc9cd1e9b0e0762 (diff) | |
parent | 33d0b7c5bdd8bdbde0a3fd6e7982440c151e321b (diff) |
Merge branch 'blender-v3.3-release'
6 files changed, 83 insertions, 17 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index f371591c3a8..1c7b3496723 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1640,7 +1640,8 @@ static void animchannels_group_channels(bAnimContext *ac, int filter; /* find selected F-Curves to re-group */ - filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | + ANIMFILTER_FCURVESONLY); ANIM_animdata_filter(ac, &anim_data, filter, adt_ref, ANIMCONT_CHANNEL); if (anim_data.first) { @@ -1754,7 +1755,7 @@ static int animchannels_ungroup_exec(bContext *C, wmOperator *UNUSED(op)) /* just selected F-Curves... */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | - ANIMFILTER_NODUPLIS); + ANIMFILTER_NODUPLIS | ANIMFILTER_FCURVESONLY); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale = anim_data.first; ale; ale = ale->next) { @@ -2454,7 +2455,7 @@ static int animchannels_enable_exec(bContext *C, wmOperator *UNUSED(op)) } /* filter data */ - filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS | ANIMFILTER_FCURVESONLY); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* loop through filtered data and clean curves */ @@ -3454,7 +3455,8 @@ static bool select_anim_channel_keys(bAnimContext *ac, int channel_index, bool e /* get the channel that was clicked on */ /* filter channels */ - filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | + ANIMFILTER_FCURVESONLY); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* get channel from index */ diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 706db498a82..63bd5665459 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -218,7 +218,7 @@ static short ob_keyframes_loop(KeyframeEditData *ked, ac.datatype = ANIMCONT_CHANNEL; /* get F-Curves to take keyframes from */ - filter = ANIMFILTER_DATA_VISIBLE; /* curves only */ + filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FCURVESONLY; ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* Loop through each F-Curve, applying the operation as required, @@ -267,7 +267,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, ac.datatype = ANIMCONT_CHANNEL; /* get F-Curves to take keyframes from */ - filter = ANIMFILTER_DATA_VISIBLE; /* curves only */ + filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FCURVESONLY; ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* Loop through each F-Curve, applying the operation as required, diff --git a/source/blender/editors/animation/keyframes_keylist.cc b/source/blender/editors/animation/keyframes_keylist.cc index 8dc598e6e2d..da266dd4253 100644 --- a/source/blender/editors/animation/keyframes_keylist.cc +++ b/source/blender/editors/animation/keyframes_keylist.cc @@ -943,7 +943,8 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, AnimKeylist *keylist, const i ac.datatype = ANIMCONT_CHANNEL; /* get F-Curves to take keyframes from */ - const eAnimFilter_Flags filter = ANIMFILTER_DATA_VISIBLE; /* curves only */ + const eAnimFilter_Flags filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FCURVESONLY; + ANIM_animdata_filter( &ac, &anim_data, filter, ac.data, static_cast<eAnimCont_Types>(ac.datatype)); @@ -980,7 +981,7 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, AnimKeylist *keylist, const int ac.datatype = ANIMCONT_CHANNEL; /* get F-Curves to take keyframes from */ - const eAnimFilter_Flags filter = ANIMFILTER_DATA_VISIBLE; /* curves only */ + const eAnimFilter_Flags filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FCURVESONLY; ANIM_animdata_filter( &ac, &anim_data, filter, ac.data, static_cast<eAnimCont_Types>(ac.datatype)); @@ -1015,7 +1016,7 @@ void cachefile_to_keylist(bDopeSheet *ads, /* get F-Curves to take keyframes from */ ListBase anim_data = {nullptr, nullptr}; - const eAnimFilter_Flags filter = ANIMFILTER_DATA_VISIBLE; /* curves only */ + const eAnimFilter_Flags filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FCURVESONLY; ANIM_animdata_filter( &ac, &anim_data, filter, ac.data, static_cast<eAnimCont_Types>(ac.datatype)); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index cc3c68abc55..ee87de5774a 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -334,6 +334,7 @@ typedef enum eAnimFilter_Flags { ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31), } eAnimFilter_Flags; +ENUM_OPERATORS(eAnimFilter_Flags, ANIMFILTER_TMP_IGNORE_ONLYSEL); /** \} */ diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 3dd21fd22c6..ea2e2e44b90 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -625,7 +625,7 @@ static void graph_refresh_fcurve_colors(const bContext *C) * - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a * mismatch between channel-colors and the drawn curves */ - filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS | ANIMFILTER_FCURVESONLY); items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* loop over F-Curves, assigning colors */ diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c index 4657f7e9a9f..84ddea368e7 100644 --- a/source/blender/makesrna/intern/rna_collection.c +++ b/source/blender/makesrna/intern/rna_collection.c @@ -39,6 +39,7 @@ const EnumPropertyItem rna_enum_collection_color_items[] = { # include "DEG_depsgraph.h" # include "DEG_depsgraph_build.h" +# include "DEG_depsgraph_query.h" # include "BKE_collection.h" # include "BKE_global.h" @@ -79,26 +80,45 @@ static PointerRNA rna_Collection_objects_get(CollectionPropertyIterator *iter) return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, cob->ob); } -static void rna_Collection_objects_link(Collection *collection, - Main *bmain, - ReportList *reports, - Object *object) +static bool rna_collection_objects_edit_check(Collection *collection, + ReportList *reports, + Object *object) { + if (!DEG_is_original_id(&collection->id)) { + BKE_reportf( + reports, RPT_ERROR, "Collection '%s' is not an original ID", collection->id.name + 2); + return false; + } + if (!DEG_is_original_id(&object->id)) { + BKE_reportf(reports, RPT_ERROR, "Collection '%s' is not an original ID", object->id.name + 2); + return false; + } /* Currently this should not be allowed (might be supported in the future though...). */ if (ID_IS_OVERRIDE_LIBRARY(&collection->id)) { BKE_reportf(reports, RPT_ERROR, - "Could not link the object '%s' because the collection '%s' is overridden", + "Could not (un)link the object '%s' because the collection '%s' is overridden", object->id.name + 2, collection->id.name + 2); - return; + return false; } if (ID_IS_LINKED(&collection->id)) { BKE_reportf(reports, RPT_ERROR, - "Could not link the object '%s' because the collection '%s' is linked", + "Could not (un)link the object '%s' because the collection '%s' is linked", object->id.name + 2, collection->id.name + 2); + return false; + } + return true; +} + +static void rna_Collection_objects_link(Collection *collection, + Main *bmain, + ReportList *reports, + Object *object) +{ + if (!rna_collection_objects_edit_check(collection, reports, object)) { return; } if (!BKE_collection_object_add(bmain, collection, object)) { @@ -120,6 +140,9 @@ static void rna_Collection_objects_unlink(Collection *collection, ReportList *reports, Object *object) { + if (!rna_collection_objects_edit_check(collection, reports, object)) { + return; + } if (!BKE_collection_object_remove(bmain, collection, object, false)) { BKE_reportf(reports, RPT_ERROR, @@ -204,11 +227,47 @@ static PointerRNA rna_Collection_children_get(CollectionPropertyIterator *iter) return rna_pointer_inherit_refine(&iter->parent, &RNA_Collection, child->collection); } +static bool rna_collection_children_edit_check(Collection *collection, + ReportList *reports, + Collection *child) +{ + if (!DEG_is_original_id(&collection->id)) { + BKE_reportf( + reports, RPT_ERROR, "Collection '%s' is not an original ID", collection->id.name + 2); + return false; + } + if (!DEG_is_original_id(&child->id)) { + BKE_reportf(reports, RPT_ERROR, "Collection '%s' is not an original ID", child->id.name + 2); + return false; + } + /* Currently this should not be allowed (might be supported in the future though...). */ + if (ID_IS_OVERRIDE_LIBRARY(&collection->id)) { + BKE_reportf(reports, + RPT_ERROR, + "Could not (un)link the collection '%s' because the collection '%s' is overridden", + child->id.name + 2, + collection->id.name + 2); + return false; + } + if (ID_IS_LINKED(&collection->id)) { + BKE_reportf(reports, + RPT_ERROR, + "Could not (un)link the collection '%s' because the collection '%s' is linked", + child->id.name + 2, + collection->id.name + 2); + return false; + } + return true; +} + static void rna_Collection_children_link(Collection *collection, Main *bmain, ReportList *reports, Collection *child) { + if (!rna_collection_children_edit_check(collection, reports, child)) { + return; + } if (!BKE_collection_child_add(bmain, collection, child)) { BKE_reportf(reports, RPT_ERROR, @@ -228,6 +287,9 @@ static void rna_Collection_children_unlink(Collection *collection, ReportList *reports, Collection *child) { + if (!rna_collection_children_edit_check(collection, reports, child)) { + return; + } if (!BKE_collection_child_remove(bmain, collection, child)) { BKE_reportf(reports, RPT_ERROR, |