Merge branch 'ubitworkmaster'

avinationmerge
Melanie Thielker 2014-10-12 00:08:06 +02:00
commit e0d5cefc69
5 changed files with 110 additions and 11 deletions

View File

@ -580,6 +580,7 @@ namespace OpenSim.Region.ClientStack.Linden
string error; string error;
int modelcost; int modelcost;
if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost,
meshcostdata, out error, ref warning)) meshcostdata, out error, ref warning))
{ {
@ -797,7 +798,7 @@ namespace OpenSim.Region.ClientStack.Linden
OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data);
// compare and get updated information // compare and get updated information
/* does nothing still we do need something to avoid special viewer to upload something diferent from the cost estimation
bool mismatchError = true; bool mismatchError = true;
while (mismatchError) while (mismatchError)
@ -813,7 +814,7 @@ namespace OpenSim.Region.ClientStack.Linden
return; return;
} }
*/
OSDArray instance_list = (OSDArray)request["instance_list"]; OSDArray instance_list = (OSDArray)request["instance_list"];
OSDArray mesh_list = (OSDArray)request["mesh_list"]; OSDArray mesh_list = (OSDArray)request["mesh_list"];
OSDArray texture_list = (OSDArray)request["texture_list"]; OSDArray texture_list = (OSDArray)request["texture_list"];
@ -827,7 +828,7 @@ namespace OpenSim.Region.ClientStack.Linden
List<UUID> textures = new List<UUID>(); List<UUID> textures = new List<UUID>();
if (doTextInv) // if (doTextInv)
m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
if(client == null) // don't put textures in inventory if there is no client if(client == null) // don't put textures in inventory if there is no client
@ -875,14 +876,73 @@ namespace OpenSim.Region.ClientStack.Linden
// create and store meshs assets // create and store meshs assets
List<UUID> meshAssets = new List<UUID>(); List<UUID> meshAssets = new List<UUID>();
List<bool> meshAvatarSkeletons = new List<bool>();
List<bool> meshAvatarColliders = new List<bool>();
bool curAvSkeleton;
bool curAvCollider;
for (int i = 0; i < mesh_list.Count; i++) for (int i = 0; i < mesh_list.Count; i++)
{ {
curAvSkeleton = false;
curAvCollider = false;
// we do need to parse the mesh now
OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]);
if (osd is OSDMap)
{
OSDMap mosd = (OSDMap)osd;
if (mosd.ContainsKey("skeleton"))
{
OSDMap skeleton = (OSDMap)mosd["skeleton"];
int sksize = skeleton["size"].AsInteger();
if (sksize > 0)
curAvSkeleton = true;
}
}
AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr);
meshAsset.Data = mesh_list[i].AsBinary(); meshAsset.Data = mesh_list[i].AsBinary();
if (istest) if (istest)
meshAsset.Local = true; meshAsset.Local = true;
m_assetService.Store(meshAsset); m_assetService.Store(meshAsset);
meshAssets.Add(meshAsset.FullID); meshAssets.Add(meshAsset.FullID);
meshAvatarSkeletons.Add(curAvSkeleton);
meshAvatarColliders.Add(curAvCollider);
// test code
if (curAvSkeleton && client != 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 = creatorIDstr;
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
meshitem.Folder = parentFolder; // dont let it go to folder Meshes that viewers dont show
// 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();
m_Scene.AddInventoryItem(client, meshitem);
meshitem = null;
}
} }
int skipedMeshs = 0; int skipedMeshs = 0;
@ -1608,7 +1668,8 @@ namespace OpenSim.Region.ClientStack.Linden
if (handlerUpLoad != null) if (handlerUpLoad != null)
{ {
handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,
m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, ref m_error); m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload,
ref m_error);
} }
if (m_IsAtestUpload) if (m_IsAtestUpload)
{ {

View File

@ -96,12 +96,16 @@ namespace OpenSim.Region.ClientStack.Linden
// basicCost input region assets upload cost // basicCost input region assets upload cost
// totalcost returns model total upload fee // totalcost returns model total upload fee
// meshcostdata returns detailed costs for viewer // meshcostdata returns detailed costs for viewer
// avatarSkeleton if mesh includes a avatar skeleton
// useAvatarCollider if we should use physics mesh for avatar
public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost,
LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning) LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning)
{ {
totalcost = 0; totalcost = 0;
error = string.Empty; error = string.Empty;
bool avatarSkeleton = false;
if (resources == null || if (resources == null ||
resources.instance_list == null || resources.instance_list == null ||
resources.instance_list.Array.Count == 0) resources.instance_list.Array.Count == 0)
@ -145,6 +149,10 @@ namespace OpenSim.Region.ClientStack.Linden
float meshsfee = 0; float meshsfee = 0;
int numberMeshs = 0; int numberMeshs = 0;
bool haveMeshs = false; bool haveMeshs = false;
bool curskeleton;
bool curAvatarPhys;
List<ameshCostParam> meshsCosts = new List<ameshCostParam>(); List<ameshCostParam> meshsCosts = new List<ameshCostParam>();
if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0) if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0)
@ -156,10 +164,20 @@ namespace OpenSim.Region.ClientStack.Linden
ameshCostParam curCost = new ameshCostParam(); ameshCostParam curCost = new ameshCostParam();
byte[] data = (byte[])resources.mesh_list.Array[i]; byte[] data = (byte[])resources.mesh_list.Array[i];
if (!MeshCost(data, curCost, out error)) if (!MeshCost(data, curCost,out curskeleton, out curAvatarPhys, out error))
{ {
return false; return false;
} }
if (curskeleton)
{
if (avatarSkeleton)
{
error = "model can only contain a avatar skeleton";
return false;
}
avatarSkeleton = true;
}
meshsCosts.Add(curCost); meshsCosts.Add(curCost);
meshsfee += curCost.costFee; meshsfee += curCost.costFee;
} }
@ -273,7 +291,7 @@ namespace OpenSim.Region.ClientStack.Linden
} }
// single mesh asset cost // single mesh asset cost
private bool MeshCost(byte[] data, ameshCostParam cost, out string error) private bool MeshCost(byte[] data, ameshCostParam cost,out bool skeleton, out bool avatarPhys, out string error)
{ {
cost.highLODSize = 0; cost.highLODSize = 0;
cost.medLODSize = 0; cost.medLODSize = 0;
@ -284,6 +302,9 @@ namespace OpenSim.Region.ClientStack.Linden
error = string.Empty; error = string.Empty;
skeleton = false;
avatarPhys = false;
if (data == null || data.Length == 0) if (data == null || data.Length == 0)
{ {
error = "Missing model information."; error = "Missing model information.";
@ -330,6 +351,17 @@ namespace OpenSim.Region.ClientStack.Linden
int submesh_offset = -1; int submesh_offset = -1;
if (map.ContainsKey("skeleton"))
{
tmpmap = (OSDMap)map["skeleton"];
if (tmpmap.ContainsKey("offset") && tmpmap.ContainsKey("size"))
{
int sksize = tmpmap["size"].AsInteger();
if(sksize > 0)
skeleton = true;
}
}
if (map.ContainsKey("physics_convex")) if (map.ContainsKey("physics_convex"))
{ {
tmpmap = (OSDMap)map["physics_convex"]; tmpmap = (OSDMap)map["physics_convex"];

View File

@ -131,6 +131,9 @@ namespace OpenSim.Region.ClientStack.Linden
m_features["MeshRezEnabled"] = true; m_features["MeshRezEnabled"] = true;
m_features["MeshUploadEnabled"] = true; m_features["MeshUploadEnabled"] = true;
m_features["MeshXferEnabled"] = true; m_features["MeshXferEnabled"] = true;
m_features["AvatarSkeleton"] = true;
m_features["AnimationSet"] = true;
m_features["PhysicsMaterialsEnabled"] = true; m_features["PhysicsMaterialsEnabled"] = true;
OSDMap typesMap = new OSDMap(); OSDMap typesMap = new OSDMap();

View File

@ -291,6 +291,10 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerParcelPrimCountTainted(); EventManager.TriggerParcelPrimCountTainted();
} }
// restore targetOmega
if (part.AngularVelocity != Vector3.Zero)
part.ScheduleTerseUpdate();
} }
public virtual void ProcessMoneyTransferRequest(UUID source, UUID destination, int amount, public virtual void ProcessMoneyTransferRequest(UUID source, UUID destination, int amount,

View File

@ -666,8 +666,7 @@ namespace OpenSim.Region.Framework.Scenes
m_isSelected = value; m_isSelected = value;
if (ParentGroup != null) if (ParentGroup != null)
ParentGroup.PartSelectChanged(value); ParentGroup.PartSelectChanged(value);
if (!m_isSelected && m_angularVelocity != Vector3.Zero)
ScheduleTerseUpdate();
} }
} }