mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 09:57:26 +02:00
Add extra logging for Clara.io asset resizing
This commit is contained in:
parent
1f3045ad30
commit
aefa116207
2 changed files with 13 additions and 5 deletions
|
@ -5746,23 +5746,29 @@ void Application::addAssetToWorldCheckModelSize() {
|
||||||
while (item != _addAssetToWorldResizeList.end()) {
|
while (item != _addAssetToWorldResizeList.end()) {
|
||||||
auto entityID = item.key();
|
auto entityID = item.key();
|
||||||
|
|
||||||
|
EntityPropertyFlags propertyFlags;
|
||||||
|
propertyFlags += PROP_NAME;
|
||||||
|
propertyFlags += PROP_DIMENSIONS;
|
||||||
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
||||||
auto properties = entityScriptingInterface->getEntityProperties(entityID, EntityPropertyFlags("dimensions"));
|
auto properties = entityScriptingInterface->getEntityProperties(entityID, propertyFlags);
|
||||||
|
auto name = properties.getName();
|
||||||
auto dimensions = properties.getDimensions();
|
auto dimensions = properties.getDimensions();
|
||||||
|
|
||||||
const glm::vec3 DEFAULT_DIMENSIONS = glm::vec3(0.1f, 0.1f, 0.1f);
|
const glm::vec3 DEFAULT_DIMENSIONS = glm::vec3(0.1f, 0.1f, 0.1f);
|
||||||
if (dimensions != DEFAULT_DIMENSIONS) {
|
if (dimensions != DEFAULT_DIMENSIONS) {
|
||||||
// Entity has been auto-resized; adjust dimensions if it seems too big.
|
// Entity has been auto-resized; adjust dimensions if it seems too big.
|
||||||
|
|
||||||
const float RESCALE_THRESHOLD = 10.0f; // Resize entities larger than this as the FBX is likely in cm or mm.
|
const float RESCALE_THRESHOLD = 10.0f; // Resize entities larger than this as the FBX is likely in cm or mm.
|
||||||
if (dimensions.x > RESCALE_THRESHOLD || dimensions.y > RESCALE_THRESHOLD || dimensions.z > RESCALE_THRESHOLD) {
|
if (dimensions.x > RESCALE_THRESHOLD || dimensions.y > RESCALE_THRESHOLD || dimensions.z > RESCALE_THRESHOLD) {
|
||||||
dimensions *= 0.01f;
|
auto dimensionsResized = dimensions * 0.01f;
|
||||||
EntityItemProperties properties;
|
EntityItemProperties properties;
|
||||||
properties.setDimensions(dimensions);
|
properties.setDimensions(dimensionsResized);
|
||||||
properties.setVisible(true);
|
properties.setVisible(true);
|
||||||
properties.setCollisionless(false);
|
properties.setCollisionless(false);
|
||||||
properties.setLastEdited(usecTimestampNow());
|
properties.setLastEdited(usecTimestampNow());
|
||||||
entityScriptingInterface->editEntity(entityID, properties);
|
entityScriptingInterface->editEntity(entityID, properties);
|
||||||
qInfo(interfaceapp) << "Asset auto-resized";
|
qInfo(interfaceapp) << "Asset" << name << "auto-resized from" << dimensions << " to "
|
||||||
|
<< dimensionsResized;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = _addAssetToWorldResizeList.erase(item); // Finished with this entity.
|
item = _addAssetToWorldResizeList.erase(item); // Finished with this entity.
|
||||||
|
@ -5781,6 +5787,7 @@ void Application::addAssetToWorldCheckModelSize() {
|
||||||
properties.setLastEdited(usecTimestampNow());
|
properties.setLastEdited(usecTimestampNow());
|
||||||
entityScriptingInterface->editEntity(entityID, properties);
|
entityScriptingInterface->editEntity(entityID, properties);
|
||||||
|
|
||||||
|
qInfo(interfaceapp) << "Asset" << name << "auto-resize timed out";
|
||||||
item = _addAssetToWorldResizeList.erase(item); // Finished with this entity.
|
item = _addAssetToWorldResizeList.erase(item); // Finished with this entity.
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -533,7 +533,8 @@ void RenderableModelEntityItem::update(const quint64& now) {
|
||||||
properties.setLastEdited(usecTimestampNow()); // we must set the edit time since we're editing it
|
properties.setLastEdited(usecTimestampNow()); // we must set the edit time since we're editing it
|
||||||
auto extents = _model->getMeshExtents();
|
auto extents = _model->getMeshExtents();
|
||||||
properties.setDimensions(extents.maximum - extents.minimum);
|
properties.setDimensions(extents.maximum - extents.minimum);
|
||||||
qCDebug(entitiesrenderer) << "Autoresizing:" << (!getName().isEmpty() ? getName() : getModelURL());
|
qCDebug(entitiesrenderer) << "Autoresizing" << (!getName().isEmpty() ? getName() : getModelURL())
|
||||||
|
<< "from mesh extents";
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<EntityScriptingInterface>().data(), "editEntity",
|
QMetaObject::invokeMethod(DependencyManager::get<EntityScriptingInterface>().data(), "editEntity",
|
||||||
Qt::QueuedConnection,
|
Qt::QueuedConnection,
|
||||||
Q_ARG(QUuid, getEntityItemID()),
|
Q_ARG(QUuid, getEntityItemID()),
|
||||||
|
|
Loading…
Reference in a new issue