Merge pull request #7365 from howard-stearns/reregister-and-scale-after-model-change

Reregister and scale after model change
This commit is contained in:
Brad Hefta-Gaub 2016-03-16 08:04:42 -07:00
commit d840e68f05

View file

@ -48,6 +48,13 @@ RenderableModelEntityItem::~RenderableModelEntityItem() {
void RenderableModelEntityItem::setModelURL(const QString& url) {
auto& currentURL = getParsedModelURL();
if (_model && (currentURL != url)) {
// The machinery for updateModelBounds will give existing models the opportunity to fix their translation/rotation/scale/registration.
// The first two are straightforward, but the latter two have guards to make sure they don't happen after they've already been set.
// Here we reset those guards. This doesn't cause the entity values to change -- it just allows the model to match once it comes in.
_model->setScaleToFit(false, getDimensions());
_model->setSnapModelToRegistrationPoint(false, getRegistrationPoint());
}
ModelEntityItem::setModelURL(url);
if (currentURL != getParsedModelURL() || !_model) {