diff options
author | Melanie | 2012-04-07 04:52:14 +0100 |
---|---|---|
committer | Melanie | 2012-04-07 04:52:14 +0100 |
commit | b39de2425cac4c2a94a7fdd6c77100ef831d66b4 (patch) | |
tree | 9258928681a82d68b408354e534c32bcf283ad3a /OpenSim/Region/Framework/Scenes | |
parent | Merge branch 'ubitwork' (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.zip opensim-SC_OLD-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.gz opensim-SC_OLD-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.bz2 opensim-SC_OLD-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/CoreModules/World/Land/LandObject.cs
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 49 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 81 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 41 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 82 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 16 |
6 files changed, 218 insertions, 59 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 741d233..2365cfe 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -506,6 +506,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
506 | public delegate void PrimsLoaded(Scene s); | 506 | public delegate void PrimsLoaded(Scene s); |
507 | public event PrimsLoaded OnPrimsLoaded; | 507 | public event PrimsLoaded OnPrimsLoaded; |
508 | 508 | ||
509 | public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout); | ||
510 | public event TeleportStart OnTeleportStart; | ||
511 | |||
512 | public delegate void TeleportFail(IClientAPI client, bool gridLogout); | ||
513 | public event TeleportFail OnTeleportFail; | ||
514 | |||
509 | public class MoneyTransferArgs : EventArgs | 515 | public class MoneyTransferArgs : EventArgs |
510 | { | 516 | { |
511 | public UUID sender; | 517 | public UUID sender; |
@@ -2487,5 +2493,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
2487 | } | 2493 | } |
2488 | } | 2494 | } |
2489 | } | 2495 | } |
2496 | |||
2497 | public void TriggerTeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout) | ||
2498 | { | ||
2499 | TeleportStart handler = OnTeleportStart; | ||
2500 | |||
2501 | if (handler != null) | ||
2502 | { | ||
2503 | foreach (TeleportStart d in handler.GetInvocationList()) | ||
2504 | { | ||
2505 | try | ||
2506 | { | ||
2507 | d(client, destination, finalDestination, teleportFlags, gridLogout); | ||
2508 | } | ||
2509 | catch (Exception e) | ||
2510 | { | ||
2511 | m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportStart failed - continuing {0} - {1}", | ||
2512 | e.Message, e.StackTrace); | ||
2513 | } | ||
2514 | } | ||
2515 | } | ||
2516 | } | ||
2517 | |||
2518 | public void TriggerTeleportFail(IClientAPI client, bool gridLogout) | ||
2519 | { | ||
2520 | TeleportFail handler = OnTeleportFail; | ||
2521 | |||
2522 | if (handler != null) | ||
2523 | { | ||
2524 | foreach (TeleportFail d in handler.GetInvocationList()) | ||
2525 | { | ||
2526 | try | ||
2527 | { | ||
2528 | d(client, gridLogout); | ||
2529 | } | ||
2530 | catch (Exception e) | ||
2531 | { | ||
2532 | m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportFail failed - continuing {0} - {1}", | ||
2533 | e.Message, e.StackTrace); | ||
2534 | } | ||
2535 | } | ||
2536 | } | ||
2537 | } | ||
2538 | |||
2490 | } | 2539 | } |
2491 | } | 2540 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6cf1067..0089c7d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -36,6 +36,7 @@ using OpenMetaverse.Packets; | |||
36 | using log4net; | 36 | using log4net; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework; | 38 | using OpenSim.Region.Framework; |
39 | using OpenSim.Framework.Client; | ||
39 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes.Serialization; | 41 | using OpenSim.Region.Framework.Scenes.Serialization; |
41 | 42 | ||
@@ -117,20 +118,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
117 | /// <param name="item"></param> | 118 | /// <param name="item"></param> |
118 | public bool AddInventoryItem(InventoryItemBase item) | 119 | public bool AddInventoryItem(InventoryItemBase item) |
119 | { | 120 | { |
120 | InventoryFolderBase folder; | 121 | if (item.Folder != UUID.Zero && InventoryService.AddItem(item)) |
121 | |||
122 | if (item.Folder == UUID.Zero) | ||
123 | { | 122 | { |
124 | folder = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); | 123 | int userlevel = 0; |
125 | if (folder == null) | 124 | if (Permissions.IsGod(item.Owner)) |
126 | { | 125 | { |
127 | folder = InventoryService.GetRootFolder(item.Owner); | 126 | userlevel = 1; |
128 | |||
129 | if (folder == null) | ||
130 | return false; | ||
131 | } | 127 | } |
128 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); | ||
129 | |||
130 | return true; | ||
131 | } | ||
132 | 132 | ||
133 | item.Folder = folder.ID; | 133 | // OK so either the viewer didn't send a folderID or AddItem failed |
134 | UUID originalFolder = item.Folder; | ||
135 | InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); | ||
136 | if (f != null) | ||
137 | { | ||
138 | m_log.DebugFormat( | ||
139 | "[AGENT INVENTORY]: Found folder {0} type {1} for item {2}", | ||
140 | f.Name, (AssetType)f.Type, item.Name); | ||
141 | |||
142 | item.Folder = f.ID; | ||
143 | } | ||
144 | else | ||
145 | { | ||
146 | f = InventoryService.GetRootFolder(item.Owner); | ||
147 | if (f != null) | ||
148 | { | ||
149 | item.Folder = f.ID; | ||
150 | } | ||
151 | else | ||
152 | { | ||
153 | m_log.WarnFormat( | ||
154 | "[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", | ||
155 | item.Owner, item.Name); | ||
156 | return false; | ||
157 | } | ||
134 | } | 158 | } |
135 | 159 | ||
136 | if (InventoryService.AddItem(item)) | 160 | if (InventoryService.AddItem(item)) |
@@ -141,7 +165,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
141 | userlevel = 1; | 165 | userlevel = 1; |
142 | } | 166 | } |
143 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); | 167 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); |
144 | 168 | ||
169 | if (originalFolder != UUID.Zero) | ||
170 | { | ||
171 | // Tell the viewer that the item didn't go there | ||
172 | ChangePlacement(item, f); | ||
173 | } | ||
174 | |||
145 | return true; | 175 | return true; |
146 | } | 176 | } |
147 | else | 177 | else |
@@ -153,7 +183,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
153 | return false; | 183 | return false; |
154 | } | 184 | } |
155 | } | 185 | } |
156 | 186 | ||
187 | private void ChangePlacement(InventoryItemBase item, InventoryFolderBase f) | ||
188 | { | ||
189 | ScenePresence sp = GetScenePresence(item.Owner); | ||
190 | if (sp != null) | ||
191 | { | ||
192 | if (sp.ControllingClient is IClientCore) | ||
193 | { | ||
194 | IClientCore core = (IClientCore)sp.ControllingClient; | ||
195 | IClientInventory inv; | ||
196 | |||
197 | if (core.TryGet<IClientInventory>(out inv)) | ||
198 | { | ||
199 | InventoryFolderBase parent = new InventoryFolderBase(f.ParentID, f.Owner); | ||
200 | parent = InventoryService.GetFolder(parent); | ||
201 | inv.SendRemoveInventoryItems(new UUID[] { item.ID }); | ||
202 | inv.SendBulkUpdateInventory(new InventoryFolderBase[0], new InventoryItemBase[] { item }); | ||
203 | string message = "The item was placed in folder " + f.Name; | ||
204 | if (parent != null) | ||
205 | message += " under " + parent.Name; | ||
206 | sp.ControllingClient.SendAgentAlertMessage(message, false); | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | } | ||
211 | |||
157 | /// <summary> | 212 | /// <summary> |
158 | /// Add the given inventory item to a user's inventory. | 213 | /// Add the given inventory item to a user's inventory. |
159 | /// </summary> | 214 | /// </summary> |
@@ -2085,7 +2140,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2085 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 2140 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
2086 | 2141 | ||
2087 | // sets itemID so client can show item as 'attached' in inventory | 2142 | // sets itemID so client can show item as 'attached' in inventory |
2088 | grp.SetFromItemID(item.ID); | 2143 | grp.FromItemID = item.ID; |
2089 | 2144 | ||
2090 | if (AddInventoryItem(item)) | 2145 | if (AddInventoryItem(item)) |
2091 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | 2146 | remoteClient.SendInventoryItemCreateUpdate(item, 0); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index df37b98..a34079c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2248,12 +2248,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2248 | part.RemoveFromPhysics(); | 2248 | part.RemoveFromPhysics(); |
2249 | } | 2249 | } |
2250 | } | 2250 | } |
2251 | |||
2252 | // if (rootPart.PhysActor != null) | ||
2253 | // { | ||
2254 | // PhysicsScene.RemovePrim(rootPart.PhysActor); | ||
2255 | // rootPart.PhysActor = null; | ||
2256 | // } | ||
2257 | 2251 | ||
2258 | if (UnlinkSceneObject(group, false)) | 2252 | if (UnlinkSceneObject(group, false)) |
2259 | { | 2253 | { |
@@ -2668,7 +2662,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2668 | SceneObjectGroup grp = sceneObject; | 2662 | SceneObjectGroup grp = sceneObject; |
2669 | 2663 | ||
2670 | m_log.DebugFormat( | 2664 | m_log.DebugFormat( |
2671 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); | 2665 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); |
2672 | m_log.DebugFormat( | 2666 | m_log.DebugFormat( |
2673 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2667 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2674 | 2668 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 54e8d50..107d9b6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -775,7 +775,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
775 | set { m_LoopSoundSlavePrims = value; } | 775 | set { m_LoopSoundSlavePrims = value; } |
776 | } | 776 | } |
777 | 777 | ||
778 | // The UUID for the Region this Object is in. | 778 | /// <summary> |
779 | /// The UUID for the region this object is in. | ||
780 | /// </summary> | ||
779 | public UUID RegionUUID | 781 | public UUID RegionUUID |
780 | { | 782 | { |
781 | get | 783 | get |
@@ -788,6 +790,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
788 | } | 790 | } |
789 | } | 791 | } |
790 | 792 | ||
793 | /// <summary> | ||
794 | /// The item ID that this object was rezzed from, if applicable. | ||
795 | /// </summary> | ||
796 | /// <remarks> | ||
797 | /// If not applicable will be UUID.Zero | ||
798 | /// </remarks> | ||
799 | public UUID FromItemID { get; set; } | ||
800 | |||
801 | /// <summary> | ||
802 | /// The folder ID that this object was rezzed from, if applicable. | ||
803 | /// </summary> | ||
804 | /// <remarks> | ||
805 | /// If not applicable will be UUID.Zero | ||
806 | /// </remarks> | ||
807 | public UUID FromFolderID { get; set; } | ||
808 | |||
791 | #endregion | 809 | #endregion |
792 | 810 | ||
793 | // ~SceneObjectGroup() | 811 | // ~SceneObjectGroup() |
@@ -851,18 +869,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
851 | } | 869 | } |
852 | } | 870 | } |
853 | 871 | ||
854 | public void SetFromItemID(UUID AssetId) | ||
855 | { | ||
856 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
857 | for (int i = 0; i < parts.Length; i++) | ||
858 | parts[i].FromItemID = AssetId; | ||
859 | } | ||
860 | |||
861 | public UUID GetFromItemID() | ||
862 | { | ||
863 | return m_rootPart.FromItemID; | ||
864 | } | ||
865 | |||
866 | /// <summary> | 872 | /// <summary> |
867 | /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. | 873 | /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. |
868 | /// </summary> | 874 | /// </summary> |
@@ -1498,7 +1504,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1498 | return; | 1504 | return; |
1499 | 1505 | ||
1500 | detachedpos = avatar.AbsolutePosition; | 1506 | detachedpos = avatar.AbsolutePosition; |
1501 | RootPart.FromItemID = UUID.Zero; | 1507 | FromItemID = UUID.Zero; |
1502 | 1508 | ||
1503 | AbsolutePosition = detachedpos; | 1509 | AbsolutePosition = detachedpos; |
1504 | AttachedAvatar = UUID.Zero; | 1510 | AttachedAvatar = UUID.Zero; |
@@ -3379,6 +3385,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3379 | { | 3385 | { |
3380 | m_rootPart.AttachedPos = pos; | 3386 | m_rootPart.AttachedPos = pos; |
3381 | } | 3387 | } |
3388 | |||
3382 | if (RootPart.GetStatusSandbox()) | 3389 | if (RootPart.GetStatusSandbox()) |
3383 | { | 3390 | { |
3384 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10) | 3391 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10) |
@@ -3389,8 +3396,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3389 | ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); | 3396 | ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); |
3390 | } | 3397 | } |
3391 | } | 3398 | } |
3392 | AbsolutePosition = pos; | ||
3393 | 3399 | ||
3400 | AbsolutePosition = pos; | ||
3394 | HasGroupChanged = true; | 3401 | HasGroupChanged = true; |
3395 | } | 3402 | } |
3396 | 3403 | ||
@@ -4032,7 +4039,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4032 | 4039 | ||
4033 | public virtual string ExtraToXmlString() | 4040 | public virtual string ExtraToXmlString() |
4034 | { | 4041 | { |
4035 | return "<ExtraFromItemID>" + GetFromItemID().ToString() + "</ExtraFromItemID>"; | 4042 | return "<ExtraFromItemID>" + FromItemID.ToString() + "</ExtraFromItemID>"; |
4036 | } | 4043 | } |
4037 | 4044 | ||
4038 | public virtual void ExtraFromXmlString(string xmlstr) | 4045 | public virtual void ExtraFromXmlString(string xmlstr) |
@@ -4044,7 +4051,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4044 | UUID uuid = UUID.Zero; | 4051 | UUID uuid = UUID.Zero; |
4045 | UUID.TryParse(id, out uuid); | 4052 | UUID.TryParse(id, out uuid); |
4046 | 4053 | ||
4047 | SetFromItemID(uuid); | 4054 | FromItemID = uuid; |
4048 | } | 4055 | } |
4049 | 4056 | ||
4050 | public void ResetOwnerChangeFlag() | 4057 | public void ResetOwnerChangeFlag() |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 951e987..969ddaf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -126,12 +126,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
126 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 126 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
127 | 127 | ||
128 | /// <value> | 128 | /// <value> |
129 | /// Is this sop a root part? | 129 | /// Is this a root part? |
130 | /// </value> | 130 | /// </value> |
131 | 131 | /// <remarks> | |
132 | /// This will return true even if the whole object is attached to an avatar. | ||
133 | /// </remarks> | ||
132 | public bool IsRoot | 134 | public bool IsRoot |
133 | { | 135 | { |
134 | get { return ParentGroup.RootPart == this; } | 136 | get { return ParentGroup.RootPart == this; } |
135 | } | 137 | } |
136 | 138 | ||
137 | #region Fields | 139 | #region Fields |
@@ -160,15 +162,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
160 | /// If another thread is simultaneously turning physics off on this part then this refernece could become | 162 | /// If another thread is simultaneously turning physics off on this part then this refernece could become |
161 | /// null at any time. | 163 | /// null at any time. |
162 | /// </remarks> | 164 | /// </remarks> |
163 | public PhysicsActor PhysActor | 165 | public PhysicsActor PhysActor { get; set; } |
164 | { | ||
165 | get { return m_physActor; } | ||
166 | set | ||
167 | { | ||
168 | // m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID); | ||
169 | m_physActor = value; | ||
170 | } | ||
171 | } | ||
172 | 166 | ||
173 | //Xantor 20080528 Sound stuff: | 167 | //Xantor 20080528 Sound stuff: |
174 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. | 168 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. |
@@ -188,10 +182,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
188 | public uint TimeStampLastActivity; // Will be used for AutoReturn | 182 | public uint TimeStampLastActivity; // Will be used for AutoReturn |
189 | 183 | ||
190 | public uint TimeStampTerse; | 184 | public uint TimeStampTerse; |
191 | |||
192 | public UUID FromItemID; | ||
193 | |||
194 | public UUID FromFolderID; | ||
195 | 185 | ||
196 | // The following two are to hold the attachment data | 186 | // The following two are to hold the attachment data |
197 | // while an object is inworld | 187 | // while an object is inworld |
@@ -275,7 +265,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
275 | 265 | ||
276 | private bool m_passTouches; | 266 | private bool m_passTouches; |
277 | 267 | ||
278 | private PhysicsActor m_physActor; | ||
279 | protected Vector3 m_acceleration; | 268 | protected Vector3 m_acceleration; |
280 | protected Vector3 m_angularVelocity; | 269 | protected Vector3 m_angularVelocity; |
281 | 270 | ||
@@ -1149,6 +1138,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1149 | } | 1138 | } |
1150 | } | 1139 | } |
1151 | 1140 | ||
1141 | /// <summary> | ||
1142 | /// The parent ID of this part. | ||
1143 | /// </summary> | ||
1144 | /// <remarks> | ||
1145 | /// If this is a root part which is not attached to an avatar then the value will be 0. | ||
1146 | /// If this is a root part which is attached to an avatar then the value is the local id of that avatar. | ||
1147 | /// If this is a child part then the value is the local ID of the root part. | ||
1148 | /// </remarks> | ||
1152 | public uint ParentID | 1149 | public uint ParentID |
1153 | { | 1150 | { |
1154 | get { return _parentID; } | 1151 | get { return _parentID; } |
@@ -1847,9 +1844,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1847 | // if (VolumeDetectActive) | 1844 | // if (VolumeDetectActive) |
1848 | // isPhantom = false; | 1845 | // isPhantom = false; |
1849 | 1846 | ||
1850 | // Added clarification.. since A rigid body is an object that you can kick around, etc. | ||
1851 | // bool RigidBody = isPhysical && !isPhantom; | ||
1852 | |||
1853 | // The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition | 1847 | // The only time the physics scene shouldn't know about the prim is if it's phantom or an attachment, which is phantom by definition |
1854 | // or flexible | 1848 | // or flexible |
1855 | // if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) | 1849 | // if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) |
@@ -1876,7 +1870,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1876 | PhysActor = null; | 1870 | PhysActor = null; |
1877 | } | 1871 | } |
1878 | 1872 | ||
1879 | // Basic Physics can also return null as well as an exception catch. | ||
1880 | PhysicsActor pa = PhysActor; | 1873 | PhysicsActor pa = PhysActor; |
1881 | 1874 | ||
1882 | if (pa != null) | 1875 | if (pa != null) |
@@ -4859,7 +4852,52 @@ namespace OpenSim.Region.Framework.Scenes | |||
4859 | } | 4852 | } |
4860 | 4853 | ||
4861 | /// <summary> | 4854 | /// <summary> |
4862 | /// This removes the part from physics | 4855 | /// Adds this part to the physics scene. |
4856 | /// </summary> | ||
4857 | /// <remarks>This method also sets the PhysActor property.</remarks> | ||
4858 | /// <param name="rigidBody">Add this prim with a rigid body.</param> | ||
4859 | /// <returns> | ||
4860 | /// The physics actor. null if there was a failure. | ||
4861 | /// </returns> | ||
4862 | private PhysicsActor AddToPhysics(bool rigidBody) | ||
4863 | { | ||
4864 | PhysicsActor pa; | ||
4865 | |||
4866 | try | ||
4867 | { | ||
4868 | pa = ParentGroup.Scene.PhysicsScene.AddPrimShape( | ||
4869 | string.Format("{0}/{1}", Name, UUID), | ||
4870 | Shape, | ||
4871 | AbsolutePosition, | ||
4872 | Scale, | ||
4873 | RotationOffset, | ||
4874 | rigidBody, | ||
4875 | m_localId); | ||
4876 | } | ||
4877 | catch | ||
4878 | { | ||
4879 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
4880 | pa = null; | ||
4881 | } | ||
4882 | |||
4883 | // FIXME: Ideally we wouldn't set the property here to reduce situations where threads changing physical | ||
4884 | // properties can stop on each other. However, DoPhysicsPropertyUpdate() currently relies on PhysActor | ||
4885 | // being set. | ||
4886 | PhysActor = pa; | ||
4887 | |||
4888 | // Basic Physics can also return null as well as an exception catch. | ||
4889 | if (pa != null) | ||
4890 | { | ||
4891 | pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info | ||
4892 | pa.SetMaterial(Material); | ||
4893 | DoPhysicsPropertyUpdate(rigidBody, true); | ||
4894 | } | ||
4895 | |||
4896 | return pa; | ||
4897 | } | ||
4898 | |||
4899 | /// <summary> | ||
4900 | /// This removes the part from the physics scene. | ||
4863 | /// </summary> | 4901 | /// </summary> |
4864 | /// <remarks> | 4902 | /// <remarks> |
4865 | /// This isn't the same as turning off physical, since even without being physical the prim has a physics | 4903 | /// This isn't the same as turning off physical, since even without being physical the prim has a physics |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ed3a7f1..b51d41b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3617,6 +3617,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3617 | }); | 3617 | }); |
3618 | } | 3618 | } |
3619 | 3619 | ||
3620 | /// <summary> | ||
3621 | /// Gets the mass. | ||
3622 | /// </summary> | ||
3623 | /// <returns> | ||
3624 | /// The mass. | ||
3625 | /// </returns> | ||
3626 | public float GetMass() | ||
3627 | { | ||
3628 | PhysicsActor pa = PhysicsActor; | ||
3629 | |||
3630 | if (pa != null) | ||
3631 | return pa.Mass; | ||
3632 | else | ||
3633 | return 0; | ||
3634 | } | ||
3635 | |||
3620 | internal void PushForce(Vector3 impulse) | 3636 | internal void PushForce(Vector3 impulse) |
3621 | { | 3637 | { |
3622 | if (PhysicsActor != null) | 3638 | if (PhysicsActor != null) |