summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r--indra/newview/llviewermenu.cpp239
1 files changed, 119 insertions, 120 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index d79cb85730..64967466fb 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -73,6 +73,8 @@
#include "llhudmanager.h"
#include "llimview.h"
#include "llinventorybridge.h"
+#include "llinventorydefines.h"
+#include "llinventoryfunctions.h"
#include "llpanellogin.h"
#include "llpanelblockedlist.h"
#include "llmenucommands.h"
@@ -135,6 +137,7 @@ extern BOOL gDebugWindowProc;
LLMenuBarGL *gMenuBarView = NULL;
LLViewerMenuHolderGL *gMenuHolder = NULL;
LLMenuGL *gPopupMenuView = NULL;
+LLMenuGL *gEditMenu = NULL;
LLMenuBarGL *gLoginMenuBarView = NULL;
// Pie menus
@@ -382,8 +385,10 @@ void init_menus()
///
/// Context menus
///
+
const widget_registry_t& registry =
LLViewerMenuHolderGL::child_registry_t::instance();
+ gEditMenu = LLUICtrlFactory::createFromFile<LLMenuGL>("menu_edit.xml", gMenuHolder, registry);
gMenuAvatarSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
"menu_avatar_self.xml", gMenuHolder, registry);
gMenuAvatarOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
@@ -1801,9 +1806,10 @@ class LLAdvancedDebugAvatarTextures : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
-#ifndef LL_RELEASE_FOR_DOWNLOAD
- handle_debug_avatar_textures(NULL);
-#endif
+ if (gAgent.isGodlike())
+ {
+ handle_debug_avatar_textures(NULL);
+ }
return true;
}
};
@@ -2692,11 +2698,10 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t
bool handleEvent(const LLSD& userdata)
{
bool new_value = false;
- if (gAgent.getAvatarObject())
+ if (isAgentAvatarValid())
{
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
- iter != avatarp->mAttachmentPoints.end(); )
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
@@ -2824,9 +2829,9 @@ bool handle_go_to()
LLViewerParcelMgr::getInstance()->deselectLand();
- if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
+ if (isAgentAvatarValid() && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
{
- gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgent.getAvatarObject()->getID());
+ gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgentAvatarp->getID());
}
else
{
@@ -3365,7 +3370,7 @@ class LLSelfStandUp : public view_listener_t
bool enable_standup_self()
{
- bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting();
+ bool new_value = isAgentAvatarValid() && gAgentAvatarp->isSitting();
return new_value;
}
@@ -3694,9 +3699,9 @@ class LLLandSit : public view_listener_t
LLVector3d posGlobal = LLToolPie::getInstance()->getPick().mPosGlobal;
LLQuaternion target_rot;
- if (gAgent.getAvatarObject())
+ if (isAgentAvatarValid())
{
- target_rot = gAgent.getAvatarObject()->getRotation();
+ target_rot = gAgentAvatarp->getRotation();
}
else
{
@@ -3859,15 +3864,15 @@ BOOL enable_deed_object_to_group(void*)
* No longer able to support viewer side manipulations in this way
*
void god_force_inv_owner_permissive(LLViewerObject* object,
- InventoryObjectList* inventory,
+ LLInventoryObject::object_list_t* inventory,
S32 serial_num,
void*)
{
typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
item_array_t items;
- InventoryObjectList::const_iterator inv_it = inventory->begin();
- InventoryObjectList::const_iterator inv_end = inventory->end();
+ LLInventoryObject::object_list_t::const_iterator inv_it = inventory->begin();
+ LLInventoryObject::object_list_t::const_iterator inv_end = inventory->end();
for ( ; inv_it != inv_end; ++inv_it)
{
if(((*inv_it)->getType() != LLAssetType::AT_CATEGORY))
@@ -4587,13 +4592,9 @@ BOOL sitting_on_selection()
}
// Need to determine if avatar is sitting on this object
- LLVOAvatar* avatar = gAgent.getAvatarObject();
- if (!avatar)
- {
- return FALSE;
- }
+ if (!isAgentAvatarValid()) return FALSE;
- return (avatar->isSitting() && avatar->getRoot() == root_object);
+ return (gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == root_object);
}
class LLToolsSaveToInventory : public view_listener_t
@@ -5186,10 +5187,6 @@ void toggle_debug_menus(void*)
{
BOOL visible = ! gSavedSettings.getBOOL("UseDebugMenus");
gSavedSettings.setBOOL("UseDebugMenus", visible);
- if(visible)
- {
- //LLFirstUse::useDebugMenus();
- }
show_debug_menus();
}
@@ -5334,6 +5331,16 @@ class LLWorldCreateLandmark : public view_listener_t
}
};
+class LLWorldPlaceProfile : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "agent"));
+
+ return true;
+ }
+};
+
void handle_look_at_selection(const LLSD& param)
{
const F32 PADDING_FACTOR = 1.75f;
@@ -5846,7 +5853,7 @@ private:
S32 index = userdata.asInteger();
LLViewerJointAttachment* attachment_point = NULL;
if (index > 0)
- attachment_point = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL);
+ attachment_point = get_if_there(gAgentAvatarp->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL);
confirm_replace_attachment(0, attachment_point);
}
return true;
@@ -5867,8 +5874,8 @@ void near_attach_object(BOOL success, void *user_data)
U8 attachment_id = 0;
if (attachment)
{
- for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin();
- iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter)
+ for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
{
if (iter->second == attachment)
{
@@ -5993,7 +6000,7 @@ class LLAttachmentDetachFromPoint : public view_listener_t
{
bool handleEvent(const LLSD& user_data)
{
- const LLViewerJointAttachment *attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL);
+ const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL);
if (attachment->getNumObjects() > 0)
{
gMessageSystem->newMessage("ObjectDetach");
@@ -6021,7 +6028,7 @@ static bool onEnableAttachmentLabel(LLUICtrl* ctrl, const LLSD& data)
LLMenuItemGL* menu = dynamic_cast<LLMenuItemGL*>(ctrl);
if (menu)
{
- const LLViewerJointAttachment *attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL);
+ const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL);
if (attachment)
{
label = data["label"].asString();
@@ -6139,7 +6146,7 @@ class LLAttachmentEnableDrop : public view_listener_t
if (object && LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES ))
{
S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getState());
- attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
+ attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
if (attachment)
{
@@ -6157,11 +6164,11 @@ class LLAttachmentEnableDrop : public view_listener_t
// if a fetch is already out there (being sent from a slow sim)
// we refetch and there are 2 fetches
LLWornItemFetchedObserver* wornItemFetched = new LLWornItemFetchedObserver();
- LLInventoryFetchObserver::item_ref_t items; //add item to the inventory item to be fetched
+ uuid_vec_t items; //add item to the inventory item to be fetched
items.push_back((*attachment_iter)->getItemID());
- wornItemFetched->fetchItems(items);
+ wornItemFetched->fetch(items);
gInventory.addObserver(wornItemFetched);
}
}
@@ -6271,8 +6278,8 @@ class LLAttachmentPointFilled : public view_listener_t
bool handleEvent(const LLSD& user_data)
{
bool enable = false;
- LLVOAvatar::attachment_map_t::iterator found_it = gAgent.getAvatarObject()->mAttachmentPoints.find(user_data.asInteger());
- if (found_it != gAgent.getAvatarObject()->mAttachmentPoints.end())
+ LLVOAvatar::attachment_map_t::iterator found_it = gAgentAvatarp->mAttachmentPoints.find(user_data.asInteger());
+ if (found_it != gAgentAvatarp->mAttachmentPoints.end())
{
enable = found_it->second->getNumObjects() > 0;
}
@@ -6468,13 +6475,13 @@ void handle_selected_texture_info(void*)
void handle_test_male(void*)
{
- LLAppearanceManager::instance().wearOutfitByName("Male Shape & Outfit");
+ LLAppearanceMgr::instance().wearOutfitByName("Male Shape & Outfit");
//gGestureList.requestResetFromServer( TRUE );
}
void handle_test_female(void*)
{
- LLAppearanceManager::instance().wearOutfitByName("Female Shape & Outfit");
+ LLAppearanceMgr::instance().wearOutfitByName("Female Shape & Outfit");
//gGestureList.requestResetFromServer( FALSE );
}
@@ -6489,15 +6496,10 @@ void handle_toggle_pg(void*)
void handle_dump_attachments(void*)
{
- LLVOAvatar* avatar = gAgent.getAvatarObject();
- if( !avatar )
- {
- llinfos << "NO AVATAR" << llendl;
- return;
- }
+ if(!isAgentAvatarValid()) return;
- for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin();
- iter != avatar->mAttachmentPoints.end(); )
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
@@ -6917,7 +6919,7 @@ void reload_vertex_shader(void *)
void handle_dump_avatar_local_textures(void*)
{
- gAgent.getAvatarObject()->dumpLocalTextures();
+ gAgentAvatarp->dumpLocalTextures();
}
void handle_dump_timers()
@@ -6937,86 +6939,83 @@ void handle_debug_avatar_textures(void*)
void handle_grab_texture(void* data)
{
ETextureIndex tex_index = (ETextureIndex)((intptr_t)data);
- const LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (avatarp)
- {
- // MULTI-WEARABLE: change to support an index
- const LLUUID& asset_id = avatarp->grabLocalTexture(tex_index, 0);
- LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl;
- LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
- LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
- const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type));
- if(folder_id.notNull())
- {
- std::string name = "Unknown";
- const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(tex_index);
- if (texture_dict->mIsBakedTexture)
- {
- EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
- name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mNameCapitalized;
- }
- name += " Texture";
-
- LLUUID item_id;
- item_id.generate();
- LLPermissions perm;
- perm.init(gAgentID,
- gAgentID,
- LLUUID::null,
- LLUUID::null);
- U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER;
- perm.initMasks(PERM_ALL,
- PERM_ALL,
- PERM_NONE,
- PERM_NONE,
- next_owner_perm);
- time_t creation_date_now = time_corrected();
- LLPointer<LLViewerInventoryItem> item
- = new LLViewerInventoryItem(item_id,
- folder_id,
- perm,
- asset_id,
- asset_type,
- inv_type,
- name,
- LLStringUtil::null,
- LLSaleInfo::DEFAULT,
- LLInventoryItem::II_FLAGS_NONE,
- creation_date_now);
-
- item->updateServer(TRUE);
- gInventory.updateItem(item);
- gInventory.notifyObservers();
-
- // Show the preview panel for textures to let
- // user know that the image is now in inventory.
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
- if(active_panel)
- {
- LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
-
- active_panel->setSelection(item_id, TAKE_FOCUS_NO);
- active_panel->openSelected();
- //LLFloaterInventory::dumpSelectionInformation((void*)view);
- // restore keyboard focus
- gFocusMgr.setKeyboardFocus(focus_ctrl);
- }
- }
- else
- {
- llwarns << "Can't find a folder to put it in" << llendl;
+ if (!isAgentAvatarValid()) return;
+
+ // MULTI-WEARABLE: change to support an index
+ const LLUUID& asset_id = gAgentAvatarp->grabLocalTexture(tex_index, 0);
+ LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl;
+ LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
+ LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
+ const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type));
+ if(folder_id.notNull())
+ {
+ std::string name = "Unknown";
+ const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(tex_index);
+ if (texture_dict->mIsBakedTexture)
+ {
+ EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+ name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mNameCapitalized;
+ }
+ name += " Texture";
+
+ LLUUID item_id;
+ item_id.generate();
+ LLPermissions perm;
+ perm.init(gAgentID,
+ gAgentID,
+ LLUUID::null,
+ LLUUID::null);
+ U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER;
+ perm.initMasks(PERM_ALL,
+ PERM_ALL,
+ PERM_NONE,
+ PERM_NONE,
+ next_owner_perm);
+ time_t creation_date_now = time_corrected();
+ LLPointer<LLViewerInventoryItem> item
+ = new LLViewerInventoryItem(item_id,
+ folder_id,
+ perm,
+ asset_id,
+ asset_type,
+ inv_type,
+ name,
+ LLStringUtil::null,
+ LLSaleInfo::DEFAULT,
+ LLInventoryItemFlags::II_FLAGS_NONE,
+ creation_date_now);
+
+ item->updateServer(TRUE);
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+
+ // Show the preview panel for textures to let
+ // user know that the image is now in inventory.
+ LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
+ if(active_panel)
+ {
+ LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
+
+ active_panel->setSelection(item_id, TAKE_FOCUS_NO);
+ active_panel->openSelected();
+ //LLFloaterInventory::dumpSelectionInformation((void*)view);
+ // restore keyboard focus
+ gFocusMgr.setKeyboardFocus(focus_ctrl);
}
}
+ else
+ {
+ llwarns << "Can't find a folder to put it in" << llendl;
+ }
}
BOOL enable_grab_texture(void* data)
{
ETextureIndex index = (ETextureIndex)((intptr_t)data);
- const LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (avatarp)
+ if (isAgentAvatarValid())
{
// MULTI-WEARABLE:
- return avatarp->canGrabLocalTexture(index,0);
+ return gAgentAvatarp->canGrabLocalTexture(index,0);
}
return FALSE;
}
@@ -7227,12 +7226,11 @@ void handle_buy_currency_test(void*)
void handle_rebake_textures(void*)
{
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if (!avatarp) return;
+ if (!isAgentAvatarValid()) return;
// Slam pending upload count to "unstick" things
bool slam_for_debug = true;
- avatarp->forceBakeAllTextures(slam_for_debug);
+ gAgentAvatarp->forceBakeAllTextures(slam_for_debug);
}
void toggle_visibility(void* user_data)
@@ -7752,6 +7750,7 @@ void initialize_menus()
commit.add("World.Chat", boost::bind(&handle_chat, (void*)NULL));
view_listener_t::addMenu(new LLWorldAlwaysRun(), "World.AlwaysRun");
view_listener_t::addMenu(new LLWorldCreateLandmark(), "World.CreateLandmark");
+ view_listener_t::addMenu(new LLWorldPlaceProfile(), "World.PlaceProfile");
view_listener_t::addMenu(new LLWorldSetHomeLocation(), "World.SetHomeLocation");
view_listener_t::addMenu(new LLWorldTeleportHome(), "World.TeleportHome");
view_listener_t::addMenu(new LLWorldSetAway(), "World.SetAway");