[Bf-blender-cvs] [12ed439] master: GPencil: Show color swatches for GPencil layers in Outliner

Joshua Leung noreply at git.blender.org
Mon Feb 9 00:56:24 CET 2015


Commit: 12ed439d8ef9e40234d31b93fa199bcfee3365f6
Author: Joshua Leung
Date:   Mon Feb 9 12:39:03 2015 +1300
Branches: master
https://developer.blender.org/rB12ed439d8ef9e40234d31b93fa199bcfee3365f6

GPencil: Show color swatches for GPencil layers in Outliner

Instead of showing a meaningless "dot" icon or having to come up with an arbitrary
icon, the Outliner now shows the stroke/fill color swatches for each layer to
match every other place where these are shown.

NOTE: Like many other widgets in the outliner though, these are not editable.

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

M	source/blender/editors/space_outliner/outliner_draw.c

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

diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 77e0e46..b9744b0 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -917,6 +917,36 @@ static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon)
 
 }
 
+static void tselem_draw_gp_icon_uibut(struct DrawIconArg *arg, ID *id, bGPDlayer *gpl)
+{
+	/* restrict column clip - skip it for now... */
+	if (arg->x >= arg->xmax) {
+		/* pass */
+	}
+	else {
+		PointerRNA ptr;
+		float w = 0.85f * U.widget_unit;
+		float h = 0.85f * UI_UNIT_Y;
+		
+		RNA_pointer_create(id, &RNA_GPencilLayer, gpl, &ptr);
+		
+		UI_block_align_begin(arg->block);
+		
+		UI_block_emboss_set(arg->block, RNA_boolean_get(&ptr, "is_stroke_visible") ? UI_EMBOSS : UI_EMBOSS_NONE);
+		uiDefButR(arg->block, UI_BTYPE_COLOR, 1, "", arg->xb, arg->yb, w, h,
+		          &ptr, "color", -1,
+		          0, 0, 0, 0, NULL);
+		
+		UI_block_emboss_set(arg->block, RNA_boolean_get(&ptr, "is_fill_visible") ? UI_EMBOSS : UI_EMBOSS_NONE);
+		uiDefButR(arg->block, UI_BTYPE_COLOR, 1, "", arg->xb, arg->yb, w, h,
+		          &ptr, "fill_color", -1,
+		          0, 0, 0, 0, NULL);
+		
+		UI_block_emboss_set(arg->block, UI_EMBOSS_NONE);
+		UI_block_align_end(arg->block);
+	}
+}
+
 static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeStoreElem *tselem, TreeElement *te,
                              float alpha)
 {
@@ -1115,7 +1145,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
 					UI_icon_draw(x, y, RNA_struct_ui_icon(te->rnaptr.type));
 				break;
 			case TSE_GP_LAYER:
-				UI_icon_draw(x, y, ICON_DOT); break; // XXX: needs a dedicated icon?
+				tselem_draw_gp_icon_uibut(&arg, tselem->id, te->directdata);
+				break;
 			default:
 				UI_icon_draw(x, y, ICON_DOT); break;
 		}




More information about the Bf-blender-cvs mailing list