summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2022-07-19 18:56:59 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2022-07-19 18:56:59 +0300
commitfcb3b6917c852779a846673bd8b35cdc2fda6bb7 (patch)
treebf5a68f7aa69e13b6b0c7b5ac8d6b088bec4ea3c
parent477f173ad55ca145ff027cb54f86c6553cf6f62d (diff)
SL-17670 Simplify outfit snapshot floater
-rw-r--r--indra/newview/CMakeLists.txt4
-rw-r--r--indra/newview/llappviewer.cpp4
-rw-r--r--indra/newview/llfloateroutfitsnapshot.cpp373
-rw-r--r--indra/newview/llfloateroutfitsnapshot.h123
-rw-r--r--indra/newview/llfloatersimpleoutfitsnapshot.cpp328
-rw-r--r--indra/newview/llfloatersimpleoutfitsnapshot.h129
-rw-r--r--indra/newview/llfloatersnapshot.cpp12
-rw-r--r--indra/newview/llfloatersnapshot.h9
-rw-r--r--indra/newview/lloutfitgallery.cpp6
-rw-r--r--indra/newview/llsnapshotlivepreview.cpp3
-rw-r--r--indra/newview/llsnapshotlivepreview.h2
-rw-r--r--indra/newview/llviewerassetupload.cpp11
-rw-r--r--indra/newview/llviewerfloaterreg.cpp4
-rw-r--r--indra/newview/llviewermenufile.cpp6
-rw-r--r--indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml351
-rw-r--r--indra/newview/skins/default/xui/en/floater_simple_outfit_snapshot.xml50
16 files changed, 535 insertions, 880 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index c577d062f9..adfa772269 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -285,9 +285,9 @@ set(viewer_SOURCE_FILES
llfloaternotificationsconsole.cpp
llfloaternotificationstabbed.cpp
llfloateroutfitphotopreview.cpp
- llfloateroutfitsnapshot.cpp
llfloaterobjectweights.cpp
llfloateropenobject.cpp
+ llfloatersimpleoutfitsnapshot.cpp
llfloaterpathfindingcharacters.cpp
llfloaterpathfindingconsole.cpp
llfloaterpathfindinglinksets.cpp
@@ -924,9 +924,9 @@ set(viewer_HEADER_FILES
llfloaternotificationsconsole.h
llfloaternotificationstabbed.h
llfloateroutfitphotopreview.h
- llfloateroutfitsnapshot.h
llfloaterobjectweights.h
llfloateropenobject.h
+ llfloatersimpleoutfitsnapshot.h
llfloaterpathfindingcharacters.h
llfloaterpathfindingconsole.h
llfloaterpathfindinglinksets.h
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index f54093d9d0..997d04fb9c 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -209,7 +209,7 @@
#include "llcommandlineparser.h"
#include "llfloatermemleak.h"
#include "llfloaterreg.h"
-#include "llfloateroutfitsnapshot.h"
+#include "llfloatersimpleoutfitsnapshot.h"
#include "llfloatersnapshot.h"
#include "llsidepanelinventory.h"
#include "llatmosphere.h"
@@ -1519,7 +1519,7 @@ bool LLAppViewer::doFrame()
LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df Snapshot" )
pingMainloopTimeout("Main:Snapshot");
LLFloaterSnapshot::update(); // take snapshots
- LLFloaterOutfitSnapshot::update();
+ LLFloaterSimpleOutfitSnapshot::update();
gGLActive = FALSE;
}
}
diff --git a/indra/newview/llfloateroutfitsnapshot.cpp b/indra/newview/llfloateroutfitsnapshot.cpp
deleted file mode 100644
index dccef88e41..0000000000
--- a/indra/newview/llfloateroutfitsnapshot.cpp
+++ /dev/null
@@ -1,373 +0,0 @@
-/**
- * @file llfloateroutfitsnapshot.cpp
- * @brief Snapshot preview window for saving as an outfit thumbnail in visual outfit gallery
- *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2016, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llfloatersnapshot.h"
-#include "llfloateroutfitsnapshot.h"
-
-#include "llagent.h"
-#include "llfloaterreg.h"
-#include "llimagefiltersmanager.h"
-#include "llcheckboxctrl.h"
-#include "llcombobox.h"
-#include "llpostcard.h"
-#include "llresmgr.h" // LLLocale
-#include "llsdserialize.h"
-#include "llsidetraypanelcontainer.h"
-#include "llspinctrl.h"
-#include "llviewercontrol.h"
-#include "lltoolfocus.h"
-#include "lltoolmgr.h"
-#include "llwebprofile.h"
-
-///----------------------------------------------------------------------------
-/// Local function declarations, constants, enums, and typedefs
-///----------------------------------------------------------------------------
-LLOutfitSnapshotFloaterView* gOutfitSnapshotFloaterView = NULL;
-
-const S32 OUTFIT_SNAPSHOT_WIDTH = 256;
-const S32 OUTFIT_SNAPSHOT_HEIGHT = 256;
-
-static LLDefaultChildRegistry::Register<LLOutfitSnapshotFloaterView> r("snapshot_outfit_floater_view");
-
-///----------------------------------------------------------------------------
-/// Class LLFloaterOutfitSnapshot::Impl
-///----------------------------------------------------------------------------
-
-// virtual
-LLPanelSnapshot* LLFloaterOutfitSnapshot::Impl::getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found)
-{
- LLPanel* panel = floater->getChild<LLPanel>("panel_outfit_snapshot_inventory");
- LLPanelSnapshot* active_panel = dynamic_cast<LLPanelSnapshot*>(panel);
- if (!ok_if_not_found)
- {
- llassert_always(active_panel != NULL);
- }
- return active_panel;
-}
-
-// virtual
-LLSnapshotModel::ESnapshotFormat LLFloaterOutfitSnapshot::Impl::getImageFormat(LLFloaterSnapshotBase* floater)
-{
- return LLSnapshotModel::SNAPSHOT_FORMAT_PNG;
-}
-
-// virtual
-LLSnapshotModel::ESnapshotLayerType LLFloaterOutfitSnapshot::Impl::getLayerType(LLFloaterSnapshotBase* floater)
-{
- return LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
-}
-
-// This is the main function that keeps all the GUI controls in sync with the saved settings.
-// It should be called anytime a setting is changed that could affect the controls.
-// No other methods should be changing any of the controls directly except for helpers called by this method.
-// The basic pattern for programmatically changing the GUI settings is to first set the
-// appropriate saved settings and then call this method to sync the GUI with them.
-// FIXME: The above comment seems obsolete now.
-// virtual
-void LLFloaterOutfitSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)
-{
- LLSnapshotModel::ESnapshotType shot_type = getActiveSnapshotType(floater);
- LLSnapshotModel::ESnapshotFormat shot_format = (LLSnapshotModel::ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat");
- LLSnapshotModel::ESnapshotLayerType layer_type = getLayerType(floater);
-
- LLSnapshotLivePreview* previewp = getPreviewView();
- BOOL got_snap = previewp && previewp->getSnapshotUpToDate();
-
- // *TODO: Separate maximum size for Web images from postcards
- LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL;
-
- LLLocale locale(LLLocale::USER_LOCALE);
- std::string bytes_string;
- if (got_snap)
- {
- LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10);
- }
-
- // Update displayed image resolution.
- LLTextBox* image_res_tb = floater->getChild<LLTextBox>("image_res_text");
- image_res_tb->setVisible(got_snap);
- if (got_snap)
- {
- image_res_tb->setTextArg("[WIDTH]", llformat("%d", previewp->getEncodedImageWidth()));
- image_res_tb->setTextArg("[HEIGHT]", llformat("%d", previewp->getEncodedImageHeight()));
- }
-
- floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
- floater->getChild<LLUICtrl>("file_size_label")->setColor(LLUIColorTable::instance().getColor("LabelTextColor"));
-
- updateResolution(floater);
-
- if (previewp)
- {
- previewp->setSnapshotType(shot_type);
- previewp->setSnapshotFormat(shot_format);
- previewp->setSnapshotBufferType(layer_type);
- }
-
- LLPanelSnapshot* current_panel = Impl::getActivePanel(floater);
- if (current_panel)
- {
- LLSD info;
- info["have-snapshot"] = got_snap;
- current_panel->updateControls(info);
- }
- LL_DEBUGS() << "finished updating controls" << LL_ENDL;
-}
-
-// virtual
-std::string LLFloaterOutfitSnapshot::Impl::getSnapshotPanelPrefix()
-{
- return "panel_outfit_snapshot_";
-}
-
-// Show/hide upload status message.
-// virtual
-void LLFloaterOutfitSnapshot::Impl::setFinished(bool finished, bool ok, const std::string& msg)
-{
- mFloater->setSuccessLabelPanelVisible(finished && ok);
- mFloater->setFailureLabelPanelVisible(finished && !ok);
-
- if (finished)
- {
- LLUICtrl* finished_lbl = mFloater->getChild<LLUICtrl>(ok ? "succeeded_lbl" : "failed_lbl");
- std::string result_text = mFloater->getString(msg + "_" + (ok ? "succeeded_str" : "failed_str"));
- finished_lbl->setValue(result_text);
-
- LLPanel* snapshot_panel = mFloater->getChild<LLPanel>("panel_outfit_snapshot_inventory");
- snapshot_panel->onOpen(LLSD());
- }
-}
-
-void LLFloaterOutfitSnapshot::Impl::updateResolution(void* data)
-{
- LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data;
-
- if (!view)
- {
- llassert(view);
- return;
- }
-
- S32 width = OUTFIT_SNAPSHOT_WIDTH;
- S32 height = OUTFIT_SNAPSHOT_HEIGHT;
-
- LLSnapshotLivePreview* previewp = getPreviewView();
- if (previewp)
- {
- S32 original_width = 0, original_height = 0;
- previewp->getSize(original_width, original_height);
-
- if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot"))
- { //clamp snapshot resolution to window size when showing UI or HUD in snapshot
- width = llmin(width, gViewerWindow->getWindowWidthRaw());
- height = llmin(height, gViewerWindow->getWindowHeightRaw());
- }
-
-
- llassert(width > 0 && height > 0);
-
- // use the resolution from the selected pre-canned drop-down choice
- LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL;
- previewp->setSize(width, height);
-
- if (original_width != width || original_height != height)
- {
- // hide old preview as the aspect ratio could be wrong
- checkAutoSnapshot(previewp, FALSE);
- LL_DEBUGS() << "updating thumbnail" << LL_ENDL;
- previewp->updateSnapshot(TRUE);
- }
- }
-}
-
-///----------------------------------------------------------------------------
-/// Class LLFloaterOutfitSnapshot
-///----------------------------------------------------------------------------
-
-// Default constructor
-LLFloaterOutfitSnapshot::LLFloaterOutfitSnapshot(const LLSD& key)
-: LLFloaterSnapshotBase(key),
-mOutfitGallery(NULL)
-{
- impl = new Impl(this);
-}
-
-LLFloaterOutfitSnapshot::~LLFloaterOutfitSnapshot()
-{
-}
-
-// virtual
-BOOL LLFloaterOutfitSnapshot::postBuild()
-{
- mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn");
- childSetAction("new_snapshot_btn", ImplBase::onClickNewSnapshot, this);
- mRefreshLabel = getChild<LLUICtrl>("refresh_lbl");
- mSucceessLblPanel = getChild<LLUICtrl>("succeeded_panel");
- mFailureLblPanel = getChild<LLUICtrl>("failed_panel");
-
- childSetCommitCallback("ui_check", ImplBase::onClickUICheck, this);
- getChild<LLUICtrl>("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot"));
-
- childSetCommitCallback("hud_check", ImplBase::onClickHUDCheck, this);
- getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot"));
-
- getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame"));
- childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this);
-
- getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot"));
- childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this);
-
- getChild<LLButton>("retract_btn")->setCommitCallback(boost::bind(&LLFloaterOutfitSnapshot::onExtendFloater, this));
- getChild<LLButton>("extend_btn")->setCommitCallback(boost::bind(&LLFloaterOutfitSnapshot::onExtendFloater, this));
-
- // Filters
- LLComboBox* filterbox = getChild<LLComboBox>("filters_combobox");
- std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList();
- for (U32 i = 0; i < filter_list.size(); i++)
- {
- filterbox->add(filter_list[i]);
- }
- childSetCommitCallback("filters_combobox", ImplBase::onClickFilter, this);
-
- mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder");
-
- // create preview window
- LLRect full_screen_rect = getRootView()->getRect();
- LLSnapshotLivePreview::Params p;
- p.rect(full_screen_rect);
- LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
- LLView* parent_view = gSnapshotFloaterView->getParent();
-
- parent_view->removeChild(gSnapshotFloaterView);
- // make sure preview is below snapshot floater
- parent_view->addChild(previewp);
- parent_view->addChild(gSnapshotFloaterView);
-
- //move snapshot floater to special purpose snapshotfloaterview
- gFloaterView->removeChild(this);
- gSnapshotFloaterView->addChild(this);
-
- impl->mPreviewHandle = previewp->getHandle();
- previewp->setContainer(this);
- impl->updateControls(this);
- impl->setAdvanced(gSavedSettings.getBOOL("AdvanceOutfitSnapshot"));
- impl->updateLayout(this);
-
- previewp->mKeepAspectRatio = FALSE;
- previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect());
-
- return TRUE;
-}
-
-// virtual
-void LLFloaterOutfitSnapshot::onOpen(const LLSD& key)
-{
- LLSnapshotLivePreview* preview = getPreviewView();
- if (preview)
- {
- LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL;
- preview->updateSnapshot(TRUE);
- }
- focusFirstItem(FALSE);
- gSnapshotFloaterView->setEnabled(TRUE);
- gSnapshotFloaterView->setVisible(TRUE);
- gSnapshotFloaterView->adjustToFitScreen(this, FALSE);
-
- impl->updateControls(this);
- impl->setAdvanced(gSavedSettings.getBOOL("AdvanceOutfitSnapshot"));
- impl->updateLayout(this);
-
- LLPanel* snapshot_panel = getChild<LLPanel>("panel_outfit_snapshot_inventory");
- snapshot_panel->onOpen(LLSD());
- postPanelSwitch();
-
-}
-
-void LLFloaterOutfitSnapshot::onExtendFloater()
-{
- impl->setAdvanced(gSavedSettings.getBOOL("AdvanceOutfitSnapshot"));
-}
-
-// static
-void LLFloaterOutfitSnapshot::update()
-{
- LLFloaterOutfitSnapshot* inst = findInstance();
- if (inst != NULL)
- {
- inst->impl->updateLivePreview();
- }
-}
-
-
-// static
-LLFloaterOutfitSnapshot* LLFloaterOutfitSnapshot::findInstance()
-{
- return LLFloaterReg::findTypedInstance<LLFloaterOutfitSnapshot>("outfit_snapshot");
-}
-
-// static
-LLFloaterOutfitSnapshot* LLFloaterOutfitSnapshot::getInstance()
-{
- return LLFloaterReg::getTypedInstance<LLFloaterOutfitSnapshot>("outfit_snapshot");
-}
-
-// virtual
-void LLFloaterOutfitSnapshot::saveTexture()
-{
- LL_DEBUGS() << "saveTexture" << LL_ENDL;
-
- LLSnapshotLivePreview* previewp = getPreviewView();
- if (!previewp)
- {
- llassert(previewp != NULL);
- return;
- }
-
- if (mOutfitGallery)
- {
- mOutfitGallery->onBeforeOutfitSnapshotSave();
- }
- previewp->saveTexture(TRUE, getOutfitID().asString());
- if (mOutfitGallery)
- {
- mOutfitGallery->onAfterOutfitSnapshotSave();
- }
- closeFloater();
-}
-
-///----------------------------------------------------------------------------
-/// Class LLOutfitSnapshotFloaterView
-///----------------------------------------------------------------------------
-
-LLOutfitSnapshotFloaterView::LLOutfitSnapshotFloaterView(const Params& p) : LLFloaterView(p)
-{
-}
-
-LLOutfitSnapshotFloaterView::~LLOutfitSnapshotFloaterView()
-{
-}
diff --git a/indra/newview/llfloateroutfitsnapshot.h b/indra/newview/llfloateroutfitsnapshot.h
deleted file mode 100644
index bee386ec63..0000000000
--- a/indra/newview/llfloateroutfitsnapshot.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * @file llfloateroutfitsnapshot.h
- * @brief Snapshot preview window for saving as an outfit thumbnail in visual outfit gallery
- *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2016, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLFLOATEROUTFITSNAPSHOT_H
-#define LL_LLFLOATEROUTFITSNAPSHOT_H
-
-#include "llfloater.h"
-#include "llfloatersnapshot.h"
-#include "lloutfitgallery.h"
-#include "llsnapshotlivepreview.h"
-
-///----------------------------------------------------------------------------
-/// Class LLFloaterOutfitSnapshot
-///----------------------------------------------------------------------------
-
-class LLFloaterOutfitSnapshot : public LLFloaterSnapshotBase
-{
- LOG_CLASS(LLFloaterOutfitSnapshot);
-
-public:
-
- LLFloaterOutfitSnapshot(const LLSD& key);
- /*virtual*/ ~LLFloaterOutfitSnapshot();
-
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
-
- static void update();
-
- void onExtendFloater();
-
- static LLFloaterOutfitSnapshot* getInstance();
- static LLFloaterOutfitSnapshot* findInstance();
- /*virtual*/ void saveTexture();
-
- const LLRect& getThumbnailPlaceholderRect() { return mThumbnailPlaceholder->getRect(); }
-
- void setOutfitID(LLUUID id) { mOutfitID = id; }
- LLUUID getOutfitID() { return mOutfitID; }
- void setGallery(LLOutfitGallery* gallery) { mOutfitGallery = gallery; }
-
- class Impl;
- friend class Impl;
-private:
-
- LLUUID mOutfitID;
- LLOutfitGallery* mOutfitGallery;
-};
-
-///----------------------------------------------------------------------------
-/// Class LLFloaterOutfitSnapshot::Impl
-///----------------------------------------------------------------------------
-
-class LLFloaterOutfitSnapshot::Impl : public LLFloaterSnapshotBase::ImplBase
-{
- LOG_CLASS(LLFloaterOutfitSnapshot::Impl);
-public:
- Impl(LLFloaterSnapshotBase* floater)
- : LLFloaterSnapshotBase::ImplBase(floater)
- {}
- ~Impl()
- {}
- void updateResolution(void* data);
-
- static void onSnapshotUploadFinished(LLFloaterSnapshotBase* floater, bool status);
-
- /*virtual*/ LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true);
- /*virtual*/ LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater);
- /*virtual*/ std::string getSnapshotPanelPrefix();
-
- /*virtual*/ void updateControls(LLFloaterSnapshotBase* floater);
-
-private:
- /*virtual*/ LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater);
- /*virtual*/ void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null);
-};
-
-///----------------------------------------------------------------------------
-/// Class LLOutfitSnapshotFloaterView
-///----------------------------------------------------------------------------
-
-class LLOutfitSnapshotFloaterView : public LLFloaterView
-{
-public:
- struct Params
- : public LLInitParam::Block<Params, LLFloaterView::Params>
- {
- };
-
-protected:
- LLOutfitSnapshotFloaterView(const Params& p);
- friend class LLUICtrlFactory;
-
-public:
- virtual ~LLOutfitSnapshotFloaterView();
-};
-
-extern LLOutfitSnapshotFloaterView* gOutfitSnapshotFloaterView;
-
-#endif // LL_LLFLOATEROUTFITSNAPSHOT_H
diff --git a/indra/newview/llfloatersimpleoutfitsnapshot.cpp b/indra/newview/llfloatersimpleoutfitsnapshot.cpp
new file mode 100644
index 0000000000..181e2ba10e
--- /dev/null
+++ b/indra/newview/llfloatersimpleoutfitsnapshot.cpp
@@ -0,0 +1,328 @@
+/**
+* @file llfloatersimpleoutfitsnapshot.cpp
+* @brief Snapshot preview window for saving as an outfit thumbnail in visual outfit gallery
+*
+* $LicenseInfo:firstyear=2022&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2022, Linden Research, Inc.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation;
+* version 2.1 of the License only.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*
+* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+* $/LicenseInfo$
+*/
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloatersimpleoutfitsnapshot.h"
+
+#include "llfloaterreg.h"
+#include "llimagefiltersmanager.h"
+#include "llstatusbar.h" // can_afford_transaction()
+#include "llnotificationsutil.h"
+#include "llagentbenefits.h"
+#include "llviewercontrol.h"
+
+LLSimpleOutfitSnapshotFloaterView* gSimpleOutfitSnapshotFloaterView = NULL;
+
+const S32 OUTFIT_SNAPSHOT_WIDTH = 256;
+const S32 OUTFIT_SNAPSHOT_HEIGHT = 256;
+
+static LLDefaultChildRegistry::Register<LLSimpleOutfitSnapshotFloaterView> r("simple_snapshot_outfit_floater_view");
+
+///----------------------------------------------------------------------------
+/// Class LLFloaterSimpleOutfitSnapshot::Impl
+///----------------------------------------------------------------------------
+
+LLSnapshotModel::ESnapshotFormat LLFloaterSimpleOutfitSnapshot::Impl::getImageFormat(LLFloaterSnapshotBase* floater)
+{
+ return LLSnapshotModel::SNAPSHOT_FORMAT_PNG;
+}
+
+LLSnapshotModel::ESnapshotLayerType LLFloaterSimpleOutfitSnapshot::Impl::getLayerType(LLFloaterSnapshotBase* floater)
+{
+ return LLSnapshotModel::SNAPSHOT_TYPE_COLOR;
+}
+
+void LLFloaterSimpleOutfitSnapshot::Impl::updateControls(LLFloaterSnapshotBase* floater)
+{
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ updateResolution(floater);
+ if (previewp)
+ {
+ previewp->setSnapshotType(LLSnapshotModel::ESnapshotType::SNAPSHOT_TEXTURE);
+ previewp->setSnapshotFormat(LLSnapshotModel::ESnapshotFormat::SNAPSHOT_FORMAT_PNG);
+ previewp->setSnapshotBufferType(LLSnapshotModel::ESnapshotLayerType::SNAPSHOT_TYPE_COLOR);
+ }
+}
+
+std::string LLFloaterSimpleOutfitSnapshot::Impl::getSnapshotPanelPrefix()
+{
+ return "panel_outfit_snapshot_";
+}
+
+void LLFloaterSimpleOutfitSnapshot::Impl::updateResolution(void* data)
+{
+ LLFloaterSimpleOutfitSnapshot *view = (LLFloaterSimpleOutfitSnapshot *)data;
+
+ if (!view)
+ {
+ llassert(view);
+ return;
+ }
+
+ S32 width = OUTFIT_SNAPSHOT_WIDTH;
+ S32 height = OUTFIT_SNAPSHOT_HEIGHT;
+
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ if (previewp)
+ {
+ S32 original_width = 0, original_height = 0;
+ previewp->getSize(original_width, original_height);
+
+ if (gSavedSettings.getBOOL("RenderHUDInSnapshot"))
+ { //clamp snapshot resolution to window size when showing UI HUD in snapshot
+ width = llmin(width, gViewerWindow->getWindowWidthRaw());
+ height = llmin(height, gViewerWindow->getWindowHeightRaw());
+ }
+
+ llassert(width > 0 && height > 0);
+
+ previewp->setSize(width, height);
+
+ if (original_width != width || original_height != height)
+ {
+ // hide old preview as the aspect ratio could be wrong
+ checkAutoSnapshot(previewp, FALSE);
+ previewp->updateSnapshot(TRUE);
+ }
+ }
+}
+
+void LLFloaterSimpleOutfitSnapshot::Impl::setStatus(EStatus status, bool ok, const std::string& msg)
+{
+ switch (status)
+ {
+ case STATUS_READY:
+ mFloater->setCtrlsEnabled(true);
+ break;
+ case STATUS_WORKING:
+ mFloater->setCtrlsEnabled(false);
+ break;
+ case STATUS_FINISHED:
+ mFloater->setCtrlsEnabled(true);
+ break;
+ }
+
+ mStatus = status;
+}
+
+///----------------------------------------------------------------re------------
+/// Class LLFloaterSimpleOutfitSnapshot
+///----------------------------------------------------------------------------
+
+LLFloaterSimpleOutfitSnapshot::LLFloaterSimpleOutfitSnapshot(const LLSD& key)
+ : LLFloaterSnapshotBase(key),
+ mOutfitGallery(NULL)
+{
+ impl = new Impl(this);
+}
+
+LLFloaterSimpleOutfitSnapshot::~LLFloaterSimpleOutfitSnapshot()
+{
+}
+
+BOOL LLFloaterSimpleOutfitSnapshot::postBuild()
+{
+ getChild<LLUICtrl>("save_btn")->setLabelArg("[UPLOAD_COST]", std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()));
+
+ childSetAction("new_snapshot_btn", ImplBase::onClickNewSnapshot, this);
+ childSetAction("save_btn", boost::bind(&LLFloaterSimpleOutfitSnapshot::onSend, this));
+ childSetAction("cancel_btn", boost::bind(&LLFloaterSimpleOutfitSnapshot::onCancel, this));
+
+ mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder");
+
+ // create preview window
+ LLRect full_screen_rect = getRootView()->getRect();
+ LLSnapshotLivePreview::Params p;
+ p.rect(full_screen_rect);
+ LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
+ LLView* parent_view = gSnapshotFloaterView->getParent();
+
+ parent_view->removeChild(gSnapshotFloaterView);
+ // make sure preview is below snapshot floater
+ parent_view->addChild(previewp);
+ parent_view->addChild(gSnapshotFloaterView);
+
+ //move snapshot floater to special purpose snapshotfloaterview
+ gFloaterView->removeChild(this);
+ gSnapshotFloaterView->addChild(this);
+
+ impl->mPreviewHandle = previewp->getHandle();
+ previewp->setContainer(this);
+ impl->updateControls(this);
+ impl->setAdvanced(true);
+ impl->setSkipReshaping(true);
+
+ previewp->mKeepAspectRatio = FALSE;
+ previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect());
+ previewp->setAllowRenderUI(false);
+
+ return TRUE;
+}
+const S32 PREVIEW_OFFSET_X = 2;
+const S32 PREVIEW_OFFSET_Y = 63;
+
+void LLFloaterSimpleOutfitSnapshot::draw()
+{
+ LLSnapshotLivePreview* previewp = getPreviewView();
+
+ if (previewp && (previewp->isSnapshotActive() || previewp->getThumbnailLock()))
+ {
+ // don't render snapshot window in snapshot, even if "show ui" is turned on
+ return;
+ }
+
+ LLFloater::draw();
+
+ if (previewp && !isMinimized() && mThumbnailPlaceholder->getVisible())
+ {
+ if(previewp->getThumbnailImage())
+ {
+ bool working = impl->getStatus() == ImplBase::STATUS_WORKING;
+ const LLRect& thumbnail_rect = getThumbnailPlaceholderRect();
+ const S32 thumbnail_w = previewp->getThumbnailWidth();
+ const S32 thumbnail_h = previewp->getThumbnailHeight();
+
+ S32 offset_x = PREVIEW_OFFSET_X;
+ S32 offset_y = PREVIEW_OFFSET_Y;
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ // Apply floater transparency to the texture unless the floater is focused.
+ F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+ LLColor4 color = working ? LLColor4::grey4 : LLColor4::white;
+ gl_draw_scaled_image(offset_x, offset_y,
+ thumbnail_w, thumbnail_h,
+ previewp->getThumbnailImage(), color % alpha);
+ std::string alpha_color = getTransparencyType() == TT_ACTIVE ? "FloaterFocusBackgroundColor" : "DkGray";
+ previewp->drawPreviewRect(offset_x, offset_y, LLUIColorTable::instance().getColor(alpha_color));
+
+ gGL.pushUIMatrix();
+ LLUI::translate((F32) thumbnail_rect.mLeft, (F32) thumbnail_rect.mBottom);
+ mThumbnailPlaceholder->draw();
+ gGL.popUIMatrix();
+ }
+ }
+ impl->updateLayout(this);
+}
+
+void LLFloaterSimpleOutfitSnapshot::onOpen(const LLSD& key)
+{
+ LLSnapshotLivePreview* preview = getPreviewView();
+ if (preview)
+ {
+ preview->updateSnapshot(TRUE);
+ }
+ focusFirstItem(FALSE);
+ gSnapshotFloaterView->setEnabled(TRUE);
+ gSnapshotFloaterView->setVisible(TRUE);
+ gSnapshotFloaterView->adjustToFitScreen(this, FALSE);
+
+ impl->updateControls(this);
+ impl->setStatus(ImplBase::STATUS_READY);
+}
+
+void LLFloaterSimpleOutfitSnapshot::onCancel()
+{
+ closeFloater();
+}
+
+void LLFloaterSimpleOutfitSnapshot::onSend()
+{
+ S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
+ if (can_afford_transaction(expected_upload_cost))
+ {
+ saveTexture();
+ postSave();
+ }
+ else
+ {
+ LLSD args;
+ args["COST"] = llformat("%d", expected_upload_cost);
+ LLNotificationsUtil::add("ErrorPhotoCannotAfford", args);
+ inventorySaveFailed();
+ }
+}
+
+void LLFloaterSimpleOutfitSnapshot::postSave()
+{
+ impl->setStatus(ImplBase::STATUS_WORKING);
+}
+
+// static
+void LLFloaterSimpleOutfitSnapshot::update()
+{
+ LLFloaterSimpleOutfitSnapshot* inst = findInstance();
+ if (inst != NULL)
+ {
+ inst->impl->updateLivePreview();
+ }
+}
+
+
+// static
+LLFloaterSimpleOutfitSnapshot* LLFloaterSimpleOutfitSnapshot::findInstance()
+{
+ return LLFloaterReg::findTypedInstance<LLFloaterSimpleOutfitSnapshot>("simple_outfit_snapshot");
+}
+
+// static
+LLFloaterSimpleOutfitSnapshot* LLFloaterSimpleOutfitSnapshot::getInstance()
+{
+ return LLFloaterReg::getTypedInstance<LLFloaterSimpleOutfitSnapshot>("simple_outfit_snapshot");
+}
+
+void LLFloaterSimpleOutfitSnapshot::saveTexture()
+{
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ if (!previewp)
+ {
+ llassert(previewp != NULL);
+ return;
+ }
+
+ if (mOutfitGallery)
+ {
+ mOutfitGallery->onBeforeOutfitSnapshotSave();
+ }
+ previewp->saveTexture(TRUE, getOutfitID().asString());
+ if (mOutfitGallery)
+ {
+ mOutfitGallery->onAfterOutfitSnapshotSave();
+ }
+ closeFloater();
+}
+
+///----------------------------------------------------------------------------
+/// Class LLSimpleOutfitSnapshotFloaterView
+///----------------------------------------------------------------------------
+
+LLSimpleOutfitSnapshotFloaterView::LLSimpleOutfitSnapshotFloaterView(const Params& p) : LLFloaterView(p)
+{
+}
+
+LLSimpleOutfitSnapshotFloaterView::~LLSimpleOutfitSnapshotFloaterView()
+{
+}
diff --git a/indra/newview/llfloatersimpleoutfitsnapshot.h b/indra/newview/llfloatersimpleoutfitsnapshot.h
new file mode 100644
index 0000000000..cc9a6c5d1e
--- /dev/null
+++ b/indra/newview/llfloatersimpleoutfitsnapshot.h
@@ -0,0 +1,129 @@
+/**
+* @file llfloatersimpleoutfitsnapshot.h
+* @brief Snapshot preview window for saving as an outfit thumbnail in visual outfit gallery
+*
+* $LicenseInfo:firstyear=2022&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2022, Linden Research, Inc.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation;
+* version 2.1 of the License only.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*
+* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+* $/LicenseInfo$
+*/
+
+#ifndef LL_LLFLOATERSIMPLEOUTFITSNAPSHOT_H
+#define LL_LLFLOATERSIMPLEOUTFITSNAPSHOT_H
+
+#include "llfloater.h"
+#include "llfloatersnapshot.h"
+#include "lloutfitgallery.h"
+#include "llsnapshotlivepreview.h"
+
+///----------------------------------------------------------------------------
+/// Class LLFloaterSimpleOutfitSnapshot
+///----------------------------------------------------------------------------
+
+class LLFloaterSimpleOutfitSnapshot : public LLFloaterSnapshotBase
+{
+ LOG_CLASS(LLFloaterSimpleOutfitSnapshot);
+
+public:
+
+ LLFloaterSimpleOutfitSnapshot(const LLSD& key);
+ ~LLFloaterSimpleOutfitSnapshot();
+
+ BOOL postBuild();
+ void onOpen(const LLSD& key);
+ void draw();
+
+ static void update();
+
+ static LLFloaterSimpleOutfitSnapshot* getInstance();
+ static LLFloaterSimpleOutfitSnapshot* findInstance();
+ void saveTexture();
+
+ const LLRect& getThumbnailPlaceholderRect() { return mThumbnailPlaceholder->getRect(); }
+
+ void setOutfitID(LLUUID id) { mOutfitID = id; }
+ LLUUID getOutfitID() { return mOutfitID; }
+ void setGallery(LLOutfitGallery* gallery) { mOutfitGallery = gallery; }
+
+ void postSave();
+
+ class Impl;
+ friend class Impl;
+
+private:
+ void onSend();
+ void onCancel();
+
+ LLUUID mOutfitID;
+ LLOutfitGallery* mOutfitGallery;
+};
+
+///----------------------------------------------------------------------------
+/// Class LLFloaterSimpleOutfitSnapshot::Impl
+///----------------------------------------------------------------------------
+
+class LLFloaterSimpleOutfitSnapshot::Impl : public LLFloaterSnapshotBase::ImplBase
+{
+ LOG_CLASS(LLFloaterSimpleOutfitSnapshot::Impl);
+public:
+ Impl(LLFloaterSnapshotBase* floater)
+ : LLFloaterSnapshotBase::ImplBase(floater)
+ {}
+ ~Impl()
+ {}
+ void updateResolution(void* data);
+
+ static void onSnapshotUploadFinished(LLFloaterSnapshotBase* floater, bool status);
+
+ LLPanelSnapshot* getActivePanel(LLFloaterSnapshotBase* floater, bool ok_if_not_found = true) { return NULL; }
+ LLSnapshotModel::ESnapshotFormat getImageFormat(LLFloaterSnapshotBase* floater);
+ std::string getSnapshotPanelPrefix();
+
+ void updateControls(LLFloaterSnapshotBase* floater);
+
+ void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null);
+
+private:
+ LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater);
+ void setFinished(bool finished, bool ok = true, const std::string& msg = LLStringUtil::null) {};
+};
+
+///----------------------------------------------------------------------------
+/// Class LLSimpleOutfitSnapshotFloaterView
+///----------------------------------------------------------------------------
+
+class LLSimpleOutfitSnapshotFloaterView : public LLFloaterView
+{
+public:
+ struct Params
+ : public LLInitParam::Block<Params, LLFloaterView::Params>
+ {
+ };
+
+protected:
+ LLSimpleOutfitSnapshotFloaterView(const Params& p);
+ friend class LLUICtrlFactory;
+
+public:
+ virtual ~LLSimpleOutfitSnapshotFloaterView();
+};
+
+extern LLSimpleOutfitSnapshotFloaterView* gSimpleOutfitSnapshotFloaterView;
+
+#endif // LL_LLFLOATERSIMPLEOUTFITSNAPSHOT_H
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 83212230e5..6b9d4580dc 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -176,16 +176,20 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate
LLUICtrl* thumbnail_placeholder = floaterp->getChild<LLUICtrl>("thumbnail_placeholder");
thumbnail_placeholder->setVisible(mAdvanced);
- thumbnail_placeholder->reshape(panel_width, thumbnail_placeholder->getRect().getHeight());
+
floaterp->getChild<LLUICtrl>("image_res_text")->setVisible(mAdvanced);
floaterp->getChild<LLUICtrl>("file_size_label")->setVisible(mAdvanced);
if (floaterp->hasChild("360_label", TRUE))
{
floaterp->getChild<LLUICtrl>("360_label")->setVisible(mAdvanced);
}
- if(!floaterp->isMinimized())
+ if (!mSkipReshaping)
{
- floaterp->reshape(floater_width, floaterp->getRect().getHeight());
+ thumbnail_placeholder->reshape(panel_width, thumbnail_placeholder->getRect().getHeight());
+ if (!floaterp->isMinimized())
+ {
+ floaterp->reshape(floater_width, floaterp->getRect().getHeight());
+ }
}
bool use_freeze_frame = floaterp->getChild<LLUICtrl>("freeze_frame_check")->getValue().asBoolean();
@@ -1193,7 +1197,7 @@ S32 LLFloaterSnapshotBase::notify(const LLSD& info)
// The refresh button is initially hidden. We show it after the first update,
// i.e. when preview appears.
- if (!mRefreshBtn->getVisible())
+ if (mRefreshBtn && !mRefreshBtn->getVisible())
{
mRefreshBtn->setVisible(true);
}
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h
index 7ec133ff45..7fc62a2746 100644
--- a/indra/newview/llfloatersnapshot.h
+++ b/indra/newview/llfloatersnapshot.h
@@ -59,9 +59,9 @@ public:
const LLRect& getThumbnailPlaceholderRect() { return mThumbnailPlaceholder->getRect(); }
- void setRefreshLabelVisible(bool value) { mRefreshLabel->setVisible(value); }
- void setSuccessLabelPanelVisible(bool value) { mSucceessLblPanel->setVisible(value); }
- void setFailureLabelPanelVisible(bool value) { mFailureLblPanel->setVisible(value); }
+ void setRefreshLabelVisible(bool value) { if (mRefreshLabel) mRefreshLabel->setVisible(value); }
+ void setSuccessLabelPanelVisible(bool value) { if (mSucceessLblPanel) mSucceessLblPanel->setVisible(value); }
+ void setFailureLabelPanelVisible(bool value) { if (mFailureLblPanel) mFailureLblPanel->setVisible(value); }
void inventorySaveFailed();
class ImplBase;
@@ -88,6 +88,7 @@ public:
mLastToolset(NULL),
mAspectRatioCheckOff(false),
mNeedRefresh(false),
+ mSkipReshaping(false),
mStatus(STATUS_READY),
mFloater(floater)
{}
@@ -120,6 +121,7 @@ public:
static BOOL updatePreviewList(bool initialized);
void setAdvanced(bool advanced) { mAdvanced = advanced; }
+ void setSkipReshaping(bool skip) { mSkipReshaping = skip; }
virtual LLSnapshotModel::ESnapshotLayerType getLayerType(LLFloaterSnapshotBase* floater) = 0;
virtual void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE);
@@ -135,6 +137,7 @@ public:
bool mAspectRatioCheckOff;
bool mNeedRefresh;
bool mAdvanced;
+ bool mSkipReshaping;
EStatus mStatus;
};
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index 4febb72c6c..87a0423483 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -41,7 +41,7 @@
#include "llfilepicker.h"
#include "llfloaterperms.h"
#include "llfloaterreg.h"
-#include "llfloateroutfitsnapshot.h"
+#include "llfloatersimpleoutfitsnapshot.h"
#include "llimagedimensionsinfo.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
@@ -1385,8 +1385,8 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id)
void LLOutfitGallery::onTakeSnapshot(LLUUID selected_outfit_id)
{
- LLFloaterReg::toggleInstanceOrBringToFront("outfit_snapshot");
- LLFloaterOutfitSnapshot* snapshot_floater = LLFloaterOutfitSnapshot::getInstance();
+ LLFloaterReg::toggleInstanceOrBringToFront("simple_outfit_snapshot");
+ LLFloaterSimpleOutfitSnapshot* snapshot_floater = LLFloaterSimpleOutfitSnapshot::getInstance();
if (snapshot_floater)
{
snapshot_floater->setOutfitID(selected_outfit_id);
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp
index 8134187c21..ed7e18fadc 100644
--- a/indra/newview/llsnapshotlivepreview.cpp
+++ b/indra/newview/llsnapshotlivepreview.cpp
@@ -233,7 +233,7 @@ bool LLSnapshotLivePreview::setSnapshotQuality(S32 quality, bool set_by_user)
return false;
}
-void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y)
+void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y, LLColor4 alpha_color)
{
F32 line_width ;
glGetFloatv(GL_LINE_WIDTH, &line_width) ;
@@ -246,7 +246,6 @@ void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y)
//draw four alpha rectangles to cover areas outside of the snapshot image
if(!mKeepAspectRatio)
{
- LLColor4 alpha_color(0.5f, 0.5f, 0.5f, 0.8f) ;
S32 dwl = 0, dwr = 0 ;
if(mThumbnailWidth > mPreviewRect.getWidth())
{
diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h
index 683cd016d8..1f81307976 100644
--- a/indra/newview/llsnapshotlivepreview.h
+++ b/indra/newview/llsnapshotlivepreview.h
@@ -112,7 +112,7 @@ public:
BOOL setThumbnailImageSize() ;
void generateThumbnailImage(BOOL force_update = FALSE) ;
void resetThumbnailImage() { mThumbnailImage = NULL ; }
- void drawPreviewRect(S32 offset_x, S32 offset_y) ;
+ void drawPreviewRect(S32 offset_x, S32 offset_y, LLColor4 alpha_color = LLColor4(0.5f, 0.5f, 0.5f, 0.8f));
void prepareFreezeFrame();
LLViewerTexture* getBigThumbnailImage();
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index 3f7e8531fb..fc83b109ba 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -811,11 +811,6 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
{
floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory")));
}
- LLFloater* floater_outfit_snapshot = LLFloaterReg::findInstance("outfit_snapshot");
- if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE && floater_outfit_snapshot && floater_outfit_snapshot->isShown())
- {
- floater_outfit_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory")));
- }
}
//=========================================================================
@@ -893,11 +888,5 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res
floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", false).with("msg", "inventory")));
}
}
-
- LLFloater* floater_outfit_snapshot = LLFloaterReg::findInstance("outfit_snapshot");
- if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE && floater_outfit_snapshot && floater_outfit_snapshot->isShown())
- {
- floater_outfit_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", false).with("msg", "inventory")));
- }
}
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index dd03d6cfdd..30f8dbae7c 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -101,7 +101,7 @@
#include "llfloaterobjectweights.h"
#include "llfloateropenobject.h"
#include "llfloateroutfitphotopreview.h"
-#include "llfloateroutfitsnapshot.h"
+#include "llfloatersimpleoutfitsnapshot.h"
#include "llfloaterpathfindingcharacters.h"
#include "llfloaterpathfindingconsole.h"
#include "llfloaterpathfindinglinksets.h"
@@ -365,7 +365,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("scene_load_stats", "floater_scene_load_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSceneLoadStats>);
LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>);
LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>);
- LLFloaterReg::add("outfit_snapshot", "floater_outfit_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOutfitSnapshot>);
+ LLFloaterReg::add("simple_outfit_snapshot", "floater_simple_outfit_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSimpleOutfitSnapshot>);
LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index f1e2c06e0c..fdf1d04c09 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -38,7 +38,7 @@
#include "llfloatermap.h"
#include "llfloatermodelpreview.h"
#include "llfloatersnapshot.h"
-#include "llfloateroutfitsnapshot.h"
+#include "llfloatersimpleoutfitsnapshot.h"
#include "llimage.h"
#include "llimagebmp.h"
#include "llimagepng.h"
@@ -664,7 +664,7 @@ class LLFileEnableCloseAllWindows : public view_listener_t
bool handleEvent(const LLSD& userdata)
{
LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
- LLFloaterOutfitSnapshot* floater_outfit_snapshot = LLFloaterOutfitSnapshot::findInstance();
+ LLFloaterSimpleOutfitSnapshot* floater_outfit_snapshot = LLFloaterSimpleOutfitSnapshot::findInstance();
bool is_floaters_snapshot_opened = (floater_snapshot && floater_snapshot->isInVisibleChain())
|| (floater_outfit_snapshot && floater_outfit_snapshot->isInVisibleChain());
bool open_children = gFloaterView->allChildrenClosed() && !is_floaters_snapshot_opened;
@@ -681,7 +681,7 @@ class LLFileCloseAllWindows : public view_listener_t
LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
if (floater_snapshot)
floater_snapshot->closeFloater(app_quitting);
- LLFloaterOutfitSnapshot* floater_outfit_snapshot = LLFloaterOutfitSnapshot::findInstance();
+ LLFloaterSimpleOutfitSnapshot* floater_outfit_snapshot = LLFloaterSimpleOutfitSnapshot::findInstance();
if (floater_outfit_snapshot)
floater_outfit_snapshot->closeFloater(app_quitting);
if (gMenuHolder) gMenuHolder->hideMenus();
diff --git a/indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml b/indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml
deleted file mode 100644
index 15c480f144..0000000000
--- a/indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml
+++ /dev/null
@@ -1,351 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<floater
- positioning="cascading"
- legacy_header_height="18"
- can_minimize="true"
- can_resize="false"
- can_close="true"
- height="455"
- layout="topleft"
- name="outfit_snapshot"
- single_instance="true"
- help_topic="snapshot"
- save_rect="true"
- save_visibility="false"
- title="OUTFIT SNAPSHOT"
- width="624"
- min_height="455">
- <floater.string
- name="unknown">
- unknown
- </floater.string>
- <string
- name="inventory_progress_str">
- Saving to Inventory
- </string>
- <string
- name="inventory_succeeded_str">
- Saved to Inventory!
- </string>
- <string
- name="inventory_failed_str">
- Failed to save to inventory.
- </string>
- <button
- follows="left|top"
- height="25"
- image_overlay="Refresh_Off"
- image_hover_unselected="Toolbar_Middle_Over"
- image_selected="Toolbar_Middle_Selected"
- image_unselected="Toolbar_Middle_Off"
- image_overlay_alignment="left"
- imgoverlay_label_space="5"
- pad_bottom="0"
- halign="left"
- layout="topleft"
- left="10"
- label="REFRESH"
- name="new_snapshot_btn"
- top_pad="26"
- width="167" />
- <button
- follows="left|top"
- control_name="AdvanceOutfitSnapshot"
- invisibility_control="AdvanceOutfitSnapshot"
- height="25"
- is_toggle="true"
- layout="topleft"
- image_hover_unselected="Toolbar_Middle_Over"
- image_selected="Toolbar_Middle_Off"
- image_unselected="Toolbar_Middle_Off"
- image_overlay="Conv_toolbar_expand"
- name="retract_btn"
- left_pad="1"
- top_delta="0"
- width="31" />
- <button
- follows="left|top"
- control_name="AdvanceOutfitSnapshot"
- visibility_control="AdvanceOutfitSnapshot"
- height="25"
- is_toggle="true"
- layout="topleft"
- image_overlay="Conv_toolbar_collapse"
- image_hover_unselected="Toolbar_Middle_Over"
- image_selected="Toolbar_Middle_Off"
- image_unselected="Toolbar_Middle_Off"
- name="extend_btn"
- left_delta="0"
- top_delta="0"
- width="31" />
- <panel
- height="154"
- layout="topleft"
- follows="top|left"
- left="0"
- name="advanced_options_panel"
- top_pad="-6"
- width="210">
- <view_border
- bevel_style="in"
- follows="left|top|right"
- height="1"
- left="10"
- layout="topleft"
- name="advanced_options_hr"
- right="-1"
- top_pad="5"
- />
- <text
- type="string"
- length="1"
- follows="left|top"
- height="13"
- layout="topleft"
- left="10"
- name="layer_type_label"
- top_pad="10"
- width="100">
- Capture:
- </text>
- <check_box
- label="Interface"
- layout="topleft"
- left="30"
- height="16"
- top_pad="8"
- width="180"
- name="ui_check" />
- <check_box
- label="HUDs"
- layout="topleft"
- height="16"
- left="30"
- top_pad="1"
- width="180"
- name="hud_check" />
- <check_box
- label="Freeze frame (fullscreen)"
- layout="topleft"
- height="16"
- left="10"
- top_pad="1"
- width="180"
- name="freeze_frame_check" />
- <check_box
- label="Auto-refresh"
- layout="topleft"
- height="16"
- left="10"
- top_pad="1"
- width="180"
- name="auto_snapshot_check" />
- <text
- type="string"
- length="1"
- follows="left|top"
- height="13"
- layout="topleft"
- left="10"
- name="filter_list_label"
- top_pad="10"
- width="50">
- Filter:
- </text>
- <combo_box
- control_name="PhotoFilters"
- follows="left|right|top"
- name="filters_combobox"
- tool_tip="Image filters"
- top_delta="-3"
- left="50"
- right="-1"
- height="21"
- width="135">
- <combo_box.item
- label="No Filter"
- name="NoFilter"
- value="NoFilter" />
- </combo_box>
- <view_border
- bevel_style="in"
- follows="left|top|right"
- height="1"
- left="10"
- layout="topleft"
- name="advanced_options_hr"
- right="-1"
- top_pad="7"
- />
- </panel>
- <panel
- class="llpaneloutfitsnapshotinventory"
- follows="left|top"
- height="230"
- layout="topleft"
- left="0"
- name="panel_outfit_snapshot_inventory"
- filename="panel_outfit_snapshot_inventory.xml"
- top_pad="10"
- width="215"
- />
- <view_border
- bevel_style="in"
- follows="left|top"
- height="1"
- left="10"
- layout="topleft"
- name="status_hr"
- width="199"
- top_pad="-16"/>
- <panel
- background_visible="false"
- follows="left|top"
- font="SansSerifLarge"
- halign="center"
- height="20"
- layout="topleft"
- left="10"
- length="1"
- name="succeeded_panel"
- width="198"
- top_pad="1"
- type="string"
- visible="false">
- <text
- follows="all"
- font="SansSerif"
- halign="center"
- height="18"
- layout="topleft"
- left="1"
- length="1"
- name="succeeded_lbl"
- right="-1"
- text_color="0.2 0.85 0.2 1"
- top="4"
- translate="false"
- type="string">
- Succeeded
- </text>
- </panel>
- <panel
- background_visible="false"
- follows="left|top"
- font="SansSerifLarge"
- halign="center"
- height="20"
- layout="topleft"
- left="10"
- length="1"
- name="failed_panel"
- width="198"
- top_delta="0"
- type="string"
- visible="false">
- <text
- follows="all"
- font="SansSerif"
- halign="center"
- height="18"
- layout="topleft"
- left="1"
- length="1"
- name="failed_lbl"
- right="-1"
- text_color="0.95 0.4 0.4 1"
- top="4"
- translate="false"
- type="string">
- Failed
- </text>
- </panel>
- <loading_indicator
- follows="left|top"
- height="24"
- layout="topleft"
- name="working_indicator"
- left="10"
- top_delta="0"
- visible="false"
- width="24" />
- <text
- follows="left|top"
- font="SansSerifBold"
- height="14"
- layout="topleft"
- left_pad="3"
- length="1"
- halign="left"
- name="working_lbl"
- top_delta="5"
- translate="false"
- type="string"
- visible="false"
- width="162">
- Working
- </text>
- <text
- follows="left|top"
- font="SansSerifBold"
- halign="left"
- height="18"
- layout="topleft"
- left="10"
- length="1"
- name="refresh_lbl"
- text_color="0.95 0.4 0.4 1"
- top_delta="0"
- translate="false"
- type="string"
- visible="false"
- width="130">
- Refresh to save.
- </text>
- <ui_ctrl
- layout="topleft"
- name="thumbnail_placeholder"
- top="23"
- left="215"
- width="400"
- height="400"
- follows="top|left"/>
- <view_border
- bevel_style="in"
- height="21"
- layout="topleft"
- name="img_info_border"
- top_pad="0"
- right="-10"
- follows="left|top|right"
- left_delta="0"/>
- <text
- type="string"
- font="SansSerifSmall"
- length="1"
- follows="left|top|right"
- height="14"
- layout="topleft"
- left="220"
- right="-20"
- halign="left"
- name="image_res_text"
- top_delta="5"
- width="200">
- [WIDTH]px (width) x [HEIGHT]px (height)
- </text>
- <text
- follows="right|top"
- font="SansSerifSmall"
- height="14"
- layout="topleft"
- left="-65"
- length="1"
- halign="right"
- name="file_size_label"
- top_delta="0"
- type="string"
- width="50">
- [SIZE] KB
- </text>
-</floater>
diff --git a/indra/newview/skins/default/xui/en/floater_simple_outfit_snapshot.xml b/indra/newview/skins/default/xui/en/floater_simple_outfit_snapshot.xml
new file mode 100644
index 0000000000..765bc54e46
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_simple_outfit_snapshot.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ positioning="cascading"
+ legacy_header_height="18"
+ can_minimize="true"
+ can_resize="false"
+ can_close="true"
+ height="315"
+ layout="topleft"
+ name="simple_outfit_snapshot"
+ single_instance="true"
+ help_topic="snapshot"
+ save_rect="true"
+ save_visibility="false"
+ title="OUTFIT SNAPSHOT"
+ width="405">
+ <ui_ctrl
+ layout="topleft"
+ name="thumbnail_placeholder"
+ top="18"
+ left="2"
+ width="400"
+ height="400"
+ follows="top|left"/>
+ <button
+ follows="left|bottom"
+ height="22"
+ layout="topleft"
+ left="42"
+ label="Take photo"
+ name="new_snapshot_btn"
+ bottom="-15"
+ width="100" />
+ <button
+ follows="left|bottom"
+ height="22"
+ layout="topleft"
+ left_pad="10"
+ label="Save (L$[UPLOAD_COST])"
+ name="save_btn"
+ width="100" />
+ <button
+ follows="left|bottom"
+ height="22"
+ layout="topleft"
+ left_pad="10"
+ label="Cancel"
+ name="cancel_btn"
+ width="100" />
+</floater>