some code reorder/minor changes
parent
16608ffb01
commit
d9d58a7b33
|
@ -271,28 +271,40 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (!m_parentScene.CombineRegions)
|
if (!m_parentScene.CombineRegions)
|
||||||
{
|
{
|
||||||
|
// temporary checks to remove after varsize suport
|
||||||
|
float regionSizeX = m_parentScene.RegionInfo.RegionSizeX;
|
||||||
|
if (regionSizeX == 0)
|
||||||
|
regionSizeX = Constants.RegionSize;
|
||||||
|
float regionSizeY = m_parentScene.RegionInfo.RegionSizeY;
|
||||||
|
if (regionSizeY == 0)
|
||||||
|
regionSizeY = Constants.RegionSize;
|
||||||
|
|
||||||
// KF: Check for out-of-region, move inside and make static.
|
// KF: Check for out-of-region, move inside and make static.
|
||||||
Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X,
|
Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X,
|
||||||
sceneObject.RootPart.GroupPosition.Y,
|
sceneObject.RootPart.GroupPosition.Y,
|
||||||
sceneObject.RootPart.GroupPosition.Z);
|
sceneObject.RootPart.GroupPosition.Z);
|
||||||
if (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (npos.X < 0.0 || npos.Y < 0.0 || npos.Z < 0.0 ||
|
if (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (npos.X < 0.0 || npos.Y < 0.0 || npos.Z < 0.0 ||
|
||||||
npos.X > Constants.RegionSize ||
|
npos.X > regionSizeX ||
|
||||||
npos.Y > Constants.RegionSize))
|
npos.Y > regionSizeY))
|
||||||
{
|
{
|
||||||
if (npos.X < 0.0) npos.X = 1.0f;
|
if (npos.X < 0.0) npos.X = 1.0f;
|
||||||
if (npos.Y < 0.0) npos.Y = 1.0f;
|
if (npos.Y < 0.0) npos.Y = 1.0f;
|
||||||
if (npos.Z < 0.0) npos.Z = 0.0f;
|
if (npos.Z < 0.0) npos.Z = 0.0f;
|
||||||
if (npos.X > Constants.RegionSize) npos.X = Constants.RegionSize - 1.0f;
|
if (npos.X > regionSizeX) npos.X = regionSizeX - 1.0f;
|
||||||
if (npos.Y > Constants.RegionSize) npos.Y = Constants.RegionSize - 1.0f;
|
if (npos.Y > regionSizeY) npos.Y = regionSizeY - 1.0f;
|
||||||
|
|
||||||
|
SceneObjectPart rootpart = sceneObject.RootPart;
|
||||||
|
rootpart.GroupPosition = npos;
|
||||||
|
|
||||||
foreach (SceneObjectPart part in sceneObject.Parts)
|
foreach (SceneObjectPart part in sceneObject.Parts)
|
||||||
{
|
{
|
||||||
|
if (part == rootpart)
|
||||||
|
continue;
|
||||||
part.GroupPosition = npos;
|
part.GroupPosition = npos;
|
||||||
}
|
}
|
||||||
sceneObject.RootPart.Velocity = Vector3.Zero;
|
rootpart.Velocity = Vector3.Zero;
|
||||||
sceneObject.RootPart.AngularVelocity = Vector3.Zero;
|
rootpart.AngularVelocity = Vector3.Zero;
|
||||||
sceneObject.RootPart.Acceleration = Vector3.Zero;
|
rootpart.Acceleration = Vector3.Zero;
|
||||||
sceneObject.RootPart.Velocity = Vector3.Zero;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +334,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
|
protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
|
bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
|
||||||
|
|
||||||
// Ensure that we persist this new scene object if it's not an
|
// Ensure that we persist this new scene object if it's not an
|
||||||
|
@ -428,9 +439,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
Vector3 scale = part.Shape.Scale;
|
Vector3 scale = part.Shape.Scale;
|
||||||
|
|
||||||
scale.X = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.X));
|
scale.X = Util.Clamp(scale.X, m_parentScene.m_minNonphys, m_parentScene.m_maxNonphys);
|
||||||
scale.Y = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Y));
|
scale.Y = Util.Clamp(scale.Y, m_parentScene.m_minNonphys, m_parentScene.m_maxNonphys);
|
||||||
scale.Z = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Z));
|
scale.Z = Util.Clamp(scale.Z, m_parentScene.m_minNonphys, m_parentScene.m_maxNonphys);
|
||||||
|
|
||||||
part.Shape.Scale = scale;
|
part.Shape.Scale = scale;
|
||||||
}
|
}
|
||||||
|
@ -439,26 +450,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
sceneObject.AttachToScene(m_parentScene);
|
sceneObject.AttachToScene(m_parentScene);
|
||||||
|
|
||||||
|
|
||||||
Entities.Add(sceneObject);
|
Entities.Add(sceneObject);
|
||||||
|
|
||||||
|
|
||||||
lock (SceneObjectGroupsByFullID)
|
lock (SceneObjectGroupsByFullID)
|
||||||
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
|
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
|
||||||
|
|
||||||
lock (SceneObjectGroupsByFullPartID)
|
foreach (SceneObjectPart part in parts)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in parts)
|
lock (SceneObjectGroupsByFullPartID)
|
||||||
SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
|
SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
|
||||||
}
|
|
||||||
|
|
||||||
lock (SceneObjectGroupsByLocalPartID)
|
lock (SceneObjectGroupsByLocalPartID)
|
||||||
{
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[SCENE GRAPH]: Adding scene object {0} {1} {2} to SceneObjectGroupsByLocalPartID in {3}",
|
|
||||||
// sceneObject.Name, sceneObject.UUID, sceneObject.LocalId, m_parentScene.RegionInfo.RegionName);
|
|
||||||
|
|
||||||
foreach (SceneObjectPart part in parts)
|
|
||||||
SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
|
SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,14 +477,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
// no tests, caller has responsability...
|
// no tests, caller has responsability...
|
||||||
lock (SceneObjectGroupsByFullPartID)
|
lock (SceneObjectGroupsByFullPartID)
|
||||||
{
|
|
||||||
SceneObjectGroupsByFullPartID[part.UUID] = grp;
|
SceneObjectGroupsByFullPartID[part.UUID] = grp;
|
||||||
}
|
|
||||||
|
|
||||||
lock (SceneObjectGroupsByLocalPartID)
|
lock (SceneObjectGroupsByLocalPartID)
|
||||||
{
|
|
||||||
SceneObjectGroupsByLocalPartID[part.LocalId] = grp;
|
SceneObjectGroupsByLocalPartID[part.LocalId] = grp;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -512,24 +510,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
RemovePhysicalPrim(grp.PrimCount);
|
RemovePhysicalPrim(grp.PrimCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ret = Entities.Remove(uuid);
|
||||||
|
|
||||||
lock (SceneObjectGroupsByFullID)
|
lock (SceneObjectGroupsByFullID)
|
||||||
SceneObjectGroupsByFullID.Remove(grp.UUID);
|
SceneObjectGroupsByFullID.Remove(grp.UUID);
|
||||||
|
|
||||||
lock (SceneObjectGroupsByFullPartID)
|
SceneObjectPart[] parts = grp.Parts;
|
||||||
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart[] parts = grp.Parts;
|
lock (SceneObjectGroupsByFullPartID)
|
||||||
for (int i = 0; i < parts.Length; i++)
|
|
||||||
SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
|
SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
|
||||||
}
|
|
||||||
|
|
||||||
lock (SceneObjectGroupsByLocalPartID)
|
lock (SceneObjectGroupsByLocalPartID)
|
||||||
{
|
|
||||||
SceneObjectPart[] parts = grp.Parts;
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
|
||||||
SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
|
SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Entities.Remove(uuid);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2133,21 +2129,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
lock (SceneObjectGroupsByFullID)
|
lock (SceneObjectGroupsByFullID)
|
||||||
SceneObjectGroupsByFullID[copy.UUID] = copy;
|
SceneObjectGroupsByFullID[copy.UUID] = copy;
|
||||||
|
|
||||||
SceneObjectPart[] children = copy.Parts;
|
SceneObjectPart[] parts = copy.Parts;
|
||||||
|
foreach (SceneObjectPart part in parts)
|
||||||
lock (SceneObjectGroupsByFullPartID)
|
|
||||||
{
|
{
|
||||||
SceneObjectGroupsByFullPartID[copy.UUID] = copy;
|
lock (SceneObjectGroupsByFullPartID)
|
||||||
foreach (SceneObjectPart part in children)
|
|
||||||
SceneObjectGroupsByFullPartID[part.UUID] = copy;
|
SceneObjectGroupsByFullPartID[part.UUID] = copy;
|
||||||
}
|
lock (SceneObjectGroupsByLocalPartID)
|
||||||
|
|
||||||
lock (SceneObjectGroupsByLocalPartID)
|
|
||||||
{
|
|
||||||
SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
|
|
||||||
foreach (SceneObjectPart part in children)
|
|
||||||
SceneObjectGroupsByLocalPartID[part.LocalId] = copy;
|
SceneObjectGroupsByLocalPartID[part.LocalId] = copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PROBABLE END OF FIXME
|
// PROBABLE END OF FIXME
|
||||||
|
|
||||||
// Since we copy from a source group that is in selected
|
// Since we copy from a source group that is in selected
|
||||||
|
|
Loading…
Reference in New Issue