Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-11-13 23:30:44 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-11-13 23:39:17 +0300
commit4a71102309c9c081d96c3e6478212f875879f4bb (patch)
tree760b52c952d0fc3af7260a77cc61521eaa289c26 /source/blender/editors/space_view3d/view3d_draw.c
parent51a14b64d86a97694272979c1c952930d35c96df (diff)
Add active collection to viewport "name" stats
Only visible when in object mode. Most of the time we will have the active object not being a part of the active collection. So it is important to clearly communicate what is the active collection, so users know for instance where new or appended objects will be added to.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_draw.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 98f5aab88ed..40257d899fb 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -41,6 +41,7 @@
#include "BIF_glutil.h"
#include "BKE_camera.h"
+#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_key.h"
@@ -1114,10 +1115,10 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, int xoffset, int *yoffs
/**
* draw info beside axes in bottom left-corner:
- * framenum, object name, bone name (if available), marker name (if available)
+ * framenum, collection, object name, bone name (if available), marker name (if available)
*/
-static void draw_selected_name(Scene *scene, Object *ob, int xoffset, int *yoffset)
+static void draw_selected_name(Scene *scene, ViewLayer *view_layer, Object *ob, int xoffset, int *yoffset)
{
const int cfra = CFRA;
const char *msg_pin = " (Pinned)";
@@ -1130,9 +1131,15 @@ static void draw_selected_name(Scene *scene, Object *ob, int xoffset, int *yoffs
s += sprintf(s, "(%d)", cfra);
+ if ((ob == NULL) || (ob->mode == OB_MODE_OBJECT)) {
+ LayerCollection *layer_collection = view_layer->active_collection;
+ s += sprintf(s, " %s |", BKE_collection_ui_name_get(layer_collection->collection));
+ }
+
/*
* info can contain:
* - a frame (7 + 2)
+ * - a collection name (MAX_NAME + 3)
* - 3 object names (MAX_NAME)
* - 2 BREAD_CRUMB_SEPARATORs (6)
* - a SHAPE_KEY_PINNED marker and a trailing '\0' (9+1) - translated, so give some room!
@@ -1279,7 +1286,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
if (U.uiflag & USER_DRAWVIEWINFO) {
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
- draw_selected_name(scene, ob, xoffset, &yoffset);
+ draw_selected_name(scene, view_layer, ob, xoffset, &yoffset);
}
#if 0 /* TODO */