[Bf-blender-cvs] [7654045981c] greasepencil-refactor: GPencil: Move Show Material Name to Overlay
Antonio Vazquez
noreply at git.blender.org
Thu Jan 9 19:16:12 CET 2020
Commit: 7654045981c8595f763dc26ebeb95617e2b28b08
Author: Antonio Vazquez
Date: Thu Jan 9 19:16:05 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB7654045981c8595f763dc26ebeb95617e2b28b08
GPencil: Move Show Material Name to Overlay
Before there was a trick to use the object name option, but now it uses a separated option.
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
M source/blender/draw/engines/overlay/overlay_gpencil.c
M source/blender/makesdna/DNA_view3d_types.h
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 45dd7af9dd3..a2ddf692a2f 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6477,6 +6477,7 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
if context.object.mode == 'EDIT_GPENCIL':
layout.prop(overlay, "use_gpencil_show_directions")
+ layout.prop(overlay, "use_gpencil_show_material_name")
if context.object.mode in {'EDIT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}:
layout.prop(overlay, "use_gpencil_edit_lines", text="Edit Lines")
diff --git a/source/blender/draw/engines/overlay/overlay_gpencil.c b/source/blender/draw/engines/overlay/overlay_gpencil.c
index ab220a9d0b3..62923c6763c 100644
--- a/source/blender/draw/engines/overlay/overlay_gpencil.c
+++ b/source/blender/draw/engines/overlay/overlay_gpencil.c
@@ -344,6 +344,9 @@ static void OVERLAY_gpencil_color_names(Object *ob)
void OVERLAY_gpencil_cache_populate(OVERLAY_Data *vedata, Object *ob)
{
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ View3D *v3d = draw_ctx->v3d;
+
bGPdata *gpd = (bGPdata *)ob->data;
if (gpd == NULL) {
return;
@@ -355,7 +358,8 @@ void OVERLAY_gpencil_cache_populate(OVERLAY_Data *vedata, Object *ob)
/* don't show object extras in set's */
if ((ob->base_flag & (BASE_FROM_SET | BASE_FROM_DUPLI)) == 0) {
- if ((ob->dtx & OB_DRAWNAME) && (ob->mode == OB_MODE_EDIT_GPENCIL) && DRW_state_show_text()) {
+ if ((v3d->gp_flag & V3D_GP_SHOW_MATERIAL_NAME) && (ob->mode == OB_MODE_EDIT_GPENCIL) &&
+ DRW_state_show_text()) {
OVERLAY_gpencil_color_names(ob);
}
}
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index b01c699c704..da3864ee251 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -408,6 +408,7 @@ typedef struct View3D {
#define V3D_GP_FADE_NOACTIVE_LAYERS (1 << 5) /* fade layers not active */
#define V3D_GP_FADE_NOACTIVE_GPENCIL (1 << 6) /* Fade other GPencil objects */
#define V3D_GP_SHOW_STROKE_DIRECTION (1 << 7) /* Show Strokes Directions */
+#define V3D_GP_SHOW_MATERIAL_NAME (1 << 8) /* Show Material names */
/** #View3DShading.light */
enum {
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 924a1602544..7cac6f74bae 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3721,6 +3721,12 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
"and smaller red dot (end) points");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+ prop = RNA_def_property(srna, "use_gpencil_show_material_name", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_MATERIAL_NAME);
+ RNA_def_property_ui_text(
+ prop, "Show Material Name", "Show material name assigned to each stroke");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
prop = RNA_def_property(srna, "gpencil_grid_opacity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "overlay.gpencil_grid_opacity");
RNA_def_property_range(prop, 0.1f, 1.0f);
More information about the Bf-blender-cvs
mailing list