[Bf-blender-cvs] [ebdb549] master: GPencil: Avoid segment fault if new stroke function is called without colorname

2016-08-10 Thread Antonioya
Commit: ebdb5490b3a63e37ac5638f8a06737cf34ba36d3
Author: Antonioya
Date:   Wed Aug 10 15:51:40 2016 +0200
Branches: master
https://developer.blender.org/rBebdb5490b3a63e37ac5638f8a06737cf34ba36d3

GPencil: Avoid segment fault if new stroke function is called without colorname

===

M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 7424c19..9476c96 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -482,7 +482,9 @@ static void rna_GPencil_stroke_point_pop(bGPDstroke 
*stroke, ReportList *reports
 static bGPDstroke *rna_GPencil_stroke_new(bGPDframe *frame, const char 
*colorname)
 {
bGPDstroke *stroke = MEM_callocN(sizeof(bGPDstroke), "gp_stroke");
-   strcpy(stroke->colorname, colorname);
+   if (colorname) {
+   strcpy(stroke->colorname, colorname);
+   }
stroke->palcolor = NULL;
stroke->flag |= GP_STROKE_RECALC_COLOR;
BLI_addtail(>strokes, stroke);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [35a6e54] master: GPencil: Cleanup code

2016-08-13 Thread Antonioya
Commit: 35a6e540b172cf351da34715b8ad2e0bebc92d44
Author: Antonioya
Date:   Sat Aug 13 16:59:53 2016 +0200
Branches: master
https://developer.blender.org/rB35a6e540b172cf351da34715b8ad2e0bebc92d44

GPencil: Cleanup code

===

M   source/blender/makesdna/DNA_gpencil_types.h

===

diff --git a/source/blender/makesdna/DNA_gpencil_types.h 
b/source/blender/makesdna/DNA_gpencil_types.h
index f154605..773d203 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -298,9 +298,8 @@ typedef struct bGPdata {
char  pad[6];   /* padding for compiler alignment error */
short sflag;/* settings for palette color */
 
-   /* saved paletes and brushes */
+   /* saved palettes */
ListBase palettes;
-   //ListBase brushes;
 } bGPdata;
 
 /* bGPdata->flag */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [774beb7] master: GPencil: Rename color name property to keep consistency in naming

2016-08-10 Thread Antonioya
Commit: 774beb7c3cf04cc42703a4a6ebb9a4836690b060
Author: Antonioya
Date:   Wed Aug 10 12:20:02 2016 +0200
Branches: master
https://developer.blender.org/rB774beb7c3cf04cc42703a4a6ebb9a4836690b060

GPencil: Rename color name property to keep consistency in naming

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index cabcd49..90cf410 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -659,7 +659,7 @@ class GPENCIL_UL_palettecolor(UIList):
 row = split.row(align=True)
 row.prop(palcolor, "color", text="", 
emboss=palcolor.is_stroke_visible)
 row.prop(palcolor, "fill_color", text="", 
emboss=palcolor.is_fill_visible)
-split.prop(palcolor, "info", text="", emboss=False)
+split.prop(palcolor, "name", text="", emboss=False)
 
 row = layout.row(align=True)
 row.prop(palcolor, "lock", text="", emboss=False)
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 80f4d5d..7424c19 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1381,8 +1381,9 @@ static void rna_def_gpencil_palettecolor(BlenderRNA *brna)
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
 
/* Name */
-   prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
-   RNA_def_property_ui_text(prop, "Info", "Color name");
+   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+   RNA_def_property_string_sdna(prop, NULL, "info");
+   RNA_def_property_ui_text(prop, "Name", "Color name");
RNA_def_property_string_funcs(prop, NULL, NULL, 
"rna_GPencilPaletteColor_info_set");
RNA_def_struct_name_property(srna, prop);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0e25dc4] master: GPencil: Fix error in arrange strokes

2016-08-07 Thread Antonioya
Commit: 0e25dc4acc08e7c48588ec7dc27f3deea3a165ec
Author: Antonioya
Date:   Fri Aug 5 21:09:30 2016 +0200
Branches: master
https://developer.blender.org/rB0e25dc4acc08e7c48588ec7dc27f3deea3a165ec

GPencil: Fix error in arrange strokes

During code review a field was renamed, but one line was missing.

===

M   source/blender/editors/gpencil/gpencil_data.c

===

diff --git a/source/blender/editors/gpencil/gpencil_data.c 
b/source/blender/editors/gpencil/gpencil_data.c
index 6f2ebbe..876f873 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -747,7 +747,7 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator 
*op)
bGPDframe *gpf = gpl->actframe;
/* temp listbase to store selected strokes */
ListBase selected = {NULL};
-   const int direction = RNA_enum_get(op->ptr, "type");
+   const int direction = RNA_enum_get(op->ptr, "direction");
 
/* verify if any selected stroke is in the extreme of the stack and 
select to move */
for (gps = gpf->strokes.first; gps; gps = gps->next) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fc9747f] master: GPencil: Handle drawing on back for polygons

2016-08-07 Thread Antonioya
Commit: fc9747fa89152251cf50b48db311622916d14f8f
Author: Antonioya
Date:   Sun Aug 7 12:16:44 2016 +0200
Branches: master
https://developer.blender.org/rBfc9747fa89152251cf50b48db311622916d14f8f

GPencil: Handle drawing on back for polygons

The polygons must move the stroke to back only when polygon is complete

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index cebcbfe..4e521b5 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -930,7 +930,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
* because the drawing order is inverse and the head stroke is the first 
to draw. This is very useful for artist
* when drawing the background
*/
-   if (ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) {
+   if ((ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode != 
GP_PAINTMODE_DRAW_POLY)) {
BLI_addhead(>gpf->strokes, gps);
}
else {
@@ -2287,6 +2287,28 @@ static void gpencil_stroke_end(wmOperator *op)
p->gpf = NULL;
 }
 
+/* if drawing polygon and draw on back is enabled, move the stroke below all 
previous strokes */
+static void gpencil_move_polygon_stroke_to_back(bContext *C)
+{
+   /* move last stroke (the polygon) to head of the listbase stroke to 
draw on back of all previous strokes */
+   bGPdata *gpd = ED_gpencil_data_get_active(C);
+   bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
+
+   /* sanity checks */
+   if (ELEM(NULL, gpd, gpl, gpl->actframe)) {
+   return;
+   }
+
+   bGPDframe *gpf = gpl->actframe;
+   bGPDstroke *gps = gpf->strokes.last;
+   if (ELEM(NULL, gps)) {
+   return;
+   }
+
+   BLI_remlink(>strokes, gps);
+   BLI_insertlinkbefore(>strokes, gpf->strokes.first, gps);
+}
+
 /* events handling during interactive drawing part of operator */
 static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent 
*event)
 {
@@ -2343,6 +2365,10 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
if (ELEM(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY, EKEY)) {
/* exit() ends the current stroke before cleaning up */
/* printf("\t\tGP - end of paint op + end of stroke\n"); */
+   /* if drawing polygon and enable on back, must move stroke */
+   if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
+   gpencil_move_polygon_stroke_to_back(C);
+   }
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}
@@ -2399,6 +2425,10 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
}
else {
/* printf("\t\tGP - end of stroke + op\n"); */
+   /* if drawing polygon and enable on back, must 
move stroke */
+   if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
+   gpencil_move_polygon_stroke_to_back(C);
+   }
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}
@@ -2479,6 +2509,10 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
 * NOTE: Don't eter this case if an error 
occurred while finding the
 *   region (as above)
 */
+   /* if drawing polygon and enable on back, must 
move stroke */
+   if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
+   gpencil_move_polygon_stroke_to_back(C);
+   }
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [945b9f4] master: GPencil: Do not disable continuous drawing if click out of drawing area

2016-08-07 Thread Antonioya
Commit: 945b9f4c3f93ff4ffcd9a1df2511957db4c66648
Author: Antonioya
Date:   Fri Aug 5 18:12:17 2016 +0200
Branches: master
https://developer.blender.org/rB945b9f4c3f93ff4ffcd9a1df2511957db4c66648

GPencil: Do not disable continuous drawing if click out of drawing area

Do not clear continuous drawing. This code was related to a previous
test and must be removed.

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index eefdee7..d637aff 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2390,9 +2390,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
}
else {
/* printf("\t\tGP - end of stroke + op\n"); */
-   /* disable paint session */
-   p->scene->toolsettings->gpencil_flags &= 
~GP_TOOL_FLAG_PAINTSESSIONS_ON;
-
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}
@@ -2422,9 +2419,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
in_bounds = true;
}
else {
-   /* disable paint session */
-   p->scene->toolsettings->gpencil_flags 
&= ~GP_TOOL_FLAG_PAINTSESSIONS_ON;
-
/* Out of bounds, or invalid in some 
other way */
p->status = GP_STATUS_ERROR;
estate = OPERATOR_CANCELLED;
@@ -2441,9 +2435,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
in_bounds = BLI_rcti_isect_pt_v(_rect, 
event->mval);
}
else {
-   /* disable paint session */
-   p->scene->toolsettings->gpencil_flags &= 
~GP_TOOL_FLAG_PAINTSESSIONS_ON;
-
/* No region */
p->status = GP_STATUS_ERROR;
estate = OPERATOR_CANCELLED;
@@ -2471,9 +2462,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
p = gpencil_stroke_begin(C, op);

if (p->status == GP_STATUS_ERROR) {
-   /* disable paint session */
-   p->scene->toolsettings->gpencil_flags 
&= ~GP_TOOL_FLAG_PAINTSESSIONS_ON;
-
estate = OPERATOR_CANCELLED;
}
}
@@ -2482,9 +2470,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
 * NOTE: Don't eter this case if an error 
occurred while finding the
 *   region (as above)
 */
-   /* disable paint session */
-   p->scene->toolsettings->gpencil_flags &= 
~GP_TOOL_FLAG_PAINTSESSIONS_ON;
-
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [97b0d23] master: GPencil: Add option to draw new strokes on back of layer

2016-08-07 Thread Antonioya
Commit: 97b0d23357b1f48f30d45f2f328707a7bdc40695
Author: Antonioya
Date:   Fri Aug 5 23:03:51 2016 +0200
Branches: master
https://developer.blender.org/rB97b0d23357b1f48f30d45f2f328707a7bdc40695

GPencil: Add option to draw new strokes on back of layer

For artist point of view is very useful to have an option to draw by
default the new strokes on back of all strokes in the layer.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/editors/gpencil/gpencil_paint.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/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index c80c5ca..cabcd49 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -80,6 +80,7 @@ class GreasePencilDrawingToolsPanel:
 sub = col.column(align=True)
 sub.prop(context.tool_settings, "use_gpencil_additive_drawing", 
text="Additive Drawing")
 sub.prop(context.tool_settings, "use_gpencil_continuous_drawing", 
text="Continuous Drawing")
+sub.prop(context.tool_settings, "use_gpencil_draw_onback", text="Draw 
on Back")
 
 col.separator()
 col.separator()
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index d637aff..cebcbfe 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -692,6 +692,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
bGPDspoint *pt;
tGPspoint *ptc;
bGPDbrush *brush = p->brush;
+   ToolSettings *ts = p->scene->toolsettings;

int i, totelem;
/* since strokes are so fine, when using their depth we need a margin 
otherwise they might get missed */
@@ -925,8 +926,16 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
gps->palcolor = palcolor;
strcpy(gps->colorname, palcolor->info);
 
-   /* add stroke to frame */
-   BLI_addtail(>gpf->strokes, gps);
+   /* add stroke to frame, usually on tail of the listbase, but if on back 
is enabled the stroke is added on listbase head 
+   * because the drawing order is inverse and the head stroke is the first 
to draw. This is very useful for artist
+   * when drawing the background
+   */
+   if (ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) {
+   BLI_addhead(>gpf->strokes, gps);
+   }
+   else {
+   BLI_addtail(>gpf->strokes, gps);
+   }
gp_stroke_added_enable(p);
 }
 
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index 90e8d8b..a4934cc 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -2088,6 +2088,8 @@ typedef enum eGPencil_Flags {
GP_TOOL_FLAG_PAINTSESSIONS_ON   = (1 << 0),
/* When creating new frames, the last frame gets used as the basis for 
the new one */
GP_TOOL_FLAG_RETAIN_LAST= (1 << 1),
+   /* Add the strokes below all strokes in the layer */
+   GP_TOOL_FLAG_PAINT_ONBACK = (1 << 2)
 } eGPencil_Flags;
 
 /* toolsettings->gpencil_src */
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index abac6b9..156c327 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2612,6 +2612,12 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
 "are included as the basis for the new one");
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);

+   prop = RNA_def_property(srna, "use_gpencil_draw_onback", PROP_BOOLEAN, 
PROP_NONE);
+   RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", 
GP_TOOL_FLAG_PAINT_ONBACK);
+   RNA_def_property_ui_text(prop, "Draw Strokes on Back",
+   "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, "grease_pencil_source", PROP_ENUM, 
PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_src");
RNA_def_property_enum_items(prop, gpencil_source_3d_items);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4444221] master: GPencil: Cleanup - Rename function for better naming

2016-08-08 Thread Antonioya
Commit: 22120f25de84d02abc99b417bd3d6b85d55a
Author: Antonioya
Date:   Mon Aug 8 11:26:00 2016 +0200
Branches: master
https://developer.blender.org/rB22120f25de84d02abc99b417bd3d6b85d55a

GPencil: Cleanup - Rename function for better naming

The old function name was not clear enough

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 3afdd57..e7e39a8 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2287,8 +2287,8 @@ static void gpencil_stroke_end(wmOperator *op)
p->gpf = NULL;
 }
 
-/* if drawing polygon and draw on back is enabled, move the stroke below all 
previous strokes */
-static void gpencil_move_polygon_stroke_to_back(bContext *C)
+/* Move last stroke in the listbase to the head to be drawn below all previous 
strokes in the layer */
+static void gpencil_move_last_stroke_to_back(bContext *C)
 {
/* move last stroke (the polygon) to head of the listbase stroke to 
draw on back of all previous strokes */
bGPdata *gpd = ED_gpencil_data_get_active(C);
@@ -2368,7 +2368,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
/* if drawing polygon and enable on back, must move stroke */
if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
if (p->flags & GP_PAINTFLAG_STROKEADDED) {
-   gpencil_move_polygon_stroke_to_back(C);
+   gpencil_move_last_stroke_to_back(C);
}
}
p->status = GP_STATUS_DONE;
@@ -2430,7 +2430,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
/* if drawing polygon and enable on back, must 
move stroke */
if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
if (p->flags & 
GP_PAINTFLAG_STROKEADDED) {
-   
gpencil_move_polygon_stroke_to_back(C);
+   
gpencil_move_last_stroke_to_back(C);
}
}
p->status = GP_STATUS_DONE;
@@ -2516,7 +2516,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
/* if drawing polygon and enable on back, must 
move stroke */
if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
if (p->flags & 
GP_PAINTFLAG_STROKEADDED) {
-   
gpencil_move_polygon_stroke_to_back(C);
+   
gpencil_move_last_stroke_to_back(C);
}
}
p->status = GP_STATUS_DONE;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [31c34ac] master: GPencil: Move polygon to back only if something was drawn

2016-08-08 Thread Antonioya
Commit: 31c34acff0b91444100095d9c2980273a4abd437
Author: Antonioya
Date:   Mon Aug 8 11:21:44 2016 +0200
Branches: master
https://developer.blender.org/rB31c34acff0b91444100095d9c2980273a4abd437

GPencil: Move polygon to back only if something was drawn

If the user enable polygon draw and press ESC before drawing something,
the last stroke must not be moved back.

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 4e521b5..3afdd57 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2367,7 +2367,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
/* printf("\t\tGP - end of paint op + end of stroke\n"); */
/* if drawing polygon and enable on back, must move stroke */
if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
-   gpencil_move_polygon_stroke_to_back(C);
+   if (p->flags & GP_PAINTFLAG_STROKEADDED) {
+   gpencil_move_polygon_stroke_to_back(C);
+   }
}
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
@@ -2427,7 +2429,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
/* printf("\t\tGP - end of stroke + op\n"); */
/* if drawing polygon and enable on back, must 
move stroke */
if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
-   gpencil_move_polygon_stroke_to_back(C);
+   if (p->flags & 
GP_PAINTFLAG_STROKEADDED) {
+   
gpencil_move_polygon_stroke_to_back(C);
+   }
}
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
@@ -2511,7 +2515,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
 */
/* if drawing polygon and enable on back, must 
move stroke */
if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
-   gpencil_move_polygon_stroke_to_back(C);
+   if (p->flags & 
GP_PAINTFLAG_STROKEADDED) {
+   
gpencil_move_polygon_stroke_to_back(C);
+   }
}
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b904210] master: Fix T49097: GP ruler data reinstances GP_Palette Color

2016-08-16 Thread Antonioya
Commit: b90421019b0257f52a6b75dcc57a0c96fa4159b6
Author: Antonioya
Date:   Tue Aug 16 22:28:34 2016 +0200
Branches: master
https://developer.blender.org/rBb90421019b0257f52a6b75dcc57a0c96fa4159b6

Fix T49097: GP ruler data reinstances GP_Palette Color

If the ruler is saved, a new color was created for each ruler. With the
change, a color is created for the first instance, and it reused in the
following instances. The default color is the current default color for
GP.

===

M   source/blender/editors/space_view3d/view3d_ruler.c

===

diff --git a/source/blender/editors/space_view3d/view3d_ruler.c 
b/source/blender/editors/space_view3d/view3d_ruler.c
index 37b068e..dda1a64 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -297,6 +297,8 @@ static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo 
*ruler_info)
bGPDlayer *gpl;
bGPDframe *gpf;
bGPDstroke *gps;
+   bGPDpalette *palette;
+   bGPDpalettecolor *palcolor;
RulerItem *ruler_item;
const char *ruler_name = RULER_ID;
bool changed = false;
@@ -312,6 +314,17 @@ static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo 
*ruler_info)
gpl->flag |= GP_LAYER_HIDE;
}
 
+   /* try to get active palette or create a new one */
+   palette = BKE_gpencil_palette_getactive(scene->gpd);
+   if (palette == NULL) {
+   palette = BKE_gpencil_palette_addnew(scene->gpd, 
DATA_("GP_Palette"), true);
+   }
+   /* try to get color with the ruler name or create a new one */
+   palcolor = BKE_gpencil_palettecolor_getbyname(palette, (char 
*)ruler_name);
+   if (palcolor == NULL) {
+   palcolor = BKE_gpencil_palettecolor_addnew(palette, (char 
*)ruler_name, true);
+   }
+   
gpf = BKE_gpencil_layer_getframe(gpl, CFRA, true);
BKE_gpencil_free_strokes(gpf);
 
@@ -342,6 +355,9 @@ static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo 
*ruler_info)
}
}
gps->flag = GP_STROKE_3DSPACE;
+   /* assign color to stroke */
+   strcpy(gps->colorname, palcolor->info);
+   gps->palcolor = palcolor;
BLI_addtail(>strokes, gps);
changed = true;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ab775b6] master: Fix T49102: Angle option of new GP brush settings is too restricted in value

2016-08-17 Thread Antonioya
Commit: ab775b6ae9930e1fc6b8536f5ca150557286a119
Author: Antonioya
Date:   Wed Aug 17 16:23:05 2016 +0200
Branches: master
https://developer.blender.org/rBab775b6ae9930e1fc6b8536f5ca150557286a119

Fix T49102: Angle option of new GP brush settings is too restricted in value

Now the range is between -90 to 90 degrees to give more customization
options.

===

M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index a3b1334..98df127 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2161,10 +2161,10 @@ static void rna_def_gpencil_brush(BlenderRNA *brna)
/* Angle when brush is full size */
prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "draw_angle");
-   RNA_def_property_range(prop, 0.0f, M_PI_2);
+   RNA_def_property_range(prop, -M_PI_2, M_PI_2);
RNA_def_property_ui_text(prop, "Angle",
 "Direction of the stroke at which brush gives 
maximal thickness "
-"(0° for horizontal, 90° for vertical)");
+"(0° for horizontal)");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
/* Factor to change brush size depending of angle */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1263965] master: GPencil: New interpolate strokes operators

2016-09-07 Thread Antonioya
Commit: 1263965f83b15e774ab83255030cf25768de5838
Author: Antonioya
Date:   Wed Sep 7 09:54:50 2016 +0200
Branches: master
https://developer.blender.org/rB1263965f83b15e774ab83255030cf25768de5838

GPencil: New interpolate strokes operators

Two new modal operators to create a grease pencil interpolate drawing
for one frame or a complete sequence between two frames.  For drawing
the temporary strokes in the viewport, two drawing handlers have been
added to manage 3D and 2D stuff.

Video: https://youtu.be/qxYwO5sSg5Y

The operator shortcuts are Ctrl+E and Ctrl+Shift+E. During the modal
operator, the interpolation can be adjusted using the mouse (moving
left/right) or the wheel mouse.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/editors/gpencil/drawgpencil.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_intern.h
M   source/blender/editors/gpencil/gpencil_ops.c
M   source/blender/editors/include/ED_gpencil.h
M   source/blender/makesdna/DNA_gpencil_types.h
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_sculpt_paint.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index e42f726..b1e9f52 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -216,6 +216,15 @@ class GreasePencilStrokeEditPanel:
 col.operator_menu_enum("gpencil.stroke_arrange", text="Arrange 
Strokes...", property="direction")
 col.operator("gpencil.stroke_change_color", text="Move to Color")
 
+if is_3d_view:
+layout.separator()
+col = layout.column(align=True)
+col.operator("gpencil.interpolate", text="Interpolate")
+col.operator("gpencil.interpolate_sequence", text="Sequence")
+settings = context.tool_settings.gpencil_sculpt
+col.prop(settings, "interpolate_all_layers")
+col.prop(settings, "interpolate_selected_only")
+
 layout.separator()
 col = layout.column(align=True)
 col.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index 4ef76f5..48786e0 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -66,6 +66,7 @@
 #include "ED_gpencil.h"
 #include "ED_screen.h"
 #include "ED_view3d.h"
+#include "ED_space_api.h"
 
 #include "UI_interface_icons.h"
 #include "UI_resources.h"
@@ -74,7 +75,6 @@
 /* GREASE PENCIL DRAWING */
 
 /* - General Defines -- */
-
 /* flags for sflag */
 typedef enum eDrawStrokeFlags {
GP_DRAWDATA_NOSTATUS= (1 << 0),   /* don't draw status info */
@@ -1338,6 +1338,39 @@ static void gp_draw_onionskins(

 }
 
+/* draw interpolate strokes (used only while operator is running) */
+void ED_gp_draw_interpolation(tGPDinterpolate *tgpi, const int type)
+{
+   tGPDinterpolate_layer *tgpil;
+   float diff_mat[4][4];
+   float color[4];
+
+   int offsx = 0;
+   int offsy = 0;
+   int winx = tgpi->ar->winx;
+   int winy = tgpi->ar->winy;
+
+   UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, color);
+   color[3] = 0.6f;
+   int dflag = 0; 
+   /* if 3d stuff, enable flags */
+   if (type == REGION_DRAW_POST_VIEW) {
+   dflag |= (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_NOSTATUS);
+   }
+
+   /* turn on alpha-blending */
+   glEnable(GL_BLEND);
+   for (tgpil = tgpi->ilayers.first; tgpil; tgpil = tgpil->next) {
+   /* calculate parent position */
+   ED_gpencil_parent_location(tgpil->gpl, diff_mat);
+   if (tgpil->interFrame) {
+   gp_draw_strokes(tgpi->gpd, tgpil->interFrame, offsx, 
offsy, winx, winy, dflag, false,
+   tgpil->gpl->thickness, 1.0f, color, true, true, 
diff_mat);
+   }
+   }
+   glDisable(GL_BLEND);
+}
+
 /* loop over gpencil data layers, drawing them */
 static void gp_draw_data_layers(
 bGPDbrush *brush, float alpha, bGPdata *gpd,
diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 9f700e8..c3b318a 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -18,7 +18,7 @@
  

[Bf-blender-cvs] [fa092da] master: GPencil: Replace strcpy by BLI_strncpy

2016-08-29 Thread Antonioya
Commit: fa092da37700b15374db50803bd7afe2a407bb55
Author: Antonioya
Date:   Mon Aug 29 21:55:02 2016 +0200
Branches: master
https://developer.blender.org/rBfa092da37700b15374db50803bd7afe2a407bb55

GPencil: Replace strcpy by BLI_strncpy

===

M   source/blender/editors/space_view3d/view3d_ruler.c

===

diff --git a/source/blender/editors/space_view3d/view3d_ruler.c 
b/source/blender/editors/space_view3d/view3d_ruler.c
index 67a40ae..3c13ab9 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -357,7 +357,7 @@ static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo 
*ruler_info)
gps->flag = GP_STROKE_3DSPACE;
gps->thickness = 3;
/* assign color to stroke */
-   strcpy(gps->colorname, palcolor->info);
+   BLI_strncpy(gps->colorname, palcolor->info, 
sizeof(gps->colorname));
gps->palcolor = palcolor;
BLI_addtail(>strokes, gps);
changed = true;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5f14bc1] master: GPencil: Fix segment fault when undo

2016-08-29 Thread Antonioya
Commit: 5f14bc1b47f3949cb5929153fcbb1916dc6cc0a8
Author: Antonioya
Date:   Mon Aug 29 22:17:57 2016 +0200
Branches: master
https://developer.blender.org/rB5f14bc1b47f3949cb5929153fcbb1916dc6cc0a8

GPencil: Fix segment fault when undo

When undo in UV/Image editor and press ESC key, there was segment fault
in Toolsettings because the reference was missing. Now the toolsetting
is loaded from context and not from local operator data.

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 70a4b29..cc45cbd 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2310,6 +2310,7 @@ static void gpencil_move_last_stroke_to_back(bContext *C)
 static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent 
