[Bf-blender-cvs] [a8ee279aa90] master: Fix: Use consistent type for nurbs order attribute

Hans Goudey noreply at git.blender.org
Thu Apr 14 00:04:57 CEST 2022


Commit: a8ee279aa903ad6d81175f4299bc426a0cd32ebf
Author: Hans Goudey
Date:   Wed Apr 13 17:00:18 2022 -0500
Branches: master
https://developer.blender.org/rBa8ee279aa903ad6d81175f4299bc426a0cd32ebf

Fix: Use consistent type for nurbs order attribute

An 8 bit integer should be enough for now. We can change this if we ever
want to allow increasing the order past 256.

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

M	source/blender/blenkernel/intern/curve_eval.cc
M	source/blender/blenkernel/intern/geometry_component_curves.cc

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

diff --git a/source/blender/blenkernel/intern/curve_eval.cc b/source/blender/blenkernel/intern/curve_eval.cc
index 6e09d1e8f10..a893359b911 100644
--- a/source/blender/blenkernel/intern/curve_eval.cc
+++ b/source/blender/blenkernel/intern/curve_eval.cc
@@ -385,8 +385,8 @@ std::unique_ptr<CurveEval> curves_to_curve_eval(const Curves &curves)
 
   VArray_Span<float> nurbs_weights{
       src_component.attribute_get_for_read<float>("nurbs_weight", ATTR_DOMAIN_POINT, 0.0f)};
-  VArray_Span<int> nurbs_orders{
-      src_component.attribute_get_for_read<int>("nurbs_order", ATTR_DOMAIN_CURVE, 4)};
+  VArray_Span<int8_t> nurbs_orders{
+      src_component.attribute_get_for_read<int8_t>("nurbs_order", ATTR_DOMAIN_CURVE, 4)};
   VArray_Span<int8_t> nurbs_knots_modes{
       src_component.attribute_get_for_read<int8_t>("knots_mode", ATTR_DOMAIN_CURVE, 0)};
 
diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc b/source/blender/blenkernel/intern/geometry_component_curves.cc
index 0bcab0aae7a..3f4342bd0dd 100644
--- a/source/blender/blenkernel/intern/geometry_component_curves.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curves.cc
@@ -462,14 +462,14 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
 
   static BuiltinCustomDataLayerProvider nurbs_order("nurbs_order",
                                                     ATTR_DOMAIN_CURVE,
-                                                    CD_PROP_INT32,
-                                                    CD_PROP_INT32,
+                                                    CD_PROP_INT8,
+                                                    CD_PROP_INT8,
                                                     BuiltinAttributeProvider::Creatable,
                                                     BuiltinAttributeProvider::Writable,
                                                     BuiltinAttributeProvider::Deletable,
                                                     curve_access,
-                                                    make_array_read_attribute<int>,
-                                                    make_array_write_attribute<int>,
+                                                    make_array_read_attribute<int8_t>,
+                                                    make_array_write_attribute<int8_t>,
                                                     tag_component_topology_changed);
 
   static BuiltinCustomDataLayerProvider normal_mode("normal_mode",



More information about the Bf-blender-cvs mailing list