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

2022-06-02 Thread Campbell Barton
Commit: 9ad19b0453f0e1d2f4653de608a71d3062092060
Author: Campbell Barton
Date:   Fri Jun 3 13:15:35 2022 +1000
Branches: master
https://developer.blender.org/rB9ad19b0453f0e1d2f4653de608a71d3062092060

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] [c4701a027fe] blender-v3.2-release: Fix T98558: island selection in UV editor can crash

2022-06-02 Thread Philipp Oeser
Commit: c4701a027fed83d2aea4f0f26a845e4d6852b1ff
Author: Philipp Oeser
Date:   Fri Jun 3 13:10:36 2022 +1000
Branches: blender-v3.2-release
https://developer.blender.org/rBc4701a027fed83d2aea4f0f26a845e4d6852b1ff

Fix T98558: island selection in UV editor can crash

Regression in [0]. When zoomed in, we can be within the face of an
island but too far from an edge, in this case
uv_find_nearest_face_multi_ex is used instead of
uv_find_nearest_edge_multi with the consequence that hit.l cannot be
used in uvedit_uv_select_test (it is NULL).

Instead, use uvedit_face_select_test instead in this case.

[0]: d356edf420ba13b3a544dcc598a0e31a36e1d86c

Reviewed By: campbellbarton

Ref D15100

===

M   source/blender/editors/uvedit/uvedit_select.c

===

