From d2499c4c314b290c42f454913305d97c6eec92d6 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 7 Dec 2012 15:54:46 +0000
Subject: *TEST* Use new avatar size in ubitODE.
---
.../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 8496005..d557a28 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -174,12 +174,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// 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
--
cgit v1.1
From 93bede4e6aa0838e14f39f5e641b028267d2683c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 7 Dec 2012 21:26:58 +0000
Subject: revert the use of avatar skeleton and use avatar size provided by
viewers, since at least for now seems good enought
---
.../Avatar/AvatarFactory/AvatarFactoryModule.cs | 31 ++++++++++++++++------
1 file changed, 23 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index d557a28..4c42397 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -145,6 +145,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
SetAppearance(sp, appearance.Texture, appearance.VisualParams);
}
+
+ public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize)
+ {
+ float oldoff = sp.Appearance.AvatarFeetOffset;
+ Vector3 oldbox = sp.Appearance.AvatarBoxSize;
+
+ SetAppearance(sp, textureEntry, visualParams);
+ sp.Appearance.SetSize(avSize);
+
+ float off = sp.Appearance.AvatarFeetOffset;
+ Vector3 box = sp.Appearance.AvatarBoxSize;
+ if (oldoff != off || oldbox != box)
+ ((ScenePresence)sp).SetSize(box, off);
+ }
+
///
/// Set appearance data (texture asset IDs and slider settings)
///
@@ -181,13 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
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;
+// 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);
+// float off = sp.Appearance.AvatarFeetOffset;
+// Vector3 box = sp.Appearance.AvatarBoxSize;
+// if(oldoff != off || oldbox != box)
+// ((ScenePresence)sp).SetSize(box,off);
}
@@ -620,12 +635,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
///
///
///
- private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams)
+ private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize)
{
// m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId);
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
if (sp != null)
- SetAppearance(sp, textureEntry, visualParams);
+ SetAppearance(sp, textureEntry, visualParams,avSize);
else
m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId);
}
--
cgit v1.1
From 20773dcfccc04d8af14e27f87746711bfaba07b1 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 13 Dec 2012 02:55:36 +0000
Subject: add a Check method to flotsamAssetCache, so to check if a asset is in
cache without actually loading it. Make use limited use of it in
avatarfactory textures check. Also on llclientview HandleAgentTextureCached
that now should work. Other asset cache modules for now will return false, so
are broken. baked textures logic still unchanged. *UNTESTED*
---
.../Region/CoreModules/Asset/CenomeAssetCache.cs | 6 ++
OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | 4 ++
.../Region/CoreModules/Asset/FlotsamAssetCache.cs | 75 ++++++++++++++++++++++
.../CoreModules/Asset/GlynnTuckerAssetCache.cs | 5 ++
.../Avatar/AvatarFactory/AvatarFactoryModule.cs | 51 +++++++++++----
5 files changed, 128 insertions(+), 13 deletions(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index e40caec..f43305f 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -194,6 +194,12 @@ namespace OpenSim.Region.CoreModules.Asset
#region IImprovedAssetCache Members
+
+ public bool Check(string id)
+ {
+ return false;
+ }
+
///
/// Cache asset.
///
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
index 9742a5c..58ce61a 100644
--- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
@@ -112,6 +112,10 @@ namespace OpenSim.Region.CoreModules.Asset
////////////////////////////////////////////////////////////
// IImprovedAssetCache
//
+ public bool Check(string id)
+ {
+ return false;
+ }
public void Cache(AssetBase asset)
{
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index b1bb56b..a0f1e8c 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -348,6 +348,17 @@ namespace OpenSim.Region.CoreModules.Asset
return asset;
}
+ private bool CheckFromMemoryCache(string id)
+ {
+ AssetBase asset = null;
+
+ if (m_MemoryCache.TryGetValue(id, out asset))
+ return true;
+
+ return false;
+ }
+
+
///
/// Try to get an asset from the file cache.
///
@@ -420,6 +431,50 @@ namespace OpenSim.Region.CoreModules.Asset
return asset;
}
+ private bool CheckFromFileCache(string id)
+ {
+ bool found = false;
+
+ string filename = GetFileName(id);
+ if (File.Exists(filename))
+ {
+ // actually check if we can open it, and so update expire
+ FileStream stream = null;
+ try
+ {
+ stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
+ if (stream != null)
+ {
+ found = true;
+ stream.Close();
+ }
+
+ }
+ catch (System.Runtime.Serialization.SerializationException e)
+ {
+ found = false;
+ m_log.ErrorFormat(
+ "[FLOTSAM ASSET CACHE]: Failed to check file {0} for asset {1}. Exception {2} {3}",
+ filename, id, e.Message, e.StackTrace);
+
+ // If there was a problem deserializing the asset, the asset may
+ // either be corrupted OR was serialized under an old format
+ // {different version of AssetBase} -- we should attempt to
+ // delete it and re-cache
+ File.Delete(filename);
+ }
+ catch (Exception e)
+ {
+ found = false;
+ m_log.ErrorFormat(
+ "[FLOTSAM ASSET CACHE]: Failed to check file {0} for asset {1}. Exception {2} {3}",
+ filename, id, e.Message, e.StackTrace);
+ }
+ }
+
+ return found;
+ }
+
public AssetBase Get(string id)
{
m_Requests++;
@@ -456,11 +511,26 @@ namespace OpenSim.Region.CoreModules.Asset
return asset;
}
+ public bool Check(string id)
+ {
+ if (m_MemoryCacheEnabled && CheckFromMemoryCache(id))
+ return true;
+
+ if (m_FileCacheEnabled && CheckFromFileCache(id))
+ return true;
+ return false;
+ }
+
public AssetBase GetCached(string id)
{
return Get(id);
}
+ public AssetBase CheckCached(string id)
+ {
+ return Get(id);
+ }
+
public void Expire(string id)
{
if (m_LogLevel >= 2)
@@ -941,6 +1011,11 @@ namespace OpenSim.Region.CoreModules.Asset
return asset.Data;
}
+ public bool CheckData(string id)
+ {
+ return Check(id); ;
+ }
+
public bool Get(string id, object sender, AssetRetrieved handler)
{
AssetBase asset = Get(id);
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index 9592ca0..ce9b546 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -115,6 +115,11 @@ namespace OpenSim.Region.CoreModules.Asset
// IImprovedAssetCache
//
+ public bool Check(string id)
+ {
+ return false;
+ }
+
public void Cache(AssetBase asset)
{
if (asset != null)
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 4c42397..3532b1d 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -361,6 +361,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
public bool ValidateBakedTextureCache(IScenePresence sp)
{
bool defonly = true; // are we only using default textures
+ IImprovedAssetCache cache = m_scene.RequestModuleInterface();
// Process the texture entry
for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
@@ -385,8 +386,16 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
defonly = false; // found a non-default texture reference
- if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
- return false;
+ if (cache != null)
+ {
+ if (!cache.Check(face.TextureID.ToString()))
+ return false;
+ }
+ else
+ {
+ if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
+ return false;
+ }
}
// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
@@ -398,6 +407,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
public int RequestRebake(IScenePresence sp, bool missingTexturesOnly)
{
int texturesRebaked = 0;
+ IImprovedAssetCache cache = m_scene.RequestModuleInterface();
for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
{
@@ -421,21 +431,36 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
if (missingTexturesOnly)
{
- if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
+ if (cache != null)
{
- continue;
+ if (cache.Check(face.TextureID.ToString()))
+ continue;
+ else
+ {
+ m_log.DebugFormat(
+ "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
+ face.TextureID, idx, sp.Name);
+ }
}
else
{
- // On inter-simulator teleports, this occurs if baked textures are not being stored by the
- // grid asset service (which means that they are not available to the new region and so have
- // to be re-requested from the client).
- //
- // The only available core OpenSimulator behaviour right now
- // is not to store these textures, temporarily or otherwise.
- m_log.DebugFormat(
- "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
- face.TextureID, idx, sp.Name);
+ if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
+ {
+ continue;
+ }
+
+ else
+ {
+ // On inter-simulator teleports, this occurs if baked textures are not being stored by the
+ // grid asset service (which means that they are not available to the new region and so have
+ // to be re-requested from the client).
+ //
+ // The only available core OpenSimulator behaviour right now
+ // is not to store these textures, temporarily or otherwise.
+ m_log.DebugFormat(
+ "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
+ face.TextureID, idx, sp.Name);
+ }
}
}
else
--
cgit v1.1