This commit is contained in:
Enrico Turri 2019-03-25 12:07:43 +01:00
parent 3f7f8f978e
commit 149551946c
2 changed files with 8 additions and 7 deletions

View File

@ -175,6 +175,11 @@ struct AMFParserContext
bool mirrory_set; bool mirrory_set;
float mirrorz; float mirrorz;
bool mirrorz_set; bool mirrorz_set;
bool anything_set() const { return deltax_set || deltay_set || deltaz_set ||
rx_set || ry_set || rz_set ||
scalex_set || scaley_set || scalez_set ||
mirrorx_set || mirrory_set || mirrorz_set; }
}; };
struct Object { struct Object {
@ -644,11 +649,7 @@ void AMFParserContext::endDocument()
continue; continue;
} }
for (const Instance &instance : object.second.instances) for (const Instance &instance : object.second.instances)
#if ENABLE_VOLUMES_CENTERING_FIXES if (instance.anything_set()) {
{
#else
if (instance.deltax_set && instance.deltay_set) {
#endif // ENABLE_VOLUMES_CENTERING_FIXES
ModelInstance *mi = m_model.objects[object.second.idx]->add_instance(); ModelInstance *mi = m_model.objects[object.second.idx]->add_instance();
mi->set_offset(Vec3d(instance.deltax_set ? (double)instance.deltax : 0.0, instance.deltay_set ? (double)instance.deltay : 0.0, instance.deltaz_set ? (double)instance.deltaz : 0.0)); mi->set_offset(Vec3d(instance.deltax_set ? (double)instance.deltax : 0.0, instance.deltay_set ? (double)instance.deltay : 0.0, instance.deltaz_set ? (double)instance.deltaz : 0.0));
mi->set_rotation(Vec3d(instance.rx_set ? (double)instance.rx : 0.0, instance.ry_set ? (double)instance.ry : 0.0, instance.rz_set ? (double)instance.rz : 0.0)); mi->set_rotation(Vec3d(instance.rx_set ? (double)instance.rx : 0.0, instance.ry_set ? (double)instance.ry : 0.0, instance.rz_set ? (double)instance.rz : 0.0));

View File

@ -1713,7 +1713,7 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
object->center_around_origin(); object->center_around_origin();
new_instances.emplace_back(object->add_instance()); new_instances.emplace_back(object->add_instance());
#else /* AUTOPLACEMENT_ON_LOAD */ #else /* AUTOPLACEMENT_ON_LOAD */
// if object has no defined position(s) we need to rearrange everything after loading object->center_around_origin(); // if object has no defined position(s) we need to rearrange everything after loading
need_arrange = true; need_arrange = true;
// add a default instance and center object around origin // add a default instance and center object around origin
object->center_around_origin(); // also aligns object to Z = 0 object->center_around_origin(); // also aligns object to Z = 0