Merge branch 'master' of /home/opensim/var/repo/opensim

integration
BlueWall 2012-08-31 12:29:21 -04:00
commit d343ecfa82
7 changed files with 424 additions and 311 deletions

View File

@ -719,6 +719,8 @@ namespace OpenSim.Data.MySQL
RegionLightShareData nWP = new RegionLightShareData(); RegionLightShareData nWP = new RegionLightShareData();
nWP.OnSave += StoreRegionWindlightSettings; nWP.OnSave += StoreRegionWindlightSettings;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
dbcon.Open(); dbcon.Open();
@ -808,6 +810,8 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
}
return nWP; return nWP;
} }
@ -852,6 +856,8 @@ namespace OpenSim.Data.MySQL
} }
public void StoreRegionWindlightSettings(RegionLightShareData wl) public void StoreRegionWindlightSettings(RegionLightShareData wl)
{
lock (m_dbLock)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
@ -953,8 +959,11 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
}
public void RemoveRegionWindlightSettings(UUID regionID) public void RemoveRegionWindlightSettings(UUID regionID)
{
lock (m_dbLock)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
@ -968,9 +977,12 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
}
#region RegionEnvironmentSettings #region RegionEnvironmentSettings
public string LoadRegionEnvironmentSettings(UUID regionUUID) public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
lock (m_dbLock)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
@ -996,8 +1008,11 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
}
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
{
lock (m_dbLock)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
@ -1014,8 +1029,11 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
}
public void RemoveRegionEnvironmentSettings(UUID regionUUID) public void RemoveRegionEnvironmentSettings(UUID regionUUID)
{
lock (m_dbLock)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
@ -1029,6 +1047,7 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
}
#endregion #endregion
public void StoreRegionSettings(RegionSettings rs) public void StoreRegionSettings(RegionSettings rs)

View File

@ -4451,8 +4451,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (bl[i].BannedUserID == UUID.Zero) if (bl[i].BannedUserID == UUID.Zero)
continue; continue;
BannedUsers.Add(bl[i].BannedUserID); BannedUsers.Add(bl[i].BannedUserID);
}
if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0))
{
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
packet.AgentData.TransactionID = UUID.Random(); packet.AgentData.TransactionID = UUID.Random();
packet.AgentData.AgentID = AgentId; packet.AgentData.AgentID = AgentId;
@ -4462,11 +4463,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count];
for (int i = 0; i < (6 + BannedUsers.Count); i++) int j;
for (j = 0; j < (6 + BannedUsers.Count); j++)
{ {
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock();
} }
int j = 0; j = 0;
returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
@ -4480,8 +4482,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
returnblock[j].Parameter = banned.GetBytes(); j++; returnblock[j].Parameter = banned.GetBytes(); j++;
} }
packet.ParamList = returnblock; packet.ParamList = returnblock;
packet.Header.Reliable = false; packet.Header.Reliable = true;
OutPacket(packet, ThrottleOutPacketType.Task); OutPacket(packet, ThrottleOutPacketType.Task);
BannedUsers.Clear();
}
}
} }
public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)

View File

@ -186,8 +186,20 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face) string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face)
{ {
if (RenderPlugins.ContainsKey(contentType)) if (!RenderPlugins.ContainsKey(contentType))
{ return UUID.Zero;
Scene scene;
RegisteredScenes.TryGetValue(simID, out scene);
if (scene == null)
return UUID.Zero;
SceneObjectPart part = scene.GetSceneObjectPart(primID);
if (part == null)
return UUID.Zero;
// If we want to reuse dynamic textures then we have to ignore any request from the caller to expire // If we want to reuse dynamic textures then we have to ignore any request from the caller to expire
// them. // them.
if (ReuseTextures) if (ReuseTextures)
@ -207,14 +219,27 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
updater.Url = "Local image"; updater.Url = "Local image";
updater.Disp = disp; updater.Disp = disp;
object reusableTextureUUID = null; object objReusableTextureUUID = null;
if (ReuseTextures) if (ReuseTextures && !updater.BlendWithOldTexture)
reusableTextureUUID {
= m_reuseableDynamicTextures.Get(GenerateReusableTextureKey(data, extraParams)); string reuseableTextureKey = GenerateReusableTextureKey(data, extraParams);
objReusableTextureUUID = m_reuseableDynamicTextures.Get(reuseableTextureKey);
if (objReusableTextureUUID != null)
{
// If something else has removed this temporary asset from the cache, detect and invalidate
// our cached uuid.
if (scene.AssetService.GetMetadata(objReusableTextureUUID.ToString()) == null)
{
m_reuseableDynamicTextures.Invalidate(reuseableTextureKey);
objReusableTextureUUID = null;
}
}
}
// We cannot reuse a dynamic texture if the data is going to be blended with something already there. // We cannot reuse a dynamic texture if the data is going to be blended with something already there.
if (reusableTextureUUID == null || updater.BlendWithOldTexture) if (objReusableTextureUUID == null)
{ {
lock (Updaters) lock (Updaters)
{ {
@ -230,21 +255,12 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
{ {
// No need to add to updaters as the texture is always the same. Not that this functionality // No need to add to updaters as the texture is always the same. Not that this functionality
// apppears to be implemented anyway. // apppears to be implemented anyway.
if (RegisteredScenes.ContainsKey(updater.SimUUID)) updater.UpdatePart(part, (UUID)objReusableTextureUUID);
{
SceneObjectPart part = RegisteredScenes[updater.SimUUID].GetSceneObjectPart(updater.PrimID);
if (part != null)
updater.UpdatePart(part, (UUID)reusableTextureUUID);
}
} }
return updater.UpdaterID; return updater.UpdaterID;
} }
return UUID.Zero;
}
private string GenerateReusableTextureKey(string data, string extraParams) private string GenerateReusableTextureKey(string data, string extraParams)
{ {
return string.Format("{0}{1}", data, extraParams); return string.Format("{0}{1}", data, extraParams);
@ -267,6 +283,10 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
public void Initialise(Scene scene, IConfigSource config) public void Initialise(Scene scene, IConfigSource config)
{ {
IConfig texturesConfig = config.Configs["Textures"];
if (texturesConfig != null)
ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false);
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
{ {
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
@ -276,7 +296,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
public void PostInitialise() public void PostInitialise()
{ {
// ReuseTextures = true;
if (ReuseTextures) if (ReuseTextures)
{ {
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);

View File

@ -46,9 +46,38 @@ namespace OpenSim.Region.Framework.Interfaces
/// </summary> /// </summary>
event ScriptCommand OnScriptCommand; event ScriptCommand OnScriptCommand;
/// <summary>
/// Register an instance method as a script call by method name
/// </summary>
/// <param name="target"></param>
/// <param name="method"></param>
void RegisterScriptInvocation(object target, string method); void RegisterScriptInvocation(object target, string method);
/// <summary>
/// Register a static or instance method as a script call by method info
/// </summary>
/// <param name="target">If target is a Type object, will assume method is static.</param>
/// <param name="method"></param>
void RegisterScriptInvocation(object target, MethodInfo method); void RegisterScriptInvocation(object target, MethodInfo method);
/// <summary>
/// Register one or more instance methods as script calls by method name
/// </summary>
/// <param name="target"></param>
/// <param name="methods"></param>
void RegisterScriptInvocation(object target, string[] methods); void RegisterScriptInvocation(object target, string[] methods);
/// <summary>
/// Register one or more static methods as script calls by method name
/// </summary>
/// <param name="target"></param>
/// <param name="methods"></param>
void RegisterScriptInvocation(Type target, string[] methods);
/// <summary>
/// Returns an array of all registered script calls
/// </summary>
/// <returns></returns>
Delegate[] GetScriptInvocationList(); Delegate[] GetScriptInvocationList();
Delegate LookupScriptInvocation(string fname); Delegate LookupScriptInvocation(string fname);

View File

@ -130,10 +130,22 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
m_scriptModule.PostScriptEvent(script, "link_message", args); m_scriptModule.PostScriptEvent(script, "link_message", args);
} }
private static MethodInfo GetMethodInfoFromType(Type target, string meth, bool searchInstanceMethods)
{
BindingFlags getMethodFlags =
BindingFlags.NonPublic | BindingFlags.Public;
if (searchInstanceMethods)
getMethodFlags |= BindingFlags.Instance;
else
getMethodFlags |= BindingFlags.Static;
return target.GetMethod(meth, getMethodFlags);
}
public void RegisterScriptInvocation(object target, string meth) public void RegisterScriptInvocation(object target, string meth)
{ {
MethodInfo mi = target.GetType().GetMethod(meth, MethodInfo mi = GetMethodInfoFromType(target.GetType(), meth, true);
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
if (mi == null) if (mi == null)
{ {
m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", meth); m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", meth);
@ -151,10 +163,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
public void RegisterScriptInvocation(object target, MethodInfo mi) public void RegisterScriptInvocation(object target, MethodInfo mi)
{ {
m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, target.GetType().Name); m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, (target is Type) ? ((Type)target).Name : target.GetType().Name);
Type delegateType; Type delegateType;
var typeArgs = mi.GetParameters() List<Type> typeArgs = mi.GetParameters()
.Select(p => p.ParameterType) .Select(p => p.ParameterType)
.ToList(); .ToList();
@ -168,7 +180,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
delegateType = Expression.GetFuncType(typeArgs.ToArray()); delegateType = Expression.GetFuncType(typeArgs.ToArray());
} }
Delegate fcall = Delegate.CreateDelegate(delegateType, target, mi); Delegate fcall;
if (!(target is Type))
fcall = Delegate.CreateDelegate(delegateType, target, mi);
else
fcall = Delegate.CreateDelegate(delegateType, (Type)target, mi.Name);
lock (m_scriptInvocation) lock (m_scriptInvocation)
{ {
@ -184,6 +200,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
} }
} }
public void RegisterScriptInvocation(Type target, string[] methods)
{
foreach (string method in methods)
{
MethodInfo mi = GetMethodInfoFromType(target, method, false);
if (mi == null)
m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", method);
else
RegisterScriptInvocation(target, mi);
}
}
public Delegate[] GetScriptInvocationList() public Delegate[] GetScriptInvocationList()
{ {
List<Delegate> ret = new List<Delegate>(); List<Delegate> ret = new List<Delegate>();

View File

@ -247,7 +247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return GetLinkParts(m_host, linkType); return GetLinkParts(m_host, linkType);
} }
private List<SceneObjectPart> GetLinkParts(SceneObjectPart part, int linkType) public static List<SceneObjectPart> GetLinkParts(SceneObjectPart part, int linkType)
{ {
List<SceneObjectPart> ret = new List<SceneObjectPart>(); List<SceneObjectPart> ret = new List<SceneObjectPart>();
ret.Add(part); ret.Add(part);

View File

@ -693,6 +693,17 @@
;LevelUpload = 0 ;LevelUpload = 0
[Textures]
; If true, textures generated dynamically (i.e. through osSetDynamicTextureData() and similar OSSL functions) are reused where possible
; Chiefly, reuse occurs if a texture has already been generated with identical data and settings, and that texture contains no dynamic components
; (e.g. images pulled from an external HTTP address).
; Reusing previously generated textures results in a much faster update on the viewer but may cause issues if the viewer didn't receive all resolutions of the texture.
; Currently, it will also increase asset cache use since temporary dynamic textures are no longer deleted.
; Hence, currently considered experimental.
; Default is false.
ReuseDynamicTextures = false
[ODEPhysicsSettings] [ODEPhysicsSettings]
; ## ; ##
; ## Physics stats settings ; ## Physics stats settings