From 96f007a9f0e83a62492366c66f5ad3ecdf483c4a Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Sun, 10 Apr 2011 11:51:41 +0200 Subject: fix some flaws in the cloud particle prefs --- linden/indra/newview/app_settings/settings.xml | 11 ++++++++ linden/indra/newview/llprefsadvanced.cpp | 32 +++++++++++++++++++--- linden/indra/newview/llprefsadvanced.h | 1 + linden/indra/newview/llviewermenu.cpp | 14 ---------- linden/indra/newview/llvoavatar.cpp | 25 ++++++++++++----- .../skins/default/xui/en-us/menu_viewer.xml | 7 ----- .../default/xui/en-us/panel_particle_settings.xml | 9 ++++-- .../xui/en-us/panel_preferences_advanced.xml | 7 ++++- 8 files changed, 70 insertions(+), 36 deletions(-) (limited to 'linden/indra/newview') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index bdaf8cc..80eb65a 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -938,6 +938,17 @@ Value 1 + PreviewAvatarAsCloud + + Comment + Turns your avatar into the paricle clud if true + Persist + 0 + Type + Boolean + Value + 0 + PrivateLookAtTarget Comment diff --git a/linden/indra/newview/llprefsadvanced.cpp b/linden/indra/newview/llprefsadvanced.cpp index ad60694..f1b2428 100644 --- a/linden/indra/newview/llprefsadvanced.cpp +++ b/linden/indra/newview/llprefsadvanced.cpp @@ -119,7 +119,7 @@ BOOL LLPrefsAdvanced::postBuild() getChild("ac_button")->setClickedCallback(onAutoCorrectButton,this); initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck"); - + getChild("reset_cloud_this_account")->setClickedCallback(onResetThisCloudButton,this); getChild("save_cloud_this_account")->setClickedCallback(onSaveThisCloudButton,this); getChild("save_cloud_any_account")->setClickedCallback(onSaveAnyoneCloudButton,this); @@ -214,8 +214,11 @@ void LLPrefsAdvanced::apply() LLComboBox* crash_behavior_combobox = getChild("crash_behavior_combobox"); gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, crash_behavior_combobox->getCurrentIndex()); - - onSaveThisCloudButton(NULL); + + if (LLStartUp::isLoggedIn() && LLVOAvatar::sHasCloud) + { + onSaveThisCloudButton(NULL); + } } void LLPrefsAdvanced::cancel() @@ -344,13 +347,15 @@ void LLPrefsAdvanced::draw() void LLPrefsAdvanced::setParticleControls(bool is_logged_in) { - + childSetEnabled("reset_cloud_this_account", is_logged_in ); childSetEnabled("save_cloud_this_account", is_logged_in); childSetEnabled("save_cloud_any_account", is_logged_in); childSetEnabled("part_start_color_swatch", is_logged_in); childSetEnabled("part_end_color_swatch", is_logged_in); childSetEnabled("part_texture_picker", is_logged_in ); + childSetEnabled("preview_cloud", is_logged_in); + childSetVisible("preview_cloud", is_logged_in); childSetVisible("must_be_logged_in_textbox", !is_logged_in); } @@ -419,6 +424,25 @@ void LLPrefsAdvanced::onClickCommandLine(void* data) FloaterCommandLine::getInstance()->center(); } +void LLPrefsAdvanced::onResetThisCloudButton(void * data) +{ + LLPrefsAdvanced* self = (LLPrefsAdvanced*)data; + if (!self) + { + return; + } + + // keep draw() from overriding the cloud with the values from the UI + LLVOAvatar::sHasCloud = false; + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "cloud.xml"); + LLVOAvatar::loadCloud(filename, LLVOAvatar::sCloud); + + // tell draw() to override values from the UI with the data from the new cloud + self-> mWasLoggedIn = !(LLStartUp::isLoggedIn()); + + LLVOAvatar::sHasCloud = true; +} + void LLPrefsAdvanced::onSaveThisCloudButton(void * data) { std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "cloud.xml"); diff --git a/linden/indra/newview/llprefsadvanced.h b/linden/indra/newview/llprefsadvanced.h index 87ddc59..e4febcc 100644 --- a/linden/indra/newview/llprefsadvanced.h +++ b/linden/indra/newview/llprefsadvanced.h @@ -59,6 +59,7 @@ private: static void onSpellEditCustom(void* data); static void onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata); static void onAutoCorrectButton(void * data); + static void onResetThisCloudButton(void * data); static void onSaveThisCloudButton(void * data); static void onSaveAnyoneCloudButton(void * data); diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index e270dbb..c8adf7b 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -10724,19 +10724,6 @@ class LLAdvancedDumpAvatarLocalTextures : public view_listener_t } }; -/////////////////////////////////// -// Reload Avatar Cloud Particles // -/////////////////////////////////// - - -class LLAdvancedReloadAvatarCloudParticle : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLVOAvatar::initCloud(); - return true; - } -}; /////////// // Crash // @@ -11526,7 +11513,6 @@ void initialize_menus() addMenu(new LLAdvancedDumpAttachments(), "Advanced.DumpAttachments"); addMenu(new LLAdvancedDebugAvatarTextures(), "Advanced.DebugAvatarTextures"); addMenu(new LLAdvancedDumpAvatarLocalTextures(), "Advanced.DumpAvatarLocalTextures"); - addMenu(new LLAdvancedReloadAvatarCloudParticle(), "Advanced.ReloadAvatarCloudParticle"); // Advanced > Crash addMenu(new LLAdvancedCrash(), "Advanced.Crash"); diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index d8b0994..8ddc936 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp @@ -1521,10 +1521,12 @@ void LLVOAvatar::loadCloud(const std::string& filename, LLPartSysData& particle LLSDSerialize::fromXMLDocument(cloud, in_file); particles.fromLLSD(cloud); - if(particles.mPartImageID.isNull()) + const LLUUID default_id = DEFAULT_UNREZZED_AVATAR_PARTICLE; + if(particles.mPartImageID.isNull() || default_id == particles.mPartImageID) { - LLViewerImage* cloud_image = gImageList.getImageFromFile("cloud-particle.j2c"); - particles.mPartImageID = cloud_image->getID(); + LLViewerImage* cloud_image = + gImageList.getImageFromFile("cloud-particle.j2c", MIPMAP_YES, IMMEDIATE_YES, 0, 0, default_id); + particles.mPartImageID = default_id; } } @@ -7431,6 +7433,7 @@ BOOL LLVOAvatar::isVisible() // returns true if the value has changed. BOOL LLVOAvatar::updateIsFullyLoaded() { + // a "heuristic" to determine if we have enough avatar data to render // (to avoid rendering a "Ruth" - DEV-3168) @@ -7510,11 +7513,19 @@ BOOL LLVOAvatar::updateIsFullyLoaded() BOOL LLVOAvatar::isFullyLoaded() { + static BOOL* sPreviewAvatarCloud = rebind_llcontrol("PreviewAvatarAsCloud", &gSavedSettings, true); static BOOL* sRenderUnloadedAvatar = rebind_llcontrol("RenderUnloadedAvatar", &gSavedSettings, true); - if (*sRenderUnloadedAvatar) - return TRUE; - else - return mFullyLoaded; + + if(*sPreviewAvatarCloud && mIsSelf) + { + return FALSE; + } + else if (*sRenderUnloadedAvatar) + { + return TRUE; + } + + return mFullyLoaded; } diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml index b31122a..d5b07c8 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -1992,13 +1992,6 @@ - - - diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_particle_settings.xml b/linden/indra/newview/skins/default/xui/en-us/panel_particle_settings.xml index e5064dd..c1e1da9 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_particle_settings.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_particle_settings.xml @@ -9,7 +9,7 @@ left="1" mouse_opaque="true" name="ParticleSettings" width="418"> Start Color: @@ -20,7 +20,7 @@ left="1" mouse_opaque="true" name="ParticleSettings" width="418"> End Color: @@ -32,10 +32,13 @@ left="1" mouse_opaque="true" name="ParticleSettings" width="418"> +