diff --git a/source/blender/editors/uvedit/uvedit_select.c 
b/source/blender/editors/uvedit/uvedit_select.c
index 6405d2df66a..a999c9b491f 100644
--- a/source/blender/editors/uvedit/uvedit_select.c
+++ b/source/blender/editors/uvedit/uvedit_select.c
@@ -2493,8 +2493,15 @@ static bool uv_mouse_select_multi(bContext *C,
 else if (selectmode == UV_SELECT_EDGE) {
   is_selected = uvedit_edge_select_test(scene, hit.l, cd_loop_uv_offset);
 }
-else { /* Vertex or island. */
-  is_selected = uvedit_uv_select_test(scene, hit.l, cd_loop_uv_offset);
+else {
+  /* Vertex or island. For island (if we were using 
#uv_find_nearest_face_multi_ex, see above),
+   * `hit.l` is NULL, use `hit.efa` instead. */
+  if (hit.l != NULL) {
+is_selected = uvedit_uv_select_test(scene, hit.l, cd_loop_uv_offset);
+  }
+  else {
+is_selected = uvedit_face_select_test(scene, hit.efa, 
cd_loop_uv_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] [f90aeb0152a] temp-pbvh-split: temp-pbvh-split: Remove debug macro

2022-06-02 Thread Joseph Eagar
Commit: f90aeb0152a4b2309ae4a97503c8fa84acdb4045
Author: Joseph Eagar
Date:   Thu Jun 2 16:47:03 2022 -0700
Branches: temp-pbvh-split
https://developer.blender.org/rBf90aeb0152a4b2309ae4a97503c8fa84acdb4045

temp-pbvh-split: Remove debug macro

===

M   source/blender/blenkernel/BKE_pbvh.h

===

diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index bea99b81c0f..3df0c6bc12e 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -594,14 +594,3 @@ bool BKE_pbvh_draw_cache_invalid(const PBVH *pbvh);
 #ifdef __cplusplus
 }
 #endif
-
-/* Disable optimization for a function (for debugging use only!)*/
-#ifdef __clang__
-#  define ATTR_NO_OPT __attribute__((optnone))
-#elif defined(_MSC_VER)
-#  define ATTR_NO_OPT __pragma(optimize("", off))
-#elif defined(__GNUC__)
-#  define ATTR_NO_OPT __attribute__((optimize("O0")))
-#else
-#  define ATTR_NO_OPT
-#endif

___
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] [68519715014] temp-pbvh-split: temp-pbvh-split: Use task api correctly.

2022-06-02 Thread Joseph Eagar
Commit: 6851971501470788fbf70cccf3fc116296377673
Author: Joseph Eagar
Date:   Thu Jun 2 16:43:37 2022 -0700
Branches: temp-pbvh-split
https://developer.blender.org/rB6851971501470788fbf70cccf3fc116296377673

temp-pbvh-split: Use task api correctly.

BLI_task_pool_push could use a comment clarify that
you can call it within threads, and also that there's
no overhead to doing so.

===

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

===

diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc 
b/source/blender/blenkernel/intern/pbvh_pixels.cc
index ebb4446e302..87e684dd1e9 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels.cc
@@ -72,17 +72,13 @@ int count_node_pixels(PBVHNode )
 }
 
 struct SplitQueueData {
-  ThreadQueue *queue;
   ThreadQueue *new_nodes;
-  int thread_num;
+  TaskPool *pool;
 
   PBVH *pbvh;
   Mesh *mesh;
   Image *image;
   ImageUser *image_user;
-
-  std::atomic *working;
-  std::atomic *nodes_num;
 };
 
 struct SplitNodePair {
@@ -92,6 +88,7 @@ struct SplitNodePair {
   int depth = 0;
   int source_index = -1;
   bool is_old = false;
+  SplitQueueData *tdata;
 
   SplitNodePair(SplitNodePair *node_parent = nullptr) : parent(node_parent)
   {
@@ -99,6 +96,8 @@ struct SplitNodePair {
   }
 };
 
+static void split_thread_job(TaskPool *__restrict pool, void *taskdata);
+
 static void split_pixel_node(PBVH *pbvh,
  SplitNodePair *split,
  Mesh *mesh,
@@ -111,8 +110,6 @@ static void split_pixel_node(PBVH *pbvh,
 
   cb = node->vb;
 
-  tdata->nodes_num->fetch_add(2);
-
   if (count_node_pixels(*node) <= pbvh->pixel_leaf_limit || split->depth >= 
pbvh->depth_limit) {
 BKE_pbvh_pixels_node_data_get(split->node).rebuild_undo_regions();
 return;
@@ -255,8 +252,8 @@ static void split_pixel_node(PBVH *pbvh,
   BLI_thread_queue_push(tdata->new_nodes, static_cast(split1));
   BLI_thread_queue_push(tdata->new_nodes, static_cast(split2));
 
-  BLI_thread_queue_push(tdata->queue, static_cast(split1));
-  BLI_thread_queue_push(tdata->queue, static_cast(split2));
+  BLI_task_pool_push(tdata->pool, split_thread_job, static_cast(split1), false, nullptr);
+  BLI_task_pool_push(tdata->pool, split_thread_job, static_cast(split2), false, nullptr);
 }
 
 static void split_flush_final_nodes(SplitQueueData *tdata)
@@ -296,41 +293,13 @@ static void split_flush_final_nodes(SplitQueueData *tdata)
   }
 }
 
-extern "C" static void split_thread_job(TaskPool *__restrict pool, void 
*taskdata)
+static void split_thread_job(TaskPool *__restrict pool, void *taskdata)
 {
-  SplitQueueData *tdata = static_cast(BLI_task_pool_user_data(pool));
-  int thread_nr = POINTER_AS_UINT(taskdata);
-
-  tdata->working[thread_nr].store(false);
-
-  while (1) {
-void *work = BLI_thread_queue_pop_timeout(tdata->queue, 1);
-
-if (work) {
-  SplitNodePair *split = static_cast(work);
 
-  /* Signal to other threads that we are working, needed to prevent
- premature task exit when the queue is temporarily empty. */
-  tdata->working[thread_nr].store(true);
-  split_pixel_node(tdata->pbvh, split, tdata->mesh, tdata->image, 
tdata->image_user, tdata);
-  tdata->working[thread_nr].store(false);
-  continue;
-}
-
-bool ok = true;
-
-for (int i : IndexRange(tdata->thread_num)) {
-  if (tdata->working[i].load()) {
-ok = false;
-break;
-  }
-}
+  SplitQueueData *tdata = static_cast(BLI_task_pool_user_data(pool));
+  SplitNodePair *split = static_cast(taskdata);
 
-/* No nodes left in queue? End task. */
-if (ok) {
-  break;
-}
-  }
+  split_pixel_node(tdata->pbvh, split, tdata->mesh, tdata->image, 
tdata->image_user, tdata);
 }
 
 static void split_pixel_nodes(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser 
*image_user)
@@ -348,15 +317,14 @@ static void split_pixel_nodes(PBVH *pbvh, Mesh *mesh, 
Image *image, ImageUser *i
   }
 
   SplitQueueData tdata;
+  TaskPool *pool = BLI_task_pool_create_suspended(, TASK_PRIORITY_HIGH);
 
-  tdata.nodes_num = MEM_new>("tdata.nodes_num");
-  tdata.nodes_num->store(pbvh->totnode);
+  tdata.pool = pool;
   tdata.pbvh = pbvh;
   tdata.mesh = mesh;
   tdata.image = image;
   tdata.image_user = image_user;
 
-  tdata.queue = BLI_thread_queue_init();
   tdata.new_nodes = BLI_thread_queue_init();
 
   /* Set up initial jobs before initializing threads. */
@@ -367,36 +335,20 @@ static void split_pixel_nodes(PBVH *pbvh, Mesh *mesh, 
Image *image, ImageUser *i
   split->source_index = i;
   split->is_old = true;
   split->node = pbvh->nodes[i];
+  split->tdata = 
+
+  BLI_task_pool_push(pool, split_thread_job, static_cast(split), 
false, nullptr);
 
-  BLI_thread_queue_push(tdata.queue, static_cast(split));
   

[Bf-blender-cvs] [d55dc9a3b18] temp-pbvh-split: temp-pbvh-split: Remove debug printf

2022-06-02 Thread Joseph Eagar
Commit: d55dc9a3b18bd138521ad8191ccfc06bf9cb0d0f
Author: Joseph Eagar
Date:   Thu Jun 2 16:15:49 2022 -0700
Branches: temp-pbvh-split
https://developer.blender.org/rBd55dc9a3b18bd138521ad8191ccfc06bf9cb0d0f

temp-pbvh-split: Remove debug printf

===

M   source/blender/editors/space_image/image_undo.c

===

diff --git a/source/blender/editors/space_image/image_undo.c 
b/source/blender/editors/space_image/image_undo.c
index 3ed8002357c..1fd9fde084b 100644
--- a/source/blender/editors/space_image/image_undo.c
+++ b/source/blender/editors/space_image/image_undo.c
@@ -204,10 +204,6 @@ void *ED_image_paint_tile_push(ListBase *paint_tiles,
   ptile->x_tile = x_tile;
   ptile->y_tile = y_tile;
 
-  if (x_tile < 0 || y_tile < 0 || x_tile >= 1000 || y_tile >= 1000) {
-printf("error!\n");
-  }
-
   /* add mask explicitly here */
   if (r_mask) {
 *r_mask = ptile->mask = MEM_callocN(sizeof(ushort) * 
square_i(ED_IMAGE_UNDO_TILE_SIZE),

___
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] [f2d39b810b4] temp-pbvh-split: Enable inlining on Apple Silicon. Use new process-wide ShaderCache in order to safely re-enable binary archives

2022-06-02 Thread Michael Jones
Commit: f2d39b810b4902bb5accbac7c5b2e8ec1e60c679
Author: Michael Jones
Date:   Wed May 11 14:52:49 2022 +0100
Branches: temp-pbvh-split
https://developer.blender.org/rBf2d39b810b4902bb5accbac7c5b2e8ec1e60c679

Enable inlining on Apple Silicon. Use new process-wide ShaderCache in order to 
safely re-enable binary archives

This patch is the same as D14763, but with a fix for unit test failures caused 
by ShaderCache fetch logic not working in the non-MetalRT case:

```
diff --git a/intern/cycles/device/metal/kernel.mm 
b/intern/cycles/device/metal/kernel.mm
index ad268ae7057..6aa1a56056e 100644
--- a/intern/cycles/device/metal/kernel.mm
+++ b/intern/cycles/device/metal/kernel.mm
@@ -203,9 +203,12 @@ bool kernel_has_intersection(DeviceKernel device_kernel)

   /* metalrt options */
   request.pipeline->use_metalrt = device->use_metalrt;
-  request.pipeline->metalrt_hair = device->kernel_features & 
KERNEL_FEATURE_HAIR;
-  request.pipeline->metalrt_hair_thick = device->kernel_features & 
KERNEL_FEATURE_HAIR_THICK;
-  request.pipeline->metalrt_pointcloud = device->kernel_features & 
KERNEL_FEATURE_POINTCLOUD;
+  request.pipeline->metalrt_hair = device->use_metalrt &&
+   (device->kernel_features & 
KERNEL_FEATURE_HAIR);
+  request.pipeline->metalrt_hair_thick = device->use_metalrt &&
+ (device->kernel_features & 
KERNEL_FEATURE_HAIR_THICK);
+  request.pipeline->metalrt_pointcloud = device->use_metalrt &&
+ (device->kernel_features & 
KERNEL_FEATURE_POINTCLOUD);

   {
 thread_scoped_lock lock(cache_mutex);
@@ -225,9 +228,9 @@ bool kernel_has_intersection(DeviceKernel device_kernel)

   /* metalrt options */
   bool use_metalrt = device->use_metalrt;
-  bool metalrt_hair = device->kernel_features & KERNEL_FEATURE_HAIR;
-  bool metalrt_hair_thick = device->kernel_features & 
KERNEL_FEATURE_HAIR_THICK;
-  bool metalrt_pointcloud = device->kernel_features & 
KERNEL_FEATURE_POINTCLOUD;
+  bool metalrt_hair = use_metalrt && (device->kernel_features & 
KERNEL_FEATURE_HAIR);
+  bool metalrt_hair_thick = use_metalrt && (device->kernel_features & 
KERNEL_FEATURE_HAIR_THICK);
+  bool metalrt_pointcloud = use_metalrt && (device->kernel_features & 
KERNEL_FEATURE_POINTCLOUD);

   MetalKernelPipeline *best_pipeline = nullptr;
   for (auto  : collection) {

```

Reviewed By: brecht

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

===

M   intern/cycles/device/metal/device_impl.h
M   intern/cycles/device/metal/device_impl.mm
M   intern/cycles/device/metal/kernel.h
M   intern/cycles/device/metal/kernel.mm
M   intern/cycles/device/metal/queue.mm
M   intern/cycles/kernel/device/metal/compat.h

===

diff --git a/intern/cycles/device/metal/device_impl.h 
b/intern/cycles/device/metal/device_impl.h
index 27c58ce6d2f..7506b9b069f 100644
--- a/intern/cycles/device/metal/device_impl.h
+++ b/intern/cycles/device/metal/device_impl.h
@@ -28,7 +28,8 @@ class MetalDevice : public Device {
   id mtlGeneralCommandQueue = nil;
   id mtlAncillaryArgEncoder =
   nil; /* encoder used for fetching device pointers from MTLBuffers */
-  string source_used_for_compile[PSO_NUM];
+  string source[PSO_NUM];
+  string source_md5[PSO_NUM];
 
   KernelParamsMetal launch_params = {0};
 
@@ -72,7 +73,6 @@ class MetalDevice : public Device {
   id texture_bindings_3d = nil;
   std::vector> texture_slot_map;
 
-  MetalDeviceKernels kernels;
   bool use_metalrt = false;
   bool use_function_specialisation = false;
 
@@ -110,6 +110,8 @@ class MetalDevice : public Device {
 
   virtual void build_bvh(BVH *bvh, Progress , bool refit) override;
 
+  id compile(string const );
+
   /* -- */
   /* low-level memory management */
 
diff --git a/intern/cycles/device/metal/device_impl.mm 
b/intern/cycles/device/metal/device_impl.mm
index c01f51fb506..e1438a9d6e2 100644
--- a/intern/cycles/device/metal/device_impl.mm
+++ b/intern/cycles/device/metal/device_impl.mm
@@ -275,96 +275,44 @@ bool MetalDevice::load_kernels(const uint 
_kernel_features)
* active, but may still need to be rendered without motion blur if that 
isn't active as well. */
   motion_blur = kernel_features & KERNEL_FEATURE_OBJECT_MOTION;
 
-  NSError *error = NULL;
+  source[PSO_GENERIC] = get_source(kernel_features);
+  mtlLibrary[PSO_GENERIC] = compile(source[PSO_GENERIC]);
 
-  for (int i = 0; i < PSO_NUM; i++) {
-if (mtlLibrary[i]) {
-  [mtlLibrary[i] release];
-  mtlLibrary[i] = nil;
-}
-  }
+  MD5Hash md5;
+  md5.append(source[PSO_GENERIC]);
+  source_md5[PSO_GENERIC] = md5.get_hex();
+
+  metal_printf("Front-end compilation finished (generic)\n");
+
+  bool result = MetalDeviceKernels::load(this, false);
+
+  

[Bf-blender-cvs] [1ebfd4294e9] temp-pbvh-split: Curves: Adjust sculpt mode UI layouts

2022-06-02 Thread Hans Goudey
Commit: 1ebfd4294e9c3b6a1338ee7fc28673c4d69e6b64
Author: Hans Goudey
Date:   Wed May 11 15:47:49 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB1ebfd4294e9c3b6a1338ee7fc28673c4d69e6b64

Curves: Adjust sculpt mode UI layouts

This patch adjusts the UI layouts for the tool header and the tool
properties in sculpt mode in a few ways. The goals are to better group
related settings, keep fundamental settings easily accessible, fix the
availability of some options, and make better use of space.

1. Remove ID template in tool header
2. Rename "Add Amount" to "Count" for add brush
3. Add "use pressure" toggles to radius and strength sliders
4. Move strength falloff to a popover
5. Move many "Add" brush settings to popover called "Curve Shape"
6. Move two "Grow/Shrink" options to a popover called "Scaling"
7. Don't display "Falloff" panel in properties when it has no effect

See the differential revision for screenshots and more reasoning.

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

===

M   release/scripts/startup/bl_ui/properties_paint_common.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/makesrna/intern/rna_brush.c

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index e3decd7fcdd..b8136f26e90 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -405,7 +405,13 @@ class FalloffPanel(BrushPanel):
 if not super().poll(context):
 return False
 settings = cls.paint_settings(context)
-return (settings and settings.brush and settings.brush.curve)
+if not (settings and settings.brush and settings.brush.curve):
+return False
+if cls.get_brush_mode(context) == 'SCULPT_CURVES':
+brush = settings.brush
+if brush.curves_sculpt_tool in {'ADD', 'DELETE'}:
+return False
+return True
 
 def draw(self, context):
 layout = self.layout
@@ -432,7 +438,13 @@ class FalloffPanel(BrushPanel):
 row.operator("brush.curve_preset", icon='LINCURVE', text="").shape 
= 'LINE'
 row.operator("brush.curve_preset", icon='NOCURVE', text="").shape 
= 'MAX'
 
-if mode in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'SCULPT_CURVES'} 
and brush.sculpt_tool != 'POSE':
+show_fallof_shape = False
+if mode in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT'} and 
brush.sculpt_tool != 'POSE':
+show_fallof_shape = True
+if not show_fallof_shape and mode == 'SCULPT_CURVES' and 
context.space_data.type == 'PROPERTIES':
+show_fallof_shape = True
+
+if show_fallof_shape:
 col.separator()
 row = col.row(align=True)
 row.use_property_split = True
@@ -772,11 +784,19 @@ def brush_settings(layout, context, brush, popover=False):
 elif mode == 'SCULPT_CURVES':
 if brush.curves_sculpt_tool == 'ADD':
 layout.prop(brush.curves_sculpt_settings, "add_amount")
-layout.prop(brush.curves_sculpt_settings, "points_per_curve")
 layout.prop(brush.curves_sculpt_settings, "curve_length")
-layout.prop(brush.curves_sculpt_settings, "interpolate_length")
-layout.prop(brush.curves_sculpt_settings, "interpolate_shape")
-layout.prop(brush.curves_sculpt_settings, 
"interpolate_point_count")
+col = layout.column(heading="Interpolate", align=True)
+col.prop(brush.curves_sculpt_settings, "interpolate_length", 
text="Length")
+col.prop(brush.curves_sculpt_settings, "interpolate_shape", 
text="Shape")
+col.prop(brush.curves_sculpt_settings, "interpolate_point_count", 
text="Point Count")
+
+col = layout.column()
+col.active = not brush.curves_sculpt_settings.interpolate_length
+col.prop(brush.curves_sculpt_settings, "curve_length")
+
+col = layout.column()
+col.active = not 
brush.curves_sculpt_settings.interpolate_point_count
+col.prop(brush.curves_sculpt_settings, "points_per_curve")
 use_frontface = True
 elif brush.curves_sculpt_tool == 'GROW_SHRINK':
 layout.prop(brush.curves_sculpt_settings, "scale_uniform")
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 9ea120616f4..4ff62b2ca00 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -484,22 +484,22 @@ class _draw_tool_settings_context_mode:
 
 tool_settings = context.tool_settings
 paint = tool_settings.curves_sculpt
-layout.template_ID_preview(paint, 

[Bf-blender-cvs] [6047cb77089] temp-pbvh-split: Merge remote-tracking branch 'origin' into temp-pbvh-split

2022-06-02 Thread Joseph Eagar
Commit: 6047cb7708964937052854c2ebf91f11237f52bf
Author: Joseph Eagar
Date:   Thu Jun 2 16:13:51 2022 -0700
Branches: temp-pbvh-split
https://developer.blender.org/rB6047cb7708964937052854c2ebf91f11237f52bf

Merge remote-tracking branch 'origin' into temp-pbvh-split

===



===



___
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] [c6445efe72b] temp-pbvh-split: Cleanup: rename BLI_str_format_attribute_domain_size

2022-06-02 Thread Campbell Barton
Commit: c6445efe72bc877740c8b84f257a5ed6c73851be
Author: Campbell Barton
Date:   Wed May 11 22:46:19 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rBc6445efe72bc877740c8b84f257a5ed6c73851be

Cleanup: rename BLI_str_format_attribute_domain_size

This is useful without any functionality specific to attribute domains,
rename to `BLI_str_format_decimal_unit` to follow naming of a similar
function `BLI_str_format_byte_unit`.

===

M   source/blender/blenlib/BLI_string.h
M   source/blender/blenlib/intern/string.c
M   source/blender/blenlib/tests/BLI_string_test.cc
M   source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc

===

diff --git a/source/blender/blenlib/BLI_string.h 
b/source/blender/blenlib/BLI_string.h
index 0344622e81d..15926e8f2d2 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -307,7 +307,7 @@ void BLI_str_format_byte_unit(char dst[15], long long int 
bytes, bool base_10) A
  *
  * Length of 7 is the maximum of the resulting string, for example, `-15.5K\0`.
  */
-void BLI_str_format_attribute_domain_size(char dst[7], int number_to_format) 
ATTR_NONNULL();
+void BLI_str_format_decimal_unit(char dst[7], int number_to_format) 
ATTR_NONNULL();
 /**
  * Compare two strings without regard to case.
  *
diff --git a/source/blender/blenlib/intern/string.c 
b/source/blender/blenlib/intern/string.c
index 8387eb5f4f9..976b9a5cd02 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -1155,7 +1155,7 @@ void BLI_str_format_byte_unit(char dst[15], long long int 
bytes, const bool base
   BLI_strncpy(dst + len, base_10 ? units_base_10[order] : units_base_2[order], 
dst_len - len);
 }
 
-void BLI_str_format_attribute_domain_size(char dst[7], int number_to_format)
+void BLI_str_format_decimal_unit(char dst[7], int number_to_format)
 {
   float number_to_format_converted = number_to_format;
   int order = 0;
diff --git a/source/blender/blenlib/tests/BLI_string_test.cc 
b/source/blender/blenlib/tests/BLI_string_test.cc
index 6c16af5767c..eaaa65dd39f 100644
--- a/source/blender/blenlib/tests/BLI_string_test.cc
+++ b/source/blender/blenlib/tests/BLI_string_test.cc
@@ -420,98 +420,98 @@ TEST(string, StrFormatByteUnits)
   EXPECT_STREQ("-8191.8472 PiB", size_str);
 }
 
-/* BLI_str_format_attribute_domain_size */
-TEST(string, StrFormatAttributeDomainSize)
+/* BLI_str_format_decimal_unit */
+TEST(string, StrFormatDecimalUnits)
 {
   char size_str[7];
   int size;
 
-  BLI_str_format_attribute_domain_size(size_str, size = 0);
+  BLI_str_format_decimal_unit(size_str, size = 0);
   EXPECT_STREQ("0", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 1);
+  BLI_str_format_decimal_unit(size_str, size = 1);
   EXPECT_STREQ("1", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 10);
+  BLI_str_format_decimal_unit(size_str, size = 10);
   EXPECT_STREQ("10", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 15);
+  BLI_str_format_decimal_unit(size_str, size = 15);
   EXPECT_STREQ("15", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 100);
+  BLI_str_format_decimal_unit(size_str, size = 100);
   EXPECT_STREQ("100", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 155);
+  BLI_str_format_decimal_unit(size_str, size = 155);
   EXPECT_STREQ("155", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 1000);
+  BLI_str_format_decimal_unit(size_str, size = 1000);
   EXPECT_STREQ("1.0K", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 1555);
+  BLI_str_format_decimal_unit(size_str, size = 1555);
   EXPECT_STREQ("1.6K", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 1);
+  BLI_str_format_decimal_unit(size_str, size = 1);
   EXPECT_STREQ("10.0K", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 1);
+  BLI_str_format_decimal_unit(size_str, size = 1);
   EXPECT_STREQ("15.6K", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 10);
+  BLI_str_format_decimal_unit(size_str, size = 10);
   EXPECT_STREQ("100K", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 10);
+  BLI_str_format_decimal_unit(size_str, size = 10);
   EXPECT_STREQ("100K", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 15);
+  BLI_str_format_decimal_unit(size_str, size = 15);
   EXPECT_STREQ("156K", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 100);
+  BLI_str_format_decimal_unit(size_str, size = 100);
   EXPECT_STREQ("1.0M", size_str);
-  BLI_str_format_attribute_domain_size(size_str, size = 155);
+  BLI_str_format_decimal_unit(size_str, size = 155);
   EXPECT_STREQ("1.6M", size_str);
-  

[Bf-blender-cvs] [91a488ad186] temp-pbvh-split: Fix (unreported) crash in Outliner Overrides Properties view in invalid cases.

2022-06-02 Thread Bastien Montagne
Commit: 91a488ad18680de2b9e17cfcd4b738e1b691f9dd
Author: Bastien Montagne
Date:   Wed May 11 15:14:44 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB91a488ad18680de2b9e17cfcd4b738e1b691f9dd

Fix (unreported) crash in Outliner Overrides Properties view in invalid cases.

We cannot try to get RNA info when the rna path of an override property
is invalid.

===

M   source/blender/editors/space_outliner/outliner_draw.cc
M   source/blender/editors/space_outliner/tree/tree_element_overrides.cc
M   source/blender/editors/space_outliner/tree/tree_element_overrides.hh

===

diff --git a/source/blender/editors/space_outliner/outliner_draw.cc 
b/source/blender/editors/space_outliner/outliner_draw.cc
index ff99416c213..57b0e2022ff 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -1809,6 +1809,25 @@ static void outliner_draw_overrides_rna_buts(uiBlock 
*block,
 TreeElementOverridesProperty _elem = 
*tree_element_cast(
 te);
 
+if (!override_elem.is_rna_path_valid) {
+  uiBut *but = uiDefBut(block,
+UI_BTYPE_LABEL,
+0,
+override_elem.rna_path.c_str(),
+x + pad_x,
+te->ys + pad_y,
+item_max_width,
+item_height,
+NULL,
+0.0f,
+0.0f,
+0.0f,
+0.0f,
+"");
+  UI_but_flag_enable(but, UI_BUT_REDALERT);
+  continue;
+}
+
 PointerRNA *ptr = _elem.override_rna_ptr;
 PropertyRNA *prop = _elem.override_rna_prop;
 const PropertyType prop_type = RNA_property_type(prop);
@@ -1936,8 +1955,9 @@ static bool outliner_draw_overrides_warning_buts(uiBlock 
*block,
 break;
   }
   case TSE_LIBRARY_OVERRIDE: {
-const bool is_rna_path_valid = (bool)(POINTER_AS_UINT(te->directdata));
-if (!is_rna_path_valid) {
+TreeElementOverridesProperty _override_prop =
+*tree_element_cast(te);
+if (!te_override_prop.is_rna_path_valid) {
   item_has_warnings = true;
   if (do_draw) {
 tip = TIP_(
diff --git 
a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc 
b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
index 857f5577e59..3a039da86c2 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
@@ -84,14 +84,13 @@ 
TreeElementOverridesProperty::TreeElementOverridesProperty(TreeElement _t

TreeElementOverridesData _data)
 : AbstractTreeElement(legacy_te),
   override_rna_ptr(override_data.override_rna_ptr),
-  override_rna_prop(override_data.override_rna_prop)
+  override_rna_prop(override_data.override_rna_prop),
+  rna_path(override_data.override_property.rna_path),
+  is_rna_path_valid(override_data.is_rna_path_valid)
 {
   BLI_assert(legacy_te.store_elem->type == TSE_LIBRARY_OVERRIDE);
 
   legacy_te.name = override_data.override_property.rna_path;
-  /* Abusing this for now, better way to do it is also pending current 
refactor of the whole tree
-   * code to use C++. */
-  legacy_te.directdata = POINTER_FROM_UINT(override_data.is_rna_path_valid);
 }
 
 }  // namespace blender::ed::outliner
diff --git 
a/source/blender/editors/space_outliner/tree/tree_element_overrides.hh 
b/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
index a2d1409f193..b42e1c37a0f 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
@@ -8,6 +8,8 @@
 
 #include "RNA_types.h"
 
+#include "BLI_string_ref.hh"
+
 #include "tree_element.hh"
 
 struct ID;
@@ -39,6 +41,9 @@ class TreeElementOverridesProperty final : public 
AbstractTreeElement {
   PointerRNA override_rna_ptr;
   PropertyRNA _rna_prop;
 
+  StringRefNull rna_path;
+  bool is_rna_path_valid;
+
  public:
   TreeElementOverridesProperty(TreeElement _te, 
TreeElementOverridesData _data);
 };

___
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] [5fa64f65657] temp-pbvh-split: Mesh: Add Auto Smooth option to Shade Smooth operator

2022-06-02 Thread Pablo Vazquez
Commit: 5fa64f65657616b37d8b0c06c526ab7a315dbbd2
Author: Pablo Vazquez
Date:   Wed May 11 11:54:14 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB5fa64f65657616b37d8b0c06c526ab7a315dbbd2

Mesh: Add Auto Smooth option to Shade Smooth operator

Add a property to the **Shade Smooth** operator to quickly enable the Mesh 
`use_auto_smooth` option.

The `Angle` property is exposed in the **Adjust Last Operation** panel to make 
it easy to tweak on multiple objects without having to go to the Properties 
editor.

The operator is exposed in the `Object` menu and `Object Context Menu`.

=== Demo ===

{F13066173, size=full}

Regarding the implementation, there are multiple ways to go about this (like 
making a whole new operator altogether), but I think a property is the 
cleanest/simplest.

I imagine there are simpler ways to achieve this without duplicating the 
`use_auto_smooth` property in the operator itself (getting it from the Mesh 
props?), but I couldn't find other operators doing something similar.

Reviewed By: #modeling, mont29

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

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/editors/object/object_edit.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 7bac7343bca..9ea120616f4 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2346,6 +2346,7 @@ class VIEW3D_MT_object(Menu):
 layout.separator()
 
 layout.operator("object.shade_smooth")
+layout.operator("object.shade_smooth", text="Shade Auto 
Smooth").use_auto_smooth = True
 layout.operator("object.shade_flat")
 
 layout.separator()
@@ -2588,7 +2589,8 @@ class VIEW3D_MT_object_context_menu(Menu):
 # Shared among some object types.
 if obj is not None:
 if obj.type in {'MESH', 'CURVE', 'SURFACE'}:
-layout.operator("object.shade_smooth", text="Shade Smooth")
+layout.operator("object.shade_smooth")
+layout.operator("object.shade_smooth", text="Shade Auto 
Smooth").use_auto_smooth = True
 layout.operator("object.shade_flat", text="Shade Flat")
 
 layout.separator()
diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index 091f30825ae..3e06a9d9e9c 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -204,6 +204,7 @@ bool BKE_mesh_material_index_used(struct Mesh *me, short 
index);
 void BKE_mesh_material_index_clear(struct Mesh *me);
 void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, 
unsigned int remap_len);
 void BKE_mesh_smooth_flag_set(struct Mesh *me, bool use_smooth);
+void BKE_mesh_auto_smooth_flag_set(struct Mesh *me, bool use_auto_smooth, 
float auto_smooth_angle);
 
 /**
  * Needed after converting a mesh with subsurf optimal display to mesh.
diff --git a/source/blender/blenkernel/intern/mesh.cc 
b/source/blender/blenkernel/intern/mesh.cc
index 628f59ae449..4e3544d0f60 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1577,6 +1577,19 @@ void BKE_mesh_smooth_flag_set(Mesh *me, const bool 
use_smooth)
   }
 }
 
+void BKE_mesh_auto_smooth_flag_set(Mesh *me,
+   const bool use_auto_smooth,
+   const float auto_smooth_angle)
+{
+  if (use_auto_smooth) {
+me->flag |= ME_AUTOSMOOTH;
+me->smoothresh = auto_smooth_angle;
+  }
+  else {
+me->flag &= ~ME_AUTOSMOOTH;
+  }
+}
+
 int poly_find_loop_from_vert(const MPoly *poly, const MLoop *loopstart, uint 
vert)
 {
   for (int j = 0; j < poly->totloop; j++, loopstart++) {
diff --git a/source/blender/editors/object/object_edit.c 
b/source/blender/editors/object/object_edit.c
index cb0e76c11e4..c9626e674f2 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -17,6 +17,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_ghash.h"
+#include "BLI_math_rotation.h"
 #include "BLI_utildefines.h"
 
 #include "BLT_translation.h"
@@ -86,6 +87,7 @@
 #include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
+#include "RNA_types.h"
 
 #include "UI_interface_icons.h"
 
@@ -1461,6 +1463,8 @@ void OBJECT_OT_paths_clear(wmOperatorType *ot)
 static int shade_smooth_exec(bContext *C, wmOperator *op)
 {
   const bool use_smooth = STREQ(op->idname, "OBJECT_OT_shade_smooth");
+  const bool use_auto_smooth = RNA_boolean_get(op->ptr, "use_auto_smooth");
+  const float auto_smooth_angle = RNA_float_get(op->ptr, 

[Bf-blender-cvs] [f82036b6e2e] temp-pbvh-split: temp-pbvh-split: Finish merge and fix paint undo

2022-06-02 Thread Joseph Eagar
Commit: f82036b6e2e33abb265552bdf844f4b2695fbe2d
Author: Joseph Eagar
Date:   Thu Jun 2 16:13:19 2022 -0700
Branches: temp-pbvh-split
https://developer.blender.org/rBf82036b6e2e33abb265552bdf844f4b2695fbe2d

temp-pbvh-split: Finish merge and fix paint undo

===

M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/BKE_pbvh_pixels.hh
M   source/blender/blenkernel/intern/pbvh_intern.h
M   source/blender/blenkernel/intern/pbvh_pixels.cc
M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/interface.cc
M   source/blender/editors/interface/interface_anim.c
M   source/blender/editors/interface/interface_intern.h
M   source/blender/editors/interface/interface_layout.c
M   source/blender/editors/interface/interface_query.cc
M   source/blender/editors/interface/interface_template_search_menu.cc
M   source/blender/editors/interface/interface_utils.cc
M   source/blender/editors/interface/view2d.cc
M   source/blender/editors/sculpt_paint/sculpt_paint_image.cc
M   source/blender/editors/sculpt_paint/sculpt_undo.c
M   source/blender/editors/space_image/image_undo.c
M   source/blender/editors/space_outliner/outliner_edit.cc
M   source/blender/editors/space_outliner/outliner_intern.hh
M   source/blender/editors/space_outliner/outliner_ops.cc
M   source/blender/editors/space_outliner/outliner_tools.cc

===

diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index 3df0c6bc12e..bea99b81c0f 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -594,3 +594,14 @@ bool BKE_pbvh_draw_cache_invalid(const PBVH *pbvh);
 #ifdef __cplusplus
 }
 #endif
+
+/* Disable optimization for a function (for debugging use only!)*/
+#ifdef __clang__
+#  define ATTR_NO_OPT __attribute__((optnone))
+#elif defined(_MSC_VER)
+#  define ATTR_NO_OPT __pragma(optimize("", off))
+#elif defined(__GNUC__)
+#  define ATTR_NO_OPT __attribute__((optimize("O0")))
+#else
+#  define ATTR_NO_OPT
+#endif
diff --git a/source/blender/blenkernel/BKE_pbvh_pixels.hh 
b/source/blender/blenkernel/BKE_pbvh_pixels.hh
index 2d7f6c64b96..e98b6325c07 100644
--- a/source/blender/blenkernel/BKE_pbvh_pixels.hh
+++ b/source/blender/blenkernel/BKE_pbvh_pixels.hh
@@ -169,6 +169,10 @@ struct NodeData {
   {
 undo_regions.clear();
 for (UDIMTilePixels  : tiles) {
+  if (tile.pixel_rows.size() == 0) {
+continue;
+  }
+
   rcti region;
   BLI_rcti_init_minmax();
   for (PackedPixelRow _row : tile.pixel_rows) {
diff --git a/source/blender/blenkernel/intern/pbvh_intern.h 
b/source/blender/blenkernel/intern/pbvh_intern.h
index cc8b0e9aefd..fe612fa63ed 100644
--- a/source/blender/blenkernel/intern/pbvh_intern.h
+++ b/source/blender/blenkernel/intern/pbvh_intern.h
@@ -282,19 +282,6 @@ void pbvh_pixels_free(PBVHNode *node);
 void pbvh_pixels_free_brush_test(PBVHNode *node);
 void pbvh_free_draw_buffers(PBVH *pbvh, PBVHNode *node);
 
-
-/* Disable optimization for a function (for debugging use only!)*/
-#ifdef __clang__
-#  define ATTR_NO_OPT __attribute__((optnone))
-#elif defined(_MSC_VER)
-#  define ATTR_NO_OPT __pragma(optimize("", off))
-#elif defined(__GNUC__)
-#  define ATTR_NO_OPT __attribute__((optimize("O0")))
-#else
-#  define ATTR_NO_OPT
-#endif
-
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc 
b/source/blender/blenkernel/intern/pbvh_pixels.cc
index 9a0cea77369..ebb4446e302 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels.cc
@@ -114,6 +114,7 @@ static void split_pixel_node(PBVH *pbvh,
   tdata->nodes_num->fetch_add(2);
 
   if (count_node_pixels(*node) <= pbvh->pixel_leaf_limit || split->depth >= 
pbvh->depth_limit) {
+BKE_pbvh_pixels_node_data_get(split->node).rebuild_undo_regions();
 return;
   }
 
@@ -249,6 +250,8 @@ static void split_pixel_node(PBVH *pbvh,
 pbvh_pixels_free(node);
   }
 
+  data.undo_regions.clear();
+
   BLI_thread_queue_push(tdata->new_nodes, static_cast(split1));
   BLI_thread_queue_push(tdata->new_nodes, static_cast(split2));
 
diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index 9a7d42ec413..a9a9c98cab8 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -461,7 +461,7 @@ enum {
 void UI_draw_widget_scroll(struct uiWidgetColors *wcol,
const struct rcti *rect,
const struct rcti *slider,
-   uint64_t state);
+   int state);
 
 /**
  * Shortening string helper.
@@ -886,9 +886,9 @@ uiBut *UI_but_active_drop_name_button(const struct bContext 
*C);
 

[Bf-blender-cvs] [8414e79b71e] temp-pbvh-split: Fix: Crash with empty curves add interpolate points

2022-06-02 Thread Hans Goudey
Commit: 8414e79b71efaa9735839ed7866692502cae031b
Author: Hans Goudey
Date:   Wed May 11 15:40:19 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB8414e79b71efaa9735839ed7866692502cae031b

Fix: Crash with empty curves add interpolate points

The neighbors for an added curve can be empty.
In that case use the constant value instead of interpolating.

===

M   source/blender/editors/sculpt_paint/curves_sculpt_add.cc

===

diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
index feda57fff1f..f214efb44be 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
@@ -608,9 +608,14 @@ struct AddOperationExecutor {
 attribute_math::DefaultMixer mixer{new_offsets};
 threading::parallel_for(neighbors_per_curve.index_range(), 1024, 
[&](IndexRange curves_range) {
   for (const int i : curves_range) {
-for (const NeighborInfo  : neighbors_per_curve[i]) {
-  const int neighbor_points_num = 
curves_->points_for_curve(neighbor.index).size();
-  mixer.mix_in(i, neighbor_points_num, neighbor.weight);
+if (neighbors_per_curve[i].is_empty()) {
+  mixer.mix_in(i, constant_points_per_curve_, 1.0f);
+}
+else {
+  for (const NeighborInfo  : neighbors_per_curve[i]) {
+const int neighbor_points_num = 
curves_->points_for_curve(neighbor.index).size();
+mixer.mix_in(i, neighbor_points_num, neighbor.weight);
+  }
 }
   }
 });

___
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] [f967fbea651] temp-pbvh-split: Merge branch 'master' into temp-pbvh-split

2022-06-02 Thread Joseph Eagar
Commit: f967fbea6511346c2a0b5a174a81b6d7970ebf0c
Author: Joseph Eagar
Date:   Thu Jun 2 03:22:27 2022 -0700
Branches: temp-pbvh-split
https://developer.blender.org/rBf967fbea6511346c2a0b5a174a81b6d7970ebf0c

Merge branch 'master' into temp-pbvh-split

===



===

diff --cc source/blender/blenkernel/BKE_pbvh_pixels.hh
index 194cd7e3b07,e73950e6299..2d7f6c64b96
--- a/source/blender/blenkernel/BKE_pbvh_pixels.hh
+++ b/source/blender/blenkernel/BKE_pbvh_pixels.hh
@@@ -138,7 -147,8 +147,8 @@@ struct NodeData 
} flags;
  
Vector tiles;
+   Vector undo_regions;
 -  Triangles triangles;
 +  Triangles *triangles = nullptr;
  
NodeData()
{
diff --cc source/blender/blenkernel/intern/pbvh_pixels.cc
index 457a7bc9af1,49397797c0d..9a0cea77369
--- a/source/blender/blenkernel/intern/pbvh_pixels.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels.cc
@@@ -642,12 -280,13 +642,13 @@@ static bool update_pixels(PBVH *pbvh, M
Vector nodes_to_update;
  
if (!find_nodes_to_update(pbvh, nodes_to_update)) {
 -return;
 +return false;
}
  
-   MLoopUV *ldata_uv = static_cast(CustomData_get_layer(>ldata, CD_MLOOPUV));
+   const MLoopUV *ldata_uv = static_cast(
+   CustomData_get_layer(>ldata, CD_MLOOPUV));
if (ldata_uv == nullptr) {
 -return;
 +return false;
}
  
for (PBVHNode *node : nodes_to_update) {
diff --cc source/blender/editors/include/UI_interface.h
index 0b507c6a4ab,a9a9c98cab8..9a7d42ec413
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@@ -1658,7 -1632,7 +1632,7 @@@ eAutoPropButsReturn uiDefAutoButsRNA(ui
   * callback returns true, the given buttons are considered to be matching and 
relevant state is
   * preserved (copied from the old to the new button). If it returns false, 
it's considered
   * non-matching and no further checks are done.
-- *
++ *\
   * If this is set, it is always executed instead of the default comparisons. 
However it is only
   * executed for buttons that have the same type and the same callback. So 
callbacks can assume the
   * button types match.
diff --cc source/blender/editors/sculpt_paint/sculpt.c
index 3336b18e7e3,2c6c4c82676..7a7534f2ecf
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@@ -3283,7 -3261,11 +3296,12 @@@ static void do_brush_action(Sculpt *sd
  }
  nodes = sculpt_pbvh_gather_generic(ob, sd, brush, use_original, 
radius_scale, );
}
 +
+   const bool use_pixels = sculpt_needs_pbvh_pixels(paint_mode_settings, 
brush, ob);
+   if (use_pixels) {
+ sculpt_pbvh_update_pixels(paint_mode_settings, ss, ob);
+   }
+ 
/* Draw Face Sets in draw mode makes a single undo push, in alt-smooth mode 
deforms the
 * vertices and uses regular coords undo. */
/* It also assigns the paint_face_set here as it needs to be done 
regardless of the stroke type
diff --cc source/blender/editors/sculpt_paint/sculpt_intern.h
index 8c6e7075032,5fa115ed629..d7bddc6b8c6
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@@ -1649,16 -1649,14 +1649,16 @@@ void SCULPT_do_paint_brush(struct Paint
 Sculpt *sd,
 Object *ob,
 PBVHNode **nodes,
 -   int totnode) ATTR_NONNULL();
 +   int totnode,
 +   PBVHNode **texnodes,
 +   int texnodes_num) ATTR_NONNULL();
  
  /**
-  * @brief Get the image canvas for painting on the given object.
+  * \brief Get the image canvas for painting on the given object.
   *
-  * @return #true if an image is found. The #r_image and #r_image_user fields 
are filled with the
+  * \return #true if an image is found. The #r_image and #r_image_user fields 
are filled with the
   * image and image user. Returns false when the image isn't found. In the 
later case the r_image
-  * and r_image_user are set to nullptr/NULL.
+  * and r_image_user are set to NULL.
   */
  bool SCULPT_paint_image_canvas_get(struct PaintModeSettings 
*paint_mode_settings,
 struct Object *ob,
diff --cc source/blender/editors/sculpt_paint/sculpt_paint_image.cc
index ba09a8f89ac,975a8f21aaf..7b807e218ec
--- a/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
@@@ -454,11 -501,12 +535,12 @@@ void SCULPT_do_paint_brush_image(PaintM
}
  
TaskParallelSettings settings;
 -  BKE_pbvh_parallel_range_settings(, true, totnode);
 -  BLI_task_parallel_range(0, totnode, , do_push_undo_tile, );
 -  BLI_task_parallel_range(0, totnode, , do_paint_pixels, );
 +  BKE_pbvh_parallel_range_settings(, true, texnodes_num);
++  BLI_task_parallel_range(0, 

[Bf-blender-cvs] [9549df341c2] temp-pbvh-split: UI: Update rest of UI code for increased button flag bitfield

2022-06-02 Thread Julian Eisel
Commit: 9549df341c2ef0539e885419ab8c1ab3560a8762
Author: Julian Eisel
Date:   Wed May 11 17:05:24 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB9549df341c2ef0539e885419ab8c1ab3560a8762

UI: Update rest of UI code for increased button flag bitfield

Needed after 98a04ed45242.

===

M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/interface.cc
M   source/blender/editors/interface/interface_anim.c
M   source/blender/editors/interface/interface_intern.h
M   source/blender/editors/interface/interface_layout.c
M   source/blender/editors/interface/interface_query.cc
M   source/blender/editors/interface/interface_region_search.cc
M   source/blender/editors/interface/interface_template_search_menu.cc
M   source/blender/editors/interface/interface_utils.cc
M   source/blender/editors/interface/interface_widgets.c
M   source/blender/editors/interface/view2d.cc

===

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index 301171a284d..0b507c6a4ab 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -462,7 +462,7 @@ enum {
 void UI_draw_widget_scroll(struct uiWidgetColors *wcol,
const struct rcti *rect,
const struct rcti *slider,
-   int state);
+   uint64_t state);
 
 /**
  * Shortening string helper.
@@ -887,9 +887,9 @@ uiBut *UI_but_active_drop_name_button(const struct bContext 
*C);
 bool UI_but_active_drop_name(const struct bContext *C);
 bool UI_but_active_drop_color(struct bContext *C);
 
-void UI_but_flag_enable(uiBut *but, int flag);
-void UI_but_flag_disable(uiBut *but, int flag);
-bool UI_but_flag_is_set(uiBut *but, int flag);
+void UI_but_flag_enable(uiBut *but, uint64_t flag);
+void UI_but_flag_disable(uiBut *but, uint64_t flag);
+bool UI_but_flag_is_set(uiBut *but, uint64_t flag);
 
 void UI_but_drawflag_enable(uiBut *but, int flag);
 void UI_but_drawflag_disable(uiBut *but, int flag);
@@ -1682,7 +1682,7 @@ bool UI_search_item_add(uiSearchItems *items,
 const char *name,
 void *poin,
 int iconid,
-int state,
+uint64_t state,
 uint8_t name_prefix_offset);
 
 /**
diff --git a/source/blender/editors/interface/interface.cc 
b/source/blender/editors/interface/interface.cc
index b7098c26bcd..effd3a64fcd 100644
--- a/source/blender/editors/interface/interface.cc
+++ b/source/blender/editors/interface/interface.cc
@@ -848,7 +848,7 @@ static void ui_but_update_old_active_from_new(uiBut 
*oldbut, uiBut *but)
   BLI_assert(oldbut->active);
 
   /* flags from the buttons we want to refresh, may want to add more here... */
-  const int flag_copy = UI_BUT_REDALERT | UI_HAS_ICON | UI_SELECT_DRAW;
+  const uint64_t flag_copy = UI_BUT_REDALERT | UI_HAS_ICON | UI_SELECT_DRAW;
   const int drawflag_copy = 0; /* None currently. */
 
   /* still stuff needs to be copied */
@@ -991,7 +991,7 @@ static bool ui_but_update_from_old_block(const bContext *C,
 found_active = true;
   }
   else {
-int flag_copy = UI_BUT_DRAG_MULTI;
+uint64_t flag_copy = UI_BUT_DRAG_MULTI;
 
 /* Stupid special case: The active button may be inside (as in, overlapped 
on top) a tree-row
  * button which we also want to keep highlighted then. */
@@ -4219,7 +4219,7 @@ static uiBut *ui_def_but(uiBlock *block,
   return but;
 }
 
-void ui_def_but_icon(uiBut *but, const int icon, const int flag)
+void ui_def_but_icon(uiBut *but, const int icon, const uint64_t flag)
 {
   if (icon) {
 ui_icon_ensure_deferred(static_cast(but->block->evil_C),
@@ -5806,17 +5806,17 @@ void UI_block_flag_disable(uiBlock *block, int flag)
   block->flag &= ~flag;
 }
 
-void UI_but_flag_enable(uiBut *but, int flag)
+void UI_but_flag_enable(uiBut *but, uint64_t flag)
 {
   but->flag |= flag;
 }
 
-void UI_but_flag_disable(uiBut *but, int flag)
+void UI_but_flag_disable(uiBut *but, uint64_t flag)
 {
   but->flag &= ~flag;
 }
 
-bool UI_but_flag_is_set(uiBut *but, int flag)
+bool UI_but_flag_is_set(uiBut *but, uint64_t flag)
 {
   return (but->flag & flag) != 0;
 }
diff --git a/source/blender/editors/interface/interface_anim.c 
b/source/blender/editors/interface/interface_anim.c
index e838ce37d8e..b77d48552c7 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -144,7 +144,7 @@ void ui_but_anim_decorate_update_from_flag(uiButDecorator 
*decorator_but)
 return;
   }
 
-  const int flag = but_anim->flag;
+  const uint64_t flag = but_anim->flag;
 
   if (flag & UI_BUT_DRIVEN) {
 but->icon = 

[Bf-blender-cvs] [052073e9e4c] temp-pbvh-split: Fix T97947: USD will fail to export without file extension

2022-06-02 Thread Philipp Oeser
Commit: 052073e9e4c5f9be443c9adfe3a461c3d8f251ff
Author: Philipp Oeser
Date:   Mon May 9 15:19:48 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB052073e9e4c5f9be443c9adfe3a461c3d8f251ff

Fix T97947: USD will fail to export without file extension

Now add a default ".usdc" file extension if no (or the wrong) extension
is given instead of presenting the user with the error that "no suitable
USD plugin to write is found".

This is in line with how other exporters do this.

Maniphest Tasks: T97947

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

===

M   source/blender/editors/io/io_usd.c

===

diff --git a/source/blender/editors/io/io_usd.c 
b/source/blender/editors/io/io_usd.c
index 97ca9b026ec..609230eefea 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -190,6 +190,20 @@ static void wm_usd_export_draw(bContext *UNUSED(C), 
wmOperator *op)
   uiItemR(box, ptr, "use_instancing", 0, NULL, ICON_NONE);
 }
 
+static bool wm_usd_export_check(bContext *UNUSED(C), wmOperator *op)
+{
+  char filepath[FILE_MAX];
+  RNA_string_get(op->ptr, "filepath", filepath);
+
+  if (!BLI_path_extension_check_n(filepath, ".usd", ".usda", ".usdc", NULL)) {
+BLI_path_extension_ensure(filepath, FILE_MAX, ".usdc");
+RNA_string_set(op->ptr, "filepath", filepath);
+return true;
+  }
+
+  return false;
+}
+
 void WM_OT_usd_export(struct wmOperatorType *ot)
 {
   ot->name = "Export USD";
@@ -200,6 +214,7 @@ void WM_OT_usd_export(struct wmOperatorType *ot)
   ot->exec = wm_usd_export_exec;
   ot->poll = WM_operator_winactive;
   ot->ui = wm_usd_export_draw;
+  ot->check = wm_usd_export_check;
 
   ot->flag = OPTYPE_REGISTER; /* No UNDO possible. */

___
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] [6bd0176ebc7] temp-pbvh-split: Fix: Build error on windows.

2022-06-02 Thread Ray Molenkamp
Commit: 6bd0176ebc760b27f232980ff25c7e9c6627af86
Author: Ray Molenkamp
Date:   Wed May 11 07:28:48 2022 -0600
Branches: temp-pbvh-split
https://developer.blender.org/rB6bd0176ebc760b27f232980ff25c7e9c6627af86

Fix: Build error on windows.

Issue introduced by rBeef98e66cf9e

BLI_math_rotation.h uses M_PI which
gets defined inside BLI_math_base.h

===

M   source/blender/blenlib/BLI_math_rotation.h

===

diff --git a/source/blender/blenlib/BLI_math_rotation.h 
b/source/blender/blenlib/BLI_math_rotation.h
index 7d10e52f699..192ad482a69 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -7,6 +7,7 @@
  * \ingroup bli
  */
 
+#include "BLI_math_base.h"
 #include "BLI_utildefines.h"
 #include "DNA_vec_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] [1cc6e754f32] temp-pbvh-split: Fix "Open Clip" operator in Clip Editor broken

2022-06-02 Thread Julian Eisel
Commit: 1cc6e754f3206bfa48853d346c8e27de377e7c69
Author: Julian Eisel
Date:   Wed May 11 13:16:54 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB1cc6e754f3206bfa48853d346c8e27de377e7c69

Fix "Open Clip" operator in Clip Editor broken

Steps to reproduce were:
- Open Clip Editor
- Call "Open Clip" (e.g. Alt+O)
- Select video file

The file wouldn't be loaded into the Clip Editor.

Caused by 7849b56c3c41.

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 58d7a55eddc..5776184aec0 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -4093,7 +4093,11 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
   /* Close any popups, like when opening a file browser from the splash. */
   UI_popup_handlers_remove_all(C, _win->modalhandlers);
 
-  CTX_wm_window_set(C, root_win);
+  /* Setting the context window unsets the context area & screen. Avoid doing 
that, so operators
+   * calling the file browser can operate in the context the browser was 
opened in. */
+  if (ctx_win != root_win) {
+CTX_wm_window_set(C, root_win);
+  }
 
   /* The root window may already have a File Browser open. Cancel it if so, 
only 1 should be open
* per window. The root context of this operation is also used for the new 
operation. */
@@ -4148,7 +4152,9 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
 
   WM_event_fileselect_event(wm, op, EVT_FILESELECT_FULL_OPEN);
 
-  CTX_wm_window_set(C, ctx_win);
+  if (ctx_win != root_win) {
+CTX_wm_window_set(C, ctx_win);
+  }
 }
 
 /** \} */

___
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] [73f1f51627a] temp-pbvh-split: Fix T97330: GPU Subdiv compiler error.

2022-06-02 Thread Jeroen Bakker
Commit: 73f1f51627afb45db7942df27256bd0ade8f3e3d
Author: Jeroen Bakker
Date:   Wed May 11 15:19:10 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB73f1f51627afb45db7942df27256bd0ade8f3e3d

Fix T97330: GPU Subdiv compiler error.

GLSL has different max number of ssbo per glsl stage.
This patch checks if the number of compute ssbo blocks matches
our requirements for the GPU Subdiv, before enabling it.

Some platforms allow more ssbo bindings then blocks per stage.

===

M   source/blender/blenkernel/intern/subdiv_modifier.c
M   source/blender/gpu/GPU_capabilities.h
M   source/blender/gpu/intern/gpu_capabilities.cc
M   source/blender/gpu/intern/gpu_capabilities_private.hh
M   source/blender/gpu/opengl/gl_backend.cc

===

diff --git a/source/blender/blenkernel/intern/subdiv_modifier.c 
b/source/blender/blenkernel/intern/subdiv_modifier.c
index 83772f153d9..3692a3cc4f7 100644
--- a/source/blender/blenkernel/intern/subdiv_modifier.c
+++ b/source/blender/blenkernel/intern/subdiv_modifier.c
@@ -77,7 +77,7 @@ static bool is_subdivision_evaluation_possible_on_gpu(void)
 return false;
   }
 
-  if (GPU_max_shader_storage_buffer_bindings() < MAX_GPU_SUBDIV_SSBOS) {
+  if (GPU_max_compute_shader_storage_blocks() < MAX_GPU_SUBDIV_SSBOS) {
 return false;
   }
 
diff --git a/source/blender/gpu/GPU_capabilities.h 
b/source/blender/gpu/GPU_capabilities.h
index aedac168a01..061b850619f 100644
--- a/source/blender/gpu/GPU_capabilities.h
+++ b/source/blender/gpu/GPU_capabilities.h
@@ -30,6 +30,7 @@ int GPU_max_batch_vertices(void);
 int GPU_max_vertex_attribs(void);
 int GPU_max_varying_floats(void);
 int GPU_max_shader_storage_buffer_bindings(void);
+int GPU_max_compute_shader_storage_blocks(void);
 
 int GPU_extensions_len(void);
 const char *GPU_extension_get(int i);
diff --git a/source/blender/gpu/intern/gpu_capabilities.cc 
b/source/blender/gpu/intern/gpu_capabilities.cc
index 72b62b3de3d..6ef015492c7 100644
--- a/source/blender/gpu/intern/gpu_capabilities.cc
+++ b/source/blender/gpu/intern/gpu_capabilities.cc
@@ -167,6 +167,12 @@ int GPU_max_shader_storage_buffer_bindings()
   return GCaps.max_shader_storage_buffer_bindings;
 }
 
+int GPU_max_compute_shader_storage_blocks()
+{
+  return GCaps.max_compute_shader_storage_blocks;
+}
+
+
 /** \} */
 
 /*  */
diff --git a/source/blender/gpu/intern/gpu_capabilities_private.hh 
b/source/blender/gpu/intern/gpu_capabilities_private.hh
index 611c2d6973c..a17dbe7f8e6 100644
--- a/source/blender/gpu/intern/gpu_capabilities_private.hh
+++ b/source/blender/gpu/intern/gpu_capabilities_private.hh
@@ -36,6 +36,7 @@ struct GPUCapabilities {
   int max_vertex_attribs = 0;
   int max_varying_floats = 0;
   int max_shader_storage_buffer_bindings = 0;
+  int max_compute_shader_storage_blocks = 0;
   int extensions_len = 0;
   const char *(*extension_get)(int);
 
diff --git a/source/blender/gpu/opengl/gl_backend.cc 
b/source/blender/gpu/opengl/gl_backend.cc
index 0ce01d80a77..17d9b392c69 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -510,6 +510,7 @@ void GLBackend::capabilities_init()
 glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 2, 
_work_group_size[2]);
 glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS,
   _shader_storage_buffer_bindings);
+glGetIntegerv(GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS, 
_compute_shader_storage_blocks);
   }
   GCaps.shader_storage_buffer_objects_support = 
GLEW_ARB_shader_storage_buffer_object;
   /* GL specific capabilities. */

___
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] [d98e2b20d40] temp-pbvh-split: Fix T97895: Eevee support for Geometry Nodes Color Attributes.

2022-06-02 Thread Jeroen Bakker
Commit: d98e2b20d40080d6b6d892b6091e3794ad211dec
Author: Jeroen Bakker
Date:   Wed May 11 14:01:47 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rBd98e2b20d40080d6b6d892b6091e3794ad211dec

Fix T97895: Eevee support for Geometry Nodes Color Attributes.

Geometry nodes can generate color attributes that aren't on point or corner 
domain.
When not found in these domains it will be processed as a common attribute.

===

M   source/blender/draw/intern/draw_cache_impl_mesh.c

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 07d740d89c1..7dc0244275d 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -708,12 +708,18 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const 
Object *object,
   case CD_MCOL:
   case CD_PROP_BYTE_COLOR:
   case CD_PROP_COLOR: {
+/* First check Color attributes, when not found check mesh 
attributes. Geometry nodes
+ * can generate those layers. */
 int vcol_bit = mesh_cd_calc_gpu_layers_vcol_used(_query, 
cd_vdata, cd_ldata, name);
 
 if (vcol_bit != -1) {
   cd_used.vcol |= 1UL << (uint)vcol_bit;
+  break;
 }
 
+if (layer != -1 && domain != ATTR_DOMAIN_NUM) {
+  drw_mesh_attributes_add_request(attributes, type, layer, domain);
+}
 break;
   }
   case CD_PROP_FLOAT3:

___
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] [3915e57a478] temp-pbvh-split: Cleanup: Use single quotes for Python enum string

2022-06-02 Thread Hans Goudey
Commit: 3915e57a47832f5b7fcd4e18e772210785be51f2
Author: Hans Goudey
Date:   Wed May 11 12:12:11 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB3915e57a47832f5b7fcd4e18e772210785be51f2

Cleanup: Use single quotes for Python enum string

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index 649e09fdfaa..e3decd7fcdd 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -840,7 +840,7 @@ def brush_shared_settings(layout, context, brush, 
popover=False):
 if mode == 'SCULPT_CURVES':
 size = True
 strength = True
-direction = brush.curves_sculpt_tool == "GROW_SHRINK"
+direction = brush.curves_sculpt_tool == 'GROW_SHRINK'
 
 ### Draw settings. ###
 ups = context.scene.tool_settings.unified_paint_settings

___
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] [07ac2445b9d] temp-pbvh-split: Fix: Curves interpolate point count option missing from panels

2022-06-02 Thread Jun Mizutani
Commit: 07ac2445b9d0c29aa9eb0116c8f22e6765b31716
Author: Jun Mizutani
Date:   Wed May 11 08:56:26 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB07ac2445b9d0c29aa9eb0116c8f22e6765b31716

Fix: Curves interpolate point count option missing from panels

Added in 8852191b779e880fe4d5116f2bee3fcddb8aced4

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

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index 782fec91f91..649e09fdfaa 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -776,6 +776,7 @@ def brush_settings(layout, context, brush, popover=False):
 layout.prop(brush.curves_sculpt_settings, "curve_length")
 layout.prop(brush.curves_sculpt_settings, "interpolate_length")
 layout.prop(brush.curves_sculpt_settings, "interpolate_shape")
+layout.prop(brush.curves_sculpt_settings, 
"interpolate_point_count")
 use_frontface = True
 elif brush.curves_sculpt_tool == 'GROW_SHRINK':
 layout.prop(brush.curves_sculpt_settings, "scale_uniform")

___
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] [9184beada70] temp-pbvh-split: Update Ceres to latest upstream version 2.1.0

2022-06-02 Thread Sergey Sharybin
Commit: 9184beada705257e973f80fab7db01866be6f072
Author: Sergey Sharybin
Date:   Tue May 10 16:36:22 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB9184beada705257e973f80fab7db01866be6f072

Update Ceres to latest upstream version 2.1.0

This release deprecated the Parameterization API and the new Manifolds
API is to be used instead. This is what was done in the Libmv as part
of this change.

Additionally, remove the bundling scripts. Nowadays those are only
leading to a duplicated work to maintain.

No measurable changes on user side is expected.

===

M   CMakeLists.txt
M   extern/ceres/CMakeLists.txt
D   extern/ceres/ChangeLog
M   extern/ceres/LICENSE
D   extern/ceres/README
M   extern/ceres/README.blender
A   extern/ceres/README.md
D   extern/ceres/bundle.sh
M   extern/ceres/config/ceres/internal/config.h
A   extern/ceres/config/ceres/internal/export.h
D   extern/ceres/files.txt
M   extern/ceres/include/ceres/autodiff_cost_function.h
M   extern/ceres/include/ceres/autodiff_first_order_function.h
M   extern/ceres/include/ceres/autodiff_local_parameterization.h
A   extern/ceres/include/ceres/autodiff_manifold.h
M   extern/ceres/include/ceres/c_api.h
M   extern/ceres/include/ceres/ceres.h
M   extern/ceres/include/ceres/conditioned_cost_function.h
M   extern/ceres/include/ceres/context.h
M   extern/ceres/include/ceres/cost_function.h
M   extern/ceres/include/ceres/cost_function_to_functor.h
M   extern/ceres/include/ceres/covariance.h
M   extern/ceres/include/ceres/crs_matrix.h
M   extern/ceres/include/ceres/cubic_interpolation.h
M   extern/ceres/include/ceres/dynamic_autodiff_cost_function.h
M   extern/ceres/include/ceres/dynamic_cost_function.h
M   extern/ceres/include/ceres/dynamic_cost_function_to_functor.h
M   extern/ceres/include/ceres/dynamic_numeric_diff_cost_function.h
M   extern/ceres/include/ceres/evaluation_callback.h
M   extern/ceres/include/ceres/first_order_function.h
M   extern/ceres/include/ceres/gradient_checker.h
M   extern/ceres/include/ceres/gradient_problem.h
M   extern/ceres/include/ceres/gradient_problem_solver.h
M   extern/ceres/include/ceres/internal/array_selector.h
M   extern/ceres/include/ceres/internal/autodiff.h
M   extern/ceres/include/ceres/internal/eigen.h
M   extern/ceres/include/ceres/internal/householder_vector.h
M   extern/ceres/include/ceres/internal/integer_sequence_algorithm.h
A   extern/ceres/include/ceres/internal/jet_traits.h
M   extern/ceres/include/ceres/internal/numeric_diff.h
M   extern/ceres/include/ceres/internal/port.h
A   extern/ceres/include/ceres/internal/sphere_manifold_functions.h
M   extern/ceres/include/ceres/internal/variadic_evaluate.h
M   extern/ceres/include/ceres/iteration_callback.h
M   extern/ceres/include/ceres/jet.h
R071extern/ceres/internal/ceres/split.h 
extern/ceres/include/ceres/jet_fwd.h
A   extern/ceres/include/ceres/line_manifold.h
M   extern/ceres/include/ceres/local_parameterization.h
M   extern/ceres/include/ceres/loss_function.h
A   extern/ceres/include/ceres/manifold.h
A   extern/ceres/include/ceres/manifold_test_utils.h
M   extern/ceres/include/ceres/normal_prior.h
M   extern/ceres/include/ceres/numeric_diff_cost_function.h
A   extern/ceres/include/ceres/numeric_diff_first_order_function.h
M   extern/ceres/include/ceres/numeric_diff_options.h
M   extern/ceres/include/ceres/ordered_groups.h
M   extern/ceres/include/ceres/problem.h
A   extern/ceres/include/ceres/product_manifold.h
M   extern/ceres/include/ceres/rotation.h
M   extern/ceres/include/ceres/sized_cost_function.h
M   extern/ceres/include/ceres/solver.h
A   extern/ceres/include/ceres/sphere_manifold.h
M   extern/ceres/include/ceres/tiny_solver.h
M   extern/ceres/include/ceres/tiny_solver_autodiff_function.h
M   extern/ceres/include/ceres/tiny_solver_cost_function_adapter.h
M   extern/ceres/include/ceres/types.h
M   extern/ceres/include/ceres/version.h
M   extern/ceres/internal/ceres/accelerate_sparse.cc
M   extern/ceres/internal/ceres/accelerate_sparse.h
M   extern/ceres/internal/ceres/array_utils.cc
M   extern/ceres/internal/ceres/array_utils.h
M   extern/ceres/internal/ceres/block_evaluate_preparer.cc
M   extern/ceres/internal/ceres/block_evaluate_preparer.h
M   extern/ceres/internal/ceres/block_jacobi_preconditioner.cc
M   extern/ceres/internal/ceres/block_jacobi_preconditioner.h
M   extern/ceres/internal/ceres/block_jacobian_writer.cc
M   extern/ceres/internal/ceres/block_jacobian_writer.h
M   extern/ceres/internal/ceres/block_random_access_dense_matrix.cc
M   extern/ceres/internal/ceres/block_random_access_dense_matrix.h
M   

[Bf-blender-cvs] [e34bfbc13b0] temp-pbvh-split: Fix T97153: Knife project crashes

2022-06-02 Thread Campbell Barton
Commit: e34bfbc13b0c1f38c7e2bdc937265306ab6a6fe3
Author: Campbell Barton
Date:   Wed May 11 16:24:25 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rBe34bfbc13b0c1f38c7e2bdc937265306ab6a6fe3

Fix T97153: Knife project crashes

Knife projection BVH-tree lookup could use invalid indices since the
mesh being cut is also used for BVH intersection tests.

Solve by storing triangle indices when knife project is used so a
triangle index can always be used to look up original coordinates of a
triangle.

===

M   source/blender/editors/mesh/editmesh_knife.c

===

diff --git a/source/blender/editors/mesh/editmesh_knife.c 
b/source/blender/editors/mesh/editmesh_knife.c
index 81cfe4f85f1..5d8cf176b87 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -190,6 +190,22 @@ typedef struct KnifeBVH {
 
 } KnifeBVH;
 
+/** Additional per-object data. */
+typedef struct KnifeObjectInfo {
+  const float (*cagecos)[3];
+
+  /**
+   * Optionally allocate triangle indices, these are needed for 
non-interactive knife
+   * projection as multiple cuts are made without the BVH being updated.
+   * Using these indices the it's possible to access `cagecos` even if the 
face has been cut
+   * and the loops in `em->looptris` no longer refer to the original 
triangles, see:
+   */
+  const int (*tri_indices)[3];
+
+  /** Only assigned for convenient access. */
+  BMEditMesh *em;
+} KnifeObjectInfo;
+
 /* struct for properties used while drawing */
 typedef struct KnifeTool_OpData {
   ARegion *region;   /* Region that knifetool was activated in. */
@@ -203,6 +219,9 @@ typedef struct KnifeTool_OpData {
   Object **objects;
   uint objects_len;
 
+  /** Array `objects_len` length of additional per-object data. */
+  KnifeObjectInfo *objects_info;
+
   MemArena *arena;
 
   /* Reused for edge-net filling. */
@@ -220,7 +239,6 @@ typedef struct KnifeTool_OpData {
   GHash *facetrimap;
 
   KnifeBVH bvh;
-  const float (**cagecos)[3];
 
   BLI_mempool *kverts;
   BLI_mempool *kedges;
@@ -1133,6 +1151,52 @@ static void knife_update_header(bContext *C, wmOperator 
*op, KnifeTool_OpData *k
 
 /** \} */
 
+/*  */
+/** \name Knife Object Info Accessors (#KnifeObjectInfo)
+ * \{ */
+
+static const int *knife_bm_tri_index_get(const KnifeTool_OpData *kcd,
+ int base_index,
+ int tri_index,
+ int tri_index_buf[3])
+{
+  const KnifeObjectInfo *obinfo = >objects_info[base_index];
+  if (obinfo->tri_indices) {
+return obinfo->tri_indices[tri_index];
+  }
+  for (int i = 0; i < 3; i++) {
+tri_index_buf[i] = 
BM_elem_index_get(obinfo->em->looptris[tri_index][i]->v);
+  }
+  return tri_index_buf;
+}
+
+static void knife_bm_tri_cagecos_get(const KnifeTool_OpData *kcd,
+ int base_index,
+ int tri_index,
+ float cos[3][3])
+{
+  const KnifeObjectInfo *obinfo = >objects_info[base_index];
+  int tri_ind_buf[3];
+  const int *tri_ind = knife_bm_tri_index_get(kcd, base_index, tri_index, 
tri_ind_buf);
+  for (int i = 0; i < 3; i++) {
+copy_v3_v3(cos[i], obinfo->cagecos[tri_ind[i]]);
+  }
+}
+
+static void knife_bm_tri_cagecos_get_worldspace(const KnifeTool_OpData *kcd,
+int base_index,
+int tri_index,
+float cos[3][3])
+{
+  knife_bm_tri_cagecos_get(kcd, base_index, tri_index, cos);
+  const Object *ob = kcd->objects[base_index];
+  for (int i = 0; i < 3; i++) {
+mul_m4_v3(ob->obmat, cos[i]);
+  }
+}
+
+/** \} */
+
 /*  */
 /** \name Knife BVH Utils
  * \{ */
@@ -1219,16 +1283,7 @@ static void knife_bvh_init(KnifeTool_OpData *kcd)
   if (!test_fn_ret) {
 continue;
   }
-
-  copy_v3_v3(cos[0], 
kcd->cagecos[b][BM_elem_index_get(looptris[i][0]->v)]);
-  copy_v3_v3(cos[1], 
kcd->cagecos[b][BM_elem_index_get(looptris[i][1]->v)]);
-  copy_v3_v3(cos[2], 
kcd->cagecos[b][BM_elem_index_get(looptris[i][2]->v)]);
-
-  /* Convert to world-space. */
-  mul_m4_v3(ob->obmat, cos[0]);
-  mul_m4_v3(ob->obmat, cos[1]);
-  mul_m4_v3(ob->obmat, cos[2]);
-
+  knife_bm_tri_cagecos_get_worldspace(kcd, b, i, cos);
   BLI_bvhtree_insert(kcd->bvh.tree, i + tottri, (float *)cos, 3);
 }
 
@@ -1282,12 +1337,7 @@ static void knife_bvh_raycast_cb(void *userdata,
   }
 }
 
-copy_v3_v3(tri_cos[0], kcd->cagecos[b][BM_elem_index_get(ltri[0]->v)]);
-copy_v3_v3(tri_cos[1], 

[Bf-blender-cvs] [a92413b0dbc] temp-pbvh-split: Revert "Gizmo: optimize intersection tests, fix selection bias"

2022-06-02 Thread Campbell Barton
Commit: a92413b0dbcb398f5477fb106f08711a1bd3675c
Author: Campbell Barton
Date:   Wed May 11 20:14:32 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rBa92413b0dbcb398f5477fb106f08711a1bd3675c

Revert "Gizmo: optimize intersection tests, fix selection bias"

Manually revert commit [0] as it caused problems macOS (reported T96435).

- Includes fixes from [1] & [2].
- T98037 TODO has been created to keep track of this feature.

Thanks to @jbakker & @sergey for investigating this issue as I wasn't
able to reproduce the bug.

[0]: 0cb5eae9d0617abedf745753c23061ddfcfd1416
[1]: cb986446e29a51b07bdb73b999a0339df5ecdeb4
[2]: cc8fe1a1cbc63db66c038773b070dca14e82cebb

===

M   source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c

===

diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c 
b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index a61d73b9f0b..f481f19045d 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -492,7 +492,8 @@ void WM_gizmomap_draw(wmGizmoMap *gzmap,
 
 static void gizmo_draw_select_3d_loop(const bContext *C,
   wmGizmo **visible_gizmos,
-  const int visible_gizmos_len)
+  const int visible_gizmos_len,
+  bool *r_use_select_bias)
 {
 
   /* TODO(campbell): this depends on depth buffer being written to,
@@ -528,6 +529,10 @@ static void gizmo_draw_select_3d_loop(const bContext *C,
   is_depth_skip_prev = is_depth_skip;
 }
 
+if (gz->select_bias != 0.0) {
+  *r_use_select_bias = true;
+}
+
 /* pass the selection id shifted by 8 bits. Last 8 bits are used for 
selected gizmo part id */
 
 gz->type->draw_select(C, gz, select_id << 8);
@@ -545,10 +550,7 @@ static int gizmo_find_intersected_3d_intern(wmGizmo 
**visible_gizmos,
 const int visible_gizmos_len,
 const bContext *C,
 const int co[2],
-const int hotspot,
-const bool use_depth_test,
-const bool has_3d_select_bias,
-int *r_hits)
+const int hotspot)
 {
   const wmWindowManager *wm = CTX_wm_manager(C);
   ScrArea *area = CTX_wm_area(C);
@@ -562,76 +564,30 @@ static int gizmo_find_intersected_3d_intern(wmGizmo 
**visible_gizmos,
 
   BLI_rcti_init_pt_radius(, co, hotspot);
 
-  /* The selection mode is assigned for the following reasons:
-   *
-   * - #GPU_SELECT_ALL: Use it to check if there is anything at the cursor 
location
-   *   (only ever runs once).
-   * - #GPU_SELECT_PICK_NEAREST: Use if there are more than 1 item at the 
cursor location,
-   *   pick the nearest one.
-   * - #GPU_SELECT_PICK_ALL: Use for the same purpose as 
#GPU_SELECT_PICK_NEAREST
-   *   when the selection depths need to re-ordered based on a bias.
-   * */
-  const eGPUSelectMode gpu_select_mode =
-  (use_depth_test ? (has_3d_select_bias ?
-  /* Using select bias means the depths need to be
-   * re-calculated based on the bias to pick the 
best. */
-  GPU_SELECT_PICK_ALL :
-  /* No bias, just pick the closest. */
-  GPU_SELECT_PICK_NEAREST) :
-/* Fast-path (occlusion queries). */
-GPU_SELECT_ALL);
-
-  /* When switching between modes and the mouse pointer is over a gizmo, the 
highlight test is
-   * performed before the viewport is fully initialized (region->draw_buffer = 
NULL).
-   * When this is the case we should not use depth testing. */
-  GPUViewport *gpu_viewport = WM_draw_region_get_viewport(region);
-  if (use_depth_test && gpu_viewport == NULL) {
-return -1;
-  }
+  ED_view3d_draw_setup_view(
+  wm, CTX_wm_window(C), depsgraph, CTX_data_scene(C), region, v3d, NULL, 
NULL, );
 
-  if (GPU_select_is_cached()) {
-GPU_select_begin(buffer, ARRAY_SIZE(buffer), , gpu_select_mode, 0);
-GPU_select_cache_load_id();
-hits = GPU_select_end();
-  }
-  else {
-/* TODO: waiting for the GPU in the middle of the event loop for every
- * mouse move is bad for performance, we need to find a solution to not
- * use the GPU or draw something once. (see T61474) */
+  bool use_select_bias = false;
 
-ED_view3d_draw_setup_view(
-wm, CTX_wm_window(C), depsgraph, CTX_data_scene(C), region, v3d, NULL, 
NULL, );
+  /* TODO: waiting for the GPU in the middle of the event 

[Bf-blender-cvs] [16fa4c53471] temp-pbvh-split: Outliner: Remove the 'Remap data-block usages' operation.

2022-06-02 Thread Bastien Montagne
Commit: 16fa4c5347156bb670c15a69579a57b58c1e082f
Author: Bastien Montagne
Date:   Wed May 11 11:23:24 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB16fa4c5347156bb670c15a69579a57b58c1e082f

Outliner: Remove the 'Remap data-block usages' operation.

This feature is very advanced, and the way it was exposed in the
Outliner was very confusing at best.

It remains available through the Python API (`ID.user_remap`) e.g.

===

M   source/blender/editors/space_outliner/outliner_edit.cc
M   source/blender/editors/space_outliner/outliner_intern.hh
M   source/blender/editors/space_outliner/outliner_ops.cc
M   source/blender/editors/space_outliner/outliner_tools.cc

===

diff --git a/source/blender/editors/space_outliner/outliner_edit.cc 
b/source/blender/editors/space_outliner/outliner_edit.cc
index 1de45b0ec96..f4e28af3fca 100644
--- a/source/blender/editors/space_outliner/outliner_edit.cc
+++ b/source/blender/editors/space_outliner/outliner_edit.cc
@@ -575,187 +575,6 @@ void OUTLINER_OT_id_delete(wmOperatorType *ot)
 
 /** \} */
 
-/*  */
-/** \name ID Remap Operator
- * \{ */
-
-static int outliner_id_remap_exec(bContext *C, wmOperator *op)
-{
-  Main *bmain = CTX_data_main(C);
-  SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
-
-  const short id_type = (short)RNA_enum_get(op->ptr, "id_type");
-  ID *old_id = reinterpret_cast(
-  BLI_findlink(which_libbase(CTX_data_main(C), id_type), 
RNA_enum_get(op->ptr, "old_id")));
-  ID *new_id = reinterpret_cast(
-  BLI_findlink(which_libbase(CTX_data_main(C), id_type), 
RNA_enum_get(op->ptr, "new_id")));
-
-  /* check for invalid states */
-  if (space_outliner == nullptr) {
-return OPERATOR_CANCELLED;
-  }
-
-  if (!(old_id && new_id && (old_id != new_id) && (GS(old_id->name) == 
GS(new_id->name {
-BKE_reportf(op->reports,
-RPT_ERROR_INVALID_INPUT,
-"Invalid old/new ID pair ('%s' / '%s')",
-old_id ? old_id->name : "Invalid ID",
-new_id ? new_id->name : "Invalid ID");
-return OPERATOR_CANCELLED;
-  }
-
-  if (ID_IS_LINKED(old_id)) {
-BKE_reportf(op->reports,
-RPT_WARNING,
-"Old ID '%s' is linked from a library, indirect usages of this 
data-block will "
-"not be remapped",
-old_id->name);
-  }
-
-  BKE_libblock_remap(
-  bmain, old_id, new_id, ID_REMAP_SKIP_INDIRECT_USAGE | 
ID_REMAP_SKIP_NEVER_NULL_USAGE);
-
-  BKE_main_lib_objects_recalc_all(bmain);
-
-  /* recreate dependency graph to include new objects */
-  DEG_relations_tag_update(bmain);
-
-  /* Free gpu materials, some materials depend on existing objects,
-   * such as lights so freeing correctly refreshes. */
-  GPU_materials_free(bmain);
-
-  WM_event_add_notifier(C, NC_WINDOW, nullptr);
-
-  return OPERATOR_FINISHED;
-}
-
-static bool outliner_id_remap_find_tree_element(bContext *C,
-wmOperator *op,
-ListBase *tree,
-const float y)
-{
-  LISTBASE_FOREACH (TreeElement *, te, tree) {
-if (y > te->ys && y < te->ys + UI_UNIT_Y) {
-  TreeStoreElem *tselem = TREESTORE(te);
-
-  if ((tselem->type == TSE_SOME_ID) && tselem->id) {
-RNA_enum_set(op->ptr, "id_type", GS(tselem->id->name));
-RNA_enum_set_identifier(C, op->ptr, "new_id", tselem->id->name + 2);
-RNA_enum_set_identifier(C, op->ptr, "old_id", tselem->id->name + 2);
-return true;
-  }
-}
-if (outliner_id_remap_find_tree_element(C, op, >subtree, y)) {
-  return true;
-}
-  }
-  return false;
-}
-
-static int outliner_id_remap_invoke(bContext *C, wmOperator *op, const wmEvent 
*event)
-{
-  SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
-  ARegion *region = CTX_wm_region(C);
-  float fmval[2];
-
-  if (!RNA_property_is_set(op->ptr, RNA_struct_find_property(op->ptr, 
"id_type"))) {
-UI_view2d_region_to_view(>v2d, event->mval[0], event->mval[1], 
[0], [1]);
-
-outliner_id_remap_find_tree_element(C, op, _outliner->tree, 
fmval[1]);
-  }
-
-  return WM_operator_props_dialog_popup(C, op, 400);
-}
-
-static const EnumPropertyItem *outliner_id_itemf(bContext *C,
- PointerRNA *ptr,
- PropertyRNA *UNUSED(prop),
- bool *r_free)
-{
-  if (C == nullptr) {
-return DummyRNA_NULL_items;
-  }
-
-  EnumPropertyItem item_tmp = {0}, *item = nullptr;
-  int totitem = 0;
-  int i = 0;
-
-  short id_type = (short)RNA_enum_get(ptr, "id_type");
-  ID *id = reinterpret_cast(which_libbase(CTX_data_main(C), 

[Bf-blender-cvs] [d1c080b737a] temp-pbvh-split: Fix: Spline parameter node broken for Catmull Rom curves

2022-06-02 Thread Hans Goudey
Commit: d1c080b737a0f43e4319f24e19567f7d0f6fb198
Author: Hans Goudey
Date:   Wed May 11 11:33:47 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rBd1c080b737a0f43e4319f24e19567f7d0f6fb198

Fix: Spline parameter node broken for Catmull Rom curves

Subtracting one from the evaluated index could make the index -1.
That was only necessary for Bezier curves due to the specifics of
the "bezier_evaluated_offsets".

===

M   source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
index a548becf24e..ae36248b573 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
@@ -75,7 +75,7 @@ static Array curve_length_point_domain(const 
bke::CurvesGeometry )
 case CURVE_TYPE_CATMULL_ROM: {
   const int resolution = resolutions[i_curve];
   for (const int i : IndexRange(points.size()).drop_back(1)) {
-lengths[i + 1] = evaluated_lengths[resolution * i - 1];
+lengths[i + 1] = evaluated_lengths[resolution * i];
   }
   break;
 }

___
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] [86214740caf] temp-pbvh-split: Fix knife tool use-after free on completion

2022-06-02 Thread Campbell Barton
Commit: 86214740caf90385ea20eae2293df7b2589b5e73
Author: Campbell Barton
Date:   Wed May 11 16:19:17 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rB86214740caf90385ea20eae2293df7b2589b5e73

Fix knife tool use-after free on completion

Regression in [0] accessed knife data after it had been freed.

[0]: f87029f7b13142499a37fb311a721d99bb1aecd7

===

M   source/blender/editors/mesh/editmesh_knife.c

===

diff --git a/source/blender/editors/mesh/editmesh_knife.c 
b/source/blender/editors/mesh/editmesh_knife.c
index ee40431c101..81cfe4f85f1 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -4391,7 +4391,8 @@ static int knifetool_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
 ED_workspace_status_text(C, NULL);
 
 return OPERATOR_CANCELLED;
-  case KNF_MODAL_CONFIRM:
+  case KNF_MODAL_CONFIRM: {
+const bool changed = (kcd->totkvert != 0);
 /* finish */
 ED_region_tag_redraw(kcd->region);
 
@@ -4400,11 +4401,11 @@ static int knifetool_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
 ED_workspace_status_text(C, NULL);
 
 /* Cancel to prevent undo push for empty cuts. */
-if (kcd->totkvert == 0) {
+if (!changed) {
   return OPERATOR_CANCELLED;
 }
-
 return OPERATOR_FINISHED;
+  }
   case KNF_MODAL_UNDO:
 if (BLI_stack_is_empty(kcd->undostack)) {
   ED_region_tag_redraw(kcd->region);

___
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] [166ef650cb2] temp-pbvh-split: Fix T97945: Cycles baking max distance is wrong

2022-06-02 Thread Brecht Van Lommel
Commit: 166ef650cb2e56de42659f2a0794bc93181b2430
Author: Brecht Van Lommel
Date:   Tue May 10 20:49:49 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB166ef650cb2e56de42659f2a0794bc93181b2430

Fix T97945: Cycles baking max distance is wrong

It was effectively sqrt(max_distance) before this fix.

Thanks to Omar Emara for identifying the solution.

===

M   source/blender/render/intern/bake.c

===

diff --git a/source/blender/render/intern/bake.c 
b/source/blender/render/intern/bake.c
index 5953c0f0f8f..bf876163013 100644
--- a/source/blender/render/intern/bake.c
+++ b/source/blender/render/intern/bake.c
@@ -330,10 +330,10 @@ static bool cast_ray_highpoly(BVHTreeFromMesh *treeData,
 {
   int i;
   int hit_mesh = -1;
-  float hit_distance = max_ray_distance;
-  if (hit_distance == 0.0f) {
+  float hit_distance_squared = max_ray_distance * max_ray_distance;
+  if (hit_distance_squared == 0.0f) {
 /* No ray distance set, use maximum. */
-hit_distance = FLT_MAX;
+hit_distance_squared = FLT_MAX;
   }
 
   BVHTreeRayHit *hits;
@@ -365,16 +365,14 @@ static bool cast_ray_highpoly(BVHTreeFromMesh *treeData,
 }
 
 if (hits[i].index != -1) {
-  float distance;
-  float hit_world[3];
-
   /* distance comparison in world space */
+  float hit_world[3];
   mul_v3_m4v3(hit_world, highpoly[i].obmat, hits[i].co);
-  distance = len_squared_v3v3(hit_world, co);
+  float distance_squared = len_squared_v3v3(hit_world, co);
 
-  if (distance < hit_distance) {
+  if (distance_squared < hit_distance_squared) {
 hit_mesh = i;
-hit_distance = distance;
+hit_distance_squared = distance_squared;
   }
 }
   }

___
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] [83a3443ea53] temp-pbvh-split: Fix T97173: Color Attributes shading turns black after switching mode.

2022-06-02 Thread Jeroen Bakker
Commit: 83a3443ea5327b80d7ee302eab75d06384eca637
Author: Jeroen Bakker
Date:   Wed May 11 12:44:04 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB83a3443ea5327b80d7ee302eab75d06384eca637

Fix T97173: Color Attributes shading turns black after switching mode.

Sculpt colors tagged the custom data as already created (cd_used), but
should have been tagged as being requested (cd_needed).

===

M   source/blender/draw/intern/draw_cache_impl_mesh.c

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index a406e154fa0..07d740d89c1 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -1231,11 +1231,11 @@ static void sculpt_request_active_vcol(MeshBatchCache 
*cache, Object *object, Me
   _query.id, render, ATTR_DOMAIN_MASK_COLOR, CD_MASK_COLOR_ALL);
 
   if (active_i >= 0) {
-cache->cd_used.vcol |= 1UL << (uint)active_i;
+cache->cd_needed.vcol |= 1UL << (uint)active_i;
   }
 
   if (render_i >= 0) {
-cache->cd_used.vcol |= 1UL << (uint)render_i;
+cache->cd_needed.vcol |= 1UL << (uint)render_i;
   }
 }

___
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] [331cc4b66ef] temp-pbvh-split: Cleanup: spelling in comments/strings

2022-06-02 Thread Campbell Barton
Commit: 331cc4b66ef4e8962d35b7f038fac52186545881
Author: Campbell Barton
Date:   Wed May 11 17:01:06 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rB331cc4b66ef4e8962d35b7f038fac52186545881

Cleanup: spelling in comments/strings

D14918 from @linux_dr with some other changes included.

===

M   build_files/cmake/project_info.py
M   intern/cycles/blender/mesh.cpp
M   source/blender/blenkernel/intern/asset_catalog_test.cc
M   source/blender/blenlib/tests/BLI_path_util_test.cc
M   source/blender/imbuf/intern/anim_movie.c

===

diff --git a/build_files/cmake/project_info.py 
b/build_files/cmake/project_info.py
index 46fd538f675..0661db3a18c 100755
--- a/build_files/cmake/project_info.py
+++ b/build_files/cmake/project_info.py
@@ -170,7 +170,7 @@ def cmake_advanced_info() -> Union[Tuple[List[str], 
List[Tuple[str, str]]], Tupl
 project_path = create_eclipse_project()
 
 if not exists(project_path):
-print("Generating Eclipse Prokect File Failed: %r not found" % 
project_path)
+print("Generating Eclipse Project File Failed: %r not found" % 
project_path)
 return None, None
 
 from xml.dom.minidom import parse
diff --git a/intern/cycles/blender/mesh.cpp b/intern/cycles/blender/mesh.cpp
index de67e27923d..c76ce3801d4 100644
--- a/intern/cycles/blender/mesh.cpp
+++ b/intern/cycles/blender/mesh.cpp
@@ -316,7 +316,7 @@ static void fill_generic_attribute(BL::Mesh _mesh,
   break;
 }
 case BL::Attribute::domain_EDGE: {
-  /* Averge edge attributes at vertices. */
+  /* Average edge attributes at vertices. */
   const size_t num_verts = b_mesh.vertices.length();
   vector count(num_verts, 0);
 
diff --git a/source/blender/blenkernel/intern/asset_catalog_test.cc 
b/source/blender/blenkernel/intern/asset_catalog_test.cc
index 11f36e32b74..81eb1786322 100644
--- a/source/blender/blenkernel/intern/asset_catalog_test.cc
+++ b/source/blender/blenkernel/intern/asset_catalog_test.cc
@@ -318,7 +318,7 @@ TEST_F(AssetCatalogTest, load_catalog_path_backslashes)
   const AssetCatalog *found_by_id = 
service.find_catalog(UUID_POSES_ELLIE_BACKSLASHES);
   ASSERT_NE(nullptr, found_by_id);
   EXPECT_EQ(AssetCatalogPath("character/Ellie/backslashes"), found_by_id->path)
-  << "Backslashes should be normalised when loading from disk.";
+  << "Backslashes should be normalized when loading from disk.";
   EXPECT_EQ(StringRefNull("Windows For Life!"), found_by_id->simple_name);
 
   const AssetCatalog *found_by_path = 
service.find_catalog_by_path("character/Ellie/backslashes");
diff --git a/source/blender/blenlib/tests/BLI_path_util_test.cc 
b/source/blender/blenlib/tests/BLI_path_util_test.cc
index bfd297214c0..4f6f4a5c413 100644
--- a/source/blender/blenlib/tests/BLI_path_util_test.cc
+++ b/source/blender/blenlib/tests/BLI_path_util_test.cc
@@ -663,7 +663,7 @@ TEST(path_util, PathContains)
   EXPECT_TRUE(BLI_path_contains("/some/path", "/some/path/inside"))
   << "A path contains its subdirectory";
   EXPECT_TRUE(BLI_path_contains("/some/path", "/some/path/../path/inside"))
-  << "Paths should be normalised";
+  << "Paths should be normalized";
   EXPECT_TRUE(BLI_path_contains("C:\\some\\path", "C:\\some\\path\\inside"))
   << "Windows paths should be supported as well";
 
@@ -672,7 +672,7 @@ TEST(path_util, PathContains)
   EXPECT_FALSE(BLI_path_contains("/some/path", "/"))
   << "Root directory not be contained in a subdirectory";
   EXPECT_FALSE(BLI_path_contains("/some/path", "/some/path/../outside"))
-  << "Paths should be normalised";
+  << "Paths should be normalized";
   EXPECT_FALSE(BLI_path_contains("/some/path", "/some/path_library"))
   << "Just sharing a suffix is not enough, path semantics should be 
followed";
   EXPECT_FALSE(BLI_path_contains("/some/path", "./contents"))
diff --git a/source/blender/imbuf/intern/anim_movie.c 
b/source/blender/imbuf/intern/anim_movie.c
index 096089d4c41..0052ce19aa1 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -423,7 +423,7 @@ static int startavi(struct anim *anim)
   anim->cur_position = 0;
 
 #  if 0
-  printf("x:%d y:%d size:%d interl:%d dur:%d\n",
+  printf("x:%d y:%d size:%d interlace:%d dur:%d\n",
  anim->x,
  anim->y,
  anim->framesize,

___
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] [a74cd170300] temp-pbvh-split: Fix: Hide empty panel in curves sculpt mode tool settings

2022-06-02 Thread Hans Goudey
Commit: a74cd170300b3c97a64a395406c07c21f368bd12
Author: Hans Goudey
Date:   Wed May 11 12:10:00 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rBa74cd170300b3c97a64a395406c07c21f368bd12

Fix: Hide empty panel in curves sculpt mode tool settings

This panel is empty after rB5b24291be1e0

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 698f0dadc33..3e1754fd908 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -391,6 +391,11 @@ class VIEW3D_PT_tools_brush_settings_advanced(Panel, 
View3DPaintBrushPanel):
 bl_options = {'DEFAULT_CLOSED'}
 bl_ui_units_x = 14
 
+@classmethod
+def poll(cls, context):
+mode = cls.get_brush_mode(context)
+return mode is not None and mode != 'SCULPT_CURVES'
+
 def draw(self, context):
 layout = self.layout

___
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] [2a570c1f4b8] temp-pbvh-split: Fix T97056: Cycles MNEE not working with glass and pure refraction BSDFs

2022-06-02 Thread Olivier Maury
Commit: 2a570c1f4b8c25bc3a88d5c32414681796a79e07
Author: Olivier Maury
Date:   Tue May 10 18:50:54 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB2a570c1f4b8c25bc3a88d5c32414681796a79e07

Fix T97056: Cycles MNEE not working with glass and pure refraction BSDFs

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

===

M   intern/cycles/kernel/integrator/mnee.h

===

diff --git a/intern/cycles/kernel/integrator/mnee.h 
b/intern/cycles/kernel/integrator/mnee.h
index 455d15b28c2..7820d71f15c 100644
--- a/intern/cycles/kernel/integrator/mnee.h
+++ b/intern/cycles/kernel/integrator/mnee.h
@@ -1026,7 +1026,9 @@ ccl_device_forceinline int 
kernel_path_mnee_sample(KernelGlobals kg,
 if (bsdf->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID ||
 bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID ||
 bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID ||
-bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID) {
+bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID ||
+bsdf->type == CLOSURE_BSDF_REFRACTION_ID ||
+bsdf->type == CLOSURE_BSDF_SHARP_GLASS_ID) {
   /* Note that CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID and
* CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID are treated as
* CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID further below. */
@@ -1038,11 +1040,14 @@ ccl_device_forceinline int 
kernel_path_mnee_sample(KernelGlobals kg,
   const float eta = (sd_mnee->flag & SD_BACKFACING) ? 1.0f / 
microfacet_bsdf->ior :
   
microfacet_bsdf->ior;
 
-  /* Sample transmissive microfacet bsdf. */
-  float bsdf_u, bsdf_v;
-  path_state_rng_2D(kg, rng_state, PRNG_BSDF_U, _u, _v);
-  float2 h = mnee_sample_bsdf_dh(
-  bsdf->type, microfacet_bsdf->alpha_x, microfacet_bsdf->alpha_y, 
bsdf_u, bsdf_v);
+  float2 h = zero_float2();
+  if (microfacet_bsdf->alpha_x > 0.f && microfacet_bsdf->alpha_y > 
0.f) {
+/* Sample transmissive microfacet bsdf. */
+float bsdf_u, bsdf_v;
+path_state_rng_2D(kg, rng_state, PRNG_BSDF_U, _u, _v);
+h = mnee_sample_bsdf_dh(
+bsdf->type, microfacet_bsdf->alpha_x, 
microfacet_bsdf->alpha_y, bsdf_u, bsdf_v);
+  }
 
   /* Setup differential geometry on vertex. */
   mnee_setup_manifold_vertex(

___
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] [ac1ffa24202] temp-pbvh-split: Fix T97908: Cycles missing motion from on pointcloud generated by geometry nodes

2022-06-02 Thread Brecht Van Lommel
Commit: ac1ffa242029966bb8611fb0319808850193c04b
Author: Brecht Van Lommel
Date:   Tue May 10 20:38:31 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rBac1ffa242029966bb8611fb0319808850193c04b

Fix T97908: Cycles missing motion from on pointcloud generated by geometry nodes

Assume geometry is always potentially animated, since we can't use our heuristic
to detect if the object is potentially animated by looking at modifiers on the
object.

The main original reason for this check was to avoid evaluating subdivision
surfaces for many static objects, which is not happening here anyway.

===

M   intern/cycles/blender/util.h

===

diff --git a/intern/cycles/blender/util.h b/intern/cycles/blender/util.h
index eead6cec08c..49cecb6d0f3 100644
--- a/intern/cycles/blender/util.h
+++ b/intern/cycles/blender/util.h
@@ -262,8 +262,11 @@ static inline bool BKE_object_is_modified(BL::Object 
, BL::Scene , bo
 static inline bool BKE_object_is_deform_modified(BObjectInfo , BL::Scene 
, bool preview)
 {
   if (!self.is_real_object_data()) {
-return false;
+/* Comes from geometry nodes, can't use heuristic to guess if it's 
animated. */
+return true;
   }
+
+  /* Use heuristic to quickly check if object is potentially animated. */
   return self.real_object.is_deform_modified(scene, (preview) ? (1 << 0) : (1 
<< 1)) ? true :

false;
 }

___
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] [1b4cc8c5f35] temp-pbvh-split: Outliner: Remove 'rename library' feature.

2022-06-02 Thread Bastien Montagne
Commit: 1b4cc8c5f357e230f2c1d5e1782af7ce06edf035
Author: Bastien Montagne
Date:   Wed May 11 10:56:14 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB1b4cc8c5f357e230f2c1d5e1782af7ce06edf035

Outliner: Remove 'rename library' feature.

This was historically the only way to change/fix paths of library files
in Blender. However, only changing the path then required a manual
reload of the library, which could be skipped by user, or a save/reload
of the working .blend file, which could lead to corruption of advanced
library usages like overrides.

Prefferred, modern way to change path of a library is to use the
Relocate operation instead. Direct path modification remains possible
through RNA (python console or the Data API view in the Outliner.

===

M   source/blender/editors/space_outliner/outliner_edit.cc
M   source/blender/editors/space_outliner/outliner_tools.cc

===

diff --git a/source/blender/editors/space_outliner/outliner_edit.cc 
b/source/blender/editors/space_outliner/outliner_edit.cc
index d6c5901b546..1de45b0ec96 100644
--- a/source/blender/editors/space_outliner/outliner_edit.cc
+++ b/source/blender/editors/space_outliner/outliner_edit.cc
@@ -334,8 +334,16 @@ static void do_item_rename(ARegion *region,
   add_textbut = true;
 }
   }
-  else if (te->idcode == ID_LI && ((Library *)tselem->id)->parent) {
-BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly 
linked library");
+  else if (te->idcode == ID_LI) {
+if (reinterpret_cast(tselem->id)->parent) {
+  BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly 
linked library");
+}
+else {
+  BKE_report(
+  reports,
+  RPT_WARNING,
+  "Library path is not editable from here anymore, please use Relocate 
operation instead");
+}
   }
   else {
 add_textbut = true;
diff --git a/source/blender/editors/space_outliner/outliner_tools.cc 
b/source/blender/editors/space_outliner/outliner_tools.cc
index 5da64177e51..2ee1d28d540 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -2527,14 +2527,12 @@ void OUTLINER_OT_id_operation(wmOperatorType *ot)
 enum eOutlinerLibOpTypes {
   OL_LIB_INVALID = 0,
 
-  OL_LIB_RENAME,
   OL_LIB_DELETE,
   OL_LIB_RELOCATE,
   OL_LIB_RELOAD,
 };
 
 static const EnumPropertyItem outliner_lib_op_type_items[] = {
-{OL_LIB_RENAME, "RENAME", 0, "Rename", ""},
 {OL_LIB_DELETE,
  "DELETE",
  ICON_X,
@@ -2566,14 +2564,6 @@ static int outliner_lib_operation_exec(bContext *C, 
wmOperator *op)
 
   eOutlinerLibOpTypes event = (eOutlinerLibOpTypes)RNA_enum_get(op->ptr, 
"type");
   switch (event) {
-case OL_LIB_RENAME: {
-  outliner_do_libdata_operation(
-  C, op->reports, scene, space_outliner, _outliner->tree, 
item_rename_fn, nullptr);
-
-  WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr);
-  ED_undo_push(C, "Rename Library");
-  break;
-}
 case OL_LIB_DELETE: {
   outliner_do_libdata_operation(
   C, op->reports, scene, space_outliner, _outliner->tree, 
id_delete_fn, nullptr);

___
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] [5e338f88d57] temp-pbvh-split: Cleanup: use 'num' / 'size' suffix instead of 'sz'

2022-06-02 Thread Campbell Barton
Commit: 5e338f88d57ad733832cc92a6234d82ac80300a6
Author: Campbell Barton
Date:   Wed May 11 13:37:10 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rB5e338f88d57ad733832cc92a6234d82ac80300a6

Cleanup: use 'num' / 'size' suffix instead of 'sz'

GPU code used `sz` as an abbreviation for size, as well as a few other
places. Use size where this represents a size in bytes, see: T85728.

===

M   source/blender/blenkernel/intern/main.c
M   source/blender/blenlib/BLI_fileops.h
M   source/blender/blenlib/intern/BLI_filelist.c
M   source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
M   source/blender/blenloader/intern/readfile.c
M   source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc
M   source/blender/editors/animation/keyframes_draw.c
M   source/blender/gpu/GPU_vertex_format.h
M   source/blender/gpu/intern/gpu_debug.cc
M   source/blender/gpu/intern/gpu_immediate.cc
M   source/blender/gpu/intern/gpu_vertex_buffer.cc
M   source/blender/gpu/intern/gpu_vertex_format.cc
M   source/blender/gpu/opengl/gl_vertex_array.cc
M   source/blender/nodes/texture/node_texture_util.c

===

diff --git a/source/blender/blenkernel/intern/main.c 
b/source/blender/blenkernel/intern/main.c
index 03e03dacfbc..b9ed783fa8c 100644
--- a/source/blender/blenkernel/intern/main.c
+++ b/source/blender/blenkernel/intern/main.c
@@ -502,13 +502,13 @@ BlendThumbnail *BKE_main_thumbnail_from_imbuf(Main 
*bmain, ImBuf *img)
   }
 
   if (img) {
-const size_t sz = BLEN_THUMB_MEMSIZE(img->x, img->y);
-data = MEM_mallocN(sz, __func__);
+const size_t data_size = BLEN_THUMB_MEMSIZE(img->x, img->y);
+data = MEM_mallocN(data_size, __func__);
 
 IMB_rect_from_float(img); /* Just in case... */
 data->width = img->x;
 data->height = img->y;
-memcpy(data->rect, img->rect, sz - sizeof(*data));
+memcpy(data->rect, img->rect, data_size - sizeof(*data));
   }
 
   if (bmain) {
diff --git a/source/blender/blenlib/BLI_fileops.h 
b/source/blender/blenlib/BLI_fileops.h
index 3ce2b90e729..9a24b09fc66 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -178,7 +178,7 @@ void BLI_filelist_free(struct direntry *filelist, unsigned 
int nrentries);
  * Convert given entry's size into human-readable strings.
  */
 void BLI_filelist_entry_size_to_string(const struct stat *st,
-   uint64_t sz,
+   uint64_t st_size_fallback,
bool compact,
char 
r_size[FILELIST_DIRENTRY_SIZE_LEN]);
 /**
diff --git a/source/blender/blenlib/intern/BLI_filelist.c 
b/source/blender/blenlib/intern/BLI_filelist.c
index 76fc5b6342a..c6178ebb3a0 100644
--- a/source/blender/blenlib/intern/BLI_filelist.c
+++ b/source/blender/blenlib/intern/BLI_filelist.c
@@ -237,7 +237,7 @@ unsigned int BLI_filelist_dir_contents(const char *dirname, 
struct direntry **r_
 }
 
 void BLI_filelist_entry_size_to_string(const struct stat *st,
-   const uint64_t sz,
+   const uint64_t st_size_fallback,
/* Used to change MB -> M, etc. - is 
that really useful? */
const bool UNUSED(compact),
char r_size[FILELIST_DIRENTRY_SIZE_LEN])
@@ -247,7 +247,7 @@ void BLI_filelist_entry_size_to_string(const struct stat 
*st,
* will buy us some time until files get bigger than 4GB or until
* everyone starts using __USE_FILE_OFFSET64 or equivalent.
*/
-  double size = (double)(st ? st->st_size : sz);
+  double size = (double)(st ? st->st_size : st_size_fallback);
 #ifdef WIN32
   BLI_str_format_byte_unit(r_size, size, false);
 #else
diff --git 
a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc 
b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
index 0ff488202c2..09bb1e7239f 100644
--- a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
+++ b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
@@ -57,23 +57,23 @@ static void str_ghash_tests(GHash *ghash, const char *id)
   printf("\n== STARTING %s ==\n", id);
 
 #ifdef TEXT_CORPUS_PATH
-  size_t sz = 0;
+  size_t data_size = 0;
   char *data;
   {
 struct stat st;
 if (stat(TEXT_CORPUS_PATH, ) == 0)
-  sz = st.st_size;
+  data_size = st.st_size;
   }
-  if (sz != 0) {
+  if (data_size != 0) {
 FILE *f = fopen(TEXT_CORPUS_PATH, "r");
 
-data = (char *)MEM_mallocN(sz + 1, __func__);
-if (fread(data, sizeof(*data), sz, f) != sz) {
+data = (char *)MEM_mallocN(data_size + 1, __func__);
+if (fread(data, 

[Bf-blender-cvs] [f8db581a22b] temp-pbvh-split: Fix T97966: Cycles shadow terminator offset wrong for scaled object instances

2022-06-02 Thread Mikhail Matrosov
Commit: f8db581a22b835f941712a7500020506fd0521bd
Author: Mikhail Matrosov
Date:   Tue May 10 18:52:00 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rBf8db581a22b835f941712a7500020506fd0521bd

Fix T97966: Cycles shadow terminator offset wrong for scaled object instances

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

===

M   intern/cycles/kernel/light/sample.h

===

diff --git a/intern/cycles/kernel/light/sample.h 
b/intern/cycles/kernel/light/sample.h
index 5acfc92cca1..9bbbd5b0d10 100644
--- a/intern/cycles/kernel/light/sample.h
+++ b/intern/cycles/kernel/light/sample.h
@@ -143,7 +143,7 @@ ccl_device_inline float3 shadow_ray_smooth_surface_offset(
   float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without 
normalization */
 
   if (!(sd->object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {
-object_normal_transform(kg, sd, ); /* Normal x scale, world space */
+object_dir_transform(kg, sd, ); /* Normal x scale, to world space */
   }
 
   /* Parabolic approximation */

___
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] [17d5450eafa] temp-pbvh-split: Cleanup: use '_num' suffix, mostly for curves & spline code

2022-06-02 Thread Campbell Barton
Commit: 17d5450eafacb0709fc679911be66748b417f5dc
Author: Campbell Barton
Date:   Wed May 11 12:59:58 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rB17d5450eafacb0709fc679911be66748b417f5dc

Cleanup: use '_num' suffix, mostly for curves & spline code

Replace tot/amount & size with num, in keeping with T85728.

===

M   source/blender/blenkernel/BKE_curves.hh
M   source/blender/blenkernel/BKE_geometry_set.hh
M   source/blender/blenkernel/BKE_spline.hh
M   source/blender/blenkernel/intern/attribute_access.cc
M   source/blender/blenkernel/intern/attribute_access_intern.hh
M   source/blender/blenkernel/intern/curve_catmull_rom.cc
M   source/blender/blenkernel/intern/curve_eval.cc
M   source/blender/blenkernel/intern/curve_nurbs.cc
M   source/blender/blenkernel/intern/curve_to_mesh_convert.cc
M   source/blender/blenkernel/intern/curves_geometry.cc
M   source/blender/blenkernel/intern/geometry_component_curve.cc
M   source/blender/blenkernel/intern/geometry_component_curves.cc
M   source/blender/blenkernel/intern/geometry_component_instances.cc
M   source/blender/blenkernel/intern/geometry_component_mesh.cc
M   source/blender/blenkernel/intern/geometry_component_pointcloud.cc
M   source/blender/blenkernel/intern/geometry_set.cc
M   source/blender/blenkernel/intern/spline_base.cc
M   source/blender/blenkernel/intern/spline_bezier.cc
M   source/blender/blenkernel/intern/spline_nurbs.cc
M   source/blender/blenkernel/intern/spline_poly.cc
M   source/blender/blenlib/BLI_length_parameterize.hh
M   source/blender/draw/intern/draw_cache_impl_curve.cc
M   source/blender/editors/space_node/node_draw.cc
M   
source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
M   source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc
M   source/blender/geometry/intern/realize_instances.cc
M   source/blender/modifiers/intern/MOD_nodes.cc
M   source/blender/nodes/NOD_geometry_nodes_eval_log.hh
M   source/blender/nodes/geometry/nodes/node_geo_accumulate_field.cc
M   source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
M   source/blender/nodes/geometry/nodes/node_geo_attribute_domain_size.cc
M   source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc
M   source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc
M   source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
M   
source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
M   source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
M   source/blender/nodes/geometry/nodes/node_geo_edge_split.cc
M   source/blender/nodes/geometry/nodes/node_geo_field_at_index.cc
M   source/blender/nodes/geometry/nodes/node_geo_flip_faces.cc
M   source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc
M   source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
M   source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc
M   source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
M   source/blender/nodes/geometry/nodes/node_geo_merge_by_distance.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
M   source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc
M   source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
M   source/blender/nodes/geometry/nodes/node_geo_raycast.cc
M   source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc
M   source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc
M   source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc
M   source/blender/nodes/geometry/nodes/node_geo_set_curve_radius.cc
M   source/blender/nodes/geometry/nodes/node_geo_set_curve_tilt.cc
M   source/blender/nodes/geometry/nodes/node_geo_set_id.cc
M   source/blender/nodes/geometry/nodes/node_geo_set_material_index.cc
M   source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc
M   source/blender/nodes/geometry/nodes/node_geo_set_position.cc
M   source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc
M   source/blender/nodes/geometry/nodes/node_geo_set_spline_cyclic.cc
M   source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc
M   

[Bf-blender-cvs] [9f3fe0583a8] temp-pbvh-split: Fix part of T97895: Cycles not rendering edge domain attributes

2022-06-02 Thread Brecht Van Lommel
Commit: 9f3fe0583a8830068305acf585e0453aead45066
Author: Brecht Van Lommel
Date:   Tue May 10 18:12:17 2022 +0200
Branches: temp-pbvh-split
https://developer.blender.org/rB9f3fe0583a8830068305acf585e0453aead45066

Fix part of T97895: Cycles not rendering edge domain attributes

These aren't really ideal for rendering, but better to show something. Edge
values are averaged at vertices.

===

M   intern/cycles/blender/mesh.cpp

===

diff --git a/intern/cycles/blender/mesh.cpp b/intern/cycles/blender/mesh.cpp
index 624a07762f2..de67e27923d 100644
--- a/intern/cycles/blender/mesh.cpp
+++ b/intern/cycles/blender/mesh.cpp
@@ -301,11 +301,11 @@ static void attr_create_sculpt_vertex_color(Scene *scene,
 template
 static void fill_generic_attribute(BL::Mesh _mesh,
TypeInCycles *data,
-   const AttributeElement element,
+   const BL::Attribute::domain_enum b_domain,
const GetValueAtIndex _value_at_index)
 {
-  switch (element) {
-case ATTR_ELEMENT_CORNER: {
+  switch (b_domain) {
+case BL::Attribute::domain_CORNER: {
   for (BL::MeshLoopTriangle  : b_mesh.loop_triangles) {
 const int index = t.index() * 3;
 BL::Array loops = t.loops();
@@ -315,14 +315,37 @@ static void fill_generic_attribute(BL::Mesh _mesh,
   }
   break;
 }
-case ATTR_ELEMENT_VERTEX: {
+case BL::Attribute::domain_EDGE: {
+  /* Averge edge attributes at vertices. */
+  const size_t num_verts = b_mesh.vertices.length();
+  vector count(num_verts, 0);
+
+  for (BL::MeshEdge  : b_mesh.edges) {
+BL::Array vertices = e.vertices();
+TypeInCycles value = get_value_at_index(e.index());
+
+data[vertices[0]] += value;
+data[vertices[1]] += value;
+count[vertices[0]]++;
+count[vertices[1]]++;
+  }
+
+  for (size_t i = 0; i < num_verts; i++) {
+if (count[i] > 1) {
+  data[i] /= (float)count[i];
+}
+  }
+
+  break;
+}
+case BL::Attribute::domain_POINT: {
   const int num_verts = b_mesh.vertices.length();
   for (int i = 0; i < num_verts; i++) {
 data[i] = get_value_at_index(i);
   }
   break;
 }
-case ATTR_ELEMENT_FACE: {
+case BL::Attribute::domain_FACE: {
   for (BL::MeshLoopTriangle  : b_mesh.loop_triangles) {
 data[t.index()] = get_value_at_index(t.polygon_index());
   }
@@ -404,6 +427,9 @@ static void attr_create_generic(Scene *scene,
   case BL::Attribute::domain_POINT:
 element = ATTR_ELEMENT_VERTEX;
 break;
+  case BL::Attribute::domain_EDGE:
+element = ATTR_ELEMENT_VERTEX;
+break;
   case BL::Attribute::domain_FACE:
 element = ATTR_ELEMENT_FACE;
 break;
@@ -420,15 +446,16 @@ static void attr_create_generic(Scene *scene,
 Attribute *attr = attributes.add(name, TypeFloat, element);
 float *data = attr->data_float();
 fill_generic_attribute(
-b_mesh, data, element, [&](int i) { return 
b_float_attribute.data[i].value(); });
+b_mesh, data, b_domain, [&](int i) { return 
b_float_attribute.data[i].value(); });
 break;
   }
   case BL::Attribute::data_type_BOOLEAN: {
 BL::BoolAttribute b_bool_attribute{b_attribute};
 Attribute *attr = attributes.add(name, TypeFloat, element);
 float *data = attr->data_float();
-fill_generic_attribute(
-b_mesh, data, element, [&](int i) { return 
(float)b_bool_attribute.data[i].value(); });
+fill_generic_attribute(b_mesh, data, b_domain, [&](int i) {
+  return (float)b_bool_attribute.data[i].value();
+});
 break;
   }
   case BL::Attribute::data_type_INT: {
@@ -436,14 +463,14 @@ static void attr_create_generic(Scene *scene,
 Attribute *attr = attributes.add(name, TypeFloat, element);
 float *data = attr->data_float();
 fill_generic_attribute(
-b_mesh, data, element, [&](int i) { return 
(float)b_int_attribute.data[i].value(); });
+b_mesh, data, b_domain, [&](int i) { return 
(float)b_int_attribute.data[i].value(); });
 break;
   }
   case BL::Attribute::data_type_FLOAT_VECTOR: {
 BL::FloatVectorAttribute b_vector_attribute{b_attribute};
 Attribute *attr = attributes.add(name, TypeVector, element);
 float3 *data = attr->data_float3();
-fill_generic_attribute(b_mesh, data, element, [&](int i) {
+fill_generic_attribute(b_mesh, data, b_domain, [&](int i) {
   BL::Array v = b_vector_attribute.data[i].vector();
   return make_float3(v[0], v[1], v[2]);
 });
@@ -453,7 +480,7 @@ static void attr_create_generic(Scene *scene,
 

[Bf-blender-cvs] [18159bd6c44] temp-pbvh-split: Cleanup: use '_num' / '_count' suffix instead of '_ct'

2022-06-02 Thread Campbell Barton
Commit: 18159bd6c4438e2f15e3ca0823322a947426c28a
Author: Campbell Barton
Date:   Wed May 11 13:19:56 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rB18159bd6c4438e2f15e3ca0823322a947426c28a

Cleanup: use '_num' / '_count' suffix instead of '_ct'

Use num & count (for counters), in drawing code, see: T85728.

===

M   source/blender/draw/engines/eevee/eevee_lightcache.c
M   source/blender/draw/engines/gpencil/gpencil_render.c
M   source/blender/draw/engines/overlay/overlay_gpencil.c
M   source/blender/draw/engines/workbench/workbench_render.c
M   source/blender/draw/engines/workbench/workbench_volume.c
M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_manager.h
M   source/blender/draw/intern/draw_manager_data.c

===

diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c 
b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 4f562dd9804..0b9909a904b 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -95,7 +95,7 @@ typedef struct EEVEE_LightBake {
   /** Target layer to store the data to. */
   int layer;
   /** Sample count for the convolution. */
-  float samples_ct, invsamples_ct;
+  float samples_count, invsamples_count;
   /** Sampling bias during convolution step. */
   float lod_factor;
   /** Max cube-map LOD to sample when convolving. */
@@ -282,14 +282,14 @@ static void irradiance_pool_size_get(int visibility_size, 
int total_samples, int
 (visibility_size / IRRADIANCE_SAMPLE_SIZE_Y);
 
   /* The irradiance itself take one layer, hence the +1 */
-  int layer_ct = MIN2(irr_per_vis + 1, IRRADIANCE_MAX_POOL_LAYER);
+  int layer_count = MIN2(irr_per_vis + 1, IRRADIANCE_MAX_POOL_LAYER);
 
-  int texel_ct = (int)ceilf((float)total_samples / (float)(layer_ct - 1));
+  int texel_count = (int)ceilf((float)total_samples / (float)(layer_count - 
1));
   r_size[0] = visibility_size *
-  max_ii(1, min_ii(texel_ct, (IRRADIANCE_MAX_POOL_SIZE / 
visibility_size)));
+  max_ii(1, min_ii(texel_count, (IRRADIANCE_MAX_POOL_SIZE / 
visibility_size)));
   r_size[1] = visibility_size *
-  max_ii(1, (texel_ct / (IRRADIANCE_MAX_POOL_SIZE / 
visibility_size)));
-  r_size[2] = layer_ct;
+  max_ii(1, (texel_count / (IRRADIANCE_MAX_POOL_SIZE / 
visibility_size)));
+  r_size[2] = layer_count;
 }
 
 static bool EEVEE_lightcache_validate(const LightCache *light_cache,
diff --git a/source/blender/draw/engines/gpencil/gpencil_render.c 
b/source/blender/draw/engines/gpencil/gpencil_render.c
index 19afdb3de5a..c7ef8677336 100644
--- a/source/blender/draw/engines/gpencil/gpencil_render.c
+++ b/source/blender/draw/engines/gpencil/gpencil_render.c
@@ -61,10 +61,10 @@ void GPENCIL_render_init(GPENCIL_Data *vedata,
 /* Depth need to be remapped to [0..1] range. */
 pix_z = MEM_dupallocN(pix_z);
 
-int pix_ct = rpass_z_src->rectx * rpass_z_src->recty;
+int pix_num = rpass_z_src->rectx * rpass_z_src->recty;
 
 if (DRW_view_is_persp_get(view)) {
-  for (int i = 0; i < pix_ct; i++) {
+  for (int i = 0; i < pix_num; i++) {
 pix_z[i] = (-winmat[3][2] / -pix_z[i]) - winmat[2][2];
 pix_z[i] = clamp_f(pix_z[i] * 0.5f + 0.5f, 0.0f, 1.0f);
   }
@@ -74,7 +74,7 @@ void GPENCIL_render_init(GPENCIL_Data *vedata,
   float near = DRW_view_near_distance_get(view);
   float far = DRW_view_far_distance_get(view);
   float range_inv = 1.0f / fabsf(far - near);
-  for (int i = 0; i < pix_ct; i++) {
+  for (int i = 0; i < pix_num; i++) {
 pix_z[i] = (pix_z[i] + near) * range_inv;
 pix_z[i] = clamp_f(pix_z[i], 0.0f, 1.0f);
   }
@@ -172,11 +172,11 @@ static void GPENCIL_render_result_z(struct RenderLayer 
*rl,
 float winmat[4][4];
 DRW_view_winmat_get(NULL, winmat, false);
 
-int pix_ct = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
+int pix_num = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
 
 /* Convert GPU depth [0..1] to view Z [near..far] */
 if (DRW_view_is_persp_get(NULL)) {
-  for (int i = 0; i < pix_ct; i++) {
+  for (int i = 0; i < pix_num; i++) {
 if (rp->rect[i] == 1.0f) {
   rp->rect[i] = 1e10f; /* Background */
 }
@@ -192,7 +192,7 @@ static void GPENCIL_render_result_z(struct RenderLayer *rl,
   float far = DRW_view_far_distance_get(NULL);
   float range = fabsf(far - near);
 
-  for (int i = 0; i < pix_ct; i++) {
+  for (int i = 0; i < pix_num; i++) {
 if (rp->rect[i] == 1.0f) {
   rp->rect[i] = 1e10f; /* Background */
 }
diff --git a/source/blender/draw/engines/overlay/overlay_gpencil.c 
b/source/blender/draw/engines/overlay/overlay_gpencil.c

[Bf-blender-cvs] [844bed2ec6e] temp-pbvh-split: Cleanup: use '_num' suffix instead of '_size' for CurveGeometry

2022-06-02 Thread Campbell Barton
Commit: 844bed2ec6ec2113d02d38f91942017a591b47e0
Author: Campbell Barton
Date:   Wed May 11 09:58:39 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rB844bed2ec6ec2113d02d38f91942017a591b47e0

Cleanup: use '_num' suffix instead of '_size' for CurveGeometry

Follow conventions from T85728.

===

M   source/blender/blenkernel/BKE_curves.hh
M   source/blender/blenkernel/intern/attribute.c
M   source/blender/blenkernel/intern/curves.cc
M   source/blender/blenkernel/intern/curves_geometry.cc
M   source/blender/draw/intern/draw_cache_impl_curves.cc
M   source/blender/editors/curves/intern/curves_add.cc
M   source/blender/geometry/intern/realize_instances.cc
M   source/blender/makesdna/DNA_curves_types.h
M   source/blender/makesdna/intern/dna_rename_defs.h
M   source/blender/makesrna/intern/rna_curves.c

===

diff --git a/source/blender/blenkernel/BKE_curves.hh 
b/source/blender/blenkernel/BKE_curves.hh
index 8ef7d2811b1..3e57041dec3 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -127,7 +127,7 @@ class CurvesGeometry : public ::CurvesGeometry {
* Create curves with the given size. Only the position attribute is 
created, along with the
* offsets.
*/
-  CurvesGeometry(int point_size, int curve_size);
+  CurvesGeometry(int point_num, int curve_num);
   CurvesGeometry(const CurvesGeometry );
   CurvesGeometry(CurvesGeometry &);
   CurvesGeometry =(const CurvesGeometry );
@@ -686,11 +686,11 @@ std::array 
calculate_type_counts(const VArray 
 
 inline int CurvesGeometry::points_num() const
 {
-  return this->point_size;
+  return this->point_num;
 }
 inline int CurvesGeometry::curves_num() const
 {
-  return this->curve_size;
+  return this->curve_num;
 }
 inline IndexRange CurvesGeometry::points_range() const
 {
@@ -720,7 +720,7 @@ inline const std::array 
::curve_type_counts
 inline IndexRange CurvesGeometry::points_for_curve(const int index) const
 {
   /* Offsets are not allocated when there are no curves. */
-  BLI_assert(this->curve_size > 0);
+  BLI_assert(this->curve_num > 0);
   BLI_assert(this->curve_offsets != nullptr);
   const int offset = this->curve_offsets[index];
   const int offset_next = this->curve_offsets[index + 1];
@@ -730,7 +730,7 @@ inline IndexRange CurvesGeometry::points_for_curve(const 
int index) const
 inline IndexRange CurvesGeometry::points_for_curves(const IndexRange curves) 
const
 {
   /* Offsets are not allocated when there are no curves. */
-  BLI_assert(this->curve_size > 0);
+  BLI_assert(this->curve_num > 0);
   BLI_assert(this->curve_offsets != nullptr);
   const int offset = this->curve_offsets[curves.start()];
   const int offset_next = this->curve_offsets[curves.one_after_last()];
@@ -752,7 +752,7 @@ inline IndexRange 
CurvesGeometry::evaluated_points_for_curve(int index) const
 inline IndexRange CurvesGeometry::evaluated_points_for_curves(const IndexRange 
curves) const
 {
   BLI_assert(!this->runtime->offsets_cache_dirty);
-  BLI_assert(this->curve_size > 0);
+  BLI_assert(this->curve_num > 0);
   const int offset = this->runtime->evaluated_offsets_cache[curves.start()];
   const int offset_next = 
this->runtime->evaluated_offsets_cache[curves.one_after_last()];
   return {offset, offset_next - offset};
diff --git a/source/blender/blenkernel/intern/attribute.c 
b/source/blender/blenkernel/intern/attribute.c
index 0cb0704ff80..7f93eb7b393 100644
--- a/source/blender/blenkernel/intern/attribute.c
+++ b/source/blender/blenkernel/intern/attribute.c
@@ -75,9 +75,9 @@ static void get_domains(const ID *id, DomainInfo 
info[ATTR_DOMAIN_NUM])
 case ID_CV: {
   Curves *curves = (Curves *)id;
   info[ATTR_DOMAIN_POINT].customdata = >geometry.point_data;
-  info[ATTR_DOMAIN_POINT].length = curves->geometry.point_size;
+  info[ATTR_DOMAIN_POINT].length = curves->geometry.point_num;
   info[ATTR_DOMAIN_CURVE].customdata = >geometry.curve_data;
-  info[ATTR_DOMAIN_CURVE].length = curves->geometry.curve_size;
+  info[ATTR_DOMAIN_CURVE].length = curves->geometry.curve_num;
   break;
 }
 default:
diff --git a/source/blender/blenkernel/intern/curves.cc 
b/source/blender/blenkernel/intern/curves.cc
index bcfd6206a78..84ba98db54b 100644
--- a/source/blender/blenkernel/intern/curves.cc
+++ b/source/blender/blenkernel/intern/curves.cc
@@ -78,12 +78,12 @@ static void curves_copy_data(Main *UNUSED(bmain), ID 
*id_dst, const ID *id_src,
* shallow copy from the source to the destination, and because the 
copy-on-write functionality
* isn't supported more generically yet. */
 
-  dst.point_size = src.point_size;
-  dst.curve_size = src.curve_size;
+  dst.point_num = src.point_num;
+  dst.curve_num = src.curve_num;
 
   const eCDAllocType alloc_type = (flag & LIB_ID_COPY_CD_REFERENCE) ? 
CD_REFERENCE 

[Bf-blender-cvs] [d46039a8b25] temp-pbvh-split: Cleanup: spelling in comments

2022-06-02 Thread Campbell Barton
Commit: d46039a8b2583e48e29b75e56f279a1682e39dfa
Author: Campbell Barton
Date:   Wed May 11 10:03:17 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rBd46039a8b2583e48e29b75e56f279a1682e39dfa

Cleanup: spelling in comments

Revert change from [0] that assumed UNORM was a mis-spelling of UNIFORM.

[0]: 2c75857f9fc0dc5d524e4a0407e0a68856e5906e

===

M   source/blender/editors/sculpt_paint/curves_sculpt_add.cc
M   source/blender/geometry/GEO_resample_curves.hh
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/GPU_texture.h
M   source/blender/gpu/opengl/gl_texture.hh
M   source/blender/imbuf/intern/jpeg.c

===

diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
index 18bdbb88d8f..feda57fff1f 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
@@ -234,7 +234,7 @@ struct AddOperationExecutor {
   neighbors_per_curve = this->find_curve_neighbors(added_points);
 }
 
-/* Resize to add the new curves, building the offests in the array owned 
by thge curves. */
+/* Resize to add the new curves, building the offsets in the array owned 
by the curves. */
 const int tot_added_curves = added_points.bary_coords.size();
 curves_->resize(curves_->points_num(), curves_->curves_num() + 
tot_added_curves);
 if (interpolate_point_count_) {
diff --git a/source/blender/geometry/GEO_resample_curves.hh 
b/source/blender/geometry/GEO_resample_curves.hh
index 7cfb5dadde6..97399ccb0a5 100644
--- a/source/blender/geometry/GEO_resample_curves.hh
+++ b/source/blender/geometry/GEO_resample_curves.hh
@@ -15,7 +15,7 @@ namespace blender::geometry {
  * samples defined by the count field. Interpolate attributes to the result, 
with an accuracy that
  * depends on the curve's resolution parameter.
  *
- * \note The values provided by the #count_field are clampled to 1 or greater.
+ * \note The values provided by the #count_field are clamped to 1 or greater.
  */
 Curves *resample_to_count(const CurveComponent _component,
   const fn::Field _field,
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index 72a36ebfac4..3460d33fe68 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -282,7 +282,7 @@ typedef enum eGPUBuiltinShader {
   /**
* Draw a texture in 3D. Take a 3D position and a 2D texture coordinate for 
each vertex.
*
-   * Exposed via pyapi for add-ons.
+   * Exposed via Python-API for add-ons.
*
* \param image: uniform sampler2D
* \param texCoord: in vec2
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 474205ce8c3..b045d908438 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -282,7 +282,7 @@ void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat 
data_format, int miplvl);
  * \warning Only work for 2D texture for now.
  * \warning Only clears the MIP 0 of the texture.
  * \param data_format: data format of the pixel data.
- * \note The format is float for uniform textures.
+ * \note The format is float for UNORM textures.
  * \param data: 1 pixel worth of data to fill the texture with.
  */
 void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat data_format, const void 
*data);
diff --git a/source/blender/gpu/opengl/gl_texture.hh 
b/source/blender/gpu/opengl/gl_texture.hh
index 2dde8d6c86b..e5b879f1f15 100644
--- a/source/blender/gpu/opengl/gl_texture.hh
+++ b/source/blender/gpu/opengl/gl_texture.hh
@@ -363,7 +363,7 @@ inline GLenum to_gl_data_format(eGPUTextureFormat format)
 }
 
 /**
- * Assume Unorm / Float target. Used with #glReadPixels.
+ * Assume UNORM/Float target. Used with #glReadPixels.
  */
 inline GLenum channel_len_to_gl(int channel_len)
 {
diff --git a/source/blender/imbuf/intern/jpeg.c 
b/source/blender/imbuf/intern/jpeg.c
index 80fcceb0aa7..cffa61977f7 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -286,8 +286,8 @@ static ImBuf *ibJpegImageFromCinfo(struct 
jpeg_decompress_struct *cinfo,
 }
 
 if (max_size > 0) {
-  /* libjpeg can more quickly decompress while scaling down to 1/2, 1/4, 
1/8,
-   * while libjpeg-turbo can also do 3/8, 5/8, etc. But max is 1/8. */
+  /* `libjpeg` can more quickly decompress while scaling down to 1/2, 1/4, 
1/8,
+   * while `libjpeg-turbo` can also do 3/8, 5/8, etc. But max is 1/8. */
   float scale = (float)max_size / MAX2(cinfo->image_width, 
cinfo->image_height);
   cinfo->scale_denom = 8;
   cinfo->scale_num = max_uu(1, min_uu(8, ceill(scale * 
(float)cinfo->scale_denom)));
@@ -520,9 +520,9 @@ struct ImBuf *imb_thumbnail_jpeg(const char *filepath,
 
   if 

[Bf-blender-cvs] [01d33feed57] temp-pbvh-split: WM: clear wmEvent.flag for file-select events

2022-06-02 Thread Campbell Barton
Commit: 01d33feed57536b3d5c189ec27e767be0c401c7e
Author: Campbell Barton
Date:   Wed May 11 10:03:37 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rB01d33feed57536b3d5c189ec27e767be0c401c7e

WM: clear wmEvent.flag for file-select events

Harmless but could cause file-select events to have WM_EVENT_IS_REPEAT
set which logged a warning as this is only intended for keyboard events.

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 082e6443ba2..58d7a55eddc 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -4027,6 +4027,7 @@ void WM_event_fileselect_event(wmWindowManager *wm, void 
*ophandle, int eventval
 
 event.type = EVT_FILESELECT;
 event.val = eventval;
+event.flag = 0;
 event.customdata = ophandle; /* Only as void pointer type check. */
 
 wm_event_add(win, );
@@ -5834,6 +5835,7 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, 
wmWindow *win)
 wmEvent test_event = *win->eventstate;
 test_event.type = event_data[data_index].event_type;
 test_event.val = event_data[data_index].event_value;
+test_event.flag = 0;
 wm_eventemulation(_event, true);
 wmKeyMapItem *kmi = NULL;
 for (int handler_index = 0; handler_index < ARRAY_SIZE(handlers); 
handler_index++) {

___
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] [db23f908adf] temp-pbvh-split: Cleanup: use doxy sections for node_edit.cc

2022-06-02 Thread Campbell Barton
Commit: db23f908adfe7edea58cdfae435940f35859ed7a
Author: Campbell Barton
Date:   Wed May 11 09:39:43 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rBdb23f908adfe7edea58cdfae435940f35859ed7a

Cleanup: use doxy sections for node_edit.cc

===

M   source/blender/editors/space_node/node_edit.cc

===

diff --git a/source/blender/editors/space_node/node_edit.cc 
b/source/blender/editors/space_node/node_edit.cc
index 2d7972e2291..fb2f1bf3751 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -66,7 +66,9 @@ namespace blender::ed::space_node {
 
 #define USE_ESC_COMPO
 
-/* * composite job manager ** */
+/*  */
+/** \name Composite Job Manager
+ * \{ */
 
 enum {
   COM_RECALC_COMPOSITE = 1,
@@ -293,6 +295,12 @@ static void compo_startjob(void *cjv,
 
 }  // namespace blender::ed::space_node
 
+/** \} */
+
+/*  */
+/** \name Composite Job C API
+ * \{ */
+
 void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, 
Scene *scene_owner)
 {
   using namespace blender::ed::space_node;
@@ -336,9 +344,13 @@ void ED_node_composite_job(const bContext *C, struct 
bNodeTree *nodetree, Scene
   WM_jobs_start(CTX_wm_manager(C), wm_job);
 }
 
+/** \} */
+
 namespace blender::ed::space_node {
 
-/* * */
+/*  */
+/** \name Composite Poll & Utility Functions
+ * \{ */
 
 bool composite_node_active(bContext *C)
 {
@@ -388,8 +400,14 @@ static void send_notifiers_after_tree_change(ID *id, 
bNodeTree *ntree)
   }
 }
 
+/** \} */
+
 }  // namespace blender::ed::space_node
 
+/*  */
+/** \name Node Editor Public API Functions
+ * \{ */
+
 void ED_node_tree_propagate_change(const bContext *C, Main *bmain, bNodeTree 
*root_ntree)
 {
   if (C != nullptr) {
@@ -783,9 +801,13 @@ void ED_node_post_apply_transform(bContext *UNUSED(C), 
bNodeTree *UNUSED(ntree))
   // node_update_nodetree(C, ntree, 0.0f, 0.0f);
 }
 
+/** \} */
+
 namespace blender::ed::space_node {
 
-/* * generic operator functions for nodes * */
+/*  */
+/** \name Generic Operator Functions for Nodes
+ * \{ */
 
 #if 0 /* UNUSED */
 
@@ -861,7 +883,11 @@ static void edit_node_properties_get(
 }
 #endif
 
-/* ** Node generic ** */
+/** \} */
+
+/*  */
+/** \name Node Generic
+ * \{ */
 
 /* is rct in visible part of node? */
 static bNode *visible_node(SpaceNode , const rctf )
@@ -874,7 +900,11 @@ static bNode *visible_node(SpaceNode , const rctf 
)
   return nullptr;
 }
 
-/* ** size widget operator  */
+/** \} */
+
+/*  */
+/** \name Node Size Widget Operator
+ * \{ */
 
 struct NodeSizeWidget {
   float mxstart, mystart;
@@ -1077,7 +1107,11 @@ void NODE_OT_resize(wmOperatorType *ot)
   ot->flag = OPTYPE_BLOCKING;
 }
 
-/* ** hidden sockets  */
+/** \} */
+
+/*  */
+/** \name Node Hidden Sockets
+ * \{ */
 
 bool node_has_hidden_sockets(bNode *node)
 {
@@ -1211,7 +1245,11 @@ bool node_find_indicated_socket(SpaceNode ,
   return false;
 }
 
-/* ** Link Dimming *** */
+/** \} */
+
+/*  */
+/** \name Node Link Dimming
+ * \{ */
 
 float node_link_dim_factor(const View2D , const bNodeLink )
 {
@@ -1237,7 +1275,11 @@ bool node_link_is_hidden_or_dimmed(const View2D , 
const bNodeLink )
   return nodeLinkIsHidden() || node_link_dim_factor(v2d, link) < 0.5f;
 }
 
-/* ** Duplicate *** */
+/** \} */
+
+/*  */
+/** \name Node Duplicate Operator
+ * \{ */
 
 static void node_duplicate_reparent_recursive(const Map _map,
   bNode *node)
@@ -1422,8 +1464,7 @@ void node_select_all(ListBase *lb, int action)
   }
 }
 
-/*  */
-/* XXX some code needing updating to operators. */
+/* XXX: some code needing updating to operators. */
 
 /* goes over all scenes, reads render layers */
 static int node_read_viewlayers_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1526,7 +1567,11 @@ void NODE_OT_render_changed(wmOperatorType *ot)
   

[Bf-blender-cvs] [1d8f2aeb740] temp-pbvh-split: Cleanup: format

2022-06-02 Thread Campbell Barton
Commit: 1d8f2aeb740dd820bdf847c93317c11e6897d84b
Author: Campbell Barton
Date:   Wed May 11 09:50:54 2022 +1000
Branches: temp-pbvh-split
https://developer.blender.org/rB1d8f2aeb740dd820bdf847c93317c11e6897d84b

Cleanup: format

===

M   doc/python_api/examples/bpy.types.Image.py
M   source/blender/editors/sculpt_paint/sculpt_filter_color.c
M   source/blender/gpencil_modifiers/CMakeLists.txt
M   source/blender/io/common/CMakeLists.txt
M   source/blender/io/common/IO_path_util.hh
M   source/blender/io/common/intern/path_util.cc
M   source/blender/makesrna/intern/rna_userdef.c

===

diff --git a/doc/python_api/examples/bpy.types.Image.py 
b/doc/python_api/examples/bpy.types.Image.py
index 715623f6f76..f0c1a780e24 100644
--- a/doc/python_api/examples/bpy.types.Image.py
+++ b/doc/python_api/examples/bpy.types.Image.py
@@ -44,4 +44,3 @@ image_dest = image_src.copy()
 image_dest.update()
 print(image_dest.size)
 print(image_dest.pixels[0:4])
-
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.c 
b/source/blender/editors/sculpt_paint/sculpt_filter_color.c
index 9bddc2ad855..f71a814aff4 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_color.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.c
@@ -125,7 +125,7 @@ static void color_filter_task_cb(void *__restrict userdata,
   case COLOR_FILTER_HUE:
 rgb_to_hsv_v(orig_color, hsv_color);
 hue = hsv_color[0];
-hsv_color[0] = fmod((hsv_color[0] + fabs(fade)) - hue,1);
+hsv_color[0] = fmod((hsv_color[0] + fabs(fade)) - hue, 1);
 hsv_to_rgb_v(hsv_color, final_color);
 break;
   case COLOR_FILTER_SATURATION:
diff --git a/source/blender/gpencil_modifiers/CMakeLists.txt 
b/source/blender/gpencil_modifiers/CMakeLists.txt
index f87c85f808f..69fc26c99e9 100644
--- a/source/blender/gpencil_modifiers/CMakeLists.txt
+++ b/source/blender/gpencil_modifiers/CMakeLists.txt
@@ -72,7 +72,6 @@ set(SRC
 
   intern/lineart/MOD_lineart.h
   intern/lineart/lineart_intern.h
-
 )
 
 if(WITH_TBB)
diff --git a/source/blender/io/common/CMakeLists.txt 
b/source/blender/io/common/CMakeLists.txt
index 95ffbe19ada..e80bd850825 100644
--- a/source/blender/io/common/CMakeLists.txt
+++ b/source/blender/io/common/CMakeLists.txt
@@ -8,7 +8,6 @@ set(INC
   ../../depsgraph
   ../../makesdna
   ../../../../intern/guardedalloc
-
 )
 
 set(INC_SYS
diff --git a/source/blender/io/common/IO_path_util.hh 
b/source/blender/io/common/IO_path_util.hh
index ac2f935523e..eeb5a9dbcfe 100644
--- a/source/blender/io/common/IO_path_util.hh
+++ b/source/blender/io/common/IO_path_util.hh
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 #pragma once
 
-#include "BLI_string_ref.hh"
 #include "BLI_set.hh"
+#include "BLI_string_ref.hh"
 
 #include "IO_path_util_types.h"
 
@@ -14,7 +14,7 @@ namespace blender::io {
  *
  * When PATH_REFERENCE_COPY mode is used, the file path pair (source
  * path, destination path) is added to the `copy_set`.
- * 
+ *
  * Equivalent of bpy_extras.io_utils.path_reference.
  */
 std::string path_reference(StringRefNull filepath,
@@ -26,4 +26,4 @@ std::string path_reference(StringRefNull filepath,
 /** Execute copying files of path_reference. */
 void path_reference_copy(const Set> 
_set);
 
-} // namespace blender::io
+}  // namespace blender::io
diff --git a/source/blender/io/common/intern/path_util.cc 
b/source/blender/io/common/intern/path_util.cc
index 2b9a1d67b44..902cf552bf0 100644
--- a/source/blender/io/common/intern/path_util.cc
+++ b/source/blender/io/common/intern/path_util.cc
@@ -28,7 +28,8 @@ std::string path_reference(StringRefNull filepath,
   }
   else if (mode == PATH_REFERENCE_COPY) {
 char filepath_cpy[PATH_MAX];
-BLI_path_join(filepath_cpy, PATH_MAX, base_dst.c_str(), 
BLI_path_basename(filepath_abs), nullptr);
+BLI_path_join(
+filepath_cpy, PATH_MAX, base_dst.c_str(), 
BLI_path_basename(filepath_abs), nullptr);
 copy_set->add(std::make_pair(filepath_abs, filepath_cpy));
 BLI_strncpy(filepath_abs, filepath_cpy, PATH_MAX);
 mode = PATH_REFERENCE_RELATIVE;
diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index 1b5536c755e..b3d4ae80713 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -6426,7 +6426,8 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "use_draw_manager_acquire_lock", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "use_draw_manager_acquire_lock", 
1);
-  RNA_def_property_ui_text(prop, "Draw Manager Locking", "Don't lock UI during 
background rendering");
+  RNA_def_property_ui_text(
+  prop, "Draw Manager Locking", "Don't lock UI during background 
rendering");
 
   prop = 

[Bf-blender-cvs] [7e63c035b8d] temp-pbvh-split: Fix cursor snap not acting on selected UVs

2022-06-02 Thread Germano Cavalcante
Commit: 7e63c035b8d9377549124b873d4acfd137edef7a
Author: Germano Cavalcante
Date:   Tue May 10 21:22:16 2022 -0300
Branches: temp-pbvh-split
https://developer.blender.org/rB7e63c035b8d9377549124b873d4acfd137edef7a

Fix cursor snap not acting on selected UVs

Regression in rBd2271cf939.

===

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

===

diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index e119b264ae7..769fd28c57b 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1020,7 +1020,7 @@ static void snap_calc_uv_fn(TransInfo *t, float 
*UNUSED(vec))
objects,
objects_len,
t->mval,
-   true,
+   t->tsnap.modeSelect == SNAP_NOT_SELECTED,
_sq,
t->tsnap.snapPoint)) {
   t->tsnap.snapPoint[0] *= t->aspect[0];

___
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] [4a72b64c7b3] master: Cleanup: Split large block of versioning code to separate function

2022-06-02 Thread Hans Goudey
Commit: 4a72b64c7b36ec82f416fed7e12b6fb6b6a2b352
Author: Hans Goudey
Date:   Thu Jun 2 22:26:34 2022 +0200
Branches: master
https://developer.blender.org/rB4a72b64c7b36ec82f416fed7e12b6fb6b6a2b352

Cleanup: Split large block of versioning code to separate function

Large blocks of versioning code should be separate to keep
`blo_do_versions_300` more readable.

===

M   source/blender/blenloader/intern/versioning_300.c

===

diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 98c860792b2..76d12cc1109 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1371,6 +1371,250 @@ static void 
version_liboverride_rnacollections_insertion_animdata(ID *id)
   }
 }
 
+static void 
versioning_replace_legacy_combined_and_separate_color_nodes(bNodeTree *ntree)
+{
+  /* In geometry nodes, replace shader combine/separate color nodes with 
function nodes */
+  if (ntree->type == NTREE_GEOMETRY) {
+version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "R", "Red");
+version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "G", 
"Green");
+version_node_input_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "B", "Blue");
+version_node_output_socket_name(ntree, SH_NODE_COMBRGB_LEGACY, "Image", 
"Color");
+
+version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "R", "Red");
+version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "G", 
"Green");
+version_node_output_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "B", "Blue");
+version_node_input_socket_name(ntree, SH_NODE_SEPRGB_LEGACY, "Image", 
"Color");
+
+LISTBASE_FOREACH (bNode *, node, >nodes) {
+  switch (node->type) {
+case SH_NODE_COMBRGB_LEGACY: {
+  node->type = FN_NODE_COMBINE_COLOR;
+  NodeCombSepColor *storage = (NodeCombSepColor 
*)MEM_callocN(sizeof(NodeCombSepColor),
+  
__func__);
+  storage->mode = NODE_COMBSEP_COLOR_RGB;
+  strcpy(node->idname, "FunctionNodeCombineColor");
+  node->storage = storage;
+  break;
+}
+case SH_NODE_SEPRGB_LEGACY: {
+  node->type = FN_NODE_SEPARATE_COLOR;
+  NodeCombSepColor *storage = (NodeCombSepColor 
*)MEM_callocN(sizeof(NodeCombSepColor),
+  
__func__);
+  storage->mode = NODE_COMBSEP_COLOR_RGB;
+  strcpy(node->idname, "FunctionNodeSeparateColor");
+  node->storage = storage;
+  break;
+}
+  }
+}
+  }
+
+  /* In compositing nodes, replace combine/separate RGBA/HSVA/YCbCrA/YCCA 
nodes with
+   * combine/separate color */
+  if (ntree->type == NTREE_COMPOSIT) {
+version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "R", 
"Red");
+version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "G", 
"Green");
+version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "B", 
"Blue");
+version_node_input_socket_name(ntree, CMP_NODE_COMBRGBA_LEGACY, "A", 
"Alpha");
+
+version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "H", 
"Red");
+version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "S", 
"Green");
+version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "V", 
"Blue");
+version_node_input_socket_name(ntree, CMP_NODE_COMBHSVA_LEGACY, "A", 
"Alpha");
+
+version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "Y", 
"Red");
+version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "Cb", 
"Green");
+version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "Cr", 
"Blue");
+version_node_input_socket_name(ntree, CMP_NODE_COMBYCCA_LEGACY, "A", 
"Alpha");
+
+version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "Y", 
"Red");
+version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "U", 
"Green");
+version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "V", 
"Blue");
+version_node_input_socket_name(ntree, CMP_NODE_COMBYUVA_LEGACY, "A", 
"Alpha");
+
+version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "R", 
"Red");
+version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "G", 
"Green");
+version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "B", 
"Blue");
+version_node_output_socket_name(ntree, CMP_NODE_SEPRGBA_LEGACY, "A", 
"Alpha");
+
+version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "H", 
"Red");
+version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "S", 
"Green");
+version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, "V", 
"Blue");
+version_node_output_socket_name(ntree, CMP_NODE_SEPHSVA_LEGACY, 

[Bf-blender-cvs] [545b9ddc34d] master: Cleanup: Simplify curves toolbar drawing logic

2022-06-02 Thread Hans Goudey
Commit: 545b9ddc34da54a04f50e40cd0993ee88c4d56de
Author: Hans Goudey
Date:   Thu Jun 2 22:17:50 2022 +0200
Branches: master
https://developer.blender.org/rB545b9ddc34da54a04f50e40cd0993ee88c4d56de

Cleanup: Simplify curves toolbar drawing logic

Use `elif` to clarify that only one case happens.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index b7fe715ca90..80ea33f8a75 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -510,30 +510,27 @@ class _draw_tool_settings_context_mode:
 header=True,
 )
 
-if brush.curves_sculpt_tool == 'COMB':
+curves_tool = brush.curves_sculpt_tool
+
+if curves_tool == 'COMB':
 layout.prop(brush, "falloff_shape", expand=True)
 layout.popover("VIEW3D_PT_tools_brush_falloff")
-
-if brush.curves_sculpt_tool == 'ADD':
+elif curves_tool == 'ADD':
 layout.prop(brush, "falloff_shape", expand=True)
 layout.prop(brush.curves_sculpt_settings, "add_amount")
 layout.popover("VIEW3D_PT_curves_sculpt_add_shape", text="Curve 
Shape")
 layout.prop(brush, "use_frontface", text="Front Faces Only")
-
-if brush.curves_sculpt_tool == 'GROW_SHRINK':
+elif curves_tool == 'GROW_SHRINK':
 layout.prop(brush, "direction", expand=True, text="")
 layout.prop(brush, "falloff_shape", expand=True)
 layout.popover("VIEW3D_PT_curves_sculpt_grow_shrink_scaling", 
text="Scaling")
 layout.popover("VIEW3D_PT_tools_brush_falloff")
-
-if brush.curves_sculpt_tool == 'SNAKE_HOOK':
+elif curves_tool == 'SNAKE_HOOK':
 layout.prop(brush, "falloff_shape", expand=True)
 layout.popover("VIEW3D_PT_tools_brush_falloff")
-
-if brush.curves_sculpt_tool == 'DELETE':
+elif curves_tool == 'DELETE':
 layout.prop(brush, "falloff_shape", expand=True)
-
-if brush.curves_sculpt_tool == 'SELECTION_PAINT':
+elif curves_tool == 'SELECTION_PAINT':
 layout.prop(brush, "direction", expand=True, text="")
 layout.prop(brush, "falloff_shape", expand=True)
 layout.popover("VIEW3D_PT_tools_brush_falloff")

___
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] [73d8015aa3b] master: Fix T79801: openvdb cache does not support Unicode paths on windows

2022-06-02 Thread Ray Molenkamp
Commit: 73d8015aa3be539089bd8ec17a9f914b4524c5e7
Author: Ray Molenkamp
Date:   Thu Jun 2 11:18:43 2022 -0600
Branches: master
https://developer.blender.org/rB73d8015aa3be539089bd8ec17a9f914b4524c5e7

Fix T79801: openvdb cache does not support Unicode paths on windows

"Fix" should be taken with a grain of salt, this will fix
the issue on win10 1903 and newer.

OpenVDB uses boosts memory mapped files which call
CreateFileA in the back-end when you feed it a
regular string.

now the encoding for CreateFileA will be whatever the
default is for the system, it internally turns it into
a wide string with said encoding and calls CreateFileW.

This change changes that encoding to UTF-8 for just
blender so we can use utf-8 with any of the narrow
api functions. This is a manifest change and only win10
1903 will look for it, so that sadly limits the fix
to only a subset of users.

While ideally we would have fixed the issue our selves,
some of the calls to openvdb::io::file::open are beyond
our control (ie from inside USD or Mantaflow)

Note: This only changes the behaviour in regard to Win32
API functions, regular CRT functions like fopen or if_stream will
still not accept utf-8 filenames.

Differential Revision: https://developer.blender.org/D14981
Reviewed by: brecht

===

M   release/windows/manifest/blender.exe.manifest.in

===

diff --git a/release/windows/manifest/blender.exe.manifest.in 
b/release/windows/manifest/blender.exe.manifest.in
index b516efe24cb..95a238f775b 100644
--- a/release/windows/manifest/blender.exe.manifest.in
+++ b/release/windows/manifest/blender.exe.manifest.in
@@ -7,6 +7,11 @@
   
 
   
+  
+
+  http://schemas.microsoft.com/SMI/2019/WindowsSettings;>UTF-8
+
+

  
 

___
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] [3ccf2dc5276] cycles_oneapi: Cycles: clean-up oneAPI backend

2022-06-02 Thread Xavier Hallade
Commit: 3ccf2dc5276fe0492754822ea57022e5b4be9039
Author: Xavier Hallade
Date:   Thu Jun 2 18:44:08 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB3ccf2dc5276fe0492754822ea57022e5b4be9039

Cycles: clean-up oneAPI backend

and added inline TODOs for remaining tasks.

===

M   intern/cycles/device/oneapi/device.cpp
M   intern/cycles/device/oneapi/device_impl.cpp
M   intern/cycles/device/oneapi/device_impl.h
M   intern/cycles/device/oneapi/queue.cpp
M   intern/cycles/kernel/device/gpu/kernel.h
M   intern/cycles/kernel/device/gpu/parallel_active_index.h
M   intern/cycles/kernel/device/oneapi/compat.h
M   intern/cycles/kernel/device/oneapi/dll_interface_template.h
M   intern/cycles/kernel/device/oneapi/globals.h
M   intern/cycles/kernel/device/oneapi/image.h
M   intern/cycles/kernel/device/oneapi/kernel.cpp
M   intern/cycles/kernel/device/oneapi/kernel.h
M   intern/cycles/kernel/device/oneapi/kernel_templates.h
M   intern/cycles/util/math.h

===

diff --git a/intern/cycles/device/oneapi/device.cpp 
b/intern/cycles/device/oneapi/device.cpp
index 2db86e30d07..2473e7983a5 100644
--- a/intern/cycles/device/oneapi/device.cpp
+++ b/intern/cycles/device/oneapi/device.cpp
@@ -73,7 +73,7 @@ bool device_oneapi_init()
   // So it is not unloaded because of this.
   // FREE_SHARED_LIBRARY(lib_handle);
 
-  // NOTE(sirgienko) we need to enable JIT cache from here and
+  // NOTE(@nsirgien): we need to enable JIT cache from here and
   // right now this cache policy is controlled by env. variables
   // NOTE(hallade) we also disable use of copy engine as it
   // improves stability as of intel/llvm sycl-nightly/20220529.
@@ -132,7 +132,7 @@ static void device_iterator_cb(const char *id, const char 
*name, int num, void *
   info.description = name;
   info.num = num;
 
-  // NOTE(sirgienko) Should be unique at least on proper oneapi installation
+  // NOTE(@nsirgien): Should be unique at least on proper oneapi installation
   info.id = id;
 
   info.has_nanovdb = true;
@@ -140,11 +140,11 @@ static void device_iterator_cb(const char *id, const char 
*name, int num, void *
 
   info.has_gpu_queue = true;
 
-  // NOTE(sirgienko) oneAPI right now is focused on one device usage. In 
future it maybe will
+  // NOTE(@nsirgien): oneAPI right now is focused on one device usage. In 
future it maybe will
   // change, but right now peer access from one device to another device is 
not supported
   info.has_peer_memory = false;
 
-  // NOTE(sirgienko) Seems not possible to know from SYCL/oneAPI or Level0.
+  // NOTE(@nsirgien): Seems not possible to know from SYCL/oneAPI or Level0.
   info.display_device = false;
 
   devices->push_back(info);
diff --git a/intern/cycles/device/oneapi/device_impl.cpp 
b/intern/cycles/device/oneapi/device_impl.cpp
index 58e7c4bd6b8..896834d9c55 100644
--- a/intern/cycles/device/oneapi/device_impl.cpp
+++ b/intern/cycles/device/oneapi/device_impl.cpp
@@ -15,7 +15,7 @@ CCL_NAMESPACE_BEGIN
 static void queue_error_cb(const char *message, void *user_ptr)
 {
   if (user_ptr) {
-*((std::string *)user_ptr) = message;
+*reinterpret_cast(user_ptr) = message;
   }
 }
 
@@ -33,12 +33,12 @@ OneapiDevice::OneapiDevice(const DeviceInfo ,
 {
   need_texture_info = false;
 
-  (oneapi_dll.oneapi_set_error_cb)(queue_error_cb, _error_string);
+  oneapi_dll.oneapi_set_error_cb(queue_error_cb, _error_string);
 
   // Oneapi calls should be initialised on this moment;
   assert(oneapi_dll.oneapi_create_queue != nullptr);
 
-  bool is_finished_ok = (oneapi_dll.oneapi_create_queue)(device_queue, 
info.num);
+  bool is_finished_ok = oneapi_dll.oneapi_create_queue(device_queue, info.num);
   if (is_finished_ok == false) {
 set_error("oneAPI queue initialization error: got runtime exception \"" + 
oneapi_error_string +
   "\"");
@@ -50,7 +50,7 @@ OneapiDevice::OneapiDevice(const DeviceInfo ,
   }
 
   size_t globals_segment_size;
-  is_finished_ok = (oneapi_dll.oneapi_kernel_globals_size)(device_queue, 
globals_segment_size);
+  is_finished_ok = oneapi_dll.oneapi_kernel_globals_size(device_queue, 
globals_segment_size);
   if (is_finished_ok == false) {
 set_error("oneAPI constant memory initialization got runtime exception \"" 
+
   oneapi_error_string + "\"");
@@ -59,10 +59,10 @@ OneapiDevice::OneapiDevice(const DeviceInfo ,
 VLOG(1) << "Successfully created global/constant memory segment (kernel 
globals object)";
   }
 
-  kg_memory = (oneapi_dll.oneapi_usm_aligned_alloc_host)(device_queue, 
globals_segment_size, 16);
-  (oneapi_dll.oneapi_usm_memset)(device_queue, kg_memory, 0, 
globals_segment_size);
+  kg_memory = oneapi_dll.oneapi_usm_aligned_alloc_host(device_queue, 
globals_segment_size, 16);
+  oneapi_dll.oneapi_usm_memset(device_queue, kg_memory, 0, 
globals_segment_size);
 
- 

[Bf-blender-cvs] [aaff151aa7a] cycles_oneapi: Build: update sycl compiler to sycl-nightly/20220529

2022-06-02 Thread Xavier Hallade
Commit: aaff151aa7a14b33aeef97464ed5ec2e1a9f1934
Author: Xavier Hallade
Date:   Thu Jun 2 18:50:21 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rBaaff151aa7a14b33aeef97464ed5ec2e1a9f1934

Build: update sycl compiler to sycl-nightly/20220529

===

M   build_files/build_environment/cmake/versions.cmake

===

diff --git a/build_files/build_environment/cmake/versions.cmake 
b/build_files/build_environment/cmake/versions.cmake
index bf6a1a8e500..902b0e7517c 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -503,9 +503,9 @@ set(LEVEL_ZERO_HASH 
c39bb05a8e5898aa6c444e1704105b93d3f1888b9c333f8e7e73825ffbfb
 set(LEVEL_ZERO_HASH_TYPE SHA256)
 set(LEVEL_ZERO_FILE level-zero-${LEVEL_ZERO_VERSION}.tar.gz)
 
-set(DPCPP_VERSION 20220208)
+set(DPCPP_VERSION 20220529)
 set(DPCPP_URI 
https://github.com/intel/llvm/archive/refs/tags/sycl-nightly/${DPCPP_VERSION}.tar.gz)
-set(DPCPP_HASH 
16ac229cbc15bfa04e4c67ceedd102243c7df6c347a37098d7f68da9cf2b0b3e)
+set(DPCPP_HASH 
1a9b95b4fd589e97dc7ce8bad24909d79605ffcafd5c68ef5bdad8c1eeefcafd)
 set(DPCPP_HASH_TYPE SHA256)
 set(DPCPP_FILE DPCPP-${DPCPP_VERSION}.tar.gz)

___
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] [2b80bfe9d0e] master: Color Management: add Filmic sRGB as an image colorspace

2022-06-02 Thread Brecht Van Lommel
Commit: 2b80bfe9d0e94ba5fae1dccf6eee702fc64df049
Author: Brecht Van Lommel
Date:   Fri Jan 21 18:49:03 2022 +0100
Branches: master
https://developer.blender.org/rB2b80bfe9d0e94ba5fae1dccf6eee702fc64df049

Color Management: add Filmic sRGB as an image colorspace

A typical use case is when you want to render with the Filmic view transform, 
but
composite an existing image in the background that should not be affected by the
view transform.

With this colorspace it's possible to do an inverse Filmic transform, render
everything in scene linear space, and then apply the Filmic transform again.

This is pretty basic in that this is not going to take into account the full 
view
transform including looks, curves and exposure. But it can be helpful anyway.

Ref T68926

===

M   release/datafiles/colormanagement/config.ocio

===

diff --git a/release/datafiles/colormanagement/config.ocio 
b/release/datafiles/colormanagement/config.ocio
index df359d6c86c..6e74f1b7c6f 100644
--- a/release/datafiles/colormanagement/config.ocio
+++ b/release/datafiles/colormanagement/config.ocio
@@ -162,7 +162,7 @@ colorspaces:
 equalitygroup:
 bitdepth: 32f
 description: |
-  Standard RGB Display Space
+  sRGB display space
 isdata: false
 to_reference: ! {src: srgb.spi1d, interpolation: linear}
 from_reference: ! {src: srgb_inv.spi1d, interpolation: 
linear}
@@ -193,11 +193,11 @@ colorspaces:
 
   - !
 name: Filmic sRGB
-family: display
+family:
 equalitygroup:
 bitdepth: 32f
 description: |
-  Filmic sRGB view transform
+  sRGB displace space with Filmic view transform
 isdata: false
 from_reference: !
 children:

___
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] [33f5e8f2391] master: Cycles: load 8 bit image textures as half float for some color spaces

2022-06-02 Thread Brecht Van Lommel
Commit: 33f5e8f2391944acf8c6cc56bcc352bc10af016c
Author: Brecht Van Lommel
Date:   Fri Jan 21 18:57:00 2022 +0100
Branches: master
https://developer.blender.org/rB33f5e8f2391944acf8c6cc56bcc352bc10af016c

Cycles: load 8 bit image textures as half float for some color spaces

For non-raw, non-sRGB color spaces, always use half float even if that uses
more memory. Otherwise the precision loss from conversion to scene linear or
sRGB (as natively understood by the texture sampling) can be too much.

This also required a change to do alpha association ourselves instead of OIIO,
because in OIIO alpha multiplication happens before conversion to half float
and that gives too much precision loss.

Ref T68926

===

M   intern/cycles/blender/image.cpp
M   intern/cycles/scene/image.cpp
M   intern/cycles/scene/image_oiio.cpp
M   intern/cycles/util/image.h

===

diff --git a/intern/cycles/blender/image.cpp b/intern/cycles/blender/image.cpp
index e802fd39335..535718150b3 100644
--- a/intern/cycles/blender/image.cpp
+++ b/intern/cycles/blender/image.cpp
@@ -7,6 +7,8 @@
 #include "blender/session.h"
 #include "blender/util.h"
 
+#include "util/half.h"
+
 CCL_NAMESPACE_BEGIN
 
 /* Packed Images */
@@ -62,80 +64,134 @@ bool BlenderImageLoader::load_metadata(const 
ImageDeviceFeatures &, ImageMetaDat
 }
 
 bool BlenderImageLoader::load_pixels(const ImageMetaData ,
- void *pixels,
- const size_t pixels_size,
+ void *out_pixels,
+ const size_t out_pixels_size,
  const bool associate_alpha)
 {
   const size_t num_pixels = ((size_t)metadata.width) * metadata.height;
   const int channels = metadata.channels;
 
-  if (b_image.is_float()) {
-/* image data */
-float *image_pixels;
-image_pixels = image_get_float_pixels_for_frame(b_image, frame, 
tile_number);
+  if (metadata.type == IMAGE_DATA_TYPE_FLOAT || metadata.type == 
IMAGE_DATA_TYPE_FLOAT4) {
+/* Float. */
+float *in_pixels = image_get_float_pixels_for_frame(b_image, frame, 
tile_number);
 
-if (image_pixels && num_pixels * channels == pixels_size) {
-  memcpy(pixels, image_pixels, pixels_size * sizeof(float));
+if (in_pixels && num_pixels * channels == out_pixels_size) {
+  /* Straight copy pixel data. */
+  memcpy(out_pixels, in_pixels, out_pixels_size * sizeof(float));
 }
 else {
+  /* Missing or invalid pixel data. */
   if (channels == 1) {
-memset(pixels, 0, num_pixels * sizeof(float));
+memset(out_pixels, 0, num_pixels * sizeof(float));
   }
   else {
-const size_t num_pixels_safe = pixels_size / channels;
-float *fp = (float *)pixels;
-for (int i = 0; i < num_pixels_safe; i++, fp += channels) {
-  fp[0] = 1.0f;
-  fp[1] = 0.0f;
-  fp[2] = 1.0f;
+const size_t num_pixels_safe = out_pixels_size / channels;
+float *out_pixel = (float *)out_pixels;
+for (int i = 0; i < num_pixels_safe; i++, out_pixel += channels) {
+  out_pixel[0] = 1.0f;
+  out_pixel[1] = 0.0f;
+  out_pixel[2] = 1.0f;
   if (channels == 4) {
-fp[3] = 1.0f;
+out_pixel[3] = 1.0f;
   }
 }
   }
 }
 
-if (image_pixels) {
-  MEM_freeN(image_pixels);
+if (in_pixels) {
+  MEM_freeN(in_pixels);
 }
   }
-  else {
-unsigned char *image_pixels = image_get_pixels_for_frame(b_image, frame, 
tile_number);
+  else if (metadata.type == IMAGE_DATA_TYPE_HALF || metadata.type == 
IMAGE_DATA_TYPE_HALF4) {
+/* Half float. Blender does not have a half type, but in some cases
+ * we upsample byte to half to avoid precision loss for colorspace
+ * conversion. */
+unsigned char *in_pixels = image_get_pixels_for_frame(b_image, frame, 
tile_number);
 
-if (image_pixels && num_pixels * channels == pixels_size) {
-  memcpy(pixels, image_pixels, pixels_size * sizeof(unsigned char));
+if (in_pixels && num_pixels * channels == out_pixels_size) {
+  /* Convert uchar to half. */
+  const uchar *in_pixel = in_pixels;
+  half *out_pixel = (half *)out_pixels;
+  if (associate_alpha && channels == 4) {
+for (size_t i = 0; i < num_pixels; i++, in_pixel += 4, out_pixel += 4) 
{
+  const float alpha = util_image_cast_to_float(in_pixel[3]);
+  out_pixel[0] = 
float_to_half_image(util_image_cast_to_float(in_pixel[0]) * alpha);
+  out_pixel[1] = 
float_to_half_image(util_image_cast_to_float(in_pixel[1]) * alpha);
+  out_pixel[2] = 
float_to_half_image(util_image_cast_to_float(in_pixel[2]) * alpha);
+  out_pixel[3] = float_to_half_image(alpha);
+}
+  }
+  else {
+

[Bf-blender-cvs] [10488d54d98] master: Cleanup: Use const pointers

2022-06-02 Thread Hans Goudey
Commit: 10488d54d9836b04f36d95269552bd449dd97e7e
Author: Hans Goudey
Date:   Thu Jun 2 18:02:48 2022 +0200
Branches: master
https://developer.blender.org/rB10488d54d9836b04f36d95269552bd449dd97e7e

Cleanup: Use const pointers

===

M   source/blender/editors/sculpt_paint/curves_sculpt_ops.cc

===

diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
index aa2ec54c73f..dc3dacf9c81 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
@@ -49,7 +49,7 @@
 
 bool CURVES_SCULPT_mode_poll(bContext *C)
 {
-  Object *ob = CTX_data_active_object(C);
+  const Object *ob = CTX_data_active_object(C);
   return ob && ob->mode & OB_MODE_SCULPT_CURVES;
 }
 
@@ -109,9 +109,9 @@ static std::unique_ptr 
start_brush_operation(bConte
 {
   const BrushStrokeMode mode = 
static_cast(RNA_enum_get(op.ptr, "mode"));
 
-  Scene  = *CTX_data_scene();
-  CurvesSculpt _sculpt = *scene.toolsettings->curves_sculpt;
-  Brush  = *BKE_paint_brush(_sculpt.paint);
+  const Scene  = *CTX_data_scene();
+  const CurvesSculpt _sculpt = *scene.toolsettings->curves_sculpt;
+  const Brush  = *BKE_paint_brush_for_read(_sculpt.paint);
   switch (brush.curves_sculpt_tool) {
 case CURVES_SCULPT_TOOL_COMB:
   return new_comb_operation();
@@ -182,8 +182,8 @@ static void stroke_done(const bContext *C, PaintStroke 
*stroke)
 
 static int sculpt_curves_stroke_invoke(bContext *C, wmOperator *op, const 
wmEvent *event)
 {
-  Paint *paint = BKE_paint_get_active_from_context(C);
-  Brush *brush = BKE_paint_brush(paint);
+  const Paint *paint = BKE_paint_get_active_from_context(C);
+  const Brush *brush = BKE_paint_brush_for_read(paint);
   if (brush == nullptr) {
 return OPERATOR_CANCELLED;
   }
@@ -252,7 +252,7 @@ static void SCULPT_CURVES_OT_brush_stroke(struct 
wmOperatorType *ot)
 
 static bool curves_sculptmode_toggle_poll(bContext *C)
 {
-  Object *ob = CTX_data_active_object(C);
+  const Object *ob = CTX_data_active_object(C);
   if (ob == nullptr) {
 return false;
   }

___
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] [91c44920dd5] master: Fix: Build error after merge from release branch

2022-06-02 Thread Hans Goudey
Commit: 91c44920dd564792427fb2afc1b55d37aa17ff06
Author: Hans Goudey
Date:   Thu Jun 2 18:02:32 2022 +0200
Branches: master
https://developer.blender.org/rB91c44920dd564792427fb2afc1b55d37aa17ff06

Fix: Build error after merge from release branch

===

M   source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
index 3e2e07cb772..3eca92e37a3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@ -145,7 +145,7 @@ static void expand_mesh(Mesh ,
   BKE_mesh_update_customdata_pointers(, false);
 }
 
-static CustomData _customdata(Mesh , const AttributeDomain domain)
+static CustomData _customdata(Mesh , const eAttrDomain domain)
 {
   switch (domain) {
 case ATTR_DOMAIN_POINT:
@@ -162,13 +162,13 @@ static CustomData _customdata(Mesh , const 
AttributeDomain domain)
   }
 }
 
-static MutableSpan get_orig_index_layer(Mesh , const AttributeDomain 
domain)
+static MutableSpan get_orig_index_layer(Mesh , const eAttrDomain 
domain)
 {
   MeshComponent component;
   component.replace(, GeometryOwnershipType::ReadOnly);
   CustomData _data = get_customdata(mesh, domain);
   if (int *orig_indices = static_cast(CustomData_get_layer(_data, CD_ORIGINDEX))) {
-return {orig_indices, component.attribute_domain_size(domain)};
+return {orig_indices, component.attribute_domain_num(domain)};
   }
   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] [3cd6ccd9687] master: Merge branch 'blender-v3.2-release'

2022-06-02 Thread Hans Goudey
Commit: 3cd6ccd9687f94bdb179641b26450f45ee2d2ef4
Author: Hans Goudey
Date:   Thu Jun 2 17:54:17 2022 +0200
Branches: master
https://developer.blender.org/rB3cd6ccd9687f94bdb179641b26450f45ee2d2ef4

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] [2d9c5f3dcf2] blender-v3.2-release: Fix T98556: Crash with extrude node in edit mode

2022-06-02 Thread Hans Goudey
Commit: 2d9c5f3dcf2e039a1f46161aa6eb988b48c5d0f7
Author: Hans Goudey
Date:   Thu Jun 2 17:53:35 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB2d9c5f3dcf2e039a1f46161aa6eb988b48c5d0f7

Fix T98556: Crash with extrude node in edit mode

The original index layer was not initialized properly.
Supporting original indices properly for this node is
doable, but for now it is better to simply initialize them
to the "none" value to fix the crash.

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

===

M   source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
index 4591cfa1da2..75c29ca969c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@ -145,6 +145,34 @@ static void expand_mesh(Mesh ,
   BKE_mesh_update_customdata_pointers(, false);
 }
 
+static CustomData _customdata(Mesh , const AttributeDomain domain)
+{
+  switch (domain) {
+case ATTR_DOMAIN_POINT:
+  return mesh.vdata;
+case ATTR_DOMAIN_EDGE:
+  return mesh.edata;
+case ATTR_DOMAIN_FACE:
+  return mesh.pdata;
+case ATTR_DOMAIN_CORNER:
+  return mesh.ldata;
+default:
+  BLI_assert_unreachable();
+  return mesh.vdata;
+  }
+}
+
+static MutableSpan get_orig_index_layer(Mesh , const AttributeDomain 
domain)
+{
+  MeshComponent component;
+  component.replace(, GeometryOwnershipType::ReadOnly);
+  CustomData _data = get_customdata(mesh, domain);
+  if (int *orig_indices = static_cast(CustomData_get_layer(_data, CD_ORIGINDEX))) {
+return {orig_indices, component.attribute_domain_size(domain)};
+  }
+  return {};
+}
+
 static MEdge new_edge(const int v1, const int v2)
 {
   MEdge edge;
@@ -292,6 +320,9 @@ static void extrude_mesh_vertices(MeshComponent ,
 });
   });
 
+  MutableSpan vert_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_POINT);
+  vert_orig_indices.slice(new_vert_range).fill(ORIGINDEX_NONE);
+
   if (attribute_outputs.top_id) {
 save_selection_as_attribute(
 component, attribute_outputs.top_id.get(), ATTR_DOMAIN_POINT, 
new_vert_range);
@@ -615,6 +646,13 @@ static void extrude_mesh_edges(MeshComponent ,
 });
   }
 
+  MutableSpan vert_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_POINT);
+  vert_orig_indices.slice(new_vert_range).fill(ORIGINDEX_NONE);
+
+  MutableSpan edge_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_EDGE);
+  edge_orig_indices.slice(connect_edge_range).fill(ORIGINDEX_NONE);
+  edge_orig_indices.slice(duplicate_edge_range).fill(ORIGINDEX_NONE);
+
   if (attribute_outputs.top_id) {
 save_selection_as_attribute(
 component, attribute_outputs.top_id.get(), ATTR_DOMAIN_EDGE, 
duplicate_edge_range);
@@ -983,6 +1021,17 @@ static void extrude_mesh_face_regions(MeshComponent 
,
 });
   }
 
+  MutableSpan vert_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_POINT);
+  vert_orig_indices.slice(new_vert_range).fill(ORIGINDEX_NONE);
+
+  MutableSpan edge_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_EDGE);
+  edge_orig_indices.slice(connect_edge_range).fill(ORIGINDEX_NONE);
+  edge_orig_indices.slice(new_inner_edge_range).fill(ORIGINDEX_NONE);
+  edge_orig_indices.slice(boundary_edge_range).fill(ORIGINDEX_NONE);
+
+  MutableSpan poly_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_FACE);
+  poly_orig_indices.slice(side_poly_range).fill(ORIGINDEX_NONE);
+
   if (attribute_outputs.top_id) {
 save_selection_as_attribute(
 component, attribute_outputs.top_id.get(), ATTR_DOMAIN_FACE, 
poly_selection);
@@ -1232,6 +1281,16 @@ static void extrude_individual_mesh_faces(MeshComponent 
,
 }
   });
 
+  MutableSpan vert_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_POINT);
+  vert_orig_indices.slice(new_vert_range).fill(ORIGINDEX_NONE);
+
+  MutableSpan edge_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_EDGE);
+  edge_orig_indices.slice(connect_edge_range).fill(ORIGINDEX_NONE);
+  edge_orig_indices.slice(duplicate_edge_range).fill(ORIGINDEX_NONE);
+
+  MutableSpan poly_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_FACE);
+  poly_orig_indices.slice(side_poly_range).fill(ORIGINDEX_NONE);
+
   /* Finally update each extruded polygon's loops to point to the new edges 
and vertices.
* This must be done last, because they were used to find original indices 
for attribute
* interpolation before. Alternatively an original index array could be 
built for each domain. */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:

[Bf-blender-cvs] [96a47af413a] blender-v3.2-release: Fix T98546: Crash with multires bake and zero levels

2022-06-02 Thread Hans Goudey
Commit: 96a47af413a8055f50b9989905922588494d1653
Author: Hans Goudey
Date:   Thu Jun 2 17:46:38 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB96a47af413a8055f50b9989905922588494d1653

Fix T98546: Crash with multires bake and zero levels

The problem was that copying a `CDDerivedMesh` (`CDDM_copy`) doesn't
copy the `vert_normals` reference that it takes from a mesh. Since this
entire area is almost completely broken anyway (mainly in terms of
ownership handling), for now we can just avoid copying the `DerivedMesh`
in the zero levels case.

Longer term, this area should be refactored to remove `DerivedMesh`
and use the newer subdivision evaluation system.

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

===

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

===

diff --git a/source/blender/editors/object/object_bake.c 
b/source/blender/editors/object/object_bake.c
index 1483c24ac70..effbde41c38 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -220,22 +220,22 @@ static DerivedMesh *multiresbake_create_loresdm(Scene 
*scene, Object *ob, int *l
   MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
   Mesh *me = (Mesh *)ob->data;
   MultiresModifierData tmp_mmd = *mmd;
-  DerivedMesh *cddm = CDDM_from_mesh(me);
 
-  DM_set_only_copy(cddm, _MASK_BAREMESH);
+  *lvl = mmd->lvl;
 
   if (mmd->lvl == 0) {
-dm = CDDM_copy(cddm);
-  }
-  else {
-tmp_mmd.lvl = mmd->lvl;
-tmp_mmd.sculptlvl = mmd->lvl;
-dm = multires_make_derived_from_derived(cddm, _mmd, scene, ob, 0);
+DerivedMesh *cddm = CDDM_from_mesh(me);
+DM_set_only_copy(cddm, _MASK_BAREMESH);
+return cddm;
   }
 
-  cddm->release(cddm);
+  DerivedMesh *cddm = CDDM_from_mesh(me);
+  DM_set_only_copy(cddm, _MASK_BAREMESH);
+  tmp_mmd.lvl = mmd->lvl;
+  tmp_mmd.sculptlvl = mmd->lvl;
+  dm = multires_make_derived_from_derived(cddm, _mmd, scene, ob, 0);
 
-  *lvl = mmd->lvl;
+  cddm->release(cddm);
 
   return dm;
 }

___
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] [3ae33717e68] lineart-shadow: LineArt: Edge cutter rare case handling.

2022-06-02 Thread Yiming Wu
Commit: 3ae33717e683d4bdee7b97d804ad084dc346060c
Author: Yiming Wu
Date:   Thu Jun 2 22:55:26 2022 +0800
Branches: lineart-shadow
https://developer.blender.org/rB3ae33717e683d4bdee7b97d804ad084dc346060c

LineArt: Edge cutter rare case handling.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index a24acff57bc..213df523b85 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -256,9 +256,11 @@ void lineart_edge_cut(LineartRenderBuffer *rb,
 if (cut_start_before != ns) {
   /* Insert cutting points for when a new cut is needed. */
   ies = cut_start_before->prev ? cut_start_before->prev : NULL;
-  ns->occlusion = ies ? ies->occlusion : 0;
-  ns->material_mask_bits = ies->material_mask_bits;
-  ns->shadow_mask_bits = ies->shadow_mask_bits;
+  if (ies) {
+ns->occlusion = ies->occlusion;
+ns->material_mask_bits = ies->material_mask_bits;
+ns->shadow_mask_bits = ies->shadow_mask_bits;
+  }
   BLI_insertlinkbefore(>segments, cut_start_before, ns);
 }
 /* Otherwise we already found a existing cutting point, no need to insert 
a new one. */
@@ -276,9 +278,11 @@ void lineart_edge_cut(LineartRenderBuffer *rb,
 /* The same manipulation as on "cut_start_before". */
 if (cut_end_before != ns2) {
   ies = cut_end_before->prev ? cut_end_before->prev : NULL;
-  ns2->occlusion = ies ? ies->occlusion : 0;
-  ns2->material_mask_bits = ies ? ies->material_mask_bits : 0;
-  ns2->shadow_mask_bits = ies ? ies->shadow_mask_bits : 0;
+  if (ies) {
+ns2->occlusion = ies->occlusion;
+ns2->material_mask_bits = ies->material_mask_bits;
+ns2->shadow_mask_bits = ies->shadow_mask_bits;
+  }
   BLI_insertlinkbefore(>segments, cut_end_before, ns2);
 }
   }
@@ -287,7 +291,9 @@ void lineart_edge_cut(LineartRenderBuffer *rb,
 ns2->occlusion = ies->occlusion;
 ns2->material_mask_bits = ies->material_mask_bits;
 ns2->shadow_mask_bits = ies->shadow_mask_bits;
-BLI_addtail(>segments, ns2);
+if (!untouched) {
+  BLI_addtail(>segments, ns2);
+}
   }
 
   /* If we touched the cut list, we assign the new cut position based on new 
cut position,

___
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] [ed21b7dd643] lineart-shadow: LineArt: Intersection matching multithread.

2022-06-02 Thread Yiming Wu
Commit: ed21b7dd643e00837b6b1e1f6a379ba0235aa855
Author: Yiming Wu
Date:   Thu Jun 2 22:55:44 2022 +0800
Branches: lineart-shadow
https://developer.blender.org/rBed21b7dd643e00837b6b1e1f6a379ba0235aa855

LineArt: Intersection matching multithread.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
index b3c0604bf52..c6efee27d3d 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
@@ -71,35 +71,65 @@ void lineart_register_shadow_cuts(LineartRenderBuffer *rb,
   }
 }
 
+typedef struct LineartIntersectionCutData {
+  LineartElementLinkNode *eln_isect_shadow;
+  LineartElementLinkNode *eln_isect_original;
+  LineartRenderBuffer *rb;
+} LineartIntersectionCutData;
+
+void lineart_intersection_shadow_cut_task(void *__restrict userdata,
+  const int orig_edge_index,
+  const TaskParallelTLS *__restrict 
UNUSED(tls))
+{
+  LineartIntersectionCutData *data = (LineartIntersectionCutData *)userdata;
+
+  LineartElementLinkNode *eln_isect_shadow = data->eln_isect_shadow;
+  LineartElementLinkNode *eln_isect_original = data->eln_isect_original;
+  LineartRenderBuffer *rb = data->rb;
+
+  LineartEdge *e = &((LineartEdge 
*)eln_isect_original->pointer)[orig_edge_index];
+  LineartEdge *shadow_e = lineart_find_matching_edge(eln_isect_shadow, 
(uint64_t)e->from_shadow);
+  if (shadow_e) {
+lineart_register_shadow_cuts(rb, e, shadow_e);
+  }
+}
+
 void lineart_register_intersection_shadow_cuts(LineartRenderBuffer *rb, 
ListBase *shadow_elns)
 {
-  LineartElementLinkNode *eln_isect_shadow = NULL, *eln_isect_original = NULL;
   if (!shadow_elns) {
 return;
   }
+
+  LineartIntersectionCutData data = {0};
+
+  data.rb = rb;
+
   LISTBASE_FOREACH (LineartElementLinkNode *, eln, shadow_elns) {
 if (eln->flags & LRT_ELEMENT_INTERSECTION_DATA) {
-  eln_isect_shadow = eln;
+  data.eln_isect_shadow = eln;
   break;
 }
   }
   LISTBASE_FOREACH (LineartElementLinkNode *, eln, >line_buffer_pointers) {
 if (eln->flags & LRT_ELEMENT_INTERSECTION_DATA) {
-  eln_isect_original = eln;
+  data.eln_isect_original = eln;
   break;
 }
   }
-  if (!eln_isect_shadow || !eln_isect_original) {
+  if (!data.eln_isect_shadow || !data.eln_isect_original) {
 return;
   }
-  LineartEdge *e = (LineartEdge *)eln_isect_original->pointer;
-  for (int i = 0; i < eln_isect_original->element_count; i++) {
-LineartEdge *shadow_e = lineart_find_matching_edge(eln_isect_shadow, 
(uint64_t)e->from_shadow);
-if (shadow_e) {
-  lineart_register_shadow_cuts(rb, e, shadow_e);
-}
-e++;
-  }
+
+  TaskParallelSettings cut_settings;
+  BLI_parallel_range_settings_defaults(_settings);
+  /* Set the minimum amount of edges a thread has to process. */
+  cut_settings.min_iter_per_thread = 2000;
+
+  BLI_task_parallel_range(0,
+  data.eln_isect_original->element_count,
+  ,
+  lineart_intersection_shadow_cut_task,
+  _settings);
 }
 
 /* Shadow computation part == */

___
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] [9e43a57d22d] master: Cycles: fix missing attribute update

2022-06-02 Thread Jacques Lucke
Commit: 9e43a57d22df57f5e7a572ddff3591df8120b547
Author: Jacques Lucke
Date:   Thu Jun 2 16:42:53 2022 +0200
Branches: master
https://developer.blender.org/rB9e43a57d22df57f5e7a572ddff3591df8120b547

Cycles: fix missing attribute update

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

===

M   intern/cycles/scene/attribute.cpp
M   intern/cycles/scene/attribute.h

===

diff --git a/intern/cycles/scene/attribute.cpp 
b/intern/cycles/scene/attribute.cpp
index df01189a54b..d6b4c0240f6 100644
--- a/intern/cycles/scene/attribute.cpp
+++ b/intern/cycles/scene/attribute.cpp
@@ -661,6 +661,26 @@ Attribute *AttributeSet::find(AttributeStandard std) const
   return NULL;
 }
 
+Attribute *AttributeSet::find_matching(const Attribute )
+{
+  for (Attribute  : attributes) {
+if (attr.name != other.name) {
+  continue;
+}
+if (attr.std != other.std) {
+  continue;
+}
+if (attr.type != other.type) {
+  continue;
+}
+if (attr.element != other.element) {
+  continue;
+}
+return 
+  }
+  return nullptr;
+}
+
 void AttributeSet::remove(AttributeStandard std)
 {
   Attribute *attr = find(std);
@@ -729,32 +749,24 @@ void AttributeSet::clear(bool preserve_voxel_data)
 
 void AttributeSet::update(AttributeSet &_attributes)
 {
-  /* add or update old_attributes based on the new_attributes */
-  foreach (Attribute , new_attributes.attributes) {
-Attribute *nattr = add(attr.name, attr.type, attr.element);
-nattr->std = attr.std;
-nattr->set_data_from(std::move(attr));
-  }
-
-  /* remove any attributes not on new_attributes */
+  /* Remove any attributes not on new_attributes. */
   list::iterator it;
   for (it = attributes.begin(); it != attributes.end();) {
-if (it->std != ATTR_STD_NONE) {
-  if (new_attributes.find(it->std) == nullptr) {
-remove(it++);
-continue;
-  }
-}
-else if (it->name != "") {
-  if (new_attributes.find(it->name) == nullptr) {
-remove(it++);
-continue;
-  }
+const Attribute _attr = *it;
+if (new_attributes.find_matching(old_attr) == nullptr) {
+  remove(it++);
+  continue;
 }
-
 it++;
   }
 
+  /* Add or update old_attributes based on the new_attributes. */
+  foreach (Attribute , new_attributes.attributes) {
+Attribute *nattr = add(attr.name, attr.type, attr.element);
+nattr->std = attr.std;
+nattr->set_data_from(std::move(attr));
+  }
+
   /* If all attributes were replaced, transform is no longer applied. */
   geometry->transform_applied = false;
 }
diff --git a/intern/cycles/scene/attribute.h b/intern/cycles/scene/attribute.h
index fd13b8ff6de..7f8cbf32049 100644
--- a/intern/cycles/scene/attribute.h
+++ b/intern/cycles/scene/attribute.h
@@ -194,6 +194,7 @@ class AttributeSet {
   void remove(AttributeStandard std);
 
   Attribute *find(AttributeRequest );
+  Attribute *find_matching(const Attribute );
 
   void remove(Attribute *attribute);

___
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] [9580f23596f] master: install_deps: Add support for oneAPI Level Zero library.

2022-06-02 Thread Bastien Montagne
Commit: 9580f23596fae21d867fa3dae88efd4c57016139
Author: Bastien Montagne
Date:   Thu Jun 2 15:53:09 2022 +0200
Branches: master
https://developer.blender.org/rB9580f23596fae21d867fa3dae88efd4c57016139

install_deps: Add support for  oneAPI Level Zero library.

===

M   build_files/build_environment/install_deps.sh

===

diff --git a/build_files/build_environment/install_deps.sh 
b/build_files/build_environment/install_deps.sh
index 3e6bc1cecaa..81db928a477 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -36,19 +36,19 @@ getopt \
 -o s:i:t:h \
 --long 
source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\
 
with-all,with-opencollada,with-jack,with-pulseaudio,with-embree,with-oidn,with-nanovdb,\
-ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,\
+ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,ver-level-zero:\
 force-all,force-python,force-boost,force-tbb,\
 
force-ocio,force-imath,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
 
force-ffmpeg,force-opencollada,force-alembic,force-embree,force-oidn,force-usd,\
-force-xr-openxr,\
+force-xr-openxr,force-level-zero,\
 build-all,build-python,build-boost,build-tbb,\
 
build-ocio,build-imath,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
 
build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,build-usd,\
-build-xr-openxr,\
+build-xr-openxr,build-level-zero,\
 skip-python,skip-boost,skip-tbb,\
 
skip-ocio,skip-imath,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
 skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-usd,\
-skip-xr-openxr \
+skip-xr-openxr,skip-level-zero \
 -- "$@" \
 )
 
@@ -165,6 +165,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
 --ver-xr-openxr=
 Force version of OpenXR-SDK.
 
+--ver-level-zero=
+Force version of OneAPI Level Zero library.
+
 Note about the --ver-foo options:
 It may not always work as expected (some libs are actually checked out 
from a git rev...), yet it might help
 to fix some build issues (like LLVM mismatch with the version used by 
your graphic system).
@@ -226,6 +229,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
 --build-xr-openxr
 Force the build of OpenXR-SDK.
 
+--build-level-zero=
+Force the build of OneAPI Level Zero library.
+
 Note about the --build-foo options:
 * They force the script to prefer building dependencies rather than 
using available packages.
   This may make things simpler and allow working around some 
distribution bugs, but on the other hand it will
@@ -293,6 +299,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
 --force-xr-openxr
 Force the rebuild of OpenXR-SDK.
 
+--force-level-zero=
+Force the rebuild of OneAPI Level Zero library.
+
 Note about the --force-foo options:
 * They obviously only have an effect if those libraries are built by 
this script
   (i.e. if there is no available and satisfactory package)!
@@ -351,7 +360,10 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
 Unconditionally skip Universal Scene Description installation/building.
 
 --skip-xr-openxr
-Unconditionally skip OpenXR-SDK installation/building.\""
+Unconditionally skip OpenXR-SDK installation/building.
+
+--skip-level-zero=
+Unconditionally skip OneAPI Level Zero installation/building.\""
 
 # 
 # Main Vars
@@ -573,14 +585,13 @@ OIDN_SKIP=false
 
 ISPC_VERSION="1.17.0"
 
-FFMPEG_VERSION="5.0"
-FFMPEG_VERSION_SHORT="5.0"
-FFMPEG_VERSION_MIN="4.0"
-FFMPEG_VERSION_MEX="6.0"
-FFMPEG_FORCE_BUILD=false
-FFMPEG_FORCE_REBUILD=false
-FFMPEG_SKIP=false
-_ffmpeg_list_sep=";"
+LEVEL_ZERO_VERSION="1.7.15"
+LEVEL_ZERO_VERSION_SHORT="1.7"
+LEVEL_ZERO_VERSION_MIN="1.7"
+LEVEL_ZERO_VERSION_MEX="2.0"
+LEVEL_ZERO_FORCE_BUILD=false
+LEVEL_ZERO_FORCE_REBUILD=false
+LEVEL_ZERO_SKIP=false
 
 XR_OPENXR_VERSION="1.0.22"
 XR_OPENXR_VERSION_SHORT="1.0"
@@ -590,6 +601,15 @@ XR_OPENXR_FORCE_BUILD=false
 XR_OPENXR_FORCE_REBUILD=false
 XR_OPENXR_SKIP=false
 
+FFMPEG_VERSION="5.0"
+FFMPEG_VERSION_SHORT="5.0"
+FFMPEG_VERSION_MIN="4.0"
+FFMPEG_VERSION_MEX="6.0"
+FFMPEG_FORCE_BUILD=false
+FFMPEG_FORCE_REBUILD=false
+FFMPEG_SKIP=false
+_ffmpeg_list_sep=";"
+
 # FFMPEG optional libs.
 VORBIS_USE=false
 VORBIS_DEV=""
@@ -781,6 +801,12 @@ while true; do
   XR_OPENXR_VERSION_SHORT=$XR_OPENXR_VERSION
   shift; shift; continue
 ;;
+--ver-level-zero)
+  LEVEL_ZERO_VERSION="$2"
+  LEVEL_ZERO_VERSION_MIN=$LEVEL_ZERO_VERSION
+  LEVEL_ZERO_VERSION_SHORT=$LEVEL_ZERO_VERSION
+  shift; shift; continue
+;;
 

[Bf-blender-cvs] [1174cdc9147] master: install_deps: raise default ffmpeg version to 5.0, minimum 4.0.

2022-06-02 Thread Bastien Montagne
Commit: 1174cdc9147e90688dd2c915608a16f64b7c2290
Author: Bastien Montagne
Date:   Thu Jun 2 12:41:42 2022 +0200
Branches: master
https://developer.blender.org/rB1174cdc9147e90688dd2c915608a16f64b7c2290

install_deps: raise default ffmpeg version to 5.0, minimum 4.0.

Ref. T98555.

===

M   build_files/build_environment/install_deps.sh

===

diff --git a/build_files/build_environment/install_deps.sh 
b/build_files/build_environment/install_deps.sh
index 58702f69609..3e6bc1cecaa 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -573,10 +573,10 @@ OIDN_SKIP=false
 
 ISPC_VERSION="1.17.0"
 
-FFMPEG_VERSION="4.4"
-FFMPEG_VERSION_SHORT="4.4"
-FFMPEG_VERSION_MIN="3.0"
-FFMPEG_VERSION_MEX="5.0"
+FFMPEG_VERSION="5.0"
+FFMPEG_VERSION_SHORT="5.0"
+FFMPEG_VERSION_MIN="4.0"
+FFMPEG_VERSION_MEX="6.0"
 FFMPEG_FORCE_BUILD=false
 FFMPEG_FORCE_REBUILD=false
 FFMPEG_SKIP=false

___
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] [fb8aa8d54c1] lineart-shadow: Merge branch 'temp-lineart-contained' into lineart-shadow

2022-06-02 Thread Yiming Wu
Commit: fb8aa8d54c13880e4b3157603e92507c9613c646
Author: Yiming Wu
Date:   Thu Jun 2 21:35:33 2022 +0800
Branches: lineart-shadow
https://developer.blender.org/rBfb8aa8d54c13880e4b3157603e92507c9613c646

Merge branch 'temp-lineart-contained' into lineart-shadow

===



===

diff --cc source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 75d93dc2204,9d5cf608c5a..a24acff57bc
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@@ -109,14 -120,16 +107,14 @@@ static bool lineart_triangle_edge_image
  double *from,
  double *to);
  
- static void lineart_bounding_area_link_triangle_cas(LineartRenderBuffer *rb,
- LineartBoundingArea 
*root_ba,
- LineartTriangle *tri,
- double *LRUB,
- int recursive,
- int recursive_level,
- bool do_intersection,
- struct LineartIsecThread 
*th);
 -static void lineart_add_edge_to_array(LineartPendingEdges *pe, LineartEdge 
*e);
 -
+ static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
+ LineartBoundingArea *root_ba,
+ LineartTriangle *tri,
+ double *LRUB,
+ int recursive,
+ int recursive_level,
+ bool do_intersection,
+ struct LineartIsecThread *th);
  
  static void lineart_free_bounding_area_memory(LineartBoundingArea *ba, bool 
recursive);
  
diff --cc source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h
index 1a9990d1e33,778bb8d0ae5..551ac1fda8d
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h
@@@ -84,93 -85,9 +84,93 @@@ void lineart_count_and_print_render_buf
((b1)[0] < (b2)[1] && (b1)[1] > (b2)[0] && (b1)[3] < (b2)[2] && (b1)[2] > 
(b2)[3])
  
  /* Initial bounding area row/column count, setting 10 is tested to be 
realitvely optimal for the
-  * performance under current CAS algorithm. */
+  * performance under current algorithm. */
  #define LRT_BA_ROWS 10
  
 +#define LRT_EDGE_BA_MARCHING_BEGIN(fb1, fb2) \
 +  double x = fb1[0], y = fb1[1]; \
 +  LineartBoundingArea *ba = lineart_edge_first_bounding_area(rb, fb1, fb2); \
 +  LineartBoundingArea *nba = ba; \
 +  double k = (fb2[1] - fb1[1]) / (fb2[0] - fb1[0] + 1e-30); \
 +  int positive_x = (fb2[0] - fb1[0]) > 0 ? 1 : (fb2[0] == fb1[0] ? 0 : -1); \
 +  int positive_y = (fb2[1] - fb1[1]) > 0 ? 1 : (fb2[1] == fb1[1] ? 0 : -1); \
 +  while (nba)
 +
 +#define LRT_EDGE_BA_MARCHING_NEXT(fb1, fb2) \
 +  /* Marching along `e->v1` to `e->v2`, searching each possible bounding 
areas it may touch. */ \
 +  nba = lineart_bounding_area_next(nba, fb1, fb2, x, y, k, positive_x, 
positive_y, , );
 +
 +#define LRT_EDGE_BA_MARCHING_END
 +
 +void lineart_main_occlusion_begin(struct LineartRenderBuffer *rb);
 +void lineart_main_cull_triangles(struct LineartRenderBuffer *rb, bool 
clip_far);
 +void lineart_main_free_adjacent_data(struct LineartRenderBuffer *rb);
 +void lineart_main_perspective_division(struct LineartRenderBuffer *rb);
 +void lineart_main_discard_out_of_frame_edges(struct LineartRenderBuffer *rb);
 +void lineart_main_load_geometries(struct Depsgraph *depsgraph,
 +  struct Scene *scene,
 +  struct Object *camera,
 +  struct LineartRenderBuffer *rb,
 +  bool allow_duplicates,
 +  bool do_shadow_casting,
 +  struct ListBase *shadow_elns);
 +void lineart_main_get_view_vector(struct LineartRenderBuffer *rb);
 +void lineart_main_bounding_area_make_initial(struct LineartRenderBuffer *rb);
 +void lineart_main_bounding_areas_connect_post(struct LineartRenderBuffer *rb);
 +void lineart_main_clear_linked_edges(struct LineartRenderBuffer *rb);
 +void lineart_main_link_lines(struct LineartRenderBuffer *rb);
 +void lineart_main_add_triangles(struct LineartRenderBuffer *rb);
 +bool lineart_main_try_generate_shadow(struct Depsgraph *depsgraph,
 +  struct Scene *scene,
 +   

[Bf-blender-cvs] [04f67fb2dbf] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

2022-06-02 Thread Yiming Wu
Commit: 04f67fb2dbf38e05d9c4855d2b214d545913c850
Author: Yiming Wu
Date:   Thu Jun 2 21:27:09 2022 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB04f67fb2dbf38e05d9c4855d2b214d545913c850

Merge remote-tracking branch 'origin/master' into temp-lineart-contained

===



===

diff --cc source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index b40be609677,da4d02f9ff2..9d5cf608c5a
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@@ -3878,8 -3808,10 +3858,8 @@@ static void lineart_bounding_area_split
}
  
/* At this point the child tiles are fully initialized and it's safe for 
new triangles to be
-* inserted, so assign root->child for 
#lineart_bounding_area_link_triangle_cas to use. */
+* inserted, so assign root->child for #lineart_bounding_area_link_triangle 
to use. */
root->child = ba;
 -
 -  rb->bounding_area_count += 3;
  }
  
  static bool lineart_bounding_area_edge_intersect(LineartRenderBuffer 
*UNUSED(fb),

___
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] [9bb7de274dc] master: USD: Enable operator presets when exporting

2022-06-02 Thread Philipp Oeser
Commit: 9bb7de274dc274a9764492491cf65525ff2d102b
Author: Philipp Oeser
Date:   Mon May 9 15:28:36 2022 +0200
Branches: master
https://developer.blender.org/rB9bb7de274dc274a9764492491cf65525ff2d102b

USD: Enable operator presets when exporting

This patch enables operator presets for USD exports.
The export menu has many options, so enabling the feature
will help users manage their export settings in the same
way they can with other filetypes.

Same as {rB1d668b635632}

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

===

M   source/blender/editors/io/io_usd.c

===

diff --git a/source/blender/editors/io/io_usd.c 
b/source/blender/editors/io/io_usd.c
index 609230eefea..8a24b48be5e 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -217,6 +217,7 @@ void WM_OT_usd_export(struct wmOperatorType *ot)
   ot->check = wm_usd_export_check;
 
   ot->flag = OPTYPE_REGISTER; /* No UNDO possible. */
+  ot->flag |= OPTYPE_PRESET;
 
   WM_operator_properties_filesel(ot,
  FILE_TYPE_FOLDER | FILE_TYPE_USD,

___
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] [432c4c74ebe] master: LineArt: Speedup construction of quad trees.

2022-06-02 Thread Yiming Wu
Commit: 432c4c74ebe6f66b83e06ff7fca70c96d0526d6a
Author: Yiming Wu
Date:   Thu Jun 2 20:32:31 2022 +0800
Branches: master
https://developer.blender.org/rB432c4c74ebe6f66b83e06ff7fca70c96d0526d6a

LineArt: Speedup construction of quad trees.

Using multithread for `add_triangles` to speed up quad tree building.
Each thread would lock its respective tile to work on triangle insertion,
intersection calculation, tile splitting and triangle array extension.

Reviewed By: Sebastian Parborg (zeddb), Sergey Sharybin (sergey)

Ref D14953

===

M   source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M   source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h

===

diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h 
b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index ad3e1b5d7f2..16b9fcbbdd7 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -236,6 +236,9 @@ typedef struct LineartRenderBuffer {
   ListBase line_buffer_pointers;
   ListBase triangle_buffer_pointers;
 
+  LineartElementLinkNode *isect_scheduled_up_to;
+  int isect_scheduled_up_to_index;
+
   /** This one's memory is not from main pool and is free()ed after culling 
stage. */
   ListBase triangle_adjacent_pointers;
 
@@ -429,15 +432,18 @@ typedef struct LineartBoundingArea {
   /** 1,2,3,4 quadrant */
   struct LineartBoundingArea *child;
 
+  SpinLock lock;
+
   ListBase lp;
   ListBase rp;
   ListBase up;
   ListBase bp;
 
-  uint16_t triangle_count;
-  uint16_t max_triangle_count;
-  uint16_t line_count;
-  uint16_t max_line_count;
+  uint32_t triangle_count;
+  uint32_t max_triangle_count;
+  uint32_t line_count;
+  uint32_t max_line_count;
+  uint32_t user_count;
 
   /* Use array for speeding up multiple accesses. */
   struct LineartTriangle **linked_triangles;
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index aae439c62a2..da4d02f9ff2 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -52,6 +52,36 @@
 
 #include "lineart_intern.h"
 
+typedef struct LineartIsecSingle {
+  float v1[3], v2[3];
+  LineartTriangle *tri1, *tri2;
+} LineartIsecSingle;
+
+typedef struct LineartIsecThread {
+  int thread_id;
+
+  /* Scheduled work range. */
+  LineartElementLinkNode *pending_from;
+  LineartElementLinkNode *pending_to;
+  int index_from;
+  int index_to;
+
+  /* Thread intersection result data. */
+  LineartIsecSingle *array;
+  int current;
+  int max;
+  int count_test;
+
+  /* For individual thread reference.*/
+  LineartRenderBuffer *rb;
+} LineartIsecThread;
+
+typedef struct LineartIsecData {
+  LineartRenderBuffer *rb;
+  LineartIsecThread *threads;
+  int thread_count;
+} LineartIsecData;
+
 static LineartBoundingArea 
*lineart_edge_first_bounding_area(LineartRenderBuffer *rb,
  LineartEdge *e);
 
@@ -76,14 +106,6 @@ static bool 
lineart_get_edge_bounding_areas(LineartRenderBuffer *rb,
 int *colbegin,
 int *colend);
 
-static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
-LineartBoundingArea *root_ba,
-LineartTriangle *tri,
-double *LRUB,
-int recursive,
-int recursive_level,
-bool do_intersection);
-
 static bool lineart_triangle_edge_image_space_occlusion(SpinLock *spl,
 const LineartTriangle 
*tri,
 const LineartEdge *e,
@@ -99,6 +121,19 @@ static bool 
lineart_triangle_edge_image_space_occlusion(SpinLock *spl,
 
 static void lineart_add_edge_to_array(LineartPendingEdges *pe, LineartEdge *e);
 
+static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
+LineartBoundingArea *root_ba,
+LineartTriangle *tri,
+double *LRUB,
+int recursive,
+int recursive_level,
+bool do_intersection,
+struct 

[Bf-blender-cvs] [66204860ca3] asset-browser-grid-view: Merge branch 'master' into asset-browser-grid-view

2022-06-02 Thread Julian Eisel
Commit: 66204860ca37c6be8379a3737a25644ad8b24c61
Author: Julian Eisel
Date:   Thu Jun 2 13:01:29 2022 +0200
Branches: asset-browser-grid-view
https://developer.blender.org/rB66204860ca37c6be8379a3737a25644ad8b24c61

Merge branch 'master' into asset-browser-grid-view

===



===



___
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] [901791944da] master: Anim: Refactor 'F-curve from rna path' code.

2022-06-02 Thread Bastien Montagne
Commit: 901791944da9cb66b68841ff8615758cec407b5a
Author: Bastien Montagne
Date:   Tue May 31 17:28:52 2022 +0200
Branches: master
https://developer.blender.org/rB901791944da9cb66b68841ff8615758cec407b5a

Anim: Refactor 'F-curve from rna path' code.

Move into its own new function the the low-level logic to search for a
given RNA path in Action F-curves, then driver F-curves of a given AnimData.

This deduplicates code from `BKE_fcurve_find_by_rna_context_ui` and
`id_data_find_fcurve`, and will allow for future more usages of this
functionality.

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

===

M   source/blender/blenkernel/BKE_fcurve.h
M   source/blender/blenkernel/intern/fcurve.c

===

diff --git a/source/blender/blenkernel/BKE_fcurve.h 
b/source/blender/blenkernel/BKE_fcurve.h
index 78d80ce200e..30c73e0fcc6 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -259,6 +259,18 @@ struct FCurve *BKE_fcurve_iter_step(struct FCurve 
*fcu_iter, const char rna_path
 
 /**
  * High level function to get an f-curve from C without having the RNA.
+ *
+ * If there is an action assigned to the `id`'s #AnimData, it will be searched 
for a matching
+ * F-curve first. Drivers are searched only if no valid action F-curve could 
be found.
+ *
+ * \note: Return pointer parameter (`r_driven`) is optional and may be NULL.
+ *
+ * \warning: In case no animation (from an Action) F-curve is found, returned 
value is always NULL.
+ * This means that this function will set `r_driven` to True in case a valid 
driver F-curve is
+ * found, but will not return said F-curve. In other words:
+ *   - Animated with FCurve: returns the `FCurve*` and `*r_driven = false`.
+ *   - Animated with driver: returns `NULL` and `*r_driven = true`.
+ *   - Not animated: returns `NULL` and `*r_driven = false`.
  */
 struct FCurve *id_data_find_fcurve(
 ID *id, void *data, struct StructRNA *type, const char *prop_name, int 
index, bool *r_driven);
@@ -278,6 +290,25 @@ struct FCurve *id_data_find_fcurve(
  */
 int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, 
const char *dataName);
 
+/**
+ * Find an F-Curve from its rna path and index.
+ *
+ * If there is an action assigned to the `animdata`, it will be searched for a 
matching F-curve
+ * first. Drivers are searched only if no valid action F-curve could be found.
+ *
+ * \note: Typically, indices in RNA arrays are stored separately in F-curves, 
so the rna_path
+ * should not include them (e.g. `rna_path='location[0]'` will not match any 
F-Curve on an Object,
+ * but `rna_path='location', rna_index=0` will if it exists).
+ *
+ * \note: Return pointer parameters (`r_action`, `r_driven` and `r_special`) 
are all optional and
+ * may be NULL.
+ */
+struct FCurve *BKE_animadata_fcurve_find_by_rna_path(struct AnimData *animdata,
+ const char *rna_path,
+ const int rna_index,
+ struct bAction **r_action,
+ bool *r_driven);
+
 /**
  * Find an f-curve based on an rna property.
  */
@@ -291,7 +322,9 @@ struct FCurve *BKE_fcurve_find_by_rna(struct PointerRNA 
*ptr,
 /**
  * Same as above, but takes a context data,
  * temp hack needed for complex paths like texture ones.
- */
+ *
+ * \param r_special Optional, ignored when NULL. Set to `true` if the given 
RNA `ptr` is a NLA
+ * strip, and the returned F-curve comes from this NLA strip. */
 struct FCurve *BKE_fcurve_find_by_rna_context_ui(struct bContext *C,
  const struct PointerRNA *ptr,
  struct PropertyRNA *prop,
diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index 952d5df299c..98a2b977d4e 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -229,16 +229,13 @@ FCurve *id_data_find_fcurve(
 return NULL;
   }
 
-  /* Animation takes priority over drivers. */
-  if (adt->action && adt->action->curves.first) {
-fcu = BKE_fcurve_find(>action->curves, path, index);
-  }
-
-  /* If not animated, check if driven. */
-  if (fcu == NULL && adt->drivers.first) {
-fcu = BKE_fcurve_find(>drivers, path, index);
-if (fcu && r_driven) {
-  *r_driven = true;
+  /* FIXME: The way drivers are handled here (always NULL-ifying `fcu`) is 
very weird, this needs
+   * to be re-checked I think?. */
+  bool is_driven = false;
+  fcu = BKE_animadata_fcurve_find_by_rna_path(adt, path, index, NULL, 
_driven);
+  if (is_driven) {
+if (r_driven != NULL) {
+  *r_driven = is_driven;
 }
 fcu = NULL;
   }
@@ -339,6 +336,47 

[Bf-blender-cvs] [3ca76ae0e8f] master: Cleanup: remove "" from headers

2022-06-02 Thread Campbell Barton
Commit: 3ca76ae0e8f7cd7f67a352dd3d8a415802506ee2
Author: Campbell Barton
Date:   Thu Jun 2 19:59:52 2022 +1000
Branches: master
https://developer.blender.org/rB3ca76ae0e8f7cd7f67a352dd3d8a415802506ee2

Cleanup: remove "" from headers

It can be assumed that all scripts comply with basic pep8 formatting
regarding white-space, indentation etc.

Also remove note in best practices page & update `tests/python/pep8.py`.

If we want to exclude some scripts from make format,
this can be done by adding them to `ignore_files` in:
source/tools/utils_maintenance/autopep8_format_paths.py

Or using `# nopep8` for to ignore for individual lines.

Ref T98554

===

M   build_files/cmake/cmake_netbeans_project.py
M   build_files/cmake/cmake_qtcreator_project.py
M   build_files/cmake/cmake_static_check_clang_array.py
M   build_files/cmake/cmake_static_check_cppcheck.py
M   build_files/cmake/cmake_static_check_smatch.py
M   build_files/cmake/cmake_static_check_sparse.py
M   build_files/cmake/cmake_static_check_splint.py
M   build_files/cmake/project_info.py
M   build_files/cmake/project_source_info.py
M   build_files/package_spec/build_archive.py
M   doc/manpage/blender.1.py
M   doc/python_api/rst/info_best_practice.rst
M   doc/python_api/rst_from_bmesh_opdefines.py
M   doc/python_api/sphinx_changelog_gen.py
M   doc/python_api/sphinx_doc_gen.py
M   doc/python_api/sphinx_doc_gen_monkeypatch.py
M   intern/cycles/blender/addon/__init__.py
M   intern/cycles/blender/addon/camera.py
M   intern/cycles/blender/addon/engine.py
M   intern/cycles/blender/addon/operators.py
M   intern/cycles/blender/addon/osl.py
M   intern/cycles/blender/addon/presets.py
M   intern/cycles/blender/addon/properties.py
M   intern/cycles/blender/addon/ui.py
M   intern/cycles/blender/addon/version_update.py
M   release/datafiles/alert_icons_update.py
M   release/datafiles/blender_icons_geom_update.py
M   release/datafiles/blender_icons_update.py
M   release/datafiles/ctodata.py
M   release/datafiles/prvicons_update.py
M   release/scripts/modules/addon_utils.py
M   release/scripts/modules/animsys_refactor.py
M   release/scripts/modules/bl_app_override/__init__.py
M   release/scripts/modules/bl_app_override/helpers.py
M   release/scripts/modules/bl_app_template_utils.py
M   release/scripts/modules/bl_console_utils/autocomplete/__init__.py
M   
release/scripts/modules/bl_console_utils/autocomplete/complete_calltip.py
M   release/scripts/modules/bl_console_utils/autocomplete/complete_import.py
M   
release/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py
M   release/scripts/modules/bl_console_utils/autocomplete/intellisense.py
M   release/scripts/modules/bl_i18n_utils/__init__.py
M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
M   release/scripts/modules/bl_i18n_utils/merge_po.py
M   release/scripts/modules/bl_i18n_utils/settings.py
M   release/scripts/modules/bl_i18n_utils/settings_user.py
M   release/scripts/modules/bl_i18n_utils/utils.py
M   release/scripts/modules/bl_i18n_utils/utils_cli.py
M   release/scripts/modules/bl_i18n_utils/utils_languages_menu.py
M   release/scripts/modules/bl_i18n_utils/utils_rtl.py
M   release/scripts/modules/bl_i18n_utils/utils_spell_check.py
M   release/scripts/modules/bl_keymap_utils/__init__.py
M   release/scripts/modules/bl_keymap_utils/io.py
M   release/scripts/modules/bl_keymap_utils/keymap_from_toolbar.py
M   release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
M   release/scripts/modules/bl_keymap_utils/versioning.py
M   release/scripts/modules/bl_previews_utils/bl_previews_render.py
M   release/scripts/modules/bl_rna_utils/data_path.py
M   release/scripts/modules/bl_ui_utils/bug_report_url.py
M   release/scripts/modules/blend_render_info.py
M   release/scripts/modules/bpy/__init__.py
M   release/scripts/modules/bpy/ops.py
M   release/scripts/modules/bpy/path.py
M   release/scripts/modules/bpy/utils/__init__.py
M   release/scripts/modules/bpy/utils/previews.py
M   release/scripts/modules/bpy/utils/toolsystem.py
M   release/scripts/modules/bpy_extras/__init__.py
M   release/scripts/modules/bpy_extras/anim_utils.py
M   release/scripts/modules/bpy_extras/asset_utils.py
M   release/scripts/modules/bpy_extras/id_map_utils.py
M   release/scripts/modules/bpy_extras/image_utils.py
M   release/scripts/modules/bpy_extras/io_utils.py
M   release/scripts/modules/bpy_extras/keyconfig_utils.py
M   release/scripts/modules/bpy_extras/mesh_utils.py
M   release/scripts/modules/bpy_extras/node_shader_utils.py
M   release/scripts/modules/bpy_extras/node_utils.py
M   release/scripts/modules/bpy_extras/object_utils.py
M   

[Bf-blender-cvs] [48bb144feac] master: PyDoc: reference enum instead of inlining

2022-06-02 Thread Campbell Barton
Commit: 48bb144feac96e6de8f267417063f4ee0a0de429
Author: Campbell Barton
Date:   Thu Jun 2 20:15:53 2022 +1000
Branches: master
https://developer.blender.org/rB48bb144feac96e6de8f267417063f4ee0a0de429

PyDoc: reference enum instead of inlining

===

M   source/blender/python/intern/bpy_app.c

===

diff --git a/source/blender/python/intern/bpy_app.c 
b/source/blender/python/intern/bpy_app.c
index f54bf3e2774..939473ceaa0 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -459,7 +459,7 @@ PyDoc_STRVAR(bpy_app_is_job_running_doc,
  "\n"
  "   Check whether a job of the given type is running.\n"
  "\n"
- "   :arg job_type: job type in ['RENDER', 'RENDER_PREVIEW', 
OBJECT_BAKE]."
+ "   :arg job_type: job type in 
:ref:`rna_enum_wm_job_type_items`.\n"
  "   :type job_type: str\n"
  "   :return: Whether a job of the given type is currently 
running.\n"
  "   :rtype: bool.\n");

___
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] [cd1c6214a0b] cycles_oneapi: Cycles: restore default message for compile time in oneAPI backend

2022-06-02 Thread Xavier Hallade
Commit: cd1c6214a0b7d9c06fc1b7ca9138c9ef31d1223a
Author: Xavier Hallade
Date:   Thu Jun 2 12:04:25 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rBcd1c6214a0b7d9c06fc1b7ca9138c9ef31d1223a

Cycles: restore default message for compile time in oneAPI backend

release builds will use precompiled binaries so users shouldn't run
into lenghty recompilation.

===

M   intern/cycles/device/device.h
M   intern/cycles/device/oneapi/device_impl.cpp
M   intern/cycles/device/oneapi/device_impl.h
M   intern/cycles/scene/scene.cpp

===

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index a0c7ecdd04b..340be85e853 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -157,12 +157,6 @@ class Device {
 return true;
   }
 
-  /* Message, which will be shown during loading/compiling of kernels */
-  virtual string load_kernels_message(uint /*kernel_features*/)
-  {
-return "Loading render kernels (may take a few minutes the first time)";
-  }
-
   /* GPU device only functions.
* These may not be used on CPU or multi-devices. */
 
diff --git a/intern/cycles/device/oneapi/device_impl.cpp 
b/intern/cycles/device/oneapi/device_impl.cpp
index 35a02575322..58e7c4bd6b8 100644
--- a/intern/cycles/device/oneapi/device_impl.cpp
+++ b/intern/cycles/device/oneapi/device_impl.cpp
@@ -91,11 +91,6 @@ BVHLayoutMask OneapiDevice::get_bvh_layout_mask() const
   return BVH_LAYOUT_BVH2;
 }
 
-string OneapiDevice::load_kernels_message(const uint /*requested_features*/)
-{
-  return "Loading render kernels (may take a few dozens of minutes)";
-}
-
 bool OneapiDevice::load_kernels(const uint requested_features)
 {
   assert(device_queue);
diff --git a/intern/cycles/device/oneapi/device_impl.h 
b/intern/cycles/device/oneapi/device_impl.h
index 501a262230e..41eb53cd00a 100644
--- a/intern/cycles/device/oneapi/device_impl.h
+++ b/intern/cycles/device/oneapi/device_impl.h
@@ -41,8 +41,6 @@ class OneapiDevice : public Device {
 
   bool load_kernels(const uint requested_features) override;
 
-  string load_kernels_message(const uint requested_features) override;
-
   void load_texture_info();
 
   void generic_alloc(device_memory );
diff --git a/intern/cycles/scene/scene.cpp b/intern/cycles/scene/scene.cpp
index 2345eee7045..b35242139ea 100644
--- a/intern/cycles/scene/scene.cpp
+++ b/intern/cycles/scene/scene.cpp
@@ -628,7 +628,7 @@ bool Scene::load_kernels(Progress , bool 
lock_scene)
   const uint kernel_features = dscene.data.kernel_features;
 
   if (!kernels_loaded || loaded_kernel_features != kernel_features) {
-progress.set_status(device->load_kernels_message(kernel_features));
+progress.set_status("Loading render kernels (may take a few minutes the 
first time)");
 
 scoped_timer timer;

___
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] [42c8b4fece7] cycles_oneapi: Build: refine CentOS7 IGC AoT workaround down to -fhonor-nans

2022-06-02 Thread Xavier Hallade
Commit: 42c8b4fece7fe0adc695c1d707ef52220689bcdf
Author: Xavier Hallade
Date:   Thu Jun 2 10:25:10 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB42c8b4fece7fe0adc695c1d707ef52220689bcdf

Build: refine CentOS7 IGC AoT workaround down to -fhonor-nans

===

M   intern/cycles/kernel/CMakeLists.txt

===

diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index bdfa9f2c747..b7652d3a0a5 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -725,6 +725,7 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
   -fdelayed-template-parsing
   -shared
   -DWITH_ONEAPI
+  -ffast-math
   -DNDEBUG
   -O2
   -o ${cycles_kernel_oneapi_lib}
@@ -800,11 +801,6 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
 endif()
   endif()
 
-  # avoid using -ffast-math for the graphics compiler on CentOS 7 until the 
compile-time issue it triggers gets fixed.
-  if(WIN32 OR NOT WITH_CYCLES_ONEAPI_BINARIES)
-list(APPEND sycl_compiler_flags -ffast-math)
-  endif()
-
   if(WIN32)
 list(APPEND sycl_compiler_flags
 -fms-extensions
@@ -850,6 +846,11 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
   else()
 list(APPEND sycl_compiler_flags -fPIC)
 
+# avoid getting __FAST_MATH__ to be defined for the graphics compiler on 
CentOS 7 until the compile-time issue it triggers gets fixed.
+if(WITH_CYCLES_ONEAPI_BINARIES)
+  list(APPEND sycl_compiler_flags -fhonor-nans)
+endif()
+
 # add $ORIGIN to cycles_kernel_oneapi.so rpath so libsycl.so and
 # libpi_level_zero.so can be placed next to it and get found.
 list(APPEND sycl_compiler_flags -Wl,-rpath,'$$ORIGIN')

___
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