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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -846,10 +846,7 @@ This should be as low as possible, but too low may break functionality</string>
|
||||
<key>AnnounceSnapshots</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>
|
||||
Announce if someone nearby has taken a snapshot in chat
|
||||
(Won't work on people who hide/quiet snapshots)
|
||||
</string>
|
||||
<string>Announce if someone nearby has taken a snapshot in chat (Won't work on people who hide/quiet snapshots)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
|
||||
@@ -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 ----------------------------------------------------------------------------
|
||||
|
||||
@@ -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<std::pair<std::string,S32> > 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<LLCheckBoxCtrl>("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<LLCheckBoxCtrl>(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<LLUICtrl>("Make Outfit")->setCommitCallback(boost::bind(&LLFloaterCustomize::onBtnMakeOutfit, this));
|
||||
getChild<LLUICtrl>("Ok")->setCommitCallback(boost::bind(&LLFloaterCustomize::onBtnOk, this));
|
||||
getChild<LLUICtrl>("Cancel")->setCommitCallback(boost::bind(&LLFloater::onClickClose, this));
|
||||
|
||||
// reX
|
||||
childSetAction("Import", LLFloaterCustomize::onBtnImport, (void*)this);
|
||||
childSetAction("Export", LLFloaterCustomize::onBtnExport, (void*)this);
|
||||
getChild<LLUICtrl>("Import")->setCommitCallback(boost::bind(&LLFloaterCustomize::onBtnImport, this));
|
||||
getChild<LLUICtrl>("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<S32> wearables_to_include;
|
||||
LLDynamicArray<S32> 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.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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);
|
||||
|
||||
218
indra/newview/llmakeoutfitdialog.cpp
Normal file
218
indra/newview/llmakeoutfitdialog.cpp
Normal file
@@ -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<LLUICtrl>("Save")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onSave, this));
|
||||
getChild<LLUICtrl>("Cancel")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::close, this, _1));
|
||||
getChild<LLUICtrl>("Check All")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onCheckAll, this, true));
|
||||
getChild<LLUICtrl>("Uncheck All")->setCommitCallback(boost::bind(&LLMakeOutfitDialog::onCheckAll, this, false));
|
||||
getChild<LLUICtrl>("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<LLUICtrl>(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());
|
||||
}
|
||||
|
||||
66
indra/newview/llmakeoutfitdialog.h
Normal file
66
indra/newview/llmakeoutfitdialog.h
Normal file
@@ -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<std::pair<std::string,S32> > 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
|
||||
|
||||
@@ -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")
|
||||
{
|
||||
|
||||
@@ -190,6 +190,10 @@
|
||||
<on_click filter="" function="Inventory.DoCreate" userdata="eyes" />
|
||||
</menu_item_call>
|
||||
</menu>
|
||||
<menu_item_call bottom_delta="-18" height="18" label="New Outfit" left="0"
|
||||
mouse_opaque="true" name="New Outfit" width="125">
|
||||
<on_click filter="" function="Inventory.DoCreate" userdata="outfit" />
|
||||
</menu_item_call>
|
||||
</menu>
|
||||
<menu bottom_delta="64" drop_shadow="true" height="49"
|
||||
label="Sort" left="0" mouse_opaque="false" name="Sort" opaque="true"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<floater border="true" bottom="167" can_close="false" can_drag_on_left="false"
|
||||
can_minimize="false" can_resize="false" can_tear_off="true" enabled="true"
|
||||
height="530" left="278" min_height="100" min_width="100"
|
||||
mouse_opaque="true" name="modal container" title="" width="515">
|
||||
mouse_opaque="true" name="modal container" title="Make New Outfit" width="515">
|
||||
<button bottom="5" enabled="true" font="SansSerif" halign="center" height="20"
|
||||
label="Save" label_selected="Save" left="171" mouse_opaque="true"
|
||||
name="Save" scale_image="true" width="82" />
|
||||
@@ -225,12 +225,12 @@
|
||||
height="16" initial_value="false" label="Bottom Right" left="413"
|
||||
mouse_opaque="true" name="checkbox_Bottom Right" radio_style="false"
|
||||
width="100" />
|
||||
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
<!--text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom="-24" drop_shadow_visible="true" enabled="true" follows="left|top"
|
||||
font="SansSerif" h_pad="0" halign="left" height="16" left="13"
|
||||
mouse_opaque="true" name="Make New Outfit" v_pad="0" width="489">
|
||||
Make New Outfit
|
||||
</text>
|
||||
</text-->
|
||||
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||
bottom="-102" drop_shadow_visible="true" enabled="true" follows="left|top"
|
||||
font="SansSerifSmall" h_pad="0" halign="left" height="70" left="13"
|
||||
|
||||
@@ -240,6 +240,10 @@
|
||||
<on_click function="ShowFloater" userdata="appearance" />
|
||||
<on_enable function="Edit.EnableCustomizeAvatar" />
|
||||
</menu_item_call>
|
||||
<menu_item_call bottom="-362" enabled="true" height="19" label="Make Outfit..." left="0"
|
||||
mouse_opaque="true" name="Make Outfit..." width="153">
|
||||
<on_click function="ShowFloater" userdata="outfit" />
|
||||
</menu_item_call>
|
||||
<menu_item_call bottom="-362" enabled="true" height="19" label="Display Name..." left="0"
|
||||
mouse_opaque="true" name="Display Name..." width="153">
|
||||
<on_click function="ShowFloater" userdata="displayname" />
|
||||
|
||||
Reference in New Issue
Block a user