diff options
Diffstat (limited to 'source/blender/editors/space_outliner')
5 files changed, 44 insertions, 16 deletions
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index b3b36811411..83f71292232 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -1104,9 +1104,7 @@ static bool collection_drop_init(bContext *C, const wmEvent *event, CollectionDrop *data) { - SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); - - /* Get collection to drop into. */ +/* Get collection to drop into. */ TreeElementInsertType insert_type; TreeElement *te = outliner_drop_insert_collection_find(C, event, &insert_type); if (!te) { @@ -1140,7 +1138,7 @@ static bool collection_drop_init(bContext *C, /* Get collection to drag out of. */ ID *parent = drag_id->from_parent; Collection *from_collection = collection_parent_from_ID(parent); - if (event->ctrl || space_outliner->outlinevis == SO_SCENES) { + if (event->ctrl) { from_collection = NULL; } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 278162c4338..0916e106abf 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -63,6 +63,7 @@ #include "ED_screen.h" #include "WM_api.h" +#include "WM_message.h" #include "WM_types.h" #include "GPU_immediate.h" @@ -663,6 +664,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) { Main *bmain = CTX_data_main(C); SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); + struct wmMsgBus *mbus = CTX_wm_message_bus(C); BLI_mempool *ts = space_outliner->treestore; TreeStoreElem *tselem = tsep; @@ -672,6 +674,8 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) if (tselem->type == TSE_SOME_ID) { BLI_libblock_ensure_unique_name(bmain, tselem->id->name); + WM_msg_publish_rna_prop(mbus, tselem->id, tselem->id, ID, name); + switch (GS(tselem->id->name)) { case ID_MA: WM_event_add_notifier(C, NC_MATERIAL, NULL); @@ -724,12 +728,19 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) } else { switch (tselem->type) { - case TSE_DEFGROUP: - BKE_object_defgroup_unique_name(te->directdata, (Object *)tselem->id); /* id = object. */ + case TSE_DEFGROUP: { + Object *ob = (Object *)tselem->id; + bDeformGroup *vg = te->directdata; + BKE_object_defgroup_unique_name(vg, ob); + WM_msg_publish_rna_prop(mbus, &ob->id, vg, VertexGroup, name); break; - case TSE_NLA_ACTION: - BLI_libblock_ensure_unique_name(bmain, tselem->id->name); + } + case TSE_NLA_ACTION: { + bAction *act = (bAction *)tselem->id; + BLI_libblock_ensure_unique_name(bmain, act->id.name); + WM_msg_publish_rna_prop(mbus, &act->id, &act->id, ID, name); break; + } case TSE_EBONE: { bArmature *arm = (bArmature *)tselem->id; if (arm->edbo) { @@ -740,6 +751,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) BLI_strncpy(newname, ebone->name, sizeof(ebone->name)); BLI_strncpy(ebone->name, oldname, sizeof(ebone->name)); ED_armature_bone_rename(bmain, arm, oldname, newname); + WM_msg_publish_rna_prop(mbus, &arm->id, ebone, EditBone, name); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); } break; @@ -760,6 +772,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) BLI_strncpy(newname, bone->name, sizeof(bone->name)); BLI_strncpy(bone->name, oldname, sizeof(bone->name)); ED_armature_bone_rename(bmain, arm, oldname, newname); + WM_msg_publish_rna_prop(mbus, &arm->id, bone, Bone, name); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); break; } @@ -768,6 +781,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) outliner_viewcontext_init(C, &tvc); Object *ob = (Object *)tselem->id; + bArmature *arm = (bArmature *)ob->data; bPoseChannel *pchan = te->directdata; char newname[sizeof(pchan->name)]; @@ -780,6 +794,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) BLI_strncpy(newname, pchan->name, sizeof(pchan->name)); BLI_strncpy(pchan->name, oldname, sizeof(pchan->name)); ED_armature_bone_rename(bmain, ob->data, oldname, newname); + WM_msg_publish_rna_prop(mbus, &arm->id, pchan->bone, Bone, name); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); break; } @@ -793,6 +808,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) '.', offsetof(bActionGroup, name), sizeof(grp->name)); + WM_msg_publish_rna_prop(mbus, &ob->id, grp, ActionGroup, name); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); break; } @@ -807,6 +823,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) BLI_uniquename( &gpd->layers, gpl, "GP Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); + WM_msg_publish_rna_prop(mbus, &gpd->id, gpl, GPencilLayer, info); DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, gpd); break; @@ -822,11 +839,15 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) /* Rename, preserving animation and compositing data. */ BKE_view_layer_rename(bmain, scene, view_layer, newname); + WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, ViewLayer, name); WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break; } case TSE_LAYER_COLLECTION: { - BLI_libblock_ensure_unique_name(bmain, tselem->id->name); + /* The ID is a #Collection, not a #LayerCollection */ + Collection *collection = (Collection *)tselem->id; + BLI_libblock_ensure_unique_name(bmain, collection->id.name); + WM_msg_publish_rna_prop(mbus, &collection->id, &collection->id, ID, name); WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break; } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 681f7fab18a..7fe66b017a4 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -466,7 +466,7 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked id '%s'", id->name); return; } - if (BKE_library_ID_is_indirectly_used(bmain, id) && ID_REAL_USERS(id) <= 1) { + if (ID_REAL_USERS(id) <= 1 && BKE_library_ID_is_indirectly_used(bmain, id)) { BKE_reportf(reports, RPT_WARNING, "Cannot delete id '%s', indirectly used data-blocks need at least one user", diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index dc9205106ab..66eb6ab15dc 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -699,8 +699,8 @@ static void outliner_object_delete_fn(bContext *C, ReportList *reports, Scene *s reports, RPT_WARNING, "Cannot delete indirectly linked object '%s'", ob->id.name + 2); return; } - if (BKE_library_ID_is_indirectly_used(bmain, ob) && ID_REAL_USERS(ob) <= 1 && - ID_EXTRA_USERS(ob) == 0) { + if (ID_REAL_USERS(ob) <= 1 && ID_EXTRA_USERS(ob) == 0 && + BKE_library_ID_is_indirectly_used(bmain, ob)) { BKE_reportf(reports, RPT_WARNING, "Cannot delete object '%s' from scene '%s', indirectly used objects need at " @@ -1422,8 +1422,8 @@ static Base *outline_batch_delete_hierarchy( base->object->id.name + 2); return base_next; } - if (BKE_library_ID_is_indirectly_used(bmain, object) && ID_REAL_USERS(object) <= 1 && - ID_EXTRA_USERS(object) == 0) { + if (ID_REAL_USERS(object) <= 1 && ID_EXTRA_USERS(object) == 0 && + BKE_library_ID_is_indirectly_used(bmain, object)) { BKE_reportf(reports, RPT_WARNING, "Cannot delete object '%s' from scene '%s', indirectly used objects need at least " @@ -1873,7 +1873,7 @@ static bool outliner_id_operation_item_poll(bContext *C, 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)) { + if (ID_IS_OVERRIDE_LIBRARY_REAL(tselem->id) && !ID_IS_LINKED(tselem->id)) { return true; } return false; @@ -2263,7 +2263,8 @@ static const EnumPropertyItem outliner_lib_op_type_items[] = { "DELETE", ICON_X, "Delete", - "Delete this library and all its item from Blender - WARNING: no undo"}, + "Delete this library and all its item.\n" + "Warning: No undo"}, {OL_LIB_RELOCATE, "RELOCATE", 0, diff --git a/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc b/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc index 89c9960a24f..f00cf3c34c0 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc @@ -148,6 +148,14 @@ void TreeDisplayViewLayer::add_layer_collections_recursive(ListBase &tree, if (!exclude && show_objects_) { add_layer_collection_objects(ten->subtree, *lc, *ten); } + + const bool lib_overrides_visible = !SUPPORT_FILTER_OUTLINER(&space_outliner_) || + ((space_outliner_.filter & SO_FILTER_NO_LIB_OVERRIDE) == 0); + + if (lib_overrides_visible && ID_IS_OVERRIDE_LIBRARY_REAL(&lc->collection->id)) { + outliner_add_element( + &space_outliner_, &ten->subtree, &lc->collection->id, ten, TSE_LIBRARY_OVERRIDE_BASE, 0); + } } } |