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:
Diffstat (limited to 'source/blender/io')
-rw-r--r--source/blender/io/alembic/ABC_alembic.h10
-rw-r--r--source/blender/io/alembic/CMakeLists.txt14
-rw-r--r--source/blender/io/alembic/exporter/abc_export_capi.cc37
-rw-r--r--source/blender/io/alembic/intern/abc_axis_conversion.cc2
-rw-r--r--source/blender/io/alembic/intern/abc_axis_conversion.h2
-rw-r--r--source/blender/io/alembic/intern/abc_customdata.cc4
-rw-r--r--source/blender/io/alembic/intern/abc_reader_archive.cc2
-rw-r--r--source/blender/io/alembic/intern/alembic_capi.cc146
-rw-r--r--source/blender/io/alembic/tests/abc_export_test.cc161
-rw-r--r--source/blender/io/alembic/tests/abc_matrix_test.cc292
-rw-r--r--source/blender/io/avi/AVI_avi.h5
-rw-r--r--source/blender/io/avi/intern/avi.c10
-rw-r--r--source/blender/io/avi/intern/avi_endian.h5
-rw-r--r--source/blender/io/avi/intern/avi_intern.h5
-rw-r--r--source/blender/io/avi/intern/avi_mjpeg.h5
-rw-r--r--source/blender/io/avi/intern/avi_rgb.c45
-rw-r--r--source/blender/io/avi/intern/avi_rgb.h5
-rw-r--r--source/blender/io/avi/intern/avi_rgb32.h5
-rw-r--r--source/blender/io/collada/AnimationClipExporter.h5
-rw-r--r--source/blender/io/collada/AnimationExporter.cpp23
-rw-r--r--source/blender/io/collada/AnimationExporter.h5
-rw-r--r--source/blender/io/collada/AnimationImporter.cpp162
-rw-r--r--source/blender/io/collada/AnimationImporter.h5
-rw-r--r--source/blender/io/collada/ArmatureExporter.h5
-rw-r--r--source/blender/io/collada/ArmatureImporter.h5
-rw-r--r--source/blender/io/collada/BCAnimationCurve.cpp5
-rw-r--r--source/blender/io/collada/BCAnimationCurve.h5
-rw-r--r--source/blender/io/collada/BCAnimationSampler.cpp2
-rw-r--r--source/blender/io/collada/BCAnimationSampler.h5
-rw-r--r--source/blender/io/collada/BCMath.h5
-rw-r--r--source/blender/io/collada/BCSampleData.h5
-rw-r--r--source/blender/io/collada/BlenderContext.h5
-rw-r--r--source/blender/io/collada/BlenderTypes.h5
-rw-r--r--source/blender/io/collada/CameraExporter.h5
-rw-r--r--source/blender/io/collada/ControllerExporter.h5
-rw-r--r--source/blender/io/collada/DocumentExporter.h5
-rw-r--r--source/blender/io/collada/DocumentImporter.cpp3
-rw-r--r--source/blender/io/collada/DocumentImporter.h5
-rw-r--r--source/blender/io/collada/EffectExporter.h5
-rw-r--r--source/blender/io/collada/ErrorHandler.h5
-rw-r--r--source/blender/io/collada/ExportSettings.h5
-rw-r--r--source/blender/io/collada/ExtraHandler.h5
-rw-r--r--source/blender/io/collada/ExtraTags.h5
-rw-r--r--source/blender/io/collada/GeometryExporter.h5
-rw-r--r--source/blender/io/collada/ImageExporter.h5
-rw-r--r--source/blender/io/collada/ImportSettings.h5
-rw-r--r--source/blender/io/collada/InstanceWriter.h5
-rw-r--r--source/blender/io/collada/LightExporter.h5
-rw-r--r--source/blender/io/collada/MaterialExporter.h5
-rw-r--r--source/blender/io/collada/Materials.h5
-rw-r--r--source/blender/io/collada/MeshImporter.h5
-rw-r--r--source/blender/io/collada/SceneExporter.h5
-rw-r--r--source/blender/io/collada/SkinInfo.h5
-rw-r--r--source/blender/io/collada/TransformReader.h5
-rw-r--r--source/blender/io/collada/TransformWriter.h5
-rw-r--r--source/blender/io/collada/collada.h5
-rw-r--r--source/blender/io/collada/collada_internal.cpp2
-rw-r--r--source/blender/io/collada/collada_internal.h5
-rw-r--r--source/blender/io/collada/collada_utils.cpp28
-rw-r--r--source/blender/io/collada/collada_utils.h9
-rw-r--r--source/blender/io/common/CMakeLists.txt5
-rw-r--r--source/blender/io/common/IO_abstract_hierarchy_iterator.h5
-rw-r--r--source/blender/io/common/IO_dupli_persistent_id.hh5
-rw-r--r--source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc3
-rw-r--r--source/blender/io/common/intern/dupli_parent_finder.hh5
-rw-r--r--source/blender/io/usd/intern/usd_exporter_context.h5
-rw-r--r--source/blender/io/usd/intern/usd_hierarchy_iterator.h5
-rw-r--r--source/blender/io/usd/intern/usd_writer_abstract.h5
-rw-r--r--source/blender/io/usd/intern/usd_writer_camera.h5
-rw-r--r--source/blender/io/usd/intern/usd_writer_hair.h5
-rw-r--r--source/blender/io/usd/intern/usd_writer_light.h5
-rw-r--r--source/blender/io/usd/intern/usd_writer_mesh.h5
-rw-r--r--source/blender/io/usd/intern/usd_writer_metaball.h5
-rw-r--r--source/blender/io/usd/intern/usd_writer_transform.h5
-rw-r--r--source/blender/io/usd/usd.h5
75 files changed, 846 insertions, 386 deletions
diff --git a/source/blender/io/alembic/ABC_alembic.h b/source/blender/io/alembic/ABC_alembic.h
index ddf75aa3258..67f8aeb0a67 100644
--- a/source/blender/io/alembic/ABC_alembic.h
+++ b/source/blender/io/alembic/ABC_alembic.h
@@ -128,6 +128,16 @@ struct CacheReader *CacheReader_open_alembic_object(struct AbcArchiveHandle *han
struct Object *object,
const char *object_path);
+bool ABC_has_vec3_array_property_named(struct CacheReader *reader, const char *name);
+
+/* r_vertex_velocities should point to a preallocated array of num_vertices floats */
+int ABC_read_velocity_cache(struct CacheReader *reader,
+ const char *velocity_name,
+ float time,
+ float fps,
+ int num_vertices,
+ float *r_vertex_velocities);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/io/alembic/CMakeLists.txt b/source/blender/io/alembic/CMakeLists.txt
index 681d6d04acd..de99a2c9d65 100644
--- a/source/blender/io/alembic/CMakeLists.txt
+++ b/source/blender/io/alembic/CMakeLists.txt
@@ -110,3 +110,17 @@ list(APPEND LIB
)
blender_add_lib(bf_alembic "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
+
+if(WITH_GTESTS)
+ set(TEST_SRC
+ tests/abc_export_test.cc
+ tests/abc_matrix_test.cc
+ )
+ set(TEST_INC
+ )
+ set(TEST_LIB
+ bf_alembic
+ )
+ include(GTestTesting)
+ blender_add_test_lib(bf_io_alembic_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
+endif()
diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc
index 98c551c635c..8c5f3d89870 100644
--- a/source/blender/io/alembic/exporter/abc_export_capi.cc
+++ b/source/blender/io/alembic/exporter/abc_export_capi.cc
@@ -48,6 +48,7 @@
static CLG_LogRef LOG = {"io.alembic"};
#include <algorithm>
+#include <memory>
struct ExportJobData {
Main *bmain;
@@ -103,17 +104,41 @@ static void export_startjob(void *customdata,
const bool export_animation = (data->params.frame_start != data->params.frame_end);
// Create the Alembic archive.
- ABCArchive abc_archive(data->bmain, scene, data->params, std::string(data->filename));
+ std::unique_ptr<ABCArchive> abc_archive;
+ try {
+ abc_archive = std::make_unique<ABCArchive>(
+ data->bmain, scene, data->params, std::string(data->filename));
+ }
+ catch (const std::exception &ex) {
+ std::stringstream error_message_stream;
+ error_message_stream << "Error writing to " << data->filename;
+ const std::string &error_message = error_message_stream.str();
+
+ // The exception message can be very cryptic (just "iostream error" on Linux, for example), so
+ // better not to include it in the report.
+ CLOG_ERROR(&LOG, "%s: %s", error_message.c_str(), ex.what());
+ WM_report(RPT_ERROR, error_message.c_str());
+ data->export_ok = false;
+ return;
+ }
+ catch (...) {
+ // Unknown exception class, so we cannot include its message.
+ std::stringstream error_message_stream;
+ error_message_stream << "Unknown error writing to " << data->filename;
+ WM_report(RPT_ERROR, error_message_stream.str().c_str());
+ data->export_ok = false;
+ return;
+ }
- ABCHierarchyIterator iter(data->depsgraph, &abc_archive, data->params);
+ ABCHierarchyIterator iter(data->depsgraph, abc_archive.get(), data->params);
if (export_animation) {
CLOG_INFO(&LOG, 2, "Exporting animation");
// Writing the animated frames is not 100% of the work, but it's our best guess.
- const float progress_per_frame = 1.0f / std::max(size_t(1), abc_archive.total_frame_count());
- ABCArchive::Frames::const_iterator frame_it = abc_archive.frames_begin();
- const ABCArchive::Frames::const_iterator frames_end = abc_archive.frames_end();
+ const float progress_per_frame = 1.0f / std::max(size_t(1), abc_archive->total_frame_count());
+ ABCArchive::Frames::const_iterator frame_it = abc_archive->frames_begin();
+ const ABCArchive::Frames::const_iterator frames_end = abc_archive->frames_end();
for (; frame_it != frames_end; frame_it++) {
double frame = *frame_it;
@@ -128,7 +153,7 @@ static void export_startjob(void *customdata,
BKE_scene_graph_update_for_newframe(data->depsgraph, data->bmain);
CLOG_INFO(&LOG, 2, "Exporting frame %.2f", frame);
- ExportSubset export_subset = abc_archive.export_subset_for_frame(frame);
+ ExportSubset export_subset = abc_archive->export_subset_for_frame(frame);
iter.set_export_subset(export_subset);
iter.iterate_and_write();
diff --git a/source/blender/io/alembic/intern/abc_axis_conversion.cc b/source/blender/io/alembic/intern/abc_axis_conversion.cc
index cebab1f2e41..396c8fdb28b 100644
--- a/source/blender/io/alembic/intern/abc_axis_conversion.cc
+++ b/source/blender/io/alembic/intern/abc_axis_conversion.cc
@@ -170,4 +170,4 @@ void create_transform_matrix(Object *obj,
} // namespace alembic
} // namespace io
-} // namespace blender \ No newline at end of file
+} // namespace blender
diff --git a/source/blender/io/alembic/intern/abc_axis_conversion.h b/source/blender/io/alembic/intern/abc_axis_conversion.h
index 9a19e9116be..645d9fc783b 100644
--- a/source/blender/io/alembic/intern/abc_axis_conversion.h
+++ b/source/blender/io/alembic/intern/abc_axis_conversion.h
@@ -100,4 +100,4 @@ void create_transform_matrix(Object *obj,
} // namespace alembic
} // namespace io
-} // namespace blender \ No newline at end of file
+} // namespace blender
diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc
index f3e2342e844..408894a8de2 100644
--- a/source/blender/io/alembic/intern/abc_customdata.cc
+++ b/source/blender/io/alembic/intern/abc_customdata.cc
@@ -330,7 +330,7 @@ static void read_custom_data_mcols(const std::string &iobject_full_name,
if (IC3fGeomParam::matches(prop_header)) {
IC3fGeomParam color_param(arbGeomParams, prop_header.getName());
IC3fGeomParam::Sample sample;
- BLI_assert(!strcmp("rgb", color_param.getInterpretation()));
+ BLI_assert(STREQ("rgb", color_param.getInterpretation()));
color_param.getIndexed(sample, iss);
is_facevarying = sample.getScope() == kFacevaryingScope &&
@@ -343,7 +343,7 @@ static void read_custom_data_mcols(const std::string &iobject_full_name,
else if (IC4fGeomParam::matches(prop_header)) {
IC4fGeomParam color_param(arbGeomParams, prop_header.getName());
IC4fGeomParam::Sample sample;
- BLI_assert(!strcmp("rgba", color_param.getInterpretation()));
+ BLI_assert(STREQ("rgba", color_param.getInterpretation()));
color_param.getIndexed(sample, iss);
is_facevarying = sample.getScope() == kFacevaryingScope &&
diff --git a/source/blender/io/alembic/intern/abc_reader_archive.cc b/source/blender/io/alembic/intern/abc_reader_archive.cc
index d7f1095f0fd..776b8955d47 100644
--- a/source/blender/io/alembic/intern/abc_reader_archive.cc
+++ b/source/blender/io/alembic/intern/abc_reader_archive.cc
@@ -63,7 +63,7 @@ static IArchive open_archive(const std::string &filename,
else if (!the_file.read(header, sizeof(header))) {
std::cerr << "Unable to read from " << filename << std::endl;
}
- else if (strncmp(header + 1, "HDF", 3)) {
+ else if (strncmp(header + 1, "HDF", 3) != 0) {
std::cerr << filename << " has an unknown file format, unable to read." << std::endl;
}
else {
diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc
index 7cde2d4fe73..eba7f64db02 100644
--- a/source/blender/io/alembic/intern/alembic_capi.cc
+++ b/source/blender/io/alembic/intern/alembic_capi.cc
@@ -22,6 +22,7 @@
#include <Alembic/AbcMaterial/IMaterial.h>
+#include "abc_axis_conversion.h"
#include "abc_reader_archive.h"
#include "abc_reader_camera.h"
#include "abc_reader_curves.h"
@@ -47,18 +48,13 @@
#include "BKE_lib_id.h"
#include "BKE_object.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "ED_undo.h"
-/* SpaceType struct has a member called 'new' which obviously conflicts with C++
- * so temporarily redefining the new keyword to make it compile. */
-#define new extern_new
-#include "BKE_screen.h"
-#undef new
-
#include "BLI_compiler_compat.h"
#include "BLI_fileops.h"
#include "BLI_ghash.h"
@@ -70,7 +66,10 @@
#include "WM_api.h"
#include "WM_types.h"
+using Alembic::Abc::IV3fArrayProperty;
using Alembic::Abc::ObjectHeader;
+using Alembic::Abc::PropertyHeader;
+using Alembic::Abc::V3fArraySamplePtr;
using Alembic::AbcGeom::ICamera;
using Alembic::AbcGeom::ICurves;
using Alembic::AbcGeom::IFaceSet;
@@ -79,9 +78,11 @@ using Alembic::AbcGeom::INuPatch;
using Alembic::AbcGeom::IObject;
using Alembic::AbcGeom::IPoints;
using Alembic::AbcGeom::IPolyMesh;
+using Alembic::AbcGeom::IPolyMeshSchema;
using Alembic::AbcGeom::ISampleSelector;
using Alembic::AbcGeom::ISubD;
using Alembic::AbcGeom::IXform;
+using Alembic::AbcGeom::kWrapExisting;
using Alembic::AbcGeom::MetaData;
using Alembic::AbcMaterial::IMaterial;
@@ -859,3 +860,136 @@ CacheReader *CacheReader_open_alembic_object(AbcArchiveHandle *handle,
return reinterpret_cast<CacheReader *>(abc_reader);
}
+
+/* ************************************************************************** */
+
+static const PropertyHeader *get_property_header(const IPolyMeshSchema &schema, const char *name)
+{
+ const PropertyHeader *prop_header = schema.getPropertyHeader(name);
+
+ if (prop_header) {
+ return prop_header;
+ }
+
+ ICompoundProperty prop = schema.getArbGeomParams();
+
+ if (!has_property(prop, name)) {
+ return nullptr;
+ }
+
+ return prop.getPropertyHeader(name);
+}
+
+bool ABC_has_vec3_array_property_named(struct CacheReader *reader, const char *name)
+{
+ AbcObjectReader *abc_reader = reinterpret_cast<AbcObjectReader *>(reader);
+
+ if (!abc_reader) {
+ return false;
+ }
+
+ IObject iobject = abc_reader->iobject();
+
+ if (!iobject.valid()) {
+ return false;
+ }
+
+ const ObjectHeader &header = iobject.getHeader();
+
+ if (!IPolyMesh::matches(header)) {
+ return false;
+ }
+
+ IPolyMesh mesh(iobject, kWrapExisting);
+ IPolyMeshSchema schema = mesh.getSchema();
+
+ const PropertyHeader *prop_header = get_property_header(schema, name);
+
+ if (!prop_header) {
+ return false;
+ }
+
+ return IV3fArrayProperty::matches(prop_header->getMetaData());
+}
+
+static V3fArraySamplePtr get_velocity_prop(const IPolyMeshSchema &schema,
+ const ISampleSelector &iss,
+ const std::string &name)
+{
+ const PropertyHeader *prop_header = schema.getPropertyHeader(name);
+
+ if (prop_header) {
+ const IV3fArrayProperty &velocity_prop = IV3fArrayProperty(schema, name, 0);
+ return velocity_prop.getValue(iss);
+ }
+
+ ICompoundProperty prop = schema.getArbGeomParams();
+
+ if (!has_property(prop, name)) {
+ return V3fArraySamplePtr();
+ }
+
+ const IV3fArrayProperty &velocity_prop = IV3fArrayProperty(prop, name, 0);
+
+ if (velocity_prop) {
+ return velocity_prop.getValue(iss);
+ }
+
+ return V3fArraySamplePtr();
+}
+
+int ABC_read_velocity_cache(CacheReader *reader,
+ const char *velocity_name,
+ const float time,
+ float velocity_scale,
+ int num_vertices,
+ float *r_vertex_velocities)
+{
+ AbcObjectReader *abc_reader = reinterpret_cast<AbcObjectReader *>(reader);
+
+ if (!abc_reader) {
+ return -1;
+ }
+
+ IObject iobject = abc_reader->iobject();
+
+ if (!iobject.valid()) {
+ return -1;
+ }
+
+ const ObjectHeader &header = iobject.getHeader();
+
+ if (!IPolyMesh::matches(header)) {
+ return -1;
+ }
+
+ IPolyMesh mesh(iobject, kWrapExisting);
+ IPolyMeshSchema schema = mesh.getSchema();
+ ISampleSelector sample_sel(time);
+ const IPolyMeshSchema::Sample sample = schema.getValue(sample_sel);
+
+ V3fArraySamplePtr velocities = get_velocity_prop(schema, sample_sel, velocity_name);
+
+ if (!velocities) {
+ return -1;
+ }
+
+ float vel[3];
+
+ int num_velocity_vectors = static_cast<int>(velocities->size());
+
+ if (num_velocity_vectors != num_vertices) {
+ return -1;
+ }
+
+ for (size_t i = 0; i < velocities->size(); ++i) {
+ const Imath::V3f &vel_in = (*velocities)[i];
+ copy_zup_from_yup(vel, vel_in.getValue());
+
+ mul_v3_fl(vel, velocity_scale);
+
+ copy_v3_v3(r_vertex_velocities + i * 3, vel);
+ }
+
+ return num_vertices;
+}
diff --git a/source/blender/io/alembic/tests/abc_export_test.cc b/source/blender/io/alembic/tests/abc_export_test.cc
new file mode 100644
index 00000000000..5c2b505958e
--- /dev/null
+++ b/source/blender/io/alembic/tests/abc_export_test.cc
@@ -0,0 +1,161 @@
+#include "testing/testing.h"
+
+// Keep first since utildefines defines AT which conflicts with STL
+#include "exporter/abc_archive.h"
+#include "intern/abc_util.h"
+
+#include "BKE_main.h"
+#include "BLI_fileops.h"
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+#include "DNA_scene_types.h"
+
+#include "DEG_depsgraph.h"
+
+namespace blender {
+namespace io {
+namespace alembic {
+
+class AlembicExportTest : public testing::Test {
+ protected:
+ ABCArchive *abc_archive;
+
+ AlembicExportParams params;
+ Scene scene;
+ Depsgraph *depsgraph;
+ Main *bmain;
+
+ virtual void SetUp()
+ {
+ abc_archive = nullptr;
+
+ /* Fake a 25 FPS scene with a nonzero base (because that's sometimes forgotten) */
+ scene.r.frs_sec = 50;
+ scene.r.frs_sec_base = 2;
+ strcpy(scene.id.name, "SCTestScene");
+
+ bmain = BKE_main_new();
+
+ /* TODO(sergey): Pass scene layer somehow? */
+ ViewLayer *view_layer = (ViewLayer *)scene.view_layers.first;
+ depsgraph = DEG_graph_new(bmain, &scene, view_layer, DAG_EVAL_RENDER);
+ }
+
+ virtual void TearDown()
+ {
+ BKE_main_free(bmain);
+ DEG_graph_free(depsgraph);
+ deleteArchive();
+ }
+
+ // Call after setting up the parameters.
+ void createArchive()
+ {
+ if (abc_archive != nullptr) {
+ deleteArchive();
+ }
+ abc_archive = new ABCArchive(bmain, &scene, params, "somefile.abc");
+ }
+
+ void deleteArchive()
+ {
+ delete abc_archive;
+ if (BLI_exists("somefile.abc")) {
+ BLI_delete("somefile.abc", false, false);
+ }
+ abc_archive = nullptr;
+ }
+};
+
+TEST_F(AlembicExportTest, TimeSamplesFullShutterUniform)
+{
+ /* Test 5 samples per frame, for 2 frames. */
+ params.shutter_open = 0.0;
+ params.shutter_close = 1.0;
+ params.frame_start = 31.0;
+ params.frame_end = 32.0;
+ params.frame_samples_xform = params.frame_samples_shape = 5;
+ createArchive();
+ std::vector<double> frames(abc_archive->frames_begin(), abc_archive->frames_end());
+ EXPECT_EQ(10, frames.size());
+ EXPECT_NEAR(31.0, frames[0], 1e-5);
+ EXPECT_NEAR(31.2, frames[1], 1e-5);
+ EXPECT_NEAR(31.4, frames[2], 1e-5);
+ EXPECT_NEAR(31.6, frames[3], 1e-5);
+ EXPECT_NEAR(31.8, frames[4], 1e-5);
+ EXPECT_NEAR(32.0, frames[5], 1e-5);
+ EXPECT_NEAR(32.2, frames[6], 1e-5);
+ EXPECT_NEAR(32.4, frames[7], 1e-5);
+ EXPECT_NEAR(32.6, frames[8], 1e-5);
+ EXPECT_NEAR(32.8, frames[9], 1e-5);
+
+ for (double frame : frames) {
+ EXPECT_TRUE(abc_archive->is_xform_frame(frame));
+ EXPECT_TRUE(abc_archive->is_shape_frame(frame));
+ }
+}
+
+TEST_F(AlembicExportTest, TimeSamplesFullShutterDifferent)
+{
+ /* Test 3 samples per frame for transforms, and 2 per frame for shapes, for 2 frames. */
+ params.shutter_open = 0.0;
+ params.shutter_close = 1.0;
+ params.frame_start = 31.0;
+ params.frame_end = 32.0;
+ params.frame_samples_xform = 3;
+ params.frame_samples_shape = 2;
+ createArchive();
+ std::vector<double> frames(abc_archive->frames_begin(), abc_archive->frames_end());
+ EXPECT_EQ(8, frames.size());
+ EXPECT_NEAR(31.0, frames[0], 1e-5); // transform + shape
+ EXPECT_TRUE(abc_archive->is_xform_frame(frames[0]));
+ EXPECT_TRUE(abc_archive->is_shape_frame(frames[0]));
+ EXPECT_NEAR(31.33333, frames[1], 1e-5); // transform
+ EXPECT_TRUE(abc_archive->is_xform_frame(frames[1]));
+ EXPECT_FALSE(abc_archive->is_shape_frame(frames[1]));
+ EXPECT_NEAR(31.5, frames[2], 1e-5); // shape
+ EXPECT_FALSE(abc_archive->is_xform_frame(frames[2]));
+ EXPECT_TRUE(abc_archive->is_shape_frame(frames[2]));
+ EXPECT_NEAR(31.66666, frames[3], 1e-5); // transform
+ EXPECT_TRUE(abc_archive->is_xform_frame(frames[3]));
+ EXPECT_FALSE(abc_archive->is_shape_frame(frames[3]));
+ EXPECT_NEAR(32.0, frames[4], 1e-5); // transform + shape
+ EXPECT_TRUE(abc_archive->is_xform_frame(frames[4]));
+ EXPECT_TRUE(abc_archive->is_shape_frame(frames[4]));
+ EXPECT_NEAR(32.33333, frames[5], 1e-5); // transform
+ EXPECT_TRUE(abc_archive->is_xform_frame(frames[5]));
+ EXPECT_FALSE(abc_archive->is_shape_frame(frames[5]));
+ EXPECT_NEAR(32.5, frames[6], 1e-5); // shape
+ EXPECT_FALSE(abc_archive->is_xform_frame(frames[6]));
+ EXPECT_TRUE(abc_archive->is_shape_frame(frames[6]));
+ EXPECT_NEAR(32.66666, frames[7], 1e-5); // transform
+ EXPECT_TRUE(abc_archive->is_xform_frame(frames[7]));
+ EXPECT_FALSE(abc_archive->is_shape_frame(frames[7]));
+}
+
+TEST_F(AlembicExportTest, TimeSamples180degShutter)
+{
+ /* Test 5 samples per frame, for 2 frames. */
+ params.shutter_open = -0.25;
+ params.shutter_close = 0.25;
+ params.frame_start = 31.0;
+ params.frame_end = 32.0;
+ params.frame_samples_xform = params.frame_samples_shape = 5;
+ createArchive();
+ std::vector<double> frames(abc_archive->frames_begin(), abc_archive->frames_end());
+ EXPECT_EQ(10, frames.size());
+ EXPECT_NEAR(31 - 0.25, frames[0], 1e-5);
+ EXPECT_NEAR(31 - 0.15, frames[1], 1e-5);
+ EXPECT_NEAR(31 - 0.05, frames[2], 1e-5);
+ EXPECT_NEAR(31 + 0.05, frames[3], 1e-5);
+ EXPECT_NEAR(31 + 0.15, frames[4], 1e-5);
+ EXPECT_NEAR(32 - 0.25, frames[5], 1e-5);
+ EXPECT_NEAR(32 - 0.15, frames[6], 1e-5);
+ EXPECT_NEAR(32 - 0.05, frames[7], 1e-5);
+ EXPECT_NEAR(32 + 0.05, frames[8], 1e-5);
+ EXPECT_NEAR(32 + 0.15, frames[9], 1e-5);
+}
+
+} // namespace alembic
+} // namespace io
+} // namespace blender
diff --git a/source/blender/io/alembic/tests/abc_matrix_test.cc b/source/blender/io/alembic/tests/abc_matrix_test.cc
new file mode 100644
index 00000000000..b58e989b1a1
--- /dev/null
+++ b/source/blender/io/alembic/tests/abc_matrix_test.cc
@@ -0,0 +1,292 @@
+#include "testing/testing.h"
+
+// Keep first since utildefines defines AT which conflicts with STL
+#include "intern/abc_axis_conversion.h"
+
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+
+namespace blender {
+namespace io {
+namespace alembic {
+
+TEST(abc_matrix, CreateRotationMatrixY_YfromZ)
+{
+ // Input variables
+ float rot_x_mat[3][3];
+ float rot_y_mat[3][3];
+ float rot_z_mat[3][3];
+ float euler[3] = {0.f, M_PI_4, 0.f};
+
+ // Construct expected matrices
+ float unit[3][3];
+ float rot_z_min_quart_pi[3][3]; // rotation of -pi/4 radians over z-axis
+
+ unit_m3(unit);
+ unit_m3(rot_z_min_quart_pi);
+ rot_z_min_quart_pi[0][0] = M_SQRT1_2;
+ rot_z_min_quart_pi[0][1] = -M_SQRT1_2;
+ rot_z_min_quart_pi[1][0] = M_SQRT1_2;
+ rot_z_min_quart_pi[1][1] = M_SQRT1_2;
+
+ // Run tests
+ create_swapped_rotation_matrix(rot_x_mat, rot_y_mat, rot_z_mat, euler, ABC_YUP_FROM_ZUP);
+
+ EXPECT_M3_NEAR(rot_x_mat, unit, 1e-5f);
+ EXPECT_M3_NEAR(rot_y_mat, unit, 1e-5f);
+ EXPECT_M3_NEAR(rot_z_mat, rot_z_min_quart_pi, 1e-5f);
+}
+
+TEST(abc_matrix, CreateRotationMatrixZ_YfromZ)
+{
+ // Input variables
+ float rot_x_mat[3][3];
+ float rot_y_mat[3][3];
+ float rot_z_mat[3][3];
+ float euler[3] = {0.f, 0.f, M_PI_4};
+
+ // Construct expected matrices
+ float unit[3][3];
+ float rot_y_quart_pi[3][3]; // rotation of pi/4 radians over y-axis
+
+ unit_m3(unit);
+ unit_m3(rot_y_quart_pi);
+ rot_y_quart_pi[0][0] = M_SQRT1_2;
+ rot_y_quart_pi[0][2] = -M_SQRT1_2;
+ rot_y_quart_pi[2][0] = M_SQRT1_2;
+ rot_y_quart_pi[2][2] = M_SQRT1_2;
+
+ // Run tests
+ create_swapped_rotation_matrix(rot_x_mat, rot_y_mat, rot_z_mat, euler, ABC_YUP_FROM_ZUP);
+
+ EXPECT_M3_NEAR(rot_x_mat, unit, 1e-5f);
+ EXPECT_M3_NEAR(rot_y_mat, rot_y_quart_pi, 1e-5f);
+ EXPECT_M3_NEAR(rot_z_mat, unit, 1e-5f);
+}
+
+TEST(abc_matrix, CreateRotationMatrixXYZ_YfromZ)
+{
+ // Input variables
+ float rot_x_mat[3][3];
+ float rot_y_mat[3][3];
+ float rot_z_mat[3][3];
+ // in degrees: X=10, Y=20, Z=30
+ float euler[3] = {0.17453292012214f, 0.34906581044197f, 0.52359879016876f};
+
+ // Construct expected matrices
+ float rot_x_p10[3][3]; // rotation of +10 degrees over x-axis
+ float rot_y_p30[3][3]; // rotation of +30 degrees over y-axis
+ float rot_z_m20[3][3]; // rotation of -20 degrees over z-axis
+
+ unit_m3(rot_x_p10);
+ rot_x_p10[1][1] = 0.9848077297210693f;
+ rot_x_p10[1][2] = 0.1736481785774231f;
+ rot_x_p10[2][1] = -0.1736481785774231f;
+ rot_x_p10[2][2] = 0.9848077297210693f;
+
+ unit_m3(rot_y_p30);
+ rot_y_p30[0][0] = 0.8660253882408142f;
+ rot_y_p30[0][2] = -0.5f;
+ rot_y_p30[2][0] = 0.5f;
+ rot_y_p30[2][2] = 0.8660253882408142f;
+
+ unit_m3(rot_z_m20);
+ rot_z_m20[0][0] = 0.9396926164627075f;
+ rot_z_m20[0][1] = -0.3420201241970062f;
+ rot_z_m20[1][0] = 0.3420201241970062f;
+ rot_z_m20[1][1] = 0.9396926164627075f;
+
+ // Run tests
+ create_swapped_rotation_matrix(rot_x_mat, rot_y_mat, rot_z_mat, euler, ABC_YUP_FROM_ZUP);
+
+ EXPECT_M3_NEAR(rot_x_mat, rot_x_p10, 1e-5f);
+ EXPECT_M3_NEAR(rot_y_mat, rot_y_p30, 1e-5f);
+ EXPECT_M3_NEAR(rot_z_mat, rot_z_m20, 1e-5f);
+}
+
+TEST(abc_matrix, CreateRotationMatrixXYZ_ZfromY)
+{
+ // Input variables
+ float rot_x_mat[3][3];
+ float rot_y_mat[3][3];
+ float rot_z_mat[3][3];
+ // in degrees: X=10, Y=20, Z=30
+ float euler[3] = {0.1745329201221466f, 0.3490658104419708f, 0.5235987901687622f};
+
+ // Construct expected matrices
+ float rot_x_p10[3][3]; // rotation of +10 degrees over x-axis
+ float rot_y_m30[3][3]; // rotation of -30 degrees over y-axis
+ float rot_z_p20[3][3]; // rotation of +20 degrees over z-axis
+
+ unit_m3(rot_x_p10);
+ rot_x_p10[1][1] = 0.9848077297210693f;
+ rot_x_p10[1][2] = 0.1736481785774231f;
+ rot_x_p10[2][1] = -0.1736481785774231f;
+ rot_x_p10[2][2] = 0.9848077297210693f;
+
+ unit_m3(rot_y_m30);
+ rot_y_m30[0][0] = 0.8660253882408142f;
+ rot_y_m30[0][2] = 0.5f;
+ rot_y_m30[2][0] = -0.5f;
+ rot_y_m30[2][2] = 0.8660253882408142f;
+
+ unit_m3(rot_z_p20);
+ rot_z_p20[0][0] = 0.9396926164627075f;
+ rot_z_p20[0][1] = 0.3420201241970062f;
+ rot_z_p20[1][0] = -0.3420201241970062f;
+ rot_z_p20[1][1] = 0.9396926164627075f;
+
+ // Run tests
+ create_swapped_rotation_matrix(rot_x_mat, rot_y_mat, rot_z_mat, euler, ABC_ZUP_FROM_YUP);
+
+ EXPECT_M3_NEAR(rot_x_mat, rot_x_p10, 1e-5f);
+ EXPECT_M3_NEAR(rot_y_mat, rot_y_m30, 1e-5f);
+ EXPECT_M3_NEAR(rot_z_mat, rot_z_p20, 1e-5f);
+}
+
+TEST(abc_matrix, CopyM44AxisSwap_YfromZ)
+{
+ float result[4][4];
+
+ /* Construct an input matrix that performs a rotation like the tests
+ * above. This matrix was created by rotating a cube in Blender over
+ * (X=10, Y=20, Z=30 degrees in XYZ order) and translating over (1, 2, 3) */
+ float input[4][4] = {
+ {0.81379765272f, 0.4698463380336f, -0.342020124197f, 0.f},
+ {-0.44096961617f, 0.8825641274452f, 0.163175910711f, 0.f},
+ {0.37852230668f, 0.0180283170193f, 0.925416588783f, 0.f},
+ {1.f, 2.f, 3.f, 1.f},
+ };
+
+ copy_m44_axis_swap(result, input, ABC_YUP_FROM_ZUP);
+
+ /* Check the resulting rotation & translation. */
+ float trans[4] = {1.f, 3.f, -2.f, 1.f};
+ EXPECT_V4_NEAR(trans, result[3], 1e-5f);
+
+ /* This matrix was created by rotating a cube in Blender over
+ * (X=10, Y=30, Z=-20 degrees in XZY order) and translating over (1, 3, -2) */
+ float expect[4][4] = {
+ {0.813797652721f, -0.342020124197f, -0.469846338033f, 0.f},
+ {0.378522306680f, 0.925416588783f, -0.018028317019f, 0.f},
+ {0.440969616174f, -0.163175910711f, 0.882564127445f, 0.f},
+ {1.f, 3.f, -2.f, 1.f},
+ };
+ EXPECT_M4_NEAR(expect, result, 1e-5f);
+}
+
+TEST(abc_matrix, CopyM44AxisSwapWithScale_YfromZ)
+{
+ float result[4][4];
+
+ /* Construct an input matrix that performs a rotation like the tests
+ * above. This matrix was created by rotating a cube in Blender over
+ * (X=10, Y=20, Z=30 degrees in XYZ order), translating over (1, 2, 3),
+ * and scaling by (4, 5, 6). */
+ float input[4][4] = {
+ {3.25519061088f, 1.8793853521347f, -1.368080496788f, 0.f},
+ {-2.20484805107f, 4.4128208160400f, 0.815879583358f, 0.f},
+ {2.27113389968f, 0.1081698983907f, 5.552499771118f, 0.f},
+ {1.f, 2.f, 3.f, 1.f},
+ };
+
+ copy_m44_axis_swap(result, input, ABC_YUP_FROM_ZUP);
+
+ /* This matrix was created by rotating a cube in Blender over
+ * (X=10, Y=30, Z=-20 degrees in XZY order), translating over (1, 3, -2)
+ * and scaling over (4, 6, 5). */
+ float expect[4][4] = {
+ {3.255190610885f, -1.368080496788f, -1.879385352134f, 0.f},
+ {2.271133899688f, 5.552499771118f, -0.108169898390f, 0.f},
+ {2.204848051071f, -0.815879583358f, 4.412820816040f, 0.f},
+ {1.f, 3.f, -2.f, 1.f},
+ };
+ EXPECT_M4_NEAR(expect, result, 1e-5f);
+}
+
+TEST(abc_matrix, CopyM44AxisSwap_ZfromY)
+{
+ float result[4][4];
+
+ /* This matrix was created by rotating a cube in Blender over
+ * (X=10, Y=30, Z=-20 degrees in XZY order) and translating over (1, 3, -2) */
+ float input[4][4] = {
+ {0.813797652721f, -0.342020124197f, -0.469846338033f, 0.f},
+ {0.378522306680f, 0.925416588783f, -0.018028317019f, 0.f},
+ {0.440969616174f, -0.163175910711f, 0.882564127445f, 0.f},
+ {1.f, 3.f, -2.f, 1.f},
+ };
+
+ copy_m44_axis_swap(result, input, ABC_ZUP_FROM_YUP);
+
+ /* This matrix was created by rotating a cube in Blender over
+ * (X=10, Y=20, Z=30 degrees in XYZ order) and translating over (1, 2, 3) */
+ float expect[4][4] = {
+ {0.813797652721f, 0.469846338033f, -0.342020124197f, 0.f},
+ {-0.44096961617f, 0.882564127445f, 0.163175910711f, 0.f},
+ {0.378522306680f, 0.018028317019f, 0.925416588783f, 0.f},
+ {1.f, 2.f, 3.f, 1.f},
+ };
+
+ EXPECT_M4_NEAR(expect, result, 1e-5f);
+}
+
+TEST(abc_matrix, CopyM44AxisSwapWithScale_ZfromY)
+{
+ float result[4][4];
+
+ /* This matrix was created by rotating a cube in Blender over
+ * (X=10, Y=30, Z=-20 degrees in XZY order), translating over (1, 3, -2)
+ * and scaling over (4, 6, 5). */
+ float input[4][4] = {
+ {3.2551906108f, -1.36808049678f, -1.879385352134f, 0.f},
+ {2.2711338996f, 5.55249977111f, -0.108169898390f, 0.f},
+ {2.2048480510f, -0.81587958335f, 4.412820816040f, 0.f},
+ {1.f, 3.f, -2.f, 1.f},
+ };
+
+ copy_m44_axis_swap(result, input, ABC_ZUP_FROM_YUP);
+
+ /* This matrix was created by rotating a cube in Blender over
+ * (X=10, Y=20, Z=30 degrees in XYZ order), translating over (1, 2, 3),
+ * and scaling by (4, 5, 6). */
+ float expect[4][4] = {
+ {3.25519061088f, 1.879385352134f, -1.36808049678f, 0.f},
+ {-2.2048480510f, 4.412820816040f, 0.81587958335f, 0.f},
+ {2.27113389968f, 0.108169898390f, 5.55249977111f, 0.f},
+ {1.f, 2.f, 3.f, 1.f},
+ };
+
+ EXPECT_M4_NEAR(expect, result, 1e-5f);
+}
+
+TEST(abc_matrix, CopyM44AxisSwapWithScale_gimbal_ZfromY)
+{
+ float result[4][4];
+
+ /* This matrix represents a rotation over (-90, -0, -0) degrees,
+ * and a translation over (-0, -0.1, -0). It is in Y=up. */
+ float input[4][4] = {
+ {1.000f, 0.000f, 0.000f, 0.000f},
+ {0.000f, 0.000f, -1.000f, 0.000f},
+ {0.000f, 1.000f, 0.000f, 0.000f},
+ {-0.000f, -0.100f, -0.000f, 1.000f},
+ };
+
+ copy_m44_axis_swap(result, input, ABC_ZUP_FROM_YUP);
+
+ /* Since the rotation is only over the X-axis, it should not change.
+ * The translation does change. */
+ float expect[4][4] = {
+ {1.000f, 0.000f, 0.000f, 0.000f},
+ {0.000f, 0.000f, -1.000f, 0.000f},
+ {0.000f, 1.000f, 0.000f, 0.000f},
+ {-0.000f, 0.000f, -0.100f, 1.000f},
+ };
+
+ EXPECT_M4_NEAR(expect, result, 1e-5f);
+}
+
+} // namespace alembic
+} // namespace io
+} // namespace blender
diff --git a/source/blender/io/avi/AVI_avi.h b/source/blender/io/avi/AVI_avi.h
index 4f3aa720da3..ba1ef9261a0 100644
--- a/source/blender/io/avi/AVI_avi.h
+++ b/source/blender/io/avi/AVI_avi.h
@@ -39,8 +39,7 @@
* code. So we keep it like this.
*/
-#ifndef __AVI_AVI_H__
-#define __AVI_AVI_H__
+#pragma once
#include "BLI_sys_types.h"
#include <stdio.h> /* for FILE */
@@ -295,5 +294,3 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...);
* Unused but still external
*/
AviError AVI_print_error(AviError error);
-
-#endif /* __AVI_AVI_H__ */
diff --git a/source/blender/io/avi/intern/avi.c b/source/blender/io/avi/intern/avi.c
index e829a15deba..0ab51b7a084 100644
--- a/source/blender/io/avi/intern/avi.c
+++ b/source/blender/io/avi/intern/avi.c
@@ -116,9 +116,8 @@ int AVI_get_stream(AviMovie *movie, int avist_type, int stream_num)
if (stream_num == 0) {
return cur_stream;
}
- else {
- stream_num--;
- }
+
+ stream_num--;
}
}
@@ -572,9 +571,8 @@ AviError AVI_open_movie(const char *name, AviMovie *movie)
if (GET_FCC(movie->fp) == FCC("movi")) {
break;
}
- else {
- BLI_fseek(movie->fp, size - 4, SEEK_CUR);
- }
+
+ BLI_fseek(movie->fp, size - 4, SEEK_CUR);
}
else {
BLI_fseek(movie->fp, size, SEEK_CUR);
diff --git a/source/blender/io/avi/intern/avi_endian.h b/source/blender/io/avi/intern/avi_endian.h
index d1253f488e7..88c13d17950 100644
--- a/source/blender/io/avi/intern/avi_endian.h
+++ b/source/blender/io/avi/intern/avi_endian.h
@@ -23,8 +23,7 @@
* This is external code.
*/
-#ifndef __AVI_ENDIAN_H__
-#define __AVI_ENDIAN_H__
+#pragma once
#define AVI_RAW 0
#define AVI_CHUNK 1
@@ -36,5 +35,3 @@
#define AVI_MJPEGU 7
void awrite(AviMovie *movie, void *datain, int block, int size, FILE *fp, int type);
-
-#endif /* __AVI_ENDIAN_H__ */
diff --git a/source/blender/io/avi/intern/avi_intern.h b/source/blender/io/avi/intern/avi_intern.h
index 6ce91ce7f70..28ab999f6e3 100644
--- a/source/blender/io/avi/intern/avi_intern.h
+++ b/source/blender/io/avi/intern/avi_intern.h
@@ -21,8 +21,7 @@
* \ingroup avi
*/
-#ifndef __AVI_INTERN_H__
-#define __AVI_INTERN_H__
+#pragma once
#include <stdio.h> /* for FILE */
@@ -61,5 +60,3 @@ int avi_get_data_id(AviFormat format, int stream);
int avi_get_format_type(AviFormat format);
int avi_get_format_fcc(AviFormat format);
int avi_get_format_compression(AviFormat format);
-
-#endif
diff --git a/source/blender/io/avi/intern/avi_mjpeg.h b/source/blender/io/avi/intern/avi_mjpeg.h
index 13153fa41f0..3ee1b611f70 100644
--- a/source/blender/io/avi/intern/avi_mjpeg.h
+++ b/source/blender/io/avi/intern/avi_mjpeg.h
@@ -21,13 +21,10 @@
* \ingroup avi
*/
-#ifndef __AVI_MJPEG_H__
-#define __AVI_MJPEG_H__
+#pragma once
void *avi_converter_from_mjpeg(AviMovie *movie,
int stream,
unsigned char *buffer,
const size_t *size);
void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, size_t *size);
-
-#endif /* __AVI_MJPEG_H__ */
diff --git a/source/blender/io/avi/intern/avi_rgb.c b/source/blender/io/avi/intern/avi_rgb.c
index 44542af96ae..8af728f0737 100644
--- a/source/blender/io/avi/intern/avi_rgb.c
+++ b/source/blender/io/avi/intern/avi_rgb.c
@@ -96,35 +96,34 @@ void *avi_converter_from_avi_rgb(AviMovie *movie,
return buf;
}
- else {
- buf = imb_alloc_pixels(
- movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf");
-
- if (buf) {
- size_t rowstride = movie->header->Width * 3;
- BLI_assert(bits != 16);
- if (movie->header->Width % 2) {
- rowstride++;
- }
- for (size_t y = 0; y < movie->header->Height; y++) {
- memcpy(&buf[y * movie->header->Width * 3],
- &buffer[((movie->header->Height - 1) - y) * rowstride],
- movie->header->Width * 3);
- }
+ buf = imb_alloc_pixels(
+ movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf");
- for (size_t y = 0; y < (size_t)movie->header->Height * (size_t)movie->header->Width * 3;
- y += 3) {
- int i = buf[y];
- buf[y] = buf[y + 2];
- buf[y + 2] = i;
- }
+ if (buf) {
+ size_t rowstride = movie->header->Width * 3;
+ BLI_assert(bits != 16);
+ if (movie->header->Width % 2) {
+ rowstride++;
}
- MEM_freeN(buffer);
+ for (size_t y = 0; y < movie->header->Height; y++) {
+ memcpy(&buf[y * movie->header->Width * 3],
+ &buffer[((movie->header->Height - 1) - y) * rowstride],
+ movie->header->Width * 3);
+ }
- return buf;
+ for (size_t y = 0; y < (size_t)movie->header->Height * (size_t)movie->header->Width * 3;
+ y += 3) {
+ int i = buf[y];
+ buf[y] = buf[y + 2];
+ buf[y + 2] = i;
+ }
}
+
+ MEM_freeN(buffer);
+
+ return buf;
}
void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size)
diff --git a/source/blender/io/avi/intern/avi_rgb.h b/source/blender/io/avi/intern/avi_rgb.h
index 3a37fad94e1..aac8a2dffbf 100644
--- a/source/blender/io/avi/intern/avi_rgb.h
+++ b/source/blender/io/avi/intern/avi_rgb.h
@@ -21,13 +21,10 @@
* \ingroup avi
*/
-#ifndef __AVI_RGB_H__
-#define __AVI_RGB_H__
+#pragma once
void *avi_converter_from_avi_rgb(AviMovie *movie,
int stream,
unsigned char *buffer,
const size_t *size);
void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size);
-
-#endif /* __AVI_RGB_H__ */
diff --git a/source/blender/io/avi/intern/avi_rgb32.h b/source/blender/io/avi/intern/avi_rgb32.h
index eb4b9ca4e21..675b1ced41e 100644
--- a/source/blender/io/avi/intern/avi_rgb32.h
+++ b/source/blender/io/avi/intern/avi_rgb32.h
@@ -21,10 +21,7 @@
* \ingroup avi
*/
-#ifndef __AVI_RGB32_H__
-#define __AVI_RGB32_H__
+#pragma once
void *avi_converter_from_rgb32(AviMovie *movie, int stream, unsigned char *buffer, size_t *size);
void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, size_t *size);
-
-#endif /* __AVI_RGB32_H__ */
diff --git a/source/blender/io/collada/AnimationClipExporter.h b/source/blender/io/collada/AnimationClipExporter.h
index 9d782eac094..a19fcb4d372 100644
--- a/source/blender/io/collada/AnimationClipExporter.h
+++ b/source/blender/io/collada/AnimationClipExporter.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __ANIMATIONCLIPEXPORTER_H__
-#define __ANIMATIONCLIPEXPORTER_H__
+#pragma once
#include <math.h>
#include <stdio.h>
@@ -49,5 +48,3 @@ class AnimationClipExporter : COLLADASW::LibraryAnimationClips {
void exportAnimationClips(Scene *sce);
};
-
-#endif /* __ANIMATIONCLIPEXPORTER_H__ */
diff --git a/source/blender/io/collada/AnimationExporter.cpp b/source/blender/io/collada/AnimationExporter.cpp
index c25b4ea543b..a4302a680a3 100644
--- a/source/blender/io/collada/AnimationExporter.cpp
+++ b/source/blender/io/collada/AnimationExporter.cpp
@@ -230,7 +230,7 @@ void AnimationExporter::export_matrix_animation(Object *ob, BCAnimationSampler &
std::string name = encode_xml(id_name(ob));
std::string action_name = (action == NULL) ? name + "-action" : id_name(action);
std::string channel_type = "transform";
- std::string axis = "";
+ std::string axis;
std::string id = bc_get_action_id(action_name, name, channel_type, axis);
std::string target = translate_id(name) + '/' + channel_type;
@@ -395,15 +395,15 @@ bool AnimationExporter::is_bone_deform_group(Bone *bone)
return true;
}
/* Check child bones */
- else {
- for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
- /* loop through all the children until deform bone is found, and then return */
- is_def = is_bone_deform_group(child);
- if (is_def) {
- return true;
- }
+
+ for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
+ /* loop through all the children until deform bone is found, and then return */
+ is_def = is_bone_deform_group(child);
+ if (is_def) {
+ return true;
}
}
+
/* no deform bone found in children also */
return false;
}
@@ -840,12 +840,11 @@ std::string AnimationExporter::get_collada_sid(const BCAnimationCurve &curve,
if (is_angle) {
return tm_name + std::string(axis_name) + ".ANGLE";
}
- else if (!axis_name.empty()) {
+ if (!axis_name.empty()) {
return tm_name + "." + std::string(axis_name);
}
- else {
- return tm_name;
- }
+
+ return tm_name;
}
return tm_name;
diff --git a/source/blender/io/collada/AnimationExporter.h b/source/blender/io/collada/AnimationExporter.h
index b4564eb7b2d..48279b0c867 100644
--- a/source/blender/io/collada/AnimationExporter.h
+++ b/source/blender/io/collada/AnimationExporter.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __ANIMATIONEXPORTER_H__
-#define __ANIMATIONEXPORTER_H__
+#pragma once
#include <math.h>
#include <stdio.h>
@@ -258,5 +257,3 @@ class AnimationExporter : COLLADASW::LibraryAnimations {
void export_morph_animation(Object *ob, BCAnimationSampler &sampler);
#endif
};
-
-#endif /* __ANIMATIONEXPORTER_H__ */
diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp
index b53aa95a11f..1dada68293e 100644
--- a/source/blender/io/collada/AnimationImporter.cpp
+++ b/source/blender/io/collada/AnimationImporter.cpp
@@ -717,37 +717,36 @@ void AnimationImporter::Assign_float_animations(const COLLADAFW::UniqueId &listi
if (animlist_map.find(listid) == animlist_map.end()) {
return;
}
- else {
- /* anim_type has animations */
- const COLLADAFW::AnimationList *animlist = animlist_map[listid];
- const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings();
- /* all the curves belonging to the current binding */
- std::vector<FCurve *> animcurves;
- for (unsigned int j = 0; j < bindings.getCount(); j++) {
- animcurves = curve_map[bindings[j].animation];
-
- BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
- modify_fcurve(&animcurves, rna_path, 0);
- std::vector<FCurve *>::iterator iter;
- /* Add the curves of the current animation to the object */
- for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
- FCurve *fcu = *iter;
- /* All anim_types whose values are to be converted from Degree to Radians can be ORed here
+
+ /* anim_type has animations */
+ const COLLADAFW::AnimationList *animlist = animlist_map[listid];
+ const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings();
+ /* all the curves belonging to the current binding */
+ std::vector<FCurve *> animcurves;
+ for (unsigned int j = 0; j < bindings.getCount(); j++) {
+ animcurves = curve_map[bindings[j].animation];
+
+ BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
+ modify_fcurve(&animcurves, rna_path, 0);
+ std::vector<FCurve *>::iterator iter;
+ /* Add the curves of the current animation to the object */
+ for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
+ FCurve *fcu = *iter;
+ /* All anim_types whose values are to be converted from Degree to Radians can be ORed here
+ */
+ if (STREQ("spot_size", anim_type)) {
+ /* NOTE: Do NOT convert if imported file was made by blender <= 2.69.10
+ * Reason: old blender versions stored spot_size in radians (was a bug)
*/
- if (STREQ("spot_size", anim_type)) {
- /* NOTE: Do NOT convert if imported file was made by blender <= 2.69.10
- * Reason: old blender versions stored spot_size in radians (was a bug)
- */
- if (this->import_from_version.empty() ||
- BLI_strcasecmp_natural(this->import_from_version.c_str(), "2.69.10") != -1) {
- fcurve_deg_to_rad(fcu);
- }
+ if (this->import_from_version.empty() ||
+ BLI_strcasecmp_natural(this->import_from_version.c_str(), "2.69.10") != -1) {
+ fcurve_deg_to_rad(fcu);
}
- /** XXX What About animtype "rotation" ? */
-
- BLI_addtail(AnimCurves, fcu);
- fcurve_is_used(fcu);
}
+ /** XXX What About animtype "rotation" ? */
+
+ BLI_addtail(AnimCurves, fcu);
+ fcurve_is_used(fcu);
}
}
}
@@ -780,35 +779,34 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId &listid
if (animlist_map.find(listid) == animlist_map.end()) {
return;
}
- else {
- /* anim_type has animations */
- const COLLADAFW::AnimationList *animlist = animlist_map[listid];
- const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings();
- /* all the curves belonging to the current binding */
- std::vector<FCurve *> animcurves;
- for (unsigned int j = 0; j < bindings.getCount(); j++) {
- animcurves = curve_map[bindings[j].animation];
- BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
+ /* anim_type has animations */
+ const COLLADAFW::AnimationList *animlist = animlist_map[listid];
+ const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings();
+ /* all the curves belonging to the current binding */
+ std::vector<FCurve *> animcurves;
+ for (unsigned int j = 0; j < bindings.getCount(); j++) {
+ animcurves = curve_map[bindings[j].animation];
- modify_fcurve(&animcurves, rna_path, 0);
- std::vector<FCurve *>::iterator iter;
- /* Add the curves of the current animation to the object */
- for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
- FCurve *fcu = *iter;
+ BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
- for (unsigned int i = 0; i < fcu->totvert; i++) {
- fcu->bezt[i].vec[0][1] = convert_to_focal_length(
- fcu->bezt[i].vec[0][1], fov_type, aspect, cam->sensor_x);
- fcu->bezt[i].vec[1][1] = convert_to_focal_length(
- fcu->bezt[i].vec[1][1], fov_type, aspect, cam->sensor_x);
- fcu->bezt[i].vec[2][1] = convert_to_focal_length(
- fcu->bezt[i].vec[2][1], fov_type, aspect, cam->sensor_x);
- }
+ modify_fcurve(&animcurves, rna_path, 0);
+ std::vector<FCurve *>::iterator iter;
+ /* Add the curves of the current animation to the object */
+ for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
+ FCurve *fcu = *iter;
- BLI_addtail(AnimCurves, fcu);
- fcurve_is_used(fcu);
+ for (unsigned int i = 0; i < fcu->totvert; i++) {
+ fcu->bezt[i].vec[0][1] = convert_to_focal_length(
+ fcu->bezt[i].vec[0][1], fov_type, aspect, cam->sensor_x);
+ fcu->bezt[i].vec[1][1] = convert_to_focal_length(
+ fcu->bezt[i].vec[1][1], fov_type, aspect, cam->sensor_x);
+ fcu->bezt[i].vec[2][1] = convert_to_focal_length(
+ fcu->bezt[i].vec[2][1], fov_type, aspect, cam->sensor_x);
}
+
+ BLI_addtail(AnimCurves, fcu);
+ fcurve_is_used(fcu);
}
}
}
@@ -1077,35 +1075,34 @@ void AnimationImporter::translate_Animations(
if (animlist_map.find(listid) == animlist_map.end()) {
continue;
}
- else {
- /* transformation has animations */
- const COLLADAFW::AnimationList *animlist = animlist_map[listid];
- const COLLADAFW::AnimationList::AnimationBindings &bindings =
- animlist->getAnimationBindings();
- /* all the curves belonging to the current binding */
- std::vector<FCurve *> animcurves;
- for (unsigned int j = 0; j < bindings.getCount(); j++) {
- animcurves = curve_map[bindings[j].animation];
- if (is_matrix) {
- apply_matrix_curves(ob, animcurves, root, node, transform);
- }
- else {
- /* calculate rnapaths and array index of fcurves according to transformation and
- * animation class */
- Assign_transform_animations(
- transform, &bindings[j], &animcurves, is_joint, joint_path);
-
- std::vector<FCurve *>::iterator iter;
- /* Add the curves of the current animation to the object */
- for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
- FCurve *fcu = *iter;
-
- BLI_addtail(AnimCurves, fcu);
- fcurve_is_used(fcu);
- }
+
+ /* transformation has animations */
+ const COLLADAFW::AnimationList *animlist = animlist_map[listid];
+ const COLLADAFW::AnimationList::AnimationBindings &bindings =
+ animlist->getAnimationBindings();
+ /* all the curves belonging to the current binding */
+ std::vector<FCurve *> animcurves;
+ for (unsigned int j = 0; j < bindings.getCount(); j++) {
+ animcurves = curve_map[bindings[j].animation];
+ if (is_matrix) {
+ apply_matrix_curves(ob, animcurves, root, node, transform);
+ }
+ else {
+ /* calculate rnapaths and array index of fcurves according to transformation and
+ * animation class */
+ Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path);
+
+ std::vector<FCurve *>::iterator iter;
+ /* Add the curves of the current animation to the object */
+ for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
+ FCurve *fcu = *iter;
+
+ BLI_addtail(AnimCurves, fcu);
+ fcurve_is_used(fcu);
}
}
}
+
if (is_rotation && !(is_joint || is_matrix)) {
ob->rotmode = ROT_MODE_EUL;
}
@@ -1423,10 +1420,9 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type(
if (animlist_map.find(listid) == animlist_map.end()) {
continue;
}
- else {
- types->transform = types->transform | BC_NODE_TRANSFORM;
- break;
- }
+
+ types->transform = types->transform | BC_NODE_TRANSFORM;
+ break;
}
const COLLADAFW::InstanceLightPointerArray &nodeLights = node->getInstanceLights();
@@ -1995,7 +1991,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm,
return true;
}
- else if (is_scale || is_translate) {
+ if (is_scale || is_translate) {
bool is_xyz = animclass == COLLADAFW::AnimationList::POSITION_XYZ;
if ((!is_xyz && curves.size() != 1) || (is_xyz && curves.size() != 3)) {
diff --git a/source/blender/io/collada/AnimationImporter.h b/source/blender/io/collada/AnimationImporter.h
index 51041c6ee3e..5c6f9400286 100644
--- a/source/blender/io/collada/AnimationImporter.h
+++ b/source/blender/io/collada/AnimationImporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __ANIMATIONIMPORTER_H__
-#define __ANIMATIONIMPORTER_H__
+#pragma once
#include <map>
#include <vector>
@@ -250,5 +249,3 @@ class AnimationImporter : private TransformReader, public AnimationImporterBase
void extra_data_importer(std::string elementName);
};
-
-#endif
diff --git a/source/blender/io/collada/ArmatureExporter.h b/source/blender/io/collada/ArmatureExporter.h
index 3bc9dfe2639..193dc9cde3a 100644
--- a/source/blender/io/collada/ArmatureExporter.h
+++ b/source/blender/io/collada/ArmatureExporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __ARMATUREEXPORTER_H__
-#define __ARMATUREEXPORTER_H__
+#pragma once
#include <list>
#include <string>
@@ -103,5 +102,3 @@ class ArmatureExporter : public COLLADASW::LibraryControllers,
void write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone);
};
-
-#endif
diff --git a/source/blender/io/collada/ArmatureImporter.h b/source/blender/io/collada/ArmatureImporter.h
index 7393b882f4b..a1c4a25b80f 100644
--- a/source/blender/io/collada/ArmatureImporter.h
+++ b/source/blender/io/collada/ArmatureImporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __ARMATUREIMPORTER_H__
-#define __ARMATUREIMPORTER_H__
+#pragma once
#include "COLLADAFWMorphController.h"
#include "COLLADAFWNode.h"
@@ -181,5 +180,3 @@ class ArmatureImporter : private TransformReader {
void set_tags_map(TagsMap &tags_map);
};
-
-#endif
diff --git a/source/blender/io/collada/BCAnimationCurve.cpp b/source/blender/io/collada/BCAnimationCurve.cpp
index 61dded368b5..5fdbb65fb6e 100644
--- a/source/blender/io/collada/BCAnimationCurve.cpp
+++ b/source/blender/io/collada/BCAnimationCurve.cpp
@@ -559,9 +559,8 @@ inline bool operator<(const BCAnimationCurve &lhs, const BCAnimationCurve &rhs)
const int rha = rhs.get_channel_index();
return lha < rha;
}
- else {
- return lhtgt < rhtgt;
- }
+
+ return lhtgt < rhtgt;
}
BCCurveKey::BCCurveKey()
diff --git a/source/blender/io/collada/BCAnimationCurve.h b/source/blender/io/collada/BCAnimationCurve.h
index e0216ee6849..779678bca1d 100644
--- a/source/blender/io/collada/BCAnimationCurve.h
+++ b/source/blender/io/collada/BCAnimationCurve.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BCANIMATIONCURVE_H__
-#define __BCANIMATIONCURVE_H__
+#pragma once
#include "BCSampleData.h"
#include "collada_utils.h"
@@ -147,5 +146,3 @@ class BCAnimationCurve {
};
typedef std::map<BCCurveKey, BCAnimationCurve *> BCAnimationCurveMap;
-
-#endif /* __BCANIMATIONCURVE_H__ */
diff --git a/source/blender/io/collada/BCAnimationSampler.cpp b/source/blender/io/collada/BCAnimationSampler.cpp
index f44e3e8385d..6f363aa76c2 100644
--- a/source/blender/io/collada/BCAnimationSampler.cpp
+++ b/source/blender/io/collada/BCAnimationSampler.cpp
@@ -558,7 +558,7 @@ const bool BCSampleFrame::has_sample_for(Object *ob) const
const bool BCSampleFrame::has_sample_for(Object *ob, Bone *bone) const
{
const BCMatrix *bc_bone = get_sample_matrix(ob, bone);
- return (bc_bone);
+ return bc_bone;
}
/* ==================================================================== */
diff --git a/source/blender/io/collada/BCAnimationSampler.h b/source/blender/io/collada/BCAnimationSampler.h
index 3273ac8e0a0..5ab4be3722c 100644
--- a/source/blender/io/collada/BCAnimationSampler.h
+++ b/source/blender/io/collada/BCAnimationSampler.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __BCANIMATIONSAMPLER_H__
-#define __BCANIMATIONSAMPLER_H__
+#pragma once
#include "BCAnimationCurve.h"
#include "BCSampleData.h"
@@ -190,5 +189,3 @@ class BCAnimationSampler {
ListBase *conlist,
std::set<Object *> &animated_objects);
};
-
-#endif /* __BCANIMATIONSAMPLER_H__ */
diff --git a/source/blender/io/collada/BCMath.h b/source/blender/io/collada/BCMath.h
index 38158751740..79a0ea941cd 100644
--- a/source/blender/io/collada/BCMath.h
+++ b/source/blender/io/collada/BCMath.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __BCMATH_H__
-#define __BCMATH_H__
+#pragma once
#include "BlenderTypes.h"
@@ -105,5 +104,3 @@ class BCMatrix {
static void sanitize(DMatrix &matrix, int precision);
static void transpose(Matrix &matrix);
};
-
-#endif /* __BCMATH_H__ */
diff --git a/source/blender/io/collada/BCSampleData.h b/source/blender/io/collada/BCSampleData.h
index 6f3ca9135b3..39e34355b72 100644
--- a/source/blender/io/collada/BCSampleData.h
+++ b/source/blender/io/collada/BCSampleData.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __BCSAMPLEDATA_H__
-#define __BCSAMPLEDATA_H__
+#pragma once
#include <algorithm>
#include <map>
@@ -62,5 +61,3 @@ class BCSample {
typedef std::map<Object *, BCSample *> BCSampleMap;
typedef std::map<int, const BCSample *> BCFrameSampleMap;
typedef std::map<int, const BCMatrix *> BCMatrixSampleMap;
-
-#endif /* __BCSAMPLEDATA_H__ */
diff --git a/source/blender/io/collada/BlenderContext.h b/source/blender/io/collada/BlenderContext.h
index bf6fde134fa..9163b30c86f 100644
--- a/source/blender/io/collada/BlenderContext.h
+++ b/source/blender/io/collada/BlenderContext.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __BLENDERCONTEXT_H__
-#define __BLENDERCONTEXT_H__
+#pragma once
#include "BKE_context.h"
#include "BKE_main.h"
@@ -68,5 +67,3 @@ class BlenderContext {
Main *get_main();
};
#endif
-
-#endif
diff --git a/source/blender/io/collada/BlenderTypes.h b/source/blender/io/collada/BlenderTypes.h
index 0e024be2374..63b0471ef6f 100644
--- a/source/blender/io/collada/BlenderTypes.h
+++ b/source/blender/io/collada/BlenderTypes.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __BLENDERTYPES_H__
-#define __BLENDERTYPES_H__
+#pragma once
typedef float(Vector)[3];
typedef float(Quat)[4];
@@ -44,5 +43,3 @@ typedef enum BC_global_up_axis {
BC_GLOBAL_UP_MINUS_Y = 4,
BC_GLOBAL_UP_MINUS_Z = 5
} BC_global_up_axis;
-
-#endif
diff --git a/source/blender/io/collada/CameraExporter.h b/source/blender/io/collada/CameraExporter.h
index 0dda6392d03..cc4f7aee165 100644
--- a/source/blender/io/collada/CameraExporter.h
+++ b/source/blender/io/collada/CameraExporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __CAMERAEXPORTER_H__
-#define __CAMERAEXPORTER_H__
+#pragma once
#include "COLLADASWLibraryCameras.h"
#include "COLLADASWStreamWriter.h"
@@ -40,5 +39,3 @@ class CamerasExporter : COLLADASW::LibraryCameras {
bool exportBlenderProfile(COLLADASW::Camera &cla, Camera *cam);
BCExportSettings &export_settings;
};
-
-#endif
diff --git a/source/blender/io/collada/ControllerExporter.h b/source/blender/io/collada/ControllerExporter.h
index fb84af6ebc9..753538d8e98 100644
--- a/source/blender/io/collada/ControllerExporter.h
+++ b/source/blender/io/collada/ControllerExporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __CONTROLLEREXPORTER_H__
-#define __CONTROLLEREXPORTER_H__
+#pragma once
#include <list>
#include <string>
@@ -133,5 +132,3 @@ class ControllerExporter : public COLLADASW::LibraryControllers,
void write_bone_URLs(COLLADASW::InstanceController &ins, Object *ob_arm, Bone *bone);
};
-
-#endif
diff --git a/source/blender/io/collada/DocumentExporter.h b/source/blender/io/collada/DocumentExporter.h
index 1fe52420534..850eb4fbbb2 100644
--- a/source/blender/io/collada/DocumentExporter.h
+++ b/source/blender/io/collada/DocumentExporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __DOCUMENTEXPORTER_H__
-#define __DOCUMENTEXPORTER_H__
+#pragma once
#include "BlenderContext.h"
#include "collada.h"
@@ -38,5 +37,3 @@ class DocumentExporter {
BCExportSettings export_settings;
KeyImageMap key_image_map;
};
-
-#endif
diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp
index 0f84db79c28..83c8a805076 100644
--- a/source/blender/io/collada/DocumentImporter.cpp
+++ b/source/blender/io/collada/DocumentImporter.cpp
@@ -1254,9 +1254,6 @@ bool DocumentImporter::is_armature(COLLADAFW::Node *node)
if (child_nodes[i]->getType() == COLLADAFW::Node::JOINT) {
return true;
}
- else {
- continue;
- }
}
/* no child is JOINT */
diff --git a/source/blender/io/collada/DocumentImporter.h b/source/blender/io/collada/DocumentImporter.h
index d9be4880b35..e382a44c3c2 100644
--- a/source/blender/io/collada/DocumentImporter.h
+++ b/source/blender/io/collada/DocumentImporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __DOCUMENTIMPORTER_H__
-#define __DOCUMENTIMPORTER_H__
+#pragma once
#include "COLLADAFWColor.h"
#include "COLLADAFWController.h"
@@ -168,5 +167,3 @@ class DocumentImporter : COLLADAFW::IWriter {
void report_unknown_reference(const COLLADAFW::Node &node, const std::string object_type);
};
-
-#endif
diff --git a/source/blender/io/collada/EffectExporter.h b/source/blender/io/collada/EffectExporter.h
index 36d02bb1c8f..c844d93b040 100644
--- a/source/blender/io/collada/EffectExporter.h
+++ b/source/blender/io/collada/EffectExporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __EFFECTEXPORTER_H__
-#define __EFFECTEXPORTER_H__
+#pragma once
#include <string>
#include <vector>
@@ -85,5 +84,3 @@ class EffectsExporter : COLLADASW::LibraryEffects {
Scene *scene;
bContext *mContext;
};
-
-#endif
diff --git a/source/blender/io/collada/ErrorHandler.h b/source/blender/io/collada/ErrorHandler.h
index 0c082a3b9dd..60253a08cda 100644
--- a/source/blender/io/collada/ErrorHandler.h
+++ b/source/blender/io/collada/ErrorHandler.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __ERRORHANDLER_H__
-#define __ERRORHANDLER_H__
+#pragma once
#include <algorithm> // sort()
#include <map>
@@ -53,5 +52,3 @@ class ErrorHandler : public COLLADASaxFWL::IErrorHandler {
/** Hold error status. */
bool mError;
};
-
-#endif /* __ERRORHANDLER_H__ */
diff --git a/source/blender/io/collada/ExportSettings.h b/source/blender/io/collada/ExportSettings.h
index 477f0b8b678..2f647cefa8b 100644
--- a/source/blender/io/collada/ExportSettings.h
+++ b/source/blender/io/collada/ExportSettings.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __EXPORTSETTINGS_H__
-#define __EXPORTSETTINGS_H__
+#pragma once
#include "BLI_linklist.h"
#include "BlenderContext.h"
@@ -291,5 +290,3 @@ class BCExportSettings {
};
#endif
-
-#endif
diff --git a/source/blender/io/collada/ExtraHandler.h b/source/blender/io/collada/ExtraHandler.h
index 04ac963b530..8f98e1dec1b 100644
--- a/source/blender/io/collada/ExtraHandler.h
+++ b/source/blender/io/collada/ExtraHandler.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __EXTRAHANDLER_H__
-#define __EXTRAHANDLER_H__
+#pragma once
#include <algorithm> // sort()
#include <map>
@@ -79,5 +78,3 @@ class ExtraHandler : public COLLADASaxFWL::IExtraDataCallbackHandler {
ExtraTags *currentExtraTags;
std::string currentElement;
};
-
-#endif /* __EXTRAHANDLER_H__ */
diff --git a/source/blender/io/collada/ExtraTags.h b/source/blender/io/collada/ExtraTags.h
index c806b8fa904..a72cdeb32a8 100644
--- a/source/blender/io/collada/ExtraTags.h
+++ b/source/blender/io/collada/ExtraTags.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __EXTRATAGS_H__
-#define __EXTRATAGS_H__
+#pragma once
#include <map>
#include <string>
@@ -73,5 +72,3 @@ class ExtraTags {
/** Get text data for tag as a string. */
std::string asString(std::string tag, bool *ok);
};
-
-#endif /* __EXTRATAGS_H__ */
diff --git a/source/blender/io/collada/GeometryExporter.h b/source/blender/io/collada/GeometryExporter.h
index 5090158177f..d91f3d1ec5a 100644
--- a/source/blender/io/collada/GeometryExporter.h
+++ b/source/blender/io/collada/GeometryExporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __GEOMETRYEXPORTER_H__
-#define __GEOMETRYEXPORTER_H__
+#pragma once
#include <set>
#include <string>
@@ -136,5 +135,3 @@ struct GeometryFunctor {
}
}
};
-
-#endif
diff --git a/source/blender/io/collada/ImageExporter.h b/source/blender/io/collada/ImageExporter.h
index 20f9b95a512..e1fdcc12272 100644
--- a/source/blender/io/collada/ImageExporter.h
+++ b/source/blender/io/collada/ImageExporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __IMAGEEXPORTER_H__
-#define __IMAGEEXPORTER_H__
+#pragma once
#include <string>
#include <vector>
@@ -47,5 +46,3 @@ class ImagesExporter : COLLADASW::LibraryImages {
KeyImageMap &key_image_map;
void export_UV_Image(Image *image, bool use_texture_copies);
};
-
-#endif
diff --git a/source/blender/io/collada/ImportSettings.h b/source/blender/io/collada/ImportSettings.h
index 608d8bff882..e8a5bf8ce81 100644
--- a/source/blender/io/collada/ImportSettings.h
+++ b/source/blender/io/collada/ImportSettings.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __IMPORTSETTINGS_H__
-#define __IMPORTSETTINGS_H__
+#pragma once
typedef struct ImportSettings {
bool import_units;
@@ -30,5 +29,3 @@ typedef struct ImportSettings {
char *filepath;
bool keep_bind_info;
} ImportSettings;
-
-#endif
diff --git a/source/blender/io/collada/InstanceWriter.h b/source/blender/io/collada/InstanceWriter.h
index cfec1cf7006..c79d6691842 100644
--- a/source/blender/io/collada/InstanceWriter.h
+++ b/source/blender/io/collada/InstanceWriter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __INSTANCEWRITER_H__
-#define __INSTANCEWRITER_H__
+#pragma once
#include "COLLADASWBindMaterial.h"
@@ -31,5 +30,3 @@ class InstanceWriter {
Object *ob,
bool active_uv_only);
};
-
-#endif
diff --git a/source/blender/io/collada/LightExporter.h b/source/blender/io/collada/LightExporter.h
index a5c7f5c6dee..90256691c06 100644
--- a/source/blender/io/collada/LightExporter.h
+++ b/source/blender/io/collada/LightExporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __LIGHTEXPORTER_H__
-#define __LIGHTEXPORTER_H__
+#pragma once
#include "COLLADASWLibraryLights.h"
#include "COLLADASWStreamWriter.h"
@@ -40,5 +39,3 @@ class LightsExporter : COLLADASW::LibraryLights {
bool exportBlenderProfile(COLLADASW::Light &cla, Light *la);
BCExportSettings &export_settings;
};
-
-#endif
diff --git a/source/blender/io/collada/MaterialExporter.h b/source/blender/io/collada/MaterialExporter.h
index babb113567f..7d40347097c 100644
--- a/source/blender/io/collada/MaterialExporter.h
+++ b/source/blender/io/collada/MaterialExporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __MATERIALEXPORTER_H__
-#define __MATERIALEXPORTER_H__
+#pragma once
#include <string>
#include <vector>
@@ -93,5 +92,3 @@ struct MaterialFunctor {
gf.forEachMeshObjectInExportSet<ForEachMaterialFunctor<Functor>>(sce, matfunc, export_set);
}
};
-
-#endif
diff --git a/source/blender/io/collada/Materials.h b/source/blender/io/collada/Materials.h
index e1d12246a2b..f671a00758d 100644
--- a/source/blender/io/collada/Materials.h
+++ b/source/blender/io/collada/Materials.h
@@ -14,8 +14,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __MATERIALS_H__
-#define __MATERIALS_H__
+#pragma once
#include <map>
#include <string>
@@ -70,5 +69,3 @@ class MaterialNode {
COLLADAFW::ColorOrTexture &cot,
COLLADAFW::FloatOrParam &val);
};
-
-#endif /* __MATERIALS_H__ */
diff --git a/source/blender/io/collada/MeshImporter.h b/source/blender/io/collada/MeshImporter.h
index 18e56e8f9df..a63cb0da987 100644
--- a/source/blender/io/collada/MeshImporter.h
+++ b/source/blender/io/collada/MeshImporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __MESHIMPORTER_H__
-#define __MESHIMPORTER_H__
+#pragma once
#include <map>
#include <vector>
@@ -177,5 +176,3 @@ class MeshImporter : public MeshImporterBase {
bool write_geometry(const COLLADAFW::Geometry *geom);
std::string *get_geometry_name(const std::string &mesh_name);
};
-
-#endif
diff --git a/source/blender/io/collada/SceneExporter.h b/source/blender/io/collada/SceneExporter.h
index 3ea6a9fac8e..5b8ec37152f 100644
--- a/source/blender/io/collada/SceneExporter.h
+++ b/source/blender/io/collada/SceneExporter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __SCENEEXPORTER_H__
-#define __SCENEEXPORTER_H__
+#pragma once
#include <math.h>
#include <stdio.h>
@@ -110,5 +109,3 @@ class SceneExporter : COLLADASW::LibraryVisualScenes,
void writeNodeList(std::vector<Object *> &child_objects, Object *parent);
void writeNode(Object *ob);
};
-
-#endif
diff --git a/source/blender/io/collada/SkinInfo.h b/source/blender/io/collada/SkinInfo.h
index e8b13f86e9c..3b94e403b6d 100644
--- a/source/blender/io/collada/SkinInfo.h
+++ b/source/blender/io/collada/SkinInfo.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __SKININFO_H__
-#define __SKININFO_H__
+#pragma once
#include <map>
#include <vector>
@@ -126,5 +125,3 @@ class SkinInfo {
bool find_node_in_tree(COLLADAFW::Node *node, COLLADAFW::Node *tree_root);
};
-
-#endif
diff --git a/source/blender/io/collada/TransformReader.h b/source/blender/io/collada/TransformReader.h
index 5a778e6aba5..f8a73ce3912 100644
--- a/source/blender/io/collada/TransformReader.h
+++ b/source/blender/io/collada/TransformReader.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __TRANSFORMREADER_H__
-#define __TRANSFORMREADER_H__
+#pragma once
#include "COLLADAFWMatrix.h"
#include "COLLADAFWNode.h"
@@ -68,5 +67,3 @@ class TransformReader {
void dae_scale_to_v3(COLLADAFW::Transformation *tm, float v[3]);
void dae_vector3_to_v3(const COLLADABU::Math::Vector3 &v3, float v[3]);
};
-
-#endif
diff --git a/source/blender/io/collada/TransformWriter.h b/source/blender/io/collada/TransformWriter.h
index db8ef3f5ee2..200f641b064 100644
--- a/source/blender/io/collada/TransformWriter.h
+++ b/source/blender/io/collada/TransformWriter.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __TRANSFORMWRITER_H__
-#define __TRANSFORMWRITER_H__
+#pragma once
#include "COLLADASWNode.h"
@@ -47,5 +46,3 @@ class TransformWriter {
const float rot[3],
const float scale[3]);
};
-
-#endif
diff --git a/source/blender/io/collada/collada.h b/source/blender/io/collada/collada.h
index d8e498ef4b2..2668be6153b 100644
--- a/source/blender/io/collada/collada.h
+++ b/source/blender/io/collada/collada.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __COLLADA_H__
-#define __COLLADA_H__
+#pragma once
#include <stdlib.h>
@@ -46,5 +45,3 @@ int collada_export(struct bContext *C, ExportSettings *export_settings);
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/source/blender/io/collada/collada_internal.cpp b/source/blender/io/collada/collada_internal.cpp
index f123e8ea31f..b3fa9ba1251 100644
--- a/source/blender/io/collada/collada_internal.cpp
+++ b/source/blender/io/collada/collada_internal.cpp
@@ -277,7 +277,7 @@ std::string encode_xml(std::string xml)
{'<', "&lt;"}, {'>', "&gt;"}, {'"', "&quot;"}, {'\'', "&apos;"}, {'&', "&amp;"}};
std::map<char, std::string>::const_iterator it;
- std::string encoded_xml = "";
+ std::string encoded_xml;
for (unsigned int i = 0; i < xml.size(); i++) {
char c = xml.at(i);
diff --git a/source/blender/io/collada/collada_internal.h b/source/blender/io/collada/collada_internal.h
index d9fe0ba0b58..de4e1d7e0d4 100644
--- a/source/blender/io/collada/collada_internal.h
+++ b/source/blender/io/collada/collada_internal.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __COLLADA_INTERNAL_H__
-#define __COLLADA_INTERNAL_H__
+#pragma once
#include <map>
#include <string>
@@ -94,5 +93,3 @@ extern std::string get_morph_id(Object *ob);
extern std::string get_effect_id(Material *mat);
extern std::string get_material_id(Material *mat);
-
-#endif /* __COLLADA_INTERNAL_H__ */
diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp
index 2c54a49198a..2493b3a386b 100644
--- a/source/blender/io/collada/collada_utils.cpp
+++ b/source/blender/io/collada/collada_utils.cpp
@@ -88,9 +88,8 @@ float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray &array, unsigned in
if (array.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT) {
return array.getFloatValues()->getData()[index];
}
- else {
- return array.getDoubleValues()->getData()[index];
- }
+
+ return array.getDoubleValues()->getData()[index];
}
/* copied from /editors/object/object_relations.c */
@@ -330,9 +329,8 @@ bool bc_is_root_bone(Bone *aBone, bool deform_bones_only)
}
return (aBone == root);
}
- else {
- return !(aBone->parent);
- }
+
+ return !(aBone->parent);
}
int bc_get_active_UVLayer(Object *ob)
@@ -672,8 +670,7 @@ void BoneExtended::set_bone_layers(std::string layerString, std::vector<std::str
std::string BoneExtended::get_bone_layers(int bitfield)
{
- std::string result = "";
- std::string sep = "";
+ std::string sep;
int bit = 1u;
std::ostringstream ss;
@@ -1323,9 +1320,8 @@ COLLADASW::ColorOrTexture bc_get_base_color(Material *ma)
if (ma->use_nodes && shader) {
return bc_get_cot_from_shader(shader, "Base Color", default_color, false);
}
- else {
- return bc_get_cot(default_color);
- }
+
+ return bc_get_cot(default_color);
}
COLLADASW::ColorOrTexture bc_get_emission(Material *ma)
@@ -1335,9 +1331,8 @@ COLLADASW::ColorOrTexture bc_get_emission(Material *ma)
if (ma->use_nodes && shader) {
return bc_get_cot_from_shader(shader, "Emission", default_color);
}
- else {
- return bc_get_cot(default_color); /* default black */
- }
+
+ return bc_get_cot(default_color); /* default black */
}
COLLADASW::ColorOrTexture bc_get_ambient(Material *ma)
@@ -1420,9 +1415,8 @@ COLLADASW::ColorOrTexture bc_get_cot_from_shader(bNode *shader,
float *col = dcol->value;
return bc_get_cot(col, with_alpha);
}
- else {
- return bc_get_cot(default_color, with_alpha);
- }
+
+ return bc_get_cot(default_color, with_alpha);
}
bNode *bc_get_master_shader(Material *ma)
diff --git a/source/blender/io/collada/collada_utils.h b/source/blender/io/collada/collada_utils.h
index 11a9376294b..38050556b47 100644
--- a/source/blender/io/collada/collada_utils.h
+++ b/source/blender/io/collada/collada_utils.h
@@ -18,8 +18,7 @@
* \ingroup collada
*/
-#ifndef __COLLADA_UTILS_H__
-#define __COLLADA_UTILS_H__
+#pragma once
#include "COLLADAFWColorOrTexture.h"
#include "COLLADAFWFloatOrDoubleArray.h"
@@ -155,7 +154,7 @@ inline std::string bc_string_after(const std::string &s, const std::string probe
if (i != std::string::npos) {
return (s.substr(i + probe.length(), s.length() - i));
}
- return (s);
+ return s;
}
inline std::string bc_string_before(const std::string &s, const std::string probe)
@@ -164,7 +163,7 @@ inline std::string bc_string_before(const std::string &s, const std::string prob
if (i != std::string::npos) {
return s.substr(0, i);
}
- return (s);
+ return s;
}
inline bool bc_startswith(std::string const &value, std::string const &starting)
@@ -393,5 +392,3 @@ COLLADASW::ColorOrTexture bc_get_cot_from_shader(bNode *shader,
COLLADASW::ColorOrTexture bc_get_cot(float r, float g, float b, float a);
COLLADASW::ColorOrTexture bc_get_cot(Color col, bool with_alpha = true);
-
-#endif
diff --git a/source/blender/io/common/CMakeLists.txt b/source/blender/io/common/CMakeLists.txt
index d3341767f8b..7e39af32f11 100644
--- a/source/blender/io/common/CMakeLists.txt
+++ b/source/blender/io/common/CMakeLists.txt
@@ -55,8 +55,11 @@ if(WITH_GTESTS)
intern/hierarchy_context_order_test.cc
intern/object_identifier_test.cc
)
+ set(TEST_INC
+ ../../blenloader
+ )
set(TEST_LIB
- bf_blenloader_test
+ bf_blenloader_tests
bf_io_common
)
include(GTestTesting)
diff --git a/source/blender/io/common/IO_abstract_hierarchy_iterator.h b/source/blender/io/common/IO_abstract_hierarchy_iterator.h
index d289d86b397..d0d9d72b880 100644
--- a/source/blender/io/common/IO_abstract_hierarchy_iterator.h
+++ b/source/blender/io/common/IO_abstract_hierarchy_iterator.h
@@ -33,8 +33,7 @@
* Selections like "selected only" or "no hair systems" are left to concrete subclasses.
*/
-#ifndef __ABSTRACT_HIERARCHY_ITERATOR_H__
-#define __ABSTRACT_HIERARCHY_ITERATOR_H__
+#pragma once
#include "IO_dupli_persistent_id.hh"
@@ -355,5 +354,3 @@ class AbstractHierarchyIterator {
} // namespace io
} // namespace blender
-
-#endif /* __ABSTRACT_HIERARCHY_ITERATOR_H__ */
diff --git a/source/blender/io/common/IO_dupli_persistent_id.hh b/source/blender/io/common/IO_dupli_persistent_id.hh
index 5dc54164684..6fabafd9d51 100644
--- a/source/blender/io/common/IO_dupli_persistent_id.hh
+++ b/source/blender/io/common/IO_dupli_persistent_id.hh
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2020 Blender Foundation.
* All rights reserved.
*/
-#ifndef __IO_COMMON_DUPLI_PERSISTENT_ID_H__
-#define __IO_COMMON_DUPLI_PERSISTENT_ID_H__
+#pragma once
#include "BKE_duplilist.h"
@@ -64,5 +63,3 @@ class PersistentID {
};
} // namespace blender::io
-
-#endif // __IO_COMMON_DUPLI_PARENT_FINDER_H__
diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
index 2bc7560e177..cbb2e63a99f 100644
--- a/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
+++ b/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
@@ -17,7 +17,8 @@
* All rights reserved.
*/
#include "IO_abstract_hierarchy_iterator.h"
-#include "blenloader/blendfile_loading_base_test.h"
+
+#include "tests/blendfile_loading_base_test.h"
#include "BLI_math.h"
#include "DEG_depsgraph.h"
diff --git a/source/blender/io/common/intern/dupli_parent_finder.hh b/source/blender/io/common/intern/dupli_parent_finder.hh
index e7e628665ee..3dcf037bb5e 100644
--- a/source/blender/io/common/intern/dupli_parent_finder.hh
+++ b/source/blender/io/common/intern/dupli_parent_finder.hh
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2020 Blender Foundation.
* All rights reserved.
*/
-#ifndef __IO_COMMON_DUPLI_PARENT_FINDER_H__
-#define __IO_COMMON_DUPLI_PARENT_FINDER_H__
+#pragma once
#include "IO_dupli_persistent_id.hh"
@@ -58,5 +57,3 @@ class DupliParentFinder final {
};
} // namespace blender::io
-
-#endif \ No newline at end of file
diff --git a/source/blender/io/usd/intern/usd_exporter_context.h b/source/blender/io/usd/intern/usd_exporter_context.h
index 07a9d0fc0c5..5513768b527 100644
--- a/source/blender/io/usd/intern/usd_exporter_context.h
+++ b/source/blender/io/usd/intern/usd_exporter_context.h
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-#ifndef __USD_EXPORTER_CONTEXT_H__
-#define __USD_EXPORTER_CONTEXT_H__
+#pragma once
#include "usd.h"
@@ -44,5 +43,3 @@ struct USDExporterContext {
} // namespace usd
} // namespace io
} // namespace blender
-
-#endif /* __USD_EXPORTER_CONTEXT_H__ */
diff --git a/source/blender/io/usd/intern/usd_hierarchy_iterator.h b/source/blender/io/usd/intern/usd_hierarchy_iterator.h
index 2836ff0b17f..03e80ce735a 100644
--- a/source/blender/io/usd/intern/usd_hierarchy_iterator.h
+++ b/source/blender/io/usd/intern/usd_hierarchy_iterator.h
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-#ifndef __USD_HIERARCHY_ITERATOR_H__
-#define __USD_HIERARCHY_ITERATOR_H__
+#pragma once
#include "IO_abstract_hierarchy_iterator.h"
#include "usd.h"
@@ -75,5 +74,3 @@ class USDHierarchyIterator : public AbstractHierarchyIterator {
} // namespace usd
} // namespace io
} // namespace blender
-
-#endif /* __USD_HIERARCHY_ITERATOR_H__ */
diff --git a/source/blender/io/usd/intern/usd_writer_abstract.h b/source/blender/io/usd/intern/usd_writer_abstract.h
index f81cf5197af..a689deaf0d8 100644
--- a/source/blender/io/usd/intern/usd_writer_abstract.h
+++ b/source/blender/io/usd/intern/usd_writer_abstract.h
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-#ifndef __USD_WRITER_ABSTRACT_H__
-#define __USD_WRITER_ABSTRACT_H__
+#pragma once
#include "IO_abstract_hierarchy_iterator.h"
#include "usd_exporter_context.h"
@@ -78,5 +77,3 @@ class USDAbstractWriter : public AbstractHierarchyWriter {
} // namespace usd
} // namespace io
} // namespace blender
-
-#endif /* __USD_WRITER_ABSTRACT_H__ */
diff --git a/source/blender/io/usd/intern/usd_writer_camera.h b/source/blender/io/usd/intern/usd_writer_camera.h
index 8b5795d7d9f..1c613d7879b 100644
--- a/source/blender/io/usd/intern/usd_writer_camera.h
+++ b/source/blender/io/usd/intern/usd_writer_camera.h
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-#ifndef __USD_WRITER_CAMERA_H__
-#define __USD_WRITER_CAMERA_H__
+#pragma once
#include "usd_writer_abstract.h"
@@ -38,5 +37,3 @@ class USDCameraWriter : public USDAbstractWriter {
} // namespace usd
} // namespace io
} // namespace blender
-
-#endif /* __USD_WRITER_CAMERA_H__ */
diff --git a/source/blender/io/usd/intern/usd_writer_hair.h b/source/blender/io/usd/intern/usd_writer_hair.h
index cecacd0a355..b9a28013875 100644
--- a/source/blender/io/usd/intern/usd_writer_hair.h
+++ b/source/blender/io/usd/intern/usd_writer_hair.h
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-#ifndef __USD_WRITER_HAIR_H__
-#define __USD_WRITER_HAIR_H__
+#pragma once
#include "usd_writer_abstract.h"
@@ -38,5 +37,3 @@ class USDHairWriter : public USDAbstractWriter {
} // namespace usd
} // namespace io
} // namespace blender
-
-#endif /* __USD_WRITER_HAIR_H__ */
diff --git a/source/blender/io/usd/intern/usd_writer_light.h b/source/blender/io/usd/intern/usd_writer_light.h
index 73666622af1..082050ad071 100644
--- a/source/blender/io/usd/intern/usd_writer_light.h
+++ b/source/blender/io/usd/intern/usd_writer_light.h
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-#ifndef __USD_WRITER_LIGHT_H__
-#define __USD_WRITER_LIGHT_H__
+#pragma once
#include "usd_writer_abstract.h"
@@ -37,5 +36,3 @@ class USDLightWriter : public USDAbstractWriter {
} // namespace usd
} // namespace io
} // namespace blender
-
-#endif /* __USD_WRITER_LIGHT_H__ */
diff --git a/source/blender/io/usd/intern/usd_writer_mesh.h b/source/blender/io/usd/intern/usd_writer_mesh.h
index a14ceecfa53..078daa05501 100644
--- a/source/blender/io/usd/intern/usd_writer_mesh.h
+++ b/source/blender/io/usd/intern/usd_writer_mesh.h
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-#ifndef __USD_WRITER_MESH_H__
-#define __USD_WRITER_MESH_H__
+#pragma once
#include "usd_writer_abstract.h"
@@ -66,5 +65,3 @@ class USDMeshWriter : public USDGenericMeshWriter {
} // namespace usd
} // namespace io
} // namespace blender
-
-#endif /* __USD_WRITER_MESH_H__ */
diff --git a/source/blender/io/usd/intern/usd_writer_metaball.h b/source/blender/io/usd/intern/usd_writer_metaball.h
index 9f51a3314a5..216f5a2638f 100644
--- a/source/blender/io/usd/intern/usd_writer_metaball.h
+++ b/source/blender/io/usd/intern/usd_writer_metaball.h
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2020 Blender Foundation.
* All rights reserved.
*/
-#ifndef __USD_WRITER_METABALL_H__
-#define __USD_WRITER_METABALL_H__
+#pragma once
#include "usd_writer_mesh.h"
@@ -42,5 +41,3 @@ class USDMetaballWriter : public USDGenericMeshWriter {
} // namespace usd
} // namespace io
} // namespace blender
-
-#endif /* __USD_WRITER_METABALL_H__ */
diff --git a/source/blender/io/usd/intern/usd_writer_transform.h b/source/blender/io/usd/intern/usd_writer_transform.h
index 8b4741f1177..39a1f20e7e8 100644
--- a/source/blender/io/usd/intern/usd_writer_transform.h
+++ b/source/blender/io/usd/intern/usd_writer_transform.h
@@ -16,8 +16,7 @@
* The Original Code is Copyright (C) 2019 Blender Foundation.
* All rights reserved.
*/
-#ifndef __USD_WRITER_TRANSFORM_H__
-#define __USD_WRITER_TRANSFORM_H__
+#pragma once
#include "usd_writer_abstract.h"
@@ -42,5 +41,3 @@ class USDTransformWriter : public USDAbstractWriter {
} // namespace usd
} // namespace io
} // namespace blender
-
-#endif /* __USD_WRITER_TRANSFORM_H__ */
diff --git a/source/blender/io/usd/usd.h b/source/blender/io/usd/usd.h
index eee98521289..f2826cd1d7c 100644
--- a/source/blender/io/usd/usd.h
+++ b/source/blender/io/usd/usd.h
@@ -17,8 +17,7 @@
* All rights reserved.
*/
-#ifndef __USD_H__
-#define __USD_H__
+#pragma once
#include "DEG_depsgraph.h"
@@ -59,5 +58,3 @@ int USD_get_version(void);
#ifdef __cplusplus
}
#endif
-
-#endif /* __USD_H__ */