Alembic export: use depsgraph to get evaluated mesh/object
This commit is contained in:
parent
28817c82f1
commit
630019d5f8
|
@ -52,6 +52,8 @@ extern "C" {
|
|||
|
||||
#include "bmesh.h"
|
||||
#include "bmesh_tools.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
}
|
||||
|
||||
using Alembic::Abc::FloatArraySample;
|
||||
|
@ -524,7 +526,9 @@ Mesh *AbcMeshWriter::getFinalMesh(bool &r_needsfree)
|
|||
m_subsurf_mod->mode |= eModifierMode_DisableTemporary;
|
||||
}
|
||||
|
||||
struct Mesh *mesh = mesh_get_eval_final(m_settings.depsgraph, m_settings.scene, m_object, CD_MASK_MESH);
|
||||
Scene *scene = DEG_get_evaluated_scene(m_settings.depsgraph);
|
||||
Object *ob_eval = DEG_get_evaluated_object(m_settings.depsgraph, m_object);
|
||||
struct Mesh *mesh = mesh_get_eval_final(m_settings.depsgraph, scene, ob_eval, CD_MASK_MESH);
|
||||
r_needsfree = false;
|
||||
|
||||
if (m_subsurf_mod) {
|
||||
|
|
|
@ -32,6 +32,8 @@ extern "C" {
|
|||
#include "BLI_math.h"
|
||||
|
||||
#include "BKE_object.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
}
|
||||
|
||||
using Alembic::AbcGeom::OObject;
|
||||
|
@ -80,29 +82,31 @@ AbcTransformWriter::AbcTransformWriter(Object *ob,
|
|||
|
||||
void AbcTransformWriter::do_write()
|
||||
{
|
||||
Object *ob_eval = DEG_get_evaluated_object(m_settings.depsgraph, m_object);
|
||||
|
||||
if (m_first_frame) {
|
||||
m_visibility = Alembic::AbcGeom::CreateVisibilityProperty(m_xform, m_xform.getSchema().getTimeSampling());
|
||||
}
|
||||
|
||||
m_visibility.set(!(m_object->restrictflag & OB_RESTRICT_VIEW));
|
||||
m_visibility.set(!(ob_eval->restrictflag & OB_RESTRICT_VIEW));
|
||||
|
||||
if (!m_first_frame && !m_is_animated) {
|
||||
return;
|
||||
}
|
||||
|
||||
float yup_mat[4][4];
|
||||
create_transform_matrix(m_object, yup_mat,
|
||||
create_transform_matrix(ob_eval, yup_mat,
|
||||
m_inherits_xform ? ABC_MATRIX_LOCAL : ABC_MATRIX_WORLD,
|
||||
m_proxy_from);
|
||||
|
||||
/* Only apply rotation to root camera, parenting will propagate it. */
|
||||
if (m_object->type == OB_CAMERA && (!m_inherits_xform || !has_parent_camera(m_object))) {
|
||||
if (ob_eval->type == OB_CAMERA && (!m_inherits_xform || !has_parent_camera(ob_eval))) {
|
||||
float rot_mat[4][4];
|
||||
axis_angle_to_mat4_single(rot_mat, 'X', -M_PI_2);
|
||||
mul_m4_m4m4(yup_mat, yup_mat, rot_mat);
|
||||
}
|
||||
|
||||
if (!m_object->parent || !m_inherits_xform) {
|
||||
if (!ob_eval->parent || !m_inherits_xform) {
|
||||
/* Only apply scaling to root objects, parenting will propagate it. */
|
||||
float scale_mat[4][4];
|
||||
scale_m4_fl(scale_mat, m_settings.global_scale);
|
||||
|
|
Loading…
Reference in New Issue