Add Enabled switch in new [Attachments] section in OpenSimDefaults.ini to allow attachments to be temporarily turned off.

This is for debugging purposes.  Defaults to Attachments Enabled
remove-scene-viewer
Justin Clark-Casey (justincc) 2011-09-30 01:19:22 +01:00
parent 528fcede6c
commit e742cffe15
5 changed files with 65 additions and 6 deletions

View File

@ -5,7 +5,7 @@ for your effort!)
These folks represent the current core team for OpenSim, and are the These folks represent the current core team for OpenSim, and are the
people that make the day to day of OpenSim happen. people that make the day to day of OpenSim happen.
* justincc * justincc (OSVW Consulting, justincc.org)
* chi11ken (Genkii) * chi11ken (Genkii)
* dahlia * dahlia
* Melanie Thielker * Melanie Thielker
@ -15,6 +15,7 @@ people that make the day to day of OpenSim happen.
* Mic Bowman (Intel) * Mic Bowman (Intel)
* BlueWall (James Hughes) * BlueWall (James Hughes)
* Snoopy Pfeffer * Snoopy Pfeffer
* Richard Adams (Intel)
= Core Developers Following the White Rabbit = = Core Developers Following the White Rabbit =
Core developers who have temporarily (we hope) gone chasing the white rabbit. Core developers who have temporarily (we hope) gone chasing the white rabbit.
@ -119,6 +120,7 @@ what it is today.
* openlifegrid.com * openlifegrid.com
* Oren Hurvitz (Kitely) * Oren Hurvitz (Kitely)
* otakup0pe * otakup0pe
* Pixel Tomsen
* ralphos * ralphos
* RemedyTomm * RemedyTomm
* Revolution * Revolution

View File

@ -442,7 +442,7 @@ namespace OpenSim.Framework.Servers.HttpServer
string path = request.RawUrl; string path = request.RawUrl;
string handlerKey = GetHandlerKey(request.HttpMethod, path); string handlerKey = GetHandlerKey(request.HttpMethod, path);
//m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); // m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
if (TryGetStreamHandler(handlerKey, out requestHandler)) if (TryGetStreamHandler(handlerKey, out requestHandler))
{ {

View File

@ -49,24 +49,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
private Scene m_scene; private Scene m_scene;
private IDialogModule m_dialogModule; private IDialogModule m_dialogModule;
/// <summary>
/// Are attachments enabled?
/// </summary>
public bool Enabled { get; private set; }
public string Name { get { return "Attachments Module"; } } public string Name { get { return "Attachments Module"; } }
public Type ReplaceableInterface { get { return null; } } public Type ReplaceableInterface { get { return null; } }
public void Initialise(IConfigSource source) {} public void Initialise(IConfigSource source)
{
IConfig config = source.Configs["Attachments"];
if (config != null)
Enabled = config.GetBoolean("Enabled", true);
else
Enabled = true;
}
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
m_scene.RegisterModuleInterface<IAttachmentsModule>(this); m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
if (Enabled)
m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
// TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
m_scene.UnregisterModuleInterface<IAttachmentsModule>(this); m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
if (Enabled)
m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
} }
public void RegionLoaded(Scene scene) {} public void RegionLoaded(Scene scene) {}
@ -102,6 +119,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
/// </summary> /// </summary>
public void RezAttachments(IScenePresence sp) public void RezAttachments(IScenePresence sp)
{ {
if (!Enabled)
return;
if (null == sp.Appearance) if (null == sp.Appearance)
{ {
m_log.WarnFormat("[ATTACHMENTS MODULE]: Appearance has not been initialized for agent {0}", sp.UUID); m_log.WarnFormat("[ATTACHMENTS MODULE]: Appearance has not been initialized for agent {0}", sp.UUID);
@ -145,6 +165,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{ {
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
if (!Enabled)
return;
foreach (SceneObjectGroup grp in sp.GetAttachments()) foreach (SceneObjectGroup grp in sp.GetAttachments())
{ {
// if (grp.HasGroupChanged) // Resizer scripts? // if (grp.HasGroupChanged) // Resizer scripts?
@ -163,6 +186,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", // "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}",
// m_scene.RegionInfo.RegionName, sp.Name, silent); // m_scene.RegionInfo.RegionName, sp.Name, silent);
if (!Enabled)
return;
foreach (SceneObjectGroup sop in sp.GetAttachments()) foreach (SceneObjectGroup sop in sp.GetAttachments())
{ {
sop.Scene.DeleteSceneObject(sop, silent); sop.Scene.DeleteSceneObject(sop, silent);
@ -184,6 +210,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", // "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})",
// objectLocalID, remoteClient.Name, AttachmentPt, silent); // objectLocalID, remoteClient.Name, AttachmentPt, silent);
if (!Enabled)
return;
try try
{ {
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
@ -232,6 +261,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent) public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent)
{ {
if (!Enabled)
return false;
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
if (sp == null) if (sp == null)
@ -331,6 +363,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
{ {
if (!Enabled)
return;
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
if (sp == null) if (sp == null)
@ -354,6 +389,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{ {
if (!Enabled)
return null;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", // "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}",
// (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); // (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name);
@ -373,6 +411,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt) public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt)
{ {
if (!Enabled)
return null;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2}", // "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2}",
// (AttachmentPoint)AttachmentPt, itemID, sp.Name); // (AttachmentPoint)AttachmentPt, itemID, sp.Name);
@ -535,6 +576,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
{ {
if (!Enabled)
return;
ScenePresence presence; ScenePresence presence;
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
{ {
@ -554,6 +598,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient) public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient)
{ {
if (!Enabled)
return;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", // "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}",
// remoteClient.Name, soLocalId); // remoteClient.Name, soLocalId);
@ -669,6 +716,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos) public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos)
{ {
if (!Enabled)
return;
// First we save the // First we save the
// attachment point information, then we update the relative // attachment point information, then we update the relative
// positioning. Then we have to mark the object as NOT an // positioning. Then we have to mark the object as NOT an

View File

@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{ {
if (!m_Enabled) if (!m_Enabled)
return; return;
} }
#endregion #endregion

View File

@ -515,6 +515,7 @@
; so it is disabled by default. ; so it is disabled by default.
Cap_WebFetchInventoryDescendents = "" Cap_WebFetchInventoryDescendents = ""
[Chat] [Chat]
; Controls whether the chat module is enabled. Default is true. ; Controls whether the chat module is enabled. Default is true.
enabled = true; enabled = true;
@ -528,6 +529,7 @@
; Distance in meters that shouts should travel. Default is 100m ; Distance in meters that shouts should travel. Default is 100m
shout_distance = 100 shout_distance = 100
[EntityTransfer] [EntityTransfer]
; The maximum distance in regions that an agent is allowed to teleport along the x or y axis ; The maximum distance in regions that an agent is allowed to teleport along the x or y axis
; This is set to 4095 because current viewers can't handle teleports that are greater than this distance ; This is set to 4095 because current viewers can't handle teleports that are greater than this distance
@ -554,6 +556,12 @@
CoalesceMultipleObjectsToInventory = true CoalesceMultipleObjectsToInventory = true
[Attachments]
; Controls whether avatar attachments are enabled.
; Defaults to true - only set to false for debugging purposes
Enabled = true
[Mesh] [Mesh]
; enable / disable Collada mesh support ; enable / disable Collada mesh support
; default is true ; default is true