[Bf-blender-cvs] [c355be6faea] master: UI: Add AbstractView base class for views, unify reconstruction in there

2022-07-02 Thread Julian Eisel
Commit: c355be6faeacef6a65afbce97f9776d2a2c7f54c
Author: Julian Eisel
Date:   Sat Jul 2 21:49:21 2022 +0200
Branches: master
https://developer.blender.org/rBc355be6faeacef6a65afbce97f9776d2a2c7f54c

UI: Add AbstractView base class for views, unify reconstruction in there

No user visible changes expected.

There's plenty of duplicated code in the grid and the tree view, and I expect
this to become more. This starts the process of unifying these parts, which
should also make it easier to add new views. Complexity in the view classes is
reduced, and some type shenanigans for C compatibility and general view
management can be removed, since there is now a common base type.

For the start this ports some of the view reconstruction, where the view and
its items are compared to the version of itself in the previous redraw, so that
state (highlighted, active, renaming, collapsed, ...) can be preserved.
Notifier listening is also ported.

===

A   source/blender/editors/include/UI_abstract_view.hh
M   source/blender/editors/include/UI_grid_view.hh
M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/include/UI_tree_view.hh
M   source/blender/editors/interface/CMakeLists.txt
A   source/blender/editors/interface/abstract_view.cc
M   source/blender/editors/interface/grid_view.cc
M   source/blender/editors/interface/interface_intern.h
M   source/blender/editors/interface/interface_view.cc
M   source/blender/editors/interface/tree_view.cc
M   source/blender/editors/util/CMakeLists.txt

===

diff --git a/source/blender/editors/include/UI_abstract_view.hh 
b/source/blender/editors/include/UI_abstract_view.hh
new file mode 100644
index 000..477f68ca03f
--- /dev/null
+++ b/source/blender/editors/include/UI_abstract_view.hh
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/** \file
+ * \ingroup editorui
+ *
+ * Base for all views (UIs to display data sets), supporting common features.
+ * https://wiki.blender.org/wiki/Source/Interface/Views
+ *
+ * The base class manages reconstruction, most importantly keeping state over 
reconstructions.
+ */
+
+#pragma once
+
+struct wmNotifier;
+
+namespace blender::ui {
+
+class AbstractView {
+  bool is_reconstructed_ = false;
+
+ public:
+  virtual ~AbstractView() = default;
+
+  /** Listen to a notifier, returning true if a redraw is needed. */
+  virtual bool listen(const wmNotifier &) const;
+
+ protected:
+  AbstractView() = default;
+
+  virtual void update_children_from_old(const AbstractView &old_view) = 0;
+
+  /**
+   * Match the view and its items against an earlier version of itself (if 
any) and copy the old UI
+   * state (e.g. collapsed, active, selected, renaming, etc.) to the new one. 
See
+   * #AbstractViewItem.update_from_old().
+   * After this, reconstruction is complete (see #is_reconstructed()).
+   */
+  void update_from_old(uiBlock &new_block);
+
+  /**
+   * Check if the view is fully (re-)constructed. That means, both the build 
function and
+   * #update_from_old() have finished.
+   */
+  bool is_reconstructed() const;
+};
+
+}  // namespace blender::ui
diff --git a/source/blender/editors/include/UI_grid_view.hh 
b/source/blender/editors/include/UI_grid_view.hh
index 6f553f4fad1..cabc49e411c 100644
--- a/source/blender/editors/include/UI_grid_view.hh
+++ b/source/blender/editors/include/UI_grid_view.hh
@@ -13,6 +13,7 @@
 #include "BLI_map.hh"
 #include "BLI_vector.hh"
 
+#include "UI_abstract_view.hh"
 #include "UI_resources.h"
 
 struct bContext;
@@ -111,7 +112,7 @@ struct GridViewStyle {
   int tile_height = 0;
 };
 
