[Bf-blender-cvs] [5249e4bb116] greasepencil-object: Add switch to chnage betwen thumbnails and list

Antonio Vazquez noreply at git.blender.org
Sun Jul 15 21:34:30 CEST 2018


Commit: 5249e4bb116b261d74749599b34eb5e8b972741d
Author: Antonio Vazquez
Date:   Sun Jul 15 21:34:23 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB5249e4bb116b261d74749599b34eb5e8b972741d

Add switch to chnage betwen thumbnails and list

Now it's possible to change between a compact list of colors or the default thumbnail mode.

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

M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index bb21d0d2152..099e9b6fb35 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -995,6 +995,7 @@ class _defs_gpencil_paint:
         if ob and ob.mode == 'GPENCIL_PAINT':
             brush = context.active_gpencil_brush
             gp_settings = brush.gpencil_settings
+            ts = context.tool_settings
 
             if gp_settings.gpencil_brush_type == 'ERASE':
                 row = layout.row()
@@ -1005,8 +1006,12 @@ class _defs_gpencil_paint:
                 row.prop(brush, "size", text="Thickness")
                 row.prop(gp_settings, "gpencil_fill_simplyfy_level", text="Simplify")
 
-                row = layout.row()
-                row.template_greasepencil_color(gp_settings, "material", rows=nrow, cols=ncol, scale=scale)
+                row = layout.row(align=True)
+                row.prop(ts, "use_gpencil_compact_list", text="", icon="SORTSIZE")
+                if ts.use_gpencil_compact_list is True:
+                    row.template_ID(gp_settings, "material")
+                else:
+                    row.template_greasepencil_color(gp_settings, "material", rows=nrow, cols=ncol, scale=scale)
 
                 row = layout.row(align=True)
                 row.prop(gp_settings, "gpencil_fill_draw_mode", text="")
@@ -1021,7 +1026,11 @@ class _defs_gpencil_paint:
                 row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
 
                 row = layout.row(align=True)
-                row.template_greasepencil_color(gp_settings, "material", rows=nrow, cols=ncol, scale=scale)
+                row.prop(ts, "use_gpencil_compact_list", text="", icon="SORTSIZE")
+                if ts.use_gpencil_compact_list is True:
+                    row.template_ID(gp_settings, "material")
+                else:
+                    row.template_greasepencil_color(gp_settings, "material", rows=nrow, cols=ncol, scale=scale)
 
     @staticmethod
     def generate_from_brushes(context):
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index f3188acda71..84f547c9da3 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -2046,6 +2046,8 @@ typedef enum eGPencil_Flags {
 	GP_TOOL_FLAG_RETAIN_LAST            = (1 << 1),
 	/* Add the strokes below all strokes in the layer */
 	GP_TOOL_FLAG_PAINT_ONBACK           = (1 << 2),
+	/* Show compact list of colors */
+	GP_TOOL_FLAG_COMPACT_LIST           = (1 << 3),
 } eGPencil_Flags;
 
 /* scene->r.simplify_gpencil */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index f09ea5d1737..092bc94c088 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2416,6 +2416,12 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
 		"When draw new strokes, the new stroke is drawn below of all strokes in the layer");
 	RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
 
+	prop = RNA_def_property(srna, "use_gpencil_compact_list", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_COMPACT_LIST);
+	RNA_def_property_ui_text(prop, "Compact List",
+		"Show compact list of color instead of thumbnails");
+	RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
 	prop = RNA_def_property(srna, "gpencil_sculpt", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "gp_sculpt");
 	RNA_def_property_struct_type(prop, "GPencilSculptSettings");



More information about the Bf-blender-cvs mailing list