Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2022-11-10 15:17:42 +0300
committerJulian Eisel <julian@blender.org>2022-11-10 15:17:42 +0300
commit7246c387435769a169ac24c91434c615df6434b4 (patch)
tree61842e3e0ce85e80720fdd7476d44d2e629f59fd /source/blender/io/alembic
parentc5f55d17096d373791363e46004176e3f7f7ae52 (diff)
parent0b4bd3ddc016298e868169a541cf6c132b10c587 (diff)
Merge branch 'master' into asset-browser-grid-viewasset-browser-grid-view
Diffstat (limited to 'source/blender/io/alembic')
-rw-r--r--source/blender/io/alembic/exporter/abc_archive.cc4
-rw-r--r--source/blender/io/alembic/exporter/abc_export_capi.cc10
-rw-r--r--source/blender/io/alembic/exporter/abc_subdiv_disabler.cc4
-rw-r--r--source/blender/io/alembic/exporter/abc_writer_curves.cc2
-rw-r--r--source/blender/io/alembic/exporter/abc_writer_hair.cc6
-rw-r--r--source/blender/io/alembic/exporter/abc_writer_mesh.cc9
-rw-r--r--source/blender/io/alembic/exporter/abc_writer_points.cc9
-rw-r--r--source/blender/io/alembic/intern/abc_axis_conversion.cc8
-rw-r--r--source/blender/io/alembic/intern/abc_customdata.cc4
-rw-r--r--source/blender/io/alembic/intern/abc_reader_camera.cc18
-rw-r--r--source/blender/io/alembic/intern/abc_reader_curves.cc2
-rw-r--r--source/blender/io/alembic/intern/abc_reader_mesh.cc25
-rw-r--r--source/blender/io/alembic/intern/abc_reader_object.cc14
-rw-r--r--source/blender/io/alembic/intern/abc_reader_transform.cc2
-rw-r--r--source/blender/io/alembic/intern/abc_util.cc4
-rw-r--r--source/blender/io/alembic/intern/alembic_capi.cc24
16 files changed, 71 insertions, 74 deletions
diff --git a/source/blender/io/alembic/exporter/abc_archive.cc b/source/blender/io/alembic/exporter/abc_archive.cc
index 9c8a36958d5..55e172db241 100644
--- a/source/blender/io/alembic/exporter/abc_archive.cc
+++ b/source/blender/io/alembic/exporter/abc_archive.cc
@@ -130,13 +130,13 @@ static TimeSamplingPtr create_time_sampling(double scene_fps,
get_shutter_samples(scene_fps, params, nr_of_samples, true, samples);
- TimeSamplingType ts(static_cast<uint32_t>(samples.size()), 1.0 / scene_fps);
+ TimeSamplingType ts(uint32_t(samples.size()), 1.0 / scene_fps);
return TimeSamplingPtr(new TimeSampling(ts, samples)); // NOLINT: modernize-make-shared
}
static void get_frames(double scene_fps,
const AlembicExportParams &params,
- unsigned int nr_of_samples,
+ uint nr_of_samples,
std::set<double> &r_frames)
{
/* Get one set of shutter samples, then add those around each frame to export. */
diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc
index dfca89e2c6d..1ac4eacc997 100644
--- a/source/blender/io/alembic/exporter/abc_export_capi.cc
+++ b/source/blender/io/alembic/exporter/abc_export_capi.cc
@@ -72,8 +72,8 @@ static void report_job_duration(const ExportJobData *data)
static void export_startjob(void *customdata,
/* Cannot be const, this function implements wm_jobs_start_callback.
* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop,
- short *do_update,
+ bool *stop,
+ bool *do_update,
float *progress)
{
ExportJobData *data = static_cast<ExportJobData *>(customdata);
@@ -144,8 +144,8 @@ static void export_startjob(void *customdata,
}
/* Update the scene for the next frame to render. */
- scene->r.cfra = static_cast<int>(frame);
- scene->r.subframe = static_cast<float>(frame - scene->r.cfra);
+ scene->r.cfra = int(frame);
+ scene->r.subframe = float(frame - scene->r.cfra);
BKE_scene_graph_update_for_newframe(data->depsgraph);
CLOG_INFO(&LOG, 2, "Exporting frame %.2f", frame);
@@ -230,7 +230,7 @@ bool ABC_export(Scene *scene,
}
else {
/* Fake a job context, so that we don't need NULL pointer checks while exporting. */
- short stop = 0, do_update = 0;
+ bool stop = false, do_update = false;
float progress = 0.0f;
blender::io::alembic::export_startjob(job, &stop, &do_update, &progress);
diff --git a/source/blender/io/alembic/exporter/abc_subdiv_disabler.cc b/source/blender/io/alembic/exporter/abc_subdiv_disabler.cc
index 514ce389e36..712b04f3992 100644
--- a/source/blender/io/alembic/exporter/abc_subdiv_disabler.cc
+++ b/source/blender/io/alembic/exporter/abc_subdiv_disabler.cc
@@ -14,6 +14,7 @@
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
+#include "BKE_layer.h"
#include "BKE_modifier.h"
namespace blender::io::alembic {
@@ -34,7 +35,8 @@ void SubdivModifierDisabler::disable_modifiers()
Scene *scene = DEG_get_input_scene(depsgraph_);
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph_);
- LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
+ BKE_view_layer_synced_ensure(scene, view_layer);
+ LISTBASE_FOREACH (Base *, base, BKE_view_layer_object_bases_get(view_layer)) {
Object *object = base->object;
if (object->type != OB_MESH) {
diff --git a/source/blender/io/alembic/exporter/abc_writer_curves.cc b/source/blender/io/alembic/exporter/abc_writer_curves.cc
index 4717d3ec26e..e5e8053d7d3 100644
--- a/source/blender/io/alembic/exporter/abc_writer_curves.cc
+++ b/source/blender/io/alembic/exporter/abc_writer_curves.cc
@@ -142,7 +142,7 @@ void ABCCurveWriter::do_write(HierarchyContext &context)
}
}
- orders.push_back(static_cast<uint8_t>(nurbs->orderu));
+ orders.push_back(uint8_t(nurbs->orderu));
vert_counts.push_back(verts.size() - current_point_count);
}
diff --git a/source/blender/io/alembic/exporter/abc_writer_hair.cc b/source/blender/io/alembic/exporter/abc_writer_hair.cc
index 4f09aee3ea9..13136372c56 100644
--- a/source/blender/io/alembic/exporter/abc_writer_hair.cc
+++ b/source/blender/io/alembic/exporter/abc_writer_hair.cc
@@ -118,7 +118,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context,
{
/* Get untransformed vertices, there's a xform under the hair. */
float inv_mat[4][4];
- invert_m4_m4_safe(inv_mat, context.object->obmat);
+ invert_m4_m4_safe(inv_mat, context.object->object_to_world);
MTFace *mtface = (MTFace *)CustomData_get_layer(&mesh->fdata, CD_MTFACE);
MFace *mface = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE);
@@ -190,7 +190,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context,
for (int n = 0; n < mesh->totface; n++) {
MFace *face = &mface[n];
MTFace *tface = mtface + n;
- unsigned int vtx[4];
+ uint vtx[4];
vtx[0] = face->v1;
vtx[1] = face->v2;
vtx[2] = face->v3;
@@ -241,7 +241,7 @@ void ABCHairWriter::write_hair_child_sample(const HierarchyContext &context,
{
/* Get untransformed vertices, there's a xform under the hair. */
float inv_mat[4][4];
- invert_m4_m4_safe(inv_mat, context.object->obmat);
+ invert_m4_m4_safe(inv_mat, context.object->object_to_world);
MFace *mface = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE);
MTFace *mtface = (MTFace *)CustomData_get_layer(&mesh->fdata, CD_MTFACE);
diff --git a/source/blender/io/alembic/exporter/abc_writer_mesh.cc b/source/blender/io/alembic/exporter/abc_writer_mesh.cc
index 7d38cd1ec88..084d26198bc 100644
--- a/source/blender/io/alembic/exporter/abc_writer_mesh.cc
+++ b/source/blender/io/alembic/exporter/abc_writer_mesh.cc
@@ -476,16 +476,17 @@ static void get_edge_creases(struct Mesh *mesh,
std::vector<int32_t> &lengths,
std::vector<float> &sharpnesses)
{
- const float factor = 1.0f / 255.0f;
-
indices.clear();
lengths.clear();
sharpnesses.clear();
+ const float *creases = static_cast<const float *>(CustomData_get_layer(&mesh->edata, CD_CREASE));
+ if (!creases) {
+ return;
+ }
const Span<MEdge> edges = mesh->edges();
-
for (const int i : edges.index_range()) {
- const float sharpness = static_cast<float>(edges[i].crease) * factor;
+ const float sharpness = creases[i];
if (sharpness != 0.0f) {
indices.push_back(edges[i].v1);
diff --git a/source/blender/io/alembic/exporter/abc_writer_points.cc b/source/blender/io/alembic/exporter/abc_writer_points.cc
index 29370978b54..9372bffc3ca 100644
--- a/source/blender/io/alembic/exporter/abc_writer_points.cc
+++ b/source/blender/io/alembic/exporter/abc_writer_points.cc
@@ -85,7 +85,7 @@ void ABCPointsWriter::do_write(HierarchyContext &context)
sim.ob = context.object;
sim.psys = psys;
- psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
+ psys_sim_data_init(&sim);
uint64_t index = 0;
for (int p = 0; p < psys->totpart; p++) {
@@ -101,7 +101,7 @@ void ABCPointsWriter::do_write(HierarchyContext &context)
}
/* location */
- mul_v3_m4v3(pos, context.object->imat, state.co);
+ mul_v3_m4v3(pos, context.object->world_to_object, state.co);
/* velocity */
sub_v3_v3v3(vel, state.co, psys->particles[p].prev_state.co);
@@ -113,10 +113,7 @@ void ABCPointsWriter::do_write(HierarchyContext &context)
ids.push_back(index++);
}
- if (psys->lattice_deform_data) {
- BKE_lattice_deform_data_destroy(psys->lattice_deform_data);
- psys->lattice_deform_data = nullptr;
- }
+ psys_sim_data_free(&sim);
Alembic::Abc::P3fArraySample psample(points);
Alembic::Abc::UInt64ArraySample idsample(ids);
diff --git a/source/blender/io/alembic/intern/abc_axis_conversion.cc b/source/blender/io/alembic/intern/abc_axis_conversion.cc
index 00e5890e9d3..c7d2a3e1bf4 100644
--- a/source/blender/io/alembic/intern/abc_axis_conversion.cc
+++ b/source/blender/io/alembic/intern/abc_axis_conversion.cc
@@ -134,15 +134,15 @@ void create_transform_matrix(Object *obj,
if (mode == ABC_MATRIX_LOCAL && obj->parent) {
/* Note that this produces another matrix than the local matrix, due to
* constraints and modifiers as well as the obj->parentinv matrix. */
- invert_m4_m4(obj->parent->imat, obj->parent->obmat);
- mul_m4_m4m4(zup_mat, obj->parent->imat, obj->obmat);
+ invert_m4_m4(obj->parent->world_to_object, obj->parent->object_to_world);
+ mul_m4_m4m4(zup_mat, obj->parent->world_to_object, obj->object_to_world);
}
else {
- copy_m4_m4(zup_mat, obj->obmat);
+ copy_m4_m4(zup_mat, obj->object_to_world);
}
if (proxy_from) {
- mul_m4_m4m4(zup_mat, proxy_from->obmat, zup_mat);
+ mul_m4_m4m4(zup_mat, proxy_from->object_to_world, zup_mat);
}
copy_m44_axis_swap(r_yup_mat, zup_mat, ABC_YUP_FROM_ZUP);
diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc
index 5494bfaa6e8..3349f9fc30b 100644
--- a/source/blender/io/alembic/intern/abc_customdata.cc
+++ b/source/blender/io/alembic/intern/abc_customdata.cc
@@ -322,14 +322,14 @@ static void read_uvs(const CDStreamConfig &config,
MLoop *mloops = config.mloop;
MLoopUV *mloopuvs = static_cast<MLoopUV *>(data);
- unsigned int uv_index, loop_index, rev_loop_index;
+ uint uv_index, loop_index, rev_loop_index;
BLI_assert(uv_scope != ABC_UV_SCOPE_NONE);
const bool do_uvs_per_loop = (uv_scope == ABC_UV_SCOPE_LOOP);
for (int i = 0; i < config.totpoly; i++) {
MPoly &poly = mpolys[i];
- unsigned int rev_loop_offset = poly.loopstart + poly.totloop - 1;
+ uint rev_loop_offset = poly.loopstart + poly.totloop - 1;
for (int f = 0; f < poly.totloop; f++) {
rev_loop_index = rev_loop_offset - f;
diff --git a/source/blender/io/alembic/intern/abc_reader_camera.cc b/source/blender/io/alembic/intern/abc_reader_camera.cc
index 830526a11ac..e7a319730b6 100644
--- a/source/blender/io/alembic/intern/abc_reader_camera.cc
+++ b/source/blender/io/alembic/intern/abc_reader_camera.cc
@@ -77,11 +77,11 @@ void AbcCameraReader::readObjectData(Main *bmain, const ISampleSelector &sample_
bcam->stereo.convergence_distance = convergence_plane.getValue(sample_sel);
}
- const float lens = static_cast<float>(cam_sample.getFocalLength());
- const float apperture_x = static_cast<float>(cam_sample.getHorizontalAperture());
- const float apperture_y = static_cast<float>(cam_sample.getVerticalAperture());
- const float h_film_offset = static_cast<float>(cam_sample.getHorizontalFilmOffset());
- const float v_film_offset = static_cast<float>(cam_sample.getVerticalFilmOffset());
+ const float lens = float(cam_sample.getFocalLength());
+ const float apperture_x = float(cam_sample.getHorizontalAperture());
+ const float apperture_y = float(cam_sample.getVerticalAperture());
+ const float h_film_offset = float(cam_sample.getHorizontalFilmOffset());
+ const float v_film_offset = float(cam_sample.getVerticalFilmOffset());
const float film_aspect = apperture_x / apperture_y;
bcam->lens = lens;
@@ -89,10 +89,10 @@ void AbcCameraReader::readObjectData(Main *bmain, const ISampleSelector &sample_
bcam->sensor_y = apperture_y * 10;
bcam->shiftx = h_film_offset / apperture_x;
bcam->shifty = v_film_offset / apperture_y / film_aspect;
- bcam->clip_start = max_ff(0.1f, static_cast<float>(cam_sample.getNearClippingPlane()));
- bcam->clip_end = static_cast<float>(cam_sample.getFarClippingPlane());
- bcam->dof.focus_distance = static_cast<float>(cam_sample.getFocusDistance());
- bcam->dof.aperture_fstop = static_cast<float>(cam_sample.getFStop());
+ bcam->clip_start = max_ff(0.1f, float(cam_sample.getNearClippingPlane()));
+ bcam->clip_end = float(cam_sample.getFarClippingPlane());
+ bcam->dof.focus_distance = float(cam_sample.getFocusDistance());
+ bcam->dof.aperture_fstop = float(cam_sample.getFStop());
m_object = BKE_object_add_only_object(bmain, OB_CAMERA, m_object_name.c_str());
m_object->data = bcam;
diff --git a/source/blender/io/alembic/intern/abc_reader_curves.cc b/source/blender/io/alembic/intern/abc_reader_curves.cc
index d8859acdf5f..24bdae3ac50 100644
--- a/source/blender/io/alembic/intern/abc_reader_curves.cc
+++ b/source/blender/io/alembic/intern/abc_reader_curves.cc
@@ -152,7 +152,7 @@ void AbcCurveReader::read_curve_sample(Curve *cu,
break;
case Alembic::AbcGeom::kVariableOrder:
if (orders && orders->size() > i) {
- nu->orderu = static_cast<short>((*orders)[i]);
+ nu->orderu = short((*orders)[i]);
break;
}
ATTR_FALLTHROUGH;
diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc
index c07aaa37988..2531bd62609 100644
--- a/source/blender/io/alembic/intern/abc_reader_mesh.cc
+++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc
@@ -133,7 +133,7 @@ static void read_mverts_interp(MVert *mverts,
const Imath::V3f &floor_pos = (*positions)[i];
const Imath::V3f &ceil_pos = (*ceil_positions)[i];
- interp_v3_v3v3(tmp, floor_pos.getValue(), ceil_pos.getValue(), static_cast<float>(weight));
+ interp_v3_v3v3(tmp, floor_pos.getValue(), ceil_pos.getValue(), float(weight));
copy_zup_from_yup(mvert.co, tmp);
}
}
@@ -188,9 +188,9 @@ static void read_mpolys(CDStreamConfig &config, const AbcMeshData &mesh_data)
const bool do_uvs = (mloopuvs && uvs && uvs_indices);
const bool do_uvs_per_loop = do_uvs && mesh_data.uv_scope == ABC_UV_SCOPE_LOOP;
BLI_assert(!do_uvs || mesh_data.uv_scope != ABC_UV_SCOPE_NONE);
- unsigned int loop_index = 0;
- unsigned int rev_loop_index = 0;
- unsigned int uv_index = 0;
+ uint loop_index = 0;
+ uint rev_loop_index = 0;
+ uint uv_index = 0;
bool seen_invalid_geometry = false;
for (int i = 0; i < face_counts->size(); i++) {
@@ -448,7 +448,7 @@ static void read_velocity(const V3fArraySamplePtr &velocities,
const CDStreamConfig &config,
const float velocity_scale)
{
- const int num_velocity_vectors = static_cast<int>(velocities->size());
+ const int num_velocity_vectors = int(velocities->size());
if (num_velocity_vectors != config.mesh->totvert) {
/* Files containing videogrammetry data may be malformed and export velocity data on missing
* frames (most likely by copying the last valid data). */
@@ -763,7 +763,7 @@ Mesh *AbcMeshReader::read_mesh(Mesh *existing_mesh,
std::map<std::string, int> mat_map;
bke::MutableAttributeAccessor attributes = new_mesh->attributes_for_write();
bke::SpanAttributeWriter<int> material_indices =
- attributes.lookup_or_add_for_write_only_span<int>("material_index", ATTR_DOMAIN_FACE);
+ attributes.lookup_or_add_for_write_span<int>("material_index", ATTR_DOMAIN_FACE);
assign_facesets_to_material_indices(sample_sel, material_indices.span, mat_map);
material_indices.finish();
}
@@ -823,8 +823,8 @@ void AbcMeshReader::readFaceSetsSample(Main *bmain, Mesh *mesh, const ISampleSel
{
std::map<std::string, int> mat_map;
bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
- bke::SpanAttributeWriter<int> material_indices =
- attributes.lookup_or_add_for_write_only_span<int>("material_index", ATTR_DOMAIN_FACE);
+ bke::SpanAttributeWriter<int> material_indices = attributes.lookup_or_add_for_write_span<int>(
+ "material_index", ATTR_DOMAIN_FACE);
assign_facesets_to_material_indices(sample_sel, material_indices.span, mat_map);
material_indices.finish();
utils::assign_materials(bmain, m_object, mat_map);
@@ -903,8 +903,6 @@ static void read_vertex_creases(Mesh *mesh,
vertex_crease_data[idx] = (*sharpnesses)[i];
}
-
- mesh->cd_flag |= ME_CDFLAG_VERT_CREASE;
}
static void read_edge_creases(Mesh *mesh,
@@ -918,6 +916,9 @@ static void read_edge_creases(Mesh *mesh,
MutableSpan<MEdge> edges = mesh->edges_for_write();
EdgeHash *edge_hash = BLI_edgehash_new_ex(__func__, edges.size());
+ float *creases = static_cast<float *>(
+ CustomData_add_layer(&mesh->edata, CD_CREASE, CD_SET_DEFAULT, nullptr, edges.size()));
+
for (const int i : edges.index_range()) {
MEdge *edge = &edges[i];
BLI_edgehash_insert(edge_hash, edge->v1, edge->v2, edge);
@@ -939,13 +940,11 @@ static void read_edge_creases(Mesh *mesh,
}
if (edge) {
- edge->crease = unit_float_to_uchar_clamp((*sharpnesses)[s]);
+ creases[edge - edges.data()] = unit_float_to_uchar_clamp((*sharpnesses)[s]);
}
}
BLI_edgehash_free(edge_hash, nullptr);
-
- mesh->cd_flag |= ME_CDFLAG_EDGE_CREASE;
}
/* ************************************************************************** */
diff --git a/source/blender/io/alembic/intern/abc_reader_object.cc b/source/blender/io/alembic/intern/abc_reader_object.cc
index db056c0eef6..f3a07eaad3f 100644
--- a/source/blender/io/alembic/intern/abc_reader_object.cc
+++ b/source/blender/io/alembic/intern/abc_reader_object.cc
@@ -110,7 +110,7 @@ static Imath::M44d blend_matrices(const Imath::M44d &m0,
convert_matrix_datatype(m0, mat0);
convert_matrix_datatype(m1, mat1);
- interp_m4_m4m4(ret, mat0, mat1, static_cast<float>(weight));
+ interp_m4_m4m4(ret, mat0, mat1, float(weight));
return convert_matrix_datatype(ret);
}
@@ -133,11 +133,11 @@ Imath::M44d get_matrix(const IXformSchema &schema, const chrono_t time)
}
struct Mesh *AbcObjectReader::read_mesh(struct Mesh *existing_mesh,
- const Alembic::Abc::ISampleSelector &UNUSED(sample_sel),
- int UNUSED(read_flag),
- const char *UNUSED(velocity_name),
- const float UNUSED(velocity_scale),
- const char **UNUSED(err_str))
+ const Alembic::Abc::ISampleSelector & /*sample_sel*/,
+ int /*read_flag*/,
+ const char * /*velocity_name*/,
+ const float /*velocity_scale*/,
+ const char ** /*err_str*/)
{
return existing_mesh;
}
@@ -165,7 +165,7 @@ void AbcObjectReader::setupObjectTransform(const chrono_t time)
/* Apply the matrix to the object. */
BKE_object_apply_mat4(m_object, transform_from_alembic, true, false);
- BKE_object_to_mat4(m_object, m_object->obmat);
+ BKE_object_to_mat4(m_object, m_object->object_to_world);
if (!is_constant || m_settings->always_add_cache_reader) {
bConstraint *con = BKE_constraint_add_for_object(
diff --git a/source/blender/io/alembic/intern/abc_reader_transform.cc b/source/blender/io/alembic/intern/abc_reader_transform.cc
index 0d3227fc718..71682531378 100644
--- a/source/blender/io/alembic/intern/abc_reader_transform.cc
+++ b/source/blender/io/alembic/intern/abc_reader_transform.cc
@@ -55,7 +55,7 @@ bool AbcEmptyReader::accepts_object_type(
return true;
}
-void AbcEmptyReader::readObjectData(Main *bmain, const ISampleSelector &UNUSED(sample_sel))
+void AbcEmptyReader::readObjectData(Main *bmain, const ISampleSelector & /*sample_sel*/)
{
m_object = BKE_object_add_only_object(bmain, OB_EMPTY, m_object_name.c_str());
m_object->data = nullptr;
diff --git a/source/blender/io/alembic/intern/abc_util.cc b/source/blender/io/alembic/intern/abc_util.cc
index 90f73d25c22..846a3622d62 100644
--- a/source/blender/io/alembic/intern/abc_util.cc
+++ b/source/blender/io/alembic/intern/abc_util.cc
@@ -73,7 +73,7 @@ Imath::M44d convert_matrix_datatype(float mat[4][4])
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
- m[i][j] = static_cast<double>(mat[i][j]);
+ m[i][j] = double(mat[i][j]);
}
}
@@ -84,7 +84,7 @@ void convert_matrix_datatype(const Imath::M44d &xform, float r_mat[4][4])
{
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
- r_mat[i][j] = static_cast<float>(xform[i][j]);
+ r_mat[i][j] = float(xform[i][j]);
}
}
}
diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc
index 86622719f6e..f6c11f6a684 100644
--- a/source/blender/io/alembic/intern/alembic_capi.cc
+++ b/source/blender/io/alembic/intern/alembic_capi.cc
@@ -427,8 +427,8 @@ struct ImportJobData {
ArchiveReader *archive;
std::vector<AbcObjectReader *> readers;
- short *stop;
- short *do_update;
+ bool *stop;
+ bool *do_update;
float *progress;
char error_code;
@@ -446,7 +446,7 @@ static void report_job_duration(const ImportJobData *data)
std::cout << '\n';
}
-static void import_startjob(void *user_data, short *stop, short *do_update, float *progress)
+static void import_startjob(void *user_data, bool *stop, bool *do_update, float *progress)
{
SCOPE_TIMER("Alembic import, objects reading and creation");
@@ -502,7 +502,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
/* Create objects and set scene frame range. */
- const float size = static_cast<float>(data->readers.size());
+ const float size = float(data->readers.size());
size_t i = 0;
chrono_t min_time = std::numeric_limits<chrono_t>::max();
@@ -542,8 +542,8 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
scene->r.cfra = scene->r.sfra;
}
else if (min_time < max_time) {
- scene->r.sfra = static_cast<int>(round(min_time * FPS));
- scene->r.efra = static_cast<int>(round(max_time * FPS));
+ scene->r.sfra = int(round(min_time * FPS));
+ scene->r.efra = int(round(max_time * FPS));
scene->r.cfra = scene->r.sfra;
}
}
@@ -601,21 +601,19 @@ static void import_endjob(void *user_data)
else {
Base *base;
LayerCollection *lc;
+ const Scene *scene = data->scene;
ViewLayer *view_layer = data->view_layer;
- BKE_view_layer_base_deselect_all(view_layer);
+ BKE_view_layer_base_deselect_all(scene, view_layer);
lc = BKE_layer_collection_get_active(view_layer);
- /* Add all objects to the collection (don't do sync for each object). */
- BKE_layer_collection_resync_forbid();
for (AbcObjectReader *reader : data->readers) {
Object *ob = reader->object();
BKE_collection_object_add(data->bmain, lc->collection, ob);
}
- /* Sync the collection, and do view layer operations. */
- BKE_layer_collection_resync_allow();
- BKE_main_collection_sync(data->bmain);
+ /* Sync and do the view layer operations. */
+ BKE_view_layer_synced_ensure(scene, view_layer);
for (AbcObjectReader *reader : data->readers) {
Object *ob = reader->object();
base = BKE_view_layer_base_find(view_layer, ob);
@@ -717,7 +715,7 @@ bool ABC_import(bContext *C,
}
else {
/* Fake a job context, so that we don't need NULL pointer checks while importing. */
- short stop = 0, do_update = 0;
+ bool stop = false, do_update = false;
float progress = 0.0f;
import_startjob(job, &stop, &do_update, &progress);