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

View File

@ -4451,8 +4451,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (bl[i].BannedUserID == UUID.Zero)
continue;
BannedUsers.Add(bl[i].BannedUserID);
}
if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0))
{
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
packet.AgentData.TransactionID = UUID.Random();
packet.AgentData.AgentID = AgentId;
@ -4462,11 +4463,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
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(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
@ -4480,8 +4482,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
returnblock[j].Parameter = banned.GetBytes(); j++;
}
packet.ParamList = returnblock;
packet.Header.Reliable = false;
packet.Header.Reliable = true;
OutPacket(packet, ThrottleOutPacketType.Task);
BannedUsers.Clear();
}
}
}
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,
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
// them.
if (ReuseTextures)
@ -207,14 +219,27 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
updater.Url = "Local image";
updater.Disp = disp;
object reusableTextureUUID = null;
object objReusableTextureUUID = null;
if (ReuseTextures)
reusableTextureUUID
= m_reuseableDynamicTextures.Get(GenerateReusableTextureKey(data, extraParams));
if (ReuseTextures && !updater.BlendWithOldTexture)
{
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.
if (reusableTextureUUID == null || updater.BlendWithOldTexture)
if (objReusableTextureUUID == null)
{
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
// apppears to be implemented anyway.
if (RegisteredScenes.ContainsKey(updater.SimUUID))
{
SceneObjectPart part = RegisteredScenes[updater.SimUUID].GetSceneObjectPart(updater.PrimID);
if (part != null)
updater.UpdatePart(part, (UUID)reusableTextureUUID);
}
updater.UpdatePart(part, (UUID)objReusableTextureUUID);
}
return updater.UpdaterID;
}
return UUID.Zero;
}
private string GenerateReusableTextureKey(string data, string 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)
{
IConfig texturesConfig = config.Configs["Textures"];
if (texturesConfig != null)
ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false);
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
{
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
@ -276,7 +296,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
public void PostInitialise()
{
// ReuseTextures = true;
if (ReuseTextures)
{
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);

View File

@ -46,9 +46,38 @@ namespace OpenSim.Region.Framework.Interfaces
/// </summary>
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);
/// <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);
/// <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);
/// <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 LookupScriptInvocation(string fname);

View File

@ -130,13 +130,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
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)
{
MethodInfo mi = target.GetType().GetMethod(meth,
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
MethodInfo mi = GetMethodInfoFromType(target.GetType(), meth, true);
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);
return;
}
@ -151,10 +163,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
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;
var typeArgs = mi.GetParameters()
List<Type> typeArgs = mi.GetParameters()
.Select(p => p.ParameterType)
.ToList();
@ -168,22 +180,38 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
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)
{
ParameterInfo[] parameters = fcall.Method.GetParameters ();
ParameterInfo[] parameters = fcall.Method.GetParameters();
if (parameters.Length < 2) // Must have two UUID params
return;
// Hide the first two parameters
Type[] parmTypes = new Type[parameters.Length - 2];
for (int i = 2 ; i < parameters.Length ; i++)
for (int i = 2; i < parameters.Length; i++)
parmTypes[i - 2] = parameters[i].ParameterType;
m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType);
}
}
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()
{
List<Delegate> ret = new List<Delegate>();

View File

@ -247,7 +247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
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>();
ret.Add(part);

View File

@ -693,6 +693,17 @@
;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]
; ##
; ## Physics stats settings