Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2019-01-03 20:01:56 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-01-03 20:09:39 +0300
commit4b2198a96ac368fa5f2a353c7c148e015246cccf (patch)
tree83022fa82cafcb6c80557f8f7f301a27b21f8dc7 /source/blender/blenkernel/intern/displist.c
parent255ab75eb3af6e1e56e68c5abf09970a59d980e5 (diff)
Fix T59925: Crash when adding any generative modifier on a curve with more than one material.
Am not totally convinced that generating meshes without fully valid material info is a good thing, but this seems to be rather common in our code base (in both mesh editing and convert-to-mesh cases). So for now, duplicated code in mesh eval finalization to main displist creation/eval function, synchronizing mat data at the end of modifiers stack eval, if needed.
Diffstat (limited to 'source/blender/blenkernel/intern/displist.c')
-rw-r--r--source/blender/blenkernel/intern/displist.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index c5dadb1b529..c5c503966c4 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1089,12 +1089,22 @@ static void curve_calc_modifiers_post(
/* XXX2.8(Sybren): make sure the face normals are recalculated as well */
BKE_mesh_ensure_normals(modified);
+ /* Special tweaks, needed since neither BKE_mesh_new_nomain_from_template() nor
+ * BKE_mesh_new_nomain_from_curve_displist() properly duplicate mat info...
+ */
+ BLI_strncpy(modified->id.name, cu->id.name, sizeof(modified->id.name));
+ *((short *)modified->id.name) = ID_ME;
+ MEM_SAFE_FREE(modified->mat);
+ /* Set flag which makes it easier to see what's going on in a debugger. */
+ modified->id.tag |= LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT;
+ modified->mat = MEM_dupallocN(cu->mat);
+ modified->totcol = cu->totcol;
+
(*r_final) = modified;
}
else {
(*r_final) = NULL;
}
-
}
}