[Bf-blender-cvs] [d14017cdcba] sculpt-mode-features: View Navigation: 2D viewport zooming

2019-03-30 Thread Pablo Dobarro
Commit: d14017cdcba43df7bfb5b5ef52145e2ed60b60cc
Author: Pablo Dobarro
Date:   Sat Mar 30 21:27:56 2019 +0100
Branches: sculpt-mode-features
https://developer.blender.org/rBd14017cdcba43df7bfb5b5ef52145e2ed60b60cc

View Navigation: 2D viewport zooming

This implements the same concept of 2D viewport panning but for zooming.
It prevents unexpected zoom speeds when working with a pen tablet.
Zoom speed is constant and it is based on the initial distance to the
working area. Speed parameters are hardcoded for now, but they can be
exposed as options or replaced by a variable zoom speed.
I also reduced the rotation speed when 2D viewport panning is enabled
for consistency.
This navigation mode is enabled by activating 2D viewport panning in the
navigation preferences. That option should be renamed in the future.
Enabling and disabling perspective is broken most of the time, but it
also happens in master. I'm not sure if these changes are making the
problem worse.

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_edit.c 
b/source/blender/editors/space_view3d/view3d_edit.c
index 30756b671ae..9c57975ba8b 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -162,6 +162,7 @@ typedef struct ViewOpsData {
float trackvec[3];
/** Dolly only. */
float mousevec[3];
+   float viewpos[3];
} init;
 
/** Previous state (previous modal event handled). */
@@ -511,6 +512,8 @@ static void viewops_data_create(
if (rv3d->persmat[2][1] < 0.0f)
vod->reverse = -1.0f;
 
+   copy_v3_v3(vod->init.viewpos, rv3d->viewinv[3]);
+
rv3d->rflag |= RV3D_NAVIGATING;
 }
 
@@ -728,6 +731,10 @@ static void viewrotate_apply(ViewOpsData *vod, const int 
event_xy[2])
 
angle = (len_v3(dvec) / (2.0f * TRACKBALLSIZE)) * (float)M_PI;
 
+   if (U.uiflag2 & USER_2D_VIEWPORT_PANNING) {
+   angle *= 0.6f;
+   }
+
/* Allow for rotation beyond the interval [-pi, pi] */
angle = angle_wrap_rad(angle);
 
