Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie 2010-11-27 13:07:23 +01:00
commit 2412b3cb4a
8 changed files with 106 additions and 43 deletions

View File

@ -323,7 +323,7 @@ namespace OpenSim.Data.Tests
.IgnoreProperty(x => x.InvType) .IgnoreProperty(x => x.InvType)
.IgnoreProperty(x => x.CreatorIdAsUuid) .IgnoreProperty(x => x.CreatorIdAsUuid)
.IgnoreProperty(x => x.Description) .IgnoreProperty(x => x.Description)
.IgnoreProperty(x => x.CreatorId) .IgnoreProperty(x => x.CreatorIdentification)
.IgnoreProperty(x => x.CreatorData)); .IgnoreProperty(x => x.CreatorData));
inventoryScrambler.Scramble(expected); inventoryScrambler.Scramble(expected);
@ -334,7 +334,7 @@ namespace OpenSim.Data.Tests
.IgnoreProperty(x => x.InvType) .IgnoreProperty(x => x.InvType)
.IgnoreProperty(x => x.CreatorIdAsUuid) .IgnoreProperty(x => x.CreatorIdAsUuid)
.IgnoreProperty(x => x.Description) .IgnoreProperty(x => x.Description)
.IgnoreProperty(x => x.CreatorId) .IgnoreProperty(x => x.CreatorIdentification)
.IgnoreProperty(x => x.CreatorData)); .IgnoreProperty(x => x.CreatorData));
} }

View File

@ -51,8 +51,16 @@ namespace OpenSim.Framework
string[] parts = temp.Split('\n'); string[] parts = temp.Split('\n');
int.TryParse(parts[0].Substring(17, 1), out Version); int.TryParse(parts[0].Substring(17, 1), out Version);
UUID.TryParse(parts[1].Substring(10, 36), out RegionID); UUID.TryParse(parts[1].Substring(10, 36), out RegionID);
// the vector is stored with spaces as separators, not with commas ("10.3 32.5 43" instead of "10.3, 32.5, 43") // The position is a vector with spaces as separators ("10.3 32.5 43").
Vector3.TryParse(parts[2].Substring(10, parts[2].Length - 10).Replace(" ", ","), out Position); // Parse each scalar separately to take into account the system's culture setting.
string[] scalars = parts[2].Substring(10, parts[2].Length - 10).Split(' ');
if (scalars.Length > 0)
System.Single.TryParse(scalars[0], out Position.X);
if (scalars.Length > 1)
System.Single.TryParse(scalars[1], out Position.Y);
if (scalars.Length > 2)
System.Single.TryParse(scalars[2], out Position.Z);
ulong.TryParse(parts[3].Substring(14, parts[3].Length - 14), out RegionHandle); ulong.TryParse(parts[3].Substring(14, parts[3].Length - 14), out RegionHandle);
} }
} }

View File

@ -2384,16 +2384,14 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
return false; return false;
} }
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2); newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
newObject.ResumeScripts(); newObject.ResumeScripts();
// Do this as late as possible so that listeners have full access to the incoming object // Do this as late as possible so that listeners have full access to the incoming object
EventManager.TriggerOnIncomingSceneObject(newObject); EventManager.TriggerOnIncomingSceneObject(newObject);
TriggerChangedTeleport(newObject);
return true; return true;
} }
@ -2520,7 +2518,7 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
private void TriggerChangedTeleport(SceneObjectGroup sog) private int GetStateSource(SceneObjectGroup sog)
{ {
ScenePresence sp = GetScenePresence(sog.OwnerID); ScenePresence sp = GetScenePresence(sog.OwnerID);
@ -2531,13 +2529,12 @@ namespace OpenSim.Region.Framework.Scenes
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default)) if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
{ {
// This will get your attention // This will get your attention
//m_log.Error("[XXX] Triggering "); //m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
// Trigger CHANGED_TELEPORT return 5; // StateSource.Teleporting
sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT);
} }
} }
return 2; // StateSource.PrimCrossing
} }
#endregion #endregion

View File

