Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
commit
2412b3cb4a
|
@ -323,7 +323,7 @@ namespace OpenSim.Data.Tests
|
|||
.IgnoreProperty(x => x.InvType)
|
||||
.IgnoreProperty(x => x.CreatorIdAsUuid)
|
||||
.IgnoreProperty(x => x.Description)
|
||||
.IgnoreProperty(x => x.CreatorId)
|
||||
.IgnoreProperty(x => x.CreatorIdentification)
|
||||
.IgnoreProperty(x => x.CreatorData));
|
||||
|
||||
inventoryScrambler.Scramble(expected);
|
||||
|
@ -334,7 +334,7 @@ namespace OpenSim.Data.Tests
|
|||
.IgnoreProperty(x => x.InvType)
|
||||
.IgnoreProperty(x => x.CreatorIdAsUuid)
|
||||
.IgnoreProperty(x => x.Description)
|
||||
.IgnoreProperty(x => x.CreatorId)
|
||||
.IgnoreProperty(x => x.CreatorIdentification)
|
||||
.IgnoreProperty(x => x.CreatorData));
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,16 @@ namespace OpenSim.Framework
|
|||
string[] parts = temp.Split('\n');
|
||||
int.TryParse(parts[0].Substring(17, 1), out Version);
|
||||
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")
|
||||
Vector3.TryParse(parts[2].Substring(10, parts[2].Length - 10).Replace(" ", ","), out Position);
|
||||
// The position is a vector with spaces as separators ("10.3 32.5 43").
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2384,16 +2384,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
|
||||
return false;
|
||||
}
|
||||
|
||||
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2);
|
||||
|
||||
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
|
||||
|
||||
newObject.ResumeScripts();
|
||||
|
||||
// Do this as late as possible so that listeners have full access to the incoming object
|
||||
EventManager.TriggerOnIncomingSceneObject(newObject);
|
||||
|
||||
TriggerChangedTeleport(newObject);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2520,7 +2518,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
private void TriggerChangedTeleport(SceneObjectGroup sog)
|
||||
private int GetStateSource(SceneObjectGroup sog)
|
||||
{
|
||||
ScenePresence sp = GetScenePresence(sog.OwnerID);
|
||||
|
||||
|
@ -2531,13 +2529,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
|
||||
{
|
||||
// This will get your attention
|
||||
//m_log.Error("[XXX] Triggering ");
|
||||
//m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
|
||||
|
||||
// Trigger CHANGED_TELEPORT
|
||||
sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT);
|
||||
return 5; // StateSource.Teleporting
|
||||
}
|
||||
|
||||
}
|
||||
return 2; // StateSource.PrimCrossing
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -464,16 +464,36 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// if (actor != null)
|
||||
if ((actor != null) && (m_parentID == 0)) // KF Do NOT update m_pos here if Av is sitting!
|
||||
m_pos = actor.Position;
|
||||
|
||||
// If we're sitting, we need to update our position
|
||||
if (m_parentID != 0)
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
|
||||
if (part != null)
|
||||
m_parentPosition = part.AbsolutePosition;
|
||||
// Obtain the correct position of a seated avatar.
|
||||
// In addition to providing the correct position while
|
||||
// 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
|
||||
{
|
||||
|
|
|
@ -86,23 +86,33 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="assetUuids">The assets gathered</param>
|
||||
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
|
||||
{
|
||||
assetUuids[assetUuid] = assetType;
|
||||
|
||||
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
|
||||
{
|
||||
GetWearableAssetUuids(assetUuid, assetUuids);
|
||||
try
|
||||
{
|
||||
assetUuids[assetUuid] = assetType;
|
||||
|
||||
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);
|
||||
}
|
||||
else if (AssetType.LSLText == assetType)
|
||||
{
|
||||
GetScriptAssetUuids(assetUuid, assetUuids);
|
||||
}
|
||||
else if (AssetType.Object == assetType)
|
||||
{
|
||||
GetSceneObjectAssetUuids(assetUuid, assetUuids);
|
||||
m_log.ErrorFormat(
|
||||
"[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
|
||||
assetUuid, assetType);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
|||
NewRez = 1,
|
||||
PrimCrossing = 2,
|
||||
ScriptedRez = 3,
|
||||
AttachedRez = 4
|
||||
AttachedRez = 4,
|
||||
Teleporting = 5
|
||||
}
|
||||
|
||||
public interface IScriptWorkItem
|
||||
|
|
|
@ -391,19 +391,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
}
|
||||
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",
|
||||
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) },
|
||||
new DetectParams[0]));
|
||||
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, new DetectParams[0]));
|
||||
}
|
||||
else if (m_stateSource == StateSource.PrimCrossing)
|
||||
else if (m_stateSource == StateSource.PrimCrossing || m_stateSource == StateSource.Teleporting)
|
||||
{
|
||||
// CHANGED_REGION
|
||||
PostEvent(new EventParams("changed",
|
||||
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) },
|
||||
new DetectParams[0]));
|
||||
new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, 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
|
||||
{
|
||||
Start();
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
{
|
||||
|
||||
private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
|
||||
private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d;
|
||||
private LSL_Api m_lslApi;
|
||||
|
||||
[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.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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue