changed skeleton, do parse the mesh on upload to check skeleton. Sooner or
later this parsing needs to validate the model cost also.avinationmerge
parent
cc71dd9a27
commit
c3e88b7b38
|
@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
|
string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
|
||||||
byte[] data, string inventoryType, string assetType,
|
byte[] data, string inventoryType, string assetType,
|
||||||
int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
|
int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
|
||||||
bool IsAtestUpload, bool avatarSkeleton, bool avatarCollider, ref string error);
|
bool IsAtestUpload, ref string error);
|
||||||
|
|
||||||
public delegate UUID UpdateItem(UUID itemID, byte[] data);
|
public delegate UUID UpdateItem(UUID itemID, byte[] data);
|
||||||
|
|
||||||
|
@ -531,8 +531,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
int nreqmeshs= 0;
|
int nreqmeshs= 0;
|
||||||
int nreqinstances = 0;
|
int nreqinstances = 0;
|
||||||
bool IsAtestUpload = false;
|
bool IsAtestUpload = false;
|
||||||
bool avatarSkeleton = false;
|
|
||||||
bool avatarCollider = false;
|
|
||||||
|
|
||||||
string assetName = llsdRequest.name;
|
string assetName = llsdRequest.name;
|
||||||
|
|
||||||
|
@ -584,7 +582,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
|
|
||||||
if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost,
|
if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost,
|
||||||
meshcostdata,out avatarSkeleton, out avatarCollider, out error, ref warning))
|
meshcostdata, out error, ref warning))
|
||||||
{
|
{
|
||||||
LLSDAssetUploadError resperror = new LLSDAssetUploadError();
|
LLSDAssetUploadError resperror = new LLSDAssetUploadError();
|
||||||
resperror.message = error;
|
resperror.message = error;
|
||||||
|
@ -667,7 +665,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
AssetUploader uploader =
|
AssetUploader uploader =
|
||||||
new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
|
new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
|
||||||
llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost,
|
llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost,
|
||||||
texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload, avatarSkeleton, avatarCollider);
|
texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload);
|
||||||
|
|
||||||
m_HostCapsObj.HttpListener.AddStreamHandler(
|
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||||
new BinaryStreamHandler(
|
new BinaryStreamHandler(
|
||||||
|
@ -714,7 +712,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
|
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
|
||||||
string assetType, int cost,
|
string assetType, int cost,
|
||||||
UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
|
UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
|
||||||
bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider, ref string error)
|
bool IsAtestUpload, ref string error)
|
||||||
{
|
{
|
||||||
|
|
||||||
lock (m_ModelCost)
|
lock (m_ModelCost)
|
||||||
|
@ -800,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)
|
||||||
|
@ -816,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"];
|
||||||
|
@ -831,7 +829,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
|
|
||||||
// if (doTextInv)
|
// if (doTextInv)
|
||||||
if (doTextInv || avatarSkeleton)
|
|
||||||
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
|
||||||
|
@ -879,10 +876,17 @@ 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;
|
||||||
// do we really need this heavy thing?
|
curAvCollider = false;
|
||||||
|
|
||||||
|
// we do need to parse the mesh now
|
||||||
OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]);
|
OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]);
|
||||||
if (osd is OSDMap)
|
if (osd is OSDMap)
|
||||||
{
|
{
|
||||||
|
@ -891,9 +895,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
OSDMap skeleton = (OSDMap)mosd["skeleton"];
|
OSDMap skeleton = (OSDMap)mosd["skeleton"];
|
||||||
int sksize = skeleton["size"].AsInteger();
|
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();
|
||||||
|
@ -901,10 +906,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
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
|
// test code
|
||||||
if (avatarSkeleton && client != null)
|
if (curAvSkeleton && client != null)
|
||||||
{
|
{
|
||||||
string name = assetName;
|
string name = assetName;
|
||||||
if (name.Length > 25)
|
if (name.Length > 25)
|
||||||
|
@ -1594,14 +1600,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
private int m_nreqmeshs;
|
private int m_nreqmeshs;
|
||||||
private int m_nreqinstances;
|
private int m_nreqinstances;
|
||||||
private bool m_IsAtestUpload;
|
private bool m_IsAtestUpload;
|
||||||
private bool m_avatarSkeleton;
|
|
||||||
private bool m_avatarCollider;
|
|
||||||
|
|
||||||
public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem,
|
public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem,
|
||||||
UUID parentFolderID, string invType, string assetType, string path,
|
UUID parentFolderID, string invType, string assetType, string path,
|
||||||
IHttpServer httpServer, bool dumpAssetsToFile,
|
IHttpServer httpServer, bool dumpAssetsToFile,
|
||||||
int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
|
int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
|
||||||
bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider)
|
bool IsAtestUpload)
|
||||||
{
|
{
|
||||||
m_assetName = assetName;
|
m_assetName = assetName;
|
||||||
m_assetDes = description;
|
m_assetDes = description;
|
||||||
|
@ -1620,8 +1624,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
m_nreqmeshs = nreqmeshs;
|
m_nreqmeshs = nreqmeshs;
|
||||||
m_nreqinstances = nreqinstances;
|
m_nreqinstances = nreqinstances;
|
||||||
m_IsAtestUpload = IsAtestUpload;
|
m_IsAtestUpload = IsAtestUpload;
|
||||||
m_avatarSkeleton = avatarSkeleton;
|
|
||||||
m_avatarCollider = avatarCollider;
|
|
||||||
|
|
||||||
m_timeoutTimer.Elapsed += TimedOut;
|
m_timeoutTimer.Elapsed += TimedOut;
|
||||||
m_timeoutTimer.Interval = 120000;
|
m_timeoutTimer.Interval = 120000;
|
||||||
|
@ -1667,7 +1669,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
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,
|
m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload,
|
||||||
m_avatarSkeleton, m_avatarCollider, ref m_error);
|
ref m_error);
|
||||||
}
|
}
|
||||||
if (m_IsAtestUpload)
|
if (m_IsAtestUpload)
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,14 +99,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// avatarSkeleton if mesh includes a avatar skeleton
|
// avatarSkeleton if mesh includes a avatar skeleton
|
||||||
// useAvatarCollider if we should use physics mesh for avatar
|
// 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 bool avatarSkeleton, out bool useAvatarCollider,
|
LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning)
|
||||||
out string error, ref string warning)
|
|
||||||
{
|
{
|
||||||
totalcost = 0;
|
totalcost = 0;
|
||||||
error = string.Empty;
|
error = string.Empty;
|
||||||
|
|
||||||
avatarSkeleton = false;
|
bool avatarSkeleton = false;
|
||||||
useAvatarCollider = false;
|
|
||||||
|
|
||||||
if (resources == null ||
|
if (resources == null ||
|
||||||
resources.instance_list == null ||
|
resources.instance_list == null ||
|
||||||
|
|
Loading…
Reference in New Issue