diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2019-01-15 18:45:12 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2019-01-16 12:44:39 +0300 |
commit | 3ce9bcee70537a52f8d802abfb9e14c34f9a9251 (patch) | |
tree | 78f53ec43f4b0bf5859f1564da4cbc269cf628b7 /source/blender/alembic/intern/abc_mesh.cc | |
parent | 2bb6028d1a64bec0ec83c14483e1d06c802989de (diff) |
Alembic export: write curve/NURBS as mesh
It's now possible to export curves and NURBS as mesh data to Alembic.
This allows artists to do any crazy thing on curves and export the
visual result to Alembic for interoperability with other software (or
caching for later use, etc.). It's an often-requested feature.
This works around T60503 and the fixes export part of T51311.
Note that exporting zero-width curves is currently not supported, as
exporting a faceless mesh (e.g. just edges and vertices) is not
supported by the mesh writer at all.
To test, create a curve with thickness (for example extruded), export to
Alembic and check the 'Curves to Mesh' checkbox in the export options.
Reviewers: sergey
Differential Revision: https://developer.blender.org/D4213
Diffstat (limited to 'source/blender/alembic/intern/abc_mesh.cc')
-rw-r--r-- | source/blender/alembic/intern/abc_mesh.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index 229f788f87c..2b6e1fd86ec 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -38,6 +38,8 @@ extern "C" { #include "BLI_math_geom.h" #include "BLI_string.h" +#include "BKE_animsys.h" +#include "BKE_key.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_material.h" @@ -338,10 +340,23 @@ AbcGenericMeshWriter::~AbcGenericMeshWriter() bool AbcGenericMeshWriter::isAnimated() const { + if (m_object->data != NULL) { + AnimData *adt = BKE_animdata_from_id(static_cast<ID*>(m_object->data)); + /* TODO(Sybren): make this check more strict, as the AnimationData may + * actually be empty (no fcurves, drivers, etc.) and thus effectively + * have no animation at all. */ + if (adt != NULL) { + return true; + } + } + if (BKE_key_from_object(m_object) != NULL) { + return true; + } + /* Test modifiers. */ ModifierData *md = static_cast<ModifierData *>(m_object->modifiers.first); - while (md) { + if (md->type != eModifierType_Subsurf) { return true; } @@ -656,27 +671,12 @@ AbcMeshWriter::AbcMeshWriter(Object *ob, AbcMeshWriter::~AbcMeshWriter() {} -struct Mesh *AbcMeshWriter::getEvaluatedMesh(struct Scene *scene_eval, struct Object *ob_eval, - bool &UNUSED(r_needsfree)) +Mesh *AbcMeshWriter::getEvaluatedMesh(Scene *scene_eval, Object *ob_eval, bool &UNUSED(r_needsfree)) { return mesh_get_eval_final(m_settings.depsgraph, scene_eval, ob_eval, CD_MASK_MESH); } -bool AbcMeshWriter::isAnimated() const -{ - Mesh *me = static_cast<Mesh *>(m_object->data); - if (me->key != NULL) { - return true; - } - if (me->adt != NULL) { - return true; - } - - return AbcGenericMeshWriter::isAnimated(); -} - - /* ************************************************************************** */ /* Some helpers for mesh generation */ |