Merge branch 'master' into blender2.8
[blender.git] / source / blender / alembic / intern / abc_mesh.cc
index 39186ec55dc980074cdcca61657c9ce31da7da29..bc62db5702c0874a950f7719ae0ad189aef3cbd7 100644 (file)
@@ -38,7 +38,6 @@ extern "C" {
 #include "BLI_string.h"
 
 #include "BKE_cdderivedmesh.h"
-#include "BKE_depsgraph.h"
 #include "BKE_main.h"
 #include "BKE_material.h"
 #include "BKE_mesh.h"
@@ -355,7 +354,7 @@ bool AbcMeshWriter::isAnimated() const
                md = md->next;
        }
 
-       return false;
+       return me->adt != NULL;
 }
 
 void AbcMeshWriter::do_write()
@@ -918,12 +917,6 @@ static void *add_customdata_cb(void *user_data, const char *name, int data_type)
        numloops = dm->getNumLoops(dm);
        cd_ptr = CustomData_add_layer_named(loopdata, cd_data_type, CD_DEFAULT,
                                            NULL, numloops, name);
-       if (cd_data_type == CD_MLOOPUV) {
-               CustomData_add_layer_named(dm->getPolyDataLayout(dm),
-                                          CD_MTEXPOLY, CD_DEFAULT,
-                                          NULL, numloops, name);
-       }
-
        return cd_ptr;
 }
 
@@ -1048,6 +1041,23 @@ void AbcMeshReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec
        }
 }
 
+bool AbcMeshReader::accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
+                                        const Object *const ob,
+                                        const char **err_str) const
+{
+       if (!Alembic::AbcGeom::IPolyMesh::matches(alembic_header)) {
+               *err_str = "Object type mismatch, Alembic object path pointed to PolyMesh when importing, but not any more.";
+               return false;
+       }
+
+       if (ob->type != OB_MESH) {
+               *err_str = "Object type mismatch, Alembic object path points to PolyMesh.";
+               return false;
+       }
+
+       return true;
+}
+
 DerivedMesh *AbcMeshReader::read_derivedmesh(DerivedMesh *dm,
                                              const ISampleSelector &sample_sel,
                                              int read_flag,
@@ -1239,6 +1249,23 @@ bool AbcSubDReader::valid() const
        return m_schema.valid();
 }
 
+bool AbcSubDReader::accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
+                                        const Object *const ob,
+                                        const char **err_str) const
+{
+       if (!Alembic::AbcGeom::ISubD::matches(alembic_header)) {
+               *err_str = "Object type mismatch, Alembic object path pointed to SubD when importing, but not any more.";
+               return false;
+       }
+
+       if (ob->type != OB_MESH) {
+               *err_str = "Object type mismatch, Alembic object path points to SubD.";
+               return false;
+       }
+
+       return true;
+}
+
 void AbcSubDReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel)
 {
        Mesh *mesh = BKE_mesh_add(bmain, m_data_name.c_str());