[Bf-blender-cvs] [e13dd0969c2] temp-explicit-colors: Merge branch 'master' into temp-explicit-colors

Jeroen Bakker noreply at git.blender.org
Mon Apr 19 07:43:22 CEST 2021


Commit: e13dd0969c20707eeb5ebd56b984517b893114cd
Author: Jeroen Bakker
Date:   Mon Apr 19 07:43:14 2021 +0200
Branches: temp-explicit-colors
https://developer.blender.org/rBe13dd0969c20707eeb5ebd56b984517b893114cd

Merge branch 'master' into temp-explicit-colors

===================================================================



===================================================================

diff --cc source/blender/blenkernel/intern/geometry_component_mesh.cc
index 0a55f68dc89,e5accd98952..31d1cba83a2
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@@ -821,7 -794,7 +794,7 @@@ static ColorGeometry get_loop_color(con
    return linear_color;
  }
  
- static void set_loop_color(MLoopCol &col, const ColorGeometry &linear_color)
 -static void set_loop_color(MLoopCol &col, Color4f linear_color)
++static void set_loop_color(MLoopCol &col, ColorGeometry linear_color)
  {
    linearrgb_to_srgb_uchar4(&col.r, linear_color);
  }
@@@ -1175,12 -1132,8 +1132,8 @@@ static ComponentAttributeProviders crea
        CD_PROP_COLOR,
        CD_MLOOPCOL,
        corner_access,
-       make_derived_read_attribute<MLoopCol, ColorGeometry, get_loop_color, ATTR_DOMAIN_CORNER>,
-       make_derived_write_attribute<MLoopCol,
-                                    ColorGeometry,
-                                    get_loop_color,
-                                    set_loop_color,
-                                    ATTR_DOMAIN_CORNER>);
 -      make_derived_read_attribute<MLoopCol, Color4f, get_loop_color>,
 -      make_derived_write_attribute<MLoopCol, Color4f, get_loop_color, set_loop_color>);
++      make_derived_read_attribute<MLoopCol, ColorGeometry, get_loop_color>,
++      make_derived_write_attribute<MLoopCol, ColorGeometry, get_loop_color, set_loop_color>);
  
    static VertexGroupsAttributeProvider vertex_groups;
    static CustomDataAttributeProvider corner_custom_data(ATTR_DOMAIN_CORNER, corner_access);
diff --cc source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
index 7432745a288,405f0cd9455..18c6a9d7d37
--- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
@@@ -155,11 -152,9 +152,9 @@@ std::unique_ptr<ColumnValues> GeometryD
        const std::array<const char *, 4> suffixes = {" R", " G", " B", " A"};
        const std::string name = StringRef(column_id.name) + suffixes[column_id.index];
        return column_values_from_function(
-           name,
-           domain_size,
-           [attribute, axis = column_id.index](int index, CellValue &r_cell_value) {
+           name, domain_size, [varray, axis = column_id.index](int index, CellValue &r_cell_value) {
 -            Color4f value;
 +            ColorGeometry value;
-             attribute->get(index, &value);
+             varray->get(index, &value);
              r_cell_value.value_float = value[axis];
            });
      }
diff --cc source/blender/nodes/geometry/nodes/node_geo_attribute_clamp.cc
index 9cca590856a,e7677ed41e1..23c11efed4f
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_clamp.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_clamp.cc
@@@ -217,10 -214,8 +217,8 @@@ static void clamp_attribute(GeometryCom
        break;
      }
      case CD_PROP_COLOR: {
-       Span<ColorGeometry> read_span = attribute_input->get_span<ColorGeometry>();
-       MutableSpan<ColorGeometry> span = attribute_result->get_span_for_write_only<ColorGeometry>();
 -      Color4f min = params.get_input<Color4f>("Min_003");
 -      Color4f max = params.get_input<Color4f>("Max_003");
 +      ColorGeometry min = params.get_input<ColorGeometry>("Min_003");
 +      ColorGeometry max = params.get_input<ColorGeometry>("Max_003");
        if (operation == NODE_CLAMP_RANGE) {
          if (min.r > max.r) {
            std::swap(min.r, max.r);
@@@ -235,7 -230,8 +233,8 @@@
            std::swap(min.a, max.a);
          }
        }
-       clamp_attribute<ColorGeometry>(read_span, span, min, max);
 -      MutableSpan<Color4f> results = attribute_result.as_span<Color4f>();
 -      clamp_attribute<Color4f>(attribute_input->typed<Color4f>(), results, min, max);
++      MutableSpan<ColorGeometry> results = attribute_result.as_span<ColorGeometry>();
++      clamp_attribute<ColorGeometry>(attribute_input->typed<ColorGeometry>(), results, min, max);
        break;
      }
      default: {
diff --cc source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc
index b8f9742d491,af65fe110e9..4c6072b5c36
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc
@@@ -71,27 -71,25 +71,25 @@@ static void execute_on_component(const 
    /* Always output a color attribute for now. We might want to allow users to customize.
     * Using the type of an existing attribute could work, but does not have a real benefit
     * currently. */
-   const CustomDataType result_type = CD_PROP_COLOR;
    const AttributeDomain result_domain = get_result_domain(component, input_name, result_name);
  
-   OutputAttributePtr attribute_result = component.attribute_try_get_for_output(
-       result_name, result_domain, result_type);
 -  OutputAttribute_Typed<Color4f> attribute_result =
 -      component.attribute_try_get_for_output_only<Color4f>(result_name, result_domain);
++  OutputAttribute_Typed<ColorGeometry> attribute_result =
++      component.attribute_try_get_for_output_only<ColorGeometry>(result_name, result_domain);
    if (!attribute_result) {
      return;
    }
  
-   FloatReadAttribute attribute_in = component.attribute_get_for_read<float>(
+   GVArray_Typed<float> attribute_in = component.attribute_get_for_read<float>(
        input_name, result_domain, 0.0f);
  
-   Span<float> data_in = attribute_in.get_span();
-   MutableSpan<ColorGeometry> data_out = attribute_result->get_span_for_write_only<ColorGeometry>();
 -  MutableSpan<Color4f> results = attribute_result.as_span();
++  MutableSpan<ColorGeometry> results = attribute_result.as_span();
  
    ColorBand *color_ramp = &node_storage->color_ramp;
-   for (const int i : data_in.index_range()) {
-     BKE_colorband_evaluate(color_ramp, data_in[i], data_out[i]);
+   for (const int i : IndexRange(attribute_in.size())) {
+     BKE_colorband_evaluate(color_ramp, attribute_in[i], results[i]);
    }
  
-   attribute_result.apply_span_and_save();
+   attribute_result.save();
  }
  
  static void geo_node_attribute_color_ramp_exec(GeoNodeExecParams params)
diff --cc source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc
index 63bb6a8b32f,22855787ab0..89e5a1ee518
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc
@@@ -134,8 -131,8 +131,8 @@@ static void do_equal_operation_float3(c
    }
  }
  
- static void do_equal_operation_color4f(const ColorGeometryReadAttribute &input_a,
-                                        const ColorGeometryReadAttribute &input_b,
 -static void do_equal_operation_color4f(const VArray<Color4f> &input_a,
 -                                       const VArray<Color4f> &input_b,
++static void do_equal_operation_color4f(const VArray<ColorGeometry> &input_a,
++                                       const VArray<ColorGeometry> &input_b,
                                         const float threshold,
                                         MutableSpan<bool> span_result)
  {
@@@ -188,8 -185,8 +185,8 @@@ static void do_not_equal_operation_floa
    }
  }
  
- static void do_not_equal_operation_color4f(const ColorGeometryReadAttribute &input_a,
-                                            const ColorGeometryReadAttribute &input_b,
 -static void do_not_equal_operation_color4f(const VArray<Color4f> &input_a,
 -                                           const VArray<Color4f> &input_b,
++static void do_not_equal_operation_color4f(const VArray<ColorGeometry> &input_a,
++                                           const VArray<ColorGeometry> &input_b,
                                             const float threshold,
                                             MutableSpan<bool> span_result)
  {
@@@ -283,30 -279,38 +279,42 @@@ static void attribute_compare_calc(Geom
      const float threshold = params.get_input<float>("Threshold");
      if (operation == NODE_FLOAT_COMPARE_EQUAL) {
        if (input_data_type == CD_PROP_FLOAT) {
-         do_equal_operation_float(*attribute_a, *attribute_b, threshold, result_span);
+         do_equal_operation_float(
+             attribute_a->typed<float>(), attribute_b->typed<float>(), threshold, result_span);
        }
        else if (input_data_type == CD_PROP_FLOAT3) {
-         do_equal_operation_float3(*attribute_a, *attribute_b, threshold, result_span);
+         do_equal_operation_float3(
+             attribute_a->typed<float3>(), attribute_b->typed<float3>(), threshold, result_span);
        }
        else if (input_data_type == CD_PROP_COLOR) {
-         do_equal_operation_color4f(*attribute_a, *attribute_b, threshold, result_span);
 -        do_equal_operation_color4f(
 -            attribute_a->typed<Color4f>(), attribute_b->typed<Color4f>(), threshold, result_span);
++        do_equal_operation_color4f(attribute_a->typed<ColorGeometry>(),
++                                   attribute_b->typed<ColorGeometry>(),
++                                   threshold,
++                                   result_span);
        }
        else if (input_data_type == CD_PROP_BOOL) {
-         do_equal_operation_bool(*attribute_a, *attribute_b, threshold, result_span);
+         do_equal_operation_bool(
+             attribute_a->typed<bool>(), attribute_b->typed<bool>(), threshold, result_span);
        }
      }
      else if (operation == NODE_FLOAT_COMPARE_NOT_EQUAL) {
        if (input_data_type == CD_PROP_FLOAT) {
-         do_not_equal_operation_float(*attribute_a, *attribute_b, threshold, result_span);
+         do_not_equal_operation_float(
+             attribute_a->typed<float>(), attribute_b->typed<float>(), threshold, result_span);
        }
        else if (input_data_type == CD_PROP_FLOAT3) {
-         do_not_equal_operation_float3(*attribute_a, *attribute_b, threshold, result_span);
+         do_not_equal_operation_float3(
+             attribute_a->typed<float3>(), attribute_b->typed<float3>(), threshold, result_span);
        }
        else if (input_data_type == CD_PROP_COLOR)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list