diff options
Diffstat (limited to 'source/blender/editors/space_outliner')
12 files changed, 58 insertions, 57 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index d54e35f659c..062d2e2b5d1 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -49,8 +49,6 @@ #include "RNA_define.h" #include "RNA_enum_types.h" -#include "UI_resources.h" - #include "outliner_intern.h" /* own include */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index 01fb0fc6f78..b3b36811411 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -26,28 +26,21 @@ #include "MEM_guardedalloc.h" #include "DNA_collection_types.h" -#include "DNA_constraint_types.h" #include "DNA_material_types.h" -#include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_space_types.h" #include "BLI_listbase.h" -#include "BLI_string.h" #include "BLT_translation.h" #include "BKE_collection.h" -#include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_layer.h" -#include "BKE_lib_id.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_object.h" #include "BKE_report.h" -#include "BKE_scene.h" -#include "BKE_shader_fx.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" @@ -57,12 +50,9 @@ #include "ED_screen.h" #include "UI_interface.h" -#include "UI_resources.h" #include "UI_view2d.h" #include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_enum_types.h" #include "WM_api.h" #include "WM_types.h" @@ -647,7 +637,7 @@ static int material_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve BKE_object_material_assign(bmain, ob, ma, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF); WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob); - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 690adb09570..5b4a45f6115 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -21,7 +21,6 @@ * \ingroup spoutliner */ -#include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_collection_types.h" #include "DNA_constraint_types.h" @@ -45,7 +44,6 @@ #include "BKE_armature.h" #include "BKE_context.h" #include "BKE_deform.h" -#include "BKE_fcurve.h" #include "BKE_gpencil.h" #include "BKE_idtype.h" #include "BKE_layer.h" @@ -56,14 +54,11 @@ #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_report.h" -#include "BKE_scene.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" #include "ED_armature.h" -#include "ED_keyframing.h" -#include "ED_object.h" #include "ED_outliner.h" #include "ED_screen.h" diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 18abe17d515..5501e52d69b 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -28,7 +28,6 @@ #include "DNA_ID.h" #include "DNA_anim_types.h" #include "DNA_collection_types.h" -#include "DNA_material_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -43,27 +42,19 @@ #include "BKE_appdir.h" #include "BKE_armature.h" #include "BKE_blender_copybuffer.h" -#include "BKE_collection.h" #include "BKE_context.h" #include "BKE_idtype.h" -#include "BKE_layer.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_lib_remap.h" #include "BKE_main.h" -#include "BKE_material.h" -#include "BKE_outliner_treehash.h" #include "BKE_report.h" -#include "BKE_scene.h" #include "BKE_workspace.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" -#include "../blenloader/BLO_readfile.h" - #include "ED_keyframing.h" -#include "ED_object.h" #include "ED_outliner.h" #include "ED_screen.h" #include "ED_select_utils.h" @@ -72,7 +63,6 @@ #include "WM_types.h" #include "UI_interface.h" -#include "UI_resources.h" #include "UI_view2d.h" #include "RNA_access.h" diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index d53a37fa60e..50f089f894a 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -27,17 +27,13 @@ #include "DNA_armature_types.h" #include "DNA_collection_types.h" -#include "DNA_constraint_types.h" #include "DNA_gpencil_modifier_types.h" #include "DNA_gpencil_types.h" -#include "DNA_light_types.h" -#include "DNA_material_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" #include "DNA_shader_fx_types.h" -#include "DNA_world_types.h" #include "BLI_listbase.h" #include "BLI_utildefines.h" @@ -52,19 +48,15 @@ #include "BKE_main.h" #include "BKE_modifier.h" #include "BKE_object.h" -#include "BKE_paint.h" #include "BKE_particle.h" #include "BKE_report.h" -#include "BKE_scene.h" #include "BKE_shader_fx.h" -#include "BKE_workspace.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" #include "ED_armature.h" #include "ED_buttons.h" -#include "ED_gpencil.h" #include "ED_object.h" #include "ED_outliner.h" #include "ED_screen.h" @@ -76,7 +68,6 @@ #include "SEQ_sequencer.h" #include "WM_api.h" -#include "WM_toolsystem.h" #include "WM_types.h" #include "UI_interface.h" diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 9af2ba6a82b..d9641930134 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -776,6 +776,11 @@ static void object_proxy_to_override_convert_fn(bContext *C, typedef struct OutlinerLibOverrideData { bool do_hierarchy; + /** + * For resync operation, force keeping newly created override IDs (or original linked IDs) + * instead of re-applying relevant existing ID pointer property override operations. Helps + * solving broken overrides while not losing *all* of your overrides. */ + bool do_resync_hierarchy_enforce; } OutlinerLibOverrideData; static void id_override_library_create_fn(bContext *C, @@ -872,10 +877,12 @@ static void id_override_library_resync_fn(bContext *C, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, - void *UNUSED(user_data)) + void *user_data) { BLI_assert(TSE_IS_REAL_ID(tselem)); ID *id_root = tselem->id; + OutlinerLibOverrideData *data = user_data; + const bool do_hierarchy_enforce = data->do_resync_hierarchy_enforce; if (ID_IS_OVERRIDE_LIBRARY_REAL(id_root)) { Main *bmain = CTX_data_main(C); @@ -893,7 +900,8 @@ static void id_override_library_resync_fn(bContext *C, te->store_elem->id->tag |= LIB_TAG_DOIT; } - BKE_lib_override_library_resync(bmain, scene, CTX_data_view_layer(C), id_root); + BKE_lib_override_library_resync( + bmain, scene, CTX_data_view_layer(C), id_root, do_hierarchy_enforce); WM_event_add_notifier(C, NC_WINDOW, NULL); } @@ -1710,6 +1718,7 @@ typedef enum eOutlinerIdOpTypes { OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET, OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET_HIERARCHY, OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY, + OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE, OUTLINER_IDOP_OVERRIDE_LIBRARY_DELETE_HIERARCHY, OUTLINER_IDOP_SINGLE, OUTLINER_IDOP_DELETE, @@ -1770,6 +1779,13 @@ static const EnumPropertyItem prop_id_op_types[] = { "Resync Library Override Hierarchy", "Rebuild this local override from its linked reference, as well as its hierarchy of " "dependencies"}, + {OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE, + "OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE", + 0, + "Resync Library Override Hierarchy Enforce", + "Rebuild this local override from its linked reference, as well as its hierarchy of " + "dependencies, enforcing that hierarchy to match the linked data (i.e. ignoring exiting " + "overrides on data-blocks pointer properties)"}, {OUTLINER_IDOP_OVERRIDE_LIBRARY_DELETE_HIERARCHY, "OVERRIDE_LIBRARY_DELETE_HIERARCHY", 0, @@ -1831,6 +1847,7 @@ static bool outliner_id_operation_item_poll(bContext *C, case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET: case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET_HIERARCHY: case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY: + case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE: case OUTLINER_IDOP_OVERRIDE_LIBRARY_DELETE_HIERARCHY: if (ID_IS_OVERRIDE_LIBRARY_REAL(tselem->id)) { return true; @@ -2041,6 +2058,18 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) ED_undo_push(C, "Resync Overridden Data Hierarchy"); break; } + case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE: { + outliner_do_libdata_operation( + C, + op->reports, + scene, + space_outliner, + &space_outliner->tree, + id_override_library_resync_fn, + &(OutlinerLibOverrideData){.do_hierarchy = true, .do_resync_hierarchy_enforce = true}); + ED_undo_push(C, "Resync Overridden Data Hierarchy"); + break; + } case OUTLINER_IDOP_OVERRIDE_LIBRARY_DELETE_HIERARCHY: { outliner_do_libdata_operation(C, op->reports, diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 6319b890b3b..573fb492613 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -62,23 +62,14 @@ #include "BLT_translation.h" #include "BKE_armature.h" -#include "BKE_fcurve_driver.h" -#include "BKE_idtype.h" #include "BKE_layer.h" #include "BKE_lib_id.h" -#include "BKE_lib_override.h" #include "BKE_main.h" #include "BKE_modifier.h" #include "BKE_outliner_treehash.h" -#include "DEG_depsgraph.h" -#include "DEG_depsgraph_build.h" - #include "ED_screen.h" -#include "WM_api.h" -#include "WM_types.h" - #include "RNA_access.h" #include "UI_interface.h" @@ -889,6 +880,10 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, /* New C++ based type handle (`TreeElementType` in C, `AbstractTreeElement` in C++). Only some * support this, eventually this should replace `TreeElement` entirely. */ te->type = outliner_tree_element_type_create(type, te, idv); + if (te->type) { + /* Element types ported to the new design are expected to have their name set at this point! */ + BLI_assert(te->name != NULL); + } if (ELEM(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) { /* pass */ diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc b/source/blender/editors/space_outliner/tree/tree_element.cc index 25bd9a53cf8..b0508e10671 100644 --- a/source/blender/editors/space_outliner/tree/tree_element.cc +++ b/source/blender/editors/space_outliner/tree/tree_element.cc @@ -18,6 +18,7 @@ * \ingroup spoutliner */ +#include "DNA_anim_types.h" #include "DNA_listBase.h" #include "tree_element_anim_data.hh" @@ -36,15 +37,25 @@ namespace blender::ed::outliner { static AbstractTreeElement *tree_element_create(int type, TreeElement &legacy_te, void *idv) { - /* Would be nice to get rid of void * here, can we somehow expect the right type right away? - * Perfect forwarding maybe, once the API is C++ only? */ ID &id = *static_cast<ID *>(idv); + /* + * The following calls make an implicit assumption about what data was passed to the `idv` + * argument of #outliner_add_element(). The old code does this already, here we just centralize + * it as much as possible for now. Would be nice to entirely get rid of that, no more `void *`. + * + * Once #outliner_add_element() is sufficiently simplified, it should be replaced by a C++ call. + * It could take the derived type as template parameter (e.g. #TreeElementAnimData) and use C++ + * perfect forwarding to pass any data to the type's constructor. + * If general Outliner code wants to access the data, they can query that through the derived + * element type then. There's no need for `void *` anymore then. + */ + switch (type) { case TSE_SOME_ID: return TreeElementID::createFromID(legacy_te, id); case TSE_ANIM_DATA: - return new TreeElementAnimData(legacy_te, id); + return new TreeElementAnimData(legacy_te, *reinterpret_cast<IdAdtTemplate &>(id).adt); case TSE_DRIVER_BASE: return new TreeElementDriverBase(legacy_te, *static_cast<AnimData *>(idv)); case TSE_NLA: @@ -52,7 +63,7 @@ static AbstractTreeElement *tree_element_create(int type, TreeElement &legacy_te case TSE_NLA_TRACK: return new TreeElementNLATrack(legacy_te, *static_cast<NlaTrack *>(idv)); case TSE_NLA_ACTION: - return new TreeElementNLAAction(legacy_te); + return new TreeElementNLAAction(legacy_te, *static_cast<bAction *>(idv)); case TSE_GP_LAYER: return new TreeElementGPencilLayer(legacy_te, *static_cast<bGPDlayer *>(idv)); case TSE_R_LAYER_BASE: diff --git a/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc b/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc index 5a9568ea906..c0fef7c98e2 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc +++ b/source/blender/editors/space_outliner/tree/tree_element_anim_data.cc @@ -32,8 +32,8 @@ namespace blender::ed::outliner { -TreeElementAnimData::TreeElementAnimData(TreeElement &legacy_te, ID &id) - : AbstractTreeElement(legacy_te), anim_data_(*reinterpret_cast<IdAdtTemplate &>(id).adt) +TreeElementAnimData::TreeElementAnimData(TreeElement &legacy_te, AnimData &anim_data) + : AbstractTreeElement(legacy_te), anim_data_(anim_data) { BLI_assert(legacy_te.store_elem->type == TSE_ANIM_DATA); /* this element's info */ diff --git a/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh b/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh index 8114277b6d6..95d08cd20b7 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_anim_data.hh @@ -30,7 +30,7 @@ class TreeElementAnimData final : public AbstractTreeElement { AnimData &anim_data_; public: - TreeElementAnimData(TreeElement &legacy_te, ID &id); + TreeElementAnimData(TreeElement &legacy_te, AnimData &anim_data); void expand(SpaceOutliner &space_outliner) const override; diff --git a/source/blender/editors/space_outliner/tree/tree_element_nla.cc b/source/blender/editors/space_outliner/tree/tree_element_nla.cc index 5d4ec53e60c..65832e8f981 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_nla.cc +++ b/source/blender/editors/space_outliner/tree/tree_element_nla.cc @@ -70,9 +70,11 @@ void TreeElementNLATrack::expand(SpaceOutliner &space_outliner) const /* -------------------------------------------------------------------- */ -TreeElementNLAAction::TreeElementNLAAction(TreeElement &legacy_te) : AbstractTreeElement(legacy_te) +TreeElementNLAAction::TreeElementNLAAction(TreeElement &legacy_te, const bAction &action) + : AbstractTreeElement(legacy_te) { BLI_assert(legacy_te.store_elem->type == TSE_NLA_ACTION); + legacy_te.name = action.id.name + 2; } } // namespace blender::ed::outliner diff --git a/source/blender/editors/space_outliner/tree/tree_element_nla.hh b/source/blender/editors/space_outliner/tree/tree_element_nla.hh index c94287ce576..7cbc8689483 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_nla.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_nla.hh @@ -46,7 +46,7 @@ class TreeElementNLATrack final : public AbstractTreeElement { class TreeElementNLAAction final : public AbstractTreeElement { public: - TreeElementNLAAction(TreeElement &legacy_te); + TreeElementNLAAction(TreeElement &legacy_te, const bAction &action); }; } // namespace blender::ed::outliner |