Alembic export: cleaned up multiply-passed depsgraph & scene
Those can now solely be found in the ExportSettings object.
This commit is contained in:
parent
ef7b7efd11
commit
20d3ce57d0
|
@ -49,13 +49,11 @@ using Alembic::AbcGeom::kWrapExisting;
|
|||
|
||||
/* ************************************************************************** */
|
||||
|
||||
AbcCameraWriter::AbcCameraWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcCameraWriter::AbcCameraWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings)
|
||||
: AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent)
|
||||
: AbcObjectWriter(ob, time_sampling, settings, parent)
|
||||
{
|
||||
OCamera camera(parent->alembicXform(), m_name, m_time_sampling);
|
||||
m_camera_schema = camera.getSchema();
|
||||
|
|
|
@ -35,9 +35,7 @@ class AbcCameraWriter : public AbcObjectWriter {
|
|||
Alembic::AbcGeom::OFloatProperty m_eye_separation;
|
||||
|
||||
public:
|
||||
AbcCameraWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcCameraWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings);
|
||||
|
|
|
@ -71,13 +71,11 @@ using Alembic::AbcGeom::OV2fGeomParam;
|
|||
|
||||
/* ************************************************************************** */
|
||||
|
||||
AbcCurveWriter::AbcCurveWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcCurveWriter::AbcCurveWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings)
|
||||
: AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent)
|
||||
: AbcObjectWriter(ob, time_sampling, settings, parent)
|
||||
{
|
||||
OCurves curves(parent->alembicXform(), m_name, m_time_sampling);
|
||||
m_schema = curves.getSchema();
|
||||
|
|
|
@ -36,9 +36,7 @@ class AbcCurveWriter : public AbcObjectWriter {
|
|||
Alembic::AbcGeom::OCurvesSchema::Sample m_sample;
|
||||
|
||||
public:
|
||||
AbcCurveWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcCurveWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings);
|
||||
|
|
|
@ -71,6 +71,8 @@ using Alembic::Abc::OBox3dProperty;
|
|||
|
||||
ExportSettings::ExportSettings()
|
||||
: scene(NULL)
|
||||
, view_layer(NULL)
|
||||
, depsgraph(NULL)
|
||||
, logger()
|
||||
, selected_only(false)
|
||||
, visible_layers_only(false)
|
||||
|
@ -170,16 +172,12 @@ static bool export_object(const ExportSettings * const settings, const Base * co
|
|||
|
||||
/* ************************************************************************** */
|
||||
|
||||
AbcExporter::AbcExporter(Main *bmain, Scene *scene,
|
||||
Depsgraph *depsgraph,
|
||||
const char *filename, ExportSettings &settings)
|
||||
AbcExporter::AbcExporter(Main *bmain, const char *filename, ExportSettings &settings)
|
||||
: m_bmain(bmain)
|
||||
, m_settings(settings)
|
||||
, m_filename(filename)
|
||||
, m_trans_sampling_index(0)
|
||||
, m_shape_sampling_index(0)
|
||||
, m_scene(scene)
|
||||
, m_depsgraph(depsgraph)
|
||||
, m_writer(NULL)
|
||||
{}
|
||||
|
||||
|
@ -203,7 +201,7 @@ void AbcExporter::getShutterSamples(unsigned int nr_of_samples,
|
|||
bool time_relative,
|
||||
std::vector<double> &samples)
|
||||
{
|
||||
Scene *scene = m_scene; /* for use in the FPS macro */
|
||||
Scene *scene = m_settings.scene; /* for use in the FPS macro */
|
||||
samples.clear();
|
||||
|
||||
unsigned int frame_offset = time_relative ? m_settings.frame_start : 0;
|
||||
|
@ -233,7 +231,7 @@ Alembic::Abc::TimeSamplingPtr AbcExporter::createTimeSampling(double step)
|
|||
|
||||
Alembic::Abc::TimeSamplingType ts(
|
||||
static_cast<uint32_t>(samples.size()),
|
||||
1.0 / m_scene->r.frs_sec);
|
||||
1.0 / m_settings.scene->r.frs_sec); /* TODO(Sybren): shouldn't we use the FPS macro here? */
|
||||
|
||||
return TimeSamplingPtr(new Alembic::Abc::TimeSampling(ts, samples));
|
||||
}
|
||||
|
@ -267,7 +265,7 @@ void AbcExporter::operator()(float &progress, bool &was_canceled)
|
|||
scene_name = "untitled";
|
||||
}
|
||||
|
||||
Scene *scene = m_scene;
|
||||
Scene *scene = m_settings.scene;
|
||||
const double fps = FPS;
|
||||
char buf[16];
|
||||
snprintf(buf, 15, "%f", fps);
|
||||
|
@ -299,8 +297,8 @@ void AbcExporter::operator()(float &progress, bool &was_canceled)
|
|||
|
||||
OBox3dProperty archive_bounds_prop = Alembic::AbcGeom::CreateOArchiveBounds(m_writer->archive(), m_trans_sampling_index);
|
||||
|
||||
createTransformWritersHierarchy(m_depsgraph);
|
||||
createShapeWriters(m_depsgraph);
|
||||
createTransformWritersHierarchy();
|
||||
createShapeWriters();
|
||||
|
||||
/* Make a list of frames to export. */
|
||||
|
||||
|
@ -362,7 +360,7 @@ void AbcExporter::operator()(float &progress, bool &was_canceled)
|
|||
}
|
||||
}
|
||||
|
||||
void AbcExporter::createTransformWritersHierarchy(Depsgraph *depsgraph)
|
||||
void AbcExporter::createTransformWritersHierarchy()
|
||||
{
|
||||
for (Base *base = static_cast<Base *>(m_settings.view_layer->object_bases.first); base; base = base->next) {
|
||||
Object *ob = base->object;
|
||||
|
@ -375,13 +373,13 @@ void AbcExporter::createTransformWritersHierarchy(Depsgraph *depsgraph)
|
|||
/* We do not export transforms for objects of these classes. */
|
||||
break;
|
||||
default:
|
||||
exploreTransform(depsgraph, base, ob->parent, NULL);
|
||||
exploreTransform(base, ob->parent, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AbcExporter::exploreTransform(Depsgraph *depsgraph, Base *ob_base, Object *parent, Object *dupliObParent)
|
||||
void AbcExporter::exploreTransform(Base *ob_base, Object *parent, Object *dupliObParent)
|
||||
{
|
||||
/* If an object isn't exported itself, its duplilist shouldn't be
|
||||
* exported either. */
|
||||
|
@ -389,12 +387,12 @@ void AbcExporter::exploreTransform(Depsgraph *depsgraph, Base *ob_base, Object *
|
|||
return;
|
||||
}
|
||||
|
||||
Object *ob = DEG_get_evaluated_object(depsgraph, ob_base->object);
|
||||
if (object_type_is_exportable(m_scene, ob)) {
|
||||
createTransformWriter(depsgraph, ob, parent, dupliObParent);
|
||||
Object *ob = DEG_get_evaluated_object(m_settings.depsgraph, ob_base->object);
|
||||
if (object_type_is_exportable(m_settings.scene, ob)) {
|
||||
createTransformWriter(ob, parent, dupliObParent);
|
||||
}
|
||||
|
||||
ListBase *lb = object_duplilist(depsgraph, m_scene, ob);
|
||||
ListBase *lb = object_duplilist(m_settings.depsgraph, m_settings.scene, ob);
|
||||
|
||||
if (lb) {
|
||||
Base fake_base = *ob_base; // copy flags (like selection state) from the real object.
|
||||
|
@ -415,7 +413,7 @@ void AbcExporter::exploreTransform(Depsgraph *depsgraph, Base *ob_base, Object *
|
|||
dupli_parent = (dupli_ob->parent) ? dupli_ob->parent : ob;
|
||||
|
||||
fake_base.object = dupli_ob;
|
||||
exploreTransform(depsgraph, &fake_base, dupli_parent, ob);
|
||||
exploreTransform(&fake_base, dupli_parent, ob);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,7 +421,7 @@ void AbcExporter::exploreTransform(Depsgraph *depsgraph, Base *ob_base, Object *
|
|||
}
|
||||
}
|
||||
|
||||
AbcTransformWriter * AbcExporter::createTransformWriter(Depsgraph *depsgraph, Object *ob, Object *parent, Object *dupliObParent)
|
||||
AbcTransformWriter * AbcExporter::createTransformWriter(Object *ob, Object *parent, Object *dupliObParent)
|
||||
{
|
||||
/* An object should not be its own parent, or we'll get infinite loops. */
|
||||
BLI_assert(ob != parent);
|
||||
|
@ -458,29 +456,29 @@ AbcTransformWriter * AbcExporter::createTransformWriter(Depsgraph *depsgraph, Ob
|
|||
* return the parent's AbcTransformWriter pointer. */
|
||||
if (parent->parent) {
|
||||
if (parent == dupliObParent) {
|
||||
parent_writer = createTransformWriter(depsgraph, parent, parent->parent, NULL);
|
||||
parent_writer = createTransformWriter(parent, parent->parent, NULL);
|
||||
}
|
||||
else {
|
||||
parent_writer = createTransformWriter(depsgraph, parent, parent->parent, dupliObParent);
|
||||
parent_writer = createTransformWriter(parent, parent->parent, dupliObParent);
|
||||
}
|
||||
}
|
||||
else if (parent == dupliObParent) {
|
||||
if (dupliObParent->parent == NULL) {
|
||||
parent_writer = createTransformWriter(depsgraph, parent, NULL, NULL);
|
||||
parent_writer = createTransformWriter(parent, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
parent_writer = createTransformWriter(depsgraph, parent, dupliObParent->parent, dupliObParent->parent);
|
||||
parent_writer = createTransformWriter(parent, dupliObParent->parent, dupliObParent->parent);
|
||||
}
|
||||
}
|
||||
else {
|
||||
parent_writer = createTransformWriter(depsgraph, parent, dupliObParent, dupliObParent);
|
||||
parent_writer = createTransformWriter(parent, dupliObParent, dupliObParent);
|
||||
}
|
||||
|
||||
BLI_assert(parent_writer);
|
||||
alembic_parent = parent_writer->alembicXform();
|
||||
}
|
||||
|
||||
my_writer = new AbcTransformWriter(depsgraph, ob, alembic_parent, parent_writer,
|
||||
my_writer = new AbcTransformWriter(ob, alembic_parent, parent_writer,
|
||||
m_trans_sampling_index, m_settings);
|
||||
|
||||
/* When flattening, the matrix of the dupliobject has to be added. */
|
||||
|
@ -492,14 +490,14 @@ AbcTransformWriter * AbcExporter::createTransformWriter(Depsgraph *depsgraph, Ob
|
|||
return my_writer;
|
||||
}
|
||||
|
||||
void AbcExporter::createShapeWriters(Depsgraph *depsgraph)
|
||||
void AbcExporter::createShapeWriters()
|
||||
{
|
||||
for (Base *base = static_cast<Base *>(m_settings.view_layer->object_bases.first); base; base = base->next) {
|
||||
exploreObject(depsgraph, base, NULL);
|
||||
exploreObject(base, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void AbcExporter::exploreObject(Depsgraph *depsgraph, Base *ob_base, Object *dupliObParent)
|
||||
void AbcExporter::exploreObject(Base *ob_base, Object *dupliObParent)
|
||||
{
|
||||
/* If an object isn't exported itself, its duplilist shouldn't be
|
||||
* exported either. */
|
||||
|
@ -510,7 +508,7 @@ void AbcExporter::exploreObject(Depsgraph *depsgraph, Base *ob_base, Object *dup
|
|||
createShapeWriter(ob_base, dupliObParent);
|
||||
|
||||
Object *ob = ob_base->object;
|
||||
ListBase *lb = object_duplilist(depsgraph, m_scene, ob);
|
||||
ListBase *lb = object_duplilist(m_settings.depsgraph, m_settings.scene, ob);
|
||||
|
||||
if (lb) {
|
||||
Base fake_base = *ob_base; // copy flags (like selection state) from the real object.
|
||||
|
@ -525,7 +523,7 @@ void AbcExporter::exploreObject(Depsgraph *depsgraph, Base *ob_base, Object *dup
|
|||
}
|
||||
if (link->type == OB_DUPLICOLLECTION) {
|
||||
fake_base.object = link->ob;
|
||||
exploreObject(depsgraph, &fake_base, ob);
|
||||
exploreObject(&fake_base, ob);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -548,10 +546,10 @@ void AbcExporter::createParticleSystemsWriters(Object *ob, AbcTransformWriter *x
|
|||
|
||||
if (m_settings.export_hair && psys->part->type == PART_HAIR) {
|
||||
m_settings.export_child_hairs = true;
|
||||
m_shapes.push_back(new AbcHairWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings, psys));
|
||||
m_shapes.push_back(new AbcHairWriter(ob, xform, m_shape_sampling_index, m_settings, psys));
|
||||
}
|
||||
else if (m_settings.export_particles && psys->part->type == PART_EMITTER) {
|
||||
m_shapes.push_back(new AbcPointsWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings, psys));
|
||||
m_shapes.push_back(new AbcPointsWriter(ob, xform, m_shape_sampling_index, m_settings, psys));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -560,7 +558,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent)
|
|||
{
|
||||
Object *ob = ob_base->object;
|
||||
|
||||
if (!object_type_is_exportable(m_scene, ob)) {
|
||||
if (!object_type_is_exportable(m_settings.scene, ob)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -591,7 +589,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent)
|
|||
return;
|
||||
}
|
||||
|
||||
m_shapes.push_back(new AbcMeshWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings));
|
||||
m_shapes.push_back(new AbcMeshWriter(ob, xform, m_shape_sampling_index, m_settings));
|
||||
break;
|
||||
}
|
||||
case OB_SURF:
|
||||
|
@ -602,7 +600,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent)
|
|||
return;
|
||||
}
|
||||
|
||||
m_shapes.push_back(new AbcNurbsWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings));
|
||||
m_shapes.push_back(new AbcNurbsWriter(ob, xform, m_shape_sampling_index, m_settings));
|
||||
break;
|
||||
}
|
||||
case OB_CURVE:
|
||||
|
@ -613,7 +611,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent)
|
|||
return;
|
||||
}
|
||||
|
||||
m_shapes.push_back(new AbcCurveWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings));
|
||||
m_shapes.push_back(new AbcCurveWriter(ob, xform, m_shape_sampling_index, m_settings));
|
||||
break;
|
||||
}
|
||||
case OB_CAMERA:
|
||||
|
@ -621,7 +619,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent)
|
|||
Camera *cam = static_cast<Camera *>(ob->data);
|
||||
|
||||
if (cam->type == CAM_PERSP) {
|
||||
m_shapes.push_back(new AbcCameraWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings));
|
||||
m_shapes.push_back(new AbcCameraWriter(ob, xform, m_shape_sampling_index, m_settings));
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -634,7 +632,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent)
|
|||
}
|
||||
|
||||
m_shapes.push_back(new AbcMBallWriter(
|
||||
m_bmain, m_depsgraph, m_scene, ob, xform,
|
||||
m_bmain, ob, xform,
|
||||
m_shape_sampling_index, m_settings));
|
||||
break;
|
||||
}
|
||||
|
@ -654,7 +652,7 @@ AbcTransformWriter *AbcExporter::getXForm(const std::string &name)
|
|||
|
||||
void AbcExporter::setCurrentFrame(Main *bmain, double t)
|
||||
{
|
||||
m_scene->r.cfra = static_cast<int>(t);
|
||||
m_scene->r.subframe = static_cast<float>(t) - m_scene->r.cfra;
|
||||
BKE_scene_graph_update_for_newframe(m_depsgraph, bmain);
|
||||
m_settings.scene->r.cfra = static_cast<int>(t);
|
||||
m_settings.scene->r.subframe = static_cast<float>(t) - m_settings.scene->r.cfra;
|
||||
BKE_scene_graph_update_for_newframe(m_settings.depsgraph, bmain);
|
||||
}
|
||||
|
|
|
@ -92,9 +92,6 @@ class AbcExporter {
|
|||
|
||||
unsigned int m_trans_sampling_index, m_shape_sampling_index;
|
||||
|
||||
Scene *m_scene;
|
||||
Depsgraph *m_depsgraph;
|
||||
|
||||
ArchiveWriter *m_writer;
|
||||
|
||||
/* mapping from name to transform writer */
|
||||
|
@ -104,8 +101,7 @@ class AbcExporter {
|
|||
std::vector<AbcObjectWriter *> m_shapes;
|
||||
|
||||
public:
|
||||
AbcExporter(Main *bmain, Scene *scene, Depsgraph *depsgraph,
|
||||
const char *filename, ExportSettings &settings);
|
||||
AbcExporter(Main *bmain, const char *filename, ExportSettings &settings);
|
||||
~AbcExporter();
|
||||
|
||||
void operator()(float &progress, bool &was_canceled);
|
||||
|
@ -119,11 +115,11 @@ protected:
|
|||
private:
|
||||
Alembic::Abc::TimeSamplingPtr createTimeSampling(double step);
|
||||
|
||||
void createTransformWritersHierarchy(Depsgraph *depsgraph);
|
||||
AbcTransformWriter * createTransformWriter(Depsgraph *depsgraph, Object *ob, Object *parent, Object *dupliObParent);
|
||||
void exploreTransform(Depsgraph *depsgraph, Base *ob_base, Object *parent, Object *dupliObParent);
|
||||
void exploreObject(Depsgraph *depsgraph, Base *ob_base, Object *dupliObParent);
|
||||
void createShapeWriters(Depsgraph *depsgraph);
|
||||
void createTransformWritersHierarchy();
|
||||
AbcTransformWriter * createTransformWriter(Object *ob, Object *parent, Object *dupliObParent);
|
||||
void exploreTransform(Base *ob_base, Object *parent, Object *dupliObParent);
|
||||
void exploreObject(Base *ob_base, Object *dupliObParent);
|
||||
void createShapeWriters();
|
||||
void createShapeWriter(Base *ob_base, Object *dupliObParent);
|
||||
void createParticleSystemsWriters(Object *ob, AbcTransformWriter *xform);
|
||||
|
||||
|
|
|
@ -53,14 +53,12 @@ using Alembic::AbcGeom::OV2fGeomParam;
|
|||
|
||||
/* ************************************************************************** */
|
||||
|
||||
AbcHairWriter::AbcHairWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcHairWriter::AbcHairWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings,
|
||||
ParticleSystem *psys)
|
||||
: AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent)
|
||||
: AbcObjectWriter(ob, time_sampling, settings, parent)
|
||||
, m_uv_warning_shown(false)
|
||||
{
|
||||
m_psys = psys;
|
||||
|
@ -81,7 +79,7 @@ void AbcHairWriter::do_write()
|
|||
return;
|
||||
}
|
||||
|
||||
Mesh *mesh = mesh_get_eval_final(m_depsgraph, m_scene, m_object, CD_MASK_MESH);
|
||||
Mesh *mesh = mesh_get_eval_final(m_settings.depsgraph, m_settings.scene, m_object, CD_MASK_MESH);
|
||||
BKE_mesh_tessface_ensure(mesh);
|
||||
|
||||
std::vector<Imath::V3f> verts;
|
||||
|
|
|
@ -39,9 +39,7 @@ class AbcHairWriter : public AbcObjectWriter {
|
|||
bool m_uv_warning_shown;
|
||||
|
||||
public:
|
||||
AbcHairWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcHairWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings,
|
||||
|
|
|
@ -42,13 +42,11 @@ extern "C" {
|
|||
|
||||
AbcMBallWriter::AbcMBallWriter(
|
||||
Main *bmain,
|
||||
Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings)
|
||||
: AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent)
|
||||
: AbcObjectWriter(ob, time_sampling, settings, parent)
|
||||
, m_bmain(bmain)
|
||||
{
|
||||
m_is_animated = isAnimated();
|
||||
|
@ -58,8 +56,7 @@ AbcMBallWriter::AbcMBallWriter(
|
|||
sizeof(CurveCache),
|
||||
"CurveCache for AbcMBallWriter");
|
||||
|
||||
m_mesh_writer = new AbcMeshWriter(depsgraph, scene, m_mesh_ob, parent,
|
||||
time_sampling, settings);
|
||||
m_mesh_writer = new AbcMeshWriter(m_mesh_ob, parent, time_sampling, settings);
|
||||
m_mesh_writer->setIsAnimated(m_is_animated);
|
||||
}
|
||||
|
||||
|
@ -101,7 +98,7 @@ void AbcMBallWriter::do_write()
|
|||
* only contains for_render flag. As soon as CoW is
|
||||
* implemented, this is to be rethinked.
|
||||
*/
|
||||
BKE_displist_make_mball_forRender(m_depsgraph, m_scene, m_object, &disp);
|
||||
BKE_displist_make_mball_forRender(m_settings.depsgraph, m_settings.scene, m_object, &disp);
|
||||
BKE_mesh_from_metaball(&disp, tmpmesh);
|
||||
BKE_displist_free(&disp);
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ class AbcMBallWriter : public AbcObjectWriter {
|
|||
public:
|
||||
AbcMBallWriter(
|
||||
Main *bmain,
|
||||
Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
|
|
|
@ -286,13 +286,11 @@ static ModifierData *get_liquid_sim_modifier(Scene *scene, Object *ob)
|
|||
|
||||
/* ************************************************************************** */
|
||||
|
||||
AbcMeshWriter::AbcMeshWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcMeshWriter::AbcMeshWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings)
|
||||
: AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent)
|
||||
: AbcObjectWriter(ob, time_sampling, settings, parent)
|
||||
{
|
||||
m_is_animated = isAnimated();
|
||||
m_subsurf_mod = NULL;
|
||||
|
@ -304,11 +302,11 @@ AbcMeshWriter::AbcMeshWriter(Depsgraph *depsgraph,
|
|||
}
|
||||
|
||||
if (!m_settings.apply_subdiv) {
|
||||
m_subsurf_mod = get_subsurf_modifier(m_scene, m_object);
|
||||
m_subsurf_mod = get_subsurf_modifier(m_settings.scene, m_object);
|
||||
m_is_subd = (m_subsurf_mod != NULL);
|
||||
}
|
||||
|
||||
m_is_liquid = (get_liquid_sim_modifier(m_scene, m_object) != NULL);
|
||||
m_is_liquid = (get_liquid_sim_modifier(m_settings.scene, m_object) != NULL);
|
||||
|
||||
while (parent->alembicXform().getChildHeader(m_name)) {
|
||||
m_name.append("_");
|
||||
|
@ -526,7 +524,7 @@ Mesh *AbcMeshWriter::getFinalMesh(bool &r_needsfree)
|
|||
m_subsurf_mod->mode |= eModifierMode_DisableTemporary;
|
||||
}
|
||||
|
||||
struct Mesh *mesh = mesh_get_eval_final(m_depsgraph, m_scene, m_object, CD_MASK_MESH);
|
||||
struct Mesh *mesh = mesh_get_eval_final(m_settings.depsgraph, m_settings.scene, m_object, CD_MASK_MESH);
|
||||
r_needsfree = false;
|
||||
|
||||
if (m_subsurf_mod) {
|
||||
|
@ -586,7 +584,7 @@ void AbcMeshWriter::getVelocities(struct Mesh *mesh, std::vector<Imath::V3f> &ve
|
|||
vels.clear();
|
||||
vels.resize(totverts);
|
||||
|
||||
ModifierData *md = get_liquid_sim_modifier(m_scene, m_object);
|
||||
ModifierData *md = get_liquid_sim_modifier(m_settings.scene, m_object);
|
||||
FluidsimModifierData *fmd = reinterpret_cast<FluidsimModifierData *>(md);
|
||||
FluidsimSettings *fss = fmd->fss;
|
||||
|
||||
|
|
|
@ -49,9 +49,7 @@ class AbcMeshWriter : public AbcObjectWriter {
|
|||
bool m_is_subd;
|
||||
|
||||
public:
|
||||
AbcMeshWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcMeshWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings);
|
||||
|
|
|
@ -60,13 +60,11 @@ using Alembic::AbcGeom::ONuPatchSchema;
|
|||
|
||||
/* ************************************************************************** */
|
||||
|
||||
AbcNurbsWriter::AbcNurbsWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcNurbsWriter::AbcNurbsWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings)
|
||||
: AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent)
|
||||
: AbcObjectWriter(ob, time_sampling, settings, parent)
|
||||
{
|
||||
m_is_animated = isAnimated();
|
||||
|
||||
|
|
|
@ -32,9 +32,7 @@ class AbcNurbsWriter : public AbcObjectWriter {
|
|||
bool m_is_animated;
|
||||
|
||||
public:
|
||||
AbcNurbsWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcNurbsWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings);
|
||||
|
|
|
@ -58,16 +58,12 @@ using Alembic::AbcGeom::OStringProperty;
|
|||
|
||||
/* ************************************************************************** */
|
||||
|
||||
AbcObjectWriter::AbcObjectWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcObjectWriter::AbcObjectWriter(Object *ob,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings,
|
||||
AbcObjectWriter *parent)
|
||||
: m_object(ob)
|
||||
, m_settings(settings)
|
||||
, m_depsgraph(depsgraph)
|
||||
, m_scene(scene)
|
||||
, m_time_sampling(time_sampling)
|
||||
, m_first_frame(true)
|
||||
{
|
||||
|
|
|
@ -44,8 +44,6 @@ protected:
|
|||
Object *m_object;
|
||||
ExportSettings &m_settings;
|
||||
|
||||
Depsgraph *m_depsgraph;
|
||||
Scene *m_scene;
|
||||
uint32_t m_time_sampling;
|
||||
|
||||
Imath::Box3d m_bounds;
|
||||
|
@ -57,9 +55,7 @@ protected:
|
|||
std::string m_name;
|
||||
|
||||
public:
|
||||
AbcObjectWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcObjectWriter(Object *ob,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings,
|
||||
AbcObjectWriter *parent = NULL);
|
||||
|
|
|
@ -60,14 +60,12 @@ using Alembic::AbcGeom::OPointsSchema;
|
|||
|
||||
/* ************************************************************************** */
|
||||
|
||||
AbcPointsWriter::AbcPointsWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcPointsWriter::AbcPointsWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings,
|
||||
ParticleSystem *psys)
|
||||
: AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent)
|
||||
: AbcObjectWriter(ob, time_sampling, settings, parent)
|
||||
{
|
||||
m_psys = psys;
|
||||
|
||||
|
@ -89,8 +87,8 @@ void AbcPointsWriter::do_write()
|
|||
ParticleKey state;
|
||||
|
||||
ParticleSimulationData sim;
|
||||
sim.depsgraph = m_depsgraph;
|
||||
sim.scene = m_scene;
|
||||
sim.depsgraph = m_settings.depsgraph;
|
||||
sim.scene = m_settings.scene;
|
||||
sim.ob = m_object;
|
||||
sim.psys = m_psys;
|
||||
|
||||
|
@ -104,7 +102,7 @@ void AbcPointsWriter::do_write()
|
|||
continue;
|
||||
}
|
||||
|
||||
state.time = DEG_get_ctime(m_depsgraph);
|
||||
state.time = DEG_get_ctime(m_settings.depsgraph);
|
||||
|
||||
if (psys_get_particle_state(&sim, p, &state, 0) == 0) {
|
||||
continue;
|
||||
|
|
|
@ -38,9 +38,7 @@ class AbcPointsWriter : public AbcObjectWriter {
|
|||
ParticleSystem *m_psys;
|
||||
|
||||
public:
|
||||
AbcPointsWriter(Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
AbcPointsWriter(Object *ob,
|
||||
AbcTransformWriter *parent,
|
||||
uint32_t time_sampling,
|
||||
ExportSettings &settings,
|
||||
|
|
|
@ -57,13 +57,12 @@ static bool has_parent_camera(Object *ob)
|
|||
|
||||
/* ************************************************************************** */
|
||||
|
||||
AbcTransformWriter::AbcTransformWriter(Depsgraph *depsgraph,
|
||||
Object *ob,
|
||||
AbcTransformWriter::AbcTransformWriter(Object *ob,
|
||||
const OObject &abc_parent,
|
||||
AbcTransformWriter *parent,
|
||||
unsigned int time_sampling,
|
||||
ExportSettings &settings)
|
||||
: AbcObjectWriter(depsgraph, NULL, ob, time_sampling, settings, parent)
|
||||
: AbcObjectWriter(ob, time_sampling, settings, parent)
|
||||
, m_proxy_from(NULL)
|
||||
{
|
||||
m_is_animated = hasAnimation(m_object);
|
||||
|
|
|
@ -43,8 +43,7 @@ public:
|
|||
Object *m_proxy_from;
|
||||
|
||||
public:
|
||||
AbcTransformWriter(Depsgraph *depsgraph,
|
||||
Object *ob,
|
||||
AbcTransformWriter(Object *ob,
|
||||
const Alembic::AbcGeom::OObject &abc_parent,
|
||||
AbcTransformWriter *parent,
|
||||
unsigned int time_sampling,
|
||||
|
|
|
@ -230,9 +230,7 @@ static void find_iobject(const IObject &object, IObject &ret,
|
|||
}
|
||||
|
||||
struct ExportJobData {
|
||||
Scene *scene;
|
||||
ViewLayer *view_layer;
|
||||
Depsgraph *depsgraph;
|
||||
Main *bmain;
|
||||
|
||||
char filename[1024];
|
||||
|
@ -263,9 +261,9 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo
|
|||
G.is_break = false;
|
||||
|
||||
try {
|
||||
Scene *scene = data->scene;
|
||||
AbcExporter exporter(data->bmain, scene, data->depsgraph, data->filename, data->settings);
|
||||
AbcExporter exporter(data->bmain, data->filename, data->settings);
|
||||
|
||||
Scene *scene = data->settings.scene; /* for the CFRA macro */
|
||||
const int orig_frame = CFRA;
|
||||
|
||||
data->was_canceled = false;
|
||||
|
@ -274,7 +272,7 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo
|
|||
if (CFRA != orig_frame) {
|
||||
CFRA = orig_frame;
|
||||
|
||||
BKE_scene_graph_update_for_newframe(data->depsgraph, data->bmain);
|
||||
BKE_scene_graph_update_for_newframe(data->settings.depsgraph, data->bmain);
|
||||
}
|
||||
|
||||
data->export_ok = !data->was_canceled;
|
||||
|
@ -313,9 +311,7 @@ bool ABC_export(
|
|||
{
|
||||
ExportJobData *job = static_cast<ExportJobData *>(MEM_mallocN(sizeof(ExportJobData), "ExportJobData"));
|
||||
|
||||
job->scene = scene;
|
||||
job->view_layer = CTX_data_view_layer(C);
|
||||
job->depsgraph = CTX_data_depsgraph(C);
|
||||
job->bmain = CTX_data_main(C);
|
||||
job->export_ok = false;
|
||||
BLI_strncpy(job->filename, filepath, 1024);
|
||||
|
@ -336,8 +332,8 @@ bool ABC_export(
|
|||
* do bigger refactor and maybe there is a better way which does not involve
|
||||
* hardcore refactoring. */
|
||||
new (&job->settings) ExportSettings();
|
||||
job->settings.scene = job->scene;
|
||||
job->settings.depsgraph = job->depsgraph;
|
||||
job->settings.scene = scene;
|
||||
job->settings.depsgraph = CTX_data_depsgraph(C);
|
||||
|
||||
/* Sybren: for now we only export the active scene layer.
|
||||
* Later in the 2.8 development process this may be replaced by using
|
||||
|
@ -387,7 +383,7 @@ bool ABC_export(
|
|||
if (as_background_job) {
|
||||
wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C),
|
||||
CTX_wm_window(C),
|
||||
job->scene,
|
||||
job->settings.scene,
|
||||
"Alembic Export",
|
||||
WM_JOB_PROGRESS,
|
||||
WM_JOB_TYPE_ALEMBIC);
|
||||
|
|
Loading…
Reference in New Issue