[Bf-blender-cvs] [f92e13a4ebe] greasepencil-object: Enable Fade geometry in Pose mode

Antonioya noreply at git.blender.org
Thu Aug 23 10:34:26 CEST 2018


Commit: f92e13a4ebe651685dc01c24edd78b71c31633e8
Author: Antonioya
Date:   Mon Aug 20 23:18:09 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBf92e13a4ebe651685dc01c24edd78b71c31633e8

Enable Fade geometry in Pose mode

Now the grease pencil geometry is fade when the alpha value is enabled.

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

M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 16412dda3f8..0d304da24f5 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -553,14 +553,14 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
 static void gpencil_add_fill_shgroup(
         GpencilBatchCache *cache, DRWShadingGroup *fillgrp,
         Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
-        const float tintcolor[4], const bool onion, const bool custonion)
+		float opacity, const float tintcolor[4], const bool onion, const bool custonion)
 {
 	MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
 	if (gps->totpoints >= 3) {
 		float tfill[4];
 		/* set color using material, tint color and opacity */
 		interp_v3_v3v3(tfill, gps->runtime.tmp_fill_rgba, tintcolor, tintcolor[3]);
-		tfill[3] = gps->runtime.tmp_fill_rgba[3] * gpl->opacity;
+		tfill[3] = gps->runtime.tmp_fill_rgba[3] * opacity;
 		if ((tfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (gp_style->fill_style > 0)) {
 			const float *color;
 			if (!onion) {
@@ -866,7 +866,7 @@ static void gpencil_draw_strokes(
 			if ((fillgrp) && (!stl->storage->simplify_fill)) {
 				gpencil_add_fill_shgroup(
 				        cache, fillgrp, ob, gpl, derived_gpf, gps,
-						tintcolor, false, custonion);
+						opacity, tintcolor, false, custonion);
 			}
 			/* stroke */
 			if (strokegrp) {
@@ -1218,6 +1218,7 @@ void DRW_gpencil_populate_datablock(
 	const bool main_onion = v3d != NULL ? (v3d->gp_flag & V3D_GP_SHOW_ONION_SKIN) : true;
 	const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0) && main_onion;
 	const bool overlay = v3d != NULL ? (bool)((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) : true;
+	float opacity;
 
 	/* check if playing animation */
 	bool playing = stl->storage->is_playing;
@@ -1241,6 +1242,16 @@ void DRW_gpencil_populate_datablock(
 		if (gpf == NULL)
 			continue;
 
+		/* if pose mode, maybe the overlay to fade geometry is enabled */
+		if ((draw_ctx->obact) && (draw_ctx->object_mode == OB_MODE_POSE) &&
+			(v3d->overlay.flag & V3D_OVERLAY_BONE_SELECT))
+		{
+			opacity = gpl->opacity * v3d->overlay.bone_select_alpha;
+		}
+		else {
+			opacity = gpl->opacity;
+		}
+
 		/* create GHash if need */
 		if (gpl->runtime.derived_data == NULL) {
 			gpl->runtime.derived_data = (GHash *)BLI_ghash_str_new(gpl->info);
@@ -1307,7 +1318,7 @@ void DRW_gpencil_populate_datablock(
 
 		gpencil_draw_strokes(
 			cache, e_data, vedata, ts, ob, gpd, gpl, gpf, derived_gpf,
-			gpl->opacity, gpl->tintcolor, false, cache_ob);
+			opacity, gpl->tintcolor, false, cache_ob);
 
 	}
 
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index d7563f13dc2..990399235d9 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2746,7 +2746,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_BONE_SELECT);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Bone Selection", "Show the Bone Selection Overlay");
-	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, "bone_select_alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "overlay.bone_select_alpha");
@@ -2754,7 +2754,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Opacity", "Opacity to use for bone selection");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	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, "show_motion_paths", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_MOTION_PATHS);



More information about the Bf-blender-cvs mailing list