aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2010-02-08 21:54:26 +0000
committerMelanie2010-02-08 21:54:26 +0000
commit1d75ad9fd55ad11134ef55aa3b8bebb3206cc1a5 (patch)
tree01060376fedc86f605d0a41cd70a270979da3e6f /OpenSim/Region/Framework
parentConvert null presence data to a singleton as well. Standalone logins now work (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-1d75ad9fd55ad11134ef55aa3b8bebb3206cc1a5.zip
opensim-SC-1d75ad9fd55ad11134ef55aa3b8bebb3206cc1a5.tar.gz
opensim-SC-1d75ad9fd55ad11134ef55aa3b8bebb3206cc1a5.tar.bz2
opensim-SC-1d75ad9fd55ad11134ef55aa3b8bebb3206cc1a5.tar.xz
Merge branch 'master' into presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs61
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs29
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs18
5 files changed, 129 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
index abcaf91..c289cdb 100644
--- a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
+++ b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs
@@ -43,10 +43,67 @@ namespace OpenSim.Region.Framework.Interfaces
43 int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face); 43 int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face);
44 UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, 44 UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
45 int updateTimer); 45 int updateTimer);
46
47 /// Apply a dynamically generated texture to all sides of the given prim. The texture is not persisted to the
48 /// asset service.
49 /// </summary>
50 /// <param name="simID">The simulator in which the texture is being generated</param>
51 /// <param name="primID">The prim to which to apply the texture.</param>
52 /// <param name="contentType">The content type to create. Current choices are "vector" to create a vector
53 /// based texture or "image" to create a texture from an image at a particular URL</param>
54 /// <param name="data">The data for the generator</param>
55 /// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param>
56 /// <param name="updateTimer">If zero, the image is never updated after the first generation. If positive
57 /// the image is updated at the given interval. Not implemented for </param>
58 /// <param name="SetBlending">
59 /// If true, the newly generated texture is blended with the appropriate existing ones on the prim
60 /// </param>
61 /// <param name="AlphaValue">
62 /// The alpha value of the generated texture.
63 /// </param>
64 /// <returns>
65 /// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need
66 /// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture
67 /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
68 /// </returns>
46 UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, 69 UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams,
47 int updateTimer, bool SetBlending, byte AlphaValue); 70 int updateTimer, bool SetBlending, byte AlphaValue);
48 UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, string extraParams, 71
49 int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face); 72 /// <summary>
73 /// Apply a dynamically generated texture to the given prim.
74 /// </summary>
75 /// <param name="simID">The simulator in which the texture is being generated</param>
76 /// <param name="primID">The prim to which to apply the texture.</param>
77 /// <param name="contentType">The content type to create. Current choices are "vector" to create a vector
78 /// based texture or "image" to create a texture from an image at a particular URL</param>
79 /// <param name="data">The data for the generator</param>
80 /// <param name="extraParams">Parameters for the generator that don't form part of the main data.</param>
81 /// <param name="updateTimer">If zero, the image is never updated after the first generation. If positive
82 /// the image is updated at the given interval. Not implemented for </param>
83 /// <param name="SetBlending">
84 /// If true, the newly generated texture is blended with the appropriate existing ones on the prim
85 /// </param>
86 /// <param name="disp">
87 /// Display flags. If DISP_EXPIRE then the old texture is deleted if it is replaced by a
88 /// newer generated texture (may not currently be implemented). If DISP_TEMP then the asset is flagged as
89 /// temporary, which often means that it is not persisted to the database.
90 /// </param>
91 /// <param name="AlphaValue">
92 /// The alpha value of the generated texture.
93 /// </param>
94 /// <param name="face">
95 /// The face of the prim on which to put the generated texture. If ALL_SIDES then all sides of the prim are
96 /// set
97 /// </param>
98 /// <returns>
99 /// The UUID of the texture updater, not the texture UUID. If you need the texture UUID then you will need
100 /// to obtain it directly from the SceneObjectPart. For instance, if ALL_SIDES is set then this texture
101 /// can be obtained as SceneObjectPart.Shape.Textures.DefaultTexture.TextureID
102 /// </returns>
103 UUID AddDynamicTextureData(
104 UUID simID, UUID primID, string contentType, string data, string extraParams,
105 int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face);
106
50 void GetDrawStringSize(string contentType, string text, string fontName, int fontSize, 107 void GetDrawStringSize(string contentType, string text, string fontName, int fontSize,
51 out double xSize, out double ySize); 108 out double xSize, out double ySize);
52 } 109 }
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 473920e..9f74b2a 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -205,6 +205,12 @@ namespace OpenSim.Region.Framework.Scenes
205 public delegate void OnMakeRootAgentDelegate(ScenePresence presence); 205 public delegate void OnMakeRootAgentDelegate(ScenePresence presence);
206 public event OnMakeRootAgentDelegate OnMakeRootAgent; 206 public event OnMakeRootAgentDelegate OnMakeRootAgent;
207 207
208 /// <summary>
209 /// Triggered when an object or attachment enters a scene
210 /// </summary>
211 public event OnIncomingSceneObjectDelegate OnIncomingSceneObject;
212 public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
213
208 public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); 214 public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
209 215
210 public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; 216 public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
@@ -407,7 +413,7 @@ namespace OpenSim.Region.Framework.Scenes
407 } 413 }
408 } 414 }
409 } 415 }
410 } 416 }
411 417
412 public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) 418 public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
413 { 419 {
@@ -1206,6 +1212,27 @@ namespace OpenSim.Region.Framework.Scenes
1206 } 1212 }
1207 } 1213 }
1208 1214
1215 public void TriggerOnIncomingSceneObject(SceneObjectGroup so)
1216 {
1217 OnIncomingSceneObjectDelegate handlerIncomingSceneObject = OnIncomingSceneObject;
1218 if (handlerIncomingSceneObject != null)
1219 {
1220 foreach (OnIncomingSceneObjectDelegate d in handlerIncomingSceneObject.GetInvocationList())
1221 {
1222 try
1223 {
1224 d(so);
1225 }
1226 catch (Exception e)
1227 {
1228 m_log.ErrorFormat(
1229 "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}",
1230 e.Message, e.StackTrace);
1231 }
1232 }
1233 }
1234 }
1235
1209 public void TriggerOnRegisterCaps(UUID agentID, Caps caps) 1236 public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
1210 { 1237 {
1211 RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; 1238 RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f109589..669720a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2239,9 +2239,14 @@ namespace OpenSim.Region.Framework.Scenes
2239 } 2239 }
2240 2240
2241 2241
2242 /// <summary>
2243 /// Called when objects or attachments cross the border between regions.
2244 /// </summary>
2245 /// <param name="sog"></param>
2246 /// <returns></returns>
2242 public bool IncomingCreateObject(ISceneObject sog) 2247 public bool IncomingCreateObject(ISceneObject sog)
2243 { 2248 {
2244 //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); 2249 //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
2245 SceneObjectGroup newObject; 2250 SceneObjectGroup newObject;
2246 try 2251 try
2247 { 2252 {
@@ -2258,7 +2263,12 @@ namespace OpenSim.Region.Framework.Scenes
2258 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); 2263 m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
2259 return false; 2264 return false;
2260 } 2265 }
2266
2261 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); 2267 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
2268
2269 // Do this as late as possible so that listeners have full access to the incoming object
2270 EventManager.TriggerOnIncomingSceneObject(newObject);
2271
2262 return true; 2272 return true;
2263 } 2273 }
2264 2274
@@ -2270,6 +2280,8 @@ namespace OpenSim.Region.Framework.Scenes
2270 /// <returns>False</returns> 2280 /// <returns>False</returns>
2271 public virtual bool IncomingCreateObject(UUID userID, UUID itemID) 2281 public virtual bool IncomingCreateObject(UUID userID, UUID itemID)
2272 { 2282 {
2283 //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID);
2284
2273 ScenePresence sp = GetScenePresence(userID); 2285 ScenePresence sp = GetScenePresence(userID);
2274 if (sp != null) 2286 if (sp != null)
2275 { 2287 {
@@ -2307,7 +2319,7 @@ namespace OpenSim.Region.Framework.Scenes
2307 foreach (SceneObjectPart p in sceneObject.Children.Values) 2319 foreach (SceneObjectPart p in sceneObject.Children.Values)
2308 p.LocalId = 0; 2320 p.LocalId = 0;
2309 2321
2310 if ((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0)) // Attachment 2322 if (sceneObject.IsAttachmentCheckFull()) // Attachment
2311 { 2323 {
2312 sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); 2324 sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
2313 sceneObject.RootPart.AddFlag(PrimFlags.Phantom); 2325 sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
@@ -2332,29 +2344,23 @@ namespace OpenSim.Region.Framework.Scenes
2332 2344
2333 //RootPrim.SetParentLocalId(parentLocalID); 2345 //RootPrim.SetParentLocalId(parentLocalID);
2334 2346
2335 m_log.DebugFormat("[ATTACHMENT]: Received " + 2347 m_log.DebugFormat(
2336 "attachment {0}, inworld asset id {1}", 2348 "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID);
2337 //grp.RootPart.LastOwnerID.ToString(),
2338 grp.GetFromItemID(),
2339 grp.UUID.ToString());
2340 2349
2341 //grp.SetFromAssetID(grp.RootPart.LastOwnerID); 2350 //grp.SetFromAssetID(grp.RootPart.LastOwnerID);
2342 m_log.DebugFormat("[ATTACHMENT]: Attach " + 2351 m_log.DebugFormat(
2343 "to avatar {0} at position {1}", 2352 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
2344 sp.UUID.ToString(), grp.AbsolutePosition); 2353
2345 AttachObject(sp.ControllingClient, 2354 AttachObject(
2346 grp.LocalId, (uint)0, 2355 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
2347 grp.GroupRotation,
2348 grp.AbsolutePosition, false);
2349 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2356 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2350 grp.SendGroupFullUpdate(); 2357 grp.SendGroupFullUpdate();
2351 } 2358 }
2352 else 2359 else
2353 { 2360 {
2354 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2361 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2355 RootPrim.AddFlag(PrimFlags.TemporaryOnRez); 2362 RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
2356 } 2363 }
2357
2358 } 2364 }
2359 else 2365 else
2360 { 2366 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 8c56870..af46659 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -268,7 +268,16 @@ namespace OpenSim.Region.Framework.Scenes
268 } 268 }
269 } 269 }
270 270
271 private bool IsAttachmentCheckFull() 271 /// <summary>
272 /// Check both the attachment property and the relevant properties of the underlying root part.
273 /// </summary>
274 /// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't
275 /// have the IsAttachment property yet checked.
276 ///
277 /// FIXME: However, this should be fixed so that this property
278 /// propertly reflects the underlying status.
279 /// <returns></returns>
280 public bool IsAttachmentCheckFull()
272 { 281 {
273 return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); 282 return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0));
274 } 283 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 29f607b..b8a937a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -104,6 +104,14 @@ namespace OpenSim.Region.Framework.Scenes
104 } 104 }
105 protected ScenePresenceAnimator m_animator; 105 protected ScenePresenceAnimator m_animator;
106 106
107 /// <value>
108 /// The scene objects attached to this avatar. Do not change this list directly - use methods such as
109 /// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it.
110 /// </value>
111 public List<SceneObjectGroup> Attachments
112 {
113 get { return m_attachments; }
114 }
107 protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); 115 protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
108 116
109 private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); 117 private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>();
@@ -219,11 +227,6 @@ namespace OpenSim.Region.Framework.Scenes
219 227
220 protected AvatarAppearance m_appearance; 228 protected AvatarAppearance m_appearance;
221 229
222 public List<SceneObjectGroup> Attachments
223 {
224 get { return m_attachments; }
225 }
226
227 // neighbouring regions we have enabled a child agent in 230 // neighbouring regions we have enabled a child agent in
228 // holds the seed cap for the child agent in that region 231 // holds the seed cap for the child agent in that region
229 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); 232 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>();
@@ -3210,8 +3213,7 @@ namespace OpenSim.Region.Framework.Scenes
3210 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3213 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3211 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3214 m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3212 m_physicsActor.SubscribeEvents(500); 3215 m_physicsActor.SubscribeEvents(500);
3213 m_physicsActor.LocalID = LocalId; 3216 m_physicsActor.LocalID = LocalId;
3214
3215 } 3217 }
3216 3218
3217 private void OutOfBoundsCall(Vector3 pos) 3219 private void OutOfBoundsCall(Vector3 pos)
@@ -3221,7 +3223,7 @@ namespace OpenSim.Region.Framework.Scenes
3221 3223
3222 //AddToPhysicalScene(flying); 3224 //AddToPhysicalScene(flying);
3223 if (ControllingClient != null) 3225 if (ControllingClient != null)
3224 ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.",true); 3226 ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true);
3225 } 3227 }
3226 3228
3227 // Event called by the physics plugin to tell the avatar about a collision. 3229 // Event called by the physics plugin to tell the avatar about a collision.