Changeset View
Changeset View
Standalone View
Standalone View
source/blender/io/alembic/intern/abc_reader_mesh.cc
| Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | static void read_mverts_interp(MVert *mverts, | ||||
| } | } | ||||
| } | } | ||||
| static void read_mverts(CDStreamConfig &config, const AbcMeshData &mesh_data) | static void read_mverts(CDStreamConfig &config, const AbcMeshData &mesh_data) | ||||
| { | { | ||||
| MVert *mverts = config.mvert; | MVert *mverts = config.mvert; | ||||
| const P3fArraySamplePtr &positions = mesh_data.positions; | const P3fArraySamplePtr &positions = mesh_data.positions; | ||||
| if (config.weight != 0.0f && mesh_data.ceil_positions != NULL && | if (config.use_vertex_interpolation && config.weight != 0.0f && | ||||
| mesh_data.ceil_positions->size() == positions->size()) { | mesh_data.ceil_positions != NULL && mesh_data.ceil_positions->size() == positions->size()) { | ||||
| read_mverts_interp(mverts, positions, mesh_data.ceil_positions, config.weight); | read_mverts_interp(mverts, positions, mesh_data.ceil_positions, config.weight); | ||||
| return; | return; | ||||
| } | } | ||||
| read_mverts(mverts, positions, nullptr); | read_mverts(mverts, positions, nullptr); | ||||
| } | } | ||||
| void read_mverts(MVert *mverts, const P3fArraySamplePtr positions, const N3fArraySamplePtr normals) | void read_mverts(MVert *mverts, const P3fArraySamplePtr positions, const N3fArraySamplePtr normals) | ||||
| ▲ Show 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | if ((settings->read_flag & MOD_MESHSEQ_READ_POLY) != 0) { | ||||
| process_normals(config, schema.getNormalsParam(), selector); | process_normals(config, schema.getNormalsParam(), selector); | ||||
| } | } | ||||
| if ((settings->read_flag & (MOD_MESHSEQ_READ_UV | MOD_MESHSEQ_READ_COLOR)) != 0) { | if ((settings->read_flag & (MOD_MESHSEQ_READ_UV | MOD_MESHSEQ_READ_COLOR)) != 0) { | ||||
| read_custom_data(iobject_full_name, schema.getArbGeomParams(), config, selector); | read_custom_data(iobject_full_name, schema.getArbGeomParams(), config, selector); | ||||
| } | } | ||||
| } | } | ||||
| CDStreamConfig get_config(Mesh *mesh) | CDStreamConfig get_config(Mesh *mesh, const bool use_vertex_interpolation) | ||||
| { | { | ||||
| CDStreamConfig config; | CDStreamConfig config; | ||||
| BLI_assert(mesh->mvert || mesh->totvert == 0); | BLI_assert(mesh->mvert || mesh->totvert == 0); | ||||
| config.mesh = mesh; | config.mesh = mesh; | ||||
| config.mvert = mesh->mvert; | config.mvert = mesh->mvert; | ||||
| config.mloop = mesh->mloop; | config.mloop = mesh->mloop; | ||||
| config.mpoly = mesh->mpoly; | config.mpoly = mesh->mpoly; | ||||
| config.totloop = mesh->totloop; | config.totloop = mesh->totloop; | ||||
| config.totpoly = mesh->totpoly; | config.totpoly = mesh->totpoly; | ||||
| config.loopdata = &mesh->ldata; | config.loopdata = &mesh->ldata; | ||||
| config.add_customdata_cb = add_customdata_cb; | config.add_customdata_cb = add_customdata_cb; | ||||
| config.use_vertex_interpolation = use_vertex_interpolation; | |||||
| return config; | return config; | ||||
| } | } | ||||
| /* ************************************************************************** */ | /* ************************************************************************** */ | ||||
| AbcMeshReader::AbcMeshReader(const IObject &object, ImportSettings &settings) | AbcMeshReader::AbcMeshReader(const IObject &object, ImportSettings &settings) | ||||
| : AbcObjectReader(object, settings) | : AbcObjectReader(object, settings) | ||||
| ▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | if (face_counts->size() != existing_mesh->totpoly || | ||||
| if (err_str) { | if (err_str) { | ||||
| *err_str = | *err_str = | ||||
| "Topology has changed, perhaps by triangulating the" | "Topology has changed, perhaps by triangulating the" | ||||
| " mesh. Only vertices will be read!"; | " mesh. Only vertices will be read!"; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| CDStreamConfig config = get_config(new_mesh ? new_mesh : existing_mesh); | const bool use_vertex_interpolation = read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES; | ||||
| CDStreamConfig config = get_config(new_mesh ? new_mesh : existing_mesh, | |||||
| use_vertex_interpolation); | |||||
| config.time = sample_sel.getRequestedTime(); | config.time = sample_sel.getRequestedTime(); | ||||
| config.modifier_error_message = err_str; | config.modifier_error_message = err_str; | ||||
| read_mesh_sample(m_iobject.getFullName(), &settings, m_schema, sample_sel, config); | read_mesh_sample(m_iobject.getFullName(), &settings, m_schema, sample_sel, config); | ||||
| if (new_mesh) { | if (new_mesh) { | ||||
| /* Here we assume that the number of materials doesn't change, i.e. that | /* Here we assume that the number of materials doesn't change, i.e. that | ||||
| * the material slots that were created when the object was loaded from | * the material slots that were created when the object was loaded from | ||||
| ▲ Show 20 Lines • Show All 273 Lines • ▼ Show 20 Lines | if (face_counts->size() != existing_mesh->totpoly || | ||||
| *err_str = | *err_str = | ||||
| "Topology has changed, perhaps by triangulating the" | "Topology has changed, perhaps by triangulating the" | ||||
| " mesh. Only vertices will be read!"; | " mesh. Only vertices will be read!"; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Only read point data when streaming meshes, unless we need to create new ones. */ | /* Only read point data when streaming meshes, unless we need to create new ones. */ | ||||
| CDStreamConfig config = get_config(new_mesh ? new_mesh : existing_mesh); | const bool use_vertex_interpolation = read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES; | ||||
| CDStreamConfig config = get_config(new_mesh ? new_mesh : existing_mesh, | |||||
| use_vertex_interpolation); | |||||
| config.time = sample_sel.getRequestedTime(); | config.time = sample_sel.getRequestedTime(); | ||||
| read_subd_sample(m_iobject.getFullName(), &settings, m_schema, sample_sel, config); | read_subd_sample(m_iobject.getFullName(), &settings, m_schema, sample_sel, config); | ||||
| return config.mesh; | return config.mesh; | ||||
| } | } | ||||
| } // namespace blender::io::alembic | } // namespace blender::io::alembic | ||||