[Bf-blender-cvs] [0c958b9] master: Fix T50062: Mask - Clicking in ActivePoint Parent makes Blender crash.

Bastien Montagne noreply at git.blender.org
Fri Dec 2 10:47:30 CET 2016


Commit: 0c958b9f8e933605497a59faf8838a544b9da740
Author: Bastien Montagne
Date:   Fri Dec 2 10:45:03 2016 +0100
Branches: master
https://developer.blender.org/rB0c958b9f8e933605497a59faf8838a544b9da740

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

Mask primitive adding code was not initializing correctly id_type of
points' parents.

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

M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/editors/mask/mask_add.c

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

diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 25d78b7..88c583b 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -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);
+						}
+					}
+				}
+			}
+		}
+	}
 }
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index e3e8f35..f01af22 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -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);




More information about the Bf-blender-cvs mailing list