mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
First part of Scene refactoring:
Started the move of some of the methods from scene into a inner class (currently called InnerScene.cs), the idea being that the code related to the 3d scene (primitive/entities/Avatars etc) will be in this inner class, then what is now Scene.cs will be left as a kind of wrapper class around it. And once the spilt is complete can be renamed to something like RegionInstance (or any name that sounds good and ids it as the Region layer class that "has" a scene). Added SceneCommunicationService which at the moment is a kind of high level wrapper around commsManager. The idea being that it has a higher level API for the Region/Scene to send messages to the other regions on the grid. a Example of the API is that instead of having sendXmessage methods, it has more functional level method like PassAvatarToNeighbour. Hopefully this will allow more freedom to do changes in communications that doesn't break other things.
This commit is contained in:
@@ -89,129 +89,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="originalPrim"></param>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="flags"></param>
|
||||
public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags)
|
||||
{
|
||||
SceneObjectGroup originPrim = null;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
if (((SceneObjectGroup) ent).LocalId == originalPrim)
|
||||
{
|
||||
originPrim = (SceneObjectGroup) ent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (originPrim != null)
|
||||
{
|
||||
SceneObjectGroup copy = originPrim.Copy();
|
||||
copy.AbsolutePosition = copy.AbsolutePosition + offset;
|
||||
Entities.Add(copy.UUID, copy);
|
||||
|
||||
copy.ScheduleGroupForFullUpdate();
|
||||
/* List<ScenePresence> avatars = this.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
{
|
||||
// copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="parentPrim"></param>
|
||||
/// <param name="childPrims"></param>
|
||||
public void LinkObjects(uint parentPrim, List<uint> childPrims)
|
||||
{
|
||||
SceneObjectGroup parenPrim = null;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
if (((SceneObjectGroup) ent).LocalId == parentPrim)
|
||||
{
|
||||
parenPrim = (SceneObjectGroup) ent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<SceneObjectGroup> children = new List<SceneObjectGroup>();
|
||||
if (parenPrim != null)
|
||||
{
|
||||
for (int i = 0; i < childPrims.Count; i++)
|
||||
{
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
if (((SceneObjectGroup) ent).LocalId == childPrims[i])
|
||||
{
|
||||
children.Add((SceneObjectGroup) ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SceneObjectGroup sceneObj in children)
|
||||
{
|
||||
parenPrim.LinkToGroup(sceneObj);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="primLocalID"></param>
|
||||
/// <param name="shapeBlock"></param>
|
||||
public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).UpdateShape(shapeBlock, primLocalID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateExtraParam(uint primLocalID, ushort type, bool inUse, byte[] data)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).UpdateExtraParam(primLocalID, type, inUse, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -255,250 +132,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="primLocalID"></param>
|
||||
/// <param name="description"></param>
|
||||
public void PrimDescription(uint primLocalID, string description)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).SetPartDescription(description, primLocalID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="primLocalID"></param>
|
||||
/// <param name="description"></param>
|
||||
public void PrimName(uint primLocalID, string name)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).SetPartName(name, primLocalID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
|
||||
{
|
||||
if (PermissionsMngr.CanEditObject(remoteClient.AgentId, objectID))
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(objectID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).GrabMovement(offset, pos, remoteClient);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="packet"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
|
||||
{
|
||||
bool hasprim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasprim = ((SceneObjectGroup) ent).HasChildPrim(localID);
|
||||
if (hasprim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).UpdatePrimFlags(localID, (ushort) packet.Type, true, packet.ToBytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//System.Console.WriteLine("Got primupdate packet: " + packet.UsePhysics.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="texture"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).UpdateTextureEntry(localID, texture);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).UpdateGroupPosition(pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).UpdateSinglePosition(pos, localID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="rot"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
public void UpdatePrimRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).UpdateGroupRotation(pos, rot);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="rot"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).UpdateGroupRotation(rot);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="rot"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).UpdateSingleRotation(rot, localID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
|
||||
{
|
||||
bool hasPrim = false;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
|
||||
if (hasPrim != false)
|
||||
{
|
||||
((SceneObjectGroup) ent).Resize(scale, localID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StartAnimation(LLUUID animID, int seq, LLUUID agentId)
|
||||
{
|
||||
Broadcast(delegate(IClientAPI client) { client.SendAnimation(animID, seq, agentId); });
|
||||
|
||||
Reference in New Issue
Block a user