[Bf-blender-cvs] [02a9377da0d] master: UI: Default Fonts Folder for Mac and Linux

2021-10-29 Thread Harley Acheson
Commit: 02a9377da0da185685896138316c3bdb0623e021
Author: Harley Acheson
Date:   Fri Oct 29 17:15:22 2021 -0700
Branches: master
https://developer.blender.org/rB02a9377da0da185685896138316c3bdb0623e021

UI: Default Fonts Folder for Mac and Linux

Initial defaults for userdef->fontdir for Mac and Linux.

See D12802 for more details.

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

Reviewed by Campbell Barton

===

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

===

diff --git a/source/blender/blenkernel/intern/appdir.c 
b/source/blender/blenkernel/intern/appdir.c
index ce4ab8a4ba1..fb6656a4b1c 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -259,23 +259,24 @@ bool BKE_appdir_folder_caches(char *r_path, const size_t 
path_len)
 /**
  * Gets a good default directory for fonts.
  */
-bool BKE_appdir_font_folder_default(
-/* This parameter can only be `const` on non-windows platforms.
- * NOLINTNEXTLINE: readability-non-const-parameter. */
-char *dir)
+bool BKE_appdir_font_folder_default(char *dir)
 {
-  bool success = false;
 #ifdef WIN32
   wchar_t wpath[FILE_MAXDIR];
-  success = SHGetSpecialFolderPathW(0, wpath, CSIDL_FONTS, 0);
-  if (success) {
+  if (SHGetSpecialFolderPathW(0, wpath, CSIDL_FONTS, 0)) {
 wcscat(wpath, L"\\");
 BLI_strncpy_wchar_as_utf8(dir, wpath, FILE_MAXDIR);
+return (BLI_exists(dir));
   }
+  return false;
+#elif defined(__APPLE__)
+  const char *home = BLI_getenv("HOME");
+  BLI_snprintf(dir, FILE_MAXDIR, "%s/Library/Fonts/", home);
+  return (BLI_exists(dir));
+#else
+  BLI_strncpy(dir, "/usr/share/fonts/", FILE_MAXDIR);
+  return (BLI_exists(dir));
 #endif
-  /* TODO: Values for other platforms. */
-  UNUSED_VARS(dir);
-  return success;
 }
 
 /** \} */

___
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] [98df4c40407] temp-geometry-nodes-text: Add Line and Pivot outputs to String to Curves

2021-10-29 Thread Erik
Commit: 98df4c40407fffa195a301e2492112d84f6a31e3
Author: Erik
Date:   Thu Oct 28 23:26:49 2021 +0200
Branches: temp-geometry-nodes-text
https://developer.blender.org/rB98df4c40407fffa195a301e2492112d84f6a31e3

Add Line and Pivot outputs to String to Curves

===

M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc

===

diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index d5d2520ddf6..ff02be04351 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1566,7 +1566,8 @@ typedef struct NodeGeometryStringToCurves {
   uint8_t align_x;
   /* GeometryNodeStringToCurvesAlignYMode */
   uint8_t align_y;
-  char _pad[1];
+  /* GeometryNodeStringToCurvesPivotMode */
+  uint8_t pivot_mode;
 } NodeGeometryStringToCurves;
 
 typedef struct NodeGeometryDeleteGeometry {
@@ -2251,6 +2252,16 @@ typedef enum GeometryNodeStringToCurvesAlignYMode {
   GEO_NODE_STRING_TO_CURVES_ALIGN_Y_BOTTOM = 4,
 } GeometryNodeStringToCurvesAlignYMode;
 
+typedef enum GeometryNodeStringToCurvesPivotMode {
+  GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT = 0,
+  GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT = 1,
+  GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_CENTER = 2,
+  GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT = 3,
+  GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT = 4,
+  GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_CENTER = 5,
+  GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_RIGHT = 6,
+} GeometryNodeStringToCurvesPivotMode;
+
 typedef enum GeometryNodeDeleteGeometryMode {
   GEO_NODE_DELETE_GEOMETRY_MODE_ALL = 0,
   GEO_NODE_DELETE_GEOMETRY_MODE_EDGE_FACE = 1,
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 6a36ef07dee..52ed8ede82f 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -11030,6 +11030,33 @@ static void def_geo_string_to_curves(StructRNA *srna)
   {0, NULL, 0, NULL, NULL},
   };
 
+  static const EnumPropertyItem 
rna_node_geometry_string_to_curves_pivot_mode[] = {
+  {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT, "MIDPOINT", 0, 
"Midpoint", "Midpoint"},
+  {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT, "TOP_LEFT", 0, "Top 
Left", "Top Left"},
+  {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_CENTER,
+   "TOP_CENTER",
+   0,
+   "Top Center",
+   "Top Center"},
+  {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT, "TOP_RIGHT", 0, "Top 
Right", "Top Right"},
+  {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT,
+   "BOTTOM_LEFT",
+   0,
+   "Bottom Left",
+   "Bottom Left"},
+  {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_CENTER,
+   "BOTTOM_CENTER",
+   0,
+   "Bottom Center",
+   "Bottom Center"},
+  {GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_RIGHT,
+   "BOTTOM_RIGHT",
+   0,
+   "Bottom Right",
+   "Bottom Right"},
+  {0, NULL, 0, NULL, NULL},
+  };
+
   PropertyRNA *prop;
 
   prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
@@ -11062,6 +11089,13 @@ static void def_geo_string_to_curves(StructRNA *srna)
   RNA_def_property_enum_default(prop, 
GEO_NODE_STRING_TO_CURVES_ALIGN_Y_TOP_BASELINE);
   RNA_def_property_ui_text(prop, "Align Y", "");
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+  prop = RNA_def_property(srna, "pivot_mode", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "pivot_mode");
+  RNA_def_property_enum_items(prop, 
rna_node_geometry_string_to_curves_pivot_mode);
+  RNA_def_property_enum_default(prop, 
GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT);
+  RNA_def_property_ui_text(prop, "Pivot Point", "The pivot point used when 
rotating characters");
+  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
 static void def_geo_separate_geometry(StructRNA *srna)
diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc 
b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
index 95e94a22d81..04b48dbebf3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
@@ -56,8 +56,10 @@ static void 
geo_node_string_to_curves_declare(NodeDeclarationBuilder )
   .default_value(0.0f)
   .min(0.0f)
   .subtype(PROP_DISTANCE);
-  b.add_output(N_("Curves"));
+  b.add_output(N_("Curve"));
   b.add_output(N_("Remainder"));
+  b.add_output(N_("Line")).field_source();
+  b.add_output(N_("Pivot Point")).field_source();
 }
 
 static void geo_node_string_to_curves_layout(uiLayout *layout, struct bContext 
*C, PointerRNA *ptr)
@@ -77,6 +79,7 @@ 

[Bf-blender-cvs] [3aab18f0ae8] temp-geometry-nodes-text: Add default value to String to Curves string input

2021-10-29 Thread Erik
Commit: 3aab18f0ae856e629c55f14bbebdaa1cb4ec8279
Author: Erik
Date:   Fri Oct 29 00:01:34 2021 +0200
Branches: temp-geometry-nodes-text
https://developer.blender.org/rB3aab18f0ae856e629c55f14bbebdaa1cb4ec8279

Add default value to String to Curves string input

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc 
b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
index a3dc609eb78..342dc22ee49 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
@@ -34,7 +34,7 @@ namespace blender::nodes {
 
 static void geo_node_string_to_curves_declare(NodeDeclarationBuilder )
 {
-  b.add_input(N_("String"));
+  b.add_input(N_("String")).default_value("Text");
   
b.add_input(N_("Size")).default_value(1.0f).min(0.0f).subtype(PROP_DISTANCE);
   b.add_input(N_("Character Spacing"))
   .default_value(1.0f)

___
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] [423a931ce5c] temp-geometry-nodes-text: Rename socket "Curves" to "Curve Instances" on String to Curves-node

2021-10-29 Thread Erik
Commit: 423a931ce5c92f172fde2f71deeb94f47965b9b7
Author: Erik
Date:   Fri Oct 29 00:00:03 2021 +0200
Branches: temp-geometry-nodes-text
https://developer.blender.org/rB423a931ce5c92f172fde2f71deeb94f47965b9b7

Rename socket "Curves" to "Curve Instances" on String to Curves-node

===

M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc

===

diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 68faa4c0672..826560562c3 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -2154,6 +2154,12 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
* \note Keep this message at the bottom of the function.
*/
   {
+LISTBASE_FOREACH (bNodeTree *, ntree, >nodetrees) {
+  if (ntree->type == NTREE_GEOMETRY) {
+version_node_output_socket_name(
+ntree, GEO_NODE_STRING_TO_CURVES, "Curves", "Curve Instances");
+  }
+}
 /* Keep this block, even when empty. */
   }
 }
diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc 
b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
index 5dd5ca04a6a..a3dc609eb78 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
@@ -56,7 +56,7 @@ static void 
geo_node_string_to_curves_declare(NodeDeclarationBuilder )
   .default_value(0.0f)
   .min(0.0f)
   .subtype(PROP_DISTANCE);
-  b.add_output(N_("Curves"));
+  b.add_output(N_("Curve Instances"));
   b.add_output(N_("Remainder"));
   b.add_output(N_("Line")).field_source();
   b.add_output(N_("Pivot Point")).field_source();
@@ -403,7 +403,7 @@ static void 
geo_node_string_to_curves_exec(GeoNodeExecParams params)
   }
 
   if (layout.positions.size() == 0) {
-params.set_output("Curves", GeometrySet());
+params.set_output("Curve Instances", GeometrySet());
 return;
   }
 
@@ -414,7 +414,7 @@ static void 
geo_node_string_to_curves_exec(GeoNodeExecParams params)
   add_instances_from_handles(instances, char_handles, layout);
   create_attributes(params, layout, instances);
 
-  params.set_output("Curves", std::move(geometry_set_out));
+  params.set_output("Curve Instances", std::move(geometry_set_out));
 }
 
 }  // namespace blender::nodes

___
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] [be109b60e77] temp-geometry-nodes-text: Fix typo Curve -> Curves in socket name

2021-10-29 Thread Erik
Commit: be109b60e77fc8d6bb1a3cf032168e32d9797109
Author: Erik
Date:   Thu Oct 28 23:34:53 2021 +0200
Branches: temp-geometry-nodes-text
https://developer.blender.org/rBbe109b60e77fc8d6bb1a3cf032168e32d9797109

Fix typo Curve -> Curves in socket name

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc 
b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
index 04b48dbebf3..5dd5ca04a6a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
@@ -56,7 +56,7 @@ static void 
geo_node_string_to_curves_declare(NodeDeclarationBuilder )
   .default_value(0.0f)
   .min(0.0f)
   .subtype(PROP_DISTANCE);
-  b.add_output(N_("Curve"));
+  b.add_output(N_("Curves"));
   b.add_output(N_("Remainder"));
   b.add_output(N_("Line")).field_source();
   b.add_output(N_("Pivot Point")).field_source();

___
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] [43a56ea1e74] temp-geometry-nodes-text: Initial support for custom attributes on instances

2021-10-29 Thread Erik
Commit: 43a56ea1e74a321fc1e53811a63eed717acf62ac
Author: Erik
Date:   Thu Oct 28 23:18:30 2021 +0200
Branches: temp-geometry-nodes-text
https://developer.blender.org/rB43a56ea1e74a321fc1e53811a63eed717acf62ac

Initial support for custom attributes on instances

===

M   source/blender/blenkernel/BKE_geometry_set.hh
M   source/blender/blenkernel/intern/geometry_component_instances.cc

===

diff --git a/source/blender/blenkernel/BKE_geometry_set.hh 
b/source/blender/blenkernel/BKE_geometry_set.hh
index 58a89d0207a..e912b2037ba 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -638,6 +638,7 @@ class InstancesComponent : public GeometryComponent {
   mutable blender::Array almost_unique_ids_;
 
  public:
+  blender::bke::CustomDataAttributes attributes;
   InstancesComponent();
   ~InstancesComponent() = default;
   GeometryComponent *copy() const override;
diff --git a/source/blender/blenkernel/intern/geometry_component_instances.cc 
b/source/blender/blenkernel/intern/geometry_component_instances.cc
index 5fe77000519..09deefb48bf 100644
--- a/source/blender/blenkernel/intern/geometry_component_instances.cc
+++ b/source/blender/blenkernel/intern/geometry_component_instances.cc
@@ -503,7 +503,21 @@ static ComponentAttributeProviders 
create_attribute_providers_for_instances()
   static InstancePositionAttributeProvider position;
   static InstanceIDAttributeProvider id;
 
-  return ComponentAttributeProviders({, }, {});
+  static CustomDataAccessInfo instance_custom_data_access = {
+  [](GeometryComponent ) -> CustomData * {
+InstancesComponent  = static_cast(component);
+return 
+  },
+  [](const GeometryComponent ) -> const CustomData * {
+const InstancesComponent  = static_cast(component);
+return 
+  },
+  nullptr};
+
+  static CustomDataAttributeProvider instance_custom_data(ATTR_DOMAIN_POINT,
+  
instance_custom_data_access);
+
+  return ComponentAttributeProviders({, }, 
{_custom_data});
 }
 }  // namespace blender::bke