*event)
 {
tGPsdata *p = op->customdata;
+   ToolSettings *ts = CTX_data_tool_settings(C);
int estate = OPERATOR_PASS_THROUGH; /* default exit state - pass 
through to support MMB view nav, etc. */

/* if (event->type == NDOF_MOTION)
@@ -2363,9 +2364,11 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
/* exit() ends the current stroke before cleaning up */
/* printf("\t\tGP - end of paint op + end of stroke\n"); */
/* if drawing polygon and enable on back, must move stroke */
-   if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
-   if (p->flags & GP_PAINTFLAG_STROKEADDED) {
-   gpencil_move_last_stroke_to_back(C);
+   if (ts) {
+   if ((ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && 
(p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
+   if (p->flags & GP_PAINTFLAG_STROKEADDED) {
+   gpencil_move_last_stroke_to_back(C);
+   }
}
}
p->status = GP_STATUS_DONE;
@@ -2425,9 +2428,11 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
else {
/* printf("\t\tGP - end of stroke + op\n"); */
/* if drawing polygon and enable on back, must 
move stroke */
-   if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
-   if (p->flags & 
GP_PAINTFLAG_STROKEADDED) {
-   
gpencil_move_last_stroke_to_back(C);
+   if (ts) {
+   if ((ts->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
+   if (p->flags & 
GP_PAINTFLAG_STROKEADDED) {
+   
gpencil_move_last_stroke_to_back(C);
+   }
}
}
p->status = GP_STATUS_DONE;
@@ -2511,9 +2516,11 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
 *   region (as above)
 */
/* if drawing polygon and enable on back, must 
move stroke */
-   if ((p->scene->toolsettings->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
-   if (p->flags & 
GP_PAINTFLAG_STROKEADDED) {
-   
gpencil_move_last_stroke_to_back(C);
+   if (ts) {
+   if ((ts->gpencil_flags & 
GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
+   if (p->flags & 
GP_PAINTFLAG_STROKEADDED) {
+   
gpencil_move_last_stroke_to_back(C);
+   }
}
}
p->status = GP_STATUS_DONE;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ac7ff55] master: GPencil: New subdivide stroke operator

2016-09-16 Thread Antonioya
Commit: ac7ff55f110e9c0b9e6cef2557d8cd06348c45fa
Author: Antonioya
Date:   Thu Sep 15 13:29:26 2016 +0200
Branches: master
https://developer.blender.org/rBac7ff55f110e9c0b9e6cef2557d8cd06348c45fa

GPencil: New subdivide stroke operator

In some situations the artist needs to subdivide a stroke created with
few points before, specially for sculpting.

The subdivision is done for any pair of continuous selected points in
the same stroke.

The operator can be activated in edit mode with W key and has a
parameter for number of cuts.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_intern.h
M   source/blender/editors/gpencil/gpencil_ops.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 4299cf6..9432be3 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -227,6 +227,7 @@ class GreasePencilStrokeEditPanel:
 
 layout.separator()
 col = layout.column(align=True)
+col.operator("gpencil.stroke_subdivide", text="Subdivide")
 col.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
 col.operator("gpencil.stroke_join", text="Join & Copy").type = 
'JOINCOPY'
 col.operator("gpencil.stroke_flip", text="Flip Direction")
diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index cce22ba..7175ec3 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -1970,6 +1970,125 @@ void GPENCIL_OT_reproject(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
+/* *** Stroke subdivide ** */
+/* helper: Count how many points need to be inserted */
+static int gp_count_subdivision_cuts(bGPDstroke *gps)
+{
+   bGPDspoint *pt;
+   int i;
+   int totnewpoints = 0;
+   for (i = 0, pt = gps->points; i < gps->totpoints && pt; i++, pt++) {
+   if (pt->flag & GP_SPOINT_SELECT) {
+   if (i + 1 < gps->totpoints){
+   if (gps->points[i + 1].flag & GP_SPOINT_SELECT) 
{
+   ++totnewpoints;
+   };
+   }
+   }
+   }
+
+   return totnewpoints;
+}
+static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op)
+{
+   bGPdata *gpd = ED_gpencil_data_get_active(C);
+   bGPDspoint *temp_points;
+   const int cuts = RNA_int_get(op->ptr, "number_cuts");
+
+   int totnewpoints, oldtotpoints;
+   int i2;
+
+   /* sanity checks */
+   if (ELEM(NULL, gpd))
+   return OPERATOR_CANCELLED;
+
+   /* Go through each editable + selected stroke */
+   GP_EDITABLE_STROKES_BEGIN(C, gpl, gps)
+   {
+   if (gps->flag & GP_STROKE_SELECT) {
+   /* loop as many times as cuts */
+   for (int s = 0; s < cuts; s++) {
+   totnewpoints = gp_count_subdivision_cuts(gps);
+   if (totnewpoints == 0) {
+   continue;
+   }
+   /* duplicate points in a temp area */
+   temp_points = MEM_dupallocN(gps->points);
+   oldtotpoints = gps->totpoints;
+
+   /* resize the points arrys */
+   gps->totpoints += totnewpoints;
+   gps->points = MEM_recallocN(gps->points, 
sizeof(*gps->points) * gps->totpoints);
+   gps->flag |= GP_STROKE_RECALC_CACHES;
+
+   /* loop and interpolate */
+   i2 = 0;
+   for (int i = 0; i < oldtotpoints; i++) {
+   bGPDspoint *pt = _points[i];
+   bGPDspoint *pt_final = >points[i2];
+
+   /* copy current point */
+   copy_v3_v3(_final->x, >x);
+   pt_final->pressure = pt->pressure;
+   pt_final->strength = pt->strength;
+   pt_final->time = pt->time;
+   

[Bf-blender-cvs] [b2f1b8a] master: GPencil: Add a new special menu for editing and replace subdivision shortcut

2016-09-16 Thread Antonioya
Commit: b2f1b8ab7a59907a81620a98ec5edb0d4d35ec59
Author: Antonioya
Date:   Fri Sep 16 11:48:41 2016 +0200
Branches: master
https://developer.blender.org/rBb2f1b8ab7a59907a81620a98ec5edb0d4d35ec59

GPencil: Add a new special menu for editing and replace subdivision shortcut

Replace the W shortcut for subdivision by a new menu for edit specials
in order to keep consistency in UI.

Subdivision is not used all the time, so it's better assign this
shortcut to menu.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/editors/gpencil/gpencil_ops.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 9432be3..5054125 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -651,6 +651,32 @@ class GPENCIL_MT_snap(Menu):
 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
 
 
+class GPENCIL_MT_gpencil_edit_specials(Menu):
+bl_label = "GPencil Specials"
+
+def draw(self, context):
+layout = self.layout
+is_3d_view = context.space_data.type == 'VIEW_3D'
+
+layout.operator_context = 'INVOKE_REGION_WIN'
+
+layout.operator("gpencil.stroke_subdivide", text="Subdivide")
+
+layout.separator()
+
+layout.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
+layout.operator("gpencil.stroke_join", text="Join & Copy").type = 
'JOINCOPY'
+layout.operator("gpencil.stroke_flip", text="Flip Direction")
+
+gpd = context.gpencil_data
+if gpd:
+layout.prop(gpd, "show_stroke_direction", text="Show Directions")
+
+if is_3d_view:
+layout.separator()
+layout.operator("gpencil.reproject")
+
+
 ###
 
 
diff --git a/source/blender/editors/gpencil/gpencil_ops.c 
b/source/blender/editors/gpencil/gpencil_ops.c
index 26fcfdc..98cdbad 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -242,8 +242,8 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)

WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", XKEY, 
KM_PRESS, KM_SHIFT, 0);

-   /* subdivide strokes */
-   WM_keymap_add_item(keymap, "GPENCIL_OT_stroke_subdivide", WKEY, 
KM_PRESS, 0, 0);
+   /* menu edit specials */
+   WM_keymap_add_menu(keymap, "GPENCIL_MT_gpencil_edit_specials", WKEY, 
KM_PRESS, 0, 0);
 
/* join strokes */
WM_keymap_add_item(keymap, "GPENCIL_OT_stroke_join", JKEY, KM_PRESS, 
KM_CTRL, 0);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [98af402] master: GPencil: Remove toggle option for pop-up specials menu

2016-09-16 Thread Antonioya
Commit: 98af4023574170f8cc1e3bbbdaa41282ef30446e
Author: Antonioya
Date:   Fri Sep 16 11:57:48 2016 +0200
Branches: master
https://developer.blender.org/rB98af4023574170f8cc1e3bbbdaa41282ef30446e

GPencil: Remove toggle option for pop-up specials menu

According UI rules, no toggle options in pop-ups menus, so remove it.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 5054125..feff5d4 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -668,10 +668,6 @@ class GPENCIL_MT_gpencil_edit_specials(Menu):
 layout.operator("gpencil.stroke_join", text="Join & Copy").type = 
'JOINCOPY'
 layout.operator("gpencil.stroke_flip", text="Flip Direction")
 
-gpd = context.gpencil_data
-if gpd:
-layout.prop(gpd, "show_stroke_direction", text="Show Directions")
-
 if is_3d_view:
 layout.separator()
 layout.operator("gpencil.reproject")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ac2fe83] master: Revert "GPencil: Add IFACE_ macro to some strings"

2016-09-11 Thread Antonioya
Commit: ac2fe8312bd2a609eb884ad95dd27bcbbf7f1b0e
Author: Antonioya
Date:   Sun Sep 11 13:05:29 2016 +0200
Branches: master
https://developer.blender.org/rBac2fe8312bd2a609eb884ad95dd27bcbbf7f1b0e

Revert "GPencil: Add IFACE_ macro to some strings"

This reverts commit b50a5b92c15e0f110ca978352c2ba59bc3e97dd3 because BKE_report 
functions are already automatically handled by translation system.

===

M   source/blender/editors/gpencil/gpencil_edit.c

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index c3d1048..cce22ba 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -2349,19 +2349,19 @@ static int gpencil_interpolate_invoke(bContext *C, 
wmOperator *op, const wmEvent
 
/* cannot interpolate if not between 2 frames */
if ((gpl->actframe == NULL) || (gpl->actframe->next == NULL)) {
-   BKE_report(op->reports, RPT_ERROR, IFACE_("Interpolation 
requires to be between two grease pencil frames in active layer"));
+   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames in active layer");
return OPERATOR_CANCELLED;
}
 
/* cannot interpolate in extremes */
if ((gpl->actframe->framenum == scene->r.cfra) || 
(gpl->actframe->next->framenum == scene->r.cfra)) {
-   BKE_report(op->reports, RPT_ERROR, IFACE_("Interpolation 
requires to be between two grease pencil frames in active layer"));
+   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames in active layer");
return OPERATOR_CANCELLED;
}
 
/* need editable strokes */
if (!gp_interpolate_check_todo(C, gpd)) {
-   BKE_report(op->reports, RPT_ERROR, IFACE_("Interpolation 
requires some editable stroke"));
+   BKE_report(op->reports, RPT_ERROR, "Interpolation requires some 
editable stroke");
return OPERATOR_CANCELLED;
}
 
@@ -2543,12 +2543,12 @@ static int gpencil_interpolate_seq_exec(bContext *C, 
wmOperator *op)
 
/* cannot interpolate if not between 2 frames */
if ((active_gpl->actframe == NULL) || (active_gpl->actframe->next == 
NULL)) {
-   BKE_report(op->reports, RPT_ERROR, IFACE_("Interpolation 
requires to be between two grease pencil frames"));
+   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames");
return OPERATOR_CANCELLED;
}
/* cannot interpolate in extremes */
if ((active_gpl->actframe->framenum == scene->r.cfra) || 
(active_gpl->actframe->next->framenum == scene->r.cfra)) {
-   BKE_report(op->reports, RPT_ERROR, IFACE_("Interpolation 
requires to be between two grease pencil frames"));
+   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames");
return OPERATOR_CANCELLED;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [347d759] master: GPencil: Change interpolate stroke factor

2016-09-11 Thread Antonioya
Commit: 347d759c623fe238c79a2d31827b8999d228fefe
Author: Antonioya
Date:   Sun Sep 11 12:22:30 2016 +0200
Branches: master
https://developer.blender.org/rB347d759c623fe238c79a2d31827b8999d228fefe

GPencil: Change interpolate stroke factor

Now the factor works similar to other Blender areas to make the factor
more consistent for artists. The value 0% means equal to original
stroke, 100% equal to final stroke (50% means half way). Any value below
0% or greater than 100% create an overshoot of the stroke.

===

M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/include/ED_gpencil.h

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 3d0323d..cce22ba 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -2076,6 +2076,12 @@ static void gp_interpolate_set_points(bContext *C, 
tGPDinterpolate *tgpi)
bGPDstroke *gps_from, *gps_to, *new_stroke;
int fFrame;
 
+   /* save initial factor for active layer to define shift limits */
+   tgpi->init_factor = (float)(tgpi->cframe - 
active_gpl->actframe->framenum) / (active_gpl->actframe->next->framenum - 
active_gpl->actframe->framenum + 1);
+   /* limits are 100% below 0 and 100% over the 100% */
+   tgpi->low_limit = -1.0f - tgpi->init_factor;
+   tgpi->high_limit = 2.0f - tgpi->init_factor;
+
/* set layers */
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* all layers or only active */
@@ -2099,7 +2105,7 @@ static void gp_interpolate_set_points(bContext *C, 
tGPDinterpolate *tgpi)
tgpil->interFrame = MEM_callocN(sizeof(bGPDframe), "bGPDframe");
tgpil->interFrame->framenum = tgpi->cframe;
 
-   /* get interpolation factor */
+   /* get interpolation factor by layer (usually must be equal for 
all layers, but not sure) */
tgpil->factor = (float)(tgpi->cframe - 
tgpil->prevFrame->framenum) / (tgpil->nextFrame->framenum - 
tgpil->prevFrame->framenum + 1);
/* create new strokes data with interpolated points reading 
original stroke */
for (gps_from = tgpil->prevFrame->strokes.first; gps_from; 
gps_from = gps_from->next) {
@@ -2159,13 +2165,13 @@ static void gpencil_mouse_update_shift(tGPDinterpolate 
*tgpi, wmOperator *op, co
float mid = (float)(tgpi->ar->winx - tgpi->ar->winrct.xmin) / 2.0f;
float mpos = event->x - tgpi->ar->winrct.xmin;
if (mpos >= mid) {
-   tgpi->shift = (mpos - mid) / mid;
+   tgpi->shift = ((mpos - mid) * tgpi->high_limit) / mid;
}
else {
-   tgpi->shift = -1.0f * (1.0f - (mpos / mid));
+   tgpi->shift = tgpi->low_limit - ((mpos * tgpi->low_limit) / 
mid);
}
 
-   CLAMP(tgpi->shift, -1.0f, 1.0f);
+   CLAMP(tgpi->shift, tgpi->low_limit, tgpi->high_limit);
RNA_float_set(op->ptr, "shift", tgpi->shift);
 }
 
@@ -2185,7 +2191,7 @@ static void 
gpencil_interpolate_status_indicators(tGPDinterpolate *p)
BLI_snprintf(status_str, sizeof(status_str), "%s: %s", msg_str, 
str_offs);
}
else {
-   BLI_snprintf(status_str, sizeof(status_str), "%s: %d", msg_str, 
(int)(p->shift * 100.0f));
+   BLI_snprintf(status_str, sizeof(status_str), "%s: %d %%", 
msg_str, (int)((p->init_factor + p->shift)  * 100.0f));
}
 
ED_area_headerprint(p->sa, status_str);
@@ -2343,13 +2349,13 @@ static int gpencil_interpolate_invoke(bContext *C, 
wmOperator *op, const wmEvent
 
/* cannot interpolate if not between 2 frames */
if ((gpl->actframe == NULL) || (gpl->actframe->next == NULL)) {
-   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames");
+   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames in active layer");
return OPERATOR_CANCELLED;
}
 
/* cannot interpolate in extremes */
if ((gpl->actframe->framenum == scene->r.cfra) || 
(gpl->actframe->next->framenum == scene->r.cfra)) {
-   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames");
+   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames in active layer");
return OPER

[Bf-blender-cvs] [b50a5b9] master: GPencil: Add IFACE_ macro to some strings

2016-09-11 Thread Antonioya
Commit: b50a5b92c15e0f110ca978352c2ba59bc3e97dd3
Author: Antonioya
Date:   Sun Sep 11 12:27:39 2016 +0200
Branches: master
https://developer.blender.org/rBb50a5b92c15e0f110ca978352c2ba59bc3e97dd3

GPencil: Add IFACE_ macro to some strings

===

M   source/blender/editors/gpencil/gpencil_edit.c

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index cce22ba..c3d1048 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -2349,19 +2349,19 @@ static int gpencil_interpolate_invoke(bContext *C, 
wmOperator *op, const wmEvent
 
/* cannot interpolate if not between 2 frames */
if ((gpl->actframe == NULL) || (gpl->actframe->next == NULL)) {
-   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames in active layer");
+   BKE_report(op->reports, RPT_ERROR, IFACE_("Interpolation 
requires to be between two grease pencil frames in active layer"));
return OPERATOR_CANCELLED;
}
 
/* cannot interpolate in extremes */
if ((gpl->actframe->framenum == scene->r.cfra) || 
(gpl->actframe->next->framenum == scene->r.cfra)) {
-   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames in active layer");
+   BKE_report(op->reports, RPT_ERROR, IFACE_("Interpolation 
requires to be between two grease pencil frames in active layer"));
return OPERATOR_CANCELLED;
}
 
/* need editable strokes */
if (!gp_interpolate_check_todo(C, gpd)) {
-   BKE_report(op->reports, RPT_ERROR, "Interpolation requires some 
editable stroke");
+   BKE_report(op->reports, RPT_ERROR, IFACE_("Interpolation 
requires some editable stroke"));
return OPERATOR_CANCELLED;
}
 
@@ -2543,12 +2543,12 @@ static int gpencil_interpolate_seq_exec(bContext *C, 
wmOperator *op)
 
/* cannot interpolate if not between 2 frames */
if ((active_gpl->actframe == NULL) || (active_gpl->actframe->next == 
NULL)) {
-   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames");
+   BKE_report(op->reports, RPT_ERROR, IFACE_("Interpolation 
requires to be between two grease pencil frames"));
return OPERATOR_CANCELLED;
}
/* cannot interpolate in extremes */
if ((active_gpl->actframe->framenum == scene->r.cfra) || 
(active_gpl->actframe->next->framenum == scene->r.cfra)) {
-   BKE_report(op->reports, RPT_ERROR, "Interpolation requires to 
be between two grease pencil frames");
+   BKE_report(op->reports, RPT_ERROR, IFACE_("Interpolation 
requires to be between two grease pencil frames"));
return OPERATOR_CANCELLED;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b859557] master: GPencil: Fix interpolate stroke keymap conflict with sculpt

2016-10-06 Thread Antonioya
Commit: b8595571155fc65bc9201f2152951db837b76cf3
Author: Antonioya
Date:   Thu Oct 6 22:21:10 2016 +0200
Branches: master
https://developer.blender.org/rBb8595571155fc65bc9201f2152951db837b76cf3

GPencil: Fix interpolate stroke keymap conflict with sculpt

The initial idea was to use Ctrl+E to interpolate stroke because this is
similar to Pose breakdown, but the Ctrl+E keymap is used to inverse
grease pencil sculpt effect.

The new keymap is Ctrl+Alt+E in order to fix the conflict

===

M   source/blender/editors/gpencil/gpencil_ops.c

===

diff --git a/source/blender/editors/gpencil/gpencil_ops.c 
b/source/blender/editors/gpencil/gpencil_ops.c
index 98cdbad..057d53e 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -144,7 +144,7 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
RNA_string_set(kmi->ptr, "data_path_primary", 
"user_preferences.edit.grease_pencil_eraser_radius");

/* Interpolation */
-   WM_keymap_add_item(keymap, "GPENCIL_OT_interpolate", EKEY, KM_PRESS, 
KM_CTRL, 0);
+   WM_keymap_add_item(keymap, "GPENCIL_OT_interpolate", EKEY, KM_PRESS, 
KM_CTRL | KM_ALT, 0);
WM_keymap_add_item(keymap, "GPENCIL_OT_interpolate_sequence", EKEY, 
KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 
/* Sculpting - */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [09925d5] master: Fix T49383: Color pickers are available if the color is locked

2016-09-17 Thread Antonioya
Commit: 09925d52f5867dbe91dc867e404e248c9a92295a
Author: Antonioya
Date:   Sat Sep 17 09:01:09 2016 +0200
Branches: master
https://developer.blender.org/rB09925d52f5867dbe91dc867e404e248c9a92295a

Fix T49383: Color pickers are available if the color is locked

If the color is locked, the row is disabled, but the picker is still
available.

This error was present in older versions for layer color.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index feff5d4..04931b7 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -491,6 +491,7 @@ class GPENCIL_PIE_settings_palette(Menu):
 # W - Stroke draw settings
 col = pie.column(align=True)
 if palcolor is not None:
+col.enabled = not palcolor.lock
 col.label(text="Stroke")
 col.prop(palcolor, "color", text="")
 col.prop(palcolor, "alpha", text="", slider=True)
@@ -498,6 +499,7 @@ class GPENCIL_PIE_settings_palette(Menu):
 # E - Fill draw settings
 col = pie.column(align=True)
 if palcolor is not None:
+col.enabled = not palcolor.lock
 col.label(text="Fill")
 col.prop(palcolor, "fill_color", text="")
 col.prop(palcolor, "fill_alpha", text="", slider=True)
@@ -700,6 +702,7 @@ class GPENCIL_UL_palettecolor(UIList):
 
 split = layout.split(percentage=0.25)
 row = split.row(align=True)
+row.enabled = not palcolor.lock
 row.prop(palcolor, "color", text="", 
emboss=palcolor.is_stroke_visible)
 row.prop(palcolor, "fill_color", text="", 
emboss=palcolor.is_fill_visible)
 split.prop(palcolor, "name", text="", emboss=False)
@@ -888,6 +891,7 @@ class GreasePencilDataPanel:
 col = split.column()
 subcol = col.column(align=True)
 subcol.label("Tint")
+subcol.enabled = not gpl.lock
 subcol.prop(gpl, "tint_color", text="")
 subcol.prop(gpl, "tint_factor", text="Factor", slider=True)
 
@@ -1025,14 +1029,14 @@ class GreasePencilPaletteColorPanel:
 
 # Column 1 - Stroke
 col = split.column(align=True)
-col.active = not pcolor.lock
+col.enabled = not pcolor.lock
 col.label(text="Stroke:")
 col.prop(pcolor, "color", text="")
 col.prop(pcolor, "alpha", slider=True)
 
 # Column 2 - Fill
 col = split.column(align=True)
-col.active = not pcolor.lock
+col.enabled = not pcolor.lock
 col.label(text="Fill:")
 col.prop(pcolor, "fill_color", text="")
 col.prop(pcolor, "fill_alpha", text="Opacity", slider=True)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e392658] master: Fix T49100: Replace old tooltip for GPencil brush iterations

2016-08-17 Thread Antonioya
Commit: e392658405f3f768ec90e2bbe60b944b0c791bc7
Author: Antonioya
Date:   Wed Aug 17 09:11:58 2016 +0200
Branches: master
https://developer.blender.org/rBe392658405f3f768ec90e2bbe60b944b0c791bc7

Fix T49100: Replace old tooltip for GPencil brush iterations

===

M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 200f464..a3b1334 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2188,8 +2188,7 @@ static void rna_def_gpencil_brush(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "draw_smoothlvl");
RNA_def_property_range(prop, 1, 3);
RNA_def_property_ui_text(prop, "Iterations",
-"Number of times to smooth newly created 
strokes "
-"[+ reason/effect of using higher values of 
this property]");
+"Number of times to smooth newly created 
strokes");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
/* Subdivision level for new strokes */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [34928ca] master: GPencil: Change ruler line thickness to make it thicker

2016-08-17 Thread Antonioya
Commit: 34928ca98aba6706a1126c60b4b02c5d39f7e53c
Author: Antonioya
Date:   Wed Aug 17 09:04:50 2016 +0200
Branches: master
https://developer.blender.org/rB34928ca98aba6706a1126c60b4b02c5d39f7e53c

GPencil: Change ruler line thickness to make it thicker

===

M   source/blender/editors/space_view3d/view3d_ruler.c

===

diff --git a/source/blender/editors/space_view3d/view3d_ruler.c 
b/source/blender/editors/space_view3d/view3d_ruler.c
index dda1a64..67a40ae 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -355,6 +355,7 @@ static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo 
*ruler_info)
}
}
gps->flag = GP_STROKE_3DSPACE;
+   gps->thickness = 3;
/* assign color to stroke */
strcpy(gps->colorname, palcolor->info);
gps->palcolor = palcolor;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2a63622] master: GPencil: Cleanup change color operator

2016-08-27 Thread Antonioya
Commit: 2a6362255d8d0e1c5fd2c20495a76ceddaa8dbc8
Author: Antonioya
Date:   Sat Aug 27 12:52:30 2016 +0200
Branches: master
https://developer.blender.org/rB2a6362255d8d0e1c5fd2c20495a76ceddaa8dbc8

GPencil: Cleanup change color operator

It is faster to assign the color to the pointer instead to force the new
lookup in drawing function.

===

M   source/blender/editors/gpencil/gpencil_data.c

===

diff --git a/source/blender/editors/gpencil/gpencil_data.c 
b/source/blender/editors/gpencil/gpencil_data.c
index 83dc0b6..9560ab1 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -879,9 +879,9 @@ static int gp_stroke_change_color_exec(bContext *C, 
wmOperator *UNUSED(op))
continue;
 
/* asign new color (only if different) 
*/
-   if (STREQ(gps->colorname, color->info) 
== false) {
+   if ((STREQ(gps->colorname, color->info) 
== false) || (gps->palcolor != color)) {
BLI_strncpy(gps->colorname, 
color->info, sizeof(gps->colorname));
-   gps->flag |= 
GP_STROKE_RECALC_COLOR;
+   gps->palcolor = color;
}
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f23db59] blender2.8: GPencil: Display stroke filling while drawing

2016-10-14 Thread Antonioya
Commit: f23db59e48024a6f89b80ff5c2fc36dc45694fc3
Author: Antonioya
Date:   Fri Oct 14 12:02:49 2016 +0200
Branches: blender2.8
https://developer.blender.org/rBf23db59e48024a6f89b80ff5c2fc36dc45694fc3

GPencil: Display stroke filling while drawing

Before this change, the stroke was filled only after complete the stroke 
drawing. For artist is better to get a feedback of the area he is filling while 
drawing, so this commit draws the filling area while drawing.

The triangulation of the stroke is recalculated every time the function is 
called because using a cache is not useful because the points information is 
changing all the time while the stroke is being drawing.

===

M   source/blender/editors/gpencil/drawgpencil.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/makesdna/DNA_gpencil_types.h

===

diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index 8e62066..5564cab 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -123,9 +123,72 @@ static void gp_set_point_varying_color(const bGPDspoint 
*pt, const float ink[4],
immAttrib4ub(attrib_id, F2UB(ink[0]), F2UB(ink[1]), F2UB(ink[2]), 
F2UB(alpha));
 }
 
+/* draw fills for buffer stroke */
+static void gp_draw_stroke_buffer_fill(tGPspoint *points, int totpoints, float 
ink[4])
+{
+   if (totpoints < 3) {
+   return;
+   }
+   int tot_triangles = totpoints - 2;
+   /* allocate memory for temporary areas */
+   unsigned int(*tmp_triangles)[3] = MEM_mallocN(sizeof(*tmp_triangles) * 
tot_triangles, "GP Stroke buffer temp triangulation");
+   float(*points2d)[2] = MEM_mallocN(sizeof(*points2d) * totpoints, "GP 
Stroke buffer temp 2d points");
+
+   /* Convert points to array and triangulate
+   * Here a cache is not used because while drawing the information 
changes all the time, so the cache
+   * would be recalculated constantly, so it is better to do direct 
calculation for each function call
+   */
+   for (int i = 0; i < totpoints; i++) {
+   const tGPspoint *pt = [i];
+   points2d[i][0] = pt->x;
+   points2d[i][1] = pt->y;
+   }
+   BLI_polyfill_calc((const float(*)[2])points2d, (unsigned int)totpoints, 
0, (unsigned int(*)[3])tmp_triangles);
+
+   /* draw triangulation data */
+   if (tot_triangles > 0) {
+   VertexFormat *format = immVertexFormat();
+   unsigned pos = add_attrib(format, "pos", GL_INT, 2, 
CONVERT_INT_TO_FLOAT);
+   unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 
4, NORMALIZE_INT_TO_FLOAT);
+
+   immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
+
+   /* Draw all triangles for filling the polygon */
+   immBegin(GL_TRIANGLES, tot_triangles * 3);
+   /* TODO: use batch instead of immediate mode, to share vertices 
*/
+
+   tGPspoint *pt;
+   for (int i = 0; i < tot_triangles; i++) {
+   /* vertex 1 */
+   pt = [tmp_triangles[i][0]];
+   gp_set_tpoint_varying_color(pt, ink, color);
+   immVertex2iv(pos, >x);
+   /* vertex 2 */
+   pt = [tmp_triangles[i][1]];
+   gp_set_tpoint_varying_color(pt, ink, color);
+   immVertex2iv(pos, >x);
+   /* vertex 3 */
+   pt = [tmp_triangles[i][2]];
+   gp_set_tpoint_varying_color(pt, ink, color);
+   immVertex2iv(pos, >x);
+   }
+
+   immEnd();
+   immUnbindProgram();
+   }
+
+   /* clear memory */
+   if (tmp_triangles) {
+   MEM_freeN(tmp_triangles);
+   }
+   if (points2d) {
+   MEM_freeN(points2d);
+   }
+}
+
 /* draw stroke defined in buffer (simple ogl lines/points for now, as dotted 
lines) */
 static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, 
short thickness,
-  short dflag, short sflag, float ink[4])
+  short dflag, short sflag, float ink[4], 
float fill_ink[4])
 {
/* error checking */
if ((points == NULL) || (totpoints <= 0))
@@ -194,6 +257,11 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, 
int totpoints, short
 
immEnd();
immUnbindProgram();
+
+   // draw fill
+   if (fill_ink[3] > GPENCIL_ALPHA_OPACITY_THRESH) {
+   gp_draw_stroke_buffer_fill(points, totpoints, fill_ink);
+   }
 }
 
 /* - 2D Stroke Drawing H

[Bf-blender-cvs] [5765dee] master: GPencil: New option to lock strokes to axis

2016-10-22 Thread Antonioya
Commit: 5765deecd42eedda780b88ed7448e4b1c185d0d8
Author: Antonioya
Date:   Sat Oct 22 16:44:11 2016 +0200
Branches: master
https://developer.blender.org/rB5765deecd42eedda780b88ed7448e4b1c185d0d8

GPencil: New option to lock strokes to axis

Now, the strokes can be locked to a plane set in the cursor location.
This option allow the artist to rotate the view and draw keeping the
strokes flat over the surface. This option is similar to surface option
but doesn't need a object.

The option is only valid for 3D view and strokes in CURSOR mode.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_sculpt_paint.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 84442f9..bc40932 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -52,6 +52,12 @@ def gpencil_stroke_placement_settings(context, layout):
 row.active = getattr(ts, propname) in {'SURFACE', 'STROKE'}
 row.prop(ts, "use_gpencil_stroke_endpoints")
 
+if context.scene.tool_settings.gpencil_stroke_placement_view3d == 
'CURSOR':
+row = col.row(align=True)
+row.label("Lock axis:")
+row = col.row(align=True)
+row.prop(ts.gpencil_sculpt, "lockaxis", expand=True)
+
 
 def gpencil_active_brush_settings_simple(context, layout):
 brush = context.active_gpencil_brush
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index cc45cbd..c23bfb1 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -40,6 +40,7 @@
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_rand.h"
+#include "BLI_math_geom.h"
 
 #include "BLT_translation.h"
 
@@ -160,6 +161,7 @@ typedef struct tGPsdata {
bGPDpalettecolor *palettecolor; /* current palette color */
bGPDbrush *brush; /* current drawing brush */
short straight[2];   /* 1: line horizontal, 2: line vertical, other: 
not defined, second element position */
+   int lock_axis;   /* lock drawing to one axis */
 } tGPsdata;
 
 /* -- */
@@ -278,6 +280,64 @@ static bool gp_stroke_filtermval(tGPsdata *p, const int 
mval[2], int pmval[2])
return false;
 }
 
+/* reproject the points of the stroke to a plane locked to axis to avoid 
stroke offset */
+static void gp_project_points_to_plane(RegionView3D *rv3d, bGPDstroke *gps, 
const float origin[3], const int axis)
+{
+   float plane_normal[3];
+   float vn[3];
+
+   float ray[3];
+   float rpoint[3];
+
+   /* normal vector for a plane locked to axis */
+   zero_v3(plane_normal);
+   plane_normal[axis] = 1.0f;
+
+   /* Reproject the points in the plane */
+   for (int i = 0; i < gps->totpoints; i++) {
+   bGPDspoint *pt = >points[i];
+
+   /* get a vector from the point with the current view direction 
of the viewport */
+   ED_view3d_global_to_vector(rv3d, >x, vn);
+
+   /* calculate line extrem point to create a ray that cross the 
plane */
+   mul_v3_fl(vn, -50.0f);
+   add_v3_v3v3(ray, >x, vn);
+
+   /* if the line never intersect, the point is not changed */
+   if (isect_line_plane_v3(rpoint, >x, ray, origin, 
plane_normal)) {
+   copy_v3_v3(>x, rpoint);
+   }
+   }
+}
+
+/* reproject stroke to plane locked to axis in 3d cursor location */
+static void gp_reproject_toplane(tGPsdata *p, bGPDstroke *gps)
+{
+   bGPdata *gpd = p->gpd;
+   float origin[3];
+   float cursor[3];
+   RegionView3D *rv3d = p->ar->regiondata;
+
+   /* verify the stroke mode is CURSOR 3d space mode */
+   if ((gpd->sbuffer_sflag & GP_STROKE_3DSPACE) == 0) {
+   return;
+   }
+   if ((*p->align_flag & GP_PROJECT_VIEWSPACE) == 0) {
+   return;
+   }
+   if ((*p->align_flag & GP_PROJECT_DEPTH_VIEW) || (*p->align_flag & 
GP_PROJECT_DEPTH_STROKE)) {
+   return;
+   }
+
+   /* get 3d cursor and set origin for locked axis only. Uses axis-1 
because the enum for XYZ start with 1 */
+   gp_get_3d_reference(p, cursor);
+   zero_v3(origin);
+   origin[p->lock_axis - 1] = cursor[p->lock_axis - 1];
+
+   gp_project_points_to_plane(rv3d, gps, origin, p->lock_axis - 1

[Bf-blender-cvs] [cdeaec3] master: GPencil: Create brush set when create new datablock or layer

2016-11-11 Thread Antonioya
Commit: cdeaec3b0d151e020f532e0b2cc46742b41a379f
Author: Antonioya
Date:   Fri Nov 11 20:04:30 2016 +0100
Branches: master
https://developer.blender.org/rBcdeaec3b0d151e020f532e0b2cc46742b41a379f

GPencil: Create brush set when create new datablock or layer

Before this commit, the brush set was created with the first stroke
drawing, but if the user creates the datablock or the layer manually
(not drawing) the brush list was empty.

This commit complement the python fix by Sergey:
https://developer.blender.org/rB89c1f9db37cc1becdd437fcfdb1877306cc2b329

===

M   source/blender/editors/gpencil/gpencil_data.c

===

diff --git a/source/blender/editors/gpencil/gpencil_data.c 
b/source/blender/editors/gpencil/gpencil_data.c
index 7dcbe2c..ae83e89 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -84,7 +84,8 @@
 static int gp_data_add_exec(bContext *C, wmOperator *op)
 {
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
-   
+   ToolSettings *ts = CTX_data_tool_settings(C);
+
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil 
data to go");
return OPERATOR_CANCELLED;
@@ -95,6 +96,15 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)

id_us_min(>id);
*gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil"));
+
+   /* if not exist brushes, create a new set */
+   if (ts) {
+   if (BLI_listbase_is_empty(>gp_brushes)) {
+   /* create new brushes */
+   BKE_gpencil_brush_init_presets(ts);
+   }
+   }
+
}

/* notifiers */
@@ -174,7 +184,8 @@ void GPENCIL_OT_data_unlink(wmOperatorType *ot)
 static int gp_layer_add_exec(bContext *C, wmOperator *op)
 {
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
-   
+   ToolSettings *ts = CTX_data_tool_settings(C);
+
/* if there's no existing Grease-Pencil data there, add some */
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil 
data to go");
@@ -183,6 +194,14 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op)
if (*gpd_ptr == NULL)
*gpd_ptr = BKE_gpencil_data_addnew(DATA_("GPencil"));

+   /* if not exist brushes, create a new set */
+   if (ts) {
+   if (BLI_listbase_is_empty(>gp_brushes)) {
+   /* create new brushes */
+   BKE_gpencil_brush_init_presets(ts);
+   }
+   }
+
/* add new layer now */
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e400f4a] master: Fix T50051: Avoid crash when render grease pencil from VSE

2016-11-16 Thread Antonioya
Commit: e400f4a53ec435b8c93c309896e63393c5b70bf3
Author: Antonioya
Date:   Wed Nov 16 21:33:47 2016 +0100
Branches: master
https://developer.blender.org/rBe400f4a53ec435b8c93c309896e63393c5b70bf3

Fix T50051: Avoid crash when render grease pencil from VSE

The renderpasses for grease pencil are not necessary when render from
sequencer.

This fix solves the GPF but we need to rethink the complete render
process for grease pencil and integrate better in the render and
composition workflow.

Thanks to Dalai Felinto por helping in the debug and fixing of the
problem.

===

M   source/blender/editors/render/render_opengl.c

===

diff --git a/source/blender/editors/render/render_opengl.c 
b/source/blender/editors/render/render_opengl.c
index 16842ef..9097432 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -552,8 +552,11 @@ static void screen_opengl_render_apply(OGLRender 
*oglrender)
BLI_assert(view_id < oglrender->views_len);
RE_SetActiveRenderView(oglrender->re, rv->name);
oglrender->view_id = view_id;
-   /* add grease pencil passes */
-   add_gpencil_renderpass(oglrender, rr, rv);
+   /* add grease pencil passes. For sequencer, the render does not 
include renderpasses
+* TODO: The sequencer render of grease pencil should be 
rethought */
+   if (!oglrender->is_sequencer) {
+   add_gpencil_renderpass(oglrender, rr, rv);
+   }
/* render composite */
screen_opengl_render_doit(oglrender, rr);
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [674c3bf] master: Fix T49996: VSE opengl render crash with grease pencil if current frame is empty

2016-11-11 Thread Antonioya
Commit: 674c3bf89480a3278b3637d1dcfe37532f00711e
Author: Antonioya
Date:   Fri Nov 11 22:27:10 2016 +0100
Branches: master
https://developer.blender.org/rB674c3bf89480a3278b3637d1dcfe37532f00711e

Fix T49996: VSE  opengl render crash with grease pencil if current frame is 
empty

If the opengl render with grease pencil is run from VSE with the current
frame outside visible frames, the render pass is wrong and the render
must be canceled because nothing to render. Related to #T49975

===

M   source/blender/editors/render/render_opengl.c

===

diff --git a/source/blender/editors/render/render_opengl.c 
b/source/blender/editors/render/render_opengl.c
index ea53c87..16842ef 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -485,23 +485,24 @@ static void add_gpencil_renderpass(OGLRender *oglrender, 
RenderResult *rr, Rende
/* copy image data from rectf */
// XXX: Needs conversion.
unsigned char *src = (unsigned char *)RE_RenderViewGetById(rr, 
oglrender->view_id)->rect32;
-   float *dest = rp->rect;
-
-   int x, y, rectx, recty;
-   rectx = rr->rectx;
-   recty = rr->recty;
-   for (y = 0; y < recty; y++) {
-   for (x = 0; x < rectx; x++) {
-   unsigned char *pixSrc = src + 4 * (rectx * y + 
x);
-   if (pixSrc[3] > 0) {
-   float *pixDest = dest + 4 * (rectx * y 
+ x);
-   float float_src[4];
-   srgb_to_linearrgb_uchar4(float_src, 
pixSrc);
-   addAlphaOverFloat(pixDest, float_src);
+   if (src != NULL) {
+   float *dest = rp->rect;
+
+   int x, y, rectx, recty;
+   rectx = rr->rectx;
+   recty = rr->recty;
+   for (y = 0; y < recty; y++) {
+   for (x = 0; x < rectx; x++) {
+   unsigned char *pixSrc = src + 4 * 
(rectx * y + x);
+   if (pixSrc[3] > 0) {
+   float *pixDest = dest + 4 * 
(rectx * y + x);
+   float float_src[4];
+   
srgb_to_linearrgb_uchar4(float_src, pixSrc);
+   addAlphaOverFloat(pixDest, 
float_src);
+   }
}
}
}
-
/* back layer status */
i = 0;
for (bGPDlayer *gph = gpd->layers.first; gph; gph = gph->next) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dd82d70] master: Fix T50081: Grease pencil parented rotation problem

2016-11-19 Thread Antonioya
Commit: dd82d70bc5eade56d20ef81eb81ba43463da
Author: Antonioya
Date:   Sat Nov 19 22:41:37 2016 +0100
Branches: master
https://developer.blender.org/rBdd82d70bc5eade56d20ef81eb81ba43463da

Fix T50081: Grease pencil parented rotation problem

When the parent object matrix change after the layer was parented, the
inverse matrix for strokes must be updated when editing strokes or the
transformations will be wrong.

===

M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/include/ED_gpencil.h

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 12d837d..15f65b3 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -96,7 +96,11 @@ static int gpencil_editmode_toggle_exec(bContext *C, 
wmOperator *UNUSED(op))

/* Just toggle editmode flag... */
gpd->flag ^= GP_DATA_STROKE_EDITMODE;
-   
+   /* recalculate parent matrix */
+   if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
+   ED_gpencil_reset_layers_parent(gpd);
+   }
+
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, 
NULL);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);

diff --git a/source/blender/editors/gpencil/gpencil_utils.c 
b/source/blender/editors/gpencil/gpencil_utils.c
index 564ba63..8073b13 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -997,6 +997,46 @@ void ED_gpencil_parent_location(bGPDlayer *gpl, float 
diff_mat[4][4])
}
 }
 
+/* reset parent matrix for all layers */
+void ED_gpencil_reset_layers_parent(bGPdata *gpd)
+{
+   bGPDspoint *pt;
+   int i;
+   float diff_mat[4][4];
+   float cur_mat[4][4];
+
+   for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+   if (gpl->parent != NULL) {
+   /* calculate new matrix */
+   if ((gpl->partype == PAROBJECT) || (gpl->partype == 
PARSKEL)) {
+   invert_m4_m4(cur_mat, gpl->parent->obmat);
+   }
+   else if (gpl->partype == PARBONE) {
+   bPoseChannel *pchan = 
BKE_pose_channel_find_name(gpl->parent->pose, gpl->parsubstr);
+   if (pchan) {
+   float tmp_mat[4][4];
+   mul_m4_m4m4(tmp_mat, 
gpl->parent->obmat, pchan->pose_mat);
+   invert_m4_m4(cur_mat, tmp_mat);
+   }
+   }
+
+   /* only redo if any change */
+   if (!equals_m4m4(gpl->inverse, cur_mat)) {
+   /* first apply current transformation to all 
strokes */
+   ED_gpencil_parent_location(gpl, diff_mat);
+   for (bGPDframe *gpf = gpl->frames.first; gpf; 
gpf = gpf->next) {
+   for (bGPDstroke *gps = 
gpf->strokes.first; gps; gps = gps->next) {
+   for (i = 0, pt = gps->points; i 
< gps->totpoints; i++, pt++) {
+   mul_m4_v3(diff_mat, 
>x);
+   }
+   }
+   }
+   /* set new parent matrix */
+   copy_m4_m4(gpl->inverse, cur_mat);
+   }
+   }
+   }
+}
 /*  */
 bool ED_gpencil_stroke_minmax(
 const bGPDstroke *gps, const bool use_select,
diff --git a/source/blender/editors/include/ED_gpencil.h 
b/source/blender/editors/include/ED_gpencil.h
index bc93b56..74d9ad0 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -185,6 +185,8 @@ int ED_undo_gpencil_step(struct bContext *C, int step, 
const char *name);
 
 /* get difference matrix using parent */
 void ED_gpencil_parent_location(struct bGPDlayer *gpl, float diff_mat[4][4]);
+/* reset parent matrix for all layers */
+void ED_gpencil_reset_layers_parent(struct bGPdata *gpd);
 
 
 #endif /*  __ED_GPENCIL_H__ */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dd350c0] blender2.8: GPencil: Avoid assert error if the immEnd is called with only one point for lines

2016-10-14 Thread Antonioya
Commit: dd350c0b37052c0dfb2436fc671cdaf57e065c13
Author: Antonioya
Date:   Fri Oct 14 19:24:27 2016 +0200
Branches: blender2.8
https://developer.blender.org/rBdd350c0b37052c0dfb2436fc671cdaf57e065c13

GPencil: Avoid assert error if the immEnd is called with only one point for 
lines

This function will be replace by geometry shader, but we need this fix until 
the shader will be ready. The problem is similar to T49614.

===

M   source/blender/editors/gpencil/drawgpencil.c

===

diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index 5b886f2..dd2f6d0 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -190,6 +190,8 @@ static void gp_draw_stroke_buffer_fill(tGPspoint *points, 
int totpoints, float i
 static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, 
short thickness,
   short dflag, short sflag, float ink[4], 
float fill_ink[4])
 {
+   int draw_points = 0;
+
/* error checking */
if ((points == NULL) || (totpoints <= 0))
return;
@@ -234,7 +236,15 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, 
int totpoints, short
 * and continue drawing again (since line-width cannot 
change in middle of GL_LINE_STRIP)
 */
if (fabsf(pt->pressure - oldpressure) > 0.2f) {
+   /* need to have 2 points to avoid immEnd assert 
error */
+   if (draw_points < 2) {
+   gp_set_tpoint_varying_color(pt - 1, 
ink, color);
+   immVertex2iv(pos, &(pt - 1)->x);
+   }
+
immEnd();
+   draw_points = 0;
+
glLineWidth(max_ff(pt->pressure * thickness, 
1.0f));
immBeginAtMost(GL_LINE_STRIP, totpoints - i + 
1);
 
@@ -242,6 +252,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, 
int totpoints, short
if (i != 0) { 
gp_set_tpoint_varying_color(pt - 1, 
ink, color);
immVertex2iv(pos, &(pt - 1)->x);
+   ++draw_points;
}
 
oldpressure = pt->pressure; /* reset our 
threshold */
@@ -250,6 +261,12 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, 
int totpoints, short
/* now the point we want */
gp_set_tpoint_varying_color(pt, ink, color);
immVertex2iv(pos, >x);
+   ++draw_points;
+   }
+   /* need to have 2 points to avoid immEnd assert error */
+   if (draw_points < 2) {
+   gp_set_tpoint_varying_color(pt - 1, ink, color);
+   immVertex2iv(pos, &(pt - 1)->x);
}
 
if (G.debug & G_DEBUG) setlinestyle(0);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6855ba4] blender2.8: Fix T49614: Grease Pencil GPF error if stroke thickness change too much between stroke points

2016-10-14 Thread Antonioya
Commit: 6855ba4034158b916122b1d881b3f53c5d1b3eb6
Author: Antonioya
Date:   Fri Oct 14 18:35:01 2016 +0200
Branches: blender2.8
https://developer.blender.org/rB6855ba4034158b916122b1d881b3f53c5d1b3eb6

Fix T49614: Grease Pencil GPF error if stroke thickness change too much between 
stroke points

The problem was the function tried to draw a line with one point only. This fix 
will be replaced by new geometry shaders, but we need while this change is not 
ready.

===

M   source/blender/editors/gpencil/drawgpencil.c

===

diff --git a/source/blender/editors/gpencil/drawgpencil.c 
b/source/blender/editors/gpencil/drawgpencil.c
index 5564cab..5b886f2 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -642,6 +642,14 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, 
int totpoints, short thi
float curpressure = points[0].pressure;
float fpt[3];
float cyclic_fpt[3];
+   int draw_points = 0;
+
+   /* if cyclic needs one vertex more */
+   int cyclic_add = 0;
+   if (cyclic) {
+   ++cyclic_add;
+   }
+
 
VertexFormat *format = immVertexFormat();
unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
@@ -653,7 +661,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int 
totpoints, short thi
 
/* draw stroke curve */
glLineWidth(max_ff(curpressure * thickness, 1.0f));
-   immBeginAtMost(GL_LINE_STRIP, totpoints);
+   immBeginAtMost(GL_LINE_STRIP, totpoints + cyclic_add);
const bGPDspoint *pt = points;
for (int i = 0; i < totpoints; i++, pt++) {
gp_set_point_varying_color(pt, ink, color);
@@ -663,22 +671,33 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, 
int totpoints, short thi
 * Note: we want more visible levels of pressures when 
thickness is bigger.
 */
if (fabsf(pt->pressure - curpressure) > 0.2f / 
(float)thickness) {
+   /* if the pressure changes before get at least 2 
vertices, need to repeat last point to avoid assert in immEnd() */
+   if (draw_points < 2) {
+   const bGPDspoint *pt2 = pt - 1;
+   mul_v3_m4v3(fpt, diff_mat, >x);
+   immVertex3fv(pos, fpt);
+   }
immEnd();
+   draw_points = 0;
+
curpressure = pt->pressure;
glLineWidth(max_ff(curpressure * thickness, 1.0f));
-   immBeginAtMost(GL_LINE_STRIP, totpoints - i + 1);
+   immBeginAtMost(GL_LINE_STRIP, totpoints - i + 1 + 
cyclic_add);
 
/* need to roll-back one point to ensure that there are 
no gaps in the stroke */
if (i != 0) { 
const bGPDspoint *pt2 = pt - 1;
mul_v3_m4v3(fpt, diff_mat, >x);
+   gp_set_point_varying_color(pt2, ink, color);
immVertex3fv(pos, fpt);
+   ++draw_points;
}
}
 
/* now the point we want */
mul_v3_m4v3(fpt, diff_mat, >x);
immVertex3fv(pos, fpt);
+   ++draw_points;
 
if (cyclic && i == 0) {
/* save first point to use in cyclic */
@@ -689,6 +708,15 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, 
int totpoints, short thi
if (cyclic) {
/* draw line to first point to complete the cycle */
immVertex3fv(pos, cyclic_fpt);
+   ++draw_points;
+   }
+
+   /* if less of two points, need to repeat last point to avoid assert in 
immEnd() */
+   if (draw_points < 2) {
+   const bGPDspoint *pt2 = pt - 1;
+   mul_v3_m4v3(fpt, diff_mat, >x);
+   gp_set_point_varying_color(pt2, ink, color);
+   immVertex3fv(pos, fpt);
}
 
immEnd();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f64df0e102] blender2.8: Fix error moving keyframes in graph editor after refactor base

2017-03-01 Thread Antonioya
Commit: f64df0e1024c2447ad449d0bf63def871ee47925
Author: Antonioya
Date:   Wed Mar 1 13:08:15 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBf64df0e1024c2447ad449d0bf63def871ee47925

Fix error moving keyframes in graph editor after refactor base

===

M   source/blender/editors/transform/transform_generics.c

===

diff --git a/source/blender/editors/transform/transform_generics.c 
b/source/blender/editors/transform/transform_generics.c
index 343cae39db..f56d810eed 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -375,6 +375,7 @@ static void recalcData_graphedit(TransInfo *t)
/* initialize relevant anim-context 'context' data from TransInfo data 
*/
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
ac.scene = t->scene;
+   ac.scene_layer = t->sl;
ac.obact = OBACT_NEW;
ac.sa = t->sa;
ac.ar = t->ar;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1a478609699] greasepencil-object: Cleanup compiler warnings

2017-06-06 Thread Antonioya
Commit: 1a478609699fc2deac5a6804956346d0d9ae2866
Author: Antonioya
Date:   Mon Jun 5 15:44:54 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB1a478609699fc2deac5a6804956346d0d9ae2866

Cleanup compiler warnings

===

M   source/blender/editors/gpencil/gpencil_ops.c

===

diff --git a/source/blender/editors/gpencil/gpencil_ops.c 
b/source/blender/editors/gpencil/gpencil_ops.c
index f44a3f107f9..fdbf935bff6 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -147,6 +147,8 @@ static int gp_stroke_sculptmode_poll(bContext *C)
return (gpd && (gpd->flag & GP_DATA_STROKE_SCULPTMODE));
}
}
+
+   return 0;
 }
 
 static void ed_keymap_gpencil_selection(wmKeyMap *keymap)
@@ -408,7 +410,6 @@ static void ed_keymap_gpencil_painting(wmKeyConfig *keyconf)
 static void ed_keymap_gpencil_sculpting(wmKeyConfig *keyconf)
 {
wmKeyMap *keymap = WM_keymap_find(keyconf, "Grease Pencil Stroke Sculpt 
Mode", 0, 0);
-   wmKeyMapItem *kmi;
 
/* set poll callback - so that this keymap only gets enabled when 
stroke sculptmode is enabled */
keymap->poll = gp_stroke_sculptmode_poll;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [773f9f19d89] greasepencil-object: UI: Disable Onion filter at Layer level

2017-09-16 Thread Antonioya
Commit: 773f9f19d899e87587f782351efb242f7b8eea2a
Author: Antonioya
Date:   Sat Sep 16 19:39:03 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB773f9f19d899e87587f782351efb242f7b8eea2a

UI: Disable Onion filter at Layer level

If main switch is disabled, thios column must be disabled too.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 6751d96cc9a..56e668ebdb3 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -928,6 +928,7 @@ class GPENCIL_UL_layer(UIList):
 def draw_item(self, context, layout, data, item, icon, active_data, 
active_propname, index):
 # assert(isinstance(item, bpy.types.GPencilLayer)
 gpl = item
+gpd = context.gpencil_data
 
 if self.layout_type in {'DEFAULT', 'COMPACT'}:
 if gpl.lock:
@@ -950,7 +951,9 @@ class GPENCIL_UL_layer(UIList):
 icon = 'GHOST_DISABLED'
 else:
 icon = 'GHOST_ENABLED'
-row.prop(gpl, "use_onion_skinning", text="", icon=icon, 
emboss=False)
+subrow = row.row(align=True)
+subrow.prop(gpl, "use_onion_skinning", text="", icon=icon, 
emboss=False)
+subrow.active = gpd.use_onion_skinning
 elif self.layout_type == 'GRID':
 layout.alignment = 'CENTER'
 layout.label(text="", icon_value=icon)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [478c1ebb23e] greasepencil-object: Cleanup: Reformat code

2018-05-22 Thread Antonioya
Commit: 478c1ebb23e76179869585025a542e35c5d43783
Author: Antonioya
Date:   Tue May 22 19:35:15 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB478c1ebb23e76179869585025a542e35c5d43783

Cleanup: Reformat code

===

M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index f66c48049b6..d9ffe12051b 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -2030,21 +2030,21 @@ typedef enum eGPencil_Flags {
/* When creating new frames, the last frame gets used as the basis for 
the new one */
GP_TOOL_FLAG_RETAIN_LAST= (1 << 1),
/* Add the strokes below all strokes in the layer */
-   GP_TOOL_FLAG_PAINT_ONBACK = (1 << 2),
+   GP_TOOL_FLAG_PAINT_ONBACK   = (1 << 2),
 } eGPencil_Flags;
 
 /* scene->r.simplify_gpencil */
 typedef enum eGPencil_SimplifyFlags {
/* Simplify */
-   SIMPLIFY_GPENCIL_ENABLE = (1 << 0),
+   SIMPLIFY_GPENCIL_ENABLE   = (1 << 0),
/* Simplify on play */
-   SIMPLIFY_GPENCIL_ON_PLAY = (1 << 1),
+   SIMPLIFY_GPENCIL_ON_PLAY  = (1 << 1),
/* Simplify fill on viewport */
-   SIMPLIFY_GPENCIL_FILL = (1 << 2),
+   SIMPLIFY_GPENCIL_FILL = (1 << 2),
/* Simplify modifier on viewport */
-   SIMPLIFY_GPENCIL_MODIFIER = (1 << 3),
+   SIMPLIFY_GPENCIL_MODIFIER = (1 << 3),
/* Remove fill external line */
-   SIMPLIFY_GPENCIL_REMOVE_FILL_LINE = (1 << 8),
+   SIMPLIFY_GPENCIL_REMOVE_FILL_LINE = (1 << 4)
 } eGPencil_SimplifyFlags;
 
 /* ToolSettings.gpencil_*_align - Stroke Placement mode flags */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9301a752609] temp-greasepencil-object-stacksplit: Add missing declarations

2018-06-16 Thread Antonioya
Commit: 9301a752609f3610bbd92190cbeaaec111a224c9
Author: Antonioya
Date:   Sat Jun 16 09:54:34 2018 +0200
Branches: temp-greasepencil-object-stacksplit
https://developer.blender.org/rB9301a752609f3610bbd92190cbeaaec111a224c9

Add missing declarations

===

M   source/blender/blenkernel/BKE_gpencil_modifier.h

===

diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h 
b/source/blender/blenkernel/BKE_gpencil_modifier.h
index e54023699f2..7a470af38c2 100644
--- a/source/blender/blenkernel/BKE_gpencil_modifier.h
+++ b/source/blender/blenkernel/BKE_gpencil_modifier.h
@@ -85,6 +85,11 @@ typedef enum {
eGreasePencilModifierTypeFlag_GpencilMod = (1 << 11),
 } GreasePencilModifierTypeFlag;
 
+/* IMPORTANT! Keep ObjectWalkFunc and IDWalkFunc signatures compatible. */
+typedef void(*ObjectWalkFunc)(void *userData, struct Object *ob, struct Object 
**obpoin, int cb_flag);
+typedef void(*IDWalkFunc)(void *userData, struct Object *ob, struct ID 
**idpoin, int cb_flag);
+typedef void(*TexWalkFunc)(void *userData, struct Object *ob, struct 
ModifierData *md, const char *propname);
+
 typedef struct GreasePencilModifierTypeInfo {
/* The user visible name for this modifier */
char name[32];

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [98fac0e144f] temp-greasepencil-vfx: New Rim FX shader effect

2018-07-01 Thread Antonioya
Commit: 98fac0e144f473bbcdf6df567d4e6b15376a8074
Author: Antonioya
Date:   Sun Jul 1 16:12:21 2018 +0200
Branches: temp-greasepencil-vfx
https://developer.blender.org/rB98fac0e144f473bbcdf6df567d4e6b15376a8074

New Rim FX shader effect

This effect allows to create a rim around the whole drawing.

A mask color can be defined in order to keep drawing lines below the rim.

===

M   release/scripts/startup/bl_ui/properties_data_shaderfx.py
M   source/blender/draw/CMakeLists.txt
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/gpencil_shader_fx.c
A   source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_rim_frag.glsl
M   source/blender/makesdna/DNA_shader_fx_types.h
M   source/blender/makesrna/RNA_access.h
M   source/blender/makesrna/intern/rna_shader_fx.c
M   source/blender/shader_fx/CMakeLists.txt
M   source/blender/shader_fx/FX_shader_types.h
A   source/blender/shader_fx/intern/FX_shader_rim.c
M   source/blender/shader_fx/intern/FX_shader_util.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_shaderfx.py 
b/release/scripts/startup/bl_ui/properties_data_shaderfx.py
index 9bf26a8baed..6f2cab5239d 100644
--- a/release/scripts/startup/bl_ui/properties_data_shaderfx.py
+++ b/release/scripts/startup/bl_ui/properties_data_shaderfx.py
@@ -82,6 +82,13 @@ class DATA_PT_shader_fx(ShaderFxButtonsPanel, Panel):
 col.enabled = fx.use_lines
 col.prop(fx, "color")
 
+def FX_RIM(self, layout, fx):
+layout.prop(fx, "offset", text="Offset")
+
+layout.prop(fx, "rim_color")
+layout.prop(fx, "mask_color")
+layout.prop(fx, "mode")
+
 def FX_SWIRL(self, layout, fx):
 layout.prop(fx, "object", text="Object")
 
diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index c220eba2255..b4c147a3bdd 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -323,6 +323,7 @@ 
data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_blur_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_flip_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_light_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_pixel_frag.glsl SRC)
+data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_rim_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl SRC)
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 0acb86a5702..2967cd1f8de 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -64,6 +64,14 @@ typedef struct GPencilFXPixel {
int lines;
 } GPencilFXPixel;
 
+typedef struct GPencilFXRim {
+   float loc[3];
+   float offset[2];
+   float rim_rgba[4];
+   float mask_rgba[4];
+   int mode;
+} GPencilFXRim;
+
 typedef struct GPencilFXBlur {
float radius[2];
int samples;
@@ -104,6 +112,7 @@ typedef struct tGPencilObjectCache {
DRWShadingGroup *fx_wave_sh;
DRWShadingGroup *fx_blur_sh;
DRWShadingGroup *fx_pixel_sh;
+   DRWShadingGroup *fx_rim_sh;
DRWShadingGroup *fx_swirl_sh;
DRWShadingGroup *fx_flip_sh;
DRWShadingGroup *fx_light_sh;
@@ -117,6 +126,7 @@ typedef struct GPENCIL_fx {
GPencilFXBlur fx_blur;
GPencilFXWave fx_wave;
GPencilFXPixel fx_pixel;
+   GPencilFXRim fx_rim;
GPencilFXSwirl fx_swirl;
GPencilFXFlip fx_flip;
GPencilFXLight fx_light;
@@ -192,6 +202,7 @@ typedef struct GPENCIL_PassList {
struct DRWPass *fx_flip_pass;
struct DRWPass *fx_light_pass;
struct DRWPass *fx_pixel_pass;
+   struct DRWPass *fx_rim_pass;
struct DRWPass *fx_swirl_pass;
struct DRWPass *fx_wave_pass;
 
@@ -273,6 +284,7 @@ typedef struct GPENCIL_e_data {
struct GPUShader *gpencil_fx_flip_sh;
struct GPUShader *gpencil_fx_light_sh;
struct GPUShader *gpencil_fx_pixel_sh;
+   struct GPUShader *gpencil_fx_rim_sh;
struct GPUShader *gpencil_fx_swirl_sh;
struct GPUShader *gpencil_fx_wave_sh;
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c 
b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
index 6c38f4be357..735e4ddfe72 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -45,6 +45,7 @@ extern char datatoc_gpencil_fx_blur_frag_glsl[];
 extern char datatoc_gpencil_fx_f

[Bf-blender-cvs] [afcacf987ab] greasepencil-object: Cleanup: iterator macros

2018-03-09 Thread Antonioya
Commit: afcacf987ab3b6f792aa9a58b60f6f03c492679d
Author: Antonioya
Date:   Fri Mar 9 11:07:15 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBafcacf987ab3b6f792aa9a58b60f6f03c492679d

Cleanup: iterator macros

===

M   source/blender/collada/EffectExporter.cpp

===

diff --git a/source/blender/collada/EffectExporter.cpp 
b/source/blender/collada/EffectExporter.cpp
index 6095038605e..5e2b00be82a 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -79,7 +79,7 @@ bool EffectsExporter::hasEffects(Scene *sce)
return true;
}
}
-   FOREACH_SCENE_OBJECT_END
+   FOREACH_SCENE_OBJECT_END;
return false;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e32c22d3a47] greasepencil-object: Add Lock to Focal Plane to Blur VFX

2018-04-03 Thread Antonioya
Commit: e32c22d3a47da2e690f2b0616cbeed130db4c460
Author: Antonioya
Date:   Tue Apr 3 19:31:13 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBe32c22d3a47da2e690f2b0616cbeed130db4c460

Add Lock to Focal Plane to Blur VFX

This optn works only in camera view and defines the blur factor depending of 
location of the object in depth of field. If the object is on a location inside 
near and far  depth of filed values, the blur is disabled.

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   source/blender/draw/engines/gpencil/gpencil_depth_of_field.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/gpencil_vfx.c
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/modifiers/intern/MOD_gpencilblur.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index c4fe835de4c..d61b9802501 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1879,6 +1879,12 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 col.separator()
 col.prop(md, "samples", text="Samples")
 
+col.separator()
+col.prop(md, "use_dof_mode")
+if md.use_dof_mode:
+col.prop(md, "coc")
+
+
 def GP_WAVE(self, layout, ob, md):
 row = layout.row(align=True)
 row.prop(md, "orientation", expand=True)
diff --git a/source/blender/draw/engines/gpencil/gpencil_depth_of_field.c 
b/source/blender/draw/engines/gpencil/gpencil_depth_of_field.c
index c0c8f96d011..a34fb9031fe 100644
--- a/source/blender/draw/engines/gpencil/gpencil_depth_of_field.c
+++ b/source/blender/draw/engines/gpencil/gpencil_depth_of_field.c
@@ -53,6 +53,36 @@ static void 
gpencil_create_shader_depth_of_field(GPENCIL_e_data *e_data)
  
datatoc_gpencil_dof_frag_glsl, "#define STEP_RESOLVE\n");
 }
 
+/* helper to get near and far depth of filed values */
+void GPENCIL_dof_nearfar(Object *camera, float coc, float nearfar[2])
+{
+   if (camera == NULL) {
+   return;
+   }
+
+   const DRWContextState *draw_ctx = DRW_context_state_get();
+   Scene *scene = draw_ctx->scene;
+   Camera *cam = (Camera *)camera->data;
+
+   float fstop = cam->gpu_dof.fstop;
+   float focus_dist = BKE_camera_object_dof_distance(camera);
+   float focal_len = cam->lens;
+
+   /* this is factor that converts to the scene scale. focal length and 
sensor are expressed in mm
+   * unit.scale_length is how many meters per blender unit we have. We 
want to convert to blender units though
+   * because the shader reads coordinates in world space, which is in 
blender units.
+   * Note however that focus_distance is already in blender units and 
shall not be scaled here (see T48157). */
+   float scale = (scene->unit.system) ? scene->unit.scale_length : 1.0f;
+   float scale_camera = 0.001f / scale;
+   /* we want radius here for the aperture number  */
+   float aperture_scaled = 0.5f * scale_camera * focal_len / fstop;
+   float focal_len_scaled = scale_camera * focal_len;
+
+   float hyperfocal = (focal_len_scaled * focal_len_scaled) / 
(aperture_scaled * coc);
+   nearfar[0] = (hyperfocal * focus_dist) / (hyperfocal + focal_len);
+   nearfar[1] = (hyperfocal * focus_dist) / (hyperfocal - focal_len);
+}
+
 /* init depth of field effect */
 int GPENCIL_depth_of_field_init(DrawEngineType *draw_engine_gpencil_type, 
GPENCIL_e_data *e_data, GPENCIL_Data *vedata, Object *camera)
 {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index ac1fdb8c779..1cae05abc8c 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -1157,6 +1157,8 @@ static void GPENCIL_render_to_image(void *vedata, 
RenderEngine *engine, struct R
 
/* depth of field */
Object *camera = DEG_get_evaluated_object(draw_ctx->depsgraph, 
RE_GetCamera(engine->re));
+   GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
+   stl->storage->camera = camera; /* save current camera */
GPENCIL_depth_of_field_init(_engine_gpencil_type, _data, vedata, 
camera);
 
GPENCIL_FramebufferList *fbl = ((GPENCIL_Data *)vedata)->fbl;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpencil/gpencil_engine.h

[Bf-blender-cvs] [5ed07515f59] greasepencil-object: Refactor VFX code

2018-04-03 Thread Antonioya
Commit: 5ed07515f5933aa55eefe7c288a62854b0edbab2
Author: Antonioya
Date:   Tue Apr 3 18:27:15 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB5ed07515f5933aa55eefe7c288a62854b0edbab2

Refactor VFX code

Make code more consistent and clear to understand.

===

M   source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/gpencil_vfx.c

===

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 773450dbc9a..0f27811e191 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -87,6 +87,7 @@ void gpencil_object_cache_add(tGPencilObjectCache 
*cache_array, Object *ob, bool
/* save object */
cache->ob = ob;
cache->temp_ob = is_temp;
+   cache->idx = *gp_cache_used;
 
cache->init_grp = 0;
cache->end_grp = -1;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index f9daea039b7..ac1fdb8c779 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -418,8 +418,17 @@ static void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, 
"strokeDepth", _data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp_noblend, "tonemapping", 
>storage->tonemapping, 1);
 
-   /* vfx copy pass from txtb to txta */
+   /* vfx setup pass to prepare txta */
struct Gwn_Batch *vfxquad = DRW_cache_fullscreen_quad_get();
+   psl->vfx_setup_pass = DRW_pass_create("GPencil VFX setup Pass", 
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS);
+   DRWShadingGroup *vfx_setup_shgrp = 
DRW_shgroup_create(e_data.gpencil_simple_fullscreen_sh, psl->vfx_setup_pass);
+   stl->g_data->tot_sh++;
+   DRW_shgroup_call_add(vfx_setup_shgrp, vfxquad, NULL);
+   DRW_shgroup_uniform_texture_ref(vfx_setup_shgrp, "strokeColor", 
_data.temp_color_tx);
+   DRW_shgroup_uniform_texture_ref(vfx_setup_shgrp, "strokeDepth", 
_data.temp_depth_tx);
+   
+   /* vfx copy pass from txtb to txta */
+   vfxquad = DRW_cache_fullscreen_quad_get();
psl->vfx_copy_pass = DRW_pass_create("GPencil VFX Copy b to a 
Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS);
DRWShadingGroup *vfx_copy_shgrp = 
DRW_shgroup_create(e_data.gpencil_simple_fullscreen_sh, psl->vfx_copy_pass);
stl->g_data->tot_sh++;
@@ -613,27 +622,30 @@ static void gpencil_draw_vfx_pass(DRWPass *vfxpass, 
DRWPass *copypass,
  * vfx modifier. This use one pass more but allows to create a stack of vfx
  * modifiers and add more modifiers in the future using the same structure.
 */
-static void gpencil_vfx_passes(int ob_idx, void *vedata, tGPencilObjectCache 
*cache)
+static void gpencil_vfx_passes(void *vedata, tGPencilObjectCache *cache)
 {
float clearcol[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
 
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
GPENCIL_FramebufferList *fbl = ((GPENCIL_Data *)vedata)->fbl;
+   int ob_idx = cache->idx;
 
GPU_framebuffer_bind(fbl->vfx_fb_a);
GPU_framebuffer_clear_color_depth(fbl->vfx_fb_a, clearcol, 1.0f);
 
-   /* create a wave pass or if this modifier is not used, copy the 
original texture
-   * to tx_a to be used by all following vfx modifiers.
-   * At the end of this pass, we can be sure the vfx_fbcolor_color_tx_a 
texture has 
+   /* Copy the original texture to tx_a to be used by all following vfx 
modifiers.
+   * At the end of this passes, we can be sure the vfx_fbcolor_color_tx_a 
texture has 
* the final image.
-   *
-   * Wave pass is always evaluated first.
*/
-   DRW_draw_pass_subset(psl->vfx_wave_pass,
-   cache->vfx_wave_sh,
-   cache->vfx_wave_sh);
+   DRW_draw_pass(psl->vfx_setup_pass);
+   /* --
+   * Wave pass 
+   * --*/
+   if (cache->vfx_wave_sh) {
+   gpencil_draw_vfx_pass(psl->vfx_wave_pass, psl->vfx_copy_pass,
+   fbl, cache->vfx_wave_sh);
+   }
/* --
 *

[Bf-blender-cvs] [c652eb0a455] greasepencil-object: Adapt code after merge

2018-03-02 Thread Antonioya
Commit: c652eb0a455438db428dfb9a3048bb27bab303cc
Author: Antonioya
Date:   Fri Mar 2 11:39:12 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc652eb0a455438db428dfb9a3048bb27bab303cc

Adapt code after merge

THe code was moved to new module

===

M   source/blender/editors/object/object_modes.c

===

diff --git a/source/blender/editors/object/object_modes.c 
b/source/blender/editors/object/object_modes.c
index 8cdec2968b3..5b2eeaff772 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -27,6 +27,7 @@
  * actual mode switching logic is per-object type.
  */
 
+#include "DNA_gpencil_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_workspace_types.h"
@@ -68,8 +69,14 @@ static const char *object_mode_op_string(eObjectMode mode)
return "PARTICLE_OT_particle_edit_toggle";
if (mode == OB_MODE_POSE)
return "OBJECT_OT_posemode_toggle";
-   if (mode == OB_MODE_GPENCIL)
+   if (mode == OB_MODE_GPENCIL_EDIT)
return "GPENCIL_OT_editmode_toggle";
+   if (mode == OB_MODE_GPENCIL_PAINT)
+   return "GPENCIL_OT_paintmode_toggle";
+   if (mode == OB_MODE_GPENCIL_SCULPT)
+   return "GPENCIL_OT_sculptmode_toggle";
+   if (mode == OB_MODE_GPENCIL_WEIGHT)
+   return "GPENCIL_OT_weightmode_toggle"; 
return NULL;
 }
 
@@ -82,8 +89,6 @@ bool ED_object_mode_compat_test(const Object *ob, eObjectMode 
mode)
if (ob) {
if (mode == OB_MODE_OBJECT)
return true;
-   else if (mode == OB_MODE_GPENCIL)
-   return true; /* XXX: assume this is the case for now... 
*/
 
switch (ob->type) {
case OB_MESH:
@@ -108,6 +113,13 @@ bool ED_object_mode_compat_test(const Object *ob, 
eObjectMode mode)
if (mode & (OB_MODE_EDIT | OB_MODE_POSE))
return true;
break;
+   case OB_GPENCIL:
+   if (mode & (OB_MODE_GPENCIL_EDIT | 
OB_MODE_GPENCIL_PAINT |
+   OB_MODE_GPENCIL_SCULPT | 
OB_MODE_GPENCIL_WEIGHT))
+   {
+   return true;
+   }
+   break;
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dab0af9b0d5] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-04-02 Thread Antonioya
Commit: dab0af9b0d55a9028004457da14e18ad92c3f2c1
Author: Antonioya
Date:   Tue Apr 2 11:40:23 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBdab0af9b0d55a9028004457da14e18ad92c3f2c1

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [60090384f52] master: Cleanup: Fix compiler warning

2019-04-02 Thread Antonioya
Commit: 60090384f52cc9b3b87455657139a208dfd0ad19
Author: Antonioya
Date:   Tue Apr 2 13:13:23 2019 +0200
Branches: master
https://developer.blender.org/rB60090384f52cc9b3b87455657139a208dfd0ad19

Cleanup: Fix compiler warning

===

M   source/blender/editors/include/ED_particle.h

===

diff --git a/source/blender/editors/include/ED_particle.h 
b/source/blender/editors/include/ED_particle.h
index 6731d878dc6..9cb0eb870ab 100644
--- a/source/blender/editors/include/ED_particle.h
+++ b/source/blender/editors/include/ED_particle.h
@@ -55,7 +55,7 @@ void PE_update_object(
 /* selection tools */
 bool PE_mouse_particles(struct bContext *C, const int mval[2], bool extend, 
bool deselect, bool toggle);
 bool PE_box_select(struct bContext *C, const struct rcti *rect, const int 
sel_op);
-bool PE_circle_select(struct bContext *C, int sel_op, const int mval[2], float 
rad);
+bool PE_circle_select(struct bContext *C, const int sel_op, const int mval[2], 
float rad);
 int PE_lasso_select(struct bContext *C, const int mcords[][2], const short 
moves, const int sel_op);
 bool PE_deselect_all_visible_ex(struct PTCacheEdit *edit);
 bool PE_deselect_all_visible(struct bContext *C);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fb86d091950] master: GPencil: Improve soft eraser for last stroke points

2019-03-29 Thread Antonioya
Commit: fb86d0919504b00db2b7f28cf39472d1abca6a90
Author: Antonioya
Date:   Fri Mar 29 15:39:29 2019 +0100
Branches: master
https://developer.blender.org/rBfb86d0919504b00db2b7f28cf39472d1abca6a90

GPencil: Improve soft eraser for last stroke points

Now, the last point is managed separately in order to get smoother transition.

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index eece759035f..d9a58ddc5a6 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1404,6 +1404,19 @@ static void gp_stroke_soft_refine(bGPDstroke *gps, const 
float cull_thresh)
}
}
 
+   /* last point special case to get smoother transition */
+   pt = >points[gps->totpoints - 1];
+   pt_before = >points[gps->totpoints - 2];
+   if (pt->flag & GP_SPOINT_TAG) {
+   pt->flag &= ~GP_SPOINT_TAG;
+   pt->flag &= ~GP_SPOINT_TEMP_TAG;
+   pt->strength = 0.0f;
+
+   pt_before->flag &= ~GP_SPOINT_TAG;
+   pt_before->flag &= ~GP_SPOINT_TEMP_TAG;
+   pt_before->strength *= 0.5f;
+   }
+
/* now untag temp tagged */
pt = gps->points;
for (i = 1; i < gps->totpoints - 1; i++, pt++) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [23c262192ce] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-04-02 Thread Antonioya
Commit: 23c262192ce3c7a429fd989a98c965bab76d605e
Author: Antonioya
Date:   Tue Apr 2 16:51:32 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB23c262192ce3c7a429fd989a98c965bab76d605e

Merge branch 'master' into greasepencil-object

===



===

diff --cc source/blender/makesdna/DNA_gpencil_types.h
index 363c1dd504d,56e17fe9149..dc752cc0bc9
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@@ -199,14 -199,9 +199,15 @@@ typedef struct bGPDstroke 
/** Caps mode for each stroke extreme */
short caps[2];
  
 +  /** gradient control along y for color */
 +  float gradient_f;
 +  /** factor xy of shape for dots gradients */
 +  float gradient_s[2];
 +  char _pad_3[4];
 +
/** Vertex weight data. */
struct MDeformVert *dvert;
+   void *_pad3;
  
bGPDstroke_Runtime runtime;
char _pad2[4];

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [aaae21245ed] master: Cleanup: Fix compiler warning

2019-04-02 Thread Antonioya
Commit: aaae21245ed9a375b4d8b5772e51492c9296092b
Author: Antonioya
Date:   Tue Apr 2 17:02:10 2019 +0200
Branches: master
https://developer.blender.org/rBaaae21245ed9a375b4d8b5772e51492c9296092b

Cleanup: Fix compiler warning

===

M   source/blender/blenlib/intern/path_util.c

===

diff --git a/source/blender/blenlib/intern/path_util.c 
b/source/blender/blenlib/intern/path_util.c
index 6a8be3fe107..0bd09f0c268 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -472,7 +472,6 @@ static void BLI_path_unc_to_short(wchar_t *unc)
wchar_t tmp[PATH_MAX];
 
int len = wcslen(unc);
-   int copy_start = 0;
/* convert:
 *\\?\UNC\server\share\folder\... to \\server\share\folder\...
 *\\?\C:\ to C:\ and \\?\C:\folder\... to C:\folder\...

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [382b2a9c66a] master: GPencil: Implement custom channel color in Dopesheet

2019-04-03 Thread Antonioya
Commit: 382b2a9c66a9f8b64581dc2a360dffbbbe706e21
Author: Antonioya
Date:   Wed Apr 3 10:25:49 2019 +0200
Branches: master
https://developer.blender.org/rB382b2a9c66a9f8b64581dc2a360dffbbbe706e21

GPencil: Implement custom channel color in Dopesheet

A new parameter in the layer adjustment panel allows to define the color of the 
channel in Dopesheet.

This is needed when there are a lot of layers.

See D4623 for more details.

===

M   release/scripts/startup/bl_ui/properties_data_gpencil.py
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/animation/anim_channels_defines.c
M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index 2374faa0da8..0348b2452da 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -224,6 +224,23 @@ class 
DATA_PT_gpencil_layer_relations(LayerDataButtonsPanel, Panel):
 col.prop_search(gpl, "parent_bone", parent.data, "bones", 
text="Bone")
 
 
+class DATA_PT_gpencil_layer_display(LayerDataButtonsPanel, Panel):
+bl_label = "Display"
+bl_parent_id = 'DATA_PT_gpencil_layers'
+bl_options = {'DEFAULT_CLOSED'}
+
+def draw(self, context):
+layout = self.layout
+layout.use_property_split = True
+layout.use_property_decorate = False
+
+gpd = context.gpencil
+gpl = gpd.layers.active
+
+col = layout.row(align=True)
+col.prop(gpl, "channel_color")
+
+
 class DATA_PT_gpencil_onion_skinning(DataButtonsPanel, Panel):
 bl_label = "Onion Skinning"
 bl_options = {'DEFAULT_CLOSED'}
@@ -449,6 +466,7 @@ classes = (
 DATA_PT_gpencil_onion_skinning_display,
 DATA_PT_gpencil_layer_adjustments,
 DATA_PT_gpencil_layer_relations,
+DATA_PT_gpencil_layer_display,
 DATA_PT_gpencil_vertex_groups,
 DATA_PT_gpencil_strokes,
 DATA_PT_gpencil_display,
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 6981d70019a..2ef8568e308 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -374,6 +374,8 @@ bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const 
char *name, bool setacti
/* thickness parameter represents "thickness change", not 
absolute thickness */
gpl->thickness = 0;
gpl->opacity = 1.0f;
+   /* default channel color */
+   ARRAY_SET_ITEMS(gpl->color, 0.2f, 0.2f, 0.2f);
}
 
/* auto-name */
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 4173bb9d99a..a1087caf40c 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2952,6 +2952,19 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
mat->blend_shadow = MA_BS_SOLID;
}
}
+
+   /* grease pencil default animation channel color */
+   {
+   for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = 
gpd->id.next) {
+   if (gpd->flag & GP_DATA_ANNOTATIONS) {
+   continue;
+   }
+   for (bGPDlayer *gpl = gpd->layers.first; gpl; 
gpl = gpl->next) {
+   /* default channel color */
+   ARRAY_SET_ITEMS(gpl->color, 0.2f, 0.2f, 
0.2f);
+   }
+   }
+   }
}
 
{
diff --git a/source/blender/editors/animation/anim_channels_defines.c 
b/source/blender/editors/animation/anim_channels_defines.c
index 997b3c22e51..618ac8f6f13 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -220,6 +220,23 @@ static void acf_generic_channel_color(bAnimContext *ac, 
bAnimListElem *ale, floa
}
 }
 
+/* get backdrop color for grease pencil channels */
+static void acf_gpencil_channel_color(bAnimContext *ac, bAnimListElem *ale, 
float r_color[3])
+{
+   const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
+   short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) 
: 0;
+   bool showGroupColors = acf_show_channel_colors(ac);
+   
+   if ((showGroupColors) && 

[Bf-blender-cvs] [b346a7c0df3] master: Fix T62802: Layer order inverted in Outliner

2019-03-21 Thread Antonioya
Commit: b346a7c0df38a308bf6f586a74c72b2e03f11d15
Author: Antonioya
Date:   Thu Mar 21 09:29:16 2019 +0100
Branches: master
https://developer.blender.org/rBb346a7c0df38a308bf6f586a74c72b2e03f11d15

Fix T62802: Layer order inverted in Outliner

===

M   source/blender/editors/space_outliner/outliner_tree.c

===

diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index 18623fc0b5e..7d700be0ec7 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -699,7 +699,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops, 
TreeElement *te, Tree
outliner_add_element(soops, >subtree, gpd, 
te, TSE_ANIM_DATA, 0);
 
// TODO: base element for layers?
-   for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+   for (gpl = gpd->layers.last; gpl; gpl = gpl->prev) {
outliner_add_element(soops, >subtree, gpl, 
te, TSE_GP_LAYER, a);
a++;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [623b08d210d] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-03-27 Thread Antonioya
Commit: 623b08d210d35b56dc9a55d48a45d1cd74100c20
Author: Antonioya
Date:   Wed Mar 27 16:03:19 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB623b08d210d35b56dc9a55d48a45d1cd74100c20

Merge branch 'master' into greasepencil-object

 Conflicts:
source/blender/blenloader/intern/versioning_280.c

===



===

diff --cc source/blender/blenloader/intern/versioning_280.c
index 44e262ad6be,c4775b77eee..95adccf7e85
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -2931,31 -2931,19 +2931,46 @@@ void blo_do_versions_280(FileData *fd, 
}
}
}
+ 
+   FOREACH_NODETREE_BEGIN(bmain, ntree, id) {
+   if (ntree->type == NTREE_SHADER) {
+   for (bNode *node = ntree->nodes.first; node; 
node = node->next) {
+   /* Fix missing version patching from 
earlier changes. */
+   if (STREQ(node->idname, 
"ShaderNodeOutputLamp")) {
+   STRNCPY(node->idname, 
"ShaderNodeOutputLight");
+   }
+   if (node->type == 
SH_NODE_BSDF_PRINCIPLED && node->custom2 == 0) {
+   node->custom2 = 
SHD_SUBSURFACE_BURLEY;
+   }
+   }
+   }
+   } FOREACH_NODETREE_END;
++
 +  /* init grease pencil brush gradients */
 +  if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", 
"float", "gradient_f")) {
 +  for (Brush *brush = bmain->brushes.first; brush; brush 
= brush->id.next) {
 +  if (brush->gpencil_settings != NULL) {
 +  BrushGpencilSettings *gp = 
brush->gpencil_settings;
 +  gp->gradient_f = 1.0f;
 +  gp->gradient_s[0] = 1.0f;
 +  gp->gradient_s[1] = 1.0f;
 +  }
 +  }
 +  }
 +
 +  /* init grease pencil stroke gradients */
 +  if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "float", 
"gradient_f")) {
 +  for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = 
gpd->id.next) {
 +  for (bGPDlayer *gpl = gpd->layers.first; gpl; 
gpl = gpl->next) {
 +  for (bGPDframe *gpf = 
gpl->frames.first; gpf; gpf = gpf->next) {
 +  for (bGPDstroke *gps = 
gpf->strokes.first; gps; gps = gps->next) {
 +  gps->gradient_f = 1.0f;
 +  gps->gradient_s[0] = 
1.0f;
 +  gps->gradient_s[1] = 
1.0f;
 +  }
 +  }
 +  }
 +  }
 +  }
}
  }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1dbece8080f] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-03-24 Thread Antonioya
Commit: 1dbece8080f43909fa5b687995fa4ac900f6a1c5
Author: Antonioya
Date:   Sun Mar 24 12:12:26 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB1dbece8080f43909fa5b687995fa4ac900f6a1c5

Merge branch 'master' into greasepencil-object

 Conflicts:
source/blender/blenloader/intern/versioning_280.c

===



===

diff --cc source/blender/blenloader/intern/versioning_280.c
index be1bfea540c,6c5eb269c5c..44e262ad6be
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -2920,31 -2920,16 +2920,42 @@@ void blo_do_versions_280(FileData *fd, 
part->draw_as = PART_DRAW_NOT;
}
}
+ 
+   if (!DNA_struct_elem_find(fd->filesdna, 
"TriangulateModifierData", "int", "min_vertices")) {
+   for (Object *ob = bmain->objects.first; ob; ob = 
ob->id.next) {
+   for (ModifierData *md = ob->modifiers.first; 
md; md = md->next) {
+   if (md->type == 
eModifierType_Triangulate) {
+   TriangulateModifierData *smd = 
(TriangulateModifierData *)md;
+   smd->min_vertices = 4;
+   }
+   }
+   }
+   }
 +  /* init grease pencil brush gradients */
 +  if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", 
"float", "gradient_f")) {
 +  for (Brush *brush = bmain->brushes.first; brush; brush 
= brush->id.next) {
 +  if (brush->gpencil_settings != NULL) {
 +  BrushGpencilSettings *gp = 
brush->gpencil_settings;
 +  gp->gradient_f = 1.0f;
 +  gp->gradient_s[0] = 1.0f;
 +  gp->gradient_s[1] = 1.0f;
 +  }
 +  }
 +  }
 +
 +  /* init grease pencil stroke gradients */
 +  if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "float", 
"gradient_f")) {
 +  for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = 
gpd->id.next) {
 +  for (bGPDlayer *gpl = gpd->layers.first; gpl; 
gpl = gpl->next) {
 +  for (bGPDframe *gpf = 
gpl->frames.first; gpf; gpf = gpf->next) {
 +  for (bGPDstroke *gps = 
gpf->strokes.first; gps; gps = gps->next) {
 +  gps->gradient_f = 1.0f;
 +  gps->gradient_s[0] = 
1.0f;
 +  gps->gradient_s[1] = 
1.0f;
 +  }
 +  }
 +  }
 +  }
 +  }
}
  }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7021bd52738] master: GPencil: Only brushes with pinned materials have materials

2019-03-25 Thread Antonioya
Commit: 7021bd527380b4d87cf48057f0039509326b03dd
Author: Antonioya
Date:   Mon Mar 25 17:02:42 2019 +0100
Branches: master
https://developer.blender.org/rB7021bd527380b4d87cf48057f0039509326b03dd

GPencil: Only brushes with pinned materials have materials

Using GP_BRUSH_MATERIAL_PINNED to switch between active material and brush 
material, instead of updating all brushes on active material changes. This will 
allow brushes to have no material and therefore to not inflate the user count.

This fix T62465.

Patch contributed by @matc
Reviewers: @brecht @antoniov @billreynish @mendio

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   release/scripts/startup/bl_ui/space_topbar.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/blenkernel/BKE_brush.h
M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/intern/brush.c
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/blenkernel/intern/material.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/editors/gpencil/gpencil_add_monkey.c
M   source/blender/editors/gpencil/gpencil_add_stroke.c
M   source/blender/editors/gpencil/gpencil_brush.c
M   source/blender/editors/gpencil/gpencil_data.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_fill.c
M   source/blender/editors/gpencil/gpencil_old.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/gpencil/gpencil_primitive.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/render/render_shading.c
M   source/blender/makesrna/intern/rna_brush.c
M   source/blender/makesrna/intern/rna_object.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 5f2ac7e7123..bb059d6befc 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -832,6 +832,11 @@ class GreasePencilMaterialsPanel:
 layout = self.layout
 show_full_ui = (self.bl_space_type == 'PROPERTIES')
 
+is_view3d = (self.bl_space_type == 'VIEW_3D')
+tool_settings = context.scene.tool_settings
+gpencil_paint = tool_settings.gpencil_paint
+brush = gpencil_paint.brush
+
 ob = context.object
 row = layout.row()
 
@@ -841,6 +846,12 @@ class GreasePencilMaterialsPanel:
 
 row.template_list("GPENCIL_UL_matslots", "", ob, "material_slots", 
ob, "active_material_index", rows=rows)
 
+# if topbar popover and brush pinned, disable
+if is_view3d and brush is not None:
+gp_settings = brush.gpencil_settings
+if gp_settings.use_material_pin:
+row.enabled = False
+
 col = row.column(align=True)
 if show_full_ui:
 col.operator("object.material_slot_add", icon='ADD', text="")
diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index 0e687452e5c..7b9b324066a 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -316,7 +316,8 @@ class _draw_left_context_mode:
 def draw_color_selector():
 ma = gp_settings.material
 row = layout.row(align=True)
-
+if not gp_settings.use_material_pin:
+ma = context.object.active_material
 icon_id = 0
 if ma:
 icon_id = ma.id_data.preview.icon_id
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 212427dead9..17dd35d9fc4 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1679,7 +1679,15 @@ class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, 
Panel):
 gp_settings = brush.gpencil_settings
 
 if brush.gpencil_tool in {'DRAW', 'FILL'}:
-layout.row(align=True).template_ID(gp_settings, "material")
+row = layout.row(align=True)
+row_mat = row.row()
+if gp_settings.use_material_pin:
+row_mat.template_ID(gp_settings, "material", 
live_icon=True)
+else:
+row_mat.template_ID(context.active_object, 
"active_material", live_icon=True)
+row_mat.enabled = Fa

[Bf-blender-cvs] [aa0bb475762] master: Fix T63257: Grease Pencil renders incorrectly when in edit-mode

2019-04-03 Thread Antonioya
Commit: aa0bb47576262b909183947815d7f626df82b35d
Author: Antonioya
Date:   Wed Apr 3 19:58:32 2019 +0200
Branches: master
https://developer.blender.org/rBaa0bb47576262b909183947815d7f626df82b35d

Fix T63257: Grease Pencil renders incorrectly when in edit-mode

===

M   source/blender/blenkernel/intern/gpencil_modifier.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_shader_fx.c

===

diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c 
b/source/blender/blenkernel/intern/gpencil_modifier.c
index d09a914e23e..30bf30e2842 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -419,7 +419,7 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph, 
Object *ob, bGPDlayer *g
if (GPENCIL_MODIFIER_ACTIVE(md, is_render)) {
const GpencilModifierTypeInfo *mti = 
BKE_gpencil_modifierType_getInfo(md->type);
 
-   if (GPENCIL_MODIFIER_EDIT(md, is_edit)) {
+   if ((GPENCIL_MODIFIER_EDIT(md, is_edit)) && 
(!is_render)) {
continue;
}
 
@@ -457,7 +457,7 @@ void BKE_gpencil_geometry_modifiers(Depsgraph *depsgraph, 
Object *ob, bGPDlayer
if (GPENCIL_MODIFIER_ACTIVE(md, is_render)) {
const GpencilModifierTypeInfo *mti = 
BKE_gpencil_modifierType_getInfo(md->type);
 
-   if (GPENCIL_MODIFIER_EDIT(md, is_edit)) {
+   if ((GPENCIL_MODIFIER_EDIT(md, is_edit)) && 
(!is_render)) {
continue;
}
 
@@ -481,7 +481,7 @@ int BKE_gpencil_time_modifier(Depsgraph *depsgraph, Scene 
*scene, Object *ob,
if (GPENCIL_MODIFIER_ACTIVE(md, is_render)) {
const GpencilModifierTypeInfo *mti = 
BKE_gpencil_modifierType_getInfo(md->type);
 
-   if (GPENCIL_MODIFIER_EDIT(md, is_edit)) {
+   if ((GPENCIL_MODIFIER_EDIT(md, is_edit)) && 
(!is_render)) {
continue;
}
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 384f25ecaa5..1cc493dd8f5 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -550,7 +550,7 @@ static void gpencil_add_draw_data(void *vedata, Object *ob)
 
if (!cache_ob->is_dup_ob) {
/* fill shading groups */
-   if (!is_multiedit) {
+   if ((!is_multiedit) || (stl->storage->is_render)) {
DRW_gpencil_populate_datablock(_data, vedata, ob, 
cache_ob);
}
else {
diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c 
b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
index b1bc796bfa7..1d1fe20aba9 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -58,7 +58,9 @@ static bool effect_is_active(bGPdata *gpd, ShaderFxData *fx, 
bool is_render)
}
 
bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd);
-   if (((fx->mode & eShaderFxMode_Editmode) == 0) && (is_edit)) {
+   if (((fx->mode & eShaderFxMode_Editmode) == 0) &&
+   (is_edit) && (!is_render))
+   {
return false;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d40581a7149] master: GPencil: Improve drawing feeling in big files

2019-04-05 Thread Antonioya
Commit: d40581a71492c9d488dd68bb7fbd004881f9113d
Author: Antonioya
Date:   Fri Apr 5 11:26:04 2019 +0200
Branches: master
https://developer.blender.org/rBd40581a71492c9d488dd68bb7fbd004881f9113d

GPencil: Improve drawing feeling in big files

When drawing in big files, the first points of the stroke were not smooth 
because the system was doing a copy of the depsgraph datablock.

Now, the depsgraph is not updated at the beginning and the feeling is far 
better, especially for big files.

To avoid the copy, the original datablock is used while drawing, because it's 
faster the lookup of the original data, than a full datablock copy.

Also some cleanup of the code.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 1cc493dd8f5..3a74e44836d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -617,9 +617,20 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
}
 
/* draw current painting strokes
-* (only if region is equal to originated paint region) */
+* (only if region is equal to originated paint region)
+*
+* Need to use original data because to use the copy of data, 
the paint
+* operator must update depsgraph and this makes that first 
events of the
+* mouse are missed if the datablock is very big due the time 
required to
+* copy the datablock. The search of the original data is 
faster than a
+* full datablock copy.
+* Using the original data doesn't require a copy and the feel 
when drawing
+* is far better.
+*/
+
+   bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(>id);
if ((draw_ctx->obact == ob) &&
-   ((gpd->runtime.ar == NULL) || (gpd->runtime.ar == 
draw_ctx->ar)))
+   ((gpd_orig->runtime.ar == NULL) || 
(gpd_orig->runtime.ar == draw_ctx->ar)))
{
DRW_gpencil_populate_buffer_strokes(_data, vedata, 
ts, ob);
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index b66956b090d..d544bd8f9b6 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1708,6 +1708,9 @@ static void gp_session_validatebuffer(tGPsdata *p)
/* reset flags */
gpd->runtime.sbuffer_sflag = 0;
 
+   /* reset region */
+   gpd->runtime.ar = NULL;
+
/* reset inittime */
p->inittime = 0.0;
 
@@ -1784,11 +1787,12 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata 
*p)
ToolSettings *ts = CTX_data_tool_settings(C);
 
Paint *paint = >gp_paint->paint;
-
+   bool changed = false;
/* if not exist, create a new one */
if (paint->brush == NULL) {
/* create new brushes */
BKE_brush_gpencil_presets(C);
+   changed = true;
}
/* be sure curves are initializated */

curvemapping_initialize(paint->brush->gpencil_settings->curve_sensitivity);
@@ -1813,7 +1817,9 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata 
*p)
 * Maybe this update can be removed when the new tool system
 * will be in place, but while, we need this to keep drawing working.
 */
-   DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
+   if (changed) {
+   DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
+   }
 }
 
 
@@ -1946,13 +1952,6 @@ static bool gp_session_initdata(bContext *C, wmOperator 
*op, tGPsdata *p)
p->gpd = *gpd_ptr;
}
 
-   if (ED_gpencil_session_active() == 0) {
-   /* initialize undo stack,
-* also, existing undo stack would make buffer drawn
-*/
-   gpencil_undo_init(p->gpd);
-   }
-
/* clear out buffer (stored in gp-data), in case something contaminated 
it */
gp_session_validatebuffer(p);
 
@@ -1961,6 +1960,9 @@ static bool gp_session_initdata(bContext *C, wmOperator 
*op, tGPsdata *p)
 
/* setup active color */
if (curarea->spacetype == SPACE_VIEW3D) {
+   /* region where paint was originated */
+   p->gpd->runtime.ar = CTX_wm_region(C);
+
/* NOTE: This is only done for 3D view, as Materials aren't 
used for
 *   annotations in 2D editors
 

[Bf-blender-cvs] [f1be941769b] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-04-05 Thread Antonioya
Commit: f1be941769baf810eef7362af813f6e7bba670ae
Author: Antonioya
Date:   Fri Apr 5 18:29:11 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBf1be941769baf810eef7362af813f6e7bba670ae

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2219f28a68b] master: Cleanup: Fix compiler warning

2019-04-05 Thread Antonioya
Commit: 2219f28a68b69ba227270abadbcaa431601d42dc
Author: Antonioya
Date:   Fri Apr 5 18:50:13 2019 +0200
Branches: master
https://developer.blender.org/rB2219f28a68b69ba227270abadbcaa431601d42dc

Cleanup: Fix compiler warning

===

M   source/blender/editors/include/ED_view3d.h

===

diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 02ea0027938..2a115f49c31 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -450,7 +450,7 @@ void ED_view3d_draw_offscreen(
 int drawtype,
 struct View3D *v3d, struct ARegion *ar, int winx, int winy, float 
viewmat[4][4],
 float winmat[4][4], bool do_sky, bool is_persp, const char *viewname,
-struct GPUFXSettings *fx_settings, bool do_color_managment,
+struct GPUFXSettings *fx_settings, const bool do_color_managment,
 struct GPUOffScreen *ofs, struct GPUViewport *viewport);
 void ED_view3d_draw_setup_view(
 struct wmWindow *win, struct Depsgraph *depsgraph, struct Scene 
*scene, struct ARegion *ar, struct View3D *v3d,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [33b43dd9334] master: Fix T63031: Keyframing Annotations doesn't work

2019-03-28 Thread Antonioya
Commit: 33b43dd93341b9b6967e42d65ab18a6868ccca53
Author: Antonioya
Date:   Thu Mar 28 11:43:17 2019 +0100
Branches: master
https://developer.blender.org/rB33b43dd93341b9b6967e42d65ab18a6868ccca53

Fix T63031: Keyframing Annotations doesn't work

By design the annotation parameters must not be animatable.

Annotations are designed to take notes, not to create animations, so any 
animatable parameters have been flagged as non-animatable.

Note: As some properties are shared with grease pencil, I had to duplicate one 
property (adviced by @mont29) to keep grease pencil animatable but annotations 
don't.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/makesrna/intern/rna_gpencil.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index bb059d6befc..6e1253df968 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -650,8 +650,7 @@ class GPENCIL_UL_annotation_layer(UIList):
 split.prop(gpl, "info", text="", emboss=False)
 
 row = layout.row(align=True)
-# row.prop(gpl, "lock", text="", emboss=False)
-row.prop(gpl, "hide", text="", emboss=False)
+row.prop(gpl, "annotation_hide", text="", emboss=False)
 elif self.layout_type == 'GRID':
 layout.alignment = 'CENTER'
 layout.label(text="", icon_value=icon)
diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index dcdad5ce314..eefac818abe 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1150,6 +1150,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, 0.0f, 1.0f);
+   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Color", "Color for all strokes in this 
layer");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
 
@@ -1157,10 +1158,10 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
prop = RNA_def_property(srna, "thickness", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "thickness");
RNA_def_property_range(prop, 1, 10);
+   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Thickness", "Thickness of annotation 
strokes");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
-
-
+   
/* Tint Color */
prop = RNA_def_property(srna, "tint_color", PROP_FLOAT, 
PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "tintcolor");
@@ -1193,6 +1194,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
 
prop = RNA_def_property(srna, "use_annotation_onion_skinning", 
PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", 
GP_LAYER_ONIONSKIN);
+   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(
prop, "Onion Skinning",
"Display annotation onion skins before and after the current 
frame");
@@ -1201,6 +1203,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
prop = RNA_def_property(srna, "annotation_onion_before_range", 
PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "gstep");
RNA_def_property_range(prop, -1, 120);
+   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(
prop, "Frames Before",
"Maximum number of frames to show before current frame");
@@ -1209,6 +1212,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
prop = RNA_def_property(srna, "annotation_onion_after_range", PROP_INT, 
PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "gstep_next");
RNA_def_property_range(prop, -1, 120);
+   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(
prop, "Frames After",
"Maximum number of frames to show after current frame");
@@ -1219,6 +1223,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_rang

[Bf-blender-cvs] [127ad4fa4a3] master: GPencil: Improve soft eraser for low pressure strokes

2019-03-30 Thread Antonioya
Commit: 127ad4fa4a3f7f1037c654288acbe32d4267fe9a
Author: Antonioya
Date:   Sat Mar 30 10:43:52 2019 +0100
Branches: master
https://developer.blender.org/rB127ad4fa4a3f7f1037c654288acbe32d4267fe9a

GPencil: Improve soft eraser for low pressure strokes

For very thin strokes with low pressure, the low limit value was too high.

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index d9a58ddc5a6..4250b95de6d 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1494,19 +1494,15 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
}
}
else {
-   /* Pressure threshold at which stroke should be culled: 
Calculated as pressure value
-* below which we would have invisible strokes
-*/
-   const float cull_thresh = (gps->thickness) ? 1.0f / 
((float)gps->thickness) : 1.0f;
+   /* Pressure threshold at which stroke should be culled */
+   const float cull_thresh = 0.005f;
 
/* Amount to decrease the pressure of each point with each 
stroke */
-   // TODO: Fetch from toolsettings, or compute based on thickness 
instead?
const float strength = 0.1f;
 
/* Perform culling? */
bool do_cull = false;
 
-
/* Clear Tags
 *
 * Note: It's better this way, as we are sure that

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5407c3a8b04] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-03-30 Thread Antonioya
Commit: 5407c3a8b046fef11e469af48abe5903d4cad8b3
Author: Antonioya
Date:   Sat Mar 30 11:37:22 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB5407c3a8b046fef11e469af48abe5903d4cad8b3

Merge branch 'master' into greasepencil-object

===



===

diff --cc source/blender/blenloader/intern/versioning_280.c
index 95adccf7e85,960fb3b417c..a4fb0469cb0
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -2945,32 -2943,18 +2943,45 @@@ void blo_do_versions_280(FileData *fd, 
}
}
} FOREACH_NODETREE_END;
 +
 +  /* init grease pencil brush gradients */
 +  if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", 
"float", "gradient_f")) {
 +  for (Brush *brush = bmain->brushes.first; brush; brush 
= brush->id.next) {
 +  if (brush->gpencil_settings != NULL) {
 +  BrushGpencilSettings *gp = 
brush->gpencil_settings;
 +  gp->gradient_f = 1.0f;
 +  gp->gradient_s[0] = 1.0f;
 +  gp->gradient_s[1] = 1.0f;
 +  }
 +  }
 +  }
 +
 +  /* init grease pencil stroke gradients */
 +  if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "float", 
"gradient_f")) {
 +  for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = 
gpd->id.next) {
 +  for (bGPDlayer *gpl = gpd->layers.first; gpl; 
gpl = gpl->next) {
 +  for (bGPDframe *gpf = 
gpl->frames.first; gpf; gpf = gpf->next) {
 +  for (bGPDstroke *gps = 
gpf->strokes.first; gps; gps = gps->next) {
 +  gps->gradient_f = 1.0f;
 +  gps->gradient_s[0] = 
1.0f;
 +  gps->gradient_s[1] = 
1.0f;
 +  }
 +  }
 +  }
 +  }
 +  }
}
+ 
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 53)) {
+   for (Material *mat = bmain->materials.first; mat; mat = 
mat->id.next) {
+   /* Eevee: Keep material appearance consistent with 
previous behavior. */
+   if (!mat->use_nodes || !mat->nodetree || 
mat->blend_method == MA_BM_SOLID) {
+   mat->blend_shadow = MA_BS_SOLID;
+   }
+   }
+   }
+ 
+   {
+   /* Versioning code until next subversion bump goes here. */
+   }
  }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [03bd024c077] master: GPencil: Uses same random seed for render in Noise modifier

2019-03-30 Thread Antonioya
Commit: 03bd024c077d549cdef1ac686a557c742545cba8
Author: Antonioya
Date:   Sat Mar 30 17:06:49 2019 +0100
Branches: master
https://developer.blender.org/rB03bd024c077d549cdef1ac686a557c742545cba8

GPencil: Uses same random seed for render in Noise modifier

As the random seed was calculated in the copy data, the render could be a 
little different. Now, the data is saved in the original data.

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
index 9bfbe20343e..97ac6fa56cd 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
@@ -101,11 +101,16 @@ static void deformStroke(
const int def_nr = defgroup_name_index(ob, mmd->vgname);
const float unit_v3[3] = { 1.0f, 1.0f, 1.0f };
 
-   /* Random generator, only init once. */
-   if (mmd->rng == NULL) {
+   Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+   GpencilModifierData *md_eval = 
BKE_gpencil_modifiers_findByName(object_eval, md->name);
+   NoiseGpencilModifierData *mmd_eval = (NoiseGpencilModifierData 
*)md_eval;
+
+   /* Random generator, only init once. (it uses eval to get same value in 
render) */
+   if (mmd_eval->rng == NULL) {
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
rng_seed ^= POINTER_AS_UINT(mmd);
-   mmd->rng = BLI_rng_new(rng_seed);
+   mmd_eval->rng = BLI_rng_new(rng_seed);
+   mmd->rng = mmd_eval->rng;
}
 
if (!is_stroke_affected_by_modifier(

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [eeefea86cdd] master: Fix T63054: Crash on "Grease Pencil Unlink"

2019-03-28 Thread Antonioya
Commit: eeefea86cddbfea47e8026e3a10210a43e70fc90
Author: Antonioya
Date:   Thu Mar 28 17:07:49 2019 +0100
Branches: master
https://developer.blender.org/rBeeefea86cddbfea47e8026e3a10210a43e70fc90

Fix T63054: Crash on "Grease Pencil Unlink"

This operator was used only by annotations and it was part of the old legacy 
code.

Now, the operator is limited to annotations and cannot be used with grease 
pencil objects.

Also changed the tooltip to clarify it's only for annotations.

===

M   source/blender/editors/gpencil/gpencil_data.c

===

diff --git a/source/blender/editors/gpencil/gpencil_data.c 
b/source/blender/editors/gpencil/gpencil_data.c
index a8b31b20182..2d5ec4c5055 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -175,6 +175,13 @@ static bool gp_data_unlink_poll(bContext *C)
 {
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
 
+   /* only unlink annotation datablocks */
+   if (gpd_ptr != NULL) {
+   bGPdata *gpd = (*gpd_ptr);
+   if ((gpd->flag & GP_DATA_ANNOTATIONS) == 0) {
+   return false;
+   }
+   }
/* if we have access to some active data, make sure there's a datablock 
before enabling this */
return (gpd_ptr && *gpd_ptr);
 }
@@ -206,9 +213,9 @@ static int gp_data_unlink_exec(bContext *C, wmOperator *op)
 void GPENCIL_OT_data_unlink(wmOperatorType *ot)
 {
/* identifiers */
-   ot->name = "Grease Pencil Unlink";
+   ot->name = "Annotation Unlink";
ot->idname = "GPENCIL_OT_data_unlink";
-   ot->description = "Unlink active Grease Pencil data-block";
+   ot->description = "Unlink active Annotation data-block";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
/* callbacks */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dfa470ec336] master: GPencil: Fix error in previous commit

2019-03-28 Thread Antonioya
Commit: dfa470ec336976eeca309909ee7ae19261431130
Author: Antonioya
Date:   Thu Mar 28 17:17:04 2019 +0100
Branches: master
https://developer.blender.org/rBdfa470ec336976eeca309909ee7ae19261431130

GPencil: Fix error in previous commit

===

M   source/blender/editors/gpencil/gpencil_fill.c

===

diff --git a/source/blender/editors/gpencil/gpencil_fill.c 
b/source/blender/editors/gpencil/gpencil_fill.c
index 5966684d30c..17cb21d62bd 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1170,7 +1170,7 @@ static bool gpencil_fill_poll(bContext *C)
}
else {
CTX_wm_operator_poll_msg_set(C, "Active region not set");
-   return true;
+   return false;
}
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1dddb47e48c] master: Fix T63052: Crash on "Grease Pencil Fill" without Grease Pencil Object

2019-03-28 Thread Antonioya
Commit: 1dddb47e48ca0661d343a21100de8219bf85ae6a
Author: Antonioya
Date:   Thu Mar 28 16:48:32 2019 +0100
Branches: master
https://developer.blender.org/rB1dddb47e48ca0661d343a21100de8219bf85ae6a

Fix T63052: Crash on "Grease Pencil Fill" without Grease Pencil Object

Changed poll function to verify if the context is valid.

Also cleanup return values.

===

M   source/blender/editors/gpencil/gpencil_fill.c

===

diff --git a/source/blender/editors/gpencil/gpencil_fill.c 
b/source/blender/editors/gpencil/gpencil_fill.c
index acbf329b783..5966684d30c 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1150,19 +1150,27 @@ static void gpencil_fill_draw_3d(const bContext *C, 
ARegion *UNUSED(ar), void *a
 /* check if context is suitable for filling */
 static bool gpencil_fill_poll(bContext *C)
 {
+   Object *obact = CTX_data_active_object(C);
+
if (ED_operator_regionactive(C)) {
ScrArea *sa = CTX_wm_area(C);
if (sa->spacetype == SPACE_VIEW3D) {
-   return 1;
+   if ((obact == NULL) ||
+   (obact->type != OB_GPENCIL) ||
+   (obact->mode != OB_MODE_PAINT_GPENCIL)) {
+   return false;
+   }
+
+   return true;
}
else {
CTX_wm_operator_poll_msg_set(C, "Active region not 
valid for filling operator");
-   return 0;
+   return false;
}
}
else {
CTX_wm_operator_poll_msg_set(C, "Active region not set");
-   return 0;
+   return true;
}
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d3367f3ca23] master: GPencil: Redesign soft eraser logic

2019-04-01 Thread Antonioya
Commit: d3367f3ca23edf290a6e9fc037635ceaf6b768f3
Author: Antonioya
Date:   Mon Apr 1 11:24:03 2019 +0200
Branches: master
https://developer.blender.org/rBd3367f3ca23edf290a6e9fc037635ceaf6b768f3

GPencil: Redesign soft eraser logic

The old logic was working if the eraser was moved towards the end of the 
stroke, but got ugly results when the eraser was done towards the start of the 
stroke.

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 2bf1c8cda75..cb58542dc38 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1366,8 +1366,7 @@ static void gp_free_stroke(bGPdata *gpd, bGPDframe *gpf, 
bGPDstroke *gps)
 static void gp_stroke_soft_refine(bGPDstroke *gps)
 {
bGPDspoint *pt = NULL;
-   bGPDspoint *pt_before = NULL;
-   bGPDspoint *pt_after = NULL;
+   bGPDspoint *pt2 = NULL;
int i;
 
/* check if enough points*/
@@ -1375,50 +1374,27 @@ static void gp_stroke_soft_refine(bGPDstroke *gps)
return;
}
 
-   /* loop all points from second to last minus one
-* to untag any point that is not surrounded by tagged points
-*/
+   /* loop all points to untag any point that next is not tagged */
pt = gps->points;
for (i = 1; i < gps->totpoints - 1; i++, pt++) {
if (pt->flag & GP_SPOINT_TAG) {
-   pt_before = >points[i - 1];
-   pt_after = >points[i + 1];
-
-   /* if any of the side points are not tagged, mark to 
keep */
-   if (((pt_before->flag & GP_SPOINT_TAG) == 0) ||
-   ((pt_after->flag & GP_SPOINT_TAG) == 0))
+   pt2 = >points[i + 1];
+   if (((pt2->flag & GP_SPOINT_TAG) == 0))
{
-   pt->flag |= GP_SPOINT_TEMP_TAG;
-   }
-   else {
-   /* reduce opacity of extreme points */
-   if ((pt_before->flag & GP_SPOINT_TAG) == 0) {
-   pt_before->strength *= 0.5f;
-   }
-   if ((pt_after->flag & GP_SPOINT_TAG) == 0) {
-   pt_after->strength *= 0.5f;
-   }
+   pt->flag &= ~GP_SPOINT_TAG;
}
}
}
 
-   /* last point special case to get smoother transition */
+   /* loop reverse all points to untag any point that previous is not 
tagged */
pt = >points[gps->totpoints - 1];
-   pt_before = >points[gps->totpoints - 2];
-   if (pt->flag & GP_SPOINT_TAG) {
-   pt->flag |= GP_SPOINT_TEMP_TAG;
-   pt->strength = 0.0f;
-
-   pt->flag |= GP_SPOINT_TEMP_TAG;
-   pt_before->strength *= 0.5f;
-   }
-
-   /* now untag temp tagged */
-   pt = gps->points;
-   for (i = 0; i < gps->totpoints; i++, pt++) {
-   if (pt->flag & GP_SPOINT_TEMP_TAG) {
-   pt->flag &= ~GP_SPOINT_TAG;
-   pt->flag &= ~GP_SPOINT_TEMP_TAG;
+   for (i = gps->totpoints - 1; i > 0; i--, pt--) {
+   if (pt->flag & GP_SPOINT_TAG) {
+   pt2 = >points[i - 1];
+   if (((pt2->flag & GP_SPOINT_TAG) == 0))
+   {
+   pt->flag &= ~GP_SPOINT_TAG;
+   }
}
}
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6cf1f687251] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-04-01 Thread Antonioya
Commit: 6cf1f6872514228e72f7aa31e0696c00725719c0
Author: Antonioya
Date:   Mon Apr 1 11:27:20 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB6cf1f6872514228e72f7aa31e0696c00725719c0

Merge branch 'master' into greasepencil-object

===



===

diff --cc source/blender/makesrna/intern/rna_brush.c
index bab59b6e191,0e4f0553a0c..2ab0228fe7d
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@@ -1194,28 -1194,9 +1194,28 @@@ static void rna_def_gpencil_options(Ble
RNA_def_property_float_sdna(prop, NULL, "uv_random");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_text(prop, "UV Random", "Random factor for 
autogenerated UV rotation");
-   RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
  
 +  /* gradient control along y */
 +  prop = RNA_def_property(srna, "gradient_factor", PROP_FLOAT, 
PROP_FACTOR);
 +  RNA_def_property_float_sdna(prop, NULL, "gradient_f");
 +  RNA_def_property_range(prop, 0.001f, 1.0f);
 +  RNA_def_property_float_default(prop, 1.0f);
 +  RNA_def_property_ui_text(
 +  prop, "Border Opacity Factor",
 +  "Amount of gradient along section of stroke (set to 1 for full 
solid)");
 +  RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
 +
 +  /* gradient shape ratio */
 +  prop = RNA_def_property(srna, "gradient_shape", PROP_FLOAT, PROP_XYZ);
 +  RNA_def_property_float_sdna(prop, NULL, "gradient_s");
 +  RNA_def_property_array(prop, 2);
 +  RNA_def_property_range(prop, 0.01f, 1.0f);
 +  RNA_def_property_float_default(prop, 1.0f);
 +  RNA_def_property_ui_text(prop, "Aspect Ratio", "");
 +  RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
 +
prop = RNA_def_property(srna, "input_samples", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "input_samples");
RNA_def_property_range(prop, 0, GP_MAX_INPUT_SAMPLES);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [48b1ba02e55] master: GPencil: Remove low limit for soft eraser

2019-04-01 Thread Antonioya
Commit: 48b1ba02e552034b75f2b7c48ae8955383396373
Author: Antonioya
Date:   Sun Mar 31 20:30:54 2019 +0200
Branches: master
https://developer.blender.org/rB48b1ba02e552034b75f2b7c48ae8955383396373

GPencil: Remove low limit for soft eraser

The low limit was not needed in the loop.

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 4250b95de6d..2bf1c8cda75 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1363,7 +1363,7 @@ static void gp_free_stroke(bGPdata *gpd, bGPDframe *gpf, 
bGPDstroke *gps)
  * to avoid that segments gets the end points rounded.
  * The round caps breaks the artistic effect.
  */
-static void gp_stroke_soft_refine(bGPDstroke *gps, const float cull_thresh)
+static void gp_stroke_soft_refine(bGPDstroke *gps)
 {
bGPDspoint *pt = NULL;
bGPDspoint *pt_before = NULL;
@@ -1386,11 +1386,9 @@ static void gp_stroke_soft_refine(bGPDstroke *gps, const 
float cull_thresh)
 
/* if any of the side points are not tagged, mark to 
keep */
if (((pt_before->flag & GP_SPOINT_TAG) == 0) ||
-   ((pt_after->flag & GP_SPOINT_TAG) == 0))
+   ((pt_after->flag & GP_SPOINT_TAG) == 0))
{
-   if (pt->pressure > cull_thresh) {
-   pt->flag |= GP_SPOINT_TEMP_TAG;
-   }
+   pt->flag |= GP_SPOINT_TEMP_TAG;
}
else {
/* reduce opacity of extreme points */
@@ -1408,18 +1406,16 @@ static void gp_stroke_soft_refine(bGPDstroke *gps, 
const float cull_thresh)
pt = >points[gps->totpoints - 1];
pt_before = >points[gps->totpoints - 2];
if (pt->flag & GP_SPOINT_TAG) {
-   pt->flag &= ~GP_SPOINT_TAG;
-   pt->flag &= ~GP_SPOINT_TEMP_TAG;
+   pt->flag |= GP_SPOINT_TEMP_TAG;
pt->strength = 0.0f;
 
-   pt_before->flag &= ~GP_SPOINT_TAG;
-   pt_before->flag &= ~GP_SPOINT_TEMP_TAG;
+   pt->flag |= GP_SPOINT_TEMP_TAG;
pt_before->strength *= 0.5f;
}
 
/* now untag temp tagged */
pt = gps->points;
-   for (i = 1; i < gps->totpoints - 1; i++, pt++) {
+   for (i = 0; i < gps->totpoints; i++, pt++) {
if (pt->flag & GP_SPOINT_TEMP_TAG) {
pt->flag &= ~GP_SPOINT_TAG;
pt->flag &= ~GP_SPOINT_TEMP_TAG;
@@ -1632,7 +1628,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
/* if soft eraser, must analyze points to be sure the 
stroke ends
 * don't get rounded */
if (eraser->gpencil_settings->eraser_mode == 
GP_BRUSH_ERASER_SOFT) {
-   gp_stroke_soft_refine(gps, cull_thresh);
+   gp_stroke_soft_refine(gps);
}
 
gp_stroke_delete_tagged_points(gpf, gps, gps->next, 
GP_SPOINT_TAG, false, 0);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fa6c2c7dba9] master: GPencil: Handle vertex groups weights correctly

2019-04-01 Thread Antonioya
Commit: fa6c2c7dba909e5d8a88817854b215990eea7051
Author: Antonioya
Date:   Mon Apr 1 16:47:01 2019 +0200
Branches: master
https://developer.blender.org/rBfa6c2c7dba909e5d8a88817854b215990eea7051

GPencil: Handle vertex groups weights correctly

In extrude operator when the point was added, the weight data pointer was 
wrongly connected to old pointer.

Now, when move the data, the pointer is moved, but when a new point is added, 
the memory is duplicated to keep separated copies of the pointer.

This is related T62872

Thanks to @sergey for his help fixing this bug.

===

M   source/blender/editors/gpencil/gpencil_edit.c

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index b6499200e01..99d37f87da7 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -757,11 +757,11 @@ void GPENCIL_OT_duplicate(wmOperatorType *ot)
 /* ** Extrude Selected Strokes  */
 
 /* helper to copy a point to temp area */
-static void copy_point(
+static void copy_move_point(
 bGPDstroke *gps,
 bGPDspoint *temp_points,
 MDeformVert *temp_dverts,
-int from_idx, int to_idx)
+int from_idx, int to_idx, const bool copy)
 {
bGPDspoint *pt = _points[from_idx];
bGPDspoint *pt_final = >points[to_idx];
@@ -779,7 +779,13 @@ static void copy_point(
MDeformVert *dvert_final = >dvert[to_idx];
 
dvert_final->totweight = dvert->totweight;
-   dvert_final->dw = dvert->dw;
+   /* if copy, duplicate memory, otherwise move only the pointer */
+   if (copy) {
+   dvert_final->dw = MEM_dupallocN(dvert->dw);
+   }
+   else {
+   dvert_final->dw = dvert->dw;
+   }
}
 }
 
@@ -822,7 +828,7 @@ static void gpencil_add_move_points(bGPDframe *gpf, 
bGPDstroke *gps)
BLI_insertlinkafter(>strokes, gps, gps_new);
 
/* copy selected point data to new stroke */
-   copy_point(gps_new, gps->points, gps->dvert, i, 0);
+   copy_move_point(gps_new, gps->points, gps->dvert, i, 0, 
true);
 
/* deselect orinal point */
pt->flag &= ~GP_SPOINT_SELECT;
@@ -863,14 +869,14 @@ static void gpencil_add_move_points(bGPDframe *gpf, 
bGPDstroke *gps)
 
/* move points to new position */
for (int i = 0; i < oldtotpoints; i++) {
-   copy_point(gps, temp_points, temp_dverts, i, i2);
+   copy_move_point(gps, temp_points, temp_dverts, i, i2, 
false);
i2++;
}
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
 
/* if first point, add new point at the begining */
if (do_first) {
-   copy_point(gps, temp_points, temp_dverts, 0, 0);
+   copy_move_point(gps, temp_points, temp_dverts, 0, 0, 
true);
/* deselect old */
pt = >points[1];
pt->flag &= ~GP_SPOINT_SELECT;
@@ -881,9 +887,9 @@ static void gpencil_add_move_points(bGPDframe *gpf, 
bGPDstroke *gps)
 
/* if last point, add new point at the end */
if (do_last) {
-   copy_point(
+   copy_move_point(
gps, temp_points, temp_dverts,
-   oldtotpoints - 1, gps->totpoints - 1);
+   oldtotpoints - 1, gps->totpoints - 1, true);
 
/* deselect old */
pt = >points[gps->totpoints - 2];

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7fc7e325efb] master: Fix T63082: Outliner allows assign grease pencil materials to mesh

2019-03-29 Thread Antonioya
Commit: 7fc7e325efbb1ccab181e32873f3ad49ed42755d
Author: Antonioya
Date:   Fri Mar 29 11:58:28 2019 +0100
Branches: master
https://developer.blender.org/rB7fc7e325efbb1ccab181e32873f3ad49ed42755d

Fix T63082: Outliner allows assign grease pencil materials to mesh

The grease pencil materials only can be assigned to objects of grease pencil 
type.

===

M   source/blender/editors/space_outliner/outliner_dragdrop.c

===

diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c 
b/source/blender/editors/space_outliner/outliner_dragdrop.c
index 77821ec0990..647fdeccb40 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.c
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.c
@@ -649,6 +649,11 @@ static int material_drop_invoke(bContext *C, wmOperator 
*UNUSED(op), const wmEve
return OPERATOR_CANCELLED;
}
 
+   /* only drop grease pencil material on grease pencil objects */
+   if ((ma->gp_style != NULL) && (ob->type != OB_GPENCIL)) {
+   return OPERATOR_CANCELLED;
+   }
+
assign_material(bmain, ob, ma, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF);
 
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [800aeaba72f] master: GPencil: Cleanup code

2019-03-29 Thread Antonioya
Commit: 800aeaba72f0ed457c45a1ebfe7d09e3c8c7ba6c
Author: Antonioya
Date:   Fri Mar 29 12:51:46 2019 +0100
Branches: master
https://developer.blender.org/rB800aeaba72f0ed457c45a1ebfe7d09e3c8c7ba6c

GPencil: Cleanup code

Reduce double function calling.

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index cd17f7dc640..eece759035f 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1559,20 +1559,24 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
if 
(eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_SOFT) {
float f_strength = 
eraser->gpencil_settings->era_strength_f / 100.0f;
float f_thickness = 
eraser->gpencil_settings->era_thickness_f / 100.0f;
+   float influence = 0.0f;
 
if (pt0) {
-   pt0->strength 
-= gp_stroke_eraser_calc_influence(p, mval, radius, pc0) * strength * 
f_strength * 0.5f;
+   influence = 
gp_stroke_eraser_calc_influence(p, mval, radius, pc0);
+   pt0->strength 
-= influence * strength * f_strength * 0.5f;

CLAMP_MIN(pt0->strength, 0.0f);
-   pt0->pressure 
-= gp_stroke_eraser_calc_influence(p, mval, radius, pc0) * strength * 
f_thickness * 0.5f;
+   pt0->pressure 
-= influence * strength * f_thickness * 0.5f;
}
 
-   pt1->strength -= 
gp_stroke_eraser_calc_influence(p, mval, radius, pc1) * strength * f_strength;
+   influence = 
gp_stroke_eraser_calc_influence(p, mval, radius, pc1);
+   pt1->strength -= 
influence * strength * f_strength;

CLAMP_MIN(pt1->strength, 0.0f);
-   pt1->pressure -= 
gp_stroke_eraser_calc_influence(p, mval, radius, pc1) * strength * f_thickness;
+   pt1->pressure -= 
influence * strength * f_thickness;
 
-   pt2->strength -= 
gp_stroke_eraser_calc_influence(p, mval, radius, pc2) * strength * f_strength * 
0.5f;
+   influence = 
gp_stroke_eraser_calc_influence(p, mval, radius, pc2);
+   pt2->strength -= 
influence * strength * f_strength * 0.5f;

CLAMP_MIN(pt2->strength, 0.0f);
-   pt2->pressure -= 
gp_stroke_eraser_calc_influence(p, mval, radius, pc2) * strength * f_thickness 
* 0.5f;
+   pt2->pressure -= 
influence * strength * f_thickness * 0.5f;
 
/* if invisible, delete 
point */
if ((pt0) &&

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4f938d2cfe1] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-04-07 Thread Antonioya
Commit: 4f938d2cfe1a0949b07d4c5de160c637d1e8ddfa
Author: Antonioya
Date:   Sun Apr 7 17:05:26 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB4f938d2cfe1a0949b07d4c5de160c637d1e8ddfa

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [75f551facaf] master: GPencil: Fix wrong Brush texture for pinned materials

2019-04-07 Thread Antonioya
Commit: 75f551facaf0a103b169ccc955b57099bd33a16a
Author: Antonioya
Date:   Sun Apr 7 17:02:13 2019 +0200
Branches: master
https://developer.blender.org/rB75f551facaf0a103b169ccc955b57099bd33a16a

GPencil: Fix wrong Brush texture for pinned materials

If the Brush had a pinned material with texture, but the material slot was in a 
different material, the texture was not working.

The material was not recovered from brush, but from object.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 3a74e44836d..c5546a55dda 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -22,8 +22,10 @@
 #include "DRW_engine.h"
 #include "DRW_render.h"
 
+#include "BKE_gpencil.h"
 #include "BKE_library.h"
 #include "BKE_object.h"
+#include "BKE_paint.h"
 #include "BKE_shader_fx.h"
 
 #include "DNA_gpencil_types.h"
@@ -302,7 +304,9 @@ void GPENCIL_cache_init(void *vedata)
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
+   ToolSettings *ts = scene->toolsettings;
View3D *v3d = draw_ctx->v3d;
+   Brush *brush = BKE_paint_brush(>gp_paint->paint);
 
/* Special handling for when active object is GP object (e.g. for draw 
mode) */
Object *obact = draw_ctx->obact;
@@ -311,7 +315,15 @@ void GPENCIL_cache_init(void *vedata)
 
if (obact && (obact->type == OB_GPENCIL) && (obact->data)) {
obact_gpd = (bGPdata *)obact->data;
-   gp_style = BKE_material_gpencil_settings_get(obact, 
obact->actcol);
+   /* use the brush material */
+   Material *ma = BKE_gpencil_get_material_for_brush(obact, brush);
+   if (ma != NULL) {
+   gp_style = ma->gp_style;
+   }
+   /* this is not common, but avoid any special situations when 
brush could be without material */
+   if (gp_style == NULL) {
+   gp_style = BKE_material_gpencil_settings_get(obact, 
obact->actcol);
+   }
}
 
if (!stl->g_data) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e944835aa5e] master: GPencil: Cleanup unused code

2019-04-08 Thread Antonioya
Commit: e944835aa5e6bd4002465e8d05de21450e769b30
Author: Antonioya
Date:   Mon Apr 8 11:28:53 2019 +0200
Branches: master
https://developer.blender.org/rBe944835aa5e6bd4002465e8d05de21450e769b30

GPencil: Cleanup unused code

===

M   source/blender/editors/gpencil/gpencil_old.c

===

diff --git a/source/blender/editors/gpencil/gpencil_old.c 
b/source/blender/editors/gpencil/gpencil_old.c
index 47654b69da4..a5f552e411b 100644
--- a/source/blender/editors/gpencil/gpencil_old.c
+++ b/source/blender/editors/gpencil/gpencil_old.c
@@ -161,36 +161,6 @@ static int gpencil_convert_old_files_exec(bContext *C, 
wmOperator *UNUSED(op))
scene->gpd = NULL;
}
 
-#if 0 /* GPXX */
-   /* Handle object-linked grease pencil datablocks */
-   for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
-   if (ob->gpd) {
-   if (ob->type == OB_GPENCIL) {
-   /* GP Object - remap the links */
-   ob->data = ob->gpd;
-   ob->gpd = NULL;
-   }
-   else if (ob->type == OB_EMPTY) {
-   /* Empty with GP data - This should be able to 
be converted
-* to a GP object with little data loss
-*/
-   ob->data = ob->gpd;
-   ob->gpd = NULL;
-   ob->type = OB_GPENCIL;
-   }
-   else {
-   /* FIXME: What to do in this case?
-*
-* We cannot create new objects for these, as 
we don't have a scene & scene layer
-* to put them into from here...
-*/
-   printf("WARNING: Old Grease Pencil data ('%s') 
still exists on Object '%s'\n",
-  ob->gpd->id.name + 2, ob->id.name + 2);
-   }
-   }
-   }
-#endif
-
/* notifiers */
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [31066ef2344] greasepencil-object: GPencil: Fix stroke opacity initialization

2019-04-08 Thread Antonioya
Commit: 31066ef234484db78e5b88e2f835a6720d679b22
Author: Antonioya
Date:   Mon Apr 8 17:22:48 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB31066ef234484db78e5b88e2f835a6720d679b22

GPencil: Fix stroke opacity initialization

===

M   source/blender/blenloader/intern/versioning_280.c

===

diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 028a9eb8428..ae525c8339f 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2944,32 +2944,6 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
}
} FOREACH_NODETREE_END;
 
-   /* init grease pencil brush gradients */
-   if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", 
"float", "gradient_f")) {
-   for (Brush *brush = bmain->brushes.first; brush; brush 
= brush->id.next) {
-   if (brush->gpencil_settings != NULL) {
-   BrushGpencilSettings *gp = 
brush->gpencil_settings;
-   gp->gradient_f = 1.0f;
-   gp->gradient_s[0] = 1.0f;
-   gp->gradient_s[1] = 1.0f;
-   }
-   }
-   }
-
-   /* init grease pencil stroke gradients */
-   if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "float", 
"gradient_f")) {
-   for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = 
gpd->id.next) {
-   for (bGPDlayer *gpl = gpd->layers.first; gpl; 
gpl = gpl->next) {
-   for (bGPDframe *gpf = 
gpl->frames.first; gpf; gpf = gpf->next) {
-   for (bGPDstroke *gps = 
gpf->strokes.first; gps; gps = gps->next) {
-   gps->gradient_f = 1.0f;
-   gps->gradient_s[0] = 
1.0f;
-   gps->gradient_s[1] = 
1.0f;
-   }
-   }
-   }
-   }
-   }
}
 
if (!MAIN_VERSION_ATLEAST(bmain, 280, 53)) {
@@ -3048,5 +3022,33 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
}
}
}
+
+   /* init grease pencil brush gradients */
+   if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", 
"float", "gradient_f")) {
+   for (Brush *brush = bmain->brushes.first; brush; brush 
= brush->id.next) {
+   if (brush->gpencil_settings != NULL) {
+   BrushGpencilSettings *gp = 
brush->gpencil_settings;
+   gp->gradient_f = 1.0f;
+   gp->gradient_s[0] = 1.0f;
+   gp->gradient_s[1] = 1.0f;
+   }
+   }
+   }
+
+   /* init grease pencil stroke gradients */
+   if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "float", 
"gradient_f")) {
+   for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = 
gpd->id.next) {
+   for (bGPDlayer *gpl = gpd->layers.first; gpl; 
gpl = gpl->next) {
+   for (bGPDframe *gpf = 
gpl->frames.first; gpf; gpf = gpf->next) {
+   for (bGPDstroke *gps = 
gpf->strokes.first; gps; gps = gps->next) {
+   gps->gradient_f = 1.0f;
+   gps->gradient_s[0] = 
1.0f;
+   gps->gradient_s[1] = 
1.0f;
+   }
+   }
+   }
+   }
+   }
+
}
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1f1eedf8ad9] master: GPencil: Mark Object gpd field as Deprecated

