[Bf-blender-cvs] [b1ada48b614] greasepencil-object: Revert "GPencil: Increase number of input samples to 50"

2019-08-18 Thread Antonioya
Commit: b1ada48b614359215e68a7e6962caa5e50fc91fb
Author: Antonioya
Date:   Tue Aug 13 22:51:37 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb1ada48b614359215e68a7e6962caa5e50fc91fb

Revert "GPencil: Increase number of input samples to 50"

This reverts commit dd370cbf8956d5d1cde0c5e42251c9dbf93d16d8.

===

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 3edd529eb68..0de7d8bdd16 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -36,7 +36,7 @@ struct MDeformVert;
 
 #define GP_DEFAULT_PIX_FACTOR 1.0f
 #define GP_DEFAULT_GRID_LINES 4
-#define GP_MAX_INPUT_SAMPLES 50
+#define GP_MAX_INPUT_SAMPLES 10
 
 /* * */
 /* GP Stroke Points */

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


[Bf-blender-cvs] [85f90ed6fd8] master: Fix T68723: GPencil - Split Select mode for Sculpt and Edit mode

2019-08-17 Thread Antonioya
Commit: 85f90ed6fd8858a60ea24dd82f73b88363207133
Author: Antonioya
Date:   Sat Aug 17 16:18:09 2019 +0200
Branches: master
https://developer.blender.org/rB85f90ed6fd8858a60ea24dd82f73b88363207133

Fix T68723: GPencil - Split Select mode for Sculpt and Edit mode

Actually, the selection mode is not visible in Sculpt mode when mask is 
enabled, but still is used.
Also, the mode is shared between Edit mode and Sculpt mode and for meshes the 
selector is by mode.

This commit splits the select mode in different properties and show the 
selector in Sculpt mode to define the Select mode. Also, the Select Mask button 
has been removed and now the Select Mode buttons work equal to Meshes where the 
select buttons are the mask enable too.

Fixed some old code not valid detected during these changes.

Differential Revision: https://developer.blender.org/D5500

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_brush.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_intern.h
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/gpencil/gpencil_select.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/makesrna/intern/rna_sculpt_paint.c

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 17e753d531f..fabf8abaeab 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1508,8 +1508,9 @@ class _defs_gpencil_sculpt:
 return True
 ob = context.active_object
 ts = context.scene.tool_settings
-return (ob and ob.type == 'GPENCIL' and
-(ts.gpencil_sculpt.use_select_mask))
+return ob and ob.type == 'GPENCIL' and 
(ts.use_gpencil_select_mask_point or
+
ts.use_gpencil_select_mask_stroke or
+
ts.use_gpencil_select_mask_segment)
 
 @staticmethod
 def generate_from_brushes(context):
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 80865b8f86d..8bb211052da 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -599,17 +599,20 @@ class VIEW3D_HT_header(Header):
 sub.separator(factor=0.4)
 sub.prop(tool_settings, "use_gpencil_draw_additive", text="", 
icon='FREEZE')
 
+# Select mode for Editing
 if gpd.use_stroke_edit_mode:
 row = layout.row(align=True)
-row.prop(tool_settings, "gpencil_selectmode", text="", 
expand=True)
+row.prop(tool_settings, "gpencil_selectmode_edit", text="", 
expand=True)
 
-if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode or 
gpd.is_stroke_weight_mode:
+# Select mode for Sculpt
+if gpd.is_stroke_sculpt_mode :
 row = layout.row(align=True)
+row.prop(tool_settings, "use_gpencil_select_mask_point", 
text="")
+row.prop(tool_settings, "use_gpencil_select_mask_stroke", 
text="")
+row.prop(tool_settings, "use_gpencil_select_mask_segment", 
text="")
 
-if gpd.is_stroke_sculpt_mode:
-row.prop(tool_settings.gpencil_sculpt, "use_select_mask", 
text="")
-row.separator()
-
+if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode or 
gpd.is_stroke_weight_mode:
+row = layout.row(align=True)
 row.prop(gpd, "use_multiedit", text="", 
icon='GP_MULTIFRAME_EDITING')
 
 sub = row.row(align=True)
@@ -621,8 +624,6 @@ class VIEW3D_HT_header(Header):
 
 if gpd.use_stroke_edit_mode:
 row = layout.row(align=True)
