[Bf-blender-cvs] [d3eef4d22a0] blender-v3.3-release: Fix: Use evaluated materials in OBJ exporter

Hans Goudey noreply at git.blender.org
Tue Aug 2 16:50:03 CEST 2022


Commit: d3eef4d22a021bf71c5e6cac492139cab397e4d2
Author: Hans Goudey
Date:   Tue Aug 2 09:49:51 2022 -0500
Branches: blender-v3.3-release
https://developer.blender.org/rBd3eef4d22a021bf71c5e6cac492139cab397e4d2

Fix: Use evaluated materials in OBJ exporter

Since 1a81d268a19f2f140, 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

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

M	source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc

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

diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index e2ecda32717..9460746630d 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -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;
 }



More information about the Bf-blender-cvs mailing list