Changeset View
Changeset View
Standalone View
Standalone View
source/blender/alembic/intern/abc_mesh.cc
| Show First 20 Lines • Show All 548 Lines • ▼ Show 20 Lines | if (m_settings.triangulate) { | ||||
| const int ngon_method = m_settings.ngon_method; | const int ngon_method = m_settings.ngon_method; | ||||
| struct BMeshCreateParams bmcp = {false}; | struct BMeshCreateParams bmcp = {false}; | ||||
| struct BMeshFromMeshParams bmfmp = {true, false, false, 0}; | struct BMeshFromMeshParams bmfmp = {true, false, false, 0}; | ||||
| BMesh *bm = BKE_mesh_to_bmesh_ex(mesh, &bmcp, &bmfmp); | BMesh *bm = BKE_mesh_to_bmesh_ex(mesh, &bmcp, &bmfmp); | ||||
| BM_mesh_triangulate(bm, quad_method, ngon_method, tag_only, NULL, NULL, NULL); | BM_mesh_triangulate(bm, quad_method, ngon_method, tag_only, NULL, NULL, NULL); | ||||
| Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0); | Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL); | ||||
| BM_mesh_free(bm); | BM_mesh_free(bm); | ||||
| if (r_needsfree) { | if (r_needsfree) { | ||||
| BKE_id_free(NULL, mesh); | BKE_id_free(NULL, mesh); | ||||
| } | } | ||||
| mesh = result; | mesh = result; | ||||
| r_needsfree = true; | r_needsfree = true; | ||||
| ▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | AbcMeshWriter::AbcMeshWriter(Object *ob, | ||||
| : AbcGenericMeshWriter(ob, parent, time_sampling, settings) | : AbcGenericMeshWriter(ob, parent, time_sampling, settings) | ||||
| {} | {} | ||||
| AbcMeshWriter::~AbcMeshWriter() | AbcMeshWriter::~AbcMeshWriter() | ||||
| {} | {} | ||||
| Mesh *AbcMeshWriter::getEvaluatedMesh(Scene *scene_eval, Object *ob_eval, bool &UNUSED(r_needsfree)) | Mesh *AbcMeshWriter::getEvaluatedMesh(Scene *scene_eval, Object *ob_eval, bool &UNUSED(r_needsfree)) | ||||
| { | { | ||||
| return mesh_get_eval_final(m_settings.depsgraph, scene_eval, ob_eval, CD_MASK_MESH); | return mesh_get_eval_final(m_settings.depsgraph, scene_eval, ob_eval, &CD_MASK_MESH); | ||||
| } | } | ||||
| /* ************************************************************************** */ | /* ************************************************************************** */ | ||||
| /* Some helpers for mesh generation */ | /* Some helpers for mesh generation */ | ||||
| namespace utils { | namespace utils { | ||||
| ▲ Show 20 Lines • Show All 371 Lines • ▼ Show 20 Lines | |||||
| void AbcMeshReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) | void AbcMeshReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) | ||||
| { | { | ||||
| Mesh *mesh = BKE_mesh_add(bmain, m_data_name.c_str()); | Mesh *mesh = BKE_mesh_add(bmain, m_data_name.c_str()); | ||||
| m_object = BKE_object_add_only_object(bmain, OB_MESH, m_object_name.c_str()); | m_object = BKE_object_add_only_object(bmain, OB_MESH, m_object_name.c_str()); | ||||
| m_object->data = mesh; | m_object->data = mesh; | ||||
| Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, NULL); | Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, NULL); | ||||
| BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, CD_MASK_MESH, true); | BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, &CD_MASK_MESH, true); | ||||
| if (m_settings->validate_meshes) { | if (m_settings->validate_meshes) { | ||||
| BKE_mesh_validate(mesh, false, false); | BKE_mesh_validate(mesh, false, false); | ||||
| } | } | ||||
| readFaceSetsSample(bmain, mesh, 0, sample_sel); | readFaceSetsSample(bmain, mesh, 0, sample_sel); | ||||
| if (has_animations(m_schema, m_settings)) { | if (has_animations(m_schema, m_settings)) { | ||||
| ▲ Show 20 Lines • Show All 266 Lines • ▼ Show 20 Lines | |||||
| void AbcSubDReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) | void AbcSubDReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) | ||||
| { | { | ||||
| Mesh *mesh = BKE_mesh_add(bmain, m_data_name.c_str()); | Mesh *mesh = BKE_mesh_add(bmain, m_data_name.c_str()); | ||||
| m_object = BKE_object_add_only_object(bmain, OB_MESH, m_object_name.c_str()); | m_object = BKE_object_add_only_object(bmain, OB_MESH, m_object_name.c_str()); | ||||
| m_object->data = mesh; | m_object->data = mesh; | ||||
| Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, NULL); | Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, NULL); | ||||
| BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, CD_MASK_MESH, true); | BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, &CD_MASK_MESH, true); | ||||
| ISubDSchema::Sample sample; | ISubDSchema::Sample sample; | ||||
| try { | try { | ||||
| sample = m_schema.getValue(sample_sel); | sample = m_schema.getValue(sample_sel); | ||||
| } | } | ||||
| catch(Alembic::Util::Exception &ex) { | catch(Alembic::Util::Exception &ex) { | ||||
| printf("Alembic: error reading mesh sample for '%s/%s' at time %f: %s\n", | printf("Alembic: error reading mesh sample for '%s/%s' at time %f: %s\n", | ||||
| m_iobject.getFullName().c_str(), | m_iobject.getFullName().c_str(), | ||||
| ▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines | |||||