Fix(EnvAdjust): Properly update sky after cloud texture selection
Problem: When selecting a new cloud texture in the Personal Lighting floater (LLFloaterEnvironmentAdjust), the sky did not visually update. The code previously only updated LiveSky->setCloudNoiseTextureId() and called mLiveSky->update(), which failed to notify the global LLEnvironment mechanism or the renderer about the new texture. Cause: Relying solely on mLiveSky for environment changes is insufficient. To update the live environment layer (ENV_LOCAL) and trigger a render refresh, calls to LLEnvironment::setEnvironment() and LLEnvironment::updateEnvironment() are required. Solution: 1. Remove an unnecessary null-check for getChild<LLTextureCtrl>, as getChild() never returns null. 2. Clone the current sky settings (mLiveSky->buildClone()) to avoid modifying a shared environment object directly. 3. Apply the new cloud texture ID to the clone. 4. Use LLEnvironment::setEnvironment(ENV_LOCAL, sky_to_set) to apply the updated settings to the user's local environment override. 5. Call LLEnvironment::updateEnvironment(LLEnvironment::TRANSITION_INSTANT, true) to ensure the renderer recognizes and displays the updated texture immediately. 6. Reset the picker control’s value to match the newly applied texture for UI consistency. Additional Note: A partial implementation was inadvertently committed earlier (commit`04af042`) due to a local staging error. This commit supersedes that incomplete change by correctly implementing the intended fix. Result: Selecting a new cloud texture from LLFloaterEnvironmentAdjust now immediately updates both the in-world sky rendering and the texture preview UI, ensuring consistency and clarity for users. Testing: - Open the Personal Lighting floater and select various cloud textures. - Verify that the sky updates immediately for each new selection. - Confirm that the texture picker also updates to reflect the selected texture.master
parent
7c35a02225
commit
1fcabcdd32
|
|
@ -455,26 +455,28 @@ void LLFloaterEnvironmentAdjust::onMoonAzimElevChanged()
|
|||
void LLFloaterEnvironmentAdjust::onCloudMapChanged()
|
||||
{
|
||||
if (!mLiveSky)
|
||||
return;
|
||||
|
||||
// Get the texture picker control
|
||||
LLTextureCtrl* picker_ctrl = getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP);
|
||||
if (!picker_ctrl)
|
||||
{
|
||||
// Optional: Log an error if the control isn't found, though unlikely
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the new texture ID selected by the user
|
||||
LLTextureCtrl* picker_ctrl = getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP);
|
||||
|
||||
LLUUID new_texture_id = picker_ctrl->getValue().asUUID();
|
||||
|
||||
// Update the internal sky settings object
|
||||
mLiveSky->setCloudNoiseTextureId(new_texture_id);
|
||||
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
|
||||
|
||||
// Trigger the update for the sky rendering
|
||||
mLiveSky->update();
|
||||
LLSettingsSky::ptr_t sky_to_set = mLiveSky->buildClone();
|
||||
if (!sky_to_set)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sky_to_set->setCloudNoiseTextureId(new_texture_id);
|
||||
|
||||
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, sky_to_set);
|
||||
|
||||
LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_INSTANT, true);
|
||||
|
||||
// Explicitly refresh the UI picker control to match the applied change
|
||||
picker_ctrl->setValue(new_texture_id);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue