* This concludes UploadObjectAsset for now until the permissions and physics shape are added to the message serialization.
* You should now be able to upload multiple mesh collada mesh objects. They should appear in front of you (or on top of you!) when you upload them. * Once again, thanks to John Hurliman and Latif Khalifa for insight and smxy for cheering me on :Dviewer-2-initial-appearance
parent
158e43d4fd
commit
b2c1a1c9bd
|
@ -126,6 +126,14 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parses ad request
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="AgentId"></param>
|
||||
/// <param name="cap"></param>
|
||||
/// <returns></returns>
|
||||
public Hashtable ProcessAdd(Hashtable request, UUID AgentId, Caps cap)
|
||||
{
|
||||
Hashtable responsedata = new Hashtable();
|
||||
|
@ -147,9 +155,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error("[UploadObjectAssetModule]: Error deserializing message");
|
||||
// TODO: Remove this ugly multiline-friendly debug!
|
||||
Console.WriteLine(ex.ToString());
|
||||
m_log.Error("[UploadObjectAssetModule]: Error deserializing message " + ex.ToString());
|
||||
message = null;
|
||||
}
|
||||
|
||||
|
@ -166,15 +172,22 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
|
||||
Vector3 pos = avatar.AbsolutePosition + (Vector3.UnitX * avatar.Rotation);
|
||||
Quaternion rot = Quaternion.Identity;
|
||||
Vector3 rootpos = Vector3.Zero;
|
||||
Quaternion rootrot = Quaternion.Identity;
|
||||
|
||||
|
||||
|
||||
SceneObjectGroup grp = new SceneObjectGroup();
|
||||
SceneObjectGroup rootGroup = null;
|
||||
SceneObjectGroup[] allparts = new SceneObjectGroup[message.Objects.Length];
|
||||
for (int i = 0; i < message.Objects.Length; i++)
|
||||
{
|
||||
UploadObjectAssetMessage.Object obj = message.Objects[i];
|
||||
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
rootpos = obj.Position;
|
||||
rootrot = obj.Rotation;
|
||||
|
||||
}
|
||||
// Combine the extraparams data into it's ugly blob again....
|
||||
int bytelength = 0;
|
||||
for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++)
|
||||
|
@ -186,7 +199,8 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
|
||||
for (int extparams = 0; extparams < obj.ExtraParams.Length; extparams++)
|
||||
{
|
||||
Buffer.BlockCopy(obj.ExtraParams[extparams].ExtraParamData, 0, extraparams, position, obj.ExtraParams[extparams].ExtraParamData.Length);
|
||||
Buffer.BlockCopy(obj.ExtraParams[extparams].ExtraParamData, 0, extraparams, position,
|
||||
obj.ExtraParams[extparams].ExtraParamData.Length);
|
||||
|
||||
position += obj.ExtraParams[extparams].ExtraParamData.Length;
|
||||
}
|
||||
|
@ -229,7 +243,8 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
prim.PayPrice[2] = -2;
|
||||
prim.PayPrice[3] = -2;
|
||||
prim.PayPrice[4] = -2;
|
||||
Primitive.TextureEntry tmp = new Primitive.TextureEntry(UUID.Parse("89556747-24cb-43ed-920b-47caed15465f"));
|
||||
Primitive.TextureEntry tmp =
|
||||
new Primitive.TextureEntry(UUID.Parse("89556747-24cb-43ed-920b-47caed15465f"));
|
||||
|
||||
for (int j = 0; j < obj.Faces.Length; j++)
|
||||
{
|
||||
|
@ -258,33 +273,46 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
prim.Shape.SculptTexture = obj.SculptID;
|
||||
prim.Shape.SculptType = (byte) SculptType.Mesh;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
SceneObjectGroup grp = new SceneObjectGroup();
|
||||
|
||||
grp.SetRootPart(prim);
|
||||
prim.ParentID = 0;
|
||||
}
|
||||
else
|
||||
if (i == 0)
|
||||
{
|
||||
prim.SetParent(grp);
|
||||
grp.AddPart(prim);
|
||||
}
|
||||
rootGroup = grp;
|
||||
|
||||
}
|
||||
pos = m_scene.GetNewRezLocation(Vector3.Zero, pos, UUID.Zero, rot, (byte)1 , 1 , true, grp.GroupScale(), false);
|
||||
grp.AttachToScene(m_scene);
|
||||
grp.AbsolutePosition = pos;
|
||||
grp.ClearPartAttachmentData();
|
||||
grp.AbsolutePosition = obj.Position;
|
||||
prim.RotationOffset = obj.Rotation;
|
||||
|
||||
grp.RootPart.IsAttachment = false;
|
||||
// Required for linking
|
||||
grp.RootPart.UpdateFlag = 0;
|
||||
|
||||
if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos))
|
||||
{
|
||||
m_scene.AddSceneObject(grp);
|
||||
grp.AbsolutePosition = obj.Position;
|
||||
}
|
||||
grp.ScheduleGroupForFullUpdate();
|
||||
allparts[i] = grp;
|
||||
|
||||
}
|
||||
|
||||
for (int j = 1; j < allparts.Length; j++)
|
||||
{
|
||||
rootGroup.RootPart.UpdateFlag = 0;
|
||||
allparts[j].RootPart.UpdateFlag = 0;
|
||||
rootGroup.LinkToGroup(allparts[j]);
|
||||
}
|
||||
|
||||
rootGroup.ScheduleGroupForFullUpdate();
|
||||
pos = m_scene.GetNewRezLocation(Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale(), false);
|
||||
|
||||
responsedata["int_response_code"] = 200; //501; //410; //404;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(grp.LocalId));
|
||||
responsedata["str_response_string"] = String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(allparts[0].LocalId));
|
||||
|
||||
return responsedata;
|
||||
|
||||
|
|
Loading…
Reference in New Issue