[Bf-blender-cvs] [d2d5d382c56] sculpt-dev: sculpt-dev: Fix bmesh toolflags crash

2022-05-13 Thread Joseph Eagar
Commit: d2d5d382c560bf11d3528b09c36676a79ff22f85
Author: Joseph Eagar
Date:   Fri May 13 23:48:26 2022 -0700
Branches: sculpt-dev
https://developer.blender.org/rBd2d5d382c560bf11d3528b09c36676a79ff22f85

sculpt-dev: Fix bmesh toolflags crash

===

M   source/blender/bmesh/intern/bmesh_mesh.c

===

diff --git a/source/blender/bmesh/intern/bmesh_mesh.c 
b/source/blender/bmesh/intern/bmesh_mesh.c
index b169dd1776e..ef52af37d63 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -85,6 +85,16 @@ void BM_mesh_elem_toolflags_ensure(BMesh *bm)
 {
   BLI_assert(bm->use_toolflags);
 
+  if (!CustomData_has_layer(&bm->vdata, CD_TOOLFLAGS)) {
+if (bm->vtoolflagpool) {
+  printf("%s: Error: toolflags were deallocated improperly\n", __func__);
+
+  BM_mesh_elem_toolflags_clear(bm);
+
+  bm_alloc_toolflags_cdlayers(bm, true);
+}
+  }
+
   if (bm->vtoolflagpool && bm->etoolflagpool && bm->ftoolflagpool) {
 return;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [394bd7fe057] sculpt-dev: Sculpt-dev: Fix crash in bmesh conversion code

2022-05-13 Thread Joseph Eagar
Commit: 394bd7fe05700a30366253cdb8b809dd25632f8d
Author: Joseph Eagar
Date:   Fri May 13 23:34:28 2022 -0700
Branches: sculpt-dev
https://developer.blender.org/rB394bd7fe05700a30366253cdb8b809dd25632f8d

Sculpt-dev: Fix crash in bmesh conversion code

===

M   source/blender/bmesh/intern/bmesh_mesh_convert.cc
M   source/blender/bmesh/intern/bmesh_operator_api.h

===

diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc 
b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
index c7ce47a7eed..4f712ba2159 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@ -407,6 +407,10 @@ void BM_mesh_bm_from_me(Object *ob,
   bm_init_idmap_cdlayers(bm);
 }
 
+if (bm->use_toolflags) {
+  bm_alloc_toolflags_cdlayers(bm, true);
+}
+
 return; /* Sanity check. */
   }
 
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h 
b/source/blender/bmesh/intern/bmesh_operator_api.h
index 35bbb7b222f..7e4e608a8a5 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -6,8 +6,8 @@
  * \ingroup bmesh
  */
 
-#include "BLI_ghash.h"
 #include "BLI_compiler_compat.h"
+#include "BLI_ghash.h"
 
 #include "DNA_meshdata_types.h"

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [da4349c1476] sculpt-dev: Sculpt-dev: fix shapekey undo bug with PBVH_FACES

2022-05-13 Thread Joseph Eagar
Commit: da4349c147646b30cbfe0a78a5095e400cf4b5d7
Author: Joseph Eagar
Date:   Fri May 13 16:53:47 2022 -0700
Branches: sculpt-dev
https://developer.blender.org/rBda4349c147646b30cbfe0a78a5095e400cf4b5d7

Sculpt-dev: fix shapekey undo bug with PBVH_FACES

* Also fixed bug in bmesh conversion code.

===

M   source/blender/bmesh/intern/bmesh_mesh_convert.cc
M   source/blender/editors/mesh/editmesh_utils.c
M   source/blender/editors/sculpt_paint/sculpt_undo.c

===

diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc 
b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
index 91126913e59..c7ce47a7eed 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@ -308,8 +308,21 @@ void BM_mesh_bm_from_me(Object *ob,
 const Mesh *me,
 const struct BMeshFromMeshParams *params)
 {
-  const bool is_new = !(bm->totvert || (bm->vdata.totlayer || 
bm->edata.totlayer ||
-bm->pdata.totlayer || 
bm->ldata.totlayer));
+  static int totlayers = 0;
+
+  for (int i = 0; i < 4; i++) {
+CustomData *cdata = (&bm->vdata) + i;
+
+for (int j = 0; j < cdata->totlayer; j++) {
+  if (cdata->layers[j].type == CD_TOOLFLAGS || cdata->layers[j].type == 
CD_MESH_ID) {
+continue;
+  }
+
+  totlayers++;
+}
+  }
+
+  const bool is_new = !(bm->totvert || totlayers);
   KeyBlock *actkey;
   float(*keyco)[3] = nullptr;
 
diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index a1ea3230ba9..62cf51b0928 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -27,6 +27,7 @@
 #include "BKE_mesh.h"
 #include "BKE_mesh_mapping.h"
 #include "BKE_report.h"
+#include "BKE_pbvh.h"
 
 #include "DEG_depsgraph.h"
 
@@ -304,6 +305,8 @@ void EDBM_mesh_load_ex(Main *bmain, Object *ob, bool 
free_data)
 bm->shapenr = 1;
   }
 
+  BKE_pbvh_invalidate_cache(ob);
+
   BM_mesh_bm_to_me(bmain,
ob,
bm,
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c 
b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 34717fa6bfc..8fc965e32ce 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -19,6 +19,7 @@
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
 
+#include "DNA_key_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
@@ -1716,6 +1717,8 @@ static void sculpt_undo_store_coords(Object *ob, 
SculptUndoNode *unode)
 unode->orig_co = MEM_malloc_arrayN(allvert, sizeof(float) * 3, "sculpt 
unode undo coords");
   }
 
+  bool have_grids = BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS;
+
   BKE_pbvh_vertex_iter_begin (ss->pbvh, unode->node, vd, PBVH_ITER_ALL) {
 copy_v3_v3(unode->co[vd.i], vd.co);
 if (vd.no) {
@@ -1726,9 +1729,15 @@ static void sculpt_undo_store_coords(Object *ob, 
SculptUndoNode *unode)
 }
 
 if (ss->deform_modifiers_active) {
-  SCULPT_orig_vert_data_update(&orig_data, vd.vertex);
+  if (!have_grids && ss->shapekey_active) {
+float(*cos)[3] = ss->shapekey_active->data;
 
-  copy_v3_v3(unode->orig_co[vd.i], orig_data.co);
+copy_v3_v3(unode->orig_co[vd.i], cos[vd.index]);
+  }
+  else {
+MSculptVert *mv = SCULPT_vertex_get_sculptvert(ss, vd.vertex);
+copy_v3_v3(unode->orig_co[vd.i], mv->origco);
+  }
 }
   }
   BKE_pbvh_vertex_iter_end;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e1c8ef551fe] master: Cleanup: Use const arguments

2022-05-13 Thread Hans Goudey
Commit: e1c8ef551fe2c4393d714822e5e74eb153fc7af2
Author: Hans Goudey
Date:   Fri May 13 19:20:55 2022 +0200
Branches: master
https://developer.blender.org/rBe1c8ef551fe2c4393d714822e5e74eb153fc7af2

Cleanup: Use const arguments

===

M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/space_view3d/view3d_project.c

===

diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 48bd86027f9..c6e261549a3 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -443,14 +443,14 @@ void pose_foreachScreenBone(struct ViewContext *vc,
 void ED_view3d_project_float_v2_m4(const struct ARegion *region,
const float co[3],
float r_co[2],
-   float mat[4][4]);
+   const float mat[4][4]);
 /**
  * \note use #ED_view3d_ob_project_mat_get to get projecting mat
  */
 void ED_view3d_project_float_v3_m4(const struct ARegion *region,
const float co[3],
float r_co[3],
-   float mat[4][4]);
+   const float mat[4][4]);
 
 eV3DProjStatus ED_view3d_project_base(const struct ARegion *region, struct 
Base *base);
 
