Prim Copying (both CTRL+D and shift-drag) should now work.

afrisby
MW 2007-07-13 19:01:09 +00:00
parent 41cd6cdfdd
commit 401af6ad4a
3 changed files with 66 additions and 44 deletions

View File

@ -163,21 +163,33 @@ namespace OpenSim.Region.Environment.Scenes
dupe.inventoryItems = this.inventoryItems;
dupe.m_Parent = parent;
dupe.m_RootParent = rootParent;
// TODO: Copy this properly.
dupe.m_Shape = this.m_Shape.Copy();
dupe.children = new List<EntityBase>();
uint newLocalID = this.m_world.PrimIDAllocate();
dupe.uuid = LLUUID.Random();
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.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);
foreach (Primitive prim in this.children)
{
Primitive primClone = prim.Copy(this, rootParent);
Primitive primClone = prim.Copy(dupe, rootParent);
dupe.children.Add(primClone);
}

View File

@ -149,7 +149,7 @@ namespace OpenSim.Region.Environment.Scenes
{
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));
dis = (int) avatar.Pos.GetDistanceTo(fromPos);
dis = (int)avatar.Pos.GetDistanceTo(fromPos);
//Console.WriteLine("found avatar at " +dis);
}
@ -239,7 +239,15 @@ namespace OpenSim.Region.Environment.Scenes
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
@ -494,7 +502,7 @@ namespace OpenSim.Region.Environment.Scenes
prim = ((SceneObject)ent).HasChildPrim(localID);
if (prim != null)
{
prim.UpdateGroupMouseRotation( pos, rot);
prim.UpdateGroupMouseRotation(pos, rot);
break;
}
}

View File

@ -117,11 +117,13 @@ namespace OpenSim.Region.Environment.Scenes
dupe.m_world = this.m_world;
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.Pos =( this.Pos + new LLVector3(0,0,1));
dupe.children.Add(dupe.rootPrimitive);
dupe.rootPrimitive.Pos = this.Pos;
dupe.Rotation = this.Rotation;
LLUUID rootu= dupe.rootUUID;
uint rooti = dupe.rootLocalID;
return dupe;
}