simplify coalesced object tests by using existing scene object set up utils

this change makes it possible to set an absolute position on a group before it is put into a scene.
bulletsim
Justin Clark-Casey (justincc) 2011-04-14 17:33:55 +01:00
parent c5465414b6
commit aaf9125869
2 changed files with 20 additions and 41 deletions

View File

@ -87,41 +87,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
// Create asset // Create asset
SceneObjectGroup object1; SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20);
{ object1.AbsolutePosition = new Vector3(15, 30, 45);
string partName = "Object1"; object1.Parts[0].Scale = new Vector3(1, 1, 1);
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30);
Quaternion rotationOffset = Quaternion.Identity;
Vector3 offsetPosition = new Vector3(5, 10, 15);
SceneObjectPart part1 SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40);
= new SceneObjectPart( object2.AbsolutePosition = new Vector3(25, 50, 75);
ownerId, shape, groupPosition, rotationOffset, offsetPosition); object2.Parts[0].Scale = new Vector3(1, 1, 1);
part1.Scale = new Vector3(1, 1, 1);
part1.Name = partName;
object1 = new SceneObjectGroup(part1);
}
SceneObjectGroup object2;
{
string partName = "Object2";
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(20, 40, 60);
Quaternion rotationOffset = Quaternion.Identity;
Vector3 offsetPosition = new Vector3(5, 10, 15);
SceneObjectPart part1
= new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Scale = new Vector3(1, 1, 1);
part1.Name = partName;
object2 = new SceneObjectGroup(part1);
}
CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2); CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2);

View File

@ -296,20 +296,26 @@ namespace OpenSim.Region.Framework.Scenes
{ {
Vector3 val = value; Vector3 val = value;
if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) if (Scene != null)
|| m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) {
&& !IsAttachmentCheckFull() && (!m_scene.LoadingPrims)) if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|| Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
&& !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
{ {
m_scene.CrossPrimGroupIntoNewRegion(val, this, true); m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
} }
}
if (RootPart.GetStatusSandbox()) if (RootPart.GetStatusSandbox())
{ {
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
{ {
RootPart.ScriptSetPhysicsStatus(false); RootPart.ScriptSetPhysicsStatus(false);
if (Scene != null)
Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
return; return;
} }
} }
@ -326,7 +332,8 @@ namespace OpenSim.Region.Framework.Scenes
//m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
//} //}
m_scene.EventManager.TriggerParcelPrimCountTainted(); if (Scene != null)
Scene.EventManager.TriggerParcelPrimCountTainted();
} }
} }