Fix: Python: Incorrect default curve_type when calling drawing.add_strokes()

The API did not initialize the `curve_type` for the newly created strokes resulting in unwanted behavior.

Set the curve type to the expected default: `POLY`.
This commit is contained in:
Falk David
2024-10-08 12:37:10 +02:00
parent 09ca5a4c5f
commit 92b4c853db

View File

@@ -25,6 +25,7 @@ const EnumPropertyItem rna_enum_tree_node_move_type_items[] = {
# include "BKE_attribute.hh"
# include "BKE_context.hh"
# include "BKE_curves.hh"
# include "BKE_grease_pencil.hh"
# include "BKE_report.hh"
@@ -45,6 +46,10 @@ static void rna_GreasePencilDrawing_add_curves(ID *grease_pencil_id,
return;
}
/* Default to `POLY` curves for the newly added ones. */
drawing.strokes_for_write().curve_types_for_write().take_back(sizes_num).fill(CURVE_TYPE_POLY);
drawing.strokes_for_write().update_curve_types();
drawing.tag_topology_changed();
/* Avoid updates for importers. */