Fix T50062: Mask - Clicking in ActivePoint Parent makes Blender crash.

Mask primitive adding code was not initializing correctly id_type of
points' parents.
This commit is contained in:
Bastien Montagne 2016-12-02 10:45:03 +01:00
parent 0ac2be7030
commit 0c958b9f8e
Notes: blender-bot 2023-02-14 08:40:26 +01:00
Referenced by issue #50062, Mask - Clicking in ActivePoint Parent makes Blender crash.
2 changed files with 20 additions and 0 deletions

View File

@ -46,6 +46,7 @@
#include "DNA_screen_types.h"
#include "DNA_object_force.h"
#include "DNA_object_types.h"
#include "DNA_mask_types.h"
#include "DNA_mesh_types.h"
#include "DNA_modifier_types.h"
#include "DNA_particle_types.h"
@ -60,6 +61,7 @@
#include "BKE_colortools.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mask.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_scene.h"
@ -1473,4 +1475,21 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
br->fill_threshold /= sqrt_3;
}
}
/* To be added to next subversion bump! */
{
/* Mask primitive adding code was not initializing correctly id_type of its points' parent. */
for (Mask *mask = main->mask.first; mask; mask = mask->id.next) {
for (MaskLayer *mlayer = mask->masklayers.first; mlayer; mlayer = mlayer->next) {
for (MaskSpline *mspline = mlayer->splines.first; mspline; mspline = mspline->next) {
int i = 0;
for (MaskSplinePoint *mspoint = mspline->points; i < mspline->tot_point; mspoint++, i++) {
if (mspoint->parent.id_type == 0) {
BKE_mask_parent_init(&mspoint->parent);
}
}
}
}
}
}
}

View File

@ -779,6 +779,7 @@ static int create_primitive_from_points(bContext *C, wmOperator *op, const float
for (i = 0; i < num_points; i++) {
MaskSplinePoint *new_point = &new_spline->points[i];
BKE_mask_parent_init(&new_point->parent);
copy_v2_v2(new_point->bezt.vec[1], points[i]);
mul_v2_fl(new_point->bezt.vec[1], scale);