-row.prop(tool_settings.gpencil_sculpt, "use_select_mask", 
text="")
-
 row.popover(
 panel="VIEW3D_PT_tools_grease_pencil_interpolate",
 text="Interpolate",
@@ -732,7 +733,10 @@ class VIEW3D_MT_editor_menus(Menu):
 # Select Menu
 if gp_edit:
 if mode_string not in {'PAINT_GPENCIL', 'WEIGHT_GPENCIL'}:
- 

[Bf-blender-cvs] [0e1d4dec7a7] master: Fix T68722: Improve Smooth algorithm for Thickness and Strength

2019-08-17 Thread Antonioya
Commit: 0e1d4dec7a7d50867c97179299775d31ac30938e
Author: Antonioya
Date:   Thu Aug 15 17:49:55 2019 +0200
Branches: master
https://developer.blender.org/rB0e1d4dec7a7d50867c97179299775d31ac30938e

Fix T68722: Improve Smooth algorithm for Thickness and Strength

Now the GPencil smooth algorithm uses a average value instead to use only two 
points and the interpolated value.

Differential Revision: https://developer.blender.org/D5489

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 728f4890189..0354aeaf0ca 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1784,33 +1784,55 @@ bool BKE_gpencil_smooth_stroke_strength(bGPDstroke 
*gps, int point_index, float
   bGPDspoint *ptb = &gps->points[point_index];
 
   /* Do nothing if not enough points */
-  if (gps->totpoints <= 2) {
+  if ((gps->totpoints <= 2) || (point_index < 1)) {
 return false;
   }
+  /* Only affect endpoints by a fraction of the normal influence */
+  float inf = influence;
+  if ((point_index == 0) || (point_index == gps->totpoints - 1)) {
+inf *= 0.01f;
+  }
+  /* Limit max influence to reduce pop effect. */
+  CLAMP_MAX(inf, 0.98f);
 
-  /* Compute theoretical optimal value using distances */
-  bGPDspoint *pta, *ptc;
-  int before = point_index - 1;
-  int after = point_index + 1;
+  float total = 0.0f;
+  float max_strength = 0.0f;
+  const int steps = 4;
+  const float average_fac = 1.0f / (float)(steps * 2 + 1);
+  int step;
 
-  CLAMP_MIN(before, 0);
-  CLAMP_MAX(after, gps->totpoints - 1);
+  /* add the point itself */
+  total += ptb->strength * average_fac;
+  max_strength = ptb->strength;
 
-  pta = &gps->points[before];
-  ptc = &gps->points[after];
+  /* n-steps before/after current point */
+  for (step = 1; step <= steps; step++) {
+bGPDspoint *pt1, *pt2;
+int before = point_index - step;
+int after = point_index + step;
 
-  /* the optimal value is the corresponding to the interpolation of the 
strength
-   * at the distance of point b
-   */
-  float fac = line_point_factor_v3(&ptb->x, &pta->x, &ptc->x);
-  /* sometimes the factor can be wrong due stroke geometry, so use middle 
point */
-  if ((fac < 0.0f) || (fac > 1.0f)) {
-fac = 0.5f;
+CLAMP_MIN(before, 0);
+CLAMP_MAX(after, gps->totpoints - 1);
+
+pt1 = &gps->points[before];
+pt2 = &gps->points[after];
+
+/* add both these points to the average-sum (s += p[i]/n) */
+total += pt1->strength * average_fac;
+total += pt2->strength * average_fac;
+/* Save max value. */
+if (max_strength < pt1->strength) {
+  max_strength = pt1->strength;
+}
+if (max_strength < pt2->strength) {
+  max_strength = pt2->strength;
+}
   }
-  const float optimal = (1.0f - fac) * pta->strength + fac * ptc->strength;
 
-  /* Based on influence factor, blend between original and optimal */
-  ptb->strength = (1.0f - influence) * ptb->strength + influence * optimal;
+  /* Based on influence factor, blend between original and optimal smoothed 
value. */
+  ptb->strength = interpf(ptb->strength, total, inf);
+  /* Clamp to maximum stroke strength to avoid weird results. */
+  CLAMP_MAX(ptb->strength, max_strength);
 
   return true;
 }
@@ -1825,31 +1847,52 @@ bool BKE_gpencil_smooth_stroke_thickness(bGPDstroke 
*gps, int point_index, float
   if ((gps->totpoints <= 2) || (point_index < 1)) {
 return false;
   }
+  /* Only affect endpoints by a fraction of the normal influence */
+  float inf = influence;
+  if ((point_index == 0) || (point_index == gps->totpoints - 1)) {
+inf *= 0.01f;
+  }
+  /* Limit max influence to reduce pop effect. */
+  CLAMP_MAX(inf, 0.98f);
 
-  /* Compute theoretical optimal value using distances */
-  bGPDspoint *pta, *ptc;
-  int before = point_index - 1;
-  int after = point_index + 1;
+  float total = 0.0f;
+  float max_pressure = 0.0f;
+  const int steps = 4;
+  const float average_fac = 1.0f / (float)(steps * 2 + 1);
+  int step;
 
-  CLAMP_MIN(before, 0);
-  CLAMP_MAX(after, gps->totpoints - 1);
+  /* add the point itself */
+  total += ptb->pressure * average_fac;
+  max_pressure = ptb->pressure;
 
-  pta = &gps->points[before];
-  ptc = &gps->points[after];
+  /* n-steps before/after current point */
+  for (step = 1; step <= steps; step++) {
+bGPDspoint *pt1, *pt2;
+int before = point_index - step;
+int after = point_index + step;
 
-  /* the optimal value is the corresponding to the interpolation of the 
pressure
-   * at the distance 

[Bf-blender-cvs] [2623e68c3b0] master: GPencil: Revert commit d727f4f22340 (Interpolate menu)

2019-08-14 Thread Antonioya
Commit: 2623e68c3b0e43134027dda33cd5ec1fc45b3bdc
Author: Antonioya
Date:   Wed Aug 14 17:32:00 2019 +0200
Branches: master
https://developer.blender.org/rB2623e68c3b0e43134027dda33cd5ec1fc45b3bdc

GPencil: Revert commit d727f4f22340 (Interpolate menu)

The menu is not redundant,  it is just another way to reach the tool and also 
give more discoverability of the operator shortcut (Many tools in Blender are 
also on menus, toolbar or header, just think of Move, Rotate, Scale).

There is also no reason to force the user/artist to change to edit mode for 
interpolate strokes, when the tool works perfectly in drawing mode too. It 
would only slow down the 2D animation workflow.

Reviewers: @mendio

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 85b55378f1d..80865b8f86d 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4392,6 +4392,7 @@ class VIEW3D_MT_paint_gpencil(Menu):
 layout = self.layout
 
 layout.menu("VIEW3D_MT_gpencil_animation")
+layout.menu("VIEW3D_MT_edit_gpencil_interpolate")
 
 layout.separator()
 
@@ -4447,6 +4448,7 @@ class VIEW3D_MT_edit_gpencil(Menu):
 layout.separator()
 
 layout.menu("VIEW3D_MT_gpencil_animation")
+layout.menu("VIEW3D_MT_edit_gpencil_interpolate")
 
 layout.separator()
 
@@ -4602,6 +4604,16 @@ class VIEW3D_MT_edit_gpencil_showhide(Menu):
 layout.operator("gpencil.reveal", text="Show All Layers")
 
 
+class VIEW3D_MT_edit_gpencil_interpolate(Menu):
+bl_label = "Interpolate"
+
+def draw(self, _context):
+layout = self.layout
+
+layout.operator("gpencil.interpolate", text="Interpolate")
+layout.operator("gpencil.interpolate_sequence", text="Sequence")
+
+
 class VIEW3D_MT_object_mode_pie(Menu):
 bl_label = "Mode"
 
@@ -6634,6 +6646,7 @@ classes = (
 VIEW3D_MT_edit_armature_names,
 VIEW3D_MT_edit_armature_delete,
 VIEW3D_MT_edit_gpencil_transform,
+VIEW3D_MT_edit_gpencil_interpolate,
 VIEW3D_MT_object_mode_pie,
 VIEW3D_MT_view_pie,
 VIEW3D_MT_transform_gizmo_pie,

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


[Bf-blender-cvs] [c9acc5faad0] master: Fix T68597: GPencil Dope Sheet can fail to display active GP object

2019-08-14 Thread Antonioya
Commit: c9acc5faad08422e07be59fc160a028a45b7440c
Author: Antonioya
Date:   Wed Aug 14 10:29:21 2019 +0200
Branches: master
https://developer.blender.org/rBc9acc5faad08422e07be59fc160a028a45b7440c

Fix T68597: GPencil Dope Sheet can fail to display active GP object

Now, the dopesheet is activated if the object is in any Edition mode.

===

M   source/blender/editors/animation/anim_filter.c

===

diff --git a/source/blender/editors/animation/anim_filter.c 
b/source/blender/editors/animation/anim_filter.c
index 625a52fc800..a78a63f1347 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1829,13 +1829,13 @@ static size_t animdata_filter_gpencil(bAnimContext *ac,
   }
 }
 
-/* check selection and object type filters */
-if ((ads->filterflag & ADS_FILTER_ONLYSEL) &&
-!((base->flag & BASE_SELECTED) /*|| (base == scene->basact)*/)) {
-  /* only selected should be shown */
-  continue;
+/* check selection and object type filters only for Object mode */
+if (ob->mode == OB_MODE_OBJECT) {
+  if ((ads->filterflag & ADS_FILTER_ONLYSEL) && !((base->flag & 
BASE_SELECTED))) {
+/* only selected should be shown */
+continue;
+  }
 }
-
 /* check if object belongs to the filtering group if option to filter
  * objects by the grouped status is on
  * - used to ease the process of doing multiple-character 
choreographies

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


[Bf-blender-cvs] [dd370cbf895] greasepencil-object: GPencil: Increase number of input samples to 50

2019-08-13 Thread Antonioya
Commit: dd370cbf8956d5d1cde0c5e42251c9dbf93d16d8
Author: Antonioya
Date:   Tue Aug 13 22:51:37 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBdd370cbf8956d5d1cde0c5e42251c9dbf93d16d8

GPencil: Increase number of input samples to 50

For testing new brushes.

===

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 0de7d8bdd16..3edd529eb68 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -36,7 +36,7 @@ struct MDeformVert;
 
 #define GP_DEFAULT_PIX_FACTOR 1.0f
 #define GP_DEFAULT_GRID_LINES 4
-#define GP_MAX_INPUT_SAMPLES 10
+#define GP_MAX_INPUT_SAMPLES 50
 
 /* * */
 /* GP Stroke Points */

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


[Bf-blender-cvs] [9e68b560a60] master: GPencil: New macros to check Sculpt and Weight Paint modes

2019-08-10 Thread Antonioya
Commit: 9e68b560a60a1059fdcea5c9bfe19db724df083b
Author: Antonioya
Date:   Sat Aug 10 16:26:59 2019 +0200
Branches: master
https://developer.blender.org/rB9e68b560a60a1059fdcea5c9bfe19db724df083b

GPencil: New macros to check Sculpt and Weight Paint modes

===

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 bf72ce5e598..9682fa1d13b 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -651,6 +651,8 @@ typedef enum eGP_DrawMode {
   ((gpd) && (gpd->flag & \
  (GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE | 
GP_DATA_STROKE_WEIGHTMODE)))
 #define GPENCIL_PAINT_MODE(gpd) ((gpd) && (gpd->flag & 
(GP_DATA_STROKE_PAINTMODE)))
+#define GPENCIL_SCULPT_MODE(gpd) ((gpd) && (gpd->flag & 
GP_DATA_STROKE_SCULPTMODE))
+#define GPENCIL_WEIGHT_MODE(gpd) ((gpd) && (gpd->flag & 
GP_DATA_STROKE_WEIGHTMODE))
 #define GPENCIL_SCULPT_OR_WEIGHT_MODE(gpd) \
   ((gpd) && (gpd->flag & (GP_DATA_STROKE_SCULPTMODE | 
GP_DATA_STROKE_WEIGHTMODE)))
 #define GPENCIL_NONE_EDIT_MODE(gpd) \

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


[Bf-blender-cvs] [bc958747b74] greasepencil-object: GPencil: Add inverse matrix to macro

2019-08-10 Thread Antonioya
Commit: bc958747b742464f143e7a07344afd0cb70b3785
Author: Antonioya
Date:   Sat Aug 10 13:17:51 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBbc958747b742464f143e7a07344afd0cb70b3785

GPencil: Add inverse matrix to macro

This makes the macro similar to editable macro.

===

M   source/blender/editors/gpencil/gpencil_intern.h

===

diff --git a/source/blender/editors/gpencil/gpencil_intern.h 
b/source/blender/editors/gpencil/gpencil_intern.h
index 73c9d9d6d84..94e8ee28881 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -587,6 +587,7 @@ typedef enum ACTCONT_TYPES {
 
 struct GP_EditableStrokes_Iter {
   float diff_mat[4][4];
+  float inverse_diff_mat[4][4];
 };
 
 /**
@@ -611,6 +612,7 @@ struct GP_EditableStrokes_Iter {
   for (bGPDframe *gpf_ = init_gpf_; gpf_; gpf_ = gpf_->next) { \
 if ((gpf_ == gpl->actframe) || ((gpf_->flag & GP_FRAME_SELECT) && 
is_multiedit_)) { \
   ED_gpencil_parent_location(depsgraph_, obact_, gpd_, gpl, 
gpstroke_iter.diff_mat); \
+  invert_m4_m4(gpstroke_iter.inverse_diff_mat, 
gpstroke_iter.diff_mat); \
   /* loop over strokes */ \
   bGPDstroke *gpsn_; \
   for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gpsn_) { \
@@ -663,6 +665,7 @@ struct GP_EditableStrokes_Iter {
 for (bGPDframe *gpf_ = init_gpf_; gpf_; gpf_ = gpf_->next) { \
   if ((gpf_ == gpl->actframe) || ((gpf_->flag & GP_FRAME_SELECT) && 
is_multiedit_)) { \
 ED_gpencil_parent_location(depsgraph_, obact_, gpd_, gpl, 
gpstroke_iter.diff_mat); \
+invert_m4_m4(gpstroke_iter.inverse_diff_mat, 
gpstroke_iter.diff_mat); \
 /* get derived frame with modifiers applied */ \
 bGPDframe *derived_gpf_ = 
&obeval_->runtime.derived_frames[derived_idx]; \
 /* loop over strokes */ \

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


[Bf-blender-cvs] [b4aeb8df198] greasepencil-object: GPencil: Fix some minor problems with merge

2019-08-09 Thread Antonioya
Commit: b4aeb8df198e53a86e2a0c6013f8b6f8922b0af8
Author: Antonioya
Date:   Fri Aug 9 17:57:17 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb4aeb8df198e53a86e2a0c6013f8b6f8922b0af8

GPencil: Fix some minor problems with merge

As the code was ain the branch already, the previous merge had some problems.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 41b9f756e6e..65619ffd285 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4504,21 +4504,6 @@ class VIEW3D_MT_edit_gpencil_stroke(Menu):
 class VIEW3D_MT_edit_gpencil_point(Menu):
 bl_label = "Point"
 
-def draw(self, _context):
-layout = self.layout
-
-layout.operator("gpencil.extrude_move", text="Extrude Points")
-
-layout.separator()
-
-layout.operator("gpencil.stroke_smooth", text="Smooth 
Points").only_selected = True
-
-layout.separator()
-
-layout.operator("gpencil.stroke_merge", text="Merge Points")
-
-# TODO: add new RIP operator
-
 def draw(self, _context):
 layout = self.layout
 
@@ -4600,24 +4585,6 @@ class VIEW3D_MT_edit_gpencil_transform(Menu):
 layout.operator("transform.transform", text="Shrink Fatten").mode = 
'GPENCIL_SHRINKFATTEN'
 
 
-class VIEW3D_MT_edit_gpencil_interpolate(Menu):
-bl_label = "Interpolate"
-
-def draw(self, _context):
-layout = self.layout
-
-layout.operator("gpencil.interpolate", text="Interpolate")
-layout.operator("gpencil.interpolate_sequence", text="Sequence")
-
-class VIEW3D_MT_edit_gpencil_showhide(Menu):
-bl_label = "Show/hide"
-
-def draw(self, _context):
-layout = self.layout
-
-layout.operator("gpencil.hide", text="Hide Active Layer")
-layout.operator("gpencil.reveal", text="Show All Layers")
-
 layout.operator("gpencil.interpolate", text="Interpolate")
 layout.operator("gpencil.interpolate_sequence", text="Sequence")

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


[Bf-blender-cvs] [18668a20cb4] master: Cleanup: Remove blank lines and trim end line spaces

2019-08-09 Thread Antonioya
Commit: 18668a20cb419ea1a2e17fc9314eb7397e13a55c
Author: Antonioya
Date:   Fri Aug 9 17:46:05 2019 +0200
Branches: master
https://developer.blender.org/rB18668a20cb419ea1a2e17fc9314eb7397e13a55c

Cleanup: Remove blank lines and trim end line spaces

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index cfe4a06dcc0..65619ffd285 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4458,7 +4458,7 @@ class VIEW3D_MT_edit_gpencil(Menu):
 layout.menu("VIEW3D_MT_weight_gpencil")
 
 layout.separator()
-
+
 layout.menu("VIEW3D_MT_edit_gpencil_showhide")
 
 layout.operator_menu_enum("gpencil.stroke_separate", "mode")
@@ -4468,14 +4468,14 @@ class VIEW3D_MT_edit_gpencil(Menu):
 
 # Remove
 layout.menu("VIEW3D_MT_edit_gpencil_delete")
-
+
 
 class VIEW3D_MT_edit_gpencil_stroke(Menu):
 bl_label = "Stroke"
 
 def draw(self, _context):
 layout = self.layout
-
+
 layout.operator("gpencil.stroke_subdivide", 
text="Subdivide").only_selected = False
 layout.menu("VIEW3D_MT_gpencil_simplify")
 layout.operator("gpencil.stroke_trim", text="Trim")
@@ -4506,21 +4506,21 @@ class VIEW3D_MT_edit_gpencil_point(Menu):
 
 def draw(self, _context):
 layout = self.layout
-
+
 layout.operator("gpencil.extrude_move", text="Extrude Points")
 
 layout.separator()
-
+
 layout.operator("gpencil.stroke_smooth", text="Smooth 
Points").only_selected = True
 
 layout.separator()
 
 layout.operator("gpencil.stroke_merge", text="Merge Points")
-
-# TODO: add new RIP operator
+
+# TODO: add new RIP operator
 
 layout.separator()
-
+
 layout.menu("VIEW3D_MT_gpencil_vertex_group")
 
 
@@ -4554,7 +4554,7 @@ class VIEW3D_MT_gpencil_animation(Menu):
 def draw(self, _context):
 layout = self.layout
 
-layout.operator("gpencil.blank_frame_add")
+layout.operator("gpencil.blank_frame_add")
 
 layout.separator()
 
@@ -4593,7 +4593,7 @@ class VIEW3D_MT_edit_gpencil_showhide(Menu):
 
 def draw(self, _context):
 layout = self.layout
-
+
 layout.operator("gpencil.hide", text="Hide Active Layer")
 layout.operator("gpencil.reveal", text="Show All Layers")

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


[Bf-blender-cvs] [6ae9dd0902a] greasepencil-object: GPencil: More merge errors

2019-08-09 Thread Antonioya
Commit: 6ae9dd0902ad60de8813fdf49bd2fb0c2cd6444a
Author: Antonioya
Date:   Fri Aug 9 13:57:25 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB6ae9dd0902ad60de8813fdf49bd2fb0c2cd6444a

GPencil: More merge errors

All these errors are related to the problem when merge the LANPR branch to 
GPencil branch by error.

===

M   release/scripts/startup/bl_ui/properties_data_gpencil.py
M   release/scripts/startup/bl_ui/properties_material_gpencil.py
M   release/scripts/startup/bl_ui/space_clip.py
M   release/scripts/startup/bl_ui/space_image.py
M   release/scripts/startup/bl_ui/space_node.py
M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/blenfont/BLF_api.h
M   source/blender/blenfont/intern/blf_thumbs.c
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/intern/armature.c
M   source/blender/blenkernel/intern/subdiv_mesh.c
M   source/blender/blenkernel/intern/tracking_stabilize.c
M   source/blender/blentranslation/CMakeLists.txt
M   source/blender/blentranslation/intern/blt_lang.c
M   source/blender/bmesh/operators/bmo_primitive.c
M   source/blender/draw/engines/gpencil/gpencil_shader_fx.c
M   
source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
M   source/blender/editors/sculpt_paint/paint_image_proj.c
M   source/blender/editors/space_action/action_select.c
M   source/blender/editors/space_file/filelist.c
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/editors/transform/transform_conversions.c
M   source/blender/imbuf/IMB_thumbs.h
M   source/blender/imbuf/intern/thumbs_font.c
M   source/blender/makesrna/intern/rna_meta.c
M   source/blender/makesrna/intern/rna_object.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index 04424b2a97a..7d3c61af34c 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -268,7 +268,7 @@ class DATA_PT_gpencil_onion_skinning(DataButtonsPanel, 
Panel):
 col = layout.column(align=True)
 col.prop(gpd, "ghost_before_range", text="Keyframes Before")
 col.prop(gpd, "ghost_after_range", text="Keyframes After")
- 
+
 
 class DATA_PT_gpencil_onion_skinning_custom_colors(DataButtonsPanel, Panel):
 bl_parent_id = "DATA_PT_gpencil_onion_skinning"
diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 79be1bbdfe7..a9e68ecc502 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -120,6 +120,7 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 ma = context.material
 if ma is not None and ma.grease_pencil is not None:
 gpcolor = ma.grease_pencil
+self.layout.enabled = not gpcolor.lock
 self.layout.prop(gpcolor, "show_stroke", text="")
 
 def draw(self, context):
@@ -131,7 +132,7 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 gpcolor = ma.grease_pencil
 
 col = layout.column()
-col.active = not gpcolor.lock
+col.enabled = not gpcolor.lock
 
 col.prop(gpcolor, "mode")
 
@@ -171,6 +172,7 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, 
Panel):
 def draw_header(self, context):
 ma = context.material
 gpcolor = ma.grease_pencil
+self.layout.enabled = not gpcolor.lock
 self.layout.prop(gpcolor, "show_fill", text="")
 
 def draw(self, context):
@@ -182,7 +184,7 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, 
Panel):
 
 # color settings
 col = layout.column()
-col.active = not gpcolor.lock
+col.enabled = not gpcolor.lock
 col.prop(gpcolor, "fill_style", text="Style")
 
 if gpcolor.fill_style == 'GRADIENT':
diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index fefb12ad323..37c76bf327c 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1202,7 +1202,7 @@ class CLIP_PT_tools_scenesetup(Panel):
 
 
 # Grease Pencil properties
-class CLIP_PT_grease_pencil(AnnotationDataPanel, CLIP_PT_clip_view_panel, 
Panel):
+class CLIP_PT_annotation(AnnotationDataPanel, CLIP_PT_clip_view_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'
 bl_region_typ

[Bf-blender-cvs] [0ff6eb86815] greasepencil-object: GPencil: Fix old merge error

2019-08-09 Thread Antonioya
Commit: 0ff6eb868153bd77192ed6deee4492f75c9ba032
Author: Antonioya
Date:   Fri Aug 9 12:38:59 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0ff6eb868153bd77192ed6deee4492f75c9ba032

GPencil: Fix old merge error

===

M   source/blender/windowmanager/intern/wm_init_exit.c

===

diff --git a/source/blender/windowmanager/intern/wm_init_exit.c 
b/source/blender/windowmanager/intern/wm_init_exit.c
index 900024d4853..29cb02888ac 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -80,6 +80,8 @@
 #include "RE_engine.h"
 #include "RE_pipeline.h" /* RE_ free stuff */
 
+#include "IMB_thumbs.h"
+
 #ifdef WITH_PYTHON
 #  include "BPY_extern.h"
 #endif
@@ -299,6 +301,9 @@ void WM_init(bContext *C, int argc, const char **argv)
   /* Call again to set from userpreferences... */
   BLT_lang_set(NULL);
 
+  /* That one is generated on demand, we need to be sure it's clear on init. */
+  IMB_thumb_clear_translations();
+
   if (!G.background) {
 
 #ifdef WITH_INPUT_NDOF

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


[Bf-blender-cvs] [8aa2f3b6ce8] master: GPencil: Add "Self Overlap" parameter to materials to disable Stencil

2019-08-09 Thread Antonioya
Commit: 8aa2f3b6ce89065151e37a9922296582c8ea7c8e
Author: Antonioya
Date:   Fri Aug 9 11:04:14 2019 +0200
Branches: master
https://developer.blender.org/rB8aa2f3b6ce89065151e37a9922296582c8ea7c8e

GPencil: Add "Self Overlap" parameter to materials to disable Stencil

This parameter was removed in 2.80 and we decided to back again, but now is 
inverted.

===

M   release/scripts/startup/bl_ui/properties_material_gpencil.py
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/makesdna/DNA_material_types.h
M   source/blender/makesrna/intern/rna_material.c

===

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 8db0f8182ab..a9e68ecc502 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -162,6 +162,8 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 if gpcolor.mode in {'DOTS', 'BOX'}:
 col.prop(gpcolor, "alignment_mode")
 
+if gpcolor.mode == 'LINE':
+col.prop(gpcolor, "use_overlap_strokes")
 
 class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
 bl_label = "Fill"
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 9b755217946..2892d0dbbaa 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1456,7 +1456,8 @@ void gpencil_triangulate_stroke_fill(Object *ob, 
bGPDstroke *gps)
 /* Check if stencil is required */
 static bool gpencil_is_stencil_required(MaterialGPencilStyle *gp_style)
 {
-  return (bool)(gp_style->stroke_style == GP_STYLE_STROKE_STYLE_SOLID);
+  return (bool)((gp_style->stroke_style == GP_STYLE_STROKE_STYLE_SOLID) &&
+((gp_style->flag & GP_STYLE_DISABLE_STENCIL) == 0));
 }
 
 /* draw stroke in drawing buffer */
diff --git a/source/blender/makesdna/DNA_material_types.h 
b/source/blender/makesdna/DNA_material_types.h
index 42308f54d7a..152ecb85991 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -128,6 +128,8 @@ typedef enum eMaterialGPencilStyle_Flag {
   GP_STYLE_FILL_SHOW = (1 << 9),
   /* mix stroke texture */
   GP_STYLE_STROKE_TEX_MIX = (1 << 11),
+  /* disable stencil clipping (overlap) */
+  GP_STYLE_DISABLE_STENCIL = (1 << 12),
 } eMaterialGPencilStyle_Flag;
 
 typedef enum eMaterialGPencilStyle_Mode {
diff --git a/source/blender/makesrna/intern/rna_material.c 
b/source/blender/makesrna/intern/rna_material.c
index 162ba6be834..04fe53821e4 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -610,8 +610,14 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
   prop = RNA_def_property(srna, "use_fill_pattern", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_FILL_PATTERN);
   RNA_def_property_ui_text(prop, "Pattern", "Use Fill Texture as a pattern to 
apply color");
+
   RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, 
"rna_MaterialGpencil_update");
+  prop = RNA_def_property(srna, "use_overlap_strokes", PROP_BOOLEAN, 
PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_DISABLE_STENCIL);
+  RNA_def_property_ui_text(
+  prop, "Self Overlap", "Disable stencil and overlap self intersections 
with alpha materials");
 
+  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, 
"rna_MaterialGpencil_update");
   prop = RNA_def_property(srna, "show_stroke", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_STROKE_SHOW);
   RNA_def_property_ui_text(prop, "Show Stroke", "Show stroke lines of this 
material");

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


[Bf-blender-cvs] [179e886ab3d] master: GPencil: New Simplify modifier mode Sample and operator

2019-08-08 Thread Antonioya
Commit: 179e886ab3d6f8b762ff66c5bb2cb203a4adcb62
Author: Antonioya
Date:   Thu Aug 8 16:12:13 2019 +0200
Branches: master
https://developer.blender.org/rB179e886ab3d6f8b762ff66c5bb2cb203a4adcb62

GPencil: New Simplify modifier mode Sample and operator

This mode simplify the stroke doing a resampling of the points and generate new 
geometry at the distance defined.

Sample function developed by @NicksBest

New Resample Stroke operator

This operator recreates the stroke geometry with a predefined length between 
points.

The operator uses the same code used in Simplify modifier.

Reviewers: @mendio

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/intern/gpencil.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/gpencil_modifiers/intern/MOD_gpencilsimplify.c
M   source/blender/makesdna/DNA_gpencil_modifier_types.h
M   source/blender/makesrna/intern/rna_gpencil_modifier.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 66e96199b08..5595408f1da 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1785,13 +1785,13 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, 
Panel):
 
 col = split.column()
 col.label(text="Settings:")
-row = col.row(align=True)
-row.enabled = md.mode == 'FIXED'
-row.prop(md, "step")
 
-row = col.row(align=True)
-row.enabled = not md.mode == 'FIXED'
-row.prop(md, "factor")
+if md.mode == 'FIXED':
+col.prop(md, "step")
+elif md.mode == 'ADAPTIVE':
+col.prop(md, "factor")
+elif md.mode == 'SAMPLE':
+col.prop(md, "length")
 
 col = layout.column()
 col.separator()
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 2eeb13310fa..c7fc79aa8e8 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4447,6 +4447,7 @@ class VIEW3D_MT_gpencil_simplify(Menu):
 layout = self.layout
 layout.operator("gpencil.stroke_simplify_fixed", text="Fixed")
 layout.operator("gpencil.stroke_simplify", text="Adaptive")
+layout.operator("gpencil.stroke_sample", text="Sample")
 
 
 class VIEW3D_MT_paint_gpencil(Menu):
@@ -6322,8 +6323,7 @@ class VIEW3D_MT_gpencil_edit_context_menu(Menu):
 if is_3d_view:
 layout.menu("GPENCIL_MT_cleanup")
 
-layout.operator("gpencil.stroke_simplify_fixed", text="Simplify")
-layout.operator("gpencil.stroke_simplify", text="Simplify Adaptive")
+layout.menu("VIEW3D_MT_gpencil_simplify")
 layout.operator("gpencil.stroke_merge", text="Merge")
 layout.menu("VIEW3D_MT_edit_gpencil_delete")
 
diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index 3dfd6eb466c..997f1fc82e1 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -216,6 +216,7 @@ void BKE_gpencil_stroke_2d_flat_ref(const struct bGPDspoint 
*ref_points,
 
 void BKE_gpencil_transform(struct bGPdata *gpd, float mat[4][4]);
 
+bool BKE_gpencil_sample_stroke(struct bGPDstroke *gps, const float dist, const 
bool select);
 bool BKE_gpencil_smooth_stroke(struct bGPDstroke *gps, int i, float inf);
 bool BKE_gpencil_smooth_stroke_strength(struct bGPDstroke *gps, int 
point_index, float influence);
 bool BKE_gpencil_smooth_stroke_thickness(struct bGPDstroke *gps, int 
point_index, float influence);
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index efdb35d4409..b9e7b155941 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1404,6 +1404,324 @@ void BKE_gpencil_dvert_ensure(bGPDstroke *gps)
 
 /* ** */
 
+static void stroke_defvert_create_nr_list(MDeformVert *dv_list,
+  int count,
+  ListBase *result,
+  int *totweight)
+{
+  LinkData *ld;
+  MDeformVert *

[Bf-blender-cvs] [b9d0f33530f] master: Fix T67545: GPencil - New Merge by Distance operator

2019-08-08 Thread Antonioya
Commit: b9d0f33530f095fb318890dca4f8933a9afd1904
Author: Antonioya
Date:   Thu Aug 8 10:23:05 2019 +0200
Branches: master
https://developer.blender.org/rBb9d0f33530f095fb318890dca4f8933a9afd1904

Fix T67545: GPencil - New Merge by Distance operator

Merge points when the distance is less than a predefined value.

The method to interpolate the position created a wrong merge. Now, always the 
secondary point is merged with the first one (merge at first), except the last 
point.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/intern/gpencil.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

===

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 1e5aac4cc0d..bef4f395233 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -606,6 +606,7 @@ class GPENCIL_MT_cleanup(Menu):
 
 def draw(self, _context):
 layout = self.layout
+layout.operator("gpencil.stroke_merge_by_distance", text="Merge by 
Distance")
 layout.operator("gpencil.frame_clean_loose", text="Loose Points")
 layout.separator()
 
diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index 9ec872f3676..3dfd6eb466c 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -197,6 +197,10 @@ void BKE_gpencil_simplify_stroke(struct bGPDstroke *gps, 
float factor);
 void BKE_gpencil_simplify_fixed(struct bGPDstroke *gps);
 void BKE_gpencil_subdivide(struct bGPDstroke *gps, int level, int flag);
 bool BKE_gpencil_trim_stroke(struct bGPDstroke *gps);
+void BKE_gpencil_merge_distance_stroke(struct bGPDframe *gpf,
+   struct bGPDstroke *gps,
+   const float threshold,
+   const bool use_unselected);
 
 void BKE_gpencil_stroke_2d_flat(const struct bGPDspoint *points,
 int totpoints,
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 3ae20642b15..efdb35d4409 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2138,3 +2138,81 @@ void BKE_gpencil_dissolve_points(bGPDframe *gpf, 
bGPDstroke *gps, const short ta
 gps->tot_triangles = 0;
   }
 }
+
+/* Merge by distance - */
+/* Reduce a series of points when the distance is below a threshold.
+ * Special case for first and last points (both are keeped) for other points,
+ * the merge point always is at first point.
+ * \param gpf: Grease Pencil frame
+ * \param gps: Grease Pencil stroke
+ * \param threshold: Distance between points
+ * \param use_unselected: Set to true to analyze all stroke and not only 
selected points
+ */
+void BKE_gpencil_merge_distance_stroke(bGPDframe *gpf,
+   bGPDstroke *gps,
+   const float threshold,
+   const bool use_unselected)
+{
+  bGPDspoint *pt = NULL;
+  bGPDspoint *pt_next = NULL;
+  float tagged = false;
+  /* Use square distance to speed up loop */
+  const float th_square = threshold * threshold;
+  /* Need to have something to merge. */
+  if (gps->totpoints < 2) {
+return;
+  }
+  int i = 0;
+  int step = 1;
+  while ((i < gps->totpoints - 1) && (i + step < gps->totpoints)) {
+pt = &gps->points[i];
+if (pt->flag & GP_SPOINT_TAG) {
+  i++;
+  step = 1;
+  continue;
+}
+pt_next = &gps->points[i + step];
+/* Do not recalc tagged points. */
+if (pt_next->flag & GP_SPOINT_TAG) {
+  step++;
+  continue;
+}
+/* Check if contiguous points are selected. */
+if (!use_unselected) {
+  if (((pt->flag & GP_SPOINT_SELECT) == 0) || ((pt_next->flag & 
GP_SPOINT_SELECT) == 0)) {
+i++;
+step = 1;
+continue;
+  }
+}
+float len_square = len_squared_v3v3(&pt->x, &pt_next->x);
+if (len_square <= th_square) {
+  tagged = true;
+  if (i != gps->totpoints - 1) {
+/* Tag second point for delete. */
+pt_next->flag |= GP_SPOINT_TAG;
+  }
+  else {
+pt->flag |= GP_SPOINT_TAG;
+  }
+  /* Jump to next pair of points, keeping first point segment equals.*/
+  ste

[Bf-blender-cvs] [76e0123700c] greasepencil-object: GPencil: Fix error after merge

2019-08-07 Thread Antonioya
Commit: 76e0123700c0f8385bc403b06ad0dd6d66b7c48f
Author: Antonioya
Date:   Wed Aug 7 12:13:53 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB76e0123700c0f8385bc403b06ad0dd6d66b7c48f

GPencil: Fix error after merge

===

M   source/blender/editors/gpencil/gpencil_intern.h
M   source/blender/editors/gpencil/gpencil_svg.c
M   source/blender/editors/object/object_hook.c
M   source/blender/editors/space_clip/clip_graph_draw.c
M   source/blender/editors/space_clip/clip_graph_ops.c
M   source/blender/editors/space_clip/clip_intern.h
M   source/blender/editors/space_clip/clip_utils.c
M   source/blender/editors/space_clip/tracking_ops_solve.c

===

diff --git a/source/blender/editors/gpencil/gpencil_intern.h 
b/source/blender/editors/gpencil/gpencil_intern.h
index 8d030a7f464..f9f4e31f5ce 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -646,7 +646,7 @@ struct GP_EditableStrokes_Iter {
 #define GP_DERIVED_STROKES_BEGIN(gpstroke_iter, C, gpl, gps) \
   { \
 struct GP_EditableStrokes_Iter gpstroke_iter = {{{0}}}; \
-Depsgraph *depsgraph_ = CTX_data_depsgraph(C); \
+Depsgraph *depsgraph_ = CTX_data_ensure_evaluated_depsgraph(C); \
 Object *obact_ = CTX_data_active_object(C); \
 Object *obeval_ = DEG_get_evaluated_object(depsgraph_, obact_); \
 bGPdata *gpd_ = CTX_data_gpencil_data(C); \
diff --git a/source/blender/editors/gpencil/gpencil_svg.c 
b/source/blender/editors/gpencil/gpencil_svg.c
index f2e9813e55b..56950b3009c 100644
--- a/source/blender/editors/gpencil/gpencil_svg.c
+++ b/source/blender/editors/gpencil/gpencil_svg.c
@@ -89,9 +89,6 @@ void GPENCIL_OT_export_svg(wmOperatorType *ot)
   ot->exec = gpencil_export_svg_exec;
   ot->poll = gpencil_export_svg_poll;
 
-  /* flag */
-  ot->flag = OPTYPE_USE_EVAL_DATA;
-
   /* properties */
   /* Should have: facing, layer, visibility, file split... */
 }
diff --git a/source/blender/editors/object/object_hook.c 
b/source/blender/editors/object/object_hook.c
index 56221ad8202..15c5ea40991 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -52,6 +52,7 @@
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
 
 #include "RNA_define.h"
 #include "RNA_access.h"
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c 
b/source/blender/editors/space_clip/clip_graph_draw.c
index df82e878039..3f705aad89a 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -48,6 +48,7 @@
 #include "clip_intern.h"  // own include
 
 typedef struct TrackMotionCurveUserData {
+  SpaceClip *sc;
   MovieTrackingTrack *act_track;
   bool sel;
   float xscale, yscale, hsize;
@@ -72,13 +73,28 @@ static void tracking_segment_point_cb(void *userdata,
 
 static void tracking_segment_start_cb(void *userdata,
   MovieTrackingTrack *track,
-  int coord,
+  eClipCurveValueSource value_source,
   bool is_point)
 {
   TrackMotionCurveUserData *data = (TrackMotionCurveUserData *)userdata;
+  SpaceClip *sc = data->sc;
   float col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 
-  col[coord] = 1.0f;
+  if (!clip_graph_value_visible(sc, value_source)) {
+return;
+  }
+
+  switch (value_source) {
+case CLIP_VALUE_SOURCE_SPEED_X:
+  col[0] = 1.0f;
+  break;
+case CLIP_VALUE_SOURCE_SPEED_Y:
+  col[1] = 1.0f;
+  break;
+case CLIP_VALUE_SOURCE_REPROJECTION_ERROR:
+  col[2] = 1.0f;
+  break;
+  }
 
   if (track == data->act_track) {
 col[3] = 1.0f;
@@ -100,15 +116,20 @@ static void tracking_segment_start_cb(void *userdata,
   }
 }
 
-static void tracking_segment_end_cb(void *UNUSED(userdata), int UNUSED(coord))
+static void tracking_segment_end_cb(void *userdata, eClipCurveValueSource 
value_source)
 {
+  TrackMotionCurveUserData *data = (TrackMotionCurveUserData *)userdata;
+  SpaceClip *sc = data->sc;
+  if (!clip_graph_value_visible(sc, value_source)) {
+return;
+  }
   immEnd();
 }
 
 static void tracking_segment_knot_cb(void *userdata,
  MovieTrackingTrack *track,
  MovieTrackingMarker *marker,
- int coord,
+ eClipCurveValueSource value_source,
  int scene_framenr,
  float val)
 {
@@ -118,8 +139,11 @@ static void tracking_segment_knot_cb(void *userdata,
   if (track != data->ac

[Bf-blender-cvs] [0aa824cad2b] greasepencil-object: GPencil: Revert wrong merge of LANPR branch

2019-08-06 Thread Antonioya
Commit: 0aa824cad2bf1b0715551425076bbc2156153190
Author: Antonioya
Date:   Tue Aug 6 19:43:09 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0aa824cad2bf1b0715551425076bbc2156153190

GPencil: Revert wrong merge of LANPR branch

Due to an error, the code of LANPR branch was merged accidentally to the Grease 
Pencil branch.

This commit reverts all work to the last correct commit.

The command executed was: `git diff ff7482286319e7b462b98dc26909b47d9d661ec6 | 
patch -p1 -R`

Thanks to @dfelinto for fixing the error.

===

D   bvhtree
M   intern/opensubdiv/internal/opensubdiv_evaluator.cc
M   intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
M   intern/opensubdiv/internal/opensubdiv_evaluator_internal.h
M   intern/opensubdiv/opensubdiv_evaluator_capi.h
D   mesh
M   release/scripts/startup/bl_operators/__init__.py
D   release/scripts/startup/bl_operators/lanpr.py
M   release/scripts/startup/bl_ui/__init__.py
D   release/scripts/startup/bl_ui/properties_collection.py
M   release/scripts/startup/bl_ui/properties_data_armature.py
M   release/scripts/startup/bl_ui/properties_data_bone.py
M   release/scripts/startup/bl_ui/properties_data_camera.py
M   release/scripts/startup/bl_ui/properties_data_curve.py
M   release/scripts/startup/bl_ui/properties_data_lattice.py
M   release/scripts/startup/bl_ui/properties_data_light.py
M   release/scripts/startup/bl_ui/properties_data_mesh.py
M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   release/scripts/startup/bl_ui/properties_data_speaker.py
M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
D   release/scripts/startup/bl_ui/properties_lanpr.py
M   release/scripts/startup/bl_ui/properties_material.py
M   release/scripts/startup/bl_ui/properties_material_gpencil.py
M   release/scripts/startup/bl_ui/properties_object.py
M   release/scripts/startup/bl_ui/properties_output.py
M   release/scripts/startup/bl_ui/properties_particle.py
M   release/scripts/startup/bl_ui/properties_physics_cloth.py
M   release/scripts/startup/bl_ui/properties_physics_common.py
M   release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
M   release/scripts/startup/bl_ui/properties_physics_field.py
M   release/scripts/startup/bl_ui/properties_physics_fluid.py
M   release/scripts/startup/bl_ui/properties_physics_rigidbody.py
M   release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
M   release/scripts/startup/bl_ui/properties_physics_softbody.py
M   release/scripts/startup/bl_ui/properties_render.py
M   release/scripts/startup/bl_ui/properties_scene.py
M   release/scripts/startup/bl_ui/properties_view_layer.py
M   release/scripts/startup/bl_ui/properties_world.py
M   release/scripts/startup/bl_ui/space_clip.py
M   release/scripts/startup/bl_ui/space_image.py
M   release/scripts/startup/bl_ui/space_node.py
M   release/scripts/startup/bl_ui/space_sequencer.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenfont/BLF_api.h
M   source/blender/blenfont/intern/blf_thumbs.c
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/CMakeLists.txt
M   source/blender/blenkernel/intern/armature.c
M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenkernel/intern/data_transfer.c
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/blenkernel/intern/gpencil_modifier.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenkernel/intern/subdiv_mesh.c
M   source/blender/blenkernel/intern/tracking_stabilize.c
M   source/blender/blenlib/BLI_math_base.h
M   source/blender/blenlib/BLI_math_vector.h
M   source/blender/blenlib/intern/math_base_inline.c
M   source/blender/blenlib/intern/math_vector.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/blenloader/intern/writefile.c
M   source/blender/blentranslation/CMakeLists.txt
M   source/blender/blentranslation/intern/blt_lang.c
M   source/blender/bmesh/operators/bmo_primitive.c
M   source/blender/draw/CMakeLists.txt
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_render.c
M   source/blender/draw/engines/gpencil/gpencil_shader_fx.c
M   
source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
D   source/blender/draw/engines/lanpr/lanpr_access.h
D   source/blender/draw/engines/lanpr/lanpr_all.h
D   source/blender/draw/engines/lanpr/lanpr_chain_draw.c
D   source/blender/draw/engines/lanpr/lanpr_cpu.c
D   source/blender/draw/engines/lanpr

[Bf-blender-cvs] [80123efc5fc] master: Fix T67939: GPencil Noise modifier wrong random calculation

2019-08-01 Thread Antonioya
Commit: 80123efc5fc258ef8b27efba67d6ad2a0efb7edd
Author: Antonioya
Date:   Thu Aug 1 17:54:51 2019 +0200
Branches: master
https://developer.blender.org/rB80123efc5fc258ef8b27efba67d6ad2a0efb7edd

Fix T67939: GPencil Noise modifier wrong random calculation

There were several problems in the old random calculation:

* Different result in the viewport and render.
* Noise "pop" in some frames. 
* Random number was calculated every time the file was opened, so get different 
results.

Now, instead to calculate the random numbers when n number of frames changed, 
the random values are calculated using a unique seed by stroke.

Also, a new Seed parameter has been added and this adds more control in the 
noise generated. This value can be animated and get more variations.

Differential Revision: http://developer.blender.org/D5393

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
M   source/blender/makesdna/DNA_gpencil_modifier_types.h
M   source/blender/makesrna/intern/rna_gpencil_modifier.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 0a4c166d0f7..66e96199b08 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1685,6 +1685,9 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, 
Panel):
 row = col.row()
 row.enabled = md.random
 row.prop(md, "step")
+row = col.row()
+row.enabled = md.random
+row.prop(md, "seed")
 col.prop(md, "full_stroke")
 col.prop(md, "move_extreme")
 
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
index e0139eac6b2..e891b6dea12 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
@@ -26,10 +26,9 @@
 #include "BLI_utildefines.h"
 
 #include "BLI_math_vector.h"
+#include "BLI_hash.h"
 #include "BLI_rand.h"
 
-#include "PIL_time.h"
-
 #include "DNA_meshdata_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
@@ -58,20 +57,7 @@ static void initData(GpencilModifierData *md)
   gpmd->layername[0] = '\0';
   gpmd->vgname[0] = '\0';
   gpmd->step = 1;
-  gpmd->scene_frame = -99;
-  gpmd->gp_frame = -99;
-
-  gpmd->vrand1 = 1.0;
-  gpmd->vrand2 = 1.0;
-}
-
-static void freeData(GpencilModifierData *md)
-{
-  NoiseGpencilModifierData *mmd = (NoiseGpencilModifierData *)md;
-
-  if (mmd->rng != NULL) {
-BLI_rng_free(mmd->rng);
-  }
+  gpmd->seed = 0;
 }
 
 static void copyData(const GpencilModifierData *md, GpencilModifierData 
*target)
@@ -85,21 +71,6 @@ static bool dependsOnTime(GpencilModifierData *md)
   return (mmd->flag & GP_NOISE_USE_RANDOM) != 0;
 }
 
-/* Get the lower number of frame for all layers. */
-static int get_lower_frame(bGPdata *gpd)
-{
-  int init = 9;
-  for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-if (gpl->frames.first) {
-  bGPDframe *gpf = gpl->frames.first;
-  if (gpf->framenum < init) {
-init = gpf->framenum;
-  }
-}
-  }
-  return init;
-}
-
 /* aply noise effect based on stroke direction */
 static void deformStroke(
 GpencilModifierData *md, Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, 
bGPDstroke *gps)
@@ -111,26 +82,10 @@ static void deformStroke(
   float normal[3];
   float vec1[3], vec2[3];
   int sc_frame = 0;
-  int sc_diff = 0;
+  int stroke_seed = 0;
   const int def_nr = defgroup_name_index(ob, mmd->vgname);
   const float unit_v3[3] = {1.0f, 1.0f, 1.0f};
 
-  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;
-  bGPdata *gpd = (bGPdata *)ob->data;
-
-  /* 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_eval->rng = BLI_rng_new(rng_seed);
-mmd->rng = mmd_eval->rng;
-/* Get lower frame number */
-mmd_eval->scene_frame = get_lower_frame(gpd);
-mmd->scene_frame = mmd_eval->scene_frame;
-  }
-
   if (!is_stroke_affected_by_modifier(ob,
   mmd->layername,
   m

[Bf-blender-cvs] [7f29fc7415a] master: Fix T65691: GPencil Drawing long strokes turn invisible

2019-07-30 Thread Antonioya
Commit: 7f29fc7415a49d5688efbe10fa0a81b174d49435
Author: Antonioya
Date:   Sat Jul 20 23:01:19 2019 +0200
Branches: master
https://developer.blender.org/rB7f29fc7415a49d5688efbe10fa0a81b174d49435

Fix T65691: GPencil Drawing long strokes turn invisible

There was a fixed limit to the number of points available in a buffer stroke.

Now, the array is expanded as needed using a predefined number of points for 
each expansion, instead to add one by one. This is done to reduce the number of 
times the memory allocation is required.

As part of the fix, some variables have been renamed to reflect better their 
use.

===

M   source/blender/blenloader/intern/readfile.c
M   source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/editors/gpencil/annotate_draw.c
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_fill.c
M   source/blender/editors/gpencil/gpencil_intern.h
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/include/ED_gpencil.h
M   source/blender/makesdna/DNA_gpencil_types.h

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 88d878ac019..a4979cc470c 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7039,6 +7039,7 @@ static void direct_link_gpencil(FileData *fd, bGPdata 
*gpd)
 
   /* init stroke buffer */
   gpd->runtime.sbuffer = NULL;
+  gpd->runtime.sbuffer_used = 0;
   gpd->runtime.sbuffer_size = 0;
   gpd->runtime.tot_cp_points = 0;
 
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 18950f00823..d5f8d062593 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -375,7 +375,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, 
short thickness)
   Object *ob = draw_ctx->obact;
 
   tGPspoint *points = gpd->runtime.sbuffer;
-  int totpoints = gpd->runtime.sbuffer_size;
+  int totpoints = gpd->runtime.sbuffer_used;
   /* if cyclic needs more vertex */
   int cyclic_add = (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC) ? 1 : 0;
   int totvertex = totpoints + cyclic_add + 2;
@@ -477,7 +477,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short 
thickness)
   Object *ob = draw_ctx->obact;
 
   tGPspoint *points = gpd->runtime.sbuffer;
-  int totpoints = gpd->runtime.sbuffer_size;
+  int totpoints = gpd->runtime.sbuffer_used;
 
   static GPUVertFormat format = {0};
   static uint pos_id, color_id, thickness_id, uvdata_id, prev_pos_id;
@@ -621,7 +621,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd)
   }
 
   const tGPspoint *points = gpd->runtime.sbuffer;
-  int totpoints = gpd->runtime.sbuffer_size;
+  int totpoints = gpd->runtime.sbuffer_used;
   if (totpoints < 3) {
 return NULL;
   }
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 181d2efbabb..9b755217946 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1493,7 +1493,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data,
   /* Check if may need to draw the active stroke cache, only if this layer is 
the active layer
* that is being edited. (Stroke buffer is currently stored in gp-data)
*/
-  if (gpd->runtime.sbuffer_size > 0) {
+  if (gpd->runtime.sbuffer_used > 0) {
 if ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) {
   /* It should also be noted that sbuffer contains temporary point types
* i.e. tGPspoints NOT bGPDspoints
@@ -1506,7 +1506,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data,
   stl->storage->alignment_mode = (gp_style) ? gp_style->alignment_mode : 
GP_STYLE_FOLLOW_PATH;
 
   /* if only one point, don't need to draw buffer because the user has no 
time to see it */
-  if (gpd->runtime.sbuffer_size > 1) {
+  if (gpd->runtime.sbuffer_used > 1) {
 if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) {
   stl->g_data->shgrps_drawing_stroke = gpencil_shgroup_stroke_create(
   vedata,
@@ -1562,7 +1562,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data

[Bf-blender-cvs] [1178046ed22] master: GPencil: Remove Annotations panel from non-preview Sequencer areas

2019-07-29 Thread Antonioya
Commit: 1178046ed2227915e2ec73e9fdc90459e1637e9a
Author: Antonioya
Date:   Mon Jul 29 22:43:09 2019 +0200
Branches: master
https://developer.blender.org/rB1178046ed2227915e2ec73e9fdc90459e1637e9a

GPencil: Remove Annotations panel from non-preview Sequencer areas

Fix by: Peter Fog (@tintwotin)

I did some small changes to original differential code.

Differential Revision: http://developer.blender.org/D5306

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index ff71c7a825a..d5ef24d7ff3 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -1996,6 +1996,15 @@ class SEQUENCER_PT_annotation(AnnotationDataPanel, 
SequencerButtonsPanel_Output,
 bl_region_type = 'UI'
 bl_category = "View"
 
+@staticmethod
+def has_preview(context):
+st = context.space_data
+return st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}
+
+@classmethod
+def poll(cls, context):
+return cls.has_preview(context)
+
 # NOTE: this is just a wrapper around the generic GP Panel
 # But, it should only show up when there are images in the preview region

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


[Bf-blender-cvs] [770b496729d] master: Cleanup: GPencil replace cfra_eval by cfra or CFRA

2019-07-29 Thread Antonioya
Commit: 770b496729d21f3e700cadd1bc3543a57ca01169
Author: Antonioya
Date:   Mon Jul 29 17:07:24 2019 +0200
Branches: master
https://developer.blender.org/rB770b496729d21f3e700cadd1bc3543a57ca01169

Cleanup: GPencil replace cfra_eval by cfra or CFRA

Don't need these variable because this code was part of using depsgraph frame 
number, but now using scene framenumber only add noise to the code.

===

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_convert.c
M   source/blender/editors/gpencil/gpencil_data.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_interpolate.c
M   source/blender/editors/gpencil/gpencil_merge.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/gpencil/gpencil_primitive.c
M   source/blender/editors/gpencil/gpencil_select.c

===

diff --git a/source/blender/editors/gpencil/gpencil_add_monkey.c 
b/source/blender/editors/gpencil/gpencil_add_monkey.c
index 38d0c0cd07d..c4528518009 100644
--- a/source/blender/editors/gpencil/gpencil_add_monkey.c
+++ b/source/blender/editors/gpencil/gpencil_add_monkey.c
@@ -830,7 +830,6 @@ void ED_gpencil_create_monkey(bContext *C, Object *ob, 
float mat[4][4])
 {
   Main *bmain = CTX_data_main(C);
   Scene *scene = CTX_data_scene(C);
-  int cfra_eval = CFRA;
   bGPdata *gpd = (bGPdata *)ob->data;
   bGPDstroke *gps;
 
@@ -852,8 +851,8 @@ void ED_gpencil_create_monkey(bContext *C, Object *ob, 
float mat[4][4])
 
   /* frames */
   /* NOTE: No need to check for existing, as this will take care of it for us 
*/
-  bGPDframe *frameFills = BKE_gpencil_frame_addnew(Fills, cfra_eval);
-  bGPDframe *frameLines = BKE_gpencil_frame_addnew(Lines, cfra_eval);
+  bGPDframe *frameFills = BKE_gpencil_frame_addnew(Fills, CFRA);
+  bGPDframe *frameLines = BKE_gpencil_frame_addnew(Lines, CFRA);
 
   /* generate strokes */
   gps = BKE_gpencil_add_stroke(frameFills, color_Skin, 270, 75);
diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c 
b/source/blender/editors/gpencil/gpencil_add_stroke.c
index b7cb1f344ec..80e239c9ae5 100644
--- a/source/blender/editors/gpencil/gpencil_add_stroke.c
+++ b/source/blender/editors/gpencil/gpencil_add_stroke.c
@@ -216,7 +216,6 @@ void ED_gpencil_create_stroke(bContext *C, Object *ob, 
float mat[4][4])
 {
   Main *bmain = CTX_data_main(C);
   Scene *scene = CTX_data_scene(C);
-  int cfra_eval = CFRA;
   bGPdata *gpd = (bGPdata *)ob->data;
   bGPDstroke *gps;
 
@@ -236,8 +235,8 @@ void ED_gpencil_create_stroke(bContext *C, Object *ob, 
float mat[4][4])
   bGPDlayer *lines = BKE_gpencil_layer_addnew(gpd, "Lines", true);
 
   /* frames */
-  bGPDframe *frame_color = BKE_gpencil_frame_addnew(colors, cfra_eval);
-  bGPDframe *frame_lines = BKE_gpencil_frame_addnew(lines, cfra_eval);
+  bGPDframe *frame_color = BKE_gpencil_frame_addnew(colors, CFRA);
+  bGPDframe *frame_lines = BKE_gpencil_frame_addnew(lines, CFRA);
   UNUSED_VARS(frame_color);
 
   /* generate stroke */
diff --git a/source/blender/editors/gpencil/gpencil_brush.c 
b/source/blender/editors/gpencil/gpencil_brush.c
index 35d33183c38..c183091dbb1 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1052,9 +1052,8 @@ static void gp_brush_clone_add(bContext *C, 
tGP_BrushEditData *gso)
   Object *ob = CTX_data_active_object(C);
   bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
   Scene *scene = CTX_data_scene(C);
-  int cfra_eval = CFRA;
 
-  bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, 
GP_GETFRAME_ADD_NEW);
+  bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, GP_GETFRAME_ADD_NEW);
   bGPDstroke *gps;
 
   float delta[3];
@@ -1399,10 +1398,10 @@ static void 
gpsculpt_brush_init_stroke(tGP_BrushEditData *gso)
 
   bGPDlayer *gpl;
   Scene *scene = gso->scene;
-  int cfra_eval = CFRA;
+  int cfra = CFRA;
 
   /* only try to add a new frame if this is the first stroke, or the frame has 
changed */
-  if ((gpd == NULL) || (cfra_eval == gso->cfra)) {
+  if ((gpd == NULL) || (cfra == gso->cfra)) {
 return;
   }
 
@@ -1418,14 +1417,14 @@ static void 
gpsculpt_brush_init_stroke(tGP_BrushEditData *gso)
*   spent too much time editing the wrong frame.
*/
   // XXX: should this be allowed when framelock is enabled?
-  if (gpf->framenum != cfra_eval) {
-BKE_gpencil_frame_addcopy(gpl, cfra_eval);
+  if (gpf->framenum != cfra) {
+BKE_gpencil_frame_addcopy(gpl, cfra);
   }
 }
   }
 
   /* save off new current frame, so that next update works fine */
-  gso->cfra = cfra_ev

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

2019-07-29 Thread Antonioya
Commit: 7356e922554f8401af0c841c8085538e77edfcd7
Author: Antonioya
Date:   Mon Jul 29 16:46:03 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB7356e922554f8401af0c841c8085538e77edfcd7

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] [ec5d643d3eb] greasepencil-object: GPencil: Update stroke loop after merge using macro

2019-07-29 Thread Antonioya
Commit: ec5d643d3eb3962ccf102e2b2fe0da186cf60346
Author: Antonioya
Date:   Mon Jul 29 16:24:25 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBec5d643d3eb3962ccf102e2b2fe0da186cf60346

GPencil: Update stroke loop after merge using macro

During merge, the loop back to old style using for's and now it's using the 
macro.

===

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 0cd51c7fd7c..fa4065975e0 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3133,7 +3133,6 @@ static int gp_strokes_reproject_exec(bContext *C, 
wmOperator *op)
   RegionView3D *rv3d = ar->regiondata;
   SnapObjectContext *sctx = NULL;
   int oldframe = (int)DEG_get_ctime(depsgraph);
-  const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
 
   GP_SpaceConversion gsc = {NULL};
   eGP_ReprojectModes mode = RNA_enum_get(op->ptr, "type");
@@ -3149,149 +3148,118 @@ static int gp_strokes_reproject_exec(bContext *C, 
wmOperator *op)
   bmain, scene, depsgraph, 0, ar, CTX_wm_view3d(C));
 
   /* Go through each editable + selected stroke, adjusting each of its points 
one by one... */
-  CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
-bGPDframe *init_gpf = gpl->actframe;
-if (is_multiedit) {
-  init_gpf = gpl->frames.first;
-}
-float diff_mat[4][4];
-float inverse_diff_mat[4][4];
-/* calculate difference matrix object */
-ED_gpencil_parent_location(depsgraph, ob, gpd, gpl, diff_mat);
-/* Compute inverse matrix for unapplying parenting once instead of doing 
per-point */
-invert_m4_m4(inverse_diff_mat, diff_mat);
+  GP_EDITABLE_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
+if (gps->flag & GP_STROKE_SELECT) {
+  /* update frame to get the new location of objects */
+  if ((mode == GP_REPROJECT_SURFACE) && (cfra_prv != gpf_->framenum)) {
+cfra_prv = gpf_->framenum;
+CFRA = gpf_->framenum;
+BKE_scene_graph_update_for_newframe(depsgraph, bmain);
+  }
 
-for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
-  if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && 
(is_multiedit))) {
-if (gpf == NULL) {
-  continue;
-}
+  bGPDspoint *pt;
+  int i;
+  /* Adjust each point */
+  for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+float xy[2];
 
-for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
-  /* skip strokes that are invalid for current view */
-  if (ED_gpencil_stroke_can_use(C, gps) == false) {
-continue;
-  }
-  if ((gps->flag & GP_STROKE_SELECT) == 0) {
-continue;
+/* 3D to Screenspace */
+/* Note: We can't use gp_point_to_xy() here because that uses ints for 
the
+ * screenspace coordinates, resulting in lost precision, which in turn 
causes
+ * stairstepping artifacts in the final points.
+ */
+bGPDspoint pt2;
+gp_point_to_parent_space(pt, gpstroke_iter.diff_mat, &pt2);
+gp_point_to_xy_fl(&gsc, gps, &pt2, &xy[0], &xy[1]);
+
+/* Project stroke in one axis */
+if (ELEM(mode,
+ GP_REPROJECT_FRONT,
+ GP_REPROJECT_SIDE,
+ GP_REPROJECT_TOP,
+ GP_REPROJECT_CURSOR)) {
+  if (mode != GP_REPROJECT_CURSOR) {
+ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, 
origin);
   }
-
-  /* update frame to get the new location of objects */
-  if ((mode == GP_REPROJECT_SURFACE) && (cfra_prv != gpf->framenum)) {
-cfra_prv = gpf->framenum;
-CFRA = gpf->framenum;
-BKE_scene_graph_update_for_newframe(depsgraph, bmain);
+  else {
+copy_v3_v3(origin, scene->cursor.location);
   }
 
-  bGPDspoint *pt;
-  int i;
-  /* Adjust each point */
-  for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
-float xy[2];
-
-/* 3D to Screenspace */
-/* Note: We can't use gp_point_to_xy() here because that uses ints 
for the
- * screenspace coordinates, resulting in lost precision, which in 
turn causes
- * stairstepping artifacts in the final points.
- */
-bGPDspoint pt2;
-gp_point_to_parent_space(pt, diff_mat, &pt2);
-gp_point_to_xy_fl(&gsc, gps, &pt2, &xy[0], &xy[1]);
-
-/

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

2019-07-29 Thread Antonioya
Commit: c8e9cf3dadc3e1b52839d6cb54ba725a8b3153af
Author: Antonioya
Date:   Mon Jul 29 16:13:14 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc8e9cf3dadc3e1b52839d6cb54ba725a8b3153af

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] [29259a318de] greasepencil-object: GPencil: Merge by distance (WIP)

2019-07-29 Thread Antonioya
Commit: 29259a318de3a73a4df52a736b559244cd4dfa47
Author: Antonioya
Date:   Mon Jul 29 13:56:48 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB29259a318de3a73a4df52a736b559244cd4dfa47

GPencil: Merge by distance (WIP)

Initial implementation of merge by distance
GPencil: Fix duplicated CMake entry


GPencil: Add missing code for operator in previous commit

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/blenkernel/intern/gpencil_modifier.c
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_intern.h
M   source/blender/editors/gpencil/gpencil_merge.c
M   source/blender/editors/gpencil/gpencil_ops.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/gpencil_modifiers/CMakeLists.txt

===

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 112fb4361d6..3a623604934 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -616,6 +616,7 @@ class GPENCIL_MT_cleanup(Menu):
 
 def draw(self, _context):
 layout = self.layout
+layout.operator("gpencil.stroke_merge_by_distance", text="Merge by 
Distance")
 layout.operator("gpencil.frame_clean_loose", text="Loose Points")
 layout.separator()
 
diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index c145d8acd15..2a33c486288 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -277,6 +277,10 @@ void BKE_gpencil_simplify_stroke(struct bGPDstroke *gps, 
float factor);
 void BKE_gpencil_simplify_fixed(struct bGPDstroke *gps);
 void BKE_gpencil_subdivide(struct bGPDstroke *gps, int level, int flag);
 bool BKE_gpencil_trim_stroke(struct bGPDstroke *gps);
+void BKE_gpencil_merge_distance_stroke(struct bGPDframe *gpf,
+   struct bGPDstroke *gps,
+   const float threshold,
+   const bool use_unselected);
 
 void BKE_gpencil_stroke_2d_flat(const struct bGPDspoint *points,
 int totpoints,
@@ -309,6 +313,14 @@ bool BKE_gpencil_smooth_stroke_thickness(struct bGPDstroke 
*gps, int point_index
 bool BKE_gpencil_smooth_stroke_uv(struct bGPDstroke *gps, int point_index, 
float influence);
 bool BKE_gpencil_close_stroke(struct bGPDstroke *gps);
 
+void BKE_gpencil_delete_tagged_points(struct bGPDframe *gpf,
+  struct bGPDstroke *gps,
+  struct bGPDstroke *next_stroke,
+  int tag_flags,
+  bool select,
+  int limit);
+void BKE_gpencil_dissolve_points(struct bGPDframe *gpf, struct bGPDstroke 
*gps, const short tag);
+
 void BKE_gpencil_get_range_selected(struct bGPDlayer *gpl, int *r_initframe, 
int *r_endframe);
 float BKE_gpencil_multiframe_falloff_calc(
 struct bGPDframe *gpf, int actnum, int f_init, int f_end, struct 
CurveMapping *cur_falloff);
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 0d935f47805..78c1caf5385 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2647,6 +2647,340 @@ bool BKE_gpencil_close_stroke(bGPDstroke *gps)
   return true;
 }
 
+/* Temp data for storing information about an "island" of points
+ * that should be kept when splitting up a stroke. Used in:
+ * BKE_gpencil_delete_tagged_points()
+ */
+typedef struct tGPDeleteIsland {
+  int start_idx;
+  int end_idx;
+} tGPDeleteIsland;
+
+static void gp_stroke_join_islands(bGPDframe *gpf, bGPDstroke *gps_first, 
bGPDstroke *gps_last)
+{
+  bGPDspoint *pt = NULL;
+  bGPDspoint *pt_final = NULL;
+  const int totpoints = gps_first->totpoints + gps_last->totpoints;
+
+  /* create new stroke */
+  bGPDstroke *join_stroke = MEM_dupallocN(gps_first);
+
+  join_stroke->points = MEM_callocN(sizeof(bGPDspoint) * totpoints, __func__);
+  join_stroke->totpoints = totpoints;
+  join_stroke->flag &= ~GP_STROKE_CYCLIC;
+
+  /* copy points (last before) */
+  int e1 = 0;
+  int e2 = 0;
+  float delta = 0.0f;
+
+  for (int i = 0; i < totpoints; i++) {
+pt_final = &join_stroke->points[i];
+if (i < gps_last->totpoints) {
+  pt = &gps_last-&

[Bf-blender-cvs] [b83a1b62c7d] master: Fix T66233: Grease Pencil Swirl Effect not working at origin

2019-07-29 Thread Antonioya
Commit: b83a1b62c7db4e11c96b65cb68b2a88eeab7fcbc
Author: Antonioya
Date:   Tue Jul 23 22:29:42 2019 +0200
Branches: master
https://developer.blender.org/rBb83a1b62c7db4e11c96b65cb68b2a88eeab7fcbc

Fix T66233: Grease Pencil Swirl Effect not working at origin

If the control object is in the origin the radius is wrongly calculated because 
the result is 0.

Now, this value is clamped to avoid this situation

===

M   
source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
index b226d4f93bc..01d4fe40195 100644
--- a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
@@ -42,7 +42,11 @@ void main()
   vec2 tc = uv - center;
 
   float dist = length(tc);
-  float pxradius = (ProjectionMatrix[3][3] == 0.0) ? (radius / (loc.z * 
defaultpixsize)) :
+  float locpixsize = abs((loc.z * defaultpixsize));
+  if (locpixsize == 0) {
+locpixsize = 1;
+  }
+  float pxradius = (ProjectionMatrix[3][3] == 0.0) ? (radius / locpixsize) :
  (radius / defaultpixsize);
   pxradius = max(pxradius, 1);

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


[Bf-blender-cvs] [13f57237f24] master: Fix T67331: Annotations: Rename old grease pencil panels

2019-07-29 Thread Antonioya
Commit: 13f57237f24a4537bef9c080418c7837f6496a6c
Author: Antonioya
Date:   Mon Jul 29 12:39:19 2019 +0200
Branches: master
https://developer.blender.org/rB13f57237f24a4537bef9c080418c7837f6496a6c

Fix T67331: Annotations: Rename old grease pencil panels

These panels were using the old names, but now they are not grease pencil, but 
annotations.

Also removed old Tools panel. This must be replaced with new Toolbar

===

M   release/scripts/startup/bl_ui/space_clip.py
M   release/scripts/startup/bl_ui/space_image.py
M   release/scripts/startup/bl_ui/space_node.py
M   release/scripts/startup/bl_ui/space_sequencer.py

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index a8a29f03b73..084ba4b36d8 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1204,7 +1204,7 @@ class CLIP_PT_tools_scenesetup(Panel):
 
 
 # Grease Pencil properties
-class CLIP_PT_grease_pencil(AnnotationDataPanel, CLIP_PT_clip_view_panel, 
Panel):
+class CLIP_PT_annotation(AnnotationDataPanel, CLIP_PT_clip_view_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'
 bl_region_type = 'UI'
 bl_category = "Annotation"
@@ -1762,7 +1762,7 @@ classes = (
 CLIP_PT_tools_mask_transforms,
 CLIP_PT_tools_mask_tools,
 CLIP_PT_tools_scenesetup,
-CLIP_PT_grease_pencil,
+CLIP_PT_annotation,
 CLIP_PT_tools_grease_pencil_draw,
 CLIP_MT_view,
 CLIP_MT_clip,
diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index 8f6e9d71790..bd003063e16 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -1684,7 +1684,7 @@ class IMAGE_PT_uv_cursor(Panel):
 
 
 # Grease Pencil properties
-class IMAGE_PT_grease_pencil(AnnotationDataPanel, Panel):
+class IMAGE_PT_annotation(AnnotationDataPanel, Panel):
 bl_space_type = 'IMAGE_EDITOR'
 bl_region_type = 'UI'
 bl_category = "View"
@@ -1750,7 +1750,7 @@ classes = (
 IMAGE_PT_sample_line,
 IMAGE_PT_scope_sample,
 IMAGE_PT_uv_cursor,
-IMAGE_PT_grease_pencil,
+IMAGE_PT_annotation,
 )
 
 
diff --git a/release/scripts/startup/bl_ui/space_node.py 
b/release/scripts/startup/bl_ui/space_node.py
index 88b35fa4035..939102bc11b 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -25,7 +25,6 @@ from bpy.app.translations import contexts as i18n_contexts
 from bl_ui.utils import PresetPanel
 from bl_ui.properties_grease_pencil_common import (
 AnnotationDataPanel,
-GreasePencilToolsPanel,
 )
 from bl_ui.space_toolsystem_common import (
 ToolActivePanelHelper,
@@ -656,7 +655,7 @@ class NODE_UL_interface_sockets(bpy.types.UIList):
 
 
 # Grease Pencil properties
-class NODE_PT_grease_pencil(AnnotationDataPanel, Panel):
+class NODE_PT_annotation(AnnotationDataPanel, Panel):
 bl_space_type = 'NODE_EDITOR'
 bl_region_type = 'UI'
 bl_category = "View"
@@ -670,17 +669,6 @@ class NODE_PT_grease_pencil(AnnotationDataPanel, Panel):
 return snode is not None and snode.node_tree is not None
 
 
-class NODE_PT_grease_pencil_tools(GreasePencilToolsPanel, Panel):
-bl_space_type = 'NODE_EDITOR'
-bl_region_type = 'UI'
-bl_category = "View"
-bl_options = {'DEFAULT_CLOSED'}
-
-# NOTE: this is just a wrapper around the generic GP tools panel
-# It contains access to some essential tools usually found only in
-# toolbar, but which may not necessarily be open
-
-
 def node_draw_tree_view(_layout, _context):
 pass
 
@@ -717,8 +705,7 @@ classes = (
 NODE_PT_active_tool,
 NODE_PT_backdrop,
 NODE_PT_quality,
-NODE_PT_grease_pencil,
-NODE_PT_grease_pencil_tools,
+NODE_PT_annotation,
 NODE_UL_interface_sockets,
 
 node_panel(EEVEE_MATERIAL_PT_settings),
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index ff4657f2e7f..ff71c7a825a 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -29,7 +29,6 @@ from bpy.app.translations import (
 )
 from bl_ui.properties_grease_pencil_common import (
 AnnotationDataPanel,
-GreasePencilToolsPanel,
 )
 from rna_prop_ui import PropertyPanel
 
@@ -1992,7 +1991,7 @@ class SEQUENCER_PT_modifiers(SequencerButtonsPanel, 
Panel):
 col.prop(mod, "gamma")
 
 
-class SEQUENCER_PT_grease_pencil(AnnotationDataPanel, 
SequencerButtonsPanel_Output, Panel):
+class SEQUENCER_PT_annotation(AnnotationDataPanel, 
SequencerButtonsPanel_Output, Panel):
 bl

[Bf-blender-cvs] [3ee246f614c] master: Fix T67338 : GPencil Disable material properties when material is locked

2019-07-29 Thread Antonioya
Commit: 3ee246f614caaa8fa88b0c7813730fc35b7718e6
Author: Antonioya
Date:   Sat Jul 20 22:57:47 2019 +0200
Branches: master
https://developer.blender.org/rB3ee246f614caaa8fa88b0c7813730fc35b7718e6

Fix T67338 : GPencil Disable material properties when material is locked

When the material was locked, the properties were deactivated but not disabled.

Differential Revision: http://developer.blender.org/D5309

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 29a89c7b4a3..8db0f8182ab 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -120,6 +120,7 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 ma = context.material
 if ma is not None and ma.grease_pencil is not None:
 gpcolor = ma.grease_pencil
+self.layout.enabled = not gpcolor.lock
 self.layout.prop(gpcolor, "show_stroke", text="")
 
 def draw(self, context):
@@ -131,7 +132,7 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 gpcolor = ma.grease_pencil
 
 col = layout.column()
-col.active = not gpcolor.lock
+col.enabled = not gpcolor.lock
 
 col.prop(gpcolor, "mode")
 
@@ -169,6 +170,7 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, 
Panel):
 def draw_header(self, context):
 ma = context.material
 gpcolor = ma.grease_pencil
+self.layout.enabled = not gpcolor.lock
 self.layout.prop(gpcolor, "show_fill", text="")
 
 def draw(self, context):
@@ -180,7 +182,7 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, 
Panel):
 
 # color settings
 col = layout.column()
-col.active = not gpcolor.lock
+col.enabled = not gpcolor.lock
 col.prop(gpcolor, "fill_style", text="Style")
 
 if gpcolor.fill_style == 'GRADIENT':

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


[Bf-blender-cvs] [60d71ffbe99] master: Fix T67811: GPencil Weights shift when use dissolve in Edit Mode

2019-07-29 Thread Antonioya
Commit: 60d71ffbe99395bbfeed1eb0504b8f52eb84a827
Author: Antonioya
Date:   Sun Jul 28 10:57:26 2019 +0200
Branches: master
https://developer.blender.org/rB60d71ffbe99395bbfeed1eb0504b8f52eb84a827

Fix T67811: GPencil Weights shift when use dissolve in Edit Mode

The problem was the index was not right calculated for unselected points.

===

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 779ce27ddf1..f9534b74c04 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -1940,9 +1940,11 @@ static int gp_dissolve_selected_points(bContext *C, 
eGP_DissolveMode mode)
 *ndvert = *dvert;
 ndvert->dw = MEM_dupallocN(dvert->dw);
 ndvert++;
-dvert++;
   }
 }
+if (gps->dvert != NULL) {
+  dvert++;
+}
   }
   break;
 case GP_DISSOLVE_BETWEEN:
@@ -1970,9 +1972,11 @@ static int gp_dissolve_selected_points(bContext *C, 
eGP_DissolveMode mode)
 *ndvert = *dvert;
 ndvert->dw = MEM_dupallocN(dvert->dw);
 ndvert++;
-dvert++;
   }
 }
+if (gps->dvert != NULL) {
+  dvert++;
+}
   }
   /* copy last segment */
   (gps->dvert != NULL) ? dvert = gps->dvert + last : NULL;
@@ -2001,9 +2005,11 @@ static int gp_dissolve_selected_points(bContext *C, 
eGP_DissolveMode mode)
 *ndvert = *dvert;
 ndvert->dw = MEM_dupallocN(dvert->dw);
 ndvert++;
-dvert++;
   }
 }
+if (gps->dvert != NULL) {
+  dvert++;
+}
   }
   break;
   }

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


[Bf-blender-cvs] [801962e2b67] master: Fix T67813: Remove mask from Weight Paint

2019-07-29 Thread Antonioya
Commit: 801962e2b6779714917f1b1cf2cd6c161bd53855
Author: Antonioya
Date:   Sat Jul 27 20:44:24 2019 +0200
Branches: master
https://developer.blender.org/rB801962e2b6779714917f1b1cf2cd6c161bd53855

Fix T67813: Remove mask from Weight Paint

Weight Painting was using mask if "Selection Mask" in Sculpt Mode is turned on.

This can be quite confusing because the option to turn it off is not available 
in Weight Painting and the selection is also not visible.

Now the mask is not checked in weight paint mode.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_brush.c 
b/source/blender/editors/gpencil/gpencil_brush.c
index 2df5f6a0cec..35d33183c38 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1477,7 +1477,7 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData 
*gso,
 
   /* Skip if neither one is selected
* (and we are only allowed to edit/consider selected points) */
-  if (gso->settings->flag & GP_SCULPT_SETT_FLAG_SELECT_MASK) {
+  if ((gso->settings->flag & GP_SCULPT_SETT_FLAG_SELECT_MASK) && 
(!gso->is_weight_mode)) {
 if (!(pt1->flag & GP_SPOINT_SELECT) && !(pt2->flag & 
GP_SPOINT_SELECT)) {
   include_last = false;
   continue;

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


[Bf-blender-cvs] [d438e71729d] master: GPencil: Use uniform_int_copy instead to pass reference

2019-07-29 Thread Antonioya
Commit: d438e71729d1e95edf58ee6b8e99def22adf813e
Author: Antonioya
Date:   Sat Jul 27 17:37:31 2019 +0200
Branches: master
https://developer.blender.org/rBd438e71729d1e95edf58ee6b8e99def22adf813e

GPencil: Use uniform_int_copy instead to pass reference

The constant variable was passed as reference to constant variable, but it's 
better use the new function to copy values.

This could be the problem with T67772

===

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

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c 
b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
index 306444303e2..0f4043ce278 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -463,12 +463,11 @@ static void gpencil_fx_shadow(ShaderFxData *fx,
 DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->runtime.loc, 1);
   }
 
-  const int nowave = -1;
   if (fxd->flag & FX_SHADOW_USE_WAVE) {
 DRW_shgroup_uniform_int(fx_shgrp, "orientation", &fxd->orientation, 1);
   }
   else {
-DRW_shgroup_uniform_int(fx_shgrp, "orientation", &nowave, 1);
+DRW_shgroup_uniform_int_copy(fx_shgrp, "orientation", -1);
   }
   DRW_shgroup_uniform_float(fx_shgrp, "amplitude", &fxd->amplitude, 1);
   DRW_shgroup_uniform_float(fx_shgrp, "period", &fxd->period, 1);

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


[Bf-blender-cvs] [fd730fce0c2] master: GPencil: Add inverse diff matrix to iterator macro

2019-07-29 Thread Antonioya
Commit: fd730fce0c202342cbc39f4c196c93a2f24ecc01
Author: Antonioya
Date:   Thu Jul 25 12:10:47 2019 +0200
Branches: master
https://developer.blender.org/rBfd730fce0c202342cbc39f4c196c93a2f24ecc01

GPencil: Add inverse diff matrix to iterator macro

GPencil: Cleanup inverse mat code

This calculation is done in the macro, so don't need do it again in loop.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 2e51fc355a4..779ce27ddf1 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3401,12 +3401,6 @@ static int gp_strokes_reproject_exec(bContext *C, 
wmOperator *op)
 if (gps->flag & GP_STROKE_SELECT) {
   bGPDspoint *pt;
   int i;
-  float inverse_diff_mat[4][4];
-
-  /* Compute inverse matrix for unapplying parenting once instead of doing 
per-point */
-  /* TODO: add this bit to the iteration macro? */
-  invert_m4_m4(inverse_diff_mat, gpstroke_iter.diff_mat);
-
   /* Adjust each point */
   for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
 float xy[2];
@@ -3493,7 +3487,7 @@ static int gp_strokes_reproject_exec(bContext *C, 
wmOperator *op)
 
 /* Unapply parent corrections */
 if (!ELEM(mode, GP_REPROJECT_FRONT, GP_REPROJECT_SIDE, 
GP_REPROJECT_TOP)) {
-  mul_m4_v3(inverse_diff_mat, &pt->x);
+  mul_m4_v3(gpstroke_iter.inverse_diff_mat, &pt->x);
 }
   }
 }
diff --git a/source/blender/editors/gpencil/gpencil_intern.h 
b/source/blender/editors/gpencil/gpencil_intern.h
index df9cb2e9a01..6a3439a4898 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -583,6 +583,7 @@ typedef enum ACTCONT_TYPES {
 
 struct GP_EditableStrokes_Iter {
   float diff_mat[4][4];
+  float inverse_diff_mat[4][4];
 };
 
 /**
@@ -607,6 +608,7 @@ struct GP_EditableStrokes_Iter {
   for (bGPDframe *gpf_ = init_gpf_; gpf_; gpf_ = gpf_->next) { \
 if ((gpf_ == gpl->actframe) || ((gpf_->flag & GP_FRAME_SELECT) && 
is_multiedit_)) { \
   ED_gpencil_parent_location(depsgraph_, obact_, gpd_, gpl, 
gpstroke_iter.diff_mat); \
+  invert_m4_m4(gpstroke_iter.inverse_diff_mat, 
gpstroke_iter.diff_mat); \
   /* loop over strokes */ \
   for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gps->next) { \
 /* skip strokes that are invalid for current view */ \

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


[Bf-blender-cvs] [ff748228631] greasepencil-object: GPencil: Cleanup tarnsform rotation function

2019-07-28 Thread Antonioya
Commit: ff7482286319e7b462b98dc26909b47d9d661ec6
Author: Antonioya
Date:   Sun Jul 28 17:29:47 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBff7482286319e7b462b98dc26909b47d9d661ec6

GPencil: Cleanup tarnsform rotation function

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_brush.c 
b/source/blender/editors/gpencil/gpencil_brush.c
index 55f08de3731..dd8b6e331a0 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1476,6 +1476,8 @@ static void gpsculpt_brush_init_stroke(tGP_BrushEditData 
*gso)
 }
 
 /* Apply --- */
+
+/* Get angle of the segment relative to the original segment before any 
transformation */
 static float gpsculpt_transform_rot_get(GP_SpaceConversion *gsc,
 bGPDstroke *gps_derived,
 bGPDspoint *pt_derived,
@@ -1510,17 +1512,18 @@ static float 
gpsculpt_transform_rot_get(GP_SpaceConversion *gsc,
 }
   }
 
-  /* create vectors of the stroke segment */
-  float v1a_2d[2], v2a_2d[2], v1b_2d[2], v2b_2d[2];
-  gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_derived->x, v1a_2d);
-  gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_orig->x, v2a_2d);
-  gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_derived_prev->x, v1b_2d);
-  gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_orig_prev->x, v2b_2d);
+  /* create 2D vectors of the stroke segments */
+  float v_orig_a[2], v_orig_b[2], v_derived_a[2], v_derived_b[2];
+
+  gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_orig->x, v_orig_a);
+  gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_orig_prev->x, v_orig_b);
+  sub_v2_v2(v_orig_a, v_orig_b);
 
-  sub_v2_v2(v1a_2d, v1b_2d);
-  sub_v2_v2(v2a_2d, v2b_2d);
+  gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_derived->x, v_derived_a);
+  gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_derived_prev->x, v_derived_b);
+  sub_v2_v2(v_derived_a, v_derived_b);
 
-  return angle_v2v2(v1a_2d, v2a_2d);
+  return angle_v2v2(v_orig_a, v_derived_a);
 }
 
 /* Apply brush operation to points in this stroke */

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


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

2019-07-28 Thread Antonioya
Commit: 0473e4c50a520014206d5e290e7f4ecd9159d3fe
Author: Antonioya
Date:   Sun Jul 28 17:06:37 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0473e4c50a520014206d5e290e7f4ecd9159d3fe

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] [a8037f40381] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-07-27 Thread Antonioya
Commit: a8037f403815671b900c5625e919e4d1291a795f
Author: Antonioya
Date:   Sat Jul 27 11:44:21 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBa8037f403815671b900c5625e919e4d1291a795f

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] [3eecb2806ba] greasepencil-object: GPencil: Add Edit support to Length modifier

2019-07-26 Thread Antonioya
Commit: 3eecb2806ba471815e96a41c27dd477ad4105f3e
Author: Antonioya
Date:   Fri Jul 26 17:28:09 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB3eecb2806ba471815e96a41c27dd477ad4105f3e

GPencil: Add Edit support to Length modifier

Now the modifier is visible in edit mode.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
index ec06ead9a10..29c98eced26 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
@@ -134,7 +134,7 @@ GpencilModifierTypeInfo modifierType_Gpencil_Length = {
 /* structName */ "LengthGpencilModifierData",
 /* structSize */ sizeof(LengthGpencilModifierData),
 /* type */ eGpencilModifierTypeType_Gpencil,
-/* flags */ 0,
+/* flags */ eGpencilModifierTypeFlag_SupportsEditmode,
 
 /* copyData */ copyData,

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


[Bf-blender-cvs] [9a7f7757f81] greasepencil-object: GPencil: Fix missing modifiers initialization

2019-07-26 Thread Antonioya
Commit: 9a7f7757f81a2181d9551474a0bc5e0975be0441
Author: Antonioya
Date:   Fri Jul 26 17:12:00 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB9a7f7757f81a2181d9551474a0bc5e0975be0441

GPencil: Fix missing modifiers initialization

This was missing when the modifier was ported from NPR branch

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
index 5b5290dc0ff..c0ecd3bf0eb 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
@@ -71,6 +71,8 @@ void gpencil_modifier_type_init(GpencilModifierTypeInfo 
*types[])
   INIT_GP_TYPE(Offset);
   INIT_GP_TYPE(Armature);
   INIT_GP_TYPE(Time);
+  INIT_GP_TYPE(Length);
+  INIT_GP_TYPE(Multiply);
 #undef INIT_GP_TYPE
 }

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


[Bf-blender-cvs] [0bbf47ce428] greasepencil-object: GPencil: Cleanup more compiler warnings

2019-07-26 Thread Antonioya
Commit: 0bbf47ce428634cb6b82babd3b6ddb38068b8760
Author: Antonioya
Date:   Fri Jul 26 16:48:22 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0bbf47ce428634cb6b82babd3b6ddb38068b8760

GPencil: Cleanup more compiler warnings

===

M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index 3f5f5ba1f53..3933dda8fb3 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -212,10 +212,6 @@ struct bGPDframe *BKE_gpencil_layer_getframe(struct 
bGPDlayer *gpl,
 struct bGPDframe *BKE_gpencil_layer_find_frame(struct bGPDlayer *gpl, int 
cframe);
 bool BKE_gpencil_layer_delframe(struct bGPDlayer *gpl, struct bGPDframe *gpf);
 
-struct bGPDlayer *BKE_gpencil_layer_get_index(struct bGPdata *gpd,
-  int index,
-  int first_if_not_found);
-
 struct bGPDlayer *BKE_gpencil_layer_getactive(struct bGPdata *gpd);
 void BKE_gpencil_layer_setactive(struct bGPdata *gpd, struct bGPDlayer 
*active);
 void BKE_gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl);
@@ -293,13 +289,15 @@ float BKE_gpencil_stroke_length(const struct bGPDstroke 
*gps, bool use_3d);
 
 void BKE_gpencil_transform(struct bGPdata *gpd, float mat[4][4]);
 
-bool BKE_gpencil_sample_stroke(struct bGPDstroke *gps, float dist);
-bool BKE_gpencil_stretch_stroke(struct bGPDstroke *gps, float dist);
-bool BKE_gpencil_trim_stroke_points(struct bGPDstroke *gps, int index_from, 
int index_to);
-bool BKE_gpencil_shrink_stroke(struct bGPDstroke *gps, float dist);
+bool BKE_gpencil_sample_stroke(struct bGPDstroke *gps, const float dist);
+bool BKE_gpencil_stretch_stroke(struct bGPDstroke *gps, const float dist);
+bool BKE_gpencil_trim_stroke_points(struct bGPDstroke *gps,
+const int index_from,
+const int index_to);
+bool BKE_gpencil_shrink_stroke(struct bGPDstroke *gps, const float dist);
 bool BKE_gpencil_split_stroke(struct bGPDframe *gpf,
   struct bGPDstroke *gps,
-  int before_index,
+  const int before_index,
   struct bGPDstroke **remaining_gps);
 bool BKE_gpencil_smooth_stroke(struct bGPDstroke *gps, int i, float inf);
 bool BKE_gpencil_smooth_stroke_strength(struct bGPDstroke *gps, int 
point_index, float influence);
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 729e9d59a44..286493b74f0 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -988,31 +988,6 @@ bGPDlayer *BKE_gpencil_layer_getactive(bGPdata *gpd)
   return NULL;
 }
 
-bGPDlayer *BKE_gpencil_layer_get_index(bGPdata *gpd, int index, int 
first_if_not_found)
-{
-  bGPDlayer *gpl;
-  int i = 0;
-
-  /* error checking */
-  if (ELEM(NULL, gpd, gpd->layers.first)) {
-return NULL;
-  }
-
-  /* loop over layers until found (assume only one active) */
-  for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-if (i == index) {
-  return gpl;
-}
-i++;
-  }
-
-  /* no such layer */
-  if (first_if_not_found) {
-return gpd->layers.first;
-  }
-  return NULL;
-}
-
 /* set the active gp-layer */
 void BKE_gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active)
 {
@@ -1436,9 +1411,9 @@ void BKE_gpencil_dvert_ensure(bGPDstroke *gps)
 /* ** */
 
 static void stroke_defvert_create_nr_list(MDeformVert *dv_list,
-   int count,
-   ListBase *result,
-   int *totweight)
+  int count,
+  ListBase *result,
+  int *totweight)
 {
   LinkData *ld;
   MDeformVert *dv;
@@ -1585,8 +1560,11 @@ static int stroke_march_next_point(const bGPDstroke *gps,
   }
 }
 
-static int stroke_march_next_point_no_interp(
-const bGPDstroke *gps, const int index_next_pt, const float *current, 
const float dist, float *result)
+static int stroke_march_next_point_no_interp(const bGPDstroke *gps,
+ const int index_next_pt,
+ const float *current,
+ const float dist,
+ float *result)
 {
   float remaining_till_next = 0.0f;
   float remaining_march = dist;
@@ -1632,10 +1610,7 @@ static int stroke_march_next_point_no_interp(
 
 static int stroke

[Bf-blender-cvs] [af7d3bb2dba] greasepencil-object: GPencil: Remove compiler warnings

2019-07-26 Thread Antonioya
Commit: af7d3bb2dba9689e330d498d257adc9180293e56
Author: Antonioya
Date:   Fri Jul 26 16:43:18 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBaf7d3bb2dba9689e330d498d257adc9180293e56

GPencil: Remove compiler warnings

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
index df390c5516f..ec06ead9a10 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
@@ -66,11 +66,6 @@
 #include "MOD_gpencil_util.h"
 #include "MOD_gpencil_modifiertypes.h"
 
-static void initData(GpencilModifierData *md)
-{
-  LengthGpencilModifierData *gpmd = (LengthGpencilModifierData *)md;
-}
-
 static void copyData(const GpencilModifierData *md, GpencilModifierData 
*target)
 {
   BKE_gpencil_modifier_copyData_generic(md, target);
@@ -123,26 +118,17 @@ static void bakeModifier(Main *UNUSED(bmain),
 /*  */
 
 /* Generic "generateStrokes" callback */
-static void deformStroke(
-GpencilModifierData *md, Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, 
bGPDstroke *gps)
+static void deformStroke(GpencilModifierData *md,
+ Depsgraph *depsgraph,
+ Object *ob,
+ bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
+ bGPDstroke *gps)
 {
   LengthGpencilModifierData *lmd = (LengthGpencilModifierData *)md;
   applyLength(gps, lmd->length, lmd->percentage);
 }
 
-static void updateDepsgraph(GpencilModifierData *md, const 
ModifierUpdateDepsgraphContext *ctx)
-{
-  LengthGpencilModifierData *lmd = (LengthGpencilModifierData *)md;
-}
-
-static void foreachObjectLink(GpencilModifierData *md,
-  Object *ob,
-  ObjectWalkFunc walk,
-  void *userData)
-{
-  LengthGpencilModifierData *mmd = (LengthGpencilModifierData *)md;
-}
-
 GpencilModifierTypeInfo modifierType_Gpencil_Length = {
 /* name */ "Length",
 /* structName */ "LengthGpencilModifierData",
@@ -157,12 +143,12 @@ GpencilModifierTypeInfo modifierType_Gpencil_Length = {
 /* bakeModifier */ bakeModifier,
 /* remapTime */ NULL,
 
-/* initData */ initData,
+/* initData */ NULL,
 /* freeData */ NULL,
 /* isDisabled */ NULL,
-/* updateDepsgraph */ updateDepsgraph,
+/* updateDepsgraph */ NULL,
 /* dependsOnTime */ NULL,
-/* foreachObjectLink */ foreachObjectLink,
+/* foreachObjectLink */ NULL,
 /* foreachIDLink */ NULL,
 /* foreachTexLink */ NULL,
 /* getDuplicationFactor */ NULL,
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
index ab505cb0118..941d454272c 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
@@ -146,7 +146,6 @@ static void duplicateStroke(bGPDframe *gpf,
   bGPDstroke *new_gps;
   float stroke_normal[3];
   float minter[3];
-  float target1[3], target2[3];
   bGPDspoint *pt;
   float offset_factor;
   float thickness_factor;
@@ -297,19 +296,6 @@ static void generateStrokes(
   }
 }
 
-static void updateDepsgraph(GpencilModifierData *md, const 
ModifierUpdateDepsgraphContext *ctx)
-{
-  MultiplyGpencilModifierData *mmd = (MultiplyGpencilModifierData *)md;
-}
-
-static void foreachObjectLink(GpencilModifierData *md,
-  Object *ob,
-  ObjectWalkFunc walk,
-  void *userData)
-{
-  MultiplyGpencilModifierData *mmd = (MultiplyGpencilModifierData *)md;
-}
-
 GpencilModifierTypeInfo modifierType_Gpencil_Multiply = {
 /* name */ "Multiple Strokes",
 /* structName */ "MultiplyGpencilModifierData",
@@ -327,9 +313,9 @@ GpencilModifierTypeInfo modifierType_Gpencil_Multiply = {
 /* initData */ initData,
 /* freeData */ NULL,
 /* isDisabled */ NULL,
-/* updateDepsgraph */ updateDepsgraph,
+/* updateDepsgraph */ NULL,
 /* dependsOnTime */ NULL,
-/* foreachObjectLink */ foreachObjectLink,
+/* foreachObjectLink */ NULL,
 /* foreachIDLink */ NULL,
 /* foreachTexLink */ NULL,
 /* getDuplicationFactor */ NULL,

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


[Bf-blender-cvs] [80a6acd8149] soc-2019-npr: Cleanup: Remove . at the end of text

2019-07-25 Thread Antonioya
Commit: 80a6acd814961cbe82ab16f9f753b7f77fc240ca
Author: Antonioya
Date:   Thu Jul 25 14:03:02 2019 +0200
Branches: soc-2019-npr
https://developer.blender.org/rB80a6acd814961cbe82ab16f9f753b7f77fc240ca

Cleanup: Remove . at the end of text

===

M   source/blender/editors/lanpr/lanpr_ops.c

===

diff --git a/source/blender/editors/lanpr/lanpr_ops.c 
b/source/blender/editors/lanpr/lanpr_ops.c
index 6deb0463e69..5082f8b82a9 100644
--- a/source/blender/editors/lanpr/lanpr_ops.c
+++ b/source/blender/editors/lanpr/lanpr_ops.c
@@ -399,7 +399,7 @@ void SCENE_OT_lanpr_move_line_layer(struct wmOperatorType 
*ot)
 void SCENE_OT_lanpr_enable_all_line_types(struct wmOperatorType *ot)
 {
   ot->name = "Enable All Line Types";
-  ot->description = "Enable All Line Types In This Line Layer.";
+  ot->description = "Enable All Line Types In This Line Layer";
   ot->idname = "SCENE_OT_lanpr_enable_all_line_types";
 
   ot->exec = lanpr_enable_all_line_types_exec;
@@ -2598,8 +2598,8 @@ static LANPR_RenderLine 
*lanpr_triangle_generate_intersection_line_only(
   return Result;
 }
 static void 
lanpr_triangle_calculate_intersections_in_bounding_area(LANPR_RenderBuffer *rb,
- 
LANPR_RenderTriangle *rt,
- 
LANPR_BoundingArea *ba)
+
LANPR_RenderTriangle *rt,
+
LANPR_BoundingArea *ba)
 {
   tnsVector3d n, c = {0};
   tnsVector3d tl, tr;
@@ -3323,8 +3323,8 @@ static void 
lanpr_link_triangle_with_bounding_area(LANPR_RenderBuffer *rb,
real *LRUB,
int Recursive);
 static void 
lanpr_triangle_calculate_intersections_in_bounding_area(LANPR_RenderBuffer *rb,
- 
LANPR_RenderTriangle *rt,
- 
LANPR_BoundingArea *ba);
+
LANPR_RenderTriangle *rt,
+
LANPR_BoundingArea *ba);
 
 static void lanpr_split_bounding_area(LANPR_RenderBuffer *rb, 
LANPR_BoundingArea *Root)
 {
@@ -4611,7 +4611,7 @@ void SCENE_OT_lanpr_bake_gp_strokes(struct wmOperatorType 
*ot)
 void OBJECT_OT_lanpr_update_gp_target(struct wmOperatorType *ot)
 {
   ot->name = "Update Strokes";
-  ot->description = "Update LANPR strokes for selected GPencil object.";
+  ot->description = "Update LANPR strokes for selected GPencil object";
   ot->idname = "OBJECT_OT_lanpr_update_gp_target";
 
   ot->poll = lanpr_active_is_gpencil_object;

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


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

2019-07-25 Thread Antonioya
Commit: c6fbc1db41ff337f1428327844cb30a8f7251722
Author: Antonioya
Date:   Thu Jul 25 12:41:59 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc6fbc1db41ff337f1428327844cb30a8f7251722

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] [b3f0501e311] blender-v2.80-release: GPencil: Fix showing wrong material in brush panel with pinning

2019-07-24 Thread Antonioya
Commit: b3f0501e311b0cb744c36f5f1d1de41c784ea499
Author: Antonioya
Date:   Thu Jul 18 19:52:52 2019 +0200
Branches: blender-v2.80-release
https://developer.blender.org/rBb3f0501e311b0cb744c36f5f1d1de41c784ea499

GPencil: Fix showing wrong material in brush panel with pinning

The options of the material are from object material not pinned material.

If the brush is pinned, the material must be the brush material and not the 
object material.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index e7be73391b7..730bad796db 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1781,7 +1781,7 @@ class 
VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel):
 col.prop(gp_settings, "angle_factor", text="Factor", slider=True)
 
 ob = context.object
-if ob:
+if ob and brush.gpencil_settings.use_material_pin is False:
 ma = ob.active_material
 elif brush.gpencil_settings.material:
 ma = brush.gpencil_settings.material

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


[Bf-blender-cvs] [21f17cc959f] blender-v2.80-release: GPencil: Fix wrong material when apply Opacity, Hue or Tint modifier

2019-07-24 Thread Antonioya
Commit: 21f17cc959f1d552122e01933cb9bfeeacc43bfd
Author: Antonioya
Date:   Thu Jul 18 18:07:56 2019 +0200
Branches: blender-v2.80-release
https://developer.blender.org/rB21f17cc959f1d552122e01933cb9bfeeacc43bfd

GPencil: Fix wrong material when apply Opacity, Hue or Tint modifier

When apply the modifier a new material is created, but it was assigned wrongly. 
The problem was the index was base 0 already, so subtract 1, got a wrong value.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
index bdab4c083e9..5b5290dc0ff 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
@@ -192,9 +192,8 @@ void gpencil_apply_modifier_material(
   BLI_ghash_insert(gh_color, mat->id.name, newmat);
   DEG_id_tag_update(&newmat->id, ID_RECALC_COPY_ON_WRITE);
 }
-/* Reaasign color index. */
-int idx = BKE_gpencil_object_material_get_index(ob, newmat);
-gps->mat_nr = idx - 1;
+/* Reassign color index. */
+gps->mat_nr = BKE_gpencil_object_material_get_index(ob, newmat);
   }
   else {
 /* reuse existing color (but update only first time) */

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


[Bf-blender-cvs] [09a774c3c00] greasepencil-object: GPencil: Remove duplicate self overlap option

2019-07-23 Thread Antonioya
Commit: 09a774c3c009d5af84bf05c171de27e71c8c668f
Author: Antonioya
Date:   Tue Jul 23 13:32:57 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB09a774c3c009d5af84bf05c171de27e71c8c668f

GPencil: Remove duplicate self overlap option

The option was duplicated for textured strokes.

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 2898213d760..79be1bbdfe7 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -144,7 +144,6 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 col.template_ID(gpcolor, "stroke_image", open="image.open")
 if gpcolor.mode == 'LINE':
 col.prop(gpcolor, "pixel_size", text="UV Factor")
-col.prop(gpcolor, "use_overlap_strokes")
 
 col.prop(gpcolor, "use_stroke_pattern", text="Use As Stencil 
Mask")
 if gpcolor.use_stroke_pattern is False:

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


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

2019-07-23 Thread Antonioya
Commit: 8441fa98f7811a11f8e92d82f3639a8ccfb2acb7
Author: Antonioya
Date:   Tue Jul 23 09:48:00 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB8441fa98f7811a11f8e92d82f3639a8ccfb2acb7

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] [2204bfcf9e1] temp-gpencil-drw-engine: Merge branch 'master' into temp-gpencil-drw-engine

2019-07-23 Thread Antonioya
Commit: 2204bfcf9e1c3a38e60830bd97775dd72158f4d6
Author: Antonioya
Date:   Tue Jul 23 09:46:29 2019 +0200
Branches: temp-gpencil-drw-engine
https://developer.blender.org/rB2204bfcf9e1c3a38e60830bd97775dd72158f4d6

Merge branch 'master' into temp-gpencil-drw-engine

===



===



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


[Bf-blender-cvs] [0abf6d349c2] greasepencil-object: Cleanup: Rename poll function

2019-07-22 Thread Antonioya
Commit: 0abf6d349c2f6f006c63b38ab52ff9c0c652d705
Author: Antonioya
Date:   Mon Jul 22 16:54:42 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0abf6d349c2f6f006c63b38ab52ff9c0c652d705

Cleanup: Rename poll function

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_svg.c 
b/source/blender/editors/gpencil/gpencil_svg.c
index 46a0b5805bd..f2e9813e55b 100644
--- a/source/blender/editors/gpencil/gpencil_svg.c
+++ b/source/blender/editors/gpencil/gpencil_svg.c
@@ -65,7 +65,7 @@ static int gpencil_export_svg_exec(bContext *C, wmOperator 
*op)
   return OPERATOR_FINISHED;
 }
 
-static bool gpencil_found(bContext *C)
+static bool gpencil_export_svg_poll(bContext *C)
 {
   Object *o = CTX_data_active_object(C);
 
@@ -87,7 +87,7 @@ void GPENCIL_OT_export_svg(wmOperatorType *ot)
 
   /* callbacks */
   ot->exec = gpencil_export_svg_exec;
-  ot->poll = gpencil_found;
+  ot->poll = gpencil_export_svg_poll;
 
   /* flag */
   ot->flag = OPTYPE_USE_EVAL_DATA;

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


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

2019-07-21 Thread Antonioya
Commit: 6fff1f2b6e88e76e34f58dbe0df14af7a0583b1e
Author: Antonioya
Date:   Sun Jul 21 22:34:05 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB6fff1f2b6e88e76e34f58dbe0df14af7a0583b1e

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] [475aca05ab8] greasepencil-object: GPencil: Fix errors after merge and compiler warnings

2019-07-19 Thread Antonioya
Commit: 475aca05ab8f7b79c3af95f00f0b95b7e9890ce8
Author: Antonioya
Date:   Fri Jul 19 15:51:09 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB475aca05ab8f7b79c3af95f00f0b95b7e9890ce8

GPencil: Fix errors after merge and compiler warnings

The BKE_text_write function parameter list changed.

Added some UNUSED_VARS to functions in development.

===

M   source/blender/editors/gpencil/gpencil_svg.c
M   source/blender/editors/io/io_svg.c

===

diff --git a/source/blender/editors/gpencil/gpencil_svg.c 
b/source/blender/editors/gpencil/gpencil_svg.c
index 494f38df299..46a0b5805bd 100644
--- a/source/blender/editors/gpencil/gpencil_svg.c
+++ b/source/blender/editors/gpencil/gpencil_svg.c
@@ -53,13 +53,13 @@
 
 static int gpencil_export_svg_exec(bContext *C, wmOperator *op)
 {
-  Object* gpobj = CTX_data_active_object(C);
+  Object *gpobj = CTX_data_active_object(C);
   bGPdata *gpd = gpobj->data;
-  bGPDlayer* gpl;
+  bGPDlayer *gpl;
 
-  for(gpl = gpd->layers.first; gpl; gpl = gpl->next){
-Text *ta = BKE_text_add(CTX_data_main(C),"exported_svg");
-ED_svg_data_from_gpencil(gpd,ta,gpl,CTX_data_scene(C)->r.cfra);
+  for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+Text *ta = BKE_text_add(CTX_data_main(C), "exported_svg");
+ED_svg_data_from_gpencil(gpd, ta, gpl, CTX_data_scene(C)->r.cfra);
   }
 
   return OPERATOR_FINISHED;
@@ -67,9 +67,9 @@ static int gpencil_export_svg_exec(bContext *C, wmOperator 
*op)
 
 static bool gpencil_found(bContext *C)
 {
-  Object* o = CTX_data_active_object(C);
-  
-  if(o && o->type == OB_GPENCIL){
+  Object *o = CTX_data_active_object(C);
+
+  if (o && o->type == OB_GPENCIL) {
 return true;
   }
   return false;
@@ -78,6 +78,7 @@ static bool gpencil_found(bContext *C)
 void GPENCIL_OT_export_svg(wmOperatorType *ot)
 {
   PropertyRNA *prop;
+  UNUSED_VARS(prop);
 
   /* identifiers */
   ot->name = "Export to SVG";
@@ -94,4 +95,3 @@ void GPENCIL_OT_export_svg(wmOperatorType *ot)
   /* properties */
   /* Should have: facing, layer, visibility, file split... */
 }
-
diff --git a/source/blender/editors/io/io_svg.c 
b/source/blender/editors/io/io_svg.c
index 9774fa792e1..61afd3d696c 100644
--- a/source/blender/editors/io/io_svg.c
+++ b/source/blender/editors/io/io_svg.c
@@ -40,127 +40,156 @@
 
 #include "MEM_guardedalloc.h"
 
-static void write_svg_head(Text* ta){
-BKE_text_write(ta, NULL, "\n");
-BKE_text_write(ta, NULL, "http://www.w3.org/2000/svg\"; version=\"1.1\">\n");
+static void write_svg_head(Text *ta)
+{
+  BKE_text_write(ta, "\n");
+  BKE_text_write(ta,
+ "http://www.w3.org/2000/svg\"; version=\"1.1\">\n");
 }
 
-static void write_svg_end(Text* ta){
-BKE_text_write(ta, NULL, "");
+static void write_svg_end(Text *ta)
+{
+  BKE_text_write(ta, "");
 }
 
-typedef int (svg_get_path_callback)(void* iterator, float* fill_rgba, float* 
stroke_rgba, float* stroke_width);
-typedef int (svg_get_node_callback)(void* iterator, float *x, float *y);
-
-#define FAC_255_COLOR3(color) 
((int)(255*color[0])),((int)(255*color[1])),((int)(255*color[2]))
-
-static void write_paths_from_callback(void* iterator, Text* ta, 
svg_get_path_callback get_path, svg_get_node_callback get_node){
-int status;
-float fill_color[3], stroke_color[3], stroke_width;
-int fill_color_i[3], stroke_color_i[3];
-float x,y;
-char buf[128];
-int first_in;
-while(get_path(iterator,fill_color,stroke_color,&stroke_width)){
-
-/* beginning of a path item */
-BKE_text_write(ta, NULL, "\n",
-FAC_255_COLOR3(fill_color), FAC_255_COLOR3(stroke_color), 
stroke_width/1000.0f);
-BKE_text_write(ta, NULL, buf);
+typedef int(svg_get_path_callback)(void *iterator,
+   float *fill_rgba,
+   float *stroke_rgba,
+   float *stroke_width);
+typedef int(svg_get_node_callback)(void *iterator, float *x, float *y);
+
+#define FAC_255_COLOR3(color) \
+  ((int)(255 * color[0])), ((int)(255 * color[1])), ((int)(255 * color[2]))
+
+static void write_paths_from_callback(void *iterator,
+  Text *ta,
+  svg_get_path_callback get_path,
+  svg_get_node_callback get_node)
+{
+  int status;
+  float fill_color[3], stroke_color[3], stroke_width;
+  int fill_color_i[3], stroke_color_i[3];
+  UNUSED_VARS(status, stroke_color_i, fill_color_i);
+
+  float x, y;
+  char buf[128];
+  int first_in;
+  while (get_path(iterator, fill_color, stroke_color, &stroke_width)) {
+
+/* beginni

[Bf-blender-cvs] [39341441f13] greasepencil-object: GPencil: Add frame parameter to deformStroke callback

2019-07-19 Thread Antonioya
Commit: 39341441f13ecb4d8115ed687835de6a9bd2a25c
Author: Antonioya
Date:   Fri Jul 19 10:49:17 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB39341441f13ecb4d8115ed687835de6a9bd2a25c

GPencil: Add frame parameter to deformStroke callback

This parameter can be necessary for some new modifiers in development. The 
parmeter was already there but it was removed, now we back again the parameter.

===

M   source/blender/blenkernel/BKE_gpencil_modifier.h
M   source/blender/blenkernel/intern/gpencil_modifier.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
M   source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
M   source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c

===

diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h 
b/source/blender/blenkernel/BKE_gpencil_modifier.h
index 1528feedbee..373efadad55 100644
--- a/source/blender/blenkernel/BKE_gpencil_modifier.h
+++ b/source/blender/blenkernel/BKE_gpencil_modifier.h
@@ -140,6 +140,7 @@ typedef struct GpencilModifierTypeInfo {
struct Depsgraph *depsgraph,
struct Object *ob,
struct bGPDlayer *gpl,
+   struct bGPDframe *gpf,
struct bGPDstroke *gps);
 
   /**
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c 
b/source/blender/blenkernel/intern/gpencil_modifier.c
index 1ed40a79acf..c7815d2ed14 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -344,7 +344,7 @@ bool BKE_gpencil_has_time_modifiers(Object *ob)
 void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph,
   Object *ob,
   bGPDlayer *gpl,
-  bGPDframe *UNUSED(gpf),
+  bGPDframe *gpf,
   bGPDstroke *gps,
   bool is_render)
 {
@@ -361,7 +361,7 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph,
   }
 
   if (mti && mti->deformStroke) {
-mti->deformStroke(md, depsgraph, ob, gpl, gps);
+mti->deformStroke(md, depsgraph, ob, gpl, gpf, gps);
 /* subdivide allways requires update */
 if (md->type == eGpencilModifierType_Subdiv) {
   gps->flag |= GP_STROKE_RECALC_GEOMETRY;
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
index 1ef1068ee52..4297cbb545c 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
@@ -107,6 +107,7 @@ static void deformStroke(GpencilModifierData *md,
  Depsgraph *UNUSED(depsgraph),
  Object *ob,
  bGPDlayer *UNUSED(gpl),
+ bGPDframe *UNUSED(gpf),
  bGPDstroke *gps)
 {
   ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
@@ -140,7 +141,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, 
GpencilModifierData
 
   /* compute armature effects on this frame */
   for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
-deformStroke(md_eval, depsgraph, object_eval, gpl, gps);
+deformStroke(md_eval, depsgraph, object_eval, gpl, gpf, gps);
   }
 }
   }
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
index d54ec75862b..13329e4176d 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
@@ -65,6 +65,7 @@ static void deformStroke(GpencilModifierData *md,
  Depsgraph *UNUSED(depsgraph),
  Object *ob,
  bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
  bGPDstroke *gps)
 {
 
@@ -128,7 +129,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, 
GpencilModifie

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

2019-07-19 Thread Antonioya
Commit: c4b57de36e6d266dc655aaff93c3ecc980957caa
Author: Antonioya
Date:   Fri Jul 19 15:29:45 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc4b57de36e6d266dc655aaff93c3ecc980957caa

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] [65aac86d5a3] master: GPencil: Fix wrong material when apply Opacity, Hue or Tint modifier

2019-07-19 Thread Antonioya
Commit: 65aac86d5a35b23eabf30379c7a44b04860c7b2f
Author: Antonioya
Date:   Thu Jul 18 18:07:56 2019 +0200
Branches: master
https://developer.blender.org/rB65aac86d5a35b23eabf30379c7a44b04860c7b2f

GPencil: Fix wrong material when apply Opacity, Hue or Tint modifier

When apply the modifier a new material is created, but it was assigned wrongly. 
The problem was the index was base 0 already, so subtract 1, got a wrong value.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
index bdab4c083e9..5b5290dc0ff 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
@@ -192,9 +192,8 @@ void gpencil_apply_modifier_material(
   BLI_ghash_insert(gh_color, mat->id.name, newmat);
   DEG_id_tag_update(&newmat->id, ID_RECALC_COPY_ON_WRITE);
 }
-/* Reaasign color index. */
-int idx = BKE_gpencil_object_material_get_index(ob, newmat);
-gps->mat_nr = idx - 1;
+/* Reassign color index. */
+gps->mat_nr = BKE_gpencil_object_material_get_index(ob, newmat);
   }
   else {
 /* reuse existing color (but update only first time) */

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


[Bf-blender-cvs] [23ea4b56ada] master: GPencil: Fix showing wrong material in brush panel with pinning

2019-07-19 Thread Antonioya
Commit: 23ea4b56adab66dbc0aa8c095c49c8f2e6a5d92b
Author: Antonioya
Date:   Thu Jul 18 19:52:52 2019 +0200
Branches: master
https://developer.blender.org/rB23ea4b56adab66dbc0aa8c095c49c8f2e6a5d92b

GPencil: Fix showing wrong material in brush panel with pinning

The options of the material are from object material not pinned material.

If the brush is pinned, the material must be the brush material and not the 
object material.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index e7be73391b7..730bad796db 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1781,7 +1781,7 @@ class 
VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel):
 col.prop(gp_settings, "angle_factor", text="Factor", slider=True)
 
 ob = context.object
-if ob:
+if ob and brush.gpencil_settings.use_material_pin is False:
 ma = ob.active_material
 elif brush.gpencil_settings.material:
 ma = brush.gpencil_settings.material

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


[Bf-blender-cvs] [3912e4439a4] soc-2019-npr: Cleanup: Replace if else if, by Switch

2019-07-19 Thread Antonioya
Commit: 3912e4439a48afab13e8e0aaf48a39a32dd33c6e
Author: Antonioya
Date:   Fri Jul 19 10:18:51 2019 +0200
Branches: soc-2019-npr
https://developer.blender.org/rB3912e4439a48afab13e8e0aaf48a39a32dd33c6e

Cleanup: Replace if else if, by Switch

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
index 615850498a9..d67c7c09192 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
@@ -74,17 +74,25 @@ static void deformStroke(GpencilModifierData *md,
 return;
   }
 
-  if (mmd->mode == GP_SIMPLIFY_FIXED) {
-for (int i = 0; i < mmd->step; i++) {
-  BKE_gpencil_simplify_fixed(gps);
+  /* Select simplification mode. */
+  switch (mmd->mode) {
+case GP_SIMPLIFY_FIXED: {
+  for (int i = 0; i < mmd->step; i++) {
+BKE_gpencil_simplify_fixed(gps);
+  }
+  break;
 }
-  }
-  else if (mmd->mode == GP_SIMPLIFY_ADAPTIVE) {
-/* simplify stroke using Ramer-Douglas-Peucker algorithm */
-BKE_gpencil_simplify_stroke(gps, mmd->factor);
-  }
-  else if (mmd->mode == GP_SIMPLIFY_SAMPLE) {
-BKE_gpencil_sample_stroke(gps, mmd->length);
+case GP_SIMPLIFY_ADAPTIVE: {
+  /* simplify stroke using Ramer-Douglas-Peucker algorithm */
+  BKE_gpencil_simplify_stroke(gps, mmd->factor);
+  break;
+}
+case GP_SIMPLIFY_SAMPLE: {
+  BKE_gpencil_sample_stroke(gps, mmd->length);
+  break;
+}
+default:
+  break;
   }
 }

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


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

2019-07-18 Thread Antonioya
Commit: 69c8d314cfbfadc7d5048ef79a1253941569113e
Author: Antonioya
Date:   Thu Jul 18 22:24:14 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB69c8d314cfbfadc7d5048ef79a1253941569113e

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] [69218e4d9a1] greasepencil-object: GPencil: Remove old comments

2019-07-18 Thread Antonioya
Commit: 69218e4d9a1e274b8caf1bceef0f529d9c076d60
Author: Antonioya
Date:   Thu Jul 18 22:23:14 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB69218e4d9a1e274b8caf1bceef0f529d9c076d60

GPencil: Remove old comments

===

M   source/blender/blenkernel/intern/gpencil_modifier.c

===

diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c 
b/source/blender/blenkernel/intern/gpencil_modifier.c
index ddb51936121..1ed40a79acf 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -447,14 +447,6 @@ void BKE_gpencil_eval_geometry(Depsgraph *depsgraph, 
bGPdata *gpd)
 gpl->actframe = BKE_gpencil_layer_getframe(gpl, ctime, 
GP_GETFRAME_USE_PREV);
   }
 
-  /* TODO: Move "derived_gpf" logic here from DRW_gpencil_populate_datablock()?
-   * This would be better than inventing our own logic for this stuff...
-   */
-
-  /* TODO: Move the following code to "BKE_gpencil_eval_done()" (marked as an 
exit node)
-   * later when there's more happening here. For now, let's just keep this in 
here to avoid
-   * needing to have one more node slowing down evaluation...
-   */
   if (DEG_is_active(depsgraph)) {
 bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&gpd->id);

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


[Bf-blender-cvs] [b05570736cc] greasepencil-object: GPencil: Testing idea for changing weights when opacity factor is greater than 1.0

2019-07-18 Thread Antonioya
Commit: b05570736cc1e4770c796851fa95d3e9543747ea
Author: Antonioya
Date:   Thu Jul 18 20:50:03 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb05570736cc1e4770c796851fa95d3e9543747ea

GPencil: Testing idea for changing weights when opacity factor is greater than 
1.0

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index 6c1206f851d..9928ebb150f 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -146,6 +146,11 @@ static void deformStroke(GpencilModifierData *md,
   else {
 CLAMP(weight, 0.0f, 1.0f);
 weight = 1.0f - weight;
+/* High factor values, change weight too. */
+if ((mmd->factor > 1.0f) && (weight < 1.0f)) {
+  weight += mmd->factor - 1.0f;
+  CLAMP(weight, 0.0f, 1.0f);
+}
 pt->strength += (mmd->factor * weight) - 1.0f;
   }
   CLAMP(pt->strength, 0.0f, 1.0f);

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


[Bf-blender-cvs] [3f4e87e9874] greasepencil-object: GPencil: Clamp weight in Opacity modifier for Material mode

2019-07-18 Thread Antonioya
Commit: 3f4e87e98740c77fa08219a695b2236944db75a3
Author: Antonioya
Date:   Thu Jul 18 20:25:29 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB3f4e87e98740c77fa08219a695b2236944db75a3

GPencil: Clamp weight in Opacity modifier for Material mode

If the value is not clamped, the opacity gets wild values.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index a67567be3be..6c1206f851d 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -111,7 +111,7 @@ static void deformStroke(GpencilModifierData *md,
 MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
 
 /* verify vertex group */
-const float weight = get_modifier_point_weight(
+float weight = get_modifier_point_weight(
 dvert, (mmd->flag & GP_OPACITY_INVERT_VGROUP) != 0, def_nr);
 if (weight < 0.0f) {
   continue;
@@ -120,6 +120,8 @@ static void deformStroke(GpencilModifierData *md,
   pt->strength += mmd->factor - 1.0f;
 }
 else {
+  CLAMP(weight, 0.0f, 1.0f);
+  weight = 1.0f - weight;
   pt->strength += (mmd->factor * weight) - 1.0f;
 }
 CLAMP(pt->strength, 0.0f, 1.0f);

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


[Bf-blender-cvs] [092f9ead204] greasepencil-object: GPencil: Apply opacity only to vertex with weights

2019-07-18 Thread Antonioya
Commit: 092f9ead204286ab6a804ea3ff25e625681280fb
Author: Antonioya
Date:   Thu Jul 18 20:22:54 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB092f9ead204286ab6a804ea3ff25e625681280fb

GPencil: Apply opacity only to vertex with weights

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index f11079b34df..a67567be3be 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -113,7 +113,10 @@ static void deformStroke(GpencilModifierData *md,
 /* verify vertex group */
 const float weight = get_modifier_point_weight(
 dvert, (mmd->flag & GP_OPACITY_INVERT_VGROUP) != 0, def_nr);
-if ((def_nr < 0) || (weight < 0.0f)) {
+if (weight < 0.0f) {
+  continue;
+}
+if (def_nr < 0) {
   pt->strength += mmd->factor - 1.0f;
 }
 else {
@@ -132,7 +135,10 @@ static void deformStroke(GpencilModifierData *md,
   /* verify vertex group */
   float weight = get_modifier_point_weight(
   dvert, (mmd->flag & GP_OPACITY_INVERT_VGROUP) != 0, def_nr);
-  if ((def_nr < 0) || (weight < 0.0f)) {
+  if (weight < 0.0f) {
+continue;
+  }
+  if (def_nr < 0) {
 pt->strength += mmd->factor - 1.0f;
   }
   else {

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


[Bf-blender-cvs] [8fc1be0c2b6] greasepencil-object: GPencil: Fix unreported error in Brush option panel

2019-07-18 Thread Antonioya
Commit: 8fc1be0c2b6f8e93e49b6072ecb09f8d886726d4
Author: Antonioya
Date:   Thu Jul 18 19:52:52 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB8fc1be0c2b6f8e93e49b6072ecb09f8d886726d4

GPencil: Fix unreported error in Brush option panel

The options of the material are from object material not pinned material.

If the brush is pinned, the material must be the brush material and not the 
object material.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index d8f214028ea..49bc27e4ff1 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1781,7 +1781,7 @@ class 
VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel):
 col.prop(gp_settings, "angle_factor", text="Factor", slider=True)
 
 ob = context.object
-if ob:
+if ob and brush.gpencil_settings.use_material_pin is False:
 ma = ob.active_material
 elif brush.gpencil_settings.material:
 ma = brush.gpencil_settings.material

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


[Bf-blender-cvs] [2cef81ac4fe] greasepencil-object: GPencil: Modify opacity modifier to use weights inverted

2019-07-18 Thread Antonioya
Commit: 2cef81ac4fe43fc3622c80688c96fc6e89708848
Author: Antonioya
Date:   Thu Jul 18 19:38:45 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2cef81ac4fe43fc3622c80688c96fc6e89708848

GPencil: Modify opacity modifier to use weights inverted

It's more logic consider the no weight as opaque and the weight to transparent.

Also fixed some small issues.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index c2b3ae5f15b..f11079b34df 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -113,11 +113,11 @@ static void deformStroke(GpencilModifierData *md,
 /* verify vertex group */
 const float weight = get_modifier_point_weight(
 dvert, (mmd->flag & GP_OPACITY_INVERT_VGROUP) != 0, def_nr);
-if (weight < 0.0f) {
+if ((def_nr < 0) || (weight < 0.0f)) {
   pt->strength += mmd->factor - 1.0f;
 }
 else {
-  pt->strength += (mmd->factor - 1.0f) * weight;
+  pt->strength += (mmd->factor * weight) - 1.0f;
 }
 CLAMP(pt->strength, 0.0f, 1.0f);
   }
@@ -130,13 +130,15 @@ static void deformStroke(GpencilModifierData *md,
   MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
 
   /* verify vertex group */
-  const float weight = get_modifier_point_weight(
+  float weight = get_modifier_point_weight(
   dvert, (mmd->flag & GP_OPACITY_INVERT_VGROUP) != 0, def_nr);
-  if (weight < 0.0f) {
+  if ((def_nr < 0) || (weight < 0.0f)) {
 pt->strength += mmd->factor - 1.0f;
   }
   else {
-pt->strength += (mmd->factor - 1.0f) * weight;
+CLAMP(weight, 0.0f, 1.0f);
+weight = 1.0f - weight;
+pt->strength += (mmd->factor * weight) - 1.0f;
   }
   CLAMP(pt->strength, 0.0f, 1.0f);
 }

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


[Bf-blender-cvs] [71eda41ae90] greasepencil-object: GPencil: Fix error when apply material in Opacity/Hue and Tint

2019-07-18 Thread Antonioya
Commit: 71eda41ae902822f73b3ba4a44f2efd05d9174d5
Author: Antonioya
Date:   Thu Jul 18 18:07:56 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB71eda41ae902822f73b3ba4a44f2efd05d9174d5

GPencil: Fix error when apply material in Opacity/Hue and Tint

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
index bdab4c083e9..5b5290dc0ff 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
@@ -192,9 +192,8 @@ void gpencil_apply_modifier_material(
   BLI_ghash_insert(gh_color, mat->id.name, newmat);
   DEG_id_tag_update(&newmat->id, ID_RECALC_COPY_ON_WRITE);
 }
-/* Reaasign color index. */
-int idx = BKE_gpencil_object_material_get_index(ob, newmat);
-gps->mat_nr = idx - 1;
+/* Reassign color index. */
+gps->mat_nr = BKE_gpencil_object_material_get_index(ob, newmat);
   }
   else {
 /* reuse existing color (but update only first time) */

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


[Bf-blender-cvs] [8bfa7e1c725] greasepencil-object: GPencil: Fix error with evaluated colors after changing evaluation to depsgraph

2019-07-18 Thread Antonioya
Commit: 8bfa7e1c725221a6d0c77a4649678d91f4dda059
Author: Antonioya
Date:   Thu Jul 18 18:03:14 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB8bfa7e1c725221a6d0c77a4649678d91f4dda059

GPencil: Fix error with evaluated colors after changing evaluation to depsgraph

The temporary colors were not copied when the derived frame was created.

The color must be copied in evaluation, not in draw manager because this 
replace any modifier change.

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c 
b/source/blender/blenkernel/intern/gpencil_modifier.c
index 31a6c19824f..ddb51936121 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -43,6 +43,7 @@
 #include "BKE_library_query.h"
 #include "BKE_gpencil.h"
 #include "BKE_lattice.h"
+#include "BKE_material.h"
 #include "BKE_gpencil_modifier.h"
 #include "BKE_object.h"
 
@@ -786,7 +787,7 @@ void BKE_gpencil_subdivide(bGPDstroke *gps, int level, int 
flag)
 }
 
 /* Copy frame but do not assign new memory */
-static void gpencil_copy_frame(bGPDframe *gpf, bGPDframe *derived_gpf)
+static void gpencil_copy_frame(Object *ob, bGPDframe *gpf, bGPDframe 
*derived_gpf)
 {
   derived_gpf->prev = gpf->prev;
   derived_gpf->next = gpf->next;
@@ -802,6 +803,11 @@ static void gpencil_copy_frame(bGPDframe *gpf, bGPDframe 
*derived_gpf)
 /* make copy of source stroke */
 bGPDstroke *gps_dst = BKE_gpencil_stroke_duplicate(gps_src);
 
+/* copy color to temp fields to apply temporal changes in the stroke */
+MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, 
gps_src->mat_nr + 1);
+copy_v4_v4(gps_dst->runtime.tmp_stroke_rgba, gp_style->stroke_rgba);
+copy_v4_v4(gps_dst->runtime.tmp_fill_rgba, gp_style->fill_rgba);
+
 /* Save original pointers for using in edit and select operators. */
 gps_dst->runtime.gps_orig = gps_src;
 for (int i = 0; i < gps_src->totpoints; i++) {
@@ -828,7 +834,7 @@ static void gpencil_ensure_derived_frame(
 BKE_gpencil_free_frame_runtime_data(*derived_gpf);
   }
   /* copy data (do not assign new memory)*/
-  gpencil_copy_frame(gpf, *derived_gpf);
+  gpencil_copy_frame(ob, gpf, *derived_gpf);
 }
 
 /* Calculate gpencil modifiers */
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 103ade8e85a..85ad1689c23 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1057,10 +1057,6 @@ static void gpencil_draw_strokes(GpencilBatchCache 
*cache,
 }
 
 if ((gpl->actframe->framenum == gpf->framenum) || (!is_multiedit) || 
(overlay_multiedit)) {
-  /* copy color to temp fields to apply temporal changes in the stroke */
-  copy_v4_v4(gps->runtime.tmp_stroke_rgba, gp_style->stroke_rgba);
-  copy_v4_v4(gps->runtime.tmp_fill_rgba, gp_style->fill_rgba);
-
   /* hide any blend layer */
   if ((!stl->storage->simplify_blend) || (gpl->blend_mode == 
eGplBlendMode_Regular)) {
 /* fill */

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


[Bf-blender-cvs] [35af94cc869] greasepencil-object: GPencil: New Strength mode for Opacity modifier

2019-07-18 Thread Antonioya
Commit: 35af94cc8697e8bdf5e8f082558e249e56450b9c
Author: Antonioya
Date:   Thu Jul 18 18:07:34 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB35af94cc8697e8bdf5e8f082558e249e56450b9c

GPencil: New Strength mode for Opacity modifier

Now it's possible to determine the opacity by Material (default) or by point 
Strength.

This new mode is required to get some effects using weight data.

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
M   source/blender/makesdna/DNA_gpencil_modifier_types.h
M   source/blender/makesrna/intern/rna_gpencil_modifier.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 0a4c166d0f7..9a4f35a8d73 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1950,9 +1950,13 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, 
Panel):
 col.label(text="Opacity:")
 col.prop(md, "factor")
 
+row = layout.row()
+row.prop(md, "opacity_mode", text="Mode")
+
 row = layout.row()
 row.prop(md, "create_materials")
-row.prop(md, "modify_color")
+if md.opacity_mode == 'COLOR':
+row.prop(md, "modify_color", text="Change")
 
 col = layout.column()
 col.separator()
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index 587cf527118..c2b3ae5f15b 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -85,26 +85,46 @@ static void deformStroke(GpencilModifierData *md,
 return;
   }
 
-  if (mmd->modify_color != GP_MODIFY_COLOR_FILL) {
-gps->runtime.tmp_stroke_rgba[3] *= mmd->factor;
-/* if factor is > 1, then force opacity */
-if (mmd->factor > 1.0f) {
-  gps->runtime.tmp_stroke_rgba[3] += mmd->factor - 1.0f;
+  if (mmd->opacity_mode == GP_OPACITY_MODE_MATERIAL) {
+if (mmd->modify_color != GP_MODIFY_COLOR_FILL) {
+  gps->runtime.tmp_stroke_rgba[3] *= mmd->factor;
+  /* if factor is > 1, then force opacity */
+  if (mmd->factor > 1.0f) {
+gps->runtime.tmp_stroke_rgba[3] += mmd->factor - 1.0f;
+  }
+  CLAMP(gps->runtime.tmp_stroke_rgba[3], 0.0f, 1.0f);
 }
-CLAMP(gps->runtime.tmp_stroke_rgba[3], 0.0f, 1.0f);
-  }
 
-  if (mmd->modify_color != GP_MODIFY_COLOR_STROKE) {
-gps->runtime.tmp_fill_rgba[3] *= mmd->factor;
-/* if factor is > 1, then force opacity */
-if (mmd->factor > 1.0f && gps->runtime.tmp_fill_rgba[3] > 1e-5) {
-  gps->runtime.tmp_fill_rgba[3] += mmd->factor - 1.0f;
+if (mmd->modify_color != GP_MODIFY_COLOR_STROKE) {
+  gps->runtime.tmp_fill_rgba[3] *= mmd->factor;
+  /* if factor is > 1, then force opacity */
+  if (mmd->factor > 1.0f && gps->runtime.tmp_fill_rgba[3] > 1e-5) {
+gps->runtime.tmp_fill_rgba[3] += mmd->factor - 1.0f;
+  }
+  CLAMP(gps->runtime.tmp_fill_rgba[3], 0.0f, 1.0f);
 }
-CLAMP(gps->runtime.tmp_fill_rgba[3], 0.0f, 1.0f);
-  }
 
-  /* if opacity > 1.0, affect the strength of the stroke */
-  if (mmd->factor > 1.0f) {
+/* if opacity > 1.0, affect the strength of the stroke */
+if (mmd->factor > 1.0f) {
+  for (int i = 0; i < gps->totpoints; i++) {
+bGPDspoint *pt = &gps->points[i];
+MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
+
+/* verify vertex group */
+const float weight = get_modifier_point_weight(
+dvert, (mmd->flag & GP_OPACITY_INVERT_VGROUP) != 0, def_nr);
+if (weight < 0.0f) {
+  pt->strength += mmd->factor - 1.0f;
+}
+else {
+  pt->strength += (mmd->factor - 1.0f) * weight;
+}
+CLAMP(pt->strength, 0.0f, 1.0f);
+  }
+}
+  }
+  /* Apply opacity by strength */
+  else {
 for (int i = 0; i < gps->totpoints; i++) {
   bGPDspoint *pt = &gps->points[i];
   MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h 
b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 8b756ff2937..ab6ab3526f5 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -199,6 +

[Bf-blender-cvs] [c6f6d6ef098] greasepencil-object: GPencil: Enable gradient factor for Line strokes

2019-07-18 Thread Antonioya
Commit: c6f6d6ef09855122eb69ab7d75e5afee7fd1e6d4
Author: Antonioya
Date:   Thu Jul 18 16:50:43 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc6f6d6ef09855122eb69ab7d75e5afee7fd1e6d4

GPencil: Enable gradient factor for Line strokes

Now it's possible to use the same gradient used in Dots and Boxes with Line 
strokes. This was disabled, pending to solve the overlap glitches, but as this 
was fixed with stencil, we can enable it again.

Also, the gradient formula has been changed to use the same of Dots.

===

M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index e7be73391b7..d8f214028ea 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1789,10 +1789,10 @@ class 
VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel):
 ma = None
 
 col.separator()
+col.prop(gp_settings, "gradient_factor", slider=True)
 subcol = col.column(align=True)
 if ma and ma.grease_pencil.mode == 'LINE':
 subcol.enabled = False
-subcol.prop(gp_settings, "gradient_factor", slider=True)
 subcol.prop(gp_settings, "gradient_shape")
 
 
diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
index 73baacb35d4..8281a696b35 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
@@ -76,14 +76,11 @@ void main()
   }
 
   /* gradient */
-  /* keep this disabled while the line glitch bug exists
-  if (gradient_f < 1.0) {
-float d = abs(mTexCoord.y - 0.5)  * (1.1 - gradient_f);
-float alpha = 1.0 - clamp((fragColor.a - (d * 2.0)), 0.03, 1.0);
-fragColor.a = smoothstep(fragColor.a, 0.0, alpha);
-
-  }
-  */
+   if (gradient_f < 1.0) {
+float dist = abs(mTexCoord.y - 0.5) * 2.0;
+float decay = dist * (1.0 - gradient_f) * fragColor.a;
+fragColor.a = clamp(fragColor.a - decay, 0.0, 1.0);
+   }
 
   if (fragColor.a < 0.0035) {
 discard;

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


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

2019-07-17 Thread Antonioya
Commit: 0507d41374e7b4ae35bf24f53798526785a2cb09
Author: Antonioya
Date:   Wed Jul 17 23:02:30 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0507d41374e7b4ae35bf24f53798526785a2cb09

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] [4759a0f0a6d] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-07-17 Thread Antonioya
Commit: 4759a0f0a6d133bc2dbb2a03c49f0f92e61932f3
Author: Antonioya
Date:   Wed Jul 17 22:10:17 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB4759a0f0a6d133bc2dbb2a03c49f0f92e61932f3

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] [7f1acb3c51a] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-07-17 Thread Antonioya
Commit: 7f1acb3c51a1176cfa878e7c74d0ec298dc04a6d
Author: Antonioya
Date:   Wed Jul 17 11:15:07 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB7f1acb3c51a1176cfa878e7c74d0ec298dc04a6d

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] [0d73e799668] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-07-16 Thread Antonioya
Commit: 0d73e799668b3bedd310522b134eeab87a005216
Author: Antonioya
Date:   Tue Jul 16 18:06:58 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0d73e799668b3bedd310522b134eeab87a005216

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] [8a7dedc9d29] master: Fix T66011: Transformed objects break sculpt tools

2019-07-16 Thread Antonioya
Commit: 8a7dedc9d2951943f5826d8172280785739db6b4
Author: Antonioya
Date:   Tue Jul 16 17:55:42 2019 +0200
Branches: master
https://developer.blender.org/rB8a7dedc9d2951943f5826d8172280785739db6b4

Fix T66011: Transformed objects break sculpt tools

The Pinch, Push, Twist and Clone were not using the object transformation to 
compute point changes, so the point was way off of the right place.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_brush.c 
b/source/blender/editors/gpencil/gpencil_brush.c
index f5b27d8268d..7d866aedd87 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -579,6 +579,7 @@ static bool gp_brush_push_apply(
   mul_v3_v3fl(delta, gso->dvec, inf);
 
   /* apply */
+  mul_mat3_m4_v3(gso->object->obmat, delta); /* only rotation component */
   add_v3_v3(&pt->x, delta);
 
   /* compute lock axis */
@@ -646,7 +647,9 @@ static bool gp_brush_pinch_apply(
   inf = gp_brush_influence_calc(gso, radius, co) / 5.0f;
 
   /* 1) Make this point relative to the cursor/midpoint (dvec) */
-  sub_v3_v3v3(vec, &pt->x, gso->dvec);
+  float fpt[3];
+  mul_v3_m4v3(fpt, gso->object->obmat, &pt->x);
+  sub_v3_v3v3(vec, fpt, gso->dvec);
 
   /* 2) Shrink the distance by pulling the point towards the midpoint
*(0.0 = at midpoint, 1 = at edge of brush region)
@@ -664,7 +667,8 @@ static bool gp_brush_pinch_apply(
   mul_v3_fl(vec, fac);
 
   /* 3) Translate back to original space, with the shrinkage applied */
-  add_v3_v3v3(&pt->x, gso->dvec, vec);
+  add_v3_v3v3(fpt, gso->dvec, vec);
+  mul_v3_m4v3(&pt->x, gso->object->imat, fpt);
 
   /* compute lock axis */
   gpsculpt_compute_lock_axis(gso, pt, save_pt);
@@ -713,11 +717,14 @@ static bool gp_brush_twist_apply(
 
 axis_angle_normalized_to_mat3(rmat, axis, angle);
 
-/* Rotate point (no matrix-space transforms needed, as GP points are in 
world space) */
-sub_v3_v3v3(vec, &pt->x, gso->dvec); /* make relative to center
-  * (center is stored in dvec) */
+/* Rotate point */
+float fpt[3];
+mul_v3_m4v3(fpt, gso->object->obmat, &pt->x);
+sub_v3_v3v3(vec, fpt, gso->dvec); /* make relative to center
+   * (center is stored in dvec) */
 mul_m3_v3(rmat, vec);
-add_v3_v3v3(&pt->x, vec, gso->dvec); /* restore */
+add_v3_v3v3(fpt, vec, gso->dvec); /* restore */
+mul_v3_m4v3(&pt->x, gso->object->imat, fpt);
 
 /* compute lock axis */
 gpsculpt_compute_lock_axis(gso, pt, save_pt);
@@ -1090,8 +1097,12 @@ static void gp_brush_clone_add(bContext *C, 
tGP_BrushEditData *gso)
* get pasted relative to where the cursor is now
*/
   for (i = 0, pt = new_stroke->points; i < new_stroke->totpoints; i++, 
pt++) {
+/* Rotate around center new position */
+mul_mat3_m4_v3(gso->object->obmat, &pt->x); /* only rotation component 
*/
+
 /* assume that the delta can just be applied, and then everything 
works */
 add_v3_v3(&pt->x, delta);
+mul_m4_v3(gso->object->imat, &pt->x);
   }
 
   /* Store ref for later */

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


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

2019-07-16 Thread Antonioya
Commit: c85f8ae5b22df08d3b79d27c6bb24de9d01c287a
Author: Antonioya
Date:   Tue Jul 16 16:43:39 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc85f8ae5b22df08d3b79d27c6bb24de9d01c287a

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] [8a124f86c41] greasepencil-object: GPencil: Use alpha channel of curve material

2019-07-16 Thread Antonioya
Commit: 8a124f86c41d05bb6462c8fff3e9b480b1cb2cb9
Author: Antonioya
Date:   Tue Jul 16 16:30:55 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB8a124f86c41d05bb6462c8fff3e9b480b1cb2cb9

GPencil: Use alpha channel of curve material

Now the grease pencil stroke is using the alpha channel of the original curve 
material.

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 74256f801e7..6526591f05f 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2061,9 +2061,9 @@ static int gpencil_check_same_material_color(Object 
*ob_gp, float color[4], Mate
   Material *ma = NULL;
   float color_cu[4];
   linearrgb_to_srgb_v3_v3(color_cu, color);
-  color_cu[3] = color[3];
-  float hsv1[3];
+  float hsv1[4];
   rgb_to_hsv_v(color_cu, hsv1);
+  hsv1[3] = color[3];
 
   for (int i = 1; i <= ob_gp->totcol; i++) {
 ma = give_current_material(ob_gp, i);
@@ -2243,12 +2243,14 @@ static void gpencil_convert_spline(Main *bmain,
 /* If object has more than 1 material, use second material for stroke 
color. */
 if (ob_cu->totcol > 1) {
   ma_stroke = give_current_material(ob_cu, 2);
-  linearrgb_to_srgb_v4(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
+  linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
+  mat_gp->gp_style->stroke_rgba[3] = ma_stroke->a;
 }
 else if (only_stroke) {
   /* Also use the first color if the fill is none for stroke color. */
   ma_stroke = give_current_material(ob_cu, 1);
-  linearrgb_to_srgb_v4(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
+  linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
+  mat_gp->gp_style->stroke_rgba[3] = ma_stroke->a;
   /* set fill to off. */
   mat_gp->gp_style->flag &= ~GP_STYLE_FILL_SHOW;
 }

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


[Bf-blender-cvs] [0df10ebf3f6] greasepencil-object: GPencil: Use alpha component for converting splines

2019-07-16 Thread Antonioya
Commit: 0df10ebf3f6e4c6a28fce63179bb849758090324
Author: Antonioya
Date:   Tue Jul 16 13:45:33 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0df10ebf3f6e4c6a28fce63179bb849758090324

GPencil: Use alpha component for converting splines

The alpha channel was not used before.

Note: This is a previous step before changing svg add-on to support alpha.

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index b361b819ee0..74256f801e7 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2056,12 +2056,12 @@ bool BKE_gpencil_close_stroke(bGPDstroke *gps)
 }
 
 /* Helper function to check materials with same color */
-static int gpencil_check_same_material_color(Object *ob_gp, float color[3], 
Material *r_mat)
+static int gpencil_check_same_material_color(Object *ob_gp, float color[4], 
Material *r_mat)
 {
   Material *ma = NULL;
   float color_cu[4];
   linearrgb_to_srgb_v3_v3(color_cu, color);
-  color_cu[3] = 1.0f;
+  color_cu[3] = color[3];
   float hsv1[3];
   rgb_to_hsv_v(color_cu, hsv1);
 
@@ -2069,10 +2069,10 @@ static int gpencil_check_same_material_color(Object 
*ob_gp, float color[3], Mate
 ma = give_current_material(ob_gp, i);
 MaterialGPencilStyle *gp_style = ma->gp_style;
 /* Check color with small tolerance (better in HSV). */
-float hsv2[3];
+float hsv2[4];
 rgb_to_hsv_v(gp_style->fill_rgba, hsv2);
-
-if (compare_v3v3(hsv1, hsv2, 0.01f)) {
+hsv2[3] = gp_style->fill_rgba[3];
+if (compare_v4v4(hsv1, hsv2, 0.01f)) {
   r_mat = ma;
   return i - 1;
 }
@@ -2085,7 +2085,7 @@ static int gpencil_check_same_material_color(Object 
*ob_gp, float color[3], Mate
 /* Add gpencil material using curve material as base */
 static Material *gpencil_add_from_curve_material(Main *bmain,
  Object *ob_gp,
- float cu_color[3],
+ float cu_color[4],
  const bool gpencil_lines,
  const bool fill,
  int *r_idx)
@@ -2099,15 +2099,11 @@ static Material *gpencil_add_from_curve_material(Main 
*bmain,
 ARRAY_SET_ITEMS(gp_style->stroke_rgba, 0.0f, 0.0f, 0.0f, 1.0f);
   }
   else {
-linearrgb_to_srgb_v3_v3(gp_style->stroke_rgba, cu_color);
-/* TODO: review alpha*/
-gp_style->stroke_rgba[3] = 1.0f;
+linearrgb_to_srgb_v4(gp_style->stroke_rgba, cu_color);
   }
 
   /* Fill color. */
-  linearrgb_to_srgb_v3_v3(gp_style->fill_rgba, cu_color);
-  /* TODO: review alpha*/
-  gp_style->fill_rgba[3] = 1.0f;
+  linearrgb_to_srgb_v4(gp_style->fill_rgba, cu_color);
   /* Fill is false if the original curva hasn't material assigned. */
   if (fill) {
 gp_style->flag |= GP_STYLE_FILL_SHOW;
@@ -2214,16 +2210,17 @@ static void gpencil_convert_spline(Main *bmain,
   Material *mat_gp = NULL;
   bool fill = true;
   /* Check if grease pencil has a material with same color.*/
-  float color[3];
+  float color[4];
   if ((cu->mat) && (*cu->mat)) {
 Material *mat_cu = *cu->mat;
-copy_v3_v3(color, &mat_cu->r);
+copy_v4_v4(color, &mat_cu->r);
   }
   else {
 /* Pink (unassigned) */
-zero_v3(color);
+zero_v4(color);
 color[0] = 1.0f;
 color[2] = 1.0f;
+color[3] = 1.0f;
 fill = false;
   }
 
@@ -2246,12 +2243,12 @@ static void gpencil_convert_spline(Main *bmain,
 /* If object has more than 1 material, use second material for stroke 
color. */
 if (ob_cu->totcol > 1) {
   ma_stroke = give_current_material(ob_cu, 2);
-  linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
+  linearrgb_to_srgb_v4(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
 }
 else if (only_stroke) {
   /* Also use the first color if the fill is none for stroke color. */
   ma_stroke = give_current_material(ob_cu, 1);
-  linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
+  linearrgb_to_srgb_v4(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
   /* set fill to off. */
   mat_gp->gp_style->flag &= ~GP_STYLE_FILL_SHOW;
 }

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


[Bf-blender-cvs] [575fff2209f] greasepencil-object: GPencil: Cleanup MSVSC warnings

2019-07-16 Thread Antonioya
Commit: 575fff2209f6cb7b9d9ed393c8a5b18d6428814a
Author: Antonioya
Date:   Tue Jul 16 13:11:34 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB575fff2209f6cb7b9d9ed393c8a5b18d6428814a

GPencil: Cleanup MSVSC warnings

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index d2efb144727..b361b819ee0 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1396,7 +1396,9 @@ void BKE_gpencil_vgroup_remove(Object *ob, bDeformGroup 
*defgroup)
 
   /* Remove the group */
   BLI_freelinkN(&ob->defbase, defgroup);
-  DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+  if (gpd) {
+DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+  }
 }
 
 void BKE_gpencil_dvert_ensure(bGPDstroke *gps)
@@ -2275,7 +2277,7 @@ static void gpencil_convert_spline(Main *bmain,
 BezTriple *bezt = &nu->bezt[inext];
 bool last = (bool)(s == segments - 1);
 
-float *coord_array = MEM_callocN(3 * resolu * sizeof(float), __func__);
+float *coord_array = MEM_callocN((size_t)3 * resolu * sizeof(float), 
__func__);
 
 for (int j = 0; j < 3; j++) {
   BKE_curve_forward_diff_bezier(prevbezt->vec[1][j],

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


[Bf-blender-cvs] [43343509b98] greasepencil-object: GPencil: Improve curve conversion when end points are very near

2019-07-16 Thread Antonioya
Commit: 43343509b98da5eb0aaf8bb1a42b8cd1acb38754
Author: Antonioya
Date:   Tue Jul 16 12:13:45 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB43343509b98da5eb0aaf8bb1a42b8cd1acb38754

GPencil: Improve curve conversion when end points are very near

When the distance between first and last point of the curve was very small, 
there was a glitch in the join. Now the points are moved slightly to get good 
result.

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index a8e120d8225..d2efb144727 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2115,12 +2115,28 @@ static Material *gpencil_add_from_curve_material(Main 
*bmain,
 }
 
 /* Helper function to create new stroke section */
-static void gpencil_add_new_points(
-bGPDstroke *gps, float *coord_array, float pressure, int init, int 
totpoints)
+static void gpencil_add_new_points(bGPDstroke *gps,
+   float *coord_array,
+   float pressure,
+   int init,
+   int totpoints,
+   float init_co[3],
+   bool last)
 {
   for (int i = 0; i < totpoints; i++) {
 bGPDspoint *pt = &gps->points[i + init];
 copy_v3_v3(&pt->x, &coord_array[3 * i]);
+/* Be sure the last point is not on top of the first point of the curve or
+ * the close of the stroke will produce glitches. */
+if ((last) && (i > 0) && (i == totpoints - 1)) {
+  float dist = len_v3v3(init_co, &pt->x);
+  if (dist < 0.1f) {
+/* Interpolate between previous point and current to back slightly. */
+bGPDspoint *pt_prev = &gps->points[i + init - 1];
+interp_v3_v3v3(&pt->x, &pt_prev->x, &pt->x, 0.95f);
+  }
+}
+
 pt->pressure = pressure;
 pt->strength = 1.0f;
   }
@@ -2252,10 +2268,12 @@ static void gpencil_convert_spline(Main *bmain,
 segments--;
   }
   /* Get all interpolated curve points of Beziert */
+  float init_co[3];
   for (int s = 0; s < segments; s++) {
 int inext = (s + 1) % nu->pntsu;
 BezTriple *prevbezt = &nu->bezt[s];
 BezTriple *bezt = &nu->bezt[inext];
+bool last = (bool)(s == segments - 1);
 
 float *coord_array = MEM_callocN(3 * resolu * sizeof(float), __func__);
 
@@ -2268,8 +2286,12 @@ static void gpencil_convert_spline(Main *bmain,
 resolu - 1,
 3 * sizeof(float));
 }
+/* Save first point coordinates. */
+if (s == 0) {
+  copy_v3_v3(init_co, &coord_array[0]);
+}
 /* Add points to the stroke */
-gpencil_add_new_points(gps, coord_array, bezt->radius, init, resolu);
+gpencil_add_new_points(gps, coord_array, bezt->radius, init, resolu, 
init_co, last);
 /* Free memory. */
 MEM_SAFE_FREE(coord_array);

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


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

2019-07-16 Thread Antonioya
Commit: 157dc60dc8d191475dd4628e0707a241df5e0a5a
Author: Antonioya
Date:   Tue Jul 16 12:14:36 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB157dc60dc8d191475dd4628e0707a241df5e0a5a

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] [a808ade3a26] greasepencil-object: GPencil: Create one stroke for each spline

2019-07-16 Thread Antonioya
Commit: a808ade3a26750aa7caf71d944cdddcd3a6fd510
Author: Antonioya
Date:   Tue Jul 16 11:00:19 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBa808ade3a26750aa7caf71d944cdddcd3a6fd510

GPencil: Create one stroke for each spline

For curves with several splines, must create a stroke for each of them or the 
shape would be wrong.

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 70c66805dc0..2c67f89cc14 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2118,7 +2118,7 @@ static void gpencil_add_new_points(
   }
 }
 
-/* Helper function to get the first collection that includes the object */
+/* Helper function to get the first collection that includes the object. */
 static Collection *gpencil_get_parent_collection(Scene *scene, Object *ob)
 {
   Collection *mycol = NULL;
@@ -2134,52 +2134,19 @@ static Collection *gpencil_get_parent_collection(Scene 
*scene, Object *ob)
   return mycol;
 }
 
-/* Convert a curve object to grease pencil stroke.
- *
- * \param bmain: Main thread pointer
- * \param scene: Original scene.
- * \param ob_gp: Grease pencil object to add strokes.
- * \param ob_cu: Curve to convert.
- * \param gpencil_lines: Use lines for strokes.
- * \param use_collections: Create layers using collection names.
- */
-void BKE_gpencil_convert_curve(Main *bmain,
-   Scene *scene,
-   Object *ob_gp,
-   Object *ob_cu,
-   const bool gpencil_lines,
-   const bool use_collections)
+/* Helper function to convert one spline to grease pencil stroke. */
+static void gpencil_convert_spline(Main *bmain,
+   Scene *scene,
+   Object *ob_gp,
+   Object *ob_cu,
+   const bool gpencil_lines,
+   const bool use_collections,
+   bGPDframe *gpf,
+   Nurb *nu)
 {
-  if (ELEM(NULL, ob_gp, ob_cu) || (ob_gp->type != OB_GPENCIL) || (ob_gp->data 
== NULL)) {
-return;
-  }
-
-  bGPdata *gpd = (bGPdata *)ob_gp->data;
   Curve *cu = (Curve *)ob_cu->data;
-  Nurb *nu = NULL;
   bool cyclic = true;
-  bGPDlayer *gpl = NULL;
 
-  /* Check if there is an active layer. */
-  if (use_collections) {
-Collection *collection = gpencil_get_parent_collection(scene, ob_cu);
-if (collection != NULL) {
-  gpl = BLI_findstring(&gpd->layers, collection->id.name + 2, 
offsetof(bGPDlayer, info));
-  if (gpl == NULL) {
-gpl = BKE_gpencil_layer_addnew(gpd, collection->id.name + 2, true);
-  }
-}
-  }
-
-  if (gpl == NULL) {
-gpl = BKE_gpencil_layer_getactive(gpd);
-if (gpl == NULL) {
-  gpl = BKE_gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true);
-}
-  }
-
-  /* Check if there is an active frame. */
-  bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, CFRA, GP_GETFRAME_ADD_COPY);
   /* Create Stroke. */
   bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "bGPDstroke");
   gps->thickness = 1.0f;
@@ -2200,20 +2167,16 @@ void BKE_gpencil_convert_curve(Main *bmain,
*/
   int totpoints = 0;
   int segments = 0;
-  for (nu = cu->nurb.first; nu; nu = nu->next) {
-int resolu = nu->resolu + 1;
-if (nu->type == CU_BEZIER) {
-  segments = nu->pntsu;
-  if (((nu->flagu & CU_NURB_CYCLIC) == 0) || (nu->pntsu == 2)) {
-segments--;
-cyclic = false;
-  }
-  totpoints += resolu * segments;
-}
+  int resolu = nu->resolu + 1;
+  segments = nu->pntsu;
+  if (((nu->flagu & CU_NURB_CYCLIC) == 0) || (nu->pntsu == 2)) {
+segments--;
+cyclic = false;
   }
-  totpoints -= segments - 1;
-  gps->totpoints = totpoints;
+  totpoints = (resolu * segments) - (segments - 1);
+
   /* Allocate memory for storage points, but keep empty. */
+  gps->totpoints = totpoints;
   gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, 
"gp_stroke_points");
   /* Initialize triangle memory to dummy data. */
   gps->tot_triangles = 0;
@@ -2263,11 +2226,11 @@ void BKE_gpencil_convert_curve(Main *bmain,
   /* Also use the first color if the fill is none for stroke color. */
   ma_stroke = give_current_material(ob_cu, 1);
   linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
-  /* set fill to off */
+  /* set fill to off. */
   mat_gp->gp_style->flag &= ~GP_STYLE_FILL_SHOW;
 }
   }
-
+  /* Assign material index

[Bf-blender-cvs] [4cda368ef68] greasepencil-object: GPencil: Improve Close stroke function for very small gaps

2019-07-16 Thread Antonioya
Commit: 4cda368ef68a755eac1a8e336ee7505c17761ccf
Author: Antonioya
Date:   Tue Jul 16 11:31:05 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB4cda368ef68a755eac1a8e336ee7505c17761ccf

GPencil: Improve Close stroke function for very small gaps

When the gap is very small, don't need to add new points to the stroke, just 
cyclic.

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 2c67f89cc14..a8e120d8225 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1994,6 +1994,12 @@ bool BKE_gpencil_close_stroke(bGPDstroke *gps)
   pt2 = &gps->points[0];
   float dist_close = len_v3v3(&pt1->x, &pt2->x);
 
+  /* if the distance to close is very small, don't need add points and just 
enable cyclic. */
+  if (dist_close <= dist_avg) {
+gps->flag |= GP_STROKE_CYCLIC;
+return true;
+  }
+
   /* Calc number of points required using the average distance. */
   int tot_newpoints = MAX2(dist_close / dist_avg, 1);
 
@@ -2010,9 +2016,11 @@ bool BKE_gpencil_close_stroke(bGPDstroke *gps)
   pt2 = &gps->points[0];
   bGPDspoint *pt = &gps->points[old_tot];
   for (int i = 1; i < tot_newpoints + 1; i++, pt++) {
-float step = ((float)i / (float)tot_newpoints);
+float step = (tot_newpoints > 1) ? ((float)i / (float)tot_newpoints) : 
0.99f;
 /* Clamp last point to be near, but not on top of first point. */
-CLAMP(step, 0.0f, 0.99f);
+if ((tot_newpoints > 1) && (i == tot_newpoints)) {
+  step *= 0.99f;
+}
 
 /* Average point. */
 interp_v3_v3v3(&pt->x, &pt1->x, &pt2->x, step);

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


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

2019-07-15 Thread Antonioya
Commit: cfdd6636799c4a77cd6d2e2aecc8cdf7e395bd32
Author: Antonioya
Date:   Mon Jul 15 17:22:35 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBcfdd6636799c4a77cd6d2e2aecc8cdf7e395bd32

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] [69aa5bba4f0] master: Fix T66941: GPencil wrong interpolation calculation for last keyframe

2019-07-15 Thread Antonioya
Commit: 69aa5bba4f0ccd9e95ce2eb811e0f7089fbb5574
Author: Antonioya
Date:   Mon Jul 15 16:56:32 2019 +0200
Branches: master
https://developer.blender.org/rB69aa5bba4f0ccd9e95ce2eb811e0f7089fbb5574

Fix T66941: GPencil wrong interpolation calculation for last keyframe

The range used for frames was wrong and the last keyframe was way off of the 
correct place.

Thanks to @MagnumOctopus for catching the bug.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c 
b/source/blender/editors/gpencil/gpencil_interpolate.c
index 8a9f7c1224a..4d5548dcdf3 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -996,8 +996,9 @@ static int gpencil_interpolate_seq_exec(bContext *C, 
wmOperator *op)
   float factor;
 
   /* get interpolation factor */
-  factor = (float)(cframe - prevFrame->framenum) /
-   (nextFrame->framenum - prevFrame->framenum + 1);
+  float framerange = nextFrame->framenum - prevFrame->framenum;
+  CLAMP_MIN(framerange, 1.0f);
+  factor = (float)(cframe - prevFrame->framenum) / framerange;
 
   if (ipo_settings->type == GP_IPO_CURVEMAP) {
 /* custom curvemap */

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


[Bf-blender-cvs] [bb165d6df10] master: Fix T66957: GPencil material isolate crash when slot is empty

2019-07-15 Thread Antonioya
Commit: bb165d6df10dcee953b55a52e169e5b9e6bac78e
Author: Antonioya
Date:   Mon Jul 15 09:52:14 2019 +0200
Branches: master
https://developer.blender.org/rBbb165d6df10dcee953b55a52e169e5b9e6bac78e

Fix T66957: GPencil material isolate crash when slot is empty

When the slot of the material is empty, the loop to lock the materials tried to 
use the material but this was NULL.

Check if material is NULL before using it in other operators too.

===

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 941c7645dc0..90a2b2d613c 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1521,8 +1521,10 @@ static int gp_stroke_lock_color_exec(bContext *C, 
wmOperator *UNUSED(op))
   /* first lock all colors */
   for (short i = 0; i < *totcol; i++) {
 Material *tmp_ma = give_current_material(ob, i + 1);
-tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED;
-DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE);
+if (tmp_ma) {
+  tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED;
+  DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE);
+}
   }
 
   /* loop all selected strokes and unlock any color */
@@ -2433,10 +2435,12 @@ static int gpencil_lock_layer_exec(bContext *C, 
wmOperator *UNUSED(op))
 
   for (short i = 0; i < *totcol; i++) {
 ma = give_current_material(ob, i + 1);
-gp_style = ma->gp_style;
-gp_style->flag |= GP_STYLE_COLOR_LOCKED;
-gp_style->flag |= GP_STYLE_COLOR_HIDE;
-DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+if (ma) {
+  gp_style = ma->gp_style;
+  gp_style->flag |= GP_STYLE_COLOR_LOCKED;
+  gp_style->flag |= GP_STYLE_COLOR_HIDE;
+  DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+}
   }
 
   /* loop all selected strokes and unlock any color used in active layer */
@@ -2515,7 +2519,7 @@ static int gpencil_color_isolate_exec(bContext *C, 
wmOperator *op)
   for (short i = 0; i < *totcol; i++) {
 ma = give_current_material(ob, i + 1);
 /* Skip if this is the active one */
-if (ma == active_ma) {
+if ((ma == NULL) || (ma == active_ma)) {
   continue;
 }
 
@@ -2534,6 +2538,9 @@ static int gpencil_color_isolate_exec(bContext *C, 
wmOperator *op)
 /* Set flags on all "other" colors */
 for (short i = 0; i < *totcol; i++) {
   ma = give_current_material(ob, i + 1);
+  if (ma == NULL) {
+continue;
+  }
   gp_style = ma->gp_style;
   if (gp_style == active_color) {
 continue;
@@ -2548,6 +2555,9 @@ static int gpencil_color_isolate_exec(bContext *C, 
wmOperator *op)
 /* Clear flags - Restore everything else */
 for (short i = 0; i < *totcol; i++) {
   ma = give_current_material(ob, i + 1);
+  if (ma == NULL) {
+continue;
+  }
   gp_style = ma->gp_style;
   gp_style->flag &= ~flags;
   DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
@@ -2610,10 +2620,12 @@ static int gpencil_color_hide_exec(bContext *C, 
wmOperator *op)
 MaterialGPencilStyle *color = NULL;
 for (short i = 0; i < *totcol; i++) {
   ma = give_current_material(ob, i + 1);
-  color = ma->gp_style;
-  if (active_color != color) {
-color->flag |= GP_STYLE_COLOR_HIDE;
-DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+  if (ma) {
+color = ma->gp_style;
+if (active_color != color) {
+  color->flag |= GP_STYLE_COLOR_HIDE;
+  DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+}
   }
 }
   }
@@ -2671,9 +2683,11 @@ static int gpencil_color_reveal_exec(bContext *C, 
wmOperator *UNUSED(op))
 
   for (short i = 0; i < *totcol; i++) {
 ma = give_current_material(ob, i + 1);
-gp_style = ma->gp_style;
-gp_style->flag &= ~GP_STYLE_COLOR_HIDE;
-DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+if (ma) {
+  gp_style = ma->gp_style;
+  gp_style->flag &= ~GP_STYLE_COLOR_HIDE;
+  DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+}
   }
 
   /* updates */
@@ -2722,9 +2736,11 @@ static int gpencil_color_lock_all_exec(bContext *C, 
wmOperator *UNUSED(op))
 
   for (short i = 0; i < *totcol; i++) {
 ma = give_current_material(ob, i + 1);
-gp_style = ma->gp_style;
-gp_style->flag |= GP_STYLE_COLOR_LOCKED;
-DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+if (ma) {
+  gp_style = ma->gp_style;
+  gp_style->flag |= GP_STYLE_COLOR_LOCKED;
+  DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+}
   }
 
 

[Bf-blender-cvs] [648bd58595e] greasepencil-object: GPencil: Change default value in python API

2019-07-14 Thread Antonioya
Commit: 648bd58595edd972eaa1632534c0060c98e30df5
Author: Antonioya
Date:   Sun Jul 14 20:55:02 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB648bd58595edd972eaa1632534c0060c98e30df5

GPencil: Change default value in python API

The gpencil_lines must be set to False by default.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_object_api.c 
b/source/blender/makesrna/intern/rna_object_api.c
index c3a5b57817c..163df1469fa 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -1192,7 +1192,7 @@ void RNA_api_object(StructRNA *srna)
   parm = RNA_def_pointer(
   func, "ob_gpencil", "Object", "", "Grease Pencil object used to create 
new strokes");
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-  parm = RNA_def_boolean(func, "gpencil_lines", 1, "", "Create Lines");
+  parm = RNA_def_boolean(func, "gpencil_lines", 0, "", "Create Lines");
   parm = RNA_def_boolean(func, "use_collections", 1, "", "Use Collections");
 
   parm = RNA_def_boolean(func, "result", 0, "", "Result");

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


[Bf-blender-cvs] [7393ca434dd] greasepencil-object: GPencil: Set gpencil_lines parameter to False by default

2019-07-14 Thread Antonioya
Commit: 7393ca434dd5ba90e7f38262abf4c1f7cc5ef010
Author: Antonioya
Date:   Sun Jul 14 17:23:27 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB7393ca434dd5ba90e7f38262abf4c1f7cc5ef010

GPencil: Set gpencil_lines parameter to False by default

===

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

===

diff --git a/source/blender/editors/object/object_add.c 
b/source/blender/editors/object/object_add.c
index 077c56adafb..fae53bf7182 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2538,11 +2538,8 @@ void OBJECT_OT_convert(wmOperatorType *ot)
   0,
   "Keep Original",
   "Keep original objects instead of replacing them");
-  RNA_def_boolean(ot->srna,
-  "gpencil_lines",
-  1,
-  "GPencil Lines",
-  "Use lines for grease pencil conversion");
+  RNA_def_boolean(
+  ot->srna, "gpencil_lines", 0, "GPencil Lines", "Use lines for grease 
pencil conversion");
   RNA_def_boolean(ot->srna,
   "use_collections",
   1,

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


[Bf-blender-cvs] [58b7d61ebfc] greasepencil-object: GPencil: Fix problem when color is nofill in SVG

2019-07-14 Thread Antonioya
Commit: 58b7d61ebfca1df24d439a93fd87c12b466b22f3
Author: Antonioya
Date:   Sun Jul 14 17:19:45 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB58b7d61ebfca1df24d439a93fd87c12b466b22f3

GPencil: Fix problem when color is nofill in SVG

If the color in the SVG converted was nofill, the stroke had fill color in 
grease pencil and this creates glitches because the shape was not defined to be 
filled.

Now, the name of the color is checked to verify if the material is for stroke, 
and if only there is one material with this name, the fill is disabled.

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 975c567789e..70c66805dc0 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2237,15 +2237,37 @@ void BKE_gpencil_convert_curve(Main *bmain,
 color[2] = 1.0f;
 fill = false;
   }
+
+  /* Special case: If the color was created by the SVG add-on and the name 
contains '_stroke' and
+   * there is only one color, the stroke must not be closed, fill to false and 
use for
+   * stroke the fill color.
+   */
+  bool only_stroke = false;
+  if (ob_cu->totcol == 1) {
+Material *ma_stroke = give_current_material(ob_cu, 1);
+if ((ma_stroke) && (strstr(ma_stroke->id.name, "_stroke") != NULL)) {
+  only_stroke = true;
+}
+  }
+
   int r_idx = gpencil_check_same_material_color(ob_gp, color, mat_gp);
   if (r_idx < 0) {
+Material *ma_stroke = NULL;
 mat_gp = gpencil_add_from_curve_material(bmain, ob_gp, color, 
gpencil_lines, fill, &r_idx);
-/* If object has more than 1 material, use second material for stroke 
color */
+/* If object has more than 1 material, use second material for stroke 
color. */
 if (ob_cu->totcol > 1) {
-  Material *ma_stroke = give_current_material(ob_cu, 2);
+  ma_stroke = give_current_material(ob_cu, 2);
+  linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
+}
+else if (only_stroke) {
+  /* Also use the first color if the fill is none for stroke color. */
+  ma_stroke = give_current_material(ob_cu, 1);
   linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
+  /* set fill to off */
+  mat_gp->gp_style->flag &= ~GP_STYLE_FILL_SHOW;
 }
   }
+
   gps->mat_nr = r_idx;
 
   /* Add stroke to frame.*/
@@ -2290,7 +2312,7 @@ void BKE_gpencil_convert_curve(Main *bmain,
 }
   }
   /* Cyclic curve, close stroke. */
-  if (cyclic) {
+  if ((cyclic) && (!only_stroke)) {
 BKE_gpencil_close_stroke(gps);
   }

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


[Bf-blender-cvs] [e4c9f9d953a] greasepencil-object: GPencil: Fix error generating strokes with curves with 2 points only

2019-07-14 Thread Antonioya
Commit: e4c9f9d953aef09149117eefdbb5f71479a71d47
Author: Antonioya
Date:   Sun Jul 14 14:33:23 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBe4c9f9d953aef09149117eefdbb5f71479a71d47

GPencil: Fix error generating strokes with curves with 2 points only

The number of segments must be 1 if the number of control points is 2. The 
problem was with the closed curves.

Also added tag of the databalock.

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 028b22a8bc4..975c567789e 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2150,7 +2150,7 @@ void BKE_gpencil_convert_curve(Main *bmain,
const bool gpencil_lines,
const bool use_collections)
 {
-  if (ELEM(NULL, ob_gp, ob_cu) || (ob_gp->type != OB_GPENCIL)) {
+  if (ELEM(NULL, ob_gp, ob_cu) || (ob_gp->type != OB_GPENCIL) || (ob_gp->data 
== NULL)) {
 return;
   }
 
@@ -2185,6 +2185,7 @@ void BKE_gpencil_convert_curve(Main *bmain,
   gps->thickness = 1.0f;
   gps->gradient_f = 1.0f;
   ARRAY_SET_ITEMS(gps->gradient_s, 1.0f, 1.0f);
+  ARRAY_SET_ITEMS(gps->caps, GP_STROKE_CAP_ROUND, GP_STROKE_CAP_ROUND);
   gps->inittime = 0.0f;
 
   /* Enable recalculation flag by default. */
@@ -2203,7 +2204,7 @@ void BKE_gpencil_convert_curve(Main *bmain,
 int resolu = nu->resolu + 1;
 if (nu->type == CU_BEZIER) {
   segments = nu->pntsu;
-  if ((nu->flagu & CU_NURB_CYCLIC) == 0) {
+  if (((nu->flagu & CU_NURB_CYCLIC) == 0) || (nu->pntsu == 2)) {
 segments--;
 cyclic = false;
   }
@@ -2256,7 +2257,7 @@ void BKE_gpencil_convert_curve(Main *bmain,
 int resolu = nu->resolu + 1;
 if (nu->type == CU_BEZIER) {
   segments = nu->pntsu;
-  if ((nu->flagu & CU_NURB_CYCLIC) == 0) {
+  if (((nu->flagu & CU_NURB_CYCLIC) == 0) || (nu->pntsu == 2)) {
 segments--;
   }
   /* Get all interpolated curve points of Beziert */
@@ -2292,4 +2293,6 @@ void BKE_gpencil_convert_curve(Main *bmain,
   if (cyclic) {
 BKE_gpencil_close_stroke(gps);
   }
+
+  DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
 }

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


[Bf-blender-cvs] [af6a5bc0717] greasepencil-object: GPencil: Apply curve radius as pressure for stroke point

2019-07-14 Thread Antonioya
Commit: af6a5bc07175727f8617b1def033b59816835b0a
Author: Antonioya
Date:   Sun Jul 14 11:04:31 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBaf6a5bc07175727f8617b1def033b59816835b0a

GPencil: Apply curve radius as pressure for stroke point

When convert the curve, the beziert point radius is used to generate the 
pressure of the grease pencil stroke point and this allows to generate 
different thickness.

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index c9bf88de4e1..028b22a8bc4 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2107,12 +2107,13 @@ static Material *gpencil_add_from_curve_material(Main 
*bmain,
 }
 
 /* Helper function to create new stroke section */
-static void gpencil_add_new_points(bGPDstroke *gps, float *coord_array, int 
init, int totpoints)
+static void gpencil_add_new_points(
+bGPDstroke *gps, float *coord_array, float pressure, int init, int 
totpoints)
 {
   for (int i = 0; i < totpoints; i++) {
 bGPDspoint *pt = &gps->points[i + init];
 copy_v3_v3(&pt->x, &coord_array[3 * i]);
-pt->pressure = 1.0f;
+pt->pressure = pressure;
 pt->strength = 1.0f;
   }
 }
@@ -2276,7 +2277,7 @@ void BKE_gpencil_convert_curve(Main *bmain,
 3 * sizeof(float));
 }
 /* Add points to the stroke */
-gpencil_add_new_points(gps, coord_array, init, resolu);
+gpencil_add_new_points(gps, coord_array, bezt->radius, init, resolu);
 /* Free memory. */
 MEM_SAFE_FREE(coord_array);

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


[Bf-blender-cvs] [f05a18f0fa3] greasepencil-object: GPencil: Rename python API function from convert_to_gpencil to generate_gpencil_strokes

2019-07-14 Thread Antonioya
Commit: f05a18f0fa315635030c36e24ff0b49c03909143
Author: Antonioya
Date:   Sun Jul 14 10:46:22 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBf05a18f0fa315635030c36e24ff0b49c03909143

GPencil: Rename python API function from convert_to_gpencil to 
generate_gpencil_strokes

The problem with old name was that it implied that original object was removed, 
but the function only creates the strokes, so the new name is better.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_object_api.c 
b/source/blender/makesrna/intern/rna_object_api.c
index 3d3319a0d15..c3a5b57817c 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -717,12 +717,12 @@ static bool rna_Object_update_from_editmode(Object *ob, 
Main *bmain)
   return result;
 }
 
-bool rna_Object_convert_to_gpencil(Object *ob,
-   bContext *C,
-   ReportList *reports,
-   Object *ob_gpencil,
-   bool gpencil_lines,
-   bool use_collections)
+bool rna_Object_generate_gpencil_strokes(Object *ob,
+ bContext *C,
+ ReportList *reports,
+ Object *ob_gpencil,
+ bool gpencil_lines,
+ bool use_collections)
 {
   if (ob->type != OB_CURVE) {
 BKE_reportf(reports,
@@ -1185,7 +1185,7 @@ void RNA_api_object(StructRNA *srna)
   "Intended to be used by render engines 
only");
 
   /* Convert curve object to gpencil strokes. */
-  func = RNA_def_function(srna, "convert_to_gpencil", 
"rna_Object_convert_to_gpencil");
+  func = RNA_def_function(srna, "generate_gpencil_strokes", 
"rna_Object_generate_gpencil_strokes");
   RNA_def_function_ui_description(func, "Convert a curve object to grease 
pencil strokes.");
   RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);

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


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

2019-07-13 Thread Antonioya
Commit: 9546718f32515f7a2cae4c8b9859d7721ef0b859
Author: Antonioya
Date:   Sat Jul 13 11:35:27 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB9546718f32515f7a2cae4c8b9859d7721ef0b859

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] [ae571881918] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-07-11 Thread Antonioya
Commit: ae5718819186a5c8f91ecabcad3e35a4e5121ecd
Author: Antonioya
Date:   Thu Jul 11 17:21:22 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBae5718819186a5c8f91ecabcad3e35a4e5121ecd

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] [ff12988a498] greasepencil-object: GPencil: Cleanup commet

2019-07-10 Thread Antonioya
Commit: ff12988a49818c2a576184cd66bf52480b202f6e
Author: Antonioya
Date:   Wed Jul 10 22:53:44 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBff12988a49818c2a576184cd66bf52480b202f6e

GPencil: Cleanup commet

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index d656d2d0a16..c9bf88de4e1 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2133,8 +2133,9 @@ static Collection *gpencil_get_parent_collection(Scene 
*scene, Object *ob)
   return mycol;
 }
 
-/* Convert a curve to grease pencil stroke.
+/* Convert a curve object to grease pencil stroke.
  *
+ * \param bmain: Main thread pointer
  * \param scene: Original scene.
  * \param ob_gp: Grease pencil object to add strokes.
  * \param ob_cu: Curve to convert.

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


[Bf-blender-cvs] [3ba6576a32b] greasepencil-object: GPencil: Remove extra parameters to Convert API

2019-07-10 Thread Antonioya
Commit: 3ba6576a32b9ea51e6d45fc0424f73621ec0ef16
Author: Antonioya
Date:   Wed Jul 10 21:09:18 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB3ba6576a32b9ea51e6d45fc0424f73621ec0ef16

GPencil: Remove extra parameters to Convert API

Scene can be removed using context. Also bmain can be removed too.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_object_api.c 
b/source/blender/makesrna/intern/rna_object_api.c
index 6dc1b7463b3..3d3319a0d15 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -718,9 +718,8 @@ static bool rna_Object_update_from_editmode(Object *ob, 
Main *bmain)
 }
 
 bool rna_Object_convert_to_gpencil(Object *ob,
-   Main *bmain,
+   bContext *C,
ReportList *reports,
-   Scene *scene,
Object *ob_gpencil,
bool gpencil_lines,
bool use_collections)
@@ -732,6 +731,8 @@ bool rna_Object_convert_to_gpencil(Object *ob,
 ob->id.name + 2);
 return false;
   }
+  Main *bmain = CTX_data_main(C);
+  Scene *scene = CTX_data_scene(C);
 
   BKE_gpencil_convert_curve(bmain, scene, ob_gpencil, ob, gpencil_lines, 
use_collections);
 
@@ -1186,10 +1187,8 @@ void RNA_api_object(StructRNA *srna)
   /* Convert curve object to gpencil strokes. */
   func = RNA_def_function(srna, "convert_to_gpencil", 
"rna_Object_convert_to_gpencil");
   RNA_def_function_ui_description(func, "Convert a curve object to grease 
pencil strokes.");
-  RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+  RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
 
-  parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene of the object");
-  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
   parm = RNA_def_pointer(
   func, "ob_gpencil", "Object", "", "Grease Pencil object used to create 
new strokes");
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);

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


[Bf-blender-cvs] [3ed7b3b37c2] greasepencil-object: GPencil: Add notifier to update new created stroke

2019-07-10 Thread Antonioya
Commit: 3ed7b3b37c22e9b6c8c0d2b80c39a8aef53fa40f
Author: Antonioya
Date:   Wed Jul 10 17:45:06 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB3ed7b3b37c22e9b6c8c0d2b80c39a8aef53fa40f

GPencil: Add notifier to update new created stroke

===

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

===

diff --git a/source/blender/makesrna/intern/rna_object_api.c 
b/source/blender/makesrna/intern/rna_object_api.c
index be7dfb2bd86..6dc1b7463b3 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -734,6 +734,9 @@ bool rna_Object_convert_to_gpencil(Object *ob,
   }
 
   BKE_gpencil_convert_curve(bmain, scene, ob_gpencil, ob, gpencil_lines, 
use_collections);
+
+  WM_main_add_notifier(NC_GPENCIL | ND_DATA, NULL);
+
   return true;
 }
 #else /* RNA_RUNTIME */

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


[Bf-blender-cvs] [8b3afb178a7] greasepencil-object: GPencil: Fix double definition

2019-07-10 Thread Antonioya
Commit: 8b3afb178a720e9305666afd00bb876dfed17c9d
Author: Antonioya
Date:   Wed Jul 10 17:37:33 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB8b3afb178a720e9305666afd00bb876dfed17c9d

GPencil: Fix double definition

The gpl was out of scope due double definition.

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 99f9419de9f..d656d2d0a16 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2170,7 +2170,7 @@ void BKE_gpencil_convert_curve(Main *bmain,
   }
 
   if (gpl == NULL) {
-bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
+gpl = BKE_gpencil_layer_getactive(gpd);
 if (gpl == NULL) {
   gpl = BKE_gpencil_layer_addnew(gpd, 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] [8e8673483d8] greasepencil-object: GPencil: Change default parameter use_collections to True

2019-07-10 Thread Antonioya
Commit: 8e8673483d868e00b28a000ae7a71f6743859e87
Author: Antonioya
Date:   Wed Jul 10 17:37:58 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB8e8673483d868e00b28a000ae7a71f6743859e87

GPencil: Change default parameter use_collections to True

===

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

===

diff --git a/source/blender/makesrna/intern/rna_object_api.c 
b/source/blender/makesrna/intern/rna_object_api.c
index 7df63d0aae1..be7dfb2bd86 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -1191,7 +1191,7 @@ void RNA_api_object(StructRNA *srna)
   func, "ob_gpencil", "Object", "", "Grease Pencil object used to create 
new strokes");
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
   parm = RNA_def_boolean(func, "gpencil_lines", 1, "", "Create Lines");
-  parm = RNA_def_boolean(func, "use_collections", 0, "", "Use Collections");
+  parm = RNA_def_boolean(func, "use_collections", 1, "", "Use Collections");
 
   parm = RNA_def_boolean(func, "result", 0, "", "Result");
   RNA_def_function_return(func, parm);

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


[Bf-blender-cvs] [c5244904258] greasepencil-object: GPencil: Basic python api to convert curve to strokes

2019-07-10 Thread Antonioya
Commit: c52449042582c9a76cbf24c5698da1c71c0d37cd
Author: Antonioya
Date:   Wed Jul 10 17:12:05 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc52449042582c9a76cbf24c5698da1c71c0d37cd

GPencil: Basic python api to convert curve to strokes

===

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

===

diff --git a/source/blender/makesrna/intern/rna_object_api.c 
b/source/blender/makesrna/intern/rna_object_api.c
index a891e11a944..7df63d0aae1 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -37,6 +37,7 @@
 #include "DNA_object_types.h"
 
 #include "BKE_layer.h"
+#include "BKE_gpencil.h"
 
 #include "DEG_depsgraph.h"
 
@@ -715,6 +716,26 @@ static bool rna_Object_update_from_editmode(Object *ob, 
Main *bmain)
   }
   return result;
 }
+
+bool rna_Object_convert_to_gpencil(Object *ob,
+   Main *bmain,
+   ReportList *reports,
+   Scene *scene,
+   Object *ob_gpencil,
+   bool gpencil_lines,
+   bool use_collections)
+{
+  if (ob->type != OB_CURVE) {
+BKE_reportf(reports,
+RPT_ERROR,
+"Object '%s' not valid for this operation! Only curves 
supported.",
+ob->id.name + 2);
+return false;
+  }
+
+  BKE_gpencil_convert_curve(bmain, scene, ob_gpencil, ob, gpencil_lines, 
use_collections);
+  return true;
+}
 #else /* RNA_RUNTIME */
 
 void RNA_api_object(StructRNA *srna)
@@ -1158,6 +1179,22 @@ void RNA_api_object(StructRNA *srna)
   RNA_def_function_ui_description(func,
   "Release memory used by caches associated 
with this object. "
   "Intended to be used by render engines 
only");
+
+  /* Convert curve object to gpencil strokes. */
+  func = RNA_def_function(srna, "convert_to_gpencil", 
"rna_Object_convert_to_gpencil");
+  RNA_def_function_ui_description(func, "Convert a curve object to grease 
pencil strokes.");
+  RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+
+  parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene of the object");
+  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+  parm = RNA_def_pointer(
+  func, "ob_gpencil", "Object", "", "Grease Pencil object used to create 
new strokes");
+  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+  parm = RNA_def_boolean(func, "gpencil_lines", 1, "", "Create Lines");
+  parm = RNA_def_boolean(func, "use_collections", 0, "", "Use Collections");
+
+  parm = RNA_def_boolean(func, "result", 0, "", "Result");
+  RNA_def_function_return(func, parm);
 }
 
 #endif /* RNA_RUNTIME */

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


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

2019-07-10 Thread Antonioya
Commit: 097ae32e2b7fb2d0c7ba1e0d106a814c9304b438
Author: Antonioya
Date:   Wed Jul 10 17:12:31 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB097ae32e2b7fb2d0c7ba1e0d106a814c9304b438

Merge branch 'master' into greasepencil-object

===



===

diff --cc source/blender/editors/object/object_add.c
index 22550e18dba,f8cf55933aa..077c56adafb
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@@ -2126,10 -2131,9 +2132,10 @@@ static Base *duplibase_for_convert
  static int convert_exec(bContext *C, wmOperator *op)
  {
Main *bmain = CTX_data_main(C);
-   Depsgraph *depsgraph = CTX_data_depsgraph(C);
+   Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
 +  View3D *v3d = CTX_wm_view3d(C);
Base *basen = NULL, *basact = NULL;
Object *ob1, *obact = CTX_data_active_object(C);
Curve *cu;

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


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

2019-07-09 Thread Antonioya
Commit: 00b5bda6ae8ed85838ba1e3c767151d22f1254f8
Author: Antonioya
Date:   Tue Jul 9 23:23:26 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB00b5bda6ae8ed85838ba1e3c767151d22f1254f8

Merge branch 'master' into greasepencil-object

 Conflicts:
release/datafiles/locale
release/scripts/addons
release/scripts/addons_contrib
source/tools

===



===



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


[Bf-blender-cvs] [2e7dee3fb9f] greasepencil-object: GPencil: Add "Self Overlap" parameter to materials to disable Stencil

2019-07-09 Thread Antonioya
Commit: 2e7dee3fb9ffd5e6fb38889a3669ed0d66d112e8
Author: Antonioya
Date:   Tue Jul 9 23:11:36 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2e7dee3fb9ffd5e6fb38889a3669ed0d66d112e8

GPencil: Add "Self Overlap" parameter to materials to disable Stencil

This parameter was removed in 2.80 and we decided to back again, but now is 
inverted.

===

M   release/scripts/startup/bl_ui/properties_material_gpencil.py
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/makesdna/DNA_material_types.h
M   source/blender/makesrna/intern/rna_material.c

===

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 29a89c7b4a3..2898213d760 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -144,6 +144,7 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 col.template_ID(gpcolor, "stroke_image", open="image.open")
 if gpcolor.mode == 'LINE':
 col.prop(gpcolor, "pixel_size", text="UV Factor")
+col.prop(gpcolor, "use_overlap_strokes")
 
 col.prop(gpcolor, "use_stroke_pattern", text="Use As Stencil 
Mask")
 if gpcolor.use_stroke_pattern is False:
@@ -161,6 +162,8 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 if gpcolor.mode in {'DOTS', 'BOX'}:
 col.prop(gpcolor, "alignment_mode")
 
+if gpcolor.mode == 'LINE':
+col.prop(gpcolor, "use_overlap_strokes")
 
 class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
 bl_label = "Fill"
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 4b533fd94ef..103ade8e85a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1396,7 +1396,8 @@ void gpencil_triangulate_stroke_fill(Object *ob, 
bGPDstroke *gps)
 /* Check if stencil is required */
 static bool gpencil_is_stencil_required(MaterialGPencilStyle *gp_style)
 {
-  return (bool)(gp_style->stroke_style == GP_STYLE_STROKE_STYLE_SOLID);
+  return (bool)((gp_style->stroke_style == GP_STYLE_STROKE_STYLE_SOLID) &&
+((gp_style->flag & GP_STYLE_DISABLE_STENCIL) == 0));
 }
 
 /* draw stroke in drawing buffer */
diff --git a/source/blender/makesdna/DNA_material_types.h 
b/source/blender/makesdna/DNA_material_types.h
index 42308f54d7a..152ecb85991 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -128,6 +128,8 @@ typedef enum eMaterialGPencilStyle_Flag {
   GP_STYLE_FILL_SHOW = (1 << 9),
   /* mix stroke texture */
   GP_STYLE_STROKE_TEX_MIX = (1 << 11),
+  /* disable stencil clipping (overlap) */
+  GP_STYLE_DISABLE_STENCIL = (1 << 12),
 } eMaterialGPencilStyle_Flag;
 
 typedef enum eMaterialGPencilStyle_Mode {
diff --git a/source/blender/makesrna/intern/rna_material.c 
b/source/blender/makesrna/intern/rna_material.c
index 28989d1dd5f..57ec4c4c87c 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -618,8 +618,14 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
   prop = RNA_def_property(srna, "use_fill_pattern", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_FILL_PATTERN);
   RNA_def_property_ui_text(prop, "Pattern", "Use Fill Texture as a pattern to 
apply color");
+
   RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, 
"rna_MaterialGpencil_update");
+  prop = RNA_def_property(srna, "use_overlap_strokes", PROP_BOOLEAN, 
PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_DISABLE_STENCIL);
+  RNA_def_property_ui_text(
+  prop, "Self Overlap", "Disable stencil and overlap self intersections 
with alpha materials");
 
+  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, 
"rna_MaterialGpencil_update");
   prop = RNA_def_property(srna, "show_stroke", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_STROKE_SHOW);
   RNA_def_property_ui_text(prop, "Show Stroke", "Show stroke lines of this 
material");

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


[Bf-blender-cvs] [2708e25e4ec] greasepencil-object: GPencil: Use dynamic array size for SBuffer while drawing

2019-07-09 Thread Antonioya
Commit: 2708e25e4ec92f18a501396e19a4f9575dbdaca6
Author: Antonioya
Date:   Tue Jul 9 20:56:07 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2708e25e4ec92f18a501396e19a4f9575dbdaca6

GPencil: Use dynamic array size for SBuffer while drawing

This is to solve the fixed limit defined before.

Also some cleanup and renames.

===

M   source/blender/blenloader/intern/readfile.c
M   source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/editors/gpencil/annotate_draw.c
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_edit.c
M   source/blender/editors/gpencil/gpencil_fill.c
M   source/blender/editors/gpencil/gpencil_intern.h
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/include/ED_gpencil.h
M   source/blender/makesdna/DNA_gpencil_types.h

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index e750b84efa0..46815f5b762 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7033,6 +7033,7 @@ static void direct_link_gpencil(FileData *fd, bGPdata 
*gpd)
 
   /* init stroke buffer */
   gpd->runtime.sbuffer = NULL;
+  gpd->runtime.sbuffer_used = 0;
   gpd->runtime.sbuffer_size = 0;
   gpd->runtime.tot_cp_points = 0;
 
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 65c1ba89dda..1ec02cac109 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -385,7 +385,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, 
short thickness)
   Object *ob = draw_ctx->obact;
 
   tGPspoint *points = gpd->runtime.sbuffer;
-  int totpoints = gpd->runtime.sbuffer_size;
+  int totpoints = gpd->runtime.sbuffer_used;
   /* if cyclic needs more vertex */
   int cyclic_add = (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC) ? 1 : 0;
   int totvertex = totpoints + cyclic_add + 2;
@@ -487,7 +487,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short 
thickness)
   Object *ob = draw_ctx->obact;
 
   tGPspoint *points = gpd->runtime.sbuffer;
-  int totpoints = gpd->runtime.sbuffer_size;
+  int totpoints = gpd->runtime.sbuffer_used;
 
   static GPUVertFormat format = {0};
   static uint pos_id, color_id, thickness_id, uvdata_id, prev_pos_id;
@@ -631,7 +631,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd)
   }
 
   const tGPspoint *points = gpd->runtime.sbuffer;
-  int totpoints = gpd->runtime.sbuffer_size;
+  int totpoints = gpd->runtime.sbuffer_used;
   if (totpoints < 3) {
 return NULL;
   }
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index a743e20245d..4b533fd94ef 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1433,7 +1433,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data,
   /* Check if may need to draw the active stroke cache, only if this layer is 
the active layer
* that is being edited. (Stroke buffer is currently stored in gp-data)
*/
-  if (gpd->runtime.sbuffer_size > 0) {
+  if (gpd->runtime.sbuffer_used > 0) {
 if ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) {
   /* It should also be noted that sbuffer contains temporary point types
* i.e. tGPspoints NOT bGPDspoints
@@ -1446,7 +1446,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data,
   stl->storage->alignment_mode = (gp_style) ? gp_style->alignment_mode : 
GP_STYLE_FOLLOW_PATH;
 
   /* if only one point, don't need to draw buffer because the user has no 
time to see it */
-  if (gpd->runtime.sbuffer_size > 1) {
+  if (gpd->runtime.sbuffer_used > 1) {
 if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) {
   stl->g_data->shgrps_drawing_stroke = gpencil_shgroup_stroke_create(
   vedata,
@@ -1502,7 +1502,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data,
 DRW_shgroup_call(
 stl->g_data->shgrps_drawing_stroke, 
stl->g_data->batch_buffer_stroke, NULL);
 
-if ((gpd->runtime.sbuffer_size >= 3) &&
+if ((gpd->runtime.sbuffer_used >= 3) &&
 

[Bf-blender-cvs] [8742dedaabb] greasepencil-object: GPencil: Fix possible memory leak in function

2019-07-09 Thread Antonioya
Commit: 8742dedaabb103803837348c4a46a4e6fcd243bb
Author: Antonioya
Date:   Tue Jul 9 22:44:26 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB8742dedaabb103803837348c4a46a4e6fcd243bb

GPencil: Fix possible memory leak in function

The function exit before the END_ITER

===

M   source/blender/blenkernel/intern/gpencil.c

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index cbc21c90146..99f9419de9f 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2120,16 +2120,17 @@ static void gpencil_add_new_points(bGPDstroke *gps, 
float *coord_array, int init
 /* Helper function to get the first collection that includes the object */
 static Collection *gpencil_get_parent_collection(Scene *scene, Object *ob)
 {
+  Collection *mycol = NULL;
   FOREACH_SCENE_COLLECTION_BEGIN (scene, collection) {
 for (CollectionObject *cob = collection->gobject.first; cob; cob = 
cob->next) {
-  if (cob->ob == ob) {
-return collection;
+  if ((mycol == NULL) && (cob->ob == ob)) {
+mycol = collection;
   }
 }
   }
   FOREACH_SCENE_COLLECTION_END;
 
-  return NULL;
+  return mycol;
 }
 
 /* Convert a curve to grease pencil stroke.

___
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   >