___
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] [87c6d95603f] sculpt-dev: Sculpt: fix off-by-half error in paint_stroke_apply_subspacing

2021-10-29 Thread Joseph Eagar
Commit: 87c6d95603f68a35e0a17adb9ab4f3b3c62acdcb
Author: Joseph Eagar
Date:   Fri Oct 29 14:39:53 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB87c6d95603f68a35e0a17adb9ab4f3b3c62acdcb

Sculpt: fix off-by-half error in
paint_stroke_apply_subspacing

===

M   source/blender/editors/sculpt_paint/paint_stroke.c

===

diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c 
b/source/blender/editors/sculpt_paint/paint_stroke.c
index 6e2b75f8655..a989a11312e 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -191,7 +191,7 @@ static bool paint_stroke_use_scene_spacing(Brush *brush, 
ePaintMode mode)
 
 static bool paint_tool_require_inbetween_mouse_events(Brush *brush, ePaintMode 
mode)
 {
-  if (brush->flag & (BRUSH_ANCHORED|BRUSH_DRAG_DOT)) {
+  if (brush->flag & (BRUSH_ANCHORED | BRUSH_DRAG_DOT)) {
 return false;
   }
 
@@ -230,7 +230,7 @@ bool paint_stroke_apply_subspacing(struct PaintStroke 
*stroke,
 
   const float t = stroke->stroke_distance_t;
 
-  if (t != 0.0f && t < *state + spacing) {
+  if (t != 0.0f && t < *state + spacing * 2.0f) {
 return false;
   }
   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] [736d1cf5f50] sculpt-dev: Sculpt: remove extraneous call to SCULPT_vertex_random_access_ensure

2021-10-29 Thread Joseph Eagar
Commit: 736d1cf5f501c0ef79277b55583bc48e886a1a17
Author: Joseph Eagar
Date:   Fri Oct 29 14:32:23 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB736d1cf5f501c0ef79277b55583bc48e886a1a17

Sculpt: remove extraneous call to
SCULPT_vertex_random_access_ensure

===

M   release/datafiles/startup.blend
M   source/blender/editors/sculpt_paint/sculpt_brushes.c
M   source/blender/editors/sculpt_paint/sculpt_smooth.c

===

diff --git a/release/datafiles/startup.blend b/release/datafiles/startup.blend
index 31a190f7c45..d57757a0522 100644
Binary files a/release/datafiles/startup.blend and 
b/release/datafiles/startup.blend differ
diff --git a/source/blender/editors/sculpt_paint/sculpt_brushes.c 
b/source/blender/editors/sculpt_paint/sculpt_brushes.c
index ef7aec120ec..dd1ffd02a1b 100644
--- a/source/blender/editors/sculpt_paint/sculpt_brushes.c
+++ b/source/blender/editors/sculpt_paint/sculpt_brushes.c
@@ -1301,8 +1301,6 @@ void SCULPT_do_clay_strips_brush(Sculpt *sd, Object *ob, 
PBVHNode **nodes, int t
   const float offset = SCULPT_brush_plane_offset_get(sd, ss);
   const float displace = radius * (0.18f + offset);
 
-  SCULPT_vertex_random_access_ensure(ss);
-
   /* The sculpt-plane normal (whatever its set to). */
   float area_no_sp[3];
 
@@ -1973,8 +1971,6 @@ void SCULPT_do_layer_brush(Sculpt *sd, Object *ob, 
PBVHNode **nodes, int totnode
 ss->cache->layer_stroke_id = 
ss->custom_layers[SCULPT_SCL_LAYER_STROKE_ID]->data;
   }
 
-  SCULPT_vertex_random_access_ensure(ss);
-
   SculptThreadedTaskData data = {.sd = sd,
  .ob = ob,
  .brush = brush,
diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c 
b/source/blender/editors/sculpt_paint/sculpt_smooth.c
index 44b21777163..64e4d459e48 100644
--- a/source/blender/editors/sculpt_paint/sculpt_smooth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c
@@ -1608,7 +1608,7 @@ void SCULPT_smooth(Sculpt *sd,
 last = 1.0f;
   }
 
-  printf("smooth iterations: %d, last: %.4f\n", count + 1, last);
+  // printf("smooth iterations: %d, last: %.4f\n", count + 1, last);
 
   if (type == PBVH_FACES && !ss->pmap) {
 BLI_assert_msg(0, "sculpt smooth: pmap missing");

___
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] [dcdbaf89bd1] master: Asset Browser: Correct name & tooltip for asset list refresh operator

2021-10-29 Thread Julian Eisel
Commit: dcdbaf89bd114aaf066cec57bb619b828c159719
Author: Julian Eisel
Date:   Fri Oct 29 16:45:08 2021 +0200
Branches: master
https://developer.blender.org/rBdcdbaf89bd114aaf066cec57bb619b828c159719

Asset Browser: Correct name & tooltip for asset list refresh operator

The name and tooltip were talking about file-lists, which exposes the
fact that the Asset Browser uses the File Browser code in the UI, which
we shouldn't do. This can confuse users.
Instead have a dedicated operator for the Asset Browser with a proper
name and tooltip.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   
release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M   release/scripts/startup/bl_ui/space_filebrowser.py
M   source/blender/editors/space_file/file_intern.h
M   source/blender/editors/space_file/file_ops.c
M   source/blender/editors/space_file/file_panels.c
M   source/blender/editors/space_file/space_file.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 2289e8200a6..9f921bd2b70 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2140,7 +2140,9 @@ def km_file_browser(params):
 ("file.parent", {"type": 'UP_ARROW', "value": 'PRESS', "alt": True}, 
None),
 ("file.previous", {"type": 'LEFT_ARROW', "value": 'PRESS', "alt": 
True}, None),
 ("file.next", {"type": 'RIGHT_ARROW', "value": 'PRESS', "alt": True}, 
None),
+# The two refresh operators have polls excluding each other (so only 
one is available depending on context).
 ("file.refresh", {"type": 'R', "value": 'PRESS'}, None),
+("file.asset_library_refresh", {"type": 'R', "value": 'PRESS'}, None),
 ("file.parent", {"type": 'P', "value": 'PRESS'}, None),
 ("file.previous", {"type": 'BACK_SPACE', "value": 'PRESS'}, None),
 ("file.next", {"type": 'BACK_SPACE', "value": 'PRESS', "shift": True}, 
None),
diff --git 
a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py 
b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index 8200aad1091..0ae64dbc62e 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -1227,7 +1227,9 @@ def km_file_browser(params):
 ("file.previous", {"type": 'LEFT_ARROW', "value": 'PRESS', "ctrl": 
True}, None),
 ("file.next", {"type": 'RIGHT_ARROW', "value": 'PRESS', "alt": True}, 
None),
 ("file.next", {"type": 'RIGHT_ARROW', "value": 'PRESS', "ctrl": True}, 
None),
+# The two refresh operators have polls excluding each other (so only 
one is available depending on context).
 ("file.refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
+("file.asset_library_refresh", {"type": 'R', "value": 'PRESS', "ctrl": 
True}, None),
 ("file.previous", {"type": 'BACK_SPACE', "value": 'PRESS'}, None),
 ("file.next", {"type": 'BACK_SPACE', "value": 'PRESS', "shift": True}, 
None),
 ("wm.context_toggle", {"type": 'H', "value": 'PRESS'},
@@ -1272,7 +1274,9 @@ def km_file_browser_main(params):
 
 items.extend([
 ("file.mouse_execute", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, 
None),
+# The two refresh operators have polls excluding each other (so only 
one is available depending on context).
 ("file.refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
+("file.asset_library_refresh", {"type": 'R', "value": 'PRESS', "ctrl": 
True}, None),
 ("file.select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
 ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK'},
  {"properties": [("open", False), ("deselect_all", True)]}),
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py 
b/release/scripts/startup/bl_ui/space_filebrowser.py
index a33e2665b58..05f505c518d 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -792,7 +792,7 @@ class ASSETBROWSER_MT_context_menu(AssetBrowserMenu, Menu):
 st = context.space_data
 params = st.params
 
-layout.operator("file.refresh", text="Refresh")
+layout.operator("file.asset_library_refresh")
 
 layout.separator()
 
diff --git a/source/blender/editors/space_file/file_intern.h 
b/source/blender/editors/space_file/file_intern.h
index f6b5f0f47cd..4be5d6d8008 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -79,6 +79,7 @@ void FILE_OT_directory_new(struct 

[Bf-blender-cvs] [9549dbb994d] sculpt-dev: Sculpt: UI update

2021-10-29 Thread Joseph Eagar
Commit: 9549dbb994d32e1b2c7ea9880b8daf2a4ea0b36a
Author: Joseph Eagar
Date:   Fri Oct 29 13:20:28 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB9549dbb994d32e1b2c7ea9880b8daf2a4ea0b36a

Sculpt: UI update

* Sculpt viewport header is now auto-generated in
  much the same way as the workspace buttons
  and right click menu.
* Added an API in the python code to insert
  bits of UI code after a brush channel, currently
  used to add flip colors operator.
* Added icon to add brush channels to header in
  brush edit mode.
* Updated input mappings UI.

===

M   release/scripts/startup/bl_ui/properties_paint_common.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/BKE_brush_engine.h
M   source/blender/blenkernel/intern/brush_channel_define.h
M   source/blender/blenkernel/intern/brush_engine_presets.c
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/bmesh/intern/bmesh_log.c
M   source/blender/editors/sculpt_paint/paint_image.c
M   source/blender/makesrna/intern/rna_brush_engine.c

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index fc1497dc1c0..547790d5f22 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -66,15 +66,20 @@ class DynamicBrushCategoryPanel(Panel):
 layout.use_property_split = True
 
 channels = self.get_channels(context)
+group = DynamicPaintPanelGen.getGroup(self)
 
 for ch in channels:
+inserts = group.getInserts(ch.idname) if group else []
+
 ok = ch.show_in_workspace
 ok = ok and ch.category == idname
 
 if not ok:
 continue
 
-UnifiedPaintPanel.channel_unified(layout,
+row = layout if len(inserts) == 0 else layout.row(align=True)
+
+UnifiedPaintPanel.channel_unified(row,
 context,
 brush,
 ch.idname,
@@ -83,6 +88,18 @@ class DynamicBrushCategoryPanel(Panel):
 show_reorder=opt["show_reorder"],
 show_mappings=opt["show_mappings"])
 
+for item in inserts:
+if item.sameLine:
+item.cb(row)
+
+for item in inserts:
+if not item.sameLine:
+item.cb(layout)
+
+class InsertAfterItem:
+def __init__(self, cb, sameLine):
+self.cb = cb
+self.sameLine = sameLine
 
 class DynamicPaintPanelGen:
 class Group:
@@ -93,9 +110,43 @@ class DynamicPaintPanelGen:
 self.rnaclass = None
 self.parent = parent
 self.options = {}
+self.insert_cbs = {}
+
+def getInserts(self, key):
+return self.insert_cbs[key] if key in self.insert_cbs else []
+
+def insertEachAfter(self, insertdict):
+#return
+for key in insertdict.keys():
+item = insertdict[key]
+
+if isinstance(item, dict):
+callback = item["callback"]
+sameLine = item["sameLine"] if "sameLine" in item else 
False
+else:
+callback = item
+sameLine = False
+
+self.insertAfter(key, callback, sameLine)
+
+def insertAfter(self, key, cb, sameLine=True):
+"""
+example:
+group.insertAfter("color", lambda layout: 
layout.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="", 
emboss=False))
+"""
+if key not in self.insert_cbs:
+self.insert_cbs[key] = []
+
+self.insert_cbs[key].append(InsertAfterItem(cb, sameLine))
 
 groups = {}
 
+@staticmethod
+def getGroup(panel):
+idname = panel.bl_idname
+
+return DynamicPaintPanelGen.groups[idname] if idname in 
DynamicPaintPanelGen.groups else None
+
 @staticmethod
 def ensureCategory(idname, name=None, prefix="VIEW3D_PT_brush_category_", 
parent=None, show_reorder=False, ui_editing=False, show_mappings=None):
 if name is None:
@@ -154,9 +205,6 @@ class DynamicPaintPanelGen:
 name = name2
 
 for cls in classes[:]:
-#print("_", cls.bl_rna.identifier, cls.bl_rna.identifier == name) #
-#r, dir(cls.bl_rna)) #.name)
-
 if cls.bl_rna.identifier == name:
 try:
 unregister_class(cls)
@@ -194,12 +242,21 @@ classes.append(CLASSNAME)
 
 exec(code)
 
+#custom UI code that is inserted
+#for different brush channel properties
+insertAfters = {
+"color" : {
+"sameLine" : True,

[Bf-blender-cvs] [fcf1ba18f0c] blender-v3.0-release: Fix: Incorrect component type warning in points to volume node

2021-10-29 Thread Hans Goudey
Commit: fcf1ba18f0c41187bc7e34e1cdba8d59970a632c
Author: Hans Goudey
Date:   Fri Oct 29 13:17:33 2021 -0500
Branches: blender-v3.0-release
https://developer.blender.org/rBfcf1ba18f0c41187bc7e34e1cdba8d59970a632c

Fix: Incorrect component type warning in points to volume node

This node doesn't only support point clouds, it supports any geometry
component type with points, so meshes, curves, and point clouds.
We could explicitly list them to add a warning for volumes, but
that wouldn't really have any practical benefit, and isn't done
elsewhere.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc 
b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
index fcd82170a8a..312ea7df919 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
@@ -32,7 +32,7 @@ namespace blender::nodes {
 
 static void geo_node_points_to_volume_declare(NodeDeclarationBuilder )
 {
-  
b.add_input(N_("Points")).supported_type(GEO_COMPONENT_TYPE_POINT_CLOUD);
+  b.add_input(N_("Points"));
   b.add_input(N_("Density")).default_value(1.0f).min(0.0f);
   b.add_input(N_("Voxel 
Size")).default_value(0.3f).min(0.01f).subtype(PROP_DISTANCE);
   b.add_input(N_("Voxel Amount")).default_value(64.0f).min(0.0f);

___
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] [b5f42029b88] blender-v3.0-release: Fix T92592: Cycles stereo render not rendering right view

2021-10-29 Thread Brecht Van Lommel
Commit: b5f42029b887be8d475ef471c97d4a84768d1f09
Author: Brecht Van Lommel
Date:   Fri Oct 29 15:56:44 2021 +0200
Branches: blender-v3.0-release
https://developer.blender.org/rBb5f42029b887be8d475ef471c97d4a84768d1f09

Fix T92592: Cycles stereo render not rendering right view

===

M   intern/cycles/session/buffers.cpp

===

diff --git a/intern/cycles/session/buffers.cpp 
b/intern/cycles/session/buffers.cpp
index 51d9c1e5d8f..5c9e097e5b1 100644
--- a/intern/cycles/session/buffers.cpp
+++ b/intern/cycles/session/buffers.cpp
@@ -257,7 +257,7 @@ bool BufferParams::modified(const BufferParams ) const
   }
 
   if (layer != other.layer || view != other.view) {
-return false;
+return true;
   }
 
   if (exposure != other.exposure ||

___
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] [0c3da7f3701] master: Merge branch 'blender-v3.0-release'

2021-10-29 Thread Hans Goudey
Commit: 0c3da7f37019df937aa70ec9f02f3c16a0b6f257
Author: Hans Goudey
Date:   Fri Oct 29 09:42:24 2021 -0500
Branches: master
https://developer.blender.org/rB0c3da7f37019df937aa70ec9f02f3c16a0b6f257

Merge branch 'blender-v3.0-release'

===



===



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


[Bf-blender-cvs] [2383628ee11] blender-v3.0-release: Nodes: Add translation markers to new socket names and descriptions

2021-10-29 Thread Hans Goudey
Commit: 2383628ee11b6e90d34cd010f742c6d0356f5e11
Author: Hans Goudey
Date:   Fri Oct 29 09:41:08 2021 -0500
Branches: blender-v3.0-release
https://developer.blender.org/rB2383628ee11b6e90d34cd010f742c6d0356f5e11

Nodes: Add translation markers to new socket names and descriptions

As part of the refactor to the node declaration builders, we had hoped
to add a regular expression specifically for these socket names, but
recent discussions have revealed that using the translation marker
macros is the preferred solution.

If the names and descriptions were exposed to RNA, these would not
be necessary. However, that may be quite complicated, since sockets
are all instances of the same RNA types.

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

===

M   source/blender/nodes/composite/nodes/node_composite_bokehimage.cc
M   source/blender/nodes/composite/nodes/node_composite_brightness.cc
M   source/blender/nodes/composite/nodes/node_composite_colorbalance.cc
M   source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc
M   source/blender/nodes/composite/nodes/node_composite_composite.cc
M   source/blender/nodes/composite/nodes/node_composite_curves.cc
M   source/blender/nodes/composite/nodes/node_composite_exposure.cc
M   source/blender/nodes/composite/nodes/node_composite_gamma.cc
M   source/blender/nodes/composite/nodes/node_composite_hueSatVal.cc
M   source/blender/nodes/composite/nodes/node_composite_huecorrect.cc
M   source/blender/nodes/composite/nodes/node_composite_idMask.cc
M   source/blender/nodes/composite/nodes/node_composite_invert.cc
M   source/blender/nodes/composite/nodes/node_composite_levels.cc
M   source/blender/nodes/composite/nodes/node_composite_mask.cc
M   source/blender/nodes/composite/nodes/node_composite_movieclip.cc
M   source/blender/nodes/composite/nodes/node_composite_premulkey.cc
M   source/blender/nodes/composite/nodes/node_composite_rgb.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.cc
M   source/blender/nodes/composite/nodes/node_composite_setalpha.cc
M   source/blender/nodes/composite/nodes/node_composite_texture.cc
M   source/blender/nodes/composite/nodes/node_composite_tonemap.cc
M   source/blender/nodes/composite/nodes/node_composite_trackpos.cc
M   source/blender/nodes/composite/nodes/node_composite_valToRgb.cc
M   source/blender/nodes/composite/nodes/node_composite_value.cc
M   source/blender/nodes/composite/nodes/node_composite_viewer.cc
M   source/blender/nodes/function/nodes/legacy/node_fn_random_float.cc
M   source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc
M   source/blender/nodes/function/nodes/node_fn_boolean_math.cc
M   source/blender/nodes/function/nodes/node_fn_float_compare.cc
M   source/blender/nodes/function/nodes/node_fn_float_to_int.cc
M   source/blender/nodes/function/nodes/node_fn_input_bool.cc
M   source/blender/nodes/function/nodes/node_fn_input_color.cc
M   source/blender/nodes/function/nodes/node_fn_input_int.cc
M   source/blender/nodes/function/nodes/node_fn_input_special_characters.cc
M   source/blender/nodes/function/nodes/node_fn_input_string.cc
M   source/blender/nodes/function/nodes/node_fn_input_vector.cc
M   source/blender/nodes/function/nodes/node_fn_random_value.cc
M   source/blender/nodes/function/nodes/node_fn_replace_string.cc
M   source/blender/nodes/function/nodes/node_fn_rotate_euler.cc
M   source/blender/nodes/function/nodes/node_fn_slice_string.cc
M   source/blender/nodes/function/nodes/node_fn_string_length.cc
M   source/blender/nodes/function/nodes/node_fn_value_to_string.cc
M   
source/blender/nodes/geometry/nodes/legacy/node_geo_align_rotation_to_vector.cc
M   source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_clamp.cc
M   
source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_color_ramp.cc
M   
source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_combine_xyz.cc
M   source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_compare.cc
M   source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_convert.cc
M   
source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_curve_map.cc
M   source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_fill.cc
M   
source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_map_range.cc
M   source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_math.cc
M   source/blender/nodes/geometry/nodes/legacy/node_geo_attribute_mix.cc
M   

[Bf-blender-cvs] [837b72fa83e] master: Merge branch 'blender-v3.0-release'

2021-10-29 Thread Germano Cavalcante
Commit: 837b72fa83e448a1f3ea17dbfe7e939b51463b1f
Author: Germano Cavalcante
Date:   Fri Oct 29 11:25:32 2021 -0300
Branches: master
https://developer.blender.org/rB837b72fa83e448a1f3ea17dbfe7e939b51463b1f

Merge branch 'blender-v3.0-release'

===



===



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


[Bf-blender-cvs] [7e94499bb3b] blender-v3.0-release: Fix snap cursor not working in regions with transparency

2021-10-29 Thread Germano Cavalcante
Commit: 7e94499bb3bb64170f826471a86ce0f957eab3a3
Author: Germano Cavalcante
Date:   Fri Oct 29 11:23:56 2021 -0300
Branches: blender-v3.0-release
https://developer.blender.org/rB7e94499bb3bb64170f826471a86ce0f957eab3a3

Fix snap cursor not working in regions with transparency

Use `BKE_area_find_region_type` instead of using the context region.

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_cursor_snap.c 
b/source/blender/editors/space_view3d/view3d_cursor_snap.c
index e8f1e011364..baf61befcba 100644
--- a/source/blender/editors/space_view3d/view3d_cursor_snap.c
+++ b/source/blender/editors/space_view3d/view3d_cursor_snap.c
@@ -37,6 +37,7 @@
 #include "BKE_main.h"
 #include "BKE_object.h"
 #include "BKE_scene.h"
+#include "BKE_screen.h"
 
 #include "GPU_immediate.h"
 #include "GPU_matrix.h"
@@ -764,16 +765,12 @@ static bool v3d_cursor_snap_pool_fn(bContext *C)
 return false;
   }
 
-  ARegion *region = CTX_wm_region(C);
-  if (region->regiontype != RGN_TYPE_WINDOW) {
-return false;
-  }
-
   ScrArea *area = CTX_wm_area(C);
   if (area->spacetype != SPACE_VIEW3D) {
 return false;
   }
 
+  ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
   RegionView3D *rv3d = region->regiondata;
   if (rv3d->rflag & RV3D_NAVIGATING) {
 /* Don't draw the cursor while navigating. It can be distracting. */
@@ -790,7 +787,8 @@ static void v3d_cursor_snap_draw_fn(bContext *C, int x, int 
y, void *UNUSED(cust
   V3DSnapCursorData *snap_data = _intern->snap_data;
 
   wmWindowManager *wm = CTX_wm_manager(C);
-  ARegion *region = CTX_wm_region(C);
+  ScrArea *area = CTX_wm_area(C);
+  ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
   x -= region->winrct.xmin;
   y -= region->winrct.ymin;
   if (v3d_cursor_eventstate_has_changed(data_intern, state, wm, x, y)) {
@@ -955,7 +953,8 @@ V3DSnapCursorData 
*ED_view3d_cursor_snap_data_get(V3DSnapCursorState *state,
 if (v3d_cursor_eventstate_has_changed(data_intern, state, wm, x, y)) {
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
   Scene *scene = DEG_get_input_scene(depsgraph);
-  ARegion *region = CTX_wm_region(C);
+  ScrArea *area = CTX_wm_area(C);
+  ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
   View3D *v3d = CTX_wm_view3d(C);
 
   if (!state) {

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


[Bf-blender-cvs] [d18d87d3e7d] master: Fix T92576: Crash switching from Asset Browser to File Brower

2021-10-29 Thread Julian Eisel
Commit: d18d87d3e7d381124f91c2230eb447ff5b001c27
Author: Julian Eisel
Date:   Fri Oct 29 15:59:03 2021 +0200
Branches: master
https://developer.blender.org/rBd18d87d3e7d381124f91c2230eb447ff5b001c27

Fix T92576: Crash switching from Asset Browser to File Brower

The asset catalog filtering data needs to be cleared when with the other
asset library data of the file list. This is done when changing between
asset and file browser (and in other cases).

===

M   source/blender/editors/space_file/filelist.c

===

diff --git a/source/blender/editors/space_file/filelist.c 
b/source/blender/editors/space_file/filelist.c
index a1b1c8cc363..a73fa2b9740 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1911,6 +1911,7 @@ static void filelist_clear_asset_library(FileList 
*filelist)
 {
   /* The AssetLibraryService owns the AssetLibrary pointer, so no need for us 
to free it. */
   filelist->asset_library = NULL;
+  
file_delete_asset_catalog_filter_settings(>filter_data.asset_catalog_filter);
 }
 
 void filelist_clear_ex(struct FileList *filelist,
@@ -2010,7 +2011,6 @@ void filelist_free(struct FileList *filelist)
 filelist->selection_state = NULL;
   }
 
-  
file_delete_asset_catalog_filter_settings(>filter_data.asset_catalog_filter);
   MEM_SAFE_FREE(filelist->asset_library_ref);
 
   memset(>filter_data, 0, sizeof(filelist->filter_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] [e1db6dc11b5] master: Fix crash on undo after recent lib_query refactor.

2021-10-29 Thread Bastien Montagne
Commit: e1db6dc11b56497561181a18d35db0badda4e84a
Author: Bastien Montagne
Date:   Fri Oct 29 12:54:32 2021 +0200
Branches: master
https://developer.blender.org/rBe1db6dc11b56497561181a18d35db0badda4e84a

Fix crash on undo after recent lib_query refactor.

Forgot that scene uses part of its ID looping code for specific undo
handling.

Caused by rBe3b2f0fd6ff9.

===

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

===

diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 3853687a8f1..a827e1c32a2 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -523,7 +523,10 @@ static void scene_foreach_toolsettings_id_pointer_process(
   }
 }
 
-#define BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS( \
+/* Special handling is needed here, as `scene_foreach_toolsettings` (and its 
dependency
+ * `scene_foreach_paint`) are also used by `scene_undo_preserve`, where 
`LibraryForeachIDData
+ * *data` is NULL. */
+#define BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER( \
 __data, __id, __do_undo_restore, __action, __reader, __id_old, __cb_flag) \
   { \
 if (__do_undo_restore) { \
@@ -531,24 +534,38 @@ static void scene_foreach_toolsettings_id_pointer_process(
   (ID **)&(__id), __action, __reader, (ID **)&(__id_old), __cb_flag); \
 } \
 else { \
+  BLI_assert((__data) != NULL); \
   BKE_LIB_FOREACHID_PROCESS_IDSUPER(__data, __id, __cb_flag); \
 } \
   } \
   (void)0
 
+#define BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_FUNCTION_CALL( \
+__data, __do_undo_restore, __func_call) \
+  { \
+if (__do_undo_restore) { \
+  __func_call; \
+} \
+else { \
+  BLI_assert((__data) != NULL); \
+  BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(__data, __func_call); \
+} \
+  } \
+  (void)0
+
 static void scene_foreach_paint(LibraryForeachIDData *data,
 Paint *paint,
 const bool do_undo_restore,
 BlendLibReader *reader,
 Paint *paint_old)
 {
-  BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
-  paint->brush,
-  do_undo_restore,
-  SCENE_FOREACH_UNDO_RESTORE,
-  reader,
-  paint_old->brush,
-  IDWALK_CB_USER);
+  BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
+  paint->brush,
+  do_undo_restore,
+  SCENE_FOREACH_UNDO_RESTORE,
+  reader,
+  paint_old->brush,
+  IDWALK_CB_USER);
   for (int i = 0; i < paint_old->tool_slots_len; i++) {
 /* This is a bit tricky.
  *  - In case we do not do `undo_restore`, `paint` and `paint_old` 
pointers are the same, so
@@ -560,21 +577,21 @@ static void scene_foreach_paint(LibraryForeachIDData 
*data,
  */
 Brush *brush_tmp = NULL;
 Brush **brush_p = i < paint->tool_slots_len ? >tool_slots[i].brush 
: _tmp;
-BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
-*brush_p,
-do_undo_restore,
-SCENE_FOREACH_UNDO_RESTORE,
-reader,
-paint_old->brush,
-IDWALK_CB_USER);
-  }
-  BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS(data,
-  paint->palette,
-  do_undo_restore,
-  SCENE_FOREACH_UNDO_RESTORE,
-  reader,
-  paint_old->palette,
-  IDWALK_CB_USER);
+BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
+*brush_p,
+do_undo_restore,
+SCENE_FOREACH_UNDO_RESTORE,
+reader,
+paint_old->brush,
+IDWALK_CB_USER);
+  }
+  BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
+  paint->palette,
+

[Bf-blender-cvs] [e3b2f0fd6ff] master: LibQuery: Add macro to help break looping when requested.

2021-10-29 Thread Bastien Montagne
Commit: e3b2f0fd6ff912bac69a94e35ac2f617c720328e
Author: Bastien Montagne
Date:   Wed Oct 27 11:30:43 2021 +0200
Branches: master
https://developer.blender.org/rBe3b2f0fd6ff912bac69a94e35ac2f617c720328e

LibQuery: Add macro to help break looping when requested.

The new `BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL` execute the given
statement and then check status of `LibraryForeachIDData` data, and
return in case stop of iteration is requested.

This is very similar to the other `BKE_LIB_FOREACHID_PROCESS_` existing
macros, and allows us to properly break iteration when a sub-function
has requested it.

Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.

===

M   source/blender/blenkernel/BKE_lib_query.h
M   source/blender/blenkernel/intern/action.c
M   source/blender/blenkernel/intern/anim_data.c
M   source/blender/blenkernel/intern/armature.c
M   source/blender/blenkernel/intern/brush.c
M   source/blender/blenkernel/intern/fcurve.c
M   source/blender/blenkernel/intern/light.c
M   source/blender/blenkernel/intern/linestyle.c
M   source/blender/blenkernel/intern/material.c
M   source/blender/blenkernel/intern/nla.c
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/particle.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenkernel/intern/screen.c
M   source/blender/blenkernel/intern/simulation.cc
M   source/blender/blenkernel/intern/texture.c
M   source/blender/blenkernel/intern/world.c
M   source/blender/windowmanager/intern/wm.c

===

diff --git a/source/blender/blenkernel/BKE_lib_query.h 
b/source/blender/blenkernel/BKE_lib_query.h
index 093d3fb12a6..364a9056dd4 100644
--- a/source/blender/blenkernel/BKE_lib_query.h
+++ b/source/blender/blenkernel/BKE_lib_query.h
@@ -172,6 +172,15 @@ int 
BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeach
   } \
   ((void)0)
 
+#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(_data, _func_call) \
+  { \
+_func_call; \
+if (BKE_lib_query_foreachid_iter_stop((_data))) { \
+  return; \
+} \
+  } \
+  ((void)0)
+
 bool BKE_library_foreach_ID_embedded(struct LibraryForeachIDData *data, struct 
ID **id_pp);
 void BKE_lib_query_idpropertiesForeachIDLink_callback(struct IDProperty 
*id_prop, void *user_data);
 
diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index 7403b7f2109..cae72ddf68c 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -175,7 +175,7 @@ static void action_foreach_id(ID *id, LibraryForeachIDData 
*data)
   bAction *act = (bAction *)id;
 
   LISTBASE_FOREACH (FCurve *, fcu, >curves) {
-BKE_fcurve_foreach_id(fcu, data);
+BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data, BKE_fcurve_foreach_id(fcu, 
data));
   }
 
   LISTBASE_FOREACH (TimeMarker *, marker, >markers) {
diff --git a/source/blender/blenkernel/intern/anim_data.c 
b/source/blender/blenkernel/intern/anim_data.c
index 23d2c4fe55f..21887d514d9 100644
--- a/source/blender/blenkernel/intern/anim_data.c
+++ b/source/blender/blenkernel/intern/anim_data.c
@@ -294,7 +294,7 @@ bool BKE_animdata_id_is_animated(const struct ID *id)
 void BKE_animdata_foreach_id(AnimData *adt, LibraryForeachIDData *data)
 {
   LISTBASE_FOREACH (FCurve *, fcu, >drivers) {
-BKE_fcurve_foreach_id(fcu, data);
+BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data, BKE_fcurve_foreach_id(fcu, 
data));
   }
 
   BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, adt->action, IDWALK_CB_USER);
diff --git a/source/blender/blenkernel/intern/armature.c 
b/source/blender/blenkernel/intern/armature.c
index b64b050f4e7..b830c9de5f5 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -161,30 +161,36 @@ static void armature_free_data(struct ID *id)
 
 static void armature_foreach_id_bone(Bone *bone, LibraryForeachIDData *data)
 {
-  IDP_foreach_property(
-  bone->prop, IDP_TYPE_FILTER_ID, 
BKE_lib_query_idpropertiesForeachIDLink_callback, data);
+  BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(
+  data,
+  IDP_foreach_property(
+  bone->prop, IDP_TYPE_FILTER_ID, 
BKE_lib_query_idpropertiesForeachIDLink_callback, data));
 
   LISTBASE_FOREACH (Bone *, curbone, >childbase) {
-armature_foreach_id_bone(curbone, data);
+BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data, 
armature_foreach_id_bone(curbone, data));
   }
 }
 
 static void armature_foreach_id_editbone(EditBone *edit_bone, 
LibraryForeachIDData *data)
 {
-  IDP_foreach_property(
-  edit_bone->prop, IDP_TYPE_FILTER_ID, 
BKE_lib_query_idpropertiesForeachIDLink_callback, data);
+  BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(
+  data,
+  

[Bf-blender-cvs] [259731909c8] master: LibQuery: Fix potential memleak in recursive case.

2021-10-29 Thread Bastien Montagne
Commit: 259731909c8013fa6d8cdaa221ad7785cabd48ce
Author: Bastien Montagne
Date:   Wed Oct 27 12:04:36 2021 +0200
Branches: master
https://developer.blender.org/rB259731909c8013fa6d8cdaa221ad7785cabd48ce

LibQuery: Fix potential memleak in recursive case.

In case `library_foreach_ID_link` would return early in recursive
process, it would not properly free its utils data.

Also add proper iteration break in case some sub-calls requested it.

Finally, make this function return a boolean to know whether iteration
should be stopped or not (will be used in future commit to fix this
handling in embedded IDs case).

Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.

===

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

===

diff --git a/source/blender/blenkernel/intern/lib_query.c 
b/source/blender/blenkernel/intern/lib_query.c
index 79b093bedbe..f0011a3b533 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -146,7 +146,7 @@ int 
BKE_lib_query_foreachid_process_callback_flag_override(LibraryForeachIDData
   return cb_flag_backup;
 }
 
-static void library_foreach_ID_link(Main *bmain,
+static bool library_foreach_ID_link(Main *bmain,
 ID *id_owner,
 ID *id,
 LibraryIDLinkCallback callback,
@@ -200,7 +200,16 @@ bool BKE_library_foreach_ID_embedded(LibraryForeachIDData 
*data, ID **id_pp)
   return true;
 }
 
-static void library_foreach_ID_link(Main *bmain,
+static void library_foreach_ID_data_cleanup(LibraryForeachIDData *data)
+{
+  if (data->ids_handled != NULL) {
+BLI_gset_free(data->ids_handled, NULL);
+BLI_LINKSTACK_FREE(data->ids_todo);
+  }
+}
+
+/** \return false in case iteration over ID pointers must be stopped, true 
otherwise. */
+static bool library_foreach_ID_link(Main *bmain,
 ID *id_owner,
 ID *id,
 LibraryIDLinkCallback callback,
@@ -235,10 +244,26 @@ static void library_foreach_ID_link(Main *bmain,
   data.user_data = user_data;
 
 #define CALLBACK_INVOKE_ID(check_id, cb_flag) \
-  BKE_LIB_FOREACHID_PROCESS_ID(, check_id, cb_flag)
+  { \
+CHECK_TYPE_ANY((check_id), ID *, void *); \
+BKE_lib_query_foreachid_process(, (ID **)&(check_id), (cb_flag)); \
+if (BKE_lib_query_foreachid_iter_stop()) { \
+  library_foreach_ID_data_cleanup(); \
+  return false; \
+} \
+  } \
+  ((void)0)
 
 #define CALLBACK_INVOKE(check_id_super, cb_flag) \
-  BKE_LIB_FOREACHID_PROCESS_IDSUPER(, check_id_super, cb_flag)
+  { \
+CHECK_TYPE(&((check_id_super)->id), ID *); \
+BKE_lib_query_foreachid_process(, (ID **)&(check_id_super), 
(cb_flag)); \
+if (BKE_lib_query_foreachid_iter_stop()) { \
+  library_foreach_ID_data_cleanup(); \
+  return false; \
+} \
+  } \
+  ((void)0)
 
   for (; id != NULL; id = (flag & IDWALK_RECURSE) ? 
BLI_LINKSTACK_POP(data.ids_todo) : NULL) {
 data.self_id = id;
@@ -280,6 +305,10 @@ static void library_foreach_ID_link(Main *bmain,
to_id_entry = to_id_entry->next) {
 BKE_lib_query_foreachid_process(
 , to_id_entry->id_pointer.to, to_id_entry->usage_flag);
+if (BKE_lib_query_foreachid_iter_stop()) {
+  library_foreach_ID_data_cleanup();
+  return false;
+}
   }
   continue;
 }
@@ -303,26 +332,33 @@ static void library_foreach_ID_link(Main *bmain,
  IDP_TYPE_FILTER_ID,
  BKE_lib_query_idpropertiesForeachIDLink_callback,
  );
+if (BKE_lib_query_foreachid_iter_stop()) {
+  library_foreach_ID_data_cleanup();
+  return false;
+}
 
 AnimData *adt = BKE_animdata_from_id(id);
 if (adt) {
   BKE_animdata_foreach_id(adt, );
+  if (BKE_lib_query_foreachid_iter_stop()) {
+library_foreach_ID_data_cleanup();
+return false;
+  }
 }
 
 const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id);
 if (id_type->foreach_id != NULL) {
   id_type->foreach_id(id, );
 
-  if (data.status & IDWALK_STOP) {
-break;
+  if (BKE_lib_query_foreachid_iter_stop()) {
+library_foreach_ID_data_cleanup();
+return false;
   }
 }
   }
 
-  if (data.ids_handled) {
-BLI_gset_free(data.ids_handled, NULL);
-BLI_LINKSTACK_FREE(data.ids_todo);
-  }
+  library_foreach_ID_data_cleanup();
+  return true;
 
 #undef CALLBACK_INVOKE_ID
 #undef CALLBACK_INVOKE

___
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] [c8c53ceecc3] master: LibQuery: Remove last 'bool returns' from public API.

2021-10-29 Thread Bastien Montagne
Commit: c8c53ceecc3022c7a8e5f84e619ac9ea6994ed5c
Author: Bastien Montagne
Date:   Wed Oct 27 12:16:31 2021 +0200
Branches: master
https://developer.blender.org/rBc8c53ceecc3022c7a8e5f84e619ac9ea6994ed5c

LibQuery: Remove last 'bool returns' from public API.

Those were used in a very few places to detect whether iteration should
be stopped or not, but one can use `BKE_lib_query_foreachid_iter_stop`
now for that.

Also fix early break handling in embedded IDs processing.

Fix T90922: Fix return policy inconsistency in `scene_foreach_id`.

===

M   source/blender/blenkernel/BKE_lib_query.h
M   source/blender/blenkernel/intern/lib_query.c
M   source/blender/blenkernel/intern/scene.c

===

diff --git a/source/blender/blenkernel/BKE_lib_query.h 
b/source/blender/blenkernel/BKE_lib_query.h
index 364a9056dd4..30c742e3af6 100644
--- a/source/blender/blenkernel/BKE_lib_query.h
+++ b/source/blender/blenkernel/BKE_lib_query.h
@@ -144,7 +144,7 @@ enum {
 typedef struct LibraryForeachIDData LibraryForeachIDData;
 
 bool BKE_lib_query_foreachid_iter_stop(struct LibraryForeachIDData *data);
-bool BKE_lib_query_foreachid_process(struct LibraryForeachIDData *data,
+void BKE_lib_query_foreachid_process(struct LibraryForeachIDData *data,
  struct ID **id_pp,
  int cb_flag);
 int BKE_lib_query_foreachid_process_flags_get(struct LibraryForeachIDData 
*data);
@@ -181,7 +181,7 @@ int 
BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeach
   } \
   ((void)0)
 
-bool BKE_library_foreach_ID_embedded(struct LibraryForeachIDData *data, struct 
ID **id_pp);
+void BKE_library_foreach_ID_embedded(struct LibraryForeachIDData *data, struct 
ID **id_pp);
 void BKE_lib_query_idpropertiesForeachIDLink_callback(struct IDProperty 
*id_prop, void *user_data);
 
 /* Loop over all of the ID's this datablock links to. */
diff --git a/source/blender/blenkernel/intern/lib_query.c 
b/source/blender/blenkernel/intern/lib_query.c
index f0011a3b533..74750a9b61a 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -83,48 +83,45 @@ bool BKE_lib_query_foreachid_iter_stop(LibraryForeachIDData 
*data)
   return (data->status & IDWALK_STOP) != 0;
 }
 
-bool BKE_lib_query_foreachid_process(LibraryForeachIDData *data, ID **id_pp, 
int cb_flag)
+void BKE_lib_query_foreachid_process(LibraryForeachIDData *data, ID **id_pp, 
int cb_flag)
 {
-  if (!(data->status & IDWALK_STOP)) {
-const int flag = data->flag;
-ID *old_id = *id_pp;
-
-/* Update the callback flags with the ones defined (or forbidden) in 
`data` by the generic
- * caller code. */
-cb_flag = ((cb_flag | data->cb_flag) & ~data->cb_flag_clear);
-
-/* Update the callback flags with some extra information regarding 
overrides: all 'loopback',
- * 'internal', 'embedded' etc. ID pointers are never overridable. */
-if (cb_flag &
-(IDWALK_CB_INTERNAL | IDWALK_CB_LOOPBACK | 
IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
-  cb_flag |= IDWALK_CB_OVERRIDE_LIBRARY_NOT_OVERRIDABLE;
-}
+  if (BKE_lib_query_foreachid_iter_stop(data)) {
+return;
+  }
 
-const int callback_return = data->callback(
-&(struct LibraryIDLinkCallbackData){.user_data = data->user_data,
-.bmain = data->bmain,
-.id_owner = data->owner_id,
-.id_self = data->self_id,
-.id_pointer = id_pp,
-.cb_flag = cb_flag});
-if (flag & IDWALK_READONLY) {
-  BLI_assert(*(id_pp) == old_id);
-}
-if (old_id && (flag & IDWALK_RECURSE)) {
-  if (BLI_gset_add((data)->ids_handled, old_id)) {
-if (!(callback_return & IDWALK_RET_STOP_RECURSION)) {
-  BLI_LINKSTACK_PUSH(data->ids_todo, old_id);
-}
+  const int flag = data->flag;
+  ID *old_id = *id_pp;
+
+  /* Update the callback flags with the ones defined (or forbidden) in `data` 
by the generic
+   * caller code. */
+  cb_flag = ((cb_flag | data->cb_flag) & ~data->cb_flag_clear);
+
+  /* Update the callback flags with some extra information regarding 
overrides: all 'loopback',
+   * 'internal', 'embedded' etc. ID pointers are never overridable. */
+  if (cb_flag & (IDWALK_CB_INTERNAL | IDWALK_CB_LOOPBACK | 
IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
+cb_flag |= IDWALK_CB_OVERRIDE_LIBRARY_NOT_OVERRIDABLE;
+  }
+
+  const int callback_return = data->callback(
+  &(struct LibraryIDLinkCallbackData){.user_data = data->user_data,
+  .bmain = data->bmain,
+  .id_owner = data->owner_id,
+  

[Bf-blender-cvs] [51c1c1cd938] master: Fix potential early-return in WM foreach_id process.

2021-10-29 Thread Bastien Montagne
Commit: 51c1c1cd938f990333b09d89fb063bb28864b302
Author: Bastien Montagne
Date:   Tue Oct 26 17:23:38 2021 +0200
Branches: master
https://developer.blender.org/rB51c1c1cd938f990333b09d89fb063bb28864b302

Fix potential early-return in WM foreach_id process.

Add a function to check if iteration over ID usages should stop (using
internal `IDWALK_STOP` status flag).

Use it in `BKE_LIB_FOREACHID_PROCESS_` macros, and in
`window_manager_foreach_id` to handle properly the active workspace case
(previous code could skip the call to `BKE_workspace_active_set` in case
iteration over ID usages was stopped by callback on that specific ID
usage).

Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.

===

M   source/blender/blenkernel/BKE_lib_query.h
M   source/blender/blenkernel/intern/lib_query.c
M   source/blender/windowmanager/intern/wm.c

===

diff --git a/source/blender/blenkernel/BKE_lib_query.h 
b/source/blender/blenkernel/BKE_lib_query.h
index 957a623577e..093d3fb12a6 100644
--- a/source/blender/blenkernel/BKE_lib_query.h
+++ b/source/blender/blenkernel/BKE_lib_query.h
@@ -143,6 +143,7 @@ enum {
 
 typedef struct LibraryForeachIDData LibraryForeachIDData;
 
+bool BKE_lib_query_foreachid_iter_stop(struct LibraryForeachIDData *data);
 bool BKE_lib_query_foreachid_process(struct LibraryForeachIDData *data,
  struct ID **id_pp,
  int cb_flag);
@@ -154,7 +155,8 @@ int 
BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeach
 #define BKE_LIB_FOREACHID_PROCESS_ID(_data, _id, _cb_flag) \
   { \
 CHECK_TYPE_ANY((_id), ID *, void *); \
-if (!BKE_lib_query_foreachid_process((_data), (ID **)&(_id), (_cb_flag))) 
{ \
+BKE_lib_query_foreachid_process((_data), (ID **)&(_id), (_cb_flag)); \
+if (BKE_lib_query_foreachid_iter_stop((_data))) { \
   return; \
 } \
   } \
@@ -163,7 +165,8 @@ int 
BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeach
 #define BKE_LIB_FOREACHID_PROCESS_IDSUPER(_data, _id_super, _cb_flag) \
   { \
 CHECK_TYPE(&((_id_super)->id), ID *); \
-if (!BKE_lib_query_foreachid_process((_data), (ID **)&(_id_super), 
(_cb_flag))) { \
+BKE_lib_query_foreachid_process((_data), (ID **)&(_id_super), (_cb_flag)); 
\
+if (BKE_lib_query_foreachid_iter_stop((_data))) { \
   return; \
 } \
   } \
diff --git a/source/blender/blenkernel/intern/lib_query.c 
b/source/blender/blenkernel/intern/lib_query.c
index 317621e1149..79b093bedbe 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -76,6 +76,13 @@ typedef struct LibraryForeachIDData {
   BLI_LINKSTACK_DECLARE(ids_todo, ID *);
 } LibraryForeachIDData;
 
+/** Check whether current iteration over ID usages should be stopped or not.
+ * \return true if the iteration should be stopped, false otherwise. */
+bool BKE_lib_query_foreachid_iter_stop(LibraryForeachIDData *data)
+{
+  return (data->status & IDWALK_STOP) != 0;
+}
+
 bool BKE_lib_query_foreachid_process(LibraryForeachIDData *data, ID **id_pp, 
int cb_flag)
 {
   if (!(data->status & IDWALK_STOP)) {
diff --git a/source/blender/windowmanager/intern/wm.c 
b/source/blender/windowmanager/intern/wm.c
index 4458b386ab6..aa439f619be 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -91,10 +91,14 @@ static void window_manager_foreach_id(ID *id, 
LibraryForeachIDData *data)
 /* This pointer can be NULL during old files reading, better be safe than 
sorry. */
 if (win->workspace_hook != NULL) {
   ID *workspace = (ID *)BKE_workspace_active_get(win->workspace_hook);
-  BKE_LIB_FOREACHID_PROCESS_ID(data, workspace, IDWALK_CB_NOP);
+  BKE_lib_query_foreachid_process(data, , IDWALK_CB_USER);
   /* Allow callback to set a different workspace. */
   BKE_workspace_active_set(win->workspace_hook, (WorkSpace *)workspace);
+  if (BKE_lib_query_foreachid_iter_stop(data)) {
+return;
+  }
 }
+
 if (BKE_lib_query_foreachid_process_flags_get(data) & IDWALK_INCLUDE_UI) {
   LISTBASE_FOREACH (ScrArea *, area, >global_areas.areabase) {
 BKE_screen_foreach_id_screen_area(data, area);

___
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] [eae59645def] master: Cleanup: Add some comments to some sub-function of `foreach_id` process.

2021-10-29 Thread Bastien Montagne
Commit: eae59645def368a46c546a5d88db4b885f707b9b
Author: Bastien Montagne
Date:   Tue Oct 26 17:22:10 2021 +0200
Branches: master
https://developer.blender.org/rBeae59645def368a46c546a5d88db4b885f707b9b

Cleanup: Add some comments to some sub-function of `foreach_id` process.

===

M   source/blender/blenkernel/intern/lib_query.c
M   source/blender/blenkernel/intern/screen.c

===

diff --git a/source/blender/blenkernel/intern/lib_query.c 
b/source/blender/blenkernel/intern/lib_query.c
index 4165452801c..317621e1149 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -210,6 +210,10 @@ static void library_foreach_ID_link(Main *bmain,
 flag |= IDWALK_READONLY;
 flag &= ~IDWALK_DO_INTERNAL_RUNTIME_POINTERS;
 
+/* NOTE: This function itself should never be called recursively when 
IDWALK_RECURSE is set,
+ * see also comments in #BKE_library_foreach_ID_embedded.
+ * This is why we can always create this data here, and do not need to try 
and re-use it from
+ * `inherit_data`. */
 data.ids_handled = BLI_gset_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, __func__);
 BLI_LINKSTACK_INIT(data.ids_todo);
 
diff --git a/source/blender/blenkernel/intern/screen.c 
b/source/blender/blenkernel/intern/screen.c
index 3e1a2a9bbe9..1ddfd4e47ac 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -97,6 +97,10 @@ static void screen_foreach_id_dopesheet(LibraryForeachIDData 
*data, bDopeSheet *
   }
 }
 
+/**
+ * Callback used by lib_query to walk over all ID usages (mimics `foreach_id` 
callback of
+ * `IDTypeInfo` structure).
+ */
 void BKE_screen_foreach_id_screen_area(LibraryForeachIDData *data, ScrArea 
*area)
 {
   BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, area->full, IDWALK_CB_NOP);
@@ -107,10 +111,8 @@ void 
BKE_screen_foreach_id_screen_area(LibraryForeachIDData *data, ScrArea *area
 switch (sl->spacetype) {
   case SPACE_VIEW3D: {
 View3D *v3d = (View3D *)sl;
-
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, v3d->camera, IDWALK_CB_NOP);
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, v3d->ob_center, IDWALK_CB_NOP);
-
 if (v3d->localvd) {
   BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, v3d->localvd->camera, 
IDWALK_CB_NOP);
 }
@@ -124,7 +126,6 @@ void BKE_screen_foreach_id_screen_area(LibraryForeachIDData 
*data, ScrArea *area
   }
   case SPACE_PROPERTIES: {
 SpaceProperties *sbuts = (SpaceProperties *)sl;
-
 BKE_LIB_FOREACHID_PROCESS_ID(data, sbuts->pinid, IDWALK_CB_NOP);
 break;
   }
@@ -132,14 +133,12 @@ void 
BKE_screen_foreach_id_screen_area(LibraryForeachIDData *data, ScrArea *area
 break;
   case SPACE_ACTION: {
 SpaceAction *saction = (SpaceAction *)sl;
-
 screen_foreach_id_dopesheet(data, >ads);
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, saction->action, 
IDWALK_CB_NOP);
 break;
   }
   case SPACE_IMAGE: {
 SpaceImage *sima = (SpaceImage *)sl;
-
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, sima->image, 
IDWALK_CB_USER_ONE);
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, sima->mask_info.mask, 
IDWALK_CB_USER_ONE);
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, sima->gpd, IDWALK_CB_USER);
@@ -147,7 +146,6 @@ void BKE_screen_foreach_id_screen_area(LibraryForeachIDData 
*data, ScrArea *area
   }
   case SPACE_SEQ: {
 SpaceSeq *sseq = (SpaceSeq *)sl;
-
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, sseq->gpd, IDWALK_CB_USER);
 break;
   }
@@ -159,21 +157,17 @@ void 
BKE_screen_foreach_id_screen_area(LibraryForeachIDData *data, ScrArea *area
   }
   case SPACE_TEXT: {
 SpaceText *st = (SpaceText *)sl;
-
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, st->text, IDWALK_CB_NOP);
 break;
   }
   case SPACE_SCRIPT: {
 SpaceScript *scpt = (SpaceScript *)sl;
-
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, scpt->script, IDWALK_CB_NOP);
 break;
   }
   case SPACE_OUTLINER: {
 SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
-
 BKE_LIB_FOREACHID_PROCESS_ID(data, space_outliner->search_tse.id, 
IDWALK_CB_NOP);
-
 if (space_outliner->treestore != NULL) {
   TreeStoreElem *tselem;
   BLI_mempool_iter iter;
@@ -187,13 +181,11 @@ void 
BKE_screen_foreach_id_screen_area(LibraryForeachIDData *data, ScrArea *area
   }
   case SPACE_NODE: {
 SpaceNode *snode = (SpaceNode *)sl;
-
 const bool is_private_nodetree = snode->id != NULL &&
  ntreeFromID(snode->id) == 
snode->nodetree;
 
 BKE_LIB_FOREACHID_PROCESS_ID(data, snode->id, IDWALK_CB_NOP);
 BKE_LIB_FOREACHID_PROCESS_ID(data, snode->from, IDWALK_CB_NOP);
-
 

[Bf-blender-cvs] [c112418e952] master: Merge branch 'blender-v3.0-release'

2021-10-29 Thread Jacques Lucke
Commit: c112418e952b51bbf4d56ea08a8856d74795b604
Author: Jacques Lucke
Date:   Fri Oct 29 11:05:20 2021 +0200
Branches: master
https://developer.blender.org/rBc112418e952b51bbf4d56ea08a8856d74795b604

Merge branch 'blender-v3.0-release'

===



===



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


[Bf-blender-cvs] [2d42dc4182f] blender-v3.0-release: Cleanup: remove unused function

2021-10-29 Thread Jacques Lucke
Commit: 2d42dc4182ffe6fbb8bd48af2e1a4576efcaf4af
Author: Jacques Lucke
Date:   Fri Oct 29 10:39:05 2021 +0200
Branches: blender-v3.0-release
https://developer.blender.org/rB2d42dc4182ffe6fbb8bd48af2e1a4576efcaf4af

Cleanup: remove unused function

===

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

===

diff --git a/release/scripts/startup/bl_operators/spreadsheet.py 
b/release/scripts/startup/bl_operators/spreadsheet.py
index b5098d63dac..ba0c9969356 100644
--- a/release/scripts/startup/bl_operators/spreadsheet.py
+++ b/release/scripts/startup/bl_operators/spreadsheet.py
@@ -50,19 +50,6 @@ class SPREADSHEET_OT_toggle_pin(Operator):
 space.is_pinned = False
 space.context_path.guess()
 
-def find_geometry_node_editors(self, context):
-editors = []
-for window in context.window_manager.windows:
-for area in window.screen.areas:
-space = area.spaces.active
-if space.type != 'NODE_EDITOR':
-continue
-if space.edit_tree is None:
-continue
-if space.edit_tree.type == 'GEOMETRY':
-editors.append(space)
-return editors
-
 
 classes = (
 SPREADSHEET_OT_toggle_pin,

___
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] [f13826a572f] blender-v3.0-release: Fix T92476: wrong context in spreadsheet when area is maximized

2021-10-29 Thread Jacques Lucke
Commit: f13826a572f76fe7a359e84f003c667d3b801725
Author: Jacques Lucke
Date:   Fri Oct 29 11:04:37 2021 +0200
Branches: blender-v3.0-release
https://developer.blender.org/rBf13826a572f76fe7a359e84f003c667d3b801725

Fix T92476: wrong context in spreadsheet when area is maximized

Now, if a spreadsheet editor is maximized, it looks for its context in
the unmaximized screen "below".

===

M   source/blender/editors/space_spreadsheet/spreadsheet_context.cc

===

diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_context.cc 
b/source/blender/editors/space_spreadsheet/spreadsheet_context.cc
index c38e765caee..e55a7cae6a6 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_context.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_context.cc
@@ -373,6 +373,21 @@ void 
ED_spreadsheet_context_path_set_evaluated_object(SpaceSpreadsheet *sspreads
   BLI_addtail(>context_path, context);
 }
 
+static bScreen *find_screen_to_search_for_context(wmWindow *window,
+  SpaceSpreadsheet 
*current_space)
+{
+  bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook);
+  if (ELEM(screen->state, SCREENMAXIMIZED, SCREENFULL)) {
+/* If the spreadsheet is maximized, try to find the context in the 
unmaximized screen. */
+ScrArea *main_area = (ScrArea *)screen->areabase.first;
+SpaceLink *sl = (SpaceLink *)main_area->spacedata.first;
+if (sl == (SpaceLink *)current_space) {
+  return main_area->full;
+}
+  }
+  return screen;
+}
+
 void ED_spreadsheet_context_path_guess(const bContext *C, SpaceSpreadsheet 
*sspreadsheet)
 {
   ED_spreadsheet_context_path_clear(sspreadsheet);
@@ -385,9 +400,12 @@ void ED_spreadsheet_context_path_guess(const bContext *C, 
SpaceSpreadsheet *sspr
 
   if (sspreadsheet->object_eval_state == 
SPREADSHEET_OBJECT_EVAL_STATE_VIEWER_NODE) {
 LISTBASE_FOREACH (wmWindow *, window, >windows) {
-  bScreen *screen = 
BKE_workspace_active_screen_get(window->workspace_hook);
+  bScreen *screen = find_screen_to_search_for_context(window, 
sspreadsheet);
   LISTBASE_FOREACH (ScrArea *, area, >areabase) {
 SpaceLink *sl = (SpaceLink *)area->spacedata.first;
+if (sl == nullptr) {
+  continue;
+}
 if (sl->spacetype == SPACE_NODE) {
   SpaceNode *snode = (SpaceNode *)sl;
   if (snode->edittree != nullptr) {
@@ -466,9 +484,12 @@ bool ED_spreadsheet_context_path_is_active(const bContext 
*C, SpaceSpreadsheet *
   }
 
   LISTBASE_FOREACH (wmWindow *, window, >windows) {
-bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook);
+bScreen *screen = find_screen_to_search_for_context(window, sspreadsheet);
 LISTBASE_FOREACH (ScrArea *, area, >areabase) {
   SpaceLink *sl = (SpaceLink *)area->spacedata.first;
+  if (sl == nullptr) {
+continue;
+  }
   if (sl->spacetype != SPACE_NODE) {
 continue;
   }

___
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] [43bc494892c] master: IDManagement: Remove deprecated `BKE_libblock_relink_to_newid` usages.

2021-10-29 Thread Bastien Montagne
Commit: 43bc494892c3551222601122c880a4da87354634
Author: Bastien Montagne
Date:   Thu Oct 28 11:22:43 2021 +0200
Branches: master
https://developer.blender.org/rB43bc494892c3551222601122c880a4da87354634

IDManagement: Remove deprecated `BKE_libblock_relink_to_newid` usages.

Move all usages to new `BKE_libblock_relink_to_newid_new`, and rename
that one to `BKE_libblock_relink_to_newid`.

Fix T91413.

===

M   source/blender/blenkernel/BKE_lib_remap.h
M   source/blender/blenkernel/intern/collection.c
M   source/blender/blenkernel/intern/lib_remap.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/editors/object/object_add.c
M   source/blender/editors/object/object_relations.c
M   source/blender/windowmanager/intern/wm_files_link.c

===

diff --git a/source/blender/blenkernel/BKE_lib_remap.h 
b/source/blender/blenkernel/BKE_lib_remap.h
index c70521f9593..8df6a803358 100644
--- a/source/blender/blenkernel/BKE_lib_remap.h
+++ b/source/blender/blenkernel/BKE_lib_remap.h
@@ -111,8 +111,7 @@ void BKE_libblock_relink_ex(struct Main *bmain,
 void *new_idv,
 const short remap_flags) ATTR_NONNULL(1, 2);
 
-void BKE_libblock_relink_to_newid(struct ID *id) ATTR_NONNULL();
-void BKE_libblock_relink_to_newid_new(struct Main *bmain, struct ID *id) 
ATTR_NONNULL();
+void BKE_libblock_relink_to_newid(struct Main *bmain, struct ID *id) 
ATTR_NONNULL();
 
 typedef void (*BKE_library_free_notifier_reference_cb)(const void *);
 typedef void (*BKE_library_remap_editor_id_reference_cb)(struct ID *, struct 
ID *);
diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index 2dca5dcb75d..14097ecd8a7 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -716,7 +716,7 @@ Collection *BKE_collection_duplicate(Main *bmain,
 collection_new->id.tag &= ~LIB_TAG_NEW;
 
 /* This code will follow into all ID links using an ID tagged with 
LIB_TAG_NEW. */
-BKE_libblock_relink_to_newid(_new->id);
+BKE_libblock_relink_to_newid(bmain, _new->id);
 
 #ifndef NDEBUG
 /* Call to `BKE_libblock_relink_to_newid` above is supposed to have 
cleared all those flags. */
diff --git a/source/blender/blenkernel/intern/lib_remap.c 
b/source/blender/blenkernel/intern/lib_remap.c
index 905ac5af512..248d85bcae0 100644
--- a/source/blender/blenkernel/intern/lib_remap.c
+++ b/source/blender/blenkernel/intern/lib_remap.c
@@ -669,55 +669,8 @@ void BKE_libblock_relink_ex(
   DEG_relations_tag_update(bmain);
 }
 
+static void libblock_relink_to_newid(Main *bmain, ID *id);
 static int id_relink_to_newid_looper(LibraryIDLinkCallbackData *cb_data)
-{
-  const int cb_flag = cb_data->cb_flag;
-  if (cb_flag & IDWALK_CB_EMBEDDED) {
-return IDWALK_RET_NOP;
-  }
-
-  ID **id_pointer = cb_data->id_pointer;
-  ID *id = *id_pointer;
-  if (id) {
-/* See: NEW_ID macro */
-if (id->newid) {
-  BKE_library_update_ID_link_user(id->newid, id, cb_flag);
-  id = id->newid;
-  *id_pointer = id;
-}
-if (id->tag & LIB_TAG_NEW) {
-  id->tag &= ~LIB_TAG_NEW;
-  BKE_libblock_relink_to_newid(id);
-}
-  }
-  return IDWALK_RET_NOP;
-}
-
-/**
- * Similar to #libblock_relink_ex,
- * but is remapping IDs to their newid value if non-NULL, in given \a id.
- *
- * Very specific usage, not sure we'll keep it on the long run,
- * currently only used in Object/Collection duplication code...
- *
- * WARNING: This is a deprecated version of this function, should not be used 
by new code. See
- * #BKE_libblock_relink_to_newid_new below.
- */
-void BKE_libblock_relink_to_newid(ID *id)
-{
-  if (ID_IS_LINKED(id)) {
-return;
-  }
-
-  BKE_library_foreach_ID_link(NULL, id, id_relink_to_newid_looper, NULL, 0);
-}
-
-/* 
- * FIXME: Port all usages of #BKE_libblock_relink_to_newid to this
- *#BKE_libblock_relink_to_newid_new new code and remove old one.
- ** */
-static void libblock_relink_to_newid_new(Main *bmain, ID *id);
-static int id_relink_to_newid_looper_new(LibraryIDLinkCallbackData *cb_data)
 {
   const int cb_flag = cb_data->cb_flag;
   if (cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
@@ -740,20 +693,20 @@ static int 
id_relink_to_newid_looper_new(LibraryIDLinkCallbackData *cb_data)
 }
 if (id->tag & LIB_TAG_NEW) {
   id->tag &= ~LIB_TAG_NEW;
-  libblock_relink_to_newid_new(bmain, id);
+  libblock_relink_to_newid(bmain, id);
 }
   }
   return IDWALK_RET_NOP;
 }
 
-static void libblock_relink_to_newid_new(Main *bmain, ID *id)
+static void libblock_relink_to_newid(Main *bmain, ID *id)
 {
   if (ID_IS_LINKED(id)) {
 return;
   }
 
   id->tag &= 

[Bf-blender-cvs] [14b8f6c25b2] blender-v2.83-release: VSE: Implement sanity check for files with more channels than supported

2021-10-29 Thread Dalai Felinto
Commit: 14b8f6c25b2912fdc669c1b5640dcb4bb7d927f1
Author: Dalai Felinto
Date:   Fri Oct 29 10:33:40 2021 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB14b8f6c25b2912fdc669c1b5640dcb4bb7d927f1

VSE: Implement sanity check for files with more channels than supported

This is a follow up to 8fecc2a8525467ee2fbbaae16ddbbc10b3050d46.

This makes sure future .blend files that have more channels than the
limit won't break Blender.

For LTS this happens silently, without warning the users.

This is part of https://developer.blender.org/D12645

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

===

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

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 630ead642a3..47cbff0d391 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6789,7 +6789,11 @@ static void link_recurs_seq(FileData *fd, ListBase *lb)
   link_list(fd, lb);
 
   for (seq = lb->first; seq; seq = seq->next) {
-if (seq->seqbase.first) {
+/* Sanity check. */
+if ((seq->machine < 1) || (seq->machine > MAXSEQ)) {
+  BLI_freelinkN(lb, seq);
+}
+else if (seq->seqbase.first) {
   link_recurs_seq(fd, >seqbase);
 }
   }

___
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] [90ee4b94eea] blender-v2.83-release: Fix LLVM 12 symbol conflict with Mesa drivers, after recent Linux libs update

2021-10-29 Thread Brecht Van Lommel
Commit: 90ee4b94eeadde473d570d849bac0b9e2156c4d9
Author: Brecht Van Lommel
Date:   Tue Jul 27 17:37:59 2021 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB90ee4b94eeadde473d570d849bac0b9e2156c4d9

Fix LLVM 12 symbol conflict with Mesa drivers, after recent Linux libs update

===

M   source/creator/blender.map

===

diff --git a/source/creator/blender.map b/source/creator/blender.map
index 5171e94382d..a40f03404f6 100644
--- a/source/creator/blender.map
+++ b/source/creator/blender.map
@@ -73,21 +73,55 @@ local:
   *YAML*;
 
   /* LLVM symbols not in the LLVM namespace that can conflict with LLVM usage
-   * in OpenGL and OpenCL drivers. */
+   * in OpenGL and OpenCL drivers.
+   *
+   * These are found by doing a Blender build with and without OSL, and
+   * comparing the output of nm -gD ./bin/blender to find symbols. */
+  AlwaysSpillBase;
+  AsmMacroMaxNestingDepth;
+  AttributorRun;
+  CheckBFIUnknownBlockQueries;
+  *cloneBitwiseIVUser*;
+  *computeHostNumHardwareThread*;
+  *computeHostNumPhysicalCores*;
   decodeInstruction;
+  DisableBasicAA;
+  DisablePreInliner;
+  DisableWholeProgramVisibility;
+  EnableCHR;
+  EnableConstraintElimination;
+  EnableGVNHoist;
+  EnableGVNSink;
   EnableHotColdSplit;
   EnableIPRA;
+  EnableIROutliner;
+  EnableKnowledgeRetention;
+  EnableLoopFlatten;
+  EnableMatrix;
   EnableOrderFileInstrumentation;
+  EnablePGSO;
+  EnableUnrollAndJam;
   EnableVPlanNativePath;
   EnableVPlanPredication;
+  ExtraVectorizerPasses;
   FlattenedProfileUsed;
+  ForcePGSO;
   ForceStackAlign;
   ForceSummaryEdgesCold;
   FSEC;
+  *getExtendedOperandRecurrence*;
+  *getWideRecurrence*;
+  InlinerFunctionImportStats;
+  *IROutlinerLegacyPass*;
   __jit_debug_descriptor;
   __jit_debug_register_code;
   _Jv_RegisterClasses;
+  *LiveDebugValues*;
+  *LoopInterchangeLegacyPass*;
   MachineRegionInfoPassID;
+  MaxDevirtIterations;
+  MaxRegistersForGCPointers;
+  MemOPOptMemcmpBcmp;
   MemOPSizeLarge;
   MemOPSizeRange;
   MISchedPostRA;
@@ -96,18 +130,40 @@ local:
   Name;
   NumNamedVarArgParams;
   PGOViewCounts;
+  PGSOColdCodeOnly;
+  PGSOColdCodeOnlyForInstrPGO;
+  PGSOColdCodeOnlyForPartialSamplePGO;
+  PGSOColdCodeOnlyForSamplePGO;
+  PgsoCutoffInstrProf;
+  PgsoCutoffSampleProf;
+  PGSOLargeWorkingSetSizeOnly;
+  PreInlineThreshold;
   PrintBlockFreqFuncName;
   PrintBranchProbFuncName;
   ProfileLikelyProb;
+  RunNewGVN;
+  RunPartialInlining;
+  RunSLPVectorization;
+  ScalePartialSampleProfileWorkingSetSize;
+  *ScopedAliasMetadataDeepCloner*;
+  ShouldPreserveAllAttributes;
+  SkipFunctionNames;
   StartAfterOptName;
   StartBeforeOptName;
   StaticLikelyProb;
   StopAfterOptName;
   StopBeforeOptName;
+  UseContextLessSummary;
   UseDbgAddr;
+  UseLEB128Directives;
+  UseRegistersForDeoptValues;
+  UseRegistersForGCPointersInLandingPad;
   ViewBlockFreqFuncName;
   ViewBlockLayoutWithBFI;
   ViewHotFreqPercent;
+  WholeProgramVisibility;
+  *widenLoopCompare*;
+  *widenWithVariant*;
   WriteRelBFToSummary;
   X86CompilationCallback*;
 };

___
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] [b382632665b] blender-v2.83-release: Add missing "CUDA_ERROR_UNSUPPORTED_PTX_VERSION" to CUEW

2021-10-29 Thread Patrick Mours
Commit: b382632665b3552d580a3c65e94dd36857d5fb68
Author: Patrick Mours
Date:   Fri Oct 29 10:29:25 2021 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBb382632665b3552d580a3c65e94dd36857d5fb68

Add missing "CUDA_ERROR_UNSUPPORTED_PTX_VERSION" to CUEW

This is required for Cycles to report a meaningful error message when it fails 
to load a PTX module
created with a newer CUDA toolkit version than the driver supports.

Ref T91879

===

M   extern/cuew/include/cuew.h
M   extern/cuew/src/cuew.c
M   intern/cycles/device/cuda/device_cuda_impl.cpp

===

diff --git a/extern/cuew/include/cuew.h b/extern/cuew/include/cuew.h
index 0fa0f1291fa..85522744ad1 100644
--- a/extern/cuew/include/cuew.h
+++ b/extern/cuew/include/cuew.h
@@ -609,6 +609,7 @@ typedef enum cudaError_enum {
   CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219,
   CUDA_ERROR_NVLINK_UNCORRECTABLE = 220,
   CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221,
+  CUDA_ERROR_UNSUPPORTED_PTX_VERSION = 222,
   CUDA_ERROR_INVALID_SOURCE = 300,
   CUDA_ERROR_FILE_NOT_FOUND = 301,
   CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,
diff --git a/extern/cuew/src/cuew.c b/extern/cuew/src/cuew.c
index f477ec48a18..e5349763197 100644
--- a/extern/cuew/src/cuew.c
+++ b/extern/cuew/src/cuew.c
@@ -736,6 +736,7 @@ const char *cuewErrorString(CUresult result) {
 case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT: return "Invalid graphics 
context";
 case CUDA_ERROR_NVLINK_UNCORRECTABLE: return "Nvlink uncorrectable";
 case CUDA_ERROR_JIT_COMPILER_NOT_FOUND: return "Jit compiler not found";
+case CUDA_ERROR_UNSUPPORTED_PTX_VERSION: return "Unsupported PTX version";
 case CUDA_ERROR_INVALID_SOURCE: return "Invalid source";
 case CUDA_ERROR_FILE_NOT_FOUND: return "File not found";
 case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND: return "Link to a shared 
object failed to resolve";
diff --git a/intern/cycles/device/cuda/device_cuda_impl.cpp 
b/intern/cycles/device/cuda/device_cuda_impl.cpp
index 6196f642f8e..22a136e5ab9 100644
--- a/intern/cycles/device/cuda/device_cuda_impl.cpp
+++ b/intern/cycles/device/cuda/device_cuda_impl.cpp
@@ -545,9 +545,9 @@ bool CUDADevice::load_kernels(const DeviceRequestedFeatures 
_features)
 
   if (result == CUDA_SUCCESS) {
 reserve_local_memory(requested_features);
-  }
 
-  load_functions();
+load_functions();
+  }
 
   return (result == CUDA_SUCCESS);
 }

___
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] [7c860ab9d4b] blender-v3.0-release: Fix T92499: duplicating geometry nodes modifier causes crash

2021-10-29 Thread Jacques Lucke
Commit: 7c860ab9d4b54f9c394d3c2769927f55c6737b5f
Author: Jacques Lucke
Date:   Fri Oct 29 10:29:38 2021 +0200
Branches: blender-v3.0-release
https://developer.blender.org/rB7c860ab9d4b54f9c394d3c2769927f55c6737b5f

Fix T92499: duplicating geometry nodes modifier causes crash

Calling `remove_unused_references` inside the `modify_geometry_sets` loop
was known to be not entirely reliable before. Now I just moved it out of
the loop which fixes the bug.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc 
b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
index f4a127faf43..1e94a4a6a50 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
@@ -202,12 +202,15 @@ static void 
geo_node_instance_on_points_exec(GeoNodeExecParams params)
   instances, *geometry_set.get_component_for_read(), 
instance, params);
   geometry_set.remove(GEO_COMPONENT_TYPE_CURVE);
 }
-/* Unused references may have been added above. Remove those now so that 
other nodes don't
- * process them needlessly. */
-/** \note: This currently expects that all originally existing instances 
were used. */
-instances.remove_unused_references();
   });
 
+  /* Unused references may have been added above. Remove those now so that 
other nodes don't
+   * process them needlessly.
+   * This should eventually be moved into the loop above, but currently this 
is quite tricky
+   * because it might remove references that the loop still wants to iterate 
over. */
+  InstancesComponent  = 
geometry_set.get_component_for_write();
+  instances.remove_unused_references();
+
   params.set_output("Instances", std::move(geometry_set));
 }

___
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] [fb688c8d5c4] master: Merge branch 'blender-v3.0-release'

2021-10-29 Thread Bastien Montagne
Commit: fb688c8d5c431708218d342552c5fb0806c97f2d
Author: Bastien Montagne
Date:   Fri Oct 29 10:24:37 2021 +0200
Branches: master
https://developer.blender.org/rBfb688c8d5c431708218d342552c5fb0806c97f2d

Merge branch 'blender-v3.0-release'

===



===



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


[Bf-blender-cvs] [be0d5da341c] blender-v3.0-release: Fix T88877: 2.93: Crash on recent OSX with a non-English locale.

2021-10-29 Thread Ankit Meel
Commit: be0d5da341cf3f33ba2d7cca8c979abf9d94f683
Author: Ankit Meel
Date:   Fri Oct 29 10:11:04 2021 +0200
Branches: blender-v3.0-release
https://developer.blender.org/rBbe0d5da341cf3f33ba2d7cca8c979abf9d94f683

Fix T88877: 2.93: Crash on recent OSX with a non-English locale.

Looks like OSX changed the default format of its locale, which is not
valid anymore for gettext/boost::locale.

Solution based on investigations and patch by Kieun Mun (@kieuns), with
some further tweaks by Ankit Meel (@ankitm), many thanks.

Also add an exception catcher on `std::runtime_error` in
`bl_locale_set()`, since in OSX catching the ancestor `std::exception`
does not work with `boost::locale::conv::conversion_error` and the like
for some reasons.

Reviewed By: #platform_macos, brecht

Maniphest Tasks: T88877

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

===

M   intern/locale/boost_locale_wrapper.cpp
M   intern/locale/osx_user_locale.mm

===

diff --git a/intern/locale/boost_locale_wrapper.cpp 
b/intern/locale/boost_locale_wrapper.cpp
index 73433fe7c5e..ede9377b38f 100644
--- a/intern/locale/boost_locale_wrapper.cpp
+++ b/intern/locale/boost_locale_wrapper.cpp
@@ -117,6 +117,13 @@ void bl_locale_set(const char *locale)
 
 #undef LOCALE_INFO
   }
+  // Extra catch on `std::runtime_error` is needed for macOS/Clang as it seems 
that exceptions
+  // like `boost::locale::conv::conversion_error` (which inherit from 
`std::runtime_error`) are
+  // not caught by their ancestor `std::exception`. See
+  // https://developer.blender.org/T88877#1177108 .
+  catch (std::runtime_error const ) {
+std::cout << "bl_locale_set(" << locale << "): " << e.what() << " \n";
+  }
   catch (std::exception const ) {
 std::cout << "bl_locale_set(" << locale << "): " << e.what() << " \n";
   }
diff --git a/intern/locale/osx_user_locale.mm b/intern/locale/osx_user_locale.mm
index e2f65d39df9..ce694b5fc1e 100644
--- a/intern/locale/osx_user_locale.mm
+++ b/intern/locale/osx_user_locale.mm
@@ -14,7 +14,17 @@ const char *osx_user_locale()
   CFLocaleRef myCFLocale = CFLocaleCopyCurrent();
   NSLocale *myNSLocale = (NSLocale *)myCFLocale;
   [myNSLocale autorelease];
-  NSString *nsIdentifier = [myNSLocale localeIdentifier];
+
+  // This produces gettext-invalid locale in recent macOS versions (11.4),
+  // like `ko-Kore_KR` instead of `ko_KR`. See T88877.
+  // NSString *nsIdentifier = [myNSLocale localeIdentifier];
+
+  const NSString *nsIdentifier = [myNSLocale languageCode];
+  const NSString *const nsIdentifier_country = [myNSLocale countryCode];
+  if ([nsIdentifier length] != 0 && [nsIdentifier_country length] != 0) {
+nsIdentifier = [NSString stringWithFormat:@"%@_%@", nsIdentifier, 
nsIdentifier_country];
+  }
+
   user_locale = ::strdup([nsIdentifier UTF8String]);
   [pool drain];

___
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] [261bb766fba] master: Merge branch 'blender-v3.0-release'

2021-10-29 Thread Jacques Lucke
Commit: 261bb766fbaf701baafed25f1ae5ea38d5e52151
Author: Jacques Lucke
Date:   Fri Oct 29 10:11:26 2021 +0200
Branches: master
https://developer.blender.org/rB261bb766fbaf701baafed25f1ae5ea38d5e52151

Merge branch 'blender-v3.0-release'

===



===



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


[Bf-blender-cvs] [2887d872320] blender-v3.0-release: Fix T92324: crash caused by recursive instancing

2021-10-29 Thread Jacques Lucke
Commit: 2887d872320efc50d377ebe299c7e0beaedb67d8
Author: Jacques Lucke
Date:   Fri Oct 29 10:10:58 2021 +0200
Branches: blender-v3.0-release
https://developer.blender.org/rB2887d872320efc50d377ebe299c7e0beaedb67d8

Fix T92324: crash caused by recursive instancing

This fixes one (of possibly multiple) root issues. The collection passed into
the Collection Info node must not contain the current object, because that
would result in a dependency cycle and recursive instancing.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc 
b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
index eca4e3d2d14..18fc09daf01 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
@@ -71,6 +71,14 @@ static void geo_node_collection_info_exec(GeoNodeExecParams 
params)
 params.set_output("Geometry", geometry_set_out);
 return;
   }
+  const Object *self_object = params.self_object();
+  const bool is_recursive = 
BKE_collection_has_object_recursive_instanced(collection,
+  
(Object *)self_object);
+  if (is_recursive) {
+params.error_message_add(NodeWarningType::Error, "Collection contains 
current object");
+params.set_output("Geometry", geometry_set_out);
+return;
+  }
 
   const bNode  = params.node();
   NodeGeometryCollectionInfo *node_storage = (NodeGeometryCollectionInfo 
*)bnode.storage;
@@ -79,8 +87,6 @@ static void geo_node_collection_info_exec(GeoNodeExecParams 
params)
 
   InstancesComponent  = 
geometry_set_out.get_component_for_write();
 
-  const Object *self_object = params.self_object();
-
   const bool separate_children = params.get_input("Separate Children");
   if (separate_children) {
 const bool reset_children = params.get_input("Reset Children");

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


[Bf-blender-cvs] [1688cb27cd6] master: Merge branch 'blender-v3.0-release'

2021-10-29 Thread Jacques Lucke
Commit: 1688cb27cd63029b3ab5ec976384785c2c397c29
Author: Jacques Lucke
Date:   Fri Oct 29 09:49:48 2021 +0200
Branches: master
https://developer.blender.org/rB1688cb27cd63029b3ab5ec976384785c2c397c29

Merge branch 'blender-v3.0-release'

===



===



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


[Bf-blender-cvs] [cf771807b79] blender-v3.0-release: Geometry Nodes: do cache invalidation after writing attributes

2021-10-29 Thread Jacques Lucke
Commit: cf771807b7997949611dbf76b43150592c9977cb
Author: Jacques Lucke
Date:   Fri Oct 29 09:28:31 2021 +0200
Branches: blender-v3.0-release
https://developer.blender.org/rBcf771807b7997949611dbf76b43150592c9977cb

Geometry Nodes: do cache invalidation after writing attributes

This is a better and more general fix for T92511 and T92508 than
the ones that I committed before.

Previously, we tagged caches dirty when first accessing attributes.
This led to incorrect caches when under some circumstances. Now
cache invalidation is part of `OutputAttribute.save()`.

A nice side benefit of this change is that it may make things more
efficient in some cases, because we don't invalidate caches when
they don't have to be invalidated.

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

===

M   source/blender/blenkernel/BKE_attribute_access.hh
M   source/blender/blenkernel/BKE_spline.hh
M   source/blender/blenkernel/intern/attribute_access.cc
M   source/blender/blenkernel/intern/attribute_access_intern.hh
M   source/blender/blenkernel/intern/curve_eval.cc
M   source/blender/blenkernel/intern/geometry_component_curve.cc
M   source/blender/blenkernel/intern/geometry_component_instances.cc
M   source/blender/blenkernel/intern/geometry_component_mesh.cc

===

diff --git a/source/blender/blenkernel/BKE_attribute_access.hh 
b/source/blender/blenkernel/BKE_attribute_access.hh
index 38f5497ed92..cf19eb29a0e 100644
--- a/source/blender/blenkernel/BKE_attribute_access.hh
+++ b/source/blender/blenkernel/BKE_attribute_access.hh
@@ -183,6 +183,8 @@ struct WriteAttributeLookup {
   GVMutableArrayPtr varray;
   /* Domain the attributes lives on in the geometry. */
   AttributeDomain domain;
+  /* Call this after changing the attribute to invalidate caches that depend 
on this attribute. */
+  std::function tag_modified_fn;
 
   /* Convenience function to check if the attribute has been found. */
   operator bool() const
diff --git a/source/blender/blenkernel/BKE_spline.hh 
b/source/blender/blenkernel/BKE_spline.hh
index 97e0d8415a5..8509b730709 100644
--- a/source/blender/blenkernel/BKE_spline.hh
+++ b/source/blender/blenkernel/BKE_spline.hh
@@ -570,6 +570,8 @@ struct CurveEval {
   blender::Array evaluated_point_offsets() const;
   blender::Array accumulated_spline_lengths() const;
 
+  void mark_cache_invalid();
+
   void assert_valid_point_attributes() const;
 };
 
diff --git a/source/blender/blenkernel/intern/attribute_access.cc 
b/source/blender/blenkernel/intern/attribute_access.cc
index 1ea7f522bef..01b53baf237 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -360,7 +360,7 @@ GVArrayPtr BuiltinCustomDataLayerProvider::try_get_for_read(
   return as_read_attribute_(data, domain_size);
 }
 
-GVMutableArrayPtr BuiltinCustomDataLayerProvider::try_get_for_write(
+WriteAttributeLookup BuiltinCustomDataLayerProvider::try_get_for_write(
 GeometryComponent ) const
 {
   if (writable_ != Writable) {
@@ -397,10 +397,14 @@ GVMutableArrayPtr 
BuiltinCustomDataLayerProvider::try_get_for_write(
 data = new_data;
   }
 
+  std::function tag_modified_fn;
   if (update_on_write_ != nullptr) {
-update_on_write_(component);
+tag_modified_fn = [component = , update = update_on_write_]() {
+  update(*component);
+};
   }
-  return as_write_attribute_(data, domain_size);
+
+  return {as_write_attribute_(data, domain_size), domain_, 
std::move(tag_modified_fn)};
 }
 
 bool BuiltinCustomDataLayerProvider::try_delete(GeometryComponent ) 
const
@@ -925,7 +929,7 @@ blender::bke::WriteAttributeLookup 
GeometryComponent::attribute_try_get_for_writ
 const BuiltinAttributeProvider *builtin_provider =
 
providers->builtin_attribute_providers().lookup_default_as(attribute_id.name(), 
nullptr);
 if (builtin_provider != nullptr) {
-  return {builtin_provider->try_get_for_write(*this), 
builtin_provider->domain()};
+  return builtin_provider->try_get_for_write(*this);
 }
   }
   for (const DynamicAttributesProvider *dynamic_provider :
@@ -1249,6 +1253,20 @@ static void save_output_attribute(OutputAttribute 
_attribute)
 varray.get(i, buffer);
 write_attribute.varray->set_by_relocate(i, buffer);
   }
+  if (write_attribute.tag_modified_fn) {
+write_attribute.tag_modified_fn();
+  }
+}
+
+static std::function 
get_simple_output_attribute_save_method(
+const blender::bke::WriteAttributeLookup )
+{
+  if (!attribute.tag_modified_fn) {
+return {};
+  }
+  return [tag_modified_fn = attribute.tag_modified_fn](OutputAttribute 
(attribute)) {
+tag_modified_fn();
+  };
 }
 
 static OutputAttribute create_output_attribute(GeometryComponent ,
@@ -1293,14 +1311,21 @@ static OutputAttribute 
create_output_attribute(GeometryComponent ,
   /* Builtin