Changeset View
Changeset View
Standalone View
Standalone View
source/blender/io/alembic/intern/abc_reader_points.cc
| Show All 21 Lines | |||||
| */ | */ | ||||
| #include "abc_reader_points.h" | #include "abc_reader_points.h" | ||||
| #include "abc_reader_mesh.h" | #include "abc_reader_mesh.h" | ||||
| #include "abc_reader_transform.h" | #include "abc_reader_transform.h" | ||||
| #include "abc_util.h" | #include "abc_util.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_modifier_types.h" | |||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "BKE_customdata.h" | #include "BKE_customdata.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| using Alembic::AbcGeom::kWrapExisting; | using Alembic::AbcGeom::kWrapExisting; | ||||
| using Alembic::AbcGeom::N3fArraySamplePtr; | using Alembic::AbcGeom::N3fArraySamplePtr; | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | if (has_property(prop, "N")) { | ||||
| } | } | ||||
| } | } | ||||
| read_mverts(config.mvert, positions, vnormals); | read_mverts(config.mvert, positions, vnormals); | ||||
| } | } | ||||
| struct Mesh *AbcPointsReader::read_mesh(struct Mesh *existing_mesh, | struct Mesh *AbcPointsReader::read_mesh(struct Mesh *existing_mesh, | ||||
| const ISampleSelector &sample_sel, | const ISampleSelector &sample_sel, | ||||
| int /*read_flag*/, | int read_flag, | ||||
| const char **err_str) | const char **err_str) | ||||
| { | { | ||||
| IPointsSchema::Sample sample; | IPointsSchema::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) { | ||||
| *err_str = "Error reading points sample; more detail on the console"; | *err_str = "Error reading points sample; more detail on the console"; | ||||
| printf("Alembic: error reading points sample for '%s/%s' at time %f: %s\n", | printf("Alembic: error reading points sample for '%s/%s' at time %f: %s\n", | ||||
| m_iobject.getFullName().c_str(), | m_iobject.getFullName().c_str(), | ||||
| m_schema.getName().c_str(), | m_schema.getName().c_str(), | ||||
| sample_sel.getRequestedTime(), | sample_sel.getRequestedTime(), | ||||
| ex.what()); | ex.what()); | ||||
| return existing_mesh; | return existing_mesh; | ||||
| } | } | ||||
| const P3fArraySamplePtr &positions = sample.getPositions(); | const P3fArraySamplePtr &positions = sample.getPositions(); | ||||
| Mesh *new_mesh = NULL; | Mesh *new_mesh = NULL; | ||||
| if (existing_mesh->totvert != positions->size()) { | if (existing_mesh->totvert != positions->size()) { | ||||
| new_mesh = BKE_mesh_new_nomain(positions->size(), 0, 0, 0, 0); | new_mesh = BKE_mesh_new_nomain(positions->size(), 0, 0, 0, 0); | ||||
| } | } | ||||
| CDStreamConfig config = get_config(new_mesh ? new_mesh : existing_mesh); | CDStreamConfig config = get_config(new_mesh ? new_mesh : existing_mesh, | ||||
| read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES); | |||||
| read_points_sample(m_schema, sample_sel, config); | read_points_sample(m_schema, sample_sel, config); | ||||
sergey: Mesh *mesh_to_export = new_mesh ? new_mesh : existing_mesh;
const bool… | |||||
| return new_mesh ? new_mesh : existing_mesh; | return new_mesh ? new_mesh : existing_mesh; | ||||
| } | } | ||||
| } // namespace blender::io::alembic | } // namespace blender::io::alembic | ||||
But sure, other than the boolean flag the rest is the existing code.
The point of adding extra boolean variable is to avoid inlined bit operations in the function call, which, I think, is more readable.