|
|
@ -28,35 +28,20 @@ namespace fx
|
|
|
|
{
|
|
|
|
{
|
|
|
|
void EditBool::setValue(bool value)
|
|
|
|
void EditBool::setValue(bool value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto uniform = mUniform.lock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!uniform)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mCheckbutton->setCaptionWithReplacing(value ? "#{Interface:On}" : "#{Interface:Off}");
|
|
|
|
mCheckbutton->setCaptionWithReplacing(value ? "#{Interface:On}" : "#{Interface:Off}");
|
|
|
|
mFill->setVisible(value);
|
|
|
|
mFill->setVisible(value);
|
|
|
|
|
|
|
|
|
|
|
|
uniform->setValue<bool>(value);
|
|
|
|
mUniform->setValue<bool>(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EditBool::setValueFromUniform()
|
|
|
|
void EditBool::setValueFromUniform()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto uniform = mUniform.lock();
|
|
|
|
setValue(mUniform->template getValue<bool>());
|
|
|
|
|
|
|
|
|
|
|
|
if (!uniform)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setValue(uniform->template getValue<bool>());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EditBool::toDefault()
|
|
|
|
void EditBool::toDefault()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto uniform = mUniform.lock();
|
|
|
|
setValue(mUniform->getDefault<bool>());
|
|
|
|
|
|
|
|
|
|
|
|
if (!uniform)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setValue(uniform->getDefault<bool>());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EditBool::initialiseOverride()
|
|
|
|
void EditBool::initialiseOverride()
|
|
|
@ -71,12 +56,75 @@ namespace fx
|
|
|
|
|
|
|
|
|
|
|
|
void EditBool::notifyMouseButtonClick(MyGUI::Widget* sender)
|
|
|
|
void EditBool::notifyMouseButtonClick(MyGUI::Widget* sender)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto uniform = mUniform.lock();
|
|
|
|
setValue(!mUniform->getValue<bool>());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
|
|
|
|
void EditChoice::setValue(const T& value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Update the combo view
|
|
|
|
|
|
|
|
for (size_t i = 0; i < this->mChoices->getItemCount(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (*this->mChoices->getItemDataAt<T>(i) == value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this->mChoices->setIndexSelected(i);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mUniform->template setValue<T>(value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EditChoice::notifyComboBoxChanged(MyGUI::ComboBox* sender, size_t pos)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::visit(
|
|
|
|
|
|
|
|
[this, sender, pos](auto&& data) {
|
|
|
|
|
|
|
|
using T = typename std::decay_t<decltype(data)>::value_type;
|
|
|
|
|
|
|
|
setValue<T>(*sender->getItemDataAt<T>(pos));
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mUniform->mData);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EditChoice::setValueFromUniform()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::visit(
|
|
|
|
|
|
|
|
[this](auto&& data) {
|
|
|
|
|
|
|
|
using T = typename std::decay_t<decltype(data)>::value_type;
|
|
|
|
|
|
|
|
size_t index = 0;
|
|
|
|
|
|
|
|
for (const auto& choice : data.mChoices)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this->mChoices->addItem(choice.mLabel, choice.mValue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (choice.mValue == mUniform->template getValue<T>())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this->mChoices->setIndexSelected(index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setValue(mUniform->template getValue<T>());
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mUniform->mData);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EditChoice::toDefault()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::visit(
|
|
|
|
|
|
|
|
[this](auto&& data) {
|
|
|
|
|
|
|
|
using T = typename std::decay_t<decltype(data)>::value_type;
|
|
|
|
|
|
|
|
setValue(mUniform->template getDefault<T>());
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mUniform->mData);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EditChoice::initialiseOverride()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Base::initialiseOverride();
|
|
|
|
|
|
|
|
|
|
|
|
if (!uniform)
|
|
|
|
assignWidget(mChoices, "Choices");
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setValue(!uniform->getValue<bool>());
|
|
|
|
mChoices->eventComboChangePosition += MyGUI::newDelegate(this, &EditChoice::notifyComboBoxChanged);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UniformBase::init(const std::shared_ptr<fx::Types::UniformBase>& uniform)
|
|
|
|
void UniformBase::init(const std::shared_ptr<fx::Types::UniformBase>& uniform)
|
|
|
@ -101,38 +149,48 @@ namespace fx
|
|
|
|
[this, &uniform](auto&& arg) {
|
|
|
|
[this, &uniform](auto&& arg) {
|
|
|
|
using T = typename std::decay_t<decltype(arg)>::value_type;
|
|
|
|
using T = typename std::decay_t<decltype(arg)>::value_type;
|
|
|
|
|
|
|
|
|
|
|
|
if constexpr (std::is_same_v<osg::Vec4f, T>)
|
|
|
|
if (arg.mChoices.size() > 0)
|
|
|
|
{
|
|
|
|
|
|
|
|
createVectorWidget<T, EditNumberFloat4>(uniform, mClient, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if constexpr (std::is_same_v<osg::Vec3f, T>)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
createVectorWidget<T, EditNumberFloat3>(uniform, mClient, this);
|
|
|
|
auto* widget = mClient->createWidget<EditChoice>("MW_ValueEditChoice",
|
|
|
|
}
|
|
|
|
|
|
|
|
else if constexpr (std::is_same_v<osg::Vec2f, T>)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
createVectorWidget<T, EditNumberFloat2>(uniform, mClient, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if constexpr (std::is_same_v<T, float>)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
auto* widget = mClient->createWidget<EditNumberFloat>("MW_ValueEditNumber",
|
|
|
|
|
|
|
|
{ 0, 0, mClient->getWidth(), mClient->getHeight() }, MyGUI::Align::Stretch);
|
|
|
|
|
|
|
|
widget->setData(uniform);
|
|
|
|
|
|
|
|
mBases.emplace_back(widget);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if constexpr (std::is_same_v<T, int>)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
auto* widget = mClient->createWidget<EditNumberInt>("MW_ValueEditNumber",
|
|
|
|
|
|
|
|
{ 0, 0, mClient->getWidth(), mClient->getHeight() }, MyGUI::Align::Stretch);
|
|
|
|
{ 0, 0, mClient->getWidth(), mClient->getHeight() }, MyGUI::Align::Stretch);
|
|
|
|
widget->setData(uniform);
|
|
|
|
widget->setData(uniform);
|
|
|
|
mBases.emplace_back(widget);
|
|
|
|
mBases.emplace_back(widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if constexpr (std::is_same_v<T, bool>)
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto* widget = mClient->createWidget<EditBool>("MW_ValueEditBool",
|
|
|
|
if constexpr (std::is_same_v<osg::Vec4f, T>)
|
|
|
|
{ 0, 0, mClient->getWidth(), mClient->getHeight() }, MyGUI::Align::Stretch);
|
|
|
|
{
|
|
|
|
widget->setData(uniform);
|
|
|
|
createVectorWidget<T, EditNumberFloat4>(uniform, mClient, this);
|
|
|
|
mBases.emplace_back(widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if constexpr (std::is_same_v<osg::Vec3f, T>)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
createVectorWidget<T, EditNumberFloat3>(uniform, mClient, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if constexpr (std::is_same_v<osg::Vec2f, T>)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
createVectorWidget<T, EditNumberFloat2>(uniform, mClient, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if constexpr (std::is_same_v<T, float>)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
auto* widget = mClient->createWidget<EditNumberFloat>("MW_ValueEditNumber",
|
|
|
|
|
|
|
|
{ 0, 0, mClient->getWidth(), mClient->getHeight() }, MyGUI::Align::Stretch);
|
|
|
|
|
|
|
|
widget->setData(uniform);
|
|
|
|
|
|
|
|
mBases.emplace_back(widget);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if constexpr (std::is_same_v<T, int>)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
auto* widget = mClient->createWidget<EditNumberInt>("MW_ValueEditNumber",
|
|
|
|
|
|
|
|
{ 0, 0, mClient->getWidth(), mClient->getHeight() }, MyGUI::Align::Stretch);
|
|
|
|
|
|
|
|
widget->setData(uniform);
|
|
|
|
|
|
|
|
mBases.emplace_back(widget);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if constexpr (std::is_same_v<T, bool>)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
auto* widget = mClient->createWidget<EditBool>("MW_ValueEditBool",
|
|
|
|
|
|
|
|
{ 0, 0, mClient->getWidth(), mClient->getHeight() }, MyGUI::Align::Stretch);
|
|
|
|
|
|
|
|
widget->setData(uniform);
|
|
|
|
|
|
|
|
mBases.emplace_back(widget);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
mReset->eventMouseButtonClick += MyGUI::newDelegate(this, &UniformBase::notifyResetClicked);
|
|
|
|
mReset->eventMouseButtonClick += MyGUI::newDelegate(this, &UniformBase::notifyResetClicked);
|
|
|
|