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 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
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 :(
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 61 |
1 files changed, 61 insertions, 0 deletions
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 |