Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
4cb4c9fb25
|
@ -199,6 +199,8 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
|
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
|
||||||
public void StoreAsset(AssetBase asset)
|
public void StoreAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[XASSETS DB]: Storing asset {0} {1}", asset.Name, asset.ID);
|
||||||
|
|
||||||
lock (m_dbLock)
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
|
@ -1021,15 +1021,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public event TeleportFail OnTeleportFail;
|
public event TeleportFail OnTeleportFail;
|
||||||
|
|
||||||
public delegate void GatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids);
|
// public delegate void GatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids);
|
||||||
|
//
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Triggered when UUIDs referenced by a scene object are being gathered for archiving, hg transfer, etc.
|
// /// Triggered when UUIDs referenced by a scene object are being gathered for archiving, hg transfer, etc.
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <remarks>
|
// /// <remarks>
|
||||||
/// The listener should add references to the IDictionary<UUID, AssetType> as appropriate.
|
// /// The listener should add references to the IDictionary<UUID, AssetType> as appropriate.
|
||||||
/// </remarks>
|
// /// </remarks>
|
||||||
public event GatherUuids OnGatherUuids;
|
// public event GatherUuids OnGatherUuids;
|
||||||
|
|
||||||
public class MoneyTransferArgs : EventArgs
|
public class MoneyTransferArgs : EventArgs
|
||||||
{
|
{
|
||||||
|
@ -3248,25 +3248,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TriggerGatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids)
|
// public void TriggerGatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids)
|
||||||
{
|
// {
|
||||||
GatherUuids handler = OnGatherUuids;
|
// GatherUuids handler = OnGatherUuids;
|
||||||
|
//
|
||||||
if (handler != null)
|
// if (handler != null)
|
||||||
{
|
// {
|
||||||
foreach (GatherUuids d in handler.GetInvocationList())
|
// foreach (GatherUuids d in handler.GetInvocationList())
|
||||||
{
|
// {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
d(sop, assetUuids);
|
// d(sop, assetUuids);
|
||||||
}
|
// }
|
||||||
catch (Exception e)
|
// catch (Exception e)
|
||||||
{
|
// {
|
||||||
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}",
|
// m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}",
|
||||||
e.Message, e.StackTrace);
|
// e.Message, e.StackTrace);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids);
|
GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids);
|
||||||
}
|
}
|
||||||
|
|
||||||
part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids);
|
// FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed
|
||||||
|
// to be called with scene objects that are in a scene (e.g. in the case of hg asset mapping and
|
||||||
|
// inventory transfer. There needs to be a way for a module to register a method without assuming a
|
||||||
|
// Scene.EventManager is present.
|
||||||
|
// part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids);
|
||||||
|
|
||||||
|
GatherMaterialsUuids(part, assetUuids);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -211,6 +217,69 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="part"></param>
|
||||||
|
/// <param name="assetUuids"></param>
|
||||||
|
public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids)
|
||||||
|
{
|
||||||
|
// scan thru the dynAttrs map of this part for any textures used as materials
|
||||||
|
OSD osdMaterials = null;
|
||||||
|
|
||||||
|
lock (part.DynAttrs)
|
||||||
|
{
|
||||||
|
if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
|
||||||
|
{
|
||||||
|
OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
|
||||||
|
materialsStore.TryGetValue("Materials", out osdMaterials);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (osdMaterials != null)
|
||||||
|
{
|
||||||
|
//m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
|
||||||
|
|
||||||
|
if (osdMaterials is OSDArray)
|
||||||
|
{
|
||||||
|
OSDArray matsArr = osdMaterials as OSDArray;
|
||||||
|
foreach (OSDMap matMap in matsArr)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (matMap.ContainsKey("Material"))
|
||||||
|
{
|
||||||
|
OSDMap mat = matMap["Material"] as OSDMap;
|
||||||
|
if (mat.ContainsKey("NormMap"))
|
||||||
|
{
|
||||||
|
UUID normalMapId = mat["NormMap"].AsUUID();
|
||||||
|
if (normalMapId != UUID.Zero)
|
||||||
|
{
|
||||||
|
assetUuids[normalMapId] = AssetType.Texture;
|
||||||
|
//m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mat.ContainsKey("SpecMap"))
|
||||||
|
{
|
||||||
|
UUID specularMapId = mat["SpecMap"].AsUUID();
|
||||||
|
if (specularMapId != UUID.Zero)
|
||||||
|
{
|
||||||
|
assetUuids[specularMapId] = AssetType.Texture;
|
||||||
|
//m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Warn("[UUID Gatherer]: exception getting materials: " + e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get an asset synchronously, potentially using an asynchronous callback. If the
|
/// Get an asset synchronously, potentially using an asynchronous callback. If the
|
||||||
/// asynchronous callback is used, we will wait for it to complete.
|
/// asynchronous callback is used, we will wait for it to complete.
|
||||||
|
|
|
@ -125,7 +125,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
||||||
m_scene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene;
|
m_scene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene;
|
||||||
m_scene.EventManager.OnGatherUuids += GatherMaterialsUuids;
|
// m_scene.EventManager.OnGatherUuids += GatherMaterialsUuids;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventManager_OnObjectAddedToScene(SceneObjectGroup obj)
|
void EventManager_OnObjectAddedToScene(SceneObjectGroup obj)
|
||||||
|
@ -161,7 +161,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
|
||||||
|
|
||||||
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
|
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
|
||||||
m_scene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene;
|
m_scene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene;
|
||||||
m_scene.EventManager.OnGatherUuids -= GatherMaterialsUuids;
|
// m_scene.EventManager.OnGatherUuids -= GatherMaterialsUuids;
|
||||||
|
|
||||||
m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
|
@ -591,70 +591,72 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
|
||||||
output.Flush();
|
output.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// FIXME: This code is currently still in UuidGatherer since we cannot use Scene.EventManager as some
|
||||||
/// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
|
// calls to the gatherer are done for objects with no scene.
|
||||||
/// </summary>
|
// /// <summary>
|
||||||
/// <param name="part"></param>
|
// /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
|
||||||
/// <param name="assetUuids"></param>
|
// /// </summary>
|
||||||
private void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids)
|
// /// <param name="part"></param>
|
||||||
{
|
// /// <param name="assetUuids"></param>
|
||||||
// scan thru the dynAttrs map of this part for any textures used as materials
|
// private void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids)
|
||||||
OSD osdMaterials = null;
|
// {
|
||||||
|
// // scan thru the dynAttrs map of this part for any textures used as materials
|
||||||
lock (part.DynAttrs)
|
// OSD osdMaterials = null;
|
||||||
{
|
//
|
||||||
if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
|
// lock (part.DynAttrs)
|
||||||
{
|
// {
|
||||||
OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
|
// if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
|
||||||
if (materialsStore == null)
|
// {
|
||||||
return;
|
// OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
|
||||||
|
// if (materialsStore == null)
|
||||||
materialsStore.TryGetValue("Materials", out osdMaterials);
|
// return;
|
||||||
}
|
//
|
||||||
|
// materialsStore.TryGetValue("Materials", out osdMaterials);
|
||||||
if (osdMaterials != null)
|
// }
|
||||||
{
|
//
|
||||||
//m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
|
// if (osdMaterials != null)
|
||||||
|
// {
|
||||||
if (osdMaterials is OSDArray)
|
// //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
|
||||||
{
|
//
|
||||||
OSDArray matsArr = osdMaterials as OSDArray;
|
// if (osdMaterials is OSDArray)
|
||||||
foreach (OSDMap matMap in matsArr)
|
// {
|
||||||
{
|
// OSDArray matsArr = osdMaterials as OSDArray;
|
||||||
try
|
// foreach (OSDMap matMap in matsArr)
|
||||||
{
|
// {
|
||||||
if (matMap.ContainsKey("Material"))
|
// try
|
||||||
{
|
// {
|
||||||
OSDMap mat = matMap["Material"] as OSDMap;
|
// if (matMap.ContainsKey("Material"))
|
||||||
if (mat.ContainsKey("NormMap"))
|
// {
|
||||||
{
|
// OSDMap mat = matMap["Material"] as OSDMap;
|
||||||
UUID normalMapId = mat["NormMap"].AsUUID();
|
// if (mat.ContainsKey("NormMap"))
|
||||||
if (normalMapId != UUID.Zero)
|
// {
|
||||||
{
|
// UUID normalMapId = mat["NormMap"].AsUUID();
|
||||||
assetUuids[normalMapId] = AssetType.Texture;
|
// if (normalMapId != UUID.Zero)
|
||||||
//m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString());
|
// {
|
||||||
}
|
// assetUuids[normalMapId] = AssetType.Texture;
|
||||||
}
|
// //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString());
|
||||||
if (mat.ContainsKey("SpecMap"))
|
// }
|
||||||
{
|
// }
|
||||||
UUID specularMapId = mat["SpecMap"].AsUUID();
|
// if (mat.ContainsKey("SpecMap"))
|
||||||
if (specularMapId != UUID.Zero)
|
// {
|
||||||
{
|
// UUID specularMapId = mat["SpecMap"].AsUUID();
|
||||||
assetUuids[specularMapId] = AssetType.Texture;
|
// if (specularMapId != UUID.Zero)
|
||||||
//m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString());
|
// {
|
||||||
}
|
// assetUuids[specularMapId] = AssetType.Texture;
|
||||||
}
|
// //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString());
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
}
|
// }
|
||||||
catch (Exception e)
|
//
|
||||||
{
|
// }
|
||||||
m_log.Warn("[MaterialsDemoModule]: exception getting materials: " + e.Message);
|
// catch (Exception e)
|
||||||
}
|
// {
|
||||||
}
|
// m_log.Warn("[MaterialsDemoModule]: exception getting materials: " + e.Message);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -119,16 +119,14 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
|
|
||||||
if (asset == null || asset.Data.Length == 0)
|
if (asset == null || asset.Data.Length == 0)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Asset not found");
|
MainConsole.Instance.OutputFormat("Could not find asset with ID {0}", args[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_AssetService.Delete(args[2]);
|
if (!m_AssetService.Delete(asset.ID))
|
||||||
|
MainConsole.Instance.OutputFormat("ERROR: Could not delete asset {0} {1}", asset.ID, asset.Name);
|
||||||
//MainConsole.Instance.Output("Asset deleted");
|
else
|
||||||
// TODO: Implement this
|
MainConsole.Instance.OutputFormat("Deleted asset {0} {1}", asset.ID, asset.Name);
|
||||||
|
|
||||||
MainConsole.Instance.Output("Asset deletion not supported by database");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleDumpAsset(string module, string[] args)
|
void HandleDumpAsset(string module, string[] args)
|
||||||
|
|
|
@ -205,15 +205,16 @@ namespace OpenSim.Services.AssetService
|
||||||
if (!UUID.TryParse(id, out assetID))
|
if (!UUID.TryParse(id, out assetID))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Don't bother deleting from a chained asset service. This isn't a big deal since deleting happens
|
if (HasChainedAssetService)
|
||||||
// very rarely.
|
m_ChainedAssetService.Delete(id);
|
||||||
|
|
||||||
return m_Database.Delete(id);
|
return m_Database.Delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MigrateFromChainedService(AssetBase asset)
|
private void MigrateFromChainedService(AssetBase asset)
|
||||||
{
|
{
|
||||||
Util.FireAndForget(o => { Store(asset); m_ChainedAssetService.Delete(asset.ID); });
|
Store(asset);
|
||||||
|
m_ChainedAssetService.Delete(asset.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue