Fix T90900: Crash when rendering geometry nodes created curve

The comment for data_eval mentions that it should contain a mesh for
curve objects, however with geometry nodes, objects can evaluate to
curves as well (though they are only containers for the `CurveEval`.
That is a larger issue, but with the upcoming geometry instancing patch
the situation changes, so this commit does not correct that. I also hope
to remove this code in favor of the new curve to mesh code soon.

Instead, just check the evaluated data type in this case, which prevents
the crash, though it is hacky.
This commit is contained in:
Hans Goudey 2021-08-24 13:38:53 -05:00
parent f53cf5141d
commit 5ef3afd87c
Notes: blender-bot 2023-02-13 17:51:19 +01:00
Referenced by issue #94506, Crash in Compositing
Referenced by issue #90900, When trying to apply a material to an instanced curve and rendering, Blender crashes.
1 changed files with 4 additions and 2 deletions

View File

@ -548,10 +548,12 @@ Mesh *BKE_mesh_new_nomain_from_curve(const Object *ob)
return BKE_mesh_new_nomain_from_curve_displist(ob, &disp);
}
/* this may fail replacing ob->data, be sure to check ob->type */
static void mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const char *obdata_name)
{
Object *ob1;
if (ob->runtime.data_eval && GS(((ID *)ob->runtime.data_eval)->name) != ID_ME) {
return;
}
Mesh *me_eval = (Mesh *)ob->runtime.data_eval;
Mesh *me;
MVert *allvert = NULL;