[Bf-blender-cvs] [dcf0f452818] blender-v2.93-release: Release cycle: Version bump to 2.93.14 release

2023-01-17 Thread Philipp Oeser
Commit: dcf0f452818e59fc6c52f61d57c0b30790686575
Author: Philipp Oeser
Date:   Tue Jan 17 09:31:34 2023 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rBdcf0f452818e59fc6c52f61d57c0b30790686575

Release cycle: Version bump to 2.93.14 release

===

M   source/blender/blenkernel/BKE_blender_version.h

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index bd12a60c70f..256bc201c92 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -35,7 +35,7 @@ extern "C" {
 /* Blender patch version for bugfix releases. */
 #define BLENDER_VERSION_PATCH 14
 /** Blender release cycle stage: alpha/beta/rc/release. */
-#define BLENDER_VERSION_CYCLE rc
+#define BLENDER_VERSION_CYCLE release
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION

___
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] [8d94aeb604f] blender-v3.3-release: Release cycle: Version bump to 3.3.3 release

2023-01-17 Thread Philipp Oeser
Commit: 8d94aeb604fac9e8a361be65d374031fcad20939
Author: Philipp Oeser
Date:   Tue Jan 17 09:38:55 2023 +0100
Branches: blender-v3.3-release
https://developer.blender.org/rB8d94aeb604fac9e8a361be65d374031fcad20939

Release cycle: Version bump to 3.3.3 release

===

M   source/blender/blenkernel/BKE_blender_version.h

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 88f808ee4fb..176f500803e 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -21,7 +21,7 @@ extern "C" {
 /* Blender patch version for bugfix releases. */
 #define BLENDER_VERSION_PATCH 3
 /** Blender release cycle stage: alpha/beta/rc/release. */
-#define BLENDER_VERSION_CYCLE rc
+#define BLENDER_VERSION_CYCLE release
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION

___
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] [8082b96a759] master: Tracking: fix inverted pie menu items for pattern match of track

2023-01-17 Thread Damien Picard
Commit: 8082b96a759b497888ac82d9eaf29c2643de631d
Author: Damien Picard
Date:   Tue Jan 17 09:40:08 2023 +0100
Branches: master
https://developer.blender.org/rB8082b96a759b497888ac82d9eaf29c2643de631d

Tracking: fix inverted pie menu items for pattern match of track

The two items had their effects inverted.

Reviewed By: sebastian_k

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

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 5bf68cb04de..076cd322360 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1750,11 +1750,11 @@ class CLIP_MT_marker_pie(Menu):
 # Match Keyframe
 prop = pie.operator("wm.context_set_enum", text="Match Previous", 
icon='KEYFRAME_HLT')
 prop.data_path = 
"space_data.clip.tracking.tracks.active.pattern_match"
-prop.value = 'KEYFRAME'
+prop.value = 'PREV_FRAME'
 # Match Previous Frame
 prop = pie.operator("wm.context_set_enum", text="Match Keyframe", 
icon='KEYFRAME')
 prop.data_path = 
"space_data.clip.tracking.tracks.active.pattern_match"
-prop.value = 'PREV_FRAME'
+prop.value = 'KEYFRAME'
 
 
 class CLIP_MT_tracking_pie(Menu):

___
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] [eb7b6004e59] temp-T101739-fix-seam-bleeding-non-manifold: Merge branch 'master' into temp-T101739-fix-seam-bleeding-non-manifold

2023-01-17 Thread Jeroen Bakker
Commit: eb7b6004e59c75ad2e6048df1ec74aac8b10d8e5
Author: Jeroen Bakker
Date:   Tue Jan 17 11:16:55 2023 +0100
Branches: temp-T101739-fix-seam-bleeding-non-manifold
https://developer.blender.org/rBeb7b6004e59c75ad2e6048df1ec74aac8b10d8e5

Merge branch 'master' into temp-T101739-fix-seam-bleeding-non-manifold

===



===



___
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] [6950c9659d5] temp-T101739-fix-seam-bleeding-non-manifold: Fix out of bounds read due to naming confusion. Clamp vs isect.

2023-01-17 Thread Jeroen Bakker
Commit: 6950c9659d51832dfc6b9239ebbc11affde8d25c
Author: Jeroen Bakker
Date:   Tue Jan 17 12:16:45 2023 +0100
Branches: temp-T101739-fix-seam-bleeding-non-manifold
https://developer.blender.org/rB6950c9659d51832dfc6b9239ebbc11affde8d25c

Fix out of bounds read due to naming confusion. Clamp vs isect.

===

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

===

