diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-08-21 14:18:26 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-08-21 14:18:26 +0300 |
commit | 069569f82011c833937df07ec7945751c02f0a9c (patch) | |
tree | 8c6ed443d055f23d9ec7764b70e98d133b9766d1 /source/blender/alembic | |
parent | be2bc7e0f66b9ed1c863790b3555aa3e7db4cb76 (diff) | |
parent | 43bb8f12f44415c91f07ab5864aee7da51ef4a09 (diff) |
Merge branch 'master' into blender2.8
In addition to pack of conflicts listed below, also had to comment out particle part of new Alembic code... :/
Conflicts:
intern/ghost/intern/GHOST_WindowWin32.cpp
source/blender/blenkernel/BKE_effect.h
source/blender/blenkernel/BKE_pointcache.h
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/rigidbody.c
source/blender/blenkernel/intern/smoke.c
source/blender/blenkernel/intern/softbody.c
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/gpu/intern/gpu_debug.c
source/blender/makesdna/DNA_object_types.h
source/blender/makesrna/intern/rna_particle.c
Diffstat (limited to 'source/blender/alembic')
-rw-r--r-- | source/blender/alembic/intern/abc_camera.cc | 2 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_curves.cc | 2 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_exporter.cc | 32 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_hair.cc | 16 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_hair.h | 10 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_mesh.cc | 8 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_nurbs.cc | 2 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_points.cc | 11 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_points.h | 6 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_transform.cc | 2 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_util.h | 14 | ||||
-rw-r--r-- | source/blender/alembic/intern/alembic_capi.cc | 13 |
12 files changed, 63 insertions, 55 deletions
diff --git a/source/blender/alembic/intern/abc_camera.cc b/source/blender/alembic/intern/abc_camera.cc index 38a6d3d33cf..5c34ec1391f 100644 --- a/source/blender/alembic/intern/abc_camera.cc +++ b/source/blender/alembic/intern/abc_camera.cc @@ -109,7 +109,7 @@ AbcCameraReader::AbcCameraReader(const Alembic::Abc::IObject &object, ImportSett ICamera abc_cam(m_iobject, kWrapExisting); m_schema = abc_cam.getSchema(); - get_min_max_time(m_schema, m_min_time, m_max_time); + get_min_max_time(m_iobject, m_schema, m_min_time, m_max_time); } bool AbcCameraReader::valid() const diff --git a/source/blender/alembic/intern/abc_curves.cc b/source/blender/alembic/intern/abc_curves.cc index 4e1e4e7e490..2b54741a5c5 100644 --- a/source/blender/alembic/intern/abc_curves.cc +++ b/source/blender/alembic/intern/abc_curves.cc @@ -190,7 +190,7 @@ AbcCurveReader::AbcCurveReader(const Alembic::Abc::IObject &object, ImportSettin ICurves abc_curves(object, kWrapExisting); m_curves_schema = abc_curves.getSchema(); - get_min_max_time(m_curves_schema, m_min_time, m_max_time); + get_min_max_time(m_iobject, m_curves_schema, m_min_time, m_max_time); } bool AbcCurveReader::valid() const diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc index 127e8853789..132c59c0cfb 100644 --- a/source/blender/alembic/intern/abc_exporter.cc +++ b/source/blender/alembic/intern/abc_exporter.cc @@ -44,6 +44,7 @@ extern "C" { #include "DNA_curve_types.h" #include "DNA_mesh_types.h" #include "DNA_modifier_types.h" +#include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_space_types.h" /* for FILE_MAX */ @@ -59,7 +60,6 @@ extern "C" { #include "BKE_idprop.h" #include "BKE_main.h" #include "BKE_modifier.h" -#include "BKE_particle.h" #include "BKE_scene.h" } @@ -175,7 +175,7 @@ void AbcExporter::getShutterSamples(double step, bool time_relative, /* sample all frame */ if (shutter_open == 0.0 && shutter_close == 1.0) { for (double t = 0; t < 1.0; t += step) { - samples.push_back(t / time_factor); + samples.push_back((t + m_settings.frame_start) / time_factor); } } else { @@ -184,7 +184,7 @@ void AbcExporter::getShutterSamples(double step, bool time_relative, const double time_inc = (shutter_close - shutter_open) / nsamples; for (double t = shutter_open; t <= shutter_close; t += time_inc) { - samples.push_back(t / time_factor); + samples.push_back((t + m_settings.frame_start) / time_factor); } } } @@ -325,16 +325,18 @@ void AbcExporter::operator()(Main *bmain, float &progress, bool &was_canceled) break; } - double f = *begin; - setCurrentFrame(bmain, f); + const double frame = *begin; - if (shape_frames.count(f) != 0) { + /* 'frame' is offset by start frame, so need to cancel the offset. */ + setCurrentFrame(bmain, frame - m_settings.frame_start); + + if (shape_frames.count(frame) != 0) { for (int i = 0, e = m_shapes.size(); i != e; ++i) { m_shapes[i]->write(); } } - if (xform_frames.count(f) == 0) { + if (xform_frames.count(frame) == 0) { continue; } @@ -518,22 +520,6 @@ void AbcExporter::createShapeWriter(Object *ob, Object *dupliObParent) return; } - ParticleSystem *psys = static_cast<ParticleSystem *>(ob->particlesystem.first); - - for (; psys; psys = psys->next) { - if (!psys_check_enabled(ob, psys, G.is_rendering) || !psys->part) { - continue; - } - - if (psys->part->type == PART_HAIR) { - m_settings.export_child_hairs = true; - m_shapes.push_back(new AbcHairWriter(m_scene, ob, xform, m_shape_sampling_index, m_settings, psys)); - } - else if (psys->part->type == PART_EMITTER) { - m_shapes.push_back(new AbcPointsWriter(m_scene, ob, xform, m_shape_sampling_index, m_settings, psys)); - } - } - switch(ob->type) { case OB_MESH: { diff --git a/source/blender/alembic/intern/abc_hair.cc b/source/blender/alembic/intern/abc_hair.cc index 45bf9b7ab8a..967c99d81e1 100644 --- a/source/blender/alembic/intern/abc_hair.cc +++ b/source/blender/alembic/intern/abc_hair.cc @@ -37,7 +37,6 @@ extern "C" { #include "BKE_DerivedMesh.h" #include "BKE_object.h" -#include "BKE_particle.h" } using Alembic::Abc::P3fArraySamplePtr; @@ -54,10 +53,10 @@ AbcHairWriter::AbcHairWriter(Scene *scene, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings, - ParticleSystem *psys) + void *UNUSED(psys)) : AbcObjectWriter(scene, ob, time_sampling, settings, parent) { - m_psys = psys; + m_psys = NULL; // = psys; OCurves curves(parent->alembicXform(), m_name, m_time_sampling); m_schema = curves.getSchema(); @@ -68,7 +67,7 @@ void AbcHairWriter::do_write() if (!m_psys) { return; } - +#if 0 ParticleSystemModifierData *psmd = psys_get_modifier(m_object, m_psys); if (!psmd->dm_final) { @@ -116,15 +115,17 @@ void AbcHairWriter::do_write() m_sample.setSelfBounds(bounds()); m_schema.set(m_sample); +#endif } void AbcHairWriter::write_hair_sample(DerivedMesh *dm, - ParticleSettings *part, + void *part, std::vector<Imath::V3f> &verts, std::vector<Imath::V3f> &norm_values, std::vector<Imath::V2f> &uv_values, std::vector<int32_t> &hvertices) { +#if 0 /* Get untransformed vertices, there's a xform under the hair. */ float inv_mat[4][4]; invert_m4_m4_safe(inv_mat, m_object->obmat); @@ -225,15 +226,17 @@ void AbcHairWriter::write_hair_sample(DerivedMesh *dm, ++path; } } +#endif } void AbcHairWriter::write_hair_child_sample(DerivedMesh *dm, - ParticleSettings *part, + void *part, std::vector<Imath::V3f> &verts, std::vector<Imath::V3f> &norm_values, std::vector<Imath::V2f> &uv_values, std::vector<int32_t> &hvertices) { +#if 0 /* Get untransformed vertices, there's a xform under the hair. */ float inv_mat[4][4]; invert_m4_m4_safe(inv_mat, m_object->obmat); @@ -287,4 +290,5 @@ void AbcHairWriter::write_hair_child_sample(DerivedMesh *dm, ++path; } } +#endif } diff --git a/source/blender/alembic/intern/abc_hair.h b/source/blender/alembic/intern/abc_hair.h index d132b60be12..bbd5f2c4361 100644 --- a/source/blender/alembic/intern/abc_hair.h +++ b/source/blender/alembic/intern/abc_hair.h @@ -26,13 +26,11 @@ #include "abc_object.h" struct DerivedMesh; -struct ParticleSettings; -struct ParticleSystem; /* ************************************************************************** */ class AbcHairWriter : public AbcObjectWriter { - ParticleSystem *m_psys; + /*ParticleSystem*/ void *m_psys; Alembic::AbcGeom::OCurvesSchema m_schema; Alembic::AbcGeom::OCurvesSchema::Sample m_sample; @@ -43,20 +41,20 @@ public: AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings, - ParticleSystem *psys); + /*ParticleSystem*/void *psys); private: virtual void do_write(); void write_hair_sample(DerivedMesh *dm, - ParticleSettings *part, + /*ParticleSettings*/ void *part, std::vector<Imath::V3f> &verts, std::vector<Imath::V3f> &norm_values, std::vector<Imath::V2f> &uv_values, std::vector<int32_t> &hvertices); void write_hair_child_sample(DerivedMesh *dm, - ParticleSettings *part, + /*ParticleSettings*/ void *part, std::vector<Imath::V3f> &verts, std::vector<Imath::V3f> &norm_values, std::vector<Imath::V2f> &uv_values, diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index f1c7b6b3aa3..4db33289232 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -272,7 +272,7 @@ static ModifierData *get_subsurf_modifier(Scene *scene, Object *ob) } /* mesh is not a subsurf. break */ - if ((md->type != eModifierType_Displace) && (md->type != eModifierType_ParticleSystem)) { + if ((md->type != eModifierType_Displace) /*&& (md->type != eModifierType_ParticleSystem)*/) { return NULL; } } @@ -968,7 +968,8 @@ AbcMeshReader::AbcMeshReader(const IObject &object, ImportSettings &settings) IPolyMesh ipoly_mesh(m_iobject, kWrapExisting); m_schema = ipoly_mesh.getSchema(); - get_min_max_time(m_schema, m_min_time, m_max_time); + + get_min_max_time(m_iobject, m_schema, m_min_time, m_max_time); } bool AbcMeshReader::valid() const @@ -1120,7 +1121,8 @@ AbcSubDReader::AbcSubDReader(const IObject &object, ImportSettings &settings) ISubD isubd_mesh(m_iobject, kWrapExisting); m_schema = isubd_mesh.getSchema(); - get_min_max_time(m_schema, m_min_time, m_max_time); + + get_min_max_time(m_iobject, m_schema, m_min_time, m_max_time); } bool AbcSubDReader::valid() const diff --git a/source/blender/alembic/intern/abc_nurbs.cc b/source/blender/alembic/intern/abc_nurbs.cc index a3c18ad6301..4f57dfdae9e 100644 --- a/source/blender/alembic/intern/abc_nurbs.cc +++ b/source/blender/alembic/intern/abc_nurbs.cc @@ -201,7 +201,7 @@ AbcNurbsReader::AbcNurbsReader(const IObject &object, ImportSettings &settings) : AbcObjectReader(object, settings) { getNurbsPatches(m_iobject); - get_min_max_time(m_schemas[0].first, m_min_time, m_max_time); + get_min_max_time(m_iobject, m_schemas[0].first, m_min_time, m_max_time); } bool AbcNurbsReader::valid() const diff --git a/source/blender/alembic/intern/abc_points.cc b/source/blender/alembic/intern/abc_points.cc index fa5b71ac094..22a51d984ef 100644 --- a/source/blender/alembic/intern/abc_points.cc +++ b/source/blender/alembic/intern/abc_points.cc @@ -30,11 +30,11 @@ extern "C" { #include "DNA_mesh_types.h" +#include "DNA_object_types.h" #include "BKE_lattice.h" #include "BKE_mesh.h" #include "BKE_object.h" -#include "BKE_particle.h" #include "BKE_scene.h" #include "BLI_math.h" @@ -61,10 +61,10 @@ AbcPointsWriter::AbcPointsWriter(Scene *scene, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings, - ParticleSystem *psys) + void *UNUSED(psys)) : AbcObjectWriter(scene, ob, time_sampling, settings, parent) { - m_psys = psys; + m_psys = NULL; // = psys; OPoints points(parent->alembicXform(), m_name, m_time_sampling); m_schema = points.getSchema(); @@ -75,7 +75,7 @@ void AbcPointsWriter::do_write() if (!m_psys) { return; } - +#if 0 std::vector<Imath::V3f> points; std::vector<Imath::V3f> velocities; std::vector<float> widths; @@ -132,6 +132,7 @@ void AbcPointsWriter::do_write() m_sample.setSelfBounds(bounds()); m_schema.set(m_sample); +#endif } /* ************************************************************************** */ @@ -141,7 +142,7 @@ AbcPointsReader::AbcPointsReader(const Alembic::Abc::IObject &object, ImportSett { IPoints ipoints(m_iobject, kWrapExisting); m_schema = ipoints.getSchema(); - get_min_max_time(m_schema, m_min_time, m_max_time); + get_min_max_time(m_iobject, m_schema, m_min_time, m_max_time); } bool AbcPointsReader::valid() const diff --git a/source/blender/alembic/intern/abc_points.h b/source/blender/alembic/intern/abc_points.h index 51f3103bd8b..cfa51e66a22 100644 --- a/source/blender/alembic/intern/abc_points.h +++ b/source/blender/alembic/intern/abc_points.h @@ -28,14 +28,12 @@ #include "abc_object.h" #include "abc_customdata.h" -class ParticleSystem; - /* ************************************************************************** */ class AbcPointsWriter : public AbcObjectWriter { Alembic::AbcGeom::OPointsSchema m_schema; Alembic::AbcGeom::OPointsSchema::Sample m_sample; - ParticleSystem *m_psys; + /*ParticleSystem*/ void *m_psys; public: AbcPointsWriter(Scene *scene, @@ -43,7 +41,7 @@ public: AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings, - ParticleSystem *psys); + /*ParticleSystem*/ void *psys); void do_write(); }; diff --git a/source/blender/alembic/intern/abc_transform.cc b/source/blender/alembic/intern/abc_transform.cc index 3326ae0ed84..7f8984f9970 100644 --- a/source/blender/alembic/intern/abc_transform.cc +++ b/source/blender/alembic/intern/abc_transform.cc @@ -137,7 +137,7 @@ AbcEmptyReader::AbcEmptyReader(const Alembic::Abc::IObject &object, ImportSettin Alembic::AbcGeom::IXform xform(object, Alembic::AbcGeom::kWrapExisting); m_schema = xform.getSchema(); - get_min_max_time(m_schema, m_min_time, m_max_time); + get_min_max_time(m_iobject, m_schema, m_min_time, m_max_time); } bool AbcEmptyReader::valid() const diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h index 688a25d85f6..648570f5f27 100644 --- a/source/blender/alembic/intern/abc_util.h +++ b/source/blender/alembic/intern/abc_util.h @@ -64,7 +64,7 @@ void create_input_transform(const Alembic::AbcGeom::ISampleSelector &sample_sel, float r_mat[4][4], float scale, bool has_alembic_parent = false); template <typename Schema> -void get_min_max_time(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(); @@ -81,6 +81,18 @@ void get_min_max_time(const Schema &schema, chrono_t &min, chrono_t &max) } } +template <typename Schema> +void get_min_max_time(const Alembic::AbcGeom::IObject &object, const Schema &schema, chrono_t &min, chrono_t &max) +{ + get_min_max_time_ex(schema, min, max); + + const Alembic::AbcGeom::IObject &parent = object.getParent(); + if (parent.valid() && Alembic::AbcGeom::IXform::matches(parent.getMetaData())) { + Alembic::AbcGeom::IXform xform(parent, Alembic::AbcGeom::kWrapExisting); + get_min_max_time_ex(xform.getSchema(), min, max); + } +} + bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string &name); /* ************************** */ diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index 0e96ac22e11..f42c708b4c2 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -585,6 +585,9 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa IArchive *archive = open_archive(data->filename); if (!archive || !archive->valid()) { + if (archive) { + delete archive; + } data->error_code = ABC_ARCHIVE_FAIL; return; } @@ -933,12 +936,12 @@ static DerivedMesh *read_mesh_sample(DerivedMesh *dm, const IObject &iobject, co CDStreamConfig config = get_config(new_dm ? new_dm : dm); - bool has_loop_normals = false; - read_mesh_sample(&settings, schema, sample_sel, config, has_loop_normals); + bool do_normals = false; + read_mesh_sample(&settings, schema, sample_sel, config, do_normals); if (new_dm) { /* Check if we had ME_SMOOTH flag set to restore it. */ - if (!has_loop_normals && check_smooth_poly_flag(dm)) { + if (!do_normals && check_smooth_poly_flag(dm)) { set_smooth_poly_flag(new_dm); } @@ -948,6 +951,10 @@ static DerivedMesh *read_mesh_sample(DerivedMesh *dm, const IObject &iobject, co return new_dm; } + if (do_normals) { + CDDM_calc_normals(dm); + } + return dm; } |