diff --git a/source/blender/editors/space_view3d/view3d_project.c 
b/source/blender/editors/space_view3d/view3d_project.c
index 78b873f533c..e23bb1f7a4f 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -30,7 +30,7 @@
 void ED_view3d_project_float_v2_m4(const ARegion *region,
const float co[3],
float r_co[2],
-   float mat[4][4])
+   const float mat[4][4])
 {
   float vec4[4];
 
@@ -52,7 +52,7 @@ void ED_view3d_project_float_v2_m4(const ARegion *region,
 void ED_view3d_project_float_v3_m4(const ARegion *region,
const float co[3],
float r_co[3],
-   float mat[4][4])
+   const float mat[4][4])
 {
   float vec4[4];

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c2bbd01b2fb] master: Cleanup: Use const arguments

2022-05-13 Thread Hans Goudey
Commit: c2bbd01b2fb0df665102b8dbf14cdc562d37b617
Author: Hans Goudey
Date:   Fri May 13 19:13:31 2022 +0200
Branches: master
https://developer.blender.org/rBc2bbd01b2fb0df665102b8dbf14cdc562d37b617

Cleanup: Use const arguments

===

M   source/blender/blenkernel/BKE_camera.h
M   source/blender/blenkernel/intern/camera.c
M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
M   source/blender/editors/space_view3d/view3d_project.c
M   source/blender/editors/space_view3d/view3d_utils.c

===

diff --git a/source/blender/blenkernel/BKE_camera.h 
b/source/blender/blenkernel/BKE_camera.h
index 57dc1e288dc..e55b8b1a2da 100644
--- a/source/blender/blenkernel/BKE_camera.h
+++ b/source/blender/blenkernel/BKE_camera.h
@@ -79,7 +79,7 @@ typedef struct CameraParams {
 void BKE_camera_params_init(CameraParams *params);
 void BKE_camera_params_from_object(CameraParams *params, const struct Object 
*cam_ob);
 void BKE_camera_params_from_view3d(CameraParams *params,
-   struct Depsgraph *depsgraph,
+   const struct Depsgraph *depsgraph,
const struct View3D *v3d,
const struct RegionView3D *rv3d);
 
diff --git a/source/blender/blenkernel/intern/camera.c 
b/source/blender/blenkernel/intern/camera.c
index 32925168437..b59e44aae8a 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -302,7 +302,7 @@ void BKE_camera_params_from_object(CameraParams *params, 
const Object *cam_ob)
 }
 
 void BKE_camera_params_from_view3d(CameraParams *params,
-   Depsgraph *depsgraph,
+   const Depsgraph *depsgraph,
const View3D *v3d,
const RegionView3D *rv3d)
 {
diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 414643dd0d6..48bd86027f9 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -700,9 +700,9 @@ void ED_view3d_win_to_vector(const struct ARegion *region, 
const float mval[2],
  * \param do_clip_planes: Optionally clip the ray by the view clipping planes.
  * \return success, false if the segment is totally clipped.
  */
-bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
+bool ED_view3d_win_to_segment_clipped(const struct Depsgraph *depsgraph,
   const struct ARegion *region,
-  struct View3D *v3d,
+  const struct View3D *v3d,
   const float mval[2],
   float r_ray_start[3],
   float r_ray_end[3],
@@ -733,7 +733,7 @@ void ED_view3d_dist_range_get(const struct View3D *v3d, 
float r_dist_range[2]);
 /**
  * \note copies logic of #ED_view3d_viewplane_get(), keep in sync.
  */
-bool ED_view3d_clip_range_get(struct Depsgraph *depsgraph,
+bool ED_view3d_clip_range_get(const struct Depsgraph *depsgraph,
   const struct View3D *v3d,
   const struct RegionView3D *rv3d,
   float *r_clipsta,
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
index 89470772e1c..dee9615ce76 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
@@ -41,9 +41,9 @@ static std::optional find_curves_brush_position(const 
CurvesGeometry &cu
 const float3 
&ray_start_cu,
 const float3 
&ray_end_cu,
 const float 
brush_radius_re,
-ARegion ®ion,
-RegionView3D &rv3d,
-Object &object)
+const ARegion ®ion,
+const RegionView3D 
&rv3d,
+const Object &object)
 {
   /* This value might have to be adjusted based on user feedback. */
   const float brush_inner_radius_re = std::min(brush_radius_re, 
(float)UI_UNIT_X / 3.0f);
@@ -146,14 +146,14 @@ std::optional 
sample_curves_3d_brush(bContext &C,
 const float2 &brush_pos_re,
   

[Bf-blender-cvs] [7c9b6cc3802] master: LineArt: Better behavior of smooth tolerance.

2022-05-13 Thread YimingWu
Commit: 7c9b6cc3802982bfb7a13aed37d4a032d9166fbc
Author: YimingWu
Date:   Sat May 14 00:55:18 2022 +0800
Branches: master
https://developer.blender.org/rB7c9b6cc3802982bfb7a13aed37d4a032d9166fbc

LineArt: Better behavior of smooth tolerance.

This fixes the smooth tolerance feature in master where sometimes you could
get over simplified chains and lose the shape it's supposed to be originally.

Reviewed By: Sebastian Parborg (zeddb)

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

===

M   source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c

===

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index b666eb677eb..d7b370ef5e5 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@ -971,27 +971,67 @@ void MOD_lineart_chain_clear_picked_flag(LineartCache *lc)
 void MOD_lineart_smooth_chains(LineartRenderBuffer *rb, float tolerance)
 {
   LISTBASE_FOREACH (LineartEdgeChain *, ec, &rb->chains) {
-LineartEdgeChainItem *next_eci;
-for (LineartEdgeChainItem *eci = ec->chain.first; eci; eci = next_eci) {
-  next_eci = eci->next;
-  LineartEdgeChainItem *eci2, *eci3, *eci4;
-
-  /* Not enough point to do simplify. */
-  if ((!(eci2 = eci->next)) || (!(eci3 = eci2->next))) {
-continue;
-  }
-
-  /* No need to care for different line types/occlusion and so on, because 
at this stage they
-   * are all the same within a chain. */
-
-  /* If p3 is within the p1-p2 segment of a width of "tolerance". */
-  if (dist_to_line_segment_v2(eci3->pos, eci->pos, eci2->pos) < tolerance) 
{
-/* And if p4 is on the extension of p1-p2 , we remove p3. */
-if ((eci4 = eci3->next) && (dist_to_line_v2(eci4->pos, eci->pos, 
eci2->pos) < tolerance)) {
-  BLI_remlink(&ec->chain, eci3);
-  next_eci = eci;
+/* Go through the chain two times, once from each direction. */
+for (int times = 0; times < 2; times++) {
+  for (LineartEdgeChainItem *eci = ec->chain.first, *next_eci = eci->next; 
eci;
+   eci = next_eci) {
+LineartEdgeChainItem *eci2, *eci3, *eci4;
+
+if ((!(eci2 = eci->next)) || (!(eci3 = eci2->next))) {
+  /* Not enough points to simplify. */
+  next_eci = eci->next;
+  continue;
 }
+/* No need to care for different line types/occlusion and so on, 
because at this stage they
+ * are all the same within a chain.
+ *
+ * We need to simplify a chain from this:
+ * 1---2
+ *3---4
+ * to this:
+ * 1---2--_
+ * `--4 */
+
+/* If p3 is within the p1-p2 segment of a width of "tolerance", in 
other words, p3 is
+ * approximately on the segment of p1-p2. */
+if (dist_to_line_segment_v2(eci3->pos, eci->pos, eci2->pos) < 
tolerance) {
+  float vec2[2], vec3[2], v2n[2], ratio, len2;
+  sub_v2_v2v2(vec2, eci2->pos, eci->pos);
+  sub_v2_v2v2(vec3, eci3->pos, eci->pos);
+  normalize_v2_v2(v2n, vec2);
+  ratio = dot_v2v2(v2n, vec3);
+  len2 = len_v2(vec2);
+  /* Because this smoothing applies on geometries of different scales 
in the same scene,
+   * some small scale features (e.g. the "tails" on the inner ring of 
a torus geometry)
+   * could be completely erased if the tolerance value is set for 
accomondating the entire
+   * scene. Those situations typically result in (ratio << 0), looks 
like this:
+   * 1---2
+   * 3---4
+   * (this sort of long zig zag obviously are "features" that can't be 
erased)
+   * setting a ratio of -10 turned out to be a reasonabe threshold in 
tests. */
+  if (ratio < len2 && ratio > -len2 * 10) {
+/* We only remove p3 if p4 is on the extension of p1->p2. */
+if ((eci4 = eci3->next) &&
+(dist_to_line_v2(eci4->pos, eci->pos, eci2->pos) < tolerance)) 
{
+  BLI_remlink(&ec->chain, eci3);
+  next_eci = eci;
+  continue;
+}
+if (!eci4) {
+  /* See if the last segment's direction is reversed, if so remove 
that.
+   * Basically we don't need to preserve p3 if the entire chain 
looked like this:
+   * ...13===2 */
+  if (len_v2(vec2) > len_v2(vec3)) {
+BLI_remlink(&ec->chain, eci3);
+  }
+  next_eci = NULL;
+  continue;
+}
+  }
+}
+next_eci = eci->next;
   }
+  BLI_listbase_re

[Bf-blender-cvs] [ee363ee7b3a] master: Cleanup: Use standard variable names for curves

2022-05-13 Thread Hans Goudey
Commit: ee363ee7b3a26e3236f2107b8a8324877404db04
Author: Hans Goudey
Date:   Fri May 13 18:44:09 2022 +0200
Branches: master
https://developer.blender.org/rBee363ee7b3a26e3236f2107b8a8324877404db04

Cleanup: Use standard variable names for curves

===

M   source/blender/blenkernel/intern/curve_eval.cc
M   source/blender/blenkernel/intern/curves.cc
M   source/blender/blenkernel/intern/geometry_component_curves.cc
M   source/blender/editors/sculpt_paint/curves_sculpt_delete.cc
M   source/blender/geometry/intern/point_merge_by_distance.cc
M   source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc

===

diff --git a/source/blender/blenkernel/intern/curve_eval.cc 
b/source/blender/blenkernel/intern/curve_eval.cc
index c507e7934a8..dd2bd982506 100644
--- a/source/blender/blenkernel/intern/curve_eval.cc
+++ b/source/blender/blenkernel/intern/curve_eval.cc
@@ -373,15 +373,15 @@ static void copy_attributes_between_components(const 
GeometryComponent &src_comp
   });
 }
 
-std::unique_ptr curves_to_curve_eval(const Curves &curves)
+std::unique_ptr curves_to_curve_eval(const Curves &curves_id)
 {
   CurveComponent src_component;
-  src_component.replace(&const_cast(curves), 
GeometryOwnershipType::ReadOnly);
-  const blender::bke::CurvesGeometry &geometry = 
blender::bke::CurvesGeometry::wrap(
-  curves.geometry);
+  src_component.replace(&const_cast(curves_id), 
GeometryOwnershipType::ReadOnly);
+  const blender::bke::CurvesGeometry &curves = 
blender::bke::CurvesGeometry::wrap(
+  curves_id.geometry);
 
-  VArray resolution = geometry.resolution();
-  VArray normal_mode = geometry.normal_mode();
+  VArray resolution = curves.resolution();
+  VArray normal_mode = curves.normal_mode();
 
   VArray_Span nurbs_weights{
   src_component.attribute_get_for_read("nurbs_weight", 
ATTR_DOMAIN_POINT, 0.0f)};
@@ -396,34 +396,34 @@ std::unique_ptr curves_to_curve_eval(const 
Curves &curves)
   src_component.attribute_get_for_read("handle_type_left", 
ATTR_DOMAIN_POINT, 0)};
 
   /* Create splines with the correct size and type. */
-  VArray curve_types = geometry.curve_types();
+  VArray curve_types = curves.curve_types();
   std::unique_ptr curve_eval = std::make_unique();
   for (const int curve_index : curve_types.index_range()) {
-const IndexRange point_range = geometry.points_for_curve(curve_index);
+const IndexRange points = curves.points_for_curve(curve_index);
 
 std::unique_ptr spline;
 /* #CurveEval does not support catmull rom curves, so convert those to 
poly splines. */
 switch (std::max(1, curve_types[curve_index])) {
   case CURVE_TYPE_POLY: {
 spline = std::make_unique();
-spline->resize(point_range.size());
+spline->resize(points.size());
 break;
   }
   case CURVE_TYPE_BEZIER: {
 std::unique_ptr bezier_spline = 
std::make_unique();
-bezier_spline->resize(point_range.size());
+bezier_spline->resize(points.size());
 bezier_spline->set_resolution(resolution[curve_index]);
-
bezier_spline->handle_types_left().copy_from(handle_types_left.slice(point_range));
-
bezier_spline->handle_types_right().copy_from(handle_types_right.slice(point_range));
+
bezier_spline->handle_types_left().copy_from(handle_types_left.slice(points));
+
bezier_spline->handle_types_right().copy_from(handle_types_right.slice(points));
 
 spline = std::move(bezier_spline);
 break;
   }
   case CURVE_TYPE_NURBS: {
 std::unique_ptr nurb_spline = 
std::make_unique();
-nurb_spline->resize(point_range.size());
+nurb_spline->resize(points.size());
 nurb_spline->set_resolution(resolution[curve_index]);
-nurb_spline->weights().copy_from(nurbs_weights.slice(point_range));
+nurb_spline->weights().copy_from(nurbs_weights.slice(points));
 nurb_spline->set_order(nurbs_orders[curve_index]);
 nurb_spline->knots_mode = 
static_cast(nurbs_knots_modes[curve_index]);
 
@@ -463,14 +463,14 @@ std::unique_ptr curves_to_curve_eval(const 
Curves &curves)
 
 Curves *curve_eval_to_curves(const CurveEval &curve_eval)
 {
-  Curves *curves = 
blender::bke::curves_new_nomain(curve_eval.total_control_point_num(),
-   
curve_eval.splines().size());
+  Curves *curves_id = 
blender::bke::curves_new_nomain(curve_eval.total_control_point_num(),
+  
curve_eval.splines().size());
   CurveComponent dst_component;
-  dst_component.replace(curves, GeometryOwnershipType::Editable);
+  dst_component.replace(curves_id, GeometryOwnershipType::Editable);
 
-  blender::bke::CurvesGeometry &geometry = 
blender::bke::CurvesGeometry::wrap(curves->geometry);
-  geometry.offsets_for_write().copy_from(curv

[Bf-blender-cvs] [cf69652618f] master: Cleanup: Use const when retrieving custom data layers

2022-05-13 Thread Hans Goudey
Commit: cf69652618fefcd22b2cde9a2e0338b63f9a003e
Author: Hans Goudey
Date:   Fri May 13 18:31:29 2022 +0200
Branches: master
https://developer.blender.org/rBcf69652618fefcd22b2cde9a2e0338b63f9a003e

Cleanup: Use const when retrieving custom data layers

Knowing when layers are retrieved for write access will be essential
when adding proper copy-on-write support. This commit makes that
clearer by adding `const` where the retrieved data is not modified.

Ref T95842

===

M   source/blender/blenkernel/BKE_deform.h
M   source/blender/blenkernel/BKE_particle.h
M   source/blender/blenkernel/BKE_shrinkwrap.h
M   source/blender/blenkernel/intern/cloth.c
M   source/blender/blenkernel/intern/data_transfer.c
M   source/blender/blenkernel/intern/deform.c
M   source/blender/blenkernel/intern/fluid.c
M   source/blender/blenkernel/intern/mesh_remesh_voxel.cc
M   source/blender/blenkernel/intern/mesh_tangent.c
M   source/blender/blenkernel/intern/mesh_tessellate.c
M   source/blender/blenkernel/intern/multires.c
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenkernel/intern/particle.c
M   source/blender/blenkernel/intern/particle_distribute.c
M   source/blender/blenkernel/intern/particle_system.c
M   source/blender/blenkernel/intern/pbvh_pixels.cc
M   source/blender/blenkernel/intern/subdiv_ccg_mask.c
M   source/blender/blenkernel/intern/subsurf_ccg.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/draw/intern/draw_cache_impl_subdivision.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh.h
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_orco.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_sculpt_data.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc
M   source/blender/editors/curves/intern/curves_ops.cc
M   source/blender/editors/mesh/mesh_data.c
M   source/blender/editors/mesh/meshtools.c
M   source/blender/editors/object/object_bake_api.c
M   source/blender/editors/sculpt_paint/sculpt_face_set.c
M   source/blender/editors/sculpt_paint/sculpt_ops.c
M   source/blender/editors/sculpt_paint/sculpt_undo.c
M   
source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
M   source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
M   source/blender/io/collada/GeometryExporter.cpp
M   source/blender/makesrna/intern/rna_mesh.c
M   source/blender/modifiers/intern/MOD_displace.c
M   source/blender/modifiers/intern/MOD_explode.c
M   source/blender/modifiers/intern/MOD_mask.cc
M   source/blender/modifiers/intern/MOD_normal_edit.c
M   source/blender/modifiers/intern/MOD_screw.c
M   source/blender/modifiers/intern/MOD_skin.c
M   source/blender/modifiers/intern/MOD_util.c
M   source/blender/modifiers/intern/MOD_weighted_normal.c
M   source/blender/modifiers/intern/MOD_weightvg_util.c
M   source/blender/render/intern/bake.c
M   source/blender/render/intern/texture_margin.cc
M   source/blender/render/intern/texture_pointdensity.c

===

diff --git a/source/blender/blenkernel/BKE_deform.h 
b/source/blender/blenkernel/BKE_deform.h
index 1b225884b14..d32f754c6c0 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -228,35 +228,38 @@ void BKE_defvert_normalize_lock_map(struct MDeformVert 
*dvert,
 /* Utilities to 'extract' a given vgroup into a simple float array,
  * for verts, but also edges/polys/loops. */
 
-void BKE_defvert_extract_vgroup_to_vertweights(
-struct MDeformVert *dvert, int defgroup, int num_verts, float *r_weights, 
bool invert_vgroup);
+void BKE_defvert_extract_vgroup_to_vertweights(const struct MDeformVert *dvert,
+   int defgroup,
+   int num_verts,
+   bool invert_vgroup,
+   float *r_weights);
 /**
  * The following three make basic interpolation,
  * using temp vert_weights array to avoid looking up same weight several times.
  */
-void BKE_defvert_extract_vgroup_to_edgeweights(struct MDeformVert *dvert,
+void BKE_defvert_extract_vgroup_to_edgeweights(const struct MDeformVert *dvert,
int defgroup,
int num_verts,
struct MEdge *edges,

[Bf-blender-cvs] [fa7224d8ed8] master: Merge branch 'blender-v3.2-release'

2022-05-13 Thread Bastien Montagne
Commit: fa7224d8ed88fbfbf55e5d1a83cef49c309785cb
Author: Bastien Montagne
Date:   Fri May 13 18:07:31 2022 +0200
Branches: master
https://developer.blender.org/rBfa7224d8ed88fbfbf55e5d1a83cef49c309785cb

Merge branch 'blender-v3.2-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [074c695a0d4] blender-v3.2-release: Fix T98072: Regression: When appending a Scene, the Collections that are excluded get instanced into Current Scene.

2022-05-13 Thread Bastien Montagne
Commit: 074c695a0d4de88550be71181690639ab6b16dcf
Author: Bastien Montagne
Date:   Fri May 13 18:05:44 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB074c695a0d4de88550be71181690639ab6b16dcf

Fix T98072: Regression: When appending a Scene, the Collections that are 
excluded get instanced into Current Scene.

This was due to using `BKE_scene_has_object` function, which uses the
cache of bases of the viewlayers, which do not have entries for the
content of excluded collections... Now use
`BKE_collection_has_object_recursive` instead.

===

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

===

diff --git a/source/blender/blenkernel/intern/blendfile_link_append.c 
b/source/blender/blenkernel/intern/blendfile_link_append.c
index 555c4690308..f9eea52360e 100644
--- a/source/blender/blenkernel/intern/blendfile_link_append.c
+++ b/source/blender/blenkernel/intern/blendfile_link_append.c
@@ -400,7 +400,9 @@ typedef struct LooseDataInstantiateContext {
 static bool object_in_any_scene(Main *bmain, Object *ob)
 {
   LISTBASE_FOREACH (Scene *, sce, &bmain->scenes) {
-if (BKE_scene_object_find(sce, ob)) {
+/* #BKE_scene_has_object checks bases cache of the scenes' viewlayer, not 
actual content of
+ * their collections. */
+if (BKE_collection_has_object_recursive(sce->master_collection, ob)) {
   return true;
 }
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [870ad7d05db] master: Fix T96781: LineArt proper object iterator.

2022-05-13 Thread YimingWu
Commit: 870ad7d05db2e14164d818cd5320345fd8110a69
Author: YimingWu
Date:   Sat May 14 00:03:40 2022 +0800
Branches: master
https://developer.blender.org/rB870ad7d05db2e14164d818cd5320345fd8110a69

Fix T96781: LineArt proper object iterator.

This patch get rid of the _incorrectly used_ DG iterator in object loading,
and uses scene objects iteration to prevent problems.

Reviewed By: Sebastian Parborg (zeddb)

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

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 0e7df2a136d..a07ef2eb195 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -218,9 +218,18 @@ static void add_this_collection(Collection *c,
   if (!c) {
 return;
   }
+  bool default_add = true;
+  /* Do not do nested collection usage check, this is consistent with lineart 
calculation, because
+   * collection usage doesn't have a INHERIT mode. This might initially be 
derived from the fact
+   * that an object can be inside multiple collections, but might be 
irrelevant now with the way
+   * objects are iterated. Keep this logic for now. */
+  if (c->lineart_usage & COLLECTION_LRT_EXCLUDE) {
+default_add = false;
+  }
   FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (c, ob, mode) {
 if (ELEM(ob->type, OB_MESH, OB_MBALL, OB_CURVES_LEGACY, OB_SURF, OB_FONT)) 
{
-  if (ob->lineart.usage != OBJECT_LRT_EXCLUDE) {
+  if ((ob->lineart.usage == OBJECT_LRT_INHERIT && default_add) ||
+  ob->lineart.usage != OBJECT_LRT_EXCLUDE) {
 DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_GEOMETRY, "Line Art 
Modifier");
 DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_TRANSFORM, "Line 
Art Modifier");
   }
@@ -239,15 +248,11 @@ static void updateDepsgraph(GpencilModifierData *md,
   DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Line 
Art Modifier");
 
   LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
-  if (lmd->source_type == LRT_SOURCE_OBJECT && lmd->source_object) {
-DEG_add_object_relation(
-ctx->node, lmd->source_object, DEG_OB_COMP_GEOMETRY, "Line Art 
Modifier");
-DEG_add_object_relation(
-ctx->node, lmd->source_object, DEG_OB_COMP_TRANSFORM, "Line Art 
Modifier");
-  }
-  else {
-add_this_collection(ctx->scene->master_collection, ctx, mode);
-  }
+
+  /* Always add whole master collection because line art will need the whole 
scene for
+   * visibility computation. Line art exclusion is handled inside 
#add_this_collection. */
+  add_this_collection(ctx->scene->master_collection, ctx, mode);
+
   if (lmd->calculation_flags & LRT_USE_CUSTOM_CAMERA && lmd->source_camera) {
 DEG_add_object_relation(
 ctx->node, lmd->source_camera, DEG_OB_COMP_TRANSFORM, "Line Art 
Modifier");
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index b09bb15ce81..11d368b819c 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -21,6 +21,7 @@
 #include "BKE_collection.h"
 #include "BKE_customdata.h"
 #include "BKE_deform.h"
+#include "BKE_duplilist.h"
 #include "BKE_editmesh.h"
 #include "BKE_global.h"
 #include "BKE_gpencil.h"
@@ -2398,6 +2399,64 @@ static bool lineart_geometry_check_visible(double 
(*model_view_proj)[4],
   return true;
 }
 
+static void lineart_object_load_single_instance(LineartRenderBuffer *rb,
+Depsgraph *depsgraph,
+Scene *scene,
+Object *ob,
+Object *ref_ob,
+float use_mat[4][4],
+bool is_render,
+LineartObjectLoadTaskInfo 
*olti,
+int thread_count)
+{
+  LineartObjectInfo *obi = lineart_mem_acquire(&rb->render_data_pool, 
sizeof(LineartObjectInfo));
+  obi->usage = lineart_usage_check(scene->master_collection, ob, is_render);
+  obi->override_intersection_mask = 
lineart_intersection_mask_check(scene->master_collection, ob);
+  Mesh *use_mesh;
+
+  if (obi->usage == OBJECT_LRT_EXCLUDE) {
+return;
+  }
+
+  /* Prepare the matrix used for transforming this specific object (instance). 
This has to be
+   * done before mesh boundbox check because

[Bf-blender-cvs] [8d43ee1b082] blender-v3.2-release: Fix T97518: All buttons with eyedropper highlight if one is hovered

2022-05-13 Thread Julian Eisel
Commit: 8d43ee1b0823e6e5fae2fdceaee0a94d3d61f9b7
Author: Julian Eisel
Date:   Fri May 13 15:55:11 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB8d43ee1b0823e6e5fae2fdceaee0a94d3d61f9b7

Fix T97518: All buttons with eyedropper highlight if one is hovered

Issue is that the operator acts on the active button, and also uses that in the
poll. So the actually active button would affect the poll of a different
button. For the superimposed icons we need to be able to execute these polls
properly for non-active buttons.

This enables temporarily overriding the active button for lookups via context.
While a bit of a hack it makes sense conceptually.

Reviewed By: Campbell Barton

Maniphest Tasks: T97518

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

===

M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/interface.cc
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/interface/interface_intern.h

===

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index 9f4d6815287..1b61e87b140 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -184,26 +184,26 @@ enum {
 
 /** #uiBut.flag general state flags. */
 enum {
-  /* WARNING: the first 7 flags are internal (see #UI_SELECT definition). */
-  UI_BUT_ICON_SUBMENU = 1 << 7,
-  UI_BUT_ICON_PREVIEW = 1 << 8,
+  /* WARNING: the first 8 flags are internal (see #UI_SELECT definition). */
+  UI_BUT_ICON_SUBMENU = 1 << 8,
+  UI_BUT_ICON_PREVIEW = 1 << 9,
 
-  UI_BUT_NODE_LINK = 1 << 9,
-  UI_BUT_NODE_ACTIVE = 1 << 10,
-  UI_BUT_DRAG_LOCK = 1 << 11,
+  UI_BUT_NODE_LINK = 1 << 10,
+  UI_BUT_NODE_ACTIVE = 1 << 11,
+  UI_BUT_DRAG_LOCK = 1 << 12,
   /** Grayed out and un-editable. */
-  UI_BUT_DISABLED = 1 << 12,
+  UI_BUT_DISABLED = 1 << 13,
 
-  UI_BUT_ANIMATED = 1 << 13,
-  UI_BUT_ANIMATED_KEY = 1 << 14,
-  UI_BUT_DRIVEN = 1 << 15,
-  UI_BUT_REDALERT = 1 << 16,
+  UI_BUT_ANIMATED = 1 << 14,
+  UI_BUT_ANIMATED_KEY = 1 << 15,
+  UI_BUT_DRIVEN = 1 << 16,
+  UI_BUT_REDALERT = 1 << 17,
   /** Grayed out but still editable. */
-  UI_BUT_INACTIVE = 1 << 17,
-  UI_BUT_LAST_ACTIVE = 1 << 18,
-  UI_BUT_UNDO = 1 << 19,
-  UI_BUT_IMMEDIATE = 1 << 20,
-  UI_BUT_NO_UTF8 = 1 << 21,
+  UI_BUT_INACTIVE = 1 << 18,
+  UI_BUT_LAST_ACTIVE = 1 << 19,
+  UI_BUT_UNDO = 1 << 20,
+  UI_BUT_IMMEDIATE = 1 << 21,
+  UI_BUT_NO_UTF8 = 1 << 22,
 
   /** For popups, pressing return activates this button, overriding the 
highlighted button.
* For non-popups this is just used as a display hint for the user to let 
them
diff --git a/source/blender/editors/interface/interface.cc 
b/source/blender/editors/interface/interface.cc
index b7098c26bcd..480044118f1 100644
--- a/source/blender/editors/interface/interface.cc
+++ b/source/blender/editors/interface/interface.cc
@@ -1861,15 +1861,32 @@ bool ui_but_context_poll_operator_ex(bContext *C,
  const wmOperatorCallParams *optype_params)
 {
   bool result;
+  int old_but_flag = 0;
 
-  if (but && but->context) {
-CTX_store_set(C, but->context);
+  if (but) {
+old_but_flag = but->flag;
+
+/* Temporarily make this button override the active one, in case the poll 
acts on the active
+ * button. */
+const_cast(but)->flag |= UI_BUT_ACTIVE_OVERRIDE;
+
+if (but->context) {
+  CTX_store_set(C, but->context);
+}
   }
 
   result = WM_operator_poll_context(C, optype_params->optype, 
optype_params->opcontext);
 
-  if (but && but->context) {
-CTX_store_set(C, nullptr);
+  if (but) {
+BLI_assert_msg((but->flag & ~UI_BUT_ACTIVE_OVERRIDE) ==
+   (old_but_flag & ~UI_BUT_ACTIVE_OVERRIDE),
+   "Operator polls shouldn't change button flags");
+
+const_cast(but)->flag = old_but_flag;
+
+if (but->context) {
+  CTX_store_set(C, nullptr);
+}
   }
 
   return result;
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 26b9b82d67f..9d30ad992c9 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8714,13 +8714,23 @@ static uiBut *ui_context_button_active(const ARegion 
*region, bool (*but_check_c
 /* find active button */
 LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) {
   LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
+if (but->flag & UI_BUT_ACTIVE_OVERRIDE) {
+  activebut = but;
+  break;
+}
 if (but->active) {
   activebut = but;
+  break;
 }
-else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE)) {
+if (but->flag & UI_BUT_LAST_ACTIVE) {
  

[Bf-blender-cvs] [ca2fb9bae9e] blender-v3.2-release: Fix possible null-pointer dererence for active button data

2022-05-13 Thread Julian Eisel
Commit: ca2fb9bae9e9920bb1049863c7bddc5d7ebd1884
Author: Julian Eisel
Date:   Fri May 13 17:52:36 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rBca2fb9bae9e9920bb1049863c7bddc5d7ebd1884

Fix possible null-pointer dererence for active button data

The button returned from `UI_region_active_but_get()` is not guaranteed
to have active button data, so code can't rely on that.

===

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 d2dfa3c2285..9d7d76f0bdb 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4352,14 +4352,14 @@ static uiBut *ui_but_list_row_text_activate(bContext *C,
  * \{ */
 
 static uiButExtraOpIcon *ui_but_extra_operator_icon_mouse_over_get(uiBut *but,
-   
uiHandleButtonData *data,
+   ARegion 
*region,
const 
wmEvent *event)
 {
   float xmax = but->rect.xmax;
   const float icon_size = 0.8f * BLI_rctf_size_y(&but->rect); /* 
ICON_SIZE_FROM_BUTRECT */
   int x = event->xy[0], y = event->xy[1];
 
-  ui_window_to_block(data->region, but->block, &x, &y);
+  ui_window_to_block(region, but->block, &x, &y);
   if (!BLI_rctf_isect_pt(&but->rect, x, y)) {
 return NULL;
   }
@@ -4388,7 +4388,7 @@ static bool ui_do_but_extra_operator_icon(bContext *C,
   uiHandleButtonData *data,
   const wmEvent *event)
 {
-  uiButExtraOpIcon *op_icon = ui_but_extra_operator_icon_mouse_over_get(but, 
data, event);
+  uiButExtraOpIcon *op_icon = ui_but_extra_operator_icon_mouse_over_get(but, 
data->region, event);
 
   if (!op_icon) {
 return false;
@@ -4423,7 +4423,7 @@ static void 
ui_do_but_extra_operator_icons_mousemove(uiBut *but,
 op_icon->highlighted = false;
   }
 
-  uiButExtraOpIcon *hovered = ui_but_extra_operator_icon_mouse_over_get(but, 
data, event);
+  uiButExtraOpIcon *hovered = ui_but_extra_operator_icon_mouse_over_get(but, 
data->region, event);
 
   if (hovered) {
 hovered->highlighted = true;
@@ -4662,7 +4662,7 @@ static int ui_do_but_TEX(
 /* pass */
   }
   else {
-if (!ui_but_extra_operator_icon_mouse_over_get(but, data, event)) {
+if (!ui_but_extra_operator_icon_mouse_over_get(but, data->region, 
event)) {
   button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
 }
 return WM_UI_HANDLER_BREAK;
@@ -4788,7 +4788,7 @@ static int ui_do_but_TREEROW(bContext *C,
   switch (event->val) {
 case KM_PRESS:
   /* Extra icons have priority, don't mess with them. */
-  if (ui_but_extra_operator_icon_mouse_over_get(but, data, event)) {
+  if (ui_but_extra_operator_icon_mouse_over_get(but, data->region, 
event)) {
 return WM_UI_HANDLER_BREAK;
   }
   button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG);
@@ -8222,7 +8222,7 @@ static ARegion *ui_but_tooltip_init(
   if (but) {
 const wmWindow *win = CTX_wm_window(C);
 uiButExtraOpIcon *extra_icon = ui_but_extra_operator_icon_mouse_over_get(
-but, but->active, win->eventstate);
+but, but->active ? but->active->region : region, win->eventstate);
 
 return UI_tooltip_create_from_button_or_extra_icon(C, region, but, 
extra_icon, is_label);
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8e717ce55ae] blender-v3.2-release: Fix crash when displaying some button tooltips

2022-05-13 Thread Julian Eisel
Commit: 8e717ce55aee27cc97b44770026792f65dd106ca
Author: Julian Eisel
Date:   Fri May 13 17:48:10 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB8e717ce55aee27cc97b44770026792f65dd106ca

Fix crash when displaying some button tooltips

Steps to reproduce were:
- Factory startup
- Right-click in 3D View
- Move the mouse over "Shade Flat", wait for the tooltip

The changed logic in 4680331749aa to lookup an active button was
incorrect. It didn't respect the priority of active button candidates.

===

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 9d30ad992c9..d2dfa3c2285 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8709,28 +8709,36 @@ static uiBut *ui_context_button_active(const ARegion 
*region, bool (*but_check_c
   uiBut *but_found = NULL;
 
   while (region) {
-uiBut *activebut = NULL;
+/* Follow this exact priority (from highest to lowest priority):
+ * 1) Active-override button (#UI_BUT_ACTIVE_OVERRIDE).
+ * 2) The real active button.
+ * 3) The previously active button (#UI_BUT_LAST_ACTIVE).
+ */
+uiBut *active_but_override = NULL;
+uiBut *active_but_real = NULL;
+uiBut *active_but_last = NULL;
 
 /* find active button */
 LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) {
   LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
 if (but->flag & UI_BUT_ACTIVE_OVERRIDE) {
-  activebut = but;
-  break;
+  active_but_override = but;
 }
 if (but->active) {
-  activebut = but;
-  break;
+  active_but_real = but;
 }
 if (but->flag & UI_BUT_LAST_ACTIVE) {
-  activebut = but;
-  break;
+  active_but_last = but;
 }
   }
+}
 
-  if (activebut) {
-break;
-  }
+uiBut *activebut = active_but_override;
+if (!activebut) {
+  activebut = active_but_real;
+}
+if (!activebut) {
+  activebut = active_but_last;
 }
 
 if (activebut && (but_check_cb == NULL || but_check_cb(activebut))) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5baa3ecda66] master: Color Management: various improvements and fixes for image saving

2022-05-13 Thread Brecht Van Lommel
Commit: 5baa3ecda66337c0584f0bc6c6e7af0a6c0f6320
Author: Brecht Van Lommel
Date:   Fri May 13 16:03:26 2022 +0200
Branches: master
https://developer.blender.org/rB5baa3ecda66337c0584f0bc6c6e7af0a6c0f6320

Color Management: various improvements and fixes for image saving

* Respect the image file color space setitng for saving in various cases where
  it was previously ignored. Previously it would often use the sRGB or Linear
  color space even when not selected.
* For the Save As operator, add a Color Space option in the file browser to
  choose the color space of the file. Previously this was chosen automatically,
  now it's possible to e.g. resave a Linear image as Linear ACES.
* When changing the file format, the colorspace is automatically changed to an
  appropriate color space for the file format. This already happened before, but
  there was no visibility or control in the operator settings for this.
* Don't change color space when using the Save operator to save over the same
  file.
* Fix missing color space conversion for 16 bit PNGs, where it assumed wrongly
  assumed ibuf->rect would be used for saving. Add BKE_image_format_is_byte to
  more accurately test this.

Fixes T74610

Ref T68926

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

===

M   source/blender/blenkernel/BKE_image_format.h
M   source/blender/blenkernel/BKE_image_save.h
M   source/blender/blenkernel/intern/image_format.cc
M   source/blender/blenkernel/intern/image_save.cc
M   source/blender/compositor/operations/COM_OutputFileOperation.cc
M   source/blender/editors/space_image/image_ops.c
M   source/blender/imbuf/intern/colormanagement.c

===

diff --git a/source/blender/blenkernel/BKE_image_format.h 
b/source/blender/blenkernel/BKE_image_format.h
index 633af54ea4f..6a03d1d8df5 100644
--- a/source/blender/blenkernel/BKE_image_format.h
+++ b/source/blender/blenkernel/BKE_image_format.h
@@ -76,6 +76,8 @@ char BKE_imtype_from_arg(const char *arg);
 void BKE_image_format_from_imbuf(struct ImageFormatData *im_format, const 
struct ImBuf *imbuf);
 void BKE_image_format_to_imbuf(struct ImBuf *ibuf, const struct 
ImageFormatData *imf);
 
+bool BKE_image_format_is_byte(const struct ImageFormatData *imf);
+
 /* Color Management */
 
 void BKE_image_format_color_management_copy(struct ImageFormatData *imf,
diff --git a/source/blender/blenkernel/BKE_image_save.h 
b/source/blender/blenkernel/BKE_image_save.h
index f5695eb11a4..673a7dffb82 100644
--- a/source/blender/blenkernel/BKE_image_save.h
+++ b/source/blender/blenkernel/BKE_image_save.h
@@ -35,6 +35,10 @@ typedef struct ImageSaveOptions {
   bool save_copy;
   bool save_as_render;
   bool do_newpath;
+
+  /* Keep track of previous values for auto updates in UI. */
+  bool prev_save_as_render;
+  int prev_imtype;
 } ImageSaveOptions;
 
 bool BKE_image_save_options_init(ImageSaveOptions *opts,
@@ -44,6 +48,7 @@ bool BKE_image_save_options_init(ImageSaveOptions *opts,
  struct ImageUser *iuser,
  const bool guess_path,
  const bool save_as_render);
+void BKE_image_save_options_update(struct ImageSaveOptions *opts, struct Image 
*ima);
 void BKE_image_save_options_free(struct ImageSaveOptions *opts);
 
 bool BKE_image_save(struct ReportList *reports,
diff --git a/source/blender/blenkernel/intern/image_format.cc 
b/source/blender/blenkernel/intern/image_format.cc
index 30be1fdaba7..57763e1670f 100644
--- a/source/blender/blenkernel/intern/image_format.cc
+++ b/source/blender/blenkernel/intern/image_format.cc
@@ -911,6 +911,11 @@ void BKE_image_format_from_imbuf(ImageFormatData 
*im_format, const ImBuf *imbuf)
   im_format->planes = imbuf->planes;
 }
 
+bool BKE_image_format_is_byte(const ImageFormatData *imf)
+{
+  return (imf->depth == R_IMF_CHAN_DEPTH_8) && 
(BKE_imtype_valid_depths(imf->imtype) & imf->depth);
+}
+
 /* Color Management */
 
 void BKE_image_format_color_management_copy(ImageFormatData *imf, const 
ImageFormatData *imf_src)
diff --git a/source/blender/blenkernel/intern/image_save.cc 
b/source/blender/blenkernel/intern/image_save.cc
index 0fd997c3a9b..106384643df 100644
--- a/source/blender/blenkernel/intern/image_save.cc
+++ b/source/blender/blenkernel/intern/image_save.cc
@@ -121,9 +121,16 @@ bool BKE_image_save_options_init(ImageSaveOptions *opts,
   opts->im_format.stereo3d_format = *ima->stereo3d_format;
   opts->im_format.views_format = ima->views_format;
 
+  /* Render output: colorspace from render settings. */
   BKE_image_format_color_management_copy_from_scene(&opts->im_format, 
scene);
 }
 
+/* Default to saving in the same colorspace as the image setting. */
+if (!save_as_render) {
+  
BKE_color_managed_colorspace_settings_copy(&opts->im_format.linear_colorspace_settings,

[Bf-blender-cvs] [1e4cd98f0a9] master: Fix build error without unity build after recent changes

2022-05-13 Thread Brecht Van Lommel
Commit: 1e4cd98f0a948fbd947f79c220e7834c99a44f65
Author: Brecht Van Lommel
Date:   Fri May 13 17:20:08 2022 +0200
Branches: master
https://developer.blender.org/rB1e4cd98f0a948fbd947f79c220e7834c99a44f65

Fix build error without unity build after recent changes

float3 should have been declared within the blender namespace. And forward
declaration is difficult with templated classes so just include header.

===

M   source/blender/geometry/GEO_mesh_primitive_cuboid.hh

===

diff --git a/source/blender/geometry/GEO_mesh_primitive_cuboid.hh 
b/source/blender/geometry/GEO_mesh_primitive_cuboid.hh
index d8f16065e2b..d9901db9f15 100644
--- a/source/blender/geometry/GEO_mesh_primitive_cuboid.hh
+++ b/source/blender/geometry/GEO_mesh_primitive_cuboid.hh
@@ -2,8 +2,9 @@
 
 #pragma once
 
+#include "BLI_math_vec_types.hh"
+
 struct Mesh;
-struct float3;
 namespace blender {
 namespace bke {
 class AttributeIDRef;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7c9c13cf833] master: Fix possible null-pointer dererence for active button data

2022-05-13 Thread Julian Eisel
Commit: 7c9c13cf8333beb57c4e50e261c5699738347e02
Author: Julian Eisel
Date:   Fri May 13 17:52:36 2022 +0200
Branches: master
https://developer.blender.org/rB7c9c13cf8333beb57c4e50e261c5699738347e02

Fix possible null-pointer dererence for active button data

The button returned from `UI_region_active_but_get()` is not guaranteed
to have active button data, so code can't rely on that.

===

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 d98717206ea..3d347fab89c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4352,14 +4352,14 @@ static uiBut *ui_but_list_row_text_activate(bContext *C,
  * \{ */
 
 static uiButExtraOpIcon *ui_but_extra_operator_icon_mouse_over_get(uiBut *but,
-   
uiHandleButtonData *data,
+   ARegion 
*region,
const 
wmEvent *event)
 {
   float xmax = but->rect.xmax;
   const float icon_size = 0.8f * BLI_rctf_size_y(&but->rect); /* 
ICON_SIZE_FROM_BUTRECT */
   int x = event->xy[0], y = event->xy[1];
 
-  ui_window_to_block(data->region, but->block, &x, &y);
+  ui_window_to_block(region, but->block, &x, &y);
   if (!BLI_rctf_isect_pt(&but->rect, x, y)) {
 return NULL;
   }
@@ -4388,7 +4388,7 @@ static bool ui_do_but_extra_operator_icon(bContext *C,
   uiHandleButtonData *data,
   const wmEvent *event)
 {
-  uiButExtraOpIcon *op_icon = ui_but_extra_operator_icon_mouse_over_get(but, 
data, event);
+  uiButExtraOpIcon *op_icon = ui_but_extra_operator_icon_mouse_over_get(but, 
data->region, event);
 
   if (!op_icon) {
 return false;
@@ -4423,7 +4423,7 @@ static void 
ui_do_but_extra_operator_icons_mousemove(uiBut *but,
 op_icon->highlighted = false;
   }
 
-  uiButExtraOpIcon *hovered = ui_but_extra_operator_icon_mouse_over_get(but, 
data, event);
+  uiButExtraOpIcon *hovered = ui_but_extra_operator_icon_mouse_over_get(but, 
data->region, event);
 
   if (hovered) {
 hovered->highlighted = true;
@@ -4665,7 +4665,7 @@ static int ui_do_but_TEX(
 /* pass */
   }
   else {
-if (!ui_but_extra_operator_icon_mouse_over_get(but, data, event)) {
+if (!ui_but_extra_operator_icon_mouse_over_get(but, data->region, 
event)) {
   button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
 }
 return WM_UI_HANDLER_BREAK;
@@ -4791,7 +4791,7 @@ static int ui_do_but_TREEROW(bContext *C,
   switch (event->val) {
 case KM_PRESS:
   /* Extra icons have priority, don't mess with them. */
-  if (ui_but_extra_operator_icon_mouse_over_get(but, data, event)) {
+  if (ui_but_extra_operator_icon_mouse_over_get(but, data->region, 
event)) {
 return WM_UI_HANDLER_BREAK;
   }
   button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG);
@@ -8225,7 +8225,7 @@ static ARegion *ui_but_tooltip_init(
   if (but) {
 const wmWindow *win = CTX_wm_window(C);
 uiButExtraOpIcon *extra_icon = ui_but_extra_operator_icon_mouse_over_get(
-but, but->active, win->eventstate);
+but, but->active ? but->active->region : region, win->eventstate);
 
 return UI_tooltip_create_from_button_or_extra_icon(C, region, but, 
extra_icon, is_label);
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [908e6c7c4d6] master: Fix crash when displaying some button tooltips

2022-05-13 Thread Julian Eisel
Commit: 908e6c7c4d658615bd0d384d28e9f1b8c001c7a5
Author: Julian Eisel
Date:   Fri May 13 17:48:10 2022 +0200
Branches: master
https://developer.blender.org/rB908e6c7c4d658615bd0d384d28e9f1b8c001c7a5

Fix crash when displaying some button tooltips

Steps to reproduce were:
- Factory startup
- Right-click in 3D View
- Move the mouse over "Shade Flat", wait for the tooltip

The changed logic in 4680331749aa to lookup an active button was
incorrect. It didn't respect the priority of active button candidates.

===

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 3b5d8ce89f2..d98717206ea 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8712,28 +8712,36 @@ static uiBut *ui_context_button_active(const ARegion 
*region, bool (*but_check_c
   uiBut *but_found = NULL;
 
   while (region) {
-uiBut *activebut = NULL;
+/* Follow this exact priority (from highest to lowest priority):
+ * 1) Active-override button (#UI_BUT_ACTIVE_OVERRIDE).
+ * 2) The real active button.
+ * 3) The previously active button (#UI_BUT_LAST_ACTIVE).
+ */
+uiBut *active_but_override = NULL;
+uiBut *active_but_real = NULL;
+uiBut *active_but_last = NULL;
 
 /* find active button */
 LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) {
   LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
 if (but->flag & UI_BUT_ACTIVE_OVERRIDE) {
-  activebut = but;
-  break;
+  active_but_override = but;
 }
 if (but->active) {
-  activebut = but;
-  break;
+  active_but_real = but;
 }
 if (but->flag & UI_BUT_LAST_ACTIVE) {
-  activebut = but;
-  break;
+  active_but_last = but;
 }
   }
+}
 
-  if (activebut) {
-break;
-  }
+uiBut *activebut = active_but_override;
+if (!activebut) {
+  activebut = active_but_real;
+}
+if (!activebut) {
+  activebut = active_but_last;
 }
 
 if (activebut && (but_check_cb == NULL || but_check_cb(activebut))) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3f952b3ca30] master: Merge branch 'blender-v3.2-release'

2022-05-13 Thread Hans Goudey
Commit: 3f952b3ca30897eb8005c321217459d66d978c51
Author: Hans Goudey
Date:   Fri May 13 17:35:18 2022 +0200
Branches: master
https://developer.blender.org/rB3f952b3ca30897eb8005c321217459d66d978c51

Merge branch 'blender-v3.2-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c2d2cd1468c] blender-v3.2-release: Fix: Incorrect order in geometry nodes add menu

2022-05-13 Thread Hans Goudey
Commit: c2d2cd1468cd89e7aaf7770a8b89be19a83490df
Author: Hans Goudey
Date:   Fri May 13 17:34:11 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rBc2d2cd1468cd89e7aaf7770a8b89be19a83490df

Fix: Incorrect order in geometry nodes add menu

===

M   release/scripts/startup/nodeitems_builtins.py

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 4f94184f006..f9bd4342b6e 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -145,10 +145,10 @@ def geometry_node_items(context):
 yield NodeItem("GeometryNodeConvexHull")
 yield NodeItem("GeometryNodeDeleteGeometry")
 yield NodeItem("GeometryNodeDuplicateElements")
-yield NodeItem("GeometryNodeGeometryToInstance")
-yield NodeItem("GeometryNodeMergeByDistance")
 yield NodeItem("GeometryNodeProximity")
+yield NodeItem("GeometryNodeGeometryToInstance")
 yield NodeItem("GeometryNodeJoinGeometry")
+yield NodeItem("GeometryNodeMergeByDistance")
 yield NodeItem("GeometryNodeRaycast")
 yield NodeItem("GeometryNodeSeparateComponents")
 yield NodeItem("GeometryNodeSeparateGeometry")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [aab388678ab] tracking_tools: Merge branch 'master' into tracking_tools

2022-05-13 Thread Sergey Sharybin
Commit: aab388678abd5dd0660cf0387966e66b69e8fdb8
Author: Sergey Sharybin
Date:   Fri May 13 17:23:53 2022 +0200
Branches: tracking_tools
https://developer.blender.org/rBaab388678abd5dd0660cf0387966e66b69e8fdb8

Merge branch 'master' into tracking_tools

===



===

diff --cc source/blender/editors/space_clip/tracking_select.c
index 2e5f5e7bdf5,6b11fb86efc..73765a70670
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@@ -281,12 -292,35 +292,37 @@@ static int select_exec(bContext *C, wmO
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
ListBase *plane_tracks_base = 
BKE_tracking_get_active_plane_tracks(tracking);
MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
-   MovieTrackingTrack *track;
-   MovieTrackingPlaneTrack *plane_track;
+   const bool extend = RNA_boolean_get(op->ptr, "extend");
+   const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
+ 
+   float co[2];
+   RNA_float_get_array(op->ptr, "location", co);
+ 
+   /* Special code which allows to slide a marker which belongs to currently 
selected but not yet
+* active track. If such track is found activate it and return pass-though 
so that marker slide
+* operator can be used immediately after.
 -   * This logic makes it convenient to slide markers when left mouse 
selection is used. */
 -  if (!extend) {
++   * This logic makes it convenient to slide markers when left mouse 
selection is used. Without it
++   * selection will be lost which causes inconvenience for the VFX artist. */
++  const bool activate_selected = RNA_boolean_get(op->ptr, 
"activate_selected");
++  if (activate_selected) {
+ MovieTrackingTrack *track = tracking_find_slidable_track_in_proximity(C, 
co);
+ if (track != NULL) {
+   MovieClip *clip = ED_space_clip_get_clip(sc);
+ 
+   clip->tracking.act_track = track;
+ 
+   WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+   DEG_id_tag_update(&clip->id, ID_RECALC_SELECT);
+ 
+   return OPERATOR_PASS_THROUGH;
+ }
+   }
+ 
float distance_to_track, distance_to_plane_track;
  
-   track = find_nearest_track(sc, tracksbase, co, &distance_to_track);
-   plane_track = find_nearest_plane_track(sc, plane_tracks_base, co, 
&distance_to_plane_track);
+   MovieTrackingTrack *track = find_nearest_track(sc, tracksbase, co, 
&distance_to_track);
+   MovieTrackingPlaneTrack *plane_track = find_nearest_plane_track(
+   sc, plane_tracks_base, co, &distance_to_plane_track);
  
ClipViewLockState lock_state;
ED_clip_view_lock_state_store(C, &lock_state);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a80ad0a5457] master: Refactor: Use coordinate in API for track selection

2022-05-13 Thread Sergey Sharybin
Commit: a80ad0a54578d6e92695dced22538bdca3c8e1a7
Author: Sergey Sharybin
Date:   Fri May 13 17:14:28 2022 +0200
Branches: master
https://developer.blender.org/rBa80ad0a54578d6e92695dced22538bdca3c8e1a7

Refactor: Use coordinate in API for track selection

Currently no functional changes. Prepares for a change which will
allow to more consistently redo the track selection operator.

===

M   source/blender/editors/space_clip/clip_intern.h
M   source/blender/editors/space_clip/tracking_ops.c
M   source/blender/editors/space_clip/tracking_select.c

===

diff --git a/source/blender/editors/space_clip/clip_intern.h 
b/source/blender/editors/space_clip/clip_intern.h
index 8e1df133189..ec3d098e68f 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -190,7 +190,7 @@ void clip_draw_sfra_efra(struct View2D *v2d, struct Scene 
*scene);
 /* Find track which can be slid in a proximity of the given event.
  * Uses the same rules w.r.t distance tolerances for track sliding and 
selection operators. */
 struct MovieTrackingTrack *tracking_find_slidable_track_in_proximity(struct 
bContext *C,
- const 
struct wmEvent *event);
+ const 
float co[2]);
 
 void CLIP_OT_add_marker(struct wmOperatorType *ot);
 void CLIP_OT_add_marker_at_click(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_clip/tracking_ops.c 
b/source/blender/editors/space_clip/tracking_ops.c
index 8cddd0ab23b..ca224b04da5 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -528,11 +528,10 @@ static bool slide_check_corners(float (*corners)[2])
 }
 
 static MovieTrackingTrack *tracking_marker_check_slide(
-bContext *C, const wmEvent *event, int *r_area, eSlideAction *r_action, 
int *r_corner)
+bContext *C, const float co[2], int *r_area, eSlideAction *r_action, int 
*r_corner)
 {
   const float distance_clip_squared = 12.0f * 12.0f;
   SpaceClip *sc = CTX_wm_space_clip(C);
-  ARegion *region = CTX_wm_region(C);
   MovieClip *clip = ED_space_clip_get_clip(sc);
   ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
   const int framenr = ED_space_clip_get_clip_frame_number(sc);
@@ -549,9 +548,6 @@ static MovieTrackingTrack *tracking_marker_check_slide(
 return NULL;
   }
 
-  float co[2];
-  ED_clip_mouse_pos(sc, region, event->mval, co);
-
   LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
 if (!TRACK_VIEW_SELECTED(sc, track) || (track->flag & TRACK_LOCKED)) {
   continue;
@@ -640,9 +636,9 @@ static MovieTrackingTrack *tracking_marker_check_slide(
 }
 
 struct MovieTrackingTrack *tracking_find_slidable_track_in_proximity(struct 
bContext *C,
- const 
struct wmEvent *event)
+ const 
float co[2])
 {
-  return tracking_marker_check_slide(C, event, NULL, NULL, NULL);
+  return tracking_marker_check_slide(C, co, NULL, NULL, NULL);
 }
 
 static void *slide_marker_customdata(bContext *C, const wmEvent *event)
@@ -666,7 +662,7 @@ static void *slide_marker_customdata(bContext *C, const 
wmEvent *event)
 
   ED_clip_mouse_pos(sc, region, event->mval, co);
 
-  track = tracking_marker_check_slide(C, event, &area, &action, &corner);
+  track = tracking_marker_check_slide(C, co, &area, &action, &corner);
   if (track != NULL) {
 MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
 customdata = create_slide_marker_data(
diff --git a/source/blender/editors/space_clip/tracking_select.c 
b/source/blender/editors/space_clip/tracking_select.c
index 1f6ec7de978..db985ae67e5 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -402,15 +402,17 @@ static int select_invoke(bContext *C, wmOperator *op, 
const wmEvent *event)
   SpaceClip *sc = CTX_wm_space_clip(C);
   ARegion *region = CTX_wm_region(C);
 
-  float co[2];
   const bool extend = RNA_boolean_get(op->ptr, "extend");
 
+  float co[2];
+  ED_clip_mouse_pos(sc, region, event->mval, co);
+
   /* Special code which allows to slide a marker which belongs to currently 
selected but not yet
* active track. If such track is found activate it and return pass-though 
so that marker slide
* operator can be used immediately after.
* This logic makes it convenient to slide markers when left mouse selection 
is used. */
   if (!extend) {
-MovieTrackingTrack *track = tracking_find_slidable_track_in_proximity(C, 
event);
+MovieTrackingTrack *track = tracking_find_slidable_track_in_proximity(C, 
co);
 if (track !

[Bf-blender-cvs] [a0748153b42] master: Tracking: Move all selection logic to operator exec()

2022-05-13 Thread Sergey Sharybin
Commit: a0748153b422d4521e02953215ccb0bd5ad2270d
Author: Sergey Sharybin
Date:   Fri May 13 17:21:55 2022 +0200
Branches: master
https://developer.blender.org/rBa0748153b422d4521e02953215ccb0bd5ad2270d

Tracking: Move all selection logic to operator exec()

Unlikely that users will notice this, but this makes it so that
the operator behaves consistently across its exec() and invoke()
code paths.

===

M   source/blender/editors/space_clip/tracking_select.c

===

diff --git a/source/blender/editors/space_clip/tracking_select.c 
b/source/blender/editors/space_clip/tracking_select.c
index db985ae67e5..6b11fb86efc 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -273,7 +273,18 @@ void ed_tracking_deselect_all_plane_tracks(ListBase 
*plane_tracks_base)
   }
 }
 
-static int mouse_select(bContext *C, const float co[2], const bool extend, 
const bool deselect_all)
+static bool select_poll(bContext *C)
+{
+  SpaceClip *sc = CTX_wm_space_clip(C);
+
+  if (sc) {
+return sc->clip && sc->view == SC_VIEW_CLIP;
+  }
+
+  return false;
+}
+
+static int select_exec(bContext *C, wmOperator *op)
 {
   SpaceClip *sc = CTX_wm_space_clip(C);
   MovieClip *clip = ED_space_clip_get_clip(sc);
@@ -281,12 +292,35 @@ static int mouse_select(bContext *C, const float co[2], 
const bool extend, const
   ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
   ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
   MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
-  MovieTrackingTrack *track;
-  MovieTrackingPlaneTrack *plane_track;
+  const bool extend = RNA_boolean_get(op->ptr, "extend");
+  const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
+
+  float co[2];
+  RNA_float_get_array(op->ptr, "location", co);
+
+  /* Special code which allows to slide a marker which belongs to currently 
selected but not yet
+   * active track. If such track is found activate it and return pass-though 
so that marker slide
+   * operator can be used immediately after.
+   * This logic makes it convenient to slide markers when left mouse selection 
is used. */
+  if (!extend) {
+MovieTrackingTrack *track = tracking_find_slidable_track_in_proximity(C, 
co);
+if (track != NULL) {
+  MovieClip *clip = ED_space_clip_get_clip(sc);
+
+  clip->tracking.act_track = track;
+
+  WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
+  DEG_id_tag_update(&clip->id, ID_RECALC_SELECT);
+
+  return OPERATOR_PASS_THROUGH;
+}
+  }
+
   float distance_to_track, distance_to_plane_track;
 
-  track = find_nearest_track(sc, tracksbase, co, &distance_to_track);
-  plane_track = find_nearest_plane_track(sc, plane_tracks_base, co, 
&distance_to_plane_track);
+  MovieTrackingTrack *track = find_nearest_track(sc, tracksbase, co, 
&distance_to_track);
+  MovieTrackingPlaneTrack *plane_track = find_nearest_plane_track(
+  sc, plane_tracks_base, co, &distance_to_plane_track);
 
   ClipViewLockState lock_state;
   ED_clip_view_lock_state_store(C, &lock_state);
@@ -375,56 +409,13 @@ static int mouse_select(bContext *C, const float co[2], 
const bool extend, const
   return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 }
 
-static bool select_poll(bContext *C)
-{
-  SpaceClip *sc = CTX_wm_space_clip(C);
-
-  if (sc) {
-return sc->clip && sc->view == SC_VIEW_CLIP;
-  }
-
-  return false;
-}
-
-static int select_exec(bContext *C, wmOperator *op)
-{
-  float co[2];
-
-  RNA_float_get_array(op->ptr, "location", co);
-  const bool extend = RNA_boolean_get(op->ptr, "extend");
-  const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
-
-  return mouse_select(C, co, extend, deselect_all);
-}
-
 static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
   SpaceClip *sc = CTX_wm_space_clip(C);
   ARegion *region = CTX_wm_region(C);
 
-  const bool extend = RNA_boolean_get(op->ptr, "extend");
-
   float co[2];
   ED_clip_mouse_pos(sc, region, event->mval, co);
-
-  /* Special code which allows to slide a marker which belongs to currently 
selected but not yet
-   * active track. If such track is found activate it and return pass-though 
so that marker slide
-   * operator can be used immediately after.
-   * This logic makes it convenient to slide markers when left mouse selection 
is used. */
-  if (!extend) {
-MovieTrackingTrack *track = tracking_find_slidable_track_in_proximity(C, 
co);
-if (track != NULL) {
-  MovieClip *clip = ED_space_clip_get_clip(sc);
-
-  clip->tracking.act_track = track;
-
-  WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
-  DEG_id_tag_update(&clip->id, ID_RECALC_SELECT);
-
-  return OPERATOR_PASS_THROUGH;
-}
-  }
-
   RNA_float_set_array(op->ptr, "location", co);
 
   return se

[Bf-blender-cvs] [0893e29a151] cycles_oneapi: Cycles: detect sycl library ABI to keep backend compatible

2022-05-13 Thread Xavier Hallade
Commit: 0893e29a1513e42fb636ff278de123193307cf3d
Author: Xavier Hallade
Date:   Fri May 13 17:01:42 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB0893e29a1513e42fb636ff278de123193307cf3d

Cycles: detect sycl library ABI to keep backend compatible

===

M   intern/cycles/kernel/CMakeLists.txt

===

diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index a8ee9f301af..f4f0856aaf8 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -759,6 +759,16 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
   get_filename_component(sycl_compiler_root ${SYCL_COMPILER} DIRECTORY)
   get_filename_component(sycl_compiler_compiler_name ${SYCL_COMPILER} NAME_WE)
 
+  if(UNIX AND NOT APPLE)
+if(NOT WITH_CXX11_ABI)
+  check_library_exists(sycl
+_ZN2cl4sycl7handler22verifyUsedKernelBundleERKSs 
${sycl_compiler_root}/../lib SYCL_NO_CXX11_ABI)
+  if(SYCL_NO_CXX11_ABI)
+list(APPEND sycl_compiler_flags -D_GLIBCXX_USE_CXX11_ABI=0)
+  endif()
+endif()
+  endif()
+
   if(WIN32)
 list(APPEND sycl_compiler_flags
 -fms-extensions

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4f28b881a67] tracking_tools: Tracking: Always allow LMB select for tweak tools

2022-05-13 Thread Sergey Sharybin
Commit: 4f28b881a67fb06a15d7b2966fafe2a808314ecc
Author: Sergey Sharybin
Date:   Fri May 13 16:53:20 2022 +0200
Branches: tracking_tools
https://developer.blender.org/rB4f28b881a67fb06a15d7b2966fafe2a808314ecc

Tracking: Always allow LMB select for tweak tools

Similar to the nodes editor: makes it very easy and convenient to
alter markers.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index e4c9f3f141b..d08786e6ba8 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -6615,21 +6615,43 @@ def km_image_editor_tool_uv_scale(params):
 # 
--
 # Tool System (Clip Editor)
 
+def _template_items_clip_tool_tweak_selection(params):
+items = [
+("clip.select", {"type": params.select_mouse, "value": 'PRESS'},
+{"properties": [
+("extend", False),
+("deselect_all", True),
+("activate_selected", params.select_mouse == 'LEFTMOUSE')]}
+ ),
+]
+
+if params.select_mouse == 'RIGHTMOUSE':
+items.append(
+("clip.select", {"type": 'LEFTMOUSE', "value": 'PRESS'},
+{"properties": [
+("extend", False),
+("deselect_all", True),
+("activate_selected", True)]}
+ ),
+)
+
+return items
+
+
+def _template_items_clip_tool_tweak(params):
+return [
+("clip.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
+*_template_items_clip_tool_tweak_selection(params),
+("clip.slide_marker", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
+("clip.slide_plane_marker", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
+]
+
+
 def km_clip_editor_tool_select(params):
 return (
 "Clip Editor: Tweak",
 {"space_type": 'CLIP_EDITOR', "region_type": 'WINDOW'},
-{"items": [
-("clip.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
-("clip.select", {"type": params.select_mouse, "value": 'PRESS'},
- {"properties": [
- ("extend", False),
- ("deselect_all", True),
- ("activate_selected", params.select_mouse == 'LEFTMOUSE')]}
- ),
-("clip.slide_marker", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
-("clip.slide_plane_marker", {"type": 'LEFTMOUSE', "value": 
'PRESS'}, None),
-]},
+{"items": _template_items_clip_tool_tweak(params)},
 )
 
 
@@ -6669,15 +6691,7 @@ def km_clip_editor_tool_add_marker_tweak(params):
 "Clip Editor: Add Marker and Tweak",
 {"space_type": 'CLIP_EDITOR', "region_type": 'WINDOW'},
 {"items": [
-("clip.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
-("clip.select", {"type": params.select_mouse, "value": 'PRESS'},
- {"properties": [
- ("extend", False),
- ("deselect_all", True),
- ("activate_selected", params.select_mouse == 'LEFTMOUSE')]}
- ),
-("clip.slide_marker", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
-("clip.slide_plane_marker", {"type": 'LEFTMOUSE', "value": 
'PRESS'}, None),
+*_template_items_clip_tool_tweak(params),
 ("clip.add_marker_slide", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
 ]},
 )

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0c2c1601b90] tracking_tools: Tracking: Make "Tweak" tool have same selection rules as "Add Marker and Tweak"

2022-05-13 Thread Sergey Sharybin
Commit: 0c2c1601b9075390c98b515f265b97ace34c11a9
Author: Sergey Sharybin
Date:   Fri May 13 16:23:17 2022 +0200
Branches: tracking_tools
https://developer.blender.org/rB0c2c1601b9075390c98b515f265b97ace34c11a9

Tracking: Make "Tweak" tool have same selection rules as "Add Marker and Tweak"

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index b9303cb5842..e4c9f3f141b 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -6620,10 +6620,15 @@ def km_clip_editor_tool_select(params):
 "Clip Editor: Tweak",
 {"space_type": 'CLIP_EDITOR', "region_type": 'WINDOW'},
 {"items": [
+("clip.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
+("clip.select", {"type": params.select_mouse, "value": 'PRESS'},
+ {"properties": [
+ ("extend", False),
+ ("deselect_all", True),
+ ("activate_selected", params.select_mouse == 'LEFTMOUSE')]}
+ ),
 ("clip.slide_marker", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
 ("clip.slide_plane_marker", {"type": 'LEFTMOUSE', "value": 
'PRESS'}, None),
-("clip.select", {"type": params.select_mouse, "value": 'PRESS'},
- {"properties": [("extend", False), ("deselect_all", not 
params.legacy)]}),
 ]},
 )

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c9e3ae3f070] gpencil-new-data-proposal: Cleanup, comments

2022-05-13 Thread Falk David
Commit: c9e3ae3f070d1df5c0efb2281fb99bcdfd1a0587
Author: Falk David
Date:   Fri May 13 16:07:31 2022 +0200
Branches: gpencil-new-data-proposal
https://developer.blender.org/rBc9e3ae3f070d1df5c0efb2281fb99bcdfd1a0587

Cleanup, comments

===

M   source/blender/blenkernel/intern/gpencil_new_proposal.hh
M   source/blender/blenkernel/intern/gpencil_new_proposal_test.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh 
b/source/blender/blenkernel/intern/gpencil_new_proposal.hh
index 630f324c6cb..3f328ee36e6 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh
@@ -120,13 +120,17 @@ typedef struct GPData {
   GPDataRuntimeHandle *runtime;
 } GPData;
 
-/* This is the ID_GP structure that holds all the information at the object 
data level. */
+/**
+ * This would be the new Grease Pencil ID structure. This is where the 
animation data, materials, etc. are stored.
+ * Layers, Frames, Groups and RuntimeData would be stored in GPData.
+ */
 typedef struct GreasePencil {
   ID id;
   /* Animation data (must be immediately after id). */
   struct AnimData *adt;
 
-  /* Pointer to the actual data-block containing the frames, layers and layer 
groups. */
+  /* Pointer to the actual data-block containing the frames, layers and layer 
groups. Note: This is
+   * stored as a pointer to easily wrap it in a class. */
   GPData *grease_pencil_data;
 
   /* GreasePencil flag. */
diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc 
b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
index d7ce5c803c6..4ca0ca7a4fb 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
@@ -21,7 +21,7 @@
 
 namespace blender::bke {
 
-class GPLayerGroup : ::GPLayerGroup {
+class GPLayerGroup : ::GPLayerGroup { /* Unused for now. Placeholder class. */
  public:
   GPLayerGroup()
   {
@@ -64,7 +64,7 @@ class GPDataRuntime {
   mutable Map> frame_index_masks_cache;
   mutable std::mutex frame_index_masks_cache_mutex;
 
-  IndexMask get_cached_frame_index_mask(int layer_index)
+  IndexMask frame_index_masks_cache_for_layer(int layer_index)
   {
 return frame_index_masks_cache.lookup(layer_index).as_span();
   }
@@ -290,6 +290,7 @@ class GPData : public ::GPData {
 if (this->layers_size > 0) {
   this->layers_array = reinterpret_cast<::GPLayer *>(
   MEM_malloc_arrayN(this->layers_size, sizeof(::GPLayer), __func__));
+  default_construct_n(reinterpret_cast(this->layers_array), 
this->layers_size);
   this->active_layer_index = 0;
 }
 else {
@@ -348,7 +349,7 @@ class GPData : public ::GPData {
 
   Span frames() const
   {
-return {(const GPFrame *)this->frames_array, this->frames_size};
+return {reinterpret_cast(this->frames_array), 
this->frames_size};
   }
 
   const GPFrame &frames(int index) const
@@ -358,7 +359,7 @@ class GPData : public ::GPData {
 
   MutableSpan frames_for_write()
   {
-return {(GPFrame *)this->frames_array, this->frames_size};
+return {reinterpret_cast(this->frames_array), 
this->frames_size};
   }
 
   GPFrame &frames_for_write(int index)
@@ -374,13 +375,13 @@ class GPData : public ::GPData {
 
 /* If the indices are cached for this layer, use the cache. */
 if (this->runtime->frame_index_masks_cache.contains(layer_index)) {
-  return this->runtime->get_cached_frame_index_mask(layer_index);
+  return this->runtime->frame_index_masks_cache_for_layer(layer_index);
 }
 
 /* A double checked lock. */
 std::scoped_lock{this->runtime->frame_index_masks_cache_mutex};
 if (this->runtime->frame_index_masks_cache.contains(layer_index)) {
-  return this->runtime->get_cached_frame_index_mask(layer_index);
+  return this->runtime->frame_index_masks_cache_for_layer(layer_index);
 }
 
 Vector indices;
@@ -410,7 +411,7 @@ class GPData : public ::GPData {
 
   Span layers() const
   {
-return {(const GPLayer *)this->layers_array, this->layers_size};
+return {reinterpret_cast(this->layers_array), 
this->layers_size};
   }
 
   const GPLayer &layers(int index) const
@@ -420,7 +421,7 @@ class GPData : public ::GPData {
 
   MutableSpan layers_for_write()
   {
-return {(GPLayer *)this->layers_array, this->layers_size};
+return {reinterpret_cast(this->layers_array), 
this->layers_size};
   }
 
   GPLayer &layers_for_write(int index)
@@ -463,6 +464,7 @@ class GPData : public ::GPData {
 /* Sort frame array. */
 update_frames_array();
 
+/* Find the frame again and return its index (now from the sorted array). 
*/
 auto it = std::lower_bound(this->frames().begin(),
this->frames().end(),
std::pair(la

[Bf-blender-cvs] [4680331749a] master: Fix T97518: All buttons with eyedropper highlight if one is hovered

2022-05-13 Thread Julian Eisel
Commit: 4680331749aa716fe01445c473308f3ff80ec8c9
Author: Julian Eisel
Date:   Fri May 13 15:55:11 2022 +0200
Branches: master
https://developer.blender.org/rB4680331749aa716fe01445c473308f3ff80ec8c9

Fix T97518: All buttons with eyedropper highlight if one is hovered

Issue is that the operator acts on the active button, and also uses that in the
poll. So the actually active button would affect the poll of a different
button. For the superimposed icons we need to be able to execute these polls
properly for non-active buttons.

This enables temporarily overriding the active button for lookups via context.
While a bit of a hack it makes sense conceptually.

Reviewed By: Campbell Barton

Maniphest Tasks: T97518

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

===

M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/interface.cc
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/interface/interface_intern.h

===

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index 082335ae2cd..cc08525c6da 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -184,26 +184,26 @@ enum {
 
 /** #uiBut.flag general state flags. */
 enum {
-  /* WARNING: the first 7 flags are internal (see #UI_SELECT definition). */
-  UI_BUT_ICON_SUBMENU = 1 << 7,
-  UI_BUT_ICON_PREVIEW = 1 << 8,
+  /* WARNING: the first 8 flags are internal (see #UI_SELECT definition). */
+  UI_BUT_ICON_SUBMENU = 1 << 8,
+  UI_BUT_ICON_PREVIEW = 1 << 9,
 
-  UI_BUT_NODE_LINK = 1 << 9,
-  UI_BUT_NODE_ACTIVE = 1 << 10,
-  UI_BUT_DRAG_LOCK = 1 << 11,
+  UI_BUT_NODE_LINK = 1 << 10,
+  UI_BUT_NODE_ACTIVE = 1 << 11,
+  UI_BUT_DRAG_LOCK = 1 << 12,
   /** Grayed out and un-editable. */
-  UI_BUT_DISABLED = 1 << 12,
+  UI_BUT_DISABLED = 1 << 13,
 
-  UI_BUT_ANIMATED = 1 << 13,
-  UI_BUT_ANIMATED_KEY = 1 << 14,
-  UI_BUT_DRIVEN = 1 << 15,
-  UI_BUT_REDALERT = 1 << 16,
+  UI_BUT_ANIMATED = 1 << 14,
+  UI_BUT_ANIMATED_KEY = 1 << 15,
+  UI_BUT_DRIVEN = 1 << 16,
+  UI_BUT_REDALERT = 1 << 17,
   /** Grayed out but still editable. */
-  UI_BUT_INACTIVE = 1 << 17,
-  UI_BUT_LAST_ACTIVE = 1 << 18,
-  UI_BUT_UNDO = 1 << 19,
-  UI_BUT_IMMEDIATE = 1 << 20,
-  UI_BUT_NO_UTF8 = 1 << 21,
+  UI_BUT_INACTIVE = 1 << 18,
+  UI_BUT_LAST_ACTIVE = 1 << 19,
+  UI_BUT_UNDO = 1 << 20,
+  UI_BUT_IMMEDIATE = 1 << 21,
+  UI_BUT_NO_UTF8 = 1 << 22,
 
   /** For popups, pressing return activates this button, overriding the 
highlighted button.
* For non-popups this is just used as a display hint for the user to let 
them
diff --git a/source/blender/editors/interface/interface.cc 
b/source/blender/editors/interface/interface.cc
index 8774a177c7d..d6719f0aa9f 100644
--- a/source/blender/editors/interface/interface.cc
+++ b/source/blender/editors/interface/interface.cc
@@ -1861,15 +1861,32 @@ bool ui_but_context_poll_operator_ex(bContext *C,
  const wmOperatorCallParams *optype_params)
 {
   bool result;
+  int old_but_flag = 0;
 
-  if (but && but->context) {
-CTX_store_set(C, but->context);
+  if (but) {
+old_but_flag = but->flag;
+
+/* Temporarily make this button override the active one, in case the poll 
acts on the active
+ * button. */
+const_cast(but)->flag |= UI_BUT_ACTIVE_OVERRIDE;
+
+if (but->context) {
+  CTX_store_set(C, but->context);
+}
   }
 
   result = WM_operator_poll_context(C, optype_params->optype, 
optype_params->opcontext);
 
-  if (but && but->context) {
-CTX_store_set(C, nullptr);
+  if (but) {
+BLI_assert_msg((but->flag & ~UI_BUT_ACTIVE_OVERRIDE) ==
+   (old_but_flag & ~UI_BUT_ACTIVE_OVERRIDE),
+   "Operator polls shouldn't change button flags");
+
+const_cast(but)->flag = old_but_flag;
+
+if (but->context) {
+  CTX_store_set(C, nullptr);
+}
   }
 
   return result;
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index ad354560183..3b5d8ce89f2 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8717,13 +8717,23 @@ static uiBut *ui_context_button_active(const ARegion 
*region, bool (*but_check_c
 /* find active button */
 LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) {
   LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
+if (but->flag & UI_BUT_ACTIVE_OVERRIDE) {
+  activebut = but;
+  break;
+}
 if (but->active) {
   activebut = but;
+  break;
 }
-else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE)) {
+if (but->flag & UI_BUT_LAST_ACTIVE) {
   activ

[Bf-blender-cvs] [6f3d1552936] master: Merge branch 'blender-v3.2-release'

2022-05-13 Thread Campbell Barton
Commit: 6f3d1552936bb65bc94011ecb83ef9aaa574b0a0
Author: Campbell Barton
Date:   Fri May 13 23:42:06 2022 +1000
Branches: master
https://developer.blender.org/rB6f3d1552936bb65bc94011ecb83ef9aaa574b0a0

Merge branch 'blender-v3.2-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [05b56d55e85] blender-v3.2-release: Fix T97386: Node socket labels swallow click/drag events

2022-05-13 Thread Campbell Barton
Commit: 05b56d55e8578c79080083cb4177a8846f82af14
Author: Campbell Barton
Date:   Fri May 13 23:41:03 2022 +1000
Branches: blender-v3.2-release
https://developer.blender.org/rB05b56d55e8578c79080083cb4177a8846f82af14

Fix T97386: Node socket labels swallow click/drag events

Regression caused by [0] which made `ui_but_is_interactive` consider
label buttons with tool-tips to be interactive. This prevented
the clicks to pass through to the nodes for selecting/dragging.

Resolve this by allowing buttons to be activated for the purpose
of showing tool-tips but otherwise considering them disabled
(as if the UI_BUT_DISABLED is set when handling events).

[0]: 484a9146479e05946d291e9886cdf3febca6d05d

Reviewed By: Severin

Ref D14932

===

M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/interface/interface_intern.h
M   source/blender/editors/interface/interface_query.cc

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 2c408619fe7..26b9b82d67f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -384,6 +384,12 @@ typedef struct uiHandleButtonData {
 
   /* True when alt is held and the preference for displaying tooltips should 
be ignored. */
   bool tooltip_force;
+  /**
+   * Behave as if #UI_BUT_DISABLED is set (without drawing grayed out).
+   * Needed so non-interactive labels can be activated for the purpose of 
showing tool-tips,
+   * without them blocking interaction with nodes, see: T97386.
+   */
+  bool disable_force;
 
   /* auto open */
   bool used_mouse;
@@ -1669,7 +1675,7 @@ static void ui_drag_toggle_set(bContext *C, 
uiDragToggleHandle *drag_info, const
*/
   if (drag_info->is_xy_lock_init == false) {
 /* first store the buttons original coords */
-uiBut *but = ui_but_find_mouse_over_ex(region, xy_input, true, NULL, NULL);
+uiBut *but = ui_but_find_mouse_over_ex(region, xy_input, true, false, 
NULL, NULL);
 
 if (but) {
   if (but->flag & UI_BUT_DRAG_LOCK) {
@@ -1739,7 +1745,7 @@ static int ui_handler_region_drag_toggle(bContext *C, 
const wmEvent *event, void
   if (done) {
 wmWindow *win = CTX_wm_window(C);
 const ARegion *region = CTX_wm_region(C);
-uiBut *but = ui_but_find_mouse_over_ex(region, drag_info->xy_init, true, 
NULL, NULL);
+uiBut *but = ui_but_find_mouse_over_ex(region, drag_info->xy_init, true, 
false, NULL, NULL);
 
 if (but) {
   ui_apply_but_undo(but);
@@ -4324,7 +4330,7 @@ static uiBut *ui_but_list_row_text_activate(bContext *C,
 uiButtonActivateType activate_type)
 {
   ARegion *region = CTX_wm_region(C);
-  uiBut *labelbut = ui_but_find_mouse_over_ex(region, event->xy, true, NULL, 
NULL);
+  uiBut *labelbut = ui_but_find_mouse_over_ex(region, event->xy, true, false, 
NULL, NULL);
 
   if (labelbut && labelbut->type == UI_BTYPE_TEXT && !(labelbut->flag & 
UI_BUT_DISABLED)) {
 /* exit listrow */
@@ -7899,7 +7905,7 @@ static int ui_do_button(bContext *C, uiBlock *block, 
uiBut *but, const wmEvent *
   uiHandleButtonData *data = but->active;
   int retval = WM_UI_HANDLER_CONTINUE;
 
-  const bool is_disabled = but->flag & UI_BUT_DISABLED;
+  const bool is_disabled = but->flag & UI_BUT_DISABLED || data->disable_force;
 
   /* if but->pointype is set, but->poin should be too */
   BLI_assert(!but->pointype || but->poin);
@@ -8947,7 +8953,12 @@ static uiBut *ui_but_find_open_event(ARegion *region, 
const wmEvent *event)
 static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion 
*region)
 {
   if (event->type == MOUSEMOVE) {
-uiBut *but = ui_but_find_mouse_over(region, event);
+const bool labeledit = event->modifier & KM_CTRL;
+/* Allow buttons to be activated to show the tool-tip,
+ * then force-disable them if they're not considered interactive
+ * so they don't swallow events but can still display tips. */
+const bool for_tooltip = true;
+uiBut *but = ui_but_find_mouse_over_ex(region, event->xy, labeledit, 
for_tooltip, NULL, NULL);
 if (but) {
   button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER);
 
@@ -8956,6 +8967,10 @@ static int ui_handle_button_over(bContext *C, const 
wmEvent *event, ARegion *reg
  * preferences. */
 but->active->tooltip_force = true;
   }
+
+  if (but->active && !ui_but_is_interactive(but, labeledit)) {
+but->active->disable_force = true;
+  }
 }
   }
   else if (event->type == EVT_BUT_OPEN) {
@@ -9435,7 +9450,7 @@ static bool ui_list_is_hovering_draggable_but(bContext *C,
   int mouse_xy[2];
   WM_event_drag_start_xy(event, mouse_xy);
 
-  const uiBut *hovered_but = ui_but_find_mouse_over_ex(region, mouse_xy, 
false, NULL, N

[Bf-blender-cvs] [dc29529ca8d] tracking_tools: Merge branch 'master' into tracking_tools

2022-05-13 Thread Sergey Sharybin
Commit: dc29529ca8ddb999609baf21631398a1c20faed2
Author: Sergey Sharybin
Date:   Fri May 13 14:17:34 2022 +0200
Branches: tracking_tools
https://developer.blender.org/rBdc29529ca8ddb999609baf21631398a1c20faed2

Merge branch 'master' into tracking_tools

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7533bee58b1] master: Cleanup: Remove dead code in tracking slide operator

2022-05-13 Thread Sergey Sharybin
Commit: 7533bee58b10f1f34c942347586163d6f1caa4fc
Author: Sergey Sharybin
Date:   Fri May 13 12:51:00 2022 +0200
Branches: master
https://developer.blender.org/rB7533bee58b10f1f34c942347586163d6f1caa4fc

Cleanup: Remove dead code in tracking slide operator

The code was there prior pattern area affine transform and was never
used afterwards.

After so long time it should be safe to remove the unused code.

===

M   source/blender/editors/space_clip/tracking_ops.c

===

diff --git a/source/blender/editors/space_clip/tracking_ops.c 
b/source/blender/editors/space_clip/tracking_ops.c
index 2a891757536..d7265c97d47 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -353,13 +353,13 @@ typedef struct {
 
   int mval[2];
   int width, height;
-  float *min, *max, *pos, *offset, (*corners)[2];
+  float *min, *max, *pos, (*corners)[2];
   float spos[2];
 
   bool lock, accurate;
 
   /* Data to restore on cancel. */
-  float old_search_min[2], old_search_max[2], old_pos[2], old_offset[2];
+  float old_search_min[2], old_search_max[2], old_pos[2];
   float old_corners[4][2];
   float (*old_markers)[2];
 } SlideMarkerData;
@@ -392,35 +392,16 @@ static SlideMarkerData 
*create_slide_marker_data(SpaceClip *sc,
 
   if (area == TRACK_AREA_POINT) {
 data->pos = marker->pos;
-data->offset = track->offset;
   }
   else if (area == TRACK_AREA_PAT) {
-switch (action) {
-  case SLIDE_ACTION_NONE:
-BLI_assert_msg(0, "Expected valid action");
-break;
-
-  case SLIDE_ACTION_SIZE:
-data->corners = marker->pattern_corners;
-break;
-  case SLIDE_ACTION_OFFSET:
-data->pos = marker->pos;
-data->offset = track->offset;
-data->old_markers = MEM_callocN(sizeof(*data->old_markers) * 
track->markersnr,
-"slide markers");
-for (int a = 0; a < track->markersnr; a++) {
-  copy_v2_v2(data->old_markers[a], track->markers[a].pos);
-}
-break;
-  case SLIDE_ACTION_POS:
-data->corners = marker->pattern_corners;
-data->pos = marker->pattern_corners[corner];
-copy_v2_v2(data->spos, data->pos);
-break;
-  case SLIDE_ACTION_TILT_SIZE:
-data->corners = marker->pattern_corners;
-slide_marker_tilt_slider(marker, data->spos);
-break;
+if (action == SLIDE_ACTION_POS) {
+  data->corners = marker->pattern_corners;
+  data->pos = marker->pattern_corners[corner];
+  copy_v2_v2(data->spos, data->pos);
+}
+else if (action == SLIDE_ACTION_TILT_SIZE) {
+  data->corners = marker->pattern_corners;
+  slide_marker_tilt_slider(marker, data->spos);
 }
   }
   else if (area == TRACK_AREA_SEARCH) {
@@ -443,7 +424,6 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip 
*sc,
   copy_v2_v2(data->old_search_min, marker->search_min);
   copy_v2_v2(data->old_search_max, marker->search_max);
   copy_v2_v2(data->old_pos, marker->pos);
-  copy_v2_v2(data->old_offset, track->offset);
 
   return data;
 }
@@ -718,14 +698,12 @@ static int slide_marker_invoke(bContext *C, wmOperator 
*op, const wmEvent *event
 
 static void cancel_mouse_slide(SlideMarkerData *data)
 {
-  MovieTrackingTrack *track = data->track;
   MovieTrackingMarker *marker = data->marker;
 
   memcpy(marker->pattern_corners, data->old_corners, 
sizeof(marker->pattern_corners));
   copy_v2_v2(marker->search_min, data->old_search_min);
   copy_v2_v2(marker->search_max, data->old_search_max);
   copy_v2_v2(marker->pos, data->old_pos);
-  copy_v2_v2(track->offset, data->old_offset);
 
   if (data->old_markers != NULL) {
 for (int a = 0; a < data->track->markersnr; a++) {
@@ -765,7 +743,6 @@ static void free_slide_data(SlideMarkerData *data)
 static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent 
*event)
 {
   SpaceClip *sc = CTX_wm_space_clip(C);
-  ARegion *region = CTX_wm_region(C);
 
   SlideMarkerData *data = (SlideMarkerData *)op->customdata;
   float dx, dy, mdelta[2];
@@ -804,61 +781,14 @@ static int slide_marker_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
   }
 
   if (data->area == TRACK_AREA_POINT) {
-if (data->action == SLIDE_ACTION_OFFSET) {
-  data->offset[0] = data->old_offset[0] + dx;
-  data->offset[1] = data->old_offset[1] + dy;
-}
-else {
-  data->pos[0] = data->old_pos[0] + dx;
-  data->pos[1] = data->old_pos[1] + dy;
-}
+data->pos[0] = data->old_pos[0] + dx;
+data->pos[1] = data->old_pos[1] + dy;
 
 WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
 DEG_id_tag_update(&sc->clip->id, 0);
   }
   else if (data->area == TRACK_AREA_PAT) {
-if (data->action == SLIDE_ACTION_SIZE) {
- 

[Bf-blender-cvs] [d6c4317f351] master: Fix jump when switching accurate marker sliding

2022-05-13 Thread Sergey Sharybin
Commit: d6c4317f35181438550b67105ea4a523a72dd543
Author: Sergey Sharybin
Date:   Fri May 13 13:08:23 2022 +0200
Branches: master
https://developer.blender.org/rBd6c4317f35181438550b67105ea4a523a72dd543

Fix jump when switching accurate marker sliding

As a side effect the "sticky" search area on resize/move is also
resolved now: previously attempt to move search area past to where
it could be would make it hard to move it back. Now the search area
will always respond immediately to mouse motion, even after it got
clamped.

===

M   source/blender/editors/space_clip/tracking_ops.c

===

diff --git a/source/blender/editors/space_clip/tracking_ops.c 
b/source/blender/editors/space_clip/tracking_ops.c
index d7265c97d47..8cddd0ab23b 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -354,7 +354,6 @@ typedef struct {
   int mval[2];
   int width, height;
   float *min, *max, *pos, (*corners)[2];
-  float spos[2];
 
   bool lock, accurate;
 
@@ -364,10 +363,17 @@ typedef struct {
   float (*old_markers)[2];
 } SlideMarkerData;
 
-static void slide_marker_tilt_slider(const MovieTrackingMarker *marker, float 
r_slider[2])
+static void slide_marker_tilt_slider_relative(const float 
pattern_corners[4][2], float r_slider[2])
 {
-  add_v2_v2v2(r_slider, marker->pattern_corners[1], 
marker->pattern_corners[2]);
-  add_v2_v2(r_slider, marker->pos);
+  add_v2_v2v2(r_slider, pattern_corners[1], pattern_corners[2]);
+}
+
+static void slide_marker_tilt_slider(const float marker_pos[2],
+ const float pattern_corners[4][2],
+ float r_slider[2])
+{
+  slide_marker_tilt_slider_relative(pattern_corners, r_slider);
+  add_v2_v2(r_slider, marker_pos);
 }
 
 static SlideMarkerData *create_slide_marker_data(SpaceClip *sc,
@@ -397,11 +403,9 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip 
*sc,
 if (action == SLIDE_ACTION_POS) {
   data->corners = marker->pattern_corners;
   data->pos = marker->pattern_corners[corner];
-  copy_v2_v2(data->spos, data->pos);
 }
 else if (action == SLIDE_ACTION_TILT_SIZE) {
   data->corners = marker->pattern_corners;
-  slide_marker_tilt_slider(marker, data->spos);
 }
   }
   else if (area == TRACK_AREA_SEARCH) {
@@ -486,7 +490,7 @@ static int mouse_to_tilt_distance_squared(const 
MovieTrackingMarker *marker,
   int height)
 {
   float slider[2];
-  slide_marker_tilt_slider(marker, slider);
+  slide_marker_tilt_slider(marker->pos, marker->pattern_corners, slider);
   return mouse_to_slide_zone_distance_squared(co, slider, width, height);
 }
 
@@ -781,61 +785,66 @@ static int slide_marker_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
   }
 
   if (data->area == TRACK_AREA_POINT) {
-data->pos[0] = data->old_pos[0] + dx;
-data->pos[1] = data->old_pos[1] + dy;
+data->pos[0] += dx;
+data->pos[1] += dy;
 
 WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
 DEG_id_tag_update(&sc->clip->id, 0);
   }
   else if (data->area == TRACK_AREA_PAT) {
 if (data->action == SLIDE_ACTION_POS) {
-  float spos[2];
+  float prev_pos[2];
+  copy_v2_v2(prev_pos, data->pos);
 
-  copy_v2_v2(spos, data->pos);
-
-  data->pos[0] = data->spos[0] + dx;
-  data->pos[1] = data->spos[1] + dy;
+  data->pos[0] += dx;
+  data->pos[1] += dy;
 
   if (!slide_check_corners(data->corners)) {
-copy_v2_v2(data->pos, spos);
+copy_v2_v2(data->pos, prev_pos);
   }
 
-  /* Currently only patterns are allowed to have such combination of 
event and data. */
+  /* Allow pattern to be arbitrary size and resize search area if 
needed. */
   BKE_tracking_marker_clamp_search_size(data->marker);
 }
 else if (data->action == SLIDE_ACTION_TILT_SIZE) {
-  const float mouse_delta[2] = {dx, dy};
-
-  /* Vector which connects marker position with tilt/scale sliding 
area before sliding
-   * began. */
-  float start[2];
-  sub_v2_v2v2(start, data->spos, data->old_pos);
-  start[0] *= data->width;
-  start[1] *= data->height;
-
-  /* Vector which connects marker position with tilt/scale sliding 
area with the sliding
-   * delta applied. */
-  float end[2];
-  add_v2_v2v2(end, data->spos, mouse_delta);
-  sub_v2_v2(end, data->old_pos);
-  end[0] *= data->width;
-  end[1] *= data->height;
+  const float delta[2] = {dx, dy};
+
+  /* Slider position relative to the marker position using current 
state of pattern
+   * corners. */
+  float s

[Bf-blender-cvs] [0e4a04a07ff] temp-T97352-3d-texturing-seam-bleeding: Remove debug code.

2022-05-13 Thread Jeroen Bakker
Commit: 0e4a04a07ff5e45ad152161472e204829b8a7120
Author: Jeroen Bakker
Date:   Fri May 13 12:57:53 2022 +0200
Branches: temp-T97352-3d-texturing-seam-bleeding
https://developer.blender.org/rB0e4a04a07ff5e45ad152161472e204829b8a7120

Remove debug code.

===

M   source/blender/blenkernel/intern/pbvh_pixels_seams.cc

===

diff --git a/source/blender/blenkernel/intern/pbvh_pixels_seams.cc 
b/source/blender/blenkernel/intern/pbvh_pixels_seams.cc
index b7ff3cc258f..474969b0c12 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels_seams.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels_seams.cc
@@ -458,9 +458,6 @@ static void build_fixes(PBVH &pbvh,
 /** Pixel not part of this tile. */
 continue;
   }
-  if (u == 18 && v == 530) {
-printf("error");
-  }
 
   int pixel_offset = v * bitmap.resolution.x + u;
   PixelInfo &pixel_info = bitmap.bitmap[pixel_offset];

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [94ad77100c7] master: Merge branch 'blender-v3.2-release'

2022-05-13 Thread Jeroen Bakker
Commit: 94ad77100c7626ef9f3c276b627ffc51661384ed
Author: Jeroen Bakker
Date:   Fri May 13 12:55:24 2022 +0200
Branches: master
https://developer.blender.org/rB94ad77100c7626ef9f3c276b627ffc51661384ed

Merge branch 'blender-v3.2-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cbc024c3cac] blender-v3.2-release: MacOS/AMD: Drawing artifacts in VSE.

2022-05-13 Thread Jeroen Bakker
Commit: cbc024c3cac29dd17a9e5338162792d8fadc82ee
Author: Jeroen Bakker
Date:   Fri May 13 12:53:18 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rBcbc024c3cac29dd17a9e5338162792d8fadc82ee

MacOS/AMD: Drawing artifacts in VSE.

Related to the partial revert done for T97272. It seems also that the
workaround should be enabled for any MACOS platform.

===

M   source/blender/gpu/opengl/gl_backend.cc

===

diff --git a/source/blender/gpu/opengl/gl_backend.cc 
b/source/blender/gpu/opengl/gl_backend.cc
index 17d9b392c69..1cd2301aa4e 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -419,10 +419,10 @@ static void detect_workarounds()
 GCaps.shader_storage_buffer_objects_support = false;
   }
 
-  /* Certain Intel based platforms don't clear the viewport textures. Always 
clearing leads to
-   * noticeable performance regressions. */
-  if (GPU_type_matches(
-  GPU_DEVICE_INTEL, static_cast(GPU_OS_MAC | GPU_OS_UNIX), 
GPU_DRIVER_ANY)) {
+  /* Certain Intel/AMD based platforms don't clear the viewport textures. 
Always clearing leads to
+   * noticeable performance regressions on other platforms as well. */
+  if (GPU_type_matches(GPU_DEVICE_ANY, GPU_OS_MAC, GPU_DRIVER_ANY) ||
+  GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_UNIX, GPU_DRIVER_ANY)) {
 GCaps.clear_viewport_workaround = true;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6e2270f3d33] master: Merge branch 'blender-v3.2-release'

2022-05-13 Thread Sergey Sharybin
Commit: 6e2270f3d33c1b6dc8c7779a42398c5943fa3072
Author: Sergey Sharybin
Date:   Fri May 13 12:47:33 2022 +0200
Branches: master
https://developer.blender.org/rB6e2270f3d33c1b6dc8c7779a42398c5943fa3072

Merge branch 'blender-v3.2-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e30ccb9a34f] blender-v3.2-release: Fix crash toggling marker translate with marker offset

2022-05-13 Thread Sergey Sharybin
Commit: e30ccb9a34f39ef0565214aef1084c47871a27fe
Author: Sergey Sharybin
Date:   Fri May 13 12:39:40 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rBe30ccb9a34f39ef0565214aef1084c47871a27fe

Fix crash toggling marker translate with marker offset

The shortcut is G-G.

Caused by loop argument "shadowing".

===

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

===

diff --git a/source/blender/editors/transform/transform_convert_tracking.c 
b/source/blender/editors/transform/transform_convert_tracking.c
index 45f17512c09..bf9f929dd65 100644
--- a/source/blender/editors/transform/transform_convert_tracking.c
+++ b/source/blender/editors/transform/transform_convert_tracking.c
@@ -621,7 +621,7 @@ static void flushTransTracking(TransInfo *t)
   TransData *td;
   TransData2D *td2d;
   TransDataTracking *tdt;
-  int a;
+  int td_index;
 
   if (t->state == TRANS_CANCEL) {
 cancelTransTracking(t);
@@ -630,8 +630,9 @@ static void flushTransTracking(TransInfo *t)
   TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
 
   /* flush to 2d vector from internally used 3d vector */
-  for (a = 0, td = tc->data, td2d = tc->data_2d, tdt = tc->custom.type.data; a 
< tc->data_len;
-   a++, td2d++, td++, tdt++) {
+  for (td_index = 0, td = tc->data, td2d = tc->data_2d, tdt = 
tc->custom.type.data;
+   td_index < tc->data_len;
+   td_index++, td2d++, td++, tdt++) {
 if (tdt->mode == transDataTracking_ModeTracks) {
   float loc2d[2];
 
@@ -655,7 +656,7 @@ static void flushTransTracking(TransInfo *t)
 if (!tdt->smarkers) {
   tdt->smarkers = MEM_callocN(sizeof(*tdt->smarkers) * 
tdt->markersnr,
   "flushTransTracking markers");
-  for (a = 0; a < tdt->markersnr; a++) {
+  for (int a = 0; a < tdt->markersnr; a++) {
 copy_v2_v2(tdt->smarkers[a], tdt->markers[a].pos);
   }
 }
@@ -665,7 +666,7 @@ static void flushTransTracking(TransInfo *t)
 
 sub_v2_v2v2(d2, loc2d, tdt->srelative);
 
-for (a = 0; a < tdt->markersnr; a++) {
+for (int a = 0; a < tdt->markersnr; a++) {
   add_v2_v2v2(tdt->markers[a].pos, tdt->smarkers[a], d2);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c4b20425bd8] temp-T97352-3d-texturing-seam-bleeding: Improve quality seam fixing (step distance)

2022-05-13 Thread Jeroen Bakker
Commit: c4b20425bd8715f98aea0c6b7edfbb8524fbca20
Author: Jeroen Bakker
Date:   Fri May 13 12:38:23 2022 +0200
Branches: temp-T97352-3d-texturing-seam-bleeding
https://developer.blender.org/rBc4b20425bd8715f98aea0c6b7edfbb8524fbca20

Improve quality seam fixing (step distance)

===

M   source/blender/blenkernel/intern/pbvh_pixels_seams.cc

===

diff --git a/source/blender/blenkernel/intern/pbvh_pixels_seams.cc 
b/source/blender/blenkernel/intern/pbvh_pixels_seams.cc
index f23ff555bd4..b7ff3cc258f 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels_seams.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels_seams.cc
@@ -272,9 +272,11 @@ Bitmaps create_tile_bitmap(const PBVH &pbvh, Image &image, 
ImageUser &image_user
   return result;
 }
 
-int2 find_source_pixel(const Bitmap &bitmap, float2 near_image_coord)
+int2 find_source_pixel(const Bitmap &bitmap,
+   float2 near_image_coord,
+   const float seam_fix_distance)
 {
-  const int SEARCH_RADIUS = 2;
+  const int SEARCH_RADIUS = std::ceil(seam_fix_distance);
   float min_distance = FLT_MAX;
   int2 result(0, 0);
   int2 image_coord(int(near_image_coord.x), int(near_image_coord.y));
@@ -290,8 +292,9 @@ int2 find_source_pixel(const Bitmap &bitmap, float2 
near_image_coord)
   if (!pixel_info.is_extracted()) {
 continue;
   }
+  float2 center_pixel_uv(u + 0.5f, v + 0.5f);
 
-  float distance = len_v2v2_int(uv, image_coord);
+  float distance = len_v2v2(center_pixel_uv, near_image_coord);
   if (distance < min_distance) {
 result = uv;
 min_distance = distance;
@@ -344,11 +347,11 @@ static void add_seam_fix(PBVHNode &node,
  * \{ */
 
 struct Projection {
-  const Bitmap *bitmap;
-  int node_index;
-  float2 pixel;
-  char bit_mask;
-  float score;
+  const Bitmap *bitmap = nullptr;
+  int node_index = -1;
+  float2 pixel = float2(0.0f, 0.0f);
+  char bit_mask = 0;
+  float score = 0.0f;
 };
 
 /*
@@ -455,6 +458,9 @@ static void build_fixes(PBVH &pbvh,
 /** Pixel not part of this tile. */
 continue;
   }
+  if (u == 18 && v == 530) {
+printf("error");
+  }
 
   int pixel_offset = v * bitmap.resolution.x + u;
   PixelInfo &pixel_info = bitmap.bitmap[pixel_offset];
@@ -466,27 +472,38 @@ static void build_fixes(PBVH &pbvh,
   float2 dst_uv_offset(bitmap.image_tile.get_tile_x_offset(),
bitmap.image_tile.get_tile_y_offset());
   float2 uv_coord(u, v);
-  float2 uv(uv_coord.x / bitmap.resolution.x, uv_coord.y / 
bitmap.resolution.y);
+  float2 center_uv_coord(u + 0.5f, v + 0.5f);
+  float2 center_uv(center_uv_coord.x / bitmap.resolution.x,
+   center_uv_coord.y / bitmap.resolution.y);
   float2 closest_point;
   const float lambda = closest_to_line_v2(closest_point,
-  uv,
+  center_uv,
   float2(luv_a_1.uv) - 
dst_uv_offset,
   float2(luv_a_2.uv) - 
dst_uv_offset);
   float2 closest_coord(closest_point.x * bitmap.resolution.x,
closest_point.y * bitmap.resolution.y);
 
   /* Distance to the edge in pixel space. */
-  float distance_to_edge = len_v2v2(closest_coord, uv_coord);
+  float distance_to_edge = len_v2v2(closest_coord, center_uv_coord);
   if (distance_to_edge > seamfix_distance) {
 continue;
   }
 
   Projection solution1;
   Projection solution2;
-  find_projection_source(
-  bitmaps, distance_to_edge, lambda, luv_b_1, luv_b_2, scale_factor, 
solution1);
-  find_projection_source(
-  bitmaps, distance_to_edge, 1.0f - lambda, luv_b_2, luv_b_1, 
scale_factor, solution2);
+  /* When distance to edge is small, it could happen that the solution is 
pointing to a pixel
+   * that also needs to be fixed. In this case we increase the distance 
until we find a
+   * solution or skip this pixel after some iterations. */
+  while (solution1.score == 0.0f && solution2.score == 0.0f) {
+find_projection_source(
+bitmaps, distance_to_edge, lambda, luv_b_1, luv_b_2, scale_factor, 
solution1);
+find_projection_source(
+bitmaps, distance_to_edge, 1.0f - lambda, luv_b_2, luv_b_1, 
scale_factor, solution2);
+if (distance_to_edge > 1.4f) {
+  break;
+}
+distance_to_edge += 0.25f;
+  }
   if (solution1.score == 0.0 && solution2.score == 0.0) {
 /* No solution found skip this pixel. */
 continue;
@@ -513,6 +530,7 @@ static void build_fixes(PBVH &pbvh,
 const MLoopUV *ldata_uv,
 const float seamfix_distance)
 {
+  const 

[Bf-blender-cvs] [f39e871490b] temp-T97352-3d-texturing-seam-bleeding: Merge branch 'master' into temp-T97352-3d-texturing-seam-bleeding

2022-05-13 Thread Jeroen Bakker
Commit: f39e871490b0d6e20d8d81767f8a063d04b050af
Author: Jeroen Bakker
Date:   Fri May 13 09:43:58 2022 +0200
Branches: temp-T97352-3d-texturing-seam-bleeding
https://developer.blender.org/rBf39e871490b0d6e20d8d81767f8a063d04b050af

Merge branch 'master' into temp-T97352-3d-texturing-seam-bleeding

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [22dc47f710c] cycles_oneapi: Cycles: add lgamma definition in oneAPI compat header

2022-05-13 Thread Xavier Hallade
Commit: 22dc47f710c8c7bd9b9fe6df2bac215fef3ef7e6
Author: Xavier Hallade
Date:   Fri May 13 11:41:28 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB22dc47f710c8c7bd9b9fe6df2bac215fef3ef7e6

Cycles: add lgamma definition in oneAPI compat header

fixes compilation using intel/llvm compiler on Linux

===

M   intern/cycles/kernel/device/oneapi/compat.h

===

diff --git a/intern/cycles/kernel/device/oneapi/compat.h 
b/intern/cycles/kernel/device/oneapi/compat.h
index d737f5a8029..d4f15d95875 100644
--- a/intern/cycles/kernel/device/oneapi/compat.h
+++ b/intern/cycles/kernel/device/oneapi/compat.h
@@ -185,6 +185,7 @@ ccl_always_inline float3 make_float3(float x)
 #define fmaxf(x, y) sycl::fmax((x), (y))
 #define fminf(x, y) sycl::fmin((x), (y))
 #define fmodf(x, y) sycl::fmod((x), (y))
+#define lgammaf(x) sycl::lgamma((x))
 
 #define __forceinline inline

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [15c146091de] cycles_oneapi: Cycles: avoid using OpenCL for oneAPI devices enumeration

2022-05-13 Thread Xavier Hallade
Commit: 15c146091def58c6f1bd156611cda3efff982687
Author: Xavier Hallade
Date:   Wed May 11 14:57:06 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB15c146091def58c6f1bd156611cda3efff982687

Cycles: avoid using OpenCL for oneAPI devices enumeration

to also simplify and improve device filtering and branding
and remove dependency on pi_opencl library.

===

M   intern/cycles/kernel/device/oneapi/device_id.h
M   intern/cycles/kernel/device/oneapi/kernel.cpp

===

diff --git a/intern/cycles/kernel/device/oneapi/device_id.h 
b/intern/cycles/kernel/device/oneapi/device_id.h
index 02129ca1676..d27c553497e 100644
--- a/intern/cycles/kernel/device/oneapi/device_id.h
+++ b/intern/cycles/kernel/device/oneapi/device_id.h
@@ -3,31 +3,9 @@
 
 #pragma once
 
-// NOTE(sirgienko) List of PCI device ids, which correspond to allowed Intel 
GPUs
-// public source of device IDs :
+// from public source :
 // 
https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/include/pci_ids/iris_pci_ids.h
-const static std::set oneapi_allowed_gpu_devices = {
-// Alchemist dGPU, called DG2 before.
-#if 1
-0x4f80,
-0x4f81,
-0x4f82,
-0x4f83,
-0x4f84,
-0x4f87,
-0x4f88,
-0x5690,
-0x5691,
-0x5692,
-0x5693,
-0x5694,
-0x5695,
-0x56a0,
-0x56a1,
-0x56a2,
-0x56a5,
-0x56a6,
-0x56b0,
-0x56b1,
-#endif
-};
+const static std::set intel_arc_alchemist_device_ids = {
+0x4f80, 0x4f81, 0x4f82, 0x4f83, 0x4f84, 0x4f87, 0x4f88, 0x5690, 0x5691,
+0x5692, 0x5693, 0x5694, 0x5695, 0x5696, 0x5697, 0x56a0, 0x56a1, 0x56a2,
+0x56a3, 0x56a4, 0x56a5, 0x56a6, 0x56b0, 0x56b1, 0x56b2, 0x56b3};
diff --git a/intern/cycles/kernel/device/oneapi/kernel.cpp 
b/intern/cycles/kernel/device/oneapi/kernel.cpp
index bc521029d9b..2f8608da819 100644
--- a/intern/cycles/kernel/device/oneapi/kernel.cpp
+++ b/intern/cycles/kernel/device/oneapi/kernel.cpp
@@ -24,8 +24,7 @@
 static OneAPIErrorCallback s_error_cb = nullptr;
 static void *s_error_user_ptr = nullptr;
 
-static std::vector oneapi_available_devices(
-std::map *proper_names_map = nullptr);
+static std::vector oneapi_available_devices();
 
 void oneapi_set_error_cb(OneAPIErrorCallback cb, void *user_ptr)
 {
@@ -654,207 +653,134 @@ bool oneapi_enqueue_kernel(KernelContext 
*kernel_context,
   return success;
 }
 
-// TODO(sirgienko) Put proper linux driver version number here, when it will 
be known, which
-// exactly driver will have lowerest support
-static const int windows_lowest_supported_driver_build_version = 1011660;
-static const int linux_lowest_supported_driver_build_version = 20066;
+static const int lowest_supported_driver_version_win = 1011660;
+static const int lowest_supported_driver_version_neo = 20066;
 
-// Windows: os_type == 1
-// Linux: os_type == 2
-static int parse_driver_build_version(const sycl::device &device, int &os_type)
+static int parse_driver_build_version(const sycl::device &device)
 {
-  const std::string &device_name = device.get_info();
   const std::string &driver_version = 
device.get_info();
+  int driver_build_version = 0;
 
-  // NOTE(sirgienko) Windows Intel GPUs driver version look like this:
-  //   xx.x.101.1340
-  // the 7 last digits are forming the version number.
-  // For more details, see
-  // 
https://www.intel.com/content/www/us/en/support/articles/05654/graphics.html
-  if (std::count(driver_version.begin(), driver_version.end(), '.') == 3) {
-os_type = 1;
-  }
-  // Linux versions examples: 22.01.022066, 22.01.018324
-  // Last number is used as driver version number.
-  else if (std::count(driver_version.begin(), driver_version.end(), '.') == 2) 
{
-os_type = 2;
+  size_t second_dot_position = driver_version.find('.', 
driver_version.find('.') + 1);
+  if (second_dot_position == std::string::npos) {
+std::cerr << "Unable to parse unknown Intel GPU driver version \"" << 
driver_version
+  << "\" does not match xx.xx.x (Linux), x.x. (L0),"
+  << " xx.xx.xxx. (Windows) for device \""
+  << device.get_info() << "\"." << 
std::endl;
   }
   else {
-std::cerr << "Unable to parse incorrect/unknown Intel GPU driver version 
\"" << driver_version
-  << "\" - device \"" << device_name << "\" will be skipped" << 
std::endl;
-os_type = 0;
-return 0;
-  }
-
-  size_t second_dot_position = driver_version.find('.', 
driver_version.find('.', 0) + 1);
-  // For easier parsing, let's consider third dot as an end string position 
for Linux version
-  // string
-  size_t third_dot_position = os_type == 1 ? driver_version.find('.', 
second_dot_position + 1) :
- driver_version.length();
-
-  int driver_build_version = 0;
-  try {
-const std::string &third_number_substr = driver_version.substr(
-second_dot_posi

[Bf-blender-cvs] [58555ccc7aa] master: Cleanup: format (with autopep8 line wrapping applied)

2022-05-13 Thread Campbell Barton
Commit: 58555ccc7aabecd6349de816af29be33f0fc9941
Author: Campbell Barton
Date:   Fri May 13 19:21:54 2022 +1000
Branches: master
https://developer.blender.org/rB58555ccc7aabecd6349de816af29be33f0fc9941

Cleanup: format (with autopep8 line wrapping applied)

===

M   intern/cycles/blender/addon/properties.py
M   intern/cycles/blender/addon/ui.py

===

diff --git a/intern/cycles/blender/addon/properties.py 
b/intern/cycles/blender/addon/properties.py
index 9b4799d252f..9acc9e99ad0 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -24,12 +24,19 @@ from . import camera
 
 enum_devices = (
 ('CPU', "CPU", "Use CPU for rendering"),
-('GPU', "GPU Compute", "Use GPU compute device for rendering, configured 
in the system tab in the user preferences"),
+('GPU', "GPU Compute",
+"Use GPU compute device for rendering, configured in the system tab in 
the user preferences"),
 )
 
 enum_feature_set = (
-('SUPPORTED', "Supported", "Only use finished and supported features"),
-('EXPERIMENTAL', "Experimental", "Use experimental and incomplete features 
that might be broken or change in the future", 'ERROR', 1),
+('SUPPORTED',
+ "Supported",
+ "Only use finished and supported features"),
+('EXPERIMENTAL',
+ "Experimental",
+ "Use experimental and incomplete features that might be broken or change 
in the future",
+ 'ERROR',
+ 1),
 )
 
 enum_displacement_methods = (
@@ -81,9 +88,14 @@ enum_sampling_pattern = (
 )
 
 enum_volume_sampling = (
-('DISTANCE', "Distance", "Use distance sampling, best for dense volumes 
with lights far away"),
-('EQUIANGULAR', "Equiangular", "Use equiangular sampling, best for volumes 
with low density with light inside or near the volume"),
-('MULTIPLE_IMPORTANCE', "Multiple Importance",
+('DISTANCE',
+ "Distance",
+ "Use distance sampling, best for dense volumes with lights far away"),
+('EQUIANGULAR',
+ "Equiangular",
+ "Use equiangular sampling, best for volumes with low density with light 
inside or near the volume"),
+('MULTIPLE_IMPORTANCE',
+ "Multiple Importance",
  "Combine distance and equi-angular sampling for volumes where neither 
method is ideal"),
 )
 
@@ -93,10 +105,15 @@ enum_volume_interpolation = (
 )
 
 enum_world_mis = (
-('NONE', "None", "Don't sample the background, faster but might cause 
noise for non-solid backgrounds"),
-('AUTOMATIC', "Auto", "Automatically try to determine the best setting"),
-('MANUAL', "Manual", "Manually set the resolution of the sampling map, 
higher values are slower and require more memory but reduce noise")
-)
+('NONE',
+ "None",
+ "Don't sample the background, faster but might cause noise for non-solid 
backgrounds"),
+('AUTOMATIC',
+ "Auto",
+ "Automatically try to determine the best setting"),
+('MANUAL',
+ "Manual",
+ "Manually set the resolution of the sampling map, higher values are 
slower and require more memory but reduce noise"))
 
 enum_device_type = (
 ('CPU', "CPU", "CPU", 0),
@@ -210,17 +227,33 @@ enum_denoising_input_passes = (
 )
 
 enum_denoising_prefilter = (
-('NONE', "None", "No prefiltering, use when guiding passes are 
noise-free", 1),
-('FAST', "Fast", "Denoise color and guiding passes together. Improves 
quality when guiding passes are noisy using least amount of extra processing 
time", 2),
-('ACCURATE', "Accurate", "Prefilter noisy guiding passes before denoising 
color. Improves quality when guiding passes are noisy using extra processing 
time", 3),
+('NONE',
+ "None",
+ "No prefiltering, use when guiding passes are noise-free",
+ 1),
+('FAST',
+ "Fast",
+ "Denoise color and guiding passes together. Improves quality when guiding 
passes are noisy using least amount of extra processing time",
+ 2),
+('ACCURATE',
+ "Accurate",
+ "Prefilter noisy guiding passes before denoising color. Improves quality 
when guiding passes are noisy using extra processing time",
+ 3),
 )
 
 enum_direct_light_sampling_type = (
-('MULTIPLE_IMPORTANCE_SAMPLING', "Multiple Importance Sampling",
- "Multiple importance sampling is used to combine direct light 
contributions from next-event estimation and forward path tracing", 0),
-('FORWARD_PATH_TRACING', "Forward Path Tracing", "Direct light 
contributions are only sampled using forward path tracing", 1),
-('NEXT_EVENT_ESTIMATION', "Next-Event Estimation",
- "Direct light contributions are only sampled using next-event 
estimation", 2),
+('MULTIPLE_IMPORTANCE_SAMPLING',
+ "Multiple Importance Sampling",
+ "Multiple importance sampling is used to combine direct light 
contributions from next-event estimation and forward path tracing",
+ 0),
+('FORWARD_

[Bf-blender-cvs] [8741cf20380] master: Cleanup: Proper state check in marker slide operator

2022-05-13 Thread Sergey Sharybin
Commit: 8741cf20380c7037cbde5f0935610e985ad7c62a
Author: Sergey Sharybin
Date:   Fri May 13 10:42:28 2022 +0200
Branches: master
https://developer.blender.org/rB8741cf20380c7037cbde5f0935610e985ad7c62a

Cleanup: Proper state check in marker slide operator

The previous code was had confusing logic, but since it was acting
more as a fall-back it did not cause bugs for users.

===

M   source/blender/editors/space_clip/tracking_ops.c

===

diff --git a/source/blender/editors/space_clip/tracking_ops.c 
b/source/blender/editors/space_clip/tracking_ops.c
index 239e9925997..2a891757536 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -928,13 +928,13 @@ static int slide_marker_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
 
   BKE_tracking_marker_clamp_search_size(data->marker);
 }
-else if (data->area == TRACK_AREA_SEARCH) {
+else if (data->action == SLIDE_ACTION_OFFSET) {
   const float d[2] = {dx, dy};
   add_v2_v2v2(data->min, data->old_search_min, d);
   add_v2_v2v2(data->max, data->old_search_max, d);
-}
 
-BKE_tracking_marker_clamp_search_position(data->marker);
+  BKE_tracking_marker_clamp_search_position(data->marker);
+}
   }
 
   data->marker->flag &= ~MARKER_TRACKED;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e3e7543f304] tracking_tools: Tracking: Restore pre-tool behavior for tweak tool with RMB select

2022-05-13 Thread Sergey Sharybin
Commit: e3e7543f3042a54e5830b89efb9b35029cfb6993
Author: Sergey Sharybin
Date:   Fri May 13 10:25:50 2022 +0200
Branches: tracking_tools
https://developer.blender.org/rBe3e7543f3042a54e5830b89efb9b35029cfb6993

Tracking: Restore pre-tool behavior for tweak tool with RMB select

Make it an explicit option for operator to make it behave in a way which
is the most convenient for left mouse select, and do not use it for the
right mouse select.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   source/blender/editors/space_clip/tracking_select.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 07f32cc8ce7..b9303cb5842 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -,7 +,11 @@ def km_clip_editor_tool_add_marker_tweak(params):
 {"items": [
 ("clip.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
 ("clip.select", {"type": params.select_mouse, "value": 'PRESS'},
- {"properties": [("extend", False), ("deselect_all", True)]}),
+ {"properties": [
+ ("extend", False),
+ ("deselect_all", True),
+ ("activate_selected", params.select_mouse == 'LEFTMOUSE')]}
+ ),
 ("clip.slide_marker", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
 ("clip.slide_plane_marker", {"type": 'LEFTMOUSE', "value": 
'PRESS'}, None),
 ("clip.add_marker_slide", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
diff --git a/source/blender/editors/space_clip/tracking_select.c 
b/source/blender/editors/space_clip/tracking_select.c
index 5b2a1b945e7..b922aeaa61e 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -402,14 +402,13 @@ static int select_invoke(bContext *C, wmOperator *op, 
const wmEvent *event)
   SpaceClip *sc = CTX_wm_space_clip(C);
   ARegion *region = CTX_wm_region(C);
 
-  float co[2];
-  const bool extend = RNA_boolean_get(op->ptr, "extend");
-
   /* Special code which allows to slide a marker which belongs to currently 
selected but not yet
* active track. If such track is found activate it and return pass-though 
so that marker slide
* operator can be used immediately after.
-   * This logic makes it convenient to slide markers when left mouse selection 
is used. */
-  if (!extend) {
+   * This logic makes it convenient to slide markers when left mouse selection 
is used. Without it
+   * selection will be lost which causes inconvenience for the VFX artist. */
+  const bool activate_selected = RNA_boolean_get(op->ptr, "activate_selected");
+  if (activate_selected) {
 MovieTrackingTrack *track = tracking_find_slidable_track_in_proximity(C, 
event);
 if (track != NULL) {
   MovieClip *clip = ED_space_clip_get_clip(sc);
@@ -423,6 +422,7 @@ static int select_invoke(bContext *C, wmOperator *op, const 
wmEvent *event)
 }
   }
 
+  float co[2];
   ED_clip_mouse_pos(sc, region, event->mval, co);
   RNA_float_set_array(op->ptr, "location", co);
 
@@ -452,6 +452,7 @@ void CLIP_OT_select(wmOperatorType *ot)
  "Extend",
  "Extend selection rather than clearing the existing 
selection");
   RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
   prop = RNA_def_boolean(ot->srna,
  "deselect_all",
  false,
@@ -459,6 +460,14 @@ void CLIP_OT_select(wmOperatorType *ot)
  "Deselect all when nothing under the cursor");
   RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 
+  prop = RNA_def_boolean(
+  ot->srna,
+  "activate_selected",
+  0,
+  "Activate Selected",
+  "When selecting already selected track activate it and do not alter 
others selection");
+  RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
   RNA_def_float_vector(
   ot->srna,
   "location",

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [68fa87dbf0e] tracking_tools: Fix add marker and tweak tool with left mouse selection

2022-05-13 Thread Sergey Sharybin
Commit: 68fa87dbf0ed9e0b770e4dd07ffadcc39fc44b38
Author: Sergey Sharybin
Date:   Thu May 12 17:35:59 2022 +0200
Branches: tracking_tools
https://developer.blender.org/rB68fa87dbf0ed9e0b770e4dd07ffadcc39fc44b38

Fix add marker and tweak tool with left mouse selection

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index c3d1fc8a3a3..07f32cc8ce7 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -6665,6 +6665,8 @@ def km_clip_editor_tool_add_marker_tweak(params):
 {"space_type": 'CLIP_EDITOR', "region_type": 'WINDOW'},
 {"items": [
 ("clip.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
+("clip.select", {"type": params.select_mouse, "value": 'PRESS'},
+ {"properties": [("extend", False), ("deselect_all", True)]}),
 ("clip.slide_marker", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),
 ("clip.slide_plane_marker", {"type": 'LEFTMOUSE', "value": 
'PRESS'}, None),
 ("clip.add_marker_slide", {"type": 'LEFTMOUSE', "value": 'PRESS'}, 
None),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [613dd855413] tracking_tools: Cleanup: Autopep8 in keymap

2022-05-13 Thread Sergey Sharybin
Commit: 613dd855413f960d0b318d01c63165b2c53e56dc
Author: Sergey Sharybin
Date:   Fri May 13 09:46:35 2022 +0200
Branches: tracking_tools
https://developer.blender.org/rB613dd855413f960d0b318d01c63165b2c53e56dc

Cleanup: Autopep8 in keymap

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 18fd0f76d9c..c3d1fc8a3a3 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -6637,6 +6637,7 @@ def km_clip_editor_tool_select_box(params):
 )},
 )
 
+
 def km_clip_editor_tool_select_lasso(params):
 return (
 "Clip Editor: Select Lasso",
@@ -6646,6 +6647,7 @@ def km_clip_editor_tool_select_lasso(params):
 )},
 )
 
+
 def km_clip_editor_tool_select_circle(params):
 return (
 "Clip Editor: Select Circle",
@@ -6656,6 +6658,7 @@ def km_clip_editor_tool_select_circle(params):
 )},
 )
 
+
 def km_clip_editor_tool_add_marker_tweak(params):
 return (
 "Clip Editor: Add Marker and Tweak",

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f10d718df82] gpencil-new-data-proposal: Remove unessecary include

2022-05-13 Thread Falk David
Commit: f10d718df82afe5519be27b5433743256d095c6b
Author: Falk David
Date:   Thu May 12 18:06:17 2022 +0200
Branches: gpencil-new-data-proposal
https://developer.blender.org/rBf10d718df82afe5519be27b5433743256d095c6b

Remove unessecary include

===

M   source/blender/blenkernel/intern/gpencil_new_proposal_test.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc 
b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
index 3b91fedb08a..134d9b075d8 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
@@ -6,7 +6,7 @@
 
 #include "testing/testing.h"
 #include 
-#include 
+
 
 #include "BKE_curves.hh"
 #include "BKE_gpencil.h"

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [80078ef3af0] gpencil-new-data-proposal: Rename test

2022-05-13 Thread Falk David
Commit: 80078ef3af0ad64f7bfe01557da616228e796993
Author: Falk David
Date:   Fri May 13 10:29:18 2022 +0200
Branches: gpencil-new-data-proposal
https://developer.blender.org/rB80078ef3af0ad64f7bfe01557da616228e796993

Rename test

===

M   source/blender/blenkernel/intern/gpencil_new_proposal_test.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc 
b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
index 54e9afbb98a..d7ce5c803c6 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
@@ -7,7 +7,6 @@
 #include "testing/testing.h"
 #include 
 
-
 #include "BKE_curves.hh"
 #include "BKE_gpencil.h"
 
@@ -929,9 +928,10 @@ TEST(gpencil_proposal, BigGPData)
   EXPECT_EQ(data.points_num(), 25e6);
 }
 
-TEST(gpencil_proposal, BigGPDataCopy)
+TEST(gpencil_proposal, TimeBigGPDataCopy)
 {
   int layers_num = 10, frames_num = 500, strokes_num = 100, points_num = 100;
+
   GPData data = build_gpencil_data(layers_num, frames_num, strokes_num, 
points_num);
   GPData data_copy;
 
@@ -939,9 +939,6 @@ TEST(gpencil_proposal, BigGPDataCopy)
   data_copy = data;
   TIMEIT_END(BigGPDataCopy);
 
-  EXPECT_EQ(data_copy.strokes_num(), layers_num * frames_num * strokes_num);
-  EXPECT_EQ(data_copy.points_num(), layers_num * frames_num * strokes_num * 
points_num);
-
   bGPdata *old_data = build_old_gpencil_data(layers_num, frames_num, 
strokes_num, points_num);
   bGPdata *old_data_copy;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ad24b503656] gpencil-new-data-proposal: Fix memory corruption with strings

2022-05-13 Thread Falk David
Commit: ad24b503656386323b86311282f8642386513dea
Author: Falk David
Date:   Fri May 13 10:28:23 2022 +0200
Branches: gpencil-new-data-proposal
https://developer.blender.org/rBad24b503656386323b86311282f8642386513dea

Fix memory corruption with strings

===

M   source/blender/blenkernel/intern/gpencil_new_proposal_test.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc 
b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
index b2bd19b6085..54e9afbb98a 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
@@ -647,9 +647,9 @@ static GPData build_gpencil_data(int num_layers,
 {
   GPData gpd;
 
-  Vector test_names;
+  Vector test_names;
   for (const int i : IndexRange(num_layers)) {
-test_names.append("GPLayer" + i);
+test_names.append(std::string("GPLayer") + std::to_string(i));
   }
   gpd.add_layers(test_names.as_span());

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bf4ce584927] gpencil-new-data-proposal: Use MEM_malloc* instead of MEM_calloc*

2022-05-13 Thread Falk David
Commit: bf4ce58492750491d353ad3b907e9dc4acffbdf1
Author: Falk David
Date:   Fri May 13 10:27:52 2022 +0200
Branches: gpencil-new-data-proposal
https://developer.blender.org/rBbf4ce58492750491d353ad3b907e9dc4acffbdf1

Use MEM_malloc* instead of MEM_calloc*

===

M   source/blender/blenkernel/intern/gpencil_new_proposal_test.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc 
b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
index ff4da413f09..b2bd19b6085 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
@@ -280,7 +280,7 @@ class GPData : public ::GPData {
 
 if (this->frames_size > 0) {
   this->frames_array = reinterpret_cast<::GPFrame *>(
-  MEM_calloc_arrayN(this->frames_size, sizeof(::GPFrame), __func__));
+  MEM_malloc_arrayN(this->frames_size, sizeof(::GPFrame), __func__));
   default_construct_n(reinterpret_cast(this->frames_array), 
this->frames_size);
 }
 else {
@@ -290,7 +290,7 @@ class GPData : public ::GPData {
 
 if (this->layers_size > 0) {
   this->layers_array = reinterpret_cast<::GPLayer *>(
-  MEM_calloc_arrayN(this->layers_size, sizeof(::GPLayer), __func__));
+  MEM_malloc_arrayN(this->layers_size, sizeof(::GPLayer), __func__));
   this->active_layer_index = 0;
 }
 else {
@@ -527,7 +527,7 @@ class GPData : public ::GPData {
 /* Copy frame data. */
 dst.frames_size = src.frames_size;
 dst.frames_array = reinterpret_cast<::GPFrame *>(
-MEM_calloc_arrayN(dst.frames_size, sizeof(::GPFrame), __func__));
+MEM_malloc_arrayN(dst.frames_size, sizeof(::GPFrame), __func__));
 uninitialized_copy_n(reinterpret_cast(src.frames_array),
  src.frames_size,
  reinterpret_cast(dst.frames_array));
@@ -537,7 +537,7 @@ class GPData : public ::GPData {
 MEM_SAFE_FREE(dst.layers_array);
 dst.layers_size = src.layers_size;
 dst.layers_array = reinterpret_cast<::GPLayer *>(
-MEM_calloc_arrayN(dst.layers_size, sizeof(::GPLayer), __func__));
+MEM_malloc_arrayN(dst.layers_size, sizeof(::GPLayer), __func__));
 uninitialized_copy_n(reinterpret_cast(src.layers_array),
  src.layers_size,
  reinterpret_cast(dst.layers_array));
@@ -605,7 +605,7 @@ class GPData : public ::GPData {
 this->frames_size = size;
 
 ::GPFrame *new_array = reinterpret_cast<::GPFrame *>(
-MEM_calloc_arrayN(this->frames_size, sizeof(::GPFrame), __func__));
+MEM_malloc_arrayN(this->frames_size, sizeof(::GPFrame), __func__));
 if (new_array == nullptr) {
   return false;
 }
@@ -614,6 +614,8 @@ class GPData : public ::GPData {
   uninitialized_relocate_n(reinterpret_cast(this->frames_array),
old_size,
reinterpret_cast(new_array));
+  default_construct_n(reinterpret_cast(new_array + old_size),
+  this->frames_size - old_size);
   MEM_SAFE_FREE(this->frames_array);
   this->frames_array = new_array;
 }
@@ -674,20 +676,28 @@ static bGPdata *build_old_gpencil_data(int num_layers,
int strokes_per_layer,
int points_per_stroke)
 {
-  bGPdata *gpd = reinterpret_cast(MEM_callocN(sizeof(bGPdata), 
__func__));
+  bGPdata *gpd = reinterpret_cast(MEM_mallocN(sizeof(bGPdata), 
__func__));
+  BLI_listbase_clear(&gpd->layers);
   for (int i = 0; i < num_layers; i++) {
-bGPDlayer *gpl = reinterpret_cast(MEM_callocN(sizeof(bGPDlayer), __func__));
+bGPDlayer *gpl = reinterpret_cast(MEM_mallocN(sizeof(bGPDlayer), __func__));
 sprintf(gpl->info, "%s%d", "GPLayer", i);
 
+BLI_listbase_clear(&gpl->mask_layers);
+BLI_listbase_clear(&gpl->frames);
 for (int j = 0; j < frames_per_layer; j++) {
-  bGPDframe *gpf = reinterpret_cast(MEM_callocN(sizeof(bGPDframe), __func__));
+  bGPDframe *gpf = reinterpret_cast(MEM_mallocN(sizeof(bGPDframe), __func__));
   gpf->framenum = j;
 
+  BLI_listbase_clear(&gpf->strokes);
   for (int k = 0; k < strokes_per_layer; k++) {
 bGPDstroke *gps = reinterpret_cast(
-MEM_callocN(sizeof(bGPDstroke), __func__));
+MEM_mallocN(sizeof(bGPDstroke), __func__));
+gps->totpoints = points_per_stroke;
 gps->points = reinterpret_cast(
 MEM_calloc_arrayN(points_per_stroke, sizeof(bGPDspoint), 
__func__));
+gps->triangles = nullptr;
+gps->editcurve = nullptr;
+gps->dvert = nullptr;
 
 for (int l = 0; l < points_per_stroke; l++) {
   float pos[3] = {(float)l, (float)((l * k) % points_per_stroke), 
(float)(l 

[Bf-blender-cvs] [20e11d2f359] gpencil-new-data-proposal: Clear strokes pointer after frame move

2022-05-13 Thread Falk David
Commit: 20e11d2f359bb79c40fea6d6aeb6e7e02ac74f9c
Author: Falk David
Date:   Thu May 12 18:06:45 2022 +0200
Branches: gpencil-new-data-proposal
https://developer.blender.org/rB20e11d2f359bb79c40fea6d6aeb6e7e02ac74f9c

Clear strokes pointer after frame move

===

M   source/blender/blenkernel/intern/gpencil_new_proposal_test.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc 
b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
index 134d9b075d8..ff4da413f09 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
@@ -160,6 +160,7 @@ class GPFrame : public ::GPFrame {
   {
 if (this != &other) {
   std::swap(this->strokes, other.strokes);
+  other.strokes = nullptr;
 }
 this->layer_index = other.layer_index;
   }
@@ -168,6 +169,7 @@ class GPFrame : public ::GPFrame {
   {
 if (this != &other) {
   std::swap(this->strokes, other.strokes);
+  other.strokes = nullptr;
 }
 this->layer_index = other.layer_index;
 this->start_time = other.start_time;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3a049fc3a03] gpencil-new-data-proposal: Merge branch 'master' into gpencil-new-data-proposal

2022-05-13 Thread Antonio Vazquez
Commit: 3a049fc3a03e9128c9e2b45a33f289cbe3eef0f0
Author: Antonio Vazquez
Date:   Fri May 13 10:22:25 2022 +0200
Branches: gpencil-new-data-proposal
https://developer.blender.org/rB3a049fc3a03e9128c9e2b45a33f289cbe3eef0f0

Merge branch 'master' into gpencil-new-data-proposal

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [42d748be342] master: pyproject: re-enable line wrapping for autopep8

2022-05-13 Thread Campbell Barton
Commit: 42d748be3425821400677db99a6e2c079d9e271c
Author: Campbell Barton
Date:   Fri May 13 18:03:11 2022 +1000
Branches: master
https://developer.blender.org/rB42d748be3425821400677db99a6e2c079d9e271c

pyproject: re-enable line wrapping for autopep8

The problem noted in the configuration file no longer occurs,
re-enabling line wrapping (E501).

===

M   pyproject.toml

===

diff --git a/pyproject.toml b/pyproject.toml
index 283e4c40db2..22d2d768d08 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -20,11 +20,6 @@ ignore = [
 # Why disable? Re-ordering imports is disruptive and breaks some scripts
 # that need to check if a module has already been loaded in the case of 
reloading.
 "E402",
-# Info: Try to make lines fit within --max-line-length characters.
-# Why disable? Causes lines to be wrapped, where long lines have the 
trailing bracket moved to the end of the line.
-# If trailing commas were respected as they are by clang-format this might 
be acceptable.
-# Note that this doesn't disable all line wrapping.
-"E501",
 # Info: Fix various deprecated code (via lib2to3)
 # Why disable? Does nothing besides incorrectly adding a duplicate import,
 # could be reported as a bug except this is likely to be removed soon, see:

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs