diff options
Diffstat (limited to 'source/blender/alembic/intern/abc_util.cc')
-rw-r--r-- | source/blender/alembic/intern/abc_util.cc | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc index 24a508e8292..90dfbd869f7 100644 --- a/source/blender/alembic/intern/abc_util.cc +++ b/source/blender/alembic/intern/abc_util.cc @@ -35,6 +35,7 @@ extern "C" { #include "DNA_object_types.h" +#include "DNA_layer_types.h" #include "BLI_math.h" @@ -60,6 +61,15 @@ std::string get_id_name(const ID * const id) return name; } +/** + * \brief get_object_dag_path_name returns the name under which the object + * will be exported in the Alembic file. It is of the form + * "[../grandparent/]parent/object" if dupli_parent is NULL, or + * "dupli_parent/[../grandparent/]parent/object" otherwise. + * \param ob: + * \param dupli_parent: + * \return + */ std::string get_object_dag_path_name(const Object * const ob, Object *dupli_parent) { std::string name = get_id_name(ob); @@ -78,31 +88,9 @@ std::string get_object_dag_path_name(const Object * const ob, Object *dupli_pare return name; } -bool object_selected(Object *ob) -{ - return ob->flag & SELECT; -} - -bool parent_selected(Object *ob) +bool object_selected(const Base * const ob_base) { - if (object_selected(ob)) { - return true; - } - - bool do_export = false; - - Object *parent = ob->parent; - - while (parent != NULL) { - if (object_selected(parent)) { - do_export = true; - break; - } - - parent = parent->parent; - } - - return do_export; + return ob_base->flag & SELECT; } Imath::M44d convert_matrix(float mat[4][4]) @@ -152,7 +140,10 @@ void create_swapped_rotation_matrix( rz = -euler[1]; break; default: + ry = 0.0f; + rz = 0.0f; BLI_assert(false); + break; } unit_m3(rot_x_mat); @@ -190,11 +181,11 @@ void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMod unit_m3(dst_rot); unit_m4(dst_scale_mat); - /* We assume there is no sheer component and no homogeneous scaling component. */ - BLI_assert(fabs(src_mat[0][3]) < 2 * FLT_EPSILON); - BLI_assert(fabs(src_mat[1][3]) < 2 * FLT_EPSILON); - BLI_assert(fabs(src_mat[2][3]) < 2 * FLT_EPSILON); - BLI_assert(fabs(src_mat[3][3] - 1.0f) < 2 * FLT_EPSILON); + /* TODO(Sybren): This code assumes there is no sheer component and no + * homogeneous scaling component, which is not always true when writing + * non-hierarchical (e.g. flat) objects (e.g. when parent has non-uniform + * scale and the child rotates). This is currently not taken into account + * when axis-swapping. */ /* Extract translation, rotation, and scale form matrix. */ mat4_to_loc_rot_size(src_trans, src_rot, src_scale, src_mat); |