Prim Copying (both CTRL+D and shift-drag) should now work.
parent
41cd6cdfdd
commit
401af6ad4a
|
@ -163,21 +163,33 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
dupe.inventoryItems = this.inventoryItems;
|
dupe.inventoryItems = this.inventoryItems;
|
||||||
dupe.m_Parent = parent;
|
dupe.m_Parent = parent;
|
||||||
dupe.m_RootParent = rootParent;
|
dupe.m_RootParent = rootParent;
|
||||||
// TODO: Copy this properly.
|
|
||||||
dupe.m_Shape = this.m_Shape.Copy();
|
dupe.m_Shape = this.m_Shape.Copy();
|
||||||
dupe.children = new List<EntityBase>();
|
dupe.children = new List<EntityBase>();
|
||||||
uint newLocalID = this.m_world.PrimIDAllocate();
|
uint newLocalID = this.m_world.PrimIDAllocate();
|
||||||
dupe.uuid = LLUUID.Random();
|
dupe.uuid = LLUUID.Random();
|
||||||
dupe.LocalId = newLocalID;
|
dupe.LocalId = newLocalID;
|
||||||
|
dupe.m_regionHandle = this.m_regionHandle;
|
||||||
|
|
||||||
|
if (parent is SceneObject)
|
||||||
|
{
|
||||||
|
dupe.m_isRootPrim = true;
|
||||||
|
dupe.ParentID = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dupe.m_isRootPrim = false;
|
||||||
|
dupe.ParentID = ((Primitive)parent).LocalId;
|
||||||
|
}
|
||||||
|
|
||||||
dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z);
|
dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z);
|
||||||
dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z);
|
dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z);
|
||||||
dupe.Pos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z);
|
dupe.m_pos = new LLVector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z);
|
||||||
rootParent.AddChildToList(dupe);
|
rootParent.AddChildToList(dupe);
|
||||||
|
|
||||||
foreach (Primitive prim in this.children)
|
foreach (Primitive prim in this.children)
|
||||||
{
|
{
|
||||||
Primitive primClone = prim.Copy(this, rootParent);
|
Primitive primClone = prim.Copy(dupe, rootParent);
|
||||||
dupe.children.Add(primClone);
|
dupe.children.Add(primClone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="fromAgentID"></param>
|
/// <param name="fromAgentID"></param>
|
||||||
public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
|
public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
|
||||||
{
|
{
|
||||||
// Console.WriteLine("Chat message");
|
// Console.WriteLine("Chat message");
|
||||||
ScenePresence avatar = null;
|
ScenePresence avatar = null;
|
||||||
|
|
||||||
m_clientManager.ForEachClient(delegate(IClientAPI client)
|
m_clientManager.ForEachClient(delegate(IClientAPI client)
|
||||||
|
@ -149,7 +149,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
avatar = this.Avatars[client.AgentId];
|
avatar = this.Avatars[client.AgentId];
|
||||||
// int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
|
// int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
|
||||||
dis = (int) avatar.Pos.GetDistanceTo(fromPos);
|
dis = (int)avatar.Pos.GetDistanceTo(fromPos);
|
||||||
//Console.WriteLine("found avatar at " +dis);
|
//Console.WriteLine("found avatar at " +dis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
public void RezObject(AssetBase primAsset, LLVector3 pos)
|
public void RezObject(AssetBase primAsset, LLVector3 pos)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -204,7 +204,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="simClient"></param>
|
/// <param name="simClient"></param>
|
||||||
public void DeRezObject(Packet packet, IClientAPI simClient)
|
public void DeRezObject(Packet packet, IClientAPI simClient)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -213,7 +213,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void SendAvatarsToClient(IClientAPI remoteClient)
|
public void SendAvatarsToClient(IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -239,7 +239,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
if (originPrim != null)
|
if (originPrim != null)
|
||||||
{
|
{
|
||||||
//SceneObject copy = originPrim.Copy();
|
SceneObject copy = originPrim.Copy();
|
||||||
|
copy.Pos = copy.Pos + offset;
|
||||||
|
this.Entities.Add(copy.rootUUID, copy);
|
||||||
|
|
||||||
|
List<ScenePresence> avatars = this.RequestAvatarList();
|
||||||
|
for (int i = 0; i < avatars.Count; i++)
|
||||||
|
{
|
||||||
|
copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -256,7 +264,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="childPrims"></param>
|
/// <param name="childPrims"></param>
|
||||||
public void LinkObjects(uint parentPrim, List<uint> childPrims)
|
public void LinkObjects(uint parentPrim, List<uint> childPrims)
|
||||||
{
|
{
|
||||||
SceneObject parenPrim = null;
|
SceneObject parenPrim = null;
|
||||||
foreach (EntityBase ent in Entities.Values)
|
foreach (EntityBase ent in Entities.Values)
|
||||||
{
|
{
|
||||||
if (ent is SceneObject)
|
if (ent is SceneObject)
|
||||||
|
@ -328,7 +336,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
if (((SceneObject)ent).rootLocalID == primLocalID)
|
if (((SceneObject)ent).rootLocalID == primLocalID)
|
||||||
{
|
{
|
||||||
((SceneObject)ent).GetProperites(remoteClient);
|
((SceneObject)ent).GetProperites(remoteClient);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +350,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="description"></param>
|
/// <param name="description"></param>
|
||||||
public void PrimDescription(uint primLocalID, string description)
|
public void PrimDescription(uint primLocalID, string description)
|
||||||
{
|
{
|
||||||
Primitive prim = null;
|
Primitive prim = null;
|
||||||
foreach (EntityBase ent in Entities.Values)
|
foreach (EntityBase ent in Entities.Values)
|
||||||
{
|
{
|
||||||
if (ent is SceneObject)
|
if (ent is SceneObject)
|
||||||
|
@ -350,7 +358,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
prim = ((SceneObject)ent).HasChildPrim(primLocalID);
|
prim = ((SceneObject)ent).HasChildPrim(primLocalID);
|
||||||
if (prim != null)
|
if (prim != null)
|
||||||
{
|
{
|
||||||
prim.Description = description;
|
prim.Description = description;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -381,19 +389,19 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
|
public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
Primitive prim = null;
|
Primitive prim = null;
|
||||||
foreach (EntityBase ent in Entities.Values)
|
foreach (EntityBase ent in Entities.Values)
|
||||||
{
|
{
|
||||||
if (ent is SceneObject)
|
if (ent is SceneObject)
|
||||||
{
|
{
|
||||||
prim = ((SceneObject)ent).HasChildPrim(objectID);
|
prim = ((SceneObject)ent).HasChildPrim(objectID);
|
||||||
if (prim != null)
|
if (prim != null)
|
||||||
{
|
{
|
||||||
((SceneObject)ent).GrapMovement(offset, pos, remoteClient);
|
((SceneObject)ent).GrapMovement(offset, pos, remoteClient);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (this.Entities.ContainsKey(objectID))
|
if (this.Entities.ContainsKey(objectID))
|
||||||
{
|
{
|
||||||
|
@ -412,7 +420,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
|
public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -423,18 +431,18 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
|
public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
Primitive prim = null;
|
Primitive prim = null;
|
||||||
foreach (EntityBase ent in Entities.Values)
|
foreach (EntityBase ent in Entities.Values)
|
||||||
{
|
{
|
||||||
if (ent is SceneObject)
|
if (ent is SceneObject)
|
||||||
{
|
{
|
||||||
prim = ((SceneObject)ent).HasChildPrim(localID);
|
prim = ((SceneObject)ent).HasChildPrim(localID);
|
||||||
if (prim != null)
|
if (prim != null)
|
||||||
{
|
{
|
||||||
prim.UpdateTextureEntry(texture);
|
prim.UpdateTextureEntry(texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -494,7 +502,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
prim = ((SceneObject)ent).HasChildPrim(localID);
|
prim = ((SceneObject)ent).HasChildPrim(localID);
|
||||||
if (prim != null)
|
if (prim != null)
|
||||||
{
|
{
|
||||||
prim.UpdateGroupMouseRotation( pos, rot);
|
prim.UpdateGroupMouseRotation(pos, rot);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,7 +540,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
|
public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("trying to update single prim rotation");
|
//Console.WriteLine("trying to update single prim rotation");
|
||||||
Primitive prim = null;
|
Primitive prim = null;
|
||||||
foreach (EntityBase ent in Entities.Values)
|
foreach (EntityBase ent in Entities.Values)
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,11 +117,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
dupe.m_world = this.m_world;
|
dupe.m_world = this.m_world;
|
||||||
dupe.m_regionHandle = this.m_regionHandle;
|
dupe.m_regionHandle = this.m_regionHandle;
|
||||||
Primitive newRoot = this.rootPrimitive.Copy((EntityBase)dupe, dupe);
|
Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
|
||||||
dupe.rootPrimitive = newRoot;
|
dupe.rootPrimitive = newRoot;
|
||||||
dupe.rootPrimitive.Pos =( this.Pos + new LLVector3(0,0,1));
|
dupe.children.Add(dupe.rootPrimitive);
|
||||||
|
dupe.rootPrimitive.Pos = this.Pos;
|
||||||
dupe.Rotation = this.Rotation;
|
dupe.Rotation = this.Rotation;
|
||||||
|
LLUUID rootu= dupe.rootUUID;
|
||||||
|
uint rooti = dupe.rootLocalID;
|
||||||
return dupe;
|
return dupe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue