diff options
author | Michael Cerquoni aka Nebadon Izumi | 2011-07-07 03:18:04 -0700 |
---|---|---|
committer | dahlia | 2011-07-07 03:30:37 -0700 |
commit | 281e80ccf3353b4876eaff97b7accaf547561634 (patch) | |
tree | 3af062567437ce2e83aa2ca7a629b5e2b0598375 /OpenSim | |
parent | Add TestClearCache() (diff) | |
download | opensim-SC_OLD-281e80ccf3353b4876eaff97b7accaf547561634.zip opensim-SC_OLD-281e80ccf3353b4876eaff97b7accaf547561634.tar.gz opensim-SC_OLD-281e80ccf3353b4876eaff97b7accaf547561634.tar.bz2 opensim-SC_OLD-281e80ccf3353b4876eaff97b7accaf547561634.tar.xz |
add MeshUploadFlag capability fixed mesh upload with latest mesh viewer thank you dahlia and lkalif for helping to make this happen!
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs | 128 |
2 files changed, 150 insertions, 18 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 6786ac5..d3bb0bc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -595,21 +595,25 @@ namespace OpenSim.Region.ClientStack.Linden | |||
595 | Vector3 scale = inner_instance_list["scale"].AsVector3(); | 595 | Vector3 scale = inner_instance_list["scale"].AsVector3(); |
596 | Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); | 596 | Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); |
597 | 597 | ||
598 | // no longer used - begin ------------------------ | ||
598 | // int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); | 599 | // int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); |
599 | // int material = inner_instance_list["material"].AsInteger(); | 600 | // int material = inner_instance_list["material"].AsInteger(); |
600 | // int mesh = inner_instance_list["mesh"].AsInteger(); | 601 | // int mesh = inner_instance_list["mesh"].AsInteger(); |
601 | 602 | ||
602 | OSDMap permissions = (OSDMap)inner_instance_list["permissions"]; | 603 | // OSDMap permissions = (OSDMap)inner_instance_list["permissions"]; |
603 | int base_mask = permissions["base_mask"].AsInteger(); | 604 | // int base_mask = permissions["base_mask"].AsInteger(); |
604 | int everyone_mask = permissions["everyone_mask"].AsInteger(); | 605 | // int everyone_mask = permissions["everyone_mask"].AsInteger(); |
605 | UUID creator_id = permissions["creator_id"].AsUUID(); | 606 | // UUID creator_id = permissions["creator_id"].AsUUID(); |
606 | UUID group_id = permissions["group_id"].AsUUID(); | 607 | // UUID group_id = permissions["group_id"].AsUUID(); |
607 | int group_mask = permissions["group_mask"].AsInteger(); | 608 | // int group_mask = permissions["group_mask"].AsInteger(); |
608 | // bool is_owner_group = permissions["is_owner_group"].AsBoolean(); | 609 | // bool is_owner_group = permissions["is_owner_group"].AsBoolean(); |
609 | // UUID last_owner_id = permissions["last_owner_id"].AsUUID(); | 610 | // UUID last_owner_id = permissions["last_owner_id"].AsUUID(); |
610 | int next_owner_mask = permissions["next_owner_mask"].AsInteger(); | 611 | // int next_owner_mask = permissions["next_owner_mask"].AsInteger(); |
611 | UUID owner_id = permissions["owner_id"].AsUUID(); | 612 | // UUID owner_id = permissions["owner_id"].AsUUID(); |
612 | int owner_mask = permissions["owner_mask"].AsInteger(); | 613 | // int owner_mask = permissions["owner_mask"].AsInteger(); |
614 | // no longer used - end ------------------------ | ||
615 | |||
616 | UUID owner_id = m_HostCapsObj.AgentID; | ||
613 | 617 | ||
614 | SceneObjectPart prim | 618 | SceneObjectPart prim |
615 | = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); | 619 | = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); |
@@ -619,19 +623,19 @@ namespace OpenSim.Region.ClientStack.Linden | |||
619 | rotations.Add(rotation); | 623 | rotations.Add(rotation); |
620 | positions.Add(position); | 624 | positions.Add(position); |
621 | prim.UUID = UUID.Random(); | 625 | prim.UUID = UUID.Random(); |
622 | prim.CreatorID = creator_id; | 626 | prim.CreatorID = owner_id; |
623 | prim.OwnerID = owner_id; | 627 | prim.OwnerID = owner_id; |
624 | prim.GroupID = group_id; | 628 | prim.GroupID = UUID.Zero; |
625 | prim.LastOwnerID = prim.OwnerID; | 629 | prim.LastOwnerID = prim.OwnerID; |
626 | prim.CreationDate = Util.UnixTimeSinceEpoch(); | 630 | prim.CreationDate = Util.UnixTimeSinceEpoch(); |
627 | prim.Name = assetName; | 631 | prim.Name = assetName; |
628 | prim.Description = ""; | 632 | prim.Description = ""; |
629 | 633 | ||
630 | prim.BaseMask = (uint)base_mask; | 634 | // prim.BaseMask = (uint)base_mask; |
631 | prim.EveryoneMask = (uint)everyone_mask; | 635 | // prim.EveryoneMask = (uint)everyone_mask; |
632 | prim.GroupMask = (uint)group_mask; | 636 | // prim.GroupMask = (uint)group_mask; |
633 | prim.NextOwnerMask = (uint)next_owner_mask; | 637 | // prim.NextOwnerMask = (uint)next_owner_mask; |
634 | prim.OwnerMask = (uint)owner_mask; | 638 | // prim.OwnerMask = (uint)owner_mask; |
635 | 639 | ||
636 | if (grp == null) | 640 | if (grp == null) |
637 | grp = new SceneObjectGroup(prim); | 641 | grp = new SceneObjectGroup(prim); |
@@ -1123,4 +1127,4 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1123 | } | 1127 | } |
1124 | } | 1128 | } |
1125 | 1129 | ||
1126 | } | 1130 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs new file mode 100644 index 0000000..98f9663 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using Mono.Addins; | ||
34 | using OpenMetaverse; | ||
35 | using OpenMetaverse.StructuredData; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
42 | |||
43 | namespace OpenSim.Region.ClientStack.Linden | ||
44 | { | ||
45 | /// <summary> | ||
46 | /// MeshUploadFlag capability. This is required for uploading Mesh. | ||
47 | /// </summary> | ||
48 | /// | ||
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
50 | public class MeshUploadFlagModule : ISharedRegionModule | ||
51 | { | ||
52 | private static readonly ILog m_log = | ||
53 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
54 | private Scene m_scene; | ||
55 | private UUID m_agentID; | ||
56 | |||
57 | |||
58 | #region ISharedRegionModule Members | ||
59 | |||
60 | public void Initialise(IConfigSource source) | ||
61 | { | ||
62 | IConfig config = source.Configs["MeshUploadFlag"]; | ||
63 | if (config == null) | ||
64 | return; | ||
65 | } | ||
66 | |||
67 | public void AddRegion(Scene s) | ||
68 | { | ||
69 | m_scene = s; | ||
70 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
71 | } | ||
72 | |||
73 | public void RemoveRegion(Scene s) | ||
74 | { | ||
75 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | ||
76 | } | ||
77 | |||
78 | public void RegionLoaded(Scene s) | ||
79 | { | ||
80 | } | ||
81 | |||
82 | public void PostInitialise() | ||
83 | { | ||
84 | } | ||
85 | |||
86 | public void Close() { } | ||
87 | |||
88 | public string Name { get { return "MeshUploadFlagModule"; } } | ||
89 | |||
90 | public Type ReplaceableInterface | ||
91 | { | ||
92 | get { return null; } | ||
93 | } | ||
94 | |||
95 | #endregion | ||
96 | |||
97 | public void RegisterCaps(UUID agentID, Caps caps) | ||
98 | { | ||
99 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag); | ||
100 | caps.RegisterHandler("MeshUploadFlag", reqHandler); | ||
101 | m_agentID = agentID; | ||
102 | } | ||
103 | |||
104 | private Hashtable MeshUploadFlag(Hashtable mDhttpMethod) | ||
105 | { | ||
106 | m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: MeshUploadFlag request"); | ||
107 | OSDMap data = new OSDMap(); | ||
108 | ScenePresence sp = m_scene.GetScenePresence(m_agentID); | ||
109 | data["username"] = sp.Firstname + "." + sp.Lastname; | ||
110 | data["display_name_next_update"] = new OSDDate(DateTime.Now); | ||
111 | data["legacy_first_name"] = sp.Firstname; | ||
112 | data["mesh_upload_status"] = "valid"; | ||
113 | data["display_name"] = sp.Firstname + " " + sp.Lastname; | ||
114 | data["legacy_last_name"] = sp.Lastname; | ||
115 | data["id"] = m_agentID; | ||
116 | data["is_display_name_default"] = true; | ||
117 | |||
118 | //Send back data | ||
119 | Hashtable responsedata = new Hashtable(); | ||
120 | responsedata["int_response_code"] = 200; | ||
121 | responsedata["content_type"] = "text/plain"; | ||
122 | responsedata["keepalive"] = false; | ||
123 | responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data); | ||
124 | return responsedata; | ||
125 | } | ||
126 | |||
127 | } | ||
128 | } \ No newline at end of file | ||