add LSL_Integer osGetLinkNumber(LSL_String name). uses a cache for the string to linknumber map, cache invalidations may still be missing :(
parent
ca250e0b0b
commit
e237e1b2fa
|
@ -1985,6 +1985,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
newRoot.TriggerScriptChangedEvent(Changed.LINK);
|
newRoot.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
newRoot.ParentGroup.HasGroupChanged = true;
|
newRoot.ParentGroup.HasGroupChanged = true;
|
||||||
|
newRoot.ParentGroup.InvalidatePartsLinkMaps();
|
||||||
newRoot.ParentGroup.ScheduleGroupForFullUpdate();
|
newRoot.ParentGroup.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2001,6 +2002,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// from the database. They will be rewritten immediately,
|
// from the database. They will be rewritten immediately,
|
||||||
// minus the rows for the unlinked child prims.
|
// minus the rows for the unlinked child prims.
|
||||||
m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID);
|
m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID);
|
||||||
|
g.InvalidatePartsLinkMaps();
|
||||||
g.TriggerScriptChangedEvent(Changed.LINK);
|
g.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
g.HasGroupChanged = true; // Persist
|
g.HasGroupChanged = true; // Persist
|
||||||
g.ScheduleGroupForFullUpdate();
|
g.ScheduleGroupForFullUpdate();
|
||||||
|
|
|
@ -2004,6 +2004,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (part.LinkNum == 2)
|
if (part.LinkNum == 2)
|
||||||
RootPart.LinkNum = 1;
|
RootPart.LinkNum = 1;
|
||||||
|
InvalidatePartsLinkMaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2560,6 +2561,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
dupe.ScheduleGroupForFullUpdate();
|
dupe.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dupe.InvalidatePartsLinkMaps();
|
||||||
m_dupeInProgress = false;
|
m_dupeInProgress = false;
|
||||||
return dupe;
|
return dupe;
|
||||||
}
|
}
|
||||||
|
@ -3321,6 +3323,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ResetChildPrimPhysicsPositions();
|
ResetChildPrimPhysicsPositions();
|
||||||
|
|
||||||
InvalidBoundsRadius();
|
InvalidBoundsRadius();
|
||||||
|
InvalidatePartsLinkMaps();
|
||||||
|
|
||||||
if (m_rootPart.PhysActor != null)
|
if (m_rootPart.PhysActor != null)
|
||||||
m_rootPart.PhysActor.Building = false;
|
m_rootPart.PhysActor.Building = false;
|
||||||
|
@ -3477,6 +3480,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
objectGroup.HasGroupChangedDueToDelink = true;
|
objectGroup.HasGroupChangedDueToDelink = true;
|
||||||
|
|
||||||
InvalidBoundsRadius();
|
InvalidBoundsRadius();
|
||||||
|
InvalidatePartsLinkMaps();
|
||||||
objectGroup.AggregatePerms();
|
objectGroup.AggregatePerms();
|
||||||
|
|
||||||
if (sendEvents)
|
if (sendEvents)
|
||||||
|
@ -5333,6 +5337,63 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_PlaySoundSlavePrims.Clear();
|
m_PlaySoundSlavePrims.Clear();
|
||||||
m_LoopSoundMasterPrim = null;
|
m_LoopSoundMasterPrim = null;
|
||||||
m_targets.Clear();
|
m_targets.Clear();
|
||||||
|
m_partsNameToLinkMap.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string,int> m_partsNameToLinkMap = new Dictionary<string, int>();
|
||||||
|
|
||||||
|
// this scales bad but so does GetLinkNumPart
|
||||||
|
public int GetLinkNumber(string name)
|
||||||
|
{
|
||||||
|
if(String.IsNullOrEmpty(name) || name == "Object")
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
lock(m_partsNameToLinkMap)
|
||||||
|
{
|
||||||
|
if(m_partsNameToLinkMap.Count == 0)
|
||||||
|
{
|
||||||
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
|
for (int i = 0; i < parts.Length; i++)
|
||||||
|
{
|
||||||
|
string s = parts[i].Name;
|
||||||
|
if(String.IsNullOrEmpty(s) || s == "Object" || s == "Primitive")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(m_partsNameToLinkMap.ContainsKey(s))
|
||||||
|
{
|
||||||
|
int ol = parts[i].LinkNum;
|
||||||
|
if(ol < m_partsNameToLinkMap[s])
|
||||||
|
m_partsNameToLinkMap[s] = ol;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_partsNameToLinkMap[s] = parts[i].LinkNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_partsNameToLinkMap.ContainsKey(name))
|
||||||
|
return m_partsNameToLinkMap[name];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_sittingAvatars.Count > 0)
|
||||||
|
{
|
||||||
|
int j = m_parts.Count;
|
||||||
|
if(j > 1)
|
||||||
|
j++;
|
||||||
|
ScenePresence[] avs = m_sittingAvatars.ToArray();
|
||||||
|
for (int i = 0; i < avs.Length; i++, j++)
|
||||||
|
{
|
||||||
|
if (avs[i].Name == name)
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InvalidatePartsLinkMaps()
|
||||||
|
{
|
||||||
|
lock(m_partsNameToLinkMap)
|
||||||
|
m_partsNameToLinkMap.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -4663,5 +4663,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
sog.TeleportObject(myid, targetPos, rotation, flags);
|
sog.TeleportObject(myid, targetPos, rotation, flags);
|
||||||
// a delay here may break vehicles
|
// a delay here may break vehicles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSL_Integer osGetLinkNumber(LSL_String name)
|
||||||
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
SceneObjectGroup sog = m_host.ParentGroup;
|
||||||
|
if(sog== null || sog.IsDeleted)
|
||||||
|
return -1;
|
||||||
|
return sog.GetLinkNumber(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1144,5 +1144,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags);
|
m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSL_Integer osGetLinkNumber(LSL_String name)
|
||||||
|
{
|
||||||
|
return m_OSSL_Functions.osGetLinkNumber(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue