diff options
author | UbitUmarov | 2017-04-04 19:27:45 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-04 19:27:45 +0100 |
commit | e237e1b2fa444b0bf0077036c9436f919e344e2b (patch) | |
tree | b67615c35fe7185a1e02130f0bd1ca24045dcbda | |
parent | mantis 8740: rename osObjectTeleport as osTeleportObject, replaced the stop ... (diff) | |
download | opensim-SC-e237e1b2fa444b0bf0077036c9436f919e344e2b.zip opensim-SC-e237e1b2fa444b0bf0077036c9436f919e344e2b.tar.gz opensim-SC-e237e1b2fa444b0bf0077036c9436f919e344e2b.tar.bz2 opensim-SC-e237e1b2fa444b0bf0077036c9436f919e344e2b.tar.xz |
add LSL_Integer osGetLinkNumber(LSL_String name). uses a cache for the string to linknumber map, cache invalidations may still be missing :(
4 files changed, 77 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 49e98e7..6b29ec1 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1985,6 +1985,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1985 | { | 1985 | { |
1986 | newRoot.TriggerScriptChangedEvent(Changed.LINK); | 1986 | newRoot.TriggerScriptChangedEvent(Changed.LINK); |
1987 | newRoot.ParentGroup.HasGroupChanged = true; | 1987 | newRoot.ParentGroup.HasGroupChanged = true; |
1988 | newRoot.ParentGroup.InvalidatePartsLinkMaps(); | ||
1988 | newRoot.ParentGroup.ScheduleGroupForFullUpdate(); | 1989 | newRoot.ParentGroup.ScheduleGroupForFullUpdate(); |
1989 | } | 1990 | } |
1990 | } | 1991 | } |
@@ -2001,6 +2002,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2001 | // from the database. They will be rewritten immediately, | 2002 | // from the database. They will be rewritten immediately, |
2002 | // minus the rows for the unlinked child prims. | 2003 | // minus the rows for the unlinked child prims. |
2003 | m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); | 2004 | m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); |
2005 | g.InvalidatePartsLinkMaps(); | ||
2004 | g.TriggerScriptChangedEvent(Changed.LINK); | 2006 | g.TriggerScriptChangedEvent(Changed.LINK); |
2005 | g.HasGroupChanged = true; // Persist | 2007 | g.HasGroupChanged = true; // Persist |
2006 | g.ScheduleGroupForFullUpdate(); | 2008 | g.ScheduleGroupForFullUpdate(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a0d7bfd..b410b74 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2004,6 +2004,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2004 | 2004 | ||
2005 | if (part.LinkNum == 2) | 2005 | if (part.LinkNum == 2) |
2006 | RootPart.LinkNum = 1; | 2006 | RootPart.LinkNum = 1; |
2007 | InvalidatePartsLinkMaps(); | ||
2007 | } | 2008 | } |
2008 | 2009 | ||
2009 | /// <summary> | 2010 | /// <summary> |
@@ -2560,6 +2561,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2560 | dupe.ScheduleGroupForFullUpdate(); | 2561 | dupe.ScheduleGroupForFullUpdate(); |
2561 | } | 2562 | } |
2562 | 2563 | ||
2564 | dupe.InvalidatePartsLinkMaps(); | ||
2563 | m_dupeInProgress = false; | 2565 | m_dupeInProgress = false; |
2564 | return dupe; | 2566 | return dupe; |
2565 | } | 2567 | } |
@@ -3321,6 +3323,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3321 | ResetChildPrimPhysicsPositions(); | 3323 | ResetChildPrimPhysicsPositions(); |
3322 | 3324 | ||
3323 | InvalidBoundsRadius(); | 3325 | InvalidBoundsRadius(); |
3326 | InvalidatePartsLinkMaps(); | ||
3324 | 3327 | ||
3325 | if (m_rootPart.PhysActor != null) | 3328 | if (m_rootPart.PhysActor != null) |
3326 | m_rootPart.PhysActor.Building = false; | 3329 | m_rootPart.PhysActor.Building = false; |
@@ -3477,6 +3480,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3477 | objectGroup.HasGroupChangedDueToDelink = true; | 3480 | objectGroup.HasGroupChangedDueToDelink = true; |
3478 | 3481 | ||
3479 | InvalidBoundsRadius(); | 3482 | InvalidBoundsRadius(); |
3483 | InvalidatePartsLinkMaps(); | ||
3480 | objectGroup.AggregatePerms(); | 3484 | objectGroup.AggregatePerms(); |
3481 | 3485 | ||
3482 | if (sendEvents) | 3486 | if (sendEvents) |
@@ -5333,6 +5337,63 @@ namespace OpenSim.Region.Framework.Scenes | |||
5333 | m_PlaySoundSlavePrims.Clear(); | 5337 | m_PlaySoundSlavePrims.Clear(); |
5334 | m_LoopSoundMasterPrim = null; | 5338 | m_LoopSoundMasterPrim = null; |
5335 | m_targets.Clear(); | 5339 | m_targets.Clear(); |
5340 | m_partsNameToLinkMap.Clear(); | ||
5341 | } | ||
5342 | |||
5343 | Dictionary<string,int> m_partsNameToLinkMap = new Dictionary<string, int>(); | ||
5344 | |||
5345 | // this scales bad but so does GetLinkNumPart | ||
5346 | public int GetLinkNumber(string name) | ||
5347 | { | ||
5348 | if(String.IsNullOrEmpty(name) || name == "Object") | ||
5349 | return -1; | ||
5350 | |||
5351 | lock(m_partsNameToLinkMap) | ||
5352 | { | ||
5353 | if(m_partsNameToLinkMap.Count == 0) | ||
5354 | { | ||
5355 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
5356 | for (int i = 0; i < parts.Length; i++) | ||
5357 | { | ||
5358 | string s = parts[i].Name; | ||
5359 | if(String.IsNullOrEmpty(s) || s == "Object" || s == "Primitive") | ||
5360 | continue; | ||
5361 | |||
5362 | if(m_partsNameToLinkMap.ContainsKey(s)) | ||
5363 | { | ||
5364 | int ol = parts[i].LinkNum; | ||
5365 | if(ol < m_partsNameToLinkMap[s]) | ||
5366 | m_partsNameToLinkMap[s] = ol; | ||
5367 | } | ||
5368 | else | ||
5369 | m_partsNameToLinkMap[s] = parts[i].LinkNum; | ||
5370 | } | ||
5371 | } | ||
5372 | |||
5373 | if(m_partsNameToLinkMap.ContainsKey(name)) | ||
5374 | return m_partsNameToLinkMap[name]; | ||
5375 | } | ||
5376 | |||
5377 | if(m_sittingAvatars.Count > 0) | ||
5378 | { | ||
5379 | int j = m_parts.Count; | ||
5380 | if(j > 1) | ||
5381 | j++; | ||
5382 | ScenePresence[] avs = m_sittingAvatars.ToArray(); | ||
5383 | for (int i = 0; i < avs.Length; i++, j++) | ||
5384 | { | ||
5385 | if (avs[i].Name == name) | ||
5386 | return j; | ||
5387 | } | ||
5388 | } | ||
5389 | |||
5390 | return -1; | ||
5391 | } | ||
5392 | |||
5393 | public void InvalidatePartsLinkMaps() | ||
5394 | { | ||
5395 | lock(m_partsNameToLinkMap) | ||
5396 | m_partsNameToLinkMap.Clear(); | ||
5336 | } | 5397 | } |
5337 | 5398 | ||
5338 | #endregion | 5399 | #endregion |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b50ae28..0275cf4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -4663,5 +4663,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4663 | sog.TeleportObject(myid, targetPos, rotation, flags); | 4663 | sog.TeleportObject(myid, targetPos, rotation, flags); |
4664 | // a delay here may break vehicles | 4664 | // a delay here may break vehicles |
4665 | } | 4665 | } |
4666 | |||
4667 | public LSL_Integer osGetLinkNumber(LSL_String name) | ||
4668 | { | ||
4669 | m_host.AddScriptLPS(1); | ||
4670 | SceneObjectGroup sog = m_host.ParentGroup; | ||
4671 | if(sog== null || sog.IsDeleted) | ||
4672 | return -1; | ||
4673 | return sog.GetLinkNumber(name); | ||
4674 | } | ||
4666 | } | 4675 | } |
4667 | } | 4676 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 3c8e02d..7c08628 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -1144,5 +1144,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1144 | { | 1144 | { |
1145 | m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags); | 1145 | m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags); |
1146 | } | 1146 | } |
1147 | |||
1148 | public LSL_Integer osGetLinkNumber(LSL_String name) | ||
1149 | { | ||
1150 | return m_OSSL_Functions.osGetLinkNumber(name); | ||
1151 | } | ||
1147 | } | 1152 | } |
1148 | } | 1153 | } |