@ -464,16 +464,36 @@ namespace OpenSim.Region.Framework.Scenes
// if (actor != null) // if (actor != null)
if ((actor != null) && (m_parentID == 0)) // KF Do NOT update m_pos here if Av is sitting! if ((actor != null) && (m_parentID == 0)) // KF Do NOT update m_pos here if Av is sitting!
m_pos = actor.Position; m_pos = actor.Position;
else
// If we're sitting, we need to update our position
if (m_parentID != 0)
{ {
SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); // Obtain the correct position of a seated avatar.
if (part != null) // In addition to providing the correct position while
m_parentPosition = part.AbsolutePosition; // the avatar is seated, this value will also
// be used as the location to unsit to.
//
// If m_parentID is not 0, assume we are a seated avatar
// and we should return the position based on the sittarget
// offset and rotation of the prim we are seated on.
//
// Generally, m_pos will contain the position of the avatar
// in the sim unless the avatar is on a sit target. While
// on a sit target, m_pos will contain the desired offset
// without the parent rotation applied.
if (m_parentID != 0)
{
SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
if (part != null)
{
return m_parentPosition + (m_pos * part.GetWorldRotation());
}
else
{
return m_parentPosition + m_pos;
}
}
} }
return m_parentPosition + m_pos; return m_pos;
} }
set set
{ {

View File

@ -86,23 +86,33 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="assetUuids">The assets gathered</param> /// <param name="assetUuids">The assets gathered</param>
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids) public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
{ {
assetUuids[assetUuid] = assetType; try
{
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType) assetUuids[assetUuid] = assetType;
{
GetWearableAssetUuids(assetUuid, assetUuids); if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
{
GetWearableAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.Gesture == assetType)
{
GetGestureAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.LSLText == assetType)
{
GetScriptAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.Object == assetType)
{
GetSceneObjectAssetUuids(assetUuid, assetUuids);
}
} }
else if (AssetType.Gesture == assetType) catch (Exception)
{ {
GetGestureAssetUuids(assetUuid, assetUuids); m_log.ErrorFormat(
} "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
else if (AssetType.LSLText == assetType) assetUuid, assetType);
{ throw;
GetScriptAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.Object == assetType)
{
GetSceneObjectAssetUuids(assetUuid, assetUuids);
} }
} }

View File

@ -42,7 +42,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
NewRez = 1, NewRez = 1,
PrimCrossing = 2, PrimCrossing = 2,
ScriptedRez = 3, ScriptedRez = 3,
AttachedRez = 4 AttachedRez = 4,
Teleporting = 5
} }
public interface IScriptWorkItem public interface IScriptWorkItem

View File

@ -391,19 +391,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
} }
else if (m_stateSource == StateSource.RegionStart) else if (m_stateSource == StateSource.RegionStart)
{ {
// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); //m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script");
PostEvent(new EventParams("changed", PostEvent(new EventParams("changed",
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, new DetectParams[0]));
new DetectParams[0]));
} }
else if (m_stateSource == StateSource.PrimCrossing) else if (m_stateSource == StateSource.PrimCrossing || m_stateSource == StateSource.Teleporting)
{ {
// CHANGED_REGION // CHANGED_REGION
PostEvent(new EventParams("changed", PostEvent(new EventParams("changed",
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, new DetectParams[0]));
new DetectParams[0]));
// CHANGED_TELEPORT
if (m_stateSource == StateSource.Teleporting)
PostEvent(new EventParams("changed",
new Object[] { new LSL_Types.LSLInteger((int)Changed.TELEPORT) }, new DetectParams[0]));
} }
} }
else else
{ {
Start(); Start();

View File

@ -47,6 +47,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
{ {
private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d;
private LSL_Api m_lslApi; private LSL_Api m_lslApi;
[SetUp] [SetUp]
@ -164,5 +165,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail"); Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail");
Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail");
} }
[Test]
// llVecNorm test.
public void TestllVecNorm()
{
// Check special case for normalizing zero vector.
CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d));
// Check various vectors.
CheckllVecNorm(new LSL_Types.Vector3(10.0d, 25.0d, 0.0d), new LSL_Types.Vector3(0.371391d, 0.928477d, 0.0d));
CheckllVecNorm(new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), new LSL_Types.Vector3(1.0d, 0.0d, 0.0d));
CheckllVecNorm(new LSL_Types.Vector3(-90.0d, 55.0d, 2.0d), new LSL_Types.Vector3(-0.853128d, 0.521356d, 0.018958d));
CheckllVecNorm(new LSL_Types.Vector3(255.0d, 255.0d, 255.0d), new LSL_Types.Vector3(0.577350d, 0.577350d, 0.577350d));
}
public void CheckllVecNorm(LSL_Types.Vector3 vec, LSL_Types.Vector3 vecNormCheck)
{
// Call LSL function to normalize the vector.
LSL_Types.Vector3 vecNorm = m_lslApi.llVecNorm(vec);
// Check each vector component against expected result.
Assert.AreEqual(vecNorm.x, vecNormCheck.x, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on x component");
Assert.AreEqual(vecNorm.y, vecNormCheck.y, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on y component");
Assert.AreEqual(vecNorm.z, vecNormCheck.z, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on z component");
}
} }
} }