Fix: Use evaluated materials in OBJ exporter
Since 1a81d268a1
, materials on object data can change during
evaluation. But a different function is necessary to retrieve materials
taking that into account.
Solves part of T96721.
Differential Revision: https://developer.blender.org/D15595
This commit is contained in:
parent
e4dd644d6b
commit
d3eef4d22a
Notes:
blender-bot
2023-05-31 04:43:10 +02:00
Referenced by issue blender/blender-addons#96721, Exporters (add-ons and compiled) need to be updated to support new fully dynamic material assignment possible from Geometry Nodes
|
@ -219,13 +219,13 @@ void OBJMesh::calc_poly_order()
|
|||
const Material *OBJMesh::get_object_material(const int16_t mat_nr) const
|
||||
{
|
||||
/**
|
||||
* The const_cast is safe here because BKE_object_material_get won't change the object
|
||||
* The const_cast is safe here because #BKE_object_material_get_eval won't change the object
|
||||
* but it is a big can of worms to fix the declaration of that function right now.
|
||||
*
|
||||
* The call uses "+ 1" as material getter needs one-based indices.
|
||||
*/
|
||||
Object *obj = const_cast<Object *>(&export_object_eval_);
|
||||
const Material *r_mat = BKE_object_material_get(obj, mat_nr + 1);
|
||||
const Material *r_mat = BKE_object_material_get_eval(obj, mat_nr + 1);
|
||||
return r_mat;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue