[Bf-blender-cvs] [535298e] master: Fix T50264: Stroke is not painted when append Grease Pencil block
Antonio Vazquez
noreply at git.blender.org
Fri Dec 16 22:57:36 CET 2016
Commit: 535298eea5fd50a19d04ddffb05060313e32826c
Author: Antonio Vazquez
Date: Fri Dec 16 22:56:43 2016 +0100
Branches: master
https://developer.blender.org/rB535298eea5fd50a19d04ddffb05060313e32826c
Fix T50264: Stroke is not painted when append Grease Pencil block
When append a datablock the default brushes were not created and only
were created when draw new strokes. Now the default brushes are created
when draw strokes if necessary.
===================================================================
M source/blender/editors/gpencil/drawgpencil.c
===================================================================
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 48786e0..9da3c3e 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1554,7 +1554,17 @@ static void gp_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, i
int cfra, int dflag, const char spacetype)
{
bGPdata *gpd_source = NULL;
-
+ ToolSettings *ts;
+ bGPDbrush *brush;
+ if (scene) {
+ ts = scene->toolsettings;
+ brush = BKE_gpencil_brush_getactive(ts);
+ /* if no brushes, create default set */
+ if (brush == NULL) {
+ BKE_gpencil_brush_init_presets(ts);
+ brush = BKE_gpencil_brush_getactive(ts);
+ }
+ }
if (scene) {
if (spacetype == SPACE_VIEW3D) {
gpd_source = (scene->gpd ? scene->gpd : NULL);
@@ -1565,8 +1575,6 @@ static void gp_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, i
}
if (gpd_source) {
- ToolSettings *ts = scene->toolsettings;
- bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
if (brush != NULL) {
gp_draw_data(brush, ts->gp_sculpt.alpha, gpd_source,
offsx, offsy, winx, winy, cfra, dflag);
@@ -1578,8 +1586,6 @@ static void gp_draw_data_all(Scene *scene, bGPdata *gpd, int offsx, int offsy, i
/* scene/clip data has already been drawn, only object/track data is drawn here
* if gpd_source == gpd, we don't have any object/track data and we can skip */
if (gpd_source == NULL || (gpd_source && gpd_source != gpd)) {
- ToolSettings *ts = scene->toolsettings;
- bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
if (brush != NULL) {
gp_draw_data(brush, ts->gp_sculpt.alpha, gpd,
offsx, offsy, winx, winy, cfra, dflag);
More information about the Bf-blender-cvs
mailing list