[Bf-blender-cvs] [4a71102309c] blender2.8: Add active collection to viewport "name" stats

Dalai Felinto noreply at git.blender.org
Tue Nov 13 22:09:12 CET 2018


Commit: 4a71102309c9c081d96c3e6478212f875879f4bb
Author: Dalai Felinto
Date:   Tue Nov 13 18:30:44 2018 -0200
Branches: blender2.8
https://developer.blender.org/rB4a71102309c9c081d96c3e6478212f875879f4bb

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.

===================================================================

M	source/blender/editors/space_view3d/view3d_draw.c

===================================================================

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



More information about the Bf-blender-cvs mailing list