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

0.6.9
Melanie 2010-02-08 21:42:23 +00:00
commit def8f8166a
7 changed files with 133 additions and 27 deletions

View File

@ -115,7 +115,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// client.OnAvatarNowWearing -= AvatarIsWearing; // client.OnAvatarNowWearing -= AvatarIsWearing;
} }
public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
{ {
IInventoryService invService = m_scene.InventoryService; IInventoryService invService = m_scene.InventoryService;
@ -139,7 +138,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
} }
else else
{ {
m_log.ErrorFormat("[APPEARANCE]: Can't find inventory item {0}, setting to default", appearance.Wearables[i].ItemID); m_log.ErrorFormat(
"[APPEARANCE]: Can't find inventory item {0} for {1}, setting to default",
appearance.Wearables[i].ItemID, (WearableType)i);
appearance.Wearables[i].AssetID = def.Wearables[i].AssetID; appearance.Wearables[i].AssetID = def.Wearables[i].AssetID;
} }
} }

View File

@ -43,10 +43,67 @@ namespace OpenSim.Region.Framework.Interfaces
int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face); int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face);
UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
int updateTimer); int updateTimer);
/// Apply a dynamically generated texture to all sides of the given prim. The texture is not persisted to the
/// asset service.
/// </summary>
/// <param name="simID">The simulator in which the texture is being generated</param>
/// <param name="primID">The prim to which to apply the texture.</param>
/// <param name="contentType">The content type to create. Current choices are "vector" to create a vector
/// based texture or "image" to create a texture from an image at a particular URL</param>
/// <param name="data">The data for the generator</param>
/// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param>
/// <param name="updateTimer">If zero, the image is never updated after the first generation. If positive
/// the image is updated at the given interval. Not implemented for </param>
/// <param name="SetBlending">
/// If true, the newly generated texture is blended with the appropriate existing ones on the prim
/// </param>
/// <param name="AlphaValue">
/// The alpha value of the generated texture.
/// </param>
/// <returns>
/// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need
/// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture
/// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
/// </returns>
UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
int updateTimer, bool SetBlending, byte AlphaValue); int updateTimer, bool SetBlending, byte AlphaValue);
UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
/// <summary>
/// Apply a dynamically generated texture to the given prim.
/// </summary>
/// <param name="simID">The simulator in which the texture is being generated</param>
/// <param name="primID">The prim to which to apply the texture.</param>
/// <param name="contentType">The content type to create. Current choices are "vector" to create a vector
/// based texture or "image" to create a texture from an image at a particular URL</param>
/// <param name="data">The data for the generator</param>
/// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param>
/// <param name="updateTimer">If zero, the image is never updated after the first generation. If positive
/// the image is updated at the given interval. Not implemented for </param>
/// <param name="SetBlending">
/// If true, the newly generated texture is blended with the appropriate existing ones on the prim
/// </param>
/// <param name="disp">
/// Display flags. If DISP_EXPIRE then the old texture is deleted if it is replaced by a
/// newer generated texture (may not currently be implemented). If DISP_TEMP then the asset is flagged as
/// temporary, which often means that it is not persisted to the database.
/// </param>
/// <param name="AlphaValue">
/// The alpha value of the generated texture.
/// </param>
/// <param name="face">
/// The face of the prim on which to put the generated texture. If ALL_SIDES then all sides of the prim are
/// set
/// </param>
/// <returns>
/// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need
/// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture
/// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
/// </returns>
UUID AddDynamicTextureData(
UUID simID, UUID primID, string contentType, string data, string extraParams,
int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face); int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face);
void GetDrawStringSize(string contentType, string text, string fontName, int fontSize, void GetDrawStringSize(string contentType, string text, string fontName, int fontSize,
out double xSize, out double ySize); out double xSize, out double ySize);
} }

View File

@ -205,6 +205,12 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void OnMakeRootAgentDelegate(ScenePresence presence); public delegate void OnMakeRootAgentDelegate(ScenePresence presence);
public event OnMakeRootAgentDelegate OnMakeRootAgent; public event OnMakeRootAgentDelegate OnMakeRootAgent;
/// <summary>
/// Triggered when an object or attachment enters a scene
/// </summary>
public event OnIncomingSceneObjectDelegate OnIncomingSceneObject;
public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
@ -1206,6 +1212,27 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void TriggerOnIncomingSceneObject(SceneObjectGroup so)
{
OnIncomingSceneObjectDelegate handlerIncomingSceneObject = OnIncomingSceneObject;
if (handlerIncomingSceneObject != null)
{
foreach (OnIncomingSceneObjectDelegate d in handlerIncomingSceneObject.GetInvocationList())
{
try
{
d(so);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerOnRegisterCaps(UUID agentID, Caps caps) public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
{ {
RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;

View File

@ -2406,9 +2406,14 @@ namespace OpenSim.Region.Framework.Scenes
return successYN; return successYN;
} }
/// <summary>
/// Called when objects or attachments cross the border between regions.
/// </summary>
/// <param name="sog"></param>
/// <returns></returns>
public bool IncomingCreateObject(ISceneObject sog) public bool IncomingCreateObject(ISceneObject sog)
{ {
//m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
SceneObjectGroup newObject; SceneObjectGroup newObject;
try try
{ {
@ -2425,7 +2430,12 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
return false; return false;
} }
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
// Do this as late as possible so that listeners have full access to the incoming object
EventManager.TriggerOnIncomingSceneObject(newObject);
return true; return true;
} }
@ -2437,6 +2447,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>False</returns> /// <returns>False</returns>
public virtual bool IncomingCreateObject(UUID userID, UUID itemID) public virtual bool IncomingCreateObject(UUID userID, UUID 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)
{ {
@ -2471,7 +2483,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart p in sceneObject.Children.Values) foreach (SceneObjectPart p in sceneObject.Children.Values)
p.LocalId = 0; p.LocalId = 0;
if ((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0)) // Attachment if (sceneObject.IsAttachmentCheckFull()) // Attachment
{ {
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
sceneObject.RootPart.AddFlag(PrimFlags.Phantom); sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
@ -2496,20 +2508,15 @@ namespace OpenSim.Region.Framework.Scenes
//RootPrim.SetParentLocalId(parentLocalID); //RootPrim.SetParentLocalId(parentLocalID);
m_log.DebugFormat("[ATTACHMENT]: Received " + m_log.DebugFormat(
"attachment {0}, inworld asset id {1}", "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID);
//grp.RootPart.LastOwnerID.ToString(),
grp.GetFromItemID(),
grp.UUID.ToString());
//grp.SetFromAssetID(grp.RootPart.LastOwnerID); //grp.SetFromAssetID(grp.RootPart.LastOwnerID);
m_log.DebugFormat("[ATTACHMENT]: Attach " + m_log.DebugFormat(
"to avatar {0} at position {1}", "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
sp.UUID.ToString(), grp.AbsolutePosition);
AttachObject(sp.ControllingClient, AttachObject(
grp.LocalId, (uint)0, sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
grp.GroupRotation,
grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
grp.SendGroupFullUpdate(); grp.SendGroupFullUpdate();
} }
@ -2518,7 +2525,6 @@ namespace OpenSim.Region.Framework.Scenes
RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
RootPrim.AddFlag(PrimFlags.TemporaryOnRez); RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
} }
} }
else else
{ {

View File

@ -191,7 +191,6 @@ namespace OpenSim.Region.Framework.Scenes
if (handlerChildAgentUpdate != null) if (handlerChildAgentUpdate != null)
handlerChildAgentUpdate(cAgentData); handlerChildAgentUpdate(cAgentData);
return true; return true;
} }

View File

@ -268,7 +268,16 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
private bool IsAttachmentCheckFull() /// <summary>
/// Check both the attachment property and the relevant properties of the underlying root part.
/// </summary>
/// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't
/// have the IsAttachment property yet checked.
///
/// FIXME: However, this should be fixed so that this property
/// propertly reflects the underlying status.
/// <returns></returns>
public bool IsAttachmentCheckFull()
{ {
return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0));
} }

View File

@ -104,6 +104,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
protected ScenePresenceAnimator m_animator; protected ScenePresenceAnimator m_animator;
/// <value>
/// The scene objects attached to this avatar. Do not change this list directly - use methods such as
/// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it.
/// </value>
public List<SceneObjectGroup> Attachments
{
get { return m_attachments; }
}
protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>();
@ -1105,7 +1113,6 @@ namespace OpenSim.Region.Framework.Scenes
m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
SendInitialData(); SendInitialData();
} }
/// <summary> /// <summary>
@ -3185,7 +3192,6 @@ namespace OpenSim.Region.Framework.Scenes
m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
m_physicsActor.SubscribeEvents(500); m_physicsActor.SubscribeEvents(500);
m_physicsActor.LocalID = LocalId; m_physicsActor.LocalID = LocalId;
} }
private void OutOfBoundsCall(Vector3 pos) private void OutOfBoundsCall(Vector3 pos)