Cleanup: Various clang-tidy warnings in io
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
# include "BLT_translation.hh"
|
||||
|
||||
# include "BLI_fileops.h"
|
||||
# include "BLI_path_utils.hh"
|
||||
# include "BLI_string.h"
|
||||
|
||||
# include "BKE_context.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@ struct Object;
|
||||
struct Scene;
|
||||
struct bContext;
|
||||
|
||||
int ABC_get_version(void);
|
||||
int ABC_get_version();
|
||||
|
||||
struct AlembicExportParams {
|
||||
double frame_start;
|
||||
@@ -120,12 +120,12 @@ void ABC_get_transform(struct CacheReader *reader,
|
||||
double time,
|
||||
float scale);
|
||||
|
||||
typedef struct ABCReadParams {
|
||||
struct ABCReadParams {
|
||||
double time;
|
||||
int read_flags;
|
||||
const char *velocity_name;
|
||||
float velocity_scale;
|
||||
} ABCReadParams;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace blender::bke {
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace blender::io::alembic {
|
||||
* metadata. */
|
||||
class ABCArchive {
|
||||
public:
|
||||
typedef std::set<double> Frames;
|
||||
using Frames = std::set<double>;
|
||||
|
||||
Alembic::Abc::OArchive *archive;
|
||||
|
||||
|
||||
@@ -42,29 +42,26 @@ class ABCHierarchyIterator : public AbstractHierarchyIterator {
|
||||
ABCArchive *abc_archive,
|
||||
const AlembicExportParams ¶ms);
|
||||
|
||||
virtual void iterate_and_write() override;
|
||||
virtual std::string make_valid_name(const std::string &name) const override;
|
||||
void iterate_and_write() override;
|
||||
std::string make_valid_name(const std::string &name) const override;
|
||||
|
||||
Alembic::Abc::OObject get_alembic_object(const std::string &export_path) const;
|
||||
|
||||
protected:
|
||||
virtual bool mark_as_weak_export(const Object *object) const override;
|
||||
bool mark_as_weak_export(const Object *object) const override;
|
||||
|
||||
virtual ExportGraph::key_type determine_graph_index_object(
|
||||
const HierarchyContext *context) override;
|
||||
virtual AbstractHierarchyIterator::ExportGraph::key_type determine_graph_index_dupli(
|
||||
ExportGraph::key_type determine_graph_index_object(const HierarchyContext *context) override;
|
||||
AbstractHierarchyIterator::ExportGraph::key_type determine_graph_index_dupli(
|
||||
const HierarchyContext *context,
|
||||
const DupliObject *dupli_object,
|
||||
const DupliParentFinder &dupli_parent_finder) override;
|
||||
|
||||
virtual AbstractHierarchyWriter *create_transform_writer(
|
||||
const HierarchyContext *context) override;
|
||||
virtual AbstractHierarchyWriter *create_data_writer(const HierarchyContext *context) override;
|
||||
virtual AbstractHierarchyWriter *create_hair_writer(const HierarchyContext *context) override;
|
||||
virtual AbstractHierarchyWriter *create_particle_writer(
|
||||
const HierarchyContext *context) override;
|
||||
AbstractHierarchyWriter *create_transform_writer(const HierarchyContext *context) override;
|
||||
AbstractHierarchyWriter *create_data_writer(const HierarchyContext *context) override;
|
||||
AbstractHierarchyWriter *create_hair_writer(const HierarchyContext *context) override;
|
||||
AbstractHierarchyWriter *create_particle_writer(const HierarchyContext *context) override;
|
||||
|
||||
virtual void release_writer(AbstractHierarchyWriter *writer) override;
|
||||
void release_writer(AbstractHierarchyWriter *writer) override;
|
||||
|
||||
private:
|
||||
Alembic::Abc::OObject get_alembic_parent(const HierarchyContext *context) const;
|
||||
|
||||
@@ -34,7 +34,7 @@ class ABCAbstractWriter : public AbstractHierarchyWriter {
|
||||
public:
|
||||
explicit ABCAbstractWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
virtual void write(HierarchyContext &context) override;
|
||||
void write(HierarchyContext &context) override;
|
||||
|
||||
/* Returns true if the data to be written is actually supported. This would, for example, allow a
|
||||
* hypothetical camera writer accept a perspective camera but reject an orthogonal one.
|
||||
|
||||
@@ -25,12 +25,12 @@ class ABCCameraWriter : public ABCAbstractWriter {
|
||||
public:
|
||||
explicit ABCCameraWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
virtual void create_alembic_objects(const HierarchyContext *context) override;
|
||||
virtual Alembic::Abc::OObject get_alembic_object() const override;
|
||||
void create_alembic_objects(const HierarchyContext *context) override;
|
||||
Alembic::Abc::OObject get_alembic_object() const override;
|
||||
|
||||
protected:
|
||||
virtual bool is_supported(const HierarchyContext *context) const override;
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
bool is_supported(const HierarchyContext *context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override;
|
||||
};
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ class ABCCurveWriter : public ABCAbstractWriter {
|
||||
public:
|
||||
explicit ABCCurveWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
virtual void create_alembic_objects(const HierarchyContext *context) override;
|
||||
virtual Alembic::Abc::OObject get_alembic_object() const override;
|
||||
void create_alembic_objects(const HierarchyContext *context) override;
|
||||
Alembic::Abc::OObject get_alembic_object() const override;
|
||||
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override;
|
||||
|
||||
protected:
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
};
|
||||
|
||||
class ABCCurveMeshWriter : public ABCGenericMeshWriter {
|
||||
@@ -37,7 +37,7 @@ class ABCCurveMeshWriter : public ABCGenericMeshWriter {
|
||||
ABCCurveMeshWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
protected:
|
||||
virtual Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
};
|
||||
|
||||
} // namespace blender::io::alembic
|
||||
|
||||
@@ -23,12 +23,12 @@ class ABCHairWriter : public ABCAbstractWriter {
|
||||
public:
|
||||
explicit ABCHairWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
virtual void create_alembic_objects(const HierarchyContext *context) override;
|
||||
virtual Alembic::Abc::OObject get_alembic_object() const override;
|
||||
void create_alembic_objects(const HierarchyContext *context) override;
|
||||
Alembic::Abc::OObject get_alembic_object() const override;
|
||||
|
||||
protected:
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
virtual bool check_is_animated(const HierarchyContext &context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
bool check_is_animated(const HierarchyContext &context) const override;
|
||||
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -20,12 +20,12 @@ class ABCInstanceWriter : public ABCAbstractWriter {
|
||||
public:
|
||||
explicit ABCInstanceWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
virtual void create_alembic_objects(const HierarchyContext *context) override;
|
||||
virtual Alembic::Abc::OObject get_alembic_object() const override;
|
||||
void create_alembic_objects(const HierarchyContext *context) override;
|
||||
Alembic::Abc::OObject get_alembic_object() const override;
|
||||
|
||||
protected:
|
||||
virtual bool is_supported(const HierarchyContext *context) const override;
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
bool is_supported(const HierarchyContext *context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
void ensure_custom_properties_exporter(const HierarchyContext &context) override;
|
||||
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override;
|
||||
};
|
||||
|
||||
@@ -16,11 +16,11 @@ class ABCMetaballWriter : public ABCGenericMeshWriter {
|
||||
explicit ABCMetaballWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
protected:
|
||||
virtual Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
virtual void free_export_mesh(Mesh *mesh) override;
|
||||
virtual bool is_supported(const HierarchyContext *context) const override;
|
||||
virtual bool check_is_animated(const HierarchyContext &context) const override;
|
||||
virtual bool export_as_subdivision_surface(Object *ob_eval) const override;
|
||||
Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
void free_export_mesh(Mesh *mesh) override;
|
||||
bool is_supported(const HierarchyContext *context) const override;
|
||||
bool check_is_animated(const HierarchyContext &context) const override;
|
||||
bool export_as_subdivision_surface(Object *ob_eval) const override;
|
||||
|
||||
private:
|
||||
bool is_basis_ball(Scene *scene, Object *ob) const;
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "abc_hierarchy_iterator.h"
|
||||
#include "intern/abc_axis_conversion.h"
|
||||
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_material.hh"
|
||||
|
||||
@@ -39,13 +39,13 @@ class ABCGenericMeshWriter : public ABCAbstractWriter {
|
||||
public:
|
||||
explicit ABCGenericMeshWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
virtual void create_alembic_objects(const HierarchyContext *context) override;
|
||||
virtual Alembic::Abc::OObject get_alembic_object() const override;
|
||||
void create_alembic_objects(const HierarchyContext *context) override;
|
||||
Alembic::Abc::OObject get_alembic_object() const override;
|
||||
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override;
|
||||
|
||||
protected:
|
||||
virtual bool is_supported(const HierarchyContext *context) const override;
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
bool is_supported(const HierarchyContext *context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
|
||||
virtual Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) = 0;
|
||||
virtual void free_export_mesh(Mesh *mesh);
|
||||
@@ -70,7 +70,7 @@ class ABCMeshWriter : public ABCGenericMeshWriter {
|
||||
ABCMeshWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
protected:
|
||||
virtual Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
};
|
||||
|
||||
} // namespace blender::io::alembic
|
||||
|
||||
@@ -24,13 +24,13 @@ class ABCNurbsWriter : public ABCAbstractWriter {
|
||||
public:
|
||||
explicit ABCNurbsWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
virtual void create_alembic_objects(const HierarchyContext *context) override;
|
||||
virtual Alembic::Abc::OObject get_alembic_object() const override;
|
||||
void create_alembic_objects(const HierarchyContext *context) override;
|
||||
Alembic::Abc::OObject get_alembic_object() const override;
|
||||
|
||||
protected:
|
||||
virtual bool is_supported(const HierarchyContext *context) const override;
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
virtual bool check_is_animated(const HierarchyContext &context) const override;
|
||||
bool is_supported(const HierarchyContext *context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
bool check_is_animated(const HierarchyContext &context) const override;
|
||||
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override;
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ class ABCNurbsMeshWriter : public ABCGenericMeshWriter {
|
||||
explicit ABCNurbsMeshWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
protected:
|
||||
virtual Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
};
|
||||
|
||||
} // namespace blender::io::alembic
|
||||
|
||||
@@ -20,15 +20,15 @@ class ABCPointsWriter : public ABCAbstractWriter {
|
||||
public:
|
||||
explicit ABCPointsWriter(const ABCWriterConstructorArgs &args);
|
||||
|
||||
virtual void create_alembic_objects(const HierarchyContext *context) override;
|
||||
virtual Alembic::Abc::OObject get_alembic_object() const override;
|
||||
void create_alembic_objects(const HierarchyContext *context) override;
|
||||
Alembic::Abc::OObject get_alembic_object() const override;
|
||||
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override;
|
||||
|
||||
virtual bool is_supported(const HierarchyContext *context) const override;
|
||||
bool is_supported(const HierarchyContext *context) const override;
|
||||
|
||||
protected:
|
||||
virtual bool check_is_animated(const HierarchyContext &context) const override;
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
bool check_is_animated(const HierarchyContext &context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
};
|
||||
|
||||
} // namespace blender::io::alembic
|
||||
|
||||
@@ -20,12 +20,12 @@ class ABCTransformWriter : public ABCAbstractWriter {
|
||||
|
||||
public:
|
||||
explicit ABCTransformWriter(const ABCWriterConstructorArgs &args);
|
||||
virtual void create_alembic_objects(const HierarchyContext *context) override;
|
||||
void create_alembic_objects(const HierarchyContext *context) override;
|
||||
|
||||
protected:
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
virtual bool check_is_animated(const HierarchyContext &context) const override;
|
||||
virtual Alembic::Abc::OObject get_alembic_object() const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
bool check_is_animated(const HierarchyContext &context) const override;
|
||||
Alembic::Abc::OObject get_alembic_object() const override;
|
||||
const IDProperty *get_id_properties(const HierarchyContext &context) const override;
|
||||
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override;
|
||||
};
|
||||
|
||||
@@ -57,10 +57,10 @@ BLI_INLINE void copy_yup_from_zup(short yup[3], const short zup[3])
|
||||
/* Names are given in (dst, src) order, just like
|
||||
* the parameters of copy_m44_axis_swap(). */
|
||||
|
||||
typedef enum {
|
||||
enum AbcAxisSwapMode {
|
||||
ABC_ZUP_FROM_YUP = 1,
|
||||
ABC_YUP_FROM_ZUP = 2,
|
||||
} AbcAxisSwapMode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a rotation matrix for each axis from euler angles.
|
||||
@@ -78,10 +78,10 @@ void create_swapped_rotation_matrix(float rot_x_mat[3][3],
|
||||
*/
|
||||
void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMode mode);
|
||||
|
||||
typedef enum {
|
||||
enum AbcMatrixMode {
|
||||
ABC_MATRIX_WORLD = 1,
|
||||
ABC_MATRIX_LOCAL = 2,
|
||||
} AbcMatrixMode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Recompute transform matrix of object in new coordinate system
|
||||
|
||||
@@ -36,30 +36,30 @@ struct UVSample {
|
||||
};
|
||||
|
||||
struct CDStreamConfig {
|
||||
int *corner_verts;
|
||||
int totloop;
|
||||
int *corner_verts = nullptr;
|
||||
int totloop = 0;
|
||||
|
||||
int *face_offsets;
|
||||
int faces_num;
|
||||
int *face_offsets = nullptr;
|
||||
int faces_num = 0;
|
||||
|
||||
float3 *positions;
|
||||
int totvert;
|
||||
float3 *positions = nullptr;
|
||||
int totvert = 0;
|
||||
|
||||
float2 *mloopuv;
|
||||
float2 *mloopuv = nullptr;
|
||||
|
||||
CustomData *loopdata;
|
||||
CustomData *loopdata = nullptr;
|
||||
|
||||
bool pack_uvs;
|
||||
bool pack_uvs = false;
|
||||
|
||||
/* TODO(kevin): might need a better way to handle adding and/or updating
|
||||
* custom data such that it updates the custom data holder and its pointers properly. */
|
||||
Mesh *mesh;
|
||||
void *(*add_customdata_cb)(Mesh *mesh, const char *name, int data_type);
|
||||
Mesh *mesh = nullptr;
|
||||
void *(*add_customdata_cb)(Mesh *mesh, const char *name, int data_type) = nullptr;
|
||||
|
||||
Alembic::Abc::chrono_t time;
|
||||
int timesample_index;
|
||||
Alembic::Abc::chrono_t time = 0.0;
|
||||
int timesample_index = 0;
|
||||
|
||||
const char **modifier_error_message;
|
||||
const char **modifier_error_message = nullptr;
|
||||
|
||||
/* Alembic needs Blender to keep references to C++ objects (the destructors finalize the writing
|
||||
* to ABC). The following fields are all used to keep these references. */
|
||||
@@ -74,19 +74,7 @@ struct CDStreamConfig {
|
||||
/* Mapping from vertex color layer name to its Alembic color data. */
|
||||
std::map<std::string, Alembic::AbcGeom::OC4fGeomParam> abc_vertex_colors;
|
||||
|
||||
CDStreamConfig()
|
||||
: corner_verts(NULL),
|
||||
totloop(0),
|
||||
face_offsets(NULL),
|
||||
faces_num(0),
|
||||
totvert(0),
|
||||
pack_uvs(false),
|
||||
mesh(NULL),
|
||||
add_customdata_cb(NULL),
|
||||
time(0.0),
|
||||
modifier_error_message(NULL)
|
||||
{
|
||||
}
|
||||
CDStreamConfig() = default;
|
||||
};
|
||||
|
||||
/* Get the UVs for the main UV property on a OSchema.
|
||||
@@ -115,11 +103,11 @@ void read_custom_data(const std::string &iobject_full_name,
|
||||
const CDStreamConfig &config,
|
||||
const Alembic::Abc::ISampleSelector &iss);
|
||||
|
||||
typedef enum {
|
||||
enum AbcUvScope {
|
||||
ABC_UV_SCOPE_NONE,
|
||||
ABC_UV_SCOPE_LOOP,
|
||||
ABC_UV_SCOPE_VERTEX,
|
||||
} AbcUvScope;
|
||||
};
|
||||
|
||||
/**
|
||||
* UVs can be defined per-loop (one value per vertex per face), or per-vertex (one value per
|
||||
|
||||
@@ -98,7 +98,7 @@ static bool set_knots(const FloatArraySamplePtr &knots, float *&nu_knots)
|
||||
|
||||
void AbcNurbsReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel)
|
||||
{
|
||||
Curve *cu = static_cast<Curve *>(BKE_curve_add(bmain, m_data_name.c_str(), OB_SURF));
|
||||
Curve *cu = BKE_curve_add(bmain, m_data_name.c_str(), OB_SURF);
|
||||
cu->actvert = CU_ACT_NONE;
|
||||
|
||||
std::vector<std::pair<INuPatchSchema, IObject>>::iterator it;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_math_rotation.h"
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
using Alembic::AbcGeom::IObject;
|
||||
|
||||
@@ -30,48 +30,32 @@ using Alembic::AbcCoreAbstract::chrono_t;
|
||||
namespace blender::io::alembic {
|
||||
|
||||
struct ImportSettings {
|
||||
bool do_convert_mat;
|
||||
bool do_convert_mat = false;
|
||||
float conversion_mat[4][4];
|
||||
|
||||
int from_up;
|
||||
int from_forward;
|
||||
float scale;
|
||||
bool is_sequence;
|
||||
bool set_frame_range;
|
||||
int from_up = 0;
|
||||
int from_forward = 0;
|
||||
float scale = 1.0f;
|
||||
bool is_sequence = false;
|
||||
bool set_frame_range = false;
|
||||
|
||||
/* Min and max frame detected from file sequences. */
|
||||
int sequence_min_frame;
|
||||
int sequence_max_frame;
|
||||
int sequence_min_frame = 0;
|
||||
int sequence_max_frame = 1;
|
||||
|
||||
/* From MeshSeqCacheModifierData.read_flag */
|
||||
int read_flag;
|
||||
int read_flag = 0;
|
||||
|
||||
/* From CacheFile and MeshSeqCacheModifierData */
|
||||
std::string velocity_name;
|
||||
float velocity_scale;
|
||||
float velocity_scale = 1.0f;
|
||||
|
||||
bool validate_meshes;
|
||||
bool always_add_cache_reader;
|
||||
bool validate_meshes = false;
|
||||
bool always_add_cache_reader = false;
|
||||
|
||||
CacheFile *cache_file;
|
||||
CacheFile *cache_file = nullptr;
|
||||
|
||||
ImportSettings()
|
||||
: do_convert_mat(false),
|
||||
from_up(0),
|
||||
from_forward(0),
|
||||
scale(1.0f),
|
||||
is_sequence(false),
|
||||
set_frame_range(false),
|
||||
sequence_min_frame(0),
|
||||
sequence_max_frame(1),
|
||||
read_flag(0),
|
||||
velocity_name(""),
|
||||
velocity_scale(1.0f),
|
||||
validate_meshes(false),
|
||||
always_add_cache_reader(false),
|
||||
cache_file(NULL)
|
||||
{
|
||||
}
|
||||
ImportSettings() = default;
|
||||
};
|
||||
|
||||
template<typename Schema> static bool has_animations(Schema &schema, ImportSettings *settings)
|
||||
@@ -105,14 +89,13 @@ class AbcObjectReader {
|
||||
public:
|
||||
AbcObjectReader *parent_reader;
|
||||
|
||||
public:
|
||||
explicit AbcObjectReader(const Alembic::Abc::IObject &object, ImportSettings &settings);
|
||||
|
||||
virtual ~AbcObjectReader() = default;
|
||||
|
||||
const Alembic::Abc::IObject &iobject() const;
|
||||
|
||||
typedef std::vector<AbcObjectReader *> ptr_vector;
|
||||
using ptr_vector = std::vector<AbcObjectReader *>;
|
||||
|
||||
/**
|
||||
* Returns the transform of this object. This can be the Alembic object
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_pointcloud.hh"
|
||||
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
using namespace Alembic::AbcGeom;
|
||||
|
||||
namespace blender::io::alembic {
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <Alembic/AbcCoreAbstract/TimeSampling.h>
|
||||
#include <Alembic/AbcGeom/IXform.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -10,14 +10,16 @@
|
||||
#include "IO_types.hh"
|
||||
|
||||
#include <Alembic/AbcGeom/ILight.h>
|
||||
#include <Alembic/AbcGeom/INuPatch.h>
|
||||
#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"
|
||||
#include "abc_reader_mesh.h"
|
||||
#include "abc_reader_nurbs.h"
|
||||
#ifdef USE_NURBS
|
||||
# include "abc_reader_nurbs.h"
|
||||
#endif
|
||||
#include "abc_reader_points.h"
|
||||
#include "abc_reader_transform.h"
|
||||
#include "abc_util.h"
|
||||
@@ -839,12 +841,12 @@ void ABC_read_geometry(CacheReader *reader,
|
||||
}
|
||||
|
||||
ISampleSelector sample_sel = sample_selector_for_time(params->time);
|
||||
return abc_reader->read_geometry(geometry_set,
|
||||
sample_sel,
|
||||
params->read_flags,
|
||||
params->velocity_name,
|
||||
params->velocity_scale,
|
||||
r_err_str);
|
||||
abc_reader->read_geometry(geometry_set,
|
||||
sample_sel,
|
||||
params->read_flags,
|
||||
params->velocity_name,
|
||||
params->velocity_scale,
|
||||
r_err_str);
|
||||
}
|
||||
|
||||
bool ABC_mesh_topology_changed(CacheReader *reader,
|
||||
|
||||
@@ -6,12 +6,10 @@
|
||||
|
||||
/* Keep first since utildefines defines AT which conflicts with STL */
|
||||
#include "exporter/abc_archive.h"
|
||||
#include "intern/abc_util.h"
|
||||
|
||||
#include "BKE_main.hh"
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "BLI_math_base.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
namespace blender::io::alembic {
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "AnimationClipExporter.h"
|
||||
#include "GeometryExporter.h"
|
||||
#include "MaterialExporter.h"
|
||||
|
||||
void AnimationClipExporter::exportAnimationClips(Scene *sce)
|
||||
{
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "COLLADASWLibraryAnimationClips.h"
|
||||
#include "DEG_depsgraph.hh"
|
||||
@@ -15,7 +13,7 @@
|
||||
class AnimationClipExporter : COLLADASW::LibraryAnimationClips {
|
||||
private:
|
||||
Depsgraph *depsgraph;
|
||||
Scene *scene;
|
||||
Scene *scene = nullptr;
|
||||
COLLADASW::StreamWriter *sw;
|
||||
BCExportSettings &export_settings;
|
||||
std::vector<std::vector<std::string>> anim_meta;
|
||||
@@ -27,7 +25,6 @@ class AnimationClipExporter : COLLADASW::LibraryAnimationClips {
|
||||
std::vector<std::vector<std::string>> anim_meta)
|
||||
: COLLADASW::LibraryAnimationClips(sw),
|
||||
depsgraph(depsgraph),
|
||||
scene(nullptr),
|
||||
sw(sw),
|
||||
export_settings(export_settings),
|
||||
anim_meta(anim_meta)
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
*/
|
||||
|
||||
#include "AnimationExporter.h"
|
||||
#include "AnimationClipExporter.h"
|
||||
#include "BCAnimationSampler.h"
|
||||
#include "GeometryExporter.h"
|
||||
#include "MaterialExporter.h"
|
||||
#include "collada_utils.h"
|
||||
|
||||
#include "BKE_material.hh"
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
std::string EMPTY_STRING;
|
||||
|
||||
std::string AnimationExporter::get_axis_name(std::string channel_type, int id)
|
||||
@@ -388,7 +389,6 @@ void AnimationExporter::export_collada_curve_animation(
|
||||
BCValues values;
|
||||
curve.get_frames(frames);
|
||||
curve.get_values(values);
|
||||
std::string channel_target = curve.get_channel_target();
|
||||
|
||||
fprintf(
|
||||
stdout, "Export animation curve %s (%d control points)\n", id.c_str(), int(frames.size()));
|
||||
@@ -503,31 +503,31 @@ void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNa
|
||||
{
|
||||
switch (semantic) {
|
||||
case COLLADASW::InputSemantic::INPUT:
|
||||
param.push_back("TIME");
|
||||
param.emplace_back("TIME");
|
||||
break;
|
||||
case COLLADASW::InputSemantic::OUTPUT:
|
||||
if (is_rot) {
|
||||
param.push_back("ANGLE");
|
||||
param.emplace_back("ANGLE");
|
||||
}
|
||||
else {
|
||||
if (!axis.empty()) {
|
||||
param.push_back(axis);
|
||||
}
|
||||
else if (transform) {
|
||||
param.push_back("TRANSFORM");
|
||||
param.emplace_back("TRANSFORM");
|
||||
}
|
||||
else {
|
||||
/* assumes if axis isn't specified all axes are added */
|
||||
param.push_back("X");
|
||||
param.push_back("Y");
|
||||
param.push_back("Z");
|
||||
param.emplace_back("X");
|
||||
param.emplace_back("Y");
|
||||
param.emplace_back("Z");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case COLLADASW::InputSemantic::IN_TANGENT:
|
||||
case COLLADASW::InputSemantic::OUT_TANGENT:
|
||||
param.push_back("X");
|
||||
param.push_back("Y");
|
||||
param.emplace_back("X");
|
||||
param.emplace_back("Y");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -680,7 +680,7 @@ std::string AnimationExporter::collada_interpolation_source(const BCAnimationCur
|
||||
source.setAccessorStride(1);
|
||||
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("INTERPOLATION");
|
||||
param.emplace_back("INTERPOLATION");
|
||||
|
||||
source.prepareToAppendValues();
|
||||
|
||||
@@ -723,7 +723,7 @@ std::string AnimationExporter::collada_linear_interpolation_source(int tot,
|
||||
source.setAccessorStride(1);
|
||||
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("INTERPOLATION");
|
||||
param.emplace_back("INTERPOLATION");
|
||||
|
||||
source.prepareToAppendValues();
|
||||
|
||||
@@ -791,7 +791,6 @@ std::string AnimationExporter::get_collada_name(std::string channel_type) const
|
||||
std::string AnimationExporter::get_collada_sid(const BCAnimationCurve &curve,
|
||||
const std::string axis_name)
|
||||
{
|
||||
std::string channel_target = curve.get_channel_target();
|
||||
std::string channel_type = curve.get_channel_type();
|
||||
std::string tm_name = get_collada_name(channel_type);
|
||||
|
||||
|
||||
@@ -4,73 +4,29 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "BCAnimationCurve.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_light_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BIK_api.h"
|
||||
#include "BKE_action.hh" /* pose functions */
|
||||
#include "BKE_armature.hh"
|
||||
#include "BKE_constraint.h"
|
||||
#include "BKE_fcurve.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_scene.hh"
|
||||
#include "ED_object.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
|
||||
#include "COLLADASWBaseInputElement.h"
|
||||
#include "COLLADASWConstants.h"
|
||||
#include "COLLADASWInputList.h"
|
||||
#include "COLLADASWInstanceGeometry.h"
|
||||
#include "COLLADASWLibraryAnimations.h"
|
||||
#include "COLLADASWParamBase.h"
|
||||
#include "COLLADASWParamTemplate.h"
|
||||
#include "COLLADASWPrimitves.h"
|
||||
#include "COLLADASWSampler.h"
|
||||
#include "COLLADASWSource.h"
|
||||
#include "COLLADASWVertices.h"
|
||||
|
||||
#include "BCAnimationSampler.h"
|
||||
#include "EffectExporter.h"
|
||||
#include "collada_internal.h"
|
||||
|
||||
#include "IK_solver.h"
|
||||
|
||||
#include <algorithm> /* std::find */
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
typedef enum BC_animation_source_type {
|
||||
enum BC_animation_source_type {
|
||||
BC_SOURCE_TYPE_VALUE,
|
||||
BC_SOURCE_TYPE_ANGLE,
|
||||
BC_SOURCE_TYPE_TIMEFRAME,
|
||||
} BC_animation_source_type;
|
||||
};
|
||||
|
||||
typedef enum BC_global_rotation_type {
|
||||
BC_NO_ROTATION,
|
||||
BC_OBJECT_ROTATION,
|
||||
BC_DATA_ROTATION
|
||||
} BC_global_rotation_type;
|
||||
enum BC_global_rotation_type { BC_NO_ROTATION, BC_OBJECT_ROTATION, BC_DATA_ROTATION };
|
||||
|
||||
class AnimationExporter : COLLADASW::LibraryAnimations {
|
||||
private:
|
||||
|
||||
@@ -8,8 +8,15 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
/* COLLADABU_ASSERT, may be able to remove later */
|
||||
#include "COLLADABUPlatform.h"
|
||||
#include "COLLADAFWAnimation.h"
|
||||
#include "COLLADAFWAnimationCurve.h"
|
||||
#include "COLLADAFWAnimationList.h"
|
||||
#include "COLLADAFWCamera.h"
|
||||
#include "COLLADAFWEffect.h"
|
||||
#include "COLLADAFWLight.h"
|
||||
#include "COLLADAFWNode.h"
|
||||
#include "COLLADAFWRotate.h"
|
||||
#include "COLLADAFWUniqueId.h"
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
|
||||
@@ -20,23 +27,16 @@
|
||||
#include "ANIM_animdata.hh"
|
||||
#include "ANIM_fcurve.hh"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_string_utils.hh"
|
||||
|
||||
#include "BLT_translation.hh"
|
||||
|
||||
#include "BKE_action.hh"
|
||||
#include "BKE_armature.hh"
|
||||
#include "BKE_fcurve.hh"
|
||||
#include "BKE_object.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "AnimationImporter.h"
|
||||
#include "ArmatureImporter.h"
|
||||
#include "MaterialExporter.h"
|
||||
#include "collada_utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -14,11 +14,6 @@
|
||||
#include "COLLADAFWAnimation.h"
|
||||
#include "COLLADAFWAnimationCurve.h"
|
||||
#include "COLLADAFWAnimationList.h"
|
||||
#include "COLLADAFWCamera.h"
|
||||
#include "COLLADAFWEffect.h"
|
||||
#include "COLLADAFWInstanceGeometry.h"
|
||||
#include "COLLADAFWLight.h"
|
||||
#include "COLLADAFWMaterial.h"
|
||||
#include "COLLADAFWNode.h"
|
||||
#include "COLLADAFWUniqueId.h"
|
||||
|
||||
@@ -27,7 +22,6 @@
|
||||
#include "DNA_anim_types.h"
|
||||
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_light_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
|
||||
@@ -6,18 +6,9 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
#include "COLLADASWBaseInputElement.h"
|
||||
#include "COLLADASWInstanceController.h"
|
||||
#include "COLLADASWPrimitves.h"
|
||||
#include "COLLADASWSource.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
|
||||
#include "BKE_action.hh"
|
||||
#include "BKE_armature.hh"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
|
||||
#include "ED_armature.hh"
|
||||
|
||||
@@ -25,9 +16,10 @@
|
||||
#include "BLI_math_matrix.h"
|
||||
|
||||
#include "ArmatureExporter.h"
|
||||
#include "GeometryExporter.h"
|
||||
#include "SceneExporter.h"
|
||||
|
||||
#include "collada_utils.h"
|
||||
|
||||
void ArmatureExporter::add_bone_collections(Object *ob_arm, COLLADASW::Node &node)
|
||||
{
|
||||
bArmature *armature = (bArmature *)ob_arm->data;
|
||||
@@ -190,7 +182,7 @@ void ArmatureExporter::add_bone_node(Bone *bone,
|
||||
}
|
||||
}
|
||||
|
||||
std::string collection_names = "";
|
||||
std::string collection_names;
|
||||
LISTBASE_FOREACH (const BoneCollectionReference *, bcoll_ref, &bone->runtime.collections) {
|
||||
collection_names += std::string(bcoll_ref->bcoll->name) + "\n";
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
// #include <vector>
|
||||
|
||||
#include <COLLADASWInputList.h>
|
||||
#include <COLLADASWInstanceController.h>
|
||||
@@ -19,11 +17,7 @@
|
||||
#include <COLLADASWStreamWriter.h>
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "InstanceWriter.h"
|
||||
#include "TransformWriter.h"
|
||||
@@ -85,7 +79,7 @@ class ArmatureExporter : public COLLADASW::LibraryControllers,
|
||||
SceneExporter *se,
|
||||
std::vector<Object *> &child_objects);
|
||||
|
||||
inline bool can_export(Bone *bone)
|
||||
bool can_export(Bone *bone)
|
||||
{
|
||||
return !(export_settings.get_deform_bones_only() && bone->flag & BONE_NO_DEFORM);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
/* COLLADABU_ASSERT, may be able to remove later */
|
||||
#include "COLLADABUPlatform.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
#include "COLLADAFWUniqueId.h"
|
||||
|
||||
@@ -201,9 +199,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin,
|
||||
|
||||
for (uint i = 0; i < children.getCount(); i++) {
|
||||
int cl = create_bone(skin, children[i], bone, children.getCount(), mat, arm, layer_labels);
|
||||
if (cl > chain_length) {
|
||||
chain_length = cl;
|
||||
}
|
||||
chain_length = std::max(cl, chain_length);
|
||||
}
|
||||
|
||||
bone->length = len_v3v3(bone->head, bone->tail);
|
||||
|
||||
@@ -133,7 +133,7 @@ class ArmatureImporter : private TransformReader {
|
||||
void create_armature_bones(Main *bmain, std::vector<Object *> &arm_objs);
|
||||
|
||||
/** TagsMap typedef for uid_tags_map. */
|
||||
typedef std::map<std::string, ExtraTags *> TagsMap;
|
||||
using TagsMap = std::map<std::string, ExtraTags *>;
|
||||
TagsMap uid_tags_map;
|
||||
|
||||
public:
|
||||
|
||||
@@ -2,10 +2,26 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_light_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_material.hh"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_path.hh"
|
||||
|
||||
#include "ANIM_fcurve.hh"
|
||||
|
||||
#include "BCAnimationCurve.h"
|
||||
|
||||
#include "collada_utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
BCAnimationCurve::BCAnimationCurve()
|
||||
{
|
||||
this->curve_key.set_object_type(BC_ANIMATION_TYPE_OBJECT);
|
||||
@@ -351,12 +367,8 @@ float BCAnimationCurve::get_value(const float frame)
|
||||
|
||||
void BCAnimationCurve::update_range(float val)
|
||||
{
|
||||
if (val < min) {
|
||||
min = val;
|
||||
}
|
||||
if (val > max) {
|
||||
max = val;
|
||||
}
|
||||
min = std::min(val, min);
|
||||
max = std::max(val, max);
|
||||
}
|
||||
|
||||
void BCAnimationCurve::init_range(float val)
|
||||
|
||||
@@ -4,35 +4,33 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "BCSampleData.h"
|
||||
#include "collada_utils.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_armature.hh"
|
||||
#include "BKE_fcurve.hh"
|
||||
#include "BKE_material.hh"
|
||||
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "ED_anim_api.hh"
|
||||
#include "ED_keyframes_edit.hh"
|
||||
|
||||
#include "ANIM_fcurve.hh"
|
||||
using TangentPoint = float[2];
|
||||
|
||||
typedef float(TangentPoint)[2];
|
||||
using BCFrameSet = std::set<float>;
|
||||
using BCFrames = std::vector<float>;
|
||||
using BCValues = std::vector<float>;
|
||||
using BCTimes = std::vector<float>;
|
||||
using BCValueMap = std::map<int, float>;
|
||||
|
||||
typedef std::set<float> BCFrameSet;
|
||||
typedef std::vector<float> BCFrames;
|
||||
typedef std::vector<float> BCValues;
|
||||
typedef std::vector<float> BCTimes;
|
||||
typedef std::map<int, float> BCValueMap;
|
||||
|
||||
typedef enum BC_animation_type {
|
||||
enum BC_animation_type {
|
||||
BC_ANIMATION_TYPE_OBJECT,
|
||||
BC_ANIMATION_TYPE_BONE,
|
||||
BC_ANIMATION_TYPE_CAMERA,
|
||||
BC_ANIMATION_TYPE_MATERIAL,
|
||||
BC_ANIMATION_TYPE_LIGHT,
|
||||
} BC_animation_type;
|
||||
};
|
||||
|
||||
class BCCurveKey {
|
||||
private:
|
||||
@@ -131,4 +129,4 @@ class BCAnimationCurve {
|
||||
int closest_index_below(float sample_frame) const;
|
||||
};
|
||||
|
||||
typedef std::map<BCCurveKey, BCAnimationCurve *> BCAnimationCurveMap;
|
||||
using BCAnimationCurveMap = std::map<BCCurveKey, BCAnimationCurve *>;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include <algorithm> /* std::find */
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
@@ -14,16 +13,13 @@
|
||||
|
||||
#include "BKE_action.hh"
|
||||
#include "BKE_constraint.h"
|
||||
#include "BKE_key.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_main.hh"
|
||||
#include "BKE_material.hh"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "ED_object.hh"
|
||||
|
||||
@@ -11,14 +11,10 @@
|
||||
#include "BKE_action.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
|
||||
#include "BLI_math_rotation.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
|
||||
/* Collection of animation curves */
|
||||
class BCAnimation {
|
||||
private:
|
||||
Object *reference = NULL;
|
||||
Object *reference = nullptr;
|
||||
bContext *mContext;
|
||||
|
||||
public:
|
||||
@@ -52,7 +48,7 @@ class BCAnimation {
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<Object *, BCAnimation *> BCAnimationObjectMap;
|
||||
using BCAnimationObjectMap = std::map<Object *, BCAnimation *>;
|
||||
|
||||
class BCSampleFrame {
|
||||
|
||||
@@ -90,7 +86,7 @@ class BCSampleFrame {
|
||||
bool has_sample_for(Object *ob, Bone *bone) const;
|
||||
};
|
||||
|
||||
typedef std::map<int, BCSampleFrame> BCSampleFrameMap;
|
||||
using BCSampleFrameMap = std::map<int, BCSampleFrame>;
|
||||
|
||||
class BCSampleFrameContainer {
|
||||
|
||||
@@ -122,7 +118,7 @@ class BCSampleFrameContainer {
|
||||
BCSampleFrameMap sample_frames;
|
||||
|
||||
public:
|
||||
~BCSampleFrameContainer() {}
|
||||
~BCSampleFrameContainer() = default;
|
||||
|
||||
BCSample &add(Object *ob, int frame_index);
|
||||
/** Return either the #BCSampleFrame or NULL if frame does not exist. */
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BCMath.h"
|
||||
#include "BlenderContext.h"
|
||||
|
||||
|
||||
@@ -4,25 +4,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "BCMath.h"
|
||||
#include "BCSampleData.h"
|
||||
#include "ExportSettings.h"
|
||||
|
||||
#include "BKE_object.hh"
|
||||
|
||||
#include "BLI_math_rotation.h"
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_light_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
typedef std::map<Bone *, BCMatrix *> BCBoneMatrixMap;
|
||||
using BCBoneMatrixMap = std::map<Bone *, BCMatrix *>;
|
||||
|
||||
class BCSample {
|
||||
private:
|
||||
@@ -42,6 +32,6 @@ class BCSample {
|
||||
const BCMatrix *get_matrix(Bone *bone) const; /* returns NULL if bone is not animated */
|
||||
};
|
||||
|
||||
typedef std::map<Object *, BCSample *> BCSampleMap;
|
||||
typedef std::map<int, const BCSample *> BCFrameSampleMap;
|
||||
typedef std::map<int, const BCMatrix *> BCMatrixSampleMap;
|
||||
using BCSampleMap = std::map<Object *, BCSample *>;
|
||||
using BCFrameSampleMap = std::map<int, const BCSample *>;
|
||||
using BCMatrixSampleMap = std::map<int, const BCMatrix *>;
|
||||
|
||||
@@ -8,26 +8,26 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef float(Vector)[3];
|
||||
typedef float(Quat)[4];
|
||||
typedef float(Color)[4];
|
||||
typedef float(Matrix)[4][4];
|
||||
typedef double(DMatrix)[4][4];
|
||||
using Vector = float[3];
|
||||
using Quat = float[4];
|
||||
using Color = float[4];
|
||||
using Matrix = float[4][4];
|
||||
using DMatrix = double[4][4];
|
||||
|
||||
typedef enum BC_global_forward_axis {
|
||||
enum BC_global_forward_axis {
|
||||
BC_GLOBAL_FORWARD_X = 0,
|
||||
BC_GLOBAL_FORWARD_Y = 1,
|
||||
BC_GLOBAL_FORWARD_Z = 2,
|
||||
BC_GLOBAL_FORWARD_MINUS_X = 3,
|
||||
BC_GLOBAL_FORWARD_MINUS_Y = 4,
|
||||
BC_GLOBAL_FORWARD_MINUS_Z = 5
|
||||
} BC_global_forward_axis;
|
||||
};
|
||||
|
||||
typedef enum BC_global_up_axis {
|
||||
enum BC_global_up_axis {
|
||||
BC_GLOBAL_UP_X = 0,
|
||||
BC_GLOBAL_UP_Y = 1,
|
||||
BC_GLOBAL_UP_Z = 2,
|
||||
BC_GLOBAL_UP_MINUS_X = 3,
|
||||
BC_GLOBAL_UP_MINUS_Y = 4,
|
||||
BC_GLOBAL_UP_MINUS_Z = 5
|
||||
} BC_global_up_axis;
|
||||
};
|
||||
|
||||
@@ -13,13 +13,11 @@
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
|
||||
#include "BKE_action.hh"
|
||||
#include "BKE_armature.hh"
|
||||
#include "BKE_deform.hh"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_idprop.hh"
|
||||
#include "BKE_key.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
|
||||
@@ -28,10 +26,8 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
|
||||
#include "ArmatureExporter.h"
|
||||
#include "ControllerExporter.h"
|
||||
#include "GeometryExporter.h"
|
||||
#include "SceneExporter.h"
|
||||
|
||||
#include "collada_utils.h"
|
||||
|
||||
@@ -320,7 +316,7 @@ std::string ControllerExporter::add_morph_targets(Key *key, Object *ob)
|
||||
source.setAccessorStride(1);
|
||||
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("IDREF");
|
||||
param.emplace_back("IDREF");
|
||||
|
||||
source.prepareToAppendValues();
|
||||
|
||||
@@ -348,7 +344,7 @@ std::string ControllerExporter::add_morph_weights(Key *key, Object *ob)
|
||||
source.setAccessorStride(1);
|
||||
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("MORPH_WEIGHT");
|
||||
param.emplace_back("MORPH_WEIGHT");
|
||||
|
||||
source.prepareToAppendValues();
|
||||
|
||||
@@ -437,7 +433,7 @@ std::string ControllerExporter::add_joints_source(Object *ob_arm,
|
||||
source.setAccessorStride(1);
|
||||
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("JOINT");
|
||||
param.emplace_back("JOINT");
|
||||
|
||||
source.prepareToAppendValues();
|
||||
|
||||
@@ -474,7 +470,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm,
|
||||
|
||||
source.setParameterTypeName(&COLLADASW::CSWC::CSW_VALUE_TYPE_FLOAT4x4);
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("TRANSFORM");
|
||||
param.emplace_back("TRANSFORM");
|
||||
|
||||
source.prepareToAppendValues();
|
||||
|
||||
@@ -578,7 +574,7 @@ std::string ControllerExporter::add_weights_source(Mesh *mesh,
|
||||
source.setAccessorStride(1);
|
||||
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("WEIGHT");
|
||||
param.emplace_back("WEIGHT");
|
||||
|
||||
source.prepareToAppendValues();
|
||||
|
||||
|
||||
@@ -12,28 +12,21 @@
|
||||
#include <string>
|
||||
// #include <vector>
|
||||
|
||||
#include "COLLADASWExtraTechnique.h"
|
||||
#include "COLLADASWInputList.h"
|
||||
#include "COLLADASWInstanceController.h"
|
||||
#include "COLLADASWLibraryControllers.h"
|
||||
#include "COLLADASWNode.h"
|
||||
#include "COLLADASWStreamWriter.h"
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "InstanceWriter.h"
|
||||
#include "TransformWriter.h"
|
||||
|
||||
#include "ExportSettings.h"
|
||||
|
||||
#include "BKE_key.hh"
|
||||
|
||||
class SceneExporter;
|
||||
|
||||
class ControllerExporter : public COLLADASW::LibraryControllers,
|
||||
|
||||
@@ -6,79 +6,26 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
#include <algorithm> /* std::find */
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
|
||||
#include "COLLADASWAsset.h"
|
||||
#include "COLLADASWBaseInputElement.h"
|
||||
#include "COLLADASWBindMaterial.h"
|
||||
#include "COLLADASWCamera.h"
|
||||
#include "COLLADASWColorOrTexture.h"
|
||||
#include "COLLADASWConstants.h"
|
||||
#include "COLLADASWEffectProfile.h"
|
||||
#include "COLLADASWException.h"
|
||||
#include "COLLADASWImage.h"
|
||||
#include "COLLADASWInputList.h"
|
||||
#include "COLLADASWInstanceCamera.h"
|
||||
#include "COLLADASWInstanceController.h"
|
||||
#include "COLLADASWInstanceGeometry.h"
|
||||
#include "COLLADASWInstanceLight.h"
|
||||
#include "COLLADASWInstanceNode.h"
|
||||
#include "COLLADASWLibraryAnimations.h"
|
||||
#include "COLLADASWLibraryControllers.h"
|
||||
#include "COLLADASWLibraryEffects.h"
|
||||
#include "COLLADASWLibraryImages.h"
|
||||
#include "COLLADASWLibraryMaterials.h"
|
||||
#include "COLLADASWLibraryVisualScenes.h"
|
||||
#include "COLLADASWNode.h"
|
||||
#include "COLLADASWParamBase.h"
|
||||
#include "COLLADASWParamTemplate.h"
|
||||
#include "COLLADASWPrimitves.h"
|
||||
#include "COLLADASWSampler.h"
|
||||
#include "COLLADASWScene.h"
|
||||
#include "COLLADASWSource.h"
|
||||
#include "COLLADASWSurfaceInitOption.h"
|
||||
#include "COLLADASWTechnique.h"
|
||||
#include "COLLADASWTexture.h"
|
||||
#include "COLLADASWVertices.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_collection_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_image_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_action.hh" /* pose functions */
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_appdir.hh"
|
||||
#include "BKE_armature.hh"
|
||||
#include "BKE_blender_version.h"
|
||||
#include "BKE_customdata.hh"
|
||||
#include "BKE_fcurve.hh"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_image.hh"
|
||||
#include "BKE_main.hh"
|
||||
#include "BKE_material.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_scene.hh"
|
||||
|
||||
#include "ED_keyframing.hh"
|
||||
#ifdef WITH_BUILDINFO
|
||||
@@ -94,8 +41,6 @@ extern "C" char build_hash[];
|
||||
#include "collada_utils.h"
|
||||
|
||||
/* can probably go after refactor is complete */
|
||||
#include "InstanceWriter.h"
|
||||
#include "TransformWriter.h"
|
||||
|
||||
#include "AnimationExporter.h"
|
||||
#include "ArmatureExporter.h"
|
||||
|
||||
@@ -9,11 +9,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "BlenderContext.h"
|
||||
#include "collada.h"
|
||||
#include "collada_utils.h"
|
||||
|
||||
#include "DNA_customdata_types.h"
|
||||
|
||||
class DocumentExporter {
|
||||
public:
|
||||
DocumentExporter(BlenderContext &blender_context, ExportSettings *export_settings);
|
||||
|
||||
@@ -10,37 +10,24 @@
|
||||
* * name imported objects
|
||||
* * import object rotation as euler */
|
||||
|
||||
#include <algorithm> /* sort() */
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "COLLADAFWArrayPrimitiveType.h"
|
||||
#include "COLLADAFWCamera.h"
|
||||
#include "COLLADAFWColorOrTexture.h"
|
||||
#include "COLLADAFWIndexList.h"
|
||||
#include "COLLADAFWLibraryNodes.h"
|
||||
#include "COLLADAFWLight.h"
|
||||
#include "COLLADAFWMeshPrimitiveWithFaceVertexCount.h"
|
||||
#include "COLLADAFWPolygons.h"
|
||||
#include "COLLADAFWRoot.h"
|
||||
#include "COLLADAFWSampler.h"
|
||||
#include "COLLADAFWStableHeaders.h"
|
||||
#include "COLLADAFWTypes.h"
|
||||
#include "COLLADAFWVisualScene.h"
|
||||
|
||||
#include "COLLADASaxFWLIExtraDataCallbackHandler.h"
|
||||
#include "COLLADASaxFWLLoader.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_camera.h"
|
||||
#include "BKE_collection.hh"
|
||||
#include "BKE_constraint.h"
|
||||
#include "BKE_fcurve.hh"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_image.hh"
|
||||
@@ -66,7 +53,6 @@
|
||||
#include "DocumentImporter.h"
|
||||
#include "ErrorHandler.h"
|
||||
#include "ExtraHandler.h"
|
||||
#include "TransformReader.h"
|
||||
|
||||
#include "Materials.h"
|
||||
#include "collada_internal.h"
|
||||
|
||||
@@ -8,26 +8,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "COLLADAFWColor.h"
|
||||
#include "COLLADAFWController.h"
|
||||
#include "COLLADAFWEffect.h"
|
||||
#include "COLLADAFWEffectCommon.h"
|
||||
#include "COLLADAFWIWriter.h"
|
||||
#include "COLLADAFWImage.h"
|
||||
#include "COLLADAFWInstanceGeometry.h"
|
||||
#include "COLLADAFWMaterial.h"
|
||||
#include "COLLADAFWMorphController.h"
|
||||
#include "COLLADAFWSkinController.h"
|
||||
|
||||
#include "BKE_constraint.h"
|
||||
#include "BKE_object.hh"
|
||||
|
||||
#include "AnimationImporter.h"
|
||||
#include "ArmatureImporter.h"
|
||||
#include "ControllerExporter.h"
|
||||
#include "ImportSettings.h"
|
||||
#include "MeshImporter.h"
|
||||
#include "TransformReader.h"
|
||||
|
||||
struct bContext;
|
||||
|
||||
@@ -43,7 +34,7 @@ class DocumentImporter : COLLADAFW::IWriter {
|
||||
DocumentImporter(bContext *C, const ImportSettings *import_settings);
|
||||
|
||||
/** Destructor */
|
||||
~DocumentImporter();
|
||||
~DocumentImporter() override;
|
||||
|
||||
/** Function called by blender UI */
|
||||
bool import();
|
||||
@@ -67,22 +58,22 @@ class DocumentImporter : COLLADAFW::IWriter {
|
||||
* continue to load. The writer should undo all operations that have been performed.
|
||||
* \param errorMessage: A message containing information about the error that occurred.
|
||||
*/
|
||||
void cancel(const COLLADAFW::String &errorMessage);
|
||||
void cancel(const COLLADAFW::String &errorMessage) override;
|
||||
|
||||
/** This is the method called. The writer hast to prepare to receive data. */
|
||||
void start();
|
||||
void start() override;
|
||||
|
||||
/**
|
||||
* This method is called after the last write* method.
|
||||
* No other methods will be called after this.
|
||||
*/
|
||||
void finish();
|
||||
void finish() override;
|
||||
|
||||
/**
|
||||
* When this method is called, the writer must write the global document asset.
|
||||
* \return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeGlobalAsset(const COLLADAFW::FileInfo *);
|
||||
bool writeGlobalAsset(const COLLADAFW::FileInfo * /*asset*/) override;
|
||||
/**
|
||||
* If the imported file was made with Blender, return the Blender version used,
|
||||
* otherwise return an empty std::string
|
||||
@@ -93,85 +84,86 @@ class DocumentImporter : COLLADAFW::IWriter {
|
||||
* When this method is called, the writer must write the scene.
|
||||
* \return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeScene(const COLLADAFW::Scene *);
|
||||
bool writeScene(const COLLADAFW::Scene * /*scene*/) override;
|
||||
|
||||
/**
|
||||
* When this method is called, the writer must write the entire visual scene.
|
||||
* Return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeVisualScene(const COLLADAFW::VisualScene *);
|
||||
bool writeVisualScene(const COLLADAFW::VisualScene * /*visualScene*/) override;
|
||||
|
||||
/**
|
||||
* When this method is called, the writer must handle all nodes contained in the
|
||||
* library nodes.
|
||||
* \return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeLibraryNodes(const COLLADAFW::LibraryNodes *);
|
||||
bool writeLibraryNodes(const COLLADAFW::LibraryNodes * /*libraryNodes*/) override;
|
||||
|
||||
/**
|
||||
* This function is called only for animations that pass COLLADAFW::validate.
|
||||
*/
|
||||
bool writeAnimation(const COLLADAFW::Animation *);
|
||||
bool writeAnimation(const COLLADAFW::Animation * /*animation*/) override;
|
||||
|
||||
/**
|
||||
* Called on post-process stage after writeVisualScenes.
|
||||
*/
|
||||
bool writeAnimationList(const COLLADAFW::AnimationList *);
|
||||
bool writeAnimationList(const COLLADAFW::AnimationList * /*animationList*/) override;
|
||||
|
||||
#if WITH_OPENCOLLADA_ANIMATION_CLIP
|
||||
/* Please enable this when building with Collada 1.6.65 or newer (also in DocumentImporter.cpp)
|
||||
*/
|
||||
bool writeAnimationClip(const COLLADAFW::AnimationClip *animationClip);
|
||||
bool writeAnimationClip(const COLLADAFW::AnimationClip *animationClip) override;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* When this method is called, the writer must write the geometry.
|
||||
* \return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeGeometry(const COLLADAFW::Geometry *);
|
||||
bool writeGeometry(const COLLADAFW::Geometry * /*geometry*/) override;
|
||||
|
||||
/**
|
||||
* When this method is called, the writer must write the material.
|
||||
* \return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeMaterial(const COLLADAFW::Material *);
|
||||
bool writeMaterial(const COLLADAFW::Material * /*material*/) override;
|
||||
|
||||
/**
|
||||
* When this method is called, the writer must write the effect.
|
||||
* \return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeEffect(const COLLADAFW::Effect *);
|
||||
bool writeEffect(const COLLADAFW::Effect * /*effect*/) override;
|
||||
|
||||
/**
|
||||
* When this method is called, the writer must write the camera.
|
||||
* \return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeCamera(const COLLADAFW::Camera *);
|
||||
bool writeCamera(const COLLADAFW::Camera * /*camera*/) override;
|
||||
|
||||
/**
|
||||
* When this method is called, the writer must write the image.
|
||||
* \return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeImage(const COLLADAFW::Image *);
|
||||
bool writeImage(const COLLADAFW::Image * /*image*/) override;
|
||||
|
||||
/**
|
||||
* When this method is called, the writer must write the light.
|
||||
* \return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeLight(const COLLADAFW::Light *);
|
||||
bool writeLight(const COLLADAFW::Light * /*light*/) override;
|
||||
|
||||
/**
|
||||
* When this method is called, the writer must write the skin controller data.
|
||||
* \return The writer should return true, if writing succeeded, false otherwise.
|
||||
*/
|
||||
bool writeSkinControllerData(const COLLADAFW::SkinControllerData *);
|
||||
bool writeSkinControllerData(
|
||||
const COLLADAFW::SkinControllerData * /*skinControllerData*/) override;
|
||||
|
||||
/** This is called on post-process, before writeVisualScenes. */
|
||||
bool writeController(const COLLADAFW::Controller *);
|
||||
bool writeController(const COLLADAFW::Controller * /*controller*/) override;
|
||||
|
||||
bool writeFormulas(const COLLADAFW::Formulas *);
|
||||
bool writeFormulas(const COLLADAFW::Formulas * /*formulas*/) override;
|
||||
|
||||
bool writeKinematicsScene(const COLLADAFW::KinematicsScene *);
|
||||
bool writeKinematicsScene(const COLLADAFW::KinematicsScene * /*kinematicsScene*/) override;
|
||||
|
||||
/** Add element and data for UniqueId */
|
||||
bool addExtraTags(const COLLADAFW::UniqueId &uid, ExtraTags *extra_tags);
|
||||
@@ -195,7 +187,7 @@ class DocumentImporter : COLLADAFW::IWriter {
|
||||
AnimationImporter anim_importer;
|
||||
|
||||
/** TagsMap typedef for uid_tags_map. */
|
||||
typedef std::map<std::string, ExtraTags *> TagsMap;
|
||||
using TagsMap = std::map<std::string, ExtraTags *>;
|
||||
/** Tags map of unique id as a string and ExtraTags instance. */
|
||||
TagsMap uid_tags_map;
|
||||
|
||||
|
||||
@@ -7,25 +7,21 @@
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "COLLADAFWColorOrTexture.h"
|
||||
#include "COLLADASWEffectProfile.h"
|
||||
|
||||
#include "DocumentExporter.h"
|
||||
#include "EffectExporter.h"
|
||||
#include "MaterialExporter.h"
|
||||
#include "Materials.h"
|
||||
|
||||
#include "collada_internal.h"
|
||||
#include "collada_utils.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "BKE_collection.hh"
|
||||
#include "BKE_customdata.hh"
|
||||
#include "BKE_material.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
|
||||
static std::string getActiveUVLayerName(Object *ob)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "COLLADASWColorOrTexture.h"
|
||||
#include "COLLADASWLibraryEffects.h"
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm> /* sort() */
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "COLLADASaxFWLIErrorHandler.h"
|
||||
|
||||
/** \brief Handler class for parser errors
|
||||
@@ -23,7 +18,7 @@ class ErrorHandler : public COLLADASaxFWL::IErrorHandler {
|
||||
ErrorHandler();
|
||||
|
||||
/** handle any error thrown by the parser. */
|
||||
bool virtual handleError(const COLLADASaxFWL::IError *error);
|
||||
bool handleError(const COLLADASaxFWL::IError *error) override;
|
||||
/** True if there was an error during parsing. */
|
||||
bool hasError()
|
||||
{
|
||||
|
||||
@@ -18,30 +18,30 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum BC_export_mesh_type {
|
||||
enum BC_export_mesh_type {
|
||||
BC_MESH_TYPE_VIEW,
|
||||
BC_MESH_TYPE_RENDER,
|
||||
} BC_export_mesh_type;
|
||||
};
|
||||
|
||||
typedef enum BC_export_transformation_type {
|
||||
enum BC_export_transformation_type {
|
||||
BC_TRANSFORMATION_TYPE_MATRIX,
|
||||
BC_TRANSFORMATION_TYPE_DECOMPOSED,
|
||||
} BC_export_transformation_type;
|
||||
};
|
||||
|
||||
typedef enum BC_export_animation_type {
|
||||
enum BC_export_animation_type {
|
||||
BC_ANIMATION_EXPORT_SAMPLES,
|
||||
BC_ANIMATION_EXPORT_KEYS,
|
||||
} BC_export_animation_type;
|
||||
};
|
||||
|
||||
typedef enum BC_ui_export_section {
|
||||
enum BC_ui_export_section {
|
||||
BC_UI_SECTION_MAIN,
|
||||
BC_UI_SECTION_GEOMETRY,
|
||||
BC_UI_SECTION_ARMATURE,
|
||||
BC_UI_SECTION_ANIMATION,
|
||||
BC_UI_SECTION_COLLADA,
|
||||
} BC_ui_export_section;
|
||||
};
|
||||
|
||||
typedef struct ExportSettings {
|
||||
struct ExportSettings {
|
||||
bool apply_modifiers;
|
||||
BC_global_forward_axis global_forward;
|
||||
BC_global_up_axis global_up;
|
||||
@@ -78,7 +78,7 @@ typedef struct ExportSettings {
|
||||
|
||||
char *filepath;
|
||||
LinkNode *export_set;
|
||||
} ExportSettings;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
#include "BLI_string.h"
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "ExtraHandler.h"
|
||||
|
||||
|
||||
@@ -8,13 +8,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm> /* sort() */
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "COLLADASWInstanceController.h"
|
||||
#include "COLLADASaxFWLFilePartLoader.h"
|
||||
#include "COLLADASaxFWLIExtraDataCallbackHandler.h"
|
||||
|
||||
#include "AnimationImporter.h"
|
||||
@@ -29,20 +25,20 @@ class ExtraHandler : public COLLADASaxFWL::IExtraDataCallbackHandler {
|
||||
ExtraHandler(DocumentImporter *dimp, AnimationImporter *aimp);
|
||||
|
||||
/** Handle the beginning of an element. */
|
||||
bool elementBegin(const char *elementName, const char **attributes);
|
||||
bool elementBegin(const char *elementName, const char **attributes) override;
|
||||
|
||||
/** Handle the end of an element. */
|
||||
bool elementEnd(const char *elementName);
|
||||
bool elementEnd(const char *elementName) override;
|
||||
|
||||
/** Receive the data in text format. */
|
||||
bool textData(const char *text, size_t textLength);
|
||||
bool textData(const char *text, size_t textLength) override;
|
||||
|
||||
/** Method to ask, if the current callback handler want to read the data of the given extra
|
||||
* element. */
|
||||
bool parseElement(const char *profileName,
|
||||
const unsigned long &elementHash,
|
||||
const COLLADAFW::UniqueId &uniqueId,
|
||||
COLLADAFW::Object *object);
|
||||
COLLADAFW::Object *object) override;
|
||||
|
||||
/** For backwards compatibility with older OpenCollada, new version added object parameter */
|
||||
bool parseElement(const char *profileName,
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
#include "BLI_string.h"
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <iostream>
|
||||
#include <regex>
|
||||
|
||||
#include "ExtraTags.h"
|
||||
|
||||
@@ -15,14 +15,15 @@
|
||||
|
||||
#include "GeometryExporter.h"
|
||||
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_customdata.hh"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_key.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_material.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
@@ -68,7 +69,7 @@ void GeometryExporter::operator()(Object *ob)
|
||||
|
||||
exportedGeometry.insert(geom_id);
|
||||
|
||||
bool has_color = bool(CustomData_has_layer(&mesh->fdata_legacy, CD_MCOL));
|
||||
bool has_color = CustomData_has_layer(&mesh->fdata_legacy, CD_MCOL);
|
||||
|
||||
create_normals(nor, norind, mesh);
|
||||
|
||||
@@ -81,7 +82,7 @@ void GeometryExporter::operator()(Object *ob)
|
||||
/* writes <source> for normal coords */
|
||||
createNormalsSource(geom_id, mesh, nor);
|
||||
|
||||
bool has_uvs = bool(CustomData_has_layer(&mesh->corner_data, CD_PROP_FLOAT2));
|
||||
bool has_uvs = CustomData_has_layer(&mesh->corner_data, CD_PROP_FLOAT2);
|
||||
|
||||
/* writes <source> for uv coords if mesh has uv coords */
|
||||
if (has_uvs) {
|
||||
@@ -152,7 +153,7 @@ void GeometryExporter::export_key_mesh(Object *ob, Mesh *mesh, KeyBlock *kb)
|
||||
|
||||
exportedGeometry.insert(geom_id);
|
||||
|
||||
bool has_color = bool(CustomData_has_layer(&mesh->fdata_legacy, CD_MCOL));
|
||||
bool has_color = CustomData_has_layer(&mesh->fdata_legacy, CD_MCOL);
|
||||
|
||||
create_normals(nor, norind, mesh);
|
||||
|
||||
@@ -165,7 +166,7 @@ void GeometryExporter::export_key_mesh(Object *ob, Mesh *mesh, KeyBlock *kb)
|
||||
/* writes <source> for normal coords */
|
||||
createNormalsSource(geom_id, mesh, nor);
|
||||
|
||||
bool has_uvs = bool(CustomData_has_layer(&mesh->corner_data, CD_PROP_FLOAT2));
|
||||
bool has_uvs = CustomData_has_layer(&mesh->corner_data, CD_PROP_FLOAT2);
|
||||
|
||||
/* writes <source> for uv coords if mesh has uv coords */
|
||||
if (has_uvs) {
|
||||
@@ -452,9 +453,9 @@ void GeometryExporter::createVertsSource(std::string geom_id, Mesh *mesh)
|
||||
source.setAccessorStride(3);
|
||||
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("X");
|
||||
param.push_back("Y");
|
||||
param.push_back("Z");
|
||||
param.emplace_back("X");
|
||||
param.emplace_back("Y");
|
||||
param.emplace_back("Z");
|
||||
/* main function, it creates <source id = "">, <float_array id = ""
|
||||
* count = ""> */
|
||||
source.prepareToAppendValues();
|
||||
@@ -504,10 +505,10 @@ void GeometryExporter::createVertexColorSource(std::string geom_id, Mesh *mesh)
|
||||
source.setAccessorStride(4);
|
||||
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("R");
|
||||
param.push_back("G");
|
||||
param.push_back("B");
|
||||
param.push_back("A");
|
||||
param.emplace_back("R");
|
||||
param.emplace_back("G");
|
||||
param.emplace_back("B");
|
||||
param.emplace_back("A");
|
||||
|
||||
source.prepareToAppendValues();
|
||||
|
||||
@@ -562,8 +563,8 @@ void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *mesh)
|
||||
source.setAccessorCount(totuv);
|
||||
source.setAccessorStride(2);
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("S");
|
||||
param.push_back("T");
|
||||
param.emplace_back("S");
|
||||
param.emplace_back("T");
|
||||
|
||||
source.prepareToAppendValues();
|
||||
|
||||
@@ -594,9 +595,9 @@ void GeometryExporter::createNormalsSource(std::string geom_id,
|
||||
source.setAccessorCount(ulong(nor.size()));
|
||||
source.setAccessorStride(3);
|
||||
COLLADASW::SourceBase::ParameterNameList ¶m = source.getParameterNameList();
|
||||
param.push_back("X");
|
||||
param.push_back("Y");
|
||||
param.push_back("Z");
|
||||
param.emplace_back("X");
|
||||
param.emplace_back("Y");
|
||||
param.emplace_back("Z");
|
||||
|
||||
source.prepareToAppendValues();
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BKE_key.hh"
|
||||
#include "BlenderContext.h"
|
||||
#include "ExportSettings.h"
|
||||
#include "collada_utils.h"
|
||||
|
||||
@@ -10,14 +10,10 @@
|
||||
#include "COLLADASWImage.h"
|
||||
|
||||
#include "DNA_image_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
|
||||
#include "BKE_customdata.hh"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_image.hh"
|
||||
#include "BKE_image_format.hh"
|
||||
#include "BKE_main.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_path_utils.hh"
|
||||
@@ -26,7 +22,6 @@
|
||||
#include "IMB_imbuf_types.hh"
|
||||
|
||||
#include "ImageExporter.h"
|
||||
#include "MaterialExporter.h"
|
||||
|
||||
ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw,
|
||||
BCExportSettings &export_settings,
|
||||
@@ -144,9 +139,6 @@ void ImagesExporter::exportImages(Scene *sce)
|
||||
for (iter = key_image_map.begin(); iter != key_image_map.end(); iter++) {
|
||||
|
||||
Image *image = iter->second;
|
||||
std::string uid(id_name(image));
|
||||
std::string key = translate_id(uid);
|
||||
|
||||
export_UV_Image(image, use_texture_copies);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,15 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "COLLADASWLibraryImages.h"
|
||||
#include "COLLADASWStreamWriter.h"
|
||||
|
||||
#include "DNA_image_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "ExportSettings.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef struct ImportSettings {
|
||||
struct ImportSettings {
|
||||
bool import_units;
|
||||
bool custom_normals;
|
||||
bool find_chains;
|
||||
@@ -17,4 +17,4 @@ typedef struct ImportSettings {
|
||||
int min_chain_length;
|
||||
char *filepath;
|
||||
bool keep_bind_info;
|
||||
} ImportSettings;
|
||||
};
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "ExportSettings.h"
|
||||
#include "GeometryExporter.h"
|
||||
#include "Materials.h"
|
||||
#include "collada_internal.h"
|
||||
|
||||
class MaterialsExporter : COLLADASW::LibraryMaterials {
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
#include "Materials.h"
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_legacy_types.hh"
|
||||
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.hh"
|
||||
|
||||
|
||||
@@ -9,14 +9,13 @@
|
||||
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_node.hh"
|
||||
#include "BLI_listbase.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "COLLADAFWEffectCommon.h"
|
||||
#include "collada_utils.h"
|
||||
|
||||
typedef std::map<std::string, bNode *> NodeMap;
|
||||
using NodeMap = std::map<std::string, bNode *>;
|
||||
|
||||
class MaterialNode {
|
||||
|
||||
|
||||
@@ -6,21 +6,14 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
/* COLLADABU_ASSERT, may be able to remove later */
|
||||
#include "COLLADABUPlatform.h"
|
||||
|
||||
#include "COLLADAFWMeshPrimitive.h"
|
||||
#include "COLLADAFWMeshVertexData.h"
|
||||
#include "COLLADAFWPolygons.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_customdata.hh"
|
||||
#include "BKE_displist.h"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_material.hh"
|
||||
@@ -30,9 +23,6 @@
|
||||
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "ArmatureImporter.h"
|
||||
#include "MeshImporter.h"
|
||||
#include "collada_utils.h"
|
||||
|
||||
@@ -86,7 +86,7 @@ class MeshImporter : public MeshImporterBase {
|
||||
int *material_indices;
|
||||
uint faces_num;
|
||||
};
|
||||
typedef std::map<COLLADAFW::MaterialId, std::vector<Primitive>> MaterialIdPrimitiveArrayMap;
|
||||
using MaterialIdPrimitiveArrayMap = std::map<COLLADAFW::MaterialId, std::vector<Primitive>>;
|
||||
/* crazy name! */
|
||||
std::map<COLLADAFW::UniqueId, MaterialIdPrimitiveArrayMap> geom_uid_mat_mapping_map;
|
||||
/* < materials that have already been mapped to a geometry.
|
||||
@@ -190,9 +190,9 @@ class MeshImporter : public MeshImporterBase {
|
||||
Scene *sce,
|
||||
ViewLayer *view_layer);
|
||||
|
||||
virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId &geom_uid);
|
||||
Object *get_object_by_geom_uid(const COLLADAFW::UniqueId &geom_uid) override;
|
||||
|
||||
virtual Mesh *get_mesh_by_geom_uid(const COLLADAFW::UniqueId &geom_uid);
|
||||
Mesh *get_mesh_by_geom_uid(const COLLADAFW::UniqueId &geom_uid) override;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -234,5 +234,5 @@ class MeshImporter : public MeshImporterBase {
|
||||
|
||||
/** Create a mesh storing a pointer in a map so it can be retrieved later by geometry UID. */
|
||||
bool write_geometry(const COLLADAFW::Geometry *geom);
|
||||
std::string *get_geometry_name(const std::string &mesh_name);
|
||||
std::string *get_geometry_name(const std::string &mesh_name) override;
|
||||
};
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
#include "BKE_collection.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "COLLADASWInstanceCamera.h"
|
||||
#include "COLLADASWInstanceGeometry.h"
|
||||
#include "COLLADASWInstanceLight.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "BKE_collection.hh"
|
||||
#include "BKE_constraint.h"
|
||||
|
||||
#include "BCSampleData.h"
|
||||
#include "SceneExporter.h"
|
||||
#include "collada_utils.h"
|
||||
|
||||
|
||||
@@ -8,61 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_collection_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_image_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BKE_constraint.h"
|
||||
#include "BKE_fcurve.hh"
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "ED_keyframing.hh"
|
||||
|
||||
#include "COLLADASWAsset.h"
|
||||
#include "COLLADASWBaseInputElement.h"
|
||||
#include "COLLADASWBindMaterial.h"
|
||||
#include "COLLADASWColorOrTexture.h"
|
||||
#include "COLLADASWConstants.h"
|
||||
#include "COLLADASWEffectProfile.h"
|
||||
#include "COLLADASWImage.h"
|
||||
#include "COLLADASWInputList.h"
|
||||
#include "COLLADASWInstanceCamera.h"
|
||||
#include "COLLADASWInstanceController.h"
|
||||
#include "COLLADASWInstanceGeometry.h"
|
||||
#include "COLLADASWInstanceLight.h"
|
||||
#include "COLLADASWInstanceNode.h"
|
||||
#include "COLLADASWLibraryAnimations.h"
|
||||
#include "COLLADASWLibraryControllers.h"
|
||||
#include "COLLADASWLibraryEffects.h"
|
||||
#include "COLLADASWLibraryImages.h"
|
||||
#include "COLLADASWLibraryMaterials.h"
|
||||
#include "COLLADASWLibraryVisualScenes.h"
|
||||
#include "COLLADASWNode.h"
|
||||
#include "COLLADASWParamBase.h"
|
||||
#include "COLLADASWParamTemplate.h"
|
||||
#include "COLLADASWPrimitves.h"
|
||||
#include "COLLADASWSampler.h"
|
||||
#include "COLLADASWScene.h"
|
||||
#include "COLLADASWSource.h"
|
||||
#include "COLLADASWSurfaceInitOption.h"
|
||||
#include "COLLADASWTechnique.h"
|
||||
#include "COLLADASWTexture.h"
|
||||
#include "COLLADASWVertices.h"
|
||||
|
||||
#include "ArmatureExporter.h"
|
||||
#include "ExportSettings.h"
|
||||
|
||||
@@ -8,14 +8,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined(WIN32)
|
||||
# include <cstdint>
|
||||
#endif
|
||||
|
||||
/* COLLADABU_ASSERT, may be able to remove later */
|
||||
#include "COLLADABUPlatform.h"
|
||||
|
||||
#include "BLI_compiler_attrs.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
|
||||
|
||||
@@ -6,14 +6,15 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
/* COLLADABU_ASSERT, may be able to remove later */
|
||||
#include "COLLADABUPlatform.h"
|
||||
#include "COLLADAFWMatrix.h"
|
||||
#include "COLLADAFWRotate.h"
|
||||
#include "COLLADAFWScale.h"
|
||||
#include "COLLADAFWTranslate.h"
|
||||
|
||||
#include "TransformReader.h"
|
||||
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_math_rotation.h"
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
TransformReader::TransformReader(UnitConverter *conv) : unit_converter(conv)
|
||||
{
|
||||
|
||||
@@ -8,12 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "COLLADAFWMatrix.h"
|
||||
#include <map>
|
||||
|
||||
#include "COLLADAFWNode.h"
|
||||
#include "COLLADAFWRotate.h"
|
||||
#include "COLLADAFWScale.h"
|
||||
#include "COLLADAFWTransformation.h"
|
||||
#include "COLLADAFWTranslate.h"
|
||||
#include "COLLADAFWUniqueId.h"
|
||||
#include "Math/COLLADABUMathVector3.h"
|
||||
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
*/
|
||||
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_sys_types.h"
|
||||
|
||||
#include "BKE_object.hh"
|
||||
|
||||
#include "TransformWriter.h"
|
||||
|
||||
#include "collada_utils.h"
|
||||
|
||||
void TransformWriter::add_joint_transform(COLLADASW::Node &node,
|
||||
float mat[4][4],
|
||||
float parent_mat[4][4],
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "collada.h"
|
||||
#include "collada_internal.h"
|
||||
#include "collada_utils.h"
|
||||
#include "ExportSettings.h"
|
||||
|
||||
class TransformWriter {
|
||||
protected:
|
||||
|
||||
@@ -6,22 +6,14 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
/* COLLADABU_ASSERT, may be able to remove later */
|
||||
#include "COLLADABUPlatform.h"
|
||||
|
||||
#include "collada.h"
|
||||
#include "DocumentExporter.h"
|
||||
#include "DocumentImporter.h"
|
||||
#include "ExportSettings.h"
|
||||
#include "ImportSettings.h"
|
||||
#include "collada.h"
|
||||
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_scene.hh"
|
||||
#include "DEG_depsgraph.hh"
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
/* make dummy file */
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_linklist.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -8,13 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "ExportSettings.h"
|
||||
#include "ImportSettings.h"
|
||||
|
||||
#include "BLI_linklist.h"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -6,15 +6,17 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
/* COLLADABU_ASSERT, may be able to remove later */
|
||||
#include "COLLADABUPlatform.h"
|
||||
#include "collada_utils.h"
|
||||
#include "collada_internal.h"
|
||||
|
||||
#include "BLI_linklist.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_math_rotation.h"
|
||||
|
||||
#include "BKE_armature.hh"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
|
||||
#include <map>
|
||||
|
||||
UnitConverter::UnitConverter() : up_axis(COLLADAFW::FileInfo::Z_UP)
|
||||
{
|
||||
axis_angle_to_mat4_single(x_up_mat4, 'Y', -M_PI_2);
|
||||
|
||||
@@ -8,14 +8,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "COLLADAFWFileInfo.h"
|
||||
#include "Math/COLLADABUMathMatrix4.h"
|
||||
|
||||
#include "BLI_linklist.h"
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
@@ -45,9 +42,9 @@ class UnitConverter {
|
||||
|
||||
void convertVector3(COLLADABU::Math::Vector3 &vec, float *v);
|
||||
|
||||
UnitConverter::UnitSystem isMetricSystem(void);
|
||||
UnitConverter::UnitSystem isMetricSystem();
|
||||
|
||||
float getLinearMeter(void);
|
||||
float getLinearMeter();
|
||||
|
||||
/* TODO: need also for angle conversion, time conversion... */
|
||||
|
||||
|
||||
@@ -6,19 +6,12 @@
|
||||
* \ingroup collada
|
||||
*/
|
||||
|
||||
/* COLLADABU_ASSERT, may be able to remove later */
|
||||
#include "COLLADABUPlatform.h"
|
||||
|
||||
#include "COLLADAFWGeometry.h"
|
||||
#include "COLLADAFWMeshPrimitive.h"
|
||||
#include "COLLADAFWMeshVertexData.h"
|
||||
#include "COLLADAFWNode.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_customdata_types.h"
|
||||
@@ -31,6 +24,7 @@
|
||||
#include "BLI_linklist.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_action.hh"
|
||||
#include "BKE_armature.hh"
|
||||
@@ -38,6 +32,7 @@
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_customdata.hh"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_idprop.hh"
|
||||
#include "BKE_key.hh"
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
@@ -655,7 +650,7 @@ int BoneExtended::get_use_connect()
|
||||
|
||||
void bc_set_IDPropertyMatrix(EditBone *ebone, const char *key, float mat[4][4])
|
||||
{
|
||||
IDProperty *idgroup = (IDProperty *)ebone->prop;
|
||||
IDProperty *idgroup = ebone->prop;
|
||||
if (idgroup == nullptr) {
|
||||
idgroup = blender::bke::idprop::create_group("RNA_EditBone ID properties").release();
|
||||
ebone->prop = idgroup;
|
||||
@@ -701,7 +696,7 @@ float bc_get_property(Bone *bone, std::string key, float def)
|
||||
result = float(IDP_Int(property));
|
||||
break;
|
||||
case IDP_FLOAT:
|
||||
result = float(IDP_Float(property));
|
||||
result = IDP_Float(property);
|
||||
break;
|
||||
case IDP_DOUBLE:
|
||||
result = float(IDP_Double(property));
|
||||
|
||||
@@ -8,12 +8,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "COLLADAFWColorOrTexture.h"
|
||||
#include "COLLADAFWFloatOrDoubleArray.h"
|
||||
#include "COLLADAFWGeometry.h"
|
||||
#include "COLLADAFWMeshPrimitive.h"
|
||||
#include "COLLADAFWTypes.h"
|
||||
#include "COLLADASWEffectProfile.h"
|
||||
#include "COLLADASWColorOrTexture.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
@@ -34,30 +31,24 @@
|
||||
#include "RNA_access.hh"
|
||||
|
||||
#include "BLI_linklist.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_idprop.hh"
|
||||
#include "BKE_main.hh"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_scene.hh"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
#include "BCSampleData.h"
|
||||
#include "BlenderContext.h"
|
||||
#include "ExportSettings.h"
|
||||
#include "ImportSettings.h"
|
||||
#include "collada_internal.h"
|
||||
|
||||
constexpr int LIMITTED_PRECISION = 6;
|
||||
|
||||
typedef std::map<COLLADAFW::UniqueId, Image *> UidImageMap;
|
||||
typedef std::map<std::string, Image *> KeyImageMap;
|
||||
typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex *>> TexIndexTextureArrayMap;
|
||||
typedef std::set<Object *> BCObjectSet;
|
||||
using UidImageMap = std::map<COLLADAFW::UniqueId, Image *>;
|
||||
using KeyImageMap = std::map<std::string, Image *>;
|
||||
using TexIndexTextureArrayMap = std::map<COLLADAFW::TextureMapId, std::vector<MTex *>>;
|
||||
using BCObjectSet = std::set<Object *>;
|
||||
|
||||
namespace COLLADAFW {
|
||||
class Node;
|
||||
@@ -72,39 +63,39 @@ std::vector<bAction *> bc_getSceneActions(const bContext *C, Object *ob, bool al
|
||||
|
||||
/* Action and Animdata helpers */
|
||||
|
||||
/* Return Object's Action or NULL. */
|
||||
/* Return Object's Action or nullptr. */
|
||||
inline bAction *bc_getSceneObjectAction(Object *ob)
|
||||
{
|
||||
return (ob->adt && ob->adt->action) ? ob->adt->action : NULL;
|
||||
return (ob->adt && ob->adt->action) ? ob->adt->action : nullptr;
|
||||
}
|
||||
|
||||
/* Return Light's AnimData or NULL. */
|
||||
/* Return Light's AnimData or nullptr. */
|
||||
inline AnimData *bc_getSceneLightAnimData(Object *ob)
|
||||
{
|
||||
if (ob->type != OB_LAMP) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Light *lamp = (Light *)ob->data;
|
||||
return lamp->adt;
|
||||
}
|
||||
|
||||
/* Return Camera's AnimData or NULL. */
|
||||
/* Return Camera's AnimData or nullptr. */
|
||||
inline AnimData *bc_getSceneCameraAnimData(Object *ob)
|
||||
{
|
||||
if (ob->type != OB_CAMERA) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Camera *camera = (const Camera *)ob->data;
|
||||
return camera->adt;
|
||||
}
|
||||
|
||||
/* Return Material's AnimData or NULL. */
|
||||
/* Return Material's AnimData or nullptr. */
|
||||
inline AnimData *bc_getSceneMaterialAnimData(Material *ma)
|
||||
{
|
||||
if (ma == NULL) {
|
||||
return NULL;
|
||||
if (ma == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return ma->adt;
|
||||
@@ -412,7 +403,7 @@ class BoneExtended {
|
||||
* std:string : an armature name
|
||||
* BoneExtended * : a map that contains extra data for bones
|
||||
*/
|
||||
typedef std::map<std::string, BoneExtended *> BoneExtensionMap;
|
||||
using BoneExtensionMap = std::map<std::string, BoneExtended *>;
|
||||
|
||||
/*
|
||||
* A class to organize bone extension data for multiple Armatures.
|
||||
|
||||
@@ -209,16 +209,16 @@ bool operator==(const ObjectIdentifier &obj_ident_a, const ObjectIdentifier &obj
|
||||
class AbstractHierarchyIterator {
|
||||
public:
|
||||
/* Mapping from export path to writer. */
|
||||
typedef std::map<std::string, AbstractHierarchyWriter *> WriterMap;
|
||||
using WriterMap = std::map<std::string, AbstractHierarchyWriter *>;
|
||||
/* All the children of some object, as per the export hierarchy. */
|
||||
typedef std::set<HierarchyContext *> ExportChildren;
|
||||
using ExportChildren = std::set<HierarchyContext *>;
|
||||
/* Mapping from an object and its duplicator to the object's export-children. */
|
||||
typedef std::map<ObjectIdentifier, ExportChildren> ExportGraph;
|
||||
using ExportGraph = std::map<ObjectIdentifier, ExportChildren>;
|
||||
/* Mapping from ID to its export path. This is used for instancing; given an
|
||||
* instanced datablock, the export path of the original can be looked up. */
|
||||
typedef std::map<ID *, std::string> ExportPathMap;
|
||||
using ExportPathMap = std::map<ID *, std::string>;
|
||||
/* IDs of all duplisource objects, used to identify instance prototypes. */
|
||||
typedef std::set<ID *> DupliSources;
|
||||
using DupliSources = std::set<ID *>;
|
||||
|
||||
protected:
|
||||
ExportGraph export_graph_;
|
||||
@@ -297,8 +297,8 @@ class AbstractHierarchyIterator {
|
||||
std::string get_object_name(const Object *object) const;
|
||||
std::string get_object_data_name(const Object *object) const;
|
||||
|
||||
typedef AbstractHierarchyWriter *(AbstractHierarchyIterator::*create_writer_func)(
|
||||
const HierarchyContext *);
|
||||
using create_writer_func =
|
||||
AbstractHierarchyWriter *(AbstractHierarchyIterator::*)(const HierarchyContext *);
|
||||
/* Ensure that a writer exists; if it doesn't, call create_func(context).
|
||||
*
|
||||
* The create_func function should be one of the create_XXXX_writer(context) functions declared
|
||||
|
||||
@@ -20,11 +20,11 @@ class DupliParentFinder final {
|
||||
std::set<const Object *> dupli_set_;
|
||||
|
||||
/* To find the DupliObject given its Persistent ID. */
|
||||
typedef std::map<const PersistentID, const DupliObject *> PIDToDupliMap;
|
||||
using PIDToDupliMap = std::map<const PersistentID, const DupliObject *>;
|
||||
PIDToDupliMap pid_to_dupli_;
|
||||
|
||||
/* Mapping from instancer PID to duplis instanced by it. */
|
||||
typedef std::map<const PersistentID, std::set<const DupliObject *>> InstancerPIDToDuplisMap;
|
||||
using InstancerPIDToDuplisMap = std::map<const PersistentID, std::set<const DupliObject *>>;
|
||||
InstancerPIDToDuplisMap instancer_pid_to_duplis_;
|
||||
|
||||
public:
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
#include "IO_subdiv_disabler.hh"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_bounds.hh"
|
||||
#include "BLI_color.hh"
|
||||
#include "BLI_math_matrix.hh"
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
@@ -2,20 +2,16 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_curves.hh"
|
||||
#include "BLI_bounds.hh"
|
||||
|
||||
#include "BKE_grease_pencil.hh"
|
||||
#include "BKE_material.hh"
|
||||
#include "BKE_scene.hh"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
#include "DNA_grease_pencil_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "ED_view3d.hh"
|
||||
|
||||
#include "grease_pencil_io.hh"
|
||||
#include "grease_pencil_io_intern.hh"
|
||||
|
||||
|
||||
@@ -2,35 +2,22 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_curves.hh"
|
||||
#include "BKE_material.hh"
|
||||
#include "BLI_bounds.hh"
|
||||
#include "BLI_color.hh"
|
||||
#include "BLI_math_matrix.hh"
|
||||
#include "BLI_offset_indices.hh"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_task.hh"
|
||||
#include "BLI_vector.hh"
|
||||
#include "BLI_virtual_array.hh"
|
||||
|
||||
#include "BKE_grease_pencil.hh"
|
||||
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
#include "DNA_view3d_types.h"
|
||||
|
||||
#include "GEO_resample_curves.hh"
|
||||
|
||||
#include "ED_grease_pencil.hh"
|
||||
#include "ED_view3d.hh"
|
||||
|
||||
#include "grease_pencil_io_intern.hh"
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include <fmt/format.h>
|
||||
#include <numeric>
|
||||
#include <optional>
|
||||
#include <pugixml.hpp>
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
#include "GEO_resample_curves.hh"
|
||||
|
||||
#include "ED_grease_pencil.hh"
|
||||
|
||||
#include "grease_pencil_io_intern.hh"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_bounds.hh"
|
||||
#include "BLI_bounds_types.hh"
|
||||
#include "BLI_color.hh"
|
||||
#include "BLI_function_ref.hh"
|
||||
#include "BLI_math_matrix_types.hh"
|
||||
|
||||
@@ -84,13 +84,13 @@ void exporter_main(bContext *C, const PLYExportParams &export_params)
|
||||
return;
|
||||
}
|
||||
|
||||
write_header(*buffer.get(), *plyData.get(), export_params);
|
||||
write_header(*buffer, *plyData, export_params);
|
||||
|
||||
write_vertices(*buffer.get(), *plyData.get());
|
||||
write_vertices(*buffer, *plyData);
|
||||
|
||||
write_faces(*buffer.get(), *plyData.get());
|
||||
write_faces(*buffer, *plyData);
|
||||
|
||||
write_edges(*buffer.get(), *plyData.get());
|
||||
write_edges(*buffer, *plyData);
|
||||
|
||||
buffer->close_file();
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "BLI_string_ref.hh"
|
||||
#include "BLI_utility_mixins.hh"
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_math_rotation.h"
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_span.hh"
|
||||
#include "BLI_string.h"
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
@@ -69,9 +70,7 @@ bool PlyReadBuffer::read_bytes(void *dst, size_t size)
|
||||
}
|
||||
}
|
||||
int to_copy = int(size);
|
||||
if (to_copy > buf_used_) {
|
||||
to_copy = buf_used_;
|
||||
}
|
||||
to_copy = std::min(to_copy, buf_used_);
|
||||
memcpy(dst, buffer_.data() + pos_, to_copy);
|
||||
pos_ += to_copy;
|
||||
dst = (char *)dst + to_copy;
|
||||
|
||||
@@ -41,7 +41,6 @@ class PlyReadBuffer {
|
||||
private:
|
||||
bool refill_buffer();
|
||||
|
||||
private:
|
||||
FILE *file_ = nullptr;
|
||||
Array<char> buffer_;
|
||||
int pos_ = 0;
|
||||
|
||||
@@ -261,8 +261,9 @@ static const char *load_vertex_element(PlyReadBuffer &file,
|
||||
const PlyProperty &prop = element.properties[prop_idx];
|
||||
bool is_standard = ELEM(
|
||||
prop.name, "x", "y", "z", "nx", "ny", "nz", "red", "green", "blue", "alpha", "s", "t");
|
||||
if (is_standard)
|
||||
if (is_standard) {
|
||||
continue;
|
||||
}
|
||||
|
||||
custom_attr_indices.append(prop_idx);
|
||||
PlyCustomAttribute attr(prop.name, element.count);
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_mesh_runtime.hh"
|
||||
|
||||
#include "GEO_mesh_merge_by_distance.hh"
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ static std::string read_temp_file_in_string(const std::string &file_path)
|
||||
static char read(std::ifstream &file)
|
||||
{
|
||||
char return_val;
|
||||
file.read((char *)&return_val, sizeof(return_val));
|
||||
file.read(&return_val, sizeof(return_val));
|
||||
return return_val;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ TEST_F(PLYExportTest, WriteHeaderAscii)
|
||||
|
||||
std::unique_ptr<FileBuffer> buffer = std::make_unique<FileBufferAscii>(_params.filepath);
|
||||
|
||||
write_header(*buffer.get(), *plyData.get(), _params);
|
||||
write_header(*buffer, *plyData, _params);
|
||||
|
||||
buffer->close_file();
|
||||
|
||||
@@ -184,7 +184,7 @@ TEST_F(PLYExportTest, WriteHeaderBinary)
|
||||
|
||||
std::unique_ptr<FileBuffer> buffer = std::make_unique<FileBufferBinary>(_params.filepath);
|
||||
|
||||
write_header(*buffer.get(), *plyData.get(), _params);
|
||||
write_header(*buffer, *plyData, _params);
|
||||
|
||||
buffer->close_file();
|
||||
|
||||
@@ -222,7 +222,7 @@ TEST_F(PLYExportTest, WriteVerticesAscii)
|
||||
|
||||
std::unique_ptr<FileBuffer> buffer = std::make_unique<FileBufferAscii>(_params.filepath);
|
||||
|
||||
write_vertices(*buffer.get(), *plyData.get());
|
||||
write_vertices(*buffer, *plyData);
|
||||
|
||||
buffer->close_file();
|
||||
|
||||
@@ -254,7 +254,7 @@ TEST_F(PLYExportTest, WriteVerticesBinary)
|
||||
|
||||
std::unique_ptr<FileBuffer> buffer = std::make_unique<FileBufferBinary>(_params.filepath);
|
||||
|
||||
write_vertices(*buffer.get(), *plyData.get());
|
||||
write_vertices(*buffer, *plyData);
|
||||
|
||||
buffer->close_file();
|
||||
|
||||
@@ -290,7 +290,7 @@ TEST_F(PLYExportTest, WriteFacesAscii)
|
||||
|
||||
std::unique_ptr<FileBuffer> buffer = std::make_unique<FileBufferAscii>(_params.filepath);
|
||||
|
||||
write_faces(*buffer.get(), *plyData.get());
|
||||
write_faces(*buffer, *plyData);
|
||||
|
||||
buffer->close_file();
|
||||
|
||||
@@ -320,7 +320,7 @@ TEST_F(PLYExportTest, WriteFacesBinary)
|
||||
|
||||
std::unique_ptr<FileBuffer> buffer = std::make_unique<FileBufferBinary>(_params.filepath);
|
||||
|
||||
write_faces(*buffer.get(), *plyData.get());
|
||||
write_faces(*buffer, *plyData);
|
||||
|
||||
buffer->close_file();
|
||||
|
||||
@@ -356,7 +356,7 @@ TEST_F(PLYExportTest, WriteVertexNormalsAscii)
|
||||
|
||||
std::unique_ptr<FileBuffer> buffer = std::make_unique<FileBufferAscii>(_params.filepath);
|
||||
|
||||
write_vertices(*buffer.get(), *plyData.get());
|
||||
write_vertices(*buffer, *plyData);
|
||||
|
||||
buffer->close_file();
|
||||
|
||||
@@ -388,7 +388,7 @@ TEST_F(PLYExportTest, WriteVertexNormalsBinary)
|
||||
|
||||
std::unique_ptr<FileBuffer> buffer = std::make_unique<FileBufferBinary>(_params.filepath);
|
||||
|
||||
write_vertices(*buffer.get(), *plyData.get());
|
||||
write_vertices(*buffer, *plyData);
|
||||
|
||||
buffer->close_file();
|
||||
|
||||
|
||||
@@ -5,13 +5,10 @@
|
||||
#include "tests/blendfile_loading_base_test.h"
|
||||
|
||||
#include "BKE_appdir.hh"
|
||||
#include "BKE_main.hh"
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BLO_readfile.hh"
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@@ -86,10 +86,10 @@ pxr::VtValue CurvesData::get_data(pxr::TfToken const &key) const
|
||||
if (key == pxr::HdTokens->points) {
|
||||
return pxr::VtValue(vertices_);
|
||||
}
|
||||
else if (key == pxr::HdTokens->widths) {
|
||||
if (key == pxr::HdTokens->widths) {
|
||||
return pxr::VtValue(widths_);
|
||||
}
|
||||
else if (key == usdtokens::st) {
|
||||
if (key == usdtokens::st) {
|
||||
return pxr::VtValue(uvs_);
|
||||
}
|
||||
return pxr::VtValue();
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
|
||||
#include "BLI_set.hh"
|
||||
|
||||
#include "BKE_duplilist.hh"
|
||||
|
||||
#include "DNA_curves_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
|
||||
#include "material.hh"
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
|
||||
#include <bitset>
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
|
||||
#include "BKE_duplilist.hh"
|
||||
#include "BKE_particle.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_set.hh"
|
||||
#include "BLI_string.h"
|
||||
|
||||
@@ -287,7 +289,7 @@ ObjectData *HydraSceneDelegate::object_data(pxr::SdfPath const &id) const
|
||||
pxr::SdfPath p_id = (STRPREFIX(name.c_str(), "SM_") || STRPREFIX(name.c_str(), "VF_")) ?
|
||||
id.GetParentPath() :
|
||||
id;
|
||||
auto obj_data = objects_.lookup_ptr(p_id);
|
||||
const auto *obj_data = objects_.lookup_ptr(p_id);
|
||||
if (obj_data) {
|
||||
return obj_data->get();
|
||||
}
|
||||
@@ -320,7 +322,7 @@ LightData *HydraSceneDelegate::light_data(pxr::SdfPath const &id) const
|
||||
|
||||
MaterialData *HydraSceneDelegate::material_data(pxr::SdfPath const &id) const
|
||||
{
|
||||
auto mat_data = materials_.lookup_ptr(id);
|
||||
const auto *mat_data = materials_.lookup_ptr(id);
|
||||
if (!mat_data) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <pxr/base/gf/vec2f.h>
|
||||
#include <pxr/imaging/hd/sceneDelegate.h>
|
||||
|
||||
#include "BLI_map.hh"
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
|
||||
#include "CLG_log.h"
|
||||
@@ -19,7 +17,6 @@
|
||||
#include "mesh.hh"
|
||||
#include "object.hh"
|
||||
#include "volume.hh"
|
||||
#include "volume_modifier.hh"
|
||||
#include "world.hh"
|
||||
|
||||
struct Depsgraph;
|
||||
@@ -96,7 +93,7 @@ class HydraSceneDelegate : public pxr::HdSceneDelegate {
|
||||
pxr::SdfPath prim_id(const ID *id, const char *prefix) const;
|
||||
pxr::SdfPath object_prim_id(const Object *object) const;
|
||||
pxr::SdfPath material_prim_id(const Material *mat) const;
|
||||
pxr::SdfPath hair_prim_id(Object *parent_obj, const ParticleSystem *mat) const;
|
||||
pxr::SdfPath hair_prim_id(Object *parent_obj, const ParticleSystem *psys) const;
|
||||
pxr::SdfPath instancer_prim_id() const;
|
||||
pxr::SdfPath world_prim_id() const;
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#include "id.hh"
|
||||
|
||||
#include "BKE_lib_id.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
IdData::IdData(HydraSceneDelegate *scene_delegate, const ID *id, pxr::SdfPath const &prim_id)
|
||||
|
||||
@@ -11,16 +11,12 @@
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_appdir.hh"
|
||||
#include "BKE_image.hh"
|
||||
#include "BKE_image_format.hh"
|
||||
#include "BKE_image_save.hh"
|
||||
#include "BKE_main.hh"
|
||||
#include "BKE_packedFile.hh"
|
||||
|
||||
#include "IMB_imbuf.hh"
|
||||
#include "IMB_imbuf_types.hh"
|
||||
|
||||
#include "hydra_scene_delegate.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
#include <pxr/base/gf/vec2f.h>
|
||||
#include <pxr/imaging/hd/light.h>
|
||||
|
||||
#include "BKE_duplilist.hh"
|
||||
#include "BKE_particle.h"
|
||||
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
@@ -101,7 +102,7 @@ ObjectData *InstancerData::object_data(pxr::SdfPath const &id) const
|
||||
pxr::SdfPathVector InstancerData::prototypes() const
|
||||
{
|
||||
pxr::SdfPathVector paths;
|
||||
for (auto &m_inst : mesh_instances_.values()) {
|
||||
for (const auto &m_inst : mesh_instances_.values()) {
|
||||
for (auto &p : m_inst.data->submesh_paths()) {
|
||||
paths.push_back(p);
|
||||
}
|
||||
@@ -111,10 +112,10 @@ pxr::SdfPathVector InstancerData::prototypes() const
|
||||
|
||||
void InstancerData::available_materials(Set<pxr::SdfPath> &paths) const
|
||||
{
|
||||
for (auto &m_inst : mesh_instances_.values()) {
|
||||
for (const auto &m_inst : mesh_instances_.values()) {
|
||||
m_inst.data->available_materials(paths);
|
||||
}
|
||||
for (auto &l_inst : nonmesh_instances_.values()) {
|
||||
for (const auto &l_inst : nonmesh_instances_.values()) {
|
||||
l_inst.data->available_materials(paths);
|
||||
}
|
||||
}
|
||||
@@ -299,8 +300,8 @@ void InstancerData::update_nonmesh_instance(NonmeshInstance &nm_inst)
|
||||
|
||||
InstancerData::MeshInstance *InstancerData::mesh_instance(pxr::SdfPath const &id) const
|
||||
{
|
||||
auto m_inst = mesh_instances_.lookup_ptr(id.GetPathElementCount() == 4 ? id.GetParentPath() :
|
||||
id);
|
||||
const auto *m_inst = mesh_instances_.lookup_ptr(
|
||||
id.GetPathElementCount() == 4 ? id.GetParentPath() : id);
|
||||
if (!m_inst) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -309,8 +310,8 @@ InstancerData::MeshInstance *InstancerData::mesh_instance(pxr::SdfPath const &id
|
||||
|
||||
InstancerData::NonmeshInstance *InstancerData::nonmesh_instance(pxr::SdfPath const &id) const
|
||||
{
|
||||
auto nm_inst = nonmesh_instances_.lookup_ptr(id.GetPathElementCount() == 4 ? id.GetParentPath() :
|
||||
id);
|
||||
const auto *nm_inst = nonmesh_instances_.lookup_ptr(
|
||||
id.GetPathElementCount() == 4 ? id.GetParentPath() : id);
|
||||
if (!nm_inst) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "mesh.hh"
|
||||
|
||||
struct DupliObject;
|
||||
struct ParticleSystem;
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
@@ -19,19 +19,8 @@
|
||||
# include <pxr/usd/usdMtlx/utils.h>
|
||||
#endif
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_material.hh"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_prototypes.hh"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
#include "bpy_rna.hh"
|
||||
|
||||
#include "hydra_scene_delegate.hh"
|
||||
#include "image.hh"
|
||||
|
||||
@@ -39,7 +28,6 @@
|
||||
#include "intern/usd_writer_material.hh"
|
||||
|
||||
#ifdef WITH_MATERIALX
|
||||
# include "shader/materialx/node_parser.h"
|
||||
|
||||
# include "shader/materialx/material.h"
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "BKE_customdata.hh"
|
||||
#include "BKE_material.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_mesh_runtime.hh"
|
||||
|
||||
#include "hydra_scene_delegate.hh"
|
||||
#include "mesh.hh"
|
||||
@@ -120,7 +119,7 @@ pxr::SdfPath MeshData::material_id(pxr::SdfPath const &id) const
|
||||
|
||||
void MeshData::available_materials(Set<pxr::SdfPath> &paths) const
|
||||
{
|
||||
for (auto &sm : submeshes_) {
|
||||
for (const auto &sm : submeshes_) {
|
||||
if (sm.mat_data && !sm.mat_data->prim_id.IsEmpty()) {
|
||||
paths.add(sm.mat_data->prim_id);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "BLI_set.hh"
|
||||
|
||||
#include "BKE_duplilist.hh"
|
||||
|
||||
#include "material.hh"
|
||||
#include "object.hh"
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BKE_layer.hh"
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
#include "curves.hh"
|
||||
@@ -10,6 +12,7 @@
|
||||
#include "mesh.hh"
|
||||
#include "object.hh"
|
||||
#include "volume.hh"
|
||||
#include "volume_modifier.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_set.hh"
|
||||
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_object.hh"
|
||||
|
||||
#include "id.hh"
|
||||
@@ -25,7 +24,6 @@ class ObjectData : public IdData {
|
||||
pxr::GfMatrix4d transform;
|
||||
bool visible = true;
|
||||
|
||||
public:
|
||||
ObjectData(HydraSceneDelegate *scene_delegate,
|
||||
const Object *object,
|
||||
pxr::SdfPath const &prim_id);
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <pxr/usdImaging/usdVolImaging/tokens.h>
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_volume_types.h"
|
||||
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_string.h"
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "BLI_math_rotation.h"
|
||||
#include "BLI_path_utils.hh"
|
||||
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_node_legacy_types.hh"
|
||||
@@ -65,7 +65,7 @@ void WorldData::init()
|
||||
const Span<bNodeSocket *> input_sockets = output_node->input_sockets();
|
||||
bNodeSocket *input_socket = nullptr;
|
||||
|
||||
for (auto socket : input_sockets) {
|
||||
for (auto *socket : input_sockets) {
|
||||
if (STREQ(socket->name, "Surface")) {
|
||||
input_socket = socket;
|
||||
break;
|
||||
|
||||
@@ -4,17 +4,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <pxr/base/gf/matrix4d.h>
|
||||
#include <pxr/base/tf/staticTokens.h>
|
||||
#include <pxr/base/vt/value.h>
|
||||
#include <pxr/usd/sdf/assetPath.h>
|
||||
#include <pxr/usd/sdf/path.h>
|
||||
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "light.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
@@ -394,7 +394,7 @@ bool should_import_asset(const std::string &path)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_udim_path(path) && parent_dir_exists_on_file_system(path.c_str())) {
|
||||
if (is_udim_path(path) && parent_dir_exists_on_file_system(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "usd_attribute_utils.hh"
|
||||
#include "usd_hash_types.hh"
|
||||
|
||||
#include "BLI_generic_span.hh"
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_offset_indices.hh"
|
||||
#include "BLI_sys_types.h"
|
||||
|
||||
@@ -432,10 +432,12 @@ pxr::UsdStageRefPtr export_to_stage(const USDExportParams ¶ms,
|
||||
|
||||
pxr::VtValue upAxis = pxr::VtValue(pxr::UsdGeomTokens->z);
|
||||
if (params.convert_orientation) {
|
||||
if (params.up_axis == IO_AXIS_X)
|
||||
if (params.up_axis == IO_AXIS_X) {
|
||||
upAxis = pxr::VtValue(pxr::UsdGeomTokens->x);
|
||||
else if (params.up_axis == IO_AXIS_Y)
|
||||
}
|
||||
else if (params.up_axis == IO_AXIS_Y) {
|
||||
upAxis = pxr::VtValue(pxr::UsdGeomTokens->y);
|
||||
}
|
||||
}
|
||||
|
||||
usd_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, upAxis);
|
||||
|
||||
@@ -520,7 +520,7 @@ void USD_read_geometry(CacheReader *reader,
|
||||
return;
|
||||
}
|
||||
|
||||
return usd_reader->read_geometry(geometry_set, params, r_err_str);
|
||||
usd_reader->read_geometry(geometry_set, params, r_err_str);
|
||||
}
|
||||
|
||||
bool USD_mesh_topology_changed(CacheReader *reader,
|
||||
|
||||
@@ -41,21 +41,19 @@ class USDHierarchyIterator : public AbstractHierarchyIterator {
|
||||
|
||||
void set_export_frame(float frame_nr);
|
||||
|
||||
virtual std::string make_valid_name(const std::string &name) const override;
|
||||
std::string make_valid_name(const std::string &name) const override;
|
||||
|
||||
void process_usd_skel() const;
|
||||
|
||||
protected:
|
||||
virtual bool mark_as_weak_export(const Object *object) const override;
|
||||
bool mark_as_weak_export(const Object *object) const override;
|
||||
|
||||
virtual AbstractHierarchyWriter *create_transform_writer(
|
||||
const HierarchyContext *context) override;
|
||||
virtual AbstractHierarchyWriter *create_data_writer(const HierarchyContext *context) override;
|
||||
virtual AbstractHierarchyWriter *create_hair_writer(const HierarchyContext *context) override;
|
||||
virtual AbstractHierarchyWriter *create_particle_writer(
|
||||
const HierarchyContext *context) override;
|
||||
AbstractHierarchyWriter *create_transform_writer(const HierarchyContext *context) override;
|
||||
AbstractHierarchyWriter *create_data_writer(const HierarchyContext *context) override;
|
||||
AbstractHierarchyWriter *create_hair_writer(const HierarchyContext *context) override;
|
||||
AbstractHierarchyWriter *create_particle_writer(const HierarchyContext *context) override;
|
||||
|
||||
virtual void release_writer(AbstractHierarchyWriter *writer) override;
|
||||
void release_writer(AbstractHierarchyWriter *writer) override;
|
||||
|
||||
virtual bool include_data_writers(const HierarchyContext *context) const override;
|
||||
virtual bool include_child_writers(const HierarchyContext *context) const override;
|
||||
|
||||
@@ -144,9 +144,7 @@ struct USDSceneImportContext {
|
||||
|
||||
void release()
|
||||
{
|
||||
if (prim_map_dict) {
|
||||
delete prim_map_dict;
|
||||
}
|
||||
delete prim_map_dict;
|
||||
}
|
||||
|
||||
pxr::UsdStageRefPtr get_stage() const
|
||||
@@ -165,7 +163,7 @@ struct USDSceneImportContext {
|
||||
}
|
||||
PYTHON_NS::list list = PYTHON_NS::extract<PYTHON_NS::list>((*prim_map_dict)[path]);
|
||||
|
||||
for (auto &ptr_rna : ids) {
|
||||
for (const auto &ptr_rna : ids) {
|
||||
list.append(ptr_rna);
|
||||
}
|
||||
});
|
||||
@@ -507,7 +505,7 @@ class MaterialImportPollInvoker : public USDHookInvoker {
|
||||
private:
|
||||
USDMaterialImportContext hook_context_;
|
||||
pxr::UsdShadeMaterial usd_material_;
|
||||
bool result_;
|
||||
bool result_ = false;
|
||||
|
||||
public:
|
||||
MaterialImportPollInvoker(pxr::UsdStageRefPtr stage,
|
||||
@@ -516,8 +514,7 @@ class MaterialImportPollInvoker : public USDHookInvoker {
|
||||
ReportList *reports)
|
||||
: USDHookInvoker(reports),
|
||||
hook_context_(stage, import_params, reports),
|
||||
usd_material_(usd_material),
|
||||
result_(false)
|
||||
usd_material_(usd_material)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -548,7 +545,7 @@ class OnMaterialImportInvoker : public USDHookInvoker {
|
||||
USDMaterialImportContext hook_context_;
|
||||
pxr::UsdShadeMaterial usd_material_;
|
||||
PointerRNA material_ptr_;
|
||||
bool result_;
|
||||
bool result_ = false;
|
||||
|
||||
public:
|
||||
OnMaterialImportInvoker(pxr::UsdStageRefPtr stage,
|
||||
@@ -558,8 +555,7 @@ class OnMaterialImportInvoker : public USDHookInvoker {
|
||||
ReportList *reports)
|
||||
: USDHookInvoker(reports),
|
||||
hook_context_(stage, import_params, reports),
|
||||
usd_material_(usd_material),
|
||||
result_(false)
|
||||
usd_material_(usd_material)
|
||||
{
|
||||
material_ptr_ = RNA_pointer_create_discrete(nullptr, &RNA_Material, material);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "usd_reader_utils.hh"
|
||||
#include "usd_utils.hh"
|
||||
|
||||
#include "BKE_appdir.hh"
|
||||
#include "BKE_image.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_main.hh"
|
||||
@@ -22,7 +21,6 @@
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_string_utils.hh"
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
#include "DNA_material_types.h"
|
||||
@@ -687,62 +685,61 @@ bool USDMaterialReader::set_node_input(const pxr::UsdShadeInput &usd_input,
|
||||
* and attempt to convert the connected USD shader to a Blender node. */
|
||||
return follow_connection(usd_input, dest_node, dest_socket_name, ntree, column, r_ctx, extra);
|
||||
}
|
||||
else {
|
||||
/* Set the destination node socket value from the USD shader input value. */
|
||||
|
||||
bNodeSocket *sock = blender::bke::node_find_socket(dest_node, SOCK_IN, dest_socket_name);
|
||||
if (!sock) {
|
||||
CLOG_ERROR(&LOG, "Couldn't get destination node socket %s", dest_socket_name);
|
||||
return false;
|
||||
}
|
||||
/* Set the destination node socket value from the USD shader input value. */
|
||||
|
||||
pxr::VtValue val;
|
||||
if (!usd_input.Get(&val)) {
|
||||
CLOG_ERROR(&LOG,
|
||||
"Couldn't get value for usd shader input %s",
|
||||
usd_input.GetPrim().GetPath().GetAsString().c_str());
|
||||
return false;
|
||||
}
|
||||
bNodeSocket *sock = blender::bke::node_find_socket(dest_node, SOCK_IN, dest_socket_name);
|
||||
if (!sock) {
|
||||
CLOG_ERROR(&LOG, "Couldn't get destination node socket %s", dest_socket_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (sock->type) {
|
||||
case SOCK_FLOAT:
|
||||
if (val.IsHolding<float>()) {
|
||||
((bNodeSocketValueFloat *)sock->default_value)->value = val.UncheckedGet<float>();
|
||||
return true;
|
||||
}
|
||||
else if (val.IsHolding<pxr::GfVec3f>()) {
|
||||
pxr::GfVec3f v3f = val.UncheckedGet<pxr::GfVec3f>();
|
||||
float average = (v3f[0] + v3f[1] + v3f[2]) / 3.0f;
|
||||
((bNodeSocketValueFloat *)sock->default_value)->value = average;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SOCK_RGBA:
|
||||
if (val.IsHolding<pxr::GfVec3f>()) {
|
||||
pxr::GfVec3f v3f = val.UncheckedGet<pxr::GfVec3f>();
|
||||
copy_v3_v3(((bNodeSocketValueRGBA *)sock->default_value)->value, v3f.data());
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SOCK_VECTOR:
|
||||
if (val.IsHolding<pxr::GfVec3f>()) {
|
||||
pxr::GfVec3f v3f = val.UncheckedGet<pxr::GfVec3f>();
|
||||
copy_v3_v3(((bNodeSocketValueVector *)sock->default_value)->value, v3f.data());
|
||||
return true;
|
||||
}
|
||||
else if (val.IsHolding<pxr::GfVec2f>()) {
|
||||
pxr::GfVec2f v2f = val.UncheckedGet<pxr::GfVec2f>();
|
||||
copy_v2_v2(((bNodeSocketValueVector *)sock->default_value)->value, v2f.data());
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
CLOG_WARN(&LOG,
|
||||
"Unexpected type %s for destination node socket %s",
|
||||
sock->idname,
|
||||
dest_socket_name);
|
||||
break;
|
||||
}
|
||||
pxr::VtValue val;
|
||||
if (!usd_input.Get(&val)) {
|
||||
CLOG_ERROR(&LOG,
|
||||
"Couldn't get value for usd shader input %s",
|
||||
usd_input.GetPrim().GetPath().GetAsString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (sock->type) {
|
||||
case SOCK_FLOAT:
|
||||
if (val.IsHolding<float>()) {
|
||||
((bNodeSocketValueFloat *)sock->default_value)->value = val.UncheckedGet<float>();
|
||||
return true;
|
||||
}
|
||||
else if (val.IsHolding<pxr::GfVec3f>()) {
|
||||
pxr::GfVec3f v3f = val.UncheckedGet<pxr::GfVec3f>();
|
||||
float average = (v3f[0] + v3f[1] + v3f[2]) / 3.0f;
|
||||
((bNodeSocketValueFloat *)sock->default_value)->value = average;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SOCK_RGBA:
|
||||
if (val.IsHolding<pxr::GfVec3f>()) {
|
||||
pxr::GfVec3f v3f = val.UncheckedGet<pxr::GfVec3f>();
|
||||
copy_v3_v3(((bNodeSocketValueRGBA *)sock->default_value)->value, v3f.data());
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SOCK_VECTOR:
|
||||
if (val.IsHolding<pxr::GfVec3f>()) {
|
||||
pxr::GfVec3f v3f = val.UncheckedGet<pxr::GfVec3f>();
|
||||
copy_v3_v3(((bNodeSocketValueVector *)sock->default_value)->value, v3f.data());
|
||||
return true;
|
||||
}
|
||||
else if (val.IsHolding<pxr::GfVec2f>()) {
|
||||
pxr::GfVec2f v2f = val.UncheckedGet<pxr::GfVec2f>();
|
||||
copy_v2_v2(((bNodeSocketValueVector *)sock->default_value)->value, v2f.data());
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
CLOG_WARN(&LOG,
|
||||
"Unexpected type %s for destination node socket %s",
|
||||
sock->idname,
|
||||
dest_socket_name);
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -953,13 +953,12 @@ std::optional<XformResult> USDMeshReader::get_local_usd_xform(const float time)
|
||||
* is constant over time. */
|
||||
return XformResult(pxr::GfMatrix4f(bind_xf), true);
|
||||
}
|
||||
else {
|
||||
BKE_reportf(reports(),
|
||||
RPT_WARNING,
|
||||
"%s: Couldn't compute geom bind transform for %s",
|
||||
__func__,
|
||||
prim_.GetPath().GetAsString().c_str());
|
||||
}
|
||||
|
||||
BKE_reportf(reports(),
|
||||
RPT_WARNING,
|
||||
"%s: Couldn't compute geom bind transform for %s",
|
||||
__func__,
|
||||
prim_.GetPath().GetAsString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,23 +31,19 @@ class USDMeshReader : public USDGeomReader {
|
||||
|
||||
pxr::TfToken normal_interpolation_;
|
||||
pxr::TfToken orientation_;
|
||||
bool is_left_handed_;
|
||||
bool is_time_varying_;
|
||||
bool is_left_handed_ = false;
|
||||
bool is_time_varying_ = false;
|
||||
|
||||
/* This is to ensure we load all data once, because we reuse the read_mesh function
|
||||
* in the mesh seq modifier, and in initial load. Ideally, a better fix would be
|
||||
* implemented. Note this will break if faces or positions vary. */
|
||||
bool is_initial_load_;
|
||||
bool is_initial_load_ = false;
|
||||
|
||||
public:
|
||||
USDMeshReader(const pxr::UsdPrim &prim,
|
||||
const USDImportParams &import_params,
|
||||
const ImportSettings &settings)
|
||||
: USDGeomReader(prim, import_params, settings),
|
||||
mesh_prim_(prim),
|
||||
is_left_handed_(false),
|
||||
is_time_varying_(false),
|
||||
is_initial_load_(false)
|
||||
: USDGeomReader(prim, import_params, settings), mesh_prim_(prim)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -141,9 +141,9 @@ void USDNurbsReader::read_curve_sample(Curve *cu, const double motionSampleTime)
|
||||
BPoint *bp = nu->bp;
|
||||
|
||||
for (int j = 0; j < nu->pntsu; j++, bp++, idx++) {
|
||||
bp->vec[0] = float(usdPoints[idx][0]);
|
||||
bp->vec[1] = float(usdPoints[idx][1]);
|
||||
bp->vec[2] = float(usdPoints[idx][2]);
|
||||
bp->vec[0] = usdPoints[idx][0];
|
||||
bp->vec[1] = usdPoints[idx][1];
|
||||
bp->vec[2] = usdPoints[idx][2];
|
||||
bp->vec[3] = weight;
|
||||
bp->f1 = SELECT;
|
||||
bp->weight = weight;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_geometry_set.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
|
||||
@@ -64,8 +64,7 @@ class USDShapeReader : public USDGeomReader {
|
||||
* This assumes mesh_from_prim() has been called. */
|
||||
bool is_time_varying();
|
||||
|
||||
virtual bool topology_changed(const Mesh * /*existing_mesh*/,
|
||||
double /*motionSampleTime*/) override
|
||||
bool topology_changed(const Mesh * /*existing_mesh*/, double /*motionSampleTime*/) override
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ using XformResult = std::tuple<pxr::GfMatrix4f, bool>;
|
||||
|
||||
class USDXformReader : public USDPrimReader {
|
||||
private:
|
||||
bool use_parent_xform_;
|
||||
bool use_parent_xform_ = false;
|
||||
|
||||
/* Indicates if the created object is the root of a
|
||||
* transform hierarchy. */
|
||||
@@ -33,9 +33,7 @@ class USDXformReader : public USDPrimReader {
|
||||
USDXformReader(const pxr::UsdPrim &prim,
|
||||
const USDImportParams &import_params,
|
||||
const ImportSettings &settings)
|
||||
: USDPrimReader(prim, import_params, settings),
|
||||
use_parent_xform_(false),
|
||||
is_root_xform_(is_root_xform_prim())
|
||||
: USDPrimReader(prim, import_params, settings), is_root_xform_(is_root_xform_prim())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include "ANIM_animdata.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -1313,9 +1314,7 @@ void export_deform_verts(const Mesh *mesh,
|
||||
int max_totweight = 1;
|
||||
for (const int i : dverts.index_range()) {
|
||||
const MDeformVert &vert = dverts[i];
|
||||
if (vert.totweight > max_totweight) {
|
||||
max_totweight = vert.totweight;
|
||||
}
|
||||
max_totweight = std::max(vert.totweight, max_totweight);
|
||||
}
|
||||
|
||||
/* elem_size will specify the number of
|
||||
|
||||
@@ -41,7 +41,7 @@ class USDAbstractWriter : public AbstractHierarchyWriter {
|
||||
public:
|
||||
USDAbstractWriter(const USDExporterContext &usd_export_context);
|
||||
|
||||
virtual void write(HierarchyContext &context) override;
|
||||
void write(HierarchyContext &context) override;
|
||||
|
||||
/**
|
||||
* Returns true if the data to be written is actually supported. This would, for example, allow a
|
||||
|
||||
@@ -16,9 +16,9 @@ class USDArmatureWriter : public USDAbstractWriter {
|
||||
USDArmatureWriter(const USDExporterContext &ctx);
|
||||
|
||||
protected:
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
|
||||
virtual bool check_is_animated(const HierarchyContext &context) const override;
|
||||
bool check_is_animated(const HierarchyContext &context) const override;
|
||||
|
||||
private:
|
||||
Map<StringRef, const Bone *> deform_map_;
|
||||
|
||||
@@ -13,8 +13,8 @@ class USDCameraWriter : public USDAbstractWriter {
|
||||
USDCameraWriter(const USDExporterContext &ctx);
|
||||
|
||||
protected:
|
||||
virtual bool is_supported(const HierarchyContext *context) const override;
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
bool is_supported(const HierarchyContext *context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
};
|
||||
|
||||
} // namespace blender::io::usd
|
||||
|
||||
@@ -649,7 +649,7 @@ void USDCurvesWriter::assign_materials(const HierarchyContext &context,
|
||||
}
|
||||
|
||||
bool curve_material_bound = false;
|
||||
for (short mat_num = 0; mat_num < context.object->totcol; mat_num++) {
|
||||
for (int mat_num = 0; mat_num < context.object->totcol; mat_num++) {
|
||||
Material *material = BKE_object_material_get(context.object, mat_num + 1);
|
||||
if (material == nullptr) {
|
||||
continue;
|
||||
|
||||
@@ -23,7 +23,7 @@ class USDCurvesWriter final : public USDAbstractWriter {
|
||||
~USDCurvesWriter() final = default;
|
||||
|
||||
protected:
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
void assign_materials(const HierarchyContext &context, const pxr::UsdGeomCurves &usd_curves);
|
||||
|
||||
private:
|
||||
|
||||
@@ -13,8 +13,8 @@ class USDHairWriter : public USDAbstractWriter {
|
||||
USDHairWriter(const USDExporterContext &ctx);
|
||||
|
||||
protected:
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
virtual bool check_is_animated(const HierarchyContext &context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
bool check_is_animated(const HierarchyContext &context) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::io::usd
|
||||
|
||||
@@ -12,8 +12,8 @@ class USDLightWriter : public USDAbstractWriter {
|
||||
USDLightWriter(const USDExporterContext &ctx);
|
||||
|
||||
protected:
|
||||
virtual bool is_supported(const HierarchyContext *context) const override;
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
bool is_supported(const HierarchyContext *context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
};
|
||||
|
||||
} // namespace blender::io::usd
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "usd_exporter_context.hh"
|
||||
#include "usd_hook.hh"
|
||||
#include "usd_utils.hh"
|
||||
#include "usd_writer_abstract.hh"
|
||||
|
||||
#include "BKE_image.hh"
|
||||
#include "BKE_image_format.hh"
|
||||
@@ -23,7 +22,6 @@
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_memory_utils.hh"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_set.hh"
|
||||
#include "BLI_string.h"
|
||||
@@ -44,7 +42,6 @@ static CLG_LogRef LOG = {"io.usd"};
|
||||
|
||||
#ifdef WITH_MATERIALX
|
||||
# include "shader/materialx/material.h"
|
||||
# include "shader/materialx/node_parser.h"
|
||||
# include <pxr/usd/sdf/copyUtils.h>
|
||||
# include <pxr/usd/usdMtlx/reader.h>
|
||||
# include <pxr/usd/usdMtlx/utils.h>
|
||||
@@ -1361,8 +1358,11 @@ pxr::TfToken token_for_input(const char *input_name)
|
||||
|
||||
#ifdef WITH_MATERIALX
|
||||
/* A wrapper for the MaterialX code to re-use the standard Texture export code */
|
||||
static std::string materialx_export_image(
|
||||
const USDExporterContext &usd_export_context, Main *, Scene *, Image *ima, ImageUser *)
|
||||
static std::string materialx_export_image(const USDExporterContext &usd_export_context,
|
||||
Main * /*main*/,
|
||||
Scene * /*scene*/,
|
||||
Image *ima,
|
||||
ImageUser * /*iuser*/)
|
||||
{
|
||||
auto tex_path = get_tex_image_asset_filepath(
|
||||
ima, usd_export_context.stage, usd_export_context.export_params);
|
||||
@@ -1383,7 +1383,7 @@ static pxr::SdfPath reflow_materialx_paths(pxr::SdfPath input_path,
|
||||
/* First we see if the path is in the rename_pairs,
|
||||
* otherwise we check if it starts with any items in the list plus a path separator (/ or .) .
|
||||
* Checking for the path separators, removes false positives from other prefixed elements. */
|
||||
auto value_lookup_ptr = rename_pairs.lookup_ptr(input_path_string);
|
||||
const auto *value_lookup_ptr = rename_pairs.lookup_ptr(input_path_string);
|
||||
if (value_lookup_ptr) {
|
||||
input_path = pxr::SdfPath(*value_lookup_ptr);
|
||||
}
|
||||
@@ -1415,13 +1415,11 @@ static void create_usd_materialx_material(const USDExporterContext &usd_export_c
|
||||
usd_path.GetElementString(),
|
||||
/* We want to re-use the same MaterialX document generation code as used by the renderer.
|
||||
* While the graph is traversed, we also want it to export the textures out. */
|
||||
(usd_export_context.export_image_fn) ? usd_export_context.export_image_fn :
|
||||
std::bind(materialx_export_image,
|
||||
usd_export_context,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4),
|
||||
(usd_export_context.export_image_fn) ?
|
||||
usd_export_context.export_image_fn :
|
||||
[usd_export_context](Main *main, Scene *scene, Image *ima, ImageUser *iuser) {
|
||||
return materialx_export_image(usd_export_context, main, scene, ima, iuser);
|
||||
},
|
||||
/* Active UV map name to use for default texture coordinates. */
|
||||
(usd_export_context.export_params.rename_uvmaps) ? "st" : active_uvmap_name,
|
||||
active_uvmap_name,
|
||||
|
||||
@@ -28,8 +28,8 @@ class USDGenericMeshWriter : public USDAbstractWriter {
|
||||
USDGenericMeshWriter(const USDExporterContext &ctx);
|
||||
|
||||
protected:
|
||||
virtual bool is_supported(const HierarchyContext *context) const override;
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
bool is_supported(const HierarchyContext *context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
|
||||
virtual Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) = 0;
|
||||
virtual void free_export_mesh(Mesh *mesh);
|
||||
@@ -64,9 +64,9 @@ class USDMeshWriter : public USDGenericMeshWriter {
|
||||
USDMeshWriter(const USDExporterContext &ctx);
|
||||
|
||||
protected:
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
|
||||
virtual Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
|
||||
/**
|
||||
* Determine whether we should write skinned mesh or blend shape data
|
||||
|
||||
@@ -12,10 +12,10 @@ class USDMetaballWriter : public USDGenericMeshWriter {
|
||||
USDMetaballWriter(const USDExporterContext &ctx);
|
||||
|
||||
protected:
|
||||
virtual Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
virtual void free_export_mesh(Mesh *mesh) override;
|
||||
virtual bool is_supported(const HierarchyContext *context) const override;
|
||||
virtual bool check_is_animated(const HierarchyContext &context) const override;
|
||||
Mesh *get_export_mesh(Object *object_eval, bool &r_needsfree) override;
|
||||
void free_export_mesh(Mesh *mesh) override;
|
||||
bool is_supported(const HierarchyContext *context) const override;
|
||||
bool check_is_animated(const HierarchyContext &context) const override;
|
||||
|
||||
private:
|
||||
bool is_basis_ball(Scene *scene, Object *ob) const;
|
||||
|
||||
@@ -23,7 +23,7 @@ class USDPointsWriter final : public USDAbstractWriter {
|
||||
~USDPointsWriter() final = default;
|
||||
|
||||
protected:
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
|
||||
private:
|
||||
void write_generic_data(const bke::AttributeIter &attr,
|
||||
|
||||
@@ -137,7 +137,8 @@ bool USDTransformWriter::check_is_animated(const HierarchyContext &context) cons
|
||||
return BKE_object_moves_in_time(context.object, context.animation_check_include_parent);
|
||||
}
|
||||
|
||||
void USDTransformWriter::set_xform_ops(float xf_matrix[4][4], const pxr::UsdGeomXformable &xf)
|
||||
void USDTransformWriter::set_xform_ops(float parent_relative_matrix[4][4],
|
||||
const pxr::UsdGeomXformable &xf)
|
||||
{
|
||||
if (!xf) {
|
||||
return;
|
||||
@@ -175,7 +176,7 @@ void USDTransformWriter::set_xform_ops(float xf_matrix[4][4], const pxr::UsdGeom
|
||||
pxr::UsdTimeCode time_code = get_export_time_code();
|
||||
|
||||
if (xformOps_.size() == 1) {
|
||||
pxr::GfMatrix4d mat_val(xf_matrix);
|
||||
pxr::GfMatrix4d mat_val(parent_relative_matrix);
|
||||
usd_value_writer_.SetAttribute(xformOps_[0].GetAttr(), mat_val, time_code);
|
||||
}
|
||||
else if (xformOps_.size() == 3) {
|
||||
@@ -184,7 +185,7 @@ void USDTransformWriter::set_xform_ops(float xf_matrix[4][4], const pxr::UsdGeom
|
||||
float quat[4];
|
||||
float scale[3];
|
||||
|
||||
mat4_decompose(loc, quat, scale, xf_matrix);
|
||||
mat4_decompose(loc, quat, scale, parent_relative_matrix);
|
||||
|
||||
if (xfOpMode == USD_XFORM_OP_TRS) {
|
||||
float rot[3];
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_index_range.hh"
|
||||
#include "BLI_math_base.h"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_string.h"
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ class USDVolumeWriter : public USDAbstractWriter {
|
||||
USDVolumeWriter(const USDExporterContext &ctx);
|
||||
|
||||
protected:
|
||||
virtual bool check_is_animated(const HierarchyContext &context) const override;
|
||||
virtual void do_write(HierarchyContext &context) override;
|
||||
bool check_is_animated(const HierarchyContext &context) const override;
|
||||
void do_write(HierarchyContext &context) override;
|
||||
|
||||
private:
|
||||
/* Try to ensure that external `.vdb` file is available for USD to be referenced. Blender can
|
||||
|
||||
@@ -69,12 +69,12 @@ class UsdExportTest : public BlendfileLoadingBaseTest {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void SetUp() override
|
||||
void SetUp() override
|
||||
{
|
||||
BlendfileLoadingBaseTest::SetUp();
|
||||
}
|
||||
|
||||
virtual void TearDown() override
|
||||
void TearDown() override
|
||||
{
|
||||
BlendfileLoadingBaseTest::TearDown();
|
||||
CTX_free(context);
|
||||
@@ -85,7 +85,7 @@ class UsdExportTest : public BlendfileLoadingBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
const pxr::UsdPrim get_first_child_mesh(const pxr::UsdPrim prim)
|
||||
pxr::UsdPrim get_first_child_mesh(const pxr::UsdPrim prim)
|
||||
{
|
||||
for (auto child : prim.GetChildren()) {
|
||||
if (child.IsA<pxr::UsdGeomMesh>()) {
|
||||
@@ -99,13 +99,12 @@ class UsdExportTest : public BlendfileLoadingBaseTest {
|
||||
* Loop the sockets on the Blender `bNode`, and fail if any of their values do
|
||||
* not match the equivalent Attribute values on the `UsdPrim`.
|
||||
*/
|
||||
const void compare_blender_node_to_usd_prim(const bNode *bsdf_node,
|
||||
const pxr::UsdPrim &bsdf_prim)
|
||||
void compare_blender_node_to_usd_prim(const bNode *bsdf_node, const pxr::UsdPrim &bsdf_prim)
|
||||
{
|
||||
ASSERT_NE(bsdf_node, nullptr);
|
||||
ASSERT_TRUE(bool(bsdf_prim));
|
||||
|
||||
for (auto socket : bsdf_node->input_sockets()) {
|
||||
for (const auto *socket : bsdf_node->input_sockets()) {
|
||||
const pxr::TfToken attribute_token = blender::io::usd::token_for_input(socket->name);
|
||||
if (attribute_token.IsEmpty()) {
|
||||
/* This socket is not translated between Blender and USD. */
|
||||
@@ -152,8 +151,8 @@ class UsdExportTest : public BlendfileLoadingBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
const void compare_blender_image_to_usd_image_shader(const bNode *image_node,
|
||||
const pxr::UsdPrim &image_prim)
|
||||
void compare_blender_image_to_usd_image_shader(const bNode *image_node,
|
||||
const pxr::UsdPrim &image_prim)
|
||||
{
|
||||
const Image *image = reinterpret_cast<Image *>(image_node->id);
|
||||
|
||||
@@ -178,7 +177,7 @@ class UsdExportTest : public BlendfileLoadingBaseTest {
|
||||
* Determine if a Blender Mesh matches a UsdGeomMesh prim by checking counts
|
||||
* on vertices, faces, face indices, and normals.
|
||||
*/
|
||||
const void compare_blender_mesh_to_usd_prim(const Mesh *mesh, const pxr::UsdGeomMesh &mesh_prim)
|
||||
void compare_blender_mesh_to_usd_prim(const Mesh *mesh, const pxr::UsdGeomMesh &mesh_prim)
|
||||
{
|
||||
pxr::VtIntArray face_indices;
|
||||
pxr::VtIntArray face_counts;
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_appdir.hh"
|
||||
|
||||
namespace blender::io::usd {
|
||||
|
||||
class USDStageCreationTest : public testing::Test {};
|
||||
|
||||
@@ -48,7 +48,7 @@ class UsdUsdzExportTest : public BlendfileLoadingBaseTest {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void SetUp() override
|
||||
void SetUp() override
|
||||
{
|
||||
BlendfileLoadingBaseTest::SetUp();
|
||||
|
||||
@@ -64,7 +64,7 @@ class UsdUsdzExportTest : public BlendfileLoadingBaseTest {
|
||||
BLI_path_join(output_filepath, FILE_MAX, temp_output_dir, "output_новый.usdz");
|
||||
}
|
||||
|
||||
virtual void TearDown() override
|
||||
void TearDown() override
|
||||
{
|
||||
BlendfileLoadingBaseTest::TearDown();
|
||||
CTX_free(context);
|
||||
|
||||
@@ -113,7 +113,7 @@ enum eUSDTexExportMode {
|
||||
USD_TEX_EXPORT_NEW_PATH,
|
||||
};
|
||||
|
||||
typedef enum eUSDSceneUnits {
|
||||
enum eUSDSceneUnits {
|
||||
USD_SCENE_UNITS_CUSTOM = -1,
|
||||
USD_SCENE_UNITS_METERS = 0,
|
||||
USD_SCENE_UNITS_KILOMETERS = 1,
|
||||
@@ -122,7 +122,7 @@ typedef enum eUSDSceneUnits {
|
||||
USD_SCENE_UNITS_INCHES = 4,
|
||||
USD_SCENE_UNITS_FEET = 5,
|
||||
USD_SCENE_UNITS_YARDS = 6,
|
||||
} eUSDSceneUnits;
|
||||
};
|
||||
|
||||
struct USDExportParams {
|
||||
bool export_animation = false;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "BLI_color.hh"
|
||||
#include "BLI_enumerable_thread_specific.hh"
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_math_matrix.hh"
|
||||
#include "BLI_path_utils.hh"
|
||||
#include "BLI_string.h"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "IO_wavefront_obj.hh"
|
||||
#include "obj_export_io.hh"
|
||||
#include "obj_export_mesh.hh"
|
||||
#include "obj_export_mtl.hh"
|
||||
|
||||
namespace blender::io::obj {
|
||||
|
||||
@@ -9,10 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdio>
|
||||
#include <type_traits>
|
||||
|
||||
#include "BLI_compiler_attrs.h"
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_string_ref.hh"
|
||||
#include "BLI_utility_mixins.hh"
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "BLI_math_matrix_types.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_offset_indices.hh"
|
||||
@@ -137,7 +135,7 @@ class OBJMesh : NonCopyable {
|
||||
*/
|
||||
void store_uv_coords_and_indices();
|
||||
/* Get UV coordinates computed by store_uv_coords_and_indices. */
|
||||
const Span<float2> get_uv_coords() const
|
||||
Span<float2> get_uv_coords() const
|
||||
{
|
||||
return uv_coords_;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ static void write_mesh_objects(const Span<std::unique_ptr<OBJMesh>> exportable_a
|
||||
}
|
||||
mtlindices.reserve(count);
|
||||
}
|
||||
for (auto &obj_mesh : exportable_as_mesh) {
|
||||
for (const auto &obj_mesh : exportable_as_mesh) {
|
||||
OBJMesh &obj = *obj_mesh;
|
||||
if (mtl_writer) {
|
||||
mtlindices.append(mtl_writer->add_materials(obj));
|
||||
@@ -198,7 +198,7 @@ static void write_mesh_objects(const Span<std::unique_ptr<OBJMesh>> exportable_a
|
||||
Vector<IndexOffsets> index_offsets;
|
||||
index_offsets.reserve(count);
|
||||
IndexOffsets offsets{0, 0, 0};
|
||||
for (auto &obj_mesh : exportable_as_mesh) {
|
||||
for (const auto &obj_mesh : exportable_as_mesh) {
|
||||
OBJMesh &obj = *obj_mesh;
|
||||
index_offsets.append(offsets);
|
||||
offsets.vertex_offset += obj.tot_vertices();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace blender::io::obj {
|
||||
* \return List of faces with each element containing indices of one face. The indices
|
||||
* are into face_vert_indices array.
|
||||
*/
|
||||
Vector<Vector<int>> fixup_invalid_face(Span<float3> vert_coords, Span<int> face_vert_indices);
|
||||
Vector<Vector<int>> fixup_invalid_face(Span<float3> vert_positions, Span<int> face_verts);
|
||||
|
||||
/**
|
||||
* Apply axes transform to the Object, and clamp object dimensions to the specified value.
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* \ingroup obj
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "DNA_customdata_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
@@ -236,9 +238,7 @@ void MeshFromGeometry::create_faces(Mesh *mesh, bool use_vertex_groups)
|
||||
material_indices.span[face_idx] = curr_face.material_index;
|
||||
/* Importing obj files without any materials would result in negative indices, which is not
|
||||
* supported. */
|
||||
if (material_indices.span[face_idx] < 0) {
|
||||
material_indices.span[face_idx] = 0;
|
||||
}
|
||||
material_indices.span[face_idx] = std::max(material_indices.span[face_idx], 0);
|
||||
|
||||
for (int idx = 0; idx < curr_face.corner_count_; ++idx) {
|
||||
const FaceCorner &curr_corner = mesh_geometry_.face_corners_[curr_face.start_index_ + idx];
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "DEG_depsgraph.hh"
|
||||
|
||||
#include "obj_export_file_writer.hh"
|
||||
#include "obj_export_mesh.hh"
|
||||
#include "obj_export_nurbs.hh"
|
||||
#include "obj_exporter.hh"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "CLG_log.h"
|
||||
|
||||
#include "obj_import_file_reader.hh"
|
||||
#include "obj_importer.hh"
|
||||
|
||||
namespace blender::io::obj {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user