@@ -2051,25 +2058,61 @@ static void viewzoom_apply_3d(
float zfac;
float dist_range[2];
 
-   ED_view3d_dist_range_get(vod->v3d, dist_range);
+   float center[3], new_ofs[3], vt[3], view_dir[3];
+   float center_dist, event_dist, zf, new_dist, ft;
 
-   zfac = viewzoom_scale_value_offset(
-  >ar->winrct, viewzoom, zoom_invert, false,
-  xy, vod->init.event_xy, vod->init.event_xy_offset,
-  vod->rv3d->dist, vod->init.dist,
-  >prev.time);
+   ED_view3d_dist_range_get(vod->v3d, dist_range);
 
-   if (zfac != 1.0f) {
-   const float zfac_min = dist_range[0] / vod->rv3d->dist;
-   const float zfac_max = dist_range[1] / vod->rv3d->dist;
-   CLAMP(zfac, zfac_min, zfac_max);
+   if (U.uiflag2 & USER_2D_VIEWPORT_PANNING) {
+   view3d_orbit_calc_center(vod->C, center);
+   center_dist = len_v3v3(center, vod->init.viewpos);
 
-   view_zoom_to_window_xy_3d(
-   vod->ar, zfac, zoom_to_pos ? vod->prev.event_xy : NULL);
+   if (U.uiflag & USER_ZOOM_HORIZ) {
+   event_dist = vod->init.event_xy[0] - xy[0];
+   event_dist = event_dist / vod->ar->sizex;
+   }
+   else {
+   event_dist = vod->init.event_xy[1] - xy[1];
+   event_dist = event_dist / vod->ar->sizey;
+   }
+   event_dist = event_dist * 400;
+
+   copy_v3_v3(view_dir, vod->rv3d->viewinv[2]);
+   mul_v3_fl(view_dir, -1.0f);
+   normalize_v3(view_dir);
+   zf = 0.005f * center_dist;
+   CLAMP(zf, 0, 0.05f);
+   if (vod->rv3d->is_persp) {
+   mul_v3_v3fl(vt, view_dir, event_dist * zf);
+   copy_v3_v3(new_ofs, vod->init.ofs);
+   add_v3_v3(new_ofs, vt);
+   copy_v3_v3(vod->rv3d->ofs, new_ofs);
+   }
+   else {
+   ft = event_dist * zf * 2.0f;
+   new_dist =  vod->init.dist + ft;
+   vod->rv3d->dist = new_dist;
+   }
}
+   else {
+   zfac = viewzoom_scale_value_offset(
+  >ar->winrct, viewzoom, zoom_invert, false,
+  xy, vod->init.event_xy, vod->init.event_xy_offset,
+  vod->rv3d->dist, vod->init.dist,
+  >prev.time);
+
+   if (zfac != 1.0f) {
+   const float 

[Bf-blender-cvs] [700346d377d] master: Fix T63137: crash pressing enter to confirm menu, after recent changes.

2019-03-30 Thread Brecht Van Lommel
Commit: 700346d377dd288ededc20b636162e28496fa84c
Author: Brecht Van Lommel
Date:   Sat Mar 30 20:30:35 2019 +0100
Branches: master
https://developer.blender.org/rB700346d377dd288ededc20b636162e28496fa84c

Fix T63137: crash pressing enter to confirm menu, after recent changes.

===

M   source/blender/editors/interface/interface_handlers.c

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index ebd263e9f99..2641b28554c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -9259,7 +9259,7 @@ static int ui_handle_menu_event(
else if (ELEM(event->type, RETKEY, PADENTER) && 
event->val == KM_PRESS) {
uiBut *but_default = 
ui_region_find_first_but_test_flag(ar, UI_BUT_ACTIVE_DEFAULT, UI_HIDDEN);
if ((but_default != NULL) && 
(but_default->active == NULL)) {
-   if (but->type == UI_BTYPE_BUT) {
+   if (but_default->type == UI_BTYPE_BUT) {
UI_but_execute(C, but_default);
}
else {

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


[Bf-blender-cvs] [2c5a9192129] master: Cleanup: remove unused modifier methods.

2019-03-30 Thread Brecht Van Lommel
Commit: 2c5a91921293325696c34e56755c85126ee0760f
Author: Brecht Van Lommel
Date:   Sat Mar 30 19:16:44 2019 +0100
Branches: master
https://developer.blender.org/rB2c5a91921293325696c34e56755c85126ee0760f

Cleanup: remove unused modifier methods.

===

M   source/blender/blenkernel/BKE_modifier.h
M   source/blender/modifiers/intern/MOD_armature.c
M   source/blender/modifiers/intern/MOD_array.c
M   source/blender/modifiers/intern/MOD_bevel.c
M   source/blender/modifiers/intern/MOD_boolean.c
M   source/blender/modifiers/intern/MOD_build.c
M   source/blender/modifiers/intern/MOD_cast.c
M   source/blender/modifiers/intern/MOD_cloth.c
M   source/blender/modifiers/intern/MOD_collision.c
M   source/blender/modifiers/intern/MOD_correctivesmooth.c
M   source/blender/modifiers/intern/MOD_curve.c
M   source/blender/modifiers/intern/MOD_datatransfer.c
M   source/blender/modifiers/intern/MOD_decimate.c
M   source/blender/modifiers/intern/MOD_displace.c
M   source/blender/modifiers/intern/MOD_dynamicpaint.c
M   source/blender/modifiers/intern/MOD_edgesplit.c
M   source/blender/modifiers/intern/MOD_explode.c
M   source/blender/modifiers/intern/MOD_fluidsim.c
M   source/blender/modifiers/intern/MOD_hook.c
M   source/blender/modifiers/intern/MOD_laplaciandeform.c
M   source/blender/modifiers/intern/MOD_laplaciansmooth.c
M   source/blender/modifiers/intern/MOD_lattice.c
M   source/blender/modifiers/intern/MOD_mask.c
M   source/blender/modifiers/intern/MOD_meshcache.c
M   source/blender/modifiers/intern/MOD_meshdeform.c
M   source/blender/modifiers/intern/MOD_meshsequencecache.c
M   source/blender/modifiers/intern/MOD_mirror.c
M   source/blender/modifiers/intern/MOD_multires.c
M   source/blender/modifiers/intern/MOD_none.c
M   source/blender/modifiers/intern/MOD_normal_edit.c
M   source/blender/modifiers/intern/MOD_ocean.c
M   source/blender/modifiers/intern/MOD_particleinstance.c
M   source/blender/modifiers/intern/MOD_particlesystem.c
M   source/blender/modifiers/intern/MOD_remesh.c
M   source/blender/modifiers/intern/MOD_screw.c
M   source/blender/modifiers/intern/MOD_shapekey.c
M   source/blender/modifiers/intern/MOD_shrinkwrap.c
M   source/blender/modifiers/intern/MOD_simpledeform.c
M   source/blender/modifiers/intern/MOD_skin.c
M   source/blender/modifiers/intern/MOD_smoke.c
M   source/blender/modifiers/intern/MOD_smooth.c
M   source/blender/modifiers/intern/MOD_softbody.c
M   source/blender/modifiers/intern/MOD_solidify.c
M   source/blender/modifiers/intern/MOD_subsurf.c
M   source/blender/modifiers/intern/MOD_surface.c
M   source/blender/modifiers/intern/MOD_surfacedeform.c
M   source/blender/modifiers/intern/MOD_triangulate.c
M   source/blender/modifiers/intern/MOD_uvproject.c
M   source/blender/modifiers/intern/MOD_uvwarp.c
M   source/blender/modifiers/intern/MOD_warp.c
M   source/blender/modifiers/intern/MOD_wave.c
M   source/blender/modifiers/intern/MOD_weighted_normal.c
M   source/blender/modifiers/intern/MOD_weightvgedit.c
M   source/blender/modifiers/intern/MOD_weightvgmix.c
M   source/blender/modifiers/intern/MOD_weightvgproximity.c
M   source/blender/modifiers/intern/MOD_wireframe.c

===

diff --git a/source/blender/blenkernel/BKE_modifier.h 
b/source/blender/blenkernel/BKE_modifier.h
index 683c932731d..a375ed3044c 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -28,7 +28,6 @@ struct BMEditMesh;
 struct CustomData_MeshMasks;
 struct DepsNodeHandle;
 struct Depsgraph;
-struct DerivedMesh;
 struct ID;
 struct ListBase;
 struct Main;
@@ -155,17 +154,6 @@ typedef struct ModifierTypeInfo {
void (*copyData)(const struct ModifierData *md, struct ModifierData 
*target, const int flag);
 
 
-   /* Deform modifier functions */ 
/* DEPRECATED */
-
-   void (*deformVerts_DM_removed)(void);
-   void (*deformMatrices_DM_removed)(void);
-   void (*deformVertsEM_DM_removed)(void);
-   void (*deformMatricesEM_DM_removed)(void);
-
-   /* Non-deform modifier functions 
*/ /* DEPRECATED */
-
-   void (*applyModifier_DM_removed)(void);
-
/* Deform modifier functions */
 
/* Only for deform types, should apply the deformation
diff --git a/source/blender/modifiers/intern/MOD_armature.c 
b/source/blender/modifiers/intern/MOD_armature.c
index acd4573ec44..bc933e9b6ba 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -182,12 +182,6 @@ ModifierTypeInfo modifierType_Armature = {
 
/* copyData 

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

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

GPencil: Uses same random seed for render in Noise modifier

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

===

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

===

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

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


[Bf-blender-cvs] [4b6a4b5bc25] master: GPencil: Fix segment fault when use F3 search menu.

2019-03-30 Thread Author Name
Commit: 4b6a4b5bc25bce10367dffadf7718e373f81f299
Author: Author Name
Date:   Sat Mar 30 16:03:39 2019 +0100
Branches: master
https://developer.blender.org/rB4b6a4b5bc25bce10367dffadf7718e373f81f299

GPencil: Fix segment fault when use F3 search menu.

Author of the patch: Robert Guetzkow (@rjg)

===

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 2d5ec4c5055..e3d57149d0f 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -176,7 +176,7 @@ static bool gp_data_unlink_poll(bContext *C)
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
 
/* only unlink annotation datablocks */
-   if (gpd_ptr != NULL) {
+   if ((gpd_ptr != NULL) && (*gpd_ptr != NULL)) {
bGPdata *gpd = (*gpd_ptr);
if ((gpd->flag & GP_DATA_ANNOTATIONS) == 0) {
return false;

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


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

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

Merge branch 'master' into greasepencil-object

===



===

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

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


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

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

GPencil: Improve soft eraser for low pressure strokes

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

===

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

===

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

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


[Bf-blender-cvs] [de0dab66ff8] master: Fix T63086: Navigation problem with Background/Reference Images

2019-03-30 Thread Sebastian Parborg
Commit: de0dab66ff896992251763d6e799cc682ff03543
Author: Sebastian Parborg
Date:   Sat Mar 30 08:21:09 2019 +0100
Branches: master
https://developer.blender.org/rBde0dab66ff896992251763d6e799cc682ff03543

Fix T63086: Navigation problem with Background/Reference Images

The issue was the manipulated depth for images would be used when doing 
distance depth checks.
Now we will use the actual depth of the image object when doing such tests.

Reviewed By: Clément Foucault

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

===

M   source/blender/draw/modes/object_mode.c

===

diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index bce68623536..3cb3d28a29c 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -945,12 +945,21 @@ static void DRW_shgroup_empty_image(
float image_aspect[2];
image_calc_aspect(ob->data, size, image_aspect);
 
+   char depth_mode;
+   if (DRW_state_is_depth()) {
+   /* Use the actual depth if we are doing depth tests to 
determine the distance to the object */
+   depth_mode = OB_EMPTY_IMAGE_DEPTH_DEFAULT;
+   }
+   else {
+   depth_mode = ob->empty_image_depth;
+   }
+
{
DRWShadingGroup *grp = 
DRW_shgroup_create(sh_data->object_empty_image_wire, sgl->non_meshes);
/* TODO(fclem) implement DRW_shgroup_uniform_vec2_copy */
DRW_shgroup_uniform_float_copy(grp, "aspectX", image_aspect[0]);
DRW_shgroup_uniform_float_copy(grp, "aspectY", image_aspect[1]);
-   DRW_shgroup_uniform_int_copy(grp, "depthMode", 
ob->empty_image_depth);
+   DRW_shgroup_uniform_int_copy(grp, "depthMode", depth_mode);
DRW_shgroup_uniform_float(grp, "size", >empty_drawsize, 1);
DRW_shgroup_uniform_vec2(grp, "offset", ob->ima_ofs, 1);
DRW_shgroup_uniform_vec3(grp, "color", color, 1);
@@ -969,7 +978,7 @@ static void DRW_shgroup_empty_image(
  (use_alpha_blend) ? 
sgl->image_empties : sgl->non_meshes);
DRW_shgroup_uniform_float_copy(grp, "aspectX", image_aspect[0]);
DRW_shgroup_uniform_float_copy(grp, "aspectY", image_aspect[1]);
-   DRW_shgroup_uniform_int_copy(grp, "depthMode", 
ob->empty_image_depth);
+   DRW_shgroup_uniform_int_copy(grp, "depthMode", depth_mode);
DRW_shgroup_uniform_float(grp, "size", >empty_drawsize, 1);
DRW_shgroup_uniform_vec2(grp, "offset", ob->ima_ofs, 1);
DRW_shgroup_uniform_texture(grp, "image", tex);

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