Alembic export: don't show warning for every exported frame
authorSybren A. Stüvel <sybren@stuvel.eu>
Thu, 20 Apr 2017 13:24:48 +0000 (15:24 +0200)
committerSybren A. Stüvel <sybren@stuvel.eu>
Thu, 20 Apr 2017 13:30:13 +0000 (15:30 +0200)
The warning about not having a UV map is now only shown once per hair
system.

source/blender/alembic/intern/abc_hair.cc
source/blender/alembic/intern/abc_hair.h

index e328df24e5389540e4c6dc3400880402ab915c45..9a974273a46bc4054c470b267fb105df927393de 100644 (file)
@@ -56,6 +56,7 @@ AbcHairWriter::AbcHairWriter(Scene *scene,
                              ExportSettings &settings,
                              ParticleSystem *psys)
     : AbcObjectWriter(scene, ob, time_sampling, settings, parent)
+    , m_uv_warning_shown(false)
 {
        m_psys = psys;
 
@@ -132,8 +133,10 @@ void AbcHairWriter::write_hair_sample(DerivedMesh *dm,
        MFace *mface = dm->getTessFaceArray(dm);
        MVert *mverts = dm->getVertArray(dm);
 
-       if (!mtface || !mface) {
-               std::fprintf(stderr, "Warning, no UV set found for underlying geometry.\n");
+       if ((!mtface || !mface) && !m_uv_warning_shown) {
+               std::fprintf(stderr, "Warning, no UV set found for underlying geometry of %s.\n",
+                            m_object->id.name + 2);
+               m_uv_warning_shown = true;
        }
 
        ParticleData * pa = m_psys->particles;
@@ -241,10 +244,6 @@ void AbcHairWriter::write_hair_child_sample(DerivedMesh *dm,
        MFace *mface = dm->getTessFaceArray(dm);
        MVert *mverts = dm->getVertArray(dm);
 
-       if (!mtface || !mface) {
-               std::fprintf(stderr, "Warning, no UV set found for underlying geometry.\n");
-       }
-
        ParticleCacheKey **cache = m_psys->childcache;
        ParticleCacheKey *path;
 
index d132b60be12fcd6f180254b8e3f72f637d136950..61f5fe361f851c3d645aa9b4769e32bad7e916be 100644 (file)
@@ -37,6 +37,8 @@ class AbcHairWriter : public AbcObjectWriter {
        Alembic::AbcGeom::OCurvesSchema m_schema;
        Alembic::AbcGeom::OCurvesSchema::Sample m_sample;
 
+       bool m_uv_warning_shown;
+
 public:
        AbcHairWriter(Scene *scene,
                      Object *ob,