diff --git a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc 
b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
index 74db2c457b6..c20fe04b93e 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
@@ -70,9 +70,8 @@ void add_margin(rcti &bounds, int margin)
 void clamp(rcti &bounds, int2 resolution)
 {
   rcti clamping_bounds;
-  int2 xy;
   BLI_rcti_init(&clamping_bounds, 0, resolution.x - 1, 0, resolution.y - 1);
-  BLI_rcti_clamp(&bounds, &clamping_bounds, xy);
+  BLI_rcti_isect(&bounds, &clamping_bounds, &bounds);
 }
 
 const Vertex convert_coord_space(const 
Vertex &uv_vertex,
@@ -471,6 +470,13 @@ struct Rows {
 
 static void extend_last_group(CopyPixelTile &tile_pixels, const 
CopyPixelCommand &command)
 {
+  /*
+  printf("(%d,%d) = mix((%d,%d), (%d,%d), %f);\n",
+ UNPACK2(command.destination),
+ UNPACK2(command.source_1),
+ UNPACK2(command.source_2),
+ command.mix_factor);
+ */
   CopyPixelGroup &group = tile_pixels.groups.last();
   CopyPixelCommand last_command = last_copy_command(tile_pixels, group);
   DeltaCopyPixelCommand delta_command = last_command.encode_delta(command);

___
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] [17ef4821174] temp-T101739-fix-seam-bleeding-non-manifold: Added post check to test if encoding and decoding gets similar results.

2023-01-17 Thread Jeroen Bakker
Commit: 17ef4821174e233cef0f3588cab81594291ac8ff
Author: Jeroen Bakker
Date:   Tue Jan 17 12:39:23 2023 +0100
Branches: temp-T101739-fix-seam-bleeding-non-manifold
https://developer.blender.org/rB17ef4821174e233cef0f3588cab81594291ac8ff

Added post check to test if encoding and decoding gets similar results.

===

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

===

diff --git a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc 
b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
index c20fe04b93e..d1fdbaaa8d0 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
@@ -470,18 +470,31 @@ struct Rows {
 
 static void extend_last_group(CopyPixelTile &tile_pixels, const 
CopyPixelCommand &command)
 {
-  /*
-  printf("(%d,%d) = mix((%d,%d), (%d,%d), %f);\n",
- UNPACK2(command.destination),
- UNPACK2(command.source_1),
- UNPACK2(command.source_2),
- command.mix_factor);
- */
   CopyPixelGroup &group = tile_pixels.groups.last();
   CopyPixelCommand last_command = last_copy_command(tile_pixels, group);
   DeltaCopyPixelCommand delta_command = last_command.encode_delta(command);
   tile_pixels.command_deltas.append(delta_command);
   group.num_deltas += 1;
+
+#ifndef NDEBUG
+  /* Check if decoding the encoded command gives the same result.*/
+  CopyPixelCommand test_command = last_copy_command(tile_pixels, group);
+#  if 0
+  printf("(%d,%d) = mix((%d,%d), (%d,%d), %f); -> (%d,%d) = mix((%d,%d), 
(%d,%d), %f);\n",
+ UNPACK2(command.destination),
+ UNPACK2(command.source_1),
+ UNPACK2(command.source_2),
+ command.mix_factor,
+ UNPACK2(test_command.destination),
+ UNPACK2(test_command.source_1),
+ UNPACK2(test_command.source_2),
+ test_command.mix_factor);
+#  endif
+  BLI_assert(test_command.destination == command.destination);
+  BLI_assert(test_command.source_1 == command.source_1);
+  BLI_assert(test_command.source_2 == command.source_2);
+  BLI_assert(abs(test_command.mix_factor - command.mix_factor) < (1.0 / 
255) + 0.001);
+#endif
 }
 
 // TODO: move to group. */

___
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] [20db29bf2f8] temp-T101739-fix-seam-bleeding-non-manifold: Fix incorrect search bounds when looking for second source.

2023-01-17 Thread Jeroen Bakker
Commit: 20db29bf2f852ffe196a3f554a373010d3e8f62d
Author: Jeroen Bakker
Date:   Tue Jan 17 12:48:34 2023 +0100
Branches: temp-T101739-fix-seam-bleeding-non-manifold
https://developer.blender.org/rB20db29bf2f852ffe196a3f554a373010d3e8f62d

Fix incorrect search bounds when looking for second source.

===

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

===

diff --git a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc 
b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
index d1fdbaaa8d0..7dc352d5ca4 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
@@ -344,10 +344,10 @@ struct Rows {
 {
   rcti search_bounds;
   BLI_rcti_init(&search_bounds,
-max_ii(destination.x - 1, 0),
-min_ii(destination.x + 1, rows.resolution.x - 1),
-max_ii(destination.y - 1, 0),
-min_ii(destination.y + 1, rows.resolution.y - 1));
+max_ii(first_source.x - 1, 0),
+min_ii(first_source.x + 1, rows.resolution.x - 1),
+max_ii(first_source.y - 1, 0),
+min_ii(first_source.y + 1, rows.resolution.y - 1));
   /* Initialize to the first source, so when no other source could be 
found it will use the
* first_source. */
   int2 found_source = first_source;
@@ -425,7 +425,7 @@ struct Rows {
   continue;
 }
 float new_distance = blender::math::distance(float2(sx, sy), 
float2(x, row_number));
-if (found_distance > new_distance) {
+if (new_distance < found_distance) {
   found_source = int2(sx, sy);
   found_distance = new_distance;
 }

___
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] [09febafb97b] blender-v3.3-release: Updating submodule hashes for 3.3.3 release.

2023-01-17 Thread Thomas Dinges
Commit: 09febafb97bab3baa09480d921327e4417b33371
Author: Thomas Dinges
Date:   Tue Jan 17 12:50:44 2023 +0100
Branches: blender-v3.3-release
https://developer.blender.org/rB09febafb97bab3baa09480d921327e4417b33371

Updating submodule hashes for 3.3.3 release.

===

M   release/scripts/addons

===

diff --git a/release/scripts/addons b/release/scripts/addons
index 1c1b05efd36..16ff2985ba3 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 1c1b05efd36bc245ea4d5292ca93e33dfa6447e8
+Subproject commit 16ff2985ba3fadb9ea31262dabd25c812b918b6e

___
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] [fedb19ccc0c] temp-T101739-fix-seam-bleeding-non-manifold: Remove obsolete comment.

2023-01-17 Thread Jeroen Bakker
Commit: fedb19ccc0c239ac024a285ec109458b58c508ea
Author: Jeroen Bakker
Date:   Tue Jan 17 12:55:04 2023 +0100
Branches: temp-T101739-fix-seam-bleeding-non-manifold
https://developer.blender.org/rBfedb19ccc0c239ac024a285ec109458b58c508ea

Remove obsolete comment.

===

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

===

diff --git a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc 
b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
index 7dc352d5ca4..bac3c2fdf87 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
@@ -411,8 +411,6 @@ struct Rows {
 BLI_rcti_init(&bounds, x, x, row_number, row_number);
 add_margin(bounds, rows.margin);
 clamp(bounds, rows.resolution);
-// TODO: improvement is to clamp it with the bounds of the edge that 
is assigned to the
-// pixel.
 
 float found_distance = std::numeric_limits().max();
 int2 found_source(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] [6db644cca71] blender-v2.93-release: Update submodule hashes for 2.93.14 release.

2023-01-17 Thread Thomas Dinges
Commit: 6db644cca71831d053c7d1ec8898d03ee80ab2ee
Author: Thomas Dinges
Date:   Tue Jan 17 12:59:24 2023 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rB6db644cca71831d053c7d1ec8898d03ee80ab2ee

Update submodule hashes for 2.93.14 release.

===

M   release/scripts/addons

===

diff --git a/release/scripts/addons b/release/scripts/addons
index f0dd4aaf880..f2d0c03fdad 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit f0dd4aaf8800ce48e589f8e35403d6aa687b16ed
+Subproject commit f2d0c03fdade9c484908451573b328bed325e81b

___
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] [2c6ed49c034] master: Cleanup: Rename confusing region variable

2023-01-17 Thread Julian Eisel
Commit: 2c6ed49c0343840a8ff05f326e5db4dd3a218775
Author: Julian Eisel
Date:   Tue Jan 17 13:07:05 2023 +0100
Branches: master
https://developer.blender.org/rB2c6ed49c0343840a8ff05f326e5db4dd3a218775

Cleanup: Rename confusing region variable

`scaleare` reads like "scale area", but should read "scale region".

===

M   source/blender/editors/screen/screen_ops.c

===

diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index bd6d6d27d7c..a064f4632b5 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2586,21 +2586,21 @@ typedef struct RegionMoveData {
 
 } RegionMoveData;
 
-static int area_max_regionsize(ScrArea *area, ARegion *scalear, AZEdge edge)
+static int area_max_regionsize(ScrArea *area, ARegion *scale_region, AZEdge 
edge)
 {
   int dist;
 
   /* regions in regions. */
-  if (scalear->alignment & RGN_SPLIT_PREV) {
-const int align = RGN_ALIGN_ENUM_FROM_MASK(scalear->alignment);
+  if (scale_region->alignment & RGN_SPLIT_PREV) {
+const int align = RGN_ALIGN_ENUM_FROM_MASK(scale_region->alignment);
 
 if (ELEM(align, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
-  ARegion *region = scalear->prev;
-  dist = region->winy + scalear->winy - U.pixelsize;
+  ARegion *region = scale_region->prev;
+  dist = region->winy + scale_region->winy - U.pixelsize;
 }
 else /* if (ELEM(align, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) */ {
-  ARegion *region = scalear->prev;
-  dist = region->winx + scalear->winx - U.pixelsize;
+  ARegion *region = scale_region->prev;
+  dist = region->winx + scale_region->winx - U.pixelsize;
 }
   }
   else {
@@ -2614,23 +2614,23 @@ static int area_max_regionsize(ScrArea *area, ARegion 
*scalear, AZEdge edge)
 /* Subtract the width of regions on opposite side
  * prevents dragging regions into other opposite regions. */
 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
-  if (region == scalear) {
+  if (region == scale_region) {
 continue;
   }
 
-  if (scalear->alignment == RGN_ALIGN_LEFT && region->alignment == 
RGN_ALIGN_RIGHT) {
+  if (scale_region->alignment == RGN_ALIGN_LEFT && region->alignment == 
RGN_ALIGN_RIGHT) {
 dist -= region->winx;
   }
-  else if (scalear->alignment == RGN_ALIGN_RIGHT && region->alignment == 
RGN_ALIGN_LEFT) {
+  else if (scale_region->alignment == RGN_ALIGN_RIGHT && region->alignment 
== RGN_ALIGN_LEFT) {
 dist -= region->winx;
   }
-  else if (scalear->alignment == RGN_ALIGN_TOP &&
+  else if (scale_region->alignment == RGN_ALIGN_TOP &&
(region->alignment == RGN_ALIGN_BOTTOM ||
 ELEM(
 region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, 
RGN_TYPE_FOOTER))) {
 dist -= region->winy;
   }
-  else if (scalear->alignment == RGN_ALIGN_BOTTOM &&
+  else if (scale_region->alignment == RGN_ALIGN_BOTTOM &&
(region->alignment == RGN_ALIGN_TOP ||
 ELEM(
 region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, 
RGN_TYPE_FOOTER))) {

___
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] [03fab057f1e] master: Cleanup: correct asserts

2023-01-17 Thread Jacques Lucke
Commit: 03fab057f1e456a13191c13a6aa2454ecd60a442
Author: Jacques Lucke
Date:   Tue Jan 17 13:11:56 2023 +0100
Branches: master
https://developer.blender.org/rB03fab057f1e456a13191c13a6aa2454ecd60a442

Cleanup: correct asserts

===

M   source/blender/blenlib/intern/array_utils.cc

===

diff --git a/source/blender/blenlib/intern/array_utils.cc 
b/source/blender/blenlib/intern/array_utils.cc
index 1b5b071f0cd..1e1ef354461 100644
--- a/source/blender/blenlib/intern/array_utils.cc
+++ b/source/blender/blenlib/intern/array_utils.cc
@@ -10,7 +10,8 @@ void copy(const GVArray &src,
   const int64_t grain_size)
 {
   BLI_assert(src.type() == dst.type());
-  BLI_assert(src.size() == dst.size());
+  BLI_assert(src.size() >= selection.min_array_size());
+  BLI_assert(dst.size() >= selection.min_array_size());
   threading::parallel_for(selection.index_range(), grain_size, [&](const 
IndexRange range) {
 src.materialize_to_uninitialized(selection.slice(range), dst.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] [b5105085139] master: Geometry Nodes: optimize Sample Index node with constant index

2023-01-17 Thread Jacques Lucke
Commit: b5105085139227a713f154446ff6a3255cb8be99
Author: Jacques Lucke
Date:   Tue Jan 17 13:29:55 2023 +0100
Branches: master
https://developer.blender.org/rBb5105085139227a713f154446ff6a3255cb8be99

Geometry Nodes: optimize Sample Index node with constant index

Previously, the node would always evaluate the input field on the
entire geometry domain. This is good when most indices will be
accessed afterwards. However, it is quite a bad when only a single
index is used. Now the field is only evaluated for that one index.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc 
b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
index 4f6062cb553..850b2cfdd66 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
@@ -299,12 +299,39 @@ static void node_geo_exec(GeoNodeExecParams params)
   const eCustomDataType data_type = eCustomDataType(storage.data_type);
   const eAttrDomain domain = eAttrDomain(storage.domain);
 
-  auto fn = std::make_shared(std::move(geometry),
-  
get_input_attribute_field(params, data_type),
-  domain,
-  bool(storage.clamp));
-  auto op = FieldOperation::Create(std::move(fn), 
{params.extract_input>("Index")});
-  output_attribute_field(params, GField(std::move(op)));
+  GField value_field = get_input_attribute_field(params, data_type);
+  ValueOrField index_value_or_field = 
params.extract_input>("Index");
+  const CPPType &cpp_type = value_field.cpp_type();
+
+  GField output_field;
+  if (index_value_or_field.is_field()) {
+/* If the index is a field, the output has to be a field that still 
depends on the input. */
+auto fn = std::make_shared(
+std::move(geometry), std::move(value_field), domain, 
bool(storage.clamp));
+auto op = FieldOperation::Create(std::move(fn), 
{index_value_or_field.as_field()});
+output_field = GField(std::move(op));
+  }
+  else if (const GeometryComponent *component = 
find_source_component(geometry, domain)) {
+/* Optimization for the case when the index is a single value. Here only 
that one index has to
+ * be evaluated. */
+const int index = index_value_or_field.as_value();
+const IndexMask mask = IndexRange(index, 1);
+bke::GeometryFieldContext geometry_context(*component, domain);
+FieldEvaluator evaluator(geometry_context, &mask);
+evaluator.add(value_field);
+evaluator.evaluate();
+const GVArray &data = evaluator.get_evaluated(0);
+BUFFER_FOR_CPP_TYPE_VALUE(cpp_type, buffer);
+data.get_to_uninitialized(index, buffer);
+output_field = fn::make_constant_field(cpp_type, cpp_type.default_value());
+cpp_type.destruct(buffer);
+  }
+  else {
+/* Output default value if there is no geometry. */
+output_field = fn::make_constant_field(cpp_type, cpp_type.default_value());
+  }
+
+  output_attribute_field(params, std::move(output_field));
 }
 
 }  // namespace blender::nodes::node_geo_sample_index_cc

___
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] [8b660e1cbfb] master: Cleanup: use defaulted constructor

2023-01-17 Thread Jacques Lucke
Commit: 8b660e1cbfb7f2dba55d3fb4f327c8678e9799b3
Author: Jacques Lucke
Date:   Tue Jan 17 13:43:38 2023 +0100
Branches: master
https://developer.blender.org/rB8b660e1cbfb7f2dba55d3fb4f327c8678e9799b3

Cleanup: use defaulted constructor

===

M   source/blender/blenlib/BLI_color.hh

===

diff --git a/source/blender/blenlib/BLI_color.hh 
b/source/blender/blenlib/BLI_color.hh
index 0256cec667c..f334ade6dda 100644
--- a/source/blender/blenlib/BLI_color.hh
+++ b/source/blender/blenlib/BLI_color.hh
@@ -248,7 +248,7 @@ class ColorSceneLinearByteEncoded4b final
 template
 class ColorTheme4 final : public ColorRGBA {
  public:
-  constexpr ColorTheme4() : ColorRGBA(){};
+  constexpr ColorTheme4() = default;
 
   constexpr ColorTheme4(const ChannelStorageType *rgba)
   : ColorRGBA(rgba)

___
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] [f8328ec172a] master: Fix: Draw: Freeze Culling

2023-01-17 Thread Miguel Pozo
Commit: f8328ec172af4da655a9bfeaefd23d4e2f864ad5
Author: Miguel Pozo
Date:   Tue Jan 17 15:10:36 2023 +0100
Branches: master
https://developer.blender.org/rBf8328ec172af4da655a9bfeaefd23d4e2f864ad5

Fix: Draw: Freeze Culling

Bind the frozen culling data as well.

Reviewed By: fclem

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

===

M   source/blender/draw/intern/draw_view.cc

===

diff --git a/source/blender/draw/intern/draw_view.cc 
b/source/blender/draw/intern/draw_view.cc
index 82f614f20f2..5028b24c541 100644
--- a/source/blender/draw/intern/draw_view.cc
+++ b/source/blender/draw/intern/draw_view.cc
@@ -258,7 +258,8 @@ void View::compute_visibility(ObjectBoundsBuf &bounds, uint 
resource_len, bool d
 GPU_shader_uniform_1i(shader, "visibility_word_per_draw", word_per_draw);
 GPU_storagebuf_bind(bounds, GPU_shader_get_ssbo(shader, "bounds_buf"));
 GPU_storagebuf_bind(visibility_buf_, GPU_shader_get_ssbo(shader, 
"visibility_buf"));
-GPU_uniformbuf_bind((frozen_) ? data_freeze_ : data_, DRW_VIEW_UBO_SLOT);
+GPU_uniformbuf_bind(frozen_ ? data_freeze_ : data_, DRW_VIEW_UBO_SLOT);
+GPU_uniformbuf_bind(frozen_ ? culling_freeze_ : culling_, 
DRW_VIEW_CULLING_UBO_SLOT);
 GPU_compute_dispatch(shader, divide_ceil_u(resource_len, 
DRW_VISIBILITY_GROUP_SIZE), 1, 1);
 GPU_memory_barrier(GPU_BARRIER_SHADER_STORAGE);
   }
@@ -266,6 +267,7 @@ void View::compute_visibility(ObjectBoundsBuf &bounds, uint 
resource_len, bool d
   if (frozen_) {
 /* Bind back the non frozen data. */
 GPU_uniformbuf_bind(data_, DRW_VIEW_UBO_SLOT);
+GPU_uniformbuf_bind(culling_, DRW_VIEW_CULLING_UBO_SLOT);
   }
 
   GPU_debug_group_end();

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


[Bf-blender-cvs] [e27117ff5a6] tmp-flock: Add 'file locking' feature to BLI_fileops.

2023-01-17 Thread Bastien Montagne
Commit: e27117ff5a6f992b26d8ffd6ec8fbf68a72a81f1
Author: Bastien Montagne
Date:   Tue Jan 17 15:05:13 2023 +0100
Branches: tmp-flock
https://developer.blender.org/rBe27117ff5a6f992b26d8ffd6ec8fbf68a72a81f1

Add 'file locking' feature to BLI_fileops.

The new API allows to lock (shared or exclusive) an open file
descriptor, and later unlock it.

This relies on `flock` on unix systems, and `LockFileEx`/`UnlockFile` on
Windows.

===

M   source/blender/blenlib/BLI_fileops.h
M   source/blender/blenlib/intern/fileops.c
M   source/blender/blenlib/tests/BLI_fileops_test.cc

===

diff --git a/source/blender/blenlib/BLI_fileops.h 
b/source/blender/blenlib/BLI_fileops.h
index 0ff75ca16e5..6c8d3085dd6 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -221,6 +221,38 @@ void *BLI_gzopen(const char *filepath, const char *mode) 
ATTR_WARN_UNUSED_RESULT
 int BLI_open(const char *filepath, int oflag, int pmode) 
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 int BLI_access(const char *filepath, int mode) ATTR_WARN_UNUSED_RESULT 
ATTR_NONNULL();
 
+/**
+ * API handling flie locking, to ensure several instances of Blender can 
cooperate in using a same
+ * file.
+ */
+
+/**
+ * Attempt to lock a file in a shared way (i.e. other shared locks can be 
acquired on the same file
+ * at the same time).
+ *
+ * \param file_descriptor A file handle as returned e.g. by #BLI_open.
+ * \param is_blocking Whether the call should be blocking, or fail and return 
immediately if the
+ *lock cannot be acquired.
+ * \return true if the file was successfully locked, false otherwise.
+ */
+bool BLI_flock_shared(const int file_descriptor, const bool is_blocking);
+/**
+ * Attempt to lock a file in an exclusive way (i.e. no other locks can be 
acquired on the same file
+ * at the same time, be it exclusive or shared).
+ *
+ * Same parameters and return value as for #BLI_flock_shared.
+ */
+bool BLI_flock_exclusive(const int file_descriptor, const bool is_blocking);
+/**
+ * Release a lock (either shared or exclusive) previously acquired on the 
given file handle.
+ *
+ * This function is never blocking.
+ *
+ * \param file_descriptor is a file handle as returned e.g. by #BLI_open.
+ * \return true is the file was successfully unlocked, false otherwise.
+ */
+bool BLI_flock_release(const int file_descriptor);
+
 /**
  * Returns true if the file with the specified name can be written.
  * This implementation uses access(2), which makes the check according
diff --git a/source/blender/blenlib/intern/fileops.c 
b/source/blender/blenlib/intern/fileops.c
index 005de1f85b4..03cb23be5d3 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -22,6 +22,7 @@
 #  include "BLI_winstuff.h"
 #  include "utf_winfunc.h"
 #  include "utfconv.h"
+#  include 
 #  include 
 #  include 
 #  include 
@@ -33,6 +34,7 @@
 #include 
 #  endif
 #  include 
+#  include 
 #  include 
 #  include 
 #  include 
@@ -296,6 +298,32 @@ int BLI_access(const char *filepath, int mode)
   return uaccess(filepath, mode);
 }
 
+bool BLI_flock_shared(const int file_descriptor, const bool is_blocking)
+{
+  OVERLAPPED overlapp_info = {0};
+  return LockFileEx(file_descriptor,
+(is_blocking ? 0 : LOCKFILE_FAIL_IMMEDIATELY),
+0,
+MAX_INT,
+MAX_INT,
+&overlapp_info);
+}
+bool BLI_flock_exclusive(const int file_descriptor, const bool is_blocking)
+{
+  OVERLAPPED overlapp_info = {0};
+  return LockFileEx(file_descriptor,
+LOCKFILE_EXCLUSIVE_LOCK | (is_blocking ? 0 : 
LOCKFILE_FAIL_IMMEDIATELY),
+0,
+MAX_INT,
+MAX_INT,
+&overlapp_info);
+}
+bool BLI_flock_release(const int file_descriptor)
+{
+  OVERLAPPED overlapp_info = {0};
+  return UnlockFile(file_descriptor, 0, 0, MAX_INT, MAX_INT);
+}
+
 static bool delete_soft(const wchar_t *path_16, const char **error_message)
 {
   /* Deletes file or directory to recycling bin. The latter moves all 
contained files and
@@ -931,6 +959,19 @@ int BLI_access(const char *filepath, int mode)
   return access(filepath, mode);
 }
 
+bool BLI_flock_shared(const int file_descriptor, const bool is_blocking)
+{
+  return flock(file_descriptor, LOCK_SH | (is_blocking ? 0 : LOCK_NB));
+}
+bool BLI_flock_exclusive(const int file_descriptor, const bool is_blocking)
+{
+  return flock(file_descriptor, LOCK_EX | (is_blocking ? 0 : LOCK_NB));
+}
+bool BLI_flock_release(const int file_descriptor)
+{
+  return flock(file_descriptor, LOCK_UN);
+}
+
 int BLI_delete(const char *file, bool dir, bool recursive)
 {
   BLI_assert(!BLI_path_is_rel(file));
diff --git a/source/blender/blenlib/tests/BLI_fileops_test.cc 
b/source/blender/ble

[Bf-blender-cvs] [facf4463424] temp-T101739-fix-seam-bleeding-non-manifold: Enable threading during pixel copy-ing.

2023-01-17 Thread Jeroen Bakker
Commit: facf4463424bd8563e3b9a9de36d892f909ec914
Author: Jeroen Bakker
Date:   Tue Jan 17 15:27:48 2023 +0100
Branches: temp-T101739-fix-seam-bleeding-non-manifold
https://developer.blender.org/rBfacf4463424bd8563e3b9a9de36d892f909ec914

Enable threading during pixel copy-ing.

===

M   source/blender/blenkernel/BKE_pbvh_pixels.hh
M   source/blender/blenkernel/intern/pbvh_pixels_copy.cc

===

diff --git a/source/blender/blenkernel/BKE_pbvh_pixels.hh 
b/source/blender/blenkernel/BKE_pbvh_pixels.hh
index 90cade4efa7..c40df2c8e50 100644
--- a/source/blender/blenkernel/BKE_pbvh_pixels.hh
+++ b/source/blender/blenkernel/BKE_pbvh_pixels.hh
@@ -370,15 +370,15 @@ struct CopyPixelTile {
   {
   }
 
-  void copy_pixels(ImBuf &tile_buffer) const
+  void copy_pixels(ImBuf &tile_buffer, IndexRange group_range) const
   {
 if (tile_buffer.rect_float) {
   ImageBufferAccessor accessor(tile_buffer);
-  copy_pixels(accessor);
+  copy_pixels(accessor, group_range);
 }
 else {
   ImageBufferAccessor accessor(tile_buffer);
-  copy_pixels(accessor);
+  copy_pixels(accessor, group_range);
 }
   }
 
@@ -395,9 +395,11 @@ struct CopyPixelTile {
   }
 
  private:
-  template void copy_pixels(ImageBufferAccessor &image_buffer) 
const
+  template
+  void copy_pixels(ImageBufferAccessor &image_buffer, IndexRange 
group_range) const
   {
-for (const CopyPixelGroup &group : groups) {
+for (const int64_t group_index : group_range) {
+  const CopyPixelGroup &group = groups[group_index];
   CopyPixelCommand copy_command(group);
   for (const DeltaCopyPixelCommand &item : Span(
&command_deltas[group.start_delta_index], group.num_deltas)) {
diff --git a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc 
b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
index bac3c2fdf87..4e94f002244 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
@@ -5,6 +5,7 @@
 #include "BLI_bit_vector.hh"
 #include "BLI_math.h"
 #include "BLI_math_vector.hh"
+#include "BLI_task.hh"
 #include "BLI_vector.hh"
 
 #include "IMB_imbuf.h"
@@ -652,7 +653,12 @@ void BKE_pbvh_pixels_copy_pixels(PBVH &pbvh,
 /* No tile buffer found to copy. */
 return;
   }
-  pixel_tile->get().copy_pixels(*tile_buffer);
+
+  CopyPixelTile &tile = pixel_tile->get();
+  const int grain_size = 128;
+  threading::parallel_for(tile.groups.index_range(), grain_size, 
[&](IndexRange range) {
+tile.copy_pixels(*tile_buffer, range);
+  });
 
   BKE_image_release_ibuf(&image, tile_buffer, nullptr);
   // TIMEIT_END(pbvh_pixels_copy_pixels);

___
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] [e723580acee] tmp-flock: BLI_flock: Fix windows code.

2023-01-17 Thread Bastien Montagne
Commit: e723580aceef6e2bf5a9b413bcd10e8880cb7292
Author: Bastien Montagne
Date:   Tue Jan 17 15:30:36 2023 +0100
Branches: tmp-flock
https://developer.blender.org/rBe723580aceef6e2bf5a9b413bcd10e8880cb7292

BLI_flock: Fix windows code.

===

M   source/blender/blenlib/intern/fileops.c

===

diff --git a/source/blender/blenlib/intern/fileops.c 
b/source/blender/blenlib/intern/fileops.c
index 03cb23be5d3..4a37061d936 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -304,8 +304,8 @@ bool BLI_flock_shared(const int file_descriptor, const bool 
is_blocking)
   return LockFileEx(file_descriptor,
 (is_blocking ? 0 : LOCKFILE_FAIL_IMMEDIATELY),
 0,
-MAX_INT,
-MAX_INT,
+INT_MAX,
+INT_MAX,
 &overlapp_info);
 }
 bool BLI_flock_exclusive(const int file_descriptor, const bool is_blocking)
@@ -314,8 +314,8 @@ bool BLI_flock_exclusive(const int file_descriptor, const 
bool is_blocking)
   return LockFileEx(file_descriptor,
 LOCKFILE_EXCLUSIVE_LOCK | (is_blocking ? 0 : 
LOCKFILE_FAIL_IMMEDIATELY),
 0,
-MAX_INT,
-MAX_INT,
+INT_MAX,
+INT_MAX,
 &overlapp_info);
 }
 bool BLI_flock_release(const int file_descriptor)
@@ -850,8 +850,8 @@ static int delete_soft(const char *file, const char 
**error_message)
 
   Class NSStringClass = objc_getClass("NSString");
   SEL stringWithUTF8StringSel = sel_registerName("stringWithUTF8String:");
-  id pathString = ((
-  id(*)(Class, SEL, const char *))objc_msgSend)(NSStringClass, 
stringWithUTF8StringSel, file);
+  id pathString = ((id(*)(Class, SEL, const char *))objc_msgSend)(
+  NSStringClass, stringWithUTF8StringSel, file);
 
   Class NSFileManagerClass = objc_getClass("NSFileManager");
   SEL defaultManagerSel = sel_registerName("defaultManager");
@@ -862,8 +862,8 @@ static int delete_soft(const char *file, const char 
**error_message)
   id nsurl = ((id(*)(Class, SEL, id))objc_msgSend)(NSURLClass, 
fileURLWithPathSel, pathString);
 
   SEL trashItemAtURLSel = 
sel_registerName("trashItemAtURL:resultingItemURL:error:");
-  BOOL deleteSuccessful = ((
-  BOOL(*)(id, SEL, id, id, id))objc_msgSend)(fileManager, 
trashItemAtURLSel, nsurl, nil, nil);
+  BOOL deleteSuccessful = ((BOOL(*)(id, SEL, id, id, id))objc_msgSend)(
+  fileManager, trashItemAtURLSel, nsurl, nil, nil);
 
   if (deleteSuccessful) {
 ret = 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] [e144af1f7cd] master: GPencil: Provide Option for Fill in Material Popover

2023-01-17 Thread Kevin C. Burke
Commit: e144af1f7cd3e0bf4f3f3ddf4810300afb916ac2
Author: Kevin C. Burke
Date:   Tue Jan 17 15:43:07 2023 +0100
Branches: master
https://developer.blender.org/rBe144af1f7cd3e0bf4f3f3ddf4810300afb916ac2

GPencil: Provide Option for Fill in Material Popover

The Grease Pencil Material Popover currently has a color picker 
for the Stroke of a Material using Solid style, but not one for
 a Fill using Solid style. 

With the default Grease Pencil Materials, the current 
popover only shows the Stroke color for the grey "Solid Fill" 
material (which doesn't have its Stroke enabled) instead of 
the more useful Fill color.

This patch shows a Stroke color picker when the Material 
has Stroke enabled and the style is Solid. 
This is the same for the Fill.

Reviewed By: antoniov, mendio

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

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index e0f5d65db16..1403bb0d07e 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -565,9 +565,11 @@ class GreasePencilMaterialsPanel:
 
 if is_view3d and ma is not None and ma.grease_pencil is not None:
 gpcolor = ma.grease_pencil
-if gpcolor.stroke_style == 'SOLID':
-row = layout.row()
-row.prop(gpcolor, "color", text="Stroke Color")
+col = layout.column(align=True)
+if gpcolor.show_stroke and gpcolor.stroke_style == 'SOLID':
+col.prop(gpcolor, "color", text="Stroke Color")
+if gpcolor.show_fill and gpcolor.fill_style == 'SOLID':
+col.prop(gpcolor, "fill_color", text="Fill Color")
 
 else:
 space = context.space_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] [8825d393c98] temp-T101739-fix-seam-bleeding-non-manifold: Added timeit macros, but need to use hotspot to find out what actually is happening.

2023-01-17 Thread Jeroen Bakker
Commit: 8825d393c98569c590bbc1fcce928723ea800128
Author: Jeroen Bakker
Date:   Tue Jan 17 15:46:36 2023 +0100
Branches: temp-T101739-fix-seam-bleeding-non-manifold
https://developer.blender.org/rB8825d393c98569c590bbc1fcce928723ea800128

Added timeit macros, but need to use hotspot to find out what actually is 
happening.

===

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

===

diff --git a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc 
b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
index 4e94f002244..5fc0ff776f5 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
@@ -99,6 +99,7 @@ class NonManifoldUVEdges : public 
Vector> {
  public:
   NonManifoldUVEdges(const uv_islands::MeshData &mesh_data)
   {
+TIMEIT_START(det_edges);
 int num_non_manifold_edges = count_non_manifold_edges(mesh_data);
 reserve(num_non_manifold_edges);
 for (const int primitive_id : mesh_data.looptris.index_range()) {
@@ -117,12 +118,14 @@ class NonManifoldUVEdges : public 
Vector> {
 }
 BLI_assert_msg(size() == num_non_manifold_edges,
"Incorrect number of non manifold edges added. ");
+TIMEIT_END(det_edges);
   }
 
   NonManifoldTileEdges extract_tile_edges(const image::ImageTileWrapper 
image_tile,
   const int2 tile_resolution) const
   {
 NonManifoldTileEdges result;
+TIMEIT_START(extract_edges);
 // TODO: Only add edges that intersects with the given tile.
 // TODO: Clamp edges to tile bounds.
 
@@ -131,6 +134,7 @@ class NonManifoldUVEdges : public 
Vector> {
   uv_edge, image_tile, tile_resolution);
   result.append(tile_edge);
 }
+TIMEIT_END(extract_edges);
 return result;
   }
 
@@ -174,6 +178,7 @@ class PixelNodesTileData : public 
Vector>
  public:
   PixelNodesTileData(PBVH &pbvh, const image::ImageTileWrapper &image_tile)
   {
+TIMEIT_START(pixel_nodes_tile_data);
 reserve(count_nodes(pbvh, image_tile));
 
 for (PBVHNode &node : MutableSpan(pbvh.nodes, pbvh.totnode)) {
@@ -183,6 +188,7 @@ class PixelNodesTileData : public 
Vector>
 append(tile_pixels);
   }
 }
+TIMEIT_END(pixel_nodes_tile_data);
   }
 
  private:
@@ -623,9 +629,17 @@ void BKE_pbvh_pixels_copy_update(PBVH &pbvh,
 CopyPixelTile copy_tile(image_tile.get_tile_number());
 
 Rows rows(tile_resolution, image.seam_margin, nodes_tile_pixels);
+TIMEIT_START(mark_for_eval);
 rows.mark_for_evaluation(tile_edges);
+TIMEIT_END(mark_for_eval);
+
+TIMEIT_START(find_source);
 rows.find_copy_source(tile_edges);
+TIMEIT_END(find_source);
+
+TIMEIT_START(pack);
 rows.pack_into(copy_tile);
+TIMEIT_END(pack);
 copy_tile.print_compression_rate();
 pbvh_data.tiles_copy_pixels.tiles.append(copy_tile);
   }

___
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] [ed5b2b5d5fe] asset-lite-greasepencil: Merge branch 'master' into asset-lite-greasepencil

2023-01-17 Thread Antonio Vazquez
Commit: ed5b2b5d5fe3e594c4adef2c3061720cacb37b6c
Author: Antonio Vazquez
Date:   Tue Jan 17 16:07:29 2023 +0100
Branches: asset-lite-greasepencil
https://developer.blender.org/rBed5b2b5d5fe3e594c4adef2c3061720cacb37b6c

Merge branch 'master' into asset-lite-greasepencil

===



===



___
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] [15f8b6bbef8] tmp-workbench-rewrite2: Don't override local variable

2023-01-17 Thread Miguel Pozo
Commit: 15f8b6bbef8156bb7d988d018a29933ea459e3bb
Author: Miguel Pozo
Date:   Tue Jan 17 16:08:49 2023 +0100
Branches: tmp-workbench-rewrite2
https://developer.blender.org/rB15f8b6bbef8156bb7d988d018a29933ea459e3bb

Don't override local variable

===

M   source/blender/draw/engines/workbench/workbench_engine.cc

===

diff --git a/source/blender/draw/engines/workbench/workbench_engine.cc 
b/source/blender/draw/engines/workbench/workbench_engine.cc
index 36fe0dcb21e..e917aa1e81e 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.cc
+++ b/source/blender/draw/engines/workbench/workbench_engine.cc
@@ -196,9 +196,9 @@ class Instance {
 /* TODO(fclem): This create a cull-able instance for each 
sub-object. This is done
  * for simplicity to reduce complexity. But this increase the 
overhead per object.
  * Instead, we should use an indirection buffer to the material 
buffer. */
-ResourceHandle handle = i == 0 ? handle : 
manager.resource_handle(ob_ref);
+ResourceHandle _handle = i == 0 ? handle : 
manager.resource_handle(ob_ref);
 
-Material &mat = 
resources.material_buf.get_or_resize(handle.resource_index());
+Material &mat = 
resources.material_buf.get_or_resize(_handle.resource_index());
 
 if (::Material *_mat = BKE_object_material_get_eval(ob_ref.object, 
i + 1)) {
   mat = Material(*_mat);
@@ -216,7 +216,7 @@ class Instance {
   get_material_image(ob_ref.object, i + 1, image, iuser, 
sampler_state);
 }
 
-draw_mesh(ob_ref, mat, batches[i], handle, image, sampler_state, 
iuser);
+draw_mesh(ob_ref, mat, batches[i], _handle, image, sampler_state, 
iuser);
   }
 }
   }

___
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] [2c547fc7b16] tmp-workbench-rewrite2: Merge branch 'master' into tmp-workbench-rewrite2

2023-01-17 Thread Miguel Pozo
Commit: 2c547fc7b16db1ece49199e251422a273a80d74b
Author: Miguel Pozo
Date:   Tue Jan 17 15:13:45 2023 +0100
Branches: tmp-workbench-rewrite2
https://developer.blender.org/rB2c547fc7b16db1ece49199e251422a273a80d74b

Merge branch 'master' into tmp-workbench-rewrite2

===



===



___
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] [3a06bb5e45e] tmp-workbench-rewrite2: Add Freeze Culling support

2023-01-17 Thread Miguel Pozo
Commit: 3a06bb5e45e650ac357bf18f7d7d9d9cc4eca00f
Author: Miguel Pozo
Date:   Tue Jan 17 16:03:02 2023 +0100
Branches: tmp-workbench-rewrite2
https://developer.blender.org/rB3a06bb5e45e650ac357bf18f7d7d9d9cc4eca00f

Add Freeze Culling support

===

M   source/blender/draw/engines/workbench/workbench_engine.cc
M   source/blender/draw/intern/draw_view.cc
M   source/blender/draw/intern/draw_view.hh

===

diff --git a/source/blender/draw/engines/workbench/workbench_engine.cc 
b/source/blender/draw/engines/workbench/workbench_engine.cc
index afa8281d1e0..36fe0dcb21e 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.cc
+++ b/source/blender/draw/engines/workbench/workbench_engine.cc
@@ -21,6 +21,8 @@ using namespace draw;
 
 class Instance {
  public:
+  View view = {"DefaultView"};
+
   SceneState scene_state;
 
   SceneResources resources;
@@ -309,8 +311,10 @@ class Instance {
 }
   }
 
-  void draw(Manager &manager, View &view, GPUTexture *depth_tx, GPUTexture 
*color_tx)
+  void draw(Manager &manager, GPUTexture *depth_tx, GPUTexture *color_tx)
   {
+view.sync(DRW_view_default_get());
+
 int2 resolution = scene_state.resolution;
 
 if (scene_state.render_finished) {
@@ -364,9 +368,9 @@ class Instance {
 resources.depth_in_front_tx.release();
   }
 
-  void draw_viewport(Manager &manager, View &view, GPUTexture *depth_tx, 
GPUTexture *color_tx)
+  void draw_viewport(Manager &manager, GPUTexture *depth_tx, GPUTexture 
*color_tx)
   {
-this->draw(manager, view, depth_tx, color_tx);
+this->draw(manager, depth_tx, color_tx);
 
 if (scene_state.sample + 1 < scene_state.samples_len) {
   DRW_viewport_request_redraw();
@@ -389,6 +393,7 @@ struct WORKBENCH_Data {
   DRWViewportEmptyList *psl;
   DRWViewportEmptyList *stl;
   workbench::Instance *instance;
+  draw::View *view;
 
   char info[GPU_INFO_SIZE];
 };
@@ -403,6 +408,7 @@ static void workbench_engine_init(void *vedata)
   WORKBENCH_Data *ved = reinterpret_cast(vedata);
   if (ved->instance == nullptr) {
 ved->instance = new workbench::Instance();
+ved->view = new draw::View("Default View");
   }
 
   ved->instance->init();
@@ -447,10 +453,8 @@ static void workbench_draw_scene(void *vedata)
 return;
   }
   DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
-  const DRWView *default_view = DRW_view_default_get();
   draw::Manager *manager = DRW_manager_get();
-  draw::View view("DefaultView", default_view);
-  ved->instance->draw_viewport(*manager, view, dtxl->depth, dtxl->color);
+  ved->instance->draw_viewport(*manager, dtxl->depth, dtxl->color);
 }
 
 static void workbench_instance_free(void *instance)
diff --git a/source/blender/draw/intern/draw_view.cc 
b/source/blender/draw/intern/draw_view.cc
index 2c5d4c6c9e6..85f31844311 100644
--- a/source/blender/draw/intern/draw_view.cc
+++ b/source/blender/draw/intern/draw_view.cc
@@ -31,6 +31,14 @@ void View::sync(const float4x4 &view_mat, const float4x4 
&win_mat, int view_id)
   dirty_ = true;
 }
 
+void View::sync(const DRWView *view)
+{
+  float4x4 view_mat, win_mat;
+  DRW_view_viewmat_get(view, view_mat.ptr(), false);
+  DRW_view_winmat_get(view, win_mat.ptr(), false);
+  this->sync(view_mat, win_mat);
+}
+
 void View::frustum_boundbox_calc(int view_id)
 {
   /* Extract the 8 corners from a Projection Matrix. */
diff --git a/source/blender/draw/intern/draw_view.hh 
b/source/blender/draw/intern/draw_view.hh
index 0408081c99c..5bf2bf1a568 100644
--- a/source/blender/draw/intern/draw_view.hh
+++ b/source/blender/draw/intern/draw_view.hh
@@ -64,14 +64,14 @@ class View {
   View(const char *name, const DRWView *view)
   : visibility_buf_(name), debug_name_(name), view_len_(1)
   {
-float4x4 view_mat, win_mat;
-DRW_view_viewmat_get(view, view_mat.ptr(), false);
-DRW_view_winmat_get(view, win_mat.ptr(), false);
-this->sync(view_mat, win_mat);
+this->sync(view);
   }
 
   void sync(const float4x4 &view_mat, const float4x4 &win_mat, int view_id = 
0);
 
+  /* For compatibility with old system. Will be removed at some point. */
+  void sync(const DRWView *view);
+
   bool is_persp(int view_id = 0) const
   {
 BLI_assert(view_id < view_len_);

___
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] [49e9d105f0e] tmp-worbench-rewrite2-optimizations: Experimental bbox cache

2023-01-17 Thread Miguel Pozo
Commit: 49e9d105f0e9d97fe2ff76ae6e4da04d94740a7b
Author: Miguel Pozo
Date:   Wed Jan 11 17:19:45 2023 +0100
Branches: tmp-worbench-rewrite2-optimizations
https://developer.blender.org/rB49e9d105f0e9d97fe2ff76ae6e4da04d94740a7b

Experimental bbox cache

===

M   source/blender/draw/intern/draw_manager_data.cc
M   source/blender/draw/intern/draw_resource.hh

===

diff --git a/source/blender/draw/intern/draw_manager_data.cc 
b/source/blender/draw/intern/draw_manager_data.cc
index 5b4e0792577..01cdf785a05 100644
--- a/source/blender/draw/intern/draw_manager_data.cc
+++ b/source/blender/draw/intern/draw_manager_data.cc
@@ -719,8 +719,18 @@ static void drw_call_obinfos_init(DRWObjectInfos 
*ob_infos, Object *ob)
 
 static void drw_call_culling_init(DRWCullingState *cull, Object *ob)
 {
-  const BoundBox *bbox;
-  if (ob != nullptr && (bbox = BKE_object_boundbox_get(ob))) {
+  /* WORKAROUND (Experimental):
+   * Store the last retrieved bbox so each object instance doesn't have to 
malloc a new one */
+  static const BoundBox *bbox_cache = nullptr;
+  static const void *object_data_cache = nullptr;
+
+  if (ob != nullptr && ob->data != object_data_cache) {
+// object_data_cache = ob->data;
+bbox_cache = BKE_object_boundbox_get(ob);
+  }
+  const BoundBox *bbox = bbox_cache;
+
+  if (ob != nullptr && bbox != nullptr) {
 float corner[3];
 /* Get BoundSphere center and radius from the BoundBox. */
 mid_v3_v3v3(cull->bsphere.center, bbox->vec[0], bbox->vec[6]);
diff --git a/source/blender/draw/intern/draw_resource.hh 
b/source/blender/draw/intern/draw_resource.hh
index a2de084b900..d1a6b2a5468 100644
--- a/source/blender/draw/intern/draw_resource.hh
+++ b/source/blender/draw/intern/draw_resource.hh
@@ -151,7 +151,17 @@ inline void ObjectBounds::sync()
 
 inline void ObjectBounds::sync(Object &ob)
 {
-  const BoundBox *bbox = BKE_object_boundbox_get(&ob);
+  /* WORKAROUND (Experimental):
+   * Store the last retrieved bbox so each object instance doesn't have to 
malloc a new one */
+  static const BoundBox *bbox_cache = nullptr;
+  static const void *object_data_cache = nullptr;
+
+  if (ob.data != object_data_cache) {
+// object_data_cache = ob.data;
+bbox_cache = BKE_object_boundbox_get(&ob);
+  }
+
+  const BoundBox *bbox = bbox_cache;
   if (bbox == nullptr) {
 bounding_sphere.w = -1.0f; /* Disable test. */
 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] [c2022d6d369] tmp-worbench-rewrite2-optimizations: Skip bbox allocation by retrieving bounds min/max

2023-01-17 Thread Miguel Pozo
Commit: c2022d6d3691ddcced42c24488344393249ba631
Author: Miguel Pozo
Date:   Tue Jan 17 16:13:17 2023 +0100
Branches: tmp-worbench-rewrite2-optimizations
https://developer.blender.org/rBc2022d6d3691ddcced42c24488344393249ba631

Skip bbox allocation by retrieving bounds min/max

===

M   source/blender/blenkernel/intern/object.cc
M   source/blender/draw/intern/draw_manager_data.cc
M   source/blender/draw/intern/draw_resource.hh

===

diff --git a/source/blender/blenkernel/intern/object.cc 
b/source/blender/blenkernel/intern/object.cc
index d33f8fe5de7..817bc50cba4 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -3882,8 +3882,12 @@ void BKE_object_minmax(Object *ob, float r_min[3], float 
r_max[3], const bool us
   break;
 }
 case OB_MESH: {
-  const BoundBox bb = *BKE_mesh_boundbox_get(ob);
-  BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max);
+  Mesh *me = (Mesh *)ob->data;
+  INIT_MINMAX(r_min, r_max);
+  if (!BKE_mesh_wrapper_minmax(me, r_min, r_max)) {
+r_min[0] = r_min[1] = r_min[2] = -1.0f;
+r_max[0] = r_max[1] = r_max[2] = 1.0f;
+  }
   changed = true;
   break;
 }
diff --git a/source/blender/draw/intern/draw_manager_data.cc 
b/source/blender/draw/intern/draw_manager_data.cc
index 5b4e0792577..5c06233054d 100644
--- a/source/blender/draw/intern/draw_manager_data.cc
+++ b/source/blender/draw/intern/draw_manager_data.cc
@@ -719,12 +719,16 @@ static void drw_call_obinfos_init(DRWObjectInfos 
*ob_infos, Object *ob)
 
 static void drw_call_culling_init(DRWCullingState *cull, Object *ob)
 {
-  const BoundBox *bbox;
-  if (ob != nullptr && (bbox = BKE_object_boundbox_get(ob))) {
+  if (ob != nullptr) {
+float3 min, max;
+BKE_object_minmax(ob, min, max, false);
+BoundBox bbox;
+BKE_boundbox_init_from_minmax(&bbox, min, max);
+
 float corner[3];
 /* Get BoundSphere center and radius from the BoundBox. */
-mid_v3_v3v3(cull->bsphere.center, bbox->vec[0], bbox->vec[6]);
-mul_v3_m4v3(corner, ob->object_to_world, bbox->vec[0]);
+mid_v3_v3v3(cull->bsphere.center, bbox.vec[0], bbox.vec[6]);
+mul_v3_m4v3(corner, ob->object_to_world, bbox.vec[0]);
 mul_m4_v3(ob->object_to_world, cull->bsphere.center);
 cull->bsphere.radius = len_v3v3(cull->bsphere.center, corner);
 
diff --git a/source/blender/draw/intern/draw_resource.hh 
b/source/blender/draw/intern/draw_resource.hh
index a2de084b900..69e7c3a0687 100644
--- a/source/blender/draw/intern/draw_resource.hh
+++ b/source/blender/draw/intern/draw_resource.hh
@@ -151,15 +151,15 @@ inline void ObjectBounds::sync()
 
 inline void ObjectBounds::sync(Object &ob)
 {
-  const BoundBox *bbox = BKE_object_boundbox_get(&ob);
-  if (bbox == nullptr) {
-bounding_sphere.w = -1.0f; /* Disable test. */
-return;
-  }
-  *reinterpret_cast(&bounding_corners[0]) = bbox->vec[0];
-  *reinterpret_cast(&bounding_corners[1]) = bbox->vec[4];
-  *reinterpret_cast(&bounding_corners[2]) = bbox->vec[3];
-  *reinterpret_cast(&bounding_corners[3]) = bbox->vec[1];
+  float3 min, max;
+  BKE_object_minmax(&ob, min, max, false);
+  BoundBox bbox;
+  BKE_boundbox_init_from_minmax(&bbox, min, max);
+
+  *reinterpret_cast(&bounding_corners[0]) = bbox.vec[0];
+  *reinterpret_cast(&bounding_corners[1]) = bbox.vec[4];
+  *reinterpret_cast(&bounding_corners[2]) = bbox.vec[3];
+  *reinterpret_cast(&bounding_corners[3]) = bbox.vec[1];
   bounding_sphere.w = 0.0f; /* Enable test. */
 }

___
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] [89e114fa702] tmp-worbench-rewrite2-optimizations: Merge branch 'tmp-workbench-rewrite2' into tmp-worbench-rewrite2-optimizations

2023-01-17 Thread Miguel Pozo
Commit: 89e114fa702543b9c14bec0c0241d8b71add401c
Author: Miguel Pozo
Date:   Wed Jan 11 15:27:31 2023 +0100
Branches: tmp-worbench-rewrite2-optimizations
https://developer.blender.org/rB89e114fa702543b9c14bec0c0241d8b71add401c

Merge branch 'tmp-workbench-rewrite2' into tmp-worbench-rewrite2-optimizations

===



===



___
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] [6f28259ea3d] tmp-worbench-rewrite2-optimizations: Merge branch 'tmp-workbench-rewrite2' into tmp-worbench-rewrite2-optimizations

2023-01-17 Thread Miguel Pozo
Commit: 6f28259ea3ded1790435a6f8b7bbdf30e65d3d0a
Author: Miguel Pozo
Date:   Tue Jan 17 16:14:57 2023 +0100
Branches: tmp-worbench-rewrite2-optimizations
https://developer.blender.org/rB6f28259ea3ded1790435a6f8b7bbdf30e65d3d0a

Merge branch 'tmp-workbench-rewrite2' into tmp-worbench-rewrite2-optimizations

===



===



___
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] [0ea4baa94d8] tmp-worbench-rewrite2-optimizations: Revert "Experimental bbox cache"

2023-01-17 Thread Miguel Pozo
Commit: 0ea4baa94d8c0720693310614c05366457a99fbe
Author: Miguel Pozo
Date:   Wed Jan 11 17:28:29 2023 +0100
Branches: tmp-worbench-rewrite2-optimizations
https://developer.blender.org/rB0ea4baa94d8c0720693310614c05366457a99fbe

Revert "Experimental bbox cache"

This reverts commit 49e9d105f0e9d97fe2ff76ae6e4da04d94740a7b.

===

M   source/blender/draw/intern/draw_manager_data.cc
M   source/blender/draw/intern/draw_resource.hh

===

diff --git a/source/blender/draw/intern/draw_manager_data.cc 
b/source/blender/draw/intern/draw_manager_data.cc
index 01cdf785a05..5b4e0792577 100644
--- a/source/blender/draw/intern/draw_manager_data.cc
+++ b/source/blender/draw/intern/draw_manager_data.cc
@@ -719,18 +719,8 @@ static void drw_call_obinfos_init(DRWObjectInfos 
*ob_infos, Object *ob)
 
 static void drw_call_culling_init(DRWCullingState *cull, Object *ob)
 {
-  /* WORKAROUND (Experimental):
-   * Store the last retrieved bbox so each object instance doesn't have to 
malloc a new one */
-  static const BoundBox *bbox_cache = nullptr;
-  static const void *object_data_cache = nullptr;
-
-  if (ob != nullptr && ob->data != object_data_cache) {
-// object_data_cache = ob->data;
-bbox_cache = BKE_object_boundbox_get(ob);
-  }
-  const BoundBox *bbox = bbox_cache;
-
-  if (ob != nullptr && bbox != nullptr) {
+  const BoundBox *bbox;
+  if (ob != nullptr && (bbox = BKE_object_boundbox_get(ob))) {
 float corner[3];
 /* Get BoundSphere center and radius from the BoundBox. */
 mid_v3_v3v3(cull->bsphere.center, bbox->vec[0], bbox->vec[6]);
diff --git a/source/blender/draw/intern/draw_resource.hh 
b/source/blender/draw/intern/draw_resource.hh
index d1a6b2a5468..a2de084b900 100644
--- a/source/blender/draw/intern/draw_resource.hh
+++ b/source/blender/draw/intern/draw_resource.hh
@@ -151,17 +151,7 @@ inline void ObjectBounds::sync()
 
 inline void ObjectBounds::sync(Object &ob)
 {
-  /* WORKAROUND (Experimental):
-   * Store the last retrieved bbox so each object instance doesn't have to 
malloc a new one */
-  static const BoundBox *bbox_cache = nullptr;
-  static const void *object_data_cache = nullptr;
-
-  if (ob.data != object_data_cache) {
-// object_data_cache = ob.data;
-bbox_cache = BKE_object_boundbox_get(&ob);
-  }
-
-  const BoundBox *bbox = bbox_cache;
+  const BoundBox *bbox = BKE_object_boundbox_get(&ob);
   if (bbox == nullptr) {
 bounding_sphere.w = -1.0f; /* Disable test. */
 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] [7df5d7c7a70] master: Cleanup: Curves selection boolean to float comparison

2023-01-17 Thread Hans Goudey
Commit: 7df5d7c7a70963f72a71e2f19507218b51d0f188
Author: Hans Goudey
Date:   Tue Jan 17 09:15:33 2023 -0600
Branches: master
https://developer.blender.org/rB7df5d7c7a70963f72a71e2f19507218b51d0f188

Cleanup: Curves selection boolean to float comparison

The conversion from float to boolean is now handled by
the attribute API.

===

M   source/blender/draw/intern/draw_cache_impl_curves.cc

===

diff --git a/source/blender/draw/intern/draw_cache_impl_curves.cc 
b/source/blender/draw/intern/draw_cache_impl_curves.cc
index 751fb95ce74..ba47ea576e0 100644
--- a/source/blender/draw/intern/draw_cache_impl_curves.cc
+++ b/source/blender/draw/intern/draw_cache_impl_curves.cc
@@ -339,13 +339,13 @@ static void 
curves_batch_cache_ensure_edit_points_data(const Curves &curves_id,
   switch (curves_id.selection_domain) {
 case ATTR_DOMAIN_POINT:
   for (const int point_i : selection.index_range()) {
-const float point_selection = (selection[point_i] > 0.0f) ? 1.0f : 
0.0f;
+const float point_selection = selection[point_i] ? 1.0f : 0.0f;
 GPU_vertbuf_attr_set(cache.edit_points_data, color, point_i, 
&point_selection);
   }
   break;
 case ATTR_DOMAIN_CURVE:
   for (const int curve_i : curves.curves_range()) {
-const float curve_selection = (selection[curve_i] > 0.0f) ? 1.0f : 
0.0f;
+const float curve_selection = selection[curve_i] ? 1.0f : 0.0f;
 const IndexRange points = curves.points_for_curve(curve_i);
 for (const int point_i : points) {
   GPU_vertbuf_attr_set(cache.edit_points_data, color, point_i, 
&curve_selection);

___
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] [a6b383bd69c] tmp-worbench-rewrite2-optimizations: Revert "Skip bbox allocation by retrieving bounds min/max"

2023-01-17 Thread Miguel Pozo
Commit: a6b383bd69caa50fb35a8ffefcd276a26f4fa6e8
Author: Miguel Pozo
Date:   Tue Jan 17 16:13:25 2023 +0100
Branches: tmp-worbench-rewrite2-optimizations
https://developer.blender.org/rBa6b383bd69caa50fb35a8ffefcd276a26f4fa6e8

Revert "Skip bbox allocation by retrieving bounds min/max"

This reverts commit c2022d6d3691ddcced42c24488344393249ba631.

===

M   source/blender/blenkernel/intern/object.cc
M   source/blender/draw/intern/draw_manager_data.cc
M   source/blender/draw/intern/draw_resource.hh

===

diff --git a/source/blender/blenkernel/intern/object.cc 
b/source/blender/blenkernel/intern/object.cc
index 817bc50cba4..d33f8fe5de7 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -3882,12 +3882,8 @@ void BKE_object_minmax(Object *ob, float r_min[3], float 
r_max[3], const bool us
   break;
 }
 case OB_MESH: {
-  Mesh *me = (Mesh *)ob->data;
-  INIT_MINMAX(r_min, r_max);
-  if (!BKE_mesh_wrapper_minmax(me, r_min, r_max)) {
-r_min[0] = r_min[1] = r_min[2] = -1.0f;
-r_max[0] = r_max[1] = r_max[2] = 1.0f;
-  }
+  const BoundBox bb = *BKE_mesh_boundbox_get(ob);
+  BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max);
   changed = true;
   break;
 }
diff --git a/source/blender/draw/intern/draw_manager_data.cc 
b/source/blender/draw/intern/draw_manager_data.cc
index 5c06233054d..5b4e0792577 100644
--- a/source/blender/draw/intern/draw_manager_data.cc
+++ b/source/blender/draw/intern/draw_manager_data.cc
@@ -719,16 +719,12 @@ static void drw_call_obinfos_init(DRWObjectInfos 
*ob_infos, Object *ob)
 
 static void drw_call_culling_init(DRWCullingState *cull, Object *ob)
 {
-  if (ob != nullptr) {
-float3 min, max;
-BKE_object_minmax(ob, min, max, false);
-BoundBox bbox;
-BKE_boundbox_init_from_minmax(&bbox, min, max);
-
+  const BoundBox *bbox;
+  if (ob != nullptr && (bbox = BKE_object_boundbox_get(ob))) {
 float corner[3];
 /* Get BoundSphere center and radius from the BoundBox. */
-mid_v3_v3v3(cull->bsphere.center, bbox.vec[0], bbox.vec[6]);
-mul_v3_m4v3(corner, ob->object_to_world, bbox.vec[0]);
+mid_v3_v3v3(cull->bsphere.center, bbox->vec[0], bbox->vec[6]);
+mul_v3_m4v3(corner, ob->object_to_world, bbox->vec[0]);
 mul_m4_v3(ob->object_to_world, cull->bsphere.center);
 cull->bsphere.radius = len_v3v3(cull->bsphere.center, corner);
 
diff --git a/source/blender/draw/intern/draw_resource.hh 
b/source/blender/draw/intern/draw_resource.hh
index 69e7c3a0687..a2de084b900 100644
--- a/source/blender/draw/intern/draw_resource.hh
+++ b/source/blender/draw/intern/draw_resource.hh
@@ -151,15 +151,15 @@ inline void ObjectBounds::sync()
 
 inline void ObjectBounds::sync(Object &ob)
 {
-  float3 min, max;
-  BKE_object_minmax(&ob, min, max, false);
-  BoundBox bbox;
-  BKE_boundbox_init_from_minmax(&bbox, min, max);
-
-  *reinterpret_cast(&bounding_corners[0]) = bbox.vec[0];
-  *reinterpret_cast(&bounding_corners[1]) = bbox.vec[4];
-  *reinterpret_cast(&bounding_corners[2]) = bbox.vec[3];
-  *reinterpret_cast(&bounding_corners[3]) = bbox.vec[1];
+  const BoundBox *bbox = BKE_object_boundbox_get(&ob);
+  if (bbox == nullptr) {
+bounding_sphere.w = -1.0f; /* Disable test. */
+return;
+  }
+  *reinterpret_cast(&bounding_corners[0]) = bbox->vec[0];
+  *reinterpret_cast(&bounding_corners[1]) = bbox->vec[4];
+  *reinterpret_cast(&bounding_corners[2]) = bbox->vec[3];
+  *reinterpret_cast(&bounding_corners[3]) = bbox->vec[1];
   bounding_sphere.w = 0.0f; /* Enable test. */
 }

___
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] [9b00338ed47] asset-shelf: Merge branch 'master' into asset-shelf

2023-01-17 Thread Julian Eisel
Commit: 9b00338ed47c755921aef19e419d4802c47d929b
Author: Julian Eisel
Date:   Mon Jan 16 17:22:56 2023 +0100
Branches: asset-shelf
https://developer.blender.org/rB9b00338ed47c755921aef19e419d4802c47d929b

Merge branch 'master' into asset-shelf

===



===

diff --cc source/blender/blenloader/intern/versioning_300.cc
index 2acc95b7339,4c45e1433ab..19f075241af
--- a/source/blender/blenloader/intern/versioning_300.cc
+++ b/source/blender/blenloader/intern/versioning_300.cc
@@@ -3733,25 -3818,99 +3818,118 @@@ void blo_do_versions_300(FileData *fd, 
}
  }
  
- /* Add a properties sidebar to the spreadsheet editor. */
+ LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
+   if (ntree->type == NTREE_GEOMETRY) {
+ version_geometry_nodes_primitive_uv_maps(*ntree);
+   }
+ }
+   }
+ 
+   if (!MAIN_VERSION_ATLEAST(bmain, 305, 6)) {
+ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+   LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+   if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->overlay.flag |= int(V3D_OVERLAY_SCULPT_SHOW_MASK |
+  V3D_OVERLAY_SCULPT_SHOW_FACE_SETS);
+   }
+ }
+   }
+ }
+   }
+ 
+   if (!MAIN_VERSION_ATLEAST(bmain, 305, 7)) {
+ LISTBASE_FOREACH (Light *, light, &bmain->lights) {
+   light->radius = light->area_size;
+ }
+ /* Grease Pencil Build modifier:
+  * Set default value for new natural draw-speed factor and maximum gap. */
+ if (!DNA_struct_elem_find(fd->filesdna, "BuildGpencilModifierData", 
"float", "speed_fac") ||
+ !DNA_struct_elem_find(fd->filesdna, "BuildGpencilModifierData", 
"float", "speed_maxgap")) {
+   LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ LISTBASE_FOREACH (GpencilModifierData *, md, 
&ob->greasepencil_modifiers) {
+   if (md->type == eGpencilModifierType_Build) {
+ BuildGpencilModifierData *mmd = (BuildGpencilModifierData *)md;
+ mmd->speed_fac = 1.2f;
+ mmd->speed_maxgap = 0.5f;
+   }
+ }
+   }
+ }
+   }
+ 
+   if (!MAIN_VERSION_ATLEAST(bmain, 305, 8)) {
+ const int CV_SCULPT_SELECTION_ENABLED = (1 << 1);
+ LISTBASE_FOREACH (Curves *, curves_id, &bmain->hair_curves) {
+   curves_id->flag &= ~CV_SCULPT_SELECTION_ENABLED;
+ }
+ LISTBASE_FOREACH (Curves *, curves_id, &bmain->hair_curves) {
+   BKE_id_attribute_rename(&curves_id->id, ".selection_point_float", 
".selection", nullptr);
+   BKE_id_attribute_rename(&curves_id->id, ".selection_curve_float", 
".selection", nullptr);
+ }
+ 
+ /* Toggle the Invert Vertex Group flag on Armature modifiers in some 
cases. */
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+   bool after_armature = false;
+   LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
+ if (md->type == eModifierType_Armature) {
+   ArmatureModifierData *amd = (ArmatureModifierData *)md;
+   if (amd->multi) {
+ /* Toggle the invert vertex group flag on operational Multi 
Modifier entries. */
+ if (after_armature && amd->defgrp_name[0]) {
+   amd->deformflag ^= ARM_DEF_INVERT_VGROUP;
+ }
+   }
+   else {
+ /* Disabled multi modifiers don't reset propagation, but 
non-multi ones do. */
+ after_armature = false;
+   }
+   /* Multi Modifier is only valid and operational after an active 
Armature modifier. */
+   if (md->mode & (eModifierMode_Realtime | eModifierMode_Render)) {
+ after_armature = true;
+   }
+ }
+ else if (ELEM(md->type, eModifierType_Lattice, 
eModifierType_MeshDeform)) {
+   /* These modifiers will also allow a following Multi Modifier to 
work. */
+   after_armature = (md->mode & (eModifierMode_Realtime | 
eModifierMode_Render)) != 0;
+ }
+ else {
+   after_armature = false;
+ }
+   }
+ }
+   }
+ 
+   /**
+* Versioning code until next subversion bump goes here.
+*
+* \note Be sure to check when bumping the version:
+* - "versioning_userdef.c", #blo_do_versions_userdef
+* - "versioning_userdef.c", #do_versions_theme
+*
+* \note Keep this message at the bottom of the function.
+*/
+   {
+ /* Keep this block, even when empty. */
 +LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
 +  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
 +LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
 +  if (sl->spacetype == SPACE_VIEW3D) {
 +ListBase *regionbase = (sl == area->spacedata.first) ? 
&area->

[Bf-blender-cvs] [0e3f5c66733] asset-shelf: Merge branch 'master' into asset-shelf

2023-01-17 Thread Julian Eisel
Commit: 0e3f5c66733b6b2c48c2c334b3d5a1c859aed9a5
Author: Julian Eisel
Date:   Tue Jan 17 13:08:57 2023 +0100
Branches: asset-shelf
https://developer.blender.org/rB0e3f5c66733b6b2c48c2c334b3d5a1c859aed9a5

Merge branch 'master' into asset-shelf

===



===



___
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] [d6df32a6f84] asset-shelf: Add basic (empty) asset shelf region

2023-01-17 Thread Julian Eisel
Commit: d6df32a6f841836c9b83f116bd95440346cc74fe
Author: Julian Eisel
Date:   Wed Dec 7 20:00:27 2022 +0100
Branches: asset-shelf
https://developer.blender.org/rBd6df32a6f841836c9b83f116bd95440346cc74fe

Add basic (empty) asset shelf region

===

M   source/blender/blenloader/intern/versioning_300.cc
M   source/blender/editors/screen/area.c
M   source/blender/editors/screen/screen_edit.c
M   source/blender/editors/space_view3d/space_view3d.cc
M   source/blender/makesdna/DNA_screen_types.h
M   source/blender/makesrna/intern/rna_screen.c

===

diff --git a/source/blender/blenloader/intern/versioning_300.cc 
b/source/blender/blenloader/intern/versioning_300.cc
index 85078a9902d..2acc95b7339 100644
--- a/source/blender/blenloader/intern/versioning_300.cc
+++ b/source/blender/blenloader/intern/versioning_300.cc
@@ -3732,5 +3732,26 @@ void blo_do_versions_300(FileData *fd, Library * 
/*lib*/, Main *bmain)
 image->seam_margin = 8;
   }
 }
+
+/* Add a properties sidebar to the spreadsheet editor. */
+LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+  if (sl->spacetype == SPACE_VIEW3D) {
+ListBase *regionbase = (sl == area->spacedata.first) ? 
&area->regionbase :
+   
&sl->regionbase;
+ARegion *new_asset_shelf = do_versions_add_region_if_not_found(
+regionbase,
+RGN_TYPE_ASSET_SHELF,
+"asset shelf for view3d (versioning)",
+RGN_TYPE_UI);
+if (new_asset_shelf != nullptr) {
+  new_asset_shelf->alignment = RGN_ALIGN_BOTTOM;
+  new_asset_shelf->flag |= RGN_FLAG_HIDDEN;
+}
+  }
+}
+  }
+}
   }
 }
diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index a62e027ba03..3721774842c 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1262,7 +1262,8 @@ bool ED_region_is_overlap(int spacetype, int regiontype)
RGN_TYPE_UI,
RGN_TYPE_TOOL_PROPS,
RGN_TYPE_FOOTER,
-   RGN_TYPE_TOOL_HEADER)) {
+   RGN_TYPE_TOOL_HEADER,
+   RGN_TYPE_ASSET_SHELF)) {
 return true;
   }
 }
diff --git a/source/blender/editors/screen/screen_edit.c 
b/source/blender/editors/screen/screen_edit.c
index 14ed5987cc7..0acae5b5ea5 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1435,7 +1435,8 @@ static bScreen *screen_state_to_nonnormal(bContext *C,
RGN_TYPE_FOOTER,
RGN_TYPE_TOOLS,
RGN_TYPE_NAV_BAR,
-   RGN_TYPE_EXECUTE)) {
+   RGN_TYPE_EXECUTE,
+   RGN_TYPE_ASSET_SHELF)) {
 region->flag |= RGN_FLAG_HIDDEN;
   }
 }
diff --git a/source/blender/editors/space_view3d/space_view3d.cc 
b/source/blender/editors/space_view3d/space_view3d.cc
index 05fb0c6a720..b2da6630b38 100644
--- a/source/blender/editors/space_view3d/space_view3d.cc
+++ b/source/blender/editors/space_view3d/space_view3d.cc
@@ -289,6 +289,14 @@ static SpaceLink *view3d_create(const ScrArea * /*area*/, 
const Scene *scene)
   region->alignment = RGN_ALIGN_RIGHT;
   region->flag = RGN_FLAG_HIDDEN;
 
