40 using Alembic::AbcGeom::IObject;
41 using Alembic::AbcGeom::IXform;
42 using Alembic::AbcGeom::IXformSchema;
49 m_settings(&settings),
50 m_min_time(
std::numeric_limits<chrono_t>::
max()),
51 m_max_time(
std::numeric_limits<chrono_t>::
min()),
53 parent_reader(nullptr)
55 m_name =
object.getFullName();
56 std::vector<std::string> parts;
59 if (parts.size() >= 2) {
75 IXform ixform =
xform();
80 const IXformSchema &schema(ixform.getSchema());
81 if (!schema.valid()) {
82 std::cerr <<
"Alembic object " << ixform.getFullName() <<
" has an invalid schema."
89 IObject ixform_parent = ixform.getParent();
90 if (!ixform_parent.getParent()) {
115 static Imath::M44d
blend_matrices(
const Imath::M44d &m0,
const Imath::M44d &m1,
const float weight)
117 float mat0[4][4], mat1[4][4],
ret[4][4];
124 for (
int i = 0; i < 4; i++) {
125 for (
int j = 0; j < 4; j++) {
126 mat0[i][j] =
static_cast<float>(m0[i][j]);
130 for (
int i = 0; i < 4; i++) {
131 for (
int j = 0; j < 4; j++) {
132 mat1[i][j] =
static_cast<float>(m1[i][j]);
140 for (
int i = 0; i < 4; i++) {
141 for (
int j = 0; j < 4; j++) {
151 Alembic::AbcGeom::index_t i0,
i1;
152 Alembic::AbcGeom::XformSample s0, s1;
155 time, schema.getTimeSampling(), schema.getNumSamples(), i0,
i1);
157 schema.get(s0, Alembic::AbcGeom::ISampleSelector(i0));
160 schema.get(s1, Alembic::AbcGeom::ISampleSelector(
i1));
164 return s0.getMatrix();
168 const Alembic::Abc::ISampleSelector &
UNUSED(sample_sel),
170 const char **
UNUSED(err_str))
172 return existing_mesh;
176 const Alembic::Abc::ISampleSelector & )
185 bool is_constant =
false;
186 float transform_from_alembic[4][4];
214 if (IXform::matches(
m_iobject.getMetaData())) {
216 return IXform(
m_iobject, Alembic::AbcGeom::kWrapExisting);
218 catch (Alembic::Util::Exception &ex) {
219 printf(
"Alembic: error reading object transform for '%s': %s\n",
228 IObject abc_parent =
m_iobject.getParent();
231 if (abc_parent.getParent() && IXform::matches(abc_parent.getMetaData())) {
233 return IXform(abc_parent, Alembic::AbcGeom::kWrapExisting);
235 catch (Alembic::Util::Exception &ex) {
236 printf(
"Alembic: error reading object transform for '%s': %s\n",
237 abc_parent.getFullName().c_str(),
253 IXform ixform =
xform();
260 const IXformSchema &schema(ixform.getSchema());
261 if (!schema.valid()) {
262 std::cerr <<
"Alembic object " << ixform.getFullName() <<
" has an invalid schema."
275 float camera_rotation[4][4];
282 float scale_mat[4][4];
287 is_constant = schema.isConstant();
struct bConstraint * BKE_constraint_add_for_object(struct Object *ob, const char *name, short type)
void id_us_plus(struct ID *id)
struct ModifierData * BKE_modifier_new(int type)
General operations, lookup, etc. for blender objects.
void BKE_object_to_mat4(struct Object *ob, float r_mat[4][4])
void BKE_object_apply_mat4(struct Object *ob, const float mat[4][4], const bool use_compat, const bool use_parent)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void unit_m4(float m[4][4])
void scale_m4_fl(float R[4][4], float scale)
void interp_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4], const float t)
void axis_angle_to_mat4_single(float R[4][4], const char axis, const float angle)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
@ CONSTRAINT_TYPE_TRANSFORM_CACHE
@ eModifierType_MeshSequenceCache
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint i1
std::string m_object_name
Alembic::Abc::IObject m_iobject
virtual struct Mesh * read_mesh(struct Mesh *mesh, const Alembic::Abc::ISampleSelector &sample_sel, int read_flag, const char **err_str)
AbcObjectReader(const Alembic::Abc::IObject &object, ImportSettings &settings)
void setupObjectTransform(const float time)
const Alembic::Abc::IObject & iobject() const
void determine_inherits_xform()
virtual Alembic::AbcGeom::IXform xform()
virtual bool topology_changed(Mesh *existing_mesh, const Alembic::Abc::ISampleSelector &sample_sel)
void read_matrix(float r_mat[4][4], const float time, const float scale, bool &is_constant)
ImportSettings * m_settings
static void get_weight_and_index(CDStreamConfig &config, Alembic::AbcCoreAbstract::TimeSamplingPtr time_sampling, size_t samples_number)
void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMode mode)
Imath::M44d get_matrix(const IXformSchema &schema, const float time)
Imath::M44d convert_matrix_datatype(float mat[4][4])
static Imath::M44d blend_matrices(const Imath::M44d &m0, const Imath::M44d &m1, const float weight)
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
struct CacheFile * cache_file