Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
commit
a6b2a35ddf
|
@ -128,9 +128,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
}
|
||||
private FileAgentInventoryState m_FileAgentInventoryState = FileAgentInventoryState.idle;
|
||||
|
||||
// private bool m_addNewTextures = false;
|
||||
// private bool m_addNewMeshes = false;
|
||||
|
||||
public BunchOfCaps(Scene scene, Caps caps)
|
||||
{
|
||||
m_Scene = scene;
|
||||
|
@ -641,6 +638,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
}
|
||||
}
|
||||
|
||||
// strings to types
|
||||
if (inventoryType == "sound")
|
||||
{
|
||||
inType = (sbyte)InventoryType.Sound;
|
||||
|
@ -687,45 +685,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
textureAsset.Data = texture_list[i].AsBinary();
|
||||
m_assetService.Store(textureAsset);
|
||||
textures.Add(textureAsset.FullID);
|
||||
/*
|
||||
don't do this
|
||||
replace it by optionaly making model textures cost less than if individually uploaded
|
||||
since they can't be used for other purpuses
|
||||
|
||||
// save it to inventory
|
||||
if (m_addNewTextures && AddNewInventoryItem != null)
|
||||
{
|
||||
string name = assetName;
|
||||
if (name.Length > 25)
|
||||
name = name.Substring(0, 24);
|
||||
name += "_Texture#" + i.ToString();
|
||||
InventoryItemBase texitem = new InventoryItemBase();
|
||||
texitem.Owner = m_HostCapsObj.AgentID;
|
||||
texitem.CreatorId = m_HostCapsObj.AgentID.ToString();
|
||||
texitem.CreatorData = String.Empty;
|
||||
texitem.ID = UUID.Random();
|
||||
texitem.AssetID = textureAsset.FullID;
|
||||
texitem.Description = "mesh model texture";
|
||||
texitem.Name = name;
|
||||
texitem.AssetType = (int)AssetType.Texture;
|
||||
texitem.InvType = (int)InventoryType.Texture;
|
||||
texitem.Folder = UUID.Zero; // send to default
|
||||
|
||||
// If we set PermissionMask.All then when we rez the item the next permissions will replace the current
|
||||
// (owner) permissions. This becomes a problem if next permissions are changed.
|
||||
texitem.CurrentPermissions
|
||||
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
|
||||
texitem.BasePermissions = (uint)PermissionMask.All;
|
||||
texitem.EveryOnePermissions = 0;
|
||||
texitem.NextPermissions = (uint)PermissionMask.All;
|
||||
texitem.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0);
|
||||
texitem = null;
|
||||
}
|
||||
*/
|
||||
textureAsset = null;
|
||||
}
|
||||
|
||||
// create and store meshs assets
|
||||
|
@ -736,47 +695,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
meshAsset.Data = mesh_list[i].AsBinary();
|
||||
m_assetService.Store(meshAsset);
|
||||
meshAssets.Add(meshAsset.FullID);
|
||||
|
||||
/* this was a test, funny and showed viewers deal with mesh inventory itens
|
||||
* nut also same reason as for textures
|
||||
* let integrated in a model cost eventually less than hipotetical independent meshs assets
|
||||
* that will be in inventory
|
||||
// save it to inventory
|
||||
if (m_addNewMeshes && AddNewInventoryItem != null)
|
||||
{
|
||||
string name = assetName;
|
||||
if (name.Length > 25)
|
||||
name = name.Substring(0, 24);
|
||||
name += "_Mesh#" + i.ToString();
|
||||
InventoryItemBase meshitem = new InventoryItemBase();
|
||||
meshitem.Owner = m_HostCapsObj.AgentID;
|
||||
meshitem.CreatorId = m_HostCapsObj.AgentID.ToString();
|
||||
meshitem.CreatorData = String.Empty;
|
||||
meshitem.ID = UUID.Random();
|
||||
meshitem.AssetID = meshAsset.FullID;
|
||||
meshitem.Description = "mesh ";
|
||||
meshitem.Name = name;
|
||||
meshitem.AssetType = (int)AssetType.Mesh;
|
||||
meshitem.InvType = (int)InventoryType.Mesh;
|
||||
meshitem.Folder = UUID.Zero; // send to default
|
||||
|
||||
// If we set PermissionMask.All then when we rez the item the next permissions will replace the current
|
||||
// (owner) permissions. This becomes a problem if next permissions are changed.
|
||||
meshitem.CurrentPermissions
|
||||
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
|
||||
meshitem.BasePermissions = (uint)PermissionMask.All;
|
||||
meshitem.EveryOnePermissions = 0;
|
||||
meshitem.NextPermissions = (uint)PermissionMask.All;
|
||||
meshitem.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
AddNewInventoryItem(m_HostCapsObj.AgentID, meshitem, 0);
|
||||
meshitem = null;
|
||||
}
|
||||
*/
|
||||
meshAsset = null;
|
||||
}
|
||||
|
||||
int skipedMeshs = 0;
|
||||
// build prims from instances
|
||||
for (int i = 0; i < instance_list.Count; i++)
|
||||
{
|
||||
|
@ -786,7 +707,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
Vector3 scale = inner_instance_list["scale"].AsVector3();
|
||||
|
||||
if (scale.X < m_PrimScaleMin || scale.Y < m_PrimScaleMin || scale.Z < m_PrimScaleMin)
|
||||
{
|
||||
skipedMeshs++;
|
||||
continue;
|
||||
}
|
||||
|
||||
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
|
||||
|
||||
|
@ -836,6 +760,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
pbs.TextureEntry = textureEntry.GetBytes();
|
||||
|
||||
bool hasmesh = false;
|
||||
if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
|
||||
{
|
||||
int meshindx = inner_instance_list["mesh"].AsInteger();
|
||||
if (meshAssets.Count > meshindx)
|
||||
{
|
||||
|
@ -843,14 +770,23 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
pbs.SculptType = (byte)SculptType.Mesh;
|
||||
pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction
|
||||
// data will be requested from asset on rez (i hope)
|
||||
hasmesh = true;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 position = inner_instance_list["position"].AsVector3();
|
||||
Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
|
||||
|
||||
// no longer used - begin ------------------------
|
||||
// for now viwers do send fixed defaults
|
||||
// but this may change
|
||||
// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger();
|
||||
byte physicsShapeType = (byte)PhysShapeType.prim; // default for mesh is simple convex
|
||||
if(hasmesh)
|
||||
physicsShapeType = (byte) PhysShapeType.convex; // default for mesh is simple convex
|
||||
// int material = inner_instance_list["material"].AsInteger();
|
||||
byte material = (byte)Material.Wood;
|
||||
|
||||
// no longer used - begin ------------------------
|
||||
// int mesh = inner_instance_list["mesh"].AsInteger();
|
||||
|
||||
// OSDMap permissions = (OSDMap)inner_instance_list["permissions"];
|
||||
|
@ -872,7 +808,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
= new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
|
||||
|
||||
prim.Scale = scale;
|
||||
prim.OffsetPosition = position;
|
||||
// prim.OffsetPosition = position;
|
||||
rotations.Add(rotation);
|
||||
positions.Add(position);
|
||||
prim.UUID = UUID.Random();
|
||||
|
@ -883,6 +819,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
prim.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
prim.Name = assetName;
|
||||
prim.Description = "";
|
||||
prim.Material = material;
|
||||
prim.PhysicsShapeType = physicsShapeType;
|
||||
|
||||
// prim.BaseMask = (uint)base_mask;
|
||||
// prim.EveryoneMask = (uint)everyone_mask;
|
||||
|
@ -896,25 +834,40 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
grp.AddPart(prim);
|
||||
}
|
||||
|
||||
// Fix first link number
|
||||
Vector3 rootPos = positions[0];
|
||||
|
||||
if (grp.Parts.Length > 1)
|
||||
{
|
||||
// Fix first link number
|
||||
grp.RootPart.LinkNum++;
|
||||
|
||||
Vector3 rootPos = positions[0];
|
||||
grp.AbsolutePosition = rootPos;
|
||||
for (int i = 0; i < positions.Count; i++)
|
||||
Quaternion rootRotConj = Quaternion.Conjugate(rotations[0]);
|
||||
Quaternion tmprot;
|
||||
Vector3 offset;
|
||||
|
||||
// fix children rotations and positions
|
||||
for (int i = 1; i < rotations.Count; i++)
|
||||
{
|
||||
Vector3 offset = positions[i] - rootPos;
|
||||
tmprot = rotations[i];
|
||||
tmprot = rootRotConj * tmprot;
|
||||
|
||||
grp.Parts[i].RotationOffset = tmprot;
|
||||
|
||||
offset = positions[i] - rootPos;
|
||||
|
||||
offset *= rootRotConj;
|
||||
grp.Parts[i].OffsetPosition = offset;
|
||||
}
|
||||
|
||||
for (int i = 0; i < rotations.Count; i++)
|
||||
grp.AbsolutePosition = rootPos;
|
||||
grp.UpdateGroupRotationR(rotations[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i != 0)
|
||||
grp.Parts[i].RotationOffset = rotations[i];
|
||||
grp.AbsolutePosition = rootPos;
|
||||
grp.UpdateGroupRotationR(rotations[0]);
|
||||
}
|
||||
|
||||
grp.UpdateGroupRotationR(rotations[0]);
|
||||
data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue