[Bf-blender-cvs] [8e62b8907d9] greasepencil-object: GP: New Solo Mode to display keyframes only
Antonioya
noreply at git.blender.org
Sat Jan 5 19:44:52 CET 2019
Commit: 8e62b8907d99587957379ff416bf57330cfae70d
Author: Antonioya
Date: Sat Jan 5 19:43:53 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB8e62b8907d99587957379ff416bf57330cfae70d
GP: New Solo Mode to display keyframes only
When paint mode, now is possible display only layers with keyframes in the current frame.
This is very useful to fill strokes.
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
M source/blender/draw/engines/gpencil/gpencil_draw_utils.c
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_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index b0fe98e4ff8..1b1acf29618 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -82,6 +82,8 @@ class VIEW3D_HT_header(Header):
sub.prop(tool_settings, "use_gpencil_weight_data_add", text="", icon='WPAINT_HLT')
sub.separator(factor=0.4)
sub.prop(tool_settings, "use_gpencil_draw_additive", text="", icon='FREEZE')
+ sub.separator(factor=0.4)
+ sub.prop(tool_settings, "use_gpencil_solo_mode", text="", icon='TIME')
if gpd.use_stroke_edit_mode:
row = layout.row(align=True)
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 08e1b458127..536029c6397 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1474,7 +1474,7 @@ void DRW_gpencil_populate_multiedit(
ToolSettings *ts = scene->toolsettings;
/* check if playing animation */
- bool playing = stl->storage->is_playing;
+ const bool playing = stl->storage->is_playing;
/* calc max size of VBOs */
gpencil_calc_vertex(stl, cache_ob, cache, gpd, cfra_eval);
@@ -1543,7 +1543,10 @@ void DRW_gpencil_populate_datablock(
bGPDlayer *gpl_active = BKE_gpencil_layer_getactive(gpd);
/* check if playing animation */
- bool playing = stl->storage->is_playing;
+ const bool playing = stl->storage->is_playing;
+ const bool is_solomode = GPENCIL_PAINT_MODE(gpd) &&
+ (!playing) && (!stl->storage->is_render) &&
+ (ts->gpencil_flags & GP_TOOL_FLAG_SOLO_MODE);
GpencilBatchCache *cache = gpencil_batch_cache_get(ob, cfra_eval);
@@ -1588,6 +1591,11 @@ void DRW_gpencil_populate_datablock(
if (gpf == NULL)
continue;
+ /* if solo mode, display only frames with keyframe in the current frame */
+ if ((is_solomode) && (gpf->framenum != remap_cfra)) {
+ continue;
+ }
+
opacity = gpl->opacity;
/* if pose mode, maybe the overlay to fade geometry is enabled */
if ((draw_ctx->obact) && (draw_ctx->object_mode == OB_MODE_POSE) &&
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index eb0810a3d08..5bd15992946 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -2139,6 +2139,8 @@ typedef enum eGPencil_Flags {
GP_TOOL_FLAG_THUMBNAIL_LIST = (1 << 3),
/* Generate wheight data for new strokes */
GP_TOOL_FLAG_CREATE_WEIGHTS = (1 << 4),
+ /* Display in Paint mode only layers with keyframe */
+ GP_TOOL_FLAG_SOLO_MODE = (1 << 5),
} 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 a79b6a20dc3..4e2d971b6eb 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2657,6 +2657,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_solo_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_SOLO_MODE);
+ RNA_def_property_ui_text(prop, "Solo Mode",
+ "In Paint mode display only layers with keyframe in current frame");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
prop = RNA_def_property(srna, "use_gpencil_thumbnail_list", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_THUMBNAIL_LIST);
RNA_def_property_ui_text(prop, "Compact List",
More information about the Bf-blender-cvs
mailing list