History

Fix model being left invisible if not auto-resized

David Rowe committed 9 years ago

Commit 591bc241 parent a4ff4f61 file · +9 −8Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+9−8
@@ -5809,19 +5809,20 @@ void Application::addAssetToWorldCheckModelSize() { · 5808 unmodified lines
5809 const glm::vec3 DEFAULT_DIMENSIONS = glm::vec3(0.1f, 0.1f, 0.1f);5809 const glm::vec3 DEFAULT_DIMENSIONS = glm::vec3(0.1f, 0.1f, 0.1f);
5810 if (dimensions != DEFAULT_DIMENSIONS) {5810 if (dimensions != DEFAULT_DIMENSIONS) {
5811 // Entity has been auto-resized; adjust dimensions if it seems too big.5811 // Entity has been auto-resized; adjust dimensions if it seems too big.
5812 5812 EntityItemProperties properties;
5813 const float RESCALE_THRESHOLD = 10.0f; // Resize entities larger than this as the FBX is likely in cm or mm.5813 const float RESCALE_THRESHOLD = 10.0f; // Resize entities larger than this as the FBX is likely in cm or mm.
5814 if (dimensions.x > RESCALE_THRESHOLD || dimensions.y > RESCALE_THRESHOLD || dimensions.z > RESCALE_THRESHOLD) {5814 if (dimensions.x > RESCALE_THRESHOLD || dimensions.y > RESCALE_THRESHOLD || dimensions.z > RESCALE_THRESHOLD) {
5815 auto dimensionsResized = dimensions * 0.01f;5815 auto dimensionsResized = dimensions * 0.01f;
5816 EntityItemProperties properties;
5817 properties.setDimensions(dimensionsResized);5816 properties.setDimensions(dimensionsResized);
5818 properties.setVisible(true);5817 qInfo(interfaceapp) << "Asset" << name << "auto-resized from" << dimensions << " to "
5819 properties.setCollisionless(false);
5820 properties.setLastEdited(usecTimestampNow());
5821 entityScriptingInterface->editEntity(entityID, properties);
5822 qInfo(interfaceapp) << "Asset" << name << "auto-resized from" << dimensions << " to "
5823 << dimensionsResized;5818 << dimensionsResized;
5819 } else {
5820 qInfo(interfaceapp) << "Asset" << name << "does not need to be auto-resized";
5824 }5821 }
5822 properties.setVisible(true);
5823 properties.setCollisionless(false);
5824 properties.setLastEdited(usecTimestampNow());
5825 entityScriptingInterface->editEntity(entityID, properties);
5825 5826
5826 item = _addAssetToWorldResizeList.erase(item); // Finished with this entity.5827 item = _addAssetToWorldResizeList.erase(item); // Finished with this entity.
5827 5828
@@ -5838,8 +5839,8 @@ void Application::addAssetToWorldCheckModelSize() { · 10 unmodified lines
5838 properties.setCollisionless(false);5839 properties.setCollisionless(false);
5839 properties.setLastEdited(usecTimestampNow());5840 properties.setLastEdited(usecTimestampNow());
5840 entityScriptingInterface->editEntity(entityID, properties);5841 entityScriptingInterface->editEntity(entityID, properties);
5841
5842 qInfo(interfaceapp) << "Asset" << name << "auto-resize timed out";5842 qInfo(interfaceapp) << "Asset" << name << "auto-resize timed out";
5843
5843 item = _addAssetToWorldResizeList.erase(item); // Finished with this entity.5844 item = _addAssetToWorldResizeList.erase(item); // Finished with this entity.
5844 5845
5845 } else {5846 } else {