aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-01-14 07:51:24 -0700
committerMcCabe Maxsted2009-01-14 07:51:24 -0700
commit15249add53e27895fa9a7884adafad1bd319ae4e (patch)
tree4743a5fdf592d537c70aa3308e3de22dc8a492bc /linden
parentAdded text to IM window about inventory transfers (diff)
downloadmeta-impy-15249add53e27895fa9a7884adafad1bd319ae4e.zip
meta-impy-15249add53e27895fa9a7884adafad1bd319ae4e.tar.gz
meta-impy-15249add53e27895fa9a7884adafad1bd319ae4e.tar.bz2
meta-impy-15249add53e27895fa9a7884adafad1bd319ae4e.tar.xz
Added the 'Return to World' inventory option
Diffstat (limited to '')
-rw-r--r--linden/indra/lib/python/indra/base/llsd.py79
-rw-r--r--linden/indra/llcommon/indra_constants.h11
-rw-r--r--linden/indra/newview/llinventorybridge.cpp47
-rw-r--r--linden/indra/newview/llinventorybridge.h3
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml4
-rw-r--r--linden/scripts/messages/message_template.msg52
6 files changed, 177 insertions, 19 deletions
diff --git a/linden/indra/lib/python/indra/base/llsd.py b/linden/indra/lib/python/indra/base/llsd.py
index 521b79c..e6141b6 100644
--- a/linden/indra/lib/python/indra/base/llsd.py
+++ b/linden/indra/lib/python/indra/base/llsd.py
@@ -36,10 +36,13 @@ import re
36from indra.util.fastest_elementtree import ElementTreeError, fromstring 36from indra.util.fastest_elementtree import ElementTreeError, fromstring
37from indra.base import lluuid 37from indra.base import lluuid
38 38
39try: 39# cllsd.c in server/server-1.25 has memory leaks,
40 import cllsd 40# so disabling cllsd for now
41except ImportError: 41#try:
42 cllsd = None 42# import cllsd
43#except ImportError:
44# cllsd = None
45cllsd = None
43 46
44int_regex = re.compile(r"[-+]?\d+") 47int_regex = re.compile(r"[-+]?\d+")
45real_regex = re.compile(r"[-+]?(\d+(\.\d*)?|\d*\.\d+)([eE][-+]?\d+)?") 48real_regex = re.compile(r"[-+]?(\d+(\.\d*)?|\d*\.\d+)([eE][-+]?\d+)?")
@@ -47,7 +50,7 @@ alpha_regex = re.compile(r"[a-zA-Z]+")
47date_regex = re.compile(r"(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})T" 50date_regex = re.compile(r"(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})T"
48 r"(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2})" 51 r"(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2})"
49 r"(?P<second_float>(\.\d+)?)Z") 52 r"(?P<second_float>(\.\d+)?)Z")
50#date: d"YYYY-MM-DDTHH:MM:SS.FFZ" 53#date: d"YYYY-MM-DDTHH:MM:SS.FFFFFFZ"
51 54
52class LLSDParseError(Exception): 55class LLSDParseError(Exception):
53 pass 56 pass
@@ -69,14 +72,7 @@ BOOL_FALSE = ('0', '0.0', 'false', '')
69 72
70def format_datestr(v): 73def format_datestr(v):
71 """ Formats a datetime object into the string format shared by xml and notation serializations.""" 74 """ Formats a datetime object into the string format shared by xml and notation serializations."""
72 second_str = "" 75 return v.isoformat() + 'Z'
73 if v.microsecond > 0:
74 seconds = v.second + float(v.microsecond) / 1e6
75 second_str = "%05.2f" % seconds
76 else:
77 second_str = "%02d" % v.second
78 return '%s%sZ' % (v.strftime('%Y-%m-%dT%H:%M:'), second_str)
79
80 76
81def parse_datestr(datestr): 77def parse_datestr(datestr):
82 """Parses a datetime object from the string format shared by xml and notation serializations.""" 78 """Parses a datetime object from the string format shared by xml and notation serializations."""
@@ -133,6 +129,7 @@ def date_to_python(node):
133 if not val: 129 if not val:
134 val = "1970-01-01T00:00:00Z" 130 val = "1970-01-01T00:00:00Z"
135 return parse_datestr(val) 131 return parse_datestr(val)
132
136 133
137def uri_to_python(node): 134def uri_to_python(node):
138 val = node.text or '' 135 val = node.text or ''
@@ -969,6 +966,9 @@ class LLSD(object):
969 966
970undef = LLSD(None) 967undef = LLSD(None)
971 968
969XML_MIME_TYPE = 'application/llsd+xml'
970BINARY_MIME_TYPE = 'application/llsd+binary'
971
972# register converters for llsd in mulib, if it is available 972# register converters for llsd in mulib, if it is available
973try: 973try:
974 from mulib import stacked, mu 974 from mulib import stacked, mu
@@ -978,7 +978,7 @@ except:
978 # mulib not available, don't print an error message since this is normal 978 # mulib not available, don't print an error message since this is normal
979 pass 979 pass
980else: 980else:
981 mu.add_parser(parse, 'application/llsd+xml') 981 mu.add_parser(parse, XML_MIME_TYPE)
982 mu.add_parser(parse, 'application/llsd+binary') 982 mu.add_parser(parse, 'application/llsd+binary')
983 983
984 def llsd_convert_xml(llsd_stuff, request): 984 def llsd_convert_xml(llsd_stuff, request):
@@ -987,11 +987,58 @@ else:
987 def llsd_convert_binary(llsd_stuff, request): 987 def llsd_convert_binary(llsd_stuff, request):
988 request.write(format_binary(llsd_stuff)) 988 request.write(format_binary(llsd_stuff))
989 989
990 for typ in [LLSD, dict, list, tuple, str, int, float, bool, unicode, type(None)]: 990 for typ in [LLSD, dict, list, tuple, str, int, long, float, bool, unicode, type(None)]:
991 stacked.add_producer(typ, llsd_convert_xml, 'application/llsd+xml') 991 stacked.add_producer(typ, llsd_convert_xml, XML_MIME_TYPE)
992 stacked.add_producer(typ, llsd_convert_xml, 'application/xml') 992 stacked.add_producer(typ, llsd_convert_xml, 'application/xml')
993 stacked.add_producer(typ, llsd_convert_xml, 'text/xml') 993 stacked.add_producer(typ, llsd_convert_xml, 'text/xml')
994 994
995 stacked.add_producer(typ, llsd_convert_binary, 'application/llsd+binary') 995 stacked.add_producer(typ, llsd_convert_binary, 'application/llsd+binary')
996 996
997 stacked.add_producer(LLSD, llsd_convert_xml, '*/*') 997 stacked.add_producer(LLSD, llsd_convert_xml, '*/*')
998
999 # in case someone is using the legacy mu.xml wrapper, we need to
1000 # tell mu to produce application/xml or application/llsd+xml
1001 # (based on the accept header) from raw xml. Phoenix 2008-07-21
1002 stacked.add_producer(mu.xml, mu.produce_raw, XML_MIME_TYPE)
1003 stacked.add_producer(mu.xml, mu.produce_raw, 'application/xml')
1004
1005
1006
1007# mulib wsgi stuff
1008# try:
1009# from mulib import mu, adapters
1010#
1011# # try some known attributes from mulib to be ultra-sure we've imported it
1012# mu.get_current
1013# adapters.handlers
1014# except:
1015# # mulib not available, don't print an error message since this is normal
1016# pass
1017# else:
1018# def llsd_xml_handler(content_type):
1019# def handle_llsd_xml(env, start_response):
1020# llsd_stuff, _ = mu.get_current(env)
1021# result = format_xml(llsd_stuff)
1022# start_response("200 OK", [('Content-Type', content_type)])
1023# env['mu.negotiated_type'] = content_type
1024# yield result
1025# return handle_llsd_xml
1026#
1027# def llsd_binary_handler(content_type):
1028# def handle_llsd_binary(env, start_response):
1029# llsd_stuff, _ = mu.get_current(env)
1030# result = format_binary(llsd_stuff)
1031# start_response("200 OK", [('Content-Type', content_type)])
1032# env['mu.negotiated_type'] = content_type
1033# yield result
1034# return handle_llsd_binary
1035#
1036# adapters.DEFAULT_PARSERS[XML_MIME_TYPE] = parse
1037
1038# for typ in [LLSD, dict, list, tuple, str, int, float, bool, unicode, type(None)]:
1039# for content_type in (XML_MIME_TYPE, 'application/xml'):
1040# adapters.handlers.set_handler(typ, llsd_xml_handler(content_type), content_type)
1041#
1042# adapters.handlers.set_handler(typ, llsd_binary_handler(BINARY_MIME_TYPE), BINARY_MIME_TYPE)
1043#
1044# adapters.handlers.set_handler(LLSD, llsd_xml_handler(XML_MIME_TYPE), '*/*')
diff --git a/linden/indra/llcommon/indra_constants.h b/linden/indra/llcommon/indra_constants.h
index fcb2aaf..023676a 100644
--- a/linden/indra/llcommon/indra_constants.h
+++ b/linden/indra/llcommon/indra_constants.h
@@ -77,6 +77,14 @@ enum LAND_STAT_REPORT_TYPE
77 77
78const U32 STAT_FILTER_MASK = 0x1FFFFFFF; 78const U32 STAT_FILTER_MASK = 0x1FFFFFFF;
79 79
80// Region absolute limits
81static const S32 REGION_AGENT_COUNT_MIN = 1;
82static const S32 REGION_AGENT_COUNT_MAX = 200; // Must fit in U8 for the moment (RegionInfo msg)
83static const S32 REGION_PRIM_COUNT_MIN = 0;
84static const S32 REGION_PRIM_COUNT_MAX = 40000;
85static const F32 REGION_PRIM_BONUS_MIN = 1.0;
86static const F32 REGION_PRIM_BONUS_MAX = 10.0;
87
80// Default maximum number of tasks/prims per region. 88// Default maximum number of tasks/prims per region.
81const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; 89const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000;
82 90
@@ -229,10 +237,11 @@ const S32 KEY_COUNT = 256;
229const F32 DEFAULT_WATER_HEIGHT = 20.0f; 237const F32 DEFAULT_WATER_HEIGHT = 20.0f;
230 238
231// Maturity ratings for simulators 239// Maturity ratings for simulators
232const U8 SIM_ACCESS_MIN = 0; 240const U8 SIM_ACCESS_MIN = 0; // Treated as 'unknown', usually ends up being SIM_ACCESS_PG
233const U8 SIM_ACCESS_TRIAL = 7; 241const U8 SIM_ACCESS_TRIAL = 7;
234const U8 SIM_ACCESS_PG = 13; 242const U8 SIM_ACCESS_PG = 13;
235const U8 SIM_ACCESS_MATURE = 21; 243const U8 SIM_ACCESS_MATURE = 21;
244const U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only
236const U8 SIM_ACCESS_DOWN = 254; 245const U8 SIM_ACCESS_DOWN = 254;
237const U8 SIM_ACCESS_MAX = SIM_ACCESS_MATURE; 246const U8 SIM_ACCESS_MAX = SIM_ACCESS_MATURE;
238 247
diff --git a/linden/indra/newview/llinventorybridge.cpp b/linden/indra/newview/llinventorybridge.cpp
index bde36cc..34277f7 100644
--- a/linden/indra/newview/llinventorybridge.cpp
+++ b/linden/indra/newview/llinventorybridge.cpp
@@ -756,6 +756,10 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model,
756 model->deleteObject(mUUID); 756 model->deleteObject(mUUID);
757 model->notifyObservers(); 757 model->notifyObservers();
758 } 758 }
759 else if ("restoreToWorld" == action)
760 {
761 restoreToWorld();
762 }
759 else if ("restore" == action) 763 else if ("restore" == action)
760 { 764 {
761 restoreItem(); 765 restoreItem();
@@ -812,6 +816,47 @@ void LLItemBridge::restoreItem()
812 } 816 }
813} 817}
814 818
819void LLItemBridge::restoreToWorld()
820{
821 LLViewerInventoryItem* itemp = (LLViewerInventoryItem*)getItem();
822 if (itemp)
823 {
824 LLMessageSystem* msg = gMessageSystem;
825 msg->newMessage("RezRestoreToWorld");
826 msg->nextBlockFast(_PREHASH_AgentData);
827 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
828 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
829
830 msg->nextBlockFast(_PREHASH_InventoryData);
831 itemp->packMessage(msg);
832 msg->sendReliable(gAgent.getRegion()->getHost());
833 }
834
835 //Similar functionality to the drag and drop rez logic
836 BOOL remove_from_inventory = FALSE;
837
838 //remove local inventory copy, sim will deal with permissions and removing the item
839 //from the actual inventory if its a no-copy etc
840 if(!itemp->getPermissions().allowCopyBy(gAgent.getID()))
841 {
842 remove_from_inventory = TRUE;
843 }
844
845 // Check if it's in the trash. (again similar to the normal rez logic)
846 LLUUID trash_id;
847 trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH);
848 if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id))
849 {
850 remove_from_inventory = TRUE;
851 }
852
853 if(remove_from_inventory)
854 {
855 gInventory.deleteObject(itemp->getUUID());
856 gInventory.notifyObservers();
857 }
858}
859
815LLUIImagePtr LLItemBridge::getIcon() const 860LLUIImagePtr LLItemBridge::getIcon() const
816{ 861{
817 return LLUI::getUIImage(ICON_NAME[OBJECT_ICON_NAME]); 862 return LLUI::getUIImage(ICON_NAME[OBJECT_ICON_NAME]);
@@ -3376,6 +3421,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
3376 items.push_back(std::string("Object Wear")); 3421 items.push_back(std::string("Object Wear"));
3377 items.push_back(std::string("Attach To")); 3422 items.push_back(std::string("Attach To"));
3378 items.push_back(std::string("Attach To HUD")); 3423 items.push_back(std::string("Attach To HUD"));
3424 items.push_back(std::string("Restore to Last Position"));
3379 3425
3380 LLMenuGL* attach_menu = menu.getChildMenuByName("Attach To", TRUE); 3426 LLMenuGL* attach_menu = menu.getChildMenuByName("Attach To", TRUE);
3381 LLMenuGL* attach_hud_menu = menu.getChildMenuByName("Attach To HUD", TRUE); 3427 LLMenuGL* attach_hud_menu = menu.getChildMenuByName("Attach To HUD", TRUE);
@@ -4364,7 +4410,6 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
4364 items.push_back(std::string("Wearable Wear")); 4410 items.push_back(std::string("Wearable Wear"));
4365 items.push_back(std::string("Wearable Edit")); 4411 items.push_back(std::string("Wearable Edit"));
4366 4412
4367
4368 if ((flags & FIRST_SELECTED_ITEM) == 0) 4413 if ((flags & FIRST_SELECTED_ITEM) == 0)
4369 { 4414 {
4370 disabled_items.push_back(std::string("Wearable Edit")); 4415 disabled_items.push_back(std::string("Wearable Edit"));
diff --git a/linden/indra/newview/llinventorybridge.h b/linden/indra/newview/llinventorybridge.h
index 329e57f..eb17432 100644
--- a/linden/indra/newview/llinventorybridge.h
+++ b/linden/indra/newview/llinventorybridge.h
@@ -159,6 +159,7 @@ public:
159 159
160 virtual const std::string& getPrefix() { return LLStringUtil::null; } 160 virtual const std::string& getPrefix() { return LLStringUtil::null; }
161 virtual void restoreItem() {} 161 virtual void restoreItem() {}
162 virtual void restoreToWorld() {}
162 163
163 // LLFolderViewEventListener functions 164 // LLFolderViewEventListener functions
164 virtual const std::string& getName() const; 165 virtual const std::string& getName() const;
@@ -243,6 +244,7 @@ public:
243 244
244 virtual void selectItem(); 245 virtual void selectItem();
245 virtual void restoreItem(); 246 virtual void restoreItem();
247 virtual void restoreToWorld();
246 248
247 virtual LLUIImagePtr getIcon() const; 249 virtual LLUIImagePtr getIcon() const;
248 virtual const std::string& getDisplayName() const; 250 virtual const std::string& getDisplayName() const;
@@ -283,7 +285,6 @@ public:
283 virtual void selectItem(); 285 virtual void selectItem();
284 virtual void restoreItem(); 286 virtual void restoreItem();
285 287
286
287 virtual LLUIImagePtr getIcon() const; 288 virtual LLUIImagePtr getIcon() const;
288 virtual BOOL renameItem(const std::string& new_name); 289 virtual BOOL renameItem(const std::string& new_name);
289 virtual BOOL removeItem(); 290 virtual BOOL removeItem();
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 31288ac..aa61e77 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
@@ -223,6 +223,10 @@
223 mouse_opaque="true" name="Detach From Yourself" width="128"> 223 mouse_opaque="true" name="Detach From Yourself" width="128">
224 <on_click filter="" function="Inventory.DoToSelected" userdata="detach" /> 224 <on_click filter="" function="Inventory.DoToSelected" userdata="detach" />
225 </menu_item_call> 225 </menu_item_call>
226 <menu_item_call bottom_delta="-18" height="18" label="Restore to Last Position" left="0" mouse_opaque="true"
227 name="Restore to Last Position" width="128">
228 <on_click filter="" function="Inventory.DoToSelected" userdata="restoreToWorld" />
229 </menu_item_call>
226 <menu_item_call bottom_delta="-18" height="18" label="Wear" left="0" mouse_opaque="true" 230 <menu_item_call bottom_delta="-18" height="18" label="Wear" left="0" mouse_opaque="true"
227 name="Object Wear" width="128"> 231 name="Object Wear" width="128">
228 <on_click filter="" function="Inventory.DoToSelected" userdata="attach" /> 232 <on_click filter="" function="Inventory.DoToSelected" userdata="attach" />
diff --git a/linden/scripts/messages/message_template.msg b/linden/scripts/messages/message_template.msg
index a7835ad..6d90622 100644
--- a/linden/scripts/messages/message_template.msg
+++ b/linden/scripts/messages/message_template.msg
@@ -2942,6 +2942,14 @@ version 2.0
2942 { UseEstateSun BOOL } 2942 { UseEstateSun BOOL }
2943 { SunHour F32 } // last value set by estate or region controls JC 2943 { SunHour F32 } // last value set by estate or region controls JC
2944 } 2944 }
2945 {
2946 RegionInfo2 Single
2947 { ProductSKU Variable 1 } // string
2948 { ProductName Variable 1 } // string
2949 { MaxAgents32 U32 } // Identical to RegionInfo.MaxAgents but allows greater range
2950 { HardMaxAgents U32 }
2951 { HardMaxObjects U32 }
2952 }
2945} 2953}
2946 2954
2947// GodUpdateRegionInfo 2955// GodUpdateRegionInfo
@@ -3059,6 +3067,14 @@ version 2.0
3059 RegionInfo2 Single 3067 RegionInfo2 Single
3060 { RegionID LLUUID } 3068 { RegionID LLUUID }
3061 } 3069 }
3070 {
3071 RegionInfo3 Single
3072 { CPUClassID S32 }
3073 { CPURatio S32 }
3074 { ColoName Variable 1 } // string
3075 { ProductSKU Variable 1 } // string
3076 { ProductName Variable 1 } // string
3077 }
3062} 3078}
3063 3079
3064// RegionHandshakeReply 3080// RegionHandshakeReply
@@ -8854,3 +8870,39 @@ version 2.0
8854 } 8870 }
8855} 8871}
8856 8872
8873
8874// This message is sent from viewer -> simulator when the viewer wants
8875// to rez an object out of inventory back to its position before it
8876// last moved into the inventory
8877{
8878 RezRestoreToWorld Low 425 NotTrusted Unencoded UDPDeprecated
8879 {
8880 AgentData Single
8881 { AgentID LLUUID }
8882 { SessionID LLUUID }
8883 }
8884 {
8885 InventoryData Single
8886 { ItemID LLUUID }
8887 { FolderID LLUUID }
8888 { CreatorID LLUUID } // permissions
8889 { OwnerID LLUUID } // permissions
8890 { GroupID LLUUID } // permissions
8891 { BaseMask U32 } // permissions
8892 { OwnerMask U32 } // permissions
8893 { GroupMask U32 } // permissions
8894 { EveryoneMask U32 } // permissions
8895 { NextOwnerMask U32 } // permissions
8896 { GroupOwned BOOL } // permissions
8897 { TransactionID LLUUID }
8898 { Type S8 }
8899 { InvType S8 }
8900 { Flags U32 }
8901 { SaleType U8 }
8902 { SalePrice S32 }
8903 { Name Variable 1 }
8904 { Description Variable 1 }
8905 { CreationDate S32 }
8906 { CRC U32 }
8907 }
8908}