From 2c491bc9051b98eae5cfb186263cd43632274931 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 29 Dec 2012 19:24:17 -0500 Subject: [PATCH] Break out LLMakeOutfitDialog. Added "Make Outfit..." to Edit menu and Create->"New Outfit" to inventory floater menu. Cleaned up LLMakeOutfitDialog, using boost::bind and less waste. Moved onMakeOutfitCommit() to LLMakeOutfitDialog as makeOutfit() Also changes LLFloaterCustomize's callbacks to use boost::bind Give new outfit dialog a title instead of a heading. Small fix to mistake with AnnounceSnapshots xmlstuffs. --- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 5 +- indra/newview/ascentprefsvan.cpp | 2 +- indra/newview/llfloatercustomize.cpp | 284 +----------------- indra/newview/llfloatercustomize.h | 10 +- indra/newview/llinventoryactions.cpp | 5 + indra/newview/llmakeoutfitdialog.cpp | 218 ++++++++++++++ indra/newview/llmakeoutfitdialog.h | 66 ++++ indra/newview/llviewermenu.cpp | 7 +- .../default/xui/en-us/floater_inventory.xml | 4 + .../xui/en-us/floater_new_outfit_dialog.xml | 6 +- .../skins/default/xui/en-us/menu_viewer.xml | 4 + 12 files changed, 327 insertions(+), 286 deletions(-) create mode 100644 indra/newview/llmakeoutfitdialog.cpp create mode 100644 indra/newview/llmakeoutfitdialog.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index fafe4e4e8..e4b4cdd30 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -301,6 +301,7 @@ set(viewer_SOURCE_FILES lllogchat.cpp llloginhandler.cpp llmainlooprepeater.cpp + llmakeoutfitdialog.cpp llmanip.cpp llmaniprotate.cpp llmanipscale.cpp @@ -808,6 +809,7 @@ set(viewer_HEADER_FILES lllogchat.h llloginhandler.h llmainlooprepeater.h + llmakeoutfitdialog.h llmanip.h llmaniprotate.h llmanipscale.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4c0f5db9c..e0a106ed3 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -846,10 +846,7 @@ This should be as low as possible, but too low may break functionality AnnounceSnapshots Comment - -Announce if someone nearby has taken a snapshot in chat -(Won't work on people who hide/quiet snapshots) - + Announce if someone nearby has taken a snapshot in chat (Won't work on people who hide/quiet snapshots) Persist 1 Type diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index ac6a2a28e..0fb702115 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -184,7 +184,7 @@ void LLPrefsAscentVan::refreshValues() mDisableChatAnimation = gSavedSettings.getBOOL("SGDisableChatAnimation"); mAddNotReplace = gSavedSettings.getBOOL("LiruAddNotReplace"); mTurnAround = gSavedSettings.getBOOL("TurnAroundWhenWalkingBackwards"); - mAnnounceSnapshots = gSavedSettings.getBOOL("AnnounceStreamMetadata"); + mAnnounceSnapshots = gSavedSettings.getBOOL("AnnounceSnapshots"); mAnnounceStreamMetadata = gSavedSettings.getBOOL("AnnounceStreamMetadata"); //Tags\Colors ---------------------------------------------------------------------------- diff --git a/indra/newview/llfloatercustomize.cpp b/indra/newview/llfloatercustomize.cpp index 890d80829..680df5f05 100644 --- a/indra/newview/llfloatercustomize.cpp +++ b/indra/newview/llfloatercustomize.cpp @@ -32,7 +32,6 @@ #include "llviewerprecompiledheaders.h" -#include "llappearancemgr.h" #include "llimagejpeg.h" #include "llfloatercustomize.h" #include "llfontgl.h" @@ -64,7 +63,6 @@ #include "llviewercamera.h" #include "llappearance.h" #include "imageids.h" -#include "llmodaldialog.h" #include "llassetstorage.h" #include "lltexturectrl.h" #include "lltextureentry.h" @@ -79,9 +77,9 @@ #include "lluictrlfactory.h" #include "llnotificationsutil.h" #include "llpaneleditwearable.h" +#include "llmakeoutfitdialog.h" #include "statemachine/aifilepicker.h" -#include "hippogridmanager.h" using namespace LLVOAvatarDefines; @@ -119,220 +117,6 @@ BOOL edit_wearable_for_teens(LLWearableType::EType type) } } -class LLMakeOutfitDialog : public LLModalDialog -{ -private: - std::string mFolderName; - void (*mCommitCallback)(LLMakeOutfitDialog*,void*); - void* mCallbackUserData; - std::vector > mCheckBoxList; - -public: - LLMakeOutfitDialog( void(*commit_cb)(LLMakeOutfitDialog*,void*), void* userdata ) - : LLModalDialog(LLStringUtil::null,515, 510, TRUE ), - mCommitCallback( commit_cb ), - mCallbackUserData( userdata ) - { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_new_outfit_dialog.xml"); - - // Build list of check boxes - for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) - { - std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel( (LLWearableType::EType)i ); - mCheckBoxList.push_back(std::make_pair(name,i)); - // Hide teen items - if (gAgent.isTeen() && - !edit_wearable_for_teens((LLWearableType::EType)i)) - { - // hide wearable checkboxes that don't apply to this account - std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel( (LLWearableType::EType)i ); - childSetVisible(name, FALSE); - } - } - - // NOTE: .xml needs to be updated if attachments are added or their names are changed! - LLVOAvatar* avatar = gAgentAvatarp; - if( avatar ) - { - for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); - iter != avatar->mAttachmentPoints.end(); ) - { - LLVOAvatar::attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - S32 attachment_pt = curiter->first; - BOOL object_attached = ( attachment->getNumObjects() > 0 ); - std::string name = std::string("checkbox_") + attachment->getName(); - mCheckBoxList.push_back(std::make_pair(name,attachment_pt)); - childSetEnabled(name, object_attached); - } - } - - if(!gHippoGridManager->getConnectedGrid()->supportsInvLinks()) { - childSetEnabled("checkbox_use_links", FALSE); - childSetValue("checkbox_use_links", FALSE); - childSetEnabled("checkbox_use_outfits", FALSE); - childSetValue("checkbox_use_outfits", FALSE); - } - - childSetAction("Save", onSave, this ); - childSetAction("Cancel", onCancel, this ); - childSetAction("Check All", onCheckAll, this ); - childSetAction("Uncheck All", onUncheckAll, this ); - - LLCheckBoxCtrl* pOutfitFoldersCtrl = getChild("checkbox_use_outfits"); - pOutfitFoldersCtrl->setCommitCallback(&LLMakeOutfitDialog::onOutfitFoldersToggle); - pOutfitFoldersCtrl->setCallbackUserData(this); - } - - bool getUseOutfits() - { - return childGetValue("checkbox_use_outfits").asBoolean(); - } - bool getUseLinks() - { - return childGetValue("checkbox_use_links").asBoolean(); - } - /*bool getRenameClothing() - { - return childGetValue("rename").asBoolean(); - }*/ - virtual void draw() - { - BOOL one_or_more_items_selected = FALSE; - for( S32 i = 0; i < (S32)mCheckBoxList.size(); i++ ) - { - if( childGetValue(mCheckBoxList[i].first).asBoolean() ) - { - one_or_more_items_selected = TRUE; - break; - } - } - - childSetEnabled("Save", one_or_more_items_selected ); - - LLModalDialog::draw(); - } - - const std::string& getFolderName() { return mFolderName; } - - void setWearableToInclude( S32 wearable, S32 enabled, S32 selected ) - { - LLWearableType::EType wtType = (LLWearableType::EType)wearable; - if ( ( (0 <= wtType) && (wtType < LLWearableType::WT_COUNT) ) && - ( (LLAssetType::AT_BODYPART != LLWearableType::getAssetType(wtType)) || (!getUseOutfits()) ) ) - { - std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel(wtType); - childSetEnabled(name, enabled); - childSetValue(name, selected); - } - } - - void getIncludedItems( LLInventoryModel::item_array_t& item_list ) - { - LLInventoryModel::cat_array_t *cats; - LLInventoryModel::item_array_t *items; - gInventory.getDirectDescendentsOf(LLAppearanceMgr::instance().getCOF(), cats, items); - for (LLInventoryModel::item_array_t::const_iterator iter = items->begin(); - iter != items->end(); - ++iter) - { - LLViewerInventoryItem* item = (*iter); - if(!item) - continue; - if(item->isWearableType()) - { - LLWearableType::EType type = item->getWearableType(); - if (type < LLWearableType::WT_COUNT && childGetValue(mCheckBoxList[type].first).asBoolean()) - { - item_list.push_back(item); - } - } - else - { - LLViewerJointAttachment* attachment = gAgentAvatarp->getWornAttachmentPoint(item->getLinkedUUID()); - if(attachment && childGetValue(std::string("checkbox_")+attachment->getName()).asBoolean()) - { - item_list.push_back(item); - } - } - } - } - - static void onSave( void* userdata ) - { - LLMakeOutfitDialog* self = (LLMakeOutfitDialog*) userdata; - self->mFolderName = self->childGetValue("name ed").asString(); - LLStringUtil::trim(self->mFolderName); - if( !self->mFolderName.empty() ) - { - if( self->mCommitCallback ) - { - self->mCommitCallback( self, self->mCallbackUserData ); - } - self->close(); // destroys this object - } - } - - static void onCheckAll( void* userdata ) - { - LLMakeOutfitDialog* self = (LLMakeOutfitDialog*) userdata; - for( S32 i = 0; i < (S32)(self->mCheckBoxList.size()); i++) - { - std::string name = self->mCheckBoxList[i].first; - if(self->childIsEnabled(name))self->childSetValue(name,TRUE); - } - } - - static void onUncheckAll( void* userdata ) - { - LLMakeOutfitDialog* self = (LLMakeOutfitDialog*) userdata; - for( S32 i = 0; i < (S32)(self->mCheckBoxList.size()); i++) - { - std::string name = self->mCheckBoxList[i].first; - if(self->childIsEnabled(name))self->childSetValue(name,FALSE); - } - } - - static void onCancel( void* userdata ) - { - LLMakeOutfitDialog* self = (LLMakeOutfitDialog*) userdata; - self->close(); // destroys this object - } - - BOOL postBuild() - { - refresh(); - return TRUE; - } - - void refresh() - { - BOOL fUseOutfits = getUseOutfits(); - - for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++ ) - { - LLWearableType::EType wtType = (LLWearableType::EType)idxType; - if (LLAssetType::AT_BODYPART != LLWearableType::getAssetType(wtType)) - continue; - LLCheckBoxCtrl* pCheckCtrl = getChild(std::string("checkbox_") + LLWearableType::getTypeLabel(wtType)); - if (!pCheckCtrl) - continue; - - pCheckCtrl->setEnabled(!fUseOutfits); - if (fUseOutfits) - pCheckCtrl->setValue(TRUE); - } - childSetEnabled("checkbox_use_links", !fUseOutfits); - } - - static void onOutfitFoldersToggle(LLUICtrl*, void* pParam) - { - LLMakeOutfitDialog* pSelf = (LLMakeOutfitDialog*)pParam; - if (pSelf) - pSelf->refresh(); - } -}; - //////////////////////////////////////////////////////////////////////////// void updateAvatarHeightDisplay() @@ -393,13 +177,13 @@ LLFloaterCustomize::LLFloaterCustomize() BOOL LLFloaterCustomize::postBuild() { - childSetAction("Make Outfit", LLFloaterCustomize::onBtnMakeOutfit, (void*)this); - childSetAction("Ok", LLFloaterCustomize::onBtnOk, (void*)this); - childSetAction("Cancel", LLFloater::onClickClose, (void*)this); + getChild("Make Outfit")->setCommitCallback(boost::bind(&LLFloaterCustomize::onBtnMakeOutfit, this)); + getChild("Ok")->setCommitCallback(boost::bind(&LLFloaterCustomize::onBtnOk, this)); + getChild("Cancel")->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); // reX - childSetAction("Import", LLFloaterCustomize::onBtnImport, (void*)this); - childSetAction("Export", LLFloaterCustomize::onBtnExport, (void*)this); + getChild("Import")->setCommitCallback(boost::bind(&LLFloaterCustomize::onBtnImport, this)); + getChild("Export")->setCommitCallback(boost::bind(&LLFloaterCustomize::onBtnExport, this)); // Wearable panels initWearablePanels(); @@ -459,7 +243,7 @@ void LLFloaterCustomize::setCurrentWearableType( LLWearableType::EType type ) } // reX: new function -void LLFloaterCustomize::onBtnImport( void* userdata ) +void LLFloaterCustomize::onBtnImport() { AIFilePicker* filepicker = AIFilePicker::create(); filepicker->open(FFLOAD_XML); @@ -519,7 +303,7 @@ void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker) } // reX: new function -void LLFloaterCustomize::onBtnExport( void* userdata ) +void LLFloaterCustomize::onBtnExport() { AIFilePicker* filepicker = AIFilePicker::create(); filepicker->open("", FFSAVE_XML); @@ -592,10 +376,8 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker) fclose(fp); } -// static -void LLFloaterCustomize::onBtnOk( void* userdata ) +void LLFloaterCustomize::onBtnOk() { - LLFloaterCustomize* floater = (LLFloaterCustomize*) userdata; gAgentWearables.saveAllWearables(); if ( gAgentAvatarp ) @@ -607,55 +389,13 @@ void LLFloaterCustomize::onBtnOk( void* userdata ) gAgent.sendAgentSetAppearance(); } - gFloaterView->sendChildToBack(floater); + gFloaterView->sendChildToBack(this); handle_reset_view(); // Calls askToSaveIfDirty } -// static -void LLFloaterCustomize::onBtnMakeOutfit( void* userdata ) +void LLFloaterCustomize::onBtnMakeOutfit() { - LLVOAvatar* avatar = gAgentAvatarp; - if(avatar) - { - LLMakeOutfitDialog* dialog = new LLMakeOutfitDialog( onMakeOutfitCommit, NULL ); - // LLMakeOutfitDialog deletes itself. - - for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) - { - BOOL enabled = (gAgentWearables.getWearableCount( (LLWearableType::EType) i )); // TODO: MULTI-WEARABLE - BOOL selected = (enabled && (LLWearableType::WT_SHIRT <= i) && (i < LLWearableType::WT_COUNT)); // only select clothing by default - if (gAgent.isTeen() - && !edit_wearable_for_teens((LLWearableType::EType)i)) - { - dialog->setWearableToInclude( i, FALSE, FALSE ); - } - else - { - dialog->setWearableToInclude( i, enabled, selected ); - } - } - dialog->startModal(); - } -} - -// static -void LLFloaterCustomize::onMakeOutfitCommit( LLMakeOutfitDialog* dialog, void* userdata ) -{ - LLVOAvatar* avatar = gAgentAvatarp; - if(avatar) - { - LLDynamicArray wearables_to_include; - LLDynamicArray attachments_to_include; // attachment points - - LLInventoryModel::item_array_t item_list; - dialog->getIncludedItems(item_list); - - // MULTI-WEARABLES TODO - if(dialog->getUseOutfits()) - LLAppearanceMgr::instance().makeNewOutfitLinks( dialog->getFolderName(), item_list); - else - LLAppearanceMgr::instance().makeNewOutfitLegacy( dialog->getFolderName(), item_list, dialog->getUseLinks()); - } + new LLMakeOutfitDialog(true); // LLMakeOutfitDialog deletes itself. } //////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llfloatercustomize.h b/indra/newview/llfloatercustomize.h index e603209fe..d82d7c267 100644 --- a/indra/newview/llfloatercustomize.h +++ b/indra/newview/llfloatercustomize.h @@ -98,12 +98,12 @@ public: static LLWearableType::EType getCurrentWearableType() { return sCurrentWearableType; } // Callbacks - static void onBtnOk( void* userdata ); - static void onBtnMakeOutfit( void* userdata ); - static void onMakeOutfitCommit( LLMakeOutfitDialog* dialog, void* userdata ); - static void onBtnImport( void* userdata ); + void onBtnOk(); + void onBtnMakeOutfit(); + void onMakeOutfitCommit(); + void onBtnImport(); static void onBtnImport_continued(AIFilePicker* filepicker); - static void onBtnExport( void* userdata ); + void onBtnExport(); static void onBtnExport_continued(AIFilePicker* filepicker); static void onTabChanged( const LLSD& param ); diff --git a/indra/newview/llinventoryactions.cpp b/indra/newview/llinventoryactions.cpp index 372b9bf83..074c4132a 100644 --- a/indra/newview/llinventoryactions.cpp +++ b/indra/newview/llinventoryactions.cpp @@ -67,6 +67,7 @@ #include "llinventoryclipboard.h" #include "llinventorymodelbackgroundfetch.h" #include "lllineeditor.h" +#include "llmakeoutfitdialog.h" #include "llmenugl.h" #include "llpreviewanim.h" #include "llpreviewgesture.h" @@ -382,6 +383,10 @@ void do_create(LLInventoryModel *model, LLInventoryPanel *ptr, std::string type, LLInventoryType::IT_GESTURE, PERM_ALL); } + else if ("outfit" == type) + { + new LLMakeOutfitDialog(false); + } else { LLWearableType::EType wear_type = LLWearableType::typeNameToType(type); diff --git a/indra/newview/llmakeoutfitdialog.cpp b/indra/newview/llmakeoutfitdialog.cpp new file mode 100644 index 000000000..b84e668b6 --- /dev/null +++ b/indra/newview/llmakeoutfitdialog.cpp @@ -0,0 +1,218 @@ +/** + * @file llmakeoutfitdialog.cpp + * @brief The Make Outfit Dialog, triggered by "Make Outfit" and similar UICtrls. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llmakeoutfitdialog.h" + +#include "llagent.h" +#include "llappearancemgr.h" +#include "lluictrlfactory.h" +#include "llvoavatarself.h" + +#include "hippogridmanager.h" + +LLMakeOutfitDialog::LLMakeOutfitDialog(bool modal) : LLModalDialog(LLStringUtil::null, 515, 510, modal) +{ + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_new_outfit_dialog.xml"); + + setCanClose(!modal); + setCanMinimize(!modal); + + // Build list of check boxes + for (S32 i = 0; i < LLWearableType::WT_COUNT; i++) + { + std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel((LLWearableType::EType)i); + mCheckBoxList.push_back(std::make_pair(name, i)); + // Hide undergarments from teens + if (gAgent.isTeen() && ((LLWearableType::WT_UNDERSHIRT == (LLWearableType::EType)i) || (LLWearableType::WT_UNDERPANTS == (LLWearableType::EType)i))) + { + childSetVisible(name, false); // Lest they know what's beyond their reach. + } + else + { + bool enabled = gAgentWearables.getWearableCount((LLWearableType::EType)i); // TODO: MULTI-WEARABLE + bool selected = enabled && (LLWearableType::WT_SHIRT <= i); // only select clothing by default + childSetEnabled(name, enabled); + childSetValue(name, selected); + } + } + + // NOTE: .xml needs to be updated if attachments are added or their names are changed! + LLVOAvatar* avatar = gAgentAvatarp; + if (avatar) + { + for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); iter != avatar->mAttachmentPoints.end();) + { + LLVOAvatar::attachment_map_t::iterator curiter = iter++; + LLViewerJointAttachment* attachment = curiter->second; + S32 attachment_pt = curiter->first; + bool object_attached = (attachment->getNumObjects() > 0); + std::string name = std::string("checkbox_") + attachment->getName(); + mCheckBoxList.push_back(std::make_pair(name, attachment_pt)); + childSetEnabled(name, object_attached); + } + } + + if (!gHippoGridManager->getConnectedGrid()->supportsInvLinks()) + { + childSetEnabled("checkbox_use_links", false); + childSetValue("checkbox_use_links", false); + childSetEnabled("checkbox_use_outfits", false); + childSetValue("checkbox_use_outfits", false); + } + + getChild("Save")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onSave, this)); + getChild("Cancel")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::close, this, _1)); + getChild("Check All")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onCheckAll, this, true)); + getChild("Uncheck All")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onCheckAll, this, false)); + getChild("checkbox_use_outfits")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::refresh, this)); + startModal(); +} + +//virtual +void LLMakeOutfitDialog::draw() +{ + bool one_or_more_items_selected = false; + for (S32 i = 0; i < (S32)mCheckBoxList.size(); i++) + { + if (childGetValue(mCheckBoxList[i].first).asBoolean()) + { + one_or_more_items_selected = true; + break; + } + } + childSetEnabled("Save", one_or_more_items_selected); + + LLModalDialog::draw(); +} + +BOOL LLMakeOutfitDialog::postBuild() +{ + refresh(); + return true; +} + +void LLMakeOutfitDialog::refresh() +{ + bool fUseOutfits = getUseOutfits(); + + for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++) + { + LLWearableType::EType wtType = (LLWearableType::EType)idxType; + if (LLAssetType::AT_BODYPART != LLWearableType::getAssetType(wtType)) + continue; + LLUICtrl* pCheckCtrl = getChild(std::string("checkbox_") + LLWearableType::getTypeLabel(wtType)); + if (!pCheckCtrl) + continue; + + pCheckCtrl->setEnabled(!fUseOutfits); + if (fUseOutfits) + pCheckCtrl->setValue(true); + } + childSetEnabled("checkbox_use_links", !fUseOutfits); +} + + +void LLMakeOutfitDialog::setWearableToInclude(S32 wearable, bool enabled, bool selected) +{ + LLWearableType::EType wtType = (LLWearableType::EType)wearable; + if (((0 <= wtType) && (wtType < LLWearableType::WT_COUNT)) && + ((LLAssetType::AT_BODYPART != LLWearableType::getAssetType(wtType)) || !getUseOutfits())) + { + std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel(wtType); + childSetEnabled(name, enabled); + childSetValue(name, selected); + } +} + +void LLMakeOutfitDialog::getIncludedItems(LLInventoryModel::item_array_t& item_list) +{ + LLInventoryModel::cat_array_t *cats; + LLInventoryModel::item_array_t *items; + gInventory.getDirectDescendentsOf(LLAppearanceMgr::instance().getCOF(), cats, items); + for (LLInventoryModel::item_array_t::const_iterator iter = items->begin(); iter != items->end(); ++iter) + { + LLViewerInventoryItem* item = (*iter); + if (!item) + continue; + if (item->isWearableType()) + { + LLWearableType::EType type = item->getWearableType(); + if (type < LLWearableType::WT_COUNT && childGetValue(mCheckBoxList[type].first).asBoolean()) + { + item_list.push_back(item); + } + } + else + { + LLViewerJointAttachment* attachment = gAgentAvatarp->getWornAttachmentPoint(item->getLinkedUUID()); + if (attachment && childGetValue(std::string("checkbox_")+attachment->getName()).asBoolean()) + { + item_list.push_back(item); + } + } + } +} + +void LLMakeOutfitDialog::onSave() +{ + std::string folder_name = childGetValue("name ed").asString(); + LLStringUtil::trim(folder_name); + if (!folder_name.empty()) + { + makeOutfit(folder_name); + close(); // destroys this object + } +} + +void LLMakeOutfitDialog::onCheckAll(bool check) +{ + for (S32 i = 0; i < (S32)(mCheckBoxList.size()); i++) + { + std::string name = mCheckBoxList[i].first; + if (childIsEnabled(name)) childSetValue(name, check); + } +} + +void LLMakeOutfitDialog::makeOutfit(const std::string folder_name) +{ + LLInventoryModel::item_array_t item_list; + getIncludedItems(item_list); + + // MULTI-WEARABLES TODO + if (getUseOutfits()) + LLAppearanceMgr::instance().makeNewOutfitLinks(folder_name, item_list); + else + LLAppearanceMgr::instance().makeNewOutfitLegacy(folder_name, item_list, getUseLinks()); +} + diff --git a/indra/newview/llmakeoutfitdialog.h b/indra/newview/llmakeoutfitdialog.h new file mode 100644 index 000000000..caed1ceef --- /dev/null +++ b/indra/newview/llmakeoutfitdialog.h @@ -0,0 +1,66 @@ +/** + * @file llmakeoutfitdialog.h + * @brief The Make Outfit Dialog, triggered by "Make Outfit" and similar UICtrls. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LLMAKEOUTFITDIALOG_H +#define LLMAKEOUTFITDIALOG_H + + +#include "llinventorymodel.h" +#include "llmodaldialog.h" + +class LLMakeOutfitDialog : public LLModalDialog +{ +private: + std::vector > mCheckBoxList; + +public: + LLMakeOutfitDialog(bool modal = true); + /*virtual*/ void draw(); + BOOL postBuild(); + void refresh(); + + void setWearableToInclude(S32 wearable, bool enabled, bool selected); //TODO: Call this when Wearables are added or removed to update the Dialog in !modal mode. + void onSave(); + void onCheckAll(bool check); + + //Accessors + void getIncludedItems(LLInventoryModel::item_array_t& item_list); + bool getUseOutfits() { return childGetValue("checkbox_use_outfits").asBoolean(); } + bool getUseLinks() { return childGetValue("checkbox_use_links").asBoolean(); } + //bool getRenameClothing() { return childGetValue("rename").asBoolean(); } + +protected: + void makeOutfit(const std::string folder_name); +}; + +#endif //LLMAKEOUTFITDIALOG_H + diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d4fc9c02c..c8fa64f01 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -178,7 +178,7 @@ #include "llinventorypanel.h" #include "llinventorybridge.h" #include "llkeyboard.h" -#include "llpanellogin.h" +#include "llmakeoutfitdialog.h" #include "llmenucommands.h" #include "llmenugl.h" #include "llmimetypes.h" @@ -187,6 +187,7 @@ #include "llmoveview.h" #include "llmutelist.h" #include "llnotify.h" +#include "llpanellogin.h" #include "llpanelobject.h" #include "llparcel.h" @@ -6524,6 +6525,10 @@ class LLShowFloater : public view_listener_t gAgentCamera.changeCameraToCustomizeAvatar(); } } + else if (floater_name == "outfit") + { + new LLMakeOutfitDialog(false); + } // Phoenix: Wolfspirit: Enabled Show Floater out of viewer menu else if (floater_name == "displayname") { diff --git a/indra/newview/skins/default/xui/en-us/floater_inventory.xml b/indra/newview/skins/default/xui/en-us/floater_inventory.xml index aa860ce0b..28da7d9a7 100644 --- a/indra/newview/skins/default/xui/en-us/floater_inventory.xml +++ b/indra/newview/skins/default/xui/en-us/floater_inventory.xml @@ -190,6 +190,10 @@ + + + + mouse_opaque="true" name="modal container" title="Make New Outfit" width="515">