Some minor tweaks to llfloaterpostprocess
Just to make it a little nicer and cleaner, a few changes are from upstream.
This commit is contained in:
@@ -75,8 +75,8 @@ LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater(std::string("Post-Proce
|
|||||||
//Hacky, but for now checkboxes and sliders are assumed to link to shader uniforms.
|
//Hacky, but for now checkboxes and sliders are assumed to link to shader uniforms.
|
||||||
if(dynamic_cast<LLSliderCtrl*>(*child_it) || dynamic_cast<LLCheckBoxCtrl*>(*child_it))
|
if(dynamic_cast<LLSliderCtrl*>(*child_it) || dynamic_cast<LLCheckBoxCtrl*>(*child_it))
|
||||||
{
|
{
|
||||||
LLUICtrl *ctrl = dynamic_cast<LLUICtrl*>(*child_it);
|
LLUICtrl* ctrl = static_cast<LLUICtrl*>(*child_it);
|
||||||
ctrl->setCommitCallback(boost::bind(&LLFloaterPostProcess::onControlChanged, _1, (void*)ctrl->getName().c_str()));
|
ctrl->setCommitCallback(boost::bind(&LLFloaterPostProcess::onControlChanged, _1, _2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,14 +84,13 @@ LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater(std::string("Post-Proce
|
|||||||
|
|
||||||
// Effect loading and saving.
|
// Effect loading and saving.
|
||||||
LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo");
|
LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo");
|
||||||
childSetAction("PPLoadEffect", &LLFloaterPostProcess::onLoadEffect, comboBox);
|
getChild<LLUICtrl>("PPLoadEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onLoadEffect, this, comboBox));
|
||||||
comboBox->setCommitCallback(onChangeEffectName);
|
comboBox->setCommitCallback(boost::bind(&LLFloaterPostProcess::onChangeEffectName, this, _1));
|
||||||
|
|
||||||
LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor");
|
LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor");
|
||||||
childSetAction("PPSaveEffect", &LLFloaterPostProcess::onSaveEffect, editBox);
|
getChild<LLUICtrl>("PPSaveEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onSaveEffect, this, editBox));
|
||||||
|
|
||||||
syncMenu();
|
syncMenu();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LLFloaterPostProcess::~LLFloaterPostProcess()
|
LLFloaterPostProcess::~LLFloaterPostProcess()
|
||||||
@@ -113,47 +112,42 @@ LLFloaterPostProcess* LLFloaterPostProcess::instance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LLFloaterPostProcess::onControlChanged(LLUICtrl* ctrl, void* userData)
|
void LLFloaterPostProcess::onControlChanged(LLUICtrl* ctrl, const LLSD& v)
|
||||||
{
|
{
|
||||||
LLSD v = ctrl->getValue();
|
LLPostProcess::getInstance()->setSelectedEffectValue(ctrl->getName(), v);
|
||||||
LLPostProcess::getInstance()->setSelectedEffectValue((char const *)userData, v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterPostProcess::onLoadEffect(void* userData)
|
void LLFloaterPostProcess::onLoadEffect(LLComboBox* comboBox)
|
||||||
{
|
{
|
||||||
LLComboBox* comboBox = static_cast<LLComboBox*>(userData);
|
|
||||||
|
|
||||||
LLSD::String effectName(comboBox->getSelectedValue().asString());
|
LLSD::String effectName(comboBox->getSelectedValue().asString());
|
||||||
|
|
||||||
LLPostProcess::getInstance()->setSelectedEffect(effectName);
|
LLPostProcess::getInstance()->setSelectedEffect(effectName);
|
||||||
|
|
||||||
sPostProcess->syncMenu();
|
syncMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterPostProcess::onSaveEffect(void* userData)
|
void LLFloaterPostProcess::onSaveEffect(LLLineEditor* editBox)
|
||||||
{
|
{
|
||||||
LLLineEditor* editBox = static_cast<LLLineEditor*>(userData);
|
|
||||||
|
|
||||||
std::string effectName(editBox->getValue().asString());
|
std::string effectName(editBox->getValue().asString());
|
||||||
|
|
||||||
if (LLPostProcess::getInstance()->getAllEffectInfo().has(effectName))
|
if (LLPostProcess::getInstance()->getAllEffectInfo().has(effectName))
|
||||||
{
|
{
|
||||||
LLSD payload;
|
LLSD payload;
|
||||||
payload["effect_name"] = effectName;
|
payload["effect_name"] = effectName;
|
||||||
LLNotificationsUtil::add("PPSaveEffectAlert", LLSD(), payload, &LLFloaterPostProcess::saveAlertCallback);
|
LLNotificationsUtil::add("PPSaveEffectAlert", LLSD(), payload, boost::bind(&LLFloaterPostProcess::saveAlertCallback, this, _1, _2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLPostProcess::getInstance()->saveEffectAs(effectName);
|
LLPostProcess::getInstance()->saveEffectAs(effectName);
|
||||||
sPostProcess->syncMenu();
|
syncMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl, void * userData)
|
void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl)
|
||||||
{
|
{
|
||||||
// get the combo box and name
|
// get the combo box and name
|
||||||
LLComboBox * comboBox = static_cast<LLComboBox*>(ctrl);
|
LLComboBox * comboBox = static_cast<LLComboBox*>(ctrl);
|
||||||
LLLineEditor* editBox = sPostProcess->getChild<LLLineEditor>("PPEffectNameEditor");
|
LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor");
|
||||||
|
|
||||||
// set the parameter's new name
|
// set the parameter's new name
|
||||||
editBox->setValue(comboBox->getSelectedValue());
|
editBox->setValue(comboBox->getSelectedValue());
|
||||||
@@ -168,7 +162,7 @@ bool LLFloaterPostProcess::saveAlertCallback(const LLSD& notification, const LLS
|
|||||||
{
|
{
|
||||||
LLPostProcess::getInstance()->saveEffectAs(notification["payload"]["effect_name"].asString());
|
LLPostProcess::getInstance()->saveEffectAs(notification["payload"]["effect_name"].asString());
|
||||||
|
|
||||||
sPostProcess->syncMenu();
|
syncMenu();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
|
|
||||||
class LLButton;
|
class LLButton;
|
||||||
|
class LLComboBox;
|
||||||
|
class LLLineEditor;
|
||||||
class LLSliderCtrl;
|
class LLSliderCtrl;
|
||||||
class LLTabContainer;
|
class LLTabContainer;
|
||||||
class LLPanelPermissions;
|
class LLPanelPermissions;
|
||||||
@@ -58,13 +60,13 @@ public:
|
|||||||
static LLFloaterPostProcess* instance();
|
static LLFloaterPostProcess* instance();
|
||||||
|
|
||||||
/// post process callbacks
|
/// post process callbacks
|
||||||
static void onControlChanged(LLUICtrl* ctrl, void* userData);
|
static void onControlChanged(LLUICtrl* ctrl, const LLSD& v);
|
||||||
static void onLoadEffect(void* userData);
|
void onLoadEffect(LLComboBox* comboBox);
|
||||||
static void onSaveEffect(void* userData);
|
void onSaveEffect(LLLineEditor* editBox);
|
||||||
static void onChangeEffectName(LLUICtrl* ctrl, void * userData);
|
void onChangeEffectName(LLUICtrl* ctrl);
|
||||||
|
|
||||||
/// prompts a user when overwriting an effect
|
/// prompts a user when overwriting an effect
|
||||||
static bool saveAlertCallback(const LLSD& notification, const LLSD& response);
|
bool saveAlertCallback(const LLSD& notification, const LLSD& response);
|
||||||
|
|
||||||
/// show off our menu
|
/// show off our menu
|
||||||
static void show();
|
static void show();
|
||||||
|
|||||||
Reference in New Issue
Block a user