Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

slimupdates
John Hurliman 2010-03-15 15:38:55 -07:00
commit 4e180e84e2
10 changed files with 2966 additions and 2927 deletions

View File

@ -168,6 +168,81 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return true; return true;
} }
public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{
m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true);
}
public UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
{
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt);
if (updateInventoryStatus)
{
if (att == null)
{
ShowDetachInUserInventory(itemID, remoteClient);
}
SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
}
if (null == att)
return UUID.Zero;
else
return att.UUID;
}
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null)
{
SceneObjectGroup objatt = invAccess.RezObject(remoteClient,
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
false, false, remoteClient.AgentId, true);
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
// objatt.Name, remoteClient.Name, AttachmentPt);
if (objatt != null)
{
bool tainted = false;
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
tainted = true;
AttachObject(
remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
//objatt.ScheduleGroupForFullUpdate();
if (tainted)
objatt.HasGroupChanged = true;
// Fire after attach, so we don't get messy perms dialogs
// 3 == AttachedRez
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3);
// Do this last so that event listeners have access to all the effects of the attachment
m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
}
else
{
m_log.WarnFormat(
"[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
itemID, remoteClient.Name, AttachmentPt);
}
return objatt;
}
return null;
}
public UUID SetAttachmentInventoryStatus( public UUID SetAttachmentInventoryStatus(
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)

View File

@ -56,7 +56,30 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="silent"></param> /// <param name="silent"></param>
/// <returns>true if the object was successfully attached, false otherwise</returns> /// <returns>true if the object was successfully attached, false otherwise</returns>
bool AttachObject( bool AttachObject(
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent); IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent);
/// <summary>
/// Rez an attachment from user inventory and change inventory status to match.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
/// <summary>
/// Rez an attachment from user inventory
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <param name="updateinventoryStatus">
/// If true, we also update the user's inventory to show that the attachment is set. If false, we do not.
/// False is required so that we don't attempt to update information when a user enters a scene with the
/// attachment already correctly set up in inventory.
/// <returns>The uuid of the scene object that was attached. Null if the scene object could not be found</returns>
UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
/// <summary> /// <summary>
/// Update the user inventory to the attachment of an item /// Update the user inventory to the attachment of an item

View File

@ -1842,35 +1842,12 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerOnAttach(localID, itemID, avatarID); EventManager.TriggerOnAttach(localID, itemID, avatarID);
} }
/// <summary>
/// Called when the client receives a request to rez a single attachment on to the avatar from inventory
/// (RezSingleAttachmentFromInv packet).
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <returns></returns>
public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{
m_log.DebugFormat("[USER INVENTORY]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
SceneObjectGroup att = m_sceneGraph.RezSingleAttachment(remoteClient, itemID, AttachmentPt);
if (att == null)
{
AttachmentsModule.ShowDetachInUserInventory(itemID, remoteClient);
return UUID.Zero;
}
return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
}
public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
{ {
foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects) foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
{ {
RezSingleAttachment(remoteClient, obj.ItemID, obj.AttachmentPt); AttachmentsModule.RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt);
} }
} }

View File

