Changeset View
Changeset View
Standalone View
Standalone View
source/blender/alembic/intern/abc_util.h
| Show All 38 Lines | |||||
| using Alembic::Abc::chrono_t; | using Alembic::Abc::chrono_t; | ||||
| class AbcObjectReader; | class AbcObjectReader; | ||||
| struct ImportSettings; | struct ImportSettings; | ||||
| struct ID; | struct ID; | ||||
| struct Object; | struct Object; | ||||
| std::string get_id_name(ID *id); | std::string get_id_name(const ID * const id); | ||||
| std::string get_id_name(Object *ob); | std::string get_id_name(const Object * const ob); | ||||
| std::string get_object_dag_path_name(Object *ob, Object *dupli_parent); | std::string get_object_dag_path_name(const Object * const ob, Object *dupli_parent); | ||||
| bool object_selected(Object *ob); | bool object_selected(Object *ob); | ||||
| bool parent_selected(Object *ob); | bool parent_selected(Object *ob); | ||||
| Imath::M44d convert_matrix(float mat[4][4]); | Imath::M44d convert_matrix(float mat[4][4]); | ||||
| void create_transform_matrix(float r_mat[4][4]); | void create_transform_matrix(Object *obj, float r_transform_mat[4][4]); | ||||
| void create_transform_matrix(Object *obj, float transform_mat[4][4]); | |||||
| void split(const std::string &s, const char delim, std::vector<std::string> &tokens); | void split(const std::string &s, const char delim, std::vector<std::string> &tokens); | ||||
| template<class TContainer> | template<class TContainer> | ||||
| bool begins_with(const TContainer &input, const TContainer &match) | bool begins_with(const TContainer &input, const TContainer &match) | ||||
| { | { | ||||
| return input.size() >= match.size() | return input.size() >= match.size() | ||||
| && std::equal(match.begin(), match.end(), input.begin()); | && std::equal(match.begin(), match.end(), input.begin()); | ||||
| } | } | ||||
| void convert_matrix(const Imath::M44d &xform, Object *ob, | void convert_matrix(const Imath::M44d &xform, Object *ob, float r_mat[4][4]); | ||||
| float r_mat[4][4], float scale, bool has_alembic_parent = false); | |||||
| template <typename Schema> | template <typename Schema> | ||||
| void get_min_max_time_ex(const Schema &schema, chrono_t &min, chrono_t &max) | void get_min_max_time_ex(const Schema &schema, chrono_t &min, chrono_t &max) | ||||
| { | { | ||||
| const Alembic::Abc::TimeSamplingPtr &time_samp = schema.getTimeSampling(); | const Alembic::Abc::TimeSamplingPtr &time_samp = schema.getTimeSampling(); | ||||
| if (!schema.isConstant()) { | if (!schema.isConstant()) { | ||||
| const size_t num_samps = schema.getNumSamples(); | const size_t num_samps = schema.getNumSamples(); | ||||
| Show All 36 Lines | |||||
| * everything works properly, and also because Alembic is almost exclusively | * everything works properly, and also because Alembic is almost exclusively | ||||
| * used in Y-up software, but eventually they'll be set by the user in the UI | * used in Y-up software, but eventually they'll be set by the user in the UI | ||||
| * like other importers/exporters do, to support other axis. */ | * like other importers/exporters do, to support other axis. */ | ||||
| /* Copy from Y-up to Z-up. */ | /* Copy from Y-up to Z-up. */ | ||||
| ABC_INLINE void copy_zup_from_yup(float zup[3], const float yup[3]) | ABC_INLINE void copy_zup_from_yup(float zup[3], const float yup[3]) | ||||
| { | { | ||||
| const float old_yup1 = yup[1]; /* in case zup == yup */ | |||||
| zup[0] = yup[0]; | zup[0] = yup[0]; | ||||
| zup[1] = -yup[2]; | zup[1] = -yup[2]; | ||||
| zup[2] = yup[1]; | zup[2] = old_yup1; | ||||
| } | } | ||||
| ABC_INLINE void copy_zup_from_yup(short zup[3], const short yup[3]) | ABC_INLINE void copy_zup_from_yup(short zup[3], const short yup[3]) | ||||
| { | { | ||||
| const short old_yup1 = yup[1]; /* in case zup == yup */ | |||||
LazyDodo: const short? | |||||
| zup[0] = yup[0]; | zup[0] = yup[0]; | ||||
| zup[1] = -yup[2]; | zup[1] = -yup[2]; | ||||
| zup[2] = yup[1]; | zup[2] = old_yup1; | ||||
| } | } | ||||
| /* Copy from Z-up to Y-up. */ | /* Copy from Z-up to Y-up. */ | ||||
| ABC_INLINE void copy_yup_from_zup(float yup[3], const float zup[3]) | ABC_INLINE void copy_yup_from_zup(float yup[3], const float zup[3]) | ||||
| { | { | ||||
| const float old_zup1 = zup[1]; /* in case yup == zup */ | |||||
| yup[0] = zup[0]; | yup[0] = zup[0]; | ||||
| yup[1] = zup[2]; | yup[1] = zup[2]; | ||||
| yup[2] = -zup[1]; | yup[2] = -old_zup1; | ||||
| } | } | ||||
| ABC_INLINE void copy_yup_from_zup(short yup[3], const short zup[3]) | ABC_INLINE void copy_yup_from_zup(short yup[3], const short zup[3]) | ||||
| { | { | ||||
| const short old_zup1 = zup[1]; /* in case yup == zup */ | |||||
Done Inline Actionsconst short? LazyDodo: const short? | |||||
| yup[0] = zup[0]; | yup[0] = zup[0]; | ||||
| yup[1] = zup[2]; | yup[1] = zup[2]; | ||||
| yup[2] = -zup[1]; | yup[2] = -old_zup1; | ||||
| } | } | ||||
| /* Names are given in (dst, src) order, just like | |||||
| * the parameters of copy_m44_axis_swap() */ | |||||
| typedef enum { | |||||
| ABC_ZUP_FROM_YUP = 1, | |||||
| ABC_YUP_FROM_ZUP = 2, | |||||
| } AbcAxisSwapMode; | |||||
| void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMode mode); | |||||
| #endif /* __ABC_UTIL_H__ */ | #endif /* __ABC_UTIL_H__ */ | ||||
const short?