* refactor: Remove largely duplicate code from SceneXmlLoader.CreatePrimFromXml2()

0.6.0-stable
Justin Clarke Casey 2008-06-17 17:23:00 +00:00
parent 255b87464a
commit 33d32355a1
4 changed files with 18 additions and 29 deletions

View File

@ -195,33 +195,9 @@ namespace OpenSim.Region.Environment.Scenes
{
SceneObjectGroup obj = new SceneObjectGroup(xmlData);
LLVector3 receivedVelocity = obj.RootPart.Velocity;
//System.Console.WriteLine(obj.RootPart.Velocity.ToString());
scene.AddSceneObjectFromStorage(obj);
SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
bool UsePhysics = (((rootPart.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Physics) > 0) &&
scene.m_physicalPrim);
if ((rootPart.GetEffectiveObjectFlags() & (uint) LLObject.ObjectFlags.Phantom) == 0)
{
rootPart.PhysActor = scene.PhysicsScene.AddPrimShape(
rootPart.Name,
rootPart.Shape,
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
rootPart.AbsolutePosition.Z),
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
// to quote from SceneObjectPart: Basic
// Physics returns null.. joy joy joy.
if (rootPart.PhysActor != null)
{
rootPart.PhysActor.LocalID = rootPart.LocalId;
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
}
rootPart.Velocity = receivedVelocity;
}
obj.ApplyPhysics(scene.m_physicalPrim);
obj.ScheduleGroupForFullUpdate();
}

View File

@ -79,7 +79,12 @@ namespace OpenSim.Region.Environment.Scenes
private int m_timePhase = 24;
private readonly Mutex updateLock;
/// <summary>
/// Are we applying physics to any of the prims in this scene?
/// </summary>
public bool m_physicalPrim;
public bool m_seeIntoRegionFromNeighbor;
public int MaxUndoCount = 5;
private int m_RestartTimerCounter;

View File

@ -1052,6 +1052,10 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.ScheduleFullUpdate();
}
/// <summary>
/// Apply physics to this group
/// </summary>
/// <param name="m_physicalPrim"></param>
public void ApplyPhysics(bool m_physicalPrim)
{
lock (m_parts)

View File

@ -494,8 +494,9 @@ namespace OpenSim.Region.Environment.Scenes
return m_velocity;
}
set {
set
{
m_velocity = value;
if (PhysActor != null)
{
@ -505,7 +506,6 @@ namespace OpenSim.Region.Environment.Scenes
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
}
}
}
}
@ -913,9 +913,13 @@ namespace OpenSim.Region.Environment.Scenes
return newobject;
}
/// <summary>
/// Apply physics to this part.
/// </summary>
/// <param name="rootObjectFlags"></param>
/// <param name="m_physicalPrim"></param>
public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim)
{
bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim);
bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0);