@ -2338,10 +2338,10 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID); //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
ScenePresence sp = GetScenePresence(userID); ScenePresence sp = GetScenePresence(userID);
if (sp != null) if (sp != null && AttachmentsModule != null)
{ {
uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
m_sceneGraph.RezSingleAttachment(sp.ControllingClient, itemID, attPt); AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
} }
return false; return false;
@ -2642,13 +2642,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
{ {
client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
client.OnObjectDetach += m_sceneGraph.DetachObject; client.OnObjectDetach += m_sceneGraph.DetachObject;
if (AttachmentsModule != null) if (AttachmentsModule != null)
{ {
client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
client.OnObjectAttach += AttachmentsModule.AttachObject; client.OnObjectAttach += AttachmentsModule.AttachObject;
client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory; client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
} }
@ -2799,12 +2799,12 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
{ {
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
client.OnRezSingleAttachmentFromInv -= RezSingleAttachment;
client.OnObjectDetach -= m_sceneGraph.DetachObject; client.OnObjectDetach -= m_sceneGraph.DetachObject;
if (AttachmentsModule != null) if (AttachmentsModule != null)
{ {
client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
client.OnObjectAttach -= AttachmentsModule.AttachObject; client.OnObjectAttach -= AttachmentsModule.AttachObject;
client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
} }

View File

@ -486,59 +486,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Rez an attachment
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{
IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null)
{
SceneObjectGroup objatt = invAccess.RezObject(remoteClient,
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
false, false, remoteClient.AgentId, true);
// m_log.DebugFormat(
// "[SCENE GRAPH]: Retrieved single object {0} for attachment to {1} on point {2}",
// objatt.Name, remoteClient.Name, AttachmentPt);
if (objatt != null)
{
bool tainted = false;
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
tainted = true;
m_parentScene.AttachmentsModule.AttachObject(
remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
//objatt.ScheduleGroupForFullUpdate();
if (tainted)
objatt.HasGroupChanged = true;
// Fire after attach, so we don't get messy perms dialogs
// 3 == AttachedRez
objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
// Do this last so that event listeners have access to all the effects of the attachment
m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
}
else
{
m_log.WarnFormat(
"[SCENE GRAPH]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
itemID, remoteClient.Name, AttachmentPt);
}
return objatt;
}
return null;
}
protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
{ {
ScenePresence newAvatar = null; ScenePresence newAvatar = null;

View File

@ -676,7 +676,8 @@ namespace OpenSim.Region.Framework.Scenes
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
m_userLevel = account.UserLevel; if (account != null)
m_userLevel = account.UserLevel;
IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
if (gm != null) if (gm != null)
@ -3738,7 +3739,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (null == m_appearance) if (null == m_appearance)
{ {
m_log.WarnFormat("[ATTACHMENT] Appearance has not been initialized for agent {0}", UUID); m_log.WarnFormat("[ATTACHMENT]: Appearance has not been initialized for agent {0}", UUID);
return; return;
} }
@ -3762,12 +3763,12 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
// Rez from inventory // Rez from inventory
UUID asset = m_scene.RezSingleAttachment(ControllingClient, UUID asset
itemID, (uint)p); = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p);
m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
p, itemID, assetID, asset);
m_log.InfoFormat(
"[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
p, itemID, assetID, asset);
} }
catch (Exception e) catch (Exception e)
{ {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -123,8 +123,7 @@ namespace OpenSim.Services.GridService
if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0) if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0)
{ {
// Regions reserved for the null key cannot be taken. // Regions reserved for the null key cannot be taken.
// if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString())
if (region.Data["PrincipalID"] == UUID.Zero.ToString())
return "Region location us reserved"; return "Region location us reserved";
// Treat it as an auth request // Treat it as an auth request
@ -132,7 +131,6 @@ namespace OpenSim.Services.GridService
// NOTE: Fudging the flags value here, so these flags // NOTE: Fudging the flags value here, so these flags
// should not be used elsewhere. Don't optimize // should not be used elsewhere. Don't optimize
// this with the later retrieval of the same flags! // this with the later retrieval of the same flags!
//
rflags |= OpenSim.Data.RegionFlags.Authenticate; rflags |= OpenSim.Data.RegionFlags.Authenticate;
} }
@ -489,7 +487,7 @@ namespace OpenSim.Services.GridService
f |= (OpenSim.Data.RegionFlags)val; f |= (OpenSim.Data.RegionFlags)val;
} }
} }
catch (Exception e) catch (Exception)
{ {
MainConsole.Instance.Output("Error in flag specification: " + p); MainConsole.Instance.Output("Error in flag specification: " + p);
} }

View File

@ -168,10 +168,11 @@ namespace OpenSim.Services.GridService
} }
// Sanity check. // Sanity check.
IPAddress ipaddr = null; //IPAddress ipaddr = null;
try try
{ {
ipaddr = Util.GetHostFromDNS(host); //ipaddr = Util.GetHostFromDNS(host);
Util.GetHostFromDNS(host);
} }
catch catch
{ {