mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Move auto-resize to update
This commit is contained in:
parent
bcd148cb87
commit
ae83dfe041
3 changed files with 22 additions and 14 deletions
|
@ -4068,7 +4068,7 @@ bool Application::askToLoadScript(const QString& scriptFilenameOrURL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Application::askToUploadAsset(const QString& filename) {
|
bool Application::askToUploadAsset(const QString& filename) {
|
||||||
if (DependencyManager::get<NodeList>()->getThisNodeCanRez()) {
|
if (!DependencyManager::get<NodeList>()->getThisNodeCanRez()) {
|
||||||
QMessageBox::warning(_window, "Failed Upload",
|
QMessageBox::warning(_window, "Failed Upload",
|
||||||
QString("You don't have upload rights on that domain.\n\n"));
|
QString("You don't have upload rights on that domain.\n\n"));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -298,16 +298,7 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool movingOrAnimating = isMoving() || isAnimatingSomething();
|
bool movingOrAnimating = isMoving() || isAnimatingSomething();
|
||||||
if ((movingOrAnimating || _needsInitialSimulation) && _model->isActive()) {
|
if ((movingOrAnimating || _needsInitialSimulation) && _model->isActive() && _dimensionsInitialized) {
|
||||||
if (!_dimensionsInitialized) {
|
|
||||||
EntityItemProperties properties;
|
|
||||||
auto extents = _model->getMeshExtents();
|
|
||||||
properties.setDimensions(extents.maximum - extents.minimum);
|
|
||||||
|
|
||||||
qCDebug(entitiesrenderer) << "Autoresizing:" << (!getName().isEmpty() ? getName() : getModelURL());
|
|
||||||
DependencyManager::get<EntityScriptingInterface>()->editEntity(getEntityItemID(), properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
_model->setScaleToFit(true, getDimensions());
|
_model->setScaleToFit(true, getDimensions());
|
||||||
_model->setSnapModelToRegistrationPoint(true, getRegistrationPoint());
|
_model->setSnapModelToRegistrationPoint(true, getRegistrationPoint());
|
||||||
_model->setRotation(getRotation());
|
_model->setRotation(getRotation());
|
||||||
|
@ -376,7 +367,23 @@ Model* RenderableModelEntityItem::getModel(EntityTreeRenderer* renderer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderableModelEntityItem::needsToCallUpdate() const {
|
bool RenderableModelEntityItem::needsToCallUpdate() const {
|
||||||
return _needsInitialSimulation || ModelEntityItem::needsToCallUpdate();
|
return !_dimensionsInitialized || _needsInitialSimulation || ModelEntityItem::needsToCallUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderableModelEntityItem::update(const quint64& now) {
|
||||||
|
if (!_dimensionsInitialized && _model && _model->isActive()) {
|
||||||
|
EntityItemProperties properties;
|
||||||
|
auto extents = _model->getMeshExtents();
|
||||||
|
properties.setDimensions(extents.maximum - extents.minimum);
|
||||||
|
|
||||||
|
qCDebug(entitiesrenderer) << "Autoresizing:" << (!getName().isEmpty() ? getName() : getModelURL());
|
||||||
|
QMetaObject::invokeMethod(DependencyManager::get<EntityScriptingInterface>().data(), "editEntity",
|
||||||
|
Qt::QueuedConnection,
|
||||||
|
Q_ARG(QUuid, getEntityItemID()),
|
||||||
|
Q_ARG(EntityItemProperties, properties));
|
||||||
|
}
|
||||||
|
|
||||||
|
ModelEntityItem::update(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityItemProperties RenderableModelEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
|
EntityItemProperties RenderableModelEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
|
||||||
|
|
|
@ -57,8 +57,9 @@ public:
|
||||||
void** intersectedObject, bool precisionPicking) const;
|
void** intersectedObject, bool precisionPicking) const;
|
||||||
|
|
||||||
Model* getModel(EntityTreeRenderer* renderer);
|
Model* getModel(EntityTreeRenderer* renderer);
|
||||||
|
|
||||||
bool needsToCallUpdate() const;
|
virtual bool needsToCallUpdate() const;
|
||||||
|
virtual void update(const quint64& now);
|
||||||
|
|
||||||
virtual void setCompoundShapeURL(const QString& url);
|
virtual void setCompoundShapeURL(const QString& url);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue