[Bf-blender-cvs] [aa1ffc093c4] master: Fix T99884: Crash when converting to old curve type

Hans Goudey noreply at git.blender.org
Fri Jul 22 02:44:16 CEST 2022


Commit: aa1ffc093c4711a40932c854670730944008118b
Author: Hans Goudey
Date:   Thu Jul 21 19:44:06 2022 -0500
Branches: master
https://developer.blender.org/rBaa1ffc093c4711a40932c854670730944008118b

Fix T99884: Crash when converting to old curve type

The conversion from Curves to CurveEval used an incorrect type
for one of the builtin attributes. Also, an incorrect default was used
for reading the nurbs_weight attribute.

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

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

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

diff --git a/source/blender/blenkernel/intern/curve_eval.cc b/source/blender/blenkernel/intern/curve_eval.cc
index 424fa311dc7..3bee82fadab 100644
--- a/source/blender/blenkernel/intern/curve_eval.cc
+++ b/source/blender/blenkernel/intern/curve_eval.cc
@@ -382,7 +382,7 @@ std::unique_ptr<CurveEval> curves_to_curve_eval(const Curves &curves_id)
   VArray<int8_t> normal_mode = curves.normal_mode();
 
   VArraySpan<float> nurbs_weights{
-      src_attributes.lookup_or_default<float>("nurbs_weight", ATTR_DOMAIN_POINT, 0.0f)};
+      src_attributes.lookup_or_default<float>("nurbs_weight", ATTR_DOMAIN_POINT, 1.0f)};
   VArraySpan<int8_t> nurbs_orders{
       src_attributes.lookup_or_default<int8_t>("nurbs_order", ATTR_DOMAIN_CURVE, 4)};
   VArraySpan<int8_t> nurbs_knots_modes{
@@ -475,13 +475,13 @@ Curves *curve_eval_to_curves(const CurveEval &curve_eval)
   blender::bke::SpanAttributeWriter<int8_t> normal_mode =
       dst_attributes.lookup_or_add_for_write_only_span<int8_t>("normal_mode", ATTR_DOMAIN_CURVE);
   blender::bke::SpanAttributeWriter<float> nurbs_weight;
-  blender::bke::SpanAttributeWriter<int> nurbs_order;
+  blender::bke::SpanAttributeWriter<int8_t> nurbs_order;
   blender::bke::SpanAttributeWriter<int8_t> nurbs_knots_mode;
   if (curve_eval.has_spline_with_type(CURVE_TYPE_NURBS)) {
     nurbs_weight = dst_attributes.lookup_or_add_for_write_only_span<float>("nurbs_weight",
                                                                            ATTR_DOMAIN_POINT);
-    nurbs_order = dst_attributes.lookup_or_add_for_write_only_span<int>("nurbs_order",
-                                                                        ATTR_DOMAIN_CURVE);
+    nurbs_order = dst_attributes.lookup_or_add_for_write_only_span<int8_t>("nurbs_order",
+                                                                           ATTR_DOMAIN_CURVE);
     nurbs_knots_mode = dst_attributes.lookup_or_add_for_write_only_span<int8_t>("knots_mode",
                                                                                 ATTR_DOMAIN_CURVE);
   }



More information about the Bf-blender-cvs mailing list