-class AbstractGridView {
+class AbstractGridView : public AbstractView {
   friend class AbstractGridViewItem;
   friend class GridViewBuilder;
   friend class GridViewLayoutBuilder;
@@ -122,7 +123,6 @@ class AbstractGridView {
* #update_from_old(). */
   Map item_map_;
   GridViewStyle style_;
-  bool is_reconstructed_ = false;
 
  public:
   AbstractGridView();
@@ -131,9 +131,6 @@ class AbstractGridView {
   using ItemIterFn = FunctionRef;
   void foreach_item(ItemIterFn iter_fn) const;
 
-  /** Listen to a notifier, returning true if a redraw is needed. */
-  virtual bool listen(const wmNotifier &) const;
-
   /**
* Convenience wrapper constructing the item by forwarding given arguments 
to the constructor of
* the type (\a ItemT).
@@ -154,19 +151,8 @@ class AbstractGridView {
  protected:
   virtual void build_items() = 0;
 
-  /**
-   * Check if the view is fully (re-)constructed. That means, both 
#build_items() and
-   * #update_from_old() have finished.
-   */
-  bool is_reconstructed() const;
-
  private:
-  /**
-   * Match the grid-view against an earlier version of itself (if any) and 
copy the old UI state
-   * (e.g. active, selected, renaming, etc.) to the new one. See
-   * #AbstractGridViewIt

[Bf-blender-cvs] [e86c2f72887] master: UI: Move rename buffer management to new view base class

2022-07-02 Thread Julian Eisel
Commit: e86c2f7288724bd6fec33ff43e89816d7520a2b3
Author: Julian Eisel
Date:   Sat Jul 2 22:36:50 2022 +0200
Branches: master
https://developer.blender.org/rBe86c2f7288724bd6fec33ff43e89816d7520a2b3

UI: Move rename buffer management to new view base class

Renaming is a nice example of a feature that shouldn't need a specific
implementation for a specific view type (e.g. grid or tree view). So it's
something that can be supported in the general view code. Individual views can
use it "for free" then. This ports the view level part of the renaming code,
the view item level part of it can be ported once we have a common base class
for the view items.

===

M   source/blender/editors/include/UI_abstract_view.hh
M   source/blender/editors/include/UI_tree_view.hh
M   source/blender/editors/interface/abstract_view.cc
M   source/blender/editors/interface/tree_view.cc

===

diff --git a/source/blender/editors/include/UI_abstract_view.hh 
b/source/blender/editors/include/UI_abstract_view.hh
index 477f68ca03f..82f81f1702b 100644
--- a/source/blender/editors/include/UI_abstract_view.hh
+++ b/source/blender/editors/include/UI_abstract_view.hh
@@ -6,17 +6,31 @@
  * Base for all views (UIs to display data sets), supporting common features.
  * https://wiki.blender.org/wiki/Source/Interface/Views
  *
- * The base class manages reconstruction, most importantly keeping state over 
reconstructions.
+ * One of the most important responsibilities of the base class is managing 
reconstruction,
+ * enabling state that is persistent over reconstructions/redraws.
  */
 
 #pragma once
 
+#include 
+#include 
+
+#include "BLI_span.hh"
+
 struct wmNotifier;
 
 namespace blender::ui {
 
 class AbstractView {
   bool is_reconstructed_ = false;
+  /**
+   * Only one item can be renamed at a time. So rather than giving each item 
an own rename buffer
+   * (which just adds unused memory in most cases), have one here that is 
managed by the view.
+   *
+   * This fixed-size buffer is needed because that's what the rename button 
requires. In future we
+   * may be able to bind the button to a `std::string` or similar.
+   */
+  std::unique_ptr> rename_buffer_;
 
  public:
   virtual ~AbstractView() = default;
@@ -24,6 +38,14 @@ class AbstractView {
   /** Listen to a notifier, returning true if a redraw is needed. */
   virtual bool listen(const wmNotifier &) const;
 
+  /** Only one item can be renamed at a time. */
+  bool is_renaming() const;
+  /** \return If renaming was started successfully. */
+  bool begin_renaming();
+  void end_renaming();
+  Span get_rename_buffer() const;
+  MutableSpan get_rename_buffer();
+
  protected:
   AbstractView() = default;
 
diff --git a/source/blender/editors/include/UI_tree_view.hh 
b/source/blender/editors/include/UI_tree_view.hh
index e9abe4c1d1f..9527df590b7 100644
--- a/source/blender/editors/include/UI_tree_view.hh
+++ b/source/blender/editors/include/UI_tree_view.hh
@@ -117,20 +117,11 @@ class AbstractTreeView : public AbstractView, public 
TreeViewItemContainer {
   friend class AbstractTreeViewItem;
   friend class TreeViewBuilder;
 
-  /**
-   * Only one item can be renamed at a time. So the tree is informed about the 
renaming state to
-   * enforce that.
-   */
-  std::unique_ptr> rename_buffer_;
-
  public:
   virtual ~AbstractTreeView() = default;
 
   void foreach_item(ItemIterFn iter_fn, IterOptions options = 
IterOptions::None) const;
 
-  /** Only one item can be renamed at a time. */
-  bool is_renaming() const;
-
  protected:
   virtual void build_tree() = 0;
 
diff --git a/source/blender/editors/interface/abstract_view.cc 
b/source/blender/editors/interface/abstract_view.cc
index 542d82a56a3..dea9600fde4 100644
--- a/source/blender/editors/interface/abstract_view.cc
+++ b/source/blender/editors/interface/abstract_view.cc
@@ -27,7 +27,7 @@ void AbstractView::update_from_old(uiBlock &new_block)
 return;
   }
 
-  const uiViewHandle *old_view_handle = 
ui_block_view_find_matching_in_old_block(
+  uiViewHandle *old_view_handle = ui_block_view_find_matching_in_old_block(
   &new_block, reinterpret_cast(this));
   if (old_view_handle == nullptr) {
 /* Initial construction, nothing to update. */
@@ -35,7 +35,15 @@ void AbstractView::update_from_old(uiBlock &new_block)
 return;
   }
 
-  update_children_from_old(reinterpret_cast(*old_view_handle));
+  AbstractView &old_view = reinterpret_cast(*old_view_handle);
+
+  /* Update own persistent data. */
+  /* Keep the rename buffer persistent while renaming! The rename button uses 
the buffer's
+   * pointer to identify itself over redraws. */
+  rename_buffer_ = std::move(old_view.rename_buffer_);
+  old_view.rename_buffer_ = nullptr;
+
+  update_children_from_old(old_view);
 
   /* Finished (re-)constructing the tree. */
   is_reconstructed_ = true;
@@ -43,10 +51,52 @@ void Abstra

[Bf-blender-cvs] [4ffee9a48d1] master: Fix T99316: Crash with no font in String to Curves node

2022-07-02 Thread Iliay Katueshenock
Commit: 4ffee9a48d1bc01442e554d44a1f55dfc459a221
Author: Iliay Katueshenock
Date:   Sat Jul 2 18:37:32 2022 -0500
Branches: master
https://developer.blender.org/rB4ffee9a48d1bc01442e554d44a1f55dfc459a221

Fix T99316: Crash with no font in String to Curves node

If you remove the default font from the project, the node will not
have the selected font. In this case, there is no check that the font
does not exist. This suggestion adds an error message if the font
is not specified.

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

===

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 efcc8809c9c..94d5d7f946f 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
@@ -157,12 +157,18 @@ struct TextLayout {
   float final_font_size;
 };
 
-static TextLayout get_text_layout(GeoNodeExecParams ¶ms)
+static std::optional get_text_layout(GeoNodeExecParams ¶ms)
 {
+  VFont *vfont = reinterpret_cast(params.node().id);
+  if (!vfont) {
+params.error_message_add(NodeWarningType::Error, TIP_("Font not 
specified"));
+return std::nullopt;
+  }
+
   TextLayout layout;
   layout.text = params.extract_input("String");
   if (layout.text.empty()) {
-return {};
+return std::nullopt;
   }
 
   const NodeGeometryStringToCurves &storage = node_storage(params.node());
@@ -181,7 +187,6 @@ static TextLayout get_text_layout(GeoNodeExecParams ¶ms)
   const float textbox_h = overflow == GEO_NODE_STRING_TO_CURVES_MODE_OVERFLOW ?
   0.0f :
   params.extract_input("Text Box Height");
-  VFont *vfont = (VFont *)params.node().id;
 
   Curve cu = dna::shallow_zero_initialize();
   cu.type = OB_FONT;
@@ -361,15 +366,19 @@ static void create_attributes(GeoNodeExecParams ¶ms,
 
 static void node_geo_exec(GeoNodeExecParams params)
 {
-  TextLayout layout = get_text_layout(params);
+  std::optional layout = get_text_layout(params);
+  if (!layout) {
+params.set_default_remaining_outputs();
+return;
+  }
 
   const NodeGeometryStringToCurves &storage =
   *(const NodeGeometryStringToCurves *)params.node().storage;
   if (storage.overflow == GEO_NODE_STRING_TO_CURVES_MODE_TRUNCATE) {
-params.set_output("Remainder", std::move(layout.truncated_text));
+params.set_output("Remainder", std::move(layout->truncated_text));
   }
 
-  if (layout.positions.size() == 0) {
+  if (layout->positions.size() == 0) {
 params.set_output("Curve Instances", GeometrySet());
 params.set_default_remaining_outputs();
 return;
@@ -378,9 +387,9 @@ static void node_geo_exec(GeoNodeExecParams params)
   /* Create and add instances. */
   GeometrySet geometry_set_out;
   InstancesComponent &instances = 
geometry_set_out.get_component_for_write();
-  Map char_handles = create_curve_instances(params, layout, 
instances);
-  add_instances_from_handles(instances, char_handles, layout);
-  create_attributes(params, layout, instances);
+  Map char_handles = create_curve_instances(params, *layout, 
instances);
+  add_instances_from_handles(instances, char_handles, *layout);
+  create_attributes(params, *layout, instances);
 
   params.set_output("Curve Instances", std::move(geometry_set_out));
 }

___
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] [d7901ed6070] blender-v2.93-release: COLLADA: Support for alpha color in vertex data. Many thanks to the original Author of this patch: Christian Aguilera

2022-07-02 Thread Gaia Clary
Commit: d7901ed6070874685579775f78d0775692cba816
Author: Gaia Clary
Date:   Thu Jun 30 22:12:38 2022 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rBd7901ed6070874685579775f78d0775692cba816

COLLADA: Support for alpha color in vertex data.
Many thanks to the original Author of this patch: Christian Aguilera

The COLLADA importer was silently ignoring the alpha component in the
vertex data.

The `stride` variable holds the component count (3 for RGB; 4 for RGBA),
and can be used for honouring the alpha channel in the vertex data.

Test plan:
- Open Blender.
- Clear the scene.
- Add a plane.
- Enter **Vertex Paint** mode.
- Switch to the **Erase Alpha** blending mode.
- Select a tone of gray.
- Turn strength down to less than 1
- Paint [some of] the vertices of the plane.
- Export project as a COLLADA file (`.dae`).
- Clear the scene.
- Re-import the COLLADA file again.
- Export the project again (with different name).

**Without** this patch, the second exported project will have lost the
alpha component in their vertex data:

```lang=xml, counterexample
1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1
```

**With** the patch, the first and the second exported projects retain
the alpha values painted previously:

```lang=xml
1 1 1 1 1 1 1 
0.5490196 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.5490196
```

Reviewed By: cristian64, SonnyCampbell_Unity
Authored by: Christian Aguilera

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

===

M   source/blender/io/collada/MeshImporter.cpp

===

diff --git a/source/blender/io/collada/MeshImporter.cpp 
b/source/blender/io/collada/MeshImporter.cpp
index 172f9a468b4..ccea6a06db1 100644
--- a/source/blender/io/collada/MeshImporter.cpp
+++ b/source/blender/io/collada/MeshImporter.cpp
@@ -159,6 +159,27 @@ VCOLDataWrapper::VCOLDataWrapper(COLLADAFW::MeshVertexData 
&vdata) : mVData(&vda
 {
 }
 
+template
+static void colladaAddColor(T values, MLoopCol *mloopcol, int v_index, int 
stride)
+{
+  if (values->empty() || values->getCount() < (v_index + 1) * stride) {
+fprintf(stderr,
+"VCOLDataWrapper.getvcol(): Out of Bounds error: index %d points 
outside value "
+"list of length %zd (with stride=%d) \n",
+v_index,
+values->getCount(),
+stride);
+return;
+  }
+
+  mloopcol->r = unit_float_to_uchar_clamp((*values)[v_index * stride]);
+  mloopcol->g = unit_float_to_uchar_clamp((*values)[v_index * stride + 1]);
+  mloopcol->b = unit_float_to_uchar_clamp((*values)[v_index * stride + 2]);
+  if (stride == 4) {
+mloopcol->a = unit_float_to_uchar_clamp((*values)[v_index * stride + 3]);
+  }
+}
+
 void VCOLDataWrapper::get_vcol(int v_index, MLoopCol *mloopcol)
 {
   int stride = mVData->getStride(0);
@@ -169,25 +190,14 @@ void VCOLDataWrapper::get_vcol(int v_index, MLoopCol 
*mloopcol)
   switch (mVData->getType()) {
 case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: {
   COLLADAFW::ArrayPrimitiveType *values = mVData->getFloatValues();
-  if (values->empty() || values->getCount() <= (v_index * stride + 2)) {
-return; /* xxx need to create an error instead */
-  }
-
-  mloopcol->r = unit_float_to_uchar_clamp((*values)[v_index * stride]);
-  mloopcol->g = unit_float_to_uchar_clamp((*values)[v_index * stride + 1]);
-  mloopcol->b = unit_float_to_uchar_clamp((*values)[v_index * stride + 2]);
+  colladaAddColor *>(values, 
mloopcol, v_index, stride);
 } break;
 
 case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE: {
   COLLADAFW::ArrayPrimitiveType *values = 
mVData->getDoubleValues();
-  if (values->empty() || values->getCount() <= (v_index * stride + 2)) {
-return; /* xxx need to create an error instead */
-  }
-
-  mloopcol->r = unit_float_to_uchar_clamp((*values)[v_index * stride]);
-  mloopcol->g = unit_float_to_uchar_clamp((*values)[v_index * stride + 1]);
-  mloopcol->b = unit_float_to_uchar_clamp((*values)[v_index * stride + 2]);
+  colladaAddColor *>(values, 
mloopcol, v_index, stride);
 } break;
+
 default:
   fprintf(stderr, "VCOLDataWrapper.getvcol(): unknown data type\n");
   }

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


[Bf-blender-cvs] [ab444a80a28] master: BLI: refactor length parameterization

2022-07-02 Thread Jacques Lucke
Commit: ab444a80a280e125b3e4d002941504d56f340ced
Author: Jacques Lucke
Date:   Sat Jul 2 21:51:45 2022 +0200
Branches: master
https://developer.blender.org/rBab444a80a280e125b3e4d002941504d56f340ced

BLI: refactor length parameterization

This refactor had two main goals:
* Simplify the sampling code by using an algorithm with fewer special cases.
* Generalize the sampling to support non-sorted samples.

The `SampleSegmentHint` optimization was inspired by `ValueAccessor` from
OpenVDB and improves performance 2x in my test cases.

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

===

M   source/blender/blenlib/BLI_length_parameterize.hh
M   source/blender/blenlib/intern/length_parameterize.cc
M   source/blender/blenlib/tests/BLI_length_parameterize_test.cc
M   source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
M   source/blender/geometry/intern/resample_curves.cc

===

diff --git a/source/blender/blenlib/BLI_length_parameterize.hh 
b/source/blender/blenlib/BLI_length_parameterize.hh
index ec0fabb75b4..ff957d92263 100644
--- a/source/blender/blenlib/BLI_length_parameterize.hh
+++ b/source/blender/blenlib/BLI_length_parameterize.hh
@@ -19,7 +19,7 @@ namespace blender::length_parameterize {
  *
  * \note This is the same as #bke::curves::curve_segment_num.
  */
-inline int lengths_num(const int points_num, const bool cyclic)
+inline int segments_num(const int points_num, const bool cyclic)
 {
   return cyclic ? points_num : points_num - 1;
 }
@@ -30,7 +30,7 @@ inline int lengths_num(const int points_num, const bool 
cyclic)
 template
 void accumulate_lengths(const Span values, const bool cyclic, 
MutableSpan lengths)
 {
-  BLI_assert(lengths.size() == lengths_num(values.size(), cyclic));
+  BLI_assert(lengths.size() == segments_num(values.size(), cyclic));
   float length = 0.0f;
   for (const int i : IndexRange(values.size() - 1)) {
 length += math::distance(values[i], values[i + 1]);
@@ -42,57 +42,122 @@ void accumulate_lengths(const Span values, const bool 
cyclic, MutableSpan
-void linear_interpolation(const Span src,
-  const Span indices,
-  const Span factors,
-  MutableSpan dst)
+inline void linear_interpolation(const Span src,
+ const Span indices,
+ const Span factors,
+ MutableSpan dst)
 {
   BLI_assert(indices.size() == factors.size());
   BLI_assert(indices.size() == dst.size());
-  const int last_src_index = src.index_range().last();
+  const int last_src_index = src.size() - 1;
 
-  int cyclic_sample_count = 0;
-  for (int i = indices.index_range().last(); i > 0; i--) {
-if (indices[i] != last_src_index) {
-  break;
+  for (const int i : dst.index_range()) {
+const int prev_index = indices[i];
+const float factor = factors[i];
+const bool is_cyclic_case = prev_index == last_src_index;
+if (is_cyclic_case) {
+  dst[i] = math::interpolate(src.last(), src.first(), factor);
+}
+else {
+  dst[i] = math::interpolate(src[prev_index], src[prev_index + 1], factor);
+}
+  }
+}
+
+/**
+ * Passing this to consecutive calls of #sample_at_length can increase 
performance.
+ */
+struct SampleSegmentHint {
+  int segment_index = -1;
+  float segment_start;
+  float segment_length_inv;
+};
+
+/**
+ * \param accumulated_segment_lengths: Lengths of individual segments added up.
+ * \param sample_length: The position to sample at.
+ * \param r_segment_index: Returns the index of the segment that 
#sample_length is in.
+ * \param r_factor: Returns the position within the segment.
+ *
+ * \note #sample_length must not be outside of any segment.
+ */
+inline void sample_at_length(const Span accumulated_segment_lengths,
+ float sample_length,
+ int &r_segment_index,
+ float &r_factor,
+ SampleSegmentHint *hint = nullptr)
+{
+  /* Use a shorter variable name. */
+  const Span lengths = accumulated_segment_lengths;
+
+  BLI_assert(lengths.size() > 0);
+  BLI_assert(sample_length >= 0.0f);
+  BLI_assert(sample_length <= lengths.last());
+
+  if (hint != nullptr && hint->segment_index >= 0) {
+const float length_in_segment = sample_length - hint->segment_start;
+const float factor = length_in_segment * hint->segment_length_inv;
+if (factor >= 0.0f && factor < 1.0f) {
+  r_segment_index = hint->segment_index;
+  r_factor = factor;
+  return;
 }
-dst[i] = math::interpolate(src.last(), src.first(), factors[i]);
-cyclic_sample_count++;
   }
 
-  for (const int i : dst.index_range().drop_back(cyclic_sample_count)) {
-dst[i] = math::interpolate(src[indices[i]], src[indices[i] + 1], 
factors[i]);
+  con

[Bf-blender-cvs] [69ee9ca90e3] master: Fix: Build error with unity builds off after recent cleanup

2022-07-02 Thread Hans Goudey
Commit: 69ee9ca90e36aa6a74317262fccb1e3e2e9210bc
Author: Hans Goudey
Date:   Sat Jul 2 13:04:55 2022 -0500
Branches: master
https://developer.blender.org/rB69ee9ca90e36aa6a74317262fccb1e3e2e9210bc

Fix: Build error with unity builds off after recent cleanup

Mistake in df8d96ab66adf46603b36

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc 
b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
index 31f706c497c..045206d04cd 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
@@ -22,8 +22,6 @@ static void node_declare(NodeDeclarationBuilder &b)
   b.add_output(N_("Convex Hull"));
 }
 
-using bke::GeometryInstanceGroup;
-
 #ifdef WITH_BULLET
 
 static Mesh *hull_from_bullet(const Mesh *mesh, Span coords)

___
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] [0f7bafed382] soc-2022-many-lights-sampling: Cycles: re-implement distant lights in many lights sampling

2022-07-02 Thread Jeffrey Liu
Commit: 0f7bafed3826f09e2c96126bd401de5e0540e038
Author: Jeffrey Liu
Date:   Sat Jul 2 13:55:19 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB0f7bafed3826f09e2c96126bd401de5e0540e038

Cycles: re-implement distant lights in many lights sampling

This uses a basic heuristic to determine whether Cycles should sample
from the distant lights group or the light tree, using the total energy.
A better solution would be to compute some importance value.

===

M   intern/cycles/kernel/light/light_tree.h
M   intern/cycles/kernel/types.h
M   intern/cycles/scene/light.cpp

===

diff --git a/intern/cycles/kernel/light/light_tree.h 
b/intern/cycles/kernel/light/light_tree.h
index 9cf601407b7..57f2792cc35 100644
--- a/intern/cycles/kernel/light/light_tree.h
+++ b/intern/cycles/kernel/light/light_tree.h
@@ -248,8 +248,6 @@ ccl_device int light_tree_sample(KernelGlobals kg,
 
 /* to-do: assign relative importances for the background and distant lights.
  * Can we somehow adjust the importance measure to account for these as well? 
*/
-
-/*
 ccl_device float light_tree_distant_light_importance(KernelGlobals kg,
  const float3 P,
  const float3 N,
@@ -301,7 +299,6 @@ ccl_device int 
light_tree_sample_distant_lights(KernelGlobals kg,
 }
   }
 }
-*/
 
 ccl_device bool light_tree_sample_from_position(KernelGlobals kg,
 ccl_private const RNGState 
*rng_state,
@@ -314,45 +311,19 @@ ccl_device bool 
light_tree_sample_from_position(KernelGlobals kg,
 const uint32_t path_flag,
 ccl_private LightSample *ls)
 {
-  /*
-  const int num_distant_lights = kernel_data.integrator.num_distant_lights;
-  const int num_light_tree_prims = kernel_data.integrator.num_distribution - 
num_distant_lights;
-  */
-
   float pdf_factor = 1.0f;
-  bool ret = light_tree_sample(
-kg, rng_state, randu, randv, time, N, P, bounce, path_flag, ls, 
&pdf_factor);
-  /*
-  bool ret = false;
-  if (num_distant_lights == 0) {
+  bool ret;
+  float tree_u = path_state_rng_1D(kg, rng_state, 1);
+  if (tree_u < kernel_data.integrator.pdf_light_tree) {
+pdf_factor *= kernel_data.integrator.pdf_light_tree;
 ret = light_tree_sample(
 kg, rng_state, randu, randv, time, N, P, bounce, path_flag, ls, 
&pdf_factor);
   }
-  else if (num_light_tree_prims == 0) {
+  else {
+pdf_factor *= (1 - kernel_data.integrator.pdf_light_tree);
 ret = light_tree_sample_distant_lights(
 kg, rng_state, randu, randv, time, N, P, bounce, path_flag, ls, 
&pdf_factor);
   }
-  else {
-const ccl_global KernelLightTreeNode *knode = 
&kernel_data_fetch(light_tree_nodes, 0);
-const float light_tree_importance = light_tree_cluster_importance(kg, P, 
N, knode);
-const float distant_light_importance = 
light_tree_distant_light_importance(kg, P, N, num_distant_lights);
-
-const float light_tree_probability = light_tree_importance /
- (light_tree_importance +
-  distant_light_importance);
-
-if (randu < light_tree_probability) {
-  ret = light_tree_sample(
-  kg, rng_state, randu, randv, time, N, P, bounce, path_flag, ls, 
&pdf_factor);
-  pdf_factor *= light_tree_probability;
-}
-else {
-  ret = light_tree_sample_distant_lights(
-  kg, rng_state, randu, randv, time, N, P, bounce, path_flag, ls, 
&pdf_factor);
-  pdf_factor *= (1 - light_tree_probability);
-}
-  }
-  */
 
   ls->pdf *= pdf_factor;
   return ret;
diff --git a/intern/cycles/kernel/types.h b/intern/cycles/kernel/types.h
index f360940b54a..3e9fcd19609 100644
--- a/intern/cycles/kernel/types.h
+++ b/intern/cycles/kernel/types.h
@@ -1300,11 +1300,12 @@ typedef struct KernelIntegrator {
   int direct_light_sampling_type;
 
   /* Light tree. */
+  float pdf_light_tree;
   int use_light_tree;
   float splitting_threshold;
 
   /* padding */
-  int pad1, pad2;
+  int pad1;
 } KernelIntegrator;
 static_assert_align(KernelIntegrator, 16);
 
diff --git a/intern/cycles/scene/light.cpp b/intern/cycles/scene/light.cpp
index c7f252d13f9..242665387ca 100644
--- a/intern/cycles/scene/light.cpp
+++ b/intern/cycles/scene/light.cpp
@@ -383,7 +383,11 @@ void LightManager::device_update_distribution(Device 
*device,
 object_id++;
   }
 
-  if (light_tree_enabled) {
+  size_t num_distribution = num_triangles + num_lights;
+  VLOG_INFO << "Total " << num_distribution << " of light distribution 
primitives.";
+
+  float pdf_light_tree = 0.0f;
+  if (light_tree_enabled && num_distribution > 0) {
 /* For now, we'll start with a smaller number of max lights in

[Bf-blender-cvs] [2c4a03c6b4d] soc-2022-many-lights-sampling: Merge branch 'master' into soc-2022-many-lights-sampling

2022-07-02 Thread Jeffrey Liu
Commit: 2c4a03c6b4d5bcaff7128b66785575e77afbe467
Author: Jeffrey Liu
Date:   Sat Jul 2 13:57:40 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB2c4a03c6b4d5bcaff7128b66785575e77afbe467

Merge branch 'master' into soc-2022-many-lights-sampling

===



===



___
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] [b0875a588bb] bevelv2: Start of Bevel V2, as being worked on with task T98674.

2022-07-02 Thread Howard Trickey
Commit: b0875a588bb7a7e500cb63add5561cda013d34aa
Author: Howard Trickey
Date:   Sat Jul 2 10:30:37 2022 -0400
Branches: bevelv2
https://developer.blender.org/rBb0875a588bb7a7e500cb63add5561cda013d34aa

Start of Bevel V2, as being worked on with task T98674.

This is the start of a geometry node to do edge, vertex, and face
bevels.

It doesn't yet do anything but analyze the "Vertex cap" around
selected vertices for vertex bevel.

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/geometry/CMakeLists.txt
A   source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 21bb3d01616..e6c9d62905e 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -107,6 +107,7 @@ def mesh_node_items(context):
 space = context.space_data
 if not space:
 return
+yield NodeItem("GeometryNodeBevelMesh")
 yield NodeItem("GeometryNodeDualMesh")
 yield NodeItem("GeometryNodeExtrudeMesh")
 yield NodeItem("GeometryNodeFlipFaces")
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index e13ac3180ec..dc86adc9046 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1340,6 +1340,7 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, 
struct Scene *scene, i
 
 struct TexResult;
 
+#define GEO_NODE_BEVEL_MESH 1400
 #define TEX_NODE_OUTPUT 401
 #define TEX_NODE_CHECKER 402
 #define TEX_NODE_TEXTURE 403
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 5be912ffb2b..ba9b28b4a29 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -4722,6 +4722,7 @@ static void registerGeometryNodes()
   register_node_type_geo_attribute_capture();
   register_node_type_geo_attribute_domain_size();
   register_node_type_geo_attribute_statistic();
+  register_node_type_geo_bevel_mesh();
   register_node_type_geo_boolean();
   register_node_type_geo_bounding_box();
   register_node_type_geo_collection_info();
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 76d8207eead..79e1c9c2c14 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1221,6 +1221,11 @@ typedef struct NodeGeometryExtrudeMesh {
   uint8_t mode;
 } NodeGeometryExtrudeMesh;
 
+typedef struct NodeGeometryBevelMesh {
+  /* GeometryNodeBevelMode */
+  uint8_t mode;
+} NodeGeometryBevelMesh;
+
 typedef struct NodeGeometryObjectInfo {
   /* GeometryNodeTransformSpace. */
   uint8_t transform_space;
@@ -1966,6 +1971,12 @@ typedef enum GeometryNodeExtrudeMeshMode {
   GEO_NODE_EXTRUDE_MESH_FACES = 2,
 } GeometryNodeExtrudeMeshMode;
 
+typedef enum GeometryNodeBevelMeshMode {
+  GEO_NODE_BEVEL_MESH_VERTICES = 0,
+  GEO_NODE_BEVEL_MESH_EDGES = 1,
+  GEO_NODE_BEVEL_MESH_FACES = 2,
+} GeometryNodeBevelMeshMode;
+
 typedef enum FunctionNodeRotateEulerType {
   FN_NODE_ROTATE_EULER_TYPE_EULER = 0,
   FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE = 1,
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 386ef3f74a3..2966dc97519 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9551,6 +9551,27 @@ static void def_geo_extrude_mesh(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
+static void def_geo_bevel_mesh(StructRNA *srna)
+{
+  PropertyRNA *prop;
+
+  static const EnumPropertyItem mode_items[] = {
+  {GEO_NODE_BEVEL_MESH_VERTICES, "VERTICES", 0, "Vertices", ""},
+  {GEO_NODE_BEVEL_MESH_EDGES, "EDGES", 0, "Edges", ""},
+  {GEO_NODE_BEVEL_MESH_FACES, "FACES", 0, "Faces", ""},
+  {0, NULL, 0, NULL, NULL},
+  };
+
+  RNA_def_struct_sdna_from(srna, "NodeGeometryBevelMesh", "storage");
+
+  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "mode");
+  RNA_def_property_enum_items(prop, mode_items);
+  RNA_def_property_enum_default(prop, GEO_NODE_BEVEL_MESH_FACES);
+  RNA_def_property_ui_text(prop, "Mode", "");
+  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
 static void def_geo_distribute_points_on_faces(StructRNA *srna)
 {
   PropertyRNA *prop;
diff --git a/source/blender/nodes/NOD_geometry.h 
b/source/blen

[Bf-blender-cvs] [01d7dedd745] master: Revert "Start of Bevel V2, as being worked on with task T98674."

2022-07-02 Thread Howard Trickey
Commit: 01d7dedd745e2dce6f0f7857367ad8507ed60178
Author: Howard Trickey
Date:   Sat Jul 2 10:14:26 2022 -0400
Branches: master
https://developer.blender.org/rB01d7dedd745e2dce6f0f7857367ad8507ed60178

Revert "Start of Bevel V2, as being worked on with task T98674."

This reverts commit 9bb2afb55e50f9353cfc76cf2d8df7521b0b5feb.
Oops, did not intend to commit this to master.

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/geometry/CMakeLists.txt
D   source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index e6c9d62905e..21bb3d01616 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -107,7 +107,6 @@ def mesh_node_items(context):
 space = context.space_data
 if not space:
 return
-yield NodeItem("GeometryNodeBevelMesh")
 yield NodeItem("GeometryNodeDualMesh")
 yield NodeItem("GeometryNodeExtrudeMesh")
 yield NodeItem("GeometryNodeFlipFaces")
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index dc86adc9046..e13ac3180ec 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1340,7 +1340,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, 
struct Scene *scene, i
 
 struct TexResult;
 
-#define GEO_NODE_BEVEL_MESH 1400
 #define TEX_NODE_OUTPUT 401
 #define TEX_NODE_CHECKER 402
 #define TEX_NODE_TEXTURE 403
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index ba9b28b4a29..5be912ffb2b 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -4722,7 +4722,6 @@ static void registerGeometryNodes()
   register_node_type_geo_attribute_capture();
   register_node_type_geo_attribute_domain_size();
   register_node_type_geo_attribute_statistic();
-  register_node_type_geo_bevel_mesh();
   register_node_type_geo_boolean();
   register_node_type_geo_bounding_box();
   register_node_type_geo_collection_info();
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 79e1c9c2c14..76d8207eead 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1221,11 +1221,6 @@ typedef struct NodeGeometryExtrudeMesh {
   uint8_t mode;
 } NodeGeometryExtrudeMesh;
 
-typedef struct NodeGeometryBevelMesh {
-  /* GeometryNodeBevelMode */
-  uint8_t mode;
-} NodeGeometryBevelMesh;
-
 typedef struct NodeGeometryObjectInfo {
   /* GeometryNodeTransformSpace. */
   uint8_t transform_space;
@@ -1971,12 +1966,6 @@ typedef enum GeometryNodeExtrudeMeshMode {
   GEO_NODE_EXTRUDE_MESH_FACES = 2,
 } GeometryNodeExtrudeMeshMode;
 
-typedef enum GeometryNodeBevelMeshMode {
-  GEO_NODE_BEVEL_MESH_VERTICES = 0,
-  GEO_NODE_BEVEL_MESH_EDGES = 1,
-  GEO_NODE_BEVEL_MESH_FACES = 2,
-} GeometryNodeBevelMeshMode;
-
 typedef enum FunctionNodeRotateEulerType {
   FN_NODE_ROTATE_EULER_TYPE_EULER = 0,
   FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE = 1,
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 2966dc97519..386ef3f74a3 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9551,27 +9551,6 @@ static void def_geo_extrude_mesh(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
-static void def_geo_bevel_mesh(StructRNA *srna)
-{
-  PropertyRNA *prop;
-
-  static const EnumPropertyItem mode_items[] = {
-  {GEO_NODE_BEVEL_MESH_VERTICES, "VERTICES", 0, "Vertices", ""},
-  {GEO_NODE_BEVEL_MESH_EDGES, "EDGES", 0, "Edges", ""},
-  {GEO_NODE_BEVEL_MESH_FACES, "FACES", 0, "Faces", ""},
-  {0, NULL, 0, NULL, NULL},
-  };
-
-  RNA_def_struct_sdna_from(srna, "NodeGeometryBevelMesh", "storage");
-
-  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_sdna(prop, NULL, "mode");
-  RNA_def_property_enum_items(prop, mode_items);
-  RNA_def_property_enum_default(prop, GEO_NODE_BEVEL_MESH_FACES);
-  RNA_def_property_ui_text(prop, "Mode", "");
-  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-}
-
 static void def_geo_distribute_points_on_faces(StructRNA *srna)
 {
   PropertyRNA *prop;
diff --git a/source/blender/nodes/NOD_geometry.h 
b/source/blender/nodes/NOD_geometry.h
index 7e813aef85e..8f15add33fd 1

[Bf-blender-cvs] [9bb2afb55e5] master: Start of Bevel V2, as being worked on with task T98674.

2022-07-02 Thread Howard Trickey
Commit: 9bb2afb55e50f9353cfc76cf2d8df7521b0b5feb
Author: Howard Trickey
Date:   Sat Jul 2 10:09:18 2022 -0400
Branches: master
https://developer.blender.org/rB9bb2afb55e50f9353cfc76cf2d8df7521b0b5feb

Start of Bevel V2, as being worked on with task T98674.

This is the start of a geometry node to do edge, vertex, and face
bevels.

It doesn't yet do anything but analyze the "Vertex cap" around
selected vertices for vertex bevel.

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/geometry/CMakeLists.txt
A   source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 21bb3d01616..e6c9d62905e 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -107,6 +107,7 @@ def mesh_node_items(context):
 space = context.space_data
 if not space:
 return
+yield NodeItem("GeometryNodeBevelMesh")
 yield NodeItem("GeometryNodeDualMesh")
 yield NodeItem("GeometryNodeExtrudeMesh")
 yield NodeItem("GeometryNodeFlipFaces")
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index e13ac3180ec..dc86adc9046 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1340,6 +1340,7 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, 
struct Scene *scene, i
 
 struct TexResult;
 
+#define GEO_NODE_BEVEL_MESH 1400
 #define TEX_NODE_OUTPUT 401
 #define TEX_NODE_CHECKER 402
 #define TEX_NODE_TEXTURE 403
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 5be912ffb2b..ba9b28b4a29 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -4722,6 +4722,7 @@ static void registerGeometryNodes()
   register_node_type_geo_attribute_capture();
   register_node_type_geo_attribute_domain_size();
   register_node_type_geo_attribute_statistic();
+  register_node_type_geo_bevel_mesh();
   register_node_type_geo_boolean();
   register_node_type_geo_bounding_box();
   register_node_type_geo_collection_info();
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 76d8207eead..79e1c9c2c14 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1221,6 +1221,11 @@ typedef struct NodeGeometryExtrudeMesh {
   uint8_t mode;
 } NodeGeometryExtrudeMesh;
 
+typedef struct NodeGeometryBevelMesh {
+  /* GeometryNodeBevelMode */
+  uint8_t mode;
+} NodeGeometryBevelMesh;
+
 typedef struct NodeGeometryObjectInfo {
   /* GeometryNodeTransformSpace. */
   uint8_t transform_space;
@@ -1966,6 +1971,12 @@ typedef enum GeometryNodeExtrudeMeshMode {
   GEO_NODE_EXTRUDE_MESH_FACES = 2,
 } GeometryNodeExtrudeMeshMode;
 
+typedef enum GeometryNodeBevelMeshMode {
+  GEO_NODE_BEVEL_MESH_VERTICES = 0,
+  GEO_NODE_BEVEL_MESH_EDGES = 1,
+  GEO_NODE_BEVEL_MESH_FACES = 2,
+} GeometryNodeBevelMeshMode;
+
 typedef enum FunctionNodeRotateEulerType {
   FN_NODE_ROTATE_EULER_TYPE_EULER = 0,
   FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE = 1,
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 386ef3f74a3..2966dc97519 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9551,6 +9551,27 @@ static void def_geo_extrude_mesh(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
+static void def_geo_bevel_mesh(StructRNA *srna)
+{
+  PropertyRNA *prop;
+
+  static const EnumPropertyItem mode_items[] = {
+  {GEO_NODE_BEVEL_MESH_VERTICES, "VERTICES", 0, "Vertices", ""},
+  {GEO_NODE_BEVEL_MESH_EDGES, "EDGES", 0, "Edges", ""},
+  {GEO_NODE_BEVEL_MESH_FACES, "FACES", 0, "Faces", ""},
+  {0, NULL, 0, NULL, NULL},
+  };
+
+  RNA_def_struct_sdna_from(srna, "NodeGeometryBevelMesh", "storage");
+
+  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "mode");
+  RNA_def_property_enum_items(prop, mode_items);
+  RNA_def_property_enum_default(prop, GEO_NODE_BEVEL_MESH_FACES);
+  RNA_def_property_ui_text(prop, "Mode", "");
+  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
 static void def_geo_distribute_points_on_faces(StructRNA *srna)
 {
   PropertyRNA *prop;
diff --git a/source/blender/nodes/NOD_geometry.h 
b/source/blend

[Bf-blender-cvs] [5d9ade27de5] master: BLI: improve span access to virtual arrays

2022-07-02 Thread Jacques Lucke
Commit: 5d9ade27de54b6910ed32f92d20d8f692959603c
Author: Jacques Lucke
Date:   Sat Jul 2 11:45:57 2022 +0200
Branches: master
https://developer.blender.org/rB5d9ade27de54b6910ed32f92d20d8f692959603c

BLI: improve span access to virtual arrays

* Make the class names more consistent.
* Implement missing move-constructors and assignment-operators.

===

M   source/blender/blenkernel/BKE_attribute_access.hh
M   source/blender/blenkernel/intern/attribute_access.cc
M   source/blender/blenkernel/intern/curve_eval.cc
M   source/blender/blenkernel/intern/curve_to_mesh_convert.cc
M   source/blender/blenkernel/intern/curves_geometry.cc
M   source/blender/blenkernel/intern/geometry_component_curve.cc
M   source/blender/blenlib/BLI_generic_virtual_array.hh
M   source/blender/blenlib/BLI_virtual_array.hh
M   source/blender/blenlib/intern/generic_virtual_array.cc
M   source/blender/blenlib/tests/BLI_virtual_array_test.cc
M   source/blender/editors/curves/intern/curves_ops.cc
M   source/blender/editors/sculpt_paint/curves_sculpt_add.cc
M   source/blender/editors/sculpt_paint/curves_sculpt_density.cc
M   source/blender/editors/sculpt_paint/curves_sculpt_slide.cc
M   source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
M   source/blender/geometry/intern/realize_instances.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc
M   source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
M   source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc
M   source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
M   source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
M   source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc

===

diff --git a/source/blender/blenkernel/BKE_attribute_access.hh 
b/source/blender/blenkernel/BKE_attribute_access.hh
index fef91d6f75d..9648b5b7cde 100644
--- a/source/blender/blenkernel/BKE_attribute_access.hh
+++ b/source/blender/blenkernel/BKE_attribute_access.hh
@@ -218,7 +218,7 @@ struct WriteAttributeLookup {
  * Supported convenience features:
  * - Implicit type conversion when writing to builtin attributes.
  * - Supports simple access to a span containing the attribute values (that 
avoids the use of
- *   VMutableArray_Span in many cases).
+ *   MutableVArraySpan in many cases).
  * - An output attribute can live side by side with an existing attribute with 
a different domain
  *   or data type. The old attribute will only be overwritten when the #save 
function is called.
  *
@@ -234,7 +234,7 @@ class OutputAttribute {
   GVMutableArray varray_;
   eAttrDomain domain_ = ATTR_DOMAIN_AUTO;
   SaveFn save_;
-  std::unique_ptr optional_span_varray_;
+  std::unique_ptr optional_span_varray_;
   bool ignore_old_values_ = false;
   bool save_has_been_called_ = false;
 
diff --git a/source/blender/blenkernel/intern/attribute_access.cc 
b/source/blender/blenkernel/intern/attribute_access.cc
index 409941623d2..ee9358eb97e 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -155,10 +155,9 @@ GMutableSpan OutputAttribute::as_span()
 {
   if (!optional_span_varray_) {
 const bool materialize_old_values = !ignore_old_values_;
-optional_span_varray_ = std::make_unique(varray_,
-   
materialize_old_values);
+optional_span_varray_ = std::make_unique(varray_, 
materialize_old_values);
   }
-  GVMutableArray_GSpan &span_varray = *optional_span_varray_;
+  GMutableVArraySpan &span_varray = *optional_span_varray_;
   return span_varray;
 }
 
diff --git a/source/blender/blenkernel/intern/curve_eval.cc 
b/source/blender/blenkernel/intern/curve_eval.cc
index dd2bd982506..c01a184c6f9 100644
--- a/source/blender/blenkernel/intern/curve_eval.cc
+++ b/source/blender/blenkernel/intern/curve_eval.cc
@@ -21,14 +21,14 @@ using blender::Array;
 using blender::float3;
 using blender::float4x4;
 using blender::GVArray;
-using blender::GVArray_GSpan;
+using blender::GVArraySpan;
 using blender::IndexRange;
 using blender::Map;
 using blender::MutableSpan;
 using blender::Span;
 using blender::StringRefNull;
 using blender::VArray;
-using blender::VArray_Span;
+using blender::VArraySpan;
 using blender::Vector;
 using blender::bke::AttributeIDRef;
 using blender::bke::OutputAttribute;
@@ -360,7 +360,7 @@ static void copy_attributes_between_components(const 
GeometryComponent &src_comp
 if (!src_attribute) {
   return true;
 }
-GVArray_GSpan src_attribute_data{src_attribute};
+GVArraySpan src_attribute_data{src_attribute};
 
 OutputAttribute dst_attribute = 
dst_component.attribute_try_ge

[Bf-blender-cvs] [3c60d62dba1] master: BKE: fix wrong recently added assert

2022-07-02 Thread Jacques Lucke
Commit: 3c60d62dba1214378c3348563167385385f6a539
Author: Jacques Lucke
Date:   Sat Jul 2 11:40:36 2022 +0200
Branches: master
https://developer.blender.org/rB3c60d62dba1214378c3348563167385385f6a539

BKE: fix wrong recently added assert

===

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

===

diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index 2cd829a7f0b..74903e72f91 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -2329,7 +2329,7 @@ bool CustomData_merge(const CustomData *source,
 
 void CustomData_realloc(CustomData *data, int totelem)
 {
-  BLI_assert(totelem > 0);
+  BLI_assert(totelem >= 0);
   for (int i = 0; i < data->totlayer; i++) {
 CustomDataLayer *layer = &data->layers[i];
 const LayerTypeInfo *typeInfo;

___
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