Expose handleSetShaderChanged() in llviewercontrol and wire up in quickprefs to avoid code duplication

Ansariel 2013-02-21 11:57:29 +01:00
parent 73f18b4317
commit 3aad568616
3 changed files with 8 additions and 13 deletions

View File

@ -152,7 +152,10 @@ static bool handleTerrainDetailChanged(const LLSD& newvalue)
}
static bool handleSetShaderChanged(const LLSD& newvalue)
// <FS:Ansariel> Expose handleSetShaderChanged()
//static bool handleSetShaderChanged(const LLSD& newvalue)
bool handleSetShaderChanged(const LLSD& newvalue)
// </FS:Ansariel>
{
// changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache
gBumpImageList.destroyGL();

View File

@ -47,6 +47,9 @@ void settings_setup_listeners();
// for the graphics settings
void create_graphics_group(LLControlGroup& group);
// <FS:Ansariel> Expose handleSetShaderChanged()
bool handleSetShaderChanged(const LLSD& newvalue);
// saved at end of session
extern LLControlGroup gSavedSettings;
extern LLControlGroup gSavedPerAccountSettings;

View File

@ -73,22 +73,11 @@ FloaterQuickPrefs::QuickPrefsXMLEntry::QuickPrefsXMLEntry()
{}
// </FS:Zi>
// Ansariel: Copied from llviewercontrol.cpp, handleSetShaderChanged()
static void handleShaderChanged()
{
// changing shader level may invalidate existing cached bump maps, as the shader type determines the format of the bump map it expects - clear and repopulate the bump cache
gBumpImageList.destroyGL();
gBumpImageList.restoreGL();
// else, leave terrain detail as is
LLViewerShaderMgr::instance()->setShaders();
}
FloaterQuickPrefs::FloaterQuickPrefs(const LLSD& key)
: LLTransientDockableFloater(NULL, true, key)
{
// For Phototools
mCommitCallbackRegistrar.add("Quickprefs.ShaderChanged", boost::bind(&handleShaderChanged));
mCommitCallbackRegistrar.add("Quickprefs.ShaderChanged", boost::bind(&handleSetShaderChanged, LLSD()));
}
FloaterQuickPrefs::~FloaterQuickPrefs()