[Bf-blender-cvs] [4b93cdc98a5] greasepencil-edit-curve: Merge branch 'master' into greasepencil-edit-curve

Antonio Vazquez noreply at git.blender.org
Wed Aug 12 22:58:09 CEST 2020


Commit: 4b93cdc98a5a8df681ea6233f948caf896a54406
Author: Antonio Vazquez
Date:   Wed Aug 12 22:57:46 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB4b93cdc98a5a8df681ea6233f948caf896a54406

Merge branch 'master' into greasepencil-edit-curve

 Conflicts:
	source/blender/blenkernel/intern/gpencil_curve.c

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



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

diff --cc source/blender/blenkernel/BKE_gpencil_curve.h
index 6a9271700e8,9a5950bcfab..b68fac23f56
--- a/source/blender/blenkernel/BKE_gpencil_curve.h
+++ b/source/blender/blenkernel/BKE_gpencil_curve.h
@@@ -40,21 -37,9 +40,22 @@@ void BKE_gpencil_convert_curve(struct M
                                 struct Object *ob_cu,
                                 const bool gpencil_lines,
                                 const bool use_collections,
-                                const bool only_stroke);
+                                const float scale_thickness,
+                                const float sample);
  
 +struct bGPDcurve *BKE_gpencil_stroke_editcurve_generate(struct bGPDstroke *gps,
 +                                                        float error_threshold);
 +void BKE_gpencil_stroke_editcurve_update(struct bGPDstroke *gps, float error_threshold);
 +void BKE_gpencil_editcurve_stroke_sync_selection(struct bGPDstroke *gps, struct bGPDcurve *gpc);
 +void BKE_gpencil_stroke_editcurve_sync_selection(struct bGPDstroke *gps, struct bGPDcurve *gpc);
 +void BKE_gpencil_strokes_selected_update_editcurve(struct bGPdata *gpd);
 +void BKE_gpencil_strokes_selected_sync_selection_editcurve(struct bGPdata *gpd);
 +void BKE_gpencil_stroke_update_geometry_from_editcurve(struct bGPDstroke *gps,
 +                                                       const uint resolution,
 +                                                       bool is_adaptive);
 +void BKE_gpencil_editcurve_recalculate_handles(struct bGPDstroke *gps);
 +void BKE_gpencil_editcurve_subdivide(struct bGPDstroke *gps, const int cuts);
 +
  #ifdef __cplusplus
  }
  #endif
diff --cc source/blender/blenkernel/intern/gpencil_curve.c
index eb22927a731,c2cf54adca7..79c41c7c713
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@@ -49,26 -47,34 +49,42 @@@
  #include "BKE_material.h"
  #include "BKE_object.h"
  
 +#include "curve_fit_nd.h"
 +
  #include "DEG_depsgraph_query.h"
  
 +#define COORD_FITTING_INFLUENCE 20.0f
 +
 +/* -------------------------------------------------------------------- */
 +/** \name Convert to curve object
 + * \{ */
 +
  /* Helper: Check materials with same color. */
- static int gpencil_check_same_material_color(Object *ob_gp, const float color[4], Material **r_mat)
+ static int gpencil_check_same_material_color(Object *ob_gp,
+                                              const float color_stroke[4],
+                                              const float color_fill[4],
+                                              const bool do_fill,
+                                              const bool do_stroke,
+                                              Material **r_mat)
  {
+   int index = -1;
    Material *ma = NULL;
+   *r_mat = NULL;
    float color_cu[4];
-   copy_v4_v4(color_cu, color);
+   float hsv_stroke[4], hsv_fill[4];
+ 
+   copy_v4_v4(color_cu, color_stroke);
+   zero_v3(hsv_stroke);
+   rgb_to_hsv_v(color_cu, hsv_stroke);
+   hsv_stroke[3] = color_stroke[3];
+ 
+   copy_v4_v4(color_cu, color_fill);
+   zero_v3(hsv_fill);
+   rgb_to_hsv_v(color_cu, hsv_fill);
+   hsv_fill[3] = color_fill[3];
  
-   float hsv1[4];
-   rgb_to_hsv_v(color_cu, hsv1);
-   hsv1[3] = color[3];
+   bool match_stroke = false;
+   bool match_fill = false;
  
    for (int i = 1; i <= ob_gp->totcol; i++) {
      ma = BKE_object_material_get(ob_gp, i);
@@@ -393,19 -445,12 +455,23 @@@ static void gpencil_convert_spline(Mai
      BKE_gpencil_stroke_close(gps);
    }
  
+   if (sample > 0.0f) {
+     BKE_gpencil_stroke_sample(gps, sample, false);
+   }
+ 
    /* Recalc fill geometry. */
 -  BKE_gpencil_stroke_geometry_update(gps);
 +  BKE_gpencil_stroke_geometry_update(gpd, gps);
 +}
 +
 +static void gpencil_editstroke_deselect_all(bGPDcurve *gpc)
 +{
 +  for (int i = 0; i < gpc->tot_curve_points; i++) {
 +    bGPDcurve_point *gpc_pt = &gpc->curve_points[i];
 +    BezTriple *bezt = &gpc_pt->bezt;
 +    gpc_pt->flag &= ~GP_CURVE_POINT_SELECT;
 +    BEZT_DESEL_ALL(bezt);
 +  }
 +  gpc->flag &= ~GP_CURVE_SELECT;
  }
  
  /**



More information about the Bf-blender-cvs mailing list