Fix T92460: crash when instancing on curves generated from string
Issue is that the Instance on Points node currently expects that all instance references are used (see `remove_unused_references`). This should be fixed at some point, but for now make sure that the String to Curves node does not output unused references.
This commit is contained in:
parent
bd7f1c5cce
commit
b15e1861ac
Notes:
blender-bot
2023-02-14 07:53:51 +01:00
Referenced by issue #92460, String to curves, to instance on points causes crash Referenced by issue #92243, Geonodes. Crush when using Instance on Points with String to Curve Referenced by issue #91943, Crashing when adding 'Instance on Points' node with Geometry Nodes
|
@ -196,6 +196,7 @@ static void geo_node_instance_on_points_exec(GeoNodeExecParams params)
|
|||
}
|
||||
/* 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();
|
||||
});
|
||||
|
||||
|
|
|
@ -271,8 +271,9 @@ static void geo_node_string_to_curves_exec(GeoNodeExecParams params)
|
|||
/* Convert UTF-8 encoded string to UTF-32. */
|
||||
size_t len_bytes;
|
||||
size_t len_chars = BLI_strlen_utf8_ex(layout.text.c_str(), &len_bytes);
|
||||
Array<char32_t> char_codes(len_chars + 1);
|
||||
BLI_str_utf8_as_utf32(char_codes.data(), layout.text.c_str(), len_chars + 1);
|
||||
Array<char32_t> char_codes_with_null(len_chars + 1);
|
||||
BLI_str_utf8_as_utf32(char_codes_with_null.data(), layout.text.c_str(), len_chars + 1);
|
||||
const Span<char32_t> char_codes = char_codes_with_null.as_span().drop_back(1);
|
||||
|
||||
/* Create and add instances. */
|
||||
GeometrySet geometry_set_out;
|
||||
|
|
Loading…
Reference in New Issue