Moved variable setting to outside of loop.

Added copy of ambient URL.
This commit is contained in:
Nissim Hadar 2018-01-11 19:35:13 -08:00
parent 86cfeac95c
commit a1f25bf49c
2 changed files with 11 additions and 6 deletions

View file

@ -2285,22 +2285,25 @@ bool EntityTree::readFromMap(QVariantMap& map) {
// Fix for older content not containing these fields in the zones
if (needsConversion && (properties.getType() == EntityTypes::EntityType::Zone)) {
// The ambient URL has been moved from "keyLight" to "ambientLight"
properties.getAmbientLight().setAmbientURL(entityMap["ambientURL"].toString());
// The background should be enabled if the mode is skybox
// Note that if the values are default then they are not stored in the JSON file
if (entityMap.contains("backgroundMode") && (entityMap["backgroundMode"].toString() == "skybox")) {
properties.setSkyboxMode(COMPONENT_MODE_ENABLED);
} else {
// Copy the skybox URL if the ambient URL is empty, as this is the legacy behaviour
if (properties.getAmbientLight().getAmbientURL() == "") {
properties.getAmbientLight().setAmbientURL(properties.getSkybox().getURL());
}
} else {
properties.setSkyboxMode(COMPONENT_MODE_INHERIT);
}
// The legacy version had no keylight/ambient modes - these are always on
properties.setKeyLightMode(COMPONENT_MODE_ENABLED);
properties.setAmbientLightMode(COMPONENT_MODE_ENABLED);
// Copy the skybox URL if the ambient URL is empty, as this is the legacy behaviour
if (properties.getAmbientLight().getAmbientURL() == "") {
properties.getAmbientLight().setAmbientURL(properties.getSkybox().getURL());
}
}
EntityItemPointer entity = addEntity(entityItemID, properties);

View file

@ -196,6 +196,8 @@ void sendWrongProtocolVersionsSignature(bool sendWrongVersion); /// for debuggin
uint qHash(const PacketType& key, uint seed);
QDebug operator<<(QDebug debug, const PacketType& type);
// Due to the different legacy behaviour, we need special processing for domains that were created before
// the zone inheritance modes were added. These have version numbers up to 80
enum class EntityVersion : PacketVersion {
StrokeColorProperty = 0,
HasDynamicOwnershipTests,