2019-04-08 Thread Antonioya
Commit: 1f1eedf8ad90da3c2ca9eb1d4554a895cbcaf506
Author: Antonioya
Date:   Mon Apr 8 16:23:58 2019 +0200
Branches: master
https://developer.blender.org/rB1f1eedf8ad90da3c2ca9eb1d4554a895cbcaf506

GPencil: Mark Object gpd field as Deprecated

This field is only used to read old files, but it's not used anymore, so it's 
better mark as deprecated to avoid wrong uses.

===

M   source/blender/blenkernel/intern/library_query.c
M   source/blender/editors/space_outliner/outliner_tree.c
M   source/blender/makesdna/DNA_object_types.h

===

diff --git a/source/blender/blenkernel/intern/library_query.c 
b/source/blender/blenkernel/intern/library_query.c
index 453cbe16de0..cdbbc404538 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -581,7 +581,7 @@ static void library_foreach_ID_link(
}
data.cb_flag = data_cb_flag;
 
-   CALLBACK_INVOKE(object->gpd, IDWALK_CB_USER);
+   /* Note that ob->gpd is deprecated, so no need 
to handle it here. */
CALLBACK_INVOKE(object->instance_collection, 
IDWALK_CB_USER);
 
if (object->pd) {
diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index 72e9236636e..a4e512d6846 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -331,8 +331,6 @@ static void outliner_add_object_contents(SpaceOutliner 
*soops, TreeElement *te,
outliner_add_element(soops, >subtree, ob->proxy, te, 
TSE_PROXY, 0);
}
 
-   outliner_add_element(soops, >subtree, ob->gpd, te, 0, 0);
-
outliner_add_element(soops, >subtree, ob->data, te, 0, 0);
 
if (ob->pose) {
diff --git a/source/blender/makesdna/DNA_object_types.h 
b/source/blender/makesdna/DNA_object_types.h
index 9f2118d9cc0..c8684f42963 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -202,7 +202,7 @@ typedef struct Object {
void *data;
 
/** Grease Pencil data. */
-   struct bGPdata *gpd;
+   struct bGPdata *gpd  DNA_DEPRECATED; // XXX deprecated... replaced by 
gpencil object, keep for readfile
 
/** Settings for visualization of object-transform animation. */
bAnimVizSettings avs;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a016499d4a7] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-04-08 Thread Antonioya
Commit: a016499d4a7d2984048083b079139ae9431ca811
Author: Antonioya
Date:   Mon Apr 8 16:32:00 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBa016499d4a7d2984048083b079139ae9431ca811

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ccfda7dc2c5] master: GP: Disable Onion calculation when Overlay is OFF

2019-02-24 Thread Antonioya
Commit: ccfda7dc2c5d7fe26f0461df2c8209fa6698f9c3
Author: Antonioya
Date:   Sun Feb 24 16:03:03 2019 +0100
Branches: master
https://developer.blender.org/rBccfda7dc2c5d7fe26f0461df2c8209fa6698f9c3

GP: Disable Onion calculation when Overlay is OFF

Now, it's not required to disable the Onion in Overlay panel.

===

M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 2e9a3cf1fc7..816bc554bc7 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -69,8 +69,9 @@ static void gpencil_calc_vertex(
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool main_onion = draw_ctx->v3d != NULL ? (draw_ctx->v3d->gp_flag 
& V3D_GP_SHOW_ONION_SKIN) : true;
const bool playing = stl->storage->is_playing;
+   const bool overlay = draw_ctx->v3d != NULL ? 
(bool)((draw_ctx->v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) : true;
const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 
0) &&
-   main_onion && DRW_gpencil_onion_active(gpd) && !playing;
+   overlay && main_onion && DRW_gpencil_onion_active(gpd) && 
!playing;
 
const bool time_remap = BKE_gpencil_has_time_modifiers(ob);
const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5d7ce96b5df] master: GP: Don't set cache as dirty with Onion

2019-02-24 Thread Antonioya
Commit: 5d7ce96b5df1851a559c84907ea0cd935a0be267
Author: Antonioya
Date:   Sun Feb 24 17:00:12 2019 +0100
Branches: master
https://developer.blender.org/rB5d7ce96b5df1851a559c84907ea0cd935a0be267

GP: Don't set cache as dirty with Onion

===

M   source/blender/draw/engines/gpencil/gpencil_cache_utils.c
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
index c99c7befa32..f6702f6f56b 100644
--- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
@@ -185,13 +185,6 @@ static bool gpencil_batch_cache_valid(GpencilBatchCache 
*cache, bGPdata *gpd, in
gpd->flag &= ~GP_DATA_PYTHON_UPDATED;
valid = false;
}
-   else if (DRW_gpencil_onion_active(gpd)) {
-   /* if onion, set as dirty always
-* This reduces performance, but avoid any crash in the multiple
-* overlay and multiwindow options and keep all windows working
-*/
-   valid = false;
-   }
else if (cache->is_editmode) {
valid = false;
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 816bc554bc7..c2932b34b65 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -65,6 +65,10 @@ static void gpencil_calc_vertex(
 GpencilBatchCache *cache, bGPdata *gpd,
 int cfra_eval)
 {
+   if (!cache->is_dirty) {
+   return;
+   }
+
Object *ob = cache_ob->ob;
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool main_onion = draw_ctx->v3d != NULL ? (draw_ctx->v3d->gp_flag 
& V3D_GP_SHOW_ONION_SKIN) : true;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [13dd8b69f03] master: GP: Rename "Dualtone" to "Duotone"

2019-02-26 Thread Antonioya
Commit: 13dd8b69f036980b7ad14b692ad5c1edb11745d0
Author: Antonioya
Date:   Tue Feb 26 10:15:13 2019 +0100
Branches: master
https://developer.blender.org/rB13dd8b69f036980b7ad14b692ad5c1edb11745d0

GP: Rename "Dualtone" to "Duotone"

===

M   
source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
M   source/blender/makesdna/DNA_shader_fx_types.h
M   source/blender/makesrna/intern/rna_shader_fx.c

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
index e7b38d092af..fb44b18cc86 100644
--- 
a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
+++ 
b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
@@ -10,7 +10,7 @@ out vec4 FragColor;
 
 #define MODE_GRAYSCALE   0
 #define MODE_SEPIA   1
-#define MODE_DUALTONE2
+#define MODE_DUOTONE2
 #define MODE_CUSTOM  3
 #define MODE_TRANSPARENT 4
 
@@ -48,7 +48,7 @@ void main()
outcolor = vec4(Red, Green, Blue, src_pixel.a);
break;
}
-   case MODE_DUALTONE:
+   case MODE_DUOTONE:
{
if (luminance <= factor) {
outcolor = low_color;
diff --git a/source/blender/makesdna/DNA_shader_fx_types.h 
b/source/blender/makesdna/DNA_shader_fx_types.h
index 96b114dd365..342c2be9d17 100644
--- a/source/blender/makesdna/DNA_shader_fx_types.h
+++ b/source/blender/makesdna/DNA_shader_fx_types.h
@@ -115,7 +115,7 @@ typedef struct ColorizeShaderFxData {
 typedef enum ColorizeShaderFxModes {
eShaderFxColorizeMode_GrayScale = 0,
eShaderFxColorizeMode_Sepia = 1,
-   eShaderFxColorizeMode_DualTone = 2,
+   eShaderFxColorizeMode_Duotone = 2,
eShaderFxColorizeMode_Custom = 3,
eShaderFxColorizeMode_Transparent = 4,
 } ColorizeShaderFxModes;
diff --git a/source/blender/makesrna/intern/rna_shader_fx.c 
b/source/blender/makesrna/intern/rna_shader_fx.c
index 2f0a4a4be7d..78a21b71fbf 100644
--- a/source/blender/makesrna/intern/rna_shader_fx.c
+++ b/source/blender/makesrna/intern/rna_shader_fx.c
@@ -77,7 +77,7 @@ static const EnumPropertyItem 
rna_enum_shaderfx_glow_modes_items[] = {
 static const EnumPropertyItem rna_enum_shaderfx_colorize_modes_items[] = {
{eShaderFxColorizeMode_GrayScale, "GRAYSCALE", 0, "Gray Scale", "" },
{eShaderFxColorizeMode_Sepia, "SEPIA", 0, "Sepia", "" },
-   {eShaderFxColorizeMode_DualTone, "DUALTONE", 0, "Dualtone", "" },
+   {eShaderFxColorizeMode_Duotone, "DUOTONE", 0, "Duotone", "" },
{eShaderFxColorizeMode_Transparent, "TRANSPARENT", 0, "Transparent", "" 
},
{eShaderFxColorizeMode_Custom, "CUSTOM", 0, "Custom", "" },
{0, NULL, 0, NULL, NULL }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a7acd4690c2] master: GP: Rename Colorize "Bi-Tone" to "Dualtone"

2019-02-25 Thread Antonioya
Commit: a7acd4690c20a2363e665b29cd41dbf520454e2e
Author: Antonioya
Date:   Mon Feb 25 17:45:52 2019 +0100
Branches: master
https://developer.blender.org/rBa7acd4690c20a2363e665b29cd41dbf520454e2e

GP: Rename Colorize "Bi-Tone" to "Dualtone"

===

M   
source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
M   source/blender/makesdna/DNA_shader_fx_types.h
M   source/blender/makesrna/intern/rna_shader_fx.c

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
index 33b249ac09b..e7b38d092af 100644
--- 
a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
+++ 
b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_colorize_frag.glsl
@@ -10,7 +10,7 @@ out vec4 FragColor;
 
 #define MODE_GRAYSCALE   0
 #define MODE_SEPIA   1
-#define MODE_BITONE  2
+#define MODE_DUALTONE2
 #define MODE_CUSTOM  3
 #define MODE_TRANSPARENT 4
 
@@ -48,7 +48,7 @@ void main()
outcolor = vec4(Red, Green, Blue, src_pixel.a);
break;
}
-   case MODE_BITONE:
+   case MODE_DUALTONE:
{
if (luminance <= factor) {
outcolor = low_color;
diff --git a/source/blender/makesdna/DNA_shader_fx_types.h 
b/source/blender/makesdna/DNA_shader_fx_types.h
index d65e0bd6126..96b114dd365 100644
--- a/source/blender/makesdna/DNA_shader_fx_types.h
+++ b/source/blender/makesdna/DNA_shader_fx_types.h
@@ -115,7 +115,7 @@ typedef struct ColorizeShaderFxData {
 typedef enum ColorizeShaderFxModes {
eShaderFxColorizeMode_GrayScale = 0,
eShaderFxColorizeMode_Sepia = 1,
-   eShaderFxColorizeMode_BiTone = 2,
+   eShaderFxColorizeMode_DualTone = 2,
eShaderFxColorizeMode_Custom = 3,
eShaderFxColorizeMode_Transparent = 4,
 } ColorizeShaderFxModes;
diff --git a/source/blender/makesrna/intern/rna_shader_fx.c 
b/source/blender/makesrna/intern/rna_shader_fx.c
index 8b479e9f05a..2f0a4a4be7d 100644
--- a/source/blender/makesrna/intern/rna_shader_fx.c
+++ b/source/blender/makesrna/intern/rna_shader_fx.c
@@ -77,7 +77,7 @@ static const EnumPropertyItem 
rna_enum_shaderfx_glow_modes_items[] = {
 static const EnumPropertyItem rna_enum_shaderfx_colorize_modes_items[] = {
{eShaderFxColorizeMode_GrayScale, "GRAYSCALE", 0, "Gray Scale", "" },
{eShaderFxColorizeMode_Sepia, "SEPIA", 0, "Sepia", "" },
-   {eShaderFxColorizeMode_BiTone, "BITONE", 0, "Bi-Tone", "" },
+   {eShaderFxColorizeMode_DualTone, "DUALTONE", 0, "Dualtone", "" },
{eShaderFxColorizeMode_Transparent, "TRANSPARENT", 0, "Transparent", "" 
},
{eShaderFxColorizeMode_Custom, "CUSTOM", 0, "Custom", "" },
{0, NULL, 0, NULL, NULL }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5d8a8a68425] master: GP: Add support for Wireframe mode

2019-02-25 Thread Antonioya
Commit: 5d8a8a684253da03bf20182be443c2bd03798a49
Author: Antonioya
Date:   Mon Feb 25 17:41:02 2019 +0100
Branches: master
https://developer.blender.org/rB5d8a8a684253da03bf20182be443c2bd03798a49

GP: Add support for Wireframe mode

When enable Wireframe mode in the shading type, all strokes are displayed as 
simple 1 pixel lines.

The color of the line is equal to the stroke color or the fill color if the 
fill is enabled and the stroke is disabled or has invisible alpha value.

In wireframe mode, all FX are disabled because sometimes the effects can make 
the lines invisible.

The modifiers are not disabled.

Still pending to decide if we must add support for Random colors, but not sure 
if this is useful in 2D.

===

M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/gpencil_shader_fx.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index c2932b34b65..d505095a393 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -598,7 +598,7 @@ static void gpencil_add_stroke_vertexdata(
 GpencilBatchCache *cache,
 Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
 const float opacity, const float tintcolor[4], const bool onion,
-const bool custonion)
+const bool custonion, const bool use_wiremode)
 {
float tcolor[4];
float ink[4];
@@ -616,6 +616,15 @@ static void gpencil_add_stroke_vertexdata(
else {
interp_v3_v3v3(tcolor, 
gps->runtime.tmp_stroke_rgba, tintcolor, tintcolor[3]);
tcolor[3] = gps->runtime.tmp_stroke_rgba[3] * 
opacity;
+
+   if ((use_wiremode) &&
+   ((gps->runtime.tmp_stroke_rgba[3] < 
GPENCIL_ALPHA_OPACITY_THRESH) ||
+(((gp_style->flag & 
GP_STYLE_STROKE_SHOW) == 0))) &&
+   (gps->runtime.tmp_fill_rgba[3] >= 
GPENCIL_ALPHA_OPACITY_THRESH))
+   {
+   interp_v3_v3v3(tcolor, 
gps->runtime.tmp_fill_rgba, tintcolor, tintcolor[3]);
+   tcolor[3] = 
gps->runtime.tmp_fill_rgba[3] * opacity;
+   }
}
copy_v4_v4(ink, tcolor);
}
@@ -629,8 +638,14 @@ static void gpencil_add_stroke_vertexdata(
}
}
 
-   sthickness = gps->thickness + gpl->line_change;
-   CLAMP_MIN(sthickness, 1);
+   /* if wireframe mode, set thickeness to 1 */
+   if (!use_wiremode) {
+   sthickness = gps->thickness + gpl->line_change;
+   CLAMP_MIN(sthickness, 1);
+   }
+   else {
+   sthickness = 1;
+   }
 
if ((gps->totpoints > 1) && (gp_style->mode == 
GP_STYLE_MODE_LINE)) {
/* create vertex data */
@@ -812,6 +827,7 @@ static void gpencil_draw_strokes(
/* fill */
if ((gp_style->flag & GP_STYLE_FILL_SHOW) &&
(!stl->storage->simplify_fill) &&
+   (stl->storage->shading_type != OB_WIRE) 
&&
((gps->flag & GP_STROKE_NOFILL) == 0))
{
gpencil_add_fill_vertexdata(
@@ -821,13 +837,15 @@ static void gpencil_draw_strokes(
/* stroke */
/* No fill strokes, must show stroke always */
if (((gp_style->flag & GP_STYLE_STROKE_SHOW) ||
-(gps->flag & GP_STROKE_NOFILL)) &&
+(gps->flag & GP_STROKE_NOFILL) ||
+(stl->storage->shading_type == 
OB_WIRE)) &&
((gp_style->stroke_rgba[3] > 
GPENCIL_ALPHA_OPACITY_THRESH) ||
 (gpl->blend_mode == eGplBlendMode_Normal)))
{
gpencil_add_stroke_ve

[Bf-blender-cvs] [7809ef8c579] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-02-25 Thread Antonioya
Commit: 7809ef8c57931268a275f2f32a9ae2b8e60d8433
Author: Antonioya
Date:   Mon Feb 25 17:52:07 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB7809ef8c57931268a275f2f32a9ae2b8e60d8433

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2b3553eff2a] master: GP: Redesign wireframe mode

2019-02-26 Thread Antonioya
Commit: 2b3553eff2a01cf3d1655183de9ebd416abde9c1
Author: Antonioya
Date:   Tue Feb 26 16:55:21 2019 +0100
Branches: master
https://developer.blender.org/rB2b3553eff2a01cf3d1655183de9ebd416abde9c1

GP: Redesign wireframe mode

Now it's possible use the different Wire modes (Single, Object & Random)

Also support for x-ray mode.

For random colors, the name of the object and the name of the layer is used.

Also some parameters cleanup.

===

M   release/scripts/startup/bl_ui/properties_object.py
M   source/blender/draw/engines/gpencil/gpencil_cache_utils.c
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/gpencil_shader_fx.c
M   source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
M   source/blender/draw/engines/gpencil/shaders/gpencil_point_vert.glsl
M   source/blender/draw/engines/gpencil/shaders/gpencil_stroke_vert.glsl

===

diff --git a/release/scripts/startup/bl_ui/properties_object.py 
b/release/scripts/startup/bl_ui/properties_object.py
index 2ec7f1df3a0..e87127c1274 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -221,6 +221,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel):
 is_wire = (obj_type in {'CAMERA', 'EMPTY'})
 is_empty_image = (obj_type == 'EMPTY' and obj.empty_display_type == 
'IMAGE')
 is_dupli = (obj.instance_type != 'NONE')
+is_gpencil = (obj_type == 'GPENCIL')
 
 col = flow.column()
 col.prop(obj, "show_name", text="Name")
@@ -262,7 +263,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel):
 row.active = obj.show_bounds or (obj.display_type == 'BOUNDS')
 row.prop(obj, "display_bounds_type", text="")
 
-if is_geometry or is_empty_image:
+if is_geometry or is_empty_image or is_gpencil:
 # Only useful with object having faces/materials...
 col = flow.column()
 col.prop(obj, "color")
diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
index f6702f6f56b..c18aa27ea79 100644
--- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
@@ -45,6 +45,7 @@ tGPencilObjectCache *gpencil_object_cache_add(
const DRWContextState *draw_ctx = DRW_context_state_get();
tGPencilObjectCache *cache_elem = NULL;
RegionView3D *rv3d = draw_ctx->rv3d;
+   View3D *v3d = draw_ctx->v3d;
tGPencilObjectCache *p = NULL;
 
/* By default a cache is created with one block with a predefined 
number of free slots,
@@ -79,6 +80,16 @@ tGPencilObjectCache *gpencil_object_cache_add(
cache_elem->pixfactor = cache_elem->gpd->pixfactor;
cache_elem->shader_fx = ob->shader_fx;
 
+   /* save wire mode (object mode is always primary option) */
+   if (ob->dt == OB_WIRE) {
+   cache_elem->shading_type = (int)OB_WIRE;
+   }
+   else {
+   if (v3d) {
+   cache_elem->shading_type = (int)v3d->shading.type;
+   }
+   }
+
/* shgrp array */
cache_elem->tot_layers = 0;
int totgpl = BLI_listbase_count(_elem->gpd->layers);
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 7b2cf0bfe65..cbd50c848b9 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -30,6 +30,8 @@
 #include "BKE_material.h"
 #include "BKE_paint.h"
 
+#include "BLI_hash.h"
+
 #include "ED_gpencil.h"
 
 #include "DNA_gpencil_types.h"
@@ -243,13 +245,77 @@ static void DRW_gpencil_recalc_geometry_caches(
}
 }
 
+static void set_wireframe_color(Object *ob, bGPDlayer *gpl, View3D *v3d,
+   GPENCIL_StorageList *stl,
+   MaterialGPencilStyle *gp_style, int id)
+{
+   float color[4];
+   if (((gp_style->stroke_rgba[3] < GPENCIL_ALPHA_OPACITY_THRESH) ||
+(((gp_style->flag & GP_STYLE_STROKE_SHOW) == 0))) &&
+   (gp_style->fill_rgba[3] >= GPENCIL_ALPHA_OPACITY_THRESH))
+   {
+   copy_v4_v4(color, gp_style->fill_rgba);
+   }
+   else {
+   copy_v4_v4(color, gp_style->stroke_rgba);
+   }
+   float alpha = color[3];
+
+   /* wire color */
+   if ((v3d) && (id > -1)) {
+   switch (

[Bf-blender-cvs] [18c43863f46] greasepencil-object: GPencil: Draw Outline to Active and Selected objects

2019-02-28 Thread Antonioya
Commit: 18c43863f464f231a74454bec45c388abc737304
Author: Antonioya
Date:   Thu Feb 28 10:47:57 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB18c43863f464f231a74454bec45c388abc737304

GPencil: Draw Outline to Active and Selected objects

Now an outline is drawn when the grease pencil is selected.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index a045792ad4d..2ce7a53e968 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -40,6 +40,8 @@
 #include "ED_view3d.h"
 #include "ED_screen.h"
 
+#include "UI_resources.h"
+
 
 extern char datatoc_gpencil_fill_vert_glsl[];
 extern char datatoc_gpencil_fill_frag_glsl[];
@@ -455,6 +457,8 @@ void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeColor", 
_data.input_color_tx);
DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeDepth", 
_data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp, "tonemapping", 
>storage->tonemapping, 1);
+   DRW_shgroup_uniform_int(mix_shgrp, "do_select", 
>storage->do_select, 1);
+   DRW_shgroup_uniform_vec4(mix_shgrp, "select_color", 
stl->storage->select_color, 1);
 
/* mix pass no blend used to copy between passes. A separated 
pass is required
 * because if mix_pass is used, the acumulation of blend 
degrade the colors.
@@ -470,6 +474,8 @@ void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, 
"strokeColor", _data.input_color_tx);
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, 
"strokeDepth", _data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp_noblend, "tonemapping", 
>storage->tonemapping, 1);
+   DRW_shgroup_uniform_int(mix_shgrp_noblend, "do_select", 
>storage->do_select, 1);
+   DRW_shgroup_uniform_vec4(mix_shgrp_noblend, "select_color", 
stl->storage->select_color, 1);
 
/* Painting session pass (used only to speedup while the user 
is drawing )
 * This pass is used to show the snapshot of the current grease 
pencil strokes captured
@@ -881,6 +887,7 @@ void GPENCIL_draw_scene(void *ved)
 
for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
cache_ob = >g_data->gp_object_cache[i];
+   Object *ob = cache_ob->ob;
bGPdata *gpd = cache_ob->gpd;
init_shgrp = NULL;
/* Render stroke in separated framebuffer */
@@ -976,8 +983,24 @@ void GPENCIL_draw_scene(void *ved)
/* tonemapping */
stl->storage->tonemapping = 
stl->storage->is_render ? 1 : 0;
 
+   /* active select flag and selection color */
+   stl->storage->do_select = ((ob->base_flag & 
BASE_SELECTED) &&
+   
   (ob->mode == OB_MODE_OBJECT) &&
+   
   (!is_render));
+
+   /* if active object is not object mode, disable 
for all objects */
+   if ((draw_ctx->obact) && (draw_ctx->obact->mode 
!= OB_MODE_OBJECT)) {
+   stl->storage->do_select = 0;
+   }
+   UI_GetThemeColor4fv((ob == draw_ctx->obact) ? 
TH_ACTIVE : TH_SELECT,
+   
stl->storage->select_color);
+
+   /* draw mix pass */
DRW_draw_pass(psl->mix_pass);
 
+   /* disable select flag */
+   stl->storage->do_select = 0;
+
/* prepare for fast drawing */
if (!is_render) {
if (!playing) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpenc

[Bf-blender-cvs] [4cd7dc6860a] master: GPencil: Fix memory leak issue

2019-02-27 Thread Antonioya
Commit: 4cd7dc6860a63d96b484372818c024b2cdd6379b
Author: Antonioya
Date:   Wed Feb 27 15:59:40 2019 +0100
Branches: master
https://developer.blender.org/rB4cd7dc6860a63d96b484372818c024b2cdd6379b

GPencil: Fix memory leak issue

After a previous commit to use unique identifiers for Ghash key, I had missed 
to free the memory of the name key.

Thanks to Jacques Lucke for detecting the leak.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 16d90b261bd..5112ba101a9 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -666,7 +666,7 @@ void GPENCIL_cache_finish(void *vedata)
DRW_gpencil_populate_particles(_data, gh_objects, vedata);
 
/* free hash */
-   BLI_ghash_free(gh_objects, NULL, NULL);
+   BLI_ghash_free(gh_objects, MEM_freeN, NULL);
}
 
if (stl->g_data->session_flag & (GP_DRW_PAINT_IDLE | 
GP_DRW_PAINT_FILLING)) {
@@ -719,6 +719,7 @@ static void gpencil_free_obj_runtime(GPENCIL_StorageList 
*stl)
 
/* free shgrp array */
cache_ob->tot_layers = 0;
+   MEM_SAFE_FREE(cache_ob->name);
MEM_SAFE_FREE(cache_ob->shgrp_array);
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bb9422ec82a] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-02-27 Thread Antonioya
Commit: bb9422ec82acefee184a37e99dfc655d2aba594b
Author: Antonioya
Date:   Wed Feb 27 16:32:47 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBbb9422ec82acefee184a37e99dfc655d2aba594b

Merge branch 'master' into greasepencil-object

 Conflicts:
source/blender/editors/gpencil/gpencil_edit.c
source/blender/makesdna/DNA_brush_types.h
source/blender/makesrna/intern/rna_brush.c

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5411efdeed1] master: GPencil: Draw Outline to Active and Selected objects

2019-02-28 Thread Antonioya
Commit: 5411efdeed121f5c92e462382d2e224cc91fb2f7
Author: Antonioya
Date:   Thu Feb 28 10:47:57 2019 +0100
Branches: master
https://developer.blender.org/rB5411efdeed121f5c92e462382d2e224cc91fb2f7

GPencil: Draw Outline to Active and Selected objects

Now an outline is drawn when the grease pencil is selected.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index a045792ad4d..2ce7a53e968 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -40,6 +40,8 @@
 #include "ED_view3d.h"
 #include "ED_screen.h"
 
+#include "UI_resources.h"
+
 
 extern char datatoc_gpencil_fill_vert_glsl[];
 extern char datatoc_gpencil_fill_frag_glsl[];
@@ -455,6 +457,8 @@ void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeColor", 
_data.input_color_tx);
DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeDepth", 
_data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp, "tonemapping", 
>storage->tonemapping, 1);
+   DRW_shgroup_uniform_int(mix_shgrp, "do_select", 
>storage->do_select, 1);
+   DRW_shgroup_uniform_vec4(mix_shgrp, "select_color", 
stl->storage->select_color, 1);
 
/* mix pass no blend used to copy between passes. A separated 
pass is required
 * because if mix_pass is used, the acumulation of blend 
degrade the colors.
@@ -470,6 +474,8 @@ void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, 
"strokeColor", _data.input_color_tx);
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, 
"strokeDepth", _data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp_noblend, "tonemapping", 
>storage->tonemapping, 1);
+   DRW_shgroup_uniform_int(mix_shgrp_noblend, "do_select", 
>storage->do_select, 1);
+   DRW_shgroup_uniform_vec4(mix_shgrp_noblend, "select_color", 
stl->storage->select_color, 1);
 
/* Painting session pass (used only to speedup while the user 
is drawing )
 * This pass is used to show the snapshot of the current grease 
pencil strokes captured
@@ -881,6 +887,7 @@ void GPENCIL_draw_scene(void *ved)
 
for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
cache_ob = >g_data->gp_object_cache[i];
+   Object *ob = cache_ob->ob;
bGPdata *gpd = cache_ob->gpd;
init_shgrp = NULL;
/* Render stroke in separated framebuffer */
@@ -976,8 +983,24 @@ void GPENCIL_draw_scene(void *ved)
/* tonemapping */
stl->storage->tonemapping = 
stl->storage->is_render ? 1 : 0;
 
+   /* active select flag and selection color */
+   stl->storage->do_select = ((ob->base_flag & 
BASE_SELECTED) &&
+   
   (ob->mode == OB_MODE_OBJECT) &&
+   
   (!is_render));
+
+   /* if active object is not object mode, disable 
for all objects */
+   if ((draw_ctx->obact) && (draw_ctx->obact->mode 
!= OB_MODE_OBJECT)) {
+   stl->storage->do_select = 0;
+   }
+   UI_GetThemeColor4fv((ob == draw_ctx->obact) ? 
TH_ACTIVE : TH_SELECT,
+   
stl->storage->select_color);
+
+   /* draw mix pass */
DRW_draw_pass(psl->mix_pass);
 
+   /* disable select flag */
+   stl->storage->do_select = 0;
+
/* prepare for fast drawing */
if (!is_render) {
if (!playing) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpencil/gpencil_engi

[Bf-blender-cvs] [461b1bdfbf0] master: GPencil: Add selection support for objects using strokes

2019-02-28 Thread Antonioya
Commit: 461b1bdfbf0a21edc84ca81d015a12c51b7d1a4d
Author: Antonioya
Date:   Wed Feb 27 19:49:16 2019 +0100
Branches: master
https://developer.blender.org/rB461b1bdfbf0a21edc84ca81d015a12c51b7d1a4d

GPencil: Add selection support for objects using strokes

Now it's possible to select a grease pencil object without using the dummy.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/intern/draw_manager.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 5112ba101a9..a045792ad4d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -711,16 +711,22 @@ static void gpencil_prepare_fast_drawing(
 
 static void gpencil_free_obj_runtime(GPENCIL_StorageList *stl)
 {
+   if (stl->g_data->gp_object_cache == NULL) {
+   return;
+   }
+
/* reset all cache flags */
for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
tGPencilObjectCache *cache_ob = 
>g_data->gp_object_cache[i];
-   bGPdata *gpd = cache_ob->gpd;
-   gpd->flag &= ~GP_DATA_CACHE_IS_DIRTY;
-
-   /* free shgrp array */
-   cache_ob->tot_layers = 0;
-   MEM_SAFE_FREE(cache_ob->name);
-   MEM_SAFE_FREE(cache_ob->shgrp_array);
+   if (cache_ob) {
+   bGPdata *gpd = cache_ob->gpd;
+   gpd->flag &= ~GP_DATA_CACHE_IS_DIRTY;
+
+   /* free shgrp array */
+   cache_ob->tot_layers = 0;
+   MEM_SAFE_FREE(cache_ob->name);
+   MEM_SAFE_FREE(cache_ob->shgrp_array);
+   }
}
 
/* free the cache itself */
@@ -752,6 +758,47 @@ static void gpencil_draw_pass_range(
 
 }
 
+/* draw strokes to use for selection */
+static void drw_gpencil_select_render(GPENCIL_StorageList *stl, 
GPENCIL_PassList *psl)
+{
+   tGPencilObjectCache *cache_ob;
+   tGPencilObjectCache_shgrp *array_elm = NULL;
+   DRWShadingGroup *init_shgrp = NULL;
+   DRWShadingGroup *end_shgrp = NULL;
+
+   /* Draw all pending objects */
+   if ((stl->g_data->gp_cache_used > 0) &&
+   (stl->g_data->gp_object_cache))
+   {
+   /* sort by zdepth */
+   qsort(stl->g_data->gp_object_cache, stl->g_data->gp_cache_used,
+   sizeof(tGPencilObjectCache), 
gpencil_object_cache_compare_zdepth);
+
+   for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
+   cache_ob = >g_data->gp_object_cache[i];
+   if (cache_ob) {
+   bGPdata *gpd = cache_ob->gpd;
+   init_shgrp = NULL;
+   if (cache_ob->tot_layers > 0) {
+   for (int e = 0; e < 
cache_ob->tot_layers; e++) {
+   array_elm = 
_ob->shgrp_array[e];
+   if (init_shgrp == NULL) {
+   init_shgrp = 
array_elm->init_shgrp;
+   }
+   end_shgrp = 
array_elm->end_shgrp;
+   }
+   /* draw group */
+   DRW_draw_pass_subset(
+   GPENCIL_3D_DRAWMODE(gpd) ? 
psl->stroke_pass_3d : psl->stroke_pass_2d,
+   init_shgrp, end_shgrp);
+   }
+   /* the cache must be dirty for next loop */
+   gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
+   }
+   }
+   }
+}
+
 /* draw scene */
 void GPENCIL_draw_scene(void *ved)
 {
@@ -778,6 +825,16 @@ void GPENCIL_draw_scene(void *ved)
bGPdata *gpd_act = (obact) && (obact->type == OB_GPENCIL) ? (bGPdata 
*)obact->data : NULL;
const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd_act);
 
+   /* if the draw is for select, do a basic drawing and return */
+   if (DRW_state_is_select()) {
+
+   drw_gpencil_select_render(stl, psl);
+   /* free memory */
+   gpencil_free_obj_runtime(stl);
+
+   return;
+   }
+
/* paper pass to display a comfortable area to draw over complex scenes 
with geometry */
if ((!is_render) && (obact) && (obact-&

[Bf-blender-cvs] [9ddc2064a4c] master: GPencil: Remove dummy marker for Grease Pencil objects

2019-02-28 Thread Antonioya
Commit: 9ddc2064a4c7b0a40882be943f76b2e26f2334d3
Author: Antonioya
Date:   Wed Feb 27 20:46:04 2019 +0100
Branches: master
https://developer.blender.org/rB9ddc2064a4c7b0a40882be943f76b2e26f2334d3

GPencil: Remove dummy marker for Grease Pencil objects

After adding selecction using strokes, the dummy is not required because it was 
added as a provisional solution while we implement stroke selection.

===

M   release/scripts/startup/bl_ui/properties_data_gpencil.py
M   source/blender/blenkernel/intern/object.c
M   source/blender/draw/modes/object_mode.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/object/object_add.c
M   source/blender/makesdna/DNA_gpencil_types.h

===

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index 7a723901e4b..b8b197ac3ac 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -375,8 +375,6 @@ class DATA_PT_gpencil_display(ObjectButtonsPanel, Panel):
 gpd = context.gpencil_data
 gpl = context.active_gpencil_layer
 
-layout.prop(ob, "empty_display_size", text="Marker Size")
-
 layout.prop(gpd, "edit_line_color", text="Edit Line Color")
 if gpl:
 layout.prop(gpd, "show_stroke_direction", text="Show Stroke 
Directions")
diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index 1b4aad16778..ddfed90fd97 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1661,11 +1661,6 @@ void BKE_object_obdata_size_init(struct Object *ob, 
const float size)
ob->empty_drawsize *= size;
break;
}
-   case OB_GPENCIL:
-   {
-   ob->empty_drawsize *= size;
-   break;
-   }
case OB_FONT:
{
Curve *cu = ob->data;
@@ -2560,7 +2555,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float 
max_r[3], const bool us
float size[3];
 
copy_v3_v3(size, ob->scale);
-   if ((ob->type == OB_EMPTY) || (ob->type == OB_GPENCIL)) {
+   if (ob->type == OB_EMPTY) {
mul_v3_fl(size, ob->empty_drawsize);
}
 
diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index 84c711aff60..e04512b00ac 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -2321,14 +2321,6 @@ static void volumes_free_smoke_textures(void)
BLI_freelistN(_data.smoke_domains);
 }
 
-static void DRW_shgroup_gpencil(OBJECT_ShadingGroupList *sgl, Object *ob, 
ViewLayer *view_layer)
-{
-   float *color;
-   DRW_object_wire_theme_get(ob, view_layer, );
-
-   DRW_shgroup_call_dynamic_add(sgl->gpencil_axes, color, 
>empty_drawsize, ob->obmat);
-}
-
 static void DRW_shgroup_speaker(OBJECT_ShadingGroupList *sgl, Object *ob, 
ViewLayer *view_layer)
 {
float *color;
@@ -3059,16 +3051,6 @@ static void OBJECT_cache_populate(void *vedata, Object 
*ob)
}
DRW_shgroup_empty(sh_data, sgl, ob, view_layer, rv3d, 
draw_ctx->sh_cfg);
break;
-   case OB_GPENCIL:
-   if (hide_object_extra) {
-   break;
-   }
-   /* in all modes except object mode hide always */
-   if (draw_ctx->object_mode != OB_MODE_OBJECT) {
-   break;
-   }
-   DRW_shgroup_gpencil(sgl, ob, view_layer);
-   break;
case OB_SPEAKER:
if (hide_object_extra) {
break;
diff --git a/source/blender/editors/gpencil/gpencil_utils.c 
b/source/blender/editors/gpencil/gpencil_utils.c
index 9b19fb03f8b..a727e2cc5de 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1271,8 +1271,6 @@ Object *ED_gpencil_add_object(bContext *C, Scene 
*UNUSED(scene), const float loc
 
Object *ob = ED_object_add_type(C, OB_GPENCIL, NULL, loc, rot, false, 
local_view_bits);
 
-   /* define size */
-   BKE_object_obdata_size_init(ob, GP_OBGPENCIL_DEFAULT_SIZE);
/* create default brushes and colors */
ED_gpencil_add_defaults(C, ob);
 
diff --git a/source/blender/editors/object/object_add.c 
b/source/blender/ed

[Bf-blender-cvs] [d8f9797c28f] master: GPencil: Hide selecction outline when play animation

2019-02-28 Thread Antonioya
Commit: d8f9797c28f176fd890a98f95be1e857958e622a
Author: Antonioya
Date:   Thu Feb 28 11:45:23 2019 +0100
Branches: master
https://developer.blender.org/rBd8f9797c28f176fd890a98f95be1e857958e622a

GPencil: Hide selecction outline when play animation

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 2ce7a53e968..3daf1320d85 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -4,6 +4,7 @@
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
  *
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -986,7 +987,7 @@ void GPENCIL_draw_scene(void *ved)
/* active select flag and selection color */
stl->storage->do_select = ((ob->base_flag & 
BASE_SELECTED) &&

   (ob->mode == OB_MODE_OBJECT) &&
-   
   (!is_render));
+   
   (!is_render) && (!playing));
 
/* if active object is not object mode, disable 
for all objects */
if ((draw_ctx->obact) && (draw_ctx->obact->mode 
!= OB_MODE_OBJECT)) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [175cb0a0af9] master: GPencil: Remove comment line added by error to header text

2019-02-28 Thread Antonioya
Commit: 175cb0a0af9b9d165827f4f9d57f573e00f5cc55
Author: Antonioya
Date:   Thu Feb 28 12:23:58 2019 +0100
Branches: master
https://developer.blender.org/rB175cb0a0af9b9d165827f4f9d57f573e00f5cc55

GPencil: Remove comment line added by error to header text

This line was added accidentally in the header text.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 3daf1320d85..eeb9e809d6d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -4,7 +4,6 @@
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
  *
- *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [acb38583995] master: GPencil: Increase outline to 2 pixels

2019-02-28 Thread Antonioya
Commit: acb385839958e3e9f4ce58e4195b30371a7e6969
Author: Antonioya
Date:   Thu Feb 28 12:12:52 2019 +0100
Branches: master
https://developer.blender.org/rBacb385839958e3e9f4ce58e4195b30371a7e6969

GPencil: Increase outline to 2 pixels

The selection outline of 1 pixel was too thin.

===

M   source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
index 4497828fbd5..a68c17031ff 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
@@ -65,7 +65,7 @@ void main()

if (do_select == 1) {
if (stroke_color.a == 0) {
-   if (check_borders(uv, 1)) {
+   if (check_borders(uv, 2)) {
FragColor = select_color;
gl_FragDepth = 0.01;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2cd478cf197] master: GPencil: Rename variable name and add alpha to outline

2019-02-28 Thread Antonioya
Commit: 2cd478cf1971aa27c46dbe683354c3f2165dc548
Author: Antonioya
Date:   Thu Feb 28 16:11:30 2019 +0100
Branches: master
https://developer.blender.org/rB2cd478cf1971aa27c46dbe683354c3f2165dc548

GPencil: Rename variable name and add alpha to outline

The outline now has some alpha to be more consistent with other Blender areas.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 0903faf6a75..d9ee2b26b50 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -457,7 +457,7 @@ void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeColor", 
_data.input_color_tx);
DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeDepth", 
_data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp, "tonemapping", 
>storage->tonemapping, 1);
-   DRW_shgroup_uniform_int(mix_shgrp, "do_select", 
>storage->do_select, 1);
+   DRW_shgroup_uniform_int(mix_shgrp, "do_select", 
>storage->do_select_outline, 1);
DRW_shgroup_uniform_vec4(mix_shgrp, "select_color", 
stl->storage->select_color, 1);
 
/* mix pass no blend used to copy between passes. A separated 
pass is required
@@ -474,7 +474,7 @@ void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, 
"strokeColor", _data.input_color_tx);
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, 
"strokeDepth", _data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp_noblend, "tonemapping", 
>storage->tonemapping, 1);
-   DRW_shgroup_uniform_int(mix_shgrp_noblend, "do_select", 
>storage->do_select, 1);
+   DRW_shgroup_uniform_int(mix_shgrp_noblend, "do_select", 
>storage->do_select_outline, 1);
DRW_shgroup_uniform_vec4(mix_shgrp_noblend, "select_color", 
stl->storage->select_color, 1);
 
/* Painting session pass (used only to speedup while the user 
is drawing )
@@ -985,7 +985,7 @@ void GPENCIL_draw_scene(void *ved)
stl->storage->tonemapping = 
stl->storage->is_render ? 1 : 0;
 
/* active select flag and selection color */
-   stl->storage->do_select = ((overlay) &&
+   stl->storage->do_select_outline = ((overlay) &&

   (ob->base_flag & BASE_SELECTED) &&

   (ob->mode == OB_MODE_OBJECT) &&

   (!is_render) && (!playing) &&
@@ -993,16 +993,16 @@ void GPENCIL_draw_scene(void *ved)
 
/* if active object is not object mode, disable 
for all objects */
if ((draw_ctx->obact) && (draw_ctx->obact->mode 
!= OB_MODE_OBJECT)) {
-   stl->storage->do_select = 0;
+   stl->storage->do_select_outline = 0;
}
-   UI_GetThemeColor4fv((ob == draw_ctx->obact) ? 
TH_ACTIVE : TH_SELECT,
-   
stl->storage->select_color);
+   UI_GetThemeColorShadeAlpha4fv((ob == 
draw_ctx->obact) ? TH_ACTIVE : TH_SELECT, 0, -40,
+   
stl->storage->select_color);
 
/* draw mix pass */
DRW_draw_pass(psl->mix_pass);
 
/* disable select flag */
-   stl->storage->do_select = 0;
+   stl->storage->do_select_outline = 0;
 
/* prepare for fast drawing */
if (!is_render) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpencil/gpencil_engine.h
index a27f2968487..1b92f599246 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engin

[Bf-blender-cvs] [0f37d7162b5] master: GPencil: Disable Outline if Overlay is disabled

2019-02-28 Thread Antonioya
Commit: 0f37d7162b56ed6e81fe2be8beaf0b9afb21b470
Author: Antonioya
Date:   Thu Feb 28 15:58:03 2019 +0100
Branches: master
https://developer.blender.org/rB0f37d7162b56ed6e81fe2be8beaf0b9afb21b470

GPencil: Disable Outline if Overlay is disabled

The main overlay switch and outline option must be checked.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index eeb9e809d6d..0903faf6a75 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -830,6 +830,7 @@ void GPENCIL_draw_scene(void *ved)
const bool is_render = stl->storage->is_render;
bGPdata *gpd_act = (obact) && (obact->type == OB_GPENCIL) ? (bGPdata 
*)obact->data : NULL;
const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd_act);
+   const bool overlay = v3d != NULL ? (bool)((v3d->flag2 & 
V3D_RENDER_OVERRIDE) == 0) : true;
 
/* if the draw is for select, do a basic drawing and return */
if (DRW_state_is_select()) {
@@ -984,9 +985,11 @@ void GPENCIL_draw_scene(void *ved)
stl->storage->tonemapping = 
stl->storage->is_render ? 1 : 0;
 
/* active select flag and selection color */
-   stl->storage->do_select = ((ob->base_flag & 
BASE_SELECTED) &&
+   stl->storage->do_select = ((overlay) &&
+   
   (ob->base_flag & BASE_SELECTED) &&

   (ob->mode == OB_MODE_OBJECT) &&
-   
   (!is_render) && (!playing));
+   
   (!is_render) && (!playing) &&
+   
   (v3d->flag & V3D_SELECT_OUTLINE));
 
/* if active object is not object mode, disable 
for all objects */
if ((draw_ctx->obact) && (draw_ctx->obact->mode 
!= OB_MODE_OBJECT)) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ad9922516a6] greasepencil-object: GPencil: Remove dummy marker for Grease Pencil objects

2019-02-28 Thread Antonioya
Commit: ad9922516a6a69502a17df3deda7aca079ff9d34
Author: Antonioya
Date:   Wed Feb 27 20:46:04 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBad9922516a6a69502a17df3deda7aca079ff9d34

GPencil: Remove dummy marker for Grease Pencil objects

After adding selecction using strokes, the dummy is not required because it was 
added as a provisional solution while we implement stroke selection.

===

M   release/scripts/startup/bl_ui/properties_data_gpencil.py
M   source/blender/blenkernel/intern/object.c
M   source/blender/draw/modes/object_mode.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/object/object_add.c
M   source/blender/makesdna/DNA_gpencil_types.h

===

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index 7a723901e4b..b8b197ac3ac 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -375,8 +375,6 @@ class DATA_PT_gpencil_display(ObjectButtonsPanel, Panel):
 gpd = context.gpencil_data
 gpl = context.active_gpencil_layer
 
-layout.prop(ob, "empty_display_size", text="Marker Size")
-
 layout.prop(gpd, "edit_line_color", text="Edit Line Color")
 if gpl:
 layout.prop(gpd, "show_stroke_direction", text="Show Stroke 
Directions")
diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index 1b4aad16778..ddfed90fd97 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1661,11 +1661,6 @@ void BKE_object_obdata_size_init(struct Object *ob, 
const float size)
ob->empty_drawsize *= size;
break;
}
-   case OB_GPENCIL:
-   {
-   ob->empty_drawsize *= size;
-   break;
-   }
case OB_FONT:
{
Curve *cu = ob->data;
@@ -2560,7 +2555,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float 
max_r[3], const bool us
float size[3];
 
copy_v3_v3(size, ob->scale);
-   if ((ob->type == OB_EMPTY) || (ob->type == OB_GPENCIL)) {
+   if (ob->type == OB_EMPTY) {
mul_v3_fl(size, ob->empty_drawsize);
}
 
diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index 84c711aff60..e04512b00ac 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -2321,14 +2321,6 @@ static void volumes_free_smoke_textures(void)
BLI_freelistN(_data.smoke_domains);
 }
 
-static void DRW_shgroup_gpencil(OBJECT_ShadingGroupList *sgl, Object *ob, 
ViewLayer *view_layer)
-{
-   float *color;
-   DRW_object_wire_theme_get(ob, view_layer, );
-
-   DRW_shgroup_call_dynamic_add(sgl->gpencil_axes, color, 
>empty_drawsize, ob->obmat);
-}
-
 static void DRW_shgroup_speaker(OBJECT_ShadingGroupList *sgl, Object *ob, 
ViewLayer *view_layer)
 {
float *color;
@@ -3059,16 +3051,6 @@ static void OBJECT_cache_populate(void *vedata, Object 
*ob)
}
DRW_shgroup_empty(sh_data, sgl, ob, view_layer, rv3d, 
draw_ctx->sh_cfg);
break;
-   case OB_GPENCIL:
-   if (hide_object_extra) {
-   break;
-   }
-   /* in all modes except object mode hide always */
-   if (draw_ctx->object_mode != OB_MODE_OBJECT) {
-   break;
-   }
-   DRW_shgroup_gpencil(sgl, ob, view_layer);
-   break;
case OB_SPEAKER:
if (hide_object_extra) {
break;
diff --git a/source/blender/editors/gpencil/gpencil_utils.c 
b/source/blender/editors/gpencil/gpencil_utils.c
index 9b19fb03f8b..a727e2cc5de 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1271,8 +1271,6 @@ Object *ED_gpencil_add_object(bContext *C, Scene 
*UNUSED(scene), const float loc
 
Object *ob = ED_object_add_type(C, OB_GPENCIL, NULL, loc, rot, false, 
local_view_bits);
 
-   /* define size */
-   BKE_object_obdata_size_init(ob, GP_OBGPENCIL_DEFAULT_SIZE);
/* create default brushes and colors */
ED_gpencil_add_defaults(C, ob);
 
diff --git a/source/blender/editors/object/object_add.c 
b/so

[Bf-blender-cvs] [770239fe61d] greasepencil-object: GPencil: Draw Outline to Active and Selected objects

2019-02-28 Thread Antonioya
Commit: 770239fe61da9737d504d13e6b322664457313b6
Author: Antonioya
Date:   Thu Feb 28 10:47:57 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB770239fe61da9737d504d13e6b322664457313b6

GPencil: Draw Outline to Active and Selected objects

Now an outline is drawn when the grease pencil is selected.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index a045792ad4d..2ce7a53e968 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -40,6 +40,8 @@
 #include "ED_view3d.h"
 #include "ED_screen.h"
 
+#include "UI_resources.h"
+
 
 extern char datatoc_gpencil_fill_vert_glsl[];
 extern char datatoc_gpencil_fill_frag_glsl[];
@@ -455,6 +457,8 @@ void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeColor", 
_data.input_color_tx);
DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeDepth", 
_data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp, "tonemapping", 
>storage->tonemapping, 1);
+   DRW_shgroup_uniform_int(mix_shgrp, "do_select", 
>storage->do_select, 1);
+   DRW_shgroup_uniform_vec4(mix_shgrp, "select_color", 
stl->storage->select_color, 1);
 
/* mix pass no blend used to copy between passes. A separated 
pass is required
 * because if mix_pass is used, the acumulation of blend 
degrade the colors.
@@ -470,6 +474,8 @@ void GPENCIL_cache_init(void *vedata)
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, 
"strokeColor", _data.input_color_tx);
DRW_shgroup_uniform_texture_ref(mix_shgrp_noblend, 
"strokeDepth", _data.input_depth_tx);
DRW_shgroup_uniform_int(mix_shgrp_noblend, "tonemapping", 
>storage->tonemapping, 1);
+   DRW_shgroup_uniform_int(mix_shgrp_noblend, "do_select", 
>storage->do_select, 1);
+   DRW_shgroup_uniform_vec4(mix_shgrp_noblend, "select_color", 
stl->storage->select_color, 1);
 
/* Painting session pass (used only to speedup while the user 
is drawing )
 * This pass is used to show the snapshot of the current grease 
pencil strokes captured
@@ -881,6 +887,7 @@ void GPENCIL_draw_scene(void *ved)
 
for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
cache_ob = >g_data->gp_object_cache[i];
+   Object *ob = cache_ob->ob;
bGPdata *gpd = cache_ob->gpd;
init_shgrp = NULL;
/* Render stroke in separated framebuffer */
@@ -976,8 +983,24 @@ void GPENCIL_draw_scene(void *ved)
/* tonemapping */
stl->storage->tonemapping = 
stl->storage->is_render ? 1 : 0;
 
+   /* active select flag and selection color */
+   stl->storage->do_select = ((ob->base_flag & 
BASE_SELECTED) &&
+   
   (ob->mode == OB_MODE_OBJECT) &&
+   
   (!is_render));
+
+   /* if active object is not object mode, disable 
for all objects */
+   if ((draw_ctx->obact) && (draw_ctx->obact->mode 
!= OB_MODE_OBJECT)) {
+   stl->storage->do_select = 0;
+   }
+   UI_GetThemeColor4fv((ob == draw_ctx->obact) ? 
TH_ACTIVE : TH_SELECT,
+   
stl->storage->select_color);
+
+   /* draw mix pass */
DRW_draw_pass(psl->mix_pass);
 
+   /* disable select flag */
+   stl->storage->do_select = 0;
+
/* prepare for fast drawing */
if (!is_render) {
if (!playing) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpenc

[Bf-blender-cvs] [db6fb2a7194] greasepencil-object: GPencil: Add selection support for objects using strokes

2019-02-28 Thread Antonioya
Commit: db6fb2a7194b49bcb7b202ab731c683c119174f9
Author: Antonioya
Date:   Wed Feb 27 19:49:16 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBdb6fb2a7194b49bcb7b202ab731c683c119174f9

GPencil: Add selection support for objects using strokes

Now it's possible to select a grease pencil object without using the dummy.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/intern/draw_manager.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 5112ba101a9..a045792ad4d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -711,16 +711,22 @@ static void gpencil_prepare_fast_drawing(
 
 static void gpencil_free_obj_runtime(GPENCIL_StorageList *stl)
 {
+   if (stl->g_data->gp_object_cache == NULL) {
+   return;
+   }
+
/* reset all cache flags */
for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
tGPencilObjectCache *cache_ob = 
>g_data->gp_object_cache[i];
-   bGPdata *gpd = cache_ob->gpd;
-   gpd->flag &= ~GP_DATA_CACHE_IS_DIRTY;
-
-   /* free shgrp array */
-   cache_ob->tot_layers = 0;
-   MEM_SAFE_FREE(cache_ob->name);
-   MEM_SAFE_FREE(cache_ob->shgrp_array);
+   if (cache_ob) {
+   bGPdata *gpd = cache_ob->gpd;
+   gpd->flag &= ~GP_DATA_CACHE_IS_DIRTY;
+
+   /* free shgrp array */
+   cache_ob->tot_layers = 0;
+   MEM_SAFE_FREE(cache_ob->name);
+   MEM_SAFE_FREE(cache_ob->shgrp_array);
+   }
}
 
/* free the cache itself */
@@ -752,6 +758,47 @@ static void gpencil_draw_pass_range(
 
 }
 
+/* draw strokes to use for selection */
+static void drw_gpencil_select_render(GPENCIL_StorageList *stl, 
GPENCIL_PassList *psl)
+{
+   tGPencilObjectCache *cache_ob;
+   tGPencilObjectCache_shgrp *array_elm = NULL;
+   DRWShadingGroup *init_shgrp = NULL;
+   DRWShadingGroup *end_shgrp = NULL;
+
+   /* Draw all pending objects */
+   if ((stl->g_data->gp_cache_used > 0) &&
+   (stl->g_data->gp_object_cache))
+   {
+   /* sort by zdepth */
+   qsort(stl->g_data->gp_object_cache, stl->g_data->gp_cache_used,
+   sizeof(tGPencilObjectCache), 
gpencil_object_cache_compare_zdepth);
+
+   for (int i = 0; i < stl->g_data->gp_cache_used; i++) {
+   cache_ob = >g_data->gp_object_cache[i];
+   if (cache_ob) {
+   bGPdata *gpd = cache_ob->gpd;
+   init_shgrp = NULL;
+   if (cache_ob->tot_layers > 0) {
+   for (int e = 0; e < 
cache_ob->tot_layers; e++) {
+   array_elm = 
_ob->shgrp_array[e];
+   if (init_shgrp == NULL) {
+   init_shgrp = 
array_elm->init_shgrp;
+   }
+   end_shgrp = 
array_elm->end_shgrp;
+   }
+   /* draw group */
+   DRW_draw_pass_subset(
+   GPENCIL_3D_DRAWMODE(gpd) ? 
psl->stroke_pass_3d : psl->stroke_pass_2d,
+   init_shgrp, end_shgrp);
+   }
+   /* the cache must be dirty for next loop */
+   gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
+   }
+   }
+   }
+}
+
 /* draw scene */
 void GPENCIL_draw_scene(void *ved)
 {
@@ -778,6 +825,16 @@ void GPENCIL_draw_scene(void *ved)
bGPdata *gpd_act = (obact) && (obact->type == OB_GPENCIL) ? (bGPdata 
*)obact->data : NULL;
const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd_act);
 
+   /* if the draw is for select, do a basic drawing and return */
+   if (DRW_state_is_select()) {
+
+   drw_gpencil_select_render(stl, psl);
+   /* free memory */
+   gpencil_free_obj_runtime(stl);
+
+   return;
+   }
+
/* paper pass to display a comfortable area to draw over complex scenes 
with geometry */
if ((!is_render) && (obact) &&a

[Bf-blender-cvs] [8388f4b9852] greasepencil-object: GPencil: Remove comment line added by error to header text

2019-02-28 Thread Antonioya
Commit: 8388f4b9852dcd43eae7caefde46ba040113c41d
Author: Antonioya
Date:   Thu Feb 28 12:23:58 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB8388f4b9852dcd43eae7caefde46ba040113c41d

GPencil: Remove comment line added by error to header text

This line was added accidentally in the header text.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 3daf1320d85..eeb9e809d6d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -4,7 +4,6 @@
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
  *
- *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [345ab3ab701] greasepencil-object: GPencil: Increase outline to 2 pixels

2019-02-28 Thread Antonioya
Commit: 345ab3ab7016e3d3ef47a9f81e7a6f72508f4a1a
Author: Antonioya
Date:   Thu Feb 28 12:12:52 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB345ab3ab7016e3d3ef47a9f81e7a6f72508f4a1a

GPencil: Increase outline to 2 pixels

The selection outline of 1 pixel was too thin.

===

M   source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
index 4497828fbd5..a68c17031ff 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
@@ -65,7 +65,7 @@ void main()

if (do_select == 1) {
if (stroke_color.a == 0) {
-   if (check_borders(uv, 1)) {
+   if (check_borders(uv, 2)) {
FragColor = select_color;
gl_FragDepth = 0.01;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [834942d121e] greasepencil-object: GPencil: Hide selecction outline when play animation

2019-02-28 Thread Antonioya
Commit: 834942d121e20dc0e5763f9792e980c810ef05e0
Author: Antonioya
Date:   Thu Feb 28 11:45:23 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB834942d121e20dc0e5763f9792e980c810ef05e0

GPencil: Hide selecction outline when play animation

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 2ce7a53e968..3daf1320d85 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -4,6 +4,7 @@
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
  *
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -986,7 +987,7 @@ void GPENCIL_draw_scene(void *ved)
/* active select flag and selection color */
stl->storage->do_select = ((ob->base_flag & 
BASE_SELECTED) &&

   (ob->mode == OB_MODE_OBJECT) &&
-   
   (!is_render));
+   
   (!is_render) && (!playing));
 
/* if active object is not object mode, disable 
for all objects */
if ((draw_ctx->obact) && (draw_ctx->obact->mode 
!= OB_MODE_OBJECT)) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


  1   2   3   4   5   6   7   8   9   10   >