[Bf-blender-cvs] [747d1a8989c] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonio Vazquez
noreply at git.blender.org
Sat Jun 16 20:36:38 CEST 2018
Commit: 747d1a8989c42d0e39236a1577239d2947d13ffd
Author: Antonio Vazquez
Date: Sat Jun 16 19:39:59 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB747d1a8989c42d0e39236a1577239d2947d13ffd
Merge branch 'blender2.8' into greasepencil-object
Conflicts:
source/blender/editors/gpencil/gpencil_brush.c
source/blender/editors/gpencil/gpencil_intern.h
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/gpencil/gpencil_utils.c
===================================================================
===================================================================
diff --cc source/blender/editors/gpencil/gpencil_brush.c
index fa152b8510c,f9284d71db3..d6bec58dfe6
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@@ -44,9 -44,10 +44,11 @@@
#include "BLI_rand.h"
#include "BLI_utildefines.h"
+ #include "PIL_time.h"
+
#include "BLT_translation.h"
+#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
@@@ -1175,18 -1059,17 +1179,23 @@@ static bool gpsculpt_brush_init(bContex
gso = MEM_callocN(sizeof(tGP_BrushEditData), "tGP_BrushEditData");
op->customdata = gso;
+ gso->depsgraph = CTX_data_depsgraph(C);
/* store state */
gso->settings = gpsculpt_get_settings(scene);
- gso->brush = gpsculpt_get_brush(scene);
+ gso->brush = gpsculpt_get_brush(scene, is_weight_mode);
- gso->brush_type = gso->settings->brushtype;
+ if (is_weight_mode) {
+ gso->brush_type = gso->settings->weighttype;
+ }
+ else {
+ gso->brush_type = gso->settings->brushtype;
+ }
+ /* Random generator, only init once. */
+ uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
+ rng_seed ^= GET_UINT_FROM_POINTER(gso);
+ gso->rng = BLI_rng_new(rng_seed);
+
gso->is_painting = false;
gso->first = true;
diff --cc source/blender/editors/gpencil/gpencil_intern.h
index 540d746c1e3,67b88efa285..844f0c12e6c
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@@ -41,15 -39,11 +41,16 @@@
struct bGPdata;
struct bGPDstroke;
struct bGPDspoint;
+struct tGPspoint;
+struct Material;
struct GHash;
+ struct RNG;
+struct Brush;
+struct Scene;
struct ARegion;
+struct View3D;
struct View2D;
struct wmOperatorType;
diff --cc source/blender/editors/gpencil/gpencil_paint.c
index f92dbc31c2e,d536721936d..0a2bf494ea0
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@@ -178,21 -164,14 +178,23 @@@ typedef struct tGPsdata
void *erasercursor; /* radial cursor data for drawing eraser */
- bGPDpalettecolor *palettecolor; /* current palette color */
- bGPDbrush *brush; /* current drawing brush */
+ /* mat settings are only used for 3D view */
+ Material *material; /* current material */
+
+ Brush *brush; /* current drawing brush */
+ Brush *eraser; /* default eraser brush */
short straight[2]; /* 1: line horizontal, 2: line vertical, other: not defined, second element position */
int lock_axis; /* lock drawing to one axis */
+ bool disable_fill; /* the stroke is no fill mode */
+ RNG *rng;
+
short keymodifier; /* key used for invoking the operator */
+ short shift; /* shift modifier flag */
+
+ float totpixlen; /* size in pixels for uv calculation */
+
+ ReportList *reports;
} tGPsdata;
/* ------ */
@@@ -627,11 -550,10 +629,11 @@@ static short gp_stroke_addpoint
else {
pt->pressure = 1.0f;
}
+
/* Apply jitter to position */
- if (brush->draw_jitter > 0.0f) {
+ if ((brush->gpencil_settings->flag & GP_BRUSH_GROUP_RANDOM) && (brush->gpencil_settings->draw_jitter > 0.0f)) {
int r_mval[2];
- gp_brush_jitter(gpd, brush, pt, mval, r_mval);
+ gp_brush_jitter(gpd, brush, pt, mval, r_mval, p->rng);
copy_v2_v2_int(&pt->x, r_mval);
}
else {
@@@ -1880,8 -1585,12 +1882,13 @@@ static tGPsdata *gp_session_initpaint(b
* erase size won't get lost
*/
p->radius = U.gp_eraser;
+#endif
+ /* Random generator, only init once. */
+ uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
+ rng_seed ^= GET_UINT_FROM_POINTER(p);
+ p->rng = BLI_rng_new(rng_seed);
+
/* return context data for running paint operator */
return p;
}
diff --cc source/blender/editors/gpencil/gpencil_utils.c
index eb2688e48d8,4ee3bdd587e..206d2803bac
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@@ -1015,13 -995,13 +1015,13 @@@ void gp_randomize_stroke(bGPDstroke *gp
normalize_v3(ortho);
/* Read all points and apply shift vector (first and last point not modified) */
- for (int i = 1; i < gps->totpoints - 1; ++i) {
+ for (int i = 1; i < gps->totpoints - 1; i++) {
bGPDspoint *pt = &gps->points[i];
/* get vector with shift (apply a division because random is too sensitive */
- const float fac = BLI_rng_get_float(rng) * (brush->draw_random_sub / 10.0f);
+ const float fac = BLI_frand() * (brush->gpencil_settings->draw_random_sub / 10.0f);
float svec[3];
copy_v3_v3(svec, ortho);
- if (BLI_frand() > 0.5f) {
+ if (BLI_rng_get_float(rng) > 0.5f) {
mul_v3_fl(svec, -fac);
}
else {
More information about the Bf-blender-cvs
mailing list