From 19069ce25c30f6744310e015dbf767954efbd8ae Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 28 Jun 2018 17:06:49 -0700 Subject: Creating settings objects in the correct folders. Correctly check if clouds paused. --- indra/llinventory/llfoldertype.cpp | 2 +- indra/newview/llfloatereditextdaycycle.cpp | 11 ++++++++--- indra/newview/llfloaterfixedenvironment.cpp | 10 +++++++--- indra/newview/llinventorypanel.cpp | 1 + indra/newview/llsettingsvo.cpp | 5 ++--- indra/newview/llsettingsvo.h | 2 +- indra/newview/llviewerinventory.cpp | 6 +++--- indra/newview/llviewermenu.cpp | 18 ++++++++++-------- 8 files changed, 33 insertions(+), 22 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp index 067b22ee27..7241b3c0c2 100644 --- a/indra/llinventory/llfoldertype.cpp +++ b/indra/llinventory/llfoldertype.cpp @@ -100,7 +100,7 @@ LLFolderDictionary::LLFolderDictionary() addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new FolderEntry("stock", FALSE)); addEntry(LLFolderType::FT_MARKETPLACE_VERSION, new FolderEntry("version", FALSE)); - addEntry(LLFolderType::FT_SETTINGS, new FolderEntry("settings", FALSE)); + addEntry(LLFolderType::FT_SETTINGS, new FolderEntry("settings", TRUE)); addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); }; diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 940933955d..827e1d992d 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -981,15 +981,20 @@ void LLFloaterEditExtDayCycle::reblendSettings() void LLFloaterEditExtDayCycle::doApplyCreateNewInventory() { // This method knows what sort of settings object to create. - LLSettingsVOBase::createInventoryItem(mEditDay, [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); + LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); + + LLSettingsVOBase::createInventoryItem(mEditDay, parent_id, + [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); } void LLFloaterEditExtDayCycle::doApplyUpdateInventory() { if (mInventoryId.isNull()) - LLSettingsVOBase::createInventoryItem(mEditDay, [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); + LLSettingsVOBase::createInventoryItem(mEditDay, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), + [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); else - LLSettingsVOBase::updateInventoryItem(mEditDay, mInventoryId, [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); }); + LLSettingsVOBase::updateInventoryItem(mEditDay, mInventoryId, + [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); }); } void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where) diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index be7b55bd45..d926697117 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -270,16 +270,20 @@ void LLFloaterFixedEnvironment::onButtonCancel() void LLFloaterFixedEnvironment::doApplyCreateNewInventory() { + LLUUID parent_id = mInventoryItem ? mInventoryItem->getParentUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); // This method knows what sort of settings object to create. - LLSettingsVOBase::createInventoryItem(mSettings, [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); + LLSettingsVOBase::createInventoryItem(mSettings, parent_id, + [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); } void LLFloaterFixedEnvironment::doApplyUpdateInventory() { if (mInventoryId.isNull()) - LLSettingsVOBase::createInventoryItem(mSettings, [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); + LLSettingsVOBase::createInventoryItem(mSettings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS), + [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); }); else - LLSettingsVOBase::updateInventoryItem(mSettings, mInventoryId, [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); }); + LLSettingsVOBase::updateInventoryItem(mSettings, mInventoryId, + [this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); }); } void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 46ae200a1c..b60999e64a 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1729,6 +1729,7 @@ namespace LLInitParam declare(LLFolderType::lookup(LLFolderType::FT_INBOX) , LLFolderType::FT_INBOX); declare(LLFolderType::lookup(LLFolderType::FT_OUTBOX) , LLFolderType::FT_OUTBOX); declare(LLFolderType::lookup(LLFolderType::FT_BASIC_ROOT) , LLFolderType::FT_BASIC_ROOT); + declare(LLFolderType::lookup(LLFolderType::FT_SETTINGS) , LLFolderType::FT_SETTINGS); declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_LISTINGS) , LLFolderType::FT_MARKETPLACE_LISTINGS); declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_STOCK), LLFolderType::FT_MARKETPLACE_STOCK); declare(LLFolderType::lookup(LLFolderType::FT_MARKETPLACE_VERSION), LLFolderType::FT_MARKETPLACE_VERSION); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 646b317325..e2c8652f47 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -90,10 +90,9 @@ namespace //========================================================================= -void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings, inventory_result_fn callback) +void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, inventory_result_fn callback) { LLTransactionID tid; - LLUUID parentFolder; //= gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); U32 nextOwnerPerm = LLPermissions::DEFAULT.getMaskNextOwner(); tid.generate(); @@ -103,7 +102,7 @@ void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings }); create_inventory_settings(gAgent.getID(), gAgent.getSessionID(), - parentFolder, tid, + parent_id, tid, settings->getName(), "new settings collection.", settings->getSettingsTypeValue(), nextOwnerPerm, cb); } diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h index 7d68586fa0..5d62edd867 100644 --- a/indra/newview/llsettingsvo.h +++ b/indra/newview/llsettingsvo.h @@ -47,7 +47,7 @@ public: typedef std::function asset_download_fn; typedef std::function inventory_result_fn; - static void createInventoryItem(const LLSettingsBase::ptr_t &settings, inventory_result_fn callback = inventory_result_fn()); + static void createInventoryItem(const LLSettingsBase::ptr_t &settings, const LLUUID &parent_id, inventory_result_fn callback = inventory_result_fn()); static void updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID inv_item_id, inventory_result_fn callback = inventory_result_fn()); static void updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID object_id, LLUUID inv_item_id, inventory_result_fn callback = inventory_result_fn()); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ec457c1b5d..09b07b83b8 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1823,8 +1823,6 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, } else if (("sky" == type_name) || ("water" == type_name) || ("daycycle" == type_name)) { - LL_WARNS("LAPRAS") << "Creating settings object of type: '" << type_name << "'" << LL_ENDL; - LLSettingsBase::ptr_t settings; std::string name; @@ -1852,8 +1850,10 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, return; } + LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS); + settings->setName(name); - LLSettingsVOBase::createInventoryItem(settings); + LLSettingsVOBase::createInventoryItem(settings, parent_id); } else { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 3688f6614f..e992cce26e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8445,6 +8445,11 @@ class LLWorldEnableEnvSettings : public view_listener_t bool result = false; std::string tod = userdata.asString(); + if (tod == "pauseclouds") + { + return LLEnvironment::instance().isCloudScrollPaused(); + } + LLSettingsSky::ptr_t sky = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL); if (!sky) @@ -8453,31 +8458,28 @@ class LLWorldEnableEnvSettings : public view_listener_t } std::string skyname = (sky) ? sky->getName() : ""; + LLUUID skyid = (sky) ? sky->getAssetId() : LLUUID::null; if (tod == "sunrise") { - result = (skyname == "Sunrise"); + result = (skyid == LLEnvironment::KNOWN_SKY_SUNRISE); } else if (tod == "noon") { - result = (skyname == "Midday"); + result = (skyid == LLEnvironment::KNOWN_SKY_MIDDAY); } else if (tod == "sunset") { - result = (skyname == "Sunset"); + result = (skyid == LLEnvironment::KNOWN_SKY_SUNSET); } else if (tod == "midnight") { - result = (skyname == "Midnight"); + result = (skyid == LLEnvironment::KNOWN_SKY_MIDNIGHT); } else if (tod == "region") { return false; } - else if (tod == "pauseclouds") - { - return LLEnvironment::instance().isCloudScrollPaused(); - } else { LL_WARNS() << "Unknown time-of-day item: " << tod << LL_ENDL; -- cgit v1.2.3 From 79570e276108c59f3384d49318835fdce35ce213 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 29 Jun 2018 10:44:08 -0700 Subject: Fix moon rotation. --- indra/llinventory/llsettingssky.cpp | 46 ++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b797c1b715..91d2e9b23d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -36,28 +36,32 @@ static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); -static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) -{ - F32 sinTheta = sin(azimuth); - F32 cosTheta = cos(azimuth); - F32 sinPhi = sin(altitude); - F32 cosPhi = cos(altitude); +namespace { + LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) + { + F32 sinTheta = sin(azimuth); + F32 cosTheta = cos(azimuth); + F32 sinPhi = sin(altitude); + F32 cosPhi = cos(altitude); - LLVector3 dir; - // +x right, +z up, +y at... - dir.mV[0] = cosTheta * cosPhi; - dir.mV[1] = sinTheta * cosPhi; - dir.mV[2] = sinPhi; + LLVector3 dir; + // +x right, +z up, +y at... + dir.mV[0] = cosTheta * cosPhi; + dir.mV[1] = sinTheta * cosPhi; + dir.mV[2] = sinPhi; - LLVector3 axis = LLVector3::x_axis % dir; - axis.normalize(); + LLVector3 axis = LLVector3::x_axis % dir; + axis.normalize(); + if (mirror_axis) + axis *= -1; - F32 angle = acos(LLVector3::x_axis * dir); + F32 angle = acos(LLVector3::x_axis * dir); - LLQuaternion quat; - quat.setAngleAxis(angle, axis); + LLQuaternion quat; + quat.setAngleAxis(angle, axis); - return quat; + return quat; + } } static LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); @@ -613,8 +617,9 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) // give the sun and moon slightly different tracks through the sky // instead of positioning them at opposite poles from each other... + // but keep them on opposite sides of the sky. sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); - moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); + moonquat = convert_azimuth_and_altitude_to_quat(-(altitude + (F_PI * 0.125f)), azimuth + (F_PI * 1.125f)); // Magic constants copied form dfltsetting.xml dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); @@ -794,11 +799,10 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); - // original WL moon dir was diametrically opposed to the sun dir - LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude + F_PI); + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); - newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); + newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); } -- cgit v1.2.3