Merge branch 'ubitworkmaster'
commit
a06d66b70b
|
@ -2942,7 +2942,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
/// </summary>
|
||||
private void ApplyNextOwnerPermissions(InventoryItemBase item)
|
||||
{
|
||||
if (item.InvType == (int)InventoryType.Object)
|
||||
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
||||
{
|
||||
uint perms = item.CurrentPermissions;
|
||||
PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
|
||||
|
|
|
@ -72,8 +72,8 @@ namespace OpenSim.Framework
|
|||
/// <param name="mainPerms">The permissions variable to modify.</param>
|
||||
public static void ApplyFoldedPermissions(uint foldedPerms, ref uint mainPerms)
|
||||
{
|
||||
if ((foldedPerms & 7) == 0)
|
||||
return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded
|
||||
// if ((foldedPerms & 7) == 0)
|
||||
// return; // assume that if the folded permissions are 0 then this means that they weren't actually recorded
|
||||
|
||||
if ((foldedPerms & ((uint)PermissionMask.Copy >> 13)) == 0)
|
||||
mainPerms &= ~(uint)PermissionMask.Copy;
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace OpenSim.Framework
|
|||
int itemmax = 21;
|
||||
WearableCacheItem[] retitems = new WearableCacheItem[itemmax];
|
||||
for (uint i=0;i<itemmax;i++)
|
||||
retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i + 1};
|
||||
retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i};
|
||||
return retitems;
|
||||
}
|
||||
public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache)
|
||||
|
|
|
@ -98,8 +98,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
m_scene = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void RegionLoaded(Scene s)
|
||||
{
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
|
@ -110,32 +108,47 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
private void DeRegisterPresence(UUID agentId)
|
||||
{
|
||||
ScenePresence presence = null;
|
||||
if (m_scene.TryGetScenePresence(agentId, out presence))
|
||||
// ScenePresence presence = null;
|
||||
// if (m_scene.TryGetScenePresence(agentId, out presence))
|
||||
{
|
||||
presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings;
|
||||
// presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RegisterNewPresence(ScenePresence presence)
|
||||
{
|
||||
presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings;
|
||||
|
||||
// presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings;
|
||||
}
|
||||
|
||||
/* not in use. work done in AvatarFactoryModule ValidateBakedTextureCache() and UpdateBakedTextureCache()
|
||||
private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
|
||||
{
|
||||
// if cacheItems.Length > 0 viewer is giving us current textures information.
|
||||
// baked ones should had been uploaded and in assets cache as local itens
|
||||
|
||||
|
||||
if (cacheItems.Length == 0)
|
||||
return; // no textures information, nothing to do
|
||||
|
||||
ScenePresence p = null;
|
||||
if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out p))
|
||||
return; // what are we doing if there is no presence to cache for?
|
||||
|
||||
if (p.IsDeleted)
|
||||
return; // does this really work?
|
||||
|
||||
int maxCacheitemsLoop = cacheItems.Length;
|
||||
if (maxCacheitemsLoop > AvatarWearable.MAX_WEARABLES)
|
||||
if (maxCacheitemsLoop > 20)
|
||||
{
|
||||
maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES;
|
||||
m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES);
|
||||
}
|
||||
|
||||
m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||
if (cacheItems.Length > 0)
|
||||
{
|
||||
|
||||
|
||||
// some nice debug
|
||||
m_log.Debug("[Cacheitems]: " + cacheItems.Length);
|
||||
for (int iter = 0; iter < maxCacheitemsLoop; iter++)
|
||||
{
|
||||
|
@ -143,11 +156,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
cacheItems[iter].TextureID);
|
||||
}
|
||||
|
||||
ScenePresence p = null;
|
||||
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p))
|
||||
{
|
||||
// p.Appearance.WearableCacheItems is in memory primary cashID to textures mapper
|
||||
|
||||
WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems;
|
||||
|
||||
if (existingitems == null)
|
||||
{
|
||||
if (m_BakedTextureModule != null)
|
||||
|
@ -161,24 +173,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
p.Appearance.WearableCacheItems = savedcache;
|
||||
p.Appearance.WearableCacheItemsDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* The following Catch types DO NOT WORK with m_BakedTextureModule.Get
|
||||
* it jumps to the General Packet Exception Handler if you don't catch Exception!
|
||||
*
|
||||
catch (System.Net.Sockets.SocketException)
|
||||
{
|
||||
cacheItems = null;
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
cacheItems = null;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
cacheItems = null;
|
||||
} */
|
||||
catch (Exception)
|
||||
{
|
||||
// The service logs a sufficient error message.
|
||||
|
@ -189,10 +185,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
existingitems = savedcache;
|
||||
}
|
||||
}
|
||||
|
||||
// Existing items null means it's a fully new appearance
|
||||
if (existingitems == null)
|
||||
{
|
||||
|
||||
for (int i = 0; i < maxCacheitemsLoop; i++)
|
||||
{
|
||||
if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
|
||||
|
@ -214,15 +210,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
{
|
||||
m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
{
|
||||
// for each uploaded baked texture
|
||||
for (int i = 0; i < maxCacheitemsLoop; i++)
|
||||
{
|
||||
if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
|
||||
|
@ -253,23 +244,24 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
p.Appearance.WearableCacheItems = cacheItems;
|
||||
|
||||
|
||||
|
||||
if (m_BakedTextureModule != null)
|
||||
{
|
||||
m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems);
|
||||
p.Appearance.WearableCacheItemsDirty = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
p.Appearance.WearableCacheItemsDirty = false;
|
||||
|
||||
for (int iter = 0; iter < maxCacheitemsLoop; iter++)
|
||||
{
|
||||
m_log.Debug("[CacheitemsLeaving] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
|
||||
cacheItems[iter].TextureID);
|
||||
}
|
||||
}
|
||||
*/
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -3684,6 +3684,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
avp.Sender.IsTrial = false;
|
||||
avp.Sender.ID = agentID;
|
||||
avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0];
|
||||
|
||||
// this need be use in future
|
||||
// avp.AppearanceData[0].AppearanceVersion = 0;
|
||||
// avp.AppearanceData[0].CofVersion = 0;
|
||||
|
||||
//m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
|
||||
OutPacket(avp, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
@ -6535,7 +6540,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length];
|
||||
for (int i=0; i<appear.WearableData.Length;i++)
|
||||
cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)};
|
||||
cacheitems[i] = new WearableCacheItem(){
|
||||
CacheId = appear.WearableData[i].CacheID,
|
||||
TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -12005,98 +12013,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (cachedtex.AgentData.SessionID != SessionId)
|
||||
return false;
|
||||
|
||||
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
cachedresp.AgentData.AgentID = AgentId;
|
||||
cachedresp.AgentData.SessionID = m_sessionId;
|
||||
cachedresp.AgentData.SerialNum = m_cachedTextureSerial;
|
||||
m_cachedTextureSerial++;
|
||||
cachedresp.AgentData.SerialNum = cachedtex.AgentData.SerialNum;
|
||||
cachedresp.WearableData =
|
||||
new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
|
||||
|
||||
//IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>();
|
||||
// var item = fac.GetBakedTextureFaces(AgentId);
|
||||
//WearableCacheItem[] items = fac.GetCachedItems(AgentId);
|
||||
|
||||
IAssetService cache = m_scene.AssetService;
|
||||
IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||
//bakedTextureModule = null;
|
||||
int maxWearablesLoop = cachedtex.WearableData.Length;
|
||||
if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
|
||||
maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
|
||||
|
||||
if (bakedTextureModule != null && cache != null)
|
||||
{
|
||||
int cacheHits = 0;
|
||||
|
||||
// We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid
|
||||
|
||||
WearableCacheItem[] cacheItems = null;
|
||||
|
||||
ScenePresence p = m_scene.GetScenePresence(AgentId);
|
||||
if (p.Appearance != null)
|
||||
if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty)
|
||||
{
|
||||
try
|
||||
{
|
||||
cacheItems = bakedTextureModule.Get(AgentId);
|
||||
p.Appearance.WearableCacheItems = cacheItems;
|
||||
p.Appearance.WearableCacheItemsDirty = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception!
|
||||
*
|
||||
catch (System.Net.Sockets.SocketException)
|
||||
{
|
||||
cacheItems = null;
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
cacheItems = null;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
cacheItems = null;
|
||||
} */
|
||||
catch (Exception)
|
||||
{
|
||||
cacheItems = null;
|
||||
}
|
||||
|
||||
}
|
||||
else if (p.Appearance.WearableCacheItems != null)
|
||||
if (p != null && p.Appearance != null)
|
||||
{
|
||||
cacheItems = p.Appearance.WearableCacheItems;
|
||||
}
|
||||
|
||||
if (cache != null && cacheItems != null)
|
||||
{
|
||||
foreach (WearableCacheItem item in cacheItems)
|
||||
{
|
||||
|
||||
if (cache.GetCached(item.TextureID.ToString()) == null)
|
||||
{
|
||||
item.TextureAsset.Temporary = true;
|
||||
cache.Store(item.TextureAsset);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (cacheItems != null)
|
||||
{
|
||||
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
{
|
||||
WearableCacheItem item =
|
||||
WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems);
|
||||
int idx = cachedtex.WearableData[i].TextureIndex;
|
||||
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
|
||||
if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId)
|
||||
{
|
||||
|
||||
cachedresp.WearableData[i].TextureID = item.TextureID;
|
||||
cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID;
|
||||
cacheHits++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -12115,39 +12068,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cache == null)
|
||||
{
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
{
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
|
||||
cachedresp.WearableData[i].TextureID = UUID.Zero;
|
||||
//UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
{
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
|
||||
|
||||
m_log.DebugFormat("texture cached: hits {0}", cacheHits);
|
||||
|
||||
|
||||
if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null)
|
||||
cachedresp.WearableData[i].TextureID = UUID.Zero;
|
||||
//UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
|
||||
else
|
||||
cachedresp.WearableData[i].TextureID = UUID.Zero;
|
||||
// UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
cachedresp.Header.Zerocoded = true;
|
||||
OutPacket(cachedresp, ThrottleOutPacketType.Task);
|
||||
|
||||
|
|
|
@ -1750,25 +1750,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
endPoint,
|
||||
sessionInfo);
|
||||
|
||||
// Send ack straight away to let the viewer know that the connection is active.
|
||||
// The client will be null if it already exists (e.g. if on a region crossing the client sends a use
|
||||
// circuit code to the existing child agent. This is not particularly obvious.
|
||||
SendAckImmediate(endPoint, uccp.Header.Sequence);
|
||||
|
||||
// We only want to send initial data to new clients, not ones which are being converted from child to root.
|
||||
if (client != null)
|
||||
{
|
||||
AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
|
||||
bool tp = (aCircuit.teleportFlags > 0);
|
||||
// Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from
|
||||
if (!tp)
|
||||
client.SceneAgent.SendInitialDataToMe();
|
||||
}
|
||||
|
||||
// Now we know we can handle more data
|
||||
Thread.Sleep(200);
|
||||
// Thread.Sleep(200);
|
||||
|
||||
// Obtain the queue and remove it from the cache
|
||||
// Obtain the pending queue and remove it from the cache
|
||||
Queue<UDPPacketBuffer> queue = null;
|
||||
|
||||
lock (m_pendingCache)
|
||||
|
@ -1790,6 +1775,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
PacketReceived(buf);
|
||||
}
|
||||
queue = null;
|
||||
|
||||
// Send ack straight away to let the viewer know that the connection is active.
|
||||
// The client will be null if it already exists (e.g. if on a region crossing the client sends a use
|
||||
// circuit code to the existing child agent. This is not particularly obvious.
|
||||
SendAckImmediate(endPoint, uccp.Header.Sequence);
|
||||
|
||||
// We only want to send initial data to new clients, not ones which are being converted from child to root.
|
||||
if (client != null)
|
||||
{
|
||||
AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
|
||||
bool tp = (aCircuit.teleportFlags > 0);
|
||||
// Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from
|
||||
if (!tp)
|
||||
client.SceneAgent.SendInitialDataToMe();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -188,27 +188,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
// Process the visual params, this may change height as well
|
||||
if (visualParams != null)
|
||||
{
|
||||
// string[] visualParamsStrings = new string[visualParams.Length];
|
||||
// for (int i = 0; i < visualParams.Length; i++)
|
||||
// visualParamsStrings[i] = visualParams[i].ToString();
|
||||
// m_log.DebugFormat(
|
||||
// "[AVFACTORY]: Setting visual params for {0} to {1}",
|
||||
// client.Name, string.Join(", ", visualParamsStrings));
|
||||
/*
|
||||
float oldHeight = sp.Appearance.AvatarHeight;
|
||||
changed = sp.Appearance.SetVisualParams(visualParams);
|
||||
|
||||
if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0)
|
||||
((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight);
|
||||
*/
|
||||
// float oldoff = sp.Appearance.AvatarFeetOffset;
|
||||
// Vector3 oldbox = sp.Appearance.AvatarBoxSize;
|
||||
changed = sp.Appearance.SetVisualParams(visualParams);
|
||||
// float off = sp.Appearance.AvatarFeetOffset;
|
||||
// Vector3 box = sp.Appearance.AvatarBoxSize;
|
||||
// if(oldoff != off || oldbox != box)
|
||||
// ((ScenePresence)sp).SetSize(box,off);
|
||||
|
||||
}
|
||||
|
||||
// Process the baked texture array
|
||||
|
@ -222,9 +202,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
|
||||
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
|
||||
|
||||
|
||||
// If bake textures are missing and this is not an NPC, request a rebake from client
|
||||
if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc))
|
||||
RequestRebake(sp, true);
|
||||
// rebake may messup caching, and should not be needed
|
||||
|
||||
|
||||
// if (!UpdateBakedTextureCache(sp,cacheItems) && (((ScenePresence)sp).PresenceType != PresenceType.Npc))
|
||||
// RequestRebake(sp, true);
|
||||
|
||||
UpdateBakedTextureCache(sp, cacheItems);
|
||||
|
||||
// This appears to be set only in the final stage of the appearance
|
||||
// update transaction. In theory, we should be able to do an immediate
|
||||
|
@ -377,121 +363,243 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
}
|
||||
|
||||
public bool ValidateBakedTextureCache(IScenePresence sp)
|
||||
// called on textures update
|
||||
public bool UpdateBakedTextureCache(IScenePresence sp, WearableCacheItem[] cacheItems)
|
||||
{
|
||||
bool defonly = true; // are we only using default textures
|
||||
IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
|
||||
IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||
WearableCacheItem[] wearableCache = null;
|
||||
|
||||
// Cache wearable data for teleport.
|
||||
// Only makes sense if there's a bake module and a cache module
|
||||
if (bakedModule != null && cache != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
wearableCache = bakedModule.Get(sp.UUID);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// uploaded baked textures will be in assets local cache
|
||||
IAssetService cache = m_scene.AssetService;
|
||||
|
||||
}
|
||||
if (wearableCache != null)
|
||||
{
|
||||
for (int i = 0; i < wearableCache.Length; i++)
|
||||
{
|
||||
cache.Cache(wearableCache[i].TextureAsset);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||
if (invService.GetRootFolder(userID) != null)
|
||||
{
|
||||
WearableCacheItem[] wearableCache = null;
|
||||
if (bakedModule != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
wearableCache = bakedModule.Get(userID);
|
||||
appearance.WearableCacheItems = wearableCache;
|
||||
appearance.WearableCacheItemsDirty = false;
|
||||
foreach (WearableCacheItem item in wearableCache)
|
||||
{
|
||||
appearance.Texture.FaceTextures[item.TextureIndex].TextureID = item.TextureID;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
int validDirtyBakes = 0;
|
||||
int hits = 0;
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
// our main cacheIDs mapper is p.Appearance.WearableCacheItems
|
||||
WearableCacheItem[] wearableCache = sp.Appearance.WearableCacheItems;
|
||||
|
||||
// Process the texture entry
|
||||
for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
|
||||
if (wearableCache == null)
|
||||
{
|
||||
int idx = AvatarAppearance.BAKE_INDICES[i];
|
||||
wearableCache = WearableCacheItem.GetDefaultCacheItem();
|
||||
}
|
||||
|
||||
// Process received baked textures
|
||||
for (int i = 0; i < cacheItems.Length; i++)
|
||||
{
|
||||
int idx = (int)cacheItems[i].TextureIndex;
|
||||
Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
|
||||
|
||||
// No face, so lets check our baked service cache, teleport or login.
|
||||
// No face
|
||||
if (face == null)
|
||||
{
|
||||
if (wearableCache != null)
|
||||
{
|
||||
// If we find the an appearance item, set it as the textureentry and the face
|
||||
WearableCacheItem searchitem = WearableCacheItem.SearchTextureIndex((uint) idx, wearableCache);
|
||||
if (searchitem != null)
|
||||
{
|
||||
// for some reason viewer is cleaning this
|
||||
sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint) idx);
|
||||
sp.Appearance.Texture.FaceTextures[idx].TextureID = searchitem.TextureID;
|
||||
face = sp.Appearance.Texture.FaceTextures[idx];
|
||||
sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE;
|
||||
wearableCache[idx].CacheId = UUID.Zero;
|
||||
wearableCache[idx].TextureID = UUID.Zero;
|
||||
wearableCache[idx].TextureAsset = null;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if there is no texture entry and no baked cache, skip it
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//No texture entry face and no cache. Skip this face.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
|
||||
// face.TextureID, idx, client.Name, client.AgentId);
|
||||
|
||||
// if the texture is one of the "defaults" then skip it
|
||||
// this should probably be more intelligent (skirt texture doesnt matter
|
||||
// if the avatar isnt wearing a skirt) but if any of the main baked
|
||||
// textures is default then the rest should be as well
|
||||
if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
|
||||
{
|
||||
wearableCache[idx].CacheId = UUID.Zero;
|
||||
wearableCache[idx].TextureID = UUID.Zero;
|
||||
wearableCache[idx].TextureAsset = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
defonly = false; // found a non-default texture reference
|
||||
|
||||
if (cache != null)
|
||||
if(sp.Appearance.Texture.FaceTextures[idx].TextureID == wearableCache[idx].TextureID)
|
||||
{
|
||||
if (!cache.Check(face.TextureID.ToString()))
|
||||
return false;
|
||||
if(wearableCache[idx].CacheId != cacheItems[i].CacheId)
|
||||
{
|
||||
wearableCache[idx].CacheId = cacheItems[i].CacheId;
|
||||
validDirtyBakes++;
|
||||
hits++;
|
||||
//assuming this can only happen if asset is in cache
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
wearableCache[idx].TextureAsset = null;
|
||||
if (cache != null)
|
||||
wearableCache[idx].TextureAsset = cache.GetCached(face.TextureID.ToString());
|
||||
|
||||
if (wearableCache[idx].TextureAsset != null)
|
||||
{
|
||||
wearableCache[idx].CacheId = cacheItems[i].CacheId;
|
||||
wearableCache[idx].TextureID = sp.Appearance.Texture.FaceTextures[idx].TextureID;
|
||||
validDirtyBakes++;
|
||||
hits++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
|
||||
return false;
|
||||
wearableCache[idx].CacheId = UUID.Zero;
|
||||
wearableCache[idx].TextureID = UUID.Zero;
|
||||
wearableCache[idx].TextureAsset = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
|
||||
sp.Appearance.WearableCacheItems = wearableCache;
|
||||
|
||||
// if we got a full set of baked textures save all in BakedTextureModule
|
||||
|
||||
if (validDirtyBakes == cacheItems.Length)
|
||||
{
|
||||
IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||
if (m_BakedTextureModule != null)
|
||||
{
|
||||
m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache");
|
||||
|
||||
WearableCacheItem[] toBakedModule = new WearableCacheItem[AvatarAppearance.BAKE_INDICES.Length];
|
||||
|
||||
for (int i = 0; i < cacheItems.Length; i++)
|
||||
{
|
||||
int idx = (int)cacheItems[i].TextureIndex;
|
||||
cacheItems[i].CacheId = wearableCache[idx].CacheId;
|
||||
cacheItems[i].TextureID = wearableCache[idx].TextureID;
|
||||
cacheItems[i].TextureAsset = wearableCache[idx].TextureAsset;
|
||||
}
|
||||
m_BakedTextureModule.Store(sp.UUID, cacheItems);
|
||||
}
|
||||
}
|
||||
|
||||
// debug
|
||||
for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++)
|
||||
{
|
||||
int j = AvatarAppearance.BAKE_INDICES[iter];
|
||||
m_log.Debug("[UpdateBCache] {" + iter + "/" +
|
||||
sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" +
|
||||
sp.Appearance.WearableCacheItems[j].CacheId + ", t-" +
|
||||
sp.Appearance.WearableCacheItems[j].TextureID);
|
||||
}
|
||||
|
||||
// If we only found default textures, then the appearance is not cached
|
||||
return (defonly ? false : true);
|
||||
}
|
||||
|
||||
// called when we get a new root avatar
|
||||
public bool ValidateBakedTextureCache(IScenePresence sp)
|
||||
{
|
||||
bool defonly = true; // are we only using default textures
|
||||
IAssetService cache = m_scene.AssetService;
|
||||
IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||
WearableCacheItem[] wearableCache = null;
|
||||
WearableCacheItem[] bakedModuleCache = null;
|
||||
|
||||
wearableCache = WearableCacheItem.GetDefaultCacheItem();
|
||||
|
||||
int hits = 0;
|
||||
// Cache wearable data for teleport.
|
||||
// Only makes sense if there's a bake module and a cache module
|
||||
if (bakedModule != null && cache != null)
|
||||
{
|
||||
m_log.Debug("[ValidateBakedCache] calling bakedModule");
|
||||
try
|
||||
{
|
||||
bakedModuleCache = bakedModule.Get(sp.UUID);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
bakedModuleCache = null;
|
||||
}
|
||||
|
||||
if (bakedModuleCache != null)
|
||||
{
|
||||
m_log.Debug("[ValidateBakedCache] got bakedModule cache " + bakedModuleCache.Length);
|
||||
|
||||
for (int i = 0; i < bakedModuleCache.Length; i++)
|
||||
{
|
||||
int j = (int)bakedModuleCache[i].TextureIndex;
|
||||
|
||||
if (bakedModuleCache[i].TextureAsset != null)
|
||||
{
|
||||
wearableCache[j].TextureID = bakedModuleCache[i].TextureID;
|
||||
wearableCache[j].CacheId = bakedModuleCache[i].CacheId;
|
||||
wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset;
|
||||
bakedModuleCache[i].TextureAsset.Temporary = true;
|
||||
bakedModuleCache[i].TextureAsset.Local = true;
|
||||
cache.Store(bakedModuleCache[i].TextureAsset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process the baked textures
|
||||
for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
|
||||
{
|
||||
int idx = AvatarAppearance.BAKE_INDICES[i];
|
||||
Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
|
||||
|
||||
// No face, so lets check our cache
|
||||
if (face == null || face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
|
||||
{
|
||||
sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint)idx);
|
||||
if (wearableCache[idx].TextureID != UUID.Zero)
|
||||
{
|
||||
sp.Appearance.Texture.FaceTextures[idx].TextureID = wearableCache[idx].TextureID;
|
||||
face = sp.Appearance.Texture.FaceTextures[idx];
|
||||
// let run to end of loop to check cache
|
||||
}
|
||||
else
|
||||
{
|
||||
sp.Appearance.Texture.FaceTextures[idx].TextureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE;
|
||||
face = sp.Appearance.Texture.FaceTextures[idx];
|
||||
// lets try not invalidating the cache entry
|
||||
// wearableCache[idx].CacheId = UUID.Zero;
|
||||
// wearableCache[idx].TextureAsset = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
|
||||
{
|
||||
defonly = false; // found a non-default texture reference
|
||||
continue;
|
||||
}
|
||||
|
||||
if(wearableCache[idx].TextureID != face.TextureID)
|
||||
{
|
||||
wearableCache[idx].CacheId = UUID.Zero;
|
||||
wearableCache[idx].TextureID = UUID.Zero;
|
||||
wearableCache[idx].TextureAsset = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
wearableCache[idx].TextureAsset = null;
|
||||
if (cache != null)
|
||||
{
|
||||
wearableCache[idx].TextureAsset = m_scene.AssetService.Get(face.TextureID.ToString());
|
||||
if (wearableCache[idx].TextureAsset == null)
|
||||
{
|
||||
wearableCache[idx].CacheId = UUID.Zero;
|
||||
wearableCache[idx].TextureID = UUID.Zero;
|
||||
}
|
||||
else
|
||||
hits++;
|
||||
}
|
||||
}
|
||||
|
||||
sp.Appearance.WearableCacheItems = wearableCache;
|
||||
|
||||
m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1} {2} {3}", sp.Name, sp.UUID, hits, defonly.ToString());
|
||||
// debug
|
||||
for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++)
|
||||
{
|
||||
int j = AvatarAppearance.BAKE_INDICES[iter];
|
||||
m_log.Debug("[ValidateBakedCache] {" + iter + "/" +
|
||||
sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" +
|
||||
sp.Appearance.WearableCacheItems[j].CacheId + ", t-" +
|
||||
sp.Appearance.WearableCacheItems[j].TextureID);
|
||||
}
|
||||
|
||||
// If we only found default textures, then the appearance is not cached
|
||||
return (defonly ? false : true);
|
||||
}
|
||||
public int RequestRebake(IScenePresence sp, bool missingTexturesOnly)
|
||||
{
|
||||
int texturesRebaked = 0;
|
||||
|
@ -506,14 +614,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
if (face == null)
|
||||
continue;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
|
||||
// face.TextureID, idx, client.Name, client.AgentId);
|
||||
|
||||
// if the texture is one of the "defaults" then skip it
|
||||
// this should probably be more intelligent (skirt texture doesnt matter
|
||||
// if the avatar isnt wearing a skirt) but if any of the main baked
|
||||
// textures is default then the rest should be as well
|
||||
if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1032,16 +1032,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
// object itself before we rez.
|
||||
//
|
||||
// Only do these for the first object if we are rezzing a coalescence.
|
||||
if (i == 0)
|
||||
// nahh dont mess with coalescence objects,
|
||||
// the name in inventory can be change for inventory purpuses only
|
||||
if (objlist.Count == 1)
|
||||
{
|
||||
rootPart.Name = item.Name;
|
||||
rootPart.Description = item.Description;
|
||||
}
|
||||
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0)
|
||||
{
|
||||
rootPart.ObjectSaleType = item.SaleType;
|
||||
rootPart.SalePrice = item.SalePrice;
|
||||
}
|
||||
}
|
||||
|
||||
so.FromFolderID = item.Folder;
|
||||
|
||||
|
|
|
@ -1234,8 +1234,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
uint perms = taskItem.CurrentPermissions;
|
||||
PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
|
||||
agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions;
|
||||
// agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
|
||||
// agentItem.CurrentPermissions = agentItem.BasePermissions;
|
||||
agentItem.CurrentPermissions = perms | (uint)PermissionMask.Move;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -917,12 +917,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// in the serialization, transfer the correct name from the inventory to the
|
||||
// object itself before we rez.
|
||||
// Only do these for the first object if we are rezzing a coalescence.
|
||||
if (i == 0)
|
||||
// nahh dont mess with coalescence objects,
|
||||
// the name in inventory can be change for inventory purpuses only
|
||||
if (objlist.Count == 1)
|
||||
{
|
||||
rootPart.Name = item.Name;
|
||||
rootPart.Description = item.Description;
|
||||
}
|
||||
|
||||
/* reverted to old code till part.ApplyPermissionsOnRez is better reviewed/fixed
|
||||
group.SetGroup(m_part.GroupID, null);
|
||||
|
||||
foreach (SceneObjectPart part in group.Parts)
|
||||
|
@ -938,7 +940,49 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
part.ApplyPermissionsOnRez(dest, false, m_part.ParentGroup.Scene);
|
||||
}
|
||||
*/
|
||||
// old code start
|
||||
SceneObjectPart[] partList = group.Parts;
|
||||
|
||||
group.SetGroup(m_part.GroupID, null);
|
||||
|
||||
// TODO: Remove magic number badness
|
||||
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
|
||||
{
|
||||
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryonePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
}
|
||||
|
||||
group.ApplyNextOwnerPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
// TODO: Remove magic number badness
|
||||
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.OwnerID;
|
||||
part.Inventory.ChangeInventoryOwner(item.OwnerID);
|
||||
}
|
||||
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
||||
part.EveryoneMask = item.EveryonePermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
||||
part.GroupMask = item.GroupPermissions;
|
||||
}
|
||||
// old code end
|
||||
rootPart.TrimPermissions();
|
||||
}
|
||||
|
||||
|
|
|
@ -3369,11 +3369,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void SendTerseUpdateToAgentClient(ScenePresence p)
|
||||
{
|
||||
// messy checks because a client doesn't know what presence it belongs too
|
||||
|
||||
IClientAPI remoteClient = p.ControllingClient;
|
||||
if (remoteClient == null)
|
||||
return;
|
||||
|
||||
if (!remoteClient.IsActive)
|
||||
return;
|
||||
|
@ -3381,7 +3377,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && p.GodLevel < 200)
|
||||
return;
|
||||
|
||||
|
||||
//m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
|
||||
remoteClient.SendEntityUpdate(
|
||||
this,
|
||||
|
@ -3507,7 +3502,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// If we aren't using a cached appearance, then clear out the baked textures
|
||||
if (!cachedappearance)
|
||||
{
|
||||
Appearance.ResetAppearance();
|
||||
// Appearance.ResetAppearance();
|
||||
// save what ????
|
||||
// maybe needed so the tryretry repair works?
|
||||
if (m_scene.AvatarFactory != null)
|
||||
|
@ -3530,7 +3525,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// send even grays
|
||||
if (cachedappearance)
|
||||
{
|
||||
m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name);
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name);
|
||||
// If the avatars baked textures are all in the cache, then we have a
|
||||
// complete appearance... send it out, if not, then we'll send it when
|
||||
// the avatar finishes updating its appearance
|
||||
|
|
Loading…
Reference in New Issue