diff options
author | Justin Clark-Casey (justincc) | 2012-07-05 00:05:06 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-05 00:05:06 +0100 |
commit | 951b45b80fd504b4874b9ec3e0fbff49a25cb46f (patch) | |
tree | 29b59d97d8b8ce8ee00227c41227d824d6694efa /OpenSim/Region/Framework/Scenes | |
parent | Use GetInventoryItem() in llRezAtRoot rather than iterating through a cloned ... (diff) | |
download | opensim-SC-951b45b80fd504b4874b9ec3e0fbff49a25cb46f.zip opensim-SC-951b45b80fd504b4874b9ec3e0fbff49a25cb46f.tar.gz opensim-SC-951b45b80fd504b4874b9ec3e0fbff49a25cb46f.tar.bz2 opensim-SC-951b45b80fd504b4874b9ec3e0fbff49a25cb46f.tar.xz |
Add OSSL function osForceAttachToAvatarFromInventory()
This works like osForceAttachToAvatar() but allows an object to be directly specified from the script object's inventory rather than forcing it to be rezzed in the scene first.
Still only attaches objects to the owner of the script.
This allows one to bypass the complicated co-ordination of first rezzing objects in the scene before attaching them.
Threat level high.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
5 files changed, 35 insertions, 30 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 81add43..3398a53 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -186,15 +186,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
186 | TestHelpers.InMethod(); | 186 | TestHelpers.InMethod(); |
187 | 187 | ||
188 | TestScene scene = new SceneHelpers().SetupScene(); | 188 | TestScene scene = new SceneHelpers().SetupScene(); |
189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 189 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene); |
190 | 190 | ||
191 | Assert.That(part.ParentGroup.IsDeleted, Is.False); | 191 | Assert.That(so.IsDeleted, Is.False); |
192 | 192 | ||
193 | scene.DeleteSceneObject(part.ParentGroup, false); | 193 | scene.DeleteSceneObject(so, false); |
194 | 194 | ||
195 | Assert.That(part.ParentGroup.IsDeleted, Is.True); | 195 | Assert.That(so.IsDeleted, Is.True); |
196 | 196 | ||
197 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 197 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); |
198 | Assert.That(retrievedPart, Is.Null); | 198 | Assert.That(retrievedPart, Is.Null); |
199 | } | 199 | } |
200 | 200 | ||
@@ -215,22 +215,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
215 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | 215 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; |
216 | sogd.Enabled = false; | 216 | sogd.Enabled = false; |
217 | 217 | ||
218 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 218 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene); |
219 | 219 | ||
220 | IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; | 220 | IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; |
221 | scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); | 221 | scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); |
222 | 222 | ||
223 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 223 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); |
224 | 224 | ||
225 | Assert.That(retrievedPart, Is.Not.Null); | 225 | Assert.That(retrievedPart, Is.Not.Null); |
226 | 226 | ||
227 | Assert.That(part.ParentGroup.IsDeleted, Is.False); | 227 | Assert.That(so.IsDeleted, Is.False); |
228 | 228 | ||
229 | sogd.InventoryDeQueueAndDelete(); | 229 | sogd.InventoryDeQueueAndDelete(); |
230 | 230 | ||
231 | Assert.That(part.ParentGroup.IsDeleted, Is.True); | 231 | Assert.That(so.IsDeleted, Is.True); |
232 | 232 | ||
233 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); | 233 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); |
234 | Assert.That(retrievedPart2, Is.Null); | 234 | Assert.That(retrievedPart2, Is.Null); |
235 | } | 235 | } |
236 | 236 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index 1add3dd..0e525c9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -72,10 +72,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
72 | bool debugtest = false; | 72 | bool debugtest = false; |
73 | 73 | ||
74 | Scene scene = new SceneHelpers().SetupScene(); | 74 | Scene scene = new SceneHelpers().SetupScene(); |
75 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); | 75 | SceneObjectGroup grp1 = SceneHelpers.AddSceneObject(scene); |
76 | SceneObjectGroup grp1 = part1.ParentGroup; | 76 | SceneObjectPart part1 = grp1.RootPart; |
77 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); | 77 | SceneObjectGroup grp2 = SceneHelpers.AddSceneObject(scene); |
78 | SceneObjectGroup grp2 = part2.ParentGroup; | 78 | SceneObjectPart part2 = grp2.RootPart; |
79 | 79 | ||
80 | grp1.AbsolutePosition = new Vector3(10, 10, 10); | 80 | grp1.AbsolutePosition = new Vector3(10, 10, 10); |
81 | grp2.AbsolutePosition = Vector3.Zero; | 81 | grp2.AbsolutePosition = Vector3.Zero; |
@@ -154,14 +154,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
154 | bool debugtest = false; | 154 | bool debugtest = false; |
155 | 155 | ||
156 | Scene scene = new SceneHelpers().SetupScene(); | 156 | Scene scene = new SceneHelpers().SetupScene(); |
157 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); | 157 | SceneObjectGroup grp1 = SceneHelpers.AddSceneObject(scene); |
158 | SceneObjectGroup grp1 = part1.ParentGroup; | 158 | SceneObjectPart part1 = grp1.RootPart; |
159 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); | 159 | SceneObjectGroup grp2 = SceneHelpers.AddSceneObject(scene); |
160 | SceneObjectGroup grp2 = part2.ParentGroup; | 160 | SceneObjectPart part2 = grp2.RootPart; |
161 | SceneObjectPart part3 = SceneHelpers.AddSceneObject(scene); | 161 | SceneObjectGroup grp3 = SceneHelpers.AddSceneObject(scene); |
162 | SceneObjectGroup grp3 = part3.ParentGroup; | 162 | SceneObjectPart part3 = grp3.RootPart; |
163 | SceneObjectPart part4 = SceneHelpers.AddSceneObject(scene); | 163 | SceneObjectGroup grp4 = SceneHelpers.AddSceneObject(scene); |
164 | SceneObjectGroup grp4 = part4.ParentGroup; | 164 | SceneObjectPart part4 = grp4.RootPart; |
165 | 165 | ||
166 | grp1.AbsolutePosition = new Vector3(10, 10, 10); | 166 | grp1.AbsolutePosition = new Vector3(10, 10, 10); |
167 | grp2.AbsolutePosition = Vector3.Zero; | 167 | grp2.AbsolutePosition = Vector3.Zero; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 0a94c19..e931859 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
53 | // log4net.Config.XmlConfigurator.Configure(); | 53 | // log4net.Config.XmlConfigurator.Configure(); |
54 | 54 | ||
55 | Scene scene = new SceneHelpers().SetupScene(); | 55 | Scene scene = new SceneHelpers().SetupScene(); |
56 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup; | 56 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); |
57 | 57 | ||
58 | g1.GroupResize(new Vector3(2, 3, 4)); | 58 | g1.GroupResize(new Vector3(2, 3, 4)); |
59 | 59 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index 313e350..ed39be1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
64 | Vector3 startPos = new Vector3(10.1f, 0, 0); | 64 | Vector3 startPos = new Vector3(10.1f, 0, 0); |
65 | m_sp.AbsolutePosition = startPos; | 65 | m_sp.AbsolutePosition = startPos; |
66 | 66 | ||
67 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); | 67 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
68 | 68 | ||
69 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); | 69 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); |
70 | 70 | ||
@@ -82,7 +82,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
82 | Vector3 startPos = new Vector3(9.9f, 0, 0); | 82 | Vector3 startPos = new Vector3(9.9f, 0, 0); |
83 | m_sp.AbsolutePosition = startPos; | 83 | m_sp.AbsolutePosition = startPos; |
84 | 84 | ||
85 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); | 85 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
86 | 86 | ||
87 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); | 87 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); |
88 | 88 | ||
@@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
100 | Vector3 startPos = new Vector3(1, 1, 1); | 100 | Vector3 startPos = new Vector3(1, 1, 1); |
101 | m_sp.AbsolutePosition = startPos; | 101 | m_sp.AbsolutePosition = startPos; |
102 | 102 | ||
103 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); | 103 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
104 | 104 | ||
105 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); | 105 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); |
106 | 106 | ||
@@ -133,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
133 | Vector3 startPos = new Vector3(128, 128, 30); | 133 | Vector3 startPos = new Vector3(128, 128, 30); |
134 | m_sp.AbsolutePosition = startPos; | 134 | m_sp.AbsolutePosition = startPos; |
135 | 135 | ||
136 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); | 136 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
137 | part.SitTargetPosition = new Vector3(0, 0, 1); | 137 | part.SitTargetPosition = new Vector3(0, 0, 1); |
138 | 138 | ||
139 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); | 139 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index d15141b..a51e4e3 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -128,7 +128,9 @@ namespace OpenSim.Region.Framework.Tests | |||
128 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 128 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
129 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | 129 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
130 | SceneObjectPart sop1 = sog1.RootPart; | 130 | SceneObjectPart sop1 = sog1.RootPart; |
131 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); | 131 | TaskInventoryItem sopItem1 |
132 | = TaskInventoryHelpers.AddNotecard( | ||
133 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); | ||
132 | 134 | ||
133 | InventoryFolderBase folder | 135 | InventoryFolderBase folder |
134 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; | 136 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; |
@@ -156,8 +158,11 @@ namespace OpenSim.Region.Framework.Tests | |||
156 | Scene scene = new SceneHelpers().SetupScene(); | 158 | Scene scene = new SceneHelpers().SetupScene(); |
157 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 159 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
158 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); | 160 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
161 | |||
159 | SceneObjectPart sop1 = sog1.RootPart; | 162 | SceneObjectPart sop1 = sog1.RootPart; |
160 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); | 163 | TaskInventoryItem sopItem1 |
164 | = TaskInventoryHelpers.AddNotecard( | ||
165 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); | ||
161 | 166 | ||
162 | // Perform test | 167 | // Perform test |
163 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); | 168 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); |