diff options
author | Denis Serdjuk <dserduk@productengine.com> | 2009-10-29 14:09:31 +0200 |
---|---|---|
committer | Denis Serdjuk <dserduk@productengine.com> | 2009-10-29 14:09:31 +0200 |
commit | 97a0108125ee3944ff3cde0f1ba4aeb21db4b2a9 (patch) | |
tree | 60d077f4e1c13963900c980aa3932873cda4533e /indra/newview | |
parent | 10aa210e04bed4a8ab399a28c1aba1ffe7616edf (diff) |
fixed bug EXT-1768 Unable to store landmark attached to notecard into Landmarks
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llviewertexteditor.cpp | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 65994dfb30..5c40f2a540 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -44,6 +44,9 @@ #include "llinventory.h" #include "llinventorybridge.h" #include "llinventorymodel.h" +#include "lllandmark.h" +#include "lllandmarkactions.h" +#include "lllandmarklist.h" #include "llmemorystream.h" #include "llmenugl.h" #include "llnotecard.h" @@ -64,10 +67,47 @@ #include "llviewertexturelist.h" #include "llviewerwindow.h" -#include "llappviewer.h" // for gPacificDaylightTime - static LLDefaultChildRegistry::Register<LLViewerTextEditor> r("text_editor"); +///----------------------------------------------------------------------- +/// Class LLEmbeddedLandmarkCopied +///----------------------------------------------------------------------- +class LLEmbeddedLandmarkCopied: public LLInventoryCallback +{ +public: + + LLEmbeddedLandmarkCopied(){} + void fire(const LLUUID& inv_item) + { + showInfo(inv_item); + } + static void showInfo(const LLUUID& landmark_inv_id) + { + LLSD key; + key["type"] = "landmark"; + key["id"] = landmark_inv_id; + LLSideTray::getInstance()->showPanel("panel_places", key); + } + static void processForeignLandmark(LLLandmark* landmark, + const LLUUID& object_id, const LLUUID& notecard_inventory_id, + LLInventoryItem* item) + { + LLVector3d global_pos; + landmark->getGlobalPos(global_pos); + LLViewerInventoryItem* agent_lanmark = + LLLandmarkActions::findLandmarkForGlobalPos(global_pos); + + if (agent_lanmark) + { + showInfo(agent_lanmark->getUUID()); + } + else + { + LLPointer<LLEmbeddedLandmarkCopied> cb = new LLEmbeddedLandmarkCopied(); + copy_inventory_from_notecard(object_id, notecard_inventory_id, item, gInventoryCallbacks.registerCB(cb)); + } + } +}; ///---------------------------------------------------------------------------- /// Class LLEmbeddedNotecardOpener ///---------------------------------------------------------------------------- @@ -1099,14 +1139,12 @@ void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item, llwchar wc if (!item) return; - LLSD key; - key["type"] = "landmark"; - key["id"] = item->getUUID(); - - LLPanelPlaces *panel = dynamic_cast<LLPanelPlaces*>(LLSideTray::getInstance()->showPanel("panel_places", key)); - if (panel) + LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID(), + boost::bind(&LLEmbeddedLandmarkCopied::processForeignLandmark, _1, mObjectID, mNotecardInventoryID, item)); + if (landmark) { - panel->setItem(item); + LLEmbeddedLandmarkCopied::processForeignLandmark(landmark, mObjectID, + mNotecardInventoryID, item); } } |