[Bf-blender-cvs] [4d8de9a9b1a] greasepencil-object: GPencil: Implement Vertex Overlay and set Vertex as default
Antonio Vazquez
noreply at git.blender.org
Thu Nov 28 20:18:50 CET 2019
Commit: 4d8de9a9b1a56a3b8336b5f831fbdd70a3e481ea
Author: Antonio Vazquez
Date: Thu Nov 28 20:18:38 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB4d8de9a9b1a56a3b8336b5f831fbdd70a3e481ea
GPencil: Implement Vertex Overlay and set Vertex as default
Now in Material Overlay mode the Vertex Color is not used and by default the 2D template uses Vertex Mode
===================================================================
M source/blender/blenloader/intern/versioning_defaults.c
M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M source/blender/draw/engines/gpencil/gpencil_engine.h
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 54ce04cd667..cf12e3f69ae 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -227,6 +227,11 @@ static void blo_update_defaults_screen(bScreen *screen,
/* Enable Sliders. */
saction->flag |= SACTION_SLIDERS;
}
+ else if (sa->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = sa->spacedata.first;
+ /* Set Vertex Color by default. */
+ v3d->shading.color_type = V3D_SHADING_VERTEX_COLOR;
+ }
}
}
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 601b4d5aa6d..0826a52cbee 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -160,7 +160,7 @@ void gpencil_get_point_geom(GpencilBatchCacheElem *be,
int totvertex = gps->totpoints;
float mix_color[4];
- const float vpaint_mix = v3d ? v3d->overlay.gpencil_vertex_paint_opacity : 1.0f;
+ const float vpaint_mix = gpencil_get_vertex_paint_factor(v3d);
const bool attenuate = (GPENCIL_VERTEX_MODE(gpd) &&
GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex));
@@ -272,7 +272,7 @@ void gpencil_get_stroke_geom(struct GpencilBatchCacheElem *be,
Object *ob = draw_ctx->obact;
bGPdata *gpd = ob ? (bGPdata *)ob->data : NULL;
- const float vpaint_mix = v3d ? v3d->overlay.gpencil_vertex_paint_opacity : 1.0f;
+ const float vpaint_mix = gpencil_get_vertex_paint_factor(v3d);
const bool attenuate = (GPENCIL_VERTEX_MODE(gpd) &&
GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex));
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 0db2f47259e..f8cf0859b2a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -971,6 +971,19 @@ static DRWShadingGroup *gpencil_shgroup_point_create(GPENCIL_e_data *e_data,
return grp;
}
+/* Get vertex Paint factor */
+float gpencil_get_vertex_paint_factor(View3D *v3d)
+{
+ if (v3d) {
+ float vpaint_mix = (v3d->shading.color_type == V3D_SHADING_MATERIAL_COLOR) ?
+ 0.0f :
+ v3d->overlay.gpencil_vertex_paint_opacity;
+ return vpaint_mix;
+ }
+
+ return 1.0f;
+}
+
/* add fill vertex info */
static void gpencil_add_fill_vertexdata(GpencilBatchCache *cache,
Object *ob,
@@ -987,7 +1000,7 @@ static void gpencil_add_fill_vertexdata(GpencilBatchCache *cache,
View3D *v3d = draw_ctx->v3d;
bGPdata *gpd = ob ? (bGPdata *)ob->data : NULL;
- const float vpaint_mix = v3d ? v3d->overlay.gpencil_vertex_paint_opacity : 1.0f;
+ const float vpaint_mix = gpencil_get_vertex_paint_factor(v3d);
const bool attenuate = (GPENCIL_VERTEX_MODE(gpd) &&
GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex));
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 0be1f6abafe..e3714d6627a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -32,6 +32,7 @@ struct Object;
struct RenderEngine;
struct RenderLayer;
struct bGPDstroke;
+struct View3D;
struct GPUBatch;
struct GPUVertBuf;
@@ -464,6 +465,7 @@ struct tGPencilObjectCache *gpencil_object_cache_add(struct tGPencilObjectCache
int *gp_cache_used);
bool gpencil_onion_active(struct bGPdata *gpd);
+float gpencil_get_vertex_paint_factor(struct View3D *v3d);
/* shading groups cache functions */
struct GpencilBatchGroup *gpencil_group_cache_add(struct GpencilBatchGroup *cache_array,
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index cb5541a8152..14573705601 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3178,7 +3178,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_View3DShading_color_type_itemf");
RNA_def_property_ui_text(prop, "Color", "Color Type");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
prop = RNA_def_property(srna, "wireframe_color_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "wire_color_type");
More information about the Bf-blender-cvs
mailing list