[Bf-blender-cvs] [2e12333c198] soc-2020-io-performance: Add object name in MTL related errors.
Ankit Meel
noreply at git.blender.org
Sun Jun 28 11:16:01 CEST 2020
Commit: 2e12333c198114d9bd9293ffe394536fc10ddbf3
Author: Ankit Meel
Date: Sun Jun 28 14:45:12 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB2e12333c198114d9bd9293ffe394536fc10ddbf3
Add object name in MTL related errors.
===================================================================
M source/blender/io/wavefront_obj/intern/wavefront_obj_exporter_mtl.cc
M source/blender/io/wavefront_obj/intern/wavefront_obj_exporter_mtl.hh
===================================================================
diff --git a/source/blender/io/wavefront_obj/intern/wavefront_obj_exporter_mtl.cc b/source/blender/io/wavefront_obj/intern/wavefront_obj_exporter_mtl.cc
index 595dd3ac865..c556b5baf4e 100644
--- a/source/blender/io/wavefront_obj/intern/wavefront_obj_exporter_mtl.cc
+++ b/source/blender/io/wavefront_obj/intern/wavefront_obj_exporter_mtl.cc
@@ -41,10 +41,11 @@ namespace obj {
/**
* Find and initialiase the Principled-BSDF from the object's material.
*/
-void MTLWriter::init_bsdf_node()
+void MTLWriter::init_bsdf_node(const char *object_name)
{
if (_export_mtl->use_nodes == false) {
- fprintf(stderr, "No Principled-BSDF node found in the material Node tree.\n");
+ fprintf(
+ stderr, "No Principled-BSDF node found in the material Node tree of: %s.\n", object_name);
_bsdf_node = nullptr;
return;
}
@@ -55,7 +56,8 @@ void MTLWriter::init_bsdf_node()
return;
}
}
- fprintf(stderr, "No Principled-BSDF node found in the material Node tree.\n");
+ fprintf(
+ stderr, "No Principled-BSDF node found in the material Node tree of: %s.\n", object_name);
_bsdf_node = nullptr;
}
@@ -174,14 +176,16 @@ void MTLWriter::append_material(OBJMesh &mesh_to_export)
return;
}
+ const char *object_name;
+ mesh_to_export.get_object_name(&object_name);
_export_mtl = mesh_to_export.export_object_material();
if (!_export_mtl) {
- fprintf(stderr, "No material active for the object.\n");
+ fprintf(stderr, "No active material for the object: %s.\n", object_name);
return;
}
fprintf(_mtl_outfile, "\nnewmtl %s\n", _export_mtl->id.name + 2);
- init_bsdf_node();
+ init_bsdf_node(object_name);
/* Empirical, and copied from original python exporter. */
float spec_exponent = (1.0 - _export_mtl->roughness) * 30;
diff --git a/source/blender/io/wavefront_obj/intern/wavefront_obj_exporter_mtl.hh b/source/blender/io/wavefront_obj/intern/wavefront_obj_exporter_mtl.hh
index 3a0bdaa210e..12c63de4560 100644
--- a/source/blender/io/wavefront_obj/intern/wavefront_obj_exporter_mtl.hh
+++ b/source/blender/io/wavefront_obj/intern/wavefront_obj_exporter_mtl.hh
@@ -53,7 +53,7 @@ class MTLWriter {
/** First bsdf node encountered in the object's nodes. */
bNode *_bsdf_node;
- void init_bsdf_node();
+ void init_bsdf_node(const char *object_name);
/** Copy the float property from the bNode to given buffer. */
void float_property_from_node(float *r_property, const bNode *curr_node, const char *identifier);
More information about the Bf-blender-cvs
mailing list