aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/llui/llbutton.cpp18
-rw-r--r--linden/indra/llui/llbutton.h6
-rw-r--r--linden/indra/llui/lltabcontainer.h10
-rw-r--r--linden/indra/llui/lltexteditor.cpp28
-rw-r--r--linden/indra/newview/aoremotectrl.cpp13
-rw-r--r--linden/indra/newview/app_settings/default_grids.xml37
-rw-r--r--linden/indra/newview/app_settings/logcontrol.xml2
-rw-r--r--linden/indra/newview/app_settings/settings.xml15
-rw-r--r--linden/indra/newview/floaterao.cpp846
-rw-r--r--linden/indra/newview/floaterao.h73
-rw-r--r--linden/indra/newview/hippolimits.cpp5
-rw-r--r--linden/indra/newview/hippolimits.h2
-rw-r--r--linden/indra/newview/llglsandbox.cpp10
-rw-r--r--linden/indra/newview/llinventorymodel.cpp369
-rw-r--r--linden/indra/newview/llinventorymodel.h5
-rw-r--r--linden/indra/newview/llinventoryview.cpp24
-rw-r--r--linden/indra/newview/llinventoryview.h2
-rw-r--r--linden/indra/newview/llmaniprotate.cpp6
-rw-r--r--linden/indra/newview/llmanipscale.cpp4
-rw-r--r--linden/indra/newview/llmaniptranslate.cpp4
-rw-r--r--linden/indra/newview/llpanelavatar.cpp61
-rw-r--r--linden/indra/newview/llpanelgroupgeneral.cpp44
-rw-r--r--linden/indra/newview/llpanelgroupgeneral.h2
-rw-r--r--linden/indra/newview/llprefsadvanced.cpp11
-rw-r--r--linden/indra/newview/llprefsadvanced.h1
-rw-r--r--linden/indra/newview/llselectmgr.cpp8
-rw-r--r--linden/indra/newview/llstartup.cpp58
-rw-r--r--linden/indra/newview/lltoolplacer.cpp4
-rw-r--r--linden/indra/newview/llurldispatcher.cpp42
-rw-r--r--linden/indra/newview/llurldispatcher.h2
-rw-r--r--linden/indra/newview/llviewercamera.cpp4
-rw-r--r--linden/indra/newview/llviewermenu.cpp10
-rwxr-xr-xlinden/indra/newview/llviewermessage.cpp2
-rw-r--r--linden/indra/newview/llviewerobjectlist.cpp4
-rw-r--r--linden/indra/newview/primbackup.cpp1269
-rw-r--r--linden/indra/newview/primbackup.h223
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml2
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/notifications.xml22
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml9
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_avatar.xml3
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml10
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_login.xml58
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml9
43 files changed, 2078 insertions, 1259 deletions
diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp
index 702e34e..58c1dbc 100644
--- a/linden/indra/llui/llbutton.cpp
+++ b/linden/indra/llui/llbutton.cpp
@@ -115,7 +115,9 @@ LLButton::LLButton(const std::string& name, const LLRect& rect,
115 void *callback_data, 115 void *callback_data,
116 const LLFontGL *font, 116 const LLFontGL *font,
117 const std::string& unselected_label, 117 const std::string& unselected_label,
118 const std::string& selected_label ) 118 const std::string& selected_label,
119 const std::string& disabled_label,
120 const std::string& disabled_selected_label)
119: LLUICtrl(name, rect, TRUE, NULL, NULL), 121: LLUICtrl(name, rect, TRUE, NULL, NULL),
120 mClickedCallback( click_callback ), 122 mClickedCallback( click_callback ),
121 mMouseDownCallback( NULL ), 123 mMouseDownCallback( NULL ),
@@ -148,6 +150,8 @@ LLButton::LLButton(const std::string& name, const LLRect& rect,
148{ 150{
149 mUnselectedLabel = unselected_label; 151 mUnselectedLabel = unselected_label;
150 mSelectedLabel = selected_label; 152 mSelectedLabel = selected_label;
153 mDisabledLabel = disabled_label;
154 mDisabledSelectedLabel = disabled_selected_label;
151 155
152 // by default, disabled color is same as enabled 156 // by default, disabled color is same as enabled
153 mImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" ); 157 mImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" );
@@ -989,6 +993,8 @@ LLXMLNodePtr LLButton::getXML(bool save_children) const
989 993
990 node->createChild("label", TRUE)->setStringValue(getLabelUnselected()); 994 node->createChild("label", TRUE)->setStringValue(getLabelUnselected());
991 node->createChild("label_selected", TRUE)->setStringValue(getLabelSelected()); 995 node->createChild("label_selected", TRUE)->setStringValue(getLabelSelected());
996 node->createChild("label_disabled", TRUE)->setStringValue(getLabelDisabled());
997 node->createChild("label_selected_disabled", TRUE)->setStringValue(getLabelDisabledSelected());
992 node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont)); 998 node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont));
993 node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); 999 node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign));
994 1000
@@ -1029,6 +1035,12 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
1029 std::string label_selected = label; 1035 std::string label_selected = label;
1030 node->getAttributeString("label_selected", label_selected); 1036 node->getAttributeString("label_selected", label_selected);
1031 1037
1038 std::string label_disabled = label;
1039 node->getAttributeString("label_disabled", label_disabled);
1040
1041 std::string label_disabled_selected = label_selected;
1042 node->getAttributeString("label_disabled_selected", label_disabled_selected);
1043
1032 LLFontGL* font = selectFont(node); 1044 LLFontGL* font = selectFont(node);
1033 1045
1034 std::string image_unselected; 1046 std::string image_unselected;
@@ -1070,7 +1082,9 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
1070 parent, 1082 parent,
1071 font, 1083 font,
1072 label, 1084 label,
1073 label_selected); 1085 label_selected,
1086 label_disabled,
1087 label_disabled_selected);
1074 1088
1075 node->getAttributeS32("pad_right", button->mRightHPad); 1089 node->getAttributeS32("pad_right", button->mRightHPad);
1076 node->getAttributeS32("pad_left", button->mLeftHPad); 1090 node->getAttributeS32("pad_left", button->mLeftHPad);
diff --git a/linden/indra/llui/llbutton.h b/linden/indra/llui/llbutton.h
index 2174d95..73ac446 100644
--- a/linden/indra/llui/llbutton.h
+++ b/linden/indra/llui/llbutton.h
@@ -84,7 +84,9 @@ public:
84 void *callback_data = NULL, 84 void *callback_data = NULL,
85 const LLFontGL* mGLFont = NULL, 85 const LLFontGL* mGLFont = NULL,
86 const std::string& unselected_label = LLStringUtil::null, 86 const std::string& unselected_label = LLStringUtil::null,
87 const std::string& selected_label = LLStringUtil::null ); 87 const std::string& selected_label = LLStringUtil::null,
88 const std::string& disabled_label = LLStringUtil::null,
89 const std::string& disabled_selected_label = LLStringUtil::null);
88 90
89 virtual ~LLButton(); 91 virtual ~LLButton();
90 void init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const std::string& control_name); 92 void init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const std::string& control_name);
@@ -133,6 +135,8 @@ public:
133 135
134 const std::string getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); } 136 const std::string getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); }
135 const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); } 137 const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); }
138 const std::string getLabelDisabled() const { return wstring_to_utf8str(mDisabledLabel); }
139 const std::string getLabelDisabledSelected() const { return wstring_to_utf8str(mDisabledSelectedLabel); }
136 140
137 void setImageColor(const std::string& color_control); 141 void setImageColor(const std::string& color_control);
138 void setImageColor(const LLColor4& c); 142 void setImageColor(const LLColor4& c);
diff --git a/linden/indra/llui/lltabcontainer.h b/linden/indra/llui/lltabcontainer.h
index 8117cde..989b12c 100644
--- a/linden/indra/llui/lltabcontainer.h
+++ b/linden/indra/llui/lltabcontainer.h
@@ -145,7 +145,6 @@ public:
145 145
146 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 146 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
147 147
148private:
149 // Structure used to map tab buttons to and from tab panels 148 // Structure used to map tab buttons to and from tab panels
150 struct LLTabTuple 149 struct LLTabTuple
151 { 150 {
@@ -176,11 +175,12 @@ private:
176 LLTextBox* mPlaceholderText; 175 LLTextBox* mPlaceholderText;
177 S32 mPadding; 176 S32 mPadding;
178 }; 177 };
179
180 void initButtons();
181 178
182 LLTabTuple* getTab(S32 index) { return mTabList[index]; } 179 LLTabTuple* getTab(S32 index) { return mTabList[index]; }
183 LLTabTuple* getTabByPanel(LLPanel* child); 180 LLTabTuple* getTabByPanel(LLPanel* child);
181
182 LLTextBox* getTitle() { return mTitleBox; }
183
184 void insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point); 184 void insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point);
185 185
186 S32 getScrollPos() const { return mScrollPos; } 186 S32 getScrollPos() const { return mScrollPos; }
@@ -195,6 +195,10 @@ private:
195 195
196 void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; } 196 void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; }
197 197
198private:
199
200 void initButtons();
201
198 void scrollPrev() { mScrollPos = llmax(0, mScrollPos-1); } // No wrap 202 void scrollPrev() { mScrollPos = llmax(0, mScrollPos-1); } // No wrap
199 void scrollNext() { mScrollPos = llmin(mScrollPos+1, mMaxScrollPos); } // No wrap 203 void scrollNext() { mScrollPos = llmin(mScrollPos+1, mMaxScrollPos); } // No wrap
200 204
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp
index de05872..c8ca5bf 100644
--- a/linden/indra/llui/lltexteditor.cpp
+++ b/linden/indra/llui/lltexteditor.cpp
@@ -5119,7 +5119,7 @@ S32 LLTextEditor::findHTMLToken(const std::string &line, S32 pos, BOOL reverse)
5119BOOL LLTextEditor::findHTML(const std::string &line, S32 *begin, S32 *end, std::string& url) const 5119BOOL LLTextEditor::findHTML(const std::string &line, S32 *begin, S32 *end, std::string& url) const
5120{ 5120{
5121 5121
5122 S32 m1,m2,m3; 5122 S32 m1,m2,m3,m4;
5123 BOOL matched = FALSE; 5123 BOOL matched = FALSE;
5124 5124
5125 m1=line.find("://",*end); 5125 m1=line.find("://",*end);
@@ -5132,10 +5132,11 @@ BOOL LLTextEditor::findHTML(const std::string &line, S32 *begin, S32 *end, std::
5132 //Load_url only handles http and https so don't hilite ftp, smb, etc. 5132 //Load_url only handles http and https so don't hilite ftp, smb, etc.
5133 m2 = line.substr(*begin,(m1 - *begin)).find("http"); 5133 m2 = line.substr(*begin,(m1 - *begin)).find("http");
5134 m3 = line.substr(*begin,(m1 - *begin)).find("secondlife"); 5134 m3 = line.substr(*begin,(m1 - *begin)).find("secondlife");
5135 m4 = line.substr(*begin,(m1 - *begin)).find("inworldz");
5135 5136
5136 std::string badneighbors=".,<>?';\"][}{=-+_)(*&^%$#@!~`\t\r\n\\"; 5137 std::string badneighbors=".,<>?';\"][}{=-+_)(*&^%$#@!~`\t\r\n\\";
5137 5138
5138 if (m2 >= 0 || m3>=0) 5139 if (m2 >= 0 || m3>=0 || m4>=0)
5139 { 5140 {
5140 S32 bn = badneighbors.find(line.substr(m1+3,1)); 5141 S32 bn = badneighbors.find(line.substr(m1+3,1));
5141 5142
@@ -5179,9 +5180,28 @@ BOOL LLTextEditor::findHTML(const std::string &line, S32 *begin, S32 *end, std::
5179 try 5180 try
5180 { 5181 {
5181 url = line.substr(*begin,*end - *begin); 5182 url = line.substr(*begin,*end - *begin);
5182 std::string slurlID = "slurl.com/secondlife/";
5183 strpos = url.find(slurlID);
5184 5183
5184 // see if it's an izurl
5185 std::string slurlID = "places.inworldz.com/";
5186 strpos = url.find(slurlID);
5187 if (strpos < 0)
5188 {
5189 slurlID="inworldz://";
5190 strpos = url.find(slurlID);
5191 }
5192 if (strpos < 0)
5193 {
5194 slurlID="iz://";
5195 strpos = url.find(slurlID);
5196 }
5197
5198 // see if it's an slurl
5199 if (strpos < 0)
5200 {
5201 slurlID = "slurl.com/secondlife/";
5202 strpos = url.find(slurlID);
5203 }
5204
5185 if (strpos < 0) 5205 if (strpos < 0)
5186 { 5206 {
5187 slurlID="maps.secondlife.com/secondlife/"; 5207 slurlID="maps.secondlife.com/secondlife/";
diff --git a/linden/indra/newview/aoremotectrl.cpp b/linden/indra/newview/aoremotectrl.cpp
index 781f1b3..6595835 100644
--- a/linden/indra/newview/aoremotectrl.cpp
+++ b/linden/indra/newview/aoremotectrl.cpp
@@ -88,15 +88,22 @@ BOOL AORemoteCtrl::postBuild()
88 childSetAction("ao_show_btn", onClickShowAO, this); 88 childSetAction("ao_show_btn", onClickShowAO, this);
89 childSetAction("popup_btn", onClickPopupBtn, this); 89 childSetAction("popup_btn", onClickPopupBtn, this);
90 90
91 childSetEnabled("ao_sit_btn", gSavedSettings.getBOOL("AOEnabled"));
92
91 return TRUE; 93 return TRUE;
92} 94}
93 95
94// static 96// static
95void AORemoteCtrl::onClickToggleAO(void* data) 97void AORemoteCtrl::onClickToggleAO(void* data)
96{ 98{
97 BOOL ao_enable = gSavedSettings.getBOOL("AOEnabled"); 99 AORemoteCtrl* self = (AORemoteCtrl*)data;
98 gSavedSettings.setBOOL("AOEnabled", !ao_enable); 100 if (self)
99 LLFloaterAO::run(); 101 {
102 BOOL ao_enable = gSavedSettings.getBOOL("AOEnabled");
103 gSavedSettings.setBOOL("AOEnabled", !ao_enable);
104 self->childSetEnabled("ao_sit_btn", !ao_enable);
105 LLFloaterAO::run();
106 }
100} 107}
101 108
102//static 109//static
diff --git a/linden/indra/newview/app_settings/default_grids.xml b/linden/indra/newview/app_settings/default_grids.xml
index ff511c4..dab575b 100644
--- a/linden/indra/newview/app_settings/default_grids.xml
+++ b/linden/indra/newview/app_settings/default_grids.xml
@@ -1,7 +1,7 @@
1<llsd> 1<llsd>
2 <array> 2 <array>
3 <map> 3 <map>
4 <key>default_grids_version</key><string>33</string> 4 <key>default_grids_version</key><string>37</string>
5 </map> 5 </map>
6 6
7 <!-- Second Life --> 7 <!-- Second Life -->
@@ -51,13 +51,15 @@
51 <key>gridname</key><string>OSGrid</string> 51 <key>gridname</key><string>OSGrid</string>
52 <key>platform</key><string>OpenSim</string> 52 <key>platform</key><string>OpenSim</string>
53 <key>loginuri</key><string>http://login.osgrid.org/</string> 53 <key>loginuri</key><string>http://login.osgrid.org/</string>
54 <key>loginpage</key><string>http://osgrid.org/splash/</string> 54 <key>loginpage</key><string>http://www.osgrid.org/splash/</string>
55 <key>helperuri</key><string>http://helper.osgrid.org/</string> 55 <key>helperuri</key><string>http://helper.osgrid.org/</string>
56 <key>website</key><string>http://osgrid.org/</string> 56 <key>website</key><string>http://www.osgrid.org/</string>
57 <key>support</key><string>http://osgrid.org/</string> 57 <key>support</key><string>http://www.osgrid.org/</string>
58 <key>register</key><string>http://www.osgrid.org/index.php/auth/register</string> 58 <key>register</key>
59 <key>password</key><string>http://www.osgrid.org/index.php/auth/forgot_password</string> 59 <string>http://www.osgrid.org/index.php/auth/register</string>
60 <key>version</key><string>2</string> 60 <key>password</key>
61 <string>http://www.osgrid.org/index.php/auth/forgot_password</string>
62 <key>version</key><string>3</string>
61 </map> 63 </map>
62 64
63 <!-- Aurora Grid --> 65 <!-- Aurora Grid -->
@@ -155,12 +157,13 @@
155 <key>gridname</key><string>Role Play Worlds</string> 157 <key>gridname</key><string>Role Play Worlds</string>
156 <key>platform</key><string>OpenSim</string> 158 <key>platform</key><string>OpenSim</string>
157 <key>loginuri</key><string>http://grid.roleplayworlds.net:8002/</string> 159 <key>loginuri</key><string>http://grid.roleplayworlds.net:8002/</string>
158 <key>loginpage</key><string>http://grid.roleplayworlds.net/loginscreen.php</string> 160 <key>loginpage</key><string>http://roleplayworlds.net/loginscreen</string>
159 <key>helperuri</key><string>http://grid.roleplayworlds.net/</string> 161 <key>helperuri</key><string>http://grid.roleplayworlds.net/</string>
160 <key>website</key><string>http://roleplayworlds.net/</string> 162 <key>website</key><string>http://roleplayworlds.net/</string>
161 <key>register</key><string>http://grid.roleplayworlds.net/index.php?page=create</string> 163 <key>support</key><string>http://roleplayworlds.net/help</string>
162 <key>password</key><string>http://grid.roleplayworlds.net/index.php?page=change</string> 164 <key>register</key><string>http://roleplayworlds.net/register</string>
163 <key>version</key><string>0</string> 165 <key>password</key><string>http://roleplayworlds.net/password</string>
166 <key>version</key><string>1</string>
164 </map> 167 </map>
165 168
166 <!-- GiantGrid --> 169 <!-- GiantGrid -->
@@ -168,10 +171,14 @@
168 <key>gridnick</key><string>giantgrid</string> 171 <key>gridnick</key><string>giantgrid</string>
169 <key>gridname</key><string>GiantGrid</string> 172 <key>gridname</key><string>GiantGrid</string>
170 <key>platform</key><string>OpenSim</string> 173 <key>platform</key><string>OpenSim</string>
171 <key>loginuri</key><string>http://Gianttest.no-ip.biz:8002/</string> 174 <key>loginuri</key><string>http://giantgrid.no-ip.biz:8002/</string>
172 <key>loginpage</key><string>http://gianttest.no-ip.biz:80/gridsplash?method=login</string> 175 <key>loginpage</key><string>http://www.giantgrid.nl</string>
173 <key>helperuri</key><string>http://gianttest.no-ip.biz/giantmap/</string> 176 <key>helperuri</key><string>http://giantgrid.no-ip.biz/XoopCube/html/modules/xoopensim/helper/</string>
174 <key>version</key><string>0</string> 177 <key>website</key><string>http://www.giantgrid.nl</string>
178 <key>register</key><string>http://giantgrid.no-ip.biz:8002/wifi/user/account/</string>
179 <key>password</key><string>http://giantgrid.no-ip.biz:8002/wifi/forgotpassword</string>
180 <key>support</key><string>http://gianttest.no-ip.biz/ticket/</string>
181 <key>version</key><string>1</string>
175 </map> 182 </map>
176 183
177 <!-- 3rd Rock Grid --> 184 <!-- 3rd Rock Grid -->
diff --git a/linden/indra/newview/app_settings/logcontrol.xml b/linden/indra/newview/app_settings/logcontrol.xml
index 92d477f..50f8ba5 100644
--- a/linden/indra/newview/app_settings/logcontrol.xml
+++ b/linden/indra/newview/app_settings/logcontrol.xml
@@ -53,8 +53,8 @@
53 <!--<string>AudioEngine</string>--> 53 <!--<string>AudioEngine</string>-->
54 <!--<string>BodyPhysics</string>--> 54 <!--<string>BodyPhysics</string>-->
55 <!--<string>InitInfo</string>--> 55 <!--<string>InitInfo</string>-->
56 <string>Inventory</string>
56 <!--<string>isOwnedSelf</string>--> 57 <!--<string>isOwnedSelf</string>-->
57 <!--<string>Inventory</string>-->
58 <!--<string>HUDEffect</string>--> 58 <!--<string>HUDEffect</string>-->
59 <!--<string>MarkerFile</string>--> 59 <!--<string>MarkerFile</string>-->
60 <!--<string>Media</string>--> 60 <!--<string>Media</string>-->
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index 41b9fcf..166c35a 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -512,7 +512,7 @@
512 <key>Value</key> 512 <key>Value</key>
513 <integer>1</integer> 513 <integer>1</integer>
514 </map> 514 </map>
515 <key>FetchInventoryOnLogin</key> 515 <key>FetchInventoryOnLogin2</key>
516 <map> 516 <map>
517 <key>Comment</key> 517 <key>Comment</key>
518 <string>Automatically fetch the inventory in the background after login (has issues)</string> 518 <string>Automatically fetch the inventory in the background after login (has issues)</string>
@@ -521,7 +521,7 @@
521 <key>Type</key> 521 <key>Type</key>
522 <string>Boolean</string> 522 <string>Boolean</string>
523 <key>Value</key> 523 <key>Value</key>
524 <integer>0</integer> 524 <integer>1</integer>
525 </map> 525 </map>
526 <key>FloaterAnimationListRect</key> 526 <key>FloaterAnimationListRect</key>
527 <map> 527 <map>
@@ -8188,17 +8188,6 @@
8188 <key>Value</key> 8188 <key>Value</key>
8189 <real>48.0</real> 8189 <real>48.0</real>
8190 </map> 8190 </map>
8191 <key>MaxSelectDistance</key>
8192 <map>
8193 <key>Comment</key>
8194 <string>Maximum allowed selection distance (meters from avatar)</string>
8195 <key>Persist</key>
8196 <integer>1</integer>
8197 <key>Type</key>
8198 <string>F32</string>
8199 <key>Value</key>
8200 <real>64.0</real>
8201 </map>
8202 <key>MeanCollisionBump</key> 8191 <key>MeanCollisionBump</key>
8203 <map> 8192 <map>
8204 <key>Comment</key> 8193 <key>Comment</key>
diff --git a/linden/indra/newview/floaterao.cpp b/linden/indra/newview/floaterao.cpp
index df88d6f..843cb3a 100644
--- a/linden/indra/newview/floaterao.cpp
+++ b/linden/indra/newview/floaterao.cpp
@@ -34,6 +34,8 @@
34#include "llboost.h" 34#include "llboost.h"
35#include <boost/regex.hpp> 35#include <boost/regex.hpp>
36 36
37static LLFrameTimer sInitTimer;
38
37void cmdline_printchat(std::string message); 39void cmdline_printchat(std::string message);
38 40
39AOInvTimer* gAOInvTimer = NULL; 41AOInvTimer* gAOInvTimer = NULL;
@@ -72,6 +74,11 @@ public:
72 text->insertText(line); 74 text->insertText(line);
73 } 75 }
74 file.close(); 76 file.close();
77
78 if (line.empty())
79 {
80 llwarns << "Can't open ao_template.ini at << " << mFileName << llendl;
81 }
75 82
76 nc->saveIfNeeded(); 83 nc->saveIfNeeded();
77 } 84 }
@@ -113,37 +120,71 @@ BOOL AOStandTimer::tick()
113 120
114// ------------------------------------------------------- 121// -------------------------------------------------------
115 122
123BOOL AOInvTimer::sInitialized = FALSE;
124
116AOInvTimer::AOInvTimer() : LLEventTimer( (F32)1.0 ) 125AOInvTimer::AOInvTimer() : LLEventTimer( (F32)1.0 )
117{ 126{
127 // if we can't find the item we need, start the init timer
128 // background inventory fetching has already begun in llstartup -- MC
129 if (LLStartUp::getStartupState() == STATE_STARTED)
130 {
131 LLUUID ao_notecard = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID");
132 if (ao_notecard.notNull())
133 {
134 const LLInventoryItem* item = gInventory.getItem(ao_notecard);
135 if (!item)
136 {
137 sInitTimer.start();
138 sInitTimer.setTimerExpirySec(10.0f);
139 }
140 else
141 {
142 sInitialized = LLFloaterAO::init();
143 if (!sInitialized) // should never happen, but just in case -- MC
144 {
145 sInitTimer.start();
146 sInitTimer.setTimerExpirySec(10.0f);
147 }
148 }
149 }
150 }
118} 151}
152
119AOInvTimer::~AOInvTimer() 153AOInvTimer::~AOInvTimer()
120{ 154{
121} 155}
122 156
123BOOL AOInvTimer::fullfetch = FALSE;
124
125BOOL AOInvTimer::tick() 157BOOL AOInvTimer::tick()
126{ 158{
127 if (!(gSavedSettings.getBOOL("AOEnabled"))) return TRUE; 159 /*if (!(gSavedSettings.getBOOL("AOEnabled")))
128 if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) 160 {
161 return TRUE;
162 }*/
163
164 if (gInventory.isEverythingFetched())
129 { 165 {
130 if(gInventory.isEverythingFetched()) 166 if (!sInitialized)
131 { 167 {
132// cmdline_printchat("Inventory fetched, loading AO.");
133 LLFloaterAO::init(); 168 LLFloaterAO::init();
134 return TRUE; 169 sInitialized = TRUE; // this can happen even if we can't initialize the AO -- MC
135 }else 170 }
171
172 if (sInitTimer.getStarted())
136 { 173 {
137 //static BOOL startedfetch = FALSE; 174 sInitTimer.stop();
138 if(fullfetch == FALSE)
139 {
140 fullfetch = TRUE;
141 //no choice, can't move the AO till we find it, should only have to happen once
142 gInventory.startBackgroundFetch();
143 }
144 } 175 }
145 } 176 }
146 return FALSE; 177
178 if (!sInitialized && LLStartUp::getStartupState() == STATE_STARTED)
179 {
180 if (sInitTimer.hasExpired())
181 {
182 sInitTimer.start();
183 sInitTimer.setTimerExpirySec(10.0f);
184 sInitialized = LLFloaterAO::init();
185 }
186 }
187 return sInitialized;
147} 188}
148// NC DROP ------------------------------------------------------- 189// NC DROP -------------------------------------------------------
149 190
@@ -210,40 +251,40 @@ BOOL AONoteCardDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
210 return handled; 251 return handled;
211} 252}
212 253
213AONoteCardDropTarget * LLFloaterAO::mAOItemDropTarget; 254AONoteCardDropTarget * LLFloaterAO::sAOItemDropTarget;
214 255
215 256
216// STUFF ------------------------------------------------------- 257// STUFF -------------------------------------------------------
217 258
218int LLFloaterAO::mAnimationState = 0; 259S32 LLFloaterAO::sAnimationState = 0;
219int LLFloaterAO::stand_iterator = 0; 260S32 LLFloaterAO::stand_iterator = 0;
220 261
221LLUUID LLFloaterAO::invfolderid = LLUUID::null; 262LLUUID LLFloaterAO::invfolderid = LLUUID::null;
222LLUUID LLFloaterAO::mCurrentStandId = LLUUID::null; 263LLUUID LLFloaterAO::sCurrentStandId = LLUUID::null;
223 264
224LLComboBox* mcomboBox_stands; 265LLComboBox* mComboBox_stands;
225LLComboBox* mcomboBox_walks; 266LLComboBox* mComboBox_walks;
226LLComboBox* mcomboBox_runs; 267LLComboBox* mComboBox_runs;
227LLComboBox* mcomboBox_jumps; 268LLComboBox* mComboBox_jumps;
228LLComboBox* mcomboBox_sits; 269LLComboBox* mComboBox_sits;
229LLComboBox* mcomboBox_gsits; 270LLComboBox* mComboBox_gsits;
230LLComboBox* mcomboBox_crouchs; 271LLComboBox* mComboBox_crouchs;
231LLComboBox* mcomboBox_cwalks; 272LLComboBox* mComboBox_cwalks;
232LLComboBox* mcomboBox_falls; 273LLComboBox* mComboBox_falls;
233LLComboBox* mcomboBox_hovers; 274LLComboBox* mComboBox_hovers;
234LLComboBox* mcomboBox_flys; 275LLComboBox* mComboBox_flys;
235LLComboBox* mcomboBox_flyslows; 276LLComboBox* mComboBox_flyslows;
236LLComboBox* mcomboBox_flyups; 277LLComboBox* mComboBox_flyups;
237LLComboBox* mcomboBox_flydowns; 278LLComboBox* mComboBox_flydowns;
238LLComboBox* mcomboBox_lands; 279LLComboBox* mComboBox_lands;
239LLComboBox* mcomboBox_standups; 280LLComboBox* mComboBox_standups;
240LLComboBox* mcomboBox_prejumps; 281LLComboBox* mComboBox_prejumps;
241 282
242struct struct_overrides 283struct struct_overrides
243{ 284{
244 LLUUID orig_id; 285 LLUUID orig_id;
245 LLUUID ao_id; 286 LLUUID ao_id;
246 int state; 287 S32 state;
247}; 288};
248std::vector<struct_overrides> mAOOverrides; 289std::vector<struct_overrides> mAOOverrides;
249 290
@@ -257,14 +298,16 @@ std::vector<struct_stands> mAOStands;
257struct struct_tokens 298struct struct_tokens
258{ 299{
259 std::string token; 300 std::string token;
260 int state; 301 S32 state;
261}; 302};
262std::vector<struct_tokens> mAOTokens; 303std::vector<struct_tokens> mAOTokens;
263 304
264LLFloaterAO* LLFloaterAO::sInstance = NULL; 305LLFloaterAO* LLFloaterAO::sInstance = NULL;
265 306
266LLFloaterAO::LLFloaterAO() 307LLFloaterAO::LLFloaterAO()
267:LLFloater(std::string("floater_ao")) 308 :
309 LLFloater(std::string("floater_ao")),
310 mDirty(FALSE)
268{ 311{
269// init(); 312// init();
270 llassert_always(sInstance == NULL); 313 llassert_always(sInstance == NULL);
@@ -275,80 +318,55 @@ LLFloaterAO::LLFloaterAO()
275LLFloaterAO::~LLFloaterAO() 318LLFloaterAO::~LLFloaterAO()
276{ 319{
277 sInstance=NULL; 320 sInstance=NULL;
278 mcomboBox_stands = 0; 321 mComboBox_stands = 0;
279 mcomboBox_walks = 0; 322 mComboBox_walks = 0;
280 mcomboBox_runs = 0; 323 mComboBox_runs = 0;
281 mcomboBox_jumps = 0; 324 mComboBox_jumps = 0;
282 mcomboBox_sits = 0; 325 mComboBox_sits = 0;
283 mcomboBox_gsits = 0; 326 mComboBox_gsits = 0;
284 mcomboBox_crouchs = 0; 327 mComboBox_crouchs = 0;
285 mcomboBox_cwalks = 0; 328 mComboBox_cwalks = 0;
286 mcomboBox_falls = 0; 329 mComboBox_falls = 0;
287 mcomboBox_hovers = 0; 330 mComboBox_hovers = 0;
288 mcomboBox_flys = 0; 331 mComboBox_flys = 0;
289 mcomboBox_flyslows = 0; 332 mComboBox_flyslows = 0;
290 mcomboBox_flyups = 0; 333 mComboBox_flyups = 0;
291 mcomboBox_flydowns = 0; 334 mComboBox_flydowns = 0;
292 mcomboBox_lands = 0; 335 mComboBox_lands = 0;
293 mcomboBox_standups = 0; 336 mComboBox_standups = 0;
294 mcomboBox_prejumps = 0; 337 mComboBox_prejumps = 0;
295 delete mAOItemDropTarget; 338 delete sAOItemDropTarget;
296 mAOItemDropTarget = NULL; 339 sAOItemDropTarget = NULL;
297// llinfos << "floater destroyed" << llendl; 340// llinfos << "floater destroyed" << llendl;
298} 341}
299 342
300void LLFloaterAO::show(void*)
301{
302 if (!sInstance)
303 {
304 sInstance = new LLFloaterAO();
305 updateLayout(sInstance);
306 init();
307
308 sInstance->open();
309 }
310 else
311 {
312 sInstance->close();
313 }
314 LLFirstUse::useAO();
315}
316
317bool LLFloaterAO::getInstance()
318{
319 if (sInstance)
320 return true;
321 else
322 return false;
323}
324
325BOOL LLFloaterAO::postBuild() 343BOOL LLFloaterAO::postBuild()
326{ 344{
327 LLView *target_view = getChild<LLView>("ao_notecard"); 345 LLView *target_view = getChild<LLView>("ao_notecard");
328 if(target_view) 346 if (target_view)
329 { 347 {
330 if (mAOItemDropTarget) 348 if (sAOItemDropTarget)
331 { 349 {
332 delete mAOItemDropTarget; 350 delete sAOItemDropTarget;
333 } 351 }
334 mAOItemDropTarget = new AONoteCardDropTarget("drop target", target_view->getRect(), AOItemDrop);//, mAvatarID); 352 sAOItemDropTarget = new AONoteCardDropTarget("drop target", target_view->getRect(), AOItemDrop);//, mAvatarID);
335 addChild(mAOItemDropTarget); 353 addChild(sAOItemDropTarget);
336 } 354 }
337 if(LLStartUp::getStartupState() == STATE_STARTED) 355 if (LLStartUp::getStartupState() == STATE_STARTED)
338 { 356 {
339 LLUUID itemidimport = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); 357 LLUUID itemidimport = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID");
340 LLViewerInventoryItem* itemimport = gInventory.getItem(itemidimport); 358 LLViewerInventoryItem* itemimport = gInventory.getItem(itemidimport);
341 if(itemimport) 359 if (itemimport)
342 { 360 {
343 childSetValue("ao_nc_text","Currently set to: "+itemimport->getName()); 361 childSetValue("ao_nc_text","Currently set to: "+itemimport->getName());
344 } 362 }
345 else if(itemidimport.isNull()) 363 else if (itemidimport.isNull())
346 { 364 {
347 childSetValue("ao_nc_text","Currently not set"); 365 childSetValue("ao_nc_text","Currently not set");
348 } 366 }
349 else 367 else
350 { 368 {
351 childSetValue("ao_nc_text","Currently set to a item not on this account"); 369 childSetValue("ao_nc_text","Currently not loaded");
352 } 370 }
353 } 371 }
354 else 372 else
@@ -366,23 +384,23 @@ BOOL LLFloaterAO::postBuild()
366 childSetCommitCallback("AOEnabled",onClickToggleAO); 384 childSetCommitCallback("AOEnabled",onClickToggleAO);
367 childSetCommitCallback("AOSitsEnabled",onClickToggleSits); 385 childSetCommitCallback("AOSitsEnabled",onClickToggleSits);
368 childSetCommitCallback("standtime",onSpinnerCommit); 386 childSetCommitCallback("standtime",onSpinnerCommit);
369 mcomboBox_stands = getChild<LLComboBox>("stands"); 387 mComboBox_stands = getChild<LLComboBox>("stands");
370 mcomboBox_walks = getChild<LLComboBox>("walks"); 388 mComboBox_walks = getChild<LLComboBox>("walks");
371 mcomboBox_runs = getChild<LLComboBox>("runs"); 389 mComboBox_runs = getChild<LLComboBox>("runs");
372 mcomboBox_jumps = getChild<LLComboBox>("jumps"); 390 mComboBox_jumps = getChild<LLComboBox>("jumps");
373 mcomboBox_sits = getChild<LLComboBox>("sits"); 391 mComboBox_sits = getChild<LLComboBox>("sits");
374 mcomboBox_gsits = getChild<LLComboBox>("gsits"); 392 mComboBox_gsits = getChild<LLComboBox>("gsits");
375 mcomboBox_crouchs = getChild<LLComboBox>("crouchs"); 393 mComboBox_crouchs = getChild<LLComboBox>("crouchs");
376 mcomboBox_cwalks = getChild<LLComboBox>("cwalks"); 394 mComboBox_cwalks = getChild<LLComboBox>("cwalks");
377 mcomboBox_falls = getChild<LLComboBox>("falls"); 395 mComboBox_falls = getChild<LLComboBox>("falls");
378 mcomboBox_hovers = getChild<LLComboBox>("hovers"); 396 mComboBox_hovers = getChild<LLComboBox>("hovers");
379 mcomboBox_flys = getChild<LLComboBox>("flys"); 397 mComboBox_flys = getChild<LLComboBox>("flys");
380 mcomboBox_flyslows = getChild<LLComboBox>("flyslows"); 398 mComboBox_flyslows = getChild<LLComboBox>("flyslows");
381 mcomboBox_flyups = getChild<LLComboBox>("flyups"); 399 mComboBox_flyups = getChild<LLComboBox>("flyups");
382 mcomboBox_flydowns = getChild<LLComboBox>("flydowns"); 400 mComboBox_flydowns = getChild<LLComboBox>("flydowns");
383 mcomboBox_lands = getChild<LLComboBox>("lands"); 401 mComboBox_lands = getChild<LLComboBox>("lands");
384 mcomboBox_standups = getChild<LLComboBox>("standups"); 402 mComboBox_standups = getChild<LLComboBox>("standups");
385 mcomboBox_prejumps = getChild<LLComboBox>("prejumps"); 403 mComboBox_prejumps = getChild<LLComboBox>("prejumps");
386 getChild<LLComboBox>("stands")->setCommitCallback(onComboBoxCommit); 404 getChild<LLComboBox>("stands")->setCommitCallback(onComboBoxCommit);
387 getChild<LLComboBox>("walks")->setCommitCallback(onComboBoxCommit); 405 getChild<LLComboBox>("walks")->setCommitCallback(onComboBoxCommit);
388 getChild<LLComboBox>("runs")->setCommitCallback(onComboBoxCommit); 406 getChild<LLComboBox>("runs")->setCommitCallback(onComboBoxCommit);
@@ -404,10 +422,49 @@ BOOL LLFloaterAO::postBuild()
404 return TRUE; 422 return TRUE;
405} 423}
406 424
425// static
426void LLFloaterAO::show(void*)
427{
428 if (!sInstance)
429 {
430 sInstance = new LLFloaterAO();
431 updateLayout(sInstance);
432 init();
433
434 sInstance->open();
435 }
436 else
437 {
438 sInstance->close();
439 }
440 LLFirstUse::useAO();
441}
442
443// static
444LLFloaterAO* LLFloaterAO::getInstance()
445{
446 if (!sInstance)
447 {
448 sInstance = new LLFloaterAO();
449 }
450 return sInstance;
451}
452
453// static
454bool LLFloaterAO::getVisible()
455{
456 if (sInstance)
457 {
458 return true;
459 }
460 return false;
461}
462
463// static
407void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata) 464void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata)
408{ 465{
409 LLSpinCtrl* spin = (LLSpinCtrl*) ctrl; 466 LLSpinCtrl* spin = (LLSpinCtrl*)ctrl;
410 if(spin) 467 if (spin)
411 { 468 {
412 if (spin->getName() == "standtime") 469 if (spin->getName() == "standtime")
413 { 470 {
@@ -416,10 +473,11 @@ void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata)
416 } 473 }
417} 474}
418 475
476// static
419void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) 477void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata)
420{ 478{
421 LLComboBox* box = (LLComboBox*)ctrl; 479 LLComboBox* box = (LLComboBox*)ctrl;
422 if(box) 480 if (box)
423 { 481 {
424 if (box->getName() == "stands") 482 if (box->getName() == "stands")
425 { 483 {
@@ -429,7 +487,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata)
429 } 487 }
430 else 488 else
431 { 489 {
432 int state = STATE_AGENT_IDLE; 490 S32 state = STATE_AGENT_IDLE;
433 std::string stranim = box->getValue().asString(); 491 std::string stranim = box->getValue().asString();
434// llinfos << "state " << (gAgent.getAvatarObject()->mIsSitting) << " - " << getAnimationState() << llendl; 492// llinfos << "state " << (gAgent.getAvatarObject()->mIsSitting) << " - " << getAnimationState() << llendl;
435 if (box->getName() == "walks") 493 if (box->getName() == "walks")
@@ -556,6 +614,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata)
556 } 614 }
557} 615}
558 616
617// static
559void LLFloaterAO::updateLayout(LLFloaterAO* floater) 618void LLFloaterAO::updateLayout(LLFloaterAO* floater)
560{ 619{
561 if (floater) 620 if (floater)
@@ -613,8 +672,10 @@ void LLFloaterAO::updateLayout(LLFloaterAO* floater)
613 } 672 }
614} 673}
615 674
616void LLFloaterAO::init() 675// static
676bool LLFloaterAO::init()
617{ 677{
678 //cmdline_printchat("init() called");
618 mAOStands.clear(); 679 mAOStands.clear();
619 mAOTokens.clear(); 680 mAOTokens.clear();
620 mAOOverrides.clear(); 681 mAOOverrides.clear();
@@ -673,82 +734,87 @@ void LLFloaterAO::init()
673 overrideloader.orig_id = ANIM_AGENT_FLY; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLY; mAOOverrides.push_back(overrideloader); 734 overrideloader.orig_id = ANIM_AGENT_FLY; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLY; mAOOverrides.push_back(overrideloader);
674 overrideloader.orig_id = ANIM_AGENT_FLYSLOW; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLYSLOW; mAOOverrides.push_back(overrideloader); 735 overrideloader.orig_id = ANIM_AGENT_FLYSLOW; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLYSLOW; mAOOverrides.push_back(overrideloader);
675 736
676 BOOL success = TRUE; 737 BOOL success = FALSE;
677 738
678 if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) 739 if (LLStartUp::getStartupState() >= STATE_INVENTORY_SEND)
679 { 740 {
680 if(gInventory.isEverythingFetched()) 741 LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID");
742 if (configncitem.notNull())
681 { 743 {
682 LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); 744 const LLInventoryItem* item = gInventory.getItem(configncitem);
683 if (configncitem.notNull()) 745 if (item)
684 { 746 {
685 success = FALSE; 747 if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike())
686 const LLInventoryItem* item = gInventory.getItem(configncitem);
687 if(item)
688 { 748 {
689 if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) 749 if (!item->getAssetUUID().isNull())
690 { 750 {
691 if(!item->getAssetUUID().isNull()) 751 LLUUID* new_uuid = new LLUUID(configncitem);
692 { 752 LLHost source_sim = LLHost::invalid;
693 LLUUID* new_uuid = new LLUUID(configncitem); 753 invfolderid = item->getParentUUID();
694 LLHost source_sim = LLHost::invalid; 754 gAssetStorage->getInvItemAsset(source_sim,
695 invfolderid = item->getParentUUID(); 755 gAgent.getID(),
696 gAssetStorage->getInvItemAsset(source_sim, 756 gAgent.getSessionID(),
697 gAgent.getID(), 757 item->getPermissions().getOwner(),
698 gAgent.getSessionID(), 758 LLUUID::null,
699 item->getPermissions().getOwner(), 759 item->getUUID(),
700 LLUUID::null, 760 item->getAssetUUID(),
701 item->getUUID(), 761 item->getType(),
702 item->getAssetUUID(), 762 &onNotecardLoadComplete,
703 item->getType(), 763 (void*)new_uuid,
704 &onNotecardLoadComplete, 764 TRUE);
705 (void*)new_uuid, 765 success = TRUE;
706 TRUE);
707 success = TRUE;
708 }
709 } 766 }
710 } 767 }
711 } 768 }
769 else // item
770 {
771 //cmdline_printchat("no item (notecard)");
772 }
712 } 773 }
713 } 774 }
714 775 else // notecard null
715 if (!success)
716 { 776 {
717 cmdline_printchat("Could not read the specified Config Notecard"); 777 //cmdline_printchat("Config Notecard set to a null UUID!");
718 } 778 }
719 779
720// mAnimationState = 0; 780// sAnimationState = 0;
721// mCurrentStandId = LLUUID::null; 781// sCurrentStandId = LLUUID::null;
722// setAnimationState(STATE_AGENT_IDLE); 782// setAnimationState(STATE_AGENT_IDLE);
723 783
784 return success;
724} 785}
725 786
787// static
726void LLFloaterAO::onClickMore(void* data) 788void LLFloaterAO::onClickMore(void* data)
727{ 789{
728 gSavedSettings.setBOOL( "AOAdvanced", TRUE ); 790 gSavedSettings.setBOOL( "AOAdvanced", TRUE );
729 updateLayout(sInstance); 791 updateLayout(sInstance);
730} 792}
793
794// static
731void LLFloaterAO::onClickLess(void* data) 795void LLFloaterAO::onClickLess(void* data)
732{ 796{
733 gSavedSettings.setBOOL( "AOAdvanced", FALSE ); 797 gSavedSettings.setBOOL( "AOAdvanced", FALSE );
734 updateLayout(sInstance); 798 updateLayout(sInstance);
735} 799}
736 800
801// static
737void LLFloaterAO::onClickToggleAO(LLUICtrl *, void*) 802void LLFloaterAO::onClickToggleAO(LLUICtrl *, void*)
738{ 803{
739 run(); 804 run();
740} 805}
741 806
807// static
742void LLFloaterAO::onClickToggleSits(LLUICtrl *, void*) 808void LLFloaterAO::onClickToggleSits(LLUICtrl *, void*)
743{ 809{
744 run(); 810 run();
745} 811}
746 812
747 813// static
748void LLFloaterAO::run() 814void LLFloaterAO::run()
749{ 815{
750 setAnimationState(STATE_AGENT_IDLE); // reset state 816 setAnimationState(STATE_AGENT_IDLE); // reset state
751 int state = getAnimationState(); // check if sitting or hovering 817 S32 state = getAnimationState(); // check if sitting or hovering
752 if ((state == STATE_AGENT_IDLE) || (state == STATE_AGENT_STAND)) 818 if ((state == STATE_AGENT_IDLE) || (state == STATE_AGENT_STAND))
753 { 819 {
754 if (gSavedSettings.getBOOL("AOEnabled")) 820 if (gSavedSettings.getBOOL("AOEnabled"))
@@ -771,98 +837,158 @@ void LLFloaterAO::run()
771 } 837 }
772 else 838 else
773 { 839 {
774 if (state == STATE_AGENT_SIT) gAgent.sendAnimationRequest(GetAnimIDFromState(state), (gSavedSettings.getBOOL("AOEnabled") && gSavedSettings.getBOOL("AOSitsEnabled")) ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); 840 if (state == STATE_AGENT_SIT)
775 else gAgent.sendAnimationRequest(GetAnimIDFromState(state), gSavedSettings.getBOOL("AOEnabled") ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); 841 {
842 gAgent.sendAnimationRequest(GetAnimIDFromState(state), (gSavedSettings.getBOOL("AOEnabled") && gSavedSettings.getBOOL("AOSitsEnabled")) ? ANIM_REQUEST_START : ANIM_REQUEST_STOP);
843 }
844 else
845 {
846 gAgent.sendAnimationRequest(GetAnimIDFromState(state), gSavedSettings.getBOOL("AOEnabled") ? ANIM_REQUEST_START : ANIM_REQUEST_STOP);
847 }
776 } 848 }
777} 849}
778 850
779int LLFloaterAO::getAnimationState() 851// static
852S32 LLFloaterAO::getAnimationState()
780{ 853{
781 if (gAgent.getAvatarObject()) 854 if (gAgent.getAvatarObject())
782 { 855 {
783 if (gAgent.getAvatarObject()->mIsSitting) setAnimationState(STATE_AGENT_SIT); 856 if (gAgent.getAvatarObject()->mIsSitting)
784 else if (gAgent.getFlying()) setAnimationState(STATE_AGENT_HOVER); 857 {
858 setAnimationState(STATE_AGENT_SIT);
859 }
860 else if (gAgent.getFlying())
861 {
862 setAnimationState(STATE_AGENT_HOVER);
863 }
785 } 864 }
786 return mAnimationState; 865 return sAnimationState;
787} 866}
788 867
789void LLFloaterAO::setAnimationState(const int state) 868// static
869void LLFloaterAO::setAnimationState(const S32 state)
790{ 870{
791 mAnimationState = state; 871 sAnimationState = state;
792} 872}
793 873
874// static
794LLUUID LLFloaterAO::getCurrentStandId() 875LLUUID LLFloaterAO::getCurrentStandId()
795{ 876{
796 return mCurrentStandId; 877 return sCurrentStandId;
797} 878}
798 879
880// static
799void LLFloaterAO::setCurrentStandId(const LLUUID& id) 881void LLFloaterAO::setCurrentStandId(const LLUUID& id)
800{ 882{
801 mCurrentStandId = id; 883 sCurrentStandId = id;
802} 884}
803 885
886// static
804void LLFloaterAO::AOItemDrop(LLViewerInventoryItem* item) 887void LLFloaterAO::AOItemDrop(LLViewerInventoryItem* item)
805{ 888{
806 gSavedPerAccountSettings.setString("AOConfigNotecardID", item->getUUID().asString()); 889 gSavedPerAccountSettings.setString("AOConfigNotecardID", item->getUUID().asString());
807 sInstance->childSetValue("ao_nc_text","Currently set to: "+item->getName()); 890 sInstance->childSetValue("ao_nc_text","Currently set to: "+item->getName());
808} 891}
809 892
893// static
810LLUUID LLFloaterAO::GetAnimID(const LLUUID& id) 894LLUUID LLFloaterAO::GetAnimID(const LLUUID& id)
811{ 895{
812 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) 896 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter)
813 { 897 {
814 if (iter->orig_id == id) return iter->ao_id; 898 if (iter->orig_id == id)
899 {
900 return iter->ao_id;
901 }
815 } 902 }
816 return LLUUID::null; 903 return LLUUID::null;
817} 904}
818 905
819int LLFloaterAO::GetStateFromAnimID(const LLUUID& id) 906// static
907S32 LLFloaterAO::GetStateFromAnimID(const LLUUID& id)
820{ 908{
821 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) 909 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter)
822 { 910 {
823 if (iter->orig_id == id) return iter->state; 911 if (iter->orig_id == id)
912 {
913 return iter->state;
914 }
824 } 915 }
825 return STATE_AGENT_IDLE; 916 return STATE_AGENT_IDLE;
826} 917}
827 918
828LLUUID LLFloaterAO::GetAnimIDFromState(const int state) 919// static
920LLUUID LLFloaterAO::GetAnimIDFromState(const S32 state)
829{ 921{
830 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) 922 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter)
831 { 923 {
832 if (iter->state == state) return iter->ao_id; 924 if (iter->state == state)
925 {
926 return iter->ao_id;
927 }
833 } 928 }
834 return LLUUID::null; 929 return LLUUID::null;
835} 930}
836 931
837int LLFloaterAO::GetStateFromToken(std::string strtoken) 932// static
933S32 LLFloaterAO::GetStateFromToken(std::string strtoken)
838{ 934{
839 for (std::vector<struct_tokens>::iterator iter = mAOTokens.begin(); iter != mAOTokens.end(); ++iter) 935 for (std::vector<struct_tokens>::iterator iter = mAOTokens.begin(); iter != mAOTokens.end(); ++iter)
840 { 936 {
841 if (iter->token == strtoken) return iter->state; 937 if (iter->token == strtoken)
938 {
939 return iter->state;
940 }
842 } 941 }
843 return STATE_AGENT_IDLE; 942 return STATE_AGENT_IDLE;
844} 943}
845 944
945// static
846void LLFloaterAO::onClickPrevStand(void* user_data) 946void LLFloaterAO::onClickPrevStand(void* user_data)
847{ 947{
848 if (!(mAOStands.size() > 0)) return; 948 if (!(mAOStands.size() > 0))
849 stand_iterator=stand_iterator-1; 949 {
850 if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); 950 return;
851 if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; 951 }
952
953 stand_iterator = stand_iterator-1;
954
955 if (stand_iterator < 0)
956 {
957 stand_iterator = S32( mAOStands.size()-stand_iterator);
958 }
959 if (stand_iterator > S32( mAOStands.size()-1))
960 {
961 stand_iterator = 0;
962 }
963
852 cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str())); 964 cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str()));
853 ChangeStand(); 965 ChangeStand();
854} 966}
855 967
968// static
856void LLFloaterAO::onClickNextStand(void* user_data) 969void LLFloaterAO::onClickNextStand(void* user_data)
857{ 970{
858 if (!(mAOStands.size() > 0)) return; 971 if (!(mAOStands.size() > 0))
859 stand_iterator=stand_iterator+1; 972 {
860 if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); 973 return;
861 if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; 974 }
975
976 stand_iterator = stand_iterator+1;
977
978 if (stand_iterator < 0)
979 {
980 stand_iterator = S32( mAOStands.size()-stand_iterator);
981 }
982 if (stand_iterator > S32( mAOStands.size()-1))
983 {
984 stand_iterator = 0;
985 }
986
862 cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str())); 987 cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str()));
863 ChangeStand(); 988 ChangeStand();
864} 989}
865 990
991// static
866BOOL LLFloaterAO::ChangeStand() 992BOOL LLFloaterAO::ChangeStand()
867{ 993{
868 if (gSavedSettings.getBOOL("AOEnabled")) 994 if (gSavedSettings.getBOOL("AOEnabled"))
@@ -881,17 +1007,32 @@ BOOL LLFloaterAO::ChangeStand()
881 } 1007 }
882 if ((getAnimationState() == STATE_AGENT_IDLE) || (getAnimationState() == STATE_AGENT_STAND))// stands have lowest priority 1008 if ((getAnimationState() == STATE_AGENT_IDLE) || (getAnimationState() == STATE_AGENT_STAND))// stands have lowest priority
883 { 1009 {
884 if (!(mAOStands.size() > 0)) return TRUE; 1010 if (!(mAOStands.size() > 0))
1011 {
1012 return TRUE;
1013 }
1014
885 if (gSavedSettings.getBOOL("AOStandRandomize")) 1015 if (gSavedSettings.getBOOL("AOStandRandomize"))
886 { 1016 {
887 stand_iterator = ll_rand(mAOStands.size()-1); 1017 stand_iterator = ll_rand(mAOStands.size()-1);
888 } 1018 }
889 if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator);
890 if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0;
891 1019
892 int stand_iterator_previous = stand_iterator -1; 1020 if (stand_iterator < 0)
1021 {
1022 stand_iterator = S32( mAOStands.size()-stand_iterator);
1023 }
1024
1025 if (stand_iterator > S32( mAOStands.size()-1))
1026 {
1027 stand_iterator = 0;
1028 }
1029
1030 S32 stand_iterator_previous = stand_iterator -1;
893 1031
894 if (stand_iterator_previous < 0) stand_iterator_previous = int( mAOStands.size()-1); 1032 if (stand_iterator_previous < 0)
1033 {
1034 stand_iterator_previous = S32( mAOStands.size()-1);
1035 }
895 1036
896 if (mAOStands[stand_iterator].ao_id.notNull()) 1037 if (mAOStands[stand_iterator].ao_id.notNull())
897 { 1038 {
@@ -900,7 +1041,10 @@ BOOL LLFloaterAO::ChangeStand()
900 1041
901 setAnimationState(STATE_AGENT_STAND); 1042 setAnimationState(STATE_AGENT_STAND);
902 setCurrentStandId(mAOStands[stand_iterator].ao_id); 1043 setCurrentStandId(mAOStands[stand_iterator].ao_id);
903 if ((sInstance)&&(mcomboBox_stands)) mcomboBox_stands->selectNthItem(stand_iterator); 1044 if (sInstance && mComboBox_stands)
1045 {
1046 mComboBox_stands->selectNthItem(stand_iterator);
1047 }
904// llinfos << "changing stand to " << mAOStands[stand_iterator].anim_name << llendl; 1048// llinfos << "changing stand to " << mAOStands[stand_iterator].anim_name << llendl;
905 return FALSE; 1049 return FALSE;
906 } 1050 }
@@ -926,7 +1070,10 @@ BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand)
926 { 1070 {
927 sitting = gAgent.getAvatarObject()->mIsSitting; 1071 sitting = gAgent.getAvatarObject()->mIsSitting;
928 } 1072 }
929 if (sitting) return FALSE; 1073 if (sitting)
1074 {
1075 return FALSE;
1076 }
930 gAgent.sendAnimationRequest(id, ANIM_REQUEST_START); 1077 gAgent.sendAnimationRequest(id, ANIM_REQUEST_START);
931 return TRUE; 1078 return TRUE;
932 } 1079 }
@@ -939,7 +1086,10 @@ BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand)
939 setAnimationState(GetStateFromAnimID(id)); 1086 setAnimationState(GetStateFromAnimID(id));
940 1087
941// llinfos << " state " << getAnimationState() << " start anim " << id << " overriding with " << GetAnimID(id) << llendl; 1088// llinfos << " state " << getAnimationState() << " start anim " << id << " overriding with " << GetAnimID(id) << llendl;
942 if ((GetStateFromAnimID(id) == STATE_AGENT_SIT) && !(gSavedSettings.getBOOL("AOSitsEnabled"))) return TRUE; 1089 if ((GetStateFromAnimID(id) == STATE_AGENT_SIT) && !(gSavedSettings.getBOOL("AOSitsEnabled")))
1090 {
1091 return TRUE;
1092 }
943 gAgent.sendAnimationRequest(GetAnimID(id), ANIM_REQUEST_START); 1093 gAgent.sendAnimationRequest(GetAnimID(id), ANIM_REQUEST_START);
944 return TRUE; 1094 return TRUE;
945 } 1095 }
@@ -972,35 +1122,36 @@ BOOL LLFloaterAO::stopMotion(const LLUUID& id, BOOL stop_immediate, BOOL stand)
972 return FALSE; 1122 return FALSE;
973} 1123}
974 1124
1125// static
975void LLFloaterAO::onClickReloadCard(void* user_data) 1126void LLFloaterAO::onClickReloadCard(void* user_data)
976{ 1127{
977 if(gInventory.isEverythingFetched()) 1128 LLFloaterAO::init();
978 {
979 LLFloaterAO::init();
980 }
981} 1129}
982 1130
1131// static
983void LLFloaterAO::onClickOpenCard(void* user_data) 1132void LLFloaterAO::onClickOpenCard(void* user_data)
984{ 1133{
985 if(gInventory.isEverythingFetched()) 1134 LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID");
1135 if (configncitem.notNull())
986 { 1136 {
987 LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); 1137 const LLInventoryItem* item = gInventory.getItem(configncitem);
988 if (configncitem.notNull()) 1138 if (item)
989 { 1139 {
990 const LLInventoryItem* item = gInventory.getItem(configncitem); 1140 if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike())
991 if(item)
992 { 1141 {
993 if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) 1142 if(!item->getAssetUUID().isNull())
994 { 1143 open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE);
995 if(!item->getAssetUUID().isNull()) 1144// open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE, LLUUID::null, FALSE);
996 open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE);
997 // open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE, LLUUID::null, FALSE);
998 }
999 } 1145 }
1000 } 1146 }
1147 else
1148 {
1149 cmdline_printchat("Could not find notecard UUID " + configncitem.asString() + " in your inventory. Make sure your inventory is fully loaded and try again.");
1150 }
1001 } 1151 }
1002} 1152}
1003 1153
1154// static
1004void LLFloaterAO::onClickNewCard(void* user_data) 1155void LLFloaterAO::onClickNewCard(void* user_data)
1005{ 1156{
1006 // load the template file from app_settings/ao_template.ini then 1157 // load the template file from app_settings/ao_template.ini then
@@ -1026,15 +1177,16 @@ struct AOAssetInfo
1026 std::string name; 1177 std::string name;
1027}; 1178};
1028 1179
1180// static
1029void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status) 1181void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status)
1030{ 1182{
1031 if(status == LL_ERR_NOERR) 1183 if (status == LL_ERR_NOERR)
1032 { 1184 {
1033 S32 size = vfs->getSize(asset_uuid, type); 1185 S32 size = vfs->getSize(asset_uuid, type);
1034 U8* buffer = new U8[size]; 1186 U8* buffer = new U8[size];
1035 vfs->getData(asset_uuid, type, buffer, 0, size); 1187 vfs->getData(asset_uuid, type, buffer, 0, size);
1036 1188
1037 if(type == LLAssetType::AT_NOTECARD) 1189 if (type == LLAssetType::AT_NOTECARD)
1038 { 1190 {
1039 LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,""); 1191 LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,"");
1040 if(edit->importBuffer((char*)buffer, (S32)size)) 1192 if(edit->importBuffer((char*)buffer, (S32)size))
@@ -1043,27 +1195,43 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA
1043 std::string card = edit->getText(); 1195 std::string card = edit->getText();
1044 edit->die(); 1196 edit->die();
1045 1197
1046 if (mcomboBox_stands) 1198 if (sInstance && mComboBox_stands)
1047 { 1199 {
1048 mcomboBox_stands->clear(); 1200 mComboBox_stands->clear();
1049 mcomboBox_stands->removeall(); 1201 mComboBox_stands->removeall();
1050 } 1202 }
1051 if (mcomboBox_walks) mcomboBox_walks->clear(); 1203 if (sInstance && mComboBox_walks)
1052 if (mcomboBox_runs) mcomboBox_runs->clear(); 1204 mComboBox_walks->clear();
1053 if (mcomboBox_jumps) mcomboBox_jumps->clear(); 1205 if (sInstance && mComboBox_runs)
1054 if (mcomboBox_sits) mcomboBox_sits->clear(); 1206 mComboBox_runs->clear();
1055 if (mcomboBox_gsits) mcomboBox_gsits->clear(); 1207 if (sInstance && mComboBox_jumps)
1056 if (mcomboBox_crouchs) mcomboBox_cwalks->clear(); 1208 mComboBox_jumps->clear();
1057 if (mcomboBox_cwalks) mcomboBox_cwalks->clear(); 1209 if (sInstance && mComboBox_sits)
1058 if (mcomboBox_falls) mcomboBox_falls->clear(); 1210 mComboBox_sits->clear();
1059 if (mcomboBox_hovers) mcomboBox_hovers->clear(); 1211 if (sInstance && mComboBox_gsits)
1060 if (mcomboBox_flys) mcomboBox_flys->clear(); 1212 mComboBox_gsits->clear();
1061 if (mcomboBox_flyslows) mcomboBox_flyslows->clear(); 1213 if (sInstance && mComboBox_crouchs)
1062 if (mcomboBox_flyups) mcomboBox_flyups->clear(); 1214 mComboBox_cwalks->clear();
1063 if (mcomboBox_flydowns) mcomboBox_flydowns->clear(); 1215 if (sInstance && mComboBox_cwalks)
1064 if (mcomboBox_lands) mcomboBox_lands->clear(); 1216 mComboBox_cwalks->clear();
1065 if (mcomboBox_standups) mcomboBox_standups->clear(); 1217 if (sInstance && mComboBox_falls)
1066 if (mcomboBox_prejumps) mcomboBox_prejumps->clear(); 1218 mComboBox_falls->clear();
1219 if (sInstance && mComboBox_hovers)
1220 mComboBox_hovers->clear();
1221 if (sInstance && mComboBox_flys)
1222 mComboBox_flys->clear();
1223 if (sInstance && mComboBox_flyslows)
1224 mComboBox_flyslows->clear();
1225 if (sInstance && mComboBox_flyups)
1226 mComboBox_flyups->clear();
1227 if (sInstance && mComboBox_flydowns)
1228 mComboBox_flydowns->clear();
1229 if (sInstance && mComboBox_lands)
1230 mComboBox_lands->clear();
1231 if (sInstance && mComboBox_standups)
1232 mComboBox_standups->clear();
1233 if (sInstance && mComboBox_prejumps)
1234 mComboBox_prejumps->clear();
1067 1235
1068 1236
1069 struct_stands loader; 1237 struct_stands loader;
@@ -1106,134 +1274,185 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA
1106 { 1274 {
1107 case STATE_AGENT_STAND: 1275 case STATE_AGENT_STAND:
1108 loader.ao_id = animid; loader.anim_name = stranim.c_str(); mAOStands.push_back(loader); 1276 loader.ao_id = animid; loader.anim_name = stranim.c_str(); mAOStands.push_back(loader);
1109 if(mcomboBox_stands != NULL) mcomboBox_stands->add(stranim.c_str(), ADD_BOTTOM, TRUE); 1277 if (sInstance && mComboBox_stands != NULL)
1278 {
1279 mComboBox_stands->add(stranim.c_str(), ADD_BOTTOM, TRUE);
1280 }
1110 break; 1281 break;
1111 case STATE_AGENT_WALK: 1282 case STATE_AGENT_WALK:
1112 { 1283 {
1113 if (sInstance && (mcomboBox_walks != NULL)) 1284 if (sInstance && mComboBox_walks != NULL)
1114 { 1285 {
1115 //llinfos << "1 anim: " << stranim.c_str() << " assetid: " << animid << llendl; 1286 //llinfos << "1 anim: " << stranim.c_str() << " assetid: " << animid << llendl;
1116 if (!(mcomboBox_walks->selectByValue(stranim.c_str()))) mcomboBox_walks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1287 if (!(mComboBox_walks->selectByValue(stranim.c_str())))
1288 {
1289 mComboBox_walks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1290 }
1117 } 1291 }
1118 } 1292 }
1119 break; 1293 break;
1120 case STATE_AGENT_RUN: 1294 case STATE_AGENT_RUN:
1121 { 1295 {
1122 if (sInstance && (mcomboBox_runs != NULL)) 1296 if (sInstance && mComboBox_runs != NULL)
1123 { 1297 {
1124 if (!(mcomboBox_runs->selectByValue(stranim.c_str()))) mcomboBox_runs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1298 if (!(mComboBox_runs->selectByValue(stranim.c_str())))
1299 {
1300 mComboBox_runs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1301 }
1125 } 1302 }
1126 } 1303 }
1127 break; 1304 break;
1128 case STATE_AGENT_JUMP: 1305 case STATE_AGENT_JUMP:
1129 { 1306 {
1130 if (sInstance && (mcomboBox_jumps != NULL)) 1307 if (sInstance && mComboBox_jumps != NULL)
1131 { 1308 {
1132 if (!(mcomboBox_jumps->selectByValue(stranim.c_str()))) mcomboBox_jumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1309 if (!(mComboBox_jumps->selectByValue(stranim.c_str())))
1310 {
1311 mComboBox_jumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1312 }
1133 } 1313 }
1134 } 1314 }
1135 break; 1315 break;
1136 case STATE_AGENT_SIT: 1316 case STATE_AGENT_SIT:
1137 { 1317 {
1138 if (sInstance && (mcomboBox_sits != NULL)) 1318 if (sInstance && mComboBox_sits != NULL)
1139 { 1319 {
1140 if (!(mcomboBox_sits->selectByValue(stranim.c_str()))) mcomboBox_sits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1320 if (!(mComboBox_sits->selectByValue(stranim.c_str())))
1321 {
1322 mComboBox_sits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1323 }
1141 } 1324 }
1142 } 1325 }
1143 break; 1326 break;
1144 case STATE_AGENT_GROUNDSIT: 1327 case STATE_AGENT_GROUNDSIT:
1145 { 1328 {
1146 if (sInstance && (mcomboBox_gsits != NULL)) 1329 if (sInstance && mComboBox_gsits != NULL)
1147 { 1330 {
1148 if (!(mcomboBox_gsits->selectByValue(stranim.c_str()))) mcomboBox_gsits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1331 if (!(mComboBox_gsits->selectByValue(stranim.c_str())))
1332 {
1333 mComboBox_gsits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1334 }
1149 } 1335 }
1150 } 1336 }
1151 break; 1337 break;
1152 case STATE_AGENT_CROUCH: 1338 case STATE_AGENT_CROUCH:
1153 { 1339 {
1154 if (sInstance && (mcomboBox_crouchs != NULL)) 1340 if (sInstance && mComboBox_crouchs != NULL)
1155 { 1341 {
1156 if (!(mcomboBox_crouchs->selectByValue(stranim.c_str()))) mcomboBox_crouchs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1342 if (!(mComboBox_crouchs->selectByValue(stranim.c_str())))
1343 {
1344 mComboBox_crouchs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1345 }
1157 } 1346 }
1158 } 1347 }
1159 break; 1348 break;
1160 case STATE_AGENT_CROUCHWALK: 1349 case STATE_AGENT_CROUCHWALK:
1161 { 1350 {
1162 if (sInstance && (mcomboBox_cwalks != NULL)) 1351 if (sInstance && mComboBox_cwalks != NULL)
1163 { 1352 {
1164 if (!(mcomboBox_cwalks->selectByValue(stranim.c_str()))) mcomboBox_cwalks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1353 if (!(mComboBox_cwalks->selectByValue(stranim.c_str())))
1354 {
1355 mComboBox_cwalks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1356 }
1165 } 1357 }
1166 } 1358 }
1167 break; 1359 break;
1168 case STATE_AGENT_FALLDOWN: 1360 case STATE_AGENT_FALLDOWN:
1169 { 1361 {
1170 if (sInstance && (mcomboBox_falls != NULL)) 1362 if (sInstance && mComboBox_falls != NULL)
1171 { 1363 {
1172 if (!(mcomboBox_falls->selectByValue(stranim.c_str()))) mcomboBox_falls->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1364 if (!(mComboBox_falls->selectByValue(stranim.c_str())))
1365 {
1366 mComboBox_falls->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1367 }
1173 } 1368 }
1174 } 1369 }
1175 break; 1370 break;
1176 case STATE_AGENT_HOVER: 1371 case STATE_AGENT_HOVER:
1177 { 1372 {
1178 if (sInstance && (mcomboBox_hovers != NULL)) 1373 if (sInstance && mComboBox_hovers != NULL)
1179 { 1374 {
1180 if (!(mcomboBox_hovers->selectByValue(stranim.c_str()))) mcomboBox_hovers->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1375 if (!(mComboBox_hovers->selectByValue(stranim.c_str())))
1376 {
1377 mComboBox_hovers->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1378 }
1181 } 1379 }
1182 } 1380 }
1183 break; 1381 break;
1184 case STATE_AGENT_FLY: 1382 case STATE_AGENT_FLY:
1185 { 1383 {
1186 if (sInstance && (mcomboBox_flys != NULL)) 1384 if (sInstance && mComboBox_flys != NULL)
1187 { 1385 {
1188 if (!(mcomboBox_flys->selectByValue(stranim.c_str()))) mcomboBox_flys->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1386 if (!(mComboBox_flys->selectByValue(stranim.c_str())))
1387 {
1388 mComboBox_flys->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1389 }
1189 } 1390 }
1190 } 1391 }
1191 break; 1392 break;
1192 case STATE_AGENT_FLYSLOW: 1393 case STATE_AGENT_FLYSLOW:
1193 { 1394 {
1194 if (sInstance && (mcomboBox_flyslows != NULL)) 1395 if (sInstance && mComboBox_flyslows != NULL)
1195 { 1396 {
1196 if (!(mcomboBox_flyslows->selectByValue(stranim.c_str()))) mcomboBox_flyslows->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1397 if (!(mComboBox_flyslows->selectByValue(stranim.c_str())))
1398 {
1399 mComboBox_flyslows->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1400 }
1197 } 1401 }
1198 } 1402 }
1199 break; 1403 break;
1200 case STATE_AGENT_HOVER_UP: 1404 case STATE_AGENT_HOVER_UP:
1201 { 1405 {
1202 if (sInstance && (mcomboBox_flyups != NULL)) 1406 if (sInstance && mComboBox_flyups != NULL)
1203 { 1407 {
1204 if (!(mcomboBox_flyups->selectByValue(stranim.c_str()))) mcomboBox_flyups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1408 if (!(mComboBox_flyups->selectByValue(stranim.c_str())))
1409 {
1410 mComboBox_flyups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1411 }
1205 } 1412 }
1206 } 1413 }
1207 break; 1414 break;
1208 case STATE_AGENT_HOVER_DOWN: 1415 case STATE_AGENT_HOVER_DOWN:
1209 { 1416 {
1210 if (sInstance && (mcomboBox_flydowns != NULL)) 1417 if (sInstance && mComboBox_flydowns != NULL)
1211 { 1418 {
1212 if (!(mcomboBox_flydowns->selectByValue(stranim.c_str()))) mcomboBox_flydowns->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1419 if (!(mComboBox_flydowns->selectByValue(stranim.c_str())))
1420 {
1421 mComboBox_flydowns->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1422 }
1213 } 1423 }
1214 } 1424 }
1215 break; 1425 break;
1216 case STATE_AGENT_LAND: 1426 case STATE_AGENT_LAND:
1217 { 1427 {
1218 if (sInstance && (mcomboBox_lands != NULL)) 1428 if (sInstance && mComboBox_lands != NULL)
1219 { 1429 {
1220 if (!(mcomboBox_lands->selectByValue(stranim.c_str()))) mcomboBox_lands->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1430 if (!(mComboBox_lands->selectByValue(stranim.c_str())))
1431 {
1432 mComboBox_lands->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1433 }
1221 } 1434 }
1222 } 1435 }
1223 break; 1436 break;
1224 case STATE_AGENT_STANDUP: 1437 case STATE_AGENT_STANDUP:
1225 { 1438 {
1226 if (sInstance && (mcomboBox_standups != NULL)) 1439 if (sInstance && mComboBox_standups != NULL)
1227 { 1440 {
1228 if (!(mcomboBox_standups->selectByValue(stranim.c_str()))) mcomboBox_standups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1441 if (!(mComboBox_standups->selectByValue(stranim.c_str())))
1442 {
1443 mComboBox_standups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1444 }
1229 } 1445 }
1230 } 1446 }
1231 break; 1447 break;
1232 case STATE_AGENT_PRE_JUMP: 1448 case STATE_AGENT_PRE_JUMP:
1233 { 1449 {
1234 if (sInstance && (mcomboBox_prejumps != NULL)) 1450 if (sInstance && mComboBox_prejumps != NULL)
1235 { 1451 {
1236 if (!(mcomboBox_prejumps->selectByValue(stranim.c_str()))) mcomboBox_prejumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1452 if (!(mComboBox_prejumps->selectByValue(stranim.c_str())))
1453 {
1454 mComboBox_prejumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1455 }
1237 } 1456 }
1238 } 1457 }
1239 break; 1458 break;
@@ -1259,113 +1478,161 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA
1259 case STATE_AGENT_WALK: 1478 case STATE_AGENT_WALK:
1260 { 1479 {
1261 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultWalk"); 1480 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultWalk");
1262 SetDefault(mcomboBox_walks,iter->ao_id,defaultanim); 1481 setDefault(mComboBox_walks, iter->ao_id,defaultanim);
1263 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1482 if (getAssetIDByName(defaultanim) != LLUUID::null)
1483 {
1484 iter->ao_id = getAssetIDByName(defaultanim);
1485 }
1264 } 1486 }
1265 break; 1487 break;
1266 case STATE_AGENT_RUN: 1488 case STATE_AGENT_RUN:
1267 { 1489 {
1268 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultRun"); 1490 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultRun");
1269 SetDefault(mcomboBox_runs,iter->ao_id,defaultanim); 1491 setDefault(mComboBox_runs, iter->ao_id,defaultanim);
1270 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1492 if (getAssetIDByName(defaultanim) != LLUUID::null)
1493 {
1494 iter->ao_id = getAssetIDByName(defaultanim);
1495 }
1271 } 1496 }
1272 break; 1497 break;
1273 case STATE_AGENT_JUMP: 1498 case STATE_AGENT_JUMP:
1274 { 1499 {
1275 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultJump"); 1500 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultJump");
1276 SetDefault(mcomboBox_jumps,iter->ao_id,defaultanim); 1501 setDefault(mComboBox_jumps, iter->ao_id,defaultanim);
1277 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1502 if (getAssetIDByName(defaultanim) != LLUUID::null)
1503 {
1504 iter->ao_id = getAssetIDByName(defaultanim);
1505 }
1278 } 1506 }
1279 break; 1507 break;
1280 case STATE_AGENT_SIT: 1508 case STATE_AGENT_SIT:
1281 { 1509 {
1282 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultSit"); 1510 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultSit");
1283 SetDefault(mcomboBox_sits,iter->ao_id,defaultanim); 1511 setDefault(mComboBox_sits, iter->ao_id,defaultanim);
1284 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1512 if (getAssetIDByName(defaultanim) != LLUUID::null)
1513 {
1514 iter->ao_id = getAssetIDByName(defaultanim);
1515 }
1285 } 1516 }
1286 break; 1517 break;
1287 case STATE_AGENT_CROUCH: 1518 case STATE_AGENT_CROUCH:
1288 { 1519 {
1289 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouch"); 1520 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouch");
1290 SetDefault(mcomboBox_crouchs,iter->ao_id,defaultanim); 1521 setDefault(mComboBox_crouchs,iter->ao_id,defaultanim);
1291 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1522 if (getAssetIDByName(defaultanim) != LLUUID::null)
1523 {
1524 iter->ao_id = getAssetIDByName(defaultanim);
1525 }
1292 } 1526 }
1293 break; 1527 break;
1294 case STATE_AGENT_GROUNDSIT: 1528 case STATE_AGENT_GROUNDSIT:
1295 { 1529 {
1296 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultGroundSit"); 1530 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultGroundSit");
1297 SetDefault(mcomboBox_gsits,iter->ao_id,defaultanim); 1531 setDefault(mComboBox_gsits,iter->ao_id,defaultanim);
1298 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1532 if (getAssetIDByName(defaultanim) != LLUUID::null)
1533 {
1534 iter->ao_id = getAssetIDByName(defaultanim);
1535 }
1299 } 1536 }
1300 break; 1537 break;
1301 case STATE_AGENT_CROUCHWALK: 1538 case STATE_AGENT_CROUCHWALK:
1302 { 1539 {
1303 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouchWalk"); 1540 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouchWalk");
1304 SetDefault(mcomboBox_cwalks,iter->ao_id,defaultanim); 1541 setDefault(mComboBox_cwalks,iter->ao_id,defaultanim);
1305 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1542 if (getAssetIDByName(defaultanim) != LLUUID::null)
1543 {
1544 iter->ao_id = getAssetIDByName(defaultanim);
1545 }
1306 } 1546 }
1307 break; 1547 break;
1308 case STATE_AGENT_FALLDOWN: 1548 case STATE_AGENT_FALLDOWN:
1309 { 1549 {
1310 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFall"); 1550 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFall");
1311 SetDefault(mcomboBox_falls,iter->ao_id,defaultanim); 1551 setDefault(mComboBox_falls,iter->ao_id,defaultanim);
1312 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1552 if (getAssetIDByName(defaultanim) != LLUUID::null)
1553 {
1554 iter->ao_id = getAssetIDByName(defaultanim);
1555 }
1313 } 1556 }
1314 break; 1557 break;
1315 case STATE_AGENT_HOVER: 1558 case STATE_AGENT_HOVER:
1316 { 1559 {
1317 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultHover"); 1560 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultHover");
1318 SetDefault(mcomboBox_hovers,iter->ao_id,defaultanim); 1561 setDefault(mComboBox_hovers,iter->ao_id,defaultanim);
1319 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1562 if (getAssetIDByName(defaultanim) != LLUUID::null)
1563 {
1564 iter->ao_id = getAssetIDByName(defaultanim);
1565 }
1320 } 1566 }
1321 break; 1567 break;
1322 case STATE_AGENT_FLY: 1568 case STATE_AGENT_FLY:
1323 { 1569 {
1324 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFly"); 1570 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFly");
1325 SetDefault(mcomboBox_flys,iter->ao_id,defaultanim); 1571 setDefault(mComboBox_flys,iter->ao_id,defaultanim);
1326 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1572 if (getAssetIDByName(defaultanim) != LLUUID::null)
1573 {
1574 iter->ao_id = getAssetIDByName(defaultanim);
1575 }
1327 } 1576 }
1328 break; 1577 break;
1329 case STATE_AGENT_HOVER_UP: 1578 case STATE_AGENT_HOVER_UP:
1330 { 1579 {
1331 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyUp"); 1580 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyUp");
1332 SetDefault(mcomboBox_flyups,iter->ao_id,defaultanim); 1581 setDefault(mComboBox_flyups,iter->ao_id,defaultanim);
1333 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1582 if (getAssetIDByName(defaultanim) != LLUUID::null)
1583 {
1584 iter->ao_id = getAssetIDByName(defaultanim);
1585 }
1334 } 1586 }
1335 break; 1587 break;
1336 case STATE_AGENT_FLYSLOW: 1588 case STATE_AGENT_FLYSLOW:
1337 { 1589 {
1338 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlySlow"); 1590 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlySlow");
1339 SetDefault(mcomboBox_flyslows,iter->ao_id,defaultanim); 1591 setDefault(mComboBox_flyslows,iter->ao_id,defaultanim);
1340 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1592 if (getAssetIDByName(defaultanim) != LLUUID::null)
1593 {
1594 iter->ao_id = getAssetIDByName(defaultanim);
1595 }
1341 } 1596 }
1342 break; 1597 break;
1343 case STATE_AGENT_HOVER_DOWN: 1598 case STATE_AGENT_HOVER_DOWN:
1344 { 1599 {
1345 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyDown"); 1600 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyDown");
1346 SetDefault(mcomboBox_flydowns,iter->ao_id,defaultanim); 1601 setDefault(mComboBox_flydowns,iter->ao_id,defaultanim);
1347 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1602 if (getAssetIDByName(defaultanim) != LLUUID::null)
1603 {
1604 iter->ao_id = getAssetIDByName(defaultanim);
1605 }
1348 } 1606 }
1349 break; 1607 break;
1350 case STATE_AGENT_LAND: 1608 case STATE_AGENT_LAND:
1351 { 1609 {
1352 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultLand"); 1610 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultLand");
1353 SetDefault(mcomboBox_lands,iter->ao_id,defaultanim); 1611 setDefault(mComboBox_lands,iter->ao_id,defaultanim);
1354 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1612 if (getAssetIDByName(defaultanim) != LLUUID::null)
1613 {
1614 iter->ao_id = getAssetIDByName(defaultanim);
1615 }
1355 } 1616 }
1356 break; 1617 break;
1357 case STATE_AGENT_STANDUP: 1618 case STATE_AGENT_STANDUP:
1358 { 1619 {
1359 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultStandUp"); 1620 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultStandUp");
1360 SetDefault(mcomboBox_standups,iter->ao_id,defaultanim); 1621 setDefault(mComboBox_standups,iter->ao_id,defaultanim);
1361 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1622 if (getAssetIDByName(defaultanim) != LLUUID::null)
1623 {
1624 iter->ao_id = getAssetIDByName(defaultanim);
1625 }
1362 } 1626 }
1363 break; 1627 break;
1364 case STATE_AGENT_PRE_JUMP: 1628 case STATE_AGENT_PRE_JUMP:
1365 { 1629 {
1366 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultPreJump"); 1630 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultPreJump");
1367 SetDefault(mcomboBox_prejumps,iter->ao_id,defaultanim); 1631 setDefault(mComboBox_prejumps,iter->ao_id,defaultanim);
1368 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1632 if (getAssetIDByName(defaultanim) != LLUUID::null)
1633 {
1634 iter->ao_id = getAssetIDByName(defaultanim);
1635 }
1369 } 1636 }
1370 break; 1637 break;
1371 } 1638 }
@@ -1384,7 +1651,8 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA
1384 } 1651 }
1385} 1652}
1386 1653
1387BOOL LLFloaterAO::SetDefault(void* userdata, LLUUID ao_id, std::string defaultanim) 1654// static
1655bool LLFloaterAO::setDefault(void* userdata, LLUUID ao_id, std::string defaultanim)
1388{ 1656{
1389 if (sInstance && (userdata)) 1657 if (sInstance && (userdata))
1390 { 1658 {
@@ -1427,14 +1695,18 @@ private:
1427 std::string sName; 1695 std::string sName;
1428}; 1696};
1429 1697
1698// static
1430const LLUUID& LLFloaterAO::getAssetIDByName(const std::string& name) 1699const LLUUID& LLFloaterAO::getAssetIDByName(const std::string& name)
1431{ 1700{
1432 if (name.empty() || !(gInventory.isEverythingFetched())) return LLUUID::null; 1701 if (name.empty())
1702 {
1703 return LLUUID::null;
1704 }
1433 1705
1434 LLViewerInventoryCategory::cat_array_t cats; 1706 LLViewerInventoryCategory::cat_array_t cats;
1435 LLViewerInventoryItem::item_array_t items; 1707 LLViewerInventoryItem::item_array_t items;
1436 ObjectNameMatches objectnamematches(name); 1708 ObjectNameMatches objectnamematches(name);
1437 gInventory.collectDescendentsIf(LLUUID::null,cats,items,FALSE,objectnamematches); 1709 gInventory.collectDescendentsIf(LLUUID::null, cats, items, FALSE, objectnamematches);
1438 1710
1439 if (items.count()) 1711 if (items.count())
1440 { 1712 {
diff --git a/linden/indra/newview/floaterao.h b/linden/indra/newview/floaterao.h
index 465f32e..45fd7af 100644
--- a/linden/indra/newview/floaterao.h
+++ b/linden/indra/newview/floaterao.h
@@ -9,35 +9,35 @@
9 9
10class AONoteCardDropTarget; 10class AONoteCardDropTarget;
11 11
12const int STATE_AGENT_IDLE = 0; 12const S32 STATE_AGENT_IDLE = 0;
13const int STATE_AGENT_WALK = 1; 13const S32 STATE_AGENT_WALK = 1;
14const int STATE_AGENT_RUN = 2; 14const S32 STATE_AGENT_RUN = 2;
15const int STATE_AGENT_STAND = 3; 15const S32 STATE_AGENT_STAND = 3;
16 16
17const int STATE_AGENT_PRE_JUMP = 4; 17const S32 STATE_AGENT_PRE_JUMP = 4;
18const int STATE_AGENT_JUMP = 5; 18const S32 STATE_AGENT_JUMP = 5;
19const int STATE_AGENT_TURNLEFT = 6; 19const S32 STATE_AGENT_TURNLEFT = 6;
20const int STATE_AGENT_TURNRIGHT = 7; 20const S32 STATE_AGENT_TURNRIGHT = 7;
21 21
22const int STATE_AGENT_SIT = 8; 22const S32 STATE_AGENT_SIT = 8;
23const int STATE_AGENT_GROUNDSIT = 9; 23const S32 STATE_AGENT_GROUNDSIT = 9;
24 24
25const int STATE_AGENT_HOVER = 10; 25const S32 STATE_AGENT_HOVER = 10;
26const int STATE_AGENT_HOVER_DOWN = 11; 26const S32 STATE_AGENT_HOVER_DOWN = 11;
27const int STATE_AGENT_HOVER_UP = 12; 27const S32 STATE_AGENT_HOVER_UP = 12;
28
29const int STATE_AGENT_CROUCH = 13;
30const int STATE_AGENT_CROUCHWALK = 14;
31const int STATE_AGENT_FALLDOWN = 15;
32const int STATE_AGENT_STANDUP = 16;
33const int STATE_AGENT_LAND = 17;
34
35const int STATE_AGENT_FLY = 18;
36const int STATE_AGENT_FLYSLOW = 19;
37 28
29const S32 STATE_AGENT_CROUCH = 13;
30const S32 STATE_AGENT_CROUCHWALK = 14;
31const S32 STATE_AGENT_FALLDOWN = 15;
32const S32 STATE_AGENT_STANDUP = 16;
33const S32 STATE_AGENT_LAND = 17;
38 34
35const S32 STATE_AGENT_FLY = 18;
36const S32 STATE_AGENT_FLYSLOW = 19;
39 37
40 38
39class LLFrameTimer;
40class LLComboBox;
41 41
42class AOStandTimer : public LLEventTimer 42class AOStandTimer : public LLEventTimer
43{ 43{
@@ -51,10 +51,12 @@ public:
51class AOInvTimer : public LLEventTimer 51class AOInvTimer : public LLEventTimer
52{ 52{
53public: 53public:
54 static BOOL fullfetch;
55 AOInvTimer(); 54 AOInvTimer();
56 ~AOInvTimer(); 55 ~AOInvTimer();
57 BOOL tick(); 56 BOOL tick();
57
58private:
59 static BOOL sInitialized;
58}; 60};
59 61
60class LLFloaterAO : public LLFloater 62class LLFloaterAO : public LLFloater
@@ -66,7 +68,7 @@ public:
66 virtual ~LLFloaterAO(); 68 virtual ~LLFloaterAO();
67 69
68 static void show(void*); 70 static void show(void*);
69 static void init(); 71 static bool init();
70 72
71 static void onClickToggleAO(LLUICtrl *, void*); 73 static void onClickToggleAO(LLUICtrl *, void*);
72 static void onClickToggleSits(LLUICtrl *, void*); 74 static void onClickToggleSits(LLUICtrl *, void*);
@@ -75,13 +77,13 @@ public:
75 77
76 static BOOL loadAnims(); 78 static BOOL loadAnims();
77 79
78 static int getAnimationState(); 80 static S32 getAnimationState();
79 static void setAnimationState(int state); 81 static void setAnimationState(S32 state);
80 static void setStates(const LLUUID& id, BOOL start); 82 static void setStates(const LLUUID& id, BOOL start);
81 83
82 static LLUUID getCurrentStandId(); 84 static LLUUID getCurrentStandId();
83 static void setCurrentStandId(const LLUUID& id); 85 static void setCurrentStandId(const LLUUID& id);
84 static int stand_iterator; 86 static S32 stand_iterator;
85 static BOOL ChangeStand(); 87 static BOOL ChangeStand();
86 88
87 static BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f, BOOL stand = FALSE); 89 static BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f, BOOL stand = FALSE);
@@ -89,9 +91,9 @@ public:
89 91
90 static LLUUID GetAnimID(const LLUUID& id); 92 static LLUUID GetAnimID(const LLUUID& id);
91 93
92 static int GetStateFromAnimID(const LLUUID& id); 94 static S32 GetStateFromAnimID(const LLUUID& id);
93 static LLUUID GetAnimIDFromState(const int state); 95 static LLUUID GetAnimIDFromState(const S32 state);
94 static int GetStateFromToken(std::string strtoken); 96 static S32 GetStateFromToken(std::string strtoken);
95 97
96 static void onClickLess(void* data) ; 98 static void onClickLess(void* data) ;
97 static void onClickMore(void* data) ; 99 static void onClickMore(void* data) ;
@@ -105,19 +107,20 @@ public:
105 static LLUUID invfolderid; 107 static LLUUID invfolderid;
106 static const LLUUID& getAssetIDByName(const std::string& name); 108 static const LLUUID& getAssetIDByName(const std::string& name);
107 109
108 static bool getInstance(); 110 static LLFloaterAO* getInstance();
111 static bool getVisible();
109 112
110private: 113private:
111 114
112 static LLFloaterAO* sInstance; 115 static LLFloaterAO* sInstance;
113 static int mAnimationState; 116 static S32 sAnimationState;
114 static LLUUID mCurrentStandId; 117 static LLUUID sCurrentStandId;
115 118
116 static AONoteCardDropTarget* mAOItemDropTarget; 119 static AONoteCardDropTarget* sAOItemDropTarget;
117 static void AOItemDrop(LLViewerInventoryItem* item); 120 static void AOItemDrop(LLViewerInventoryItem* item);
118 static void onSpinnerCommit(LLUICtrl* ctrl, void* userdata); 121 static void onSpinnerCommit(LLUICtrl* ctrl, void* userdata);
119 static void onComboBoxCommit(LLUICtrl* ctrl, void* userdata); 122 static void onComboBoxCommit(LLUICtrl* ctrl, void* userdata);
120 static BOOL SetDefault(void *userdata, LLUUID ao_id, std::string defaultanim); 123 static bool setDefault(void *userdata, LLUUID ao_id, std::string defaultanim);
121 124
122 BOOL mDirty; 125 BOOL mDirty;
123 126
diff --git a/linden/indra/newview/hippolimits.cpp b/linden/indra/newview/hippolimits.cpp
index 2990a45..2c581ae 100644
--- a/linden/indra/newview/hippolimits.cpp
+++ b/linden/indra/newview/hippolimits.cpp
@@ -24,7 +24,8 @@ HippoLimits::HippoLimits()
24 mMaxPrimScale(256.0f), 24 mMaxPrimScale(256.0f),
25 mMaxLinkedPrims(-1), 25 mMaxLinkedPrims(-1),
26 mMaxDragDistance(0.f), 26 mMaxDragDistance(0.f),
27 mVoiceConnector("SLVoice") 27 mVoiceConnector("SLVoice"),
28 mMaxSelectDistance(64.0f)
28{ 29{
29 setLimits(); 30 setLimits();
30} 31}
@@ -71,6 +72,7 @@ void HippoLimits::setOpenSimLimits()
71 mEnforceMaxBuild = FALSE; 72 mEnforceMaxBuild = FALSE;
72 mRenderWater = TRUE; 73 mRenderWater = TRUE;
73 mVoiceConnector = "SLVoice"; 74 mVoiceConnector = "SLVoice";
75 mMaxSelectDistance = 192.0f;
74 76
75 if (gHippoGridManager->getConnectedGrid()->isRenderCompat()) { 77 if (gHippoGridManager->getConnectedGrid()->isRenderCompat()) {
76 llinfos << "Using rendering compatible OpenSim limits" << llendl; 78 llinfos << "Using rendering compatible OpenSim limits" << llendl;
@@ -114,6 +116,7 @@ void HippoLimits::setSecondLifeLimits()
114 mEnforceMaxBuild = FALSE; 116 mEnforceMaxBuild = FALSE;
115 mRenderWater = TRUE; 117 mRenderWater = TRUE;
116 mVoiceConnector = "SLVoice"; 118 mVoiceConnector = "SLVoice";
119 mMaxSelectDistance = 64.0f;
117} 120}
118 121
119void HippoLimits::setSecondLifeMaxPrimScale() 122void HippoLimits::setSecondLifeMaxPrimScale()
diff --git a/linden/indra/newview/hippolimits.h b/linden/indra/newview/hippolimits.h
index d63d1b0..9cc6160 100644
--- a/linden/indra/newview/hippolimits.h
+++ b/linden/indra/newview/hippolimits.h
@@ -15,6 +15,7 @@ public:
15 const S32& getMaxPhysLinkedPrims() const { return mMaxPhysLinkedPrims; } 15 const S32& getMaxPhysLinkedPrims() const { return mMaxPhysLinkedPrims; }
16 const F32& getMaxInventoryItemsTransfer() const { return mMaxInventoryItemsTransfer; } 16 const F32& getMaxInventoryItemsTransfer() const { return mMaxInventoryItemsTransfer; }
17 const std::string& getVoiceConnector() const { return mVoiceConnector; } 17 const std::string& getVoiceConnector() const { return mVoiceConnector; }
18 const F32& getMaxSelectDistance() const { return mMaxSelectDistance; }
18 19
19 // Returns the max prim size we can use on a grid 20 // Returns the max prim size we can use on a grid
20 F32 getMinPrimScale() const; 21 F32 getMinPrimScale() const;
@@ -46,6 +47,7 @@ public:
46 F32 mMinPrimXPos; 47 F32 mMinPrimXPos;
47 F32 mMinPrimYPos; 48 F32 mMinPrimYPos;
48 F32 mMinPrimZPos; 49 F32 mMinPrimZPos;
50 F32 mMaxSelectDistance;
49 51
50 S32 mRenderName; 52 S32 mRenderName;
51 53
diff --git a/linden/indra/newview/llglsandbox.cpp b/linden/indra/newview/llglsandbox.cpp
index 96fd39b..61d0994 100644
--- a/linden/indra/newview/llglsandbox.cpp
+++ b/linden/indra/newview/llglsandbox.cpp
@@ -68,6 +68,8 @@
68#include "llresmgr.h" 68#include "llresmgr.h"
69#include "pipeline.h" 69#include "pipeline.h"
70#include "llspatialpartition.h" 70#include "llspatialpartition.h"
71
72#include "hippolimits.h"
71 73
72// [RLVa:KB] 74// [RLVa:KB]
73#include "rlvhandler.h" 75#include "rlvhandler.h"
@@ -180,7 +182,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
180// [/RLVa:KB] 182// [/RLVa:KB]
181 183
182 LLVector3 av_pos = gAgent.getPositionAgent(); 184 LLVector3 av_pos = gAgent.getPositionAgent();
183 F32 select_dist_squared = gSavedSettings.getF32("MaxSelectDistance"); 185 F32 select_dist_squared = gHippoLimits->getMaxSelectDistance();
184 select_dist_squared = select_dist_squared * select_dist_squared; 186 select_dist_squared = select_dist_squared * select_dist_squared;
185 187
186 BOOL deselect = (mask == MASK_CONTROL); 188 BOOL deselect = (mask == MASK_CONTROL);
@@ -228,15 +230,15 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
228 glMatrixMode(GL_PROJECTION); 230 glMatrixMode(GL_PROJECTION);
229 gGL.pushMatrix(); 231 gGL.pushMatrix();
230 232
231 BOOL limit_select_distance = gSavedSettings.getBOOL("LimitSelectDistance"); 233 BOOL limit_select_distance = (!gSavedSettings.getBOOL("DisableMaxBuildConstraints") && gSavedSettings.getBOOL("LimitSelectDistance"));
232 if (limit_select_distance) 234 if (limit_select_distance)
233 { 235 {
234 // ...select distance from control 236 // ...select distance from control
235 LLVector3 relative_av_pos = av_pos; 237 LLVector3 relative_av_pos = av_pos;
236 relative_av_pos -= LLViewerCamera::getInstance()->getOrigin(); 238 relative_av_pos -= LLViewerCamera::getInstance()->getOrigin();
237 239
238 F32 new_far = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() + gSavedSettings.getF32("MaxSelectDistance"); 240 F32 new_far = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() + gHippoLimits->getMaxSelectDistance();
239 F32 new_near = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() - gSavedSettings.getF32("MaxSelectDistance"); 241 F32 new_near = relative_av_pos * LLViewerCamera::getInstance()->getAtAxis() - gHippoLimits->getMaxSelectDistance();
240 242
241 new_near = llmax(new_near, 0.1f); 243 new_near = llmax(new_near, 0.1f);
242 244
diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp
index 1c7a049..58a2bdc 100644
--- a/linden/indra/newview/llinventorymodel.cpp
+++ b/linden/indra/newview/llinventorymodel.cpp
@@ -186,7 +186,16 @@ LLInventoryModel gInventory;
186// Default constructor 186// Default constructor
187LLInventoryModel::LLInventoryModel() : 187LLInventoryModel::LLInventoryModel() :
188 mModifyMask(LLInventoryObserver::ALL), 188 mModifyMask(LLInventoryObserver::ALL),
189 mChangedItemIDs(),
190 mCategoryMap(),
191 mItemMap(),
192 mCategoryLock(),
193 mItemLock(),
189 mLastItem(NULL), 194 mLastItem(NULL),
195 mAnimationsFolderUUID(LLUUID::null),
196 mParentChildCategoryTree(),
197 mParentChildItemTree(),
198 mObservers(),
190 mIsAgentInvUsable(false) 199 mIsAgentInvUsable(false)
191{ 200{
192} 201}
@@ -404,7 +413,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
404 413
405 if(preferred_type == LLAssetType::AT_SIMSTATE) 414 if(preferred_type == LLAssetType::AT_SIMSTATE)
406 { 415 {
407 lldebugs << "Attempt to create simstate category." << llendl; 416 LL_DEBUGS("Inventory") << "Attempt to create simstate category." << LL_ENDL;
408 return id; 417 return id;
409 } 418 }
410 419
@@ -761,7 +770,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat)
761 770
762void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) 771void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id)
763{ 772{
764 lldebugs << "LLInventoryModel::moveObject()" << llendl; 773 LL_DEBUGS("Inventory") << "LLInventoryModel::moveObject()" << LL_ENDL;
765 if(!isInventoryUsable()) 774 if(!isInventoryUsable())
766 { 775 {
767 llwarns << "Inventory is broken." << llendl; 776 llwarns << "Inventory is broken." << llendl;
@@ -803,11 +812,11 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id)
803// Delete a particular inventory object by ID. 812// Delete a particular inventory object by ID.
804void LLInventoryModel::deleteObject(const LLUUID& id) 813void LLInventoryModel::deleteObject(const LLUUID& id)
805{ 814{
806 lldebugs << "LLInventoryModel::deleteObject()" << llendl; 815 LL_DEBUGS("Inventory") << "LLInventoryModel::deleteObject()" << LL_ENDL;
807 LLPointer<LLInventoryObject> obj = getObject(id); 816 LLPointer<LLInventoryObject> obj = getObject(id);
808 if(obj) 817 if(obj)
809 { 818 {
810 lldebugs << "Deleting inventory object " << id << llendl; 819 LL_DEBUGS("Inventory") << "Deleting inventory object " << id << LL_ENDL;
811 mLastItem = NULL; 820 mLastItem = NULL;
812 LLUUID parent_id = obj->getParentUUID(); 821 LLUUID parent_id = obj->getParentUUID();
813 mCategoryMap.erase(id); 822 mCategoryMap.erase(id);
@@ -1103,8 +1112,8 @@ void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content)
1103 LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; 1112 LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
1104 titem->unpackMessage(content["items"][i]); 1113 titem->unpackMessage(content["items"][i]);
1105 1114
1106 lldebugs << "LLInventoryModel::messageUpdateCore() item id:" 1115 LL_DEBUGS("Inventory") << "LLInventoryModel::messageUpdateCore() item id:"
1107 << titem->getUUID() << llendl; 1116 << titem->getUUID() << LL_ENDL;
1108 items.push_back(titem); 1117 items.push_back(titem);
1109 // examine update for changes. 1118 // examine update for changes.
1110 LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID()); 1119 LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID());
@@ -1673,8 +1682,8 @@ void LLInventoryModel::cache(
1673 const LLUUID& parent_folder_id, 1682 const LLUUID& parent_folder_id,
1674 const LLUUID& agent_id) 1683 const LLUUID& agent_id)
1675{ 1684{
1676 lldebugs << "Caching " << parent_folder_id << " for " << agent_id 1685 LL_DEBUGS("Inventory") << "Caching " << parent_folder_id << " for " << agent_id
1677 << llendl; 1686 << LL_ENDL;
1678 LLViewerInventoryCategory* root_cat = getCategory(parent_folder_id); 1687 LLViewerInventoryCategory* root_cat = getCategory(parent_folder_id);
1679 if(!root_cat) return; 1688 if(!root_cat) return;
1680 cat_array_t categories; 1689 cat_array_t categories;
@@ -1699,7 +1708,7 @@ void LLInventoryModel::cache(
1699 gzip_filename.append(".gz"); 1708 gzip_filename.append(".gz");
1700 if(gzip_file(inventory_filename, gzip_filename)) 1709 if(gzip_file(inventory_filename, gzip_filename))
1701 { 1710 {
1702 lldebugs << "Successfully compressed " << inventory_filename << llendl; 1711 LL_DEBUGS("Inventory") << "Successfully compressed " << inventory_filename << LL_ENDL;
1703 LLFile::remove(inventory_filename); 1712 LLFile::remove(inventory_filename);
1704 } 1713 }
1705 else 1714 else
@@ -1781,8 +1790,8 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update)
1781 } 1790 }
1782 if(!accounted) 1791 if(!accounted)
1783 { 1792 {
1784 lldebugs << "No accounting for: '" << cat->getName() << "' " 1793 LL_DEBUGS("Inventory") << "No accounting for: '" << cat->getName() << "' "
1785 << version << llendl; 1794 << version << LL_ENDL;
1786 } 1795 }
1787 } 1796 }
1788 else 1797 else
@@ -1914,40 +1923,72 @@ bool LLInventoryModel::isCategoryComplete(const LLUUID& cat_id) const
1914 return false; 1923 return false;
1915} 1924}
1916 1925
1917bool LLInventoryModel::loadSkeleton( 1926bool LLInventoryModel::loadSkeleton(const LLInventoryModel::options_t& options,
1918 const LLInventoryModel::options_t& options, 1927 const LLUUID& owner_id)
1919 const LLUUID& owner_id)
1920{ 1928{
1921 lldebugs << "importing inventory skeleton for " << owner_id << llendl; 1929 LL_DEBUGS("Inventory") << "importing inventory skeleton for " << owner_id << LL_ENDL;
1922 1930
1923 typedef std::set<LLPointer<LLViewerInventoryCategory>, InventoryIDPtrLess> cat_set_t; 1931 typedef std::set<LLPointer<LLViewerInventoryCategory>, InventoryIDPtrLess> cat_set_t;
1924 cat_set_t temp_cats; 1932 cat_set_t temp_cats;
1925 1933
1926 update_map_t child_counts; 1934 update_map_t child_counts;
1927
1928 LLUUID id; 1935 LLUUID id;
1929 LLAssetType::EType preferred_type; 1936 LLAssetType::EType preferred_type;
1930 bool rv = true; 1937 bool rv = true;
1931 for(options_t::const_iterator it = options.begin(); it < options.end(); ++it) 1938 bool clean_cat = false;
1939
1940 for (options_t::const_iterator it = options.begin(); it < options.end(); ++it)
1932 { 1941 {
1933 LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id); 1942 LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id);
1943
1934 response_t::const_iterator no_response = (*it).end(); 1944 response_t::const_iterator no_response = (*it).end();
1935 response_t::const_iterator skel; 1945 response_t::const_iterator skel;
1936 skel = (*it).find("name"); 1946
1937 if(skel == no_response) goto clean_cat; 1947 clean_cat = false;
1938 cat->rename(std::string((*skel).second)); 1948
1939 skel = (*it).find("folder_id"); 1949 skel = (*it).find("folder_id");
1940 if(skel == no_response) goto clean_cat; 1950 if (skel == no_response)
1941 id.set((*skel).second); 1951 {
1952 clean_cat = true;
1953 }
1954 else
1955 {
1956 id.set((*skel).second);
1957 }
1958
1942 // if an id is null, it locks the viewer. 1959 // if an id is null, it locks the viewer.
1943 if(id.isNull()) goto clean_cat; 1960 if (id.isNull())
1944 cat->setUUID(id); 1961 {
1962 clean_cat = true;
1963 }
1964 else
1965 {
1966 cat->setUUID(id);
1967 }
1968
1945 skel = (*it).find("parent_id"); 1969 skel = (*it).find("parent_id");
1946 if(skel == no_response) goto clean_cat; 1970 if (skel == no_response)
1947 id.set((*skel).second); 1971 {
1948 cat->setParent(id); 1972 clean_cat = true;
1973 }
1974 else
1975 {
1976 id.set((*skel).second);
1977 cat->setParent(id);
1978 }
1979
1980 skel = (*it).find("name");
1981 if (skel == no_response)
1982 {
1983 clean_cat = true;
1984 }
1985 else
1986 {
1987 cat->rename(std::string((*skel).second));
1988 }
1989
1949 skel = (*it).find("type_default"); 1990 skel = (*it).find("type_default");
1950 if(skel == no_response) 1991 if (skel == no_response)
1951 { 1992 {
1952 preferred_type = LLAssetType::AT_NONE; 1993 preferred_type = LLAssetType::AT_NONE;
1953 } 1994 }
@@ -1955,40 +1996,71 @@ bool LLInventoryModel::loadSkeleton(
1955 { 1996 {
1956 S32 t = atoi((*skel).second.c_str()); 1997 S32 t = atoi((*skel).second.c_str());
1957 preferred_type = (LLAssetType::EType)t; 1998 preferred_type = (LLAssetType::EType)t;
1999
2000 // This UUID is different for each avatar and "Animations" is hardcoded into the skeleton -- MC
2001 if (LLAssetType::AT_ANIMATION == preferred_type && cat->getName() == "Animations")
2002 {
2003 //llinfos << "Animations folder uuid from skeleton: " << cat->getUUID() << llendl;
2004 mAnimationsFolderUUID = id;
2005 }
1958 } 2006 }
1959 cat->setPreferredType(preferred_type); 2007 cat->setPreferredType(preferred_type);
2008
1960 skel = (*it).find("version"); 2009 skel = (*it).find("version");
1961 if(skel == no_response) goto clean_cat; 2010 if (skel == no_response)
1962 cat->setVersion(atoi((*skel).second.c_str())); 2011 {
1963 temp_cats.insert(cat); 2012 clean_cat = true;
1964 continue; 2013 }
1965 clean_cat: 2014 else
1966 llwarns << "Unable to import near " << cat->getName() << llendl; 2015 {
1967 rv = false; 2016 cat->setVersion(atoi((*skel).second.c_str()));
1968 //delete cat; // automatic when cat is reasigned or destroyed 2017 }
2018
2019 if (clean_cat)
2020 {
2021 llwarns << "Unable to import near " << cat->getName() << llendl;
2022 rv = false;
2023 //delete cat; // automatic when cat is reasigned or destroyed
2024 temp_cats.clear();
2025 break;
2026 }
2027 else
2028 {
2029 temp_cats.insert(cat);
2030 }
1969 } 2031 }
1970 2032
1971 S32 cached_category_count = 0; 2033 S32 cached_category_count = 0;
1972 S32 cached_item_count = 0; 2034 S32 cached_item_count = 0;
1973 if(!temp_cats.empty()) 2035 if (temp_cats.empty())
2036 {
2037 LL_WARNS("Inventory") << "No categories found! Cannot continue!" << LL_ENDL;
2038 }
2039 else
1974 { 2040 {
1975 cat_array_t categories; 2041 cat_array_t categories;
1976 item_array_t items; 2042 item_array_t items;
1977 std::string owner_id_str; 2043 std::string owner_id_str;
1978 owner_id.toString(owner_id_str); 2044 owner_id.toString(owner_id_str);
2045
1979 std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str)); 2046 std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str));
1980 std::string inventory_filename; 2047 std::string inventory_filename;
1981 inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str()); 2048 inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str());
2049
1982 const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN; 2050 const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN;
2051
1983 std::string gzip_filename(inventory_filename); 2052 std::string gzip_filename(inventory_filename);
1984 gzip_filename.append(".gz"); 2053 gzip_filename.append(".gz");
1985 LLFILE* fp = LLFile::fopen(gzip_filename, "rb"); 2054 LLFILE* fp = LLFile::fopen(gzip_filename, "rb");
2055
1986 bool remove_inventory_file = false; 2056 bool remove_inventory_file = false;
1987 if(fp) 2057
2058 // try to ungzip the inventory -- MC
2059 if (fp)
1988 { 2060 {
1989 fclose(fp); 2061 fclose(fp);
1990 fp = NULL; 2062 fp = NULL;
1991 if(gunzip_file(gzip_filename, inventory_filename)) 2063 if (gunzip_file(gzip_filename, inventory_filename))
1992 { 2064 {
1993 // we only want to remove the inventory file if it was 2065 // we only want to remove the inventory file if it was
1994 // gzipped before we loaded, and we successfully 2066 // gzipped before we loaded, and we successfully
@@ -2000,7 +2072,9 @@ bool LLInventoryModel::loadSkeleton(
2000 llinfos << "Unable to gunzip " << gzip_filename << llendl; 2072 llinfos << "Unable to gunzip " << gzip_filename << llendl;
2001 } 2073 }
2002 } 2074 }
2003 if(loadFromFile(inventory_filename, categories, items)) 2075
2076 // begin cache loading -- MC
2077 if (loadFromFile(inventory_filename, categories, items))
2004 { 2078 {
2005 // We were able to find a cache of files. So, use what we 2079 // We were able to find a cache of files. So, use what we
2006 // found to generate a set of categories we should add. We 2080 // found to generate a set of categories we should add. We
@@ -2009,10 +2083,11 @@ bool LLInventoryModel::loadSkeleton(
2009 S32 count = categories.count(); 2083 S32 count = categories.count();
2010 cat_set_t::iterator not_cached = temp_cats.end(); 2084 cat_set_t::iterator not_cached = temp_cats.end();
2011 std::set<LLUUID> cached_ids; 2085 std::set<LLUUID> cached_ids;
2012 for(S32 i = 0; i < count; ++i) 2086 for (S32 i = 0; i < count; ++i)
2013 { 2087 {
2014 LLViewerInventoryCategory* cat = categories[i]; 2088 LLViewerInventoryCategory* cat = categories[i];
2015 cat_set_t::iterator cit = temp_cats.find(cat); 2089 cat_set_t::iterator cit = temp_cats.find(cat);
2090
2016 if (cit == temp_cats.end()) 2091 if (cit == temp_cats.end())
2017 { 2092 {
2018 continue; // cache corruption?? not sure why this happens -SJB 2093 continue; // cache corruption?? not sure why this happens -SJB
@@ -2021,18 +2096,23 @@ bool LLInventoryModel::loadSkeleton(
2021 2096
2022 // we can safely ignore anything loaded from file, but 2097 // we can safely ignore anything loaded from file, but
2023 // not sent down in the skeleton. 2098 // not sent down in the skeleton.
2024 if(cit == not_cached) 2099 if (cit == not_cached)
2025 { 2100 {
2026 continue; 2101 continue;
2027 } 2102 }
2028 if(cat->getVersion() != tcat->getVersion()) 2103
2104 // We insert them anyway to keep the cache from breaking.
2105 // If we delete or add a folder (aka "category") then the server
2106 // increments the version and we reload the items on next login anyway
2107 // this *may* result in duplicates that are cleared on relog-- MC
2108 /*if (cat->getVersion() != tcat->getVersion())
2029 { 2109 {
2030 // if the cached version does not match the server version, 2110 // if the cached version does not match the server version,
2031 // throw away the version we have so we can fetch the 2111 // throw away the version we have so we can fetch the
2032 // correct contents the next time the viewer opens the folder. 2112 // correct contents the next time the viewer opens the folder.
2033 tcat->setVersion(NO_VERSION); 2113 tcat->setVersion(NO_VERSION);
2034 } 2114 }
2035 else 2115 else*/
2036 { 2116 {
2037 cached_ids.insert(tcat->getUUID()); 2117 cached_ids.insert(tcat->getUUID());
2038 } 2118 }
@@ -2041,9 +2121,9 @@ bool LLInventoryModel::loadSkeleton(
2041 // go ahead and add the cats returned during the download 2121 // go ahead and add the cats returned during the download
2042 std::set<LLUUID>::iterator not_cached_id = cached_ids.end(); 2122 std::set<LLUUID>::iterator not_cached_id = cached_ids.end();
2043 cached_category_count = cached_ids.size(); 2123 cached_category_count = cached_ids.size();
2044 for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) 2124 for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
2045 { 2125 {
2046 if(cached_ids.find((*it)->getUUID()) == not_cached_id) 2126 if (cached_ids.find((*it)->getUUID()) == not_cached_id)
2047 { 2127 {
2048 // this check is performed so that we do not 2128 // this check is performed so that we do not
2049 // mark new folders in the skeleton (and not in cache) 2129 // mark new folders in the skeleton (and not in cache)
@@ -2058,15 +2138,14 @@ bool LLInventoryModel::loadSkeleton(
2058 // Add all the items loaded which are parented to a 2138 // Add all the items loaded which are parented to a
2059 // category with a correctly cached parent 2139 // category with a correctly cached parent
2060 count = items.count(); 2140 count = items.count();
2061 cat_map_t::iterator unparented = mCategoryMap.end(); 2141 for (int i = 0; i < count; ++i)
2062 for(int i = 0; i < count; ++i)
2063 { 2142 {
2064 cat_map_t::iterator cit = mCategoryMap.find(items[i]->getParentUUID()); 2143 cat_map_t::iterator cit = mCategoryMap.find(items[i]->getParentUUID());
2065 2144
2066 if(cit != unparented) 2145 if (cit != mCategoryMap.end())
2067 { 2146 {
2068 LLViewerInventoryCategory* cat = cit->second; 2147 LLViewerInventoryCategory* cat = cit->second;
2069 if(cat->getVersion() != NO_VERSION) 2148 if (cat->getVersion() != NO_VERSION)
2070 { 2149 {
2071 addItem(items[i]); 2150 addItem(items[i]);
2072 cached_item_count += 1; 2151 cached_item_count += 1;
@@ -2079,7 +2158,7 @@ bool LLInventoryModel::loadSkeleton(
2079 { 2158 {
2080 // go ahead and add everything after stripping the version 2159 // go ahead and add everything after stripping the version
2081 // information. 2160 // information.
2082 for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) 2161 for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
2083 { 2162 {
2084 LLViewerInventoryCategory *llvic = (*it); 2163 LLViewerInventoryCategory *llvic = (*it);
2085 llvic->setVersion(NO_VERSION); 2164 llvic->setVersion(NO_VERSION);
@@ -2092,13 +2171,13 @@ bool LLInventoryModel::loadSkeleton(
2092 // needlessly fetch descendents for categories which we have. 2171 // needlessly fetch descendents for categories which we have.
2093 update_map_t::iterator no_child_counts = child_counts.end(); 2172 update_map_t::iterator no_child_counts = child_counts.end();
2094 update_map_t::iterator the_count; 2173 update_map_t::iterator the_count;
2095 for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) 2174 for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
2096 { 2175 {
2097 LLViewerInventoryCategory* cat = (*it); 2176 LLViewerInventoryCategory* cat = (*it);
2098 if(cat->getVersion() != NO_VERSION) 2177 if (cat->getVersion() != NO_VERSION)
2099 { 2178 {
2100 the_count = child_counts.find(cat->getUUID()); 2179 the_count = child_counts.find(cat->getUUID());
2101 if(the_count != no_child_counts) 2180 if (the_count != no_child_counts)
2102 { 2181 {
2103 cat->setDescendentCount((*the_count).second.mValue); 2182 cat->setDescendentCount((*the_count).second.mValue);
2104 } 2183 }
@@ -2109,7 +2188,7 @@ bool LLInventoryModel::loadSkeleton(
2109 } 2188 }
2110 } 2189 }
2111 2190
2112 if(remove_inventory_file) 2191 if (remove_inventory_file)
2113 { 2192 {
2114 // clean up the gunzipped file. 2193 // clean up the gunzipped file.
2115 LLFile::remove(inventory_filename); 2194 LLFile::remove(inventory_filename);
@@ -2118,53 +2197,98 @@ bool LLInventoryModel::loadSkeleton(
2118 } 2197 }
2119 2198
2120 LL_DEBUGS("Inventory") << "Successfully loaded " << cached_category_count 2199 LL_DEBUGS("Inventory") << "Successfully loaded " << cached_category_count
2121 << " categories and " << cached_item_count << " items from cache." 2200 << " categories and " << cached_item_count << " items from cache skeleton."
2122 << LL_ENDL; 2201 << LL_ENDL;
2123 2202
2124 return rv; 2203 return rv;
2125} 2204}
2126 2205
2127bool LLInventoryModel::loadMeat( 2206bool LLInventoryModel::loadMeat(const LLInventoryModel::options_t& options,
2128 const LLInventoryModel::options_t& options, const LLUUID& owner_id) 2207 const LLUUID& owner_id)
2129{ 2208{
2130 llinfos << "importing inventory for " << owner_id << llendl; 2209 llinfos << "importing inventory for " << owner_id << llendl;
2131 LLPermissions default_perm; 2210 LLPermissions default_perm;
2132 default_perm.init(LLUUID::null, owner_id, LLUUID::null, LLUUID::null); 2211 default_perm.init(LLUUID::null, owner_id, LLUUID::null, LLUUID::null);
2133 LLPointer<LLViewerInventoryItem> item; 2212 LLPointer<LLViewerInventoryItem> item;
2134 LLUUID id; 2213 LLUUID id;
2135 LLAssetType::EType type; 2214 LLAssetType::EType type = LLAssetType::AT_NONE;
2136 LLInventoryType::EType inv_type; 2215 LLInventoryType::EType inv_type;
2216
2137 bool rv = true; 2217 bool rv = true;
2138 for(options_t::const_iterator it = options.begin(); it < options.end(); ++it) 2218 bool clean_item = false;
2219 static S32 cached_meat_count = 0;
2220
2221 for (options_t::const_iterator it = options.begin(); it < options.end(); ++it)
2139 { 2222 {
2140 item = new LLViewerInventoryItem; 2223 item = new LLViewerInventoryItem;
2224
2141 response_t::const_iterator no_response = (*it).end(); 2225 response_t::const_iterator no_response = (*it).end();
2142 response_t::const_iterator meat; 2226 response_t::const_iterator meat;
2227
2228 clean_item = false;
2229
2143 meat = (*it).find("name"); 2230 meat = (*it).find("name");
2144 if(meat == no_response) goto clean_item; 2231 if (meat == no_response)
2145 item->rename(std::string((*meat).second)); 2232 {
2233 clean_item = true;
2234 }
2235 else
2236 {
2237 item->rename(std::string((*meat).second));
2238 }
2239
2146 meat = (*it).find("item_id"); 2240 meat = (*it).find("item_id");
2147 if(meat == no_response) goto clean_item; 2241 if (meat == no_response)
2148 id.set((*meat).second); 2242 {
2149 item->setUUID(id); 2243 clean_item = true;
2244 }
2245 else
2246 {
2247 id.set((*meat).second);
2248 item->setUUID(id);
2249 }
2250
2150 meat = (*it).find("parent_id"); 2251 meat = (*it).find("parent_id");
2151 if(meat == no_response) goto clean_item; 2252 if (meat == no_response)
2152 id.set((*meat).second); 2253 {
2153 item->setParent(id); 2254 clean_item = true;
2255 }
2256 else
2257 {
2258 id.set((*meat).second);
2259 item->setParent(id);
2260 }
2261
2154 meat = (*it).find("type"); 2262 meat = (*it).find("type");
2155 if(meat == no_response) goto clean_item; 2263 if (meat == no_response)
2156 type = (LLAssetType::EType)atoi((*meat).second.c_str()); 2264 {
2157 item->setType(type); 2265 clean_item = true;
2266 }
2267 else
2268 {
2269 type = (LLAssetType::EType)atoi((*meat).second.c_str());
2270 item->setType(type);
2271 }
2272
2273 // Do we want to clean if there's no inv_type too? -- MC
2158 meat = (*it).find("inv_type"); 2274 meat = (*it).find("inv_type");
2159 if(meat != no_response) 2275 if (meat != no_response)
2160 { 2276 {
2161 inv_type = (LLInventoryType::EType)atoi((*meat).second.c_str()); 2277 inv_type = (LLInventoryType::EType)atoi((*meat).second.c_str());
2162 item->setInventoryType(inv_type); 2278 item->setInventoryType(inv_type);
2163 } 2279 }
2280
2164 meat = (*it).find("data_id"); 2281 meat = (*it).find("data_id");
2165 if(meat == no_response) goto clean_item; 2282 if (meat == no_response)
2166 id.set((*meat).second); 2283 {
2167 if(LLAssetType::AT_CALLINGCARD == type) 2284 clean_item = true;
2285 }
2286 else
2287 {
2288 id.set((*meat).second);
2289 }
2290
2291 if (LLAssetType::AT_CALLINGCARD == type)
2168 { 2292 {
2169 LLPermissions perm; 2293 LLPermissions perm;
2170 perm.init(id, owner_id, LLUUID::null, LLUUID::null); 2294 perm.init(id, owner_id, LLUUID::null, LLUUID::null);
@@ -2173,37 +2297,48 @@ bool LLInventoryModel::loadMeat(
2173 else 2297 else
2174 { 2298 {
2175 meat = (*it).find("perm_mask"); 2299 meat = (*it).find("perm_mask");
2176 if(meat != no_response) 2300 if (meat != no_response)
2177 { 2301 {
2178 PermissionMask perm_mask = atoi((*meat).second.c_str()); 2302 PermissionMask perm_mask = atoi((*meat).second.c_str());
2179 default_perm.initMasks( 2303 default_perm.initMasks(perm_mask, perm_mask, perm_mask, perm_mask, perm_mask);
2180 perm_mask, perm_mask, perm_mask, perm_mask, perm_mask);
2181 } 2304 }
2182 else 2305 else
2183 { 2306 {
2184 default_perm.initMasks( 2307 default_perm.initMasks(PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE);
2185 PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE);
2186 } 2308 }
2187 item->setPermissions(default_perm); 2309 item->setPermissions(default_perm);
2188 item->setAssetUUID(id); 2310 item->setAssetUUID(id);
2189 } 2311 }
2312
2190 meat = (*it).find("flags"); 2313 meat = (*it).find("flags");
2191 if(meat != no_response) 2314 if (meat != no_response)
2192 { 2315 {
2193 item->setFlags(strtoul((*meat).second.c_str(), NULL, 0)); 2316 item->setFlags(strtoul((*meat).second.c_str(), NULL, 0));
2194 } 2317 }
2318
2195 meat = (*it).find("time"); 2319 meat = (*it).find("time");
2196 if(meat != no_response) 2320 if (meat != no_response)
2197 { 2321 {
2198 item->setCreationDate(atoi((*meat).second.c_str())); 2322 item->setCreationDate(atoi((*meat).second.c_str()));
2199 } 2323 }
2200 addItem(item); 2324
2201 continue; 2325 if (clean_item)
2202 clean_item: 2326 {
2203 llwarns << "Unable to import near " << item->getName() << llendl; 2327 llwarns << "Unable to import near " << item->getName() << llendl;
2204 rv = false; 2328 rv = false;
2205 //delete item; // automatic when item is reassigned or destroyed 2329 //delete item; // automatic when item is reassigned or destroyed
2330 break;
2331 }
2332 else
2333 {
2334 addItem(item);
2335 cached_meat_count++;
2336 }
2206 } 2337 }
2338
2339 LL_DEBUGS("Inventory") << "Successfully added " << cached_meat_count << " items from cache."
2340 << LL_ENDL;
2341
2207 return rv; 2342 return rv;
2208} 2343}
2209 2344
@@ -2528,6 +2663,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename,
2528 // *NOTE: This buffer size is hard coded into scanf() below. 2663 // *NOTE: This buffer size is hard coded into scanf() below.
2529 char buffer[MAX_STRING]; /*Flawfinder: ignore*/ 2664 char buffer[MAX_STRING]; /*Flawfinder: ignore*/
2530 char keyword[MAX_STRING]; /*Flawfinder: ignore*/ 2665 char keyword[MAX_STRING]; /*Flawfinder: ignore*/
2666 static S32 item_count_total = 0;
2531 while(!feof(file) && fgets(buffer, MAX_STRING, file)) 2667 while(!feof(file) && fgets(buffer, MAX_STRING, file))
2532 { 2668 {
2533 sscanf(buffer, " %254s", keyword); /* Flawfinder: ignore */ 2669 sscanf(buffer, " %254s", keyword); /* Flawfinder: ignore */
@@ -2552,16 +2688,17 @@ bool LLInventoryModel::loadFromFile(const std::string& filename,
2552 // *FIX: Need a better solution, this prevents the 2688 // *FIX: Need a better solution, this prevents the
2553 // application from freezing, but breaks inventory 2689 // application from freezing, but breaks inventory
2554 // caching. 2690 // caching.
2555 if(inv_item->getUUID().isNull()) 2691 //if(inv_item->getUUID().isNull())MCCABE
2556 { 2692 //{
2557 //delete inv_item; // automatic when inv_cat is reassigned or destroyed 2693 // //delete inv_item; // automatic when inv_cat is reassigned or destroyed
2558 llwarns << "Ignoring inventory with null item id: " 2694 // llwarns << "Ignoring inventory with null item id: "
2559 << inv_item->getName() << llendl; 2695 // << inv_item->getName() << llendl;
2560 2696 //
2561 } 2697 //}
2562 else 2698 //else
2563 { 2699 {
2564 items.put(inv_item); 2700 items.put(inv_item);
2701 item_count_total++;
2565 } 2702 }
2566 } 2703 }
2567 else 2704 else
@@ -2576,6 +2713,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename,
2576 << llendl; 2713 << llendl;
2577 } 2714 }
2578 } 2715 }
2716 LL_DEBUGS("Inventory") << "Inventory items loaded from file: " << item_count_total << LL_ENDL;
2579 fclose(file); 2717 fclose(file);
2580 return true; 2718 return true;
2581} 2719}
@@ -2598,6 +2736,9 @@ bool LLInventoryModel::saveToFile(const std::string& filename,
2598 return false; 2736 return false;
2599 } 2737 }
2600 2738
2739 static S32 count_total = 0;
2740 static S32 category_total = 0;
2741
2601 S32 count = categories.count(); 2742 S32 count = categories.count();
2602 S32 i; 2743 S32 i;
2603 for(i = 0; i < count; ++i) 2744 for(i = 0; i < count; ++i)
@@ -2606,6 +2747,7 @@ bool LLInventoryModel::saveToFile(const std::string& filename,
2606 if(cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) 2747 if(cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN)
2607 { 2748 {
2608 cat->exportFileLocal(file); 2749 cat->exportFileLocal(file);
2750 category_total++;
2609 } 2751 }
2610 } 2752 }
2611 2753
@@ -2613,8 +2755,11 @@ bool LLInventoryModel::saveToFile(const std::string& filename,
2613 for(i = 0; i < count; ++i) 2755 for(i = 0; i < count; ++i)
2614 { 2756 {
2615 items[i]->exportFile(file); 2757 items[i]->exportFile(file);
2758 count_total++;
2616 } 2759 }
2617 2760
2761 LL_DEBUGS("Inventory") << "Cached " << category_total << " categories and " << count_total << " inventory items" << LL_ENDL;
2762
2618 fclose(file); 2763 fclose(file);
2619 return true; 2764 return true;
2620} 2765}
@@ -2709,8 +2854,8 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account)
2709 { 2854 {
2710 LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; 2855 LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
2711 titem->unpackMessage(msg, _PREHASH_InventoryData, i); 2856 titem->unpackMessage(msg, _PREHASH_InventoryData, i);
2712 lldebugs << "LLInventoryModel::messageUpdateCore() item id:" 2857 LL_DEBUGS("Inventory") << "LLInventoryModel::messageUpdateCore() item id:"
2713 << titem->getUUID() << llendl; 2858 << titem->getUUID() << LL_ENDL;
2714 items.push_back(titem); 2859 items.push_back(titem);
2715 // examine update for changes. 2860 // examine update for changes.
2716 LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID()); 2861 LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID());
@@ -2759,7 +2904,7 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account)
2759// static 2904// static
2760void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) 2905void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**)
2761{ 2906{
2762 lldebugs << "LLInventoryModel::processRemoveInventoryItem()" << llendl; 2907 LL_DEBUGS("Inventory") << "LLInventoryModel::processRemoveInventoryItem()" << LL_ENDL;
2763 LLUUID agent_id, item_id; 2908 LLUUID agent_id, item_id;
2764 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); 2909 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
2765 if(agent_id != gAgent.getID()) 2910 if(agent_id != gAgent.getID())
@@ -2796,7 +2941,7 @@ void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**)
2796void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, 2941void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg,
2797 void**) 2942 void**)
2798{ 2943{
2799 lldebugs << "LLInventoryModel::processUpdateInventoryFolder()" << llendl; 2944 LL_DEBUGS("Inventory") << "LLInventoryModel::processUpdateInventoryFolder()" << LL_ENDL;
2800 LLUUID agent_id, folder_id, parent_id; 2945 LLUUID agent_id, folder_id, parent_id;
2801 //char name[DB_INV_ITEM_NAME_BUF_SIZE]; 2946 //char name[DB_INV_ITEM_NAME_BUF_SIZE];
2802 msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id); 2947 msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id);
@@ -2856,7 +3001,7 @@ void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg,
2856void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, 3001void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg,
2857 void**) 3002 void**)
2858{ 3003{
2859 lldebugs << "LLInventoryModel::processRemoveInventoryFolder()" << llendl; 3004 LL_DEBUGS("Inventory") << "LLInventoryModel::processRemoveInventoryFolder()" << LL_ENDL;
2860 LLUUID agent_id, folder_id; 3005 LLUUID agent_id, folder_id;
2861 msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id); 3006 msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id);
2862 if(agent_id != gAgent.getID()) 3007 if(agent_id != gAgent.getID())
@@ -2905,8 +3050,8 @@ void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg,
2905 // The viewer ignores the asset id because this message is only 3050 // The viewer ignores the asset id because this message is only
2906 // used for attachments/objects, so the asset id is not used in 3051 // used for attachments/objects, so the asset id is not used in
2907 // the viewer anyway. 3052 // the viewer anyway.
2908 lldebugs << "LLInventoryModel::processSaveAssetIntoInventory itemID=" 3053 LL_DEBUGS("Inventory") << "LLInventoryModel::processSaveAssetIntoInventory itemID="
2909 << item_id << llendl; 3054 << item_id << LL_ENDL;
2910 LLViewerInventoryItem* item = gInventory.getItem( item_id ); 3055 LLViewerInventoryItem* item = gInventory.getItem( item_id );
2911 if( item ) 3056 if( item )
2912 { 3057 {
@@ -3173,7 +3318,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**)
3173// static 3318// static
3174void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) 3319void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**)
3175{ 3320{
3176 lldebugs << "LLInventoryModel::processMoveInventoryItem()" << llendl; 3321 LL_DEBUGS("Inventory") << "LLInventoryModel::processMoveInventoryItem()" << LL_ENDL;
3177 LLUUID agent_id; 3322 LLUUID agent_id;
3178 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); 3323 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
3179 if(agent_id != gAgent.getID()) 3324 if(agent_id != gAgent.getID())
@@ -3198,8 +3343,8 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**)
3198 msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_FolderID, folder_id, i); 3343 msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_FolderID, folder_id, i);
3199 msg->getString("InventoryData", "NewName", new_name, i); 3344 msg->getString("InventoryData", "NewName", new_name, i);
3200 3345
3201 lldebugs << "moving item " << item_id << " to folder " 3346 LL_DEBUGS("Inventory") << "moving item " << item_id << " to folder "
3202 << folder_id << llendl; 3347 << folder_id << LL_ENDL;
3203 update_list_t update; 3348 update_list_t update;
3204 LLCategoryUpdate old_folder(item->getParentUUID(), -1); 3349 LLCategoryUpdate old_folder(item->getParentUUID(), -1);
3205 update.push_back(old_folder); 3350 update.push_back(old_folder);
@@ -3759,7 +3904,7 @@ void LLInventoryFetchComboObserver::fetch(
3759 const folder_ref_t& folder_ids, 3904 const folder_ref_t& folder_ids,
3760 const item_ref_t& item_ids) 3905 const item_ref_t& item_ids)
3761{ 3906{
3762 lldebugs << "LLInventoryFetchComboObserver::fetch()" << llendl; 3907 LL_DEBUGS("Inventory") << "LLInventoryFetchComboObserver::fetch()" << LL_ENDL;
3763 for(folder_ref_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit) 3908 for(folder_ref_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit)
3764 { 3909 {
3765 LLViewerInventoryCategory* cat = gInventory.getCategory(*fit); 3910 LLViewerInventoryCategory* cat = gInventory.getCategory(*fit);
@@ -3767,13 +3912,13 @@ void LLInventoryFetchComboObserver::fetch(
3767 if(!gInventory.isCategoryComplete(*fit)) 3912 if(!gInventory.isCategoryComplete(*fit))
3768 { 3913 {
3769 cat->fetchDescendents(); 3914 cat->fetchDescendents();
3770 lldebugs << "fetching folder " << *fit <<llendl; 3915 LL_DEBUGS("Inventory") << "fetching folder " << *fit << LL_ENDL;
3771 mIncompleteFolders.push_back(*fit); 3916 mIncompleteFolders.push_back(*fit);
3772 } 3917 }
3773 else 3918 else
3774 { 3919 {
3775 mCompleteFolders.push_back(*fit); 3920 mCompleteFolders.push_back(*fit);
3776 lldebugs << "completing folder " << *fit <<llendl; 3921 LL_DEBUGS("Inventory") << "completing folder " << *fit << LL_ENDL;
3777 } 3922 }
3778 } 3923 }
3779 3924
@@ -3788,14 +3933,14 @@ void LLInventoryFetchComboObserver::fetch(
3788 LLViewerInventoryItem* item = gInventory.getItem(*iit); 3933 LLViewerInventoryItem* item = gInventory.getItem(*iit);
3789 if(!item) 3934 if(!item)
3790 { 3935 {
3791 lldebugs << "uanble to find item " << *iit << llendl; 3936 LL_DEBUGS("Inventory") << "uanble to find item " << *iit << LL_ENDL;
3792 continue; 3937 continue;
3793 } 3938 }
3794 if(item->isComplete()) 3939 if(item->isComplete())
3795 { 3940 {
3796 // It's complete, so put it on the complete container. 3941 // It's complete, so put it on the complete container.
3797 mCompleteItems.push_back(*iit); 3942 mCompleteItems.push_back(*iit);
3798 lldebugs << "completing item " << *iit << llendl; 3943 LL_DEBUGS("Inventory") << "completing item " << *iit << LL_ENDL;
3799 continue; 3944 continue;
3800 } 3945 }
3801 else 3946 else
@@ -3812,7 +3957,7 @@ void LLInventoryFetchComboObserver::fetch(
3812 } 3957 }
3813 else 3958 else
3814 { 3959 {
3815 lldebugs << "not worrying about " << *iit << llendl; 3960 LL_DEBUGS("Inventory") << "not worrying about " << *iit << LL_ENDL;
3816 } 3961 }
3817 } 3962 }
3818 fetch_items_from_llsd(items_llsd); 3963 fetch_items_from_llsd(items_llsd);
diff --git a/linden/indra/newview/llinventorymodel.h b/linden/indra/newview/llinventorymodel.h
index fee509b..7222c60 100644
--- a/linden/indra/newview/llinventorymodel.h
+++ b/linden/indra/newview/llinventorymodel.h
@@ -452,6 +452,9 @@ protected:
452 // cache recent lookups 452 // cache recent lookups
453 mutable LLPointer<LLViewerInventoryItem> mLastItem; 453 mutable LLPointer<LLViewerInventoryItem> mLastItem;
454 454
455 // UUID of the 'Animations' folder in 'My Inventory'
456 LLUUID mAnimationsFolderUUID;
457
455 // This last set of indices is used to map parents to children. 458 // This last set of indices is used to map parents to children.
456 typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t; 459 typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t;
457 typedef std::map<LLUUID, item_array_t*> parent_item_map_t; 460 typedef std::map<LLUUID, item_array_t*> parent_item_map_t;
@@ -474,6 +477,8 @@ protected:
474 bool mIsAgentInvUsable; 477 bool mIsAgentInvUsable;
475 478
476public: 479public:
480 // Returns the UUID of the 'Animations' folder in 'My Inventory' sent from the server at startup
481 LLUUID getAnimationsFolderUUID() const { return mAnimationsFolderUUID; }
477 // *NOTE: DEBUG functionality 482 // *NOTE: DEBUG functionality
478 void dumpInventory(); 483 void dumpInventory();
479 static bool isBulkFetchProcessingComplete(); 484 static bool isBulkFetchProcessingComplete();
diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp
index f8fb439..927d05c 100644
--- a/linden/indra/newview/llinventoryview.cpp
+++ b/linden/indra/newview/llinventoryview.cpp
@@ -491,7 +491,10 @@ LLInventoryView::LLInventoryView(const std::string& name,
491 LLFloater(name, rect, std::string("Inventory"), RESIZE_YES, 491 LLFloater(name, rect, std::string("Inventory"), RESIZE_YES,
492 INV_MIN_WIDTH, INV_MIN_HEIGHT, DRAG_ON_TOP, 492 INV_MIN_WIDTH, INV_MIN_HEIGHT, DRAG_ON_TOP,
493 MINIMIZE_NO, CLOSE_YES), 493 MINIMIZE_NO, CLOSE_YES),
494 mActivePanel(NULL) 494 mActivePanel(NULL),
495 mOldItemCount(-1),
496 mOldFilterText(""),
497 mFilterText("")
495 //LLHandle<LLFloater> mFinderHandle takes care of its own initialization 498 //LLHandle<LLFloater> mFinderHandle takes care of its own initialization
496{ 499{
497 init(inventory); 500 init(inventory);
@@ -681,12 +684,12 @@ LLInventoryView::~LLInventoryView( void )
681 684
682void LLInventoryView::draw() 685void LLInventoryView::draw()
683{ 686{
684 if (LLInventoryModel::isEverythingFetched()) 687 if (!LLInventoryModel::backgroundFetchActive())
685 { 688 {
686 S32 item_count = gInventory.getItemCount(); 689 S32 item_count = gInventory.getItemCount();
687 690
688 //don't let llfloater work more than necessary 691 //don't let llfloater work more than necessary
689 if (item_count != mOldItemCount || mOldFilterText != mFilterText) 692 if (item_count > mOldItemCount || mOldFilterText != mFilterText)
690 { 693 {
691 LLLocale locale(LLLocale::USER_LOCALE); 694 LLLocale locale(LLLocale::USER_LOCALE);
692 std::ostringstream title; 695 std::ostringstream title;
@@ -696,11 +699,10 @@ void LLInventoryView::draw()
696 title << " (" << item_count_string << " items)"; 699 title << " (" << item_count_string << " items)";
697 title << mFilterText; 700 title << mFilterText;
698 setTitle(title.str()); 701 setTitle(title.str());
699 }
700
701 mOldFilterText = mFilterText;
702 mOldItemCount = item_count;
703 702
703 mOldFilterText = mFilterText;
704 mOldItemCount = item_count;
705 }
704 } 706 }
705 if (mActivePanel && mSearchEditor) 707 if (mActivePanel && mSearchEditor)
706 { 708 {
@@ -798,6 +800,8 @@ void LLInventoryView::setVisible( BOOL visible )
798// Destroy all but the last floater, which is made invisible. 800// Destroy all but the last floater, which is made invisible.
799void LLInventoryView::onClose(bool app_quitting) 801void LLInventoryView::onClose(bool app_quitting)
800{ 802{
803 mOldItemCount = 0;
804 mOldFilterText = "";
801// S32 count = sActiveViews.count(); 805// S32 count = sActiveViews.count();
802// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) 806// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
803 // See LLInventoryView::closeAll() on why we're doing it this way 807 // See LLInventoryView::closeAll() on why we're doing it this way
@@ -889,6 +893,12 @@ void LLInventoryView::changed(U32 mask)
889 } 893 }
890 else 894 else
891 { 895 {
896 // This is here because it gets called on login even when it shouldn't -- MC
897 LLLocale locale(LLLocale::USER_LOCALE);
898 std::string item_count_string;
899 LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount());
900 title << " (" << item_count_string << " items)";
901
892 gSavedPerAccountSettings.setS32("InventoryPreviousCount", gInventory.getItemCount()); 902 gSavedPerAccountSettings.setS32("InventoryPreviousCount", gInventory.getItemCount());
893 } 903 }
894 title << mFilterText; 904 title << mFilterText;
diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h
index 3ec1e73..cc5106d 100644
--- a/linden/indra/newview/llinventoryview.h
+++ b/linden/indra/newview/llinventoryview.h
@@ -315,7 +315,7 @@ protected:
315 std::string mOldFilterText; 315 std::string mOldFilterText;
316 316
317 S32 mItemCount; 317 S32 mItemCount;
318 S32 mOldItemCount; 318 S32 mOldItemCount;
319 319
320 // This container is used to hold all active inventory views. This 320 // This container is used to hold all active inventory views. This
321 // is here to support the inventory toggle show button. 321 // is here to support the inventory toggle show button.
diff --git a/linden/indra/newview/llmaniprotate.cpp b/linden/indra/newview/llmaniprotate.cpp
index df503ec..77c8bd5 100644
--- a/linden/indra/newview/llmaniprotate.cpp
+++ b/linden/indra/newview/llmaniprotate.cpp
@@ -63,6 +63,8 @@
63#include "lldrawable.h" 63#include "lldrawable.h"
64#include "llglheaders.h" 64#include "llglheaders.h"
65 65
66#include "hippolimits.h"
67
66const F32 RADIUS_PIXELS = 100.f; // size in screen space 68const F32 RADIUS_PIXELS = 100.f; // size in screen space
67const F32 SQ_RADIUS = RADIUS_PIXELS * RADIUS_PIXELS; 69const F32 SQ_RADIUS = RADIUS_PIXELS * RADIUS_PIXELS;
68const F32 WIDTH_PIXELS = 8; 70const F32 WIDTH_PIXELS = 8;
@@ -1124,9 +1126,9 @@ BOOL LLManipRotate::updateVisiblity()
1124 F32 z_dist = -1.f * (mCenterToCam * cameraAtAxis); 1126 F32 z_dist = -1.f * (mCenterToCam * cameraAtAxis);
1125 1127
1126 // Don't drag manip if object too far away 1128 // Don't drag manip if object too far away
1127 if (gSavedSettings.getBOOL("LimitSelectDistance")) 1129 if (!gSavedSettings.getBOOL("DisableMaxBuildConstraints") && gSavedSettings.getBOOL("LimitSelectDistance"))
1128 { 1130 {
1129 F32 max_select_distance = gSavedSettings.getF32("MaxSelectDistance"); 1131 F32 max_select_distance = gHippoLimits->getMaxSelectDistance();
1130 if (dist_vec(gAgent.getPositionAgent(), center) > max_select_distance) 1132 if (dist_vec(gAgent.getPositionAgent(), center) > max_select_distance)
1131 { 1133 {
1132 visible = FALSE; 1134 visible = FALSE;
diff --git a/linden/indra/newview/llmanipscale.cpp b/linden/indra/newview/llmanipscale.cpp
index b38abe4..33ee1b9 100644
--- a/linden/indra/newview/llmanipscale.cpp
+++ b/linden/indra/newview/llmanipscale.cpp
@@ -236,9 +236,9 @@ void LLManipScale::render()
236 range_from_agent = dist_vec(gAgent.getPositionAgent(), center_agent); 236 range_from_agent = dist_vec(gAgent.getPositionAgent(), center_agent);
237 237
238 // Don't draw manip if object too far away 238 // Don't draw manip if object too far away
239 if (gSavedSettings.getBOOL("LimitSelectDistance")) 239 if (!gSavedSettings.getBOOL("DisableMaxBuildConstraints") && gSavedSettings.getBOOL("LimitSelectDistance"))
240 { 240 {
241 F32 max_select_distance = gSavedSettings.getF32("MaxSelectDistance"); 241 F32 max_select_distance = gHippoLimits->getMaxSelectDistance();
242 if (range_from_agent > max_select_distance) 242 if (range_from_agent > max_select_distance)
243 { 243 {
244 return; 244 return;
diff --git a/linden/indra/newview/llmaniptranslate.cpp b/linden/indra/newview/llmaniptranslate.cpp
index 3b78553..53578ca 100644
--- a/linden/indra/newview/llmaniptranslate.cpp
+++ b/linden/indra/newview/llmaniptranslate.cpp
@@ -1821,9 +1821,9 @@ void LLManipTranslate::renderTranslationHandles()
1821 F32 range_from_agent = dist_vec(gAgent.getPositionAgent(), selection_center); 1821 F32 range_from_agent = dist_vec(gAgent.getPositionAgent(), selection_center);
1822 1822
1823 // Don't draw handles if you're too far away 1823 // Don't draw handles if you're too far away
1824 if (gSavedSettings.getBOOL("LimitSelectDistance")) 1824 if (!gSavedSettings.getBOOL("DisableMaxBuildConstraints") && gSavedSettings.getBOOL("LimitSelectDistance"))
1825 { 1825 {
1826 if (range_from_agent > gSavedSettings.getF32("MaxSelectDistance")) 1826 if (range_from_agent > gHippoLimits->getMaxSelectDistance())
1827 { 1827 {
1828 return; 1828 return;
1829 } 1829 }
diff --git a/linden/indra/newview/llpanelavatar.cpp b/linden/indra/newview/llpanelavatar.cpp
index 4f041f5..dc0db8b 100644
--- a/linden/indra/newview/llpanelavatar.cpp
+++ b/linden/indra/newview/llpanelavatar.cpp
@@ -1004,6 +1004,15 @@ void LLPanelAvatarPicks::refresh()
1004 childSetVisible("Delete...", self && getPanelAvatar()->isEditable()); 1004 childSetVisible("Delete...", self && getPanelAvatar()->isEditable());
1005 1005
1006 sendAvatarProfileRequestIfNeeded("avatarpicksrequest"); 1006 sendAvatarProfileRequestIfNeeded("avatarpicksrequest");
1007
1008 for (int i = 0; i < tab_count; ++i)
1009 {
1010 LLTabContainer::LLTabTuple* tab = tabs->getTab(i);
1011 if (tab)
1012 {
1013 tab->mButton->setToolTip(tabs->getPanelTitle(i));
1014 }
1015 }
1007} 1016}
1008 1017
1009 1018
@@ -1953,29 +1962,37 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**)
1953 self->mPanelSecondLife->childSetValue("acct", caption_text); 1962 self->mPanelSecondLife->childSetValue("acct", caption_text);
1954 1963
1955 //Chalice - Show avatar age in days. 1964 //Chalice - Show avatar age in days.
1956 S32 year; 1965 S32 year = 0;
1957 S32 month; 1966 S32 month = 0;
1958 S32 day; 1967 S32 day = 0;
1959 sscanf(born_on.c_str(), "%d/%d/%d", &month, &day, &year); 1968 sscanf(born_on.c_str(), "%d/%d/%d", &month, &day, &year);
1960 time_t now = time(NULL); 1969 if (year == 0 || month == 0 || day == 0)
1961 struct tm * timeinfo; 1970 {
1962 timeinfo = localtime(&now); 1971 // In case the string sent gets screwed up. It happens -- MC
1963 timeinfo->tm_mon = --month; 1972 born_on = self->mPanelSecondLife->getString("invalid");
1964 timeinfo->tm_year = year - 1900; 1973 }
1965 timeinfo->tm_mday = day; 1974 else
1966 time_t birth = mktime(timeinfo); 1975 {
1967 1976 time_t now = time(NULL);
1968 std::stringstream numberString; 1977 struct tm * timeinfo;
1969 S32 days = difftime(now, birth) / 86400; //(60*60*24) 1978 timeinfo = localtime(&now);
1970 if (days < 0) days = 0; // Happens for people on different timezones -- MC 1979 timeinfo->tm_mon = --month;
1971 numberString << days; 1980 timeinfo->tm_year = year - 1900;
1972 1981 timeinfo->tm_mday = day;
1973 LLStringUtil::format_map_t targs; 1982 time_t birth = mktime(timeinfo);
1974 targs["[DAYS]"] = numberString.str(); 1983
1975 std::string born_msg = self->mPanelSecondLife->getString("days_old_text"); 1984 std::stringstream numberString;
1976 LLStringUtil::format(born_msg, targs); 1985 S32 days = difftime(now, birth) / 86400; //(60*60*24)
1977 born_on += " "; 1986 if (days < 0) days = 0; // Happens for people on different timezones -- MC
1978 born_on += born_msg; 1987 numberString << days;
1988
1989 LLStringUtil::format_map_t targs;
1990 targs["[DAYS]"] = numberString.str();
1991 std::string born_msg = self->mPanelSecondLife->getString("days_old_text");
1992 LLStringUtil::format(born_msg, targs);
1993 born_on += " ";
1994 born_on += born_msg;
1995 }
1979 self->mPanelSecondLife->childSetValue("born", born_on); 1996 self->mPanelSecondLife->childSetValue("born", born_on);
1980 1997
1981 EOnlineStatus online_status = (online) ? ONLINE_STATUS_YES : ONLINE_STATUS_NO; 1998 EOnlineStatus online_status = (online) ? ONLINE_STATUS_YES : ONLINE_STATUS_NO;
diff --git a/linden/indra/newview/llpanelgroupgeneral.cpp b/linden/indra/newview/llpanelgroupgeneral.cpp
index 8c522cc..e466f05 100644
--- a/linden/indra/newview/llpanelgroupgeneral.cpp
+++ b/linden/indra/newview/llpanelgroupgeneral.cpp
@@ -38,6 +38,8 @@
38 38
39#include "lluictrlfactory.h" 39#include "lluictrlfactory.h"
40#include "llagent.h" 40#include "llagent.h"
41#include "llchat.h"
42#include "llfloaterchat.h"
41#include "roles_constants.h" 43#include "roles_constants.h"
42#include "llfloateravatarinfo.h" 44#include "llfloateravatarinfo.h"
43#include "llfloatergroupinfo.h" 45#include "llfloatergroupinfo.h"
@@ -56,6 +58,7 @@
56#include "lltextbox.h" 58#include "lltextbox.h"
57#include "lltexteditor.h" 59#include "lltexteditor.h"
58#include "lltexturectrl.h" 60#include "lltexturectrl.h"
61#include "llurldispatcher.h"
59#include "llviewercontrol.h" 62#include "llviewercontrol.h"
60#include "llviewerwindow.h" 63#include "llviewerwindow.h"
61 64
@@ -144,6 +147,13 @@ BOOL LLPanelGroupGeneral::postBuild()
144 mBtnInfo->setCallbackUserData(this); 147 mBtnInfo->setCallbackUserData(this);
145 } 148 }
146 149
150 mBtnCopyLink = getChild<LLButton>("copy_link_button", recurse);
151 if ( mBtnCopyLink )
152 {
153 mBtnCopyLink->setClickedCallback(onClickCopyLink);
154 mBtnCopyLink->setCallbackUserData(this);
155 }
156
147 LLTextBox* founder = getChild<LLTextBox>("founder_name"); 157 LLTextBox* founder = getChild<LLTextBox>("founder_name");
148 if (founder) 158 if (founder)
149 { 159 {
@@ -269,6 +279,7 @@ BOOL LLPanelGroupGeneral::postBuild()
269 279
270 mBtnJoinGroup->setVisible(FALSE); 280 mBtnJoinGroup->setVisible(FALSE);
271 mBtnInfo->setVisible(FALSE); 281 mBtnInfo->setVisible(FALSE);
282 mBtnCopyLink->setVisible(FALSE);
272 mGroupName->setVisible(FALSE); 283 mGroupName->setVisible(FALSE);
273 } 284 }
274 285
@@ -404,6 +415,39 @@ bool LLPanelGroupGeneral::joinDlgCB(const LLSD& notification, const LLSD& respon
404} 415}
405 416
406// static 417// static
418void LLPanelGroupGeneral::onClickCopyLink(void* userdata)
419{
420 LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)userdata;
421
422 if (!self || (self->mGroupID).isNull()) return;
423
424 LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(self->mGroupID);
425
426 // make sure we don't have junk
427 if (gdatap)
428 {
429 std::string buffer = LLURLDispatcher::createGroupJoinLink(gdatap->getID());
430
431 // Say same info in chat -- MC
432 LLStringUtil::format_map_t targs;
433 targs["[SLURL]"] = buffer;
434 std::string msg = self->getString("copy_group_link_info");
435 LLStringUtil::format(msg, targs);
436
437 LLChat chat;
438 chat.mSourceType = CHAT_SOURCE_SYSTEM;
439 chat.mText = msg;
440 LLFloaterChat::addChat(chat);
441
442 gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer));
443 }
444 else
445 {
446 llwarns << "Trying to copy group slurl link with no group data!" << llendl;
447 }
448}
449
450// static
407void LLPanelGroupGeneral::openProfile(void* data) 451void LLPanelGroupGeneral::openProfile(void* data)
408{ 452{
409 LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; 453 LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
diff --git a/linden/indra/newview/llpanelgroupgeneral.h b/linden/indra/newview/llpanelgroupgeneral.h
index c4572e2..9e39125 100644
--- a/linden/indra/newview/llpanelgroupgeneral.h
+++ b/linden/indra/newview/llpanelgroupgeneral.h
@@ -76,6 +76,7 @@ private:
76 static void onClickInfo(void* userdata); 76 static void onClickInfo(void* userdata);
77 static void onReceiveNotices(LLUICtrl* ctrl, void* data); 77 static void onReceiveNotices(LLUICtrl* ctrl, void* data);
78 static void openProfile(void* data); 78 static void openProfile(void* data);
79 static void onClickCopyLink(void* userdata);
79 80
80 static bool joinDlgCB(const LLSD& notification, const LLSD& response); 81 static bool joinDlgCB(const LLSD& notification, const LLSD& response);
81 82
@@ -98,6 +99,7 @@ private:
98 LLTextEditor *mEditCharter; 99 LLTextEditor *mEditCharter;
99 LLButton *mBtnJoinGroup; 100 LLButton *mBtnJoinGroup;
100 LLButton *mBtnInfo; 101 LLButton *mBtnInfo;
102 LLButton *mBtnCopyLink;
101 103
102 LLNameListCtrl *mListVisibleMembers; 104 LLNameListCtrl *mListVisibleMembers;
103 105
diff --git a/linden/indra/newview/llprefsadvanced.cpp b/linden/indra/newview/llprefsadvanced.cpp
index a9500f7..087acc9 100644
--- a/linden/indra/newview/llprefsadvanced.cpp
+++ b/linden/indra/newview/llprefsadvanced.cpp
@@ -48,6 +48,9 @@
48LLPrefsAdvanced* LLPrefsAdvanced::sInstance; 48LLPrefsAdvanced* LLPrefsAdvanced::sInstance;
49 49
50LLPrefsAdvanced::LLPrefsAdvanced() 50LLPrefsAdvanced::LLPrefsAdvanced()
51:
52 mWLControl(FALSE),
53 mAOControl(FALSE)
51{ 54{
52 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_advanced.xml"); 55 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_advanced.xml");
53 if(sInstance)delete sInstance; 56 if(sInstance)delete sInstance;
@@ -99,6 +102,10 @@ BOOL LLPrefsAdvanced::postBuild()
99 childSetValue("show_timestamps_check", gSavedSettings.getBOOL("ShowTimestamps")); 102 childSetValue("show_timestamps_check", gSavedSettings.getBOOL("ShowTimestamps"));
100 childSetValue("arrow_keys_move_avatar_check", gSavedSettings.getBOOL("ArrowKeysMoveAvatar")); 103 childSetValue("arrow_keys_move_avatar_check", gSavedSettings.getBOOL("ArrowKeysMoveAvatar"));
101 104
105 static BOOL *sEnableAORemote = rebind_llcontrol<BOOL>("EnableAORemote", &gSavedSettings, true);
106 childSetValue("ao_remote_check", *sEnableAORemote);
107 mAOControl = (*sEnableAORemote);
108
102 refresh(); 109 refresh();
103 110
104 return TRUE; 111 return TRUE;
@@ -198,6 +205,9 @@ void LLPrefsAdvanced::apply()
198 gSavedSettings.setBOOL("ArrowKeysMoveAvatar", childGetValue("arrow_keys_move_avatar_check")); 205 gSavedSettings.setBOOL("ArrowKeysMoveAvatar", childGetValue("arrow_keys_move_avatar_check"));
199 gSavedSettings.setBOOL("ScriptErrorsAsChat", childGetValue("script_errors_as_chat")); 206 gSavedSettings.setBOOL("ScriptErrorsAsChat", childGetValue("script_errors_as_chat"));
200 gSavedSettings.setBOOL("ShowTimestamps", childGetValue("show_timestamps_check")); 207 gSavedSettings.setBOOL("ShowTimestamps", childGetValue("show_timestamps_check"));
208
209 static BOOL *sEnableAORemote = rebind_llcontrol<BOOL>("EnableAORemote", &gSavedSettings, true);
210 mAOControl = *sEnableAORemote;
201} 211}
202 212
203void LLPrefsAdvanced::cancel() 213void LLPrefsAdvanced::cancel()
@@ -208,6 +218,7 @@ void LLPrefsAdvanced::cancel()
208// LLVOAvatar::sCloud.mPartData.mEndColor = mCloudEndColor; 218// LLVOAvatar::sCloud.mPartData.mEndColor = mCloudEndColor;
209 219
210 gSavedSettings.setBOOL("EnableWindlightRemote", mWLControl); 220 gSavedSettings.setBOOL("EnableWindlightRemote", mWLControl);
221 gSavedSettings.setBOOL("EnableAORemote", mAOControl);
211} 222}
212 223
213void LLPrefsAdvanced::refresh() 224void LLPrefsAdvanced::refresh()
diff --git a/linden/indra/newview/llprefsadvanced.h b/linden/indra/newview/llprefsadvanced.h
index b863db3..9f02cbf 100644
--- a/linden/indra/newview/llprefsadvanced.h
+++ b/linden/indra/newview/llprefsadvanced.h
@@ -64,6 +64,7 @@ private:
64 LLColor4 mCloudEndColor; 64 LLColor4 mCloudEndColor;
65 LLUUID mCloudTextureID; 65 LLUUID mCloudTextureID;
66 BOOL mWLControl; 66 BOOL mWLControl;
67 BOOL mAOControl;
67}; 68};
68 69
69#endif // LLPREFSADVANCED_H 70#endif // LLPREFSADVANCED_H
diff --git a/linden/indra/newview/llselectmgr.cpp b/linden/indra/newview/llselectmgr.cpp
index f1092e7..4a6c8ed 100644
--- a/linden/indra/newview/llselectmgr.cpp
+++ b/linden/indra/newview/llselectmgr.cpp
@@ -92,6 +92,8 @@
92 92
93#include "llglheaders.h" 93#include "llglheaders.h"
94 94
95#include "hippolimits.h"
96
95// [RLVa:KB] 97// [RLVa:KB]
96#include "rlvhandler.h" 98#include "rlvhandler.h"
97// [/RLVa:KB] 99// [/RLVa:KB]
@@ -3494,15 +3496,15 @@ void LLSelectMgr::deselectAllIfTooFar()
3494// if (gSavedSettings.getBOOL("LimitSelectDistance") 3496// if (gSavedSettings.getBOOL("LimitSelectDistance")
3495// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f 3497// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f
3496 BOOL fRlvFartouch = gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH) && gFloaterTools->getVisible(); 3498 BOOL fRlvFartouch = gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH) && gFloaterTools->getVisible();
3497 if ( (gSavedSettings.getBOOL("LimitSelectDistance") || (fRlvFartouch) ) 3499 if ( ((!gSavedSettings.getBOOL("DisableMaxBuildConstraints") && gSavedSettings.getBOOL("LimitSelectDistance")) || (fRlvFartouch) )
3498// [/RLVa:KB] 3500// [/RLVa:KB]
3499 && (!mSelectedObjects->getPrimaryObject() || !mSelectedObjects->getPrimaryObject()->isAvatar()) 3501 && (!mSelectedObjects->getPrimaryObject() || !mSelectedObjects->getPrimaryObject()->isAvatar())
3500 && !mSelectedObjects->isAttachment() 3502 && !mSelectedObjects->isAttachment()
3501 && !selectionCenter.isExactlyZero()) 3503 && !selectionCenter.isExactlyZero())
3502 { 3504 {
3503// F32 deselect_dist = gSavedSettings.getF32("MaxSelectDistance"); 3505// F32 deselect_dist = gHippoLimits->getMaxSelectDistance();
3504// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f 3506// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f
3505 F32 deselect_dist = (!fRlvFartouch) ? gSavedSettings.getF32("MaxSelectDistance") : 1.5f; 3507 F32 deselect_dist = (!fRlvFartouch) ? gHippoLimits->getMaxSelectDistance() : 1.5f;
3506// [/RLVa:KB] 3508// [/RLVa:KB]
3507 F32 deselect_dist_sq = deselect_dist * deselect_dist; 3509 F32 deselect_dist_sq = deselect_dist * deselect_dist;
3508 3510
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index 083a082..08e12ce 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -2450,6 +2450,22 @@ bool idle_startup()
2450 } 2450 }
2451 } 2451 }
2452 2452
2453 // start background fetching for animations here in case the cache is empty.
2454 // We do this to improve AO support (that's Animatoni Overrider, not LL's
2455 // silly "AO" acronym -- MC
2456 if (gSavedSettings.getBOOL("FetchInventoryOnLogin2"))
2457 {
2458 // Start loading inventory
2459 if (gInventory.getAnimationsFolderUUID() != LLUUID::null)
2460 {
2461 gInventory.startBackgroundFetch(gInventory.getAnimationsFolderUUID());
2462 }
2463 else
2464 {
2465 gInventory.startBackgroundFetch();
2466 }
2467 }
2468
2453 options.clear(); 2469 options.clear();
2454 if(LLUserAuth::getInstance()->getOptions("buddy-list", options)) 2470 if(LLUserAuth::getInstance()->getOptions("buddy-list", options))
2455 { 2471 {
@@ -2576,19 +2592,6 @@ bool idle_startup()
2576 llinfos << "Requesting Agent Data" << llendl; 2592 llinfos << "Requesting Agent Data" << llendl;
2577 gAgent.sendAgentDataUpdateRequest(); 2593 gAgent.sendAgentDataUpdateRequest();
2578 2594
2579 bool shown_at_exit = gSavedSettings.getBOOL("ShowInventory");
2580
2581 // Create the inventory views
2582 llinfos << "Creating Inventory Views" << llendl;
2583 LLInventoryView::showAgentInventory();
2584 llinfos << "Inventory Views Created" << llendl;
2585
2586 // Hide the inventory if it wasn't shown at exit
2587 if(!shown_at_exit)
2588 {
2589 LLInventoryView::toggleVisibility(NULL);
2590 }
2591
2592// [RLVa:KB] - Checked: 2009-11-27 (RLVa-1.1.0f) | Added: RLVa-1.1.0f 2595// [RLVa:KB] - Checked: 2009-11-27 (RLVa-1.1.0f) | Added: RLVa-1.1.0f
2593 if (rlv_handler_t::isEnabled()) 2596 if (rlv_handler_t::isEnabled())
2594 { 2597 {
@@ -2910,12 +2913,6 @@ bool idle_startup()
2910 gStatusBar->updateElements(); 2913 gStatusBar->updateElements();
2911 } 2914 }
2912 2915
2913 // Start the AO now that settings have loaded and login successful -- MC
2914 if (!gAOInvTimer)
2915 {
2916 gAOInvTimer = new AOInvTimer();
2917 }
2918
2919 LLFirstUse::ClientTags(); 2916 LLFirstUse::ClientTags();
2920 2917
2921 // Add login location to teleport history 'teleported-into' 2918 // Add login location to teleport history 'teleported-into'
@@ -2949,12 +2946,6 @@ bool idle_startup()
2949 // Have the agent start watching the friends list so we can update proxies 2946 // Have the agent start watching the friends list so we can update proxies
2950 gAgent.observeFriends(); 2947 gAgent.observeFriends();
2951 2948
2952 if (gSavedSettings.getBOOL("FetchInventoryOnLogin"))
2953 {
2954 // Start loading inventory
2955 gInventory.startBackgroundFetch();
2956 }
2957
2958 if (gSavedSettings.getBOOL("LoginAsGod")) 2949 if (gSavedSettings.getBOOL("LoginAsGod"))
2959 { 2950 {
2960 gAgent.requestEnterGodMode(); 2951 gAgent.requestEnterGodMode();
@@ -2979,6 +2970,23 @@ bool idle_startup()
2979 // Clean up the userauth stuff. 2970 // Clean up the userauth stuff.
2980 LLUserAuth::getInstance()->reset(); 2971 LLUserAuth::getInstance()->reset();
2981 2972
2973 // Show the inventory if it was shown at exit
2974 // Don't do this before here or we screw up inv loading -- MC
2975 if (gSavedSettings.getBOOL("ShowInventory"))
2976 {
2977 // Create the inventory views
2978 llinfos << "Creating Inventory Views" << llendl;
2979 LLInventoryView::showAgentInventory();
2980 llinfos << "Inventory Views Created" << llendl;
2981 //LLInventoryView::toggleVisibility(NULL);
2982 }
2983
2984 // Init the AO now that settings have loaded and login successful -- MC
2985 if (!gAOInvTimer)
2986 {
2987 gAOInvTimer = new AOInvTimer();
2988 }
2989
2982 LLStartUp::setStartupState( STATE_STARTED ); 2990 LLStartUp::setStartupState( STATE_STARTED );
2983 LLStartUp::setStartedOnce(true); 2991 LLStartUp::setStartedOnce(true);
2984 LLStartUp::setLoginFailed(false); 2992 LLStartUp::setLoginFailed(false);
diff --git a/linden/indra/newview/lltoolplacer.cpp b/linden/indra/newview/lltoolplacer.cpp
index 52053f5..80b415c 100644
--- a/linden/indra/newview/lltoolplacer.cpp
+++ b/linden/indra/newview/lltoolplacer.cpp
@@ -69,6 +69,8 @@
69#include "llviewerparcelmgr.h" // RezWithLandGroup 69#include "llviewerparcelmgr.h" // RezWithLandGroup
70#include "roles_constants.h" // Ele: Land Group Override 70#include "roles_constants.h" // Ele: Land Group Override
71 71
72#include "hippolimits.h"
73
72// [RLVa:KB] 74// [RLVa:KB]
73#include "rlvhandler.h" 75#include "rlvhandler.h"
74// [/RLVa:KB] 76// [/RLVa:KB]
@@ -86,7 +88,7 @@ LLToolPlacer::LLToolPlacer()
86BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face, 88BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face,
87 BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region ) 89 BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region )
88{ 90{
89 F32 max_dist_from_camera = gSavedSettings.getF32( "MaxSelectDistance" ) - 1.f; 91 F32 max_dist_from_camera = gHippoLimits->getMaxSelectDistance() - 1.f;
90 92
91 // Viewer-side pick to find the right sim to create the object on. 93 // Viewer-side pick to find the right sim to create the object on.
92 // First find the surface the object will be created on. 94 // First find the surface the object will be created on.
diff --git a/linden/indra/newview/llurldispatcher.cpp b/linden/indra/newview/llurldispatcher.cpp
index 1144c58..0d6f6d7 100644
--- a/linden/indra/newview/llurldispatcher.cpp
+++ b/linden/indra/newview/llurldispatcher.cpp
@@ -55,6 +55,11 @@ const std::string SLURL_SECONDLIFE_PREFIX = "secondlife://";
55const std::string SLURL_SLURL_PREFIX = "http://slurl.com/secondlife/"; 55const std::string SLURL_SLURL_PREFIX = "http://slurl.com/secondlife/";
56const std::string SLURL_SLURL_ALT_PREFIX = "http://maps.secondlife.com/secondlife/"; 56const std::string SLURL_SLURL_ALT_PREFIX = "http://maps.secondlife.com/secondlife/";
57 57
58const std::string IZURL_IZ_HELP_PREFIX = "inworldz://app.";
59const std::string IZURL_IZ_PREFIX = "iz://";
60const std::string IZURL_INWORLDZ_PREFIX = "inworldz://";
61const std::string IZURL_IZURL_PREFIX = "http://places.inworldz.com/";
62
58const std::string SLURL_APP_TOKEN = "app/"; 63const std::string SLURL_APP_TOKEN = "app/";
59 64
60class LLURLDispatcherImpl 65class LLURLDispatcherImpl
@@ -119,6 +124,10 @@ bool LLURLDispatcherImpl::isSLURL(const std::string& url)
119 if (matchPrefix(url, SLURL_SECONDLIFE_PREFIX)) return true; 124 if (matchPrefix(url, SLURL_SECONDLIFE_PREFIX)) return true;
120 if (matchPrefix(url, SLURL_SLURL_PREFIX)) return true; 125 if (matchPrefix(url, SLURL_SLURL_PREFIX)) return true;
121 if (matchPrefix(url, SLURL_SLURL_ALT_PREFIX)) return true; 126 if (matchPrefix(url, SLURL_SLURL_ALT_PREFIX)) return true;
127 if (matchPrefix(url, IZURL_IZ_HELP_PREFIX)) return true;
128 if (matchPrefix(url, IZURL_IZ_PREFIX)) return true;
129 if (matchPrefix(url, IZURL_INWORLDZ_PREFIX)) return true;
130 if (matchPrefix(url, IZURL_IZURL_PREFIX)) return true;
122 return false; 131 return false;
123} 132}
124 133
@@ -128,7 +137,10 @@ bool LLURLDispatcherImpl::isSLURLCommand(const std::string& url)
128 if (matchPrefix(url, SLURL_SL_PREFIX + SLURL_APP_TOKEN) 137 if (matchPrefix(url, SLURL_SL_PREFIX + SLURL_APP_TOKEN)
129 || matchPrefix(url, SLURL_SECONDLIFE_PREFIX + "/" + SLURL_APP_TOKEN) 138 || matchPrefix(url, SLURL_SECONDLIFE_PREFIX + "/" + SLURL_APP_TOKEN)
130 || matchPrefix(url, SLURL_SLURL_PREFIX + SLURL_APP_TOKEN) 139 || matchPrefix(url, SLURL_SLURL_PREFIX + SLURL_APP_TOKEN)
131 || matchPrefix(url, SLURL_SLURL_ALT_PREFIX + SLURL_APP_TOKEN)) 140 || matchPrefix(url, SLURL_SLURL_ALT_PREFIX + SLURL_APP_TOKEN)
141 || matchPrefix(url, IZURL_IZ_PREFIX + SLURL_APP_TOKEN)
142 || matchPrefix(url, IZURL_INWORLDZ_PREFIX + "/" + SLURL_APP_TOKEN)
143 || matchPrefix(url, IZURL_IZURL_PREFIX + SLURL_APP_TOKEN))
132 { 144 {
133 return true; 145 return true;
134 } 146 }
@@ -371,9 +383,37 @@ std::string LLURLDispatcherImpl::stripProtocol(const std::string& url)
371 { 383 {
372 stripped.erase(0, SLURL_SLURL_ALT_PREFIX.length()); 384 stripped.erase(0, SLURL_SLURL_ALT_PREFIX.length());
373 } 385 }
386 else if (matchPrefix(stripped, IZURL_IZ_HELP_PREFIX))
387 {
388 stripped.erase(0, IZURL_IZ_HELP_PREFIX.length());
389 }
390 else if (matchPrefix(stripped, IZURL_IZ_PREFIX))
391 {
392 stripped.erase(0, IZURL_IZ_PREFIX.length());
393 }
394 else if (matchPrefix(stripped, IZURL_INWORLDZ_PREFIX))
395 {
396 stripped.erase(0, IZURL_INWORLDZ_PREFIX.length());
397 }
398 else if (matchPrefix(stripped, IZURL_IZURL_PREFIX))
399 {
400 stripped.erase(0, IZURL_IZURL_PREFIX.length());
401 }
374 return stripped; 402 return stripped;
375} 403}
376 404
405// static
406std::string LLURLDispatcher::createGroupJoinLink(const LLUUID& group_id)
407{
408 std::string slurl = "";
409 if (group_id.notNull())
410 {
411 //secondlife:///app/group/uuid/about
412 slurl = SLURL_SECONDLIFE_PREFIX + "/" + SLURL_APP_TOKEN + "group/" + group_id.asString() + "/about";
413 }
414 return slurl;
415}
416
377//--------------------------------------------------------------------------- 417//---------------------------------------------------------------------------
378// Teleportation links are handled here because they are tightly coupled 418// Teleportation links are handled here because they are tightly coupled
379// to URL parsing and sim-fragment parsing 419// to URL parsing and sim-fragment parsing
diff --git a/linden/indra/newview/llurldispatcher.h b/linden/indra/newview/llurldispatcher.h
index c947e5e..cfdc2db 100644
--- a/linden/indra/newview/llurldispatcher.h
+++ b/linden/indra/newview/llurldispatcher.h
@@ -66,6 +66,8 @@ public:
66 66
67 static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z); 67 static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
68 // builds: http://slurl.com/secondlife/RegionName/x/y/z/ 68 // builds: http://slurl.com/secondlife/RegionName/x/y/z/
69
70 static std::string createGroupJoinLink(const LLUUID& group_id);
69}; 71};
70 72
71#endif 73#endif
diff --git a/linden/indra/newview/llviewercamera.cpp b/linden/indra/newview/llviewercamera.cpp
index 16f6e57..fecab65 100644
--- a/linden/indra/newview/llviewercamera.cpp
+++ b/linden/indra/newview/llviewercamera.cpp
@@ -51,6 +51,8 @@
51#include "lltoolmgr.h" 51#include "lltoolmgr.h"
52#include "llviewerjoystick.h" 52#include "llviewerjoystick.h"
53 53
54#include "hippolimits.h"
55
54//glu pick matrix implementation borrowed from Mesa3D 56//glu pick matrix implementation borrowed from Mesa3D
55glh::matrix4f gl_pick_matrix(GLfloat x, GLfloat y, GLfloat width, GLfloat height, GLint* viewport) 57glh::matrix4f gl_pick_matrix(GLfloat x, GLfloat y, GLfloat width, GLfloat height, GLint* viewport)
56{ 58{
@@ -334,7 +336,7 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
334 if (limit_select_distance) 336 if (limit_select_distance)
335 { 337 {
336 // ...select distance from control 338 // ...select distance from control
337 z_far = gSavedSettings.getF32("MaxSelectDistance"); 339 z_far = gHippoLimits->getMaxSelectDistance();
338 } 340 }
339 else 341 else
340 { 342 {
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index ac16dbc..c336c3a 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -2494,7 +2494,7 @@ class LLObjectEnableExport : public view_listener_t
2494 { 2494 {
2495 virtual bool apply(LLSelectNode* node) 2495 virtual bool apply(LLSelectNode* node)
2496 { 2496 {
2497 return primbackup::check_perms( node ); 2497 return PrimBackup::validatePerms(node->mPermissions);
2498 } 2498 }
2499 } func; 2499 } func;
2500 2500
@@ -2521,7 +2521,7 @@ class LLObjectExport : public view_listener_t
2521 2521
2522 if (!avatar) 2522 if (!avatar)
2523 { 2523 {
2524 primbackup::getInstance()->pre_export_object(); 2524 PrimBackup::getInstance()->exportObject();
2525 } 2525 }
2526 2526
2527 return true; 2527 return true;
@@ -2542,7 +2542,7 @@ class LLObjectImport : public view_listener_t
2542{ 2542{
2543 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2543 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2544 { 2544 {
2545 primbackup::getInstance()->import_object(FALSE); 2545 PrimBackup::getInstance()->importObject(FALSE);
2546 return true; 2546 return true;
2547 } 2547 }
2548}; 2548};
@@ -2551,7 +2551,7 @@ class LLObjectImportUpload : public view_listener_t
2551{ 2551{
2552 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 2552 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
2553 { 2553 {
2554 primbackup::getInstance()->import_object(TRUE); 2554 PrimBackup::getInstance()->importObject(TRUE);
2555 return true; 2555 return true;
2556 } 2556 }
2557}; 2557};
@@ -8329,7 +8329,7 @@ class LLViewCheckAO: public view_listener_t
8329{ 8329{
8330 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 8330 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
8331 { 8331 {
8332 gMenuHolder->findControl(userdata["control"].asString())->setValue(LLFloaterAO::getInstance()); 8332 gMenuHolder->findControl(userdata["control"].asString())->setValue(LLFloaterAO::getVisible());
8333 return true; 8333 return true;
8334 } 8334 }
8335}; 8335};
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp
index 32d7172..cbcfb86 100755
--- a/linden/indra/newview/llviewermessage.cpp
+++ b/linden/indra/newview/llviewermessage.cpp
@@ -934,7 +934,7 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name)
934 } 934 }
935 break; 935 break;
936 case LLAssetType::AT_LANDMARK: 936 case LLAssetType::AT_LANDMARK:
937 if (!show_keep_discard) 937 if (show_keep_discard)
938 open_landmark((LLViewerInventoryItem*)item, std::string("Landmark: ") + item->getName(), FALSE, LLUUID::null, FALSE); 938 open_landmark((LLViewerInventoryItem*)item, std::string("Landmark: ") + item->getName(), FALSE, LLUUID::null, FALSE);
939 break; 939 break;
940 case LLAssetType::AT_TEXTURE: 940 case LLAssetType::AT_TEXTURE:
diff --git a/linden/indra/newview/llviewerobjectlist.cpp b/linden/indra/newview/llviewerobjectlist.cpp
index 2d6c9f4..ad92fe3 100644
--- a/linden/indra/newview/llviewerobjectlist.cpp
+++ b/linden/indra/newview/llviewerobjectlist.cpp
@@ -242,7 +242,7 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp,
242 updateActive(objectp); 242 updateActive(objectp);
243 243
244 if(!just_created) 244 if(!just_created)
245 primbackup::getInstance()->prim_update(objectp); 245 PrimBackup::getInstance()->primUpdate(objectp);
246 246
247 247
248 248
@@ -276,7 +276,7 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp,
276 gViewerWindow->getWindow()->decBusyCount(); 276 gViewerWindow->getWindow()->decBusyCount();
277 gViewerWindow->getWindow()->setCursor( UI_CURSOR_ARROW ); 277 gViewerWindow->getWindow()->setCursor( UI_CURSOR_ARROW );
278 278
279 primbackup::getInstance()->newprim(objectp); 279 PrimBackup::getInstance()->newPrim(objectp);
280 280
281 } 281 }
282} 282}
diff --git a/linden/indra/newview/primbackup.cpp b/linden/indra/newview/primbackup.cpp
index 613000a..6d9d73f 100644
--- a/linden/indra/newview/primbackup.cpp
+++ b/linden/indra/newview/primbackup.cpp
@@ -1,7 +1,6 @@
1 1
2#include "llviewerprecompiledheaders.h" 2#include "llviewerprecompiledheaders.h"
3 3
4
5// system library includes 4// system library includes
6#include <iostream> 5#include <iostream>
7#include <fstream> 6#include <fstream>
@@ -60,67 +59,89 @@
60 59
61#include "llviewerobjectlist.h" 60#include "llviewerobjectlist.h"
62 61
63primbackup* primbackup::sInstance = 0; 62PrimBackup* PrimBackup::sInstance = NULL;
63
64// Note: these default textures are initialized with hard coded values to
65// prevent cheating. When not in SL, the user-configurable values are used
66// instead (see setDefaultTextures() below).
67static LLUUID LL_TEXTURE_PLYWOOD = LLUUID("89556747-24cb-43ed-920b-47caed15465f");
68static LLUUID LL_TEXTURE_BLANK = LLUUID("5748decc-f629-461c-9a36-a35a221fe21f");
69static LLUUID LL_TEXTURE_INVISIBLE = LLUUID("38b86f85-2575-52a9-a531-23108d8da837");
70static LLUUID LL_TEXTURE_TRANSPARENT = LLUUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903");
71static LLUUID LL_TEXTURE_MEDIA = LLUUID("8b5fec65-8d8d-9dc5-cda8-8fdf2716e361");
72
73void setDefaultTextures()
74{
75 if (!gHippoGridManager->getConnectedGrid()->isSecondLife())
76 {
77 // When not in SL (no texture perm check needed), we can get these
78 // defaults from the user settings...
79 LL_TEXTURE_PLYWOOD = LLUUID(gSavedSettings.getString("DefaultObjectTexture"));
80 LL_TEXTURE_BLANK = LLUUID(gSavedSettings.getString("UIImgWhiteUUID"));
81 if (gSavedSettings.controlExists("UIImgInvisibleUUID"))
82 {
83 // This control only exists in the AllowInvisibleTextureInPicker patch
84 LL_TEXTURE_INVISIBLE = LLUUID(gSavedSettings.getString("UIImgInvisibleUUID"));
85 }
86 }
87}
64 88
65class importResponder: public LLNewAgentInventoryResponder 89class importResponder: public LLNewAgentInventoryResponder
66{ 90{
67 public: 91public:
68 92
69 importResponder(const LLSD& post_data, 93 importResponder(const LLSD& post_data, const LLUUID& vfile_id, LLAssetType::EType asset_type)
70 const LLUUID& vfile_id,
71 LLAssetType::EType asset_type)
72 : LLNewAgentInventoryResponder(post_data, vfile_id, asset_type) 94 : LLNewAgentInventoryResponder(post_data, vfile_id, asset_type)
73 { 95 {
74 } 96 }
75 97
76 98 //virtual
77 //virtual
78 virtual void uploadComplete(const LLSD& content) 99 virtual void uploadComplete(const LLSD& content)
79 { 100 {
80 lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl; 101 lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl;
81 102
82 LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString()); 103 LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString());
83 LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString()); 104 LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString());
84 105
85 // Update L$ and ownership credit information 106 // Update currency and ownership credit information
86 // since it probably changed on the server 107 // since it probably changed on the server
87 if (asset_type == LLAssetType::AT_TEXTURE || 108 if (asset_type == LLAssetType::AT_TEXTURE ||
88 asset_type == LLAssetType::AT_SOUND || 109 asset_type == LLAssetType::AT_SOUND ||
89 asset_type == LLAssetType::AT_ANIMATION) 110 asset_type == LLAssetType::AT_ANIMATION)
90 {
91 gMessageSystem->newMessageFast(_PREHASH_MoneyBalanceRequest);
92 gMessageSystem->nextBlockFast(_PREHASH_AgentData);
93 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
94 gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
95 gMessageSystem->nextBlockFast(_PREHASH_MoneyData);
96 gMessageSystem->addUUIDFast(_PREHASH_TransactionID, LLUUID::null );
97 gAgent.sendReliableMessage();
98
99// LLStringUtil::format_map_t args;
100// args["[AMOUNT]"] = llformat("%d",LLGlobalEconomy::Singleton::getInstance()->getPriceUpload());
101// LLNotifyBox::showXml("UploadPayment", args);
102 }
103
104 // Actually add the upload to viewer inventory
105 llinfos << "Adding " << content["new_inventory_item"].asUUID() << " "
106 << content["new_asset"].asUUID() << " to inventory." << llendl;
107 if(mPostData["folder_id"].asUUID().notNull())
108 {
109 LLPermissions perm;
110 U32 next_owner_perm;
111 perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
112 if (mPostData["inventory_type"].asString() == "snapshot")
113 { 111 {
114 next_owner_perm = PERM_ALL; 112 gMessageSystem->newMessageFast(_PREHASH_MoneyBalanceRequest);
113 gMessageSystem->nextBlockFast(_PREHASH_AgentData);
114 gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
115 gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
116 gMessageSystem->nextBlockFast(_PREHASH_MoneyData);
117 gMessageSystem->addUUIDFast(_PREHASH_TransactionID, LLUUID::null );
118 gAgent.sendReliableMessage();
119
120// LLStringUtil::format_map_t args;
121// args["[AMOUNT]"] = llformat("%d",LLGlobalEconomy::Singleton::getInstance()->getPriceUpload());
122// LLNotifyBox::showXml("UploadPayment", args);
115 } 123 }
116 else 124
125 // Actually add the upload to viewer inventory
126 llinfos << "Adding " << content["new_inventory_item"].asUUID() << " "
127 << content["new_asset"].asUUID() << " to inventory." << llendl;
128 if (mPostData["folder_id"].asUUID().notNull())
117 { 129 {
118 next_owner_perm = PERM_MOVE | PERM_TRANSFER; 130 LLPermissions perm;
119 } 131 U32 next_owner_perm;
120 perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, next_owner_perm); 132 perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null);
121 S32 creation_date_now = time_corrected(); 133 if (mPostData["inventory_type"].asString() == "snapshot")
122 LLPointer<LLViewerInventoryItem> item 134 {
123 = new LLViewerInventoryItem(content["new_inventory_item"].asUUID(), 135 next_owner_perm = PERM_ALL;
136 }
137 else
138 {
139 next_owner_perm = PERM_MOVE | PERM_TRANSFER;
140 }
141 perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, next_owner_perm);
142 S32 creation_date_now = time_corrected();
143 LLPointer<LLViewerInventoryItem> item
144 = new LLViewerInventoryItem(content["new_inventory_item"].asUUID(),
124 mPostData["folder_id"].asUUID(), 145 mPostData["folder_id"].asUUID(),
125 perm, 146 perm,
126 content["new_asset"].asUUID(), 147 content["new_asset"].asUUID(),
@@ -131,95 +152,96 @@ class importResponder: public LLNewAgentInventoryResponder
131 LLSaleInfo::DEFAULT, 152 LLSaleInfo::DEFAULT,
132 LLInventoryItem::II_FLAGS_NONE, 153 LLInventoryItem::II_FLAGS_NONE,
133 creation_date_now); 154 creation_date_now);
134 gInventory.updateItem(item); 155 gInventory.updateItem(item);
135 gInventory.notifyObservers(); 156 gInventory.notifyObservers();
136 } 157 }
137 else 158 else
138 { 159 {
139 llwarns << "Can't find a folder to put it in" << llendl; 160 llwarns << "Can't find a folder to put it into" << llendl;
140 } 161 }
141 162
142 // remove the "Uploading..." message 163 // remove the "Uploading..." message
143 LLUploadDialog::modalUploadFinished(); 164 LLUploadDialog::modalUploadFinished();
144
145 primbackup::getInstance()->update_map(content["new_asset"].asUUID());
146 primbackup::getInstance()->upload_next_asset();
147 165
166 PrimBackup::getInstance()->updateMap(content["new_asset"].asUUID());
167 PrimBackup::getInstance()->uploadNextAsset();
148 } 168 }
149
150}; 169};
151 170
152
153
154class CacheReadResponder : public LLTextureCache::ReadResponder 171class CacheReadResponder : public LLTextureCache::ReadResponder
172{
173public:
174 CacheReadResponder(const LLUUID& id, LLImageFormatted* image)
175 : mFormattedImage(image), mID(id)
176 {
177 setImage(image);
178 }
179 void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal)
155 { 180 {
156 public: 181 if (imageformat == IMG_CODEC_TGA && mFormattedImage->getCodec() == IMG_CODEC_J2C)
157 CacheReadResponder(const LLUUID& id, LLImageFormatted* image)
158 : mFormattedImage(image), mID(id)
159 { 182 {
160 setImage(image); 183 llwarns << "FAILED: texture " << mID << " is formatted as TGA. Not saving." << llendl;
184 PrimBackup::getInstance()->mNonExportedTextures |= PrimBackup::TEXTURE_BAD_ENCODING;
185 mFormattedImage = NULL;
186 mImageSize = 0;
187 return;
161 } 188 }
162 void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal) 189
190 if (mFormattedImage.notNull())
163 { 191 {
164 if(imageformat==IMG_CODEC_TGA && mFormattedImage->getCodec()==IMG_CODEC_J2C) 192 llassert_always(mFormattedImage->getCodec() == imageformat);
165 { 193 mFormattedImage->appendData(data, datasize);
166 llwarns<<"Bleh its a tga not saving"<<llendl; 194 }
167 mFormattedImage=NULL; 195 else
168 mImageSize=0; 196 {
169 return; 197 mFormattedImage = LLImageFormatted::createFromType(imageformat);
170 } 198 mFormattedImage->setData(data, datasize);
199 }
200 mImageSize = imagesize;
201 mImageLocal = imagelocal;
202 }
171 203
172 if (mFormattedImage.notNull()) 204 virtual void completed(bool success)
173 { 205 {
174 llassert_always(mFormattedImage->getCodec() == imageformat); 206 if (success && mFormattedImage.notNull() && mImageSize > 0)
175 mFormattedImage->appendData(data, datasize); 207 {
176 } 208 llinfos << "SUCCESS getting texture " << mID << llendl;
177 else 209 std::string name;
210 mID.toString(name);
211 name = PrimBackup::getInstance()->getfolder() + "//" + name;
212 llinfos << "Saving to " << name << llendl;
213 if (!mFormattedImage->save(name))
178 { 214 {
179 mFormattedImage = LLImageFormatted::createFromType(imageformat); 215 llwarns << "FAILED to save texture " << mID << llendl;
180 mFormattedImage->setData(data,datasize); 216 PrimBackup::getInstance()->mNonExportedTextures |= PrimBackup::TEXTURE_SAVED_FAILED;
181 } 217 }
182 mImageSize = imagesize;
183 mImageLocal = imagelocal;
184 } 218 }
185 219 else
186 virtual void completed(bool success)
187 { 220 {
188 if(success && (mFormattedImage.notNull()) && mImageSize>0) 221 if (!success)
189 { 222 {
190 223 llwarns << "FAILED to get texture " << mID << llendl;
191 llinfos << "SUCCESS getting texture "<<mID<< llendl; 224 PrimBackup::getInstance()->mNonExportedTextures |= PrimBackup::TEXTURE_MISSING;
192
193 std::string name;
194 mID.toString(name);
195 llinfos << "Saving to "<<(primbackup::getInstance()->getfolder()+"//"+name)<<llendl;
196 if(!mFormattedImage->save(primbackup::getInstance()->getfolder()+"//"+name))
197 {
198 llinfos << "FAIL saving texture "<<mID<< llendl;
199 }
200
201 } 225 }
202 else 226 if (mFormattedImage.isNull())
203 { 227 {
204 if(!success) 228 llwarns << "FAILED: NULL texture " << mID << llendl;
205 llwarns << "FAIL NOT SUCCESSFUL getting texture "<<mID<< llendl; 229 PrimBackup::getInstance()->mNonExportedTextures |= PrimBackup::TEXTURE_IS_NULL;
206 if(mFormattedImage.isNull()) 230 }
207 llwarns << "FAIL image is NULL "<<mID<< llendl;
208 }
209
210 primbackup::getInstance()->m_nexttextureready=true;
211 //JUST SAY NO TO APR DEADLOCKING
212 //primbackup::getInstance()->export_next_texture();
213 } 231 }
214 private:
215 LLPointer<LLImageFormatted> mFormattedImage;
216 LLUUID mID;
217 };
218 232
233 PrimBackup::getInstance()->mNextTextureReady = true;
234 //JUST SAY NO TO APR DEADLOCKING
235 //PrimBackup::getInstance()->exportNextTexture();
236 }
237private:
238 LLPointer<LLImageFormatted> mFormattedImage;
239 LLUUID mID;
240};
219 241
220 242
221primbackup::primbackup() 243PrimBackup::PrimBackup()
222: LLFloater( std::string("Prim Import Floater") ) 244: LLFloater( std::string("Prim Import Floater"), std::string("FloaterPrimImport"), LLStringUtil::null)
223{ 245{
224 LLUICtrlFactory::getInstance()->buildFloater( this, "floater_prim_import.xml" ); 246 LLUICtrlFactory::getInstance()->buildFloater( this, "floater_prim_import.xml" );
225 247
@@ -228,253 +250,354 @@ primbackup::primbackup()
228 //reshape( rect.getWidth(), rect.getHeight(), FALSE ); 250 //reshape( rect.getWidth(), rect.getHeight(), FALSE );
229 //setRect( rect ); 251 //setRect( rect );
230 252
231 running=false; 253 mRunning = false;
232 textures.clear(); 254 mTexturesList.clear();
233 assetmap.clear(); 255 mAssetMap.clear();
234 current_asset=LLUUID::null; 256 mCurrentAsset = LLUUID::null;
235 m_retexture=false; 257 mRetexture = false;
236 close(); 258 close();
237} 259}
238 260
239 261
240//////////////////////////////////////////////////////////////////////////////// 262////////////////////////////////////////////////////////////////////////////////
241// 263//
242primbackup* primbackup::getInstance() 264PrimBackup* PrimBackup::getInstance()
243{ 265{
244 if ( ! sInstance ) 266 if (!sInstance)
245 sInstance = new primbackup(); 267 sInstance = new PrimBackup();
246
247 return sInstance; 268 return sInstance;
248} 269}
249 270
250primbackup::~primbackup() 271PrimBackup::~PrimBackup()
251{ 272{
252 // save position of floater 273 // save position of floater
253 gSavedSettings.setRect( "FloaterPrimImport", getRect() ); 274 gSavedSettings.setRect("FloaterPrimImport", getRect());
254 sInstance = 0; 275 sInstance = NULL;
255} 276}
256 277
257void primbackup::draw() 278void PrimBackup::draw()
258{ 279{
259 LLFloater::draw(); 280 LLFloater::draw();
260} 281}
261 282
262void primbackup::show() 283void PrimBackup::show(bool exporting)
263{ 284{
264 // set the title 285 // set the title
265 setTitle( "stuff" ); 286 if (exporting)
266 m_curobject=1; 287 {
267 m_curprim=0; 288 setTitle("Object export");
268 m_objects=0; 289 }
269 m_prims=0; 290 else
270 m_textures=0; 291 {
271 m_curtexture=0; 292 setTitle("Object import");
272 rezcount=0; 293 }
294 mCurObject = 1;
295 mCurPrim = 0;
296 mObjects = 0;
297 mPrims = 0;
298 mRezCount = 0;
273 299
274 // make floater appear 300 // make floater appear
275 setVisibleAndFrontmost(); 301 setVisibleAndFrontmost();
276} 302}
277 303
278 304void PrimBackup::onClose(bool app_quitting)
279void primbackup::onClose( bool app_quitting )
280{ 305{
281 setVisible( false ); 306 setVisible(false);
282 // HACK for fast XML iteration replace with: 307 // HACK for fast XML iteration replace with:
283 // destroy(); 308 // destroy();
284} 309}
285 310
286void primbackup::updateexportnumbers() 311void PrimBackup::updateExportNumbers()
287{ 312{
313 std::stringstream sstr;
314 LLUICtrl* ctrl = getChild<LLUICtrl>("name_label");
288 315
289 std::stringstream sstr; 316 sstr << "Export Progress \n";
290 LLUICtrl * ctrl=this->getChild<LLUICtrl>("name_label");
291
292 sstr<<"Export Progress \n";
293 317
294 sstr << "Remaining Textures "<<textures.size()<<"\n"; 318 sstr << "Remaining Textures " << mTexturesList.size() << "\n";
295 ctrl->setValue(LLSD("Text")=sstr.str()); 319 ctrl->setValue(LLSD("Text") = sstr.str());
296
297} 320}
298 321
299 322void PrimBackup::updateImportNumbers()
300void primbackup::updateimportnumbers()
301{ 323{
302 std::stringstream sstr; 324 std::stringstream sstr;
303 LLUICtrl * ctrl=this->getChild<LLUICtrl>("name_label"); 325 LLUICtrl* ctrl = getChild<LLUICtrl>("name_label");
304 326
305 if(m_retexture) 327 if (mRetexture)
306 { 328 {
307 sstr << " Textures uploads remaining : "<<textures.size()<<"\n"; 329 sstr << " Textures uploads remaining : " << mTexturesList.size() << "\n";
308 ctrl->setValue(LLSD("Text")=sstr.str()); 330 ctrl->setValue(LLSD("Text") = sstr.str());
309 } 331 }
310 else 332 else
311 { 333 {
312 sstr << " Textures uploads N/A \n"; 334 sstr << " Textures uploads N/A \n";
313 ctrl->setValue(LLSD("Text")=sstr.str()); 335 ctrl->setValue(LLSD("Text") = sstr.str());
314 } 336 }
315 sstr << " Objects "<<this->m_curobject<<"/"<<this->m_objects<<"\n";
316 ctrl->setValue(LLSD("Text")=sstr.str());
317
318 sstr << " Rez "<<this->rezcount<<"/"<<this->m_prims;
319 ctrl->setValue(LLSD("Text")=sstr.str());
320 337
321 sstr << " Build "<<this->m_curprim<<"/"<<this->m_prims; 338 sstr << " Objects " << mCurObject << "/" << mObjects << "\n";
322 ctrl->setValue(LLSD("Text")=sstr.str()); 339 ctrl->setValue(LLSD("Text") = sstr.str());
323 340
341 sstr << " Rez "<< mRezCount << "/" << mPrims;
342 ctrl->setValue(LLSD("Text") = sstr.str());
324 343
344 sstr << " Build " << mCurPrim << "/" << mPrims;
345 ctrl->setValue(LLSD("Text") = sstr.str());
325} 346}
326 347
327void primbackup::pre_export_object() 348void PrimBackup::exportObject()
328{ 349{
329 textures.clear(); 350 mTexturesList.clear();
330 llsd.clear(); 351 mLLSD.clear();
331 this_group.clear(); 352 mThisGroup.clear();
353
354 setDefaultTextures();
332 355
333 // Open the file save dialog 356 // Open the file save dialog
334 LLFilePicker& file_picker = LLFilePicker::instance(); 357 LLFilePicker& file_picker = LLFilePicker::instance();
335 if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_XML ) ) 358 if (!file_picker.getSaveFile(LLFilePicker::FFSAVE_XML, LLSelectMgr::getInstance()->getSelection()->getFirstRootNode()->mName))
336 { 359 {
337 // User canceled save. 360 // User canceled save.
338 return; 361 return;
339 } 362 }
340
341 file_name = file_picker.getCurFile();
342 folder = gDirUtilp->getDirName(file_name);
343 363
344 export_state=EXPORT_INIT; 364 mFileName = file_picker.getCurFile();
345 gIdleCallbacks.addFunction(exportworker, NULL); 365 mFolder = gDirUtilp->getDirName(mFileName);
346}
347 366
367 mNonExportedTextures = TEXTURE_OK;
368
369 mExportState = EXPORT_INIT;
370 gIdleCallbacks.addFunction(exportWorker, NULL);
371}
348 372
349// static 373// static
350bool primbackup::check_perms( LLSelectNode* node ) 374bool PrimBackup::validatePerms(const LLPermissions *item_permissions)
351{ 375{
352 LLPermissions *perms = node->mPermissions; 376 if(gHippoGridManager->getConnectedGrid()->isSecondLife())
353 return (gAgent.getID() == perms->getOwner() && 377 {
354 gAgent.getID() == perms->getCreator() && 378 // In Second Life, you must be the creator to be permitted to export the asset.
355 (PERM_ITEM_UNRESTRICTED & 379 return (gAgent.getID() == item_permissions->getOwner() &&
356 perms->getMaskOwner()) == PERM_ITEM_UNRESTRICTED); 380 gAgent.getID() == item_permissions->getCreator() &&
381 (PERM_ITEM_UNRESTRICTED & item_permissions->getMaskOwner()) == PERM_ITEM_UNRESTRICTED);
382 }
383 else
384 {
385 // Out of Second Life, simply check that you're the owner and the asset is full perms.
386 return (gAgent.getID() == item_permissions->getOwner() &&
387 (item_permissions->getMaskOwner() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED);
388 }
357} 389}
358 390
391// So far, only Second Life forces TPVs to verify the creator for textures...
392// which sucks, because there is no other way to check for the texture
393// permissions or creator than to try and find the asset(s) corresponding to
394// the texture in the inventory and check the permissions/creator on the said
395// asset(s), meaning that if you created the texture and subsequently deleted
396// it from your inventory, you will not be able to export it any more !!!
397// The "must be creator" stuff also goes against the usage in Linden Lab's own
398// official viewers, since those allow you to save full perm textures (such as
399// the textures in the Library), whoever is the actual creator... Go figure !
400LLUUID PrimBackup::validateTextureID(LLUUID asset_id)
401{
402 if (!gHippoGridManager->getConnectedGrid()->isSecondLife())
403 {
404 // If we are not in Second Life, don't bother
405 return asset_id;
406 }
359 407
360void primbackup::exportworker(void *userdata) 408 LLUUID texture = LL_TEXTURE_PLYWOOD;
361{ 409 if (asset_id == texture ||
362 primbackup::getInstance()->updateexportnumbers(); 410 asset_id == LL_TEXTURE_BLANK ||
411 asset_id == LL_TEXTURE_INVISIBLE ||
412 asset_id == LL_TEXTURE_TRANSPARENT ||
413 asset_id == LL_TEXTURE_MEDIA)
414 {
415 // Allow to export a grid's default textures
416 return asset_id;
417 }
418 LLViewerInventoryCategory::cat_array_t cats;
419 LLViewerInventoryItem::item_array_t items;
420 LLAssetIDMatches asset_id_matches(asset_id);
421 gInventory.collectDescendentsIf(LLUUID::null,
422 cats,
423 items,
424 LLInventoryModel::INCLUDE_TRASH,
425 asset_id_matches);
426
427 if (items.count())
428 {
429 for (S32 i = 0; i < items.count(); i++)
430 {
431 const LLPermissions item_permissions = items[i]->getPermissions();
432 if (validatePerms(&item_permissions))
433 {
434 texture = asset_id;
435 }
436 }
437 }
363 438
364 switch(primbackup::getInstance()->export_state) 439 if (texture != asset_id)
365 { 440 {
366 case EXPORT_INIT: { 441 mNonExportedTextures |= TEXTURE_BAD_PERM;
367 primbackup::getInstance()->show(); 442 }
368 LLSelectMgr::getInstance()->getSelection()->ref(); 443
444 return texture;
445}
369 446
370 struct ff : public LLSelectedNodeFunctor 447void PrimBackup::exportWorker(void *userdata)
448{
449 PrimBackup::getInstance()->updateExportNumbers();
450
451 switch (PrimBackup::getInstance()->mExportState)
452 {
453 case EXPORT_INIT:
371 { 454 {
372 virtual bool apply(LLSelectNode* node) 455 PrimBackup::getInstance()->show(true);
456 LLSelectMgr::getInstance()->getSelection()->ref();
457
458 struct ff : public LLSelectedNodeFunctor
373 { 459 {
374 return primbackup::check_perms( node ); 460 virtual bool apply(LLSelectNode* node)
375 } 461 {
376 } func; 462 return PrimBackup::getInstance()->validatePerms(node->mPermissions);
463 }
464 } func;
377 465
378 if(LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func,false)) 466 if (LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func, false))
379 {
380 if(gHippoGridManager->getConnectedGrid()->isSecondLife())
381 { 467 {
382 LLNotifications::instance().add("NoTextureExportSL"); 468 PrimBackup::getInstance()->mExportState = EXPORT_STRUCTURE;
469 }
470 else
471 {
472 llwarns << "Incorrect permission to export" << llendl;
473 PrimBackup::getInstance()->mExportState = EXPORT_FAILED;
474 LLSelectMgr::getInstance()->getSelection()->unref();
383 } 475 }
384 primbackup::getInstance()->export_state=EXPORT_STRUCTURE;
385 } 476 }
386 else 477 break;
478
479 case EXPORT_STRUCTURE:
387 { 480 {
388 llwarns << "Incorrect permission to export" << llendl; 481 struct ff : public LLSelectedObjectFunctor
389 primbackup::getInstance()->export_state=EXPORT_DONE; 482 {
390 primbackup::getInstance()->close(); 483 virtual bool apply(LLViewerObject* object)
391 gIdleCallbacks.deleteFunction(exportworker); 484 {
485 bool is_attachment = object->isAttachment();
486 object->boostTexturePriority(TRUE);
487 LLViewerObject::child_list_t children = object->getChildren();
488 children.push_front(object); //push root onto list
489 LLSD prim_llsd = PrimBackup::getInstance()->primsToLLSD(children, is_attachment);
490 LLSD stuff;
491 if (is_attachment)
492 {
493 stuff["root_position"] = object->getPositionEdit().getValue();
494 stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotationEdit());
495 }
496 else
497 {
498 stuff["root_position"] = object->getPosition().getValue();
499 stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotation());
500 }
501 stuff["group_body"] = prim_llsd;
502 PrimBackup::getInstance()->mLLSD["data"].append(stuff);
503 return true;
504 }
505 } func;
506
507 PrimBackup::getInstance()->mExportState = EXPORT_LLSD;
508 LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, false);
392 LLSelectMgr::getInstance()->getSelection()->unref(); 509 LLSelectMgr::getInstance()->getSelection()->unref();
393 } 510 }
394 break; 511 break;
395 }
396 512
397 case EXPORT_STRUCTURE: { 513 case EXPORT_TEXTURES:
398 struct ff : public LLSelectedObjectFunctor
399 { 514 {
400 virtual bool apply(LLViewerObject* object) 515 // Exporting object textures (or other content) from Second Life
516 // without checking creator is a violation of the Second Life
517 // Policy on Third-Party Viewers and Terms of Service.
518 if (PrimBackup::getInstance()->mNextTextureReady == false)
519 return;
520
521 // Ok we got work to do
522 PrimBackup::getInstance()->mNextTextureReady = false;
523
524 if (PrimBackup::getInstance()->mTexturesList.empty())
401 { 525 {
402 object->boostTexturePriority(TRUE); 526 PrimBackup::getInstance()->mExportState = EXPORT_DONE;
403 LLViewerObject::child_list_t children = object->getChildren(); 527 return;
404 children.push_front(object); //push root onto list
405 LLSD prim_llsd=primbackup::getInstance()->prims_to_llsd(children);
406 LLSD stuff;
407 stuff["root_position"] = object->getPosition().getValue();
408 stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotation());
409 stuff["group_body"] = prim_llsd;
410 primbackup::getInstance()->llsd["data"].append(stuff);
411 return true;
412 } 528 }
413 } func;
414
415 primbackup::getInstance()->export_state=EXPORT_LLSD;
416 LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func,false);
417 LLSelectMgr::getInstance()->getSelection()->unref();
418 529
530 PrimBackup::getInstance()->exportNextTexture();
531 }
419 break; 532 break;
420 }
421 533
422 case EXPORT_TEXTURES: { 534 case EXPORT_LLSD:
423 // Exporting object textures (or other content) from Second Life
424 // without checking creator is a violation of the Second Life
425 // Policy on Third-Party Viewers and Terms of Service.
426 if(gHippoGridManager->getConnectedGrid()->isSecondLife())
427 { 535 {
428 primbackup::getInstance()->export_state=EXPORT_DONE; 536 // Create a file stream and write to it
429 return; 537 llofstream export_file(PrimBackup::getInstance()->mFileName);
538 LLSDSerialize::toPrettyXML(PrimBackup::getInstance()->mLLSD, export_file);
539 export_file.close();
540 PrimBackup::getInstance()->mNextTextureReady = true;
541 PrimBackup::getInstance()->mExportState = EXPORT_TEXTURES;
430 } 542 }
543 break;
431 544
432 if(primbackup::getInstance()->m_nexttextureready==false) 545 case EXPORT_DONE:
433 return; 546 gIdleCallbacks.deleteFunction(exportWorker);
434 547 if (PrimBackup::getInstance()->mNonExportedTextures == PrimBackup::TEXTURE_OK)
435 //Ok we got work to do
436 primbackup::getInstance()->m_nexttextureready=false;
437
438 if(primbackup::getInstance()->textures.empty())
439 { 548 {
440 primbackup::getInstance()->export_state=EXPORT_DONE; 549 llinfos << "Export successful and complete." << llendl;
441 return; 550 LLNotifications::instance().add("ExportSuccessful");
442 } 551 }
443 552 else
444 primbackup::getInstance()->export_next_texture(); 553 {
445 break; 554 llinfos << "Export successful but incomplete: some texture(s) not saved." << llendl;
446 } 555 std::string reason;
447 556 if (PrimBackup::getInstance()->mNonExportedTextures & PrimBackup::TEXTURE_BAD_PERM)
448 case EXPORT_LLSD: { 557 {
449 // Create a file stream and write to it 558 reason += "\nBad permissions/creator.";
450 llofstream export_file(primbackup::getInstance()->file_name); 559 }
451 LLSDSerialize::toPrettyXML(primbackup::getInstance()->llsd, export_file); 560 if (PrimBackup::getInstance()->mNonExportedTextures & PrimBackup::TEXTURE_MISSING)
452 export_file.close(); 561 {
453 primbackup::getInstance()->m_nexttextureready=true; 562 reason += "\nMissing texture.";
454 primbackup::getInstance()->export_state=EXPORT_TEXTURES; 563 }
564 if (PrimBackup::getInstance()->mNonExportedTextures & PrimBackup::TEXTURE_BAD_ENCODING)
565 {
566 reason += "\nBad texture encoding.";
567 }
568 if (PrimBackup::getInstance()->mNonExportedTextures & PrimBackup::TEXTURE_IS_NULL)
569 {
570 reason += "\nNull texture.";
571 }
572 if (PrimBackup::getInstance()->mNonExportedTextures & PrimBackup::TEXTURE_SAVED_FAILED)
573 {
574 reason += "\nCould not write to disk.";
575 }
576 LLSD args;
577 args["REASON"] = reason;
578 LLNotifications::instance().add("ExportPartial", args);
579 }
580 PrimBackup::getInstance()->close();
455 break; 581 break;
456 }
457 582
458 case EXPORT_DONE: { 583 case EXPORT_FAILED:
459 llinfos << "Backup complete" << llendl; 584 gIdleCallbacks.deleteFunction(exportWorker);
460 gIdleCallbacks.deleteFunction(exportworker); 585 llwarns << "Export process aborted." << llendl;
461 primbackup::getInstance()->close(); 586 LLNotifications::instance().add("ExportFailed");
587 PrimBackup::getInstance()->close();
462 break; 588 break;
463 }
464 } 589 }
465} 590}
466 591
467LLSD primbackup::prims_to_llsd(LLViewerObject::child_list_t child_list) 592LLSD PrimBackup::primsToLLSD(LLViewerObject::child_list_t child_list, bool is_attachment)
468{ 593{
469
470 LLViewerObject* object; 594 LLViewerObject* object;
471 LLSD llsd; 595 LLSD llsd;
472
473 char localid[16]; 596 char localid[16];
474 597
475 for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) 598 for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i)
476 { 599 {
477 object=(*i); 600 object = (*i);
478 LLUUID id = object->getID(); 601 LLUUID id = object->getID();
479 602
480 llinfos << "Exporting prim " << object->getID().asString() << llendl; 603 llinfos << "Exporting prim " << object->getID().asString() << llendl;
@@ -485,16 +608,31 @@ LLSD primbackup::prims_to_llsd(LLViewerObject::child_list_t child_list)
485 608
486 if (!object->isRoot()) 609 if (!object->isRoot())
487 { 610 {
488
489 // Parent id 611 // Parent id
490 snprintf(localid, sizeof(localid), "%u", object->getSubParent()->getLocalID()); 612 snprintf(localid, sizeof(localid), "%u", object->getSubParent()->getLocalID());
491 prim_llsd["parent"] = localid; 613 prim_llsd["parent"] = localid;
492 } 614 }
493 615
616 // Name and description
617 LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->findNode(object);
618 if (node)
619 {
620 prim_llsd["name"] = node->mName;
621 prim_llsd["description"] = node->mDescription;
622 }
623
494 // Transforms 624 // Transforms
495 prim_llsd["position"] = object->getPosition().getValue(); 625 if (is_attachment)
626 {
627 prim_llsd["position"] = object->getPositionEdit().getValue();
628 prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotationEdit());
629 }
630 else
631 {
632 prim_llsd["position"] = object->getPosition().getValue();
633 prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation());
634 }
496 prim_llsd["scale"] = object->getScale().getValue(); 635 prim_llsd["scale"] = object->getScale().getValue();
497 prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation());
498 636
499 // Flags 637 // Flags
500 prim_llsd["shadows"] = object->flagCastShadows(); 638 prim_llsd["shadows"] = object->flagCastShadows();
@@ -523,37 +661,55 @@ LLSD primbackup::prims_to_llsd(LLViewerObject::child_list_t child_list)
523 // Sculpt 661 // Sculpt
524 LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); 662 LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
525 prim_llsd["sculpt"] = sculpt->asLLSD(); 663 prim_llsd["sculpt"] = sculpt->asLLSD();
526 664
527 LLUUID sculpt_texture=sculpt->getSculptTexture(); 665 LLUUID sculpt_texture = sculpt->getSculptTexture();
528 bool alreadyseen=false; 666 if (sculpt_texture == validateTextureID(sculpt_texture))
529 std::list<LLUUID>::iterator iter;
530 for(iter = textures.begin(); iter != textures.end() ; iter++)
531 { 667 {
532 if( (*iter)==sculpt_texture) 668 bool alreadyseen = false;
533 alreadyseen=true; 669 std::list<LLUUID>::iterator iter;
670 for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
671 {
672 if ((*iter) == sculpt_texture)
673 alreadyseen = true;
674 }
675 if (alreadyseen == false)
676 {
677 llinfos << "Found a sculpt texture, adding to list " << sculpt_texture << llendl;
678 mTexturesList.push_back(sculpt_texture);
679 }
534 } 680 }
535 if(alreadyseen==false) 681 else
536 { 682 {
537 llinfos << "Found a sculpt texture, adding to list "<<sculpt_texture<<llendl; 683 llwarns << "Incorrect permission to export a sculpt texture." << llendl;
538 textures.push_back(sculpt_texture); 684 PrimBackup::getInstance()->mExportState = EXPORT_FAILED;
539 } 685 }
540 } 686 }
541 687
542 // Textures 688 // Textures
543 LLSD te_llsd; 689 LLSD te_llsd;
690 LLSD this_te_llsd;
691 LLUUID t_id;
544 U8 te_count = object->getNumTEs(); 692 U8 te_count = object->getNumTEs();
545 for (U8 i = 0; i < te_count; i++) 693 for (U8 i = 0; i < te_count; i++)
546 { 694 {
547 bool alreadyseen=false; 695 bool alreadyseen = false;
548 te_llsd.append(object->getTE(i)->asLLSD()); 696 t_id = validateTextureID(object->getTE(i)->getID());
549 std::list<LLUUID>::iterator iter; 697 this_te_llsd = object->getTE(i)->asLLSD();
550 for(iter = textures.begin(); iter != textures.end() ; iter++) 698 this_te_llsd["imageid"] = t_id;
699 te_llsd.append(this_te_llsd);
700 // We export these default textures -- MC
701 //if (t_id != LL_TEXTURE_BLANK && t_id != LL_TEXTURE_INVISIBLE)
702 if (t_id.notNull())
551 { 703 {
552 if( (*iter)==object->getTE(i)->getID()) 704 std::list<LLUUID>::iterator iter;
553 alreadyseen=true; 705 for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
706 {
707 if ((*iter) == t_id)
708 alreadyseen = true;
709 }
710 if (alreadyseen == false)
711 mTexturesList.push_back(t_id);
554 } 712 }
555 if(alreadyseen==false)
556 textures.push_back(object->getTE(i)->getID());
557 } 713 }
558 prim_llsd["textures"] = te_llsd; 714 prim_llsd["textures"] = te_llsd;
559 715
@@ -563,43 +719,51 @@ LLSD primbackup::prims_to_llsd(LLViewerObject::child_list_t child_list)
563 llsd[(const char*)localid] = prim_llsd; 719 llsd[(const char*)localid] = prim_llsd;
564 } 720 }
565 721
566 updateexportnumbers(); 722 updateExportNumbers();
567 723
568 return llsd; 724 return llsd;
569} 725}
570 726
571 727void PrimBackup::exportNextTexture()
572void primbackup::export_next_texture()
573{ 728{
574 if(textures.empty()) 729 if (mTexturesList.empty())
575 { 730 {
576 llinfos << "Finished exporting textures "<<llendl; 731 llinfos << "Finished exporting textures" << llendl;
577 return; 732 return;
578 } 733 }
579 734
580 std::list<LLUUID>::iterator iter;
581 iter = textures.begin();
582
583 LLUUID id; 735 LLUUID id;
736 std::list<LLUUID>::iterator iter;
737 iter = mTexturesList.begin();
584 738
585 while(1) 739 while (true)
586 { 740 {
587 if(iter==textures.end()) 741 if (iter == mTexturesList.end())
588 { 742 {
589 m_nexttextureready=true; 743 mNextTextureReady = true;
590 return; 744 return;
591 } 745 }
592 746
593 id=(*iter); 747 id = (*iter);
748 if (id.isNull())
749 {
750 // NULL texture id: just remove and ignore.
751 mTexturesList.remove(id);
752 iter = mTexturesList.begin();
753 continue;
754 }
594 755
595 LLViewerImage * imagep = gImageList.hasImage(id); 756 LLViewerImage* imagep = gImageList.hasImage(id);
596 if(imagep!=NULL) 757 if (imagep != NULL)
597 { 758 {
598 S32 cur_discard = imagep->getDiscardLevel(); 759 S32 cur_discard = imagep->getDiscardLevel();
599 if(cur_discard>0) 760 if (cur_discard > 0)
600 { 761 {
601 if(imagep->getBoostLevel()!=LLViewerImageBoostLevel::BOOST_PREVIEW) 762 if (imagep->getBoostLevel() != LLViewerImageBoostLevel::BOOST_PREVIEW)
602 imagep->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW); //we want to force discard 0 this one does this. 763 {
764 // we want to force discard 0: this one does this.
765 imagep->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW);
766 }
603 } 767 }
604 else 768 else
605 { 769 {
@@ -608,427 +772,428 @@ void primbackup::export_next_texture()
608 } 772 }
609 else 773 else
610 { 774 {
611 llwarns<<" We *DONT* have the texture "<<llendl; 775 llwarns << "We *DON'T* have the texture " << id.asString() << llendl;
776 mNonExportedTextures |= TEXTURE_MISSING;
777 mTexturesList.remove(id);
778 return;
612 } 779 }
613 iter++; 780 iter++;
614 } 781 }
615 782
616 textures.remove(id); 783 mTexturesList.remove(id);
617 784
618 llinfos<<"Requesting texture "<<id<<llendl; 785 llinfos << "Requesting texture " << id << llendl;
619 LLImageJ2C * mFormattedImage = new LLImageJ2C; 786 LLImageJ2C* mFormattedImage = new LLImageJ2C;
620 CacheReadResponder* responder = new CacheReadResponder(id, mFormattedImage); 787 CacheReadResponder* responder = new CacheReadResponder(id, mFormattedImage);
621 LLAppViewer::getTextureCache()->readFromCache(id,LLWorkerThread::PRIORITY_HIGH,0,999999,responder); 788 LLAppViewer::getTextureCache()->readFromCache(id, LLWorkerThread::PRIORITY_HIGH, 0, 999999, responder);
622} 789}
623 790
624 791void PrimBackup::importObject(bool upload)
625
626void primbackup::import_object(bool upload)
627{ 792{
793 mTexturesList.clear();
794 mAssetMap.clear();
795 mCurrentAsset = LLUUID::null;
628 796
797 setDefaultTextures();
629 798
630 textures.clear(); 799 mRetexture = upload;
631 assetmap.clear();
632 current_asset=LLUUID::null;
633
634 this->m_retexture=upload;
635 800
636 // Open the file open dialog 801 // Open the file open dialog
637 LLFilePicker& file_picker = LLFilePicker::instance(); 802 LLFilePicker& file_picker = LLFilePicker::instance();
638 if( !file_picker.getOpenFile( LLFilePicker::FFLOAD_XML ) ) 803 if (!file_picker.getOpenFile(LLFilePicker::FFLOAD_XML))
639 { 804 {
640 // User canceled save. 805 // User canceled save.
641 return; 806 return;
642 } 807 }
643 std::string file_name = file_picker.getFirstFile().c_str(); 808 std::string file_name = file_picker.getFirstFile().c_str();
644 folder = gDirUtilp->getDirName(file_name); 809 mFolder = gDirUtilp->getDirName(file_name);
645 810
646 { 811 LLSD import_llsd;
647 LLSD import_llsd; 812 llifstream import_file(file_name);
648 llifstream import_file(file_name); 813 S32 status;
649 S32 status; 814 status = LLSDSerialize::fromXML(import_llsd, import_file);
650 status = LLSDSerialize::fromXML(import_llsd, import_file); 815 import_file.close();
651 import_file.close();
652
653 if (LLSDParser::PARSE_FAILURE == status)
654 {
655 llwarns << "invalid xml file." << llendl;
656 return;
657 }
658 816
659 llsd = import_llsd; 817 if (LLSDParser::PARSE_FAILURE == status)
818 {
819 llwarns << "invalid xml file." << llendl;
820 return;
660 } 821 }
661 822
662 show(); 823 mLLSD = import_llsd;
824
825 show(false);
826
827 mAgentPos = gAgent.getPositionAgent();
828 mAgentRot = LLQuaternion(gAgent.getAtAxis(), gAgent.getLeftAxis(), gAgent.getUpAxis());
829
830 // Get the texture map
663 831
664 //Get the texture map
665
666 LLSD::map_const_iterator prim_it; 832 LLSD::map_const_iterator prim_it;
667 LLSD::array_const_iterator prim_arr_it; 833 LLSD::array_const_iterator prim_arr_it;
668
669 this->m_curobject=1;
670 this->m_curprim=1;
671 this->m_objects=llsd["data"].size();
672 this->m_prims=0;
673 rezcount=0;
674 834
675 updateimportnumbers(); 835 mCurObject = 1;
836 mCurPrim = 1;
837 mObjects = mLLSD["data"].size();
838 mPrims = 0;
839 mRezCount = 0;
840 updateImportNumbers();
676 841
677 for( prim_arr_it = llsd["data"].beginArray(); prim_arr_it != llsd["data"].endArray(); prim_arr_it++) 842 for (prim_arr_it = mLLSD["data"].beginArray(); prim_arr_it != mLLSD["data"].endArray(); prim_arr_it++)
678 { 843 {
679
680 LLSD llsd2; 844 LLSD llsd2;
681 llsd2=(*prim_arr_it)["group_body"]; 845 llsd2 = (*prim_arr_it)["group_body"];
682 846
683 for( prim_it = llsd2.beginMap(); prim_it != llsd2.endMap(); prim_it++) 847 for (prim_it = llsd2.beginMap(); prim_it != llsd2.endMap(); prim_it++)
684 { 848 {
685 LLSD prim_llsd; 849 LLSD prim_llsd;
686 prim_llsd=llsd2[prim_it->first]; 850 prim_llsd = llsd2[prim_it->first];
687 LLSD::array_iterator text_it; 851 LLSD::array_iterator text_it;
688 std::list<LLUUID>::iterator iter; 852 std::list<LLUUID>::iterator iter;
689 853
690 if(prim_llsd.has("sculpt")) 854 if (prim_llsd.has("sculpt"))
691 { 855 {
692 LLSculptParams* sculpt=new LLSculptParams(); 856 LLSculptParams* sculpt = new LLSculptParams();
693 sculpt->fromLLSD(prim_llsd["sculpt"]); 857 sculpt->fromLLSD(prim_llsd["sculpt"]);
694 LLUUID orig=sculpt->getSculptTexture(); 858 LLUUID orig = sculpt->getSculptTexture();
695 bool alreadyseen=false; 859 bool alreadyseen = false;
696 for(iter = textures.begin(); iter != textures.end() ; iter++) 860 for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
697 { 861 {
698 if( (*iter)==orig) 862 if ((*iter) == orig)
699 alreadyseen=true; 863 alreadyseen = true;
700 } 864 }
701 if(alreadyseen==false) 865 if (alreadyseen == false)
702 { 866 {
703 llinfos << "Found a new SCULPT texture to upload "<<orig<<llendl; 867 llinfos << "Found a new SCULPT texture to upload " << orig << llendl;
704 textures.push_back(orig); 868 mTexturesList.push_back(orig);
705 } 869 }
706 } 870 }
707 871
708
709 LLSD te_llsd; 872 LLSD te_llsd;
710 te_llsd=prim_llsd["textures"]; 873 te_llsd = prim_llsd["textures"];
711 874
712 875 for (text_it = te_llsd.beginArray(); text_it != te_llsd.endArray(); text_it++)
713 for(text_it=te_llsd.beginArray(); text_it !=te_llsd.endArray(); text_it++)
714 { 876 {
715 LLSD the_te; 877 LLSD the_te;
716 the_te=(*text_it); 878 the_te = (*text_it);
717 LLTextureEntry te; 879 LLTextureEntry te;
718 te.fromLLSD(the_te); 880 te.fromLLSD(the_te);
719 881
720 te.getID(); 882 LLUUID id = te.getID();
721 bool alreadyseen=false; 883 // We upload the default textures in case we're on a grid with different ones and they're part of the build -- MC
722 884 //if (id != LL_TEXTURE_PLYWOOD && id != LL_TEXTURE_BLANK && id != LL_TEXTURE_INVISIBLE)
723 for(iter = textures.begin(); iter != textures.end() ; iter++) 885 if (id.notNull())
724 { 886 {
725 if( (*iter)==te.getID()) 887 bool alreadyseen = false;
726 alreadyseen=true; 888
889 for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++)
890 {
891 if ((*iter) == te.getID())
892 alreadyseen = true;
893 }
894 if (alreadyseen == false)
895 {
896 llinfos << "Found a new texture to upload "<< te.getID() << llendl;
897 mTexturesList.push_back(te.getID());
898 }
727 } 899 }
728 if(alreadyseen==false)
729 {
730 llinfos << "Found a new texture to upload "<<te.getID()<<llendl;
731 textures.push_back(te.getID());
732 }
733 } 900 }
734
735 } 901 }
736 } 902 }
737 903
738 if(m_retexture==TRUE) 904 if (mRetexture == TRUE)
739 upload_next_asset(); 905 uploadNextAsset();
740 else 906 else
741 import_object1a(); 907 importFirstObject();
742} 908}
743 909
744LLVector3 primbackup::offset_agent(LLVector3 offset) 910LLVector3 PrimBackup::offsetAgent(LLVector3 offset)
745{ 911{
746 LLVector3 pos= gAgent.getPositionAgent(); 912 return offset * mAgentRot + mAgentPos;
747 LLQuaternion agent_rot=LLQuaternion(gAgent.getAtAxis(),gAgent.getLeftAxis(),gAgent.getUpAxis());
748 pos=(offset*agent_rot+pos);
749 return pos;
750} 913}
751 914
752void primbackup::rez_agent_offset(LLVector3 offset) 915void PrimBackup::rezAgentOffset(LLVector3 offset)
753{ 916{
754 // This will break for a sitting agent 917 // This will break for a sitting agent
755 LLToolPlacer* mPlacer = new LLToolPlacer(); 918 LLToolPlacer* mPlacer = new LLToolPlacer();
756 mPlacer->setObjectType(LL_PCODE_CUBE); 919 mPlacer->setObjectType(LL_PCODE_CUBE);
757 //LLVector3 pos=offset_agent(offset); 920 //LLVector3 pos = offsetAgent(offset);
758 mPlacer->placeObject((S32)(offset.mV[0]), (S32)(offset.mV[1]), 0); 921 mPlacer->placeObject((S32)offset.mV[0], (S32)offset.mV[1], MASK_NONE);
759} 922}
760 923
761void primbackup::import_object1a() 924void PrimBackup::importFirstObject()
762{ 925{
763 running=true; 926 mRunning = true;
927 show(false);
928 mGroupPrimImportIter = mLLSD["data"].beginArray();
929 mRootRootPos = (*mGroupPrimImportIter)["root_position"];
930 mObjects = mLLSD["data"].size();
931 mCurObject = 1;
932 importNextObject();
933}
764 934
765 show(); 935void PrimBackup::importNextObject()
936{
937 mToSelect.clear();
938 mRezCount = 0;
766 939
767 group_prim_import_iter=llsd["data"].beginArray(); 940 mThisGroup = (*mGroupPrimImportIter)["group_body"];
768 root_root_pos=(*group_prim_import_iter)["root_position"]; 941 mPrimImportIter = mThisGroup.beginMap();
769 942
770 this->m_objects=llsd["data"].size(); 943 mCurPrim = 0;
771 this->m_curobject=1; 944 mPrims = mThisGroup.size();
772 import_next_object(); 945 updateImportNumbers();
773}
774 946
775void primbackup::import_next_object() 947 LLVector3 lgpos = (*mGroupPrimImportIter)["root_position"];
776{ 948 mGroupOffset = lgpos - mRootRootPos;
777 toselect.clear(); 949 mRootPos = offsetAgent(LLVector3(2.0, 0.0, 0.0));
778 rezcount=0; 950 mRootRot = ll_quaternion_from_sd((*mGroupPrimImportIter)["root_rotation"]);
779 951
780 this_group=(*group_prim_import_iter)["group_body"]; 952 rezAgentOffset(LLVector3(0.0, 2.0, 0.0));
781 prim_import_iter=this_group.beginMap();
782
783 m_curprim=0;
784 m_prims=this_group.size();
785 updateimportnumbers();
786 LLVector3 lgpos=(*group_prim_import_iter)["root_position"];
787
788 group_offset=lgpos-root_root_pos;
789 root_pos=offset_agent(LLVector3(2.0,0,0));
790 root_rot=ll_quaternion_from_sd((*group_prim_import_iter)["root_rotation"]);
791
792 rez_agent_offset(LLVector3(0.0,2.0,0.0));
793 // Now we must wait for the callback when ViewerObjectList gets the new objects and we have the correct number selected 953 // Now we must wait for the callback when ViewerObjectList gets the new objects and we have the correct number selected
794} 954}
795 955
796// This function takes a pointer to a viewerobject and applys the prim definition that prim_llsd has 956// This function takes a pointer to a viewerobject and applies the prim definition that prim_llsd has
797void primbackup::xmltoprim(LLSD prim_llsd,LLViewerObject * object) 957void PrimBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object)
798{ 958{
799 LLUUID id = object->getID(); 959 LLUUID id = object->getID();
800 expecting_update = object->getID(); 960 mExpectingUpdate = object->getID();
801 LLSelectMgr::getInstance()->selectObjectAndFamily(object); 961 LLSelectMgr::getInstance()->selectObjectAndFamily(object);
802 962
803 if(prim_llsd.has("parent")) 963 if (prim_llsd.has("name"))
964 {
965 LLSelectMgr::getInstance()->selectionSetObjectName(prim_llsd["name"]);
966 }
967
968 if (prim_llsd.has("description"))
969 {
970 LLSelectMgr::getInstance()->selectionSetObjectDescription(prim_llsd["description"]);
971 }
972
973 if (prim_llsd.has("parent"))
804 { 974 {
805 //we are not the root node. 975 //we are not the root node.
806 LLVector3 pos=prim_llsd["position"]; 976 LLVector3 pos = prim_llsd["position"];
807 LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]); 977 LLQuaternion rot = ll_quaternion_from_sd(prim_llsd["rotation"]);
808 object->setPositionRegion((pos*root_rot)+(root_pos+group_offset)); 978 object->setPositionRegion(pos * mRootRot + mRootPos + mGroupOffset);
809 object->setRotation(rot*root_rot); 979 object->setRotation(rot * mRootRot);
810 } 980 }
811 else 981 else
812 { 982 {
813 object->setPositionRegion(root_pos+group_offset); 983 object->setPositionRegion(mRootPos + mGroupOffset);
814 LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]); 984 LLQuaternion rot=ll_quaternion_from_sd(prim_llsd["rotation"]);
815 object->setRotation(rot); 985 object->setRotation(rot);
816 } 986 }
817 987
818 object->setScale(prim_llsd["scale"]); 988 object->setScale(prim_llsd["scale"]);
819 989
820 if(prim_llsd.has("shadows")) 990 if (prim_llsd.has("shadows"))
821 if(prim_llsd["shadows"].asInteger()==1) 991 if (prim_llsd["shadows"].asInteger() == 1)
822 object->setFlags(FLAGS_CAST_SHADOWS,true); 992 object->setFlags(FLAGS_CAST_SHADOWS, true);
823 993
824 if(prim_llsd.has("phantom")) 994 if (prim_llsd.has("phantom"))
825 if(prim_llsd["phantom"].asInteger()==1) 995 if (prim_llsd["phantom"].asInteger() == 1)
826 object->setFlags(FLAGS_PHANTOM,true); 996 object->setFlags(FLAGS_PHANTOM, true);
827 997
828 if(prim_llsd.has("physical")) 998 if (prim_llsd.has("physical"))
829 if(prim_llsd["physical"].asInteger()==1) 999 if (prim_llsd["physical"].asInteger() == 1)
830 object->setFlags(FLAGS_USE_PHYSICS,true); 1000 object->setFlags(FLAGS_USE_PHYSICS, true);
831 1001
832 // Volume params 1002 // Volume params
833 LLVolumeParams volume_params = object->getVolume()->getParams(); 1003 LLVolumeParams volume_params = object->getVolume()->getParams();
834 volume_params.fromLLSD(prim_llsd["volume"]) ; 1004 volume_params.fromLLSD(prim_llsd["volume"]);
835 object->updateVolume(volume_params); 1005 object->updateVolume(volume_params);
836 1006
837 if(prim_llsd.has("sculpt")) 1007 if (prim_llsd.has("sculpt"))
838 { 1008 {
839 LLSculptParams* sculpt=new LLSculptParams(); 1009 LLSculptParams* sculpt = new LLSculptParams();
840 sculpt->fromLLSD(prim_llsd["sculpt"]); 1010 sculpt->fromLLSD(prim_llsd["sculpt"]);
841
842 //TODO check if map is valid and only set texture is map is valid and changes
843 1011
844 if(assetmap[sculpt->getSculptTexture()].notNull()) 1012 // TODO: check if map is valid and only set texture if map is valid and changes
1013
1014 if (mAssetMap[sculpt->getSculptTexture()].notNull())
845 { 1015 {
846 LLUUID replacment=assetmap[sculpt->getSculptTexture()]; 1016 LLUUID replacment = mAssetMap[sculpt->getSculptTexture()];
847 sculpt->setSculptTexture(replacment); 1017 sculpt->setSculptTexture(replacment);
848 } 1018 }
849 1019
850 object->setParameterEntry(LLNetworkData::PARAMS_SCULPT,(LLNetworkData&)(*sculpt),true); 1020 object->setParameterEntry(LLNetworkData::PARAMS_SCULPT,(LLNetworkData&)(*sculpt),true);
851 } 1021 }
852 1022
853 if(prim_llsd.has("light")) 1023 if (prim_llsd.has("light"))
854 { 1024 {
855 LLLightParams * light=new LLLightParams(); 1025 LLLightParams* light = new LLLightParams();
856 light->fromLLSD(prim_llsd["light"]); 1026 light->fromLLSD(prim_llsd["light"]);
857 object->setParameterEntry(LLNetworkData::PARAMS_LIGHT,(LLNetworkData&)(*light),true); 1027 object->setParameterEntry(LLNetworkData::PARAMS_LIGHT,(LLNetworkData&)(*light), true);
858 } 1028 }
859 1029
860 if(prim_llsd.has("flexible")) 1030 if (prim_llsd.has("flexible"))
861 { 1031 {
862 LLFlexibleObjectData* flex=new LLFlexibleObjectData(); 1032 LLFlexibleObjectData* flex = new LLFlexibleObjectData();
863 flex->fromLLSD(prim_llsd["flexible"]); 1033 flex->fromLLSD(prim_llsd["flexible"]);
864 object->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE,(LLNetworkData&)(*flex),true); 1034 object->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE,(LLNetworkData&)(*flex), true);
865 } 1035 }
866 1036
867
868 // Textures 1037 // Textures
869 LLSD te_llsd;
870 llinfos << "Processing textures for prim" << llendl; 1038 llinfos << "Processing textures for prim" << llendl;
871 1039 LLSD te_llsd;
872 te_llsd=prim_llsd["textures"]; 1040 te_llsd = prim_llsd["textures"];
873 1041
874 LLSD::array_iterator text_it; 1042 LLSD::array_iterator text_it;
875 U8 i=0; 1043 U8 i = 0;
876 i=0;
877 1044
878 for(text_it=te_llsd.beginArray(); text_it !=te_llsd.endArray(); text_it++) 1045 for (text_it = te_llsd.beginArray(); text_it != te_llsd.endArray(); text_it++)
879 { 1046 {
880 LLSD the_te; 1047 LLSD the_te;
881 the_te=(*text_it); 1048 the_te = (*text_it);
882 LLTextureEntry te; 1049 LLTextureEntry te;
883 te.fromLLSD(the_te); 1050 te.fromLLSD(the_te);
884 1051
885 if(assetmap[te.getID()].notNull()) 1052 if (mAssetMap[te.getID()].notNull())
886 { 1053 {
887 LLUUID replacment=assetmap[te.getID()]; 1054 LLUUID replacment = mAssetMap[te.getID()];
888 te.setID(replacment); 1055 te.setID(replacment);
889 } 1056 }
890 1057
891 object->setTE(i,te); // 1058 object->setTE(i, te);
892 i++; 1059 i++;
893 } 1060 }
894 1061
895 llinfos << "Textures done!" << llendl; 1062 llinfos << "Textures done!" << llendl;
896 1063
897 //bump the iterator now so the callbacks hook together nicely 1064 //bump the iterator now so the callbacks hook together nicely
898 //if(prim_import_iter!=this_group.endMap()) 1065 //if (mPrimImportIter != mThisGroup.endMap())
899 // prim_import_iter++; 1066 // mPrimImportIter++;
900 1067
901 object->sendRotationUpdate(); 1068 object->sendRotationUpdate();
902 object->sendTEUpdate(); 1069 object->sendTEUpdate();
903 object->sendShapeUpdate(); 1070 object->sendShapeUpdate();
904 LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE |UPD_POSITION); 1071 LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_SCALE | UPD_POSITION);
905 1072
906 LLSelectMgr::getInstance()->deselectAll(); 1073 LLSelectMgr::getInstance()->deselectAll();
907} 1074}
908 1075
909//This is fired when the update packet is processed so we know the prim settings have stuck 1076// This is fired when the update packet is processed so we know the prim settings have stuck
910void primbackup::prim_update(LLViewerObject* object) 1077void PrimBackup::primUpdate(LLViewerObject* object)
911{ 1078{
912 if(!running) 1079 if (!mRunning)
913 return; 1080 return;
914 1081
915 if(object!=NULL) 1082 if (object != NULL)
916 if(object->mID!=expecting_update) 1083 if (object->mID != mExpectingUpdate)
917 return; 1084 return;
918 1085
919 m_curprim++; 1086 mCurPrim++;
920 updateimportnumbers(); 1087 updateImportNumbers();
921 1088 mPrimImportIter++;
922 prim_import_iter++;
923 1089
924 LLUUID x; 1090 LLUUID x;
925 expecting_update=x.null; 1091 mExpectingUpdate = x.null;
926 1092
927 if(prim_import_iter==this_group.endMap()) 1093 if (mPrimImportIter == mThisGroup.endMap())
928 { 1094 {
929 llinfos<<"Trying to link"<<llendl; 1095 llinfos << "Trying to link" << llendl;
930 1096
931 if(toselect.size()>1) 1097 if (mToSelect.size() > 1)
932 { 1098 {
933 std::reverse(toselect.begin(),toselect.end()); 1099 std::reverse(mToSelect.begin(), mToSelect.end());
934 //Now link 1100 // Now link
935 LLSelectMgr::getInstance()->deselectAll(); 1101 LLSelectMgr::getInstance()->deselectAll();
936 LLSelectMgr::getInstance()->selectObjectAndFamily(toselect,true); 1102 LLSelectMgr::getInstance()->selectObjectAndFamily(mToSelect, true);
937 LLSelectMgr::getInstance()->sendLink(); 1103 LLSelectMgr::getInstance()->sendLink();
938 LLViewerObject * root=toselect.back(); 1104 LLViewerObject* root = mToSelect.back();
939 root->setRotation(root_rot); 1105 root->setRotation(mRootRot);
940 } 1106 }
941 1107
942 this->m_curobject++; 1108 mCurObject++;
943 group_prim_import_iter++; 1109 mGroupPrimImportIter++;
944 if(group_prim_import_iter!=llsd["data"].endArray()) 1110 if (mGroupPrimImportIter != mLLSD["data"].endArray())
945 { 1111 {
946 import_next_object(); 1112 importNextObject();
947 return; 1113 return;
948 } 1114 }
949 1115
950 running=false; 1116 mRunning = false;
951 this->close(); 1117 close();
952 return; 1118 return;
953 } 1119 }
954 1120
955 LLSD prim_llsd; 1121 LLSD prim_llsd;
956 prim_llsd=this_group[prim_import_iter->first]; 1122 prim_llsd = mThisGroup[mPrimImportIter->first];
957 1123
958 if(toselect.empty()) 1124 if (mToSelect.empty())
959 { 1125 {
960 llwarns << "error: ran out of objects to mod" << llendl; 1126 llwarns << "error: ran out of objects to mod" << llendl;
961 return; 1127 return;
962 } 1128 }
963 1129
964 if(prim_import_iter!=this_group.endMap()) 1130 if (mPrimImportIter != mThisGroup.endMap())
965 { 1131 {
966 //rez_agent_offset(LLVector3(1.0,0,0)); 1132 //rezAgentOffset(LLVector3(1.0, 0.0, 0.0));
967 LLSD prim_llsd=this_group[prim_import_iter->first]; 1133 LLSD prim_llsd = mThisGroup[mPrimImportIter->first];
968 process_iter++; 1134 mProcessIter++;
969 xmltoprim(prim_llsd,(*process_iter)); 1135 xmlToPrim(prim_llsd, *mProcessIter);
970 } 1136 }
971} 1137}
972 1138
973// Callback when we rez a new object when the importer is running. 1139// Callback when we rez a new object when the importer is running.
974bool primbackup::newprim(LLViewerObject * pobject) 1140bool PrimBackup::newPrim(LLViewerObject* pobject)
975{ 1141{
976 if(running) 1142 if (mRunning)
977 { 1143 {
978 rezcount++; 1144 mRezCount++;
979 toselect.push_back(pobject); 1145 mToSelect.push_back(pobject);
980 updateimportnumbers(); 1146 updateImportNumbers();
981 prim_import_iter++; 1147 mPrimImportIter++;
982 1148
983 if(prim_import_iter!=this_group.endMap()) 1149 if (mPrimImportIter != mThisGroup.endMap())
984 { 1150 {
985 1151 pobject->setPosition(offsetAgent(LLVector3(0.0, 1.0, 0.0)));
986 pobject->setPosition(this->offset_agent(LLVector3(0,1.0,0)));
987 LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); 1152 LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION);
988 1153
989 rez_agent_offset(LLVector3(1.0,0,0)); 1154 rezAgentOffset(LLVector3(1.0, 0.0 ,0.0));
990 } 1155 }
991 else 1156 else
992 { 1157 {
993 llinfos << "All prims rezed, moving to build stage" <<llendl; 1158 llinfos << "All prims rezzed, moving to build stage" << llendl;
994 prim_import_iter=this_group.beginMap(); 1159 // Deselecting is required to ensure that the first child prim
995 LLSD prim_llsd=this_group[prim_import_iter->first]; 1160 // in the link set (which is also the last rezzed prim and thus
996 process_iter=toselect.begin(); 1161 // currently selected) will be properly renamed and desced.
997 xmltoprim(prim_llsd,(*process_iter)); 1162 LLSelectMgr::getInstance()->deselectAll();
1163 mPrimImportIter = mThisGroup.beginMap();
1164 LLSD prim_llsd = mThisGroup[mPrimImportIter->first];
1165 mProcessIter = mToSelect.begin();
1166 xmlToPrim(prim_llsd, *mProcessIter);
998 } 1167 }
999 } 1168 }
1000
1001 return true; 1169 return true;
1002} 1170}
1003 1171
1004void primbackup::update_map(LLUUID uploaded_asset) 1172void PrimBackup::updateMap(LLUUID uploaded_asset)
1005{ 1173{
1006 if(current_asset.isNull()) 1174 if (mCurrentAsset.isNull())
1007 return; 1175 return;
1008 1176
1009 assetmap.insert(std::pair<LLUUID,LLUUID>(current_asset,uploaded_asset)); 1177 llinfos << "Mapping " << mCurrentAsset << " to " << uploaded_asset << llendl;
1010 llinfos << "Mapping "<<current_asset<<" to "<<uploaded_asset<<llendl; 1178 mAssetMap.insert(std::pair<LLUUID, LLUUID>(mCurrentAsset, uploaded_asset));
1011
1012} 1179}
1013 1180
1014 1181
1015void myupload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type, 1182void myupload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type,
1016 std::string name, 1183 std::string name, std::string desc, S32 compression_info,
1017 std::string desc, S32 compression_info,
1018 LLAssetType::EType destination_folder_type, 1184 LLAssetType::EType destination_folder_type,
1019 LLInventoryType::EType inv_type, 1185 LLInventoryType::EType inv_type, U32 next_owner_perm,
1020 U32 next_owner_perm,
1021 const std::string& display_name, 1186 const std::string& display_name,
1022 LLAssetStorage::LLStoreAssetCallback callback, 1187 LLAssetStorage::LLStoreAssetCallback callback,
1023 void *userdata) 1188 void *userdata)
1024{ 1189{
1025 if(gDisconnected) 1190 if (gDisconnected)
1026 { 1191 {
1027 return ; 1192 return;
1028 } 1193 }
1029 1194
1030 LLAssetID uuid = tid.makeAssetID(gAgent.getSecureSessionID()); 1195 LLAssetID uuid = tid.makeAssetID(gAgent.getSecureSessionID());
1031 1196
1032 // At this point, we're ready for the upload. 1197 // At this point, we're ready for the upload.
1033 std::string upload_message = "Uploading...\n\n"; 1198 std::string upload_message = "Uploading...\n\n";
1034 upload_message.append(display_name); 1199 upload_message.append(display_name);
@@ -1043,66 +1208,61 @@ void myupload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_
1043 body["inventory_type"] = LLInventoryType::lookup(inv_type); 1208 body["inventory_type"] = LLInventoryType::lookup(inv_type);
1044 body["name"] = name; 1209 body["name"] = name;
1045 body["description"] = desc; 1210 body["description"] = desc;
1046 1211
1047 std::ostringstream llsdxml; 1212 std::ostringstream llsdxml;
1048 LLSDSerialize::toXML(body, llsdxml); 1213 LLSDSerialize::toXML(body, llsdxml);
1049 lldebugs << "posting body to capability: " << llsdxml.str() << llendl; 1214 lldebugs << "posting body to capability: " << llsdxml.str() << llendl;
1050 //LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type)); 1215 //LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type));
1051 LLHTTPClient::post(url, body, new importResponder(body, uuid, asset_type)); 1216 LLHTTPClient::post(url, body, new importResponder(body, uuid, asset_type));
1052
1053 } 1217 }
1054 else 1218 else
1055 { 1219 {
1056 llinfos << "NewAgentInventory capability not found, FUCK!" << llendl; 1220 llinfos << "NewAgentInventory capability not found. Can't upload !" << llendl;
1057 } 1221 }
1058} 1222}
1059 1223
1060 1224void PrimBackup::uploadNextAsset()
1061
1062void primbackup::upload_next_asset()
1063{ 1225{
1064 if(textures.empty()) 1226 if (mTexturesList.empty())
1065 { 1227 {
1066 llinfos<<" Texture list is empty, moving to rez statge"<< llendl; 1228 llinfos << "Texture list is empty, moving to rez stage." << llendl;
1067 current_asset=LLUUID::null; 1229 mCurrentAsset = LLUUID::null;
1068 import_object1a(); 1230 importFirstObject();
1069 return; 1231 return;
1070 } 1232 }
1071 1233
1072 this->updateimportnumbers(); 1234 updateImportNumbers();
1073 1235
1074 std::list<LLUUID>::iterator iter; 1236 std::list<LLUUID>::iterator iter;
1075 iter=textures.begin(); 1237 iter = mTexturesList.begin();
1076 LLUUID id=(*iter); 1238 LLUUID id = *iter;
1077 textures.pop_front(); 1239 mTexturesList.pop_front();
1078 1240
1079 llinfos<<"Got texture ID "<<id<< "trying to upload"<<llendl; 1241 llinfos << "Got texture ID " << id << ": trying to upload" << llendl;
1080 1242
1081 current_asset=id; 1243 mCurrentAsset = id;
1082 std::string struid; 1244 std::string struid;
1083 id.toString(struid); 1245 id.toString(struid);
1084 std::string filename=folder+"//"+struid; 1246 std::string filename = mFolder + "//" + struid;
1085
1086
1087 LLAssetID uuid; 1247 LLAssetID uuid;
1088 LLTransactionID tid; 1248 LLTransactionID tid;
1089 1249
1090 // gen a new transaction ID for this asset 1250 // generate a new transaction ID for this asset
1091 tid.generate(); 1251 tid.generate();
1092 uuid = tid.makeAssetID(gAgent.getSecureSessionID()); 1252 uuid = tid.makeAssetID(gAgent.getSecureSessionID());
1093 1253
1094 S32 file_size; 1254 S32 file_size;
1095 apr_file_t* fp; 1255 apr_file_t* fp;
1096 LLAPRFile aFile; 1256 LLAPRFile aFile;
1097 aFile.open(filename, LL_APR_RB, LLAPRFile::global, &file_size); 1257 aFile.open(filename, LL_APR_RB, LLAPRFile::global, &file_size);
1098 fp = aFile.getFileHandle(); 1258 fp = aFile.getFileHandle();
1099 if (fp) 1259 if (fp)
1100 { 1260 {
1101 const S32 buf_size = 65536; 1261 const S32 buf_size = 65536;
1102 U8 copy_buf[buf_size]; 1262 U8 copy_buf[buf_size];
1103 LLVFile file(gVFS, uuid, LLAssetType::AT_TEXTURE, LLVFile::WRITE); 1263 LLVFile file(gVFS, uuid, LLAssetType::AT_TEXTURE, LLVFile::WRITE);
1104 file.setMaxSize(file_size); 1264 file.setMaxSize(file_size);
1105 1265
1106 while ((file_size =aFile.read(copy_buf, buf_size))) 1266 while ((file_size =aFile.read(copy_buf, buf_size)))
1107 { 1267 {
1108 file.write(copy_buf, file_size); 1268 file.write(copy_buf, file_size);
@@ -1111,21 +1271,12 @@ void primbackup::upload_next_asset()
1111 } 1271 }
1112 else 1272 else
1113 { 1273 {
1114 llwarns<<"Unable to access output file "<<filename<<llendl; 1274 llwarns << "Unable to access output file " << filename << llendl;
1115 upload_next_asset(); 1275 uploadNextAsset();
1116 return; 1276 return;
1117 } 1277 }
1118 1278
1119 myupload_new_resource( 1279 myupload_new_resource(tid, LLAssetType::AT_TEXTURE, struid, struid, 0,
1120 tid, LLAssetType::AT_TEXTURE, struid, 1280 LLAssetType::AT_TEXTURE, LLInventoryType::defaultForAssetType(LLAssetType::AT_TEXTURE),
1121 struid, 0, 1281 0x0, "Uploaded texture", NULL, NULL);
1122 LLAssetType::AT_TEXTURE,
1123 LLInventoryType::defaultForAssetType(LLAssetType::AT_TEXTURE),
1124 0x0,
1125 "Uploaded texture",
1126 NULL,
1127 NULL);
1128
1129
1130} 1282}
1131
diff --git a/linden/indra/newview/primbackup.h b/linden/indra/newview/primbackup.h
index cbd757a..97dd489 100644
--- a/linden/indra/newview/primbackup.h
+++ b/linden/indra/newview/primbackup.h
@@ -1,134 +1,149 @@
1 1
2#include "llviewerinventory.h" 2#include "llviewerinventory.h"
3 3
4#define LL_GRID_PERMISSIONS 1 4enum export_states {
5 5 EXPORT_INIT,
6enum export_states {EXPORT_INIT,EXPORT_STRUCTURE,EXPORT_TEXTURES,EXPORT_LLSD,EXPORT_DONE}; 6 EXPORT_STRUCTURE,
7 7 EXPORT_TEXTURES,
8class primbackup : public LLFloater 8 EXPORT_LLSD,
9 EXPORT_DONE,
10 EXPORT_FAILED
11};
9 12
13class PrimBackup : public LLFloater
10{ 14{
11 public: 15public:
12 //Export state machine 16 virtual ~PrimBackup();
13 enum export_states export_state; 17
14 18 // Floater stuff
15 //Export idle callback 19 virtual void show(bool exporting);
16 static void exportworker(void *userdata);
17
18 //Static accessor
19 static primbackup* getInstance();
20
21 static bool check_perms( LLSelectNode* node );
22
23 virtual ~primbackup();
24
25 //Floater stuff
26 virtual void show();
27 virtual void draw(); 20 virtual void draw();
28 virtual void onClose( bool app_quitting ); 21 virtual void onClose(bool app_quitting);
29 22
30 //Import entry point 23 // Static accessor
31 void import_object(bool upload=FALSE); 24 static PrimBackup* getInstance();
32
33 //Export entry point
34 void pre_export_object();
35 25
36 //Update map from texture worker 26 // Export idle callback
37 void update_map(LLUUID uploaded_asset); 27 static void exportWorker(void *userdata);
38 28
39 //Move to next texture upload 29 // Import entry point
40 void upload_next_asset(); 30 void importObject(bool upload=FALSE);
41 31
42 // is ready for next texture? 32 // Export entry point
43 bool m_nexttextureready; 33 void exportObject();
44 34
45 //Folder public geter 35 // Update map from texture worker
46 std::string getfolder() {return folder;}; 36 void updateMap(LLUUID uploaded_asset);
47 37
48 //Prim updated callback 38 // Move to next texture upload
49 void prim_update(LLViewerObject* object); 39 void uploadNextAsset();
50 40
51 //New prim call back 41 // Folder public geter
52 bool newprim(LLViewerObject * pobject); 42 std::string getfolder() { return mFolder; };
53 43
54private: 44 // Prim updated callback
45 void primUpdate(LLViewerObject* object);
55 46
56 //Static singleton stuff 47 // New prim call back
57 primbackup(); 48 bool newPrim(LLViewerObject* pobject);
58 static primbackup* sInstance;
59 49
60 // are we active flag 50 static const U32 TEXTURE_OK = 0x00;
61 bool running; 51 static const U32 TEXTURE_BAD_PERM = 0x01;
52 static const U32 TEXTURE_MISSING = 0x02;
53 static const U32 TEXTURE_BAD_ENCODING = 0x04;
54 static const U32 TEXTURE_IS_NULL = 0x08;
55 static const U32 TEXTURE_SAVED_FAILED = 0x10;
62 56
63 //file and folder name control 57 // Is ready for next texture?
64 std::string file_name; 58 bool mNextTextureReady;
65 std::string folder;
66 59
67 // True if we need to rebase the assets 60 // Export state machine
68 bool m_retexture; 61 enum export_states mExportState;
69 62
70 //Counts of import and export objects and textures and prims 63 // Export result flags for textures.
71 int m_objects,m_curobject; 64 U32 mNonExportedTextures;
72 int m_prims,m_curprim;
73 int m_textures,m_curtexture;
74 65
75 // No prims rezed 66 static bool validatePerms(const LLPermissions* item_permissions);
76 int rezcount; 67
68private:
69 // Static singleton stuff
70 PrimBackup();
71 static PrimBackup* sInstance;
77 72
78 // Update the floater with status numbers 73 // Update the floater with status numbers
79 void updateimportnumbers(); 74 void updateImportNumbers();
80 void updateexportnumbers(); 75 void updateExportNumbers();
76
77 // Permissions stuff.
78 LLUUID validateTextureID(LLUUID asset_id);
79
80 // Convert a selection list of objects to LLSD
81 LLSD primsToLLSD(LLViewerObject::child_list_t child_list, bool is_attachment);
81 82
82 //Convert a selection list of objects to LLSD
83 LLSD prims_to_llsd(LLViewerObject::child_list_t child_list);
84
85 // Start the import process 83 // Start the import process
86 void import_object1a(); 84 void importFirstObject();
87 85
88 //Export the next texture in list 86 // Move to the next import group
89 void export_next_texture(); 87 void importNextObject();
90 88
91 //apply LLSD to object 89 // Export the next texture in list
92 void xmltoprim(LLSD prim_llsd,LLViewerObject * pobject); 90 void exportNextTexture();
93
94 91
95 //rez a prim at a given position (note not agent offset X/Y screen for raycast) 92 // Apply LLSD to object
96 void rez_agent_offset(LLVector3 offset); 93 void xmlToPrim(LLSD prim_llsd, LLViewerObject* pobject);
97
98 //Move to the next import group
99 void import_next_object();
100
101 //Get an offset from the agent based on rotation and current pos
102 LLVector3 offset_agent(LLVector3 offset);
103 94
104 // Rebase map 95 // Rez a prim at a given position (note not agent offset X/Y screen for raycast)
105 std::map<LLUUID,LLUUID> assetmap; 96 void rezAgentOffset(LLVector3 offset);
106
107 //Export texture list
108 std::list<LLUUID> textures;
109
110 //Import object tracking
111 std::vector<LLViewerObject *> toselect;
112 std::vector<LLViewerObject *>::iterator process_iter;
113
114 //Working LLSD holders
115 LLUUID current_asset;
116 LLSD llsd;
117 LLSD this_group;
118 LLUUID expecting_update;
119
120 //working llsd itterators for objects and linksets
121 LLSD::map_const_iterator prim_import_iter;
122 LLSD::array_const_iterator group_prim_import_iter;
123
124 // Root pos and central root pos for link set
125 LLVector3 root_pos;
126 LLVector3 root_root_pos;
127 LLVector3 group_offset;
128
129 //Agent inital pos and rot when starting import
130 LLQuaternion root_rot;
131 LLQuaternion agent_rot;
132 97
133}; 98 // Get an offset from the agent based on rotation and current pos
99 LLVector3 offsetAgent(LLVector3 offset);
100
101 // Are we active flag
102 bool mRunning;
103
104 // File and folder name control
105 std::string mFileName;
106 std::string mFolder;
107
108 // True if we need to rebase the assets
109 bool mRetexture;
134 110
111 // Counts of import and export objects and prims
112 U32 mObjects;
113 U32 mCurObject;
114 U32 mPrims;
115 U32 mCurPrim;
116
117 // No prims rezed
118 U32 mRezCount;
119
120 // Rebase map
121 std::map<LLUUID,LLUUID> mAssetMap;
122
123 // Export texture list
124 std::list<LLUUID> mTexturesList;
125
126 // Import object tracking
127 std::vector<LLViewerObject*> mToSelect;
128 std::vector<LLViewerObject*>::iterator mProcessIter;
129
130 // Working LLSD holders
131 LLUUID mCurrentAsset;
132 LLSD mLLSD;
133 LLSD mThisGroup;
134 LLUUID mExpectingUpdate;
135
136 // Working llsd itterators for objects and linksets
137 LLSD::map_const_iterator mPrimImportIter;
138 LLSD::array_const_iterator mGroupPrimImportIter;
139
140 // Root pos and rotation and central root pos for link set
141 LLVector3 mRootPos;
142 LLQuaternion mRootRot;
143 LLVector3 mRootRootPos;
144 LLVector3 mGroupOffset;
145
146 // Agent inital pos and rot when starting import
147 LLVector3 mAgentPos;
148 LLQuaternion mAgentRot;
149};
diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml b/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml
index 86dc5c7..0cbd7c6 100644
--- a/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml
@@ -166,10 +166,12 @@
166 <on_click filter="" function="Inventory.DoToSelected" userdata="copy_uuid" /> 166 <on_click filter="" function="Inventory.DoToSelected" userdata="copy_uuid" />
167 </menu_item_call> 167 </menu_item_call>
168 <menu_item_separator name="Copy Separator" /> 168 <menu_item_separator name="Copy Separator" />
169<!-- See IMP-961 http://redmine.kokuaviewer.org/issues/961
169 <menu_item_call bottom_delta="-18" height="18" label="Cut" left="0" mouse_opaque="true" 170 <menu_item_call bottom_delta="-18" height="18" label="Cut" left="0" mouse_opaque="true"
170 name="Cut" width="128"> 171 name="Cut" width="128">
171 <on_click filter="" function="Inventory.DoToSelected" userdata="cut" /> 172 <on_click filter="" function="Inventory.DoToSelected" userdata="cut" />
172 </menu_item_call> 173 </menu_item_call>
174-->
173 <menu_item_call bottom_delta="-18" height="18" label="Copy" left="0" mouse_opaque="true" 175 <menu_item_call bottom_delta="-18" height="18" label="Copy" left="0" mouse_opaque="true"
174 name="Copy" width="128"> 176 name="Copy" width="128">
175 <on_click filter="" function="Inventory.DoToSelected" userdata="copy" /> 177 <on_click filter="" function="Inventory.DoToSelected" userdata="copy" />
diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml
index cb8171d..4474dad 100644
--- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml
@@ -7301,14 +7301,28 @@ Shadows cannot be enabled due to your graphics settings being set too low. Make
7301</notification> 7301</notification>
7302 7302
7303<notification 7303<notification
7304 icon="notifytip.tga" 7304 icon="alert.tga"
7305 name="NoTextureExportSL" 7305 name="ExportFailed"
7306 type="notifytip"> 7306 type="alert">
7307Note: To comply with the Second Life Terms of Service, Imprudence did not download any texture files for the exported object(s). 7307Bad permissions for the exported object. Export aborted.
7308</notification> 7308</notification>
7309 7309
7310<notification 7310<notification
7311 icon="alert.tga" 7311 icon="alert.tga"
7312 name="ExportPartial"
7313 type="alert">
7314Object exported. Some textures could not be saved due to: [REASON]
7315</notification>
7316
7317<notification
7318 icon="notifytip.tga"
7319 name="ExportSuccessful"
7320 type="notifytip">
7321Export successful.
7322</notification>
7323
7324<notification
7325 icon="alert.tga"
7312 name="Help_CmdLine" 7326 name="Help_CmdLine"
7313 type="alert"> 7327 type="alert">
7314Various options for command line features. 7328Various options for command line features.
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml b/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml
index 29c34fb..2d71add 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml
@@ -3,8 +3,11 @@
3 enabled="true" follows="right|bottom" height="45" left="0" mouse_opaque="true" 3 enabled="true" follows="right|bottom" height="45" left="0" mouse_opaque="true"
4 name="ao_remote" use_bounding_rect="true" width="96"> 4 name="ao_remote" use_bounding_rect="true" width="96">
5 <panel bottom="1" filename="panel_bg_tab.xml" name="panel_bg_tab" height="47" left="0" width="96" /> 5 <panel bottom="1" filename="panel_bg_tab.xml" name="panel_bg_tab" height="47" left="0" width="96" />
6 <button bottom="-20" control_name="AOSitsEnabled" enabled="true" 6 <button bottom="-20" control_name="AOSitsEnabled" enabled="true" tool_tip="Toggles AO sit animation"
7 follows="left|top" font="SansSerif" height="22" label="AO Sits Off" label_selected="AO Sits On" 7 follows="left|top" font="SansSerif" height="22" label="Sits Off" label_selected="Sits On"
8 mouse_opaque="true" name="ao_sit_btn" width="92" left="3" /> 8 mouse_opaque="true" name="ao_sit_btn" width="66" left="3" label_selected_disabled="Sits Off" />
9 <button bottom="-20" enabled="true" tool_tip="Toggle AO window"
10 follows="left|top" font="SansSerif" height="22" label="" image_overlay="arrow_up.tga"
11 mouse_opaque="true" name="ao_show_btn" width="22" left_delta="68" />
9 <panel bottom="13" filename="panel_ao_remote_controls.xml" name="panel_ao_controls" left="0" width="96" /> 12 <panel bottom="13" filename="panel_ao_remote_controls.xml" name="panel_ao_controls" left="0" width="96" />
10</panel> 13</panel>
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_avatar.xml b/linden/indra/newview/skins/default/xui/en-us/panel_avatar.xml
index f459e6a..6076eb9 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_avatar.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_avatar.xml
@@ -42,6 +42,9 @@
42 <string name="days_old_text"> 42 <string name="days_old_text">
43 ([DAYS] days old) 43 ([DAYS] days old)
44 </string> 44 </string>
45 <string name="invalid">
46 (invalid)
47 </string>
45 <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" 48 <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
46 bottom="-23" drop_shadow_visible="true" follows="left|top" 49 bottom="-23" drop_shadow_visible="true" follows="left|top"
47 font="SansSerifsmall" h_pad="0" halign="left" height="16" left="262" 50 font="SansSerifsmall" h_pad="0" halign="left" height="16" left="262"
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml b/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml
index b032b09..2974490 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml
@@ -8,9 +8,12 @@ general Group Preferences and member options.
8 8
9Hover your mouse over the options for more help. 9Hover your mouse over the options for more help.
10 </string> 10 </string>
11 <string name="group_info_unchanged"> 11 <string name="group_info_unchanged">
12 General group information has changed. 12 General group information has changed.
13 </string> 13 </string>
14 <string name="copy_group_link_info">
15 Copied group link: [SLURL]
16 </string>
14 <button bottom="-24" follows="left|top" font="SansSerif" halign="center" height="16" 17 <button bottom="-24" follows="left|top" font="SansSerif" halign="center" height="16"
15 label="?" label_selected="?" left="391" mouse_opaque="true" 18 label="?" label_selected="?" left="391" mouse_opaque="true"
16 name="help_button" width="20" /> 19 name="help_button" width="20" />
@@ -50,7 +53,10 @@ Hover your mouse over the options for more help.
50 width="265" word_wrap="true" spell_check="true"> 53 width="265" word_wrap="true" spell_check="true">
51 Group Charter 54 Group Charter
52 </text_editor> 55 </text_editor>
53 <button bottom_delta="0" follows="left|top" font="SansSerif" halign="center" 56 <button bottom_delta="-28" follows="left|top" font="SansSerif" halign="center"
57 height="22" label="Copy Group Link"
58 right="-7" mouse_opaque="true" name="copy_link_button" width="128" />
59 <button bottom_delta="28" follows="left|top" font="SansSerif" halign="center"
54 height="22" label="Join (free)" label_selected="Join (free)" left="7" 60 height="22" label="Join (free)" label_selected="Join (free)" left="7"
55 mouse_opaque="true" name="join_button" width="128" /> 61 mouse_opaque="true" name="join_button" width="128" />
56 <button bottom_delta="0" follows="left|top" font="SansSerif" halign="center" 62 <button bottom_delta="0" follows="left|top" font="SansSerif" halign="center"
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_login.xml b/linden/indra/newview/skins/default/xui/en-us/panel_login.xml
index ae60abc..5e4bd39 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_login.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_login.xml
@@ -30,10 +30,26 @@
30 </string> 30 </string>
31 31
32 32
33 <!-- GRIDS -->
34
35 <text name="grid_text"
36 bottom="80" left="15" height="16" width="120"
37 follows="left|bottom" h_pad="0" halign="left" v_pad="0"
38 bg_visible="false" drop_shadow_visible="true"
39 border_visible="false" border_drop_shadow_visible="false"
40 font="SansSerif" mouse_opaque="true">
41 Grid:
42 </text>
43 <combo_box name="server_combo"
44 bottom_delta="-20" left_delta="0" height="20" width="120"
45 follows="left|bottom" allow_text_entry="false"
46 max_chars="20" mouse_opaque="true" />
47
48
33 <!-- FIRST NAME --> 49 <!-- FIRST NAME -->
34 50
35 <text name="first_name_text" 51 <text name="first_name_text"
36 bottom="80" left="24" height="16" width="120" 52 bottom="80" left="165" height="16" width="120"
37 follows="left|bottom" h_pad="0" halign="left" v_pad="0" 53 follows="left|bottom" h_pad="0" halign="left" v_pad="0"
38 bg_visible="false" drop_shadow_visible="true" 54 bg_visible="false" drop_shadow_visible="true"
39 border_visible="false" border_drop_shadow_visible="false" 55 border_visible="false" border_drop_shadow_visible="false"
@@ -73,7 +89,7 @@
73 <!-- SL USERNAME --> 89 <!-- SL USERNAME -->
74 90
75 <text name="username_text" 91 <text name="username_text"
76 bottom="80" left="24" height="16" width="250" 92 bottom="80" left="165" height="16" width="250"
77 follows="left|bottom" h_pad="0" halign="left" v_pad="0" 93 follows="left|bottom" h_pad="0" halign="left" v_pad="0"
78 bg_visible="false" drop_shadow_visible="true" 94 bg_visible="false" drop_shadow_visible="true"
79 border_visible="false" border_drop_shadow_visible="false" 95 border_visible="false" border_drop_shadow_visible="false"
@@ -93,7 +109,7 @@
93 <!-- PASSWORD --> 109 <!-- PASSWORD -->
94 110
95 <text name="password_text" 111 <text name="password_text"
96 bottom_delta="20" left="285" height="16" width="120" 112 bottom_delta="20" left="425" height="16" width="120"
97 follows="left|bottom" h_pad="0" halign="left" v_pad="0" 113 follows="left|bottom" h_pad="0" halign="left" v_pad="0"
98 bg_visible="false" drop_shadow_visible="true" 114 bg_visible="false" drop_shadow_visible="true"
99 border_visible="false" border_drop_shadow_visible="false" 115 border_visible="false" border_drop_shadow_visible="false"
@@ -110,26 +126,18 @@
110 allow_translate="false" /> 126 allow_translate="false" />
111 127
112 128
113 <!-- GRIDS --> 129 <!-- GRID MANAGER -->
114 130
115 <text name="grid_text" 131 <button name="grid_btn" label="Grid Manager"
116 bottom="80" left_delta="150" height="16" width="120" 132 bottom="32" left="25" height="20" width="100"
117 follows="left|bottom" h_pad="0" halign="left" v_pad="0" 133 follows="left|bottom" font="SansSerifSmall" halign="center"
118 bg_visible="false" drop_shadow_visible="true" 134 mouse_opaque="true" scale_image="TRUE" />
119 border_visible="false" border_drop_shadow_visible="false"
120 font="SansSerif" mouse_opaque="true">
121 Grid:
122 </text>
123 <combo_box name="server_combo"
124 bottom_delta="-20" left_delta="0" height="20" width="120"
125 follows="left|bottom" allow_text_entry="false"
126 max_chars="20" mouse_opaque="true" />
127 135
128 136
129 <!-- START LOCATION --> 137 <!-- START LOCATION -->
130 138
131 <text name="start_location_text" 139 <text name="start_location_text"
132 bottom="32" left="10" height="16" right="115" 140 bottom_delta="0" left="125" height="16" width="115"
133 follows="left|bottom" h_pad="0" halign="right" v_pad="0" 141 follows="left|bottom" h_pad="0" halign="right" v_pad="0"
134 bg_visible="false" drop_shadow_visible="true" 142 bg_visible="false" drop_shadow_visible="true"
135 border_visible="false" border_drop_shadow_visible="false" 143 border_visible="false" border_drop_shadow_visible="false"
@@ -137,7 +145,7 @@
137 Start location: 145 Start location:
138 </text> 146 </text>
139 <combo_box name="start_location_combo" 147 <combo_box name="start_location_combo"
140 bottom_delta="2" left="120" height="16" width="150" 148 bottom_delta="2" left_delta="125" height="16" width="150"
141 follows="left|bottom" font="SansSerifSmall" 149 follows="left|bottom" font="SansSerifSmall"
142 mouse_opaque="true" allow_text_entry="true" max_chars="128"> 150 mouse_opaque="true" allow_text_entry="true" max_chars="128">
143 <combo_item name="MyHome" value="My Home"> 151 <combo_item name="MyHome" value="My Home">
@@ -155,23 +163,15 @@
155 <!-- REMEMBER PASSWORD --> 163 <!-- REMEMBER PASSWORD -->
156 164
157 <check_box name="remember_check" label="Remember password" 165 <check_box name="remember_check" label="Remember password"
158 bottom_delta="-2" left="282" height="16" width="140" 166 bottom_delta="-2" left="425" height="16" width="140"
159 follows="left|bottom" font="SansSerifSmall" control_name="RememberPassword" 167 follows="left|bottom" font="SansSerifSmall" control_name="RememberPassword"
160 initial_value="false" mouse_opaque="true" /> 168 initial_value="false" mouse_opaque="true" />
161 169
162 170
163 <!-- GRID MANAGER -->
164
165 <button name="grid_btn" label="Grid Manager"
166 bottom_delta="0" left="434" height="20" width="100"
167 follows="left|bottom" font="SansSerifSmall" halign="center"
168 mouse_opaque="true" scale_image="TRUE" />
169
170
171 <!-- LOG IN --> 171 <!-- LOG IN -->
172 172
173 <button name="connect_btn" label="Log In" 173 <button name="connect_btn" label="Log In"
174 bottom="58" left_delta="150" height="24" width="120" 174 bottom="58" left="575" height="24" width="120"
175 follows="left|bottom" font="SansSerif" halign="center" 175 follows="left|bottom" font="SansSerif" halign="center"
176 mouse_opaque="true" scale_image="TRUE" /> 176 mouse_opaque="true" scale_image="TRUE" />
177 177
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml
index 0820297..8585a8e 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml
@@ -49,11 +49,16 @@ USE left="270" FOR TABBING OPTIONS
49 label="Show WindLight toolbar" left="50" mouse_opaque="true" 49 label="Show WindLight toolbar" left="50" mouse_opaque="true"
50 name="toggle_windlight_control" radio_style="false" width="237" 50 name="toggle_windlight_control" radio_style="false" width="237"
51 control_name="EnableWindlightRemote" /> 51 control_name="EnableWindlightRemote" />
52 <check_box bottom_delta="-18" enabled="true" 52 <check_box bottom_delta="0" enabled="true"
53 follows="left|top" font="SansSerifSmall" height="16" initial_value="false" 53 follows="left|top" font="SansSerifSmall" height="16" initial_value="false"
54 label="Use legacy pie menus" left_delta="0" 54 label="Use legacy pie menus" left="270"
55 mouse_opaque="true" name="legacy_pie_menu_checkbox" radio_style="false" 55 mouse_opaque="true" name="legacy_pie_menu_checkbox" radio_style="false"
56 width="256" /> 56 width="256" />
57 <check_box bottom_delta="-18" enabled="true" follows="left|top"
58 font="SansSerifSmall" height="16" initial_value="false"
59 label="Show AO toolbar" left="50" mouse_opaque="true"
60 name="toggle_ao_control" radio_style="false" width="237"
61 control_name="EnableAORemote" />
57 62
58 63
59 <view_border bevel_style="none" border_thickness="1" bottom_delta="-15" follows="left|top" 64 <view_border bevel_style="none" border_thickness="1" bottom_delta="-15" follows="left|top"