mirror of
https://github.com/overte-org/overte.git
synced 2025-07-29 16:20:00 +02:00
Fix model auto-scaling to 1% not being seen by observers take 2
This commit is contained in:
parent
14ecb24986
commit
8a399c7cc0
1 changed files with 10 additions and 12 deletions
|
@ -5662,12 +5662,14 @@ void Application::addAssetToWorldAddEntity(QString mapping) {
|
||||||
properties.setModelURL("atp:" + mapping);
|
properties.setModelURL("atp:" + mapping);
|
||||||
properties.setShapeType(SHAPE_TYPE_SIMPLE_COMPOUND);
|
properties.setShapeType(SHAPE_TYPE_SIMPLE_COMPOUND);
|
||||||
properties.setCollisionless(true); // Temporarily set so that doesn't collide with avatar.
|
properties.setCollisionless(true); // Temporarily set so that doesn't collide with avatar.
|
||||||
|
properties.setVisible(false); // Temporarily set so that don't see at large unresized dimensions.
|
||||||
properties.setDynamic(false);
|
properties.setDynamic(false);
|
||||||
properties.setPosition(getMyAvatar()->getPosition() + getMyAvatar()->getOrientation() * glm::vec3(0.0f, 0.0f, -2.0f));
|
properties.setPosition(getMyAvatar()->getPosition() + getMyAvatar()->getOrientation() * glm::vec3(0.0f, 0.0f, -2.0f));
|
||||||
properties.setGravity(glm::vec3(0.0f, 0.0f, 0.0f));
|
properties.setGravity(glm::vec3(0.0f, 0.0f, 0.0f));
|
||||||
auto entityID = DependencyManager::get<EntityScriptingInterface>()->addEntity(properties);
|
auto entityID = DependencyManager::get<EntityScriptingInterface>()->addEntity(properties);
|
||||||
|
|
||||||
// Note: Model dimensions are not available here; model is scaled per FBX mesh in RenderableModelEntityItem::update() later
|
// Note: Model dimensions are not available here; model is scaled per FBX mesh in RenderableModelEntityItem::update() later
|
||||||
// on. But FBX dimensions may be in cm or mm, so we monitor for the dimension change and rescale again if warranted.
|
// on. But FBX dimensions may be in cm, so we monitor for the dimension change and rescale again if warranted.
|
||||||
|
|
||||||
if (entityID == QUuid()) {
|
if (entityID == QUuid()) {
|
||||||
QString errorInfo = "Could not add asset " + mapping + " to world.";
|
QString errorInfo = "Could not add asset " + mapping + " to world.";
|
||||||
|
@ -5710,16 +5712,10 @@ void Application::addAssetToWorldCheckModelSize() {
|
||||||
dimensions *= 0.01f;
|
dimensions *= 0.01f;
|
||||||
EntityItemProperties properties;
|
EntityItemProperties properties;
|
||||||
properties.setDimensions(dimensions);
|
properties.setDimensions(dimensions);
|
||||||
properties.setCollisionless(false); // Reset to default.
|
properties.setVisible(true);
|
||||||
|
properties.setCollisionless(false);
|
||||||
// Edit entity via invokeMethod() to ensure that observers get this resize after the auto-resize edit performed
|
properties.setLastEdited(usecTimestampNow());
|
||||||
// in RenderableModelEntityItem::update().
|
entityScriptingInterface->editEntity(entityID, properties);
|
||||||
//entityScriptingInterface->editEntity(entityID, properties);
|
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<EntityScriptingInterface>().data(), "editEntity",
|
|
||||||
Qt::QueuedConnection,
|
|
||||||
Q_ARG(QUuid, entityID),
|
|
||||||
Q_ARG(EntityItemProperties, properties));
|
|
||||||
|
|
||||||
qInfo() << "Asset auto-resized";
|
qInfo() << "Asset auto-resized";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5734,7 +5730,9 @@ void Application::addAssetToWorldCheckModelSize() {
|
||||||
// Have done enough checks; model was either the default size or something's gone wrong.
|
// Have done enough checks; model was either the default size or something's gone wrong.
|
||||||
|
|
||||||
EntityItemProperties properties;
|
EntityItemProperties properties;
|
||||||
properties.setCollisionless(false); // Reset to default.
|
properties.setVisible(true);
|
||||||
|
properties.setCollisionless(false);
|
||||||
|
properties.setLastEdited(usecTimestampNow());
|
||||||
entityScriptingInterface->editEntity(entityID, properties);
|
entityScriptingInterface->editEntity(entityID, properties);
|
||||||
|
|
||||||
item = _addAssetToWorldResizeList.erase(item); // Finished with this entity.
|
item = _addAssetToWorldResizeList.erase(item); // Finished with this entity.
|
||||||
|
|
Loading…
Reference in a new issue