Fix for a segfault in the new Displace modifier UV layer selection code:
If the "UV" texture coordinate option is selected while no UV layers exist, the UV layer name in the modifier is blank. This is not a problem while no UV layers exist, but if a UV layer is added the modifier code attempts to use UV coordinates without handling the missing layer name correctly, leading to a segfault. This only occurs when the modifier stack is recalculated before a modifier UI redraw, as the UI redraw updates the layer name. This fix handles a missing UV layer name by setting it to the active UV layer.
This commit is contained in:
@@ -2315,6 +2315,11 @@ static void get_texture_coords(DisplaceModifierData *dmd, Object *ob,
|
||||
tf = dm->faceData.layers[itf].data;
|
||||
strcpy(dmd->uvlayer_name, dm->faceData.layers[itf].name);
|
||||
}
|
||||
} else {
|
||||
/* no uv layer specified, use the active one */
|
||||
itf = CustomData_get_active_layer_index(&dm->faceData, CD_MTFACE);
|
||||
tf = dm->faceData.layers[itf].data;
|
||||
strcpy(dmd->uvlayer_name, dm->faceData.layers[itf].name);
|
||||
}
|
||||
|
||||
/* verts are given the UV from the first face that uses them */
|
||||
|
||||
Reference in New Issue
Block a user