Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • alchemy/viewer
  • Miezhiko/alchemy-next
  • JennaHuntsman/xdg-integration
  • logue/alchemy-next
  • FelixWolf/alchemy-viewer
  • XenHat/xdg-integration
6 results
Show changes
Showing
with 246 additions and 230 deletions
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "linden_common.h" #include "linden_common.h"
#include "lluistring.h" #include "lluistring.h"
#include "llcurrencywrapper.h"
#include "llfasttimer.h" #include "llfasttimer.h"
#include "llsd.h" #include "llsd.h"
#include "lltrans.h" #include "lltrans.h"
...@@ -146,9 +145,6 @@ void LLUIString::updateResult() const ...@@ -146,9 +145,6 @@ void LLUIString::updateResult() const
combined_args.insert(mArgs->begin(), mArgs->end()); combined_args.insert(mArgs->begin(), mArgs->end());
} }
LLStringUtil::format(mResult, combined_args); LLStringUtil::format(mResult, combined_args);
// Impact on lag: at average frame time 15.9 ms
// FTM_UI_STRING 0.01ms both with/without wrapCurrency so bite me.
LLCurrencyWrapper::instance().wrapCurrency(mResult);
} }
void LLUIString::updateWResult() const void LLUIString::updateWResult() const
......
...@@ -95,10 +95,10 @@ class LLUIString ...@@ -95,10 +95,10 @@ class LLUIString
void insert(S32 charidx, const LLWString& wchars); void insert(S32 charidx, const LLWString& wchars);
void replace(S32 charidx, llwchar wc); void replace(S32 charidx, llwchar wc);
private:
// something changed, requiring reformatting of strings // something changed, requiring reformatting of strings
void dirty(); void dirty();
private:
std::string& getUpdatedResult() const { if (mNeedsResult) { updateResult(); } return mResult; } std::string& getUpdatedResult() const { if (mNeedsResult) { updateResult(); } return mResult; }
LLWString& getUpdatedWResult() const{ if (mNeedsWResult) { updateWResult(); } return mWResult; } LLWString& getUpdatedWResult() const{ if (mNeedsWResult) { updateWResult(); } return mWResult; }
......
...@@ -1067,7 +1067,8 @@ U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only ...@@ -1067,7 +1067,8 @@ U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only
file.open(filename); file.open(filename);
if (file.is_open()) if (file.is_open())
{ {
LLSDSerialize::toPrettyXML(settings, file); LLPointer<LLSDXMLFormatter> f = new LLSDXMLFormatter(false, true);
f->format(settings, file, LLSDFormatter::OPTIONS_PRETTY);
file.close(); file.close();
LL_INFOS("Settings") << "Saved to " << filename << LL_ENDL; LL_INFOS("Settings") << "Saved to " << filename << LL_ENDL;
} }
......
...@@ -1936,7 +1936,7 @@ if (WINDOWS) ...@@ -1936,7 +1936,7 @@ if (WINDOWS)
# The following commented dependencies are determined at variably at build time. Can't do this here. # The following commented dependencies are determined at variably at build time. Can't do this here.
${CMAKE_SOURCE_DIR}/../etc/message.xml ${CMAKE_SOURCE_DIR}/../etc/message.xml
${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg
${SHARED_LIB_STAGING_DIR}/openjp2.dll ${SHARED_LIB_STAGING_DIR}/openjpeg.dll
#${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/SLVoice.exe #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/SLVoice.exe
#${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/libsndfile-1.dll #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/libsndfile-1.dll
#${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/vivoxoal.dll #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/vivoxoal.dll
......
...@@ -340,66 +340,66 @@ void ALFloaterLightBox::updateTonemapper() ...@@ -340,66 +340,66 @@ void ALFloaterLightBox::updateTonemapper()
text1->setVisible(TRUE); text1->setVisible(TRUE);
text1->setText(std::string("Max Brightness")); text1->setText(std::string("Max Brightness"));
spinner1->setVisible(TRUE); spinner1->setVisible(TRUE);
spinner1->setMinValue(0.01); spinner1->setMinValue(0.01f);
spinner1->setMaxValue(8.0); spinner1->setMaxValue(8.0f);
spinner1->setIncrement(0.1); spinner1->setIncrement(0.1f);
spinner1->setControlName("AlchemyToneMapUchimuraMaxBrightness"); spinner1->setControlName("AlchemyToneMapUchimuraMaxBrightness");
slider1->setVisible(TRUE); slider1->setVisible(TRUE);
slider1->setMinValue(0.01); slider1->setMinValue(0.01f);
slider1->setMaxValue(8.0); slider1->setMaxValue(8.0f);
slider1->setIncrement(0.1); slider1->setIncrement(0.1f);
slider1->setControlName("AlchemyToneMapUchimuraMaxBrightness", nullptr); slider1->setControlName("AlchemyToneMapUchimuraMaxBrightness", nullptr);
text2->setVisible(TRUE); text2->setVisible(TRUE);
text2->setText(std::string("Contrast")); text2->setText(std::string("Contrast"));
spinner2->setVisible(TRUE); spinner2->setVisible(TRUE);
spinner2->setMinValue(0.01); spinner2->setMinValue(0.01f);
spinner2->setMaxValue(2.0); spinner2->setMaxValue(2.0f);
spinner2->setIncrement(0.01); spinner2->setIncrement(0.01f);
spinner2->setControlName("AlchemyToneMapUchimuraContrast"); spinner2->setControlName("AlchemyToneMapUchimuraContrast");
slider2->setVisible(TRUE); slider2->setVisible(TRUE);
slider2->setMinValue(0.01); slider2->setMinValue(0.01f);
slider2->setMaxValue(2.0); slider2->setMaxValue(2.0f);
slider2->setIncrement(0.01); slider2->setIncrement(0.01f);
slider2->setControlName("AlchemyToneMapUchimuraContrast", nullptr); slider2->setControlName("AlchemyToneMapUchimuraContrast", nullptr);
text3->setVisible(TRUE); text3->setVisible(TRUE);
text3->setText(std::string("Linear Start")); text3->setText(std::string("Linear Start"));
spinner3->setVisible(TRUE); spinner3->setVisible(TRUE);
spinner3->setMinValue(0.01); spinner3->setMinValue(0.01f);
spinner3->setMaxValue(1.0); spinner3->setMaxValue(1.0f);
spinner3->setIncrement(0.01); spinner3->setIncrement(0.01f);
spinner3->setControlName("AlchemyToneMapUchimuraLinearStart"); spinner3->setControlName("AlchemyToneMapUchimuraLinearStart");
slider3->setVisible(TRUE); slider3->setVisible(TRUE);
slider3->setMinValue(0.01); slider3->setMinValue(0.01f);
slider3->setMaxValue(1.0); slider3->setMaxValue(1.0f);
slider3->setIncrement(0.01); slider3->setIncrement(0.01f);
slider3->setControlName("AlchemyToneMapUchimuraLinearStart", nullptr); slider3->setControlName("AlchemyToneMapUchimuraLinearStart", nullptr);
text4->setVisible(TRUE); text4->setVisible(TRUE);
text4->setText(std::string("Linear Length")); text4->setText(std::string("Linear Length"));
spinner4->setVisible(TRUE); spinner4->setVisible(TRUE);
spinner4->setMinValue(0.01); spinner4->setMinValue(0.01f);
spinner4->setMaxValue(1.0); spinner4->setMaxValue(1.0f);
spinner4->setIncrement(0.01); spinner4->setIncrement(0.01f);
spinner4->setControlName("AlchemyToneMapUchimuraLinearLength"); spinner4->setControlName("AlchemyToneMapUchimuraLinearLength");
slider4->setVisible(TRUE); slider4->setVisible(TRUE);
slider4->setMinValue(0.01); slider4->setMinValue(0.01f);
slider4->setMaxValue(1.0); slider4->setMaxValue(1.0f);
slider4->setIncrement(0.01); slider4->setIncrement(0.01f);
slider4->setControlName("AlchemyToneMapUchimuraLinearLength", nullptr); slider4->setControlName("AlchemyToneMapUchimuraLinearLength", nullptr);
text5->setVisible(TRUE); text5->setVisible(TRUE);
text5->setText(std::string("Black Level")); text5->setText(std::string("Black Level"));
spinner5->setVisible(TRUE); spinner5->setVisible(TRUE);
spinner5->setMinValue(0.01); spinner5->setMinValue(0.01f);
spinner5->setMaxValue(4.0); spinner5->setMaxValue(4.0f);
spinner5->setIncrement(0.01); spinner5->setIncrement(0.01f);
spinner5->setControlName("AlchemyToneMapUchimuraBlackLevel"); spinner5->setControlName("AlchemyToneMapUchimuraBlackLevel");
slider5->setVisible(TRUE); slider5->setVisible(TRUE);
slider5->setMinValue(0.01); slider5->setMinValue(0.01f);
slider5->setMaxValue(4.0); slider5->setMaxValue(4.0f);
slider5->setIncrement(0.01); slider5->setIncrement(0.01f);
slider5->setControlName("AlchemyToneMapUchimuraBlackLevel", nullptr); slider5->setControlName("AlchemyToneMapUchimuraBlackLevel", nullptr);
text6->setVisible(FALSE); text6->setVisible(FALSE);
...@@ -416,79 +416,79 @@ void ALFloaterLightBox::updateTonemapper() ...@@ -416,79 +416,79 @@ void ALFloaterLightBox::updateTonemapper()
text1->setVisible(TRUE); text1->setVisible(TRUE);
text1->setText(std::string("HDR Max")); text1->setText(std::string("HDR Max"));
spinner1->setVisible(TRUE); spinner1->setVisible(TRUE);
spinner1->setMinValue(1.0); spinner1->setMinValue(1.0f);
spinner1->setMaxValue(512.0); spinner1->setMaxValue(512.0f);
spinner1->setIncrement(1.f); spinner1->setIncrement(1.f);
spinner1->setControlName("AlchemyToneMapAMDHDRMax"); spinner1->setControlName("AlchemyToneMapAMDHDRMax");
slider1->setVisible(TRUE); slider1->setVisible(TRUE);
slider1->setMinValue(1.0); slider1->setMinValue(1.0f);
slider1->setMaxValue(512.0); slider1->setMaxValue(512.0f);
slider1->setIncrement(1.f); slider1->setIncrement(1.f);
slider1->setControlName("AlchemyToneMapAMDHDRMax", nullptr); slider1->setControlName("AlchemyToneMapAMDHDRMax", nullptr);
text2->setVisible(TRUE); text2->setVisible(TRUE);
text2->setText(std::string("Tone Exposure")); text2->setText(std::string("Tone Exposure"));
spinner2->setVisible(TRUE); spinner2->setVisible(TRUE);
spinner2->setMinValue(1.0); spinner2->setMinValue(1.0f);
spinner2->setMaxValue(16.0); spinner2->setMaxValue(16.0f);
spinner2->setIncrement(0.1); spinner2->setIncrement(0.1f);
spinner2->setControlName("AlchemyToneMapAMDExposure"); spinner2->setControlName("AlchemyToneMapAMDExposure");
slider2->setVisible(TRUE); slider2->setVisible(TRUE);
slider2->setMinValue(1.0); slider2->setMinValue(1.0f);
slider2->setMaxValue(16.0); slider2->setMaxValue(16.0f);
slider2->setIncrement(0.1); slider2->setIncrement(0.1f);
slider2->setControlName("AlchemyToneMapAMDExposure", nullptr); slider2->setControlName("AlchemyToneMapAMDExposure", nullptr);
text3->setVisible(TRUE); text3->setVisible(TRUE);
text3->setText(std::string("Contrast")); text3->setText(std::string("Contrast"));
spinner3->setVisible(TRUE); spinner3->setVisible(TRUE);
spinner3->setMinValue(0.0); spinner3->setMinValue(0.0f);
spinner3->setMaxValue(1.0); spinner3->setMaxValue(1.0f);
spinner3->setIncrement(0.01); spinner3->setIncrement(0.01f);
spinner3->setControlName("AlchemyToneMapAMDContrast"); spinner3->setControlName("AlchemyToneMapAMDContrast");
slider3->setVisible(TRUE); slider3->setVisible(TRUE);
slider3->setMinValue(0.0); slider3->setMinValue(0.0f);
slider3->setMaxValue(1.0); slider3->setMaxValue(1.0f);
slider3->setIncrement(0.01); slider3->setIncrement(0.01f);
slider3->setControlName("AlchemyToneMapAMDContrast", nullptr); slider3->setControlName("AlchemyToneMapAMDContrast", nullptr);
text4->setVisible(TRUE); text4->setVisible(TRUE);
text4->setText(std::string("R Saturation")); text4->setText(std::string("R Saturation"));
spinner4->setVisible(TRUE); spinner4->setVisible(TRUE);
spinner4->setMinValue(-2.0); spinner4->setMinValue(-2.0f);
spinner4->setMaxValue(2.0); spinner4->setMaxValue(2.0f);
spinner4->setIncrement(0.1); spinner4->setIncrement(0.1f);
spinner4->setControlName("AlchemyToneMapAMDSaturationR"); spinner4->setControlName("AlchemyToneMapAMDSaturationR");
slider4->setVisible(TRUE); slider4->setVisible(TRUE);
slider4->setMinValue(-2.0); slider4->setMinValue(-2.0f);
slider4->setMaxValue(2.0); slider4->setMaxValue(2.0f);
slider4->setIncrement(0.1); slider4->setIncrement(0.1f);
slider4->setControlName("AlchemyToneMapAMDSaturationR", nullptr); slider4->setControlName("AlchemyToneMapAMDSaturationR", nullptr);
text5->setVisible(TRUE); text5->setVisible(TRUE);
text5->setText(std::string("G Saturation")); text5->setText(std::string("G Saturation"));
spinner5->setVisible(TRUE); spinner5->setVisible(TRUE);
spinner5->setMinValue(-2.0); spinner5->setMinValue(-2.0f);
spinner5->setMaxValue(2.0); spinner5->setMaxValue(2.0f);
spinner5->setIncrement(0.1); spinner5->setIncrement(0.1f);
spinner5->setControlName("AlchemyToneMapAMDSaturationG"); spinner5->setControlName("AlchemyToneMapAMDSaturationG");
slider5->setVisible(TRUE); slider5->setVisible(TRUE);
slider5->setMinValue(-2.0); slider5->setMinValue(-2.0f);
slider5->setMaxValue(2.0); slider5->setMaxValue(2.0f);
slider5->setIncrement(0.1); slider5->setIncrement(0.1f);
slider5->setControlName("AlchemyToneMapAMDSaturationG", nullptr); slider5->setControlName("AlchemyToneMapAMDSaturationG", nullptr);
text6->setVisible(TRUE); text6->setVisible(TRUE);
text6->setText(std::string("B Saturation")); text6->setText(std::string("B Saturation"));
spinner6->setVisible(TRUE); spinner6->setVisible(TRUE);
spinner6->setMinValue(-2.0); spinner6->setMinValue(-2.0f);
spinner6->setMaxValue(2.0); spinner6->setMaxValue(2.0f);
spinner6->setIncrement(0.1); spinner6->setIncrement(0.1f);
spinner6->setControlName("AlchemyToneMapAMDSaturationB"); spinner6->setControlName("AlchemyToneMapAMDSaturationB");
slider6->setVisible(TRUE); slider6->setVisible(TRUE);
slider6->setMinValue(-2.0); slider6->setMinValue(-2.0f);
slider6->setMaxValue(2.0); slider6->setMaxValue(2.0f);
slider6->setIncrement(0.1); slider6->setIncrement(0.1f);
slider6->setControlName("AlchemyToneMapAMDSaturationB", nullptr); slider6->setControlName("AlchemyToneMapAMDSaturationB", nullptr);
text7->setVisible(FALSE); text7->setVisible(FALSE);
...@@ -501,92 +501,92 @@ void ALFloaterLightBox::updateTonemapper() ...@@ -501,92 +501,92 @@ void ALFloaterLightBox::updateTonemapper()
text1->setVisible(TRUE); text1->setVisible(TRUE);
text1->setText(std::string("Toe Strength")); text1->setText(std::string("Toe Strength"));
spinner1->setVisible(TRUE); spinner1->setVisible(TRUE);
spinner1->setMinValue(0.0); spinner1->setMinValue(0.0f);
spinner1->setMaxValue(1.0); spinner1->setMaxValue(1.0f);
spinner1->setIncrement(0.01); spinner1->setIncrement(0.01f);
spinner1->setControlName("AlchemyToneMapFilmicToeStr"); spinner1->setControlName("AlchemyToneMapFilmicToeStr");
slider1->setVisible(TRUE); slider1->setVisible(TRUE);
slider1->setMinValue(0.0); slider1->setMinValue(0.0f);
slider1->setMaxValue(1.0); slider1->setMaxValue(1.0f);
slider1->setIncrement(0.01); slider1->setIncrement(0.01f);
slider1->setControlName("AlchemyToneMapFilmicToeStr", nullptr); slider1->setControlName("AlchemyToneMapFilmicToeStr", nullptr);
text2->setVisible(TRUE); text2->setVisible(TRUE);
text2->setText(std::string("Toe Length")); text2->setText(std::string("Toe Length"));
spinner2->setVisible(TRUE); spinner2->setVisible(TRUE);
spinner2->setMinValue(0.01); spinner2->setMinValue(0.01f);
spinner2->setMaxValue(1.0); spinner2->setMaxValue(1.0f);
spinner2->setIncrement(0.01); spinner2->setIncrement(0.01f);
spinner2->setControlName("AlchemyToneMapFilmicToeLen"); spinner2->setControlName("AlchemyToneMapFilmicToeLen");
slider2->setVisible(TRUE); slider2->setVisible(TRUE);
slider2->setMinValue(0.01); slider2->setMinValue(0.01f);
slider2->setMaxValue(1.0); slider2->setMaxValue(1.0f);
slider2->setIncrement(0.01); slider2->setIncrement(0.01f);
slider2->setControlName("AlchemyToneMapFilmicToeLen", nullptr); slider2->setControlName("AlchemyToneMapFilmicToeLen", nullptr);
text3->setVisible(TRUE); text3->setVisible(TRUE);
text3->setText(std::string("Shoulder Strength")); text3->setText(std::string("Shoulder Strength"));
spinner3->setVisible(TRUE); spinner3->setVisible(TRUE);
spinner3->setMinValue(0.0); spinner3->setMinValue(0.0f);
spinner3->setMaxValue(1.0); spinner3->setMaxValue(1.0f);
spinner3->setIncrement(0.01); spinner3->setIncrement(0.01f);
spinner3->setControlName("AlchemyToneMapFilmicShoulderStr"); spinner3->setControlName("AlchemyToneMapFilmicShoulderStr");
slider3->setVisible(TRUE); slider3->setVisible(TRUE);
slider3->setMinValue(0.0); slider3->setMinValue(0.0f);
slider3->setMaxValue(1.0); slider3->setMaxValue(1.0f);
slider3->setIncrement(0.01); slider3->setIncrement(0.01f);
slider3->setControlName("AlchemyToneMapFilmicShoulderStr", nullptr); slider3->setControlName("AlchemyToneMapFilmicShoulderStr", nullptr);
text4->setVisible(TRUE); text4->setVisible(TRUE);
text4->setText(std::string("Shoulder Length")); text4->setText(std::string("Shoulder Length"));
spinner4->setVisible(TRUE); spinner4->setVisible(TRUE);
spinner4->setMinValue(0.01); spinner4->setMinValue(0.01f);
spinner4->setMaxValue(8.0); spinner4->setMaxValue(8.0f);
spinner4->setIncrement(0.01); spinner4->setIncrement(0.01f);
spinner4->setControlName("AlchemyToneMapFilmicShoulderLen"); spinner4->setControlName("AlchemyToneMapFilmicShoulderLen");
slider4->setVisible(TRUE); slider4->setVisible(TRUE);
slider4->setMinValue(0.01); slider4->setMinValue(0.01f);
slider4->setMaxValue(8.0); slider4->setMaxValue(8.0f);
slider4->setIncrement(0.01); slider4->setIncrement(0.01f);
slider4->setControlName("AlchemyToneMapFilmicShoulderLen", nullptr); slider4->setControlName("AlchemyToneMapFilmicShoulderLen", nullptr);
text5->setVisible(TRUE); text5->setVisible(TRUE);
text5->setText(std::string("Shoulder Angle")); text5->setText(std::string("Shoulder Angle"));
spinner5->setVisible(TRUE); spinner5->setVisible(TRUE);
spinner5->setMinValue(0.0); spinner5->setMinValue(0.0f);
spinner5->setMaxValue(1.0); spinner5->setMaxValue(1.0f);
spinner5->setIncrement(0.01); spinner5->setIncrement(0.01f);
spinner5->setControlName("AlchemyToneMapFilmicShoulderAngle"); spinner5->setControlName("AlchemyToneMapFilmicShoulderAngle");
slider5->setVisible(TRUE); slider5->setVisible(TRUE);
slider5->setMinValue(0.0); slider5->setMinValue(0.0f);
slider5->setMaxValue(1.0); slider5->setMaxValue(1.0f);
slider5->setIncrement(0.01); slider5->setIncrement(0.01f);
slider5->setControlName("AlchemyToneMapFilmicShoulderAngle", nullptr); slider5->setControlName("AlchemyToneMapFilmicShoulderAngle", nullptr);
text6->setVisible(TRUE); text6->setVisible(TRUE);
text6->setText(std::string("Gamma")); text6->setText(std::string("Gamma"));
spinner6->setVisible(TRUE); spinner6->setVisible(TRUE);
spinner6->setMinValue(0.01); spinner6->setMinValue(0.01f);
spinner6->setMaxValue(5.0); spinner6->setMaxValue(5.0f);
spinner6->setIncrement(0.01); spinner6->setIncrement(0.01f);
spinner6->setControlName("AlchemyToneMapFilmicGamma"); spinner6->setControlName("AlchemyToneMapFilmicGamma");
slider6->setVisible(TRUE); slider6->setVisible(TRUE);
slider6->setMinValue(0.01); slider6->setMinValue(0.01f);
slider6->setMaxValue(5.0); slider6->setMaxValue(5.0f);
slider6->setIncrement(0.01); slider6->setIncrement(0.01f);
slider6->setControlName("AlchemyToneMapFilmicGamma", nullptr); slider6->setControlName("AlchemyToneMapFilmicGamma", nullptr);
text7->setVisible(TRUE); text7->setVisible(TRUE);
text7->setText(std::string("White Point")); text7->setText(std::string("White Point"));
spinner7->setVisible(TRUE); spinner7->setVisible(TRUE);
spinner7->setMinValue(1.0); spinner7->setMinValue(1.0f);
spinner7->setMaxValue(16.0); spinner7->setMaxValue(16.0f);
spinner7->setIncrement(0.1); spinner7->setIncrement(0.1f);
spinner7->setControlName("AlchemyToneMapFilmicWhitePoint"); spinner7->setControlName("AlchemyToneMapFilmicWhitePoint");
slider7->setVisible(TRUE); slider7->setVisible(TRUE);
slider7->setMinValue(1.0); slider7->setMinValue(1.0f);
slider7->setMaxValue(16.0); slider7->setMaxValue(16.0f);
slider7->setIncrement(0.1); slider7->setIncrement(0.1f);
slider7->setControlName("AlchemyToneMapFilmicWhitePoint", nullptr); slider7->setControlName("AlchemyToneMapFilmicWhitePoint", nullptr);
break; break;
} }
...@@ -617,14 +617,14 @@ void ALFloaterLightBox::updateCAS() ...@@ -617,14 +617,14 @@ void ALFloaterLightBox::updateCAS()
case ALRenderUtil::SHARPEN_CAS: case ALRenderUtil::SHARPEN_CAS:
{ {
spinner1->setVisible(TRUE); spinner1->setVisible(TRUE);
spinner1->setMinValue(0.0); spinner1->setMinValue(0.0f);
spinner1->setMaxValue(1.0); spinner1->setMaxValue(1.0f);
spinner1->setIncrement(0.1); spinner1->setIncrement(0.1f);
spinner1->setControlName("RenderSharpenCASSharpness"); spinner1->setControlName("RenderSharpenCASSharpness");
slider1->setVisible(TRUE); slider1->setVisible(TRUE);
slider1->setMinValue(0.0); slider1->setMinValue(0.0f);
slider1->setMaxValue(1.0); slider1->setMaxValue(1.0f);
slider1->setIncrement(0.1); slider1->setIncrement(0.1f);
slider1->setControlName("RenderSharpenCASSharpness", nullptr); slider1->setControlName("RenderSharpenCASSharpness", nullptr);
text2->setVisible(FALSE); text2->setVisible(FALSE);
...@@ -635,27 +635,27 @@ void ALFloaterLightBox::updateCAS() ...@@ -635,27 +635,27 @@ void ALFloaterLightBox::updateCAS()
case ALRenderUtil::SHARPEN_DLS: case ALRenderUtil::SHARPEN_DLS:
{ {
spinner1->setVisible(TRUE); spinner1->setVisible(TRUE);
spinner1->setMinValue(0.0); spinner1->setMinValue(0.0f);
spinner1->setMaxValue(1.0); spinner1->setMaxValue(1.0f);
spinner1->setIncrement(0.1); spinner1->setIncrement(0.1f);
spinner1->setControlName("RenderSharpenDLSSharpness"); spinner1->setControlName("RenderSharpenDLSSharpness");
slider1->setVisible(TRUE); slider1->setVisible(TRUE);
slider1->setMinValue(0.0); slider1->setMinValue(0.0f);
slider1->setMaxValue(1.0); slider1->setMaxValue(1.0f);
slider1->setIncrement(0.1); slider1->setIncrement(0.1f);
slider1->setControlName("RenderSharpenDLSSharpness", nullptr); slider1->setControlName("RenderSharpenDLSSharpness", nullptr);
text2->setVisible(TRUE); text2->setVisible(TRUE);
text2->setText(std::string("Denoise:")); text2->setText(std::string("Denoise:"));
spinner2->setVisible(TRUE); spinner2->setVisible(TRUE);
spinner2->setMinValue(0.0); spinner2->setMinValue(0.0f);
spinner2->setMaxValue(1.0); spinner2->setMaxValue(1.0f);
spinner2->setIncrement(0.1); spinner2->setIncrement(0.1f);
spinner2->setControlName("RenderSharpenDLSDenoise"); spinner2->setControlName("RenderSharpenDLSDenoise");
slider2->setVisible(TRUE); slider2->setVisible(TRUE);
slider2->setMinValue(0.0); slider2->setMinValue(0.0f);
slider2->setMaxValue(1.0); slider2->setMaxValue(1.0f);
slider2->setIncrement(0.1); slider2->setIncrement(0.1f);
slider2->setControlName("RenderSharpenDLSDenoise", nullptr); slider2->setControlName("RenderSharpenDLSDenoise", nullptr);
break; break;
} }
......
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
is_running_parameters="world_map" is_running_parameters="world_map"
/> />
<command name="marketplace" <command name="marketplace"
available_in_toybox="false" available_in_toybox="true"
icon="Command_Marketplace_Icon" icon="Command_Marketplace_Icon"
label_ref="Command_Marketplace_Label" label_ref="Command_Marketplace_Label"
tooltip_ref="Command_Marketplace_Tooltip" tooltip_ref="Command_Marketplace_Tooltip"
......
...@@ -11332,6 +11332,17 @@ ...@@ -11332,6 +11332,17 @@
<string>F32</string> <string>F32</string>
<key>Value</key> <key>Value</key>
<real>0.5</real> <real>0.5</real>
</map>
<key>RenderDiffuseLuminanceScale</key>
<map>
<key>Comment</key>
<string>Luminance adjustment for diffuse surfaces to aid auto-exposure behavior</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>0.5</real>
</map> </map>
<key>RenderShaderLODThreshold</key> <key>RenderShaderLODThreshold</key>
<map> <map>
......
...@@ -2031,5 +2031,16 @@ ...@@ -2031,5 +2031,16 @@
<key>Value</key> <key>Value</key>
<string>1.0</string> <string>1.0</string>
</map> </map>
<key>MediaAutoPlayHuds</key>
<map>
<key>Comment</key>
<string>Auto play hud attached media.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
</map> </map>
</llsd> </llsd>
...@@ -34,6 +34,8 @@ in vec2 vary_fragcoord; ...@@ -34,6 +34,8 @@ in vec2 vary_fragcoord;
uniform sampler2D diffuseRect; uniform sampler2D diffuseRect;
uniform sampler2D emissiveRect; uniform sampler2D emissiveRect;
uniform sampler2D normalMap;
uniform float diffuse_luminance_scale;
float lum(vec3 col) float lum(vec3 col)
{ {
...@@ -45,7 +47,22 @@ void main() ...@@ -45,7 +47,22 @@ void main()
{ {
vec2 tc = vary_fragcoord*0.6+0.2; vec2 tc = vary_fragcoord*0.6+0.2;
tc.y -= 0.1; // HACK - nudge exposure sample down a little bit to favor ground over sky tc.y -= 0.1; // HACK - nudge exposure sample down a little bit to favor ground over sky
vec3 c = texture(diffuseRect, tc).rgb + texture(emissiveRect, tc).rgb; vec3 c = texture(diffuseRect, tc).rgb;
vec4 norm = texture(normalMap, tc);
//!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_HDRI) &&
if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_SKIP_ATMOS))
{
// Apply the diffuse luminance scale to objects but not the sky
// Prevents underexposing when looking at bright environments
// while still allowing for realistically bright skies.
c *= diffuse_luminance_scale;
}
c += texture(emissiveRect, tc).rgb;
float L = lum(c); float L = lum(c);
frag_color = vec4(max(L, 0.0)); frag_color = vec4(max(L, 0.0));
} }
......
...@@ -152,6 +152,15 @@ float noise(vec2 x) { ...@@ -152,6 +152,15 @@ float noise(vec2 x) {
//============================= //=============================
void debugExposure(inout vec3 color)
{
float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r;
exp_scale *= 0.5;
if (abs(vary_fragcoord.y-exp_scale) < 0.01 && vary_fragcoord.x < 0.1)
{
color = vec3(1,0,0);
}
}
vec3 legacyGamma(vec3 color) vec3 legacyGamma(vec3 color)
{ {
...@@ -180,7 +189,8 @@ void main() ...@@ -180,7 +189,8 @@ void main()
vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y); vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y);
vec3 nz = vec3(noise(seed.rg), noise(seed.gb), noise(seed.rb)); vec3 nz = vec3(noise(seed.rg), noise(seed.gb), noise(seed.rb));
diff.rgb += nz*0.003; diff.rgb += nz*0.003;
//debugExposure(diff.rgb);
frag_color = max(diff, vec4(0)); frag_color = max(diff, vec4(0));
} }
...@@ -98,7 +98,7 @@ void main() ...@@ -98,7 +98,7 @@ void main()
vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y);
// Calculate relative weights // Calculate relative weights
vec3 combined_haze = abs(blue_density) + vec3(abs(haze_density)); vec3 combined_haze = max(abs(blue_density) + vec3(abs(haze_density)), vec3(1e-6));
vec3 blue_weight = blue_density / combined_haze; vec3 blue_weight = blue_density / combined_haze;
vec3 haze_weight = haze_density / combined_haze; vec3 haze_weight = haze_density / combined_haze;
......
...@@ -66,7 +66,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou ...@@ -66,7 +66,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
// I had thought blue_density and haze_density should have equal weighting, // I had thought blue_density and haze_density should have equal weighting,
// but attenuation due to haze_density tends to seem too strong // but attenuation due to haze_density tends to seem too strong
vec3 combined_haze = blue_density + vec3(haze_density); vec3 combined_haze = max(blue_density + vec3(haze_density), vec3(1e-6));
vec3 blue_weight = blue_density / combined_haze; vec3 blue_weight = blue_density / combined_haze;
vec3 haze_weight = vec3(haze_density) / combined_haze; vec3 haze_weight = vec3(haze_density) / combined_haze;
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include "llviewchildren.h" #include "llviewchildren.h"
#include "llxmlrpctransaction.h" #include "llxmlrpctransaction.h"
#include "llviewernetwork.h" #include "llviewernetwork.h"
#include "llviewerregion.h"
#include "llpanel.h" #include "llpanel.h"
#include "stringize.h" #include "stringize.h"
...@@ -285,15 +284,17 @@ void LLCurrencyUIManager::Impl::finishCurrencyBuy() ...@@ -285,15 +284,17 @@ void LLCurrencyUIManager::Impl::finishCurrencyBuy()
void LLCurrencyUIManager::Impl::startTransaction(TransactionType type, void LLCurrencyUIManager::Impl::startTransaction(TransactionType type,
const char* method, LLXMLRPCValue params) const char* method, LLXMLRPCValue params)
{ {
LLViewerRegion* region = gAgent.getRegion(); static std::string transactionURI;
const std::string transaction_uri = (region != nullptr) ? region->getBuyCurrencyServerURL() if (transactionURI.empty())
: LLGridManager::getInstance()->getHelperURI() + "currency.php"; {
transactionURI = LLGridManager::getInstance()->getHelperURI() + "currency.php";
}
delete mTransaction; delete mTransaction;
mTransactionType = type; mTransactionType = type;
mTransaction = new LLXMLRPCTransaction( mTransaction = new LLXMLRPCTransaction(
transaction_uri, transactionURI,
method, method,
params, params,
false /* don't use gzip */ false /* don't use gzip */
......
...@@ -140,7 +140,7 @@ void LLDrawable::init(bool new_entry) ...@@ -140,7 +140,7 @@ void LLDrawable::init(bool new_entry)
llassert(!vo_entry->getGroup()); //not in the object cache octree. llassert(!vo_entry->getGroup()); //not in the object cache octree.
} }
llassert(!vo_entry || vo_entry->getEntry() == mEntry); llassert(!vo_entry || vo_entry->getEntry() == mEntry.get());
initVisible(sCurVisible - 2);//invisible for the current frame and the last frame. initVisible(sCurVisible - 2);//invisible for the current frame and the last frame.
} }
......
...@@ -78,7 +78,14 @@ void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex) ...@@ -78,7 +78,14 @@ void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex)
{ {
// dividing the alpha cutoff by transparency here allows the shader to compare against // dividing the alpha cutoff by transparency here allows the shader to compare against
// the alpha value of the texture without needing the transparency value // the alpha value of the texture without needing the transparency value
min_alpha = mAlphaCutoff/mBaseColor.mV[3]; if (mBaseColor.mV[3] > 0.f)
{
min_alpha = mAlphaCutoff / mBaseColor.mV[3];
}
else
{
min_alpha = 1024.f;
}
} }
shader->uniform1f(LLShaderMgr::MINIMUM_ALPHA, min_alpha); shader->uniform1f(LLShaderMgr::MINIMUM_ALPHA, min_alpha);
} }
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "llagent.h" #include "llagent.h"
#include "llassetstorage.h" #include "llassetstorage.h"
#include "llcombobox.h" #include "llcombobox.h"
#include "llcurrencywrapper.h"
#include "llestateinfomodel.h" #include "llestateinfomodel.h"
#include "llmimetypes.h" #include "llmimetypes.h"
#include "llnotifications.h" #include "llnotifications.h"
...@@ -499,7 +498,7 @@ void LLFloaterAuction::doSellToAnyone() ...@@ -499,7 +498,7 @@ void LLFloaterAuction::doSellToAnyone()
body["sale_price"] = parcelp->getArea(); // Sell for L$1 per square meter body["sale_price"] = parcelp->getArea(); // Sell for L$1 per square meter
body["auth_buyer_id"] = LLUUID::null; // To anyone body["auth_buyer_id"] = LLUUID::null; // To anyone
LL_INFOS() << LLCurrencyWrapper::instance().wrapCurrency("Sending parcel update to sell to anyone for L$1 via capability to: ") LL_INFOS() << "Sending parcel update to sell to anyone for L$1 via capability to: "
<< mParcelUpdateCapUrl << LL_ENDL; << mParcelUpdateCapUrl << LL_ENDL;
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(mParcelUpdateCapUrl, body, LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(mParcelUpdateCapUrl, body,
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
#include "llfloaterbuycurrency.h" #include "llfloaterbuycurrency.h"
#include "llcurrencywrapper.h"
// viewer includes // viewer includes
#include "llcurrencyuimanager.h" #include "llcurrencyuimanager.h"
#include "llfloater.h" #include "llfloater.h"
...@@ -40,7 +38,6 @@ ...@@ -40,7 +38,6 @@
#include "llstatusbar.h" #include "llstatusbar.h"
#include "lltextbox.h" #include "lltextbox.h"
#include "llviewchildren.h" #include "llviewchildren.h"
#include "llviewernetwork.h"
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "llweb.h" #include "llweb.h"
...@@ -56,6 +53,8 @@ class LLFloaterBuyCurrencyUI final ...@@ -56,6 +53,8 @@ class LLFloaterBuyCurrencyUI final
LLFloaterBuyCurrencyUI(const LLSD& key); LLFloaterBuyCurrencyUI(const LLSD& key);
virtual ~LLFloaterBuyCurrencyUI(); virtual ~LLFloaterBuyCurrencyUI();
public:
LLViewChildren mChildren; LLViewChildren mChildren;
LLCurrencyUIManager mManager; LLCurrencyUIManager mManager;
...@@ -63,13 +62,13 @@ class LLFloaterBuyCurrencyUI final ...@@ -63,13 +62,13 @@ class LLFloaterBuyCurrencyUI final
S32 mTargetPrice; S32 mTargetPrice;
S32 mRequiredAmount; S32 mRequiredAmount;
public:
void noTarget(); void noTarget();
void target(const std::string& name, S32 price); void target(const std::string& name, S32 price);
virtual BOOL postBuild(); virtual BOOL postBuild();
void updateUI(); void updateUI();
void updateCurrencySymbols();
void collapsePanels(bool collapse); void collapsePanels(bool collapse);
virtual void draw(); virtual void draw();
...@@ -77,8 +76,6 @@ class LLFloaterBuyCurrencyUI final ...@@ -77,8 +76,6 @@ class LLFloaterBuyCurrencyUI final
void onClickBuy(); void onClickBuy();
void onClickCancel(); void onClickCancel();
boost::signals2::connection mCurrencyChangedSlot;
}; };
LLFloater* LLFloaterBuyCurrency::buildFloater(const LLSD& key) LLFloater* LLFloaterBuyCurrency::buildFloater(const LLSD& key)
...@@ -98,8 +95,6 @@ LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI(const LLSD& key) ...@@ -98,8 +95,6 @@ LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI(const LLSD& key)
LLFloaterBuyCurrencyUI::~LLFloaterBuyCurrencyUI() LLFloaterBuyCurrencyUI::~LLFloaterBuyCurrencyUI()
{ {
if (mCurrencyChangedSlot.connected())
mCurrencyChangedSlot.disconnect();
} }
...@@ -139,17 +134,10 @@ BOOL LLFloaterBuyCurrencyUI::postBuild() ...@@ -139,17 +134,10 @@ BOOL LLFloaterBuyCurrencyUI::postBuild()
getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickBuy, this)); getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickBuy, this));
getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickCancel, this)); getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickCancel, this));
if (LLGridManager::instance().isInOpenSim())
{
getChild<LLTextBox>("currency_links")->setText(LLStringExplicit(""));
}
center(); center();
updateUI(); updateUI();
mCurrencyChangedSlot = LLCurrencyWrapper::instance().addCurrencyChangedCb(
std::bind(&LLFloaterBuyCurrencyUI::updateCurrencySymbols, this));
return TRUE; return TRUE;
} }
...@@ -197,15 +185,7 @@ void LLFloaterBuyCurrencyUI::updateUI() ...@@ -197,15 +185,7 @@ void LLFloaterBuyCurrencyUI::updateUI()
LLSD args; LLSD args;
args["TITLE"] = getString("info_cannot_buy"); args["TITLE"] = getString("info_cannot_buy");
args["MESSAGE"] = mManager.errorMessage(); args["MESSAGE"] = mManager.errorMessage();
if( !LLGridManager::getInstance()->isInSecondlife() ) LLNotificationsUtil::add("CouldNotBuyCurrency", args);
{
args["LINK"] = mManager.errorURI();
LLNotificationsUtil::add("CouldNotBuyCurrencyOS", args);
}
else
{
LLNotificationsUtil::add("CouldNotBuyCurrency", args);
}
mManager.clearError(); mManager.clearError();
closeFloater(); closeFloater();
} }
...@@ -260,16 +240,6 @@ void LLFloaterBuyCurrencyUI::updateUI() ...@@ -260,16 +240,6 @@ void LLFloaterBuyCurrencyUI::updateUI()
getChildView("getting_data")->setVisible( !mManager.canBuy() && !hasError && !getChildView("currency_est")->getVisible()); getChildView("getting_data")->setVisible( !mManager.canBuy() && !hasError && !getChildView("currency_est")->getVisible());
} }
void LLFloaterBuyCurrencyUI::updateCurrencySymbols()
{
updateCurrencySymbol();
getChild<LLTextBox>("info_need_more")->updateCurrencySymbols();
getChild<LLTextBox>("info_buying")->updateCurrencySymbols();
getChild<LLTextBox>("currency_label")->updateCurrencySymbols();
getChild<LLTextBox>("purchase_warning_repurchase")->updateCurrencySymbols();
getChild<LLTextBox>("purchase_warning_notenough")->updateCurrencySymbols();
}
void LLFloaterBuyCurrencyUI::collapsePanels(bool collapse) void LLFloaterBuyCurrencyUI::collapsePanels(bool collapse)
{ {
LLLayoutPanel* price_panel = getChild<LLLayoutPanel>("layout_panel_price"); LLLayoutPanel* price_panel = getChild<LLLayoutPanel>("layout_panel_price");
...@@ -319,33 +289,15 @@ LLFetchAvatarPaymentInfo* LLFloaterBuyCurrency::sPropertiesRequest = NULL; ...@@ -319,33 +289,15 @@ LLFetchAvatarPaymentInfo* LLFloaterBuyCurrency::sPropertiesRequest = NULL;
// static // static
void LLFloaterBuyCurrency::buyCurrency() void LLFloaterBuyCurrency::buyCurrency()
{ {
if (LLGridManager::instance().isInOpenSim()) delete sPropertiesRequest;
{ sPropertiesRequest = new LLFetchAvatarPaymentInfo(false);
LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency");
ui->noTarget();
ui->updateUI();
}
else
{
delete sPropertiesRequest;
sPropertiesRequest = new LLFetchAvatarPaymentInfo(false);
}
} }
// static // static
void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price)
{ {
if (LLGridManager::instance().isInOpenSim()) delete sPropertiesRequest;
{ sPropertiesRequest = new LLFetchAvatarPaymentInfo(true, name, price);
LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency");
ui->target(name, price);
ui->updateUI();
}
else
{
delete sPropertiesRequest;
sPropertiesRequest = new LLFetchAvatarPaymentInfo(true, name, price);
}
} }
// static // static
......
...@@ -201,15 +201,22 @@ void LLFloaterIMNearbyChat::closeFloater(bool app_quitting) ...@@ -201,15 +201,22 @@ void LLFloaterIMNearbyChat::closeFloater(bool app_quitting)
{ {
LLFloaterEmojiPicker::saveState(); LLFloaterEmojiPicker::saveState();
LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance(); if (!getHost() || app_quitting)
if (getHost())
{ {
LLFloaterIMContainer::getInstance()->closeFloater(app_quitting); LLFloaterIMSessionTab::closeFloater(app_quitting);
} }
else // If detached from conversations window close anyway
LLFloaterIMContainer* floater_container = LLFloaterIMContainer::findInstance();
if (floater_container && !app_quitting)
{ {
LLFloaterIMSessionTab::closeFloater(app_quitting); if (getHost())
floater_container->selectNextConversationByID(LLUUID()); {
LLFloaterIMContainer::getInstance()->closeFloater(app_quitting);
}
else // If detached from conversations window close anyway
{
floater_container->selectNextConversationByID(LLUUID());
}
} }
} }
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llpresetsmanager.h" #include "llpresetsmanager.h"
#include <nlohmann/json.hpp> #include <boost/json.hpp>
#include <utility> #include <utility>
#include "llsearchableui.h" #include "llsearchableui.h"
...@@ -543,9 +543,7 @@ BOOL LLFloaterPreference::postBuild() ...@@ -543,9 +543,7 @@ BOOL LLFloaterPreference::postBuild()
void LLFloaterPreference::updateDeleteTranscriptsButton() void LLFloaterPreference::updateDeleteTranscriptsButton()
{ {
std::vector<std::string> list_of_transcriptions_file_names; getChild<LLButton>("delete_transcripts")->setEnabled(LLLogChat::anyTranscriptsExist());
LLLogChat::getListOfTranscriptFiles(list_of_transcriptions_file_names);
getChild<LLButton>("delete_transcripts")->setEnabled(list_of_transcriptions_file_names.size() > 0);
} }
void LLFloaterPreference::onDoNotDisturbResponseChanged() void LLFloaterPreference::onDoNotDisturbResponseChanged()
...@@ -670,29 +668,30 @@ bool LLFloaterPreference::handleRemoveGridCB(const LLSD& notification, const LLS ...@@ -670,29 +668,30 @@ bool LLFloaterPreference::handleRemoveGridCB(const LLSD& notification, const LLS
skin_t manifestFromJson(const std::string& filename, const ESkinType type) skin_t manifestFromJson(const std::string& filename, const ESkinType type)
{ {
skin_t skin; skin_t skin;
nlohmann::json root;
llifstream in; llifstream in;
in.open(filename); in.open(filename);
if (in.is_open()) if (in.is_open())
{ {
try boost::json::error_code ec;
auto root = boost::json::parse(in, ec);
if (!ec.failed() && root.is_object())
{ {
in >> root; auto jobj = root.as_object();
skin.mName = root.value("name", "Unknown"); skin.mName = jobj.contains("name") ? boost::json::value_to<std::string>(jobj.at("name")) : "Unknown";
skin.mAuthor = root.value("author", "Unknown"); skin.mAuthor = jobj.contains("author") ? boost::json::value_to<std::string>(jobj.at("author")) : LLTrans::getString("Unknown");
skin.mUrl = root.value("url", "Unknown"); skin.mUrl = jobj.contains("url") ? boost::json::value_to<std::string>(jobj.at("url")) : LLTrans::getString("Unknown");
skin.mCompatVer = root.value("compatibility", "Unknown"); skin.mCompatVer = jobj.contains("compatibility") ? boost::json::value_to<std::string>(jobj.at("compatibility")) : LLTrans::getString("Unknown");
skin.mDate = LLDate(root.value("date", LLDate::now().asString())); skin.mDate = jobj.contains("date") ? LLDate(boost::json::value_to<std::string>(jobj.at("date"))) : LLDate::now();
skin.mNotes = root.value("notes", ""); skin.mNotes = jobj.contains("notes") ? boost::json::value_to<std::string>(jobj.at("notes")) : "";
// If it's a system skin, the compatability version is always the current build // If it's a system skin, the compatability version is always the current build
if (type == SYSTEM_SKIN) if (type == SYSTEM_SKIN)
{ {
skin.mCompatVer = LLVersionInfo::instance().getShortVersion(); skin.mCompatVer = LLVersionInfo::instance().getShortVersion();
} }
} }
catch(const nlohmann::json::exception& e) else
{ {
LL_WARNS() << "Failed to parse " << filename << ": " << e.what() << LL_ENDL; LL_WARNS() << "Failed to parse " << filename << ": " << ec.message() << LL_ENDL;
} }
in.close(); in.close();
} }
...@@ -786,11 +785,12 @@ void LLFloaterPreference::onAddSkinCallback(const std::vector<std::string>& file ...@@ -786,11 +785,12 @@ void LLFloaterPreference::onAddSkinCallback(const std::vector<std::string>& file
ss << std::string(const_cast<const char*>(buf.get()), buf_size); ss << std::string(const_cast<const char*>(buf.get()), buf_size);
buf.reset(); buf.reset();
nlohmann::json root; boost::json::error_code ec;
try auto root = boost::json::parse(ss, ec);
if (!ec.failed() && root.is_object())
{ {
ss >> root; const auto& jobj = root.as_object();
const std::string& name = root.value("name", "Unknown"); const std::string& name = jobj.contains("name") ? boost::json::value_to<std::string>(jobj.at("name")) : "Unknown";
std::string pathname = gDirUtilp->add(gDirUtilp->getOSUserAppDir(), "skins"); std::string pathname = gDirUtilp->add(gDirUtilp->getOSUserAppDir(), "skins");
if (!gDirUtilp->fileExists(pathname)) if (!gDirUtilp->fileExists(pathname))
{ {
...@@ -811,7 +811,7 @@ void LLFloaterPreference::onAddSkinCallback(const std::vector<std::string>& file ...@@ -811,7 +811,7 @@ void LLFloaterPreference::onAddSkinCallback(const std::vector<std::string>& file
LLNotificationsUtil::add("AddSkinSuccess", LLSD().with("PACKAGE", name)); LLNotificationsUtil::add("AddSkinSuccess", LLSD().with("PACKAGE", name));
} }
} }
catch(const nlohmann::json::exception&) else
{ {
LLNotificationsUtil::add("AddSkinCantParseManifest", LLSD().with("PACKAGE", package)); LLNotificationsUtil::add("AddSkinCantParseManifest", LLSD().with("PACKAGE", package));
} }
......
...@@ -47,10 +47,14 @@ ...@@ -47,10 +47,14 @@
#include <boost/iostreams/device/array.hpp> #include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/stream.hpp> #include <boost/iostreams/stream.hpp>
#include <nlohmann/json.hpp> #include <boost/json.hpp>
#ifndef TINYGLTF_NO_INCLUDE_JSON #ifndef TINYGLTF_USE_BOOSTJSON
#define TINYGLTF_NO_INCLUDE_JSON 1 #define TINYGLTF_USE_BOOSTJSON 1
#endif
#ifndef TINYGLTF_NO_INCLUDE_BOOSTJSON
#define TINYGLTF_NO_INCLUDE_BOOSTJSON 1
#endif #endif
#undef STRICT #undef STRICT
#include "tinygltf/tiny_gltf.h" #include "tinygltf/tiny_gltf.h"
......