+  /* asset shelf */
+  region = MEM_cnew("asset shelf for view3d");
+
+  BLI_addtail(&v3d->regionbase, region);
+  region->regiontype = RGN_TYPE_ASSET_SHELF;
+  region->alignment = RGN_ALIGN_BOTTOM;
+  region->flag = RGN_FLAG_HIDDEN;
+
   /* main region */
   region = MEM_cnew("main region for view3d");
 
@@ -2137,6 +2145,15 @@ void ED_spacetype_view3d()
   art->draw = view3d_header_region_draw;
   BLI_addhead(&st->regiontypes, art);
 
+  /* regions: asset shelf */
+  art = MEM_cnew("spacetype view3d asset shelf region");
+  art->regionid = RGN_TYPE_ASSET_SHELF;
+  art->prefsizey = HEADERY * 4;
+  art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | 
ED_KEYMAP_HEADER;
+  art->init = view3d_header_region_init;
+  art->draw = view3d_header_region_draw;
+  BLI_addhead(&st->regiontypes, art);
+
   /* regions: hud */
   art = ED_area_type_hud(st->spaceid);
   BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/makesdna/DNA_screen_types.h 
b/source/blender/makesdna/DNA_screen_types.h
index 4d4bd9ef775..4feab97b6b7 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -657,8 +657,9 @@ typedef enum eRegion_Type {
   /* Region type used exclusively by internal code and add-ons to register 
draw callbacks to the XR
* context (surface, mirror view). Does not re

[Bf-blender-cvs] [8ddf492e7cf] asset-shelf: Basic asset shelf prototype

2023-01-17 Thread Julian Eisel
Commit: 8ddf492e7cf677f34315dcf5a8726ce45982ab7a
Author: Julian Eisel
Date:   Tue Jan 17 15:18:17 2023 +0100
Branches: asset-shelf
https://developer.blender.org/rB8ddf492e7cf677f34315dcf5a8726ce45982ab7a

Basic asset shelf prototype

Adds the necessary bits to be able to show an asset shelf template via
the pose library add-on.

===

M   source/blender/blenloader/intern/versioning_300.cc
M   source/blender/blenloader/intern/versioning_defaults.cc
M   source/blender/editors/asset/ED_asset_list.h
M   source/blender/editors/asset/intern/asset_list.cc
M   source/blender/editors/include/ED_screen.h
M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/CMakeLists.txt
M   source/blender/editors/interface/interface_layout.cc
A   source/blender/editors/interface/interface_template_asset_shelf.cc
M   source/blender/editors/interface/interface_template_asset_view.cc
M   source/blender/editors/screen/area.c
M   source/blender/editors/space_view3d/space_view3d.cc
M   source/blender/makesdna/DNA_asset_defaults.h
M   source/blender/makesrna/intern/rna_ui_api.c

===

diff --git a/source/blender/blenloader/intern/versioning_300.cc 
b/source/blender/blenloader/intern/versioning_300.cc
index 19f075241af..7393f4fc171 100644
--- a/source/blender/blenloader/intern/versioning_300.cc
+++ b/source/blender/blenloader/intern/versioning_300.cc
@@ -3926,10 +3926,18 @@ void blo_do_versions_300(FileData *fd, Library * 
/*lib*/, Main *bmain)
 if (new_asset_shelf != nullptr) {
   new_asset_shelf->alignment = RGN_ALIGN_BOTTOM;
   new_asset_shelf->flag |= RGN_FLAG_HIDDEN;
+  new_asset_shelf->flag = RGN_FLAG_HIDDEN | RGN_FLAG_DYNAMIC_SIZE;
 }
   }
 }
   }
 }
+
+/* Should we really use the "All" library by default? Consider loading 
time and memory usage.
+ */
+LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
+  workspace->asset_library_ref.type = ASSET_LIBRARY_ALL;
+  workspace->asset_library_ref.custom_library_index = -1;
+}
   }
 }
diff --git a/source/blender/blenloader/intern/versioning_defaults.cc 
b/source/blender/blenloader/intern/versioning_defaults.cc
index f6fe45ddcdf..fb5599d1d77 100644
--- a/source/blender/blenloader/intern/versioning_defaults.cc
+++ b/source/blender/blenloader/intern/versioning_defaults.cc
@@ -260,6 +260,9 @@ void BLO_update_defaults_workspace(WorkSpace *workspace, 
const char *app_templat
   BKE_workspace_tool_remove(workspace, static_cast(workspace->tools.first));
 }
 
+workspace->asset_library_ref.type = ASSET_LIBRARY_ALL;
+workspace->asset_library_ref.custom_library_index = -1;
+
 /* For 2D animation template. */
 if (STREQ(workspace->id.name + 2, "Drawing")) {
   workspace->object_mode = OB_MODE_PAINT_GPENCIL;
diff --git a/source/blender/editors/asset/ED_asset_list.h 
b/source/blender/editors/asset/ED_asset_list.h
index 635dc3bff32..b33f909c50b 100644
--- a/source/blender/editors/asset/ED_asset_list.h
+++ b/source/blender/editors/asset/ED_asset_list.h
@@ -55,8 +55,7 @@ struct ImBuf *ED_assetlist_asset_image_get(const AssetHandle 
*asset_handle);
 /**
  * \return True if the region needs a UI redraw.
  */
-bool ED_assetlist_listen(const struct AssetLibraryReference *library_reference,
- const struct wmNotifier *notifier);
+bool ED_assetlist_listen(const struct wmNotifier *notifier);
 /**
  * \return The number of assets stored in the asset list for \a 
library_reference, or -1 if there
  * is no list fetched for it.
diff --git a/source/blender/editors/asset/intern/asset_list.cc 
b/source/blender/editors/asset/intern/asset_list.cc
index 64934316413..3b3a434f0cc 100644
--- a/source/blender/editors/asset/intern/asset_list.cc
+++ b/source/blender/editors/asset/intern/asset_list.cc
@@ -116,7 +116,7 @@ class AssetList : NonCopyable {
   bool isLoaded() const;
   asset_system::AssetLibrary *asset_library() const;
   void iterate(AssetListIterFn fn) const;
-  bool listen(const wmNotifier ¬ifier) const;
+  static bool listen(const wmNotifier ¬ifier);
   int size() const;
   void tagMainDataDirty() const;
   void remapID(ID *id_old, ID *id_new) const;
@@ -249,7 +249,7 @@ void AssetList::clear(bContext *C)
 /**
  * \return True if the asset-list needs a UI redraw.
  */
-bool AssetList::listen(const wmNotifier ¬ifier) const
+bool AssetList::listen(const wmNotifier ¬ifier)
 {
   switch (notifier.category) {
 case NC_ID: {
@@ -481,14 +481,9 @@ ImBuf *ED_assetlist_asset_image_get(const AssetHandle 
*asset_handle)
   return filelist_geticon_image_ex(asset_handle->file_data);
 }
 
-bool ED_assetlist_listen(const AssetLibraryReference *library_reference,
- const wmNotifier *notifier)
+bool ED_assetlist_list

[Bf-blender-cvs] [b3ee7ad2ccb] asset-shelf: Extend asset shelf region with a region for the catalogs & options

2023-01-17 Thread Julian Eisel
Commit: b3ee7ad2ccbf9aba225b55d6e46b5d7a73ef26d9
Author: Julian Eisel
Date:   Tue Jan 17 16:24:03 2023 +0100
Branches: asset-shelf
https://developer.blender.org/rBb3ee7ad2ccbf9aba225b55d6e46b5d7a73ef26d9

Extend asset shelf region with a region for the catalogs & options

The new region is empty, except of a dummy button.

===

M   source/blender/blenloader/intern/versioning_300.cc
M   source/blender/editors/asset/CMakeLists.txt
A   source/blender/editors/asset/ED_asset_shelf.h
A   source/blender/editors/asset/intern/asset_shelf.cc
M   source/blender/editors/include/ED_screen.h
M   source/blender/editors/interface/interface_handlers.cc
M   source/blender/editors/interface/resources.cc
M   source/blender/editors/screen/area.c
M   source/blender/editors/screen/screen_edit.c
M   source/blender/editors/screen/screen_ops.c
M   source/blender/editors/space_view3d/CMakeLists.txt
M   source/blender/editors/space_view3d/space_view3d.cc
M   source/blender/makesdna/DNA_screen_types.h
M   source/blender/makesrna/intern/rna_screen.c
M   source/blender/windowmanager/intern/wm_event_system.cc

===

diff --git a/source/blender/blenloader/intern/versioning_300.cc 
b/source/blender/blenloader/intern/versioning_300.cc
index 7393f4fc171..460ee3b8719 100644
--- a/source/blender/blenloader/intern/versioning_300.cc
+++ b/source/blender/blenloader/intern/versioning_300.cc
@@ -3918,15 +3918,27 @@ void blo_do_versions_300(FileData *fd, Library * 
/*lib*/, Main *bmain)
   if (sl->spacetype == SPACE_VIEW3D) {
 ListBase *regionbase = (sl == area->spacedata.first) ? 
&area->regionbase :

&sl->regionbase;
-ARegion *new_asset_shelf = do_versions_add_region_if_not_found(
-regionbase,
-RGN_TYPE_ASSET_SHELF,
-"asset shelf for view3d (versioning)",
-RGN_TYPE_UI);
-if (new_asset_shelf != nullptr) {
-  new_asset_shelf->alignment = RGN_ALIGN_BOTTOM;
-  new_asset_shelf->flag |= RGN_FLAG_HIDDEN;
-  new_asset_shelf->flag = RGN_FLAG_HIDDEN | RGN_FLAG_DYNAMIC_SIZE;
+{
+  ARegion *new_asset_shelf_footer = 
do_versions_add_region_if_not_found(
+  regionbase,
+  RGN_TYPE_ASSET_SHELF_FOOTER,
+  "asset shelf footer for view3d (versioning)",
+  RGN_TYPE_UI);
+  if (new_asset_shelf_footer != nullptr) {
+new_asset_shelf_footer->alignment = RGN_ALIGN_BOTTOM;
+new_asset_shelf_footer->flag |= RGN_FLAG_HIDDEN;
+  }
+}
+{
+  ARegion *new_asset_shelf = do_versions_add_region_if_not_found(
+  regionbase,
+  RGN_TYPE_ASSET_SHELF,
+  "asset shelf for view3d (versioning)",
+  RGN_TYPE_ASSET_SHELF_FOOTER);
+  if (new_asset_shelf != nullptr) {
+new_asset_shelf->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
+new_asset_shelf->flag |= RGN_FLAG_DYNAMIC_SIZE;
+  }
 }
   }
 }
diff --git a/source/blender/editors/asset/CMakeLists.txt 
b/source/blender/editors/asset/CMakeLists.txt
index a4d05ebaffe..3e45a0bccdf 100644
--- a/source/blender/editors/asset/CMakeLists.txt
+++ b/source/blender/editors/asset/CMakeLists.txt
@@ -30,6 +30,7 @@ set(SRC
   intern/asset_list.cc
   intern/asset_mark_clear.cc
   intern/asset_ops.cc
+  intern/asset_shelf.cc
   intern/asset_temp_id_consumer.cc
   intern/asset_type.cc
 
@@ -42,6 +43,7 @@ set(SRC
   ED_asset_list.h
   ED_asset_list.hh
   ED_asset_mark_clear.h
+  ED_asset_shelf.h
   ED_asset_temp_id_consumer.h
   ED_asset_type.h
   intern/asset_library_reference.hh
diff --git a/source/blender/editors/asset/ED_asset_shelf.h 
b/source/blender/editors/asset/ED_asset_shelf.h
new file mode 100644
index 000..5d5a483ef0b
--- /dev/null
+++ b/source/blender/editors/asset/ED_asset_shelf.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/** \file
+ * \ingroup edasset
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ARegionType;
+struct bContext;
+struct wmWindowManager;
+
+void ED_region_asset_shelf_footer_init(struct wmWindowManager *wm, struct 
ARegion *region);
+void ED_region_asset_shelf_footer(const struct bContext *C, struct ARegion 
*region);
+
+void ED_region_asset_shelf_listen(const struct wmRegionListenerParams *params);
+
+void ED_asset_shelf_footer_register(struct ARegionType *region_type,
+const char *idname,
+const int space_type);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/editors/asset

[Bf-blender-cvs] [f8b11528b29] master: USD export: ensure edit mode changes are exported

2023-01-17 Thread Michael Kowalski
Commit: f8b11528b29b1f7565475679715e1e0c80e266de
Author: Michael Kowalski
Date:   Tue Jan 17 10:24:43 2023 -0500
Branches: master
https://developer.blender.org/rBf8b11528b29b1f7565475679715e1e0c80e266de

USD export: ensure edit mode changes are exported

Code authored by Charles Wardlaw.

Reviewed by Bastien, Sybren and makowalski.

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

===

M   source/blender/io/usd/intern/usd_writer_mesh.cc

===

diff --git a/source/blender/io/usd/intern/usd_writer_mesh.cc 
b/source/blender/io/usd/intern/usd_writer_mesh.cc
index 9551fea75fb..7f3444d88f4 100644
--- a/source/blender/io/usd/intern/usd_writer_mesh.cc
+++ b/source/blender/io/usd/intern/usd_writer_mesh.cc
@@ -18,6 +18,7 @@
 #include "BKE_lib_id.h"
 #include "BKE_material.h"
 #include "BKE_mesh.h"
+#include "BKE_mesh_wrapper.h"
 #include "BKE_modifier.h"
 #include "BKE_object.h"
 
@@ -151,6 +152,8 @@ void USDGenericMeshWriter::write_mesh(HierarchyContext 
&context, Mesh *mesh)
   write_visibility(context, timecode, usd_mesh);
 
   USDMeshData usd_mesh_data;
+  /* Ensure data exists if currently in edit mode. */
+  BKE_mesh_wrapper_ensure_mdata(mesh);
   get_geometry_data(mesh, usd_mesh_data);
 
   if (usd_export_context_.export_params.use_instancing && 
context.is_instance()) {

___
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] [50105b29524] master: Fix T103911: Editing boolean custom property UI data resets value

2023-01-17 Thread Hans Goudey
Commit: 50105b29524d9ca771e9e93c7286a0f4d21723ed
Author: Hans Goudey
Date:   Tue Jan 17 09:50:06 2023 -0600
Branches: master
https://developer.blender.org/rB50105b29524d9ca771e9e93c7286a0f4d21723ed

Fix T103911: Editing boolean custom property UI data resets value

The old value wasn't retrieved for boolean array properties.

===

M   release/scripts/startup/bl_operators/wm.py

===

diff --git a/release/scripts/startup/bl_operators/wm.py 
b/release/scripts/startup/bl_operators/wm.py
index fe43051281d..291e412ee75 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1623,7 +1623,7 @@ class WM_OT_properties_edit(Operator):
 
 if prop_type_new == 'BOOL_ARRAY':
 prop_type_old = self.get_property_type(item, name_old)
-if prop_type_old in {'INT', 'FLOAT', 'FLOAT_ARRAY', 'INT_ARRAY'}:
+if prop_type_old in {'INT', 'FLOAT', 'FLOAT_ARRAY', 'INT_ARRAY', 
'BOOL_ARRAY'}:
 return self._convert_new_value_array(item[name_old], bool, 
self.array_length)
 else:
 return [False] * self.array_length

___
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] [0e89d243184] master: Cleanup: Use elif in custom property edit operator, reduce whitespace

2023-01-17 Thread Hans Goudey
Commit: 0e89d2431840386fe9bdc2f11bd83dbfb5847ba2
Author: Hans Goudey
Date:   Tue Jan 17 09:51:09 2023 -0600
Branches: master
https://developer.blender.org/rB0e89d2431840386fe9bdc2f11bd83dbfb5847ba2

Cleanup: Use elif in custom property edit operator, reduce whitespace

===

M   release/scripts/startup/bl_operators/wm.py

===

diff --git a/release/scripts/startup/bl_operators/wm.py 
b/release/scripts/startup/bl_operators/wm.py
index 291e412ee75..b8f5fc596c3 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1588,8 +1588,7 @@ class WM_OT_properties_edit(Operator):
 self.default_string = rna_data["default"]
 elif self.property_type in {'BOOL', 'BOOL_ARRAY'}:
 self.default_int = 
self._convert_new_value_array(rna_data["default"], bool, 32)
-
-if self.property_type in {'FLOAT_ARRAY', 'INT_ARRAY', 'BOOL_ARRAY'}:
+elif self.property_type in {'FLOAT_ARRAY', 'INT_ARRAY', 'BOOL_ARRAY'}:
 self.array_length = len(item[name])
 
 # The dictionary does not contain the description if it was empty.
@@ -1604,33 +1603,26 @@ class WM_OT_properties_edit(Operator):
 def _get_converted_value(self, item, name_old, prop_type_new):
 if prop_type_new == 'INT':
 return self._convert_new_value_single(item[name_old], int)
-
-if prop_type_new == 'FLOAT':
+elif prop_type_new == 'FLOAT':
 return self._convert_new_value_single(item[name_old], float)
-
-if prop_type_new == 'BOOL':
+elif prop_type_new == 'BOOL':
 return self._convert_new_value_single(item[name_old], bool)
-
-if prop_type_new == 'INT_ARRAY':
+elif prop_type_new == 'INT_ARRAY':
 prop_type_old = self.get_property_type(item, name_old)
 if prop_type_old in {'INT', 'FLOAT', 'INT_ARRAY', 'FLOAT_ARRAY', 
'BOOL_ARRAY'}:
 return self._convert_new_value_array(item[name_old], int, 
self.array_length)
-
-if prop_type_new == 'FLOAT_ARRAY':
+elif prop_type_new == 'FLOAT_ARRAY':
 prop_type_old = self.get_property_type(item, name_old)
 if prop_type_old in {'INT', 'FLOAT', 'FLOAT_ARRAY', 'INT_ARRAY', 
'BOOL_ARRAY'}:
 return self._convert_new_value_array(item[name_old], float, 
self.array_length)
-
-if prop_type_new == 'BOOL_ARRAY':
+elif prop_type_new == 'BOOL_ARRAY':
 prop_type_old = self.get_property_type(item, name_old)
 if prop_type_old in {'INT', 'FLOAT', 'FLOAT_ARRAY', 'INT_ARRAY', 
'BOOL_ARRAY'}:
 return self._convert_new_value_array(item[name_old], bool, 
self.array_length)
 else:
 return [False] * self.array_length
-
-if prop_type_new == 'STRING':
+elif prop_type_new == 'STRING':
 return self.convert_custom_property_to_string(item, name_old)
-
 # If all else fails, create an empty string property. That should 
avoid errors later on anyway.
 return ""
 
@@ -1667,7 +1659,7 @@ class WM_OT_properties_edit(Operator):
 default=self.default_int[0] if prop_type_new == 'INT' else 
self.default_int[:self.array_length],
 description=self.description,
 )
-if prop_type_new in {'BOOL', 'BOOL_ARRAY'}:
+elif prop_type_new in {'BOOL', 'BOOL_ARRAY'}:
 ui_data = item.id_properties_ui(name)
 ui_data.update(
 default=self.default_bool[0] if prop_type_new == 'BOOL' else 
self.default_bool[:self.array_length],

___
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] [45ed398b77f] tmp-flock: BLI_fileops flock: fixes.

2023-01-17 Thread Bastien Montagne
Commit: 45ed398b77f341f872d04e5ce297dd65aeec7711
Author: Bastien Montagne
Date:   Tue Jan 17 17:05:26 2023 +0100
Branches: tmp-flock
https://developer.blender.org/rB45ed398b77f341f872d04e5ce297dd65aeec7711

BLI_fileops flock: fixes.

===

M   source/blender/blenlib/intern/fileops.c
M   source/blender/blenlib/tests/BLI_fileops_test.cc

===

diff --git a/source/blender/blenlib/intern/fileops.c 
b/source/blender/blenlib/intern/fileops.c
index 4a37061d936..40dfd1b656b 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -961,15 +961,15 @@ int BLI_access(const char *filepath, int mode)
 
 bool BLI_flock_shared(const int file_descriptor, const bool is_blocking)
 {
-  return flock(file_descriptor, LOCK_SH | (is_blocking ? 0 : LOCK_NB));
+  return !flock(file_descriptor, LOCK_SH | (is_blocking ? 0 : LOCK_NB));
 }
 bool BLI_flock_exclusive(const int file_descriptor, const bool is_blocking)
 {
-  return flock(file_descriptor, LOCK_EX | (is_blocking ? 0 : LOCK_NB));
+  return !flock(file_descriptor, LOCK_EX | (is_blocking ? 0 : LOCK_NB));
 }
 bool BLI_flock_release(const int file_descriptor)
 {
-  return flock(file_descriptor, LOCK_UN);
+  return !flock(file_descriptor, LOCK_UN);
 }
 
 int BLI_delete(const char *file, bool dir, bool recursive)
diff --git a/source/blender/blenlib/tests/BLI_fileops_test.cc 
b/source/blender/blenlib/tests/BLI_fileops_test.cc
index 67e4c640358..568fff5a52b 100644
--- a/source/blender/blenlib/tests/BLI_fileops_test.cc
+++ b/source/blender/blenlib/tests/BLI_fileops_test.cc
@@ -90,6 +90,8 @@ TEST(fileops, flock_file)
   ASSERT_FALSE(flock_result);
   flock_result = BLI_flock_shared(fhandle_2, false);
   ASSERT_FALSE(flock_result);
+  flock_result = BLI_flock_shared(-1, false);
+  ASSERT_FALSE(flock_result);
 }
 
 }  // namespace blender::tests

___
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] [7929d9e06f1] tmp-flock: BLI_fileops flock: More fixes.

2023-01-17 Thread Bastien Montagne
Commit: 7929d9e06f14b340c91bdde8601f2f09cf4d3b9f
Author: Bastien Montagne
Date:   Tue Jan 17 17:08:27 2023 +0100
Branches: tmp-flock
https://developer.blender.org/rB7929d9e06f14b340c91bdde8601f2f09cf4d3b9f

BLI_fileops flock: More fixes.

===

M   source/blender/blenlib/intern/fileops.c

===

diff --git a/source/blender/blenlib/intern/fileops.c 
b/source/blender/blenlib/intern/fileops.c
index 40dfd1b656b..e7b48f53555 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -321,7 +321,7 @@ bool BLI_flock_exclusive(const int file_descriptor, const 
bool is_blocking)
 bool BLI_flock_release(const int file_descriptor)
 {
   OVERLAPPED overlapp_info = {0};
-  return UnlockFile(file_descriptor, 0, 0, MAX_INT, MAX_INT);
+  return UnlockFile(file_descriptor, 0, 0, INT_MAX, INT_MAX);
 }
 
 static bool delete_soft(const wchar_t *path_16, const char **error_message)

___
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] [d411de96f7d] master: Fix T103936: Regression: Track To constraint broken

2023-01-17 Thread Sergey Sharybin
Commit: d411de96f7d979209b4be6379836314aafc8aeba
Author: Sergey Sharybin
Date:   Tue Jan 17 17:08:30 2023 +0100
Branches: master
https://developer.blender.org/rBd411de96f7d979209b4be6379836314aafc8aeba

Fix T103936: Regression: Track To constraint broken

Caused by 6769acbbba7f.

Some of the matrix variants are rather obscure from the
semantic: they don't really fully initialize the output:
as in, they only write to an upper-left 3x3 block.

A quick solution to fix the very commonly used constraint.
It feels that it is possible to minimize about of copy
operations.

===

M   source/blender/blenlib/intern/math_matrix.c

===

diff --git a/source/blender/blenlib/intern/math_matrix.c 
b/source/blender/blenlib/intern/math_matrix.c
index 7322a9facec..b8eaeb5c654 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -382,6 +382,12 @@ void mul_m4_m4m3(float R[4][4], const float A[4][4], const 
float B[3][3])
 {
   if (R == A) {
 float T[4][4];
+/* The mul_m4_m4m3 only writes to the upper-left 3x3 block, so make it so 
the rest of the
+ * matrix is copied from the input to the output.
+ *
+ * TODO(sergey): It does sound a bit redundant from the number of copy 
operations, so there is
+ * a potential for optimization. */
+copy_m4_m4(T, A);
 mul_m4_m4m3(T, A, B);
 copy_m4_m4(R, T);
 return;
@@ -450,6 +456,12 @@ void mul_m4_m3m4(float R[4][4], const float A[3][3], const 
float B[4][4])
 {
   if (R == B) {
 float T[4][4];
+/* The mul_m4_m4m3 only writes to the upper-left 3x3 block, so make it so 
the rest of the
+ * matrix is copied from the input to the output.
+ *
+ * TODO(sergey): It does sound a bit redundant from the number of copy 
operations, so there is
+ * a potential for optimization. */
+copy_m4_m4(T, B);
 mul_m4_m3m4(T, A, B);
 copy_m4_m4(R, T);
 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] [873794b196a] master: Fix T103937: Applying modifier resets shape keys

2023-01-17 Thread Hans Goudey
Commit: 873794b196a2f346d5f78ab3f1a60008cf544545
Author: Hans Goudey
Date:   Tue Jan 17 10:20:16 2023 -0600
Branches: master
https://developer.blender.org/rB873794b196a2f346d5f78ab3f1a60008cf544545

Fix T103937: Applying modifier resets shape keys

The order of arguments to memcpy was reversed, which is sadly possible
because the constness `KeyBlock` of keyblock doesn't propagate to
pointers it contains.

===

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

===

diff --git a/source/blender/blenkernel/intern/key.cc 
b/source/blender/blenkernel/intern/key.cc
index 57d040c5c4f..7d835c2464d 100644
--- a/source/blender/blenkernel/intern/key.cc
+++ b/source/blender/blenkernel/intern/key.cc
@@ -2218,7 +2218,7 @@ void BKE_keyblock_convert_to_mesh(const KeyBlock *kb,
   const int totvert)
 {
   const int tot = min_ii(kb->totelem, totvert);
-  memcpy(kb->data, vert_positions, sizeof(float[3]) * tot);
+  memcpy(vert_positions, kb->data, sizeof(float[3]) * tot);
 }
 
 void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,

___
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] [400f022989c] master: Geometry Nodes: Add warning to set material node with no faces

2023-01-17 Thread Hans Goudey
Commit: 400f022989c318a7f3cf392164713bf12e93251e
Author: Hans Goudey
Date:   Tue Jan 17 10:31:07 2023 -0600
Branches: master
https://developer.blender.org/rB400f022989c318a7f3cf392164713bf12e93251e

Geometry Nodes: Add warning to set material node with no faces

The node can't do anything in this case, which isn't always obvious.

Resolves T103133

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc 
b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc
index e6e3eadff03..aa2930cfed9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc
@@ -65,22 +65,27 @@ static void node_geo_exec(GeoNodeExecParams params)
   GeometrySet geometry_set = params.extract_input("Geometry");
 
   /* Only add the warnings once, even if there are many unique instances. */
+  bool no_faces_warning = false;
   bool point_selection_warning = false;
   bool volume_selection_warning = false;
   bool curves_selection_warning = false;
 
   geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
-if (geometry_set.has_mesh()) {
-  MeshComponent &mesh_component = 
geometry_set.get_component_for_write();
-  Mesh &mesh = *mesh_component.get_for_write();
-
-  bke::MeshFieldContext field_context{mesh, ATTR_DOMAIN_FACE};
-  fn::FieldEvaluator selection_evaluator{field_context, mesh.totpoly};
-  selection_evaluator.add(selection_field);
-  selection_evaluator.evaluate();
-  const IndexMask selection = selection_evaluator.get_evaluated_as_mask(0);
-
-  assign_material_to_faces(mesh, selection, material);
+if (Mesh *mesh = geometry_set.get_mesh_for_write()) {
+  if (mesh->totpoly == 0) {
+if (mesh->totvert > 0) {
+  no_faces_warning = true;
+}
+  }
+  else {
+bke::MeshFieldContext field_context{*mesh, ATTR_DOMAIN_FACE};
+fn::FieldEvaluator selection_evaluator{field_context, mesh->totpoly};
+selection_evaluator.add(selection_field);
+selection_evaluator.evaluate();
+const IndexMask selection = 
selection_evaluator.get_evaluated_as_mask(0);
+
+assign_material_to_faces(*mesh, selection, material);
+  }
 }
 if (Volume *volume = geometry_set.get_volume_for_write()) {
   BKE_id_material_eval_assign(&volume->id, 1, material);
@@ -102,6 +107,10 @@ static void node_geo_exec(GeoNodeExecParams params)
 }
   });
 
+  if (no_faces_warning) {
+params.error_message_add(NodeWarningType::Info,
+ TIP_("Mesh has no faces for material 
assignment"));
+  }
   if (volume_selection_warning) {
 params.error_message_add(
 NodeWarningType::Info,

___
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] [597a9e3246a] tmp-flock: BLI_fileops flock: More fixes.

2023-01-17 Thread Bastien Montagne
Commit: 597a9e3246a6d779dea910328969b7232cd5435d
Author: Bastien Montagne
Date:   Tue Jan 17 17:47:08 2023 +0100
Branches: tmp-flock
https://developer.blender.org/rB597a9e3246a6d779dea910328969b7232cd5435d

BLI_fileops flock: More fixes.

===

M   source/blender/blenlib/BLI_fileops.h
M   source/blender/blenlib/intern/fileops.c

===

diff --git a/source/blender/blenlib/BLI_fileops.h 
b/source/blender/blenlib/BLI_fileops.h
index 6c8d3085dd6..45da8765e0b 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -230,7 +230,7 @@ int BLI_access(const char *filepath, int mode) 
ATTR_WARN_UNUSED_RESULT ATTR_NONN
  * Attempt to lock a file in a shared way (i.e. other shared locks can be 
acquired on the same file
  * at the same time).
  *
- * \param file_descriptor A file handle as returned e.g. by #BLI_open.
+ * \param file_descriptor A file descriptor as returned e.g. by #BLI_open.
  * \param is_blocking Whether the call should be blocking, or fail and return 
immediately if the
  *lock cannot be acquired.
  * \return true if the file was successfully locked, false otherwise.
@@ -244,11 +244,11 @@ bool BLI_flock_shared(const int file_descriptor, const 
bool is_blocking);
  */
 bool BLI_flock_exclusive(const int file_descriptor, const bool is_blocking);
 /**
- * Release a lock (either shared or exclusive) previously acquired on the 
given file handle.
+ * Release a lock (either shared or exclusive) previously acquired on the 
given file descriptor.
  *
  * This function is never blocking.
  *
- * \param file_descriptor is a file handle as returned e.g. by #BLI_open.
+ * \param file_descriptor A file descriptor as returned e.g. by #BLI_open.
  * \return true is the file was successfully unlocked, false otherwise.
  */
 bool BLI_flock_release(const int file_descriptor);
diff --git a/source/blender/blenlib/intern/fileops.c 
b/source/blender/blenlib/intern/fileops.c
index e7b48f53555..a56503ba5cb 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -301,7 +301,7 @@ int BLI_access(const char *filepath, int mode)
 bool BLI_flock_shared(const int file_descriptor, const bool is_blocking)
 {
   OVERLAPPED overlapp_info = {0};
-  return LockFileEx(file_descriptor,
+  return LockFileEx(_get_osfhandle(file_descriptor),
 (is_blocking ? 0 : LOCKFILE_FAIL_IMMEDIATELY),
 0,
 INT_MAX,
@@ -311,7 +311,7 @@ bool BLI_flock_shared(const int file_descriptor, const bool 
is_blocking)
 bool BLI_flock_exclusive(const int file_descriptor, const bool is_blocking)
 {
   OVERLAPPED overlapp_info = {0};
-  return LockFileEx(file_descriptor,
+  return LockFileEx(_get_osfhandle(file_descriptor),
 LOCKFILE_EXCLUSIVE_LOCK | (is_blocking ? 0 : 
LOCKFILE_FAIL_IMMEDIATELY),
 0,
 INT_MAX,
@@ -321,7 +321,7 @@ bool BLI_flock_exclusive(const int file_descriptor, const 
bool is_blocking)
 bool BLI_flock_release(const int file_descriptor)
 {
   OVERLAPPED overlapp_info = {0};
-  return UnlockFile(file_descriptor, 0, 0, INT_MAX, INT_MAX);
+  return UnlockFile(_get_osfhandle(file_descriptor), 0, 0, INT_MAX, INT_MAX);
 }
 
 static bool delete_soft(const wchar_t *path_16, const char **error_message)

___
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] [aa4e5a132d5] tmp-flock: Merge branch 'master' into tmp-flock

2023-01-17 Thread Bastien Montagne
Commit: aa4e5a132d538cce6f8cb5f3dc9fef81354c52e0
Author: Bastien Montagne
Date:   Tue Jan 17 17:47:27 2023 +0100
Branches: tmp-flock
https://developer.blender.org/rBaa4e5a132d538cce6f8cb5f3dc9fef81354c52e0

Merge branch 'master' into tmp-flock

===



===



___
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] [23d09b954e2] tmp-flock: BLI_fileops flock: More attemps to fix windows build.

2023-01-17 Thread Bastien Montagne
Commit: 23d09b954e2602fb8d7c79dabffb551f4dd298e7
Author: Bastien Montagne
Date:   Tue Jan 17 18:09:21 2023 +0100
Branches: tmp-flock
https://developer.blender.org/rB23d09b954e2602fb8d7c79dabffb551f4dd298e7

BLI_fileops flock: More attemps to fix windows build.

===

M   source/blender/blenlib/intern/fileops.c
M   source/blender/blenlib/tests/BLI_fileops_test.cc

===

diff --git a/source/blender/blenlib/intern/fileops.c 
b/source/blender/blenlib/intern/fileops.c
index a56503ba5cb..c18b214affa 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -320,7 +320,6 @@ bool BLI_flock_exclusive(const int file_descriptor, const 
bool is_blocking)
 }
 bool BLI_flock_release(const int file_descriptor)
 {
-  OVERLAPPED overlapp_info = {0};
   return UnlockFile(_get_osfhandle(file_descriptor), 0, 0, INT_MAX, INT_MAX);
 }
 
diff --git a/source/blender/blenlib/tests/BLI_fileops_test.cc 
b/source/blender/blenlib/tests/BLI_fileops_test.cc
index 568fff5a52b..da324bdcc6f 100644
--- a/source/blender/blenlib/tests/BLI_fileops_test.cc
+++ b/source/blender/blenlib/tests/BLI_fileops_test.cc
@@ -1,16 +1,14 @@
 /* SPDX-License-Identifier: Apache-2.0 */
 
-#include 
+#include "BLI_fileops.hh"
 
+#include 
 #ifdef WIN32
-#  include "BLI_winstuff.h"
 #  include 
 #else
 #  include  /* FreeBSD, for write() and close(). */
 #endif
 
-#include "BLI_fileops.hh"
-
 #include "testing/testing.h"
 
 namespace blender::tests {
@@ -56,39 +54,39 @@ TEST(fileops, flock_file)
   const std::string filepath_str = test_files_dir + 
"/asset_library/новый/blender_assets.cats.txt";
   const char *filepath = filepath_str.c_str();
 
-  const int fhandle_1 = BLI_open(filepath, O_BINARY | O_RDONLY, 0);
-  const int fhandle_2 = BLI_open(filepath, O_BINARY | O_RDONLY, 0);
+  const int fdescriptor_1 = BLI_open(filepath, O_BINARY | O_RDONLY, 0);
+  const int fdescriptor_2 = BLI_open(filepath, O_BINARY | O_RDONLY, 0);
 
-  bool flock_result = BLI_flock_shared(fhandle_1, false);
+  bool flock_result = BLI_flock_shared(fdescriptor_1, false);
   ASSERT_TRUE(flock_result);
 
-  flock_result = BLI_flock_shared(fhandle_2, false);
+  flock_result = BLI_flock_shared(fdescriptor_2, false);
   ASSERT_TRUE(flock_result);
 
-  flock_result = BLI_flock_release(fhandle_2);
+  flock_result = BLI_flock_release(fdescriptor_2);
   ASSERT_TRUE(flock_result);
 
   /* Acquiring an exclusive lock on a file  which already has another handle 
locked should not be
* possible. */
-  flock_result = BLI_flock_exclusive(fhandle_2, false);
+  flock_result = BLI_flock_exclusive(fdescriptor_2, false);
   ASSERT_FALSE(flock_result);
 
-  flock_result = BLI_flock_release(fhandle_1);
+  flock_result = BLI_flock_release(fdescriptor_1);
   ASSERT_TRUE(flock_result);
 
-  flock_result = BLI_flock_exclusive(fhandle_2, false);
+  flock_result = BLI_flock_exclusive(fdescriptor_2, false);
   ASSERT_TRUE(flock_result);
 
-  flock_result = BLI_flock_release(fhandle_2);
+  flock_result = BLI_flock_release(fdescriptor_2);
   ASSERT_TRUE(flock_result);
 
-  close(fhandle_1);
-  close(fhandle_2);
+  close(fdescriptor_1);
+  close(fdescriptor_2);
 
   /* Acquiring lock on closed/non-existent file handles should not be 
possible. */
-  flock_result = BLI_flock_shared(fhandle_1, false);
+  flock_result = BLI_flock_shared(fdescriptor_1, false);
   ASSERT_FALSE(flock_result);
-  flock_result = BLI_flock_shared(fhandle_2, false);
+  flock_result = BLI_flock_shared(fdescriptor_2, false);
   ASSERT_FALSE(flock_result);
   flock_result = BLI_flock_shared(-1, false);
   ASSERT_FALSE(flock_result);

___
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] [543bf28fb1f] master: Refactor: renamed I -> wi, omega_in -> wo in Cycles

2023-01-17 Thread Weizhen Huang
Commit: 543bf28fb1ff736293900d154dfb3a5da84df28a
Author: Weizhen Huang
Date:   Tue Jan 17 17:19:20 2023 +0100
Branches: master
https://developer.blender.org/rB543bf28fb1ff736293900d154dfb3a5da84df28a

Refactor: renamed I -> wi, omega_in -> wo in Cycles

wi is the viewing direction, and wo is the illumination direction. Under this 
notation, BSDF sampling always samples from wi and outputs wo, which is 
consistent with most of the papers and mitsuba. This order is reversed compared 
with PBRT, although PBRT also traces from the camera.

===

M   intern/cycles/kernel/closure/bsdf.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h
M   intern/cycles/kernel/closure/bsdf_diffuse.h
M   intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
M   intern/cycles/kernel/closure/bsdf_hair.h
M   intern/cycles/kernel/closure/bsdf_hair_principled.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.h
M   intern/cycles/kernel/closure/bsdf_oren_nayar.h
M   intern/cycles/kernel/closure/bsdf_phong_ramp.h
M   intern/cycles/kernel/closure/bsdf_principled_diffuse.h
M   intern/cycles/kernel/closure/bsdf_principled_sheen.h
M   intern/cycles/kernel/closure/bsdf_reflection.h
M   intern/cycles/kernel/closure/bsdf_refraction.h
M   intern/cycles/kernel/closure/bsdf_toon.h
M   intern/cycles/kernel/closure/bsdf_transparent.h
M   intern/cycles/kernel/closure/bssrdf.h
M   intern/cycles/kernel/closure/emissive.h
M   intern/cycles/kernel/closure/volume.h
M   intern/cycles/kernel/geom/curve.h
M   intern/cycles/kernel/geom/curve_intersect.h
M   intern/cycles/kernel/geom/shader_data.h
M   intern/cycles/kernel/integrator/guiding.h
M   intern/cycles/kernel/integrator/mnee.h
M   intern/cycles/kernel/integrator/shade_surface.h
M   intern/cycles/kernel/integrator/shade_volume.h
M   intern/cycles/kernel/integrator/surface_shader.h
M   intern/cycles/kernel/integrator/volume_shader.h
M   intern/cycles/kernel/light/triangle.h
M   intern/cycles/kernel/osl/closures_setup.h
M   intern/cycles/kernel/osl/osl.h
M   intern/cycles/kernel/osl/services.cpp
M   intern/cycles/kernel/osl/shaders/node_principled_bsdf.osl
M   intern/cycles/kernel/sample/mapping.h
M   intern/cycles/kernel/svm/closure.h
M   intern/cycles/kernel/svm/displace.h
M   intern/cycles/kernel/svm/fresnel.h
M   intern/cycles/kernel/svm/geometry.h
M   intern/cycles/kernel/svm/tex_coord.h
M   intern/cycles/kernel/svm/wireframe.h
M   intern/cycles/kernel/types.h
M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   source/tools

===

diff --git a/intern/cycles/kernel/closure/bsdf.h 
b/intern/cycles/kernel/closure/bsdf.h
index 6de645cd1fe..2f53454d7dd 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -102,10 +102,9 @@ ccl_device_inline float shift_cos_in(float cos_in, const 
float frequency_multipl
   return val;
 }
 
-ccl_device_inline bool bsdf_is_transmission(ccl_private const ShaderClosure 
*sc,
-const float3 omega_in)
+ccl_device_inline bool bsdf_is_transmission(ccl_private const ShaderClosure 
*sc, const float3 wo)
 {
-  return dot(sc->N, omega_in) < 0.0f;
+  return dot(sc->N, wo) < 0.0f;
 }
 
 ccl_device_inline int bsdf_sample(KernelGlobals kg,
@@ -114,7 +113,7 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
   float randu,
   float randv,
   ccl_private Spectrum *eval,
-  ccl_private float3 *omega_in,
+  ccl_private float3 *wo,
   ccl_private float *pdf,
   ccl_private float2 *sampled_roughness,
   ccl_private float *eta)
@@ -126,43 +125,43 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
 
   switch (sc->type) {
 case CLOSURE_BSDF_DIFFUSE_ID:
-  label = bsdf_diffuse_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, 
pdf);
+  label = bsdf_diffuse_sample(sc, Ng, sd->wi, randu, randv, eval, wo, pdf);
   *sampled_roughness = one_float2();
   *eta = 1.0f;
   break;
 #if defined(__SVM__) || defined(__OSL__)
 case CLOSURE_BSDF_OREN_NAYAR_ID:
-  label = bsdf_oren_nayar_sample(sc, Ng, sd->I, randu, randv, eval, 
omega_in, pdf);
+  label = bsdf_oren_nayar_sample(sc, Ng, sd->wi, randu, randv, eval, wo, 
pdf);
   *sampled_roughness = one_float2();
   *eta = 1.0f;
   break;
 #  ifdef __OSL__
 case CLOSURE_BSDF_PHONG_RAMP_ID:
   label = bsd

[Bf-blender-cvs] [34326fec027] master: Fix: sample index node outputs default value

2023-01-17 Thread Jacques Lucke
Commit: 34326fec02709ffaeba4d4b59f24cb0c53e721a8
Author: Jacques Lucke
Date:   Tue Jan 17 18:29:25 2023 +0100
Branches: master
https://developer.blender.org/rB34326fec02709ffaeba4d4b59f24cb0c53e721a8

Fix: sample index node outputs default value

Error in rBb5105085139227a713f154446ff6a3255cb8be99.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc 
b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
index 850b2cfdd66..2ac19b02f9c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
@@ -323,7 +323,7 @@ static void node_geo_exec(GeoNodeExecParams params)
 const GVArray &data = evaluator.get_evaluated(0);
 BUFFER_FOR_CPP_TYPE_VALUE(cpp_type, buffer);
 data.get_to_uninitialized(index, buffer);
-output_field = fn::make_constant_field(cpp_type, cpp_type.default_value());
+output_field = fn::make_constant_field(cpp_type, buffer);
 cpp_type.destruct(buffer);
   }
   else {

___
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] [1d253b66525] master: Fix T103945: incorrect anonymous attribute references

2023-01-17 Thread Jacques Lucke
Commit: 1d253b6652518a68731a5d8a5909c8b29174b894
Author: Jacques Lucke
Date:   Tue Jan 17 18:40:28 2023 +0100
Branches: master
https://developer.blender.org/rB1d253b6652518a68731a5d8a5909c8b29174b894

Fix T103945: incorrect anonymous attribute references

The case where the same field group input is evaluated on
more than one geometry inputs was not handled correctly.

===

M   source/blender/nodes/intern/geometry_nodes_lazy_function.cc

===

diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc 
b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
index 4aec8d405ea..54f8c3c912d 100644
--- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
+++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
@@ -2250,15 +2250,18 @@ struct GeometryNodesLazyFunctionGraphBuilder {
   AttributeReferenceKey key;
   key.type = AttributeReferenceKeyType::InputField;
   key.index = relation.field_input;
-  r_attribute_reference_keys.add_new(key);
-  AttributeReferenceInfo info;
-  lf::OutputSocket &lf_field_socket = *const_cast(
-  mapping_->group_input_sockets[relation.field_input]);
-  info.lf_attribute_set_socket = &add_get_attributes_node(lf_field_socket);
+  const int key_index = r_attribute_reference_keys.index_of_or_add(key);
+  if (key_index >= r_attribute_reference_infos.size()) {
+AttributeReferenceInfo info;
+lf::OutputSocket &lf_field_socket = *const_cast(
+mapping_->group_input_sockets[relation.field_input]);
+info.lf_attribute_set_socket = 
&add_get_attributes_node(lf_field_socket);
+r_attribute_reference_infos.append(info);
+  }
+  AttributeReferenceInfo &info = r_attribute_reference_infos[key_index];
   for (const bNode *bnode : btree_.group_input_nodes()) {
 
info.initial_geometry_sockets.append(&bnode->output_socket(relation.geometry_input));
   }
-  r_attribute_reference_infos.append(std::move(info));
 }
 /* Find group outputs that attributes need to be propagated to. */
 for (const aal::PropagateRelation &relation : 
tree_relations.propagate_relations) {

___
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] [665732115ec] master: Gitea: add separate issue templates for bug, design and todo

2023-01-17 Thread Brecht Van Lommel
Commit: 665732115ec5779e121333fb3a9f34f141c1d06b
Author: Brecht Van Lommel
Date:   Tue Jan 17 19:31:00 2023 +0100
Branches: master
https://developer.blender.org/rB665732115ec5779e121333fb3a9f34f141c1d06b

Gitea: add separate issue templates for bug, design and todo

===

R099.gitea/issue_template.yaml  .gitea/issue_template/bug.yaml
A   .gitea/issue_template/design.yaml
A   .gitea/issue_template/todo.yaml

===

diff --git a/.gitea/issue_template.yaml b/.gitea/issue_template/bug.yaml
similarity index 99%
rename from .gitea/issue_template.yaml
rename to .gitea/issue_template/bug.yaml
index 08b98a0112e..41cc6a4ed74 100644
--- a/.gitea/issue_template.yaml
+++ b/.gitea/issue_template/bug.yaml
@@ -27,6 +27,7 @@ body:
 If a report is tagged with Needs Information from User and it 
has no reply after a week, we will assume the issue is gone and close the 
report.
 
   - type: textarea
+id: body
 attributes:
   label: "Description"
   value: |
diff --git a/.gitea/issue_template/design.yaml 
b/.gitea/issue_template/design.yaml
new file mode 100644
index 000..b482c8fad42
--- /dev/null
+++ b/.gitea/issue_template/design.yaml
@@ -0,0 +1,10 @@
+name: Design
+about: Create a design task (for developers only)
+labels:
+  - design
+ref: master
+body:
+  - type: textarea
+id: body
+attributes:
+  label: "Description"
diff --git a/.gitea/issue_template/todo.yaml b/.gitea/issue_template/todo.yaml
new file mode 100644
index 000..8c08d897b2b
--- /dev/null
+++ b/.gitea/issue_template/todo.yaml
@@ -0,0 +1,10 @@
+name: To Do
+about: Create a to do task (for developers only)
+labels:
+  - todo
+ref: master
+body:
+  - type: textarea
+id: body
+attributes:
+  label: "Description"

___
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] [df545612337] master: Cleanup: Fix incorrect comments in mesh extrude node

2023-01-17 Thread Hans Goudey
Commit: df5456123377cb5ad5940af1b9a71ede481309d3
Author: Hans Goudey
Date:   Tue Jan 17 12:17:07 2023 -0600
Branches: master
https://developer.blender.org/rBdf5456123377cb5ad5940af1b9a71ede481309d3

Cleanup: Fix incorrect comments in mesh extrude node

===

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 29a5cb9b83c..28691252729 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@ -87,10 +87,6 @@ static void save_selection_as_attribute(Mesh &mesh,
   attribute.finish();
 }
 
-/**
- * \note Some areas in this file rely on the new sections of attributes from 
#CustomData_realloc
- * to be zeroed.
- */
 static void expand_mesh(Mesh &mesh,
 const int vert_expand,
 const int edge_expand,
@@ -389,7 +385,7 @@ static void extrude_mesh_edges(Mesh &mesh,
   const Array> edge_to_poly_map = 
mesh_calculate_polys_of_edge(mesh);
 
   /* Find the offsets on the vertex domain for translation. This must be done 
before the mesh's
-   * custom data layers are reallocated, in case the virtual array references 
on of them. */
+   * custom data layers are reallocated, in case the virtual array references 
one of them. */
   Array vert_offsets;
   if (!edge_offsets.is_single()) {
 vert_offsets.reinitialize(orig_vert_size);
@@ -1367,8 +1363,6 @@ static void node_geo_exec(GeoNodeExecParams params)
   break;
 }
   }
-
-  BLI_assert(BKE_mesh_is_valid(mesh));
 }
   });

___
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] [d76a0e98bae] master: Fix: Avoid node reevaluations for selection and parenting

2023-01-17 Thread Hans Goudey
Commit: d76a0e98baecfca4e691fd29bcf027d8cc1e07bf
Author: Hans Goudey
Date:   Tue Jan 17 12:16:38 2023 -0600
Branches: master
https://developer.blender.org/rBd76a0e98baecfca4e691fd29bcf027d8cc1e07bf

Fix: Avoid node reevaluations for selection and parenting

Since 90ea1b76434fe175e9, node trees have been reevaluated
after many selection operations because nodes are sorted based on
the selection status and an update tag was added for that. However,
for years the node order was allowed to be different between the
original and evaluated copy of node trees.

Though it is a bit sketchy to have that difference in the evaluated
node tree, reevaluations for just selection are very bad, so use a
"smaller" update tag and add a comment for justification.

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

===

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

===

diff --git a/source/blender/blenkernel/intern/node_tree_update.cc 
b/source/blender/blenkernel/intern/node_tree_update.cc
index 2943bea830b..374d67bbfa8 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -1131,7 +1131,11 @@ void BKE_ntree_update_tag_node_removed(bNodeTree *ntree)
 
 void BKE_ntree_update_tag_node_reordered(bNodeTree *ntree)
 {
-  add_tree_tag(ntree, NTREE_CHANGED_ANY);
+  /* Don't add a tree update tag to avoid reevaluations for trivial operations 
like selection or
+   * parenting that typically influence the node order. This means the node 
order can be different
+   * for original and evaluated trees. A different solution might avoid 
sorting nodes based on UI
+   * states like selection, which would require not tying the node order to 
the drawing order. */
+  ntree->runtime->topology_cache_mutex.tag_dirty();
 }
 
 void BKE_ntree_update_tag_node_mute(bNodeTree *ntree, bNode *node)

___
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] [85ea74ad77e] master: Cleanup: Remove unnecessary curves RNA verification disabling

2023-01-17 Thread Hans Goudey
Commit: 85ea74ad77ee067d037630bd59deda62e99aab4e
Author: Hans Goudey
Date:   Tue Jan 17 12:43:31 2023 -0600
Branches: master
https://developer.blender.org/rB85ea74ad77ee067d037630bd59deda62e99aab4e

Cleanup: Remove unnecessary curves RNA verification disabling

There is no SDNA data for `position_data` anymore after
e9f82d3dc7eebadcc52fdc43.

===

M   source/blender/makesrna/intern/rna_curves.c

===

diff --git a/source/blender/makesrna/intern/rna_curves.c 
b/source/blender/makesrna/intern/rna_curves.c
index 4f298a9..3db4695a9b9 100644
--- a/source/blender/makesrna/intern/rna_curves.c
+++ b/source/blender/makesrna/intern/rna_curves.c
@@ -338,7 +338,6 @@ static void rna_def_curves(BlenderRNA *brna)
 
   /* Direct access to built-in attributes. */
 
-  RNA_define_verify_sdna(0);
   prop = RNA_def_property(srna, "position_data", PROP_COLLECTION, PROP_NONE);
   RNA_def_property_collection_funcs(prop,
 "rna_Curves_position_data_begin",
@@ -351,7 +350,6 @@ static void rna_def_curves(BlenderRNA *brna)
 NULL);
   RNA_def_property_struct_type(prop, "FloatVectorAttributeValue");
   RNA_def_property_update(prop, 0, "rna_Curves_update_data");
-  RNA_define_verify_sdna(1);
 
   prop = RNA_def_property(srna, "curve_offset_data", PROP_COLLECTION, 
PROP_NONE);
   RNA_def_property_collection_sdna(prop, NULL, "geometry.curve_offsets", NULL);

___
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] [d42d4e339f2] master: Cleanup: Remove unnecessary includes in geometry set header

2023-01-17 Thread Hans Goudey
Commit: d42d4e339f20a0eb95b9f333159edea446e8b364
Author: Hans Goudey
Date:   Tue Jan 17 12:45:51 2023 -0600
Branches: master
https://developer.blender.org/rBd42d4e339f20a0eb95b9f333159edea446e8b364

Cleanup: Remove unnecessary includes in geometry set header

===

M   source/blender/blenkernel/BKE_geometry_fields.hh
M   source/blender/blenkernel/BKE_geometry_set.hh
M   source/blender/blenkernel/BKE_geometry_set_instances.hh
M   source/blender/nodes/geometry/node_geometry_util.hh
M   source/blender/nodes/intern/node_socket.cc

===

diff --git a/source/blender/blenkernel/BKE_geometry_fields.hh 
b/source/blender/blenkernel/BKE_geometry_fields.hh
index 5f5333beb63..019ff41184b 100644
--- a/source/blender/blenkernel/BKE_geometry_fields.hh
+++ b/source/blender/blenkernel/BKE_geometry_fields.hh
@@ -8,7 +8,6 @@
  * Common field utilities and field definitions for geometry components.
  */
 
-#include "BKE_attribute.h"
 #include "BKE_geometry_set.hh"
 
 #include "FN_field.hh"
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh 
b/source/blender/blenkernel/BKE_geometry_set.hh
index 42d773055fa..f450ffe33e8 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -10,16 +10,12 @@
 #include 
 #include 
 
-#include "BLI_float4x4.hh"
 #include "BLI_function_ref.hh"
-#include "BLI_hash.hh"
 #include "BLI_map.hh"
 #include "BLI_math_vector_types.hh"
-#include "BLI_set.hh"
 #include "BLI_user_counter.hh"
 #include "BLI_vector_set.hh"
 
-#include "BKE_anonymous_attribute_id.hh"
 #include "BKE_attribute.hh"
 #include "BKE_geometry_set.h"
 
diff --git a/source/blender/blenkernel/BKE_geometry_set_instances.hh 
b/source/blender/blenkernel/BKE_geometry_set_instances.hh
index 6d4b9a2128c..3e9fb1d0379 100644
--- a/source/blender/blenkernel/BKE_geometry_set_instances.hh
+++ b/source/blender/blenkernel/BKE_geometry_set_instances.hh
@@ -2,6 +2,8 @@
 
 #pragma once
 
+#include "BLI_float4x4.hh"
+
 #include "BKE_geometry_set.hh"
 
 namespace blender::bke {
diff --git a/source/blender/nodes/geometry/node_geometry_util.hh 
b/source/blender/nodes/geometry/node_geometry_util.hh
index 68205c3ce6b..84dbd8e1fef 100644
--- a/source/blender/nodes/geometry/node_geometry_util.hh
+++ b/source/blender/nodes/geometry/node_geometry_util.hh
@@ -4,6 +4,7 @@
 
 #include 
 
+#include "BLI_float4x4.hh"
 #include "BLI_math_vector_types.hh"
 #include "BLI_utildefines.h"
 
diff --git a/source/blender/nodes/intern/node_socket.cc 
b/source/blender/nodes/intern/node_socket.cc
index 2fbf14b4760..814ad1c80e1 100644
--- a/source/blender/nodes/intern/node_socket.cc
+++ b/source/blender/nodes/intern/node_socket.cc
@@ -11,6 +11,7 @@
 
 #include "BLI_color.hh"
 #include "BLI_listbase.h"
+#include "BLI_math_vector.h"
 #include "BLI_math_vector_types.hh"
 #include "BLI_string.h"
 #include "BLI_utildefines.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] [dcb37959d46] master: Fix roation snap failing with zero angle

2023-01-17 Thread Germano Cavalcante
Commit: dcb37959d467cdf3d24e7e1d7ebec7c1a5e92925
Author: Germano Cavalcante
Date:   Tue Jan 17 17:21:39 2023 -0300
Branches: master
https://developer.blender.org/rBdcb37959d467cdf3d24e7e1d7ebec7c1a5e92925

Fix roation snap failing with zero angle

Due to precision issues, the cosine value calculated with
`dot_v3v3(start, end)` can be outside the -1, 1 range causing `acosf`
to return `nan(ind)`.

Use `angle_signed_on_axis_v3v3_v3` instead. It returns more accurate
values, deduplicates code, and avoids these `nan` issues.

===

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

===

diff --git a/source/blender/editors/transform/transform_mode_rotate.c 
b/source/blender/editors/transform/transform_mode_rotate.c
index 0a49fdefd83..713902f6c62 100644
--- a/source/blender/editors/transform/transform_mode_rotate.c
+++ b/source/blender/editors/transform/transform_mode_rotate.c
@@ -171,27 +171,11 @@ static float RotationBetween(TransInfo *t, const float 
p1[3], const float p2[3])
 
   /* Angle around a constraint axis (error prone, will need debug). */
   if (t->con.applyRot != NULL && (t->con.mode & CON_APPLY)) {
-float axis[3], tmp[3];
+float axis[3];
 
 t->con.applyRot(t, NULL, NULL, axis, NULL);
 
-project_v3_v3v3(tmp, end, axis);
-sub_v3_v3v3(end, end, tmp);
-
-project_v3_v3v3(tmp, start, axis);
-sub_v3_v3v3(start, start, tmp);
-
-normalize_v3(end);
-normalize_v3(start);
-
-cross_v3_v3v3(tmp, start, end);
-
-if (dot_v3v3(tmp, axis) < 0.0f) {
-  angle = -acosf(dot_v3v3(start, end));
-}
-else {
-  angle = acosf(dot_v3v3(start, end));
-}
+angle = -angle_signed_on_axis_v3v3_v3(start, end, axis);
   }
   else {
 float mtx[3][3];

___
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] [301119619c9] master: Curves: Remove attribute retrieval, deduplicate evaluation logic

2023-01-17 Thread Hans Goudey
Commit: 301119619c96aac2c6c3ec3a83bc16c5b3110469
Author: Hans Goudey
Date:   Tue Jan 17 14:40:01 2023 -0600
Branches: master
https://developer.blender.org/rB301119619c96aac2c6c3ec3a83bc16c5b3110469

Curves: Remove attribute retrieval, deduplicate evaluation logic

Avoid calling `interpolate_to_evaluate` while evaluating normals,
which has to look up attributes by name for every curve. Also avoid
duplicating the curve type switch in a few functions. I didn't observe
a performance difference, but theoretically this could reduce
overhead for many small curves.

===

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

===

diff --git a/source/blender/blenkernel/intern/curves_geometry.cc 
b/source/blender/blenkernel/intern/curves_geometry.cc
index 0dc6a24fd9e..133521bc298 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -716,14 +716,57 @@ static void 
rotate_directions_around_axes(MutableSpan directions,
   }
 }
 
+static void evaluate_generic_data_for_curve(
+const int curve_index,
+const IndexRange points,
+const VArray &types,
+const VArray &cyclic,
+const VArray &resolution,
+const Span bezier_evaluated_offsets,
+const Span nurbs_basis_cache,
+const VArray &nurbs_orders,
+const Span nurbs_weights,
+const GSpan src,
+GMutableSpan dst)
+{
+  switch (types[curve_index]) {
+case CURVE_TYPE_CATMULL_ROM:
+  curves::catmull_rom::interpolate_to_evaluated(
+  src, cyclic[curve_index], resolution[curve_index], dst);
+  break;
+case CURVE_TYPE_POLY:
+  dst.copy_from(src);
+  break;
+case CURVE_TYPE_BEZIER:
+  curves::bezier::interpolate_to_evaluated(src, 
bezier_evaluated_offsets.slice(points), dst);
+  break;
+case CURVE_TYPE_NURBS:
+  curves::nurbs::interpolate_to_evaluated(nurbs_basis_cache[curve_index],
+  nurbs_orders[curve_index],
+  nurbs_weights.slice_safe(points),
+  src,
+  dst);
+  break;
+  }
+}
+
 Span CurvesGeometry::evaluated_normals() const
 {
   this->runtime->normal_cache_mutex.ensure([&]() {
-const Span evaluated_tangents = this->evaluated_tangents();
+const VArray types = this->curve_types();
 const VArray cyclic = this->cyclic();
 const VArray normal_mode = this->normal_mode();
-const VArray types = this->curve_types();
+const VArray resolution = this->resolution();
+const VArray nurbs_orders = this->nurbs_orders();
+const Span nurbs_weights = this->nurbs_weights();
+
+const Span evaluated_tangents = this->evaluated_tangents();
 const VArray tilt = this->tilt();
+VArraySpan tilt_span;
+const bool use_tilt = !(tilt.is_single() && tilt.get_internal_single() == 
0.0f);
+if (use_tilt) {
+  tilt_span = tilt;
+}
 
 this->runtime->evaluated_normal_cache.resize(this->evaluated_points_num());
 MutableSpan evaluated_normals = 
this->runtime->evaluated_normal_cache;
@@ -748,19 +791,26 @@ Span CurvesGeometry::evaluated_normals() const
 
 /* If the "tilt" attribute exists, rotate the normals around the 
tangents by the
  * evaluated angles. We can avoid copying the tilts to evaluate them 
for poly curves. */
-if (!(tilt.is_single() && tilt.get_internal_single() == 0.0f)) {
+if (use_tilt) {
   const IndexRange points = this->points_for_curve(curve_index);
-  Span curve_tilt = tilt.get_internal_span().slice(points);
   if (types[curve_index] == CURVE_TYPE_POLY) {
 
rotate_directions_around_axes(evaluated_normals.slice(evaluated_points),
   
evaluated_tangents.slice(evaluated_points),
-  curve_tilt);
+  tilt_span.slice(points));
   }
   else {
-evaluated_tilts.clear();
-evaluated_tilts.resize(evaluated_points.size());
-this->interpolate_to_evaluated(
-curve_index, curve_tilt, evaluated_tilts.as_mutable_span());
+evaluated_tilts.reinitialize(evaluated_points.size());
+evaluate_generic_data_for_curve(curve_index,
+points,
+types,
+cyclic,
+resolution,
+
this->runtime->bezier_evaluated_offsets.as_span(),
+
this->runtime->nurbs_basis_cache.as_span(),
+nurbs_orders,
+   

[Bf-blender-cvs] [0d43e832235] temp-offset-array-ref: initial offset array

2023-01-17 Thread Jacques Lucke
Commit: 0d43e832235e1abde3a2acfde2b64006b0549868
Author: Jacques Lucke
Date:   Tue Jan 17 22:25:47 2023 +0100
Branches: temp-offset-array-ref
https://developer.blender.org/rB0d43e832235e1abde3a2acfde2b64006b0549868

initial offset array

===

M   source/blender/blenkernel/BKE_curves.hh
A   source/blender/blenlib/BLI_offset_array_ref.hh
M   source/blender/geometry/intern/trim_curves.cc
M   
source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
M   
source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc

===

diff --git a/source/blender/blenkernel/BKE_curves.hh 
b/source/blender/blenkernel/BKE_curves.hh
index 1ed872c8ab8..1530b2ea7eb 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -18,6 +18,7 @@
 #include "BLI_generic_virtual_array.hh"
 #include "BLI_index_mask.hh"
 #include "BLI_math_vector_types.hh"
+#include "BLI_offset_array_ref.hh"
 #include "BLI_shared_cache.hh"
 #include "BLI_span.hh"
 #include "BLI_task.hh"
@@ -176,6 +177,11 @@ class CurvesGeometry : public ::CurvesGeometry {
   Span offsets() const;
   MutableSpan offsets_for_write();
 
+  /**
+   * The offsets of every curve into arrays on the points domain.
+   */
+  OffsetArrayRef points_by_curve() const;
+
   /**
* Access a range of indices of point data for a specific curve.
*/
@@ -884,6 +890,11 @@ inline const std::array 
&CurvesGeometry::curve_type_counts
   return this->runtime->type_counts;
 }
 
+inline OffsetArrayRef CurvesGeometry::points_by_curve() const
+{
+  return OffsetArrayRef({this->curve_offsets, this->curve_num + 1});
+}
+
 inline IndexRange CurvesGeometry::points_for_curve(const int index) const
 {
   /* Offsets are not allocated when there are no curves. */
diff --git a/source/blender/blenlib/BLI_offset_array_ref.hh 
b/source/blender/blenlib/BLI_offset_array_ref.hh
new file mode 100644
index 000..39d4386faab
--- /dev/null
+++ b/source/blender/blenlib/BLI_offset_array_ref.hh
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "BLI_index_range.hh"
+#include "BLI_span.hh"
+
+namespace blender {
+
+template class OffsetArrayRef {
+ private:
+  static_assert(std::is_integral_v);
+
+  Span offsets_;
+
+ public:
+  OffsetArrayRef(const Span offsets) : offsets_(offsets)
+  {
+BLI_assert(std::is_sorted(offsets_.begin(), offsets_.end()));
+  }
+
+  IndexRange operator[](const int64_t index) const
+  {
+BLI_assert(index >= 0);
+BLI_assert(index < offsets_.size() - 1);
+const int64_t begin = offsets_[index];
+const int64_t end = offsets_[index + 1];
+const int64_t size = end - begin;
+return IndexRange(begin, size);
+  }
+
+  IndexRange operator[](const IndexRange indices) const
+  {
+const int64_t begin = offsets_[indices.start()];
+const int64_t end = offsets_[indices.one_after_last()];
+const int64_t size = end - begin;
+return IndexRange(begin, size);
+  }
+};
+
+}  // namespace blender
diff --git a/source/blender/geometry/intern/trim_curves.cc 
b/source/blender/geometry/intern/trim_curves.cc
index 361415aa540..b4b2b3e7d5f 100644
--- a/source/blender/geometry/intern/trim_curves.cc
+++ b/source/blender/geometry/intern/trim_curves.cc
@@ -617,11 +617,13 @@ static void trim_polygonal_curves(const 
bke::CurvesGeometry &src_curves,
 {
   const Span src_positions = src_curves.positions();
   MutableSpan dst_positions = dst_curves.positions_for_write();
+  const OffsetArrayRef src_points_by_curve = src_curves.points_by_curve();
+  const OffsetArrayRef dst_points_by_curve = dst_curves.points_by_curve();
 
   threading::parallel_for(selection.index_range(), 512, [&](const IndexRange 
range) {
 for (const int64_t curve_i : selection.slice(range)) {
-  const IndexRange src_points = src_curves.points_for_curve(curve_i);
-  const IndexRange dst_points = dst_curves.points_for_curve(curve_i);
+  const IndexRange src_points = src_points_by_curve[curve_i];
+  const IndexRange dst_points = dst_points_by_curve[curve_i];
 
   sample_interval_linear(src_positions.slice(src_points),
  dst_positions,
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
index 9f0d40bb0d7..f63d12e6c03 100644
--- 
a/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
+++ 
b/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
@@ -55,9 +55,10 @@ static void select_by_handle_type(const bke::CurvesGeometry 
&curves,
   VArray curve_types = curves.curve_types();
   VArray left = curves.handle_types_left();
   VArray right = curves.handle_types_right();
+  const OffsetArrayRef points_by_curve = curves.po

[Bf-blender-cvs] [737e7a63b16] master: Fix: incorrect curve type counts after adding curves of same type

2023-01-17 Thread Jacques Lucke
Commit: 737e7a63b1664d7cff0fdd9587ed6a4f2ccffe7e
Author: Jacques Lucke
Date:   Wed Jan 18 00:05:33 2023 +0100
Branches: master
https://developer.blender.org/rB737e7a63b1664d7cff0fdd9587ed6a4f2ccffe7e

Fix: incorrect curve type counts after adding curves of same type

===

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

===

diff --git a/source/blender/blenkernel/intern/curves_geometry.cc 
b/source/blender/blenkernel/intern/curves_geometry.cc
index 133521bc298..3d4f81019a7 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -263,7 +263,7 @@ void CurvesGeometry::fill_curve_types(const IndexMask 
selection, const CurveType
   }
   if (std::optional single_type = this->curve_types().get_if_single()) 
{
 if (single_type == type) {
-  /* No need for an array if the types are already a single with the 
correct type. */
+  this->fill_curve_types(type);
   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] [bdb34c98041] master: Gitea: add more complete pull request template

2023-01-17 Thread Brecht Van Lommel
Commit: bdb34c98041dd1185a9c5f599e89bf04cfa9c0ea
Author: Brecht Van Lommel
Date:   Wed Jan 18 01:33:33 2023 +0100
Branches: master
https://developer.blender.org/rBbdb34c98041dd1185a9c5f599e89bf04cfa9c0ea

Gitea: add more complete pull request template

===

D   .gitea/pull_request_template.md
A   .gitea/pull_request_template.yaml

===

diff --git a/.gitea/pull_request_template.md b/.gitea/pull_request_template.md
deleted file mode 100644
index a6614b8ef00..000
--- a/.gitea/pull_request_template.md
+++ /dev/null
@@ -1,4 +0,0 @@

-name: Pull Request
-about: Submit a pull request

diff --git a/.gitea/pull_request_template.yaml 
b/.gitea/pull_request_template.yaml
new file mode 100644
index 000..f7c3242f55c
--- /dev/null
+++ b/.gitea/pull_request_template.yaml
@@ -0,0 +1,19 @@
+name: Pull Request
+about: Contribute code to Blender
+ref: master
+body:
+  - type: markdown
+attributes:
+  value: |
+Guides to [Contributing 
Code](https://wiki.blender.org/index.php/Dev:Doc/Process/Contributing_Code) and 
effective [Code 
Review](https://wiki.blender.org/index.php/Dev:Doc/Tools/Code_Review).
+
+By submitting code here, **you agree that the code is (compatible 
with) GNU GPL v2 or later**.
+
+  - type: textarea
+id: body
+attributes:
+  label: "Description"
+  value: |
+   Description of the problem that is addressed in the patch.
+
+   Description of the proposed solution and its implementation.

___
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] [9179362e7b0] master: Geometry Nodes: Prefer evaluate at index value input in search

2023-01-17 Thread Hans Goudey
Commit: 9179362e7b05d334ec8490bcdd6d04c05af4a81a
Author: Hans Goudey
Date:   Tue Jan 17 19:43:36 2023 -0600
Branches: master
https://developer.blender.org/rB9179362e7b05d334ec8490bcdd6d04c05af4a81a

Geometry Nodes: Prefer evaluate at index value input in search

Give the "Value" input a higher search weight than the "Index"
input, since it's more likely that users will want to connect to
that. Based on feedback from Simon Thommes.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_evaluate_at_index.cc 
b/source/blender/nodes/geometry/nodes/node_geo_evaluate_at_index.cc
index 65f88f23aff..68d309c0bf4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_evaluate_at_index.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_evaluate_at_index.cc
@@ -131,9 +131,6 @@ static void node_update(bNodeTree *ntree, bNode *node)
 
 static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
 {
-  const NodeDeclaration &declaration = *params.node_type().fixed_declaration;
-  search_link_ops_for_declarations(params, 
declaration.inputs.as_span().take_front(1));
-
   const bNodeType &node_type = params.node_type();
   const std::optional type = 
node_data_type_to_custom_data_type(
   (eNodeSocketDatatype)params.other_socket().type);
@@ -143,6 +140,14 @@ static void 
node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
   node.custom2 = *type;
   params.update_and_connect_available_socket(node, "Value");
 });
+params.add_item(
+IFACE_("Index"),
+[node_type, type](LinkSearchOpParams ¶ms) {
+  bNode &node = params.add_node(node_type);
+  node.custom2 = *type;
+  params.update_and_connect_available_socket(node, "Index");
+},
+-1);
   }
 }

___
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] [d45ad0acd34] master: Geometry Nodes: Show supported geometry types tooltip without computing

2023-01-17 Thread Iliya Katueshenock
Commit: d45ad0acd344f5d8e2fcc2838c7f1525da24d246
Author: Iliya Katueshenock
Date:   Tue Jan 17 19:25:26 2023 -0600
Branches: master
https://developer.blender.org/rBd45ad0acd344f5d8e2fcc2838c7f1525da24d246

Geometry Nodes: Show supported geometry types tooltip without computing

Socket declarations exist all the time and it would be useful to use
them for tooltips at all times, not just when there is a computed log.

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

===

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

===

diff --git a/source/blender/editors/space_node/node_draw.cc 
b/source/blender/editors/space_node/node_draw.cc
index ef284c3e3bf..d3b34c408cf 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -900,8 +900,7 @@ static void create_inspection_string_for_field_info(const 
bNodeSocket &socket,
 }
 
 static void create_inspection_string_for_geometry_info(const 
geo_log::GeometryInfoLog &value_log,
-   std::stringstream &ss,
-   const 
nodes::decl::Geometry *socket_decl)
+   std::stringstream &ss)
 {
   Span component_types = value_log.component_types;
   if (component_types.is_empty()) {
@@ -917,7 +916,6 @@ static void 
create_inspection_string_for_geometry_info(const geo_log::GeometryIn
 
   ss << TIP_("Geometry:\n");
   for (GeometryComponentType type : component_types) {
-const char *line_end = (type == component_types.last()) ? "" : ".\n";
 switch (type) {
   case GEO_COMPONENT_TYPE_MESH: {
 const geo_log::GeometryInfoLog::MeshInfo &mesh_info = 
*value_log.mesh_info;
@@ -928,7 +926,7 @@ static void 
create_inspection_string_for_geometry_info(const geo_log::GeometryIn
  to_string(mesh_info.verts_num).c_str(),
  to_string(mesh_info.edges_num).c_str(),
  to_string(mesh_info.faces_num).c_str());
-ss << line << line_end;
+ss << line;
 break;
   }
   case GEO_COMPONENT_TYPE_POINT_CLOUD: {
@@ -939,7 +937,7 @@ static void 
create_inspection_string_for_geometry_info(const geo_log::GeometryIn
  sizeof(line),
  TIP_("\u2022 Point Cloud: %s points"),
  to_string(pointcloud_info.points_num).c_str());
-ss << line << line_end;
+ss << line;
 break;
   }
   case GEO_COMPONENT_TYPE_CURVE: {
@@ -949,7 +947,7 @@ static void 
create_inspection_string_for_geometry_info(const geo_log::GeometryIn
  sizeof(line),
  TIP_("\u2022 Curve: %s splines"),
  to_string(curve_info.splines_num).c_str());
-ss << line << line_end;
+ss << line;
 break;
   }
   case GEO_COMPONENT_TYPE_INSTANCES: {
@@ -959,11 +957,11 @@ static void 
create_inspection_string_for_geometry_info(const geo_log::GeometryIn
  sizeof(line),
  TIP_("\u2022 Instances: %s"),
  to_string(instances_info.instances_num).c_str());
-ss << line << line_end;
+ss << line;
 break;
   }
   case GEO_COMPONENT_TYPE_VOLUME: {
-ss << TIP_("\u2022 Volume") << line_end;
+ss << TIP_("\u2022 Volume");
 break;
   }
   case GEO_COMPONENT_TYPE_EDIT: {
@@ -975,26 +973,38 @@ static void 
create_inspection_string_for_geometry_info(const geo_log::GeometryIn
TIP_("\u2022 Edit Curves: %s, %s"),
edit_info.has_deformed_positions ? TIP_("positions") : 
TIP_("no positions"),
edit_info.has_deform_matrices ? TIP_("matrices") : 
TIP_("no matrices"));
-  ss << line << line_end;
+  ss << line;
 }
 break;
   }
 }
+if (type != component_types.last()) {
+  ss << ".\n";
+}
   }
+}
 
+static void create_inspection_string_for_geometry_socket(std::stringstream &ss,
+ const 
nodes::decl::Geometry *socket_decl,
+ const bool after_log)
+{
   /* If the geometry declaration is null, as is the case for input to group 
output,
* or it is an output socket don't show supported types. */
   if (socket_decl == nullptr || socket_decl->in_out == SOCK_OUT) {
 return;
   }
 
+  if (after_log) {
+ss << ".\n\n";
+  }
+
   Span supported_types = socket_decl->supported_types();
   if (supported_types.is_empty()) {
-ss << ".\n\n" << TIP_("Supported: All Types");
+ss << TIP_("Supported: All Types");
 return;
   }
 
-  ss << ".\n\n" << TIP_("Supported: ");
+  ss << TIP_("Supported: ");
   for (Ge

[Bf-blender-cvs] [fd2bf32dc7d] master: Cleanup: use memset instead of clearing individual runtime members

2023-01-17 Thread Campbell Barton
Commit: fd2bf32dc7d15d34dc1b99dae1a8605f25db1951
Author: Campbell Barton
Date:   Wed Jan 18 14:10:29 2023 +1100
Branches: master
https://developer.blender.org/rBfd2bf32dc7d15d34dc1b99dae1a8605f25db1951

Cleanup: use memset instead of clearing individual runtime members

===

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

===

diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index 1ca870bd397..621d8e5df8e 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -209,10 +209,8 @@ static void collection_blend_write(BlendWriter *writer, ID 
*id, const void *id_a
   /* Clean up, important in undo case to reduce false detection of changed 
data-blocks. */
   collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
   collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED;
-  collection->runtime.tag = 0;
-  BLI_listbase_clear(&collection->runtime.object_cache);
-  BLI_listbase_clear(&collection->runtime.object_cache_instanced);
-  BLI_listbase_clear(&collection->runtime.parents);
+
+  memset(&collection->runtime, 0, sizeof(collection->runtime));
 
   /* write LibData */
   BLO_write_id_struct(writer, Collection, id_address, &collection->id);
@@ -259,6 +257,8 @@ void BKE_collection_blend_read_data(BlendDataReader 
*reader, Collection *collect
 }
 collection->id.flag |= LIB_EMBEDDED_DATA;
   }
+
+  memset(&collection->runtime, 0, sizeof(collection->runtime));
   collection->runtime.owner_id = owner_id;
 
   BLO_read_list(reader, &collection->gobject);
@@ -269,10 +269,6 @@ void BKE_collection_blend_read_data(BlendDataReader 
*reader, Collection *collect
 
   collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
   collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED;
-  collection->runtime.tag = 0;
-  BLI_listbase_clear(&collection->runtime.object_cache);
-  BLI_listbase_clear(&collection->runtime.object_cache_instanced);
-  BLI_listbase_clear(&collection->runtime.parents);
 
 #ifdef USE_COLLECTION_COMPAT_28
   /* This runs before the very first doversion. */

___
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] [b380d250538] master: Cleanup: define COLLECTION_FLAG_ALL_RUNTIME, use in file read/write

2023-01-17 Thread Campbell Barton
Commit: b380d25053801670502d3d1a7f9e9ff4eeb44811
Author: Campbell Barton
Date:   Wed Jan 18 14:16:36 2023 +1100
Branches: master
https://developer.blender.org/rBb380d25053801670502d3d1a7f9e9ff4eeb44811

Cleanup: define COLLECTION_FLAG_ALL_RUNTIME, use in file read/write

===

M   source/blender/blenkernel/intern/collection.c
M   source/blender/makesdna/DNA_collection_types.h

===

diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index 621d8e5df8e..de785ddd38d 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -112,8 +112,7 @@ static void collection_copy_data(Main *bmain, ID *id_dst, 
const ID *id_src, cons
 collection_dst->preview = NULL;
   }
 
-  collection_dst->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
-  collection_dst->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED;
+  collection_dst->flag &= ~(COLLECTION_HAS_OBJECT_CACHE | 
COLLECTION_HAS_OBJECT_CACHE_INSTANCED);
   BLI_listbase_clear(&collection_dst->runtime.object_cache);
   BLI_listbase_clear(&collection_dst->runtime.object_cache_instanced);
 
@@ -206,11 +205,9 @@ static void collection_blend_write(BlendWriter *writer, ID 
*id, const void *id_a
 {
   Collection *collection = (Collection *)id;
 
-  /* Clean up, important in undo case to reduce false detection of changed 
data-blocks. */
-  collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
-  collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED;
-
   memset(&collection->runtime, 0, sizeof(collection->runtime));
+  /* Clean up, important in undo case to reduce false detection of changed 
data-blocks. */
+  collection->flag &= ~COLLECTION_FLAG_ALL_RUNTIME;
 
   /* write LibData */
   BLO_write_id_struct(writer, Collection, id_address, &collection->id);
@@ -259,6 +256,8 @@ void BKE_collection_blend_read_data(BlendDataReader 
*reader, Collection *collect
   }
 
   memset(&collection->runtime, 0, sizeof(collection->runtime));
+  collection->flag &= ~COLLECTION_FLAG_ALL_RUNTIME;
+
   collection->runtime.owner_id = owner_id;
 
   BLO_read_list(reader, &collection->gobject);
@@ -267,9 +266,6 @@ void BKE_collection_blend_read_data(BlendDataReader 
*reader, Collection *collect
   BLO_read_data_address(reader, &collection->preview);
   BKE_previewimg_blend_read(reader, collection->preview);
 
-  collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
-  collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED;
-
 #ifdef USE_COLLECTION_COMPAT_28
   /* This runs before the very first doversion. */
   BLO_read_data_address(reader, &collection->collection);
@@ -842,8 +838,7 @@ ListBase 
BKE_collection_object_cache_instanced_get(Collection *collection)
 static void collection_object_cache_free(Collection *collection)
 {
   /* Clear own cache an for all parents, since those are affected by changes 
as well. */
-  collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
-  collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED;
+  collection->flag &= ~(COLLECTION_HAS_OBJECT_CACHE | 
COLLECTION_HAS_OBJECT_CACHE_INSTANCED);
   BLI_freelistN(&collection->runtime.object_cache);
   BLI_freelistN(&collection->runtime.object_cache_instanced);
 
diff --git a/source/blender/makesdna/DNA_collection_types.h 
b/source/blender/makesdna/DNA_collection_types.h
index d97d3d17182..8ec6626f4b3 100644
--- a/source/blender/makesdna/DNA_collection_types.h
+++ b/source/blender/makesdna/DNA_collection_types.h
@@ -113,6 +113,9 @@ enum {
   COLLECTION_HAS_OBJECT_CACHE_INSTANCED = (1 << 6),
 };
 
+#define COLLECTION_FLAG_ALL_RUNTIME \
+  (COLLECTION_HAS_OBJECT_CACHE | COLLECTION_HAS_OBJECT_CACHE_INSTANCED)
+
 /** #Collection_Runtime.tag */
 enum {
   /**

___
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] [44dd3308a5b] master: DNA: move Collection members into their own Runtime struct

2023-01-17 Thread Campbell Barton
Commit: 44dd3308a5b66fbd9bc4dc39304690f64da8d971
Author: Campbell Barton
Date:   Wed Jan 18 13:47:00 2023 +1100
Branches: master
https://developer.blender.org/rB44dd3308a5b66fbd9bc4dc39304690f64da8d971

DNA: move Collection members into their own Runtime struct

Also add static assert that COLLECTION_COLOR_TOT has the correct number
of items in the enum.

===

M   source/blender/blenkernel/intern/blendfile_link_append.c
M   source/blender/blenkernel/intern/collection.c
M   source/blender/blenkernel/intern/layer.cc
M   source/blender/blenkernel/intern/scene.cc
M   source/blender/editors/interface/interface_templates.cc
M   source/blender/editors/object/object_relations.c
M   source/blender/editors/space_outliner/outliner_collections.cc
M   source/blender/editors/space_outliner/outliner_dragdrop.cc
M   source/blender/editors/space_outliner/outliner_draw.cc
M   source/blender/editors/space_outliner/tree/tree_display_libraries.cc
M   source/blender/makesdna/DNA_collection_types.h
M   source/blender/makesrna/intern/rna_collection.c

===

diff --git a/source/blender/blenkernel/intern/blendfile_link_append.c 
b/source/blender/blenkernel/intern/blendfile_link_append.c
index 3f3c1028d10..49b480fcb64 100644
--- a/source/blender/blenkernel/intern/blendfile_link_append.c
+++ b/source/blender/blenkernel/intern/blendfile_link_append.c
@@ -574,7 +574,8 @@ static void loose_data_instantiate_obdata_preprocess(
  * (return false). */
 static bool 
loose_data_instantiate_collection_parents_check_recursive(Collection 
*collection)
 {
-  for (CollectionParent *parent_collection = collection->parents.first; 
parent_collection != NULL;
+  for (CollectionParent *parent_collection = collection->runtime.parents.first;
+   parent_collection != NULL;
parent_collection = parent_collection->next) {
 if ((parent_collection->collection->id.tag & LIB_TAG_DOIT) != 0) {
   return true;
diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index 53ef78525c2..1ca870bd397 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -114,12 +114,12 @@ static void collection_copy_data(Main *bmain, ID *id_dst, 
const ID *id_src, cons
 
   collection_dst->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
   collection_dst->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED;
-  BLI_listbase_clear(&collection_dst->object_cache);
-  BLI_listbase_clear(&collection_dst->object_cache_instanced);
+  BLI_listbase_clear(&collection_dst->runtime.object_cache);
+  BLI_listbase_clear(&collection_dst->runtime.object_cache_instanced);
 
   BLI_listbase_clear(&collection_dst->gobject);
   BLI_listbase_clear(&collection_dst->children);
-  BLI_listbase_clear(&collection_dst->parents);
+  BLI_listbase_clear(&collection_dst->runtime.parents);
 
   LISTBASE_FOREACH (CollectionChild *, child, &collection_src->children) {
 collection_child_add(collection_dst, child->collection, flag, false);
@@ -138,7 +138,7 @@ static void collection_free_data(ID *id)
 
   BLI_freelistN(&collection->gobject);
   BLI_freelistN(&collection->children);
-  BLI_freelistN(&collection->parents);
+  BLI_freelistN(&collection->runtime.parents);
 
   BKE_collection_object_cache_free(collection);
 }
@@ -148,7 +148,7 @@ static void collection_foreach_id(ID *id, 
LibraryForeachIDData *data)
   Collection *collection = (Collection *)id;
 
   BKE_LIB_FOREACHID_PROCESS_ID(
-  data, collection->owner_id, IDWALK_CB_LOOPBACK | IDWALK_CB_NEVER_SELF);
+  data, collection->runtime.owner_id, IDWALK_CB_LOOPBACK | 
IDWALK_CB_NEVER_SELF);
 
   LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, cob->ob, IDWALK_CB_USER);
@@ -157,7 +157,7 @@ static void collection_foreach_id(ID *id, 
LibraryForeachIDData *data)
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(
 data, child->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_USER);
   }
-  LISTBASE_FOREACH (CollectionParent *, parent, &collection->parents) {
+  LISTBASE_FOREACH (CollectionParent *, parent, &collection->runtime.parents) {
 /* XXX This is very weak. The whole idea of keeping pointers to private 
IDs is very bad
  * anyway... */
 const int cb_flag = ((parent->collection != NULL &&
@@ -178,11 +178,12 @@ static ID **collection_owner_pointer_get(ID *id)
 
   Collection *master_collection = (Collection *)id;
   BLI_assert((master_collection->flag & COLLECTION_IS_MASTER) != 0);
-  BLI_assert(master_collection->owner_id != NULL);
-  BLI_assert(GS(master_collection->owner_id->name) == ID_SCE);
-  BLI_assert(((Scene *)master_collection->owner_id)->master_collection == 
master_collection);
+  BLI_assert(master_collection->runtime.owner_id != NULL);
+  BLI_assert(GS(master_collection->runtime.owner_id->n

[Bf-blender-cvs] [1c470dbd721] master: Cleanup: replace BLI_findptr with BKE_collection_has_object

2023-01-17 Thread Campbell Barton
Commit: 1c470dbd7219a0edc2c06323b8144f9a22c50b72
Author: Campbell Barton
Date:   Wed Jan 18 15:43:20 2023 +1100
Branches: master
https://developer.blender.org/rB1c470dbd7219a0edc2c06323b8144f9a22c50b72

Cleanup: replace BLI_findptr with BKE_collection_has_object

Also swap the order of checks in collection_object_add to perform
the comparison before calling collection_find_child_recursive.

===

M   source/blender/blenkernel/intern/collection.c
M   source/blender/editors/object/object_edit.c

===

diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index de785ddd38d..8b430546644 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -1064,8 +1064,8 @@ static bool collection_object_add(
 {
   if (ob->instance_collection) {
 /* Cyclic dependency check. */
-if (collection_find_child_recursive(ob->instance_collection, collection) ||
-ob->instance_collection == collection) {
+if ((ob->instance_collection == collection) ||
+collection_find_child_recursive(ob->instance_collection, collection)) {
   return false;
 }
   }
diff --git a/source/blender/editors/object/object_edit.c 
b/source/blender/editors/object/object_edit.c
index e9b176daf4a..b1cebc32513 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1876,8 +1876,7 @@ static int move_to_collection_exec(bContext *C, 
wmOperator *op)
   Object *single_object = BLI_listbase_is_single(&objects) ? ((LinkData 
*)objects.first)->data :
  NULL;
 
-  if ((single_object != NULL) && is_link &&
-  BLI_findptr(&collection->gobject, single_object, 
offsetof(CollectionObject, ob))) {
+  if ((single_object != NULL) && is_link && 
BKE_collection_has_object(collection, single_object)) {
 BKE_reportf(op->reports,
 RPT_ERROR,
 "%s already in %s",

___
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] [988bc3dddf7] master: Cleanup: keep dna_rename_defs sorted

2023-01-17 Thread Campbell Barton
Commit: 988bc3dddf741ee95d154e0049eb96fb48006c12
Author: Campbell Barton
Date:   Wed Jan 18 17:17:29 2023 +1100
Branches: master
https://developer.blender.org/rB988bc3dddf741ee95d154e0049eb96fb48006c12

Cleanup: keep dna_rename_defs sorted

===

M   source/blender/makesdna/intern/dna_rename_defs.h

===

diff --git a/source/blender/makesdna/intern/dna_rename_defs.h 
b/source/blender/makesdna/intern/dna_rename_defs.h
index dce7d353fe6..e5057755995 100644
--- a/source/blender/makesdna/intern/dna_rename_defs.h
+++ b/source/blender/makesdna/intern/dna_rename_defs.h
@@ -84,33 +84,33 @@ DNA_STRUCT_RENAME_ELEM(LineartGpencilModifierData, 
line_types, edge_types)
 DNA_STRUCT_RENAME_ELEM(LineartGpencilModifierData, transparency_flags, 
mask_switches)
 DNA_STRUCT_RENAME_ELEM(LineartGpencilModifierData, transparency_mask, 
material_mask_bits)
 DNA_STRUCT_RENAME_ELEM(MDefCell, totinfluence, influences_num)
+DNA_STRUCT_RENAME_ELEM(MEdge, bweight, bweight_legacy)
+DNA_STRUCT_RENAME_ELEM(MEdge, crease, crease_legacy)
+DNA_STRUCT_RENAME_ELEM(MPoly, mat_nr, mat_nr_legacy)
+DNA_STRUCT_RENAME_ELEM(MVert, bweight, bweight_legacy)
+DNA_STRUCT_RENAME_ELEM(MVert, co, co_legacy)
+DNA_STRUCT_RENAME_ELEM(MVert, flag, flag_legacy)
 DNA_STRUCT_RENAME_ELEM(MaskLayer, restrictflag, visibility_flag)
 DNA_STRUCT_RENAME_ELEM(MaterialLineArt, transparency_mask, material_mask_bits)
 DNA_STRUCT_RENAME_ELEM(MeshDeformModifierData, totcagevert, cage_verts_num)
 DNA_STRUCT_RENAME_ELEM(MeshDeformModifierData, totinfluence, influences_num)
 DNA_STRUCT_RENAME_ELEM(MeshDeformModifierData, totvert, verts_num)
 DNA_STRUCT_RENAME_ELEM(MovieClip, name, filepath)
-DNA_STRUCT_RENAME_ELEM(MovieTracking, tracks, tracks_legacy)
+DNA_STRUCT_RENAME_ELEM(MovieTracking, act_plane_track, act_plane_track_legacy)
+DNA_STRUCT_RENAME_ELEM(MovieTracking, act_track, act_track_legacy)
 DNA_STRUCT_RENAME_ELEM(MovieTracking, plane_tracks, plane_tracks_legacy)
 DNA_STRUCT_RENAME_ELEM(MovieTracking, reconstruction, reconstruction_legacy)
-DNA_STRUCT_RENAME_ELEM(MovieTracking, act_track, act_track_legacy)
-DNA_STRUCT_RENAME_ELEM(MovieTracking, act_plane_track, act_plane_track_legacy)
+DNA_STRUCT_RENAME_ELEM(MovieTracking, tracks, tracks_legacy)
 DNA_STRUCT_RENAME_ELEM(MovieTrackingCamera, principal, principal_legacy)
 DNA_STRUCT_RENAME_ELEM(NodeCryptomatte, num_inputs, inputs_num)
 DNA_STRUCT_RENAME_ELEM(Object, col, color)
 DNA_STRUCT_RENAME_ELEM(Object, dup_group, instance_collection)
 DNA_STRUCT_RENAME_ELEM(Object, dupfacesca, instance_faces_scale)
+DNA_STRUCT_RENAME_ELEM(Object, imat, world_to_object)
+DNA_STRUCT_RENAME_ELEM(Object, obmat, object_to_world)
 DNA_STRUCT_RENAME_ELEM(Object, restrictflag, visibility_flag)
 DNA_STRUCT_RENAME_ELEM(Object, size, scale)
-DNA_STRUCT_RENAME_ELEM(Object, obmat, object_to_world)
-DNA_STRUCT_RENAME_ELEM(Object, imat, world_to_object)
 DNA_STRUCT_RENAME_ELEM(Object_Runtime, crazyspace_num_verts, 
crazyspace_verts_num)
-DNA_STRUCT_RENAME_ELEM(MEdge, bweight, bweight_legacy)
-DNA_STRUCT_RENAME_ELEM(MEdge, crease, crease_legacy)
-DNA_STRUCT_RENAME_ELEM(MPoly, mat_nr, mat_nr_legacy)
-DNA_STRUCT_RENAME_ELEM(MVert, co, co_legacy)
-DNA_STRUCT_RENAME_ELEM(MVert, bweight, bweight_legacy)
-DNA_STRUCT_RENAME_ELEM(MVert, flag, flag_legacy)
 DNA_STRUCT_RENAME_ELEM(ParticleSettings, child_nbr, child_percent)
 DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_group, instance_collection)
 DNA_STRUCT_RENAME_ELEM(ParticleSettings, dup_ob, instance_object)

___
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] [07af7e22666] master: Cleanup: remove unused MetaBalle.disp & rot

2023-01-17 Thread Campbell Barton
Commit: 07af7e2266676f2493b593d0c69e8668571dd0cf
Author: Campbell Barton
Date:   Wed Jan 18 17:17:31 2023 +1100
Branches: master
https://developer.blender.org/rB07af7e2266676f2493b593d0c69e8668571dd0cf

Cleanup: remove unused MetaBalle.disp & rot

===

M   source/blender/blenkernel/intern/mball.cc
M   source/blender/makesdna/DNA_meta_types.h

===

diff --git a/source/blender/blenkernel/intern/mball.cc 
b/source/blender/blenkernel/intern/mball.cc
index c1421db913d..c5025e51eb8 100644
--- a/source/blender/blenkernel/intern/mball.cc
+++ b/source/blender/blenkernel/intern/mball.cc
@@ -85,9 +85,6 @@ static void metaball_free_data(ID *id)
   MEM_SAFE_FREE(metaball->mat);
 
   BLI_freelistN(&metaball->elems);
-  if (metaball->disp.first) {
-BKE_displist_free(&metaball->disp);
-  }
 }
 
 static void metaball_foreach_id(ID *id, LibraryForeachIDData *data)
@@ -103,7 +100,6 @@ static void metaball_blend_write(BlendWriter *writer, ID 
*id, const void *id_add
   MetaBall *mb = (MetaBall *)id;
 
   /* Clean up, important in undo case to reduce false detection of changed 
datablocks. */
-  BLI_listbase_clear(&mb->disp);
   mb->editelems = nullptr;
   /* Must always be cleared (meta's don't have their own edit-data). */
   mb->needs_flush_to_id = 0;
@@ -134,7 +130,6 @@ static void metaball_blend_read_data(BlendDataReader 
*reader, ID *id)
 
   BLO_read_list(reader, &(mb->elems));
 
-  BLI_listbase_clear(&mb->disp);
   mb->editelems = nullptr;
   /* Must always be cleared (meta's don't have their own edit-data). */
   mb->needs_flush_to_id = 0;
diff --git a/source/blender/makesdna/DNA_meta_types.h 
b/source/blender/makesdna/DNA_meta_types.h
index b4a66a46efe..5650fe91696 100644
--- a/source/blender/makesdna/DNA_meta_types.h
+++ b/source/blender/makesdna/DNA_meta_types.h
@@ -54,7 +54,6 @@ typedef struct MetaBall {
   struct AnimData *adt;
 
   ListBase elems;
-  ListBase disp;
   /** Not saved in files, note we use pointer for editmode check. */
   ListBase *editelems;
   /** Old animation system, deprecated for 2.5. */
@@ -76,10 +75,8 @@ typedef struct MetaBall {
*/
   char needs_flush_to_id;
 
-  /* texture space, copied as one block in editobject.c */
   float loc[3];
   float size[3];
-  float rot[3];
 
   /** Display and render res. */
   float wiresize, rendersize;
@@ -89,9 +86,11 @@ typedef struct MetaBall {
* but these may also have their own thresh as an offset */
   float thresh;
 
-  /* used in editmode */
-  // ListBase edit_elems;
+  char _pad0[4];
+
+  /** The active meta-element (used in edit-mode). */
   MetaElem *lastelem;
+
 } MetaBall;
 
 /*  METABALL * */

___
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] [9e5e2aa775a] master: Cleanup: rename Mesh/Curve/MetaBall loc/size/texflag

2023-01-17 Thread Campbell Barton
Commit: 9e5e2aa775a9d7082ee2a1da8468cd5f46760caa
Author: Campbell Barton
Date:   Wed Jan 18 17:17:32 2023 +1100
Branches: master
https://developer.blender.org/rB9e5e2aa775a9d7082ee2a1da8468cd5f46760caa

Cleanup: rename Mesh/Curve/MetaBall loc/size/texflag

Struct members loc/size were misleading as they read as if the object
data stored object level transform channels. Rename these to match RNA
with a `texspace_*` prefix to make it clear these struct members only
apply to texture-space transform.

Also rename ME_AUTOSPACE & ME_AUTOSPACE_EVALUATED to
ME_TEXSPACE_FLAG_AUTO & ME_TEXSPACE_FLAG_AUTO_EVALUATED.

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/intern/curve.cc
M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/blenkernel/intern/mesh_convert.cc
M   source/blender/blenkernel/intern/object.cc
M   source/blender/blenkernel/intern/particle.cc
M   source/blender/draw/engines/overlay/overlay_extra.cc
M   source/blender/draw/intern/draw_manager_data.cc
M   source/blender/draw/intern/draw_resource.hh
M   source/blender/editors/curve/editcurve.c
M   source/blender/editors/transform/transform_convert_object_texspace.c
M   source/blender/makesdna/DNA_curve_defaults.h
M   source/blender/makesdna/DNA_curve_types.h
M   source/blender/makesdna/DNA_mesh_defaults.h
M   source/blender/makesdna/DNA_mesh_types.h
M   source/blender/makesdna/DNA_meta_defaults.h
M   source/blender/makesdna/DNA_meta_types.h
M   source/blender/makesdna/intern/dna_rename_defs.h
M   source/blender/makesrna/intern/rna_curve.c
M   source/blender/makesrna/intern/rna_mesh.c
M   source/blender/makesrna/intern/rna_meta.c

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index ad964184263..dc595ff0ce1 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -247,11 +247,13 @@ struct BoundBox *BKE_mesh_boundbox_get(struct Object *ob);
 
 void BKE_mesh_texspace_calc(struct Mesh *me);
 void BKE_mesh_texspace_ensure(struct Mesh *me);
-void BKE_mesh_texspace_get(struct Mesh *me, float r_loc[3], float r_size[3]);
+void BKE_mesh_texspace_get(struct Mesh *me,
+   float r_texspace_location[3],
+   float r_texspace_size[3]);
 void BKE_mesh_texspace_get_reference(struct Mesh *me,
- char **r_texflag,
- float **r_loc,
- float **r_size);
+ char **r_texspace_flag,
+ float **r_texspace_location,
+ float **r_texspace_size);
 void BKE_mesh_texspace_copy_from_object(struct Mesh *me, struct Object *ob);
 
 /**
diff --git a/source/blender/blenkernel/BKE_object.h 
b/source/blender/blenkernel/BKE_object.h
index cfad8c5cfdb..963b0b87118 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -507,9 +507,9 @@ void BKE_object_handle_update_ex(struct Depsgraph 
*depsgraph,
 void BKE_object_sculpt_data_create(struct Object *ob);
 
 bool BKE_object_obdata_texspace_get(struct Object *ob,
-char **r_texflag,
-float **r_loc,
-float **r_size);
+char **r_texspace_flag,
+float **r_texspace_location,
+float **r_texspace_size);
 
 struct Mesh *BKE_object_get_evaluated_mesh_no_subsurf(const struct Object 
*object);
 /** Get evaluated mesh for given object. */
diff --git a/source/blender/blenkernel/intern/curve.cc 
b/source/blender/blenkernel/intern/curve.cc
index be6c7502891..1ac0e27a4a3 100644
--- a/source/blender/blenkernel/intern/curve.cc
+++ b/source/blender/blenkernel/intern/curve.cc
@@ -258,7 +258,7 @@ static void curve_blend_read_data(BlendDataReader *reader, 
ID *id)
   switch_endian_knots(nu);
 }
   }
-  cu->texflag &= ~CU_AUTOSPACE_EVALUATED;
+  cu->texspace_flag &= ~CU_TEXSPACE_FLAG_AUTO_EVALUATED;
 
   BLO_read_data_address(reader, &cu->bevel_profile);
   if (cu->bevel_profile != nullptr) {
@@ -517,7 +517,7 @@ BoundBox *BKE_curve_boundbox_get(Object *ob)
 
 void BKE_curve_texspace_calc(Curve *cu)
 {
-  if (cu->texflag & CU_AUTOSPACE) {
+  if (cu->texspace_flag & CU_TEXSPACE_FLAG_AUTO) {
 float min[3], max[3];
 
 INIT_MINMAX(min, max);
@@ -526,35 +526,36 @@ void BKE_curve_texspace_calc(Curve *cu)
   max[0] = max[1] = max[2] = 1.0f;
 }
 
-float loc[3], size[3];
-mid_v3_v3v3(loc, min, max);
+float texspace_location[3], texspace_size[3];
+mid_v3_v3

[Bf-blender-cvs] [7c6dfb8f96c] temp-T101739-fix-seam-bleeding-non-manifold: Added easy threading.

2023-01-17 Thread Jeroen Bakker
Commit: 7c6dfb8f96c459404e0b698c91b1f3cee4753db1
Author: Jeroen Bakker
Date:   Wed Jan 18 08:00:59 2023 +0100
Branches: temp-T101739-fix-seam-bleeding-non-manifold
https://developer.blender.org/rB7c6dfb8f96c459404e0b698c91b1f3cee4753db1

Added easy threading.

===

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

===

diff --git a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc 
b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
index 5fc0ff776f5..7123f806268 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels_copy.cc
@@ -273,26 +273,6 @@ struct Rows {
   }
 }
 
-/**
- * Mark pixels that are painted on by the brush. Those pixels don't need 
to be updated.
- */
-void mark_pixels_effected_by_brush(const PixelNodesTileData 
&nodes_tile_pixels)
-{
-  for (const UDIMTilePixels &tile_pixels : nodes_tile_pixels) {
-for (const PackedPixelRow &encoded_pixels : tile_pixels.pixel_rows) {
-  if (encoded_pixels.start_image_coordinate.y != row_number) {
-continue;
-  }
-  for (int x = encoded_pixels.start_image_coordinate.x;
-   x < encoded_pixels.start_image_coordinate.x + 
encoded_pixels.num_pixels;
-   x++) {
-pixels[x].type = PixelType::Brush;
-pixels[x].distance = 0.0f;
-  }
-}
-  }
-}
-
 /**
  * Mark pixels that needs to be evaluated. Pixels that are marked will 
have its `edge_index`
  * filled.
@@ -548,26 +528,45 @@ struct Rows {
   Rows(int2 resolution, int margin, const PixelNodesTileData &node_tile_pixels)
   : resolution(resolution), margin(margin)
   {
+TIMEIT_START(mark_brush);
 Row row_template(resolution.x);
 rows.resize(resolution.y, row_template);
 for (int row_number : rows.index_range()) {
   rows[row_number].reinit(row_number);
-  rows[row_number].mark_pixels_effected_by_brush(node_tile_pixels);
 }
+mark_pixels_effected_by_brush(node_tile_pixels);
+TIMEIT_END(mark_brush);
   }
 
-  void find_copy_source(const NonManifoldTileEdges &tile_edges)
+  /**
+   * Mark pixels that are painted on by the brush. Those pixels don't need to 
be updated, but will
+   * act as a source for other pixels.
+   */
+  void mark_pixels_effected_by_brush(const PixelNodesTileData 
&nodes_tile_pixels)
   {
-for (Row &row : rows) {
-  row.find_copy_source(*this, tile_edges);
+for (const UDIMTilePixels &tile_pixels : nodes_tile_pixels) {
+  threading::parallel_for_each(
+  tile_pixels.pixel_rows, [&](const PackedPixelRow &encoded_pixels) {
+Row &row = rows[encoded_pixels.start_image_coordinate.y];
+for (int x = encoded_pixels.start_image_coordinate.x;
+ x < encoded_pixels.start_image_coordinate.x + 
encoded_pixels.num_pixels;
+ x++) {
+  row.pixels[x].type = Row::PixelType::Brush;
+  row.pixels[x].distance = 0.0f;
+}
+  });
 }
   }
 
+  void find_copy_source(const NonManifoldTileEdges &tile_edges)
+  {
+threading::parallel_for_each(rows, [&](Row &row) { 
row.find_copy_source(*this, tile_edges); });
+  }
+
   void mark_for_evaluation(const NonManifoldTileEdges &tile_edges)
   {
-for (Row &row : rows) {
-  row.mark_for_evaluation(*this, tile_edges);
-}
+threading::parallel_for_each(rows,
+ [&](Row &row) { 
row.mark_for_evaluation(*this, tile_edges); });
   }
 
   void pack_into(CopyPixelTile ©_tile) const

___
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] [ca3e19f4c52] master: Fixes for 'make check_pep8' target

2023-01-17 Thread Campbell Barton
Commit: ca3e19f4c529fd2389f5da56ab039163778ec1e1
Author: Campbell Barton
Date:   Wed Jan 18 18:27:49 2023 +1100
Branches: master
https://developer.blender.org/rBca3e19f4c529fd2389f5da56ab039163778ec1e1

Fixes for 'make check_pep8' target

- Skip files in dirs starting with '.' (`.git` was being searched).
- Update --disable list for pylint.

===

M   tests/python/pep8.py

===

diff --git a/tests/python/pep8.py b/tests/python/pep8.py
index 2583bec8256..6b046f5a6af 100644
--- a/tests/python/pep8.py
+++ b/tests/python/pep8.py
@@ -26,7 +26,8 @@ FORCE_PEP8_ALL = False
 
 
 def file_list_py(path):
-for dirpath, _dirnames, filenames in os.walk(path):
+for dirpath, dirnames, filenames in os.walk(path):
+dirnames[:] = [d for d in dirnames if not d.startswith(".")]
 for filename in filenames:
 if filename.endswith((".py", ".cfg")):
 yield os.path.join(dirpath, filename)
@@ -93,12 +94,11 @@ def check_files_pylint(files):
 "--disable="
 "C0111,"  # missing doc string
 "C0103,"  # invalid name
+"C0209,"  # Formatting a regular string which could be a f-string
+"C0302,"  # Too many lines in module
 "C0413,"  # import should be placed at the top
+"C0415,"  # Import outside toplevel
 "W0613,"  # unused argument, may add this back
-# but happens a lot for 'context' for eg.
-"W0232,"  # class has no __init__, Operator/Panel/Menu etc
-"W0142,"  # Used * or ** magic
-# even needed in some cases
 "R0902,"  # Too many instance attributes
 "R0903,"  # Too many statements
 "R0911,"  # Too many return statements

___
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] [60d9de767db] master: Cleanup: remove redundant forward declarations for structs

2023-01-17 Thread Campbell Barton
Commit: 60d9de767db6f14b274fd2ecf5462097bd119b49
Author: Campbell Barton
Date:   Wed Jan 18 18:41:13 2023 +1100
Branches: master
https://developer.blender.org/rB60d9de767db6f14b274fd2ecf5462097bd119b49

Cleanup: remove redundant forward declarations for structs

===

M   source/blender/asset_system/AS_asset_library.h
M   source/blender/blenfont/BLF_api.h
M   source/blender/blenfont/intern/blf_internal.h
M   source/blender/blenkernel/BKE_animsys.h
M   source/blender/blenkernel/BKE_blendfile_link_append.h
M   source/blender/blenkernel/BKE_bpath.h
M   source/blender/blenkernel/BKE_brush.h
M   source/blender/blenkernel/BKE_collision.h
M   source/blender/blenkernel/BKE_curves.h
M   source/blender/blenkernel/BKE_displist.h
M   source/blender/blenkernel/BKE_geometry_set.h
M   source/blender/blenkernel/BKE_geometry_set.hh
M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/BKE_gpencil_geom.h
M   source/blender/blenkernel/BKE_image.h
M   source/blender/blenkernel/BKE_image_partial_update.hh
M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/BKE_mesh_wrapper.h
M   source/blender/blenkernel/BKE_multires.h
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/BKE_particle.h
M   source/blender/blenkernel/BKE_pointcloud.h
M   source/blender/blenkernel/BKE_subsurf.h
M   source/blender/blenkernel/intern/library.c
M   source/blender/blenkernel/intern/pbvh_uv_islands.hh
M   source/blender/blenloader/BLO_read_write.h
M   source/blender/blenloader/BLO_readfile.h
M   source/blender/blenloader/intern/readfile.h
M   source/blender/bmesh/intern/bmesh_mesh.h
M   source/blender/bmesh/intern/bmesh_mesh_normals.h
M   source/blender/bmesh/intern/bmesh_polygon.h
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.h
M   source/blender/depsgraph/intern/builder/deg_builder_relations.h
M   source/blender/draw/DRW_pbvh.h
M   source/blender/draw/engines/eevee_next/eevee_cryptomatte.hh
M   source/blender/draw/engines/image/image_private.hh
M   source/blender/draw/intern/draw_cache_impl.h
M   source/blender/draw/intern/draw_command_shared.hh
M   source/blender/draw/intern/draw_curves_private.h
M   source/blender/draw/intern/draw_shader_shared.h
M   source/blender/draw/intern/draw_subdivision.h
M   source/blender/draw/intern/draw_view.h
M   source/blender/editors/asset/ED_asset_handle.h
M   source/blender/editors/asset/ED_asset_list.h
M   source/blender/editors/asset/ED_asset_list.hh
M   source/blender/editors/asset/ED_asset_temp_id_consumer.h
M   source/blender/editors/include/ED_armature.h
M   source/blender/editors/include/ED_curves_sculpt.h
M   source/blender/editors/include/ED_file_indexer.h
M   source/blender/editors/include/ED_fileselect.h
M   source/blender/editors/include/ED_gizmo_library.h
M   source/blender/editors/include/ED_keyframes_keylist.h
M   source/blender/editors/include/ED_node.h
M   source/blender/editors/include/ED_node.hh
M   source/blender/editors/include/ED_object.h
M   source/blender/editors/include/ED_sculpt.h
M   source/blender/editors/include/ED_select_utils.h
M   source/blender/editors/include/ED_spreadsheet.h
M   source/blender/editors/include/ED_util.h
M   source/blender/editors/include/UI_abstract_view.hh
M   source/blender/editors/include/UI_grid_view.hh
M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/interface_handlers.cc
M   source/blender/editors/space_node/node_intern.hh
M   source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh
M   source/blender/editors/space_view3d/view3d_intern.h
M   source/blender/editors/space_view3d/view3d_navigate.h
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_convert.h
M   source/blender/editors/transform/transform_mode.h
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/GPU_storage_buffer.h
M   source/blender/gpu/GPU_viewport.h
M   source/blender/imbuf/IMB_colormanagement.h
M   source/blender/io/usd/intern/usd_reader_prim.h
M   source/blender/io/usd/intern/usd_writer_material.h
M   source/blender/io/usd/usd.h
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesdna/DNA_view3d_types.h
M   source/blender/makesdna/DNA_windowmanager_types.h
M   source/blender/makesrna/intern/rna_internal.h
M   source/blender/modifiers/MOD_nodes.h
M   source/blender/nodes/NOD_geometry_exec.hh
M   source/blender/nodes/NOD_geometry_nodes_log.hh
M   source/blender/python/generic/idprop_py_ui_api.h
M   source/blender/python/gpu/gpu_py_offscreen.h
M   source/bl