diff options
author | Tom | 2011-09-04 07:06:36 -0700 |
---|---|---|
committer | Tom | 2011-09-04 07:06:36 -0700 |
commit | 66dec3b8742eff04fbbcc6e3249fe4ba87986500 (patch) | |
tree | 76cc708a821d35fac5cdbbce2de304b47064e732 /OpenSim/Region/Framework | |
parent | Guard another nullref (diff) | |
parent | Fixed BulletSim config files for Linux *.so libraries. (diff) | |
download | opensim-SC_OLD-66dec3b8742eff04fbbcc6e3249fe4ba87986500.zip opensim-SC_OLD-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.gz opensim-SC_OLD-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.bz2 opensim-SC_OLD-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.xz |
Resolve merge commits, stage 1
Diffstat (limited to 'OpenSim/Region/Framework')
42 files changed, 2713 insertions, 1788 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 788f42b..6bbdd7d 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -37,6 +37,27 @@ namespace OpenSim.Region.Framework.Interfaces | |||
37 | public interface IAttachmentsModule | 37 | public interface IAttachmentsModule |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// RezAttachments. This should only be called upon login on the first region. | ||
41 | /// Attachment rezzings on crossings and TPs are done in a different way. | ||
42 | /// </summary> | ||
43 | void RezAttachments(IScenePresence sp); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Save the attachments that have change on this presence. | ||
47 | /// </summary> | ||
48 | /// <param name="sp"></param> | ||
49 | void SaveChangedAttachments(IScenePresence sp); | ||
50 | |||
51 | /// <summary> | ||
52 | /// Delete all the presence's attachments from the scene | ||
53 | /// </summary> | ||
54 | /// <param name="sp"> | ||
55 | /// This is done when a root agent leaves/is demoted to child (for instance, on logout, teleport or region cross). | ||
56 | /// </param> | ||
57 | /// <param name="silent"></param> | ||
58 | void DeleteAttachmentsFromScene(IScenePresence sp, bool silent); | ||
59 | |||
60 | /// <summary> | ||
40 | /// Attach an object to an avatar from the world. | 61 | /// Attach an object to an avatar from the world. |
41 | /// </summary> | 62 | /// </summary> |
42 | /// <param name="controllingClient"></param> | 63 | /// <param name="controllingClient"></param> |
@@ -48,13 +69,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
48 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent); | 69 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent); |
49 | 70 | ||
50 | /// <summary> | 71 | /// <summary> |
51 | /// Attach an object to an avatar. | 72 | /// Attach an object to an avatar |
52 | /// </summary> | 73 | /// </summary> |
53 | /// <param name="controllingClient"></param> | 74 | /// <param name="remoteClient"></param> |
54 | /// <param name="localID"></param> | 75 | /// <param name="grp"></param> |
55 | /// <param name="attachPoint"></param> | 76 | /// <param name="AttachmentPt"></param> |
56 | /// <param name="rot"></param> | ||
57 | /// <param name="attachPos"></param> | ||
58 | /// <param name="silent"></param> | 77 | /// <param name="silent"></param> |
59 | /// <returns>true if the object was successfully attached, false otherwise</returns> | 78 | /// <returns>true if the object was successfully attached, false otherwise</returns> |
60 | bool AttachObject( | 79 | bool AttachObject( |
@@ -67,7 +86,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
67 | /// <param name="itemID"></param> | 86 | /// <param name="itemID"></param> |
68 | /// <param name="AttachmentPt"></param> | 87 | /// <param name="AttachmentPt"></param> |
69 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> | 88 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> |
70 | UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt); | 89 | ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt); |
71 | 90 | ||
72 | /// <summary> | 91 | /// <summary> |
73 | /// Rez an attachment from user inventory | 92 | /// Rez an attachment from user inventory |
@@ -80,7 +99,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
80 | /// False is required so that we don't attempt to update information when a user enters a scene with the | 99 | /// False is required so that we don't attempt to update information when a user enters a scene with the |
81 | /// attachment already correctly set up in inventory. | 100 | /// attachment already correctly set up in inventory. |
82 | /// <returns>The uuid of the scene object that was attached. Null if the scene object could not be found</returns> | 101 | /// <returns>The uuid of the scene object that was attached. Null if the scene object could not be found</returns> |
83 | UUID RezSingleAttachmentFromInventory( | 102 | ISceneEntity RezSingleAttachmentFromInventory( |
84 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus); | 103 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus); |
85 | 104 | ||
86 | // Same as above, but also load script states from a separate doc | 105 | // Same as above, but also load script states from a separate doc |
@@ -101,9 +120,10 @@ namespace OpenSim.Region.Framework.Interfaces | |||
101 | /// <summary> | 120 | /// <summary> |
102 | /// Detach an object from the avatar. | 121 | /// Detach an object from the avatar. |
103 | /// </summary> | 122 | /// </summary> |
104 | /// | 123 | /// <remarks> |
105 | /// This method is called in response to a client's detach request, so we only update the information in | 124 | /// This method is called in response to a client's detach request, so we only update the information in |
106 | /// inventory | 125 | /// inventory |
126 | /// </remarks> | ||
107 | /// <param name="objectLocalID"></param> | 127 | /// <param name="objectLocalID"></param> |
108 | /// <param name="remoteClient"></param> | 128 | /// <param name="remoteClient"></param> |
109 | void DetachObject(uint objectLocalID, IClientAPI remoteClient); | 129 | void DetachObject(uint objectLocalID, IClientAPI remoteClient); |
@@ -111,12 +131,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
111 | /// <summary> | 131 | /// <summary> |
112 | /// Detach the given item to the ground. | 132 | /// Detach the given item to the ground. |
113 | /// </summary> | 133 | /// </summary> |
114 | /// <param name="itemID"></param> | 134 | /// <param name="objectLocalID"></param> |
115 | /// <param name="remoteClient"></param> | 135 | /// <param name="remoteClient"></param> |
116 | void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient); | 136 | void DetachSingleAttachmentToGround(uint objectLocalID, IClientAPI remoteClient); |
117 | 137 | ||
118 | /// <summary> | 138 | /// <summary> |
119 | /// Update the user inventory to show a detach. | 139 | /// Detach the given item so that it remains in the user's inventory. |
120 | /// </summary> | 140 | /// </summary> |
121 | /// <param name="itemID"> | 141 | /// <param name="itemID"> |
122 | /// A <see cref="UUID"/> | 142 | /// A <see cref="UUID"/> |
@@ -124,23 +144,15 @@ namespace OpenSim.Region.Framework.Interfaces | |||
124 | /// <param name="remoteClient"> | 144 | /// <param name="remoteClient"> |
125 | /// A <see cref="IClientAPI"/> | 145 | /// A <see cref="IClientAPI"/> |
126 | /// </param> | 146 | /// </param> |
127 | void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); | 147 | void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient); |
128 | 148 | ||
129 | /// <summary> | 149 | /// <summary> |
130 | /// Update the user inventory with a changed attachment | 150 | /// Update the user inventory with a changed attachment |
131 | /// </summary> | 151 | /// </summary> |
132 | /// <param name="remoteClient"> | 152 | /// <param name="remoteClient"></param> |
133 | /// A <see cref="IClientAPI"/> | 153 | /// <param name="grp"></param> |
134 | /// </param> | 154 | /// <param name="itemID"></param> |
135 | /// <param name="grp"> | 155 | /// <param name="agentID"></param> |
136 | /// A <see cref="SceneObjectGroup"/> | ||
137 | /// </param> | ||
138 | /// <param name="itemID"> | ||
139 | /// A <see cref="UUID"/> | ||
140 | /// </param> | ||
141 | /// <param name="agentID"> | ||
142 | /// A <see cref="UUID"/> | ||
143 | /// </param> | ||
144 | void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID); | 156 | void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID); |
145 | } | 157 | } |
146 | } | 158 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs index d0e5609..4dbddf4 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs +++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections.Generic; | ||
28 | using OpenMetaverse; | 29 | using OpenMetaverse; |
29 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
30 | 31 | ||
@@ -32,6 +33,30 @@ namespace OpenSim.Region.Framework.Interfaces | |||
32 | { | 33 | { |
33 | public interface IAvatarFactory | 34 | public interface IAvatarFactory |
34 | { | 35 | { |
36 | /// <summary> | ||
37 | /// Send the appearance of an avatar to others in the scene. | ||
38 | /// </summary> | ||
39 | /// <param name="agentId"></param> | ||
40 | /// <returns></returns> | ||
41 | bool SendAppearance(UUID agentId); | ||
42 | |||
43 | /// <summary> | ||
44 | /// Return the baked texture ids of the given agent. | ||
45 | /// </summary> | ||
46 | /// <param name="agentId"></param> | ||
47 | /// <returns>An empty list if this agent has no baked textures (e.g. because it's a child agent)</returns> | ||
48 | Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Save the baked textures for the given agent permanently in the asset database. | ||
52 | /// </summary> | ||
53 | /// <remarks> | ||
54 | /// This is used to preserve apperance textures for NPCs | ||
55 | /// </remarks> | ||
56 | /// <param name="agentId"></param> | ||
57 | /// <returns>true if a valid agent was found, false otherwise</returns> | ||
58 | bool SaveBakedTextures(UUID agentId); | ||
59 | |||
35 | bool ValidateBakedTextureCache(IClientAPI client); | 60 | bool ValidateBakedTextureCache(IClientAPI client); |
36 | void QueueAppearanceSend(UUID agentid); | 61 | void QueueAppearanceSend(UUID agentid); |
37 | void QueueAppearanceSave(UUID agentid); | 62 | void QueueAppearanceSave(UUID agentid); |
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index da11e61..1904011 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs | |||
@@ -54,10 +54,58 @@ namespace OpenSim.Region.Framework.Interfaces | |||
54 | /// FIXME: This is not very useful. It would be far more useful to return a list of items instead. | 54 | /// FIXME: This is not very useful. It would be far more useful to return a list of items instead. |
55 | /// </returns> | 55 | /// </returns> |
56 | UUID CopyToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient); | 56 | UUID CopyToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient); |
57 | 57 | ||
58 | SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, | 58 | /// <summary> |
59 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 59 | /// Rez an object into the scene from the user's inventory |
60 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); | 60 | /// </summary> |
61 | /// <remarks> | ||
62 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing | ||
63 | /// things to the scene. The caller should be doing that, I think. | ||
64 | /// </remarks> | ||
65 | /// <param name="remoteClient"></param> | ||
66 | /// <param name="itemID"></param> | ||
67 | /// <param name="RayEnd"></param> | ||
68 | /// <param name="RayStart"></param> | ||
69 | /// <param name="RayTargetID"></param> | ||
70 | /// <param name="BypassRayCast"></param> | ||
71 | /// <param name="RayEndIsIntersection"></param> | ||
72 | /// <param name="RezSelected"></param> | ||
73 | /// <param name="RemoveItem"></param> | ||
74 | /// <param name="fromTaskID"></param> | ||
75 | /// <param name="attachment"></param> | ||
76 | /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful.</returns> | ||
77 | SceneObjectGroup RezObject( | ||
78 | IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, | ||
79 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | ||
80 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); | ||
81 | |||
82 | /// <summary> | ||
83 | /// Rez an object into the scene from the user's inventory | ||
84 | /// </summary> | ||
85 | /// <remarks> | ||
86 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing | ||
87 | /// things to the scene. The caller should be doing that, I think. | ||
88 | /// </remarks> | ||
89 | /// <param name="remoteClient"></param> | ||
90 | /// <param name="item"> | ||
91 | /// The item from which the object asset came. Can be null, in which case pre and post rez item adjustment and checks are not performed. | ||
92 | /// </param> | ||
93 | /// <param name="assetID">The asset id for the object to rez.</param> | ||
94 | /// <param name="RayEnd"></param> | ||
95 | /// <param name="RayStart"></param> | ||
96 | /// <param name="RayTargetID"></param> | ||
97 | /// <param name="BypassRayCast"></param> | ||
98 | /// <param name="RayEndIsIntersection"></param> | ||
99 | /// <param name="RezSelected"></param> | ||
100 | /// <param name="RemoveItem"></param> | ||
101 | /// <param name="fromTaskID"></param> | ||
102 | /// <param name="attachment"></param> | ||
103 | /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful.</returns> | ||
104 | SceneObjectGroup RezObject( | ||
105 | IClientAPI remoteClient, InventoryItemBase item, UUID assetID, Vector3 RayEnd, Vector3 RayStart, | ||
106 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | ||
107 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); | ||
108 | |||
61 | void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); | 109 | void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); |
62 | 110 | ||
63 | /// <summary> | 111 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 21a755f..5e5c4a1 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs | |||
@@ -26,15 +26,80 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenMetaverse; | 28 | using OpenMetaverse; |
29 | using OpenSim.Framework; | ||
29 | using OpenSim.Region.Framework.Scenes; | 30 | using OpenSim.Region.Framework.Scenes; |
30 | 31 | ||
31 | namespace OpenSim.Region.Framework.Interfaces | 32 | namespace OpenSim.Region.Framework.Interfaces |
32 | { | 33 | { |
33 | public interface INPCModule | 34 | public interface INPCModule |
34 | { | 35 | { |
35 | UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom); | 36 | /// <summary> |
36 | void Autopilot(UUID agentID, Scene scene, Vector3 pos); | 37 | /// Create an NPC |
37 | void Say(UUID agentID, Scene scene, string text); | 38 | /// </summary> |
38 | void DeleteNPC(UUID agentID, Scene scene); | 39 | /// <param name="firstname"></param> |
40 | /// <param name="lastname"></param> | ||
41 | /// <param name="position"></param> | ||
42 | /// <param name="scene"></param> | ||
43 | /// <param name="appearance">The avatar appearance to use for the new NPC.</param> | ||
44 | /// <returns>The UUID of the ScenePresence created.</returns> | ||
45 | UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance); | ||
46 | |||
47 | /// <summary> | ||
48 | /// Check if the agent is an NPC. | ||
49 | /// </summary> | ||
50 | /// <param name="agentID"></param> | ||
51 | /// <param name="scene"></param> | ||
52 | /// <returns>True if the agent is an NPC in the given scene. False otherwise.</returns> | ||
53 | bool IsNPC(UUID agentID, Scene scene); | ||
54 | |||
55 | /// <summary> | ||
56 | /// Set the appearance for an NPC. | ||
57 | /// </summary> | ||
58 | /// <param name="agentID"></param> | ||
59 | /// <param name="appearance"></param> | ||
60 | /// <param name="scene"></param> | ||
61 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
62 | bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene); | ||
63 | |||
64 | /// <summary> | ||
65 | /// Move an NPC to a target over time. | ||
66 | /// </summary> | ||
67 | /// <param name="agentID">The UUID of the NPC</param> | ||
68 | /// <param name="scene"></param> | ||
69 | /// <param name="pos"></param> | ||
70 | /// <param name="noFly"> | ||
71 | /// If true, then the avatar will attempt to walk to the location even if it's up in the air. | ||
72 | /// This is to allow walking on prims. | ||
73 | /// </param> | ||
74 | /// <param name="landAtTarget"> | ||
75 | /// If true and the avatar is flying when it reaches the target, land. | ||
76 | /// </param> | ||
77 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
78 | bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget); | ||
79 | |||
80 | /// <summary> | ||
81 | /// Stop the NPC's current movement. | ||
82 | /// </summary> | ||
83 | /// <param name="agentID">The UUID of the NPC</param> | ||
84 | /// <param name="scene"></param> | ||
85 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
86 | bool StopMoveToTarget(UUID agentID, Scene scene); | ||
87 | |||
88 | /// <summary> | ||
89 | /// Get the NPC to say something. | ||
90 | /// </summary> | ||
91 | /// <param name="agentID">The UUID of the NPC</param> | ||
92 | /// <param name="scene"></param> | ||
93 | /// <param name="text"></param> | ||
94 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
95 | bool Say(UUID agentID, Scene scene, string text); | ||
96 | |||
97 | /// <summary> | ||
98 | /// Delete an NPC. | ||
99 | /// </summary> | ||
100 | /// <param name="agentID">The UUID of the NPC</param> | ||
101 | /// <param name="scene"></param> | ||
102 | /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> | ||
103 | bool DeleteNPC(UUID agentID, Scene scene); | ||
39 | } | 104 | } |
40 | } \ No newline at end of file | 105 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs new file mode 100644 index 0000000..8913133 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Framework.Scenes; | ||
32 | |||
33 | namespace OpenSim.Region.Framework.Interfaces | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// An agent in the scene. | ||
37 | /// </summary> | ||
38 | /// <remarks> | ||
39 | /// Interface is a work in progress. Please feel free to add other required properties and methods. | ||
40 | /// </remarks> | ||
41 | public interface IScenePresence : ISceneEntity | ||
42 | { | ||
43 | /// <value> | ||
44 | /// The client controlling this presence | ||
45 | /// </value> | ||
46 | IClientAPI ControllingClient { get; } | ||
47 | |||
48 | /// <summary> | ||
49 | /// What type of presence is this? User, NPC, etc. | ||
50 | /// </summary> | ||
51 | PresenceType PresenceType { get; } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Avatar appearance data. | ||
55 | /// </summary> | ||
56 | /// <remarks> | ||
57 | // Because appearance setting is in a module, we actually need | ||
58 | // to give it access to our appearance directly, otherwise we | ||
59 | // get a synchronization issue. | ||
60 | /// </remarks> | ||
61 | AvatarAppearance Appearance { get; set; } | ||
62 | |||
63 | /// <summary> | ||
64 | /// The scene objects attached to this avatar. | ||
65 | /// </summary> | ||
66 | /// <returns> | ||
67 | /// A copy of the list. | ||
68 | /// </returns> | ||
69 | /// <remarks> | ||
70 | /// Do not change this list directly - use the attachments module. | ||
71 | /// </remarks> | ||
72 | List<SceneObjectGroup> GetAttachments(); | ||
73 | |||
74 | /// <summary> | ||
75 | /// The scene objects attached to this avatar at a specific attachment point. | ||
76 | /// </summary> | ||
77 | /// <param name="attachmentPoint"></param> | ||
78 | /// <returns></returns> | ||
79 | List<SceneObjectGroup> GetAttachments(uint attachmentPoint); | ||
80 | |||
81 | bool HasAttachments(); | ||
82 | |||
83 | // Don't use these methods directly. Instead, use the AttachmentsModule | ||
84 | void AddAttachment(SceneObjectGroup gobj); | ||
85 | void RemoveAttachment(SceneObjectGroup gobj); | ||
86 | void ClearAttachments(); | ||
87 | } | ||
88 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulatorFeaturesModule.cs b/OpenSim/Region/Framework/Interfaces/ISimulatorFeaturesModule.cs new file mode 100644 index 0000000..8cef14e --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/ISimulatorFeaturesModule.cs | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse.StructuredData; | ||
30 | |||
31 | namespace OpenSim.Region.Framework.Interfaces | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Add remove or retrieve Simulator Features that will be given to a viewer via the SimulatorFeatures capability. | ||
35 | /// </summary> | ||
36 | public interface ISimulatorFeaturesModule | ||
37 | { | ||
38 | void AddFeature(string name, OSD value); | ||
39 | bool RemoveFeature(string name); | ||
40 | bool TryGetFeature(string name, out OSD value); | ||
41 | OSDMap GetFeatures(); | ||
42 | } | ||
43 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs index 5d30aa8..c66e053 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs | |||
@@ -5,13 +5,48 @@ using OpenMetaverse; | |||
5 | 5 | ||
6 | namespace OpenSim.Region.Framework.Interfaces | 6 | namespace OpenSim.Region.Framework.Interfaces |
7 | { | 7 | { |
8 | /// <summary> | ||
9 | /// This maintains the relationship between a UUID and a user name. | ||
10 | /// </summary> | ||
8 | public interface IUserManagement | 11 | public interface IUserManagement |
9 | { | 12 | { |
10 | string GetUserName(UUID uuid); | 13 | string GetUserName(UUID uuid); |
11 | string GetUserHomeURL(UUID uuid); | 14 | string GetUserHomeURL(UUID uuid); |
12 | string GetUserUUI(UUID uuid); | 15 | string GetUserUUI(UUID uuid); |
13 | string GetUserServerURL(UUID uuid, string serverType); | 16 | string GetUserServerURL(UUID uuid, string serverType); |
14 | void AddUser(UUID uuid, string userData); | 17 | |
18 | /// <summary> | ||
19 | /// Add a user. | ||
20 | /// </summary> | ||
21 | /// <remarks> | ||
22 | /// If an account is found for the UUID, then the names in this will be used rather than any information | ||
23 | /// extracted from creatorData. | ||
24 | /// </remarks> | ||
25 | /// <param name="uuid"></param> | ||
26 | /// <param name="creatorData">The creator data for this user.</param> | ||
27 | void AddUser(UUID uuid, string creatorData); | ||
28 | |||
29 | /// <summary> | ||
30 | /// Add a user. | ||
31 | /// </summary> | ||
32 | /// <remarks> | ||
33 | /// The UUID is related to the name without any other checks being performed, such as user account presence. | ||
34 | /// </remarks> | ||
35 | /// <param name="uuid"></param> | ||
36 | /// <param name="firstName"></param> | ||
37 | /// <param name="lastName"></param> | ||
38 | void AddUser(UUID uuid, string firstName, string lastName); | ||
39 | |||
40 | /// <summary> | ||
41 | /// Add a user. | ||
42 | /// </summary> | ||
43 | /// <remarks> | ||
44 | /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the | ||
45 | /// AddUser(UUID uuid, string creatorData) method. | ||
46 | /// </remarks> | ||
47 | /// <param name="uuid"></param> | ||
48 | /// <param name="firstName"></param> | ||
49 | /// <param name="profileURL"></param> | ||
15 | void AddUser(UUID uuid, string firstName, string lastName, string profileURL); | 50 | void AddUser(UUID uuid, string firstName, string lastName, string profileURL); |
16 | } | 51 | } |
17 | } | 52 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index 8da99a0..dafbf30 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs | |||
@@ -81,6 +81,26 @@ namespace OpenSim.Region.Framework.Interfaces | |||
81 | void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); | 81 | void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); |
82 | 82 | ||
83 | /// <summary> | 83 | /// <summary> |
84 | /// Delivers the message to a specified object in the region. | ||
85 | /// </summary> | ||
86 | /// <param name='target'> | ||
87 | /// Target. | ||
88 | /// </param> | ||
89 | /// <param name='channel'> | ||
90 | /// Channel. | ||
91 | /// </param> | ||
92 | /// <param name='name'> | ||
93 | /// Name. | ||
94 | /// </param> | ||
95 | /// <param name='id'> | ||
96 | /// Identifier. | ||
97 | /// </param> | ||
98 | /// <param name='msg'> | ||
99 | /// Message. | ||
100 | /// </param> | ||
101 | bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error); | ||
102 | |||
103 | /// <summary> | ||
84 | /// Are there any listen events ready to be dispatched? | 104 | /// Are there any listen events ready to be dispatched? |
85 | /// </summary> | 105 | /// </summary> |
86 | /// <returns>boolean indication</returns> | 106 | /// <returns>boolean indication</returns> |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 9c103cb..4925175 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | ||
31 | using log4net; | ||
30 | using OpenMetaverse; | 32 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
32 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
@@ -40,6 +42,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
40 | /// </summary> | 42 | /// </summary> |
41 | public class ScenePresenceAnimator | 43 | public class ScenePresenceAnimator |
42 | { | 44 | { |
45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
43 | public AnimationSet Animations | 47 | public AnimationSet Animations |
44 | { | 48 | { |
45 | get { return m_animations; } | 49 | get { return m_animations; } |
@@ -79,6 +83,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
79 | if (m_scenePresence.IsChildAgent) | 83 | if (m_scenePresence.IsChildAgent) |
80 | return; | 84 | return; |
81 | 85 | ||
86 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); | ||
87 | |||
82 | if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) | 88 | if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) |
83 | SendAnimPack(); | 89 | SendAnimPack(); |
84 | } | 90 | } |
@@ -93,6 +99,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
93 | if (animID == UUID.Zero) | 99 | if (animID == UUID.Zero) |
94 | return; | 100 | return; |
95 | 101 | ||
102 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name); | ||
103 | |||
96 | AddAnimation(animID, objectID); | 104 | AddAnimation(animID, objectID); |
97 | } | 105 | } |
98 | 106 | ||
@@ -136,6 +144,10 @@ TrySetMovementAnimation("STAND"); | |||
136 | if (m_animations.TrySetDefaultAnimation( | 144 | if (m_animations.TrySetDefaultAnimation( |
137 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) | 145 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) |
138 | { | 146 | { |
147 | // m_log.DebugFormat( | ||
148 | // "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}", | ||
149 | // anim, m_scenePresence.Name); | ||
150 | |||
139 | // 16384 is CHANGED_ANIMATION | 151 | // 16384 is CHANGED_ANIMATION |
140 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); | 152 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); |
141 | SendAnimPack(); | 153 | SendAnimPack(); |
@@ -353,7 +365,7 @@ TrySetMovementAnimation("STAND"); | |||
353 | /* This section removed, replaced by jumping section | 365 | /* This section removed, replaced by jumping section |
354 | m_animTickFall = 0; | 366 | m_animTickFall = 0; |
355 | 367 | ||
356 | if (move.Z > 0f) | 368 | if (move.Z > 0.2f) |
357 | { | 369 | { |
358 | // Jumping | 370 | // Jumping |
359 | if (!jumping) | 371 | if (!jumping) |
diff --git a/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs b/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs index 06cd14b..9cb5674 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncInventorySender.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
70 | /// </remarks> | 70 | /// </remarks> |
71 | public class AsyncInventorySender | 71 | public class AsyncInventorySender |
72 | { | 72 | { |
73 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 73 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
74 | 74 | ||
75 | protected Scene m_scene; | 75 | protected Scene m_scene; |
76 | 76 | ||
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs index 6fd38e5..213431a 100644 --- a/OpenSim/Region/Framework/Scenes/EntityBase.cs +++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs | |||
@@ -66,12 +66,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Signals whether this entity was in a scene but has since been removed from it. | 67 | /// Signals whether this entity was in a scene but has since been removed from it. |
68 | /// </summary> | 68 | /// </summary> |
69 | public bool IsDeleted | 69 | public bool IsDeleted { get; protected internal set; } |
70 | { | ||
71 | get { return m_isDeleted; } | ||
72 | set { m_isDeleted = value; } | ||
73 | } | ||
74 | protected bool m_isDeleted; | ||
75 | 70 | ||
76 | protected Vector3 m_pos; | 71 | protected Vector3 m_pos; |
77 | 72 | ||
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 3ec4e59..65c6a29 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -169,8 +169,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
169 | public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); | 169 | public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); |
170 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; | 170 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; |
171 | 171 | ||
172 | public delegate void SignificantClientMovement(IClientAPI remote_client); | 172 | public event Action<ScenePresence> OnSignificantClientMovement; |
173 | public event SignificantClientMovement OnSignificantClientMovement; | ||
174 | 173 | ||
175 | public delegate void IncomingInstantMessage(GridInstantMessage message); | 174 | public delegate void IncomingInstantMessage(GridInstantMessage message); |
176 | public event IncomingInstantMessage OnIncomingInstantMessage; | 175 | public event IncomingInstantMessage OnIncomingInstantMessage; |
@@ -1616,16 +1615,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1616 | } | 1615 | } |
1617 | } | 1616 | } |
1618 | 1617 | ||
1619 | public void TriggerSignificantClientMovement(IClientAPI client) | 1618 | public void TriggerSignificantClientMovement(ScenePresence presence) |
1620 | { | 1619 | { |
1621 | SignificantClientMovement handlerSignificantClientMovement = OnSignificantClientMovement; | 1620 | Action<ScenePresence> handlerSignificantClientMovement = OnSignificantClientMovement; |
1622 | if (handlerSignificantClientMovement != null) | 1621 | if (handlerSignificantClientMovement != null) |
1623 | { | 1622 | { |
1624 | foreach (SignificantClientMovement d in handlerSignificantClientMovement.GetInvocationList()) | 1623 | foreach (Action<ScenePresence> d in handlerSignificantClientMovement.GetInvocationList()) |
1625 | { | 1624 | { |
1626 | try | 1625 | try |
1627 | { | 1626 | { |
1628 | d(client); | 1627 | d(presence); |
1629 | } | 1628 | } |
1630 | catch (Exception e) | 1629 | catch (Exception e) |
1631 | { | 1630 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 657df15..0a34a4c 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -116,14 +116,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
116 | return priority; | 116 | return priority; |
117 | } | 117 | } |
118 | 118 | ||
119 | |||
120 | private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) | 119 | private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) |
121 | { | 120 | { |
122 | // And anything attached to this avatar gets top priority as well | 121 | // And anything attached to this avatar gets top priority as well |
123 | if (entity is SceneObjectPart) | 122 | if (entity is SceneObjectPart) |
124 | { | 123 | { |
125 | SceneObjectPart sop = (SceneObjectPart)entity; | 124 | SceneObjectPart sop = (SceneObjectPart)entity; |
126 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | 125 | if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) |
127 | return 1; | 126 | return 1; |
128 | } | 127 | } |
129 | 128 | ||
@@ -136,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
136 | if (entity is SceneObjectPart) | 135 | if (entity is SceneObjectPart) |
137 | { | 136 | { |
138 | SceneObjectPart sop = (SceneObjectPart)entity; | 137 | SceneObjectPart sop = (SceneObjectPart)entity; |
139 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | 138 | if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) |
140 | return 1; | 139 | return 1; |
141 | } | 140 | } |
142 | 141 | ||
@@ -149,7 +148,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
149 | if (entity is SceneObjectPart) | 148 | if (entity is SceneObjectPart) |
150 | { | 149 | { |
151 | SceneObjectPart sop = (SceneObjectPart)entity; | 150 | SceneObjectPart sop = (SceneObjectPart)entity; |
152 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | 151 | if (sop.ParentGroup.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar) |
153 | return 1; | 152 | return 1; |
154 | } | 153 | } |
155 | 154 | ||
@@ -172,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
172 | if (entity is SceneObjectPart) | 171 | if (entity is SceneObjectPart) |
173 | { | 172 | { |
174 | // Attachments are high priority, | 173 | // Attachments are high priority, |
175 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) | 174 | if (((SceneObjectPart)entity).ParentGroup.IsAttachment) |
176 | return 1; | 175 | return 1; |
177 | 176 | ||
178 | // Non physical prims are lower priority than physical prims | 177 | // Non physical prims are lower priority than physical prims |
@@ -209,8 +208,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
209 | if (entity is SceneObjectPart) | 208 | if (entity is SceneObjectPart) |
210 | { | 209 | { |
211 | SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; | 210 | SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; |
212 | if (group != null) | 211 | entityPos = group.AbsolutePosition; |
213 | entityPos = group.AbsolutePosition; | ||
214 | } | 212 | } |
215 | 213 | ||
216 | // Use the camera position for local agents and avatar position for remote agents | 214 | // Use the camera position for local agents and avatar position for remote agents |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index dbefb4a..89f3683 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -211,16 +211,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
211 | 211 | ||
212 | // Retrieve group | 212 | // Retrieve group |
213 | SceneObjectPart part = GetSceneObjectPart(primId); | 213 | SceneObjectPart part = GetSceneObjectPart(primId); |
214 | SceneObjectGroup group = part.ParentGroup; | 214 | if (part == null) |
215 | if (null == group) | ||
216 | { | ||
217 | m_log.ErrorFormat( | ||
218 | "[PRIM INVENTORY]: " + | ||
219 | "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist", | ||
220 | itemId, primId); | ||
221 | |||
222 | return new ArrayList(); | 215 | return new ArrayList(); |
223 | } | 216 | |
217 | SceneObjectGroup group = part.ParentGroup; | ||
224 | 218 | ||
225 | // Retrieve item | 219 | // Retrieve item |
226 | TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId); | 220 | TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId); |
@@ -709,7 +703,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
709 | newName = item.Name; | 703 | newName = item.Name; |
710 | } | 704 | } |
711 | 705 | ||
712 | if (remoteClient.AgentId == oldAgentID || (LibraryService != null && LibraryService.LibraryRootFolder != null && oldAgentID == LibraryService.LibraryRootFolder.Owner)) | 706 | if (remoteClient.AgentId == oldAgentID |
707 | || (LibraryService != null | ||
708 | && LibraryService.LibraryRootFolder != null | ||
709 | && oldAgentID == LibraryService.LibraryRootFolder.Owner)) | ||
713 | { | 710 | { |
714 | CreateNewInventoryItem( | 711 | CreateNewInventoryItem( |
715 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, | 712 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, |
@@ -981,23 +978,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
981 | if (item == null) | 978 | if (item == null) |
982 | return; | 979 | return; |
983 | 980 | ||
984 | if (item.Type == 10) | 981 | if (item.Type == 10) |
985 | { | ||
986 | part.RemoveScriptEvents(itemID); | ||
987 | EventManager.TriggerRemoveScript(localID, itemID); | ||
988 | } | ||
989 | |||
990 | group.RemoveInventoryItem(localID, itemID); | ||
991 | part.GetProperties(remoteClient); | ||
992 | } | ||
993 | else | ||
994 | { | 982 | { |
995 | m_log.ErrorFormat( | 983 | part.RemoveScriptEvents(itemID); |
996 | "[PRIM INVENTORY]: " + | 984 | EventManager.TriggerRemoveScript(localID, itemID); |
997 | "Removal of item {0} requested of prim {1} but this prim does not exist", | ||
998 | itemID, | ||
999 | localID); | ||
1000 | } | 985 | } |
986 | |||
987 | group.RemoveInventoryItem(localID, itemID); | ||
988 | part.GetProperties(remoteClient); | ||
1001 | } | 989 | } |
1002 | 990 | ||
1003 | private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) | 991 | private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) |
@@ -1780,7 +1768,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1780 | } | 1768 | } |
1781 | 1769 | ||
1782 | // Already deleted by someone else | 1770 | // Already deleted by someone else |
1783 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) | 1771 | if (part.ParentGroup.IsDeleted) |
1784 | { | 1772 | { |
1785 | //Client still thinks the object exists, kill it | 1773 | //Client still thinks the object exists, kill it |
1786 | deleteIDs.Add(localID); | 1774 | deleteIDs.Add(localID); |
@@ -2158,6 +2146,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2158 | foreach (uint localID in localIDs) | 2146 | foreach (uint localID in localIDs) |
2159 | { | 2147 | { |
2160 | SceneObjectPart part = GetSceneObjectPart(localID); | 2148 | SceneObjectPart part = GetSceneObjectPart(localID); |
2149 | if (part == null) | ||
2150 | continue; | ||
2151 | |||
2161 | if (!groups.Contains(part.ParentGroup)) | 2152 | if (!groups.Contains(part.ParentGroup)) |
2162 | groups.Add(part.ParentGroup); | 2153 | groups.Add(part.ParentGroup); |
2163 | } | 2154 | } |
@@ -2203,6 +2194,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2203 | foreach (uint localID in localIDs) | 2194 | foreach (uint localID in localIDs) |
2204 | { | 2195 | { |
2205 | SceneObjectPart part = GetSceneObjectPart(localID); | 2196 | SceneObjectPart part = GetSceneObjectPart(localID); |
2197 | if (part == null) | ||
2198 | continue; | ||
2206 | part.GetProperties(remoteClient); | 2199 | part.GetProperties(remoteClient); |
2207 | } | 2200 | } |
2208 | } | 2201 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 9bef443..9da57a8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -191,10 +191,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
191 | if (part == null) | 191 | if (part == null) |
192 | return; | 192 | return; |
193 | 193 | ||
194 | // The prim is in the process of being deleted. | ||
195 | if (null == part.ParentGroup.RootPart) | ||
196 | return; | ||
197 | |||
198 | // A deselect packet contains all the local prims being deselected. However, since selection is still | 194 | // A deselect packet contains all the local prims being deselected. However, since selection is still |
199 | // group based we only want the root prim to trigger a full update - otherwise on objects with many prims | 195 | // group based we only want the root prim to trigger a full update - otherwise on objects with many prims |
200 | // we end up sending many duplicate ObjectUpdates | 196 | // we end up sending many duplicate ObjectUpdates |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ec82cc3..26fe61d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -635,6 +635,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
635 | "delete object name <name>", | 635 | "delete object name <name>", |
636 | "Delete object by name", HandleDeleteObject); | 636 | "Delete object by name", HandleDeleteObject); |
637 | 637 | ||
638 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", | ||
639 | "delete object outside", | ||
640 | "Delete all objects outside boundaries", HandleDeleteObject); | ||
641 | |||
638 | //Bind Storage Manager functions to some land manager functions for this scene | 642 | //Bind Storage Manager functions to some land manager functions for this scene |
639 | EventManager.OnLandObjectAdded += | 643 | EventManager.OnLandObjectAdded += |
640 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); | 644 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); |
@@ -1703,20 +1707,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1703 | 1707 | ||
1704 | m_sceneGridService.SetScene(this); | 1708 | m_sceneGridService.SetScene(this); |
1705 | 1709 | ||
1706 | // If we generate maptiles internally at all, the maptile generator | 1710 | GridRegion region = new GridRegion(RegionInfo); |
1707 | // will register the region. If not, do it here | 1711 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); |
1708 | if (m_generateMaptiles) | 1712 | if (error != String.Empty) |
1709 | { | 1713 | { |
1710 | RegenerateMaptile(null, null); | 1714 | throw new Exception(error); |
1711 | } | 1715 | } |
1712 | else | 1716 | |
1717 | // Generate the maptile asynchronously, because sometimes it can be very slow and we | ||
1718 | // don't want this to delay starting the region. | ||
1719 | if (m_generateMaptiles) | ||
1713 | { | 1720 | { |
1714 | GridRegion region = new GridRegion(RegionInfo); | 1721 | Util.FireAndForget(delegate { |
1715 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | 1722 | RegenerateMaptile(null, null); |
1716 | if (error != String.Empty) | 1723 | }); |
1717 | { | ||
1718 | throw new Exception(error); | ||
1719 | } | ||
1720 | } | 1724 | } |
1721 | } | 1725 | } |
1722 | 1726 | ||
@@ -1757,6 +1761,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1757 | /// <summary> | 1761 | /// <summary> |
1758 | /// Loads the World's objects | 1762 | /// Loads the World's objects |
1759 | /// </summary> | 1763 | /// </summary> |
1764 | /// <param name="regionID"></param> | ||
1760 | public virtual void LoadPrimsFromStorage(UUID regionID) | 1765 | public virtual void LoadPrimsFromStorage(UUID regionID) |
1761 | { | 1766 | { |
1762 | LoadingPrims = true; | 1767 | LoadingPrims = true; |
@@ -1769,20 +1774,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1769 | foreach (SceneObjectGroup group in PrimsFromDB) | 1774 | foreach (SceneObjectGroup group in PrimsFromDB) |
1770 | { | 1775 | { |
1771 | EventManager.TriggerOnSceneObjectLoaded(group); | 1776 | EventManager.TriggerOnSceneObjectLoaded(group); |
1772 | |||
1773 | if (group.RootPart == null) | ||
1774 | { | ||
1775 | m_log.ErrorFormat( | ||
1776 | "[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children", | ||
1777 | group.Parts == null ? 0 : group.PrimCount); | ||
1778 | } | ||
1779 | |||
1780 | AddRestoredSceneObject(group, true, true); | 1777 | AddRestoredSceneObject(group, true, true); |
1781 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 1778 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
1782 | rootPart.Flags &= ~PrimFlags.Scripted; | 1779 | rootPart.Flags &= ~PrimFlags.Scripted; |
1783 | rootPart.TrimPermissions(); | 1780 | rootPart.TrimPermissions(); |
1784 | group.CheckSculptAndLoad(); | 1781 | |
1785 | //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | 1782 | // Don't do this here - it will get done later on when sculpt data is loaded. |
1783 | // group.CheckSculptAndLoad(); | ||
1786 | } | 1784 | } |
1787 | 1785 | ||
1788 | m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); | 1786 | m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); |
@@ -2643,10 +2641,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2643 | #region Add/Remove Avatar Methods | 2641 | #region Add/Remove Avatar Methods |
2644 | 2642 | ||
2645 | /// <summary> | 2643 | /// <summary> |
2646 | /// Adding a New Client and Create a Presence for it. | 2644 | /// Add a new client and create a child agent for it. |
2647 | /// </summary> | 2645 | /// </summary> |
2648 | /// <param name="client"></param> | 2646 | /// <param name="client"></param> |
2649 | public override void AddNewClient(IClientAPI client) | 2647 | /// <param name="type">The type of agent to add.</param> |
2648 | public override void AddNewClient(IClientAPI client, PresenceType type) | ||
2650 | { | 2649 | { |
2651 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | 2650 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); |
2652 | bool vialogin = false; | 2651 | bool vialogin = false; |
@@ -2667,7 +2666,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2667 | m_clientManager.Add(client); | 2666 | m_clientManager.Add(client); |
2668 | SubscribeToClientEvents(client); | 2667 | SubscribeToClientEvents(client); |
2669 | 2668 | ||
2670 | ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); | 2669 | ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); |
2671 | m_eventManager.TriggerOnNewPresence(sp); | 2670 | m_eventManager.TriggerOnNewPresence(sp); |
2672 | 2671 | ||
2673 | sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; | 2672 | sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; |
@@ -2678,16 +2677,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2678 | if (aCircuit.child == false) | 2677 | if (aCircuit.child == false) |
2679 | { | 2678 | { |
2680 | sp.IsChildAgent = false; | 2679 | sp.IsChildAgent = false; |
2681 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); | 2680 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); |
2682 | } | 2681 | } |
2683 | } | 2682 | } |
2684 | 2683 | ||
2685 | if (TryGetScenePresence(client.AgentId, out presence)) | 2684 | ScenePresence createdSp = GetScenePresence(client.AgentId); |
2685 | if (createdSp != null) | ||
2686 | { | 2686 | { |
2687 | m_LastLogin = Util.EnvironmentTickCount(); | 2687 | m_LastLogin = Util.EnvironmentTickCount(); |
2688 | 2688 | ||
2689 | // Cache the user's name | 2689 | // Cache the user's name |
2690 | CacheUserName(aCircuit); | 2690 | CacheUserName(createdSp, aCircuit); |
2691 | 2691 | ||
2692 | EventManager.TriggerOnNewClient(client); | 2692 | EventManager.TriggerOnNewClient(client); |
2693 | if (vialogin) | 2693 | if (vialogin) |
@@ -2702,28 +2702,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
2702 | } | 2702 | } |
2703 | } | 2703 | } |
2704 | 2704 | ||
2705 | private void CacheUserName(AgentCircuitData aCircuit) | 2705 | /// <summary> |
2706 | /// Cache the user name for later use. | ||
2707 | /// </summary> | ||
2708 | /// <param name="sp"></param> | ||
2709 | /// <param name="aCircuit"></param> | ||
2710 | private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit) | ||
2706 | { | 2711 | { |
2707 | IUserManagement uMan = RequestModuleInterface<IUserManagement>(); | 2712 | IUserManagement uMan = RequestModuleInterface<IUserManagement>(); |
2708 | if (uMan != null) | 2713 | if (uMan != null) |
2709 | { | 2714 | { |
2710 | string homeURL = string.Empty; | ||
2711 | string first = aCircuit.firstname, last = aCircuit.lastname; | 2715 | string first = aCircuit.firstname, last = aCircuit.lastname; |
2712 | 2716 | ||
2713 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 2717 | if (sp.PresenceType == PresenceType.Npc) |
2714 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 2718 | { |
2715 | 2719 | uMan.AddUser(aCircuit.AgentID, first, last); | |
2716 | if (aCircuit.lastname.StartsWith("@")) | 2720 | } |
2721 | else | ||
2717 | { | 2722 | { |
2718 | string[] parts = aCircuit.firstname.Split('.'); | 2723 | string homeURL = string.Empty; |
2719 | if (parts.Length >= 2) | 2724 | |
2725 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | ||
2726 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | ||
2727 | |||
2728 | if (aCircuit.lastname.StartsWith("@")) | ||
2720 | { | 2729 | { |
2721 | first = parts[0]; | 2730 | string[] parts = aCircuit.firstname.Split('.'); |
2722 | last = parts[1]; | 2731 | if (parts.Length >= 2) |
2732 | { | ||
2733 | first = parts[0]; | ||
2734 | last = parts[1]; | ||
2735 | } | ||
2723 | } | 2736 | } |
2724 | } | ||
2725 | 2737 | ||
2726 | uMan.AddUser(aCircuit.AgentID, first, last, homeURL); | 2738 | uMan.AddUser(aCircuit.AgentID, first, last, homeURL); |
2739 | } | ||
2727 | } | 2740 | } |
2728 | } | 2741 | } |
2729 | 2742 | ||
@@ -2821,12 +2834,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2821 | 2834 | ||
2822 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) | 2835 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) |
2823 | { | 2836 | { |
2824 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; | 2837 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2825 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 2838 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2826 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; | 2839 | |
2827 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimRotation; | 2840 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2841 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | ||
2828 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 2842 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
2829 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; | 2843 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; |
2844 | |||
2830 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; | 2845 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; |
2831 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; | 2846 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; |
2832 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; | 2847 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; |
@@ -2856,7 +2871,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2856 | client.OnUndo += m_sceneGraph.HandleUndo; | 2871 | client.OnUndo += m_sceneGraph.HandleUndo; |
2857 | client.OnRedo += m_sceneGraph.HandleRedo; | 2872 | client.OnRedo += m_sceneGraph.HandleRedo; |
2858 | client.OnObjectDescription += m_sceneGraph.PrimDescription; | 2873 | client.OnObjectDescription += m_sceneGraph.PrimDescription; |
2859 | client.OnObjectDrop += m_sceneGraph.DropObject; | ||
2860 | client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; | 2874 | client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; |
2861 | client.OnObjectOwner += ObjectOwner; | 2875 | client.OnObjectOwner += ObjectOwner; |
2862 | } | 2876 | } |
@@ -2949,12 +2963,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2949 | 2963 | ||
2950 | public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) | 2964 | public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) |
2951 | { | 2965 | { |
2952 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimPosition; | 2966 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
2953 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 2967 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
2954 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimRotation; | 2968 | |
2955 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimRotation; | 2969 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
2970 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | ||
2956 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 2971 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
2957 | client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition; | 2972 | client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition; |
2973 | |||
2958 | client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale; | 2974 | client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale; |
2959 | client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale; | 2975 | client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale; |
2960 | client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam; | 2976 | client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam; |
@@ -2982,7 +2998,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2982 | client.OnUndo -= m_sceneGraph.HandleUndo; | 2998 | client.OnUndo -= m_sceneGraph.HandleUndo; |
2983 | client.OnRedo -= m_sceneGraph.HandleRedo; | 2999 | client.OnRedo -= m_sceneGraph.HandleRedo; |
2984 | client.OnObjectDescription -= m_sceneGraph.PrimDescription; | 3000 | client.OnObjectDescription -= m_sceneGraph.PrimDescription; |
2985 | client.OnObjectDrop -= m_sceneGraph.DropObject; | ||
2986 | client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable; | 3001 | client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable; |
2987 | client.OnObjectOwner -= ObjectOwner; | 3002 | client.OnObjectOwner -= ObjectOwner; |
2988 | } | 3003 | } |
@@ -3098,58 +3113,51 @@ namespace OpenSim.Region.Framework.Scenes | |||
3098 | Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); | 3113 | Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); |
3099 | Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); | 3114 | Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); |
3100 | 3115 | ||
3101 | if (target2.ParentGroup != null) | 3116 | pos = target2.AbsolutePosition; |
3102 | { | 3117 | //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); |
3103 | pos = target2.AbsolutePosition; | ||
3104 | //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); | ||
3105 | 3118 | ||
3106 | // TODO: Raytrace better here | 3119 | // TODO: Raytrace better here |
3107 | 3120 | ||
3108 | //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); | 3121 | //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); |
3109 | Ray NewRay = new Ray(AXOrigin, AXdirection); | 3122 | Ray NewRay = new Ray(AXOrigin, AXdirection); |
3110 | 3123 | ||
3111 | // Ray Trace against target here | 3124 | // Ray Trace against target here |
3112 | EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); | 3125 | EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); |
3113 | 3126 | ||
3114 | // Un-comment out the following line to Get Raytrace results printed to the console. | 3127 | // Un-comment out the following line to Get Raytrace results printed to the console. |
3115 | //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 3128 | //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
3116 | float ScaleOffset = 0.5f; | 3129 | float ScaleOffset = 0.5f; |
3117 | 3130 | ||
3118 | // If we hit something | 3131 | // If we hit something |
3119 | if (ei.HitTF) | 3132 | if (ei.HitTF) |
3120 | { | 3133 | { |
3121 | Vector3 scale = target.Scale; | 3134 | Vector3 scale = target.Scale; |
3122 | Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); | 3135 | Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); |
3123 | if (scaleComponent.X != 0) ScaleOffset = scale.X; | 3136 | if (scaleComponent.X != 0) ScaleOffset = scale.X; |
3124 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; | 3137 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; |
3125 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; | 3138 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; |
3126 | ScaleOffset = Math.Abs(ScaleOffset); | 3139 | ScaleOffset = Math.Abs(ScaleOffset); |
3127 | Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 3140 | Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
3128 | Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); | 3141 | Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); |
3129 | Vector3 offset = normal * (ScaleOffset / 2f); | 3142 | Vector3 offset = normal * (ScaleOffset / 2f); |
3130 | pos = intersectionpoint + offset; | 3143 | pos = intersectionpoint + offset; |
3131 | 3144 | ||
3132 | // stick in offset format from the original prim | 3145 | // stick in offset format from the original prim |
3133 | pos = pos - target.ParentGroup.AbsolutePosition; | 3146 | pos = pos - target.ParentGroup.AbsolutePosition; |
3134 | if (CopyRotates) | 3147 | if (CopyRotates) |
3135 | { | 3148 | { |
3136 | Quaternion worldRot = target2.GetWorldRotation(); | 3149 | Quaternion worldRot = target2.GetWorldRotation(); |
3137 | 3150 | ||
3138 | // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); | 3151 | // SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); |
3139 | m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); | 3152 | m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot); |
3140 | //obj.Rotation = worldRot; | 3153 | //obj.Rotation = worldRot; |
3141 | //obj.UpdateGroupRotationR(worldRot); | 3154 | //obj.UpdateGroupRotationR(worldRot); |
3142 | } | 3155 | } |
3143 | else | 3156 | else |
3144 | { | 3157 | { |
3145 | m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); | 3158 | m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); |
3146 | } | ||
3147 | } | 3159 | } |
3148 | |||
3149 | return; | ||
3150 | } | 3160 | } |
3151 | |||
3152 | return; | ||
3153 | } | 3161 | } |
3154 | } | 3162 | } |
3155 | 3163 | ||
@@ -3192,7 +3200,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3192 | if (aCircuit == null) | 3200 | if (aCircuit == null) |
3193 | { | 3201 | { |
3194 | m_log.DebugFormat("[APPEARANCE] Client did not supply a circuit. Non-Linden? Creating default appearance."); | 3202 | m_log.DebugFormat("[APPEARANCE] Client did not supply a circuit. Non-Linden? Creating default appearance."); |
3195 | appearance = new AvatarAppearance(client.AgentId); | 3203 | appearance = new AvatarAppearance(); |
3196 | return; | 3204 | return; |
3197 | } | 3205 | } |
3198 | 3206 | ||
@@ -3200,15 +3208,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3200 | if (appearance == null) | 3208 | if (appearance == null) |
3201 | { | 3209 | { |
3202 | m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName); | 3210 | m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName); |
3203 | appearance = new AvatarAppearance(client.AgentId); | 3211 | appearance = new AvatarAppearance(); |
3204 | } | 3212 | } |
3205 | } | 3213 | } |
3206 | 3214 | ||
3207 | /// <summary> | 3215 | public override void RemoveClient(UUID agentID, bool closeChildAgents) |
3208 | /// Remove the given client from the scene. | ||
3209 | /// </summary> | ||
3210 | /// <param name="agentID"></param> | ||
3211 | public override void RemoveClient(UUID agentID) | ||
3212 | { | 3216 | { |
3213 | CheckHeartbeat(); | 3217 | CheckHeartbeat(); |
3214 | bool childagentYN = false; | 3218 | bool childagentYN = false; |
@@ -3229,15 +3233,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3229 | (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); | 3233 | (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); |
3230 | 3234 | ||
3231 | m_sceneGraph.removeUserCount(!childagentYN); | 3235 | m_sceneGraph.removeUserCount(!childagentYN); |
3232 | 3236 | ||
3233 | if (CapsModule != null) | 3237 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3238 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | ||
3239 | if (closeChildAgents && CapsModule != null) | ||
3234 | CapsModule.RemoveCaps(agentID); | 3240 | CapsModule.RemoveCaps(agentID); |
3235 | 3241 | ||
3236 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3242 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3237 | // this method is doing is HORRIBLE!!! | 3243 | // this method is doing is HORRIBLE!!! |
3238 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); | 3244 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); |
3239 | 3245 | ||
3240 | if (!avatar.IsChildAgent) | 3246 | if (closeChildAgents && !avatar.IsChildAgent) |
3241 | { | 3247 | { |
3242 | //List<ulong> childknownRegions = new List<ulong>(); | 3248 | //List<ulong> childknownRegions = new List<ulong>(); |
3243 | //List<ulong> ckn = avatar.KnownChildRegionHandles; | 3249 | //List<ulong> ckn = avatar.KnownChildRegionHandles; |
@@ -3263,8 +3269,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3263 | m_eventManager.TriggerOnRemovePresence(agentID); | 3269 | m_eventManager.TriggerOnRemovePresence(agentID); |
3264 | m_log.Debug("[Scene] Finished OnRemovePresence"); | 3270 | m_log.Debug("[Scene] Finished OnRemovePresence"); |
3265 | 3271 | ||
3266 | if (avatar != null && (!avatar.IsChildAgent)) | 3272 | if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) |
3267 | avatar.SaveChangedAttachments(); | 3273 | AttachmentsModule.SaveChangedAttachments(avatar); |
3268 | 3274 | ||
3269 | if (avatar != null && (!avatar.IsChildAgent)) | 3275 | if (avatar != null && (!avatar.IsChildAgent)) |
3270 | avatar.SaveChangedAttachments(); | 3276 | avatar.SaveChangedAttachments(); |
@@ -3304,7 +3310,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3304 | } | 3310 | } |
3305 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | 3311 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); |
3306 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3312 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3307 | CleanDroppedAttachments(); | 3313 | // CleanDroppedAttachments(); |
3308 | m_log.Debug("[Scene] The avatar has left the building"); | 3314 | m_log.Debug("[Scene] The avatar has left the building"); |
3309 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3315 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
3310 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 3316 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
@@ -3540,7 +3546,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3540 | 3546 | ||
3541 | if (vialogin) | 3547 | if (vialogin) |
3542 | { | 3548 | { |
3543 | CleanDroppedAttachments(); | 3549 | // CleanDroppedAttachments(); |
3544 | 3550 | ||
3545 | if (TestBorderCross(agent.startpos, Cardinals.E)) | 3551 | if (TestBorderCross(agent.startpos, Cardinals.E)) |
3546 | { | 3552 | { |
@@ -3699,11 +3705,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3699 | 3705 | ||
3700 | if (AuthorizationService != null) | 3706 | if (AuthorizationService != null) |
3701 | { | 3707 | { |
3702 | if (!AuthorizationService.IsAuthorizedForRegion(agentID.ToString(), RegionInfo.RegionID.ToString(),out reason)) | 3708 | if (!AuthorizationService.IsAuthorizedForRegion( |
3709 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) | ||
3703 | { | 3710 | { |
3704 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the region", | 3711 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the region", |
3705 | agentID, RegionInfo.RegionName); | 3712 | agentID, RegionInfo.RegionName); |
3706 | //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName); | 3713 | |
3707 | return false; | 3714 | return false; |
3708 | } | 3715 | } |
3709 | } | 3716 | } |
@@ -4033,8 +4040,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4033 | } | 4040 | } |
4034 | 4041 | ||
4035 | /// <summary> | 4042 | /// <summary> |
4036 | /// Tries to teleport agent to other region. | 4043 | /// Tries to teleport agent to another region. |
4037 | /// </summary> | 4044 | /// </summary> |
4045 | /// <remarks> | ||
4046 | /// The region name must exactly match that given. | ||
4047 | /// </remarks> | ||
4038 | /// <param name="remoteClient"></param> | 4048 | /// <param name="remoteClient"></param> |
4039 | /// <param name="regionName"></param> | 4049 | /// <param name="regionName"></param> |
4040 | /// <param name="position"></param> | 4050 | /// <param name="position"></param> |
@@ -4043,15 +4053,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4043 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, | 4053 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, |
4044 | Vector3 lookat, uint teleportFlags) | 4054 | Vector3 lookat, uint teleportFlags) |
4045 | { | 4055 | { |
4046 | List<GridRegion> regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1); | 4056 | GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); |
4047 | if (regions == null || regions.Count == 0) | 4057 | |
4058 | if (region == null) | ||
4048 | { | 4059 | { |
4049 | // can't find the region: Tell viewer and abort | 4060 | // can't find the region: Tell viewer and abort |
4050 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); | 4061 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); |
4051 | return; | 4062 | return; |
4052 | } | 4063 | } |
4053 | 4064 | ||
4054 | RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags); | 4065 | RequestTeleportLocation(remoteClient, region.RegionHandle, position, lookat, teleportFlags); |
4055 | } | 4066 | } |
4056 | 4067 | ||
4057 | /// <summary> | 4068 | /// <summary> |
@@ -4353,7 +4364,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4353 | // their scripts will actually run. | 4364 | // their scripts will actually run. |
4354 | // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 | 4365 | // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 |
4355 | SceneObjectPart parent = part.ParentGroup.RootPart; | 4366 | SceneObjectPart parent = part.ParentGroup.RootPart; |
4356 | if (parent != null && parent.IsAttachment) | 4367 | if (part.ParentGroup.IsAttachment) |
4357 | return ScriptDanger(parent, parent.GetWorldPosition()); | 4368 | return ScriptDanger(parent, parent.GetWorldPosition()); |
4358 | else | 4369 | else |
4359 | return ScriptDanger(part, part.GetWorldPosition()); | 4370 | return ScriptDanger(part, part.GetWorldPosition()); |
@@ -5122,11 +5133,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
5122 | 5133 | ||
5123 | private void HandleDeleteObject(string module, string[] cmd) | 5134 | private void HandleDeleteObject(string module, string[] cmd) |
5124 | { | 5135 | { |
5125 | if (cmd.Length < 4) | 5136 | if (cmd.Length < 3) |
5126 | return; | 5137 | return; |
5127 | 5138 | ||
5128 | string mode = cmd[2]; | 5139 | string mode = cmd[2]; |
5129 | string o = cmd[3]; | 5140 | string o = ""; |
5141 | |||
5142 | if (mode != "outside") | ||
5143 | { | ||
5144 | if (cmd.Length < 4) | ||
5145 | return; | ||
5146 | |||
5147 | o = cmd[3]; | ||
5148 | } | ||
5130 | 5149 | ||
5131 | List<SceneObjectGroup> deletes = new List<SceneObjectGroup>(); | 5150 | List<SceneObjectGroup> deletes = new List<SceneObjectGroup>(); |
5132 | 5151 | ||
@@ -5168,10 +5187,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
5168 | deletes.Add(g); | 5187 | deletes.Add(g); |
5169 | }); | 5188 | }); |
5170 | break; | 5189 | break; |
5190 | case "outside": | ||
5191 | ForEachSOG(delegate (SceneObjectGroup g) | ||
5192 | { | ||
5193 | SceneObjectPart rootPart = g.RootPart; | ||
5194 | bool delete = false; | ||
5195 | |||
5196 | if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) | ||
5197 | { | ||
5198 | delete = true; | ||
5199 | } | ||
5200 | else | ||
5201 | { | ||
5202 | ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); | ||
5203 | |||
5204 | if (parcel == null || parcel.LandData.Name == "NO LAND") | ||
5205 | delete = true; | ||
5206 | } | ||
5207 | |||
5208 | if (delete && !g.IsAttachment && !deletes.Contains(g)) | ||
5209 | deletes.Add(g); | ||
5210 | }); | ||
5211 | break; | ||
5171 | } | 5212 | } |
5172 | 5213 | ||
5173 | foreach (SceneObjectGroup g in deletes) | 5214 | foreach (SceneObjectGroup g in deletes) |
5215 | { | ||
5216 | m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID); | ||
5174 | DeleteSceneObject(g, false); | 5217 | DeleteSceneObject(g, false); |
5218 | } | ||
5175 | } | 5219 | } |
5176 | 5220 | ||
5177 | private void HandleReloadEstate(string module, string[] cmd) | 5221 | private void HandleReloadEstate(string module, string[] cmd) |
@@ -5268,10 +5312,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
5268 | } | 5312 | } |
5269 | } | 5313 | } |
5270 | 5314 | ||
5271 | public void CleanDroppedAttachments() | 5315 | // public void CleanDroppedAttachments() |
5272 | { | 5316 | // { |
5273 | List<SceneObjectGroup> objectsToDelete = | 5317 | // List<SceneObjectGroup> objectsToDelete = |
5274 | new List<SceneObjectGroup>(); | 5318 | // new List<SceneObjectGroup>(); |
5319 | // | ||
5320 | // lock (m_cleaningAttachments) | ||
5321 | // { | ||
5322 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5323 | // { | ||
5324 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5325 | // { | ||
5326 | // UUID agentID = grp.OwnerID; | ||
5327 | // if (agentID == UUID.Zero) | ||
5328 | // { | ||
5329 | // objectsToDelete.Add(grp); | ||
5330 | // return; | ||
5331 | // } | ||
5332 | // | ||
5333 | // ScenePresence sp = GetScenePresence(agentID); | ||
5334 | // if (sp == null) | ||
5335 | // { | ||
5336 | // objectsToDelete.Add(grp); | ||
5337 | // return; | ||
5338 | // } | ||
5339 | // } | ||
5340 | // }); | ||
5341 | // } | ||
5342 | // | ||
5343 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5344 | // { | ||
5345 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5346 | // DeleteSceneObject(grp, true); | ||
5347 | // } | ||
5348 | // } | ||
5275 | 5349 | ||
5276 | lock (m_cleaningAttachments) | 5350 | lock (m_cleaningAttachments) |
5277 | { | 5351 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f343bc8..bf861b8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -177,18 +177,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
177 | 177 | ||
178 | #region Add/Remove Agent/Avatar | 178 | #region Add/Remove Agent/Avatar |
179 | 179 | ||
180 | /// <summary> | 180 | public abstract void AddNewClient(IClientAPI client, PresenceType type); |
181 | /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing | 181 | public abstract void RemoveClient(UUID agentID, bool closeChildAgents); |
182 | /// will promote it to a root agent during login. | ||
183 | /// </summary> | ||
184 | /// <param name="client"></param | ||
185 | public abstract void AddNewClient(IClientAPI client); | ||
186 | |||
187 | /// <summary> | ||
188 | /// Remove a client from the scene | ||
189 | /// </summary> | ||
190 | /// <param name="agentID"></param> | ||
191 | public abstract void RemoveClient(UUID agentID); | ||
192 | 182 | ||
193 | public bool TryGetScenePresence(UUID agentID, out object scenePresence) | 183 | public bool TryGetScenePresence(UUID agentID, out object scenePresence) |
194 | { | 184 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 39d4a29..29edf13 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -403,7 +403,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
403 | /// </returns> | 403 | /// </returns> |
404 | protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 404 | protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
405 | { | 405 | { |
406 | if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) | 406 | if (sceneObject == null || sceneObject.RootPart.UUID == UUID.Zero) |
407 | return false; | 407 | return false; |
408 | 408 | ||
409 | if (Entities.ContainsKey(sceneObject.UUID)) | 409 | if (Entities.ContainsKey(sceneObject.UUID)) |
@@ -613,13 +613,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
613 | m_activeScripts += number; | 613 | m_activeScripts += number; |
614 | } | 614 | } |
615 | 615 | ||
616 | public void DropObject(uint objectLocalID, IClientAPI remoteClient) | ||
617 | { | ||
618 | SceneObjectGroup group = GetGroupByPrim(objectLocalID); | ||
619 | if (group != null) | ||
620 | m_parentScene.AttachmentsModule.DetachSingleAttachmentToGround(group.UUID, remoteClient); | ||
621 | } | ||
622 | |||
623 | protected internal void HandleUndo(IClientAPI remoteClient, UUID primId) | 616 | protected internal void HandleUndo(IClientAPI remoteClient, UUID primId) |
624 | { | 617 | { |
625 | if (primId != UUID.Zero) | 618 | if (primId != UUID.Zero) |
@@ -629,11 +622,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
629 | part.Undo(); | 622 | part.Undo(); |
630 | } | 623 | } |
631 | } | 624 | } |
625 | |||
632 | protected internal void HandleRedo(IClientAPI remoteClient, UUID primId) | 626 | protected internal void HandleRedo(IClientAPI remoteClient, UUID primId) |
633 | { | 627 | { |
634 | if (primId != UUID.Zero) | 628 | if (primId != UUID.Zero) |
635 | { | 629 | { |
636 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); | 630 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); |
631 | |||
637 | if (part != null) | 632 | if (part != null) |
638 | part.Redo(); | 633 | part.Redo(); |
639 | } | 634 | } |
@@ -653,12 +648,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
653 | } | 648 | } |
654 | } | 649 | } |
655 | 650 | ||
656 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) | 651 | protected internal ScenePresence CreateAndAddChildScenePresence( |
652 | IClientAPI client, AvatarAppearance appearance, PresenceType type) | ||
657 | { | 653 | { |
658 | ScenePresence newAvatar = null; | 654 | ScenePresence newAvatar = null; |
659 | 655 | ||
660 | // ScenePresence always defaults to child agent | 656 | // ScenePresence always defaults to child agent |
661 | newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); | 657 | newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type); |
662 | 658 | ||
663 | AddScenePresence(newAvatar); | 659 | AddScenePresence(newAvatar); |
664 | 660 | ||
@@ -1285,19 +1281,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1285 | #region Client Event handlers | 1281 | #region Client Event handlers |
1286 | 1282 | ||
1287 | /// <summary> | 1283 | /// <summary> |
1288 | /// | 1284 | /// Update the scale of an individual prim. |
1289 | /// </summary> | 1285 | /// </summary> |
1290 | /// <param name="localID"></param> | 1286 | /// <param name="localID"></param> |
1291 | /// <param name="scale"></param> | 1287 | /// <param name="scale"></param> |
1292 | /// <param name="remoteClient"></param> | 1288 | /// <param name="remoteClient"></param> |
1293 | protected internal void UpdatePrimScale(uint localID, Vector3 scale, IClientAPI remoteClient) | 1289 | protected internal void UpdatePrimScale(uint localID, Vector3 scale, IClientAPI remoteClient) |
1294 | { | 1290 | { |
1295 | SceneObjectGroup group = GetGroupByPrim(localID); | 1291 | SceneObjectPart part = GetSceneObjectPart(localID); |
1296 | if (group != null) | 1292 | |
1293 | if (part != null) | ||
1297 | { | 1294 | { |
1298 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1295 | if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)) |
1299 | { | 1296 | { |
1300 | group.Resize(scale, localID); | 1297 | part.Resize(scale); |
1301 | } | 1298 | } |
1302 | } | 1299 | } |
1303 | } | 1300 | } |
@@ -1309,7 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1309 | { | 1306 | { |
1310 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1307 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) |
1311 | { | 1308 | { |
1312 | group.GroupResize(scale, localID); | 1309 | group.GroupResize(scale); |
1313 | } | 1310 | } |
1314 | } | 1311 | } |
1315 | } | 1312 | } |
@@ -1363,19 +1360,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1363 | { | 1360 | { |
1364 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) | 1361 | if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) |
1365 | { | 1362 | { |
1366 | group.UpdateSingleRotation(rot,pos, localID); | 1363 | group.UpdateSingleRotation(rot, pos, localID); |
1367 | } | 1364 | } |
1368 | } | 1365 | } |
1369 | } | 1366 | } |
1370 | 1367 | ||
1371 | |||
1372 | /// <summary> | 1368 | /// <summary> |
1373 | /// | 1369 | /// Update the rotation of a whole group. |
1374 | /// </summary> | 1370 | /// </summary> |
1375 | /// <param name="localID"></param> | 1371 | /// <param name="localID"></param> |
1376 | /// <param name="rot"></param> | 1372 | /// <param name="rot"></param> |
1377 | /// <param name="remoteClient"></param> | 1373 | /// <param name="remoteClient"></param> |
1378 | protected internal void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient) | 1374 | protected internal void UpdatePrimGroupRotation(uint localID, Quaternion rot, IClientAPI remoteClient) |
1379 | { | 1375 | { |
1380 | SceneObjectGroup group = GetGroupByPrim(localID); | 1376 | SceneObjectGroup group = GetGroupByPrim(localID); |
1381 | if (group != null) | 1377 | if (group != null) |
@@ -1394,7 +1390,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1394 | /// <param name="pos"></param> | 1390 | /// <param name="pos"></param> |
1395 | /// <param name="rot"></param> | 1391 | /// <param name="rot"></param> |
1396 | /// <param name="remoteClient"></param> | 1392 | /// <param name="remoteClient"></param> |
1397 | protected internal void UpdatePrimRotation(uint localID, Vector3 pos, Quaternion rot, IClientAPI remoteClient) | 1393 | protected internal void UpdatePrimGroupRotation(uint localID, Vector3 pos, Quaternion rot, IClientAPI remoteClient) |
1398 | { | 1394 | { |
1399 | SceneObjectGroup group = GetGroupByPrim(localID); | 1395 | SceneObjectGroup group = GetGroupByPrim(localID); |
1400 | if (group != null) | 1396 | if (group != null) |
@@ -1425,12 +1421,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1425 | } | 1421 | } |
1426 | 1422 | ||
1427 | /// <summary> | 1423 | /// <summary> |
1428 | /// Update the position of the given part | 1424 | /// Update the position of the given group. |
1429 | /// </summary> | 1425 | /// </summary> |
1430 | /// <param name="localID"></param> | 1426 | /// <param name="localID"></param> |
1431 | /// <param name="pos"></param> | 1427 | /// <param name="pos"></param> |
1432 | /// <param name="remoteClient"></param> | 1428 | /// <param name="remoteClient"></param> |
1433 | public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient) | 1429 | public void UpdatePrimGroupPosition(uint localID, Vector3 pos, IClientAPI remoteClient) |
1434 | { | 1430 | { |
1435 | SceneObjectGroup group = GetGroupByPrim(localID); | 1431 | SceneObjectGroup group = GetGroupByPrim(localID); |
1436 | 1432 | ||
@@ -1481,21 +1477,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1481 | } | 1477 | } |
1482 | 1478 | ||
1483 | /// <summary> | 1479 | /// <summary> |
1484 | /// | 1480 | /// Update the flags on a scene object. This covers properties such as phantom, physics and temporary. |
1485 | /// </summary> | 1481 | /// </summary> |
1482 | /// <remarks> | ||
1483 | /// This is currently handling the incoming call from the client stack (e.g. LLClientView). | ||
1484 | /// </remarks> | ||
1486 | /// <param name="localID"></param> | 1485 | /// <param name="localID"></param> |
1487 | /// <param name="packet"></param> | 1486 | /// <param name="UsePhysics"></param> |
1487 | /// <param name="SetTemporary"></param> | ||
1488 | /// <param name="SetPhantom"></param> | ||
1488 | /// <param name="remoteClient"></param> | 1489 | /// <param name="remoteClient"></param> |
1489 | /// This routine seems to get called when a user changes object settings in the viewer. | 1490 | protected internal void UpdatePrimFlags( |
1490 | /// If some one can confirm that, please change the comment according. | 1491 | uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, IClientAPI remoteClient) |
1491 | protected internal void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient) | ||
1492 | { | 1492 | { |
1493 | SceneObjectGroup group = GetGroupByPrim(localID); | 1493 | SceneObjectGroup group = GetGroupByPrim(localID); |
1494 | if (group != null) | 1494 | if (group != null) |
1495 | { | 1495 | { |
1496 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1496 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) |
1497 | { | 1497 | { |
1498 | group.UpdatePrimFlags(localID, UsePhysics, IsTemporary, IsPhantom, false); // VolumeDetect can't be set via UI and will always be off when a change is made there | 1498 | // VolumeDetect can't be set via UI and will always be off when a change is made there |
1499 | group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false); | ||
1499 | } | 1500 | } |
1500 | } | 1501 | } |
1501 | } | 1502 | } |
@@ -1618,8 +1619,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1618 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1619 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) |
1619 | { | 1620 | { |
1620 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); | 1621 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); |
1621 | part.ClickAction = Convert.ToByte(clickAction); | 1622 | if (part != null) |
1622 | group.HasGroupChanged = true; | 1623 | { |
1624 | part.ClickAction = Convert.ToByte(clickAction); | ||
1625 | group.HasGroupChanged = true; | ||
1626 | } | ||
1623 | } | 1627 | } |
1624 | } | 1628 | } |
1625 | } | 1629 | } |
@@ -1632,8 +1636,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1632 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) | 1636 | if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) |
1633 | { | 1637 | { |
1634 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); | 1638 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); |
1635 | part.Material = Convert.ToByte(material); | 1639 | if (part != null) |
1636 | group.HasGroupChanged = true; | 1640 | { |
1641 | part.Material = Convert.ToByte(material); | ||
1642 | group.HasGroupChanged = true; | ||
1643 | } | ||
1637 | } | 1644 | } |
1638 | } | 1645 | } |
1639 | } | 1646 | } |
@@ -1706,23 +1713,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1706 | parentGroup.areUpdatesSuspended = true; | 1713 | parentGroup.areUpdatesSuspended = true; |
1707 | 1714 | ||
1708 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); | 1715 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); |
1709 | if (parentGroup != null) | 1716 | |
1717 | // We do this in reverse to get the link order of the prims correct | ||
1718 | for (int i = children.Count - 1; i >= 0; i--) | ||
1710 | { | 1719 | { |
1711 | // We do this in reverse to get the link order of the prims correct | 1720 | SceneObjectGroup child = children[i].ParentGroup; |
1712 | for (int i = children.Count - 1; i >= 0; i--) | ||
1713 | { | ||
1714 | SceneObjectGroup child = children[i].ParentGroup; | ||
1715 | 1721 | ||
1722 | // Make sure no child prim is set for sale | ||
1723 | // So that, on delink, no prims are unwittingly | ||
1724 | // left for sale and sold off | ||
1725 | |||
1716 | if (child != null) | 1726 | if (child != null) |
1717 | { | 1727 | { |
1728 | child.RootPart.ObjectSaleType = 0; | ||
1729 | child.RootPart.SalePrice = 10; | ||
1718 | childGroups.Add(child); | 1730 | childGroups.Add(child); |
1719 | } | 1731 | } |
1720 | } | 1732 | } |
1721 | } | 1733 | } |
1722 | else | ||
1723 | { | ||
1724 | return; // parent is null so not in this region | ||
1725 | } | ||
1726 | 1734 | ||
1727 | foreach (SceneObjectGroup child in childGroups) | 1735 | foreach (SceneObjectGroup child in childGroups) |
1728 | { | 1736 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 86ba2aa..7fada4b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -47,12 +47,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
47 | 47 | ||
48 | public event RestartSim OnRestartSim; | 48 | public event RestartSim OnRestartSim; |
49 | 49 | ||
50 | private readonly List<Scene> m_localScenes; | 50 | private static SceneManager m_instance = null; |
51 | public static SceneManager Instance | ||
52 | { | ||
53 | get { return m_instance; } | ||
54 | } | ||
55 | |||
56 | private readonly List<Scene> m_localScenes = new List<Scene>(); | ||
51 | private Scene m_currentScene = null; | 57 | private Scene m_currentScene = null; |
52 | 58 | ||
53 | public List<Scene> Scenes | 59 | public List<Scene> Scenes |
54 | { | 60 | { |
55 | get { return m_localScenes; } | 61 | get { return new List<Scene>(m_localScenes); } |
56 | } | 62 | } |
57 | 63 | ||
58 | public Scene CurrentScene | 64 | public Scene CurrentScene |
@@ -66,13 +72,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
66 | { | 72 | { |
67 | if (m_currentScene == null) | 73 | if (m_currentScene == null) |
68 | { | 74 | { |
69 | if (m_localScenes.Count > 0) | 75 | lock (m_localScenes) |
70 | { | 76 | { |
71 | return m_localScenes[0]; | 77 | if (m_localScenes.Count > 0) |
72 | } | 78 | return m_localScenes[0]; |
73 | else | 79 | else |
74 | { | 80 | return null; |
75 | return null; | ||
76 | } | 81 | } |
77 | } | 82 | } |
78 | else | 83 | else |
@@ -84,6 +89,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
84 | 89 | ||
85 | public SceneManager() | 90 | public SceneManager() |
86 | { | 91 | { |
92 | m_instance = this; | ||
87 | m_localScenes = new List<Scene>(); | 93 | m_localScenes = new List<Scene>(); |
88 | } | 94 | } |
89 | 95 | ||
@@ -91,17 +97,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
91 | { | 97 | { |
92 | // collect known shared modules in sharedModules | 98 | // collect known shared modules in sharedModules |
93 | Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>(); | 99 | Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>(); |
94 | for (int i = 0; i < m_localScenes.Count; i++) | 100 | |
101 | lock (m_localScenes) | ||
95 | { | 102 | { |
96 | // extract known shared modules from scene | 103 | for (int i = 0; i < m_localScenes.Count; i++) |
97 | foreach (string k in m_localScenes[i].Modules.Keys) | ||
98 | { | 104 | { |
99 | if (m_localScenes[i].Modules[k].IsSharedModule && | 105 | // extract known shared modules from scene |
100 | !sharedModules.ContainsKey(k)) | 106 | foreach (string k in m_localScenes[i].Modules.Keys) |
101 | sharedModules[k] = m_localScenes[i].Modules[k]; | 107 | { |
108 | if (m_localScenes[i].Modules[k].IsSharedModule && | ||
109 | !sharedModules.ContainsKey(k)) | ||
110 | sharedModules[k] = m_localScenes[i].Modules[k]; | ||
111 | } | ||
112 | // close scene/region | ||
113 | m_localScenes[i].Close(); | ||
102 | } | 114 | } |
103 | // close scene/region | ||
104 | m_localScenes[i].Close(); | ||
105 | } | 115 | } |
106 | 116 | ||
107 | // all regions/scenes are now closed, we can now safely | 117 | // all regions/scenes are now closed, we can now safely |
@@ -114,13 +124,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
114 | 124 | ||
115 | public void Close(Scene cscene) | 125 | public void Close(Scene cscene) |
116 | { | 126 | { |
117 | if (m_localScenes.Contains(cscene)) | 127 | lock (m_localScenes) |
118 | { | 128 | { |
119 | for (int i = 0; i < m_localScenes.Count; i++) | 129 | if (m_localScenes.Contains(cscene)) |
120 | { | 130 | { |
121 | if (m_localScenes[i].Equals(cscene)) | 131 | for (int i = 0; i < m_localScenes.Count; i++) |
122 | { | 132 | { |
123 | m_localScenes[i].Close(); | 133 | if (m_localScenes[i].Equals(cscene)) |
134 | { | ||
135 | m_localScenes[i].Close(); | ||
136 | } | ||
124 | } | 137 | } |
125 | } | 138 | } |
126 | } | 139 | } |
@@ -129,27 +142,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
129 | public void Add(Scene scene) | 142 | public void Add(Scene scene) |
130 | { | 143 | { |
131 | scene.OnRestart += HandleRestart; | 144 | scene.OnRestart += HandleRestart; |
132 | m_localScenes.Add(scene); | 145 | |
146 | lock (m_localScenes) | ||
147 | m_localScenes.Add(scene); | ||
133 | } | 148 | } |
134 | 149 | ||
135 | public void HandleRestart(RegionInfo rdata) | 150 | public void HandleRestart(RegionInfo rdata) |
136 | { | 151 | { |
137 | m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); | 152 | m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); |
138 | int RegionSceneElement = -1; | 153 | int RegionSceneElement = -1; |
139 | for (int i = 0; i < m_localScenes.Count; i++) | 154 | |
155 | lock (m_localScenes) | ||
140 | { | 156 | { |
141 | if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName) | 157 | for (int i = 0; i < m_localScenes.Count; i++) |
142 | { | 158 | { |
143 | RegionSceneElement = i; | 159 | if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName) |
160 | { | ||
161 | RegionSceneElement = i; | ||
162 | } | ||
144 | } | 163 | } |
145 | } | ||
146 | 164 | ||
147 | // Now we make sure the region is no longer known about by the SceneManager | 165 | // Now we make sure the region is no longer known about by the SceneManager |
148 | // Prevents duplicates. | 166 | // Prevents duplicates. |
149 | 167 | ||
150 | if (RegionSceneElement >= 0) | 168 | if (RegionSceneElement >= 0) |
151 | { | 169 | { |
152 | m_localScenes.RemoveAt(RegionSceneElement); | 170 | m_localScenes.RemoveAt(RegionSceneElement); |
171 | } | ||
153 | } | 172 | } |
154 | 173 | ||
155 | // Send signal to main that we're restarting this sim. | 174 | // Send signal to main that we're restarting this sim. |
@@ -160,28 +179,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
160 | { | 179 | { |
161 | RegionInfo Result = null; | 180 | RegionInfo Result = null; |
162 | 181 | ||
163 | for (int i = 0; i < m_localScenes.Count; i++) | 182 | lock (m_localScenes) |
164 | { | ||
165 | if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle) | ||
166 | { | ||
167 | // Inform other regions to tell their avatar about me | ||
168 | Result = m_localScenes[i].RegionInfo; | ||
169 | } | ||
170 | } | ||
171 | if (Result != null) | ||
172 | { | 183 | { |
173 | for (int i = 0; i < m_localScenes.Count; i++) | 184 | for (int i = 0; i < m_localScenes.Count; i++) |
174 | { | 185 | { |
175 | if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle) | 186 | if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle) |
176 | { | 187 | { |
177 | // Inform other regions to tell their avatar about me | 188 | // Inform other regions to tell their avatar about me |
178 | //m_localScenes[i].OtherRegionUp(Result); | 189 | Result = m_localScenes[i].RegionInfo; |
179 | } | 190 | } |
180 | } | 191 | } |
181 | } | 192 | |
182 | else | 193 | if (Result != null) |
183 | { | 194 | { |
184 | m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up"); | 195 | for (int i = 0; i < m_localScenes.Count; i++) |
196 | { | ||
197 | if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle) | ||
198 | { | ||
199 | // Inform other regions to tell their avatar about me | ||
200 | //m_localScenes[i].OtherRegionUp(Result); | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up"); | ||
207 | } | ||
185 | } | 208 | } |
186 | } | 209 | } |
187 | 210 | ||
@@ -285,7 +308,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
285 | { | 308 | { |
286 | if (m_currentScene == null) | 309 | if (m_currentScene == null) |
287 | { | 310 | { |
288 | m_localScenes.ForEach(func); | 311 | lock (m_localScenes) |
312 | m_localScenes.ForEach(func); | ||
289 | } | 313 | } |
290 | else | 314 | else |
291 | { | 315 | { |
@@ -314,12 +338,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
314 | } | 338 | } |
315 | else | 339 | else |
316 | { | 340 | { |
317 | foreach (Scene scene in m_localScenes) | 341 | lock (m_localScenes) |
318 | { | 342 | { |
319 | if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) | 343 | foreach (Scene scene in m_localScenes) |
320 | { | 344 | { |
321 | m_currentScene = scene; | 345 | if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) |
322 | return true; | 346 | { |
347 | m_currentScene = scene; | ||
348 | return true; | ||
349 | } | ||
323 | } | 350 | } |
324 | } | 351 | } |
325 | 352 | ||
@@ -331,12 +358,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
331 | { | 358 | { |
332 | m_log.Debug("Searching for Region: '" + regionID + "'"); | 359 | m_log.Debug("Searching for Region: '" + regionID + "'"); |
333 | 360 | ||
334 | foreach (Scene scene in m_localScenes) | 361 | lock (m_localScenes) |
335 | { | 362 | { |
336 | if (scene.RegionInfo.RegionID == regionID) | 363 | foreach (Scene scene in m_localScenes) |
337 | { | 364 | { |
338 | m_currentScene = scene; | 365 | if (scene.RegionInfo.RegionID == regionID) |
339 | return true; | 366 | { |
367 | m_currentScene = scene; | ||
368 | return true; | ||
369 | } | ||
340 | } | 370 | } |
341 | } | 371 | } |
342 | 372 | ||
@@ -345,26 +375,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
345 | 375 | ||
346 | public bool TryGetScene(string regionName, out Scene scene) | 376 | public bool TryGetScene(string regionName, out Scene scene) |
347 | { | 377 | { |
348 | foreach (Scene mscene in m_localScenes) | 378 | lock (m_localScenes) |
349 | { | 379 | { |
350 | if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) | 380 | foreach (Scene mscene in m_localScenes) |
351 | { | 381 | { |
352 | scene = mscene; | 382 | if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) |
353 | return true; | 383 | { |
384 | scene = mscene; | ||
385 | return true; | ||
386 | } | ||
354 | } | 387 | } |
355 | } | 388 | } |
389 | |||
356 | scene = null; | 390 | scene = null; |
357 | return false; | 391 | return false; |
358 | } | 392 | } |
359 | 393 | ||
360 | public bool TryGetScene(UUID regionID, out Scene scene) | 394 | public bool TryGetScene(UUID regionID, out Scene scene) |
361 | { | 395 | { |
362 | foreach (Scene mscene in m_localScenes) | 396 | lock (m_localScenes) |
363 | { | 397 | { |
364 | if (mscene.RegionInfo.RegionID == regionID) | 398 | foreach (Scene mscene in m_localScenes) |
365 | { | 399 | { |
366 | scene = mscene; | 400 | if (mscene.RegionInfo.RegionID == regionID) |
367 | return true; | 401 | { |
402 | scene = mscene; | ||
403 | return true; | ||
404 | } | ||
368 | } | 405 | } |
369 | } | 406 | } |
370 | 407 | ||
@@ -374,13 +411,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
374 | 411 | ||
375 | public bool TryGetScene(uint locX, uint locY, out Scene scene) | 412 | public bool TryGetScene(uint locX, uint locY, out Scene scene) |
376 | { | 413 | { |
377 | foreach (Scene mscene in m_localScenes) | 414 | lock (m_localScenes) |
378 | { | 415 | { |
379 | if (mscene.RegionInfo.RegionLocX == locX && | 416 | foreach (Scene mscene in m_localScenes) |
380 | mscene.RegionInfo.RegionLocY == locY) | ||
381 | { | 417 | { |
382 | scene = mscene; | 418 | if (mscene.RegionInfo.RegionLocX == locX && |
383 | return true; | 419 | mscene.RegionInfo.RegionLocY == locY) |
420 | { | ||
421 | scene = mscene; | ||
422 | return true; | ||
423 | } | ||
384 | } | 424 | } |
385 | } | 425 | } |
386 | 426 | ||
@@ -390,13 +430,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
390 | 430 | ||
391 | public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene) | 431 | public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene) |
392 | { | 432 | { |
393 | foreach (Scene mscene in m_localScenes) | 433 | lock (m_localScenes) |
394 | { | 434 | { |
395 | if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) && | 435 | foreach (Scene mscene in m_localScenes) |
396 | (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port)) | ||
397 | { | 436 | { |
398 | scene = mscene; | 437 | if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) && |
399 | return true; | 438 | (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port)) |
439 | { | ||
440 | scene = mscene; | ||
441 | return true; | ||
442 | } | ||
400 | } | 443 | } |
401 | } | 444 | } |
402 | 445 | ||
@@ -465,11 +508,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
465 | 508 | ||
466 | public RegionInfo GetRegionInfo(UUID regionID) | 509 | public RegionInfo GetRegionInfo(UUID regionID) |
467 | { | 510 | { |
468 | foreach (Scene scene in m_localScenes) | 511 | lock (m_localScenes) |
469 | { | 512 | { |
470 | if (scene.RegionInfo.RegionID == regionID) | 513 | foreach (Scene scene in m_localScenes) |
471 | { | 514 | { |
472 | return scene.RegionInfo; | 515 | if (scene.RegionInfo.RegionID == regionID) |
516 | { | ||
517 | return scene.RegionInfo; | ||
518 | } | ||
473 | } | 519 | } |
474 | } | 520 | } |
475 | 521 | ||
@@ -488,11 +534,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
488 | 534 | ||
489 | public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) | 535 | public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) |
490 | { | 536 | { |
491 | foreach (Scene scene in m_localScenes) | 537 | lock (m_localScenes) |
492 | { | 538 | { |
493 | if (scene.TryGetScenePresence(avatarId, out avatar)) | 539 | foreach (Scene scene in m_localScenes) |
494 | { | 540 | { |
495 | return true; | 541 | if (scene.TryGetScenePresence(avatarId, out avatar)) |
542 | { | ||
543 | return true; | ||
544 | } | ||
496 | } | 545 | } |
497 | } | 546 | } |
498 | 547 | ||
@@ -503,12 +552,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
503 | public bool TryGetAvatarsScene(UUID avatarId, out Scene scene) | 552 | public bool TryGetAvatarsScene(UUID avatarId, out Scene scene) |
504 | { | 553 | { |
505 | ScenePresence avatar = null; | 554 | ScenePresence avatar = null; |
506 | foreach (Scene mScene in m_localScenes) | 555 | |
556 | lock (m_localScenes) | ||
507 | { | 557 | { |
508 | if (mScene.TryGetScenePresence(avatarId, out avatar)) | 558 | foreach (Scene mScene in m_localScenes) |
509 | { | 559 | { |
510 | scene = mScene; | 560 | if (mScene.TryGetScenePresence(avatarId, out avatar)) |
511 | return true; | 561 | { |
562 | scene = mScene; | ||
563 | return true; | ||
564 | } | ||
512 | } | 565 | } |
513 | } | 566 | } |
514 | 567 | ||
@@ -518,17 +571,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
518 | 571 | ||
519 | public void CloseScene(Scene scene) | 572 | public void CloseScene(Scene scene) |
520 | { | 573 | { |
521 | m_localScenes.Remove(scene); | 574 | lock (m_localScenes) |
575 | m_localScenes.Remove(scene); | ||
576 | |||
522 | scene.Close(); | 577 | scene.Close(); |
523 | } | 578 | } |
524 | 579 | ||
525 | public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) | 580 | public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) |
526 | { | 581 | { |
527 | foreach (Scene scene in m_localScenes) | 582 | lock (m_localScenes) |
528 | { | 583 | { |
529 | if (scene.TryGetAvatarByName(avatarName, out avatar)) | 584 | foreach (Scene scene in m_localScenes) |
530 | { | 585 | { |
531 | return true; | 586 | if (scene.TryGetAvatarByName(avatarName, out avatar)) |
587 | { | ||
588 | return true; | ||
589 | } | ||
532 | } | 590 | } |
533 | } | 591 | } |
534 | 592 | ||
@@ -538,7 +596,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
538 | 596 | ||
539 | public void ForEachScene(Action<Scene> action) | 597 | public void ForEachScene(Action<Scene> action) |
540 | { | 598 | { |
541 | m_localScenes.ForEach(action); | 599 | lock (m_localScenes) |
600 | m_localScenes.ForEach(action); | ||
542 | } | 601 | } |
543 | } | 602 | } |
544 | } | 603 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6c47645..b1b76dd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -209,25 +209,87 @@ namespace OpenSim.Region.Framework.Scenes | |||
209 | return true; | 209 | return true; |
210 | return false; | 210 | return false; |
211 | } | 211 | } |
212 | 212 | ||
213 | /// <value> | 213 | /// <summary> |
214 | /// Is this scene object acting as an attachment? | 214 | /// Is this scene object acting as an attachment? |
215 | /// | 215 | /// </summary> |
216 | /// We return false if the group has already been deleted. | 216 | public bool IsAttachment { get; set; } |
217 | /// | 217 | |
218 | /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I | 218 | /// <summary> |
219 | /// presume either all or no parts in a linkset can be part of an attachment (in which | 219 | /// The avatar to which this scene object is attached. |
220 | /// case the value would get proprogated down into all the descendent parts). | 220 | /// </summary> |
221 | /// </value> | 221 | /// <remarks> |
222 | public bool IsAttachment | 222 | /// If we're not attached to an avatar then this is UUID.Zero |
223 | /// </remarks> | ||
224 | public UUID AttachedAvatar { get; set; } | ||
225 | |||
226 | /// <summary> | ||
227 | /// Attachment point of this scene object to an avatar. | ||
228 | /// </summary> | ||
229 | /// <remarks> | ||
230 | /// 0 if we're not attached to anything | ||
231 | /// </remarks> | ||
232 | public uint AttachmentPoint | ||
223 | { | 233 | { |
224 | get | 234 | get |
225 | { | 235 | { |
226 | if (!IsDeleted) | 236 | return m_rootPart.Shape.State; |
227 | return m_rootPart.IsAttachment; | ||
228 | |||
229 | return false; | ||
230 | } | 237 | } |
238 | |||
239 | set | ||
240 | { | ||
241 | IsAttachment = value != 0; | ||
242 | m_rootPart.Shape.State = (byte)value; | ||
243 | } | ||
244 | } | ||
245 | |||
246 | public void ClearPartAttachmentData() | ||
247 | { | ||
248 | AttachmentPoint = 0; | ||
249 | |||
250 | // Even though we don't use child part state parameters for attachments any more, we still need to set | ||
251 | // these to zero since having them non-zero in rezzed scene objects will crash some clients. Even if | ||
252 | // we store them correctly, scene objects that we receive from elsewhere might not. | ||
253 | foreach (SceneObjectPart part in Parts) | ||
254 | part.Shape.State = 0; | ||
255 | } | ||
256 | |||
257 | /// <summary> | ||
258 | /// Is this scene object phantom? | ||
259 | /// </summary> | ||
260 | /// <remarks> | ||
261 | /// Updating must currently take place through UpdatePrimFlags() | ||
262 | /// </remarks> | ||
263 | public bool IsPhantom | ||
264 | { | ||
265 | get { return (RootPart.Flags & PrimFlags.Phantom) != 0; } | ||
266 | } | ||
267 | |||
268 | /// <summary> | ||
269 | /// Does this scene object use physics? | ||
270 | /// </summary> | ||
271 | /// <remarks> | ||
272 | /// Updating must currently take place through UpdatePrimFlags() | ||
273 | /// </remarks> | ||
274 | public bool UsesPhysics | ||
275 | { | ||
276 | get { return (RootPart.Flags & PrimFlags.TemporaryOnRez) != 0; } | ||
277 | } | ||
278 | |||
279 | /// <summary> | ||
280 | /// Is this scene object temporary? | ||
281 | /// </summary> | ||
282 | /// <remarks> | ||
283 | /// Updating must currently take place through UpdatePrimFlags() | ||
284 | /// </remarks> | ||
285 | public bool IsTemporary | ||
286 | { | ||
287 | get { return (RootPart.Flags & PrimFlags.TemporaryOnRez) != 0; } | ||
288 | } | ||
289 | |||
290 | public bool IsVolumeDetect | ||
291 | { | ||
292 | get { return RootPart.VolumeDetectActive; } | ||
231 | } | 293 | } |
232 | 294 | ||
233 | public float scriptScore; | 295 | public float scriptScore; |
@@ -261,11 +323,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
261 | /// </summary> | 323 | /// </summary> |
262 | public override string Name | 324 | public override string Name |
263 | { | 325 | { |
264 | get { | 326 | get { return RootPart.Name; } |
265 | if (RootPart == null) | ||
266 | return String.Empty; | ||
267 | return RootPart.Name; | ||
268 | } | ||
269 | set { RootPart.Name = value; } | 327 | set { RootPart.Name = value; } |
270 | } | 328 | } |
271 | 329 | ||
@@ -305,6 +363,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
305 | get { return m_rootPart.RotationOffset; } | 363 | get { return m_rootPart.RotationOffset; } |
306 | } | 364 | } |
307 | 365 | ||
366 | public Vector3 GroupScale | ||
367 | { | ||
368 | get | ||
369 | { | ||
370 | Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); | ||
371 | Vector3 maxScale = Vector3.Zero; | ||
372 | Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); | ||
373 | |||
374 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
375 | for (int i = 0; i < parts.Length; i++) | ||
376 | { | ||
377 | SceneObjectPart part = parts[i]; | ||
378 | Vector3 partscale = part.Scale; | ||
379 | Vector3 partoffset = part.OffsetPosition; | ||
380 | |||
381 | minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X; | ||
382 | minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y; | ||
383 | minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z; | ||
384 | |||
385 | maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X; | ||
386 | maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y; | ||
387 | maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z; | ||
388 | } | ||
389 | |||
390 | finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X; | ||
391 | finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; | ||
392 | finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; | ||
393 | |||
394 | return finalScale; | ||
395 | } | ||
396 | } | ||
397 | |||
308 | public UUID GroupID | 398 | public UUID GroupID |
309 | { | 399 | { |
310 | get { return m_rootPart.GroupID; } | 400 | get { return m_rootPart.GroupID; } |
@@ -344,11 +434,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
344 | /// <summary> | 434 | /// <summary> |
345 | /// Check both the attachment property and the relevant properties of the underlying root part. | 435 | /// Check both the attachment property and the relevant properties of the underlying root part. |
346 | /// </summary> | 436 | /// </summary> |
437 | /// <remarks> | ||
347 | /// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't | 438 | /// This is necessary in some cases, particularly when a scene object has just crossed into a region and doesn't |
348 | /// have the IsAttachment property yet checked. | 439 | /// have the IsAttachment property yet checked. |
349 | /// | 440 | /// |
350 | /// FIXME: However, this should be fixed so that this property | 441 | /// FIXME: However, this should be fixed so that this property |
351 | /// propertly reflects the underlying status. | 442 | /// propertly reflects the underlying status. |
443 | /// </remarks> | ||
352 | /// <returns></returns> | 444 | /// <returns></returns> |
353 | public bool IsAttachmentCheckFull() | 445 | public bool IsAttachmentCheckFull() |
354 | { | 446 | { |
@@ -682,7 +774,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
682 | part.ParentID = m_rootPart.LocalId; | 774 | part.ParentID = m_rootPart.LocalId; |
683 | //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); | 775 | //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); |
684 | } | 776 | } |
685 | 777 | ||
686 | ApplyPhysics(m_scene.m_physicalPrim); | 778 | ApplyPhysics(m_scene.m_physicalPrim); |
687 | 779 | ||
688 | if (RootPart.PhysActor != null) | 780 | if (RootPart.PhysActor != null) |
@@ -693,34 +785,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
693 | //ScheduleGroupForFullUpdate(); | 785 | //ScheduleGroupForFullUpdate(); |
694 | } | 786 | } |
695 | 787 | ||
696 | public Vector3 GroupScale() | ||
697 | { | ||
698 | Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); | ||
699 | Vector3 maxScale = Vector3.Zero; | ||
700 | Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); | ||
701 | |||
702 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
703 | for (int i = 0; i < parts.Length; i++) | ||
704 | { | ||
705 | SceneObjectPart part = parts[i]; | ||
706 | Vector3 partscale = part.Scale; | ||
707 | Vector3 partoffset = part.OffsetPosition; | ||
708 | |||
709 | minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X; | ||
710 | minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y; | ||
711 | minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z; | ||
712 | |||
713 | maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X; | ||
714 | maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y; | ||
715 | maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z; | ||
716 | } | ||
717 | |||
718 | finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X; | ||
719 | finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; | ||
720 | finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; | ||
721 | return finalScale; | ||
722 | |||
723 | } | ||
724 | public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) | 788 | public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) |
725 | { | 789 | { |
726 | // We got a request from the inner_scene to raytrace along the Ray hRay | 790 | // We got a request from the inner_scene to raytrace along the Ray hRay |
@@ -1082,6 +1146,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1082 | } | 1146 | } |
1083 | } | 1147 | } |
1084 | 1148 | ||
1149 | <<<<<<< HEAD | ||
1085 | /// <summary> | 1150 | /// <summary> |
1086 | /// Add the avatar to this linkset (avatar is sat). | 1151 | /// Add the avatar to this linkset (avatar is sat). |
1087 | /// </summary> | 1152 | /// </summary> |
@@ -1263,6 +1328,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1263 | //m_rootPart.ScheduleFullUpdate(); | 1328 | //m_rootPart.ScheduleFullUpdate(); |
1264 | } | 1329 | } |
1265 | 1330 | ||
1331 | ======= | ||
1332 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
1266 | /// <summary> | 1333 | /// <summary> |
1267 | /// | 1334 | /// |
1268 | /// </summary> | 1335 | /// </summary> |
@@ -1320,11 +1387,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1320 | public void AddPart(SceneObjectPart part) | 1387 | public void AddPart(SceneObjectPart part) |
1321 | { | 1388 | { |
1322 | part.SetParent(this); | 1389 | part.SetParent(this); |
1390 | <<<<<<< HEAD | ||
1323 | m_parts.Add(part.UUID, part); | 1391 | m_parts.Add(part.UUID, part); |
1324 | 1392 | ||
1325 | part.LinkNum = m_parts.Count; | 1393 | part.LinkNum = m_parts.Count; |
1326 | 1394 | ||
1327 | if (part.LinkNum == 2 && RootPart != null) | 1395 | if (part.LinkNum == 2 && RootPart != null) |
1396 | ======= | ||
1397 | part.LinkNum = m_parts.Add(part.UUID, part); | ||
1398 | if (part.LinkNum == 2) | ||
1399 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
1328 | RootPart.LinkNum = 1; | 1400 | RootPart.LinkNum = 1; |
1329 | } | 1401 | } |
1330 | 1402 | ||
@@ -1407,7 +1479,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1407 | 1479 | ||
1408 | public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) | 1480 | public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) |
1409 | { | 1481 | { |
1482 | <<<<<<< HEAD | ||
1410 | part.StoreUndoState(UndoType.STATE_PRIM_ALL); | 1483 | part.StoreUndoState(UndoType.STATE_PRIM_ALL); |
1484 | ======= | ||
1485 | // m_log.DebugFormat( | ||
1486 | // "[SCENE OBJECT GROUP]: Processing OnGrabPart for {0} on {1} {2}, offsetPos {3}", | ||
1487 | // remoteClient.Name, part.Name, part.LocalId, offsetPos); | ||
1488 | |||
1489 | part.StoreUndoState(); | ||
1490 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
1411 | part.OnGrab(offsetPos, remoteClient); | 1491 | part.OnGrab(offsetPos, remoteClient); |
1412 | } | 1492 | } |
1413 | 1493 | ||
@@ -1711,16 +1791,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1711 | dupe.m_isBackedUp = false; | 1791 | dupe.m_isBackedUp = false; |
1712 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); | 1792 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); |
1713 | 1793 | ||
1794 | <<<<<<< HEAD | ||
1714 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of | 1795 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of |
1715 | // attachments do not bordercross while they're being duplicated. This is hacktastic! | 1796 | // attachments do not bordercross while they're being duplicated. This is hacktastic! |
1716 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! | 1797 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! |
1717 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state | 1798 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state |
1718 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, | 1799 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, |
1719 | // then restore it's attachment state | 1800 | // then restore it's attachment state |
1801 | ======= | ||
1802 | bool previousAttachmentStatus = dupe.IsAttachment; | ||
1803 | |||
1804 | if (!userExposed) | ||
1805 | dupe.IsAttachment = true; | ||
1806 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
1720 | 1807 | ||
1721 | // This is only necessary when userExposed is false! | 1808 | // This is only necessary when userExposed is false! |
1722 | 1809 | ||
1810 | <<<<<<< HEAD | ||
1723 | bool previousAttachmentStatus = dupe.RootPart.IsAttachment; | 1811 | bool previousAttachmentStatus = dupe.RootPart.IsAttachment; |
1812 | ======= | ||
1813 | if (!userExposed) | ||
1814 | { | ||
1815 | dupe.IsAttachment = previousAttachmentStatus; | ||
1816 | } | ||
1817 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
1724 | 1818 | ||
1725 | if (!userExposed) | 1819 | if (!userExposed) |
1726 | dupe.RootPart.IsAttachment = true; | 1820 | dupe.RootPart.IsAttachment = true; |
@@ -1781,7 +1875,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1781 | dupe.HasGroupChanged = true; | 1875 | dupe.HasGroupChanged = true; |
1782 | dupe.AttachToBackup(); | 1876 | dupe.AttachToBackup(); |
1783 | 1877 | ||
1878 | <<<<<<< HEAD | ||
1784 | ScheduleGroupForFullUpdate(); | 1879 | ScheduleGroupForFullUpdate(); |
1880 | ======= | ||
1881 | // Need to duplicate the physics actor as well | ||
1882 | if (part.PhysActor != null && userExposed) | ||
1883 | { | ||
1884 | PrimitiveBaseShape pbs = newPart.Shape; | ||
1885 | |||
1886 | newPart.PhysActor | ||
1887 | = m_scene.PhysicsScene.AddPrimShape( | ||
1888 | string.Format("{0}/{1}", newPart.Name, newPart.UUID), | ||
1889 | pbs, | ||
1890 | newPart.AbsolutePosition, | ||
1891 | newPart.Scale, | ||
1892 | newPart.RotationOffset, | ||
1893 | part.PhysActor.IsPhysical, | ||
1894 | newPart.LocalId); | ||
1895 | |||
1896 | newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); | ||
1897 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
1785 | } | 1898 | } |
1786 | } | 1899 | } |
1787 | finally | 1900 | finally |
@@ -1802,36 +1915,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1802 | SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed)); | 1915 | SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed)); |
1803 | } | 1916 | } |
1804 | 1917 | ||
1805 | public void ScriptSetPhysicsStatus(bool UsePhysics) | 1918 | public void ScriptSetPhysicsStatus(bool usePhysics) |
1806 | { | 1919 | { |
1807 | bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0); | 1920 | UpdatePrimFlags(RootPart.LocalId, usePhysics, IsTemporary, IsPhantom, IsVolumeDetect); |
1808 | bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0); | ||
1809 | bool IsVolumeDetect = RootPart.VolumeDetectActive; | ||
1810 | UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect); | ||
1811 | } | 1921 | } |
1812 | 1922 | ||
1813 | public void ScriptSetTemporaryStatus(bool TemporaryStatus) | 1923 | public void ScriptSetTemporaryStatus(bool makeTemporary) |
1814 | { | 1924 | { |
1815 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); | 1925 | UpdatePrimFlags(RootPart.LocalId, UsesPhysics, makeTemporary, IsPhantom, IsVolumeDetect); |
1816 | bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0); | ||
1817 | bool IsVolumeDetect = RootPart.VolumeDetectActive; | ||
1818 | UpdatePrimFlags(RootPart.LocalId, UsePhysics, TemporaryStatus, IsPhantom, IsVolumeDetect); | ||
1819 | } | 1926 | } |
1820 | 1927 | ||
1821 | public void ScriptSetPhantomStatus(bool PhantomStatus) | 1928 | public void ScriptSetPhantomStatus(bool makePhantom) |
1822 | { | 1929 | { |
1823 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); | 1930 | UpdatePrimFlags(RootPart.LocalId, UsesPhysics, IsTemporary, makePhantom, IsVolumeDetect); |
1824 | bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0); | ||
1825 | bool IsVolumeDetect = RootPart.VolumeDetectActive; | ||
1826 | UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, PhantomStatus, IsVolumeDetect); | ||
1827 | } | 1931 | } |
1828 | 1932 | ||
1829 | public void ScriptSetVolumeDetect(bool VDStatus) | 1933 | public void ScriptSetVolumeDetect(bool makeVolumeDetect) |
1830 | { | 1934 | { |
1831 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); | 1935 | UpdatePrimFlags(RootPart.LocalId, UsesPhysics, IsTemporary, IsPhantom, makeVolumeDetect); |
1832 | bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0); | ||
1833 | bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0); | ||
1834 | UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, IsPhantom, VDStatus); | ||
1835 | 1936 | ||
1836 | /* | 1937 | /* |
1837 | ScriptSetPhantomStatus(false); // What ever it was before, now it's not phantom anymore | 1938 | ScriptSetPhantomStatus(false); // What ever it was before, now it's not phantom anymore |
@@ -1849,126 +1950,87 @@ namespace OpenSim.Region.Framework.Scenes | |||
1849 | 1950 | ||
1850 | public void applyImpulse(Vector3 impulse) | 1951 | public void applyImpulse(Vector3 impulse) |
1851 | { | 1952 | { |
1852 | // We check if rootpart is null here because scripts don't delete if you delete the host. | 1953 | if (IsAttachment) |
1853 | // This means that unfortunately, we can pass a null physics actor to Simulate! | ||
1854 | // Make sure we don't do that! | ||
1855 | SceneObjectPart rootpart = m_rootPart; | ||
1856 | if (rootpart != null) | ||
1857 | { | 1954 | { |
1858 | if (IsAttachment) | 1955 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
1956 | if (avatar != null) | ||
1859 | { | 1957 | { |
1860 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | 1958 | avatar.PushForce(impulse); |
1861 | if (avatar != null) | ||
1862 | { | ||
1863 | avatar.PushForce(impulse); | ||
1864 | } | ||
1865 | } | 1959 | } |
1866 | else | 1960 | } |
1961 | else | ||
1962 | { | ||
1963 | if (RootPart.PhysActor != null) | ||
1867 | { | 1964 | { |
1868 | if (rootpart.PhysActor != null) | 1965 | RootPart.PhysActor.AddForce(impulse, true); |
1869 | { | 1966 | m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); |
1870 | rootpart.PhysActor.AddForce(impulse, true); | ||
1871 | m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); | ||
1872 | } | ||
1873 | } | 1967 | } |
1874 | } | 1968 | } |
1875 | } | 1969 | } |
1876 | 1970 | ||
1877 | public void applyAngularImpulse(Vector3 impulse) | 1971 | public void applyAngularImpulse(Vector3 impulse) |
1878 | { | 1972 | { |
1879 | // We check if rootpart is null here because scripts don't delete if you delete the host. | 1973 | if (RootPart.PhysActor != null) |
1880 | // This means that unfortunately, we can pass a null physics actor to Simulate! | ||
1881 | // Make sure we don't do that! | ||
1882 | SceneObjectPart rootpart = m_rootPart; | ||
1883 | if (rootpart != null) | ||
1884 | { | 1974 | { |
1885 | if (rootpart.PhysActor != null) | 1975 | if (!IsAttachment) |
1886 | { | 1976 | { |
1887 | if (!IsAttachment) | 1977 | RootPart.PhysActor.AddAngularForce(impulse, true); |
1888 | { | 1978 | m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); |
1889 | rootpart.PhysActor.AddAngularForce(impulse, true); | ||
1890 | m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); | ||
1891 | } | ||
1892 | } | 1979 | } |
1893 | } | 1980 | } |
1894 | } | 1981 | } |
1895 | 1982 | ||
1896 | public void setAngularImpulse(Vector3 impulse) | 1983 | public void setAngularImpulse(Vector3 impulse) |
1897 | { | 1984 | { |
1898 | // We check if rootpart is null here because scripts don't delete if you delete the host. | 1985 | if (RootPart.PhysActor != null) |
1899 | // This means that unfortunately, we can pass a null physics actor to Simulate! | ||
1900 | // Make sure we don't do that! | ||
1901 | SceneObjectPart rootpart = m_rootPart; | ||
1902 | if (rootpart != null) | ||
1903 | { | 1986 | { |
1904 | if (rootpart.PhysActor != null) | 1987 | if (!IsAttachment) |
1905 | { | 1988 | { |
1906 | if (!IsAttachment) | 1989 | RootPart.PhysActor.Torque = impulse; |
1907 | { | 1990 | m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); |
1908 | rootpart.PhysActor.Torque = impulse; | ||
1909 | m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); | ||
1910 | } | ||
1911 | } | 1991 | } |
1912 | } | 1992 | } |
1913 | } | 1993 | } |
1914 | 1994 | ||
1915 | public Vector3 GetTorque() | 1995 | public Vector3 GetTorque() |
1916 | { | 1996 | { |
1917 | // We check if rootpart is null here because scripts don't delete if you delete the host. | 1997 | if (RootPart.PhysActor != null) |
1918 | // This means that unfortunately, we can pass a null physics actor to Simulate! | ||
1919 | // Make sure we don't do that! | ||
1920 | SceneObjectPart rootpart = m_rootPart; | ||
1921 | if (rootpart != null) | ||
1922 | { | 1998 | { |
1923 | if (rootpart.PhysActor != null) | 1999 | if (!IsAttachment) |
1924 | { | 2000 | { |
1925 | if (!IsAttachment) | 2001 | Vector3 torque = RootPart.PhysActor.Torque; |
1926 | { | 2002 | return torque; |
1927 | Vector3 torque = rootpart.PhysActor.Torque; | ||
1928 | return torque; | ||
1929 | } | ||
1930 | } | 2003 | } |
1931 | } | 2004 | } |
2005 | |||
1932 | return Vector3.Zero; | 2006 | return Vector3.Zero; |
1933 | } | 2007 | } |
1934 | 2008 | ||
1935 | // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object | 2009 | // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object |
1936 | public void moveToTarget(Vector3 target, float tau) | 2010 | public void moveToTarget(Vector3 target, float tau) |
1937 | { | 2011 | { |
1938 | SceneObjectPart rootpart = m_rootPart; | 2012 | if (IsAttachment) |
1939 | if (rootpart != null) | ||
1940 | { | 2013 | { |
1941 | if (IsAttachment) | 2014 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
2015 | if (avatar != null) | ||
1942 | { | 2016 | { |
1943 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | 2017 | avatar.MoveToTarget(target, false); |
1944 | if (avatar != null) | ||
1945 | { | ||
1946 | List<string> coords = new List<string>(); | ||
1947 | uint regionX = 0; | ||
1948 | uint regionY = 0; | ||
1949 | Utils.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY); | ||
1950 | target.X += regionX; | ||
1951 | target.Y += regionY; | ||
1952 | coords.Add(target.X.ToString()); | ||
1953 | coords.Add(target.Y.ToString()); | ||
1954 | coords.Add(target.Z.ToString()); | ||
1955 | avatar.DoMoveToPosition(avatar, "", coords); | ||
1956 | } | ||
1957 | } | 2018 | } |
1958 | else | 2019 | } |
2020 | else | ||
2021 | { | ||
2022 | if (RootPart.PhysActor != null) | ||
1959 | { | 2023 | { |
1960 | if (rootpart.PhysActor != null) | 2024 | RootPart.PhysActor.PIDTarget = target; |
1961 | { | 2025 | RootPart.PhysActor.PIDTau = tau; |
1962 | rootpart.PhysActor.PIDTarget = target; | 2026 | RootPart.PhysActor.PIDActive = true; |
1963 | rootpart.PhysActor.PIDTau = tau; | ||
1964 | rootpart.PhysActor.PIDActive = true; | ||
1965 | } | ||
1966 | } | 2027 | } |
1967 | } | 2028 | } |
1968 | } | 2029 | } |
1969 | 2030 | ||
1970 | public void stopMoveToTarget() | 2031 | public void stopMoveToTarget() |
1971 | { | 2032 | { |
2033 | <<<<<<< HEAD | ||
1972 | SceneObjectPart rootpart = m_rootPart; | 2034 | SceneObjectPart rootpart = m_rootPart; |
1973 | if (rootpart != null) | 2035 | if (rootpart != null) |
1974 | { | 2036 | { |
@@ -1985,6 +2047,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1985 | } | 2047 | } |
1986 | } | 2048 | } |
1987 | } | 2049 | } |
2050 | ======= | ||
2051 | if (RootPart.PhysActor != null) | ||
2052 | RootPart.PhysActor.PIDActive = false; | ||
2053 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
1988 | } | 2054 | } |
1989 | 2055 | ||
1990 | public void rotLookAt(Quaternion target, float strength, float damping) | 2056 | public void rotLookAt(Quaternion target, float strength, float damping) |
@@ -2016,6 +2082,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2016 | 2082 | ||
2017 | public void stopLookAt() | 2083 | public void stopLookAt() |
2018 | { | 2084 | { |
2085 | <<<<<<< HEAD | ||
2019 | SceneObjectPart rootpart = m_rootPart; | 2086 | SceneObjectPart rootpart = m_rootPart; |
2020 | if (rootpart != null) | 2087 | if (rootpart != null) |
2021 | { | 2088 | { |
@@ -2025,6 +2092,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2025 | } | 2092 | } |
2026 | } | 2093 | } |
2027 | 2094 | ||
2095 | ======= | ||
2096 | if (RootPart.PhysActor != null) | ||
2097 | RootPart.PhysActor.APIDActive = false; | ||
2098 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
2028 | } | 2099 | } |
2029 | 2100 | ||
2030 | /// <summary> | 2101 | /// <summary> |
@@ -2035,22 +2106,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2035 | /// <param name="tau">Number of seconds over which to reach target</param> | 2106 | /// <param name="tau">Number of seconds over which to reach target</param> |
2036 | public void SetHoverHeight(float height, PIDHoverType hoverType, float tau) | 2107 | public void SetHoverHeight(float height, PIDHoverType hoverType, float tau) |
2037 | { | 2108 | { |
2038 | SceneObjectPart rootpart = m_rootPart; | 2109 | if (RootPart.PhysActor != null) |
2039 | if (rootpart != null) | ||
2040 | { | 2110 | { |
2041 | if (rootpart.PhysActor != null) | 2111 | if (height != 0f) |
2042 | { | 2112 | { |
2043 | if (height != 0f) | 2113 | RootPart.PhysActor.PIDHoverHeight = height; |
2044 | { | 2114 | RootPart.PhysActor.PIDHoverType = hoverType; |
2045 | rootpart.PhysActor.PIDHoverHeight = height; | 2115 | RootPart.PhysActor.PIDTau = tau; |
2046 | rootpart.PhysActor.PIDHoverType = hoverType; | 2116 | RootPart.PhysActor.PIDHoverActive = true; |
2047 | rootpart.PhysActor.PIDTau = tau; | 2117 | } |
2048 | rootpart.PhysActor.PIDHoverActive = true; | 2118 | else |
2049 | } | 2119 | { |
2050 | else | 2120 | RootPart.PhysActor.PIDHoverActive = false; |
2051 | { | ||
2052 | rootpart.PhysActor.PIDHoverActive = false; | ||
2053 | } | ||
2054 | } | 2121 | } |
2055 | } | 2122 | } |
2056 | } | 2123 | } |
@@ -2145,7 +2212,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2145 | // an object has been deleted from a scene before update was processed. | 2212 | // an object has been deleted from a scene before update was processed. |
2146 | // A more fundamental overhaul of the update mechanism is required to eliminate all | 2213 | // A more fundamental overhaul of the update mechanism is required to eliminate all |
2147 | // the race conditions. | 2214 | // the race conditions. |
2148 | if (m_isDeleted) | 2215 | if (IsDeleted) |
2149 | return; | 2216 | return; |
2150 | 2217 | ||
2151 | // Even temporary objects take part in physics (e.g. temp-on-rez bullets) | 2218 | // Even temporary objects take part in physics (e.g. temp-on-rez bullets) |
@@ -2458,7 +2525,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2458 | } | 2525 | } |
2459 | 2526 | ||
2460 | m_scene.UnlinkSceneObject(objectGroup, true); | 2527 | m_scene.UnlinkSceneObject(objectGroup, true); |
2461 | objectGroup.m_isDeleted = true; | 2528 | objectGroup.IsDeleted = true; |
2462 | 2529 | ||
2463 | objectGroup.m_parts.Clear(); | 2530 | objectGroup.m_parts.Clear(); |
2464 | 2531 | ||
@@ -2595,9 +2662,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2595 | /// <param name="objectGroup"></param> | 2662 | /// <param name="objectGroup"></param> |
2596 | public virtual void DetachFromBackup() | 2663 | public virtual void DetachFromBackup() |
2597 | { | 2664 | { |
2665 | <<<<<<< HEAD | ||
2598 | m_scene.SceneGraph.FireDetachFromBackup(this); | 2666 | m_scene.SceneGraph.FireDetachFromBackup(this); |
2599 | 2667 | ||
2600 | if (m_isBackedUp) | 2668 | if (m_isBackedUp) |
2669 | ======= | ||
2670 | if (m_isBackedUp && Scene != null) | ||
2671 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
2601 | m_scene.EventManager.OnBackup -= ProcessBackup; | 2672 | m_scene.EventManager.OnBackup -= ProcessBackup; |
2602 | 2673 | ||
2603 | m_isBackedUp = false; | 2674 | m_isBackedUp = false; |
@@ -2857,14 +2928,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2857 | /// Update prim flags for this group. | 2928 | /// Update prim flags for this group. |
2858 | /// </summary> | 2929 | /// </summary> |
2859 | /// <param name="localID"></param> | 2930 | /// <param name="localID"></param> |
2860 | /// <param name="type"></param> | 2931 | /// <param name="UsePhysics"></param> |
2861 | /// <param name="inUse"></param> | 2932 | /// <param name="SetTemporary"></param> |
2862 | /// <param name="data"></param> | 2933 | /// <param name="SetPhantom"></param> |
2863 | public void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, bool IsVolumeDetect) | 2934 | /// <param name="SetVolumeDetect"></param> |
2935 | public void UpdatePrimFlags(uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVolumeDetect) | ||
2864 | { | 2936 | { |
2865 | SceneObjectPart selectionPart = GetChildPart(localID); | 2937 | SceneObjectPart selectionPart = GetChildPart(localID); |
2866 | 2938 | ||
2867 | if (IsTemporary) | 2939 | if (SetTemporary && Scene != null) |
2868 | { | 2940 | { |
2869 | DetachFromBackup(); | 2941 | DetachFromBackup(); |
2870 | // Remove from database and parcel prim count | 2942 | // Remove from database and parcel prim count |
@@ -2876,24 +2948,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
2876 | if (selectionPart != null) | 2948 | if (selectionPart != null) |
2877 | { | 2949 | { |
2878 | SceneObjectPart[] parts = m_parts.GetArray(); | 2950 | SceneObjectPart[] parts = m_parts.GetArray(); |
2879 | for (int i = 0; i < parts.Length; i++) | 2951 | |
2952 | if (Scene != null) | ||
2880 | { | 2953 | { |
2881 | SceneObjectPart part = parts[i]; | 2954 | for (int i = 0; i < parts.Length; i++) |
2882 | if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax || | ||
2883 | part.Scale.Y > m_scene.RegionInfo.PhysPrimMax || | ||
2884 | part.Scale.Z > m_scene.RegionInfo.PhysPrimMax) | ||
2885 | { | 2955 | { |
2886 | UsePhysics = false; // Reset physics | 2956 | SceneObjectPart part = parts[i]; |
2887 | break; | 2957 | if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax || |
2958 | part.Scale.Y > m_scene.RegionInfo.PhysPrimMax || | ||
2959 | part.Scale.Z > m_scene.RegionInfo.PhysPrimMax) | ||
2960 | { | ||
2961 | UsePhysics = false; // Reset physics | ||
2962 | break; | ||
2963 | } | ||
2888 | } | 2964 | } |
2889 | } | 2965 | } |
2890 | 2966 | ||
2891 | RootPart.UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect); | 2967 | RootPart.UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect); |
2892 | for (int i = 0; i < parts.Length; i++) | 2968 | for (int i = 0; i < parts.Length; i++) |
2969 | <<<<<<< HEAD | ||
2893 | { | 2970 | { |
2894 | if (parts[i] != RootPart) | 2971 | if (parts[i] != RootPart) |
2895 | parts[i].UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect); | 2972 | parts[i].UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect); |
2896 | } | 2973 | } |
2974 | ======= | ||
2975 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); | ||
2976 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
2897 | } | 2977 | } |
2898 | } | 2978 | } |
2899 | 2979 | ||
@@ -2966,12 +3046,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2966 | #region Resize | 3046 | #region Resize |
2967 | 3047 | ||
2968 | /// <summary> | 3048 | /// <summary> |
2969 | /// Resize the given part | 3049 | /// Resize the entire group of prims. |
2970 | /// </summary> | 3050 | /// </summary> |
2971 | /// <param name="scale"></param> | 3051 | /// <param name="scale"></param> |
2972 | /// <param name="localID"></param> | 3052 | public void GroupResize(Vector3 scale) |
2973 | public void Resize(Vector3 scale, uint localID) | ||
2974 | { | 3053 | { |
3054 | <<<<<<< HEAD | ||
2975 | if (scale.X > m_scene.m_maxNonphys) | 3055 | if (scale.X > m_scene.m_maxNonphys) |
2976 | scale.X = m_scene.m_maxNonphys; | 3056 | scale.X = m_scene.m_maxNonphys; |
2977 | if (scale.Y > m_scene.m_maxNonphys) | 3057 | if (scale.Y > m_scene.m_maxNonphys) |
@@ -2996,23 +3076,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2996 | m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); | 3076 | m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); |
2997 | } | 3077 | } |
2998 | part.Resize(scale); | 3078 | part.Resize(scale); |
3079 | ======= | ||
3080 | // m_log.DebugFormat( | ||
3081 | // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); | ||
2999 | 3082 | ||
3000 | HasGroupChanged = true; | 3083 | RootPart.StoreUndoState(true); |
3001 | part.TriggerScriptChangedEvent(Changed.SCALE); | 3084 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 |
3002 | ScheduleGroupForFullUpdate(); | ||
3003 | 3085 | ||
3004 | //if (part.UUID == m_rootPart.UUID) | 3086 | scale.X = Math.Min(scale.X, Scene.m_maxNonphys); |
3005 | //{ | 3087 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); |
3006 | //if (m_rootPart.PhysActor != null) | 3088 | scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); |
3007 | //{ | 3089 | |
3008 | //m_rootPart.PhysActor.Size = | 3090 | if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) |
3009 | //new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z); | 3091 | { |
3010 | //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 3092 | scale.X = Math.Min(scale.X, Scene.m_maxPhys); |
3011 | //} | 3093 | scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); |
3012 | //} | 3094 | scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); |
3013 | } | 3095 | } |
3014 | } | ||
3015 | 3096 | ||
3097 | <<<<<<< HEAD | ||
3016 | public void GroupResize(Vector3 scale, uint localID) | 3098 | public void GroupResize(Vector3 scale, uint localID) |
3017 | { | 3099 | { |
3018 | SceneObjectPart part = GetChildPart(localID); | 3100 | SceneObjectPart part = GetChildPart(localID); |
@@ -3036,24 +3118,50 @@ namespace OpenSim.Region.Framework.Scenes | |||
3036 | float x = (scale.X / part.Scale.X); | 3118 | float x = (scale.X / part.Scale.X); |
3037 | float y = (scale.Y / part.Scale.Y); | 3119 | float y = (scale.Y / part.Scale.Y); |
3038 | float z = (scale.Z / part.Scale.Z); | 3120 | float z = (scale.Z / part.Scale.Z); |
3121 | ======= | ||
3122 | float x = (scale.X / RootPart.Scale.X); | ||
3123 | float y = (scale.Y / RootPart.Scale.Y); | ||
3124 | float z = (scale.Z / RootPart.Scale.Z); | ||
3125 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3039 | 3126 | ||
3040 | SceneObjectPart[] parts; | 3127 | SceneObjectPart[] parts; |
3041 | if (x > 1.0f || y > 1.0f || z > 1.0f) | 3128 | if (x > 1.0f || y > 1.0f || z > 1.0f) |
3129 | { | ||
3130 | parts = m_parts.GetArray(); | ||
3131 | for (int i = 0; i < parts.Length; i++) | ||
3042 | { | 3132 | { |
3043 | parts = m_parts.GetArray(); | 3133 | SceneObjectPart obPart = parts[i]; |
3044 | for (int i = 0; i < parts.Length; i++) | 3134 | if (obPart.UUID != m_rootPart.UUID) |
3045 | { | 3135 | { |
3046 | SceneObjectPart obPart = parts[i]; | 3136 | // obPart.IgnoreUndoUpdate = true; |
3047 | if (obPart.UUID != m_rootPart.UUID) | 3137 | Vector3 oldSize = new Vector3(obPart.Scale); |
3138 | |||
3139 | float f = 1.0f; | ||
3140 | float a = 1.0f; | ||
3141 | |||
3142 | if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) | ||
3048 | { | 3143 | { |
3049 | obPart.IgnoreUndoUpdate = true; | 3144 | if (oldSize.X * x > m_scene.m_maxPhys) |
3050 | Vector3 oldSize = new Vector3(obPart.Scale); | 3145 | { |
3146 | f = m_scene.m_maxPhys / oldSize.X; | ||
3147 | a = f / x; | ||
3148 | x *= a; | ||
3149 | y *= a; | ||
3150 | z *= a; | ||
3151 | } | ||
3051 | 3152 | ||
3052 | float f = 1.0f; | 3153 | if (oldSize.Y * y > m_scene.m_maxPhys) |
3053 | float a = 1.0f; | 3154 | { |
3155 | f = m_scene.m_maxPhys / oldSize.Y; | ||
3156 | a = f / y; | ||
3157 | x *= a; | ||
3158 | y *= a; | ||
3159 | z *= a; | ||
3160 | } | ||
3054 | 3161 | ||
3055 | if (part.PhysActor != null && part.PhysActor.IsPhysical) | 3162 | if (oldSize.Z * z > m_scene.m_maxPhys) |
3056 | { | 3163 | { |
3164 | <<<<<<< HEAD | ||
3057 | if (oldSize.X*x > m_scene.m_maxPhys) | 3165 | if (oldSize.X*x > m_scene.m_maxPhys) |
3058 | { | 3166 | { |
3059 | f = m_scene.m_maxPhys / oldSize.X; | 3167 | f = m_scene.m_maxPhys / oldSize.X; |
@@ -3078,9 +3186,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
3078 | y *= a; | 3186 | y *= a; |
3079 | z *= a; | 3187 | z *= a; |
3080 | } | 3188 | } |
3189 | ======= | ||
3190 | f = m_scene.m_maxPhys / oldSize.Z; | ||
3191 | a = f / z; | ||
3192 | x *= a; | ||
3193 | y *= a; | ||
3194 | z *= a; | ||
3195 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3081 | } | 3196 | } |
3082 | else | 3197 | } |
3198 | else | ||
3199 | { | ||
3200 | if (oldSize.X * x > m_scene.m_maxNonphys) | ||
3083 | { | 3201 | { |
3202 | <<<<<<< HEAD | ||
3084 | if (oldSize.X*x > m_scene.m_maxNonphys) | 3203 | if (oldSize.X*x > m_scene.m_maxNonphys) |
3085 | { | 3204 | { |
3086 | f = m_scene.m_maxNonphys / oldSize.X; | 3205 | f = m_scene.m_maxNonphys / oldSize.X; |
@@ -3107,10 +3226,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
3107 | } | 3226 | } |
3108 | } | 3227 | } |
3109 | obPart.IgnoreUndoUpdate = false; | 3228 | obPart.IgnoreUndoUpdate = false; |
3229 | ======= | ||
3230 | f = m_scene.m_maxNonphys / oldSize.X; | ||
3231 | a = f / x; | ||
3232 | x *= a; | ||
3233 | y *= a; | ||
3234 | z *= a; | ||
3235 | } | ||
3236 | |||
3237 | if (oldSize.Y * y > m_scene.m_maxNonphys) | ||
3238 | { | ||
3239 | f = m_scene.m_maxNonphys / oldSize.Y; | ||
3240 | a = f / y; | ||
3241 | x *= a; | ||
3242 | y *= a; | ||
3243 | z *= a; | ||
3244 | } | ||
3245 | |||
3246 | if (oldSize.Z * z > m_scene.m_maxNonphys) | ||
3247 | { | ||
3248 | f = m_scene.m_maxNonphys / oldSize.Z; | ||
3249 | a = f / z; | ||
3250 | x *= a; | ||
3251 | y *= a; | ||
3252 | z *= a; | ||
3253 | } | ||
3254 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3110 | } | 3255 | } |
3256 | |||
3257 | // obPart.IgnoreUndoUpdate = false; | ||
3111 | } | 3258 | } |
3112 | } | 3259 | } |
3260 | } | ||
3113 | 3261 | ||
3262 | <<<<<<< HEAD | ||
3114 | Vector3 prevScale = part.Scale; | 3263 | Vector3 prevScale = part.Scale; |
3115 | prevScale.X *= x; | 3264 | prevScale.X *= x; |
3116 | prevScale.Y *= y; | 3265 | prevScale.Y *= y; |
@@ -3121,12 +3270,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
3121 | part.IgnoreUndoUpdate = true; | 3270 | part.IgnoreUndoUpdate = true; |
3122 | part.Resize(prevScale); | 3271 | part.Resize(prevScale); |
3123 | part.IgnoreUndoUpdate = false; | 3272 | part.IgnoreUndoUpdate = false; |
3273 | ======= | ||
3274 | Vector3 prevScale = RootPart.Scale; | ||
3275 | prevScale.X *= x; | ||
3276 | prevScale.Y *= y; | ||
3277 | prevScale.Z *= z; | ||
3278 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3124 | 3279 | ||
3125 | parts = m_parts.GetArray(); | 3280 | // RootPart.IgnoreUndoUpdate = true; |
3126 | for (int i = 0; i < parts.Length; i++) | 3281 | RootPart.Resize(prevScale); |
3282 | // RootPart.IgnoreUndoUpdate = false; | ||
3283 | |||
3284 | parts = m_parts.GetArray(); | ||
3285 | for (int i = 0; i < parts.Length; i++) | ||
3286 | { | ||
3287 | SceneObjectPart obPart = parts[i]; | ||
3288 | |||
3289 | if (obPart.UUID != m_rootPart.UUID) | ||
3127 | { | 3290 | { |
3128 | SceneObjectPart obPart = parts[i]; | ||
3129 | obPart.IgnoreUndoUpdate = true; | 3291 | obPart.IgnoreUndoUpdate = true; |
3292 | <<<<<<< HEAD | ||
3130 | if (obPart.UUID != m_rootPart.UUID) | 3293 | if (obPart.UUID != m_rootPart.UUID) |
3131 | { | 3294 | { |
3132 | if (obPart.UUID != m_rootPart.UUID) | 3295 | if (obPart.UUID != m_rootPart.UUID) |
@@ -3150,18 +3313,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
3150 | } | 3313 | } |
3151 | obPart.IgnoreUndoUpdate = false; | 3314 | obPart.IgnoreUndoUpdate = false; |
3152 | } | 3315 | } |
3316 | ======= | ||
3317 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3153 | 3318 | ||
3154 | if (part.PhysActor != null) | 3319 | Vector3 currentpos = new Vector3(obPart.OffsetPosition); |
3155 | { | 3320 | currentpos.X *= x; |
3156 | part.PhysActor.Size = prevScale; | 3321 | currentpos.Y *= y; |
3157 | m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); | 3322 | currentpos.Z *= z; |
3323 | |||
3324 | Vector3 newSize = new Vector3(obPart.Scale); | ||
3325 | newSize.X *= x; | ||
3326 | newSize.Y *= y; | ||
3327 | newSize.Z *= z; | ||
3328 | |||
3329 | obPart.Resize(newSize); | ||
3330 | obPart.UpdateOffSet(currentpos); | ||
3331 | |||
3332 | obPart.IgnoreUndoUpdate = false; | ||
3158 | } | 3333 | } |
3159 | 3334 | ||
3335 | <<<<<<< HEAD | ||
3160 | part.IgnoreUndoUpdate = false; | 3336 | part.IgnoreUndoUpdate = false; |
3161 | HasGroupChanged = true; | 3337 | HasGroupChanged = true; |
3162 | m_rootPart.TriggerScriptChangedEvent(Changed.SCALE); | 3338 | m_rootPart.TriggerScriptChangedEvent(Changed.SCALE); |
3163 | ScheduleGroupForTerseUpdate(); | 3339 | ScheduleGroupForTerseUpdate(); |
3340 | ======= | ||
3341 | // obPart.IgnoreUndoUpdate = false; | ||
3342 | // obPart.StoreUndoState(); | ||
3343 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3164 | } | 3344 | } |
3345 | |||
3346 | // m_log.DebugFormat( | ||
3347 | // "[SCENE OBJECT GROUP]: Finished group resizing {0} {1} to {2}", Name, LocalId, RootPart.Scale); | ||
3165 | } | 3348 | } |
3166 | 3349 | ||
3167 | #endregion | 3350 | #endregion |
@@ -3174,6 +3357,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3174 | /// <param name="pos"></param> | 3357 | /// <param name="pos"></param> |
3175 | public void UpdateGroupPosition(Vector3 pos) | 3358 | public void UpdateGroupPosition(Vector3 pos) |
3176 | { | 3359 | { |
3360 | <<<<<<< HEAD | ||
3361 | ======= | ||
3362 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos); | ||
3363 | |||
3364 | RootPart.StoreUndoState(true); | ||
3365 | |||
3366 | // SceneObjectPart[] parts = m_parts.GetArray(); | ||
3367 | // for (int i = 0; i < parts.Length; i++) | ||
3368 | // parts[i].StoreUndoState(); | ||
3369 | |||
3370 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3177 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) | 3371 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) |
3178 | { | 3372 | { |
3179 | if (IsAttachment) | 3373 | if (IsAttachment) |
@@ -3210,12 +3404,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
3210 | { | 3404 | { |
3211 | SceneObjectPart part = GetChildPart(localID); | 3405 | SceneObjectPart part = GetChildPart(localID); |
3212 | 3406 | ||
3407 | <<<<<<< HEAD | ||
3213 | SceneObjectPart[] parts = m_parts.GetArray(); | 3408 | SceneObjectPart[] parts = m_parts.GetArray(); |
3214 | for (int i = 0; i < parts.Length; i++) | 3409 | for (int i = 0; i < parts.Length; i++) |
3215 | parts[i].StoreUndoState(UndoType.STATE_PRIM_POSITION); | 3410 | parts[i].StoreUndoState(UndoType.STATE_PRIM_POSITION); |
3411 | ======= | ||
3412 | // SceneObjectPart[] parts = m_parts.GetArray(); | ||
3413 | // for (int i = 0; i < parts.Length; i++) | ||
3414 | // parts[i].StoreUndoState(); | ||
3415 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3216 | 3416 | ||
3217 | if (part != null) | 3417 | if (part != null) |
3218 | { | 3418 | { |
3419 | // m_log.DebugFormat( | ||
3420 | // "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos); | ||
3421 | |||
3422 | part.StoreUndoState(false); | ||
3423 | part.IgnoreUndoUpdate = true; | ||
3424 | |||
3219 | if (part.UUID == m_rootPart.UUID) | 3425 | if (part.UUID == m_rootPart.UUID) |
3220 | { | 3426 | { |
3221 | UpdateRootPosition(pos); | 3427 | UpdateRootPosition(pos); |
@@ -3226,18 +3432,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
3226 | } | 3432 | } |
3227 | 3433 | ||
3228 | HasGroupChanged = true; | 3434 | HasGroupChanged = true; |
3435 | part.IgnoreUndoUpdate = false; | ||
3229 | } | 3436 | } |
3230 | } | 3437 | } |
3231 | 3438 | ||
3232 | /// <summary> | 3439 | /// <summary> |
3233 | /// | 3440 | /// Update just the root prim position in a linkset |
3234 | /// </summary> | 3441 | /// </summary> |
3235 | /// <param name="pos"></param> | 3442 | /// <param name="pos"></param> |
3236 | private void UpdateRootPosition(Vector3 pos) | 3443 | public void UpdateRootPosition(Vector3 pos) |
3237 | { | 3444 | { |
3445 | <<<<<<< HEAD | ||
3238 | SceneObjectPart[] parts = m_parts.GetArray(); | 3446 | SceneObjectPart[] parts = m_parts.GetArray(); |
3239 | for (int i = 0; i < parts.Length; i++) | 3447 | for (int i = 0; i < parts.Length; i++) |
3240 | parts[i].StoreUndoState(UndoType.STATE_PRIM_POSITION); | 3448 | parts[i].StoreUndoState(UndoType.STATE_PRIM_POSITION); |
3449 | ======= | ||
3450 | // m_log.DebugFormat( | ||
3451 | // "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); | ||
3452 | |||
3453 | // SceneObjectPart[] parts = m_parts.GetArray(); | ||
3454 | // for (int i = 0; i < parts.Length; i++) | ||
3455 | // parts[i].StoreUndoState(); | ||
3456 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3241 | 3457 | ||
3242 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); | 3458 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); |
3243 | Vector3 oldPos = | 3459 | Vector3 oldPos = |
@@ -3250,7 +3466,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3250 | axDiff *= Quaternion.Inverse(partRotation); | 3466 | axDiff *= Quaternion.Inverse(partRotation); |
3251 | diff = axDiff; | 3467 | diff = axDiff; |
3252 | 3468 | ||
3253 | parts = m_parts.GetArray(); | 3469 | SceneObjectPart[] parts = m_parts.GetArray(); |
3254 | for (int i = 0; i < parts.Length; i++) | 3470 | for (int i = 0; i < parts.Length; i++) |
3255 | { | 3471 | { |
3256 | SceneObjectPart obPart = parts[i]; | 3472 | SceneObjectPart obPart = parts[i]; |
@@ -3296,9 +3512,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
3296 | /// <param name="rot"></param> | 3512 | /// <param name="rot"></param> |
3297 | public void UpdateGroupRotationR(Quaternion rot) | 3513 | public void UpdateGroupRotationR(Quaternion rot) |
3298 | { | 3514 | { |
3515 | <<<<<<< HEAD | ||
3299 | SceneObjectPart[] parts = m_parts.GetArray(); | 3516 | SceneObjectPart[] parts = m_parts.GetArray(); |
3300 | for (int i = 0; i < parts.Length; i++) | 3517 | for (int i = 0; i < parts.Length; i++) |
3301 | parts[i].StoreUndoState(UndoType.STATE_GROUP_ROTATION); | 3518 | parts[i].StoreUndoState(UndoType.STATE_GROUP_ROTATION); |
3519 | ======= | ||
3520 | // m_log.DebugFormat( | ||
3521 | // "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot); | ||
3522 | |||
3523 | // SceneObjectPart[] parts = m_parts.GetArray(); | ||
3524 | // for (int i = 0; i < parts.Length; i++) | ||
3525 | // parts[i].StoreUndoState(); | ||
3526 | |||
3527 | m_rootPart.StoreUndoState(true); | ||
3528 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3302 | 3529 | ||
3303 | m_rootPart.UpdateRotation(rot); | 3530 | m_rootPart.UpdateRotation(rot); |
3304 | 3531 | ||
@@ -3320,9 +3547,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3320 | /// <param name="rot"></param> | 3547 | /// <param name="rot"></param> |
3321 | public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) | 3548 | public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) |
3322 | { | 3549 | { |
3550 | <<<<<<< HEAD | ||
3323 | SceneObjectPart[] parts = m_parts.GetArray(); | 3551 | SceneObjectPart[] parts = m_parts.GetArray(); |
3324 | for (int i = 0; i < parts.Length; i++) | 3552 | for (int i = 0; i < parts.Length; i++) |
3325 | parts[i].StoreUndoState(UndoType.STATE_GROUP_ROTATION); | 3553 | parts[i].StoreUndoState(UndoType.STATE_GROUP_ROTATION); |
3554 | ======= | ||
3555 | // m_log.DebugFormat( | ||
3556 | // "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot); | ||
3557 | |||
3558 | // SceneObjectPart[] parts = m_parts.GetArray(); | ||
3559 | // for (int i = 0; i < parts.Length; i++) | ||
3560 | // parts[i].StoreUndoState(); | ||
3561 | |||
3562 | RootPart.StoreUndoState(true); | ||
3563 | RootPart.IgnoreUndoUpdate = true; | ||
3564 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3326 | 3565 | ||
3327 | m_rootPart.UpdateRotation(rot); | 3566 | m_rootPart.UpdateRotation(rot); |
3328 | 3567 | ||
@@ -3337,6 +3576,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3337 | 3576 | ||
3338 | HasGroupChanged = true; | 3577 | HasGroupChanged = true; |
3339 | ScheduleGroupForTerseUpdate(); | 3578 | ScheduleGroupForTerseUpdate(); |
3579 | |||
3580 | RootPart.IgnoreUndoUpdate = false; | ||
3340 | } | 3581 | } |
3341 | 3582 | ||
3342 | /// <summary> | 3583 | /// <summary> |
@@ -3353,6 +3594,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3353 | 3594 | ||
3354 | if (part != null) | 3595 | if (part != null) |
3355 | { | 3596 | { |
3597 | // m_log.DebugFormat( | ||
3598 | // "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot); | ||
3599 | |||
3356 | if (part.UUID == m_rootPart.UUID) | 3600 | if (part.UUID == m_rootPart.UUID) |
3357 | { | 3601 | { |
3358 | UpdateRootRotation(rot); | 3602 | UpdateRootRotation(rot); |
@@ -3374,6 +3618,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3374 | SceneObjectPart part = GetChildPart(localID); | 3618 | SceneObjectPart part = GetChildPart(localID); |
3375 | if (part != null) | 3619 | if (part != null) |
3376 | { | 3620 | { |
3621 | // m_log.DebugFormat( | ||
3622 | // "[SCENE OBJECT GROUP]: Updating single position and rotation of {0} {1} to {2}", | ||
3623 | // part.Name, part.LocalId, rot); | ||
3624 | |||
3625 | part.StoreUndoState(); | ||
3626 | part.IgnoreUndoUpdate = true; | ||
3627 | |||
3377 | if (part.UUID == m_rootPart.UUID) | 3628 | if (part.UUID == m_rootPart.UUID) |
3378 | { | 3629 | { |
3379 | UpdateRootRotation(rot); | 3630 | UpdateRootRotation(rot); |
@@ -3390,12 +3641,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3390 | } | 3641 | } |
3391 | else | 3642 | else |
3392 | { | 3643 | { |
3644 | <<<<<<< HEAD | ||
3393 | part.StoreUndoState(UndoType.STATE_PRIM_ROTATION); | 3645 | part.StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
3394 | part.IgnoreUndoUpdate = true; | 3646 | part.IgnoreUndoUpdate = true; |
3395 | part.UpdateRotation(rot); | 3647 | part.UpdateRotation(rot); |
3396 | part.OffsetPosition = pos; | 3648 | part.OffsetPosition = pos; |
3397 | part.IgnoreUndoUpdate = false; | 3649 | part.IgnoreUndoUpdate = false; |
3650 | ======= | ||
3651 | part.UpdateRotation(rot); | ||
3652 | part.OffsetPosition = pos; | ||
3653 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3398 | } | 3654 | } |
3655 | |||
3656 | part.IgnoreUndoUpdate = false; | ||
3399 | } | 3657 | } |
3400 | } | 3658 | } |
3401 | 3659 | ||
@@ -3403,8 +3661,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3403 | /// | 3661 | /// |
3404 | /// </summary> | 3662 | /// </summary> |
3405 | /// <param name="rot"></param> | 3663 | /// <param name="rot"></param> |
3406 | private void UpdateRootRotation(Quaternion rot) | 3664 | public void UpdateRootRotation(Quaternion rot) |
3407 | { | 3665 | { |
3666 | // m_log.DebugFormat( | ||
3667 | // "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", | ||
3668 | // Name, LocalId, rot); | ||
3669 | |||
3408 | Quaternion axRot = rot; | 3670 | Quaternion axRot = rot; |
3409 | Quaternion oldParentRot = m_rootPart.RotationOffset; | 3671 | Quaternion oldParentRot = m_rootPart.RotationOffset; |
3410 | 3672 | ||
@@ -3436,6 +3698,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3436 | axPos *= oldParentRot; | 3698 | axPos *= oldParentRot; |
3437 | axPos *= Quaternion.Inverse(axRot); | 3699 | axPos *= Quaternion.Inverse(axRot); |
3438 | prim.OffsetPosition = axPos; | 3700 | prim.OffsetPosition = axPos; |
3701 | <<<<<<< HEAD | ||
3439 | 3702 | ||
3440 | prim.RotationOffset *= Quaternion.Inverse(prim.GetWorldRotation()) * (oldParentRot * prim.RotationOffset); | 3703 | prim.RotationOffset *= Quaternion.Inverse(prim.GetWorldRotation()) * (oldParentRot * prim.RotationOffset); |
3441 | 3704 | ||
@@ -3448,6 +3711,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
3448 | } | 3711 | } |
3449 | HasGroupChanged = true; | 3712 | HasGroupChanged = true; |
3450 | ScheduleGroupForFullUpdate(); | 3713 | ScheduleGroupForFullUpdate(); |
3714 | ======= | ||
3715 | Quaternion primsRot = prim.RotationOffset; | ||
3716 | Quaternion newRot = primsRot * oldParentRot; | ||
3717 | newRot *= Quaternion.Inverse(axRot); | ||
3718 | prim.RotationOffset = newRot; | ||
3719 | prim.ScheduleTerseUpdate(); | ||
3720 | prim.IgnoreUndoUpdate = false; | ||
3721 | } | ||
3722 | } | ||
3723 | |||
3724 | // for (int i = 0; i < parts.Length; i++) | ||
3725 | // { | ||
3726 | // SceneObjectPart childpart = parts[i]; | ||
3727 | // if (childpart != m_rootPart) | ||
3728 | // { | ||
3729 | //// childpart.IgnoreUndoUpdate = false; | ||
3730 | //// childpart.StoreUndoState(); | ||
3731 | // } | ||
3732 | // } | ||
3733 | |||
3734 | m_rootPart.ScheduleTerseUpdate(); | ||
3735 | |||
3736 | // m_log.DebugFormat( | ||
3737 | // "[SCENE OBJECT GROUP]: Updated root rotation of {0} {1} to {2}", | ||
3738 | // Name, LocalId, rot); | ||
3739 | >>>>>>> 9f75eaf50e42ef6409fc272ba33a817241907ed8 | ||
3451 | } | 3740 | } |
3452 | 3741 | ||
3453 | #endregion | 3742 | #endregion |
@@ -3462,28 +3751,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
3462 | int yaxis = 4; | 3751 | int yaxis = 4; |
3463 | int zaxis = 8; | 3752 | int zaxis = 8; |
3464 | 3753 | ||
3465 | if (m_rootPart != null) | 3754 | setX = ((axis & xaxis) != 0) ? true : false; |
3466 | { | 3755 | setY = ((axis & yaxis) != 0) ? true : false; |
3467 | setX = ((axis & xaxis) != 0) ? true : false; | 3756 | setZ = ((axis & zaxis) != 0) ? true : false; |
3468 | setY = ((axis & yaxis) != 0) ? true : false; | ||
3469 | setZ = ((axis & zaxis) != 0) ? true : false; | ||
3470 | 3757 | ||
3471 | float setval = (rotate10 > 0) ? 1f : 0f; | 3758 | float setval = (rotate10 > 0) ? 1f : 0f; |
3472 | 3759 | ||
3473 | if (setX) | 3760 | if (setX) |
3474 | m_rootPart.RotationAxis.X = setval; | 3761 | RootPart.RotationAxis.X = setval; |
3475 | if (setY) | 3762 | if (setY) |
3476 | m_rootPart.RotationAxis.Y = setval; | 3763 | RootPart.RotationAxis.Y = setval; |
3477 | if (setZ) | 3764 | if (setZ) |
3478 | m_rootPart.RotationAxis.Z = setval; | 3765 | RootPart.RotationAxis.Z = setval; |
3479 | 3766 | ||
3480 | if (setX || setY || setZ) | 3767 | if (setX || setY || setZ) |
3481 | { | 3768 | RootPart.SetPhysicsAxisRotation(); |
3482 | m_rootPart.SetPhysicsAxisRotation(); | ||
3483 | } | ||
3484 | |||
3485 | } | ||
3486 | } | 3769 | } |
3770 | |||
3487 | public int registerRotTargetWaypoint(Quaternion target, float tolerance) | 3771 | public int registerRotTargetWaypoint(Quaternion target, float tolerance) |
3488 | { | 3772 | { |
3489 | scriptRotTarget waypoint = new scriptRotTarget(); | 3773 | scriptRotTarget waypoint = new scriptRotTarget(); |
@@ -3611,7 +3895,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3611 | foreach (uint idx in m_rotTargets.Keys) | 3895 | foreach (uint idx in m_rotTargets.Keys) |
3612 | { | 3896 | { |
3613 | scriptRotTarget target = m_rotTargets[idx]; | 3897 | scriptRotTarget target = m_rotTargets[idx]; |
3614 | double angle = Math.Acos(target.targetRot.X * m_rootPart.RotationOffset.X + target.targetRot.Y * m_rootPart.RotationOffset.Y + target.targetRot.Z * m_rootPart.RotationOffset.Z + target.targetRot.W * m_rootPart.RotationOffset.W) * 2; | 3898 | double angle |
3899 | = Math.Acos( | ||
3900 | target.targetRot.X * m_rootPart.RotationOffset.X | ||
3901 | + target.targetRot.Y * m_rootPart.RotationOffset.Y | ||
3902 | + target.targetRot.Z * m_rootPart.RotationOffset.Z | ||
3903 | + target.targetRot.W * m_rootPart.RotationOffset.W) | ||
3904 | * 2; | ||
3615 | if (angle < 0) angle = -angle; | 3905 | if (angle < 0) angle = -angle; |
3616 | if (angle > Math.PI) angle = (Math.PI * 2 - angle); | 3906 | if (angle > Math.PI) angle = (Math.PI * 2 - angle); |
3617 | if (angle <= target.tolerance) | 3907 | if (angle <= target.tolerance) |
@@ -3676,43 +3966,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
3676 | 3966 | ||
3677 | return retmass; | 3967 | return retmass; |
3678 | } | 3968 | } |
3679 | 3969 | ||
3970 | /// <summary> | ||
3971 | /// If the object is a sculpt/mesh, retrieve the mesh data for each part and reinsert it into each shape so that | ||
3972 | /// the physics engine can use it. | ||
3973 | /// </summary> | ||
3974 | /// <remarks> | ||
3975 | /// When the physics engine has finished with it, the sculpt data is discarded to save memory. | ||
3976 | /// </remarks> | ||
3680 | public void CheckSculptAndLoad() | 3977 | public void CheckSculptAndLoad() |
3681 | { | 3978 | { |
3682 | if (IsDeleted) | 3979 | if (IsDeleted) |
3683 | return; | 3980 | return; |
3981 | |||
3684 | if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) | 3982 | if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) |
3685 | return; | 3983 | return; |
3686 | 3984 | ||
3687 | SceneObjectPart[] parts = m_parts.GetArray(); | 3985 | // m_log.Debug("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); |
3688 | for (int i = 0; i < parts.Length; i++) | ||
3689 | { | ||
3690 | SceneObjectPart part = parts[i]; | ||
3691 | if (part.Shape.SculptEntry && part.Shape.SculptTexture != UUID.Zero) | ||
3692 | { | ||
3693 | // check if a previously decoded sculpt map has been cached | ||
3694 | if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + part.Shape.SculptTexture.ToString()))) | ||
3695 | { | ||
3696 | part.SculptTextureCallback(part.Shape.SculptTexture, null); | ||
3697 | } | ||
3698 | else | ||
3699 | { | ||
3700 | m_scene.AssetService.Get( | ||
3701 | part.Shape.SculptTexture.ToString(), part, AssetReceived); | ||
3702 | } | ||
3703 | } | ||
3704 | } | ||
3705 | } | ||
3706 | 3986 | ||
3707 | protected void AssetReceived(string id, Object sender, AssetBase asset) | 3987 | SceneObjectPart[] parts = m_parts.GetArray(); |
3708 | { | ||
3709 | SceneObjectPart sop = (SceneObjectPart)sender; | ||
3710 | 3988 | ||
3711 | if (sop != null) | 3989 | for (int i = 0; i < parts.Length; i++) |
3712 | { | 3990 | parts[i].CheckSculptAndLoad(); |
3713 | if (asset != null) | ||
3714 | sop.SculptTextureCallback(asset.FullID, asset); | ||
3715 | } | ||
3716 | } | 3991 | } |
3717 | 3992 | ||
3718 | /// <summary> | 3993 | /// <summary> |
@@ -3747,19 +4022,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3747 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); | 4022 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); |
3748 | } | 4023 | } |
3749 | 4024 | ||
3750 | public void SetAttachmentPoint(byte point) | ||
3751 | { | ||
3752 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
3753 | for (int i = 0; i < parts.Length; i++) | ||
3754 | parts[i].SetAttachmentPoint(point); | ||
3755 | } | ||
3756 | |||
3757 | #region ISceneObject | 4025 | #region ISceneObject |
3758 | 4026 | ||
3759 | public virtual ISceneObject CloneForNewScene() | 4027 | public virtual ISceneObject CloneForNewScene() |
3760 | { | 4028 | { |
3761 | SceneObjectGroup sog = Copy(false); | 4029 | SceneObjectGroup sog = Copy(false); |
3762 | sog.m_isDeleted = false; | 4030 | sog.IsDeleted = false; |
3763 | return sog; | 4031 | return sog; |
3764 | } | 4032 | } |
3765 | 4033 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 037f384..893faf8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.IO; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Runtime.Serialization; | 33 | using System.Runtime.Serialization; |
33 | using System.Security.Permissions; | 34 | using System.Security.Permissions; |
@@ -216,28 +217,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
216 | /// </value> | 217 | /// </value> |
217 | private UUID m_fromUserInventoryItemID; | 218 | private UUID m_fromUserInventoryItemID; |
218 | 219 | ||
219 | |||
220 | public UUID FromUserInventoryItemID | 220 | public UUID FromUserInventoryItemID |
221 | { | 221 | { |
222 | get { return m_fromUserInventoryItemID; } | 222 | get { return m_fromUserInventoryItemID; } |
223 | set { m_fromUserInventoryItemID = value; } | ||
223 | } | 224 | } |
224 | 225 | ||
225 | |||
226 | public bool IsAttachment; | ||
227 | |||
228 | |||
229 | public scriptEvents AggregateScriptEvents; | 226 | public scriptEvents AggregateScriptEvents; |
230 | 227 | ||
231 | 228 | ||
232 | public UUID AttachedAvatar; | ||
233 | |||
234 | |||
235 | public Vector3 AttachedPos; | 229 | public Vector3 AttachedPos; |
236 | 230 | ||
237 | 231 | ||
238 | public uint AttachmentPoint; | ||
239 | |||
240 | |||
241 | public Vector3 RotationAxis = Vector3.One; | 232 | public Vector3 RotationAxis = Vector3.One; |
242 | 233 | ||
243 | 234 | ||
@@ -269,12 +260,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
269 | } | 260 | } |
270 | protected SceneObjectPartInventory m_inventory; | 261 | protected SceneObjectPartInventory m_inventory; |
271 | 262 | ||
272 | |||
273 | public bool Undoing; | 263 | public bool Undoing; |
274 | |||
275 | 264 | ||
276 | public bool IgnoreUndoUpdate = false; | 265 | public bool IgnoreUndoUpdate = false; |
277 | |||
278 | 266 | ||
279 | private PrimFlags LocalFlags; | 267 | private PrimFlags LocalFlags; |
280 | 268 | ||
@@ -296,8 +284,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
296 | private bool m_occupied; // KF if any av is sitting on this prim | 284 | private bool m_occupied; // KF if any av is sitting on this prim |
297 | private string m_text = String.Empty; | 285 | private string m_text = String.Empty; |
298 | private string m_touchName = String.Empty; | 286 | private string m_touchName = String.Empty; |
299 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 287 | private readonly Stack<UndoState> m_undo = new Stack<UndoState>(5); |
300 | private readonly UndoStack<UndoState> m_redo = new UndoStack<UndoState>(5); | 288 | private readonly Stack<UndoState> m_redo = new Stack<UndoState>(5); |
301 | private UUID _creatorID; | 289 | private UUID _creatorID; |
302 | 290 | ||
303 | private bool m_passTouches; | 291 | private bool m_passTouches; |
@@ -323,7 +311,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
323 | protected string m_name; | 311 | protected string m_name; |
324 | protected Vector3 m_offsetPosition; | 312 | protected Vector3 m_offsetPosition; |
325 | 313 | ||
326 | // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out. | ||
327 | protected SceneObjectGroup m_parentGroup; | 314 | protected SceneObjectGroup m_parentGroup; |
328 | protected byte[] m_particleSystem = Utils.EmptyBytes; | 315 | protected byte[] m_particleSystem = Utils.EmptyBytes; |
329 | protected ulong m_regionHandle; | 316 | protected ulong m_regionHandle; |
@@ -424,7 +411,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
424 | CreateSelected = true; | 411 | CreateSelected = true; |
425 | 412 | ||
426 | TrimPermissions(); | 413 | TrimPermissions(); |
427 | //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); | ||
428 | 414 | ||
429 | m_inventory = new SceneObjectPartInventory(this); | 415 | m_inventory = new SceneObjectPartInventory(this); |
430 | } | 416 | } |
@@ -619,6 +605,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
619 | set | 605 | set |
620 | { | 606 | { |
621 | m_passTouches = value; | 607 | m_passTouches = value; |
608 | |||
622 | if (ParentGroup != null) | 609 | if (ParentGroup != null) |
623 | ParentGroup.HasGroupChanged = true; | 610 | ParentGroup.HasGroupChanged = true; |
624 | } | 611 | } |
@@ -744,9 +731,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
744 | return m_groupPosition; | 731 | return m_groupPosition; |
745 | } | 732 | } |
746 | 733 | ||
747 | if (IsAttachment) | 734 | if (m_parentGroup.IsAttachment) |
748 | { | 735 | { |
749 | ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar); | 736 | ScenePresence sp = m_parentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); |
750 | if (sp != null) | 737 | if (sp != null) |
751 | return sp.AbsolutePosition; | 738 | return sp.AbsolutePosition; |
752 | } | 739 | } |
@@ -794,7 +781,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
794 | set | 781 | set |
795 | { | 782 | { |
796 | Vector3 oldpos = m_offsetPosition; | 783 | Vector3 oldpos = m_offsetPosition; |
797 | StoreUndoState(UndoType.STATE_PRIM_POSITION); | ||
798 | m_offsetPosition = value; | 784 | m_offsetPosition = value; |
799 | 785 | ||
800 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 786 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -834,7 +820,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
834 | { | 820 | { |
835 | if (IsRoot) | 821 | if (IsRoot) |
836 | { | 822 | { |
837 | if (IsAttachment) | 823 | if (m_parentGroup.IsAttachment) |
838 | return AttachedPos; | 824 | return AttachedPos; |
839 | else | 825 | else |
840 | return AbsolutePosition; | 826 | return AbsolutePosition; |
@@ -887,7 +873,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
887 | actor.Orientation = resultingrotation; | 873 | actor.Orientation = resultingrotation; |
888 | //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); | 874 | //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); |
889 | } | 875 | } |
890 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 876 | |
877 | if (m_parentGroup != null) | ||
878 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | ||
891 | //} | 879 | //} |
892 | } | 880 | } |
893 | catch (Exception ex) | 881 | catch (Exception ex) |
@@ -895,7 +883,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
895 | m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message); | 883 | m_log.Error("[SCENEOBJECTPART]: ROTATIONOFFSET" + ex.Message); |
896 | } | 884 | } |
897 | } | 885 | } |
898 | |||
899 | } | 886 | } |
900 | } | 887 | } |
901 | 888 | ||
@@ -1044,30 +1031,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
1044 | get { return m_shape; } | 1031 | get { return m_shape; } |
1045 | set { m_shape = value; } | 1032 | set { m_shape = value; } |
1046 | } | 1033 | } |
1047 | 1034 | ||
1035 | /// <summary> | ||
1036 | /// Change the scale of this part. | ||
1037 | /// </summary> | ||
1048 | public Vector3 Scale | 1038 | public Vector3 Scale |
1049 | { | 1039 | { |
1050 | get { return m_shape.Scale; } | 1040 | get { return m_shape.Scale; } |
1051 | set | 1041 | set |
1052 | { | 1042 | { |
1053 | StoreUndoState(UndoType.STATE_PRIM_SCALE); | ||
1054 | if (m_shape != null) | 1043 | if (m_shape != null) |
1055 | { | 1044 | { |
1045 | StoreUndoState(); | ||
1046 | |||
1056 | m_shape.Scale = value; | 1047 | m_shape.Scale = value; |
1057 | 1048 | ||
1058 | PhysicsActor actor = PhysActor; | 1049 | PhysicsActor actor = PhysActor; |
1059 | if (actor != null && m_parentGroup != null) | 1050 | if (actor != null) |
1060 | { | 1051 | { |
1061 | if (m_parentGroup.Scene != null) | 1052 | if (m_parentGroup.Scene != null) |
1062 | { | 1053 | { |
1063 | if (m_parentGroup.Scene.PhysicsScene != null) | 1054 | if (m_parentGroup.Scene.PhysicsScene != null) |
1064 | { | 1055 | { |
1065 | actor.Size = m_shape.Scale; | 1056 | actor.Size = m_shape.Scale; |
1066 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 1057 | |
1058 | if (Shape.SculptEntry) | ||
1059 | CheckSculptAndLoad(); | ||
1060 | else | ||
1061 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
1067 | } | 1062 | } |
1068 | } | 1063 | } |
1069 | } | 1064 | } |
1070 | } | 1065 | } |
1066 | |||
1071 | TriggerScriptChangedEvent(Changed.SCALE); | 1067 | TriggerScriptChangedEvent(Changed.SCALE); |
1072 | } | 1068 | } |
1073 | } | 1069 | } |
@@ -1092,13 +1088,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1092 | set | 1088 | set |
1093 | { | 1089 | { |
1094 | m_mediaUrl = value; | 1090 | m_mediaUrl = value; |
1095 | 1091 | ||
1096 | if (ParentGroup != null) | 1092 | if (ParentGroup != null) |
1097 | ParentGroup.HasGroupChanged = true; | 1093 | ParentGroup.HasGroupChanged = true; |
1098 | } | 1094 | } |
1099 | } | 1095 | } |
1100 | 1096 | ||
1101 | |||
1102 | public bool CreateSelected | 1097 | public bool CreateSelected |
1103 | { | 1098 | { |
1104 | get { return m_createSelected; } | 1099 | get { return m_createSelected; } |
@@ -1118,7 +1113,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1118 | { | 1113 | { |
1119 | get | 1114 | get |
1120 | { | 1115 | { |
1121 | return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); | 1116 | if (m_parentGroup.IsAttachment) |
1117 | return GroupPosition; | ||
1118 | |||
1119 | return m_offsetPosition + m_groupPosition; | ||
1122 | } | 1120 | } |
1123 | } | 1121 | } |
1124 | 1122 | ||
@@ -1138,7 +1136,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1138 | set { m_sitTargetOrientation = value; } | 1136 | set { m_sitTargetOrientation = value; } |
1139 | } | 1137 | } |
1140 | 1138 | ||
1141 | |||
1142 | public Vector3 SitTargetPosition | 1139 | public Vector3 SitTargetPosition |
1143 | { | 1140 | { |
1144 | get { return m_sitTargetPosition; } | 1141 | get { return m_sitTargetPosition; } |
@@ -1268,7 +1265,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1268 | /// <summary> | 1265 | /// <summary> |
1269 | /// Property flags. See OpenMetaverse.PrimFlags | 1266 | /// Property flags. See OpenMetaverse.PrimFlags |
1270 | /// </summary> | 1267 | /// </summary> |
1268 | /// <remarks> | ||
1271 | /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge | 1269 | /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge |
1270 | /// </remarks> | ||
1272 | public PrimFlags Flags | 1271 | public PrimFlags Flags |
1273 | { | 1272 | { |
1274 | get { return _flags; } | 1273 | get { return _flags; } |
@@ -1298,7 +1297,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1298 | { | 1297 | { |
1299 | get | 1298 | get |
1300 | { | 1299 | { |
1301 | if (ParentGroup != null && ParentGroup.Scene != null) | 1300 | if (ParentGroup.Scene != null) |
1302 | return ParentGroup.Scene.RegionInfo.RegionID; | 1301 | return ParentGroup.Scene.RegionInfo.RegionID; |
1303 | else | 1302 | else |
1304 | return UUID.Zero; | 1303 | return UUID.Zero; |
@@ -1313,14 +1312,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1313 | get | 1312 | get |
1314 | { | 1313 | { |
1315 | if (ParentGroup != null) | 1314 | if (ParentGroup != null) |
1316 | { | ||
1317 | _parentUUID = ParentGroup.UUID; | 1315 | _parentUUID = ParentGroup.UUID; |
1318 | } | 1316 | |
1319 | return _parentUUID; | 1317 | return _parentUUID; |
1320 | } | 1318 | } |
1319 | |||
1321 | set { _parentUUID = value; } | 1320 | set { _parentUUID = value; } |
1322 | } | 1321 | } |
1323 | |||
1324 | 1322 | ||
1325 | public string SitAnimation | 1323 | public string SitAnimation |
1326 | { | 1324 | { |
@@ -1555,10 +1553,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1555 | impulse = newimpulse; | 1553 | impulse = newimpulse; |
1556 | } | 1554 | } |
1557 | 1555 | ||
1558 | if (m_parentGroup != null) | 1556 | m_parentGroup.applyAngularImpulse(impulse); |
1559 | { | ||
1560 | m_parentGroup.applyAngularImpulse(impulse); | ||
1561 | } | ||
1562 | } | 1557 | } |
1563 | 1558 | ||
1564 | /// <summary> | 1559 | /// <summary> |
@@ -1581,19 +1576,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1581 | impulse = newimpulse; | 1576 | impulse = newimpulse; |
1582 | } | 1577 | } |
1583 | 1578 | ||
1584 | if (m_parentGroup != null) | 1579 | m_parentGroup.setAngularImpulse(impulse); |
1585 | { | ||
1586 | m_parentGroup.setAngularImpulse(impulse); | ||
1587 | } | ||
1588 | } | ||
1589 | |||
1590 | public Vector3 GetTorque() | ||
1591 | { | ||
1592 | if (m_parentGroup != null) | ||
1593 | { | ||
1594 | m_parentGroup.GetTorque(); | ||
1595 | } | ||
1596 | return Vector3.Zero; | ||
1597 | } | 1580 | } |
1598 | 1581 | ||
1599 | /// <summary> | 1582 | /// <summary> |
@@ -1623,7 +1606,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1623 | 1606 | ||
1624 | // 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 | 1607 | // 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 |
1625 | // or flexible | 1608 | // or flexible |
1626 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1609 | if (!isPhantom && !m_parentGroup.IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1627 | { | 1610 | { |
1628 | try | 1611 | try |
1629 | { | 1612 | { |
@@ -1635,7 +1618,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1635 | RotationOffset, | 1618 | RotationOffset, |
1636 | RigidBody, | 1619 | RigidBody, |
1637 | m_localId); | 1620 | m_localId); |
1638 | PhysActor.SetMaterial(Material); | ||
1639 | } | 1621 | } |
1640 | catch | 1622 | catch |
1641 | { | 1623 | { |
@@ -1647,6 +1629,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1647 | { | 1629 | { |
1648 | PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info | 1630 | PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info |
1649 | PhysActor.SOPDescription = this.Description; | 1631 | PhysActor.SOPDescription = this.Description; |
1632 | PhysActor.SetMaterial(Material); | ||
1650 | DoPhysicsPropertyUpdate(RigidBody, true); | 1633 | DoPhysicsPropertyUpdate(RigidBody, true); |
1651 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); | 1634 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); |
1652 | } | 1635 | } |
@@ -1658,19 +1641,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1658 | } | 1641 | } |
1659 | } | 1642 | } |
1660 | 1643 | ||
1661 | public void ClearUndoState() | ||
1662 | { | ||
1663 | lock (m_undo) | ||
1664 | { | ||
1665 | m_undo.Clear(); | ||
1666 | } | ||
1667 | lock (m_redo) | ||
1668 | { | ||
1669 | m_redo.Clear(); | ||
1670 | } | ||
1671 | StoreUndoState(UndoType.STATE_ALL); | ||
1672 | } | ||
1673 | |||
1674 | public byte ConvertScriptUintToByte(uint indata) | 1644 | public byte ConvertScriptUintToByte(uint indata) |
1675 | { | 1645 | { |
1676 | byte outdata = (byte)TextureAnimFlags.NONE; | 1646 | byte outdata = (byte)TextureAnimFlags.NONE; |
@@ -1751,7 +1721,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1751 | { | 1721 | { |
1752 | if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) | 1722 | if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) |
1753 | { | 1723 | { |
1754 | m_parentGroup.Scene.AssetService.Get(dupe.m_shape.SculptTexture.ToString(), dupe, AssetReceived); | 1724 | ParentGroup.Scene.AssetService.Get( |
1725 | dupe.m_shape.SculptTexture.ToString(), dupe, dupe.AssetReceived); | ||
1755 | } | 1726 | } |
1756 | 1727 | ||
1757 | bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); | 1728 | bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); |
@@ -1765,14 +1736,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1765 | return dupe; | 1736 | return dupe; |
1766 | } | 1737 | } |
1767 | 1738 | ||
1739 | /// <summary> | ||
1740 | /// Called back by asynchronous asset fetch. | ||
1741 | /// </summary> | ||
1742 | /// <param name="id">ID of asset received</param> | ||
1743 | /// <param name="sender">Register</param> | ||
1744 | /// <param name="asset"></param> | ||
1768 | protected void AssetReceived(string id, Object sender, AssetBase asset) | 1745 | protected void AssetReceived(string id, Object sender, AssetBase asset) |
1769 | { | 1746 | { |
1770 | if (asset != null) | 1747 | if (asset != null) |
1771 | { | 1748 | SculptTextureCallback(asset); |
1772 | SceneObjectPart sop = (SceneObjectPart)sender; | 1749 | else |
1773 | if (sop != null) | 1750 | m_log.WarnFormat( |
1774 | sop.SculptTextureCallback(asset.FullID, asset); | 1751 | "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data", |
1775 | } | 1752 | Name, LocalId, id); |
1776 | } | 1753 | } |
1777 | 1754 | ||
1778 | public static SceneObjectPart Create() | 1755 | public static SceneObjectPart Create() |
@@ -1789,97 +1766,111 @@ namespace OpenSim.Region.Framework.Scenes | |||
1789 | return part; | 1766 | return part; |
1790 | } | 1767 | } |
1791 | 1768 | ||
1792 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) | 1769 | /// <summary> |
1770 | /// Do a physics property update for a NINJA joint. | ||
1771 | /// </summary> | ||
1772 | /// <param name="UsePhysics"></param> | ||
1773 | /// <param name="isNew"></param> | ||
1774 | protected void DoPhysicsPropertyUpdateForNinjaJoint(bool UsePhysics, bool isNew) | ||
1793 | { | 1775 | { |
1794 | if (IsJoint()) | 1776 | if (UsePhysics) |
1795 | { | 1777 | { |
1796 | if (UsePhysics) | 1778 | // by turning a joint proxy object physical, we cause creation of a joint in the ODE scene. |
1797 | { | 1779 | // note that, as a special case, joints have no bodies or geoms in the physics scene, even though they are physical. |
1798 | // by turning a joint proxy object physical, we cause creation of a joint in the ODE scene. | ||
1799 | // note that, as a special case, joints have no bodies or geoms in the physics scene, even though they are physical. | ||
1800 | 1780 | ||
1801 | PhysicsJointType jointType; | 1781 | PhysicsJointType jointType; |
1802 | if (IsHingeJoint()) | 1782 | if (IsHingeJoint()) |
1803 | { | 1783 | { |
1804 | jointType = PhysicsJointType.Hinge; | 1784 | jointType = PhysicsJointType.Hinge; |
1805 | } | 1785 | } |
1806 | else if (IsBallJoint()) | 1786 | else if (IsBallJoint()) |
1807 | { | 1787 | { |
1808 | jointType = PhysicsJointType.Ball; | 1788 | jointType = PhysicsJointType.Ball; |
1809 | } | 1789 | } |
1810 | else | 1790 | else |
1811 | { | 1791 | { |
1812 | jointType = PhysicsJointType.Ball; | 1792 | jointType = PhysicsJointType.Ball; |
1813 | } | 1793 | } |
1814 | 1794 | ||
1815 | List<string> bodyNames = new List<string>(); | 1795 | List<string> bodyNames = new List<string>(); |
1816 | string RawParams = Description; | 1796 | string RawParams = Description; |
1817 | string[] jointParams = RawParams.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries); | 1797 | string[] jointParams = RawParams.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries); |
1818 | string trackedBodyName = null; | 1798 | string trackedBodyName = null; |
1819 | if (jointParams.Length >= 2) | 1799 | if (jointParams.Length >= 2) |
1800 | { | ||
1801 | for (int iBodyName = 0; iBodyName < 2; iBodyName++) | ||
1820 | { | 1802 | { |
1821 | for (int iBodyName = 0; iBodyName < 2; iBodyName++) | 1803 | string bodyName = jointParams[iBodyName]; |
1804 | bodyNames.Add(bodyName); | ||
1805 | if (bodyName != "NULL") | ||
1822 | { | 1806 | { |
1823 | string bodyName = jointParams[iBodyName]; | 1807 | if (trackedBodyName == null) |
1824 | bodyNames.Add(bodyName); | ||
1825 | if (bodyName != "NULL") | ||
1826 | { | 1808 | { |
1827 | if (trackedBodyName == null) | 1809 | trackedBodyName = bodyName; |
1828 | { | ||
1829 | trackedBodyName = bodyName; | ||
1830 | } | ||
1831 | } | 1810 | } |
1832 | } | 1811 | } |
1833 | } | 1812 | } |
1813 | } | ||
1834 | 1814 | ||
1835 | SceneObjectPart trackedBody = m_parentGroup.Scene.GetSceneObjectPart(trackedBodyName); // FIXME: causes a sequential lookup | 1815 | SceneObjectPart trackedBody = m_parentGroup.Scene.GetSceneObjectPart(trackedBodyName); // FIXME: causes a sequential lookup |
1836 | Quaternion localRotation = Quaternion.Identity; | 1816 | Quaternion localRotation = Quaternion.Identity; |
1837 | if (trackedBody != null) | 1817 | if (trackedBody != null) |
1838 | { | 1818 | { |
1839 | localRotation = Quaternion.Inverse(trackedBody.RotationOffset) * this.RotationOffset; | 1819 | localRotation = Quaternion.Inverse(trackedBody.RotationOffset) * this.RotationOffset; |
1840 | } | 1820 | } |
1841 | else | 1821 | else |
1842 | { | 1822 | { |
1843 | // error, output it below | 1823 | // error, output it below |
1844 | } | 1824 | } |
1845 | |||
1846 | PhysicsJoint joint; | ||
1847 | 1825 | ||
1848 | joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType, | 1826 | PhysicsJoint joint; |
1849 | AbsolutePosition, | ||
1850 | this.RotationOffset, | ||
1851 | Description, | ||
1852 | bodyNames, | ||
1853 | trackedBodyName, | ||
1854 | localRotation); | ||
1855 | 1827 | ||
1856 | if (trackedBody == null) | 1828 | joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType, |
1857 | { | 1829 | AbsolutePosition, |
1858 | ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name); | 1830 | this.RotationOffset, |
1859 | } | 1831 | Description, |
1832 | bodyNames, | ||
1833 | trackedBodyName, | ||
1834 | localRotation); | ||
1860 | 1835 | ||
1836 | if (trackedBody == null) | ||
1837 | { | ||
1838 | ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name); | ||
1839 | } | ||
1840 | } | ||
1841 | else | ||
1842 | { | ||
1843 | if (isNew) | ||
1844 | { | ||
1845 | // if the joint proxy is new, and it is not physical, do nothing. There is no joint in ODE to | ||
1846 | // delete, and if we try to delete it, due to asynchronous processing, the deletion request | ||
1847 | // will get processed later at an indeterminate time, which could cancel a later-arriving | ||
1848 | // joint creation request. | ||
1861 | } | 1849 | } |
1862 | else | 1850 | else |
1863 | { | 1851 | { |
1864 | if (isNew) | 1852 | // here we turn off the joint object, so remove the joint from the physics scene |
1865 | { | 1853 | m_parentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed? |
1866 | // if the joint proxy is new, and it is not physical, do nothing. There is no joint in ODE to | ||
1867 | // delete, and if we try to delete it, due to asynchronous processing, the deletion request | ||
1868 | // will get processed later at an indeterminate time, which could cancel a later-arriving | ||
1869 | // joint creation request. | ||
1870 | } | ||
1871 | else | ||
1872 | { | ||
1873 | // here we turn off the joint object, so remove the joint from the physics scene | ||
1874 | m_parentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed? | ||
1875 | 1854 | ||
1876 | // make sure client isn't interpolating the joint proxy object | 1855 | // make sure client isn't interpolating the joint proxy object |
1877 | Velocity = Vector3.Zero; | 1856 | Velocity = Vector3.Zero; |
1878 | AngularVelocity = Vector3.Zero; | 1857 | AngularVelocity = Vector3.Zero; |
1879 | Acceleration = Vector3.Zero; | 1858 | Acceleration = Vector3.Zero; |
1880 | } | ||
1881 | } | 1859 | } |
1882 | } | 1860 | } |
1861 | } | ||
1862 | |||
1863 | /// <summary> | ||
1864 | /// Do a physics propery update for this part. | ||
1865 | /// </summary> | ||
1866 | /// <param name="UsePhysics"></param> | ||
1867 | /// <param name="isNew"></param> | ||
1868 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) | ||
1869 | { | ||
1870 | if (IsJoint()) | ||
1871 | { | ||
1872 | DoPhysicsPropertyUpdateForNinjaJoint(UsePhysics, isNew); | ||
1873 | } | ||
1883 | else | 1874 | else |
1884 | { | 1875 | { |
1885 | if (PhysActor != null) | 1876 | if (PhysActor != null) |
@@ -1919,7 +1910,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1919 | 1910 | ||
1920 | PhysActor.IsPhysical = UsePhysics; | 1911 | PhysActor.IsPhysical = UsePhysics; |
1921 | 1912 | ||
1922 | |||
1923 | // If we're not what we're supposed to be in the physics scene, recreate ourselves. | 1913 | // If we're not what we're supposed to be in the physics scene, recreate ourselves. |
1924 | //m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); | 1914 | //m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); |
1925 | /// that's not wholesome. Had to make Scene public | 1915 | /// that's not wholesome. Had to make Scene public |
@@ -1943,7 +1933,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1943 | } | 1933 | } |
1944 | } | 1934 | } |
1945 | } | 1935 | } |
1946 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 1936 | |
1937 | // If this part is a sculpt then delay the physics update until we've asynchronously loaded the | ||
1938 | // mesh data. | ||
1939 | if (Shape.SculptEntry) | ||
1940 | CheckSculptAndLoad(); | ||
1941 | else | ||
1942 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
1947 | } | 1943 | } |
1948 | } | 1944 | } |
1949 | } | 1945 | } |
@@ -1955,22 +1951,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1955 | /// <returns></returns> | 1951 | /// <returns></returns> |
1956 | public static SceneObjectPart FromXml(XmlTextReader xmlReader) | 1952 | public static SceneObjectPart FromXml(XmlTextReader xmlReader) |
1957 | { | 1953 | { |
1958 | return FromXml(UUID.Zero, xmlReader); | ||
1959 | } | ||
1960 | |||
1961 | /// <summary> | ||
1962 | /// Restore this part from the serialized xml representation. | ||
1963 | /// </summary> | ||
1964 | /// <param name="fromUserInventoryItemId">The inventory id from which this part came, if applicable</param> | ||
1965 | /// <param name="xmlReader"></param> | ||
1966 | /// <returns></returns> | ||
1967 | public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlTextReader xmlReader) | ||
1968 | { | ||
1969 | SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader); | 1954 | SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader); |
1970 | part.m_fromUserInventoryItemID = fromUserInventoryItemId; | ||
1971 | 1955 | ||
1972 | // for tempOnRez objects, we have to fix the Expire date. | 1956 | // for tempOnRez objects, we have to fix the Expire date. |
1973 | if ((part.Flags & PrimFlags.TemporaryOnRez) != 0) part.ResetExpire(); | 1957 | if ((part.Flags & PrimFlags.TemporaryOnRez) != 0) |
1958 | part.ResetExpire(); | ||
1974 | 1959 | ||
1975 | return part; | 1960 | return part; |
1976 | } | 1961 | } |
@@ -1982,8 +1967,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1982 | 1967 | ||
1983 | public bool GetDieAtEdge() | 1968 | public bool GetDieAtEdge() |
1984 | { | 1969 | { |
1985 | if (m_parentGroup == null) | ||
1986 | return false; | ||
1987 | if (m_parentGroup.IsDeleted) | 1970 | if (m_parentGroup.IsDeleted) |
1988 | return false; | 1971 | return false; |
1989 | 1972 | ||
@@ -1992,8 +1975,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1992 | 1975 | ||
1993 | public bool GetReturnAtEdge() | 1976 | public bool GetReturnAtEdge() |
1994 | { | 1977 | { |
1995 | if (m_parentGroup == null) | ||
1996 | return false; | ||
1997 | if (m_parentGroup.IsDeleted) | 1978 | if (m_parentGroup.IsDeleted) |
1998 | return false; | 1979 | return false; |
1999 | 1980 | ||
@@ -2002,8 +1983,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2002 | 1983 | ||
2003 | public void SetReturnAtEdge(bool p) | 1984 | public void SetReturnAtEdge(bool p) |
2004 | { | 1985 | { |
2005 | if (m_parentGroup == null) | ||
2006 | return; | ||
2007 | if (m_parentGroup.IsDeleted) | 1986 | if (m_parentGroup.IsDeleted) |
2008 | return; | 1987 | return; |
2009 | 1988 | ||
@@ -2012,8 +1991,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2012 | 1991 | ||
2013 | public bool GetBlockGrab() | 1992 | public bool GetBlockGrab() |
2014 | { | 1993 | { |
2015 | if (m_parentGroup == null) | ||
2016 | return false; | ||
2017 | if (m_parentGroup.IsDeleted) | 1994 | if (m_parentGroup.IsDeleted) |
2018 | return false; | 1995 | return false; |
2019 | 1996 | ||
@@ -2022,8 +1999,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2022 | 1999 | ||
2023 | public void SetBlockGrab(bool p) | 2000 | public void SetBlockGrab(bool p) |
2024 | { | 2001 | { |
2025 | if (m_parentGroup == null) | ||
2026 | return; | ||
2027 | if (m_parentGroup.IsDeleted) | 2002 | if (m_parentGroup.IsDeleted) |
2028 | return; | 2003 | return; |
2029 | 2004 | ||
@@ -2032,8 +2007,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2032 | 2007 | ||
2033 | public void SetStatusSandbox(bool p) | 2008 | public void SetStatusSandbox(bool p) |
2034 | { | 2009 | { |
2035 | if (m_parentGroup == null) | ||
2036 | return; | ||
2037 | if (m_parentGroup.IsDeleted) | 2010 | if (m_parentGroup.IsDeleted) |
2038 | return; | 2011 | return; |
2039 | StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition; | 2012 | StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition; |
@@ -2042,8 +2015,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2042 | 2015 | ||
2043 | public bool GetStatusSandbox() | 2016 | public bool GetStatusSandbox() |
2044 | { | 2017 | { |
2045 | if (m_parentGroup == null) | ||
2046 | return false; | ||
2047 | if (m_parentGroup.IsDeleted) | 2018 | if (m_parentGroup.IsDeleted) |
2048 | return false; | 2019 | return false; |
2049 | 2020 | ||
@@ -2085,25 +2056,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2085 | public Vector3 GetGeometricCenter() | 2056 | public Vector3 GetGeometricCenter() |
2086 | { | 2057 | { |
2087 | if (PhysActor != null) | 2058 | if (PhysActor != null) |
2088 | { | ||
2089 | return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z); | 2059 | return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z); |
2090 | } | ||
2091 | else | 2060 | else |
2092 | { | ||
2093 | return new Vector3(0, 0, 0); | 2061 | return new Vector3(0, 0, 0); |
2094 | } | ||
2095 | } | 2062 | } |
2096 | 2063 | ||
2097 | public float GetMass() | 2064 | public float GetMass() |
2098 | { | 2065 | { |
2099 | if (PhysActor != null) | 2066 | if (PhysActor != null) |
2100 | { | ||
2101 | return PhysActor.Mass; | 2067 | return PhysActor.Mass; |
2102 | } | ||
2103 | else | 2068 | else |
2104 | { | ||
2105 | return 0; | 2069 | return 0; |
2106 | } | ||
2107 | } | 2070 | } |
2108 | 2071 | ||
2109 | public Vector3 GetForce() | 2072 | public Vector3 GetForce() |
@@ -2119,19 +2082,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2119 | client.SendObjectPropertiesReply(this); | 2082 | client.SendObjectPropertiesReply(this); |
2120 | } | 2083 | } |
2121 | 2084 | ||
2122 | public UUID GetRootPartUUID() | ||
2123 | { | ||
2124 | if (m_parentGroup != null) | ||
2125 | { | ||
2126 | return m_parentGroup.UUID; | ||
2127 | } | ||
2128 | return UUID.Zero; | ||
2129 | } | ||
2130 | |||
2131 | /// <summary> | 2085 | /// <summary> |
2132 | /// Method for a prim to get it's world position from the group. | 2086 | /// Method for a prim to get it's world position from the group. |
2133 | /// Remember, the Group Position simply gives the position of the group itself | ||
2134 | /// </summary> | 2087 | /// </summary> |
2088 | /// <remarks> | ||
2089 | /// Remember, the Group Position simply gives the position of the group itself | ||
2090 | /// </remarks> | ||
2135 | /// <returns>A Linked Child Prim objects position in world</returns> | 2091 | /// <returns>A Linked Child Prim objects position in world</returns> |
2136 | public Vector3 GetWorldPosition() | 2092 | public Vector3 GetWorldPosition() |
2137 | { | 2093 | { |
@@ -2249,8 +2205,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2249 | m_lastColliders.Remove(localID); | 2205 | m_lastColliders.Remove(localID); |
2250 | } | 2206 | } |
2251 | 2207 | ||
2252 | if (m_parentGroup == null) | ||
2253 | return; | ||
2254 | if (m_parentGroup.IsDeleted) | 2208 | if (m_parentGroup.IsDeleted) |
2255 | return; | 2209 | return; |
2256 | 2210 | ||
@@ -2271,9 +2225,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2271 | { | 2225 | { |
2272 | if (localId == 0) | 2226 | if (localId == 0) |
2273 | continue; | 2227 | continue; |
2274 | // always running this check because if the user deletes the object it would return a null reference. | ||
2275 | if (m_parentGroup == null) | ||
2276 | return; | ||
2277 | 2228 | ||
2278 | if (m_parentGroup.Scene == null) | 2229 | if (m_parentGroup.Scene == null) |
2279 | return; | 2230 | return; |
@@ -2282,7 +2233,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2282 | string data = ""; | 2233 | string data = ""; |
2283 | if (obj != null) | 2234 | if (obj != null) |
2284 | { | 2235 | { |
2285 | if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) | 2236 | if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) |
2237 | || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) | ||
2286 | { | 2238 | { |
2287 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); | 2239 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); |
2288 | //If it is 1, it is to accept ONLY collisions from this object | 2240 | //If it is 1, it is to accept ONLY collisions from this object |
@@ -2329,7 +2281,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2329 | { | 2281 | { |
2330 | if (av.LocalId == localId) | 2282 | if (av.LocalId == localId) |
2331 | { | 2283 | { |
2332 | if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) | 2284 | if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) |
2285 | || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) | ||
2333 | { | 2286 | { |
2334 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); | 2287 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); |
2335 | //If it is 1, it is to accept ONLY collisions from this avatar | 2288 | //If it is 1, it is to accept ONLY collisions from this avatar |
@@ -2377,12 +2330,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2377 | if (colliding.Count > 0) | 2330 | if (colliding.Count > 0) |
2378 | { | 2331 | { |
2379 | StartCollidingMessage.Colliders = colliding; | 2332 | StartCollidingMessage.Colliders = colliding; |
2380 | // always running this check because if the user deletes the object it would return a null reference. | ||
2381 | if (m_parentGroup == null) | ||
2382 | return; | ||
2383 | 2333 | ||
2384 | if (m_parentGroup.Scene == null) | 2334 | if (m_parentGroup.Scene == null) |
2385 | return; | 2335 | return; |
2336 | |||
2386 | if (m_parentGroup.PassCollision == true) | 2337 | if (m_parentGroup.PassCollision == true) |
2387 | { | 2338 | { |
2388 | //TODO: Add pass to root prim! | 2339 | //TODO: Add pass to root prim! |
@@ -2403,9 +2354,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2403 | // always running this check because if the user deletes the object it would return a null reference. | 2354 | // always running this check because if the user deletes the object it would return a null reference. |
2404 | if (localId == 0) | 2355 | if (localId == 0) |
2405 | continue; | 2356 | continue; |
2406 | |||
2407 | if (m_parentGroup == null) | ||
2408 | return; | ||
2409 | 2357 | ||
2410 | if (m_parentGroup.Scene == null) | 2358 | if (m_parentGroup.Scene == null) |
2411 | return; | 2359 | return; |
@@ -2414,7 +2362,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2414 | string data = ""; | 2362 | string data = ""; |
2415 | if (obj != null) | 2363 | if (obj != null) |
2416 | { | 2364 | { |
2417 | if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) | 2365 | if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) |
2366 | || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) | ||
2418 | { | 2367 | { |
2419 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); | 2368 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); |
2420 | //If it is 1, it is to accept ONLY collisions from this object | 2369 | //If it is 1, it is to accept ONLY collisions from this object |
@@ -2461,7 +2410,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2461 | { | 2410 | { |
2462 | if (av.LocalId == localId) | 2411 | if (av.LocalId == localId) |
2463 | { | 2412 | { |
2464 | if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) | 2413 | if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) |
2414 | || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) | ||
2465 | { | 2415 | { |
2466 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); | 2416 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); |
2467 | //If it is 1, it is to accept ONLY collisions from this avatar | 2417 | //If it is 1, it is to accept ONLY collisions from this avatar |
@@ -2509,9 +2459,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2509 | if (colliding.Count > 0) | 2459 | if (colliding.Count > 0) |
2510 | { | 2460 | { |
2511 | CollidingMessage.Colliders = colliding; | 2461 | CollidingMessage.Colliders = colliding; |
2512 | // always running this check because if the user deletes the object it would return a null reference. | ||
2513 | if (m_parentGroup == null) | ||
2514 | return; | ||
2515 | 2462 | ||
2516 | if (m_parentGroup.Scene == null) | 2463 | if (m_parentGroup.Scene == null) |
2517 | return; | 2464 | return; |
@@ -2532,11 +2479,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2532 | if (localId == 0) | 2479 | if (localId == 0) |
2533 | continue; | 2480 | continue; |
2534 | 2481 | ||
2535 | // always running this check because if the user deletes the object it would return a null reference. | ||
2536 | if (m_parentGroup == null) | ||
2537 | return; | ||
2538 | if (m_parentGroup.Scene == null) | 2482 | if (m_parentGroup.Scene == null) |
2539 | return; | 2483 | return; |
2484 | |||
2540 | SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); | 2485 | SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); |
2541 | string data = ""; | 2486 | string data = ""; |
2542 | if (obj != null) | 2487 | if (obj != null) |
@@ -2588,7 +2533,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2588 | { | 2533 | { |
2589 | if (av.LocalId == localId) | 2534 | if (av.LocalId == localId) |
2590 | { | 2535 | { |
2591 | if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) | 2536 | if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) |
2537 | || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) | ||
2592 | { | 2538 | { |
2593 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); | 2539 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data); |
2594 | //If it is 1, it is to accept ONLY collisions from this avatar | 2540 | //If it is 1, it is to accept ONLY collisions from this avatar |
@@ -2637,9 +2583,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2637 | if (colliding.Count > 0) | 2583 | if (colliding.Count > 0) |
2638 | { | 2584 | { |
2639 | EndCollidingMessage.Colliders = colliding; | 2585 | EndCollidingMessage.Colliders = colliding; |
2640 | // always running this check because if the user deletes the object it would return a null reference. | ||
2641 | if (m_parentGroup == null) | ||
2642 | return; | ||
2643 | 2586 | ||
2644 | if (m_parentGroup.Scene == null) | 2587 | if (m_parentGroup.Scene == null) |
2645 | return; | 2588 | return; |
@@ -2648,6 +2591,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2648 | } | 2591 | } |
2649 | } | 2592 | } |
2650 | } | 2593 | } |
2594 | |||
2651 | if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0) | 2595 | if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0) |
2652 | { | 2596 | { |
2653 | if (startedColliders.Count > 0) | 2597 | if (startedColliders.Count > 0) |
@@ -2675,9 +2619,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2675 | if (colliding.Count > 0) | 2619 | if (colliding.Count > 0) |
2676 | { | 2620 | { |
2677 | LandStartCollidingMessage.Colliders = colliding; | 2621 | LandStartCollidingMessage.Colliders = colliding; |
2678 | // always running this check because if the user deletes the object it would return a null reference. | ||
2679 | if (m_parentGroup == null) | ||
2680 | return; | ||
2681 | 2622 | ||
2682 | if (m_parentGroup.Scene == null) | 2623 | if (m_parentGroup.Scene == null) |
2683 | return; | 2624 | return; |
@@ -2686,6 +2627,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2686 | } | 2627 | } |
2687 | } | 2628 | } |
2688 | } | 2629 | } |
2630 | |||
2689 | if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0) | 2631 | if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0) |
2690 | { | 2632 | { |
2691 | if (m_lastColliders.Count > 0) | 2633 | if (m_lastColliders.Count > 0) |
@@ -2713,9 +2655,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2713 | if (colliding.Count > 0) | 2655 | if (colliding.Count > 0) |
2714 | { | 2656 | { |
2715 | LandCollidingMessage.Colliders = colliding; | 2657 | LandCollidingMessage.Colliders = colliding; |
2716 | // always running this check because if the user deletes the object it would return a null reference. | ||
2717 | if (m_parentGroup == null) | ||
2718 | return; | ||
2719 | 2658 | ||
2720 | if (m_parentGroup.Scene == null) | 2659 | if (m_parentGroup.Scene == null) |
2721 | return; | 2660 | return; |
@@ -2724,6 +2663,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2724 | } | 2663 | } |
2725 | } | 2664 | } |
2726 | } | 2665 | } |
2666 | |||
2727 | if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0) | 2667 | if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0) |
2728 | { | 2668 | { |
2729 | if (endedColliders.Count > 0) | 2669 | if (endedColliders.Count > 0) |
@@ -2751,9 +2691,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2751 | if (colliding.Count > 0) | 2691 | if (colliding.Count > 0) |
2752 | { | 2692 | { |
2753 | LandEndCollidingMessage.Colliders = colliding; | 2693 | LandEndCollidingMessage.Colliders = colliding; |
2754 | // always running this check because if the user deletes the object it would return a null reference. | ||
2755 | if (m_parentGroup == null) | ||
2756 | return; | ||
2757 | 2694 | ||
2758 | if (m_parentGroup.Scene == null) | 2695 | if (m_parentGroup.Scene == null) |
2759 | return; | 2696 | return; |
@@ -2777,10 +2714,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2777 | { | 2714 | { |
2778 | if (PhysActor != null) | 2715 | if (PhysActor != null) |
2779 | { | 2716 | { |
2780 | |||
2781 | Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); | 2717 | Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); |
2782 | 2718 | ||
2783 | if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) | 2719 | if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) |
2720 | | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | ||
2721 | | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | ||
2722 | | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) | ||
2784 | { | 2723 | { |
2785 | m_parentGroup.AbsolutePosition = newpos; | 2724 | m_parentGroup.AbsolutePosition = newpos; |
2786 | return; | 2725 | return; |
@@ -2869,13 +2808,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
2869 | } | 2808 | } |
2870 | 2809 | ||
2871 | /// <summary> | 2810 | /// <summary> |
2872 | /// Resize this part. | 2811 | /// Set the scale of this part. |
2873 | /// </summary> | 2812 | /// </summary> |
2813 | /// <remarks> | ||
2814 | /// Unlike the scale property, this checks the new size against scene limits and schedules a full property | ||
2815 | /// update to viewers. | ||
2816 | /// </remarks> | ||
2874 | /// <param name="scale"></param> | 2817 | /// <param name="scale"></param> |
2875 | public void Resize(Vector3 scale) | 2818 | public void Resize(Vector3 scale) |
2876 | { | 2819 | { |
2877 | StoreUndoState(UndoType.STATE_PRIM_SCALE); | 2820 | scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys); |
2878 | m_shape.Scale = scale; | 2821 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); |
2822 | scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); | ||
2823 | |||
2824 | if (PhysActor != null && PhysActor.IsPhysical) | ||
2825 | { | ||
2826 | scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); | ||
2827 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); | ||
2828 | scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); | ||
2829 | } | ||
2830 | |||
2831 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); | ||
2832 | |||
2833 | Scale = scale; | ||
2879 | 2834 | ||
2880 | ParentGroup.HasGroupChanged = true; | 2835 | ParentGroup.HasGroupChanged = true; |
2881 | ScheduleFullUpdate(); | 2836 | ScheduleFullUpdate(); |
@@ -2886,20 +2841,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
2886 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. | 2841 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2887 | } | 2842 | } |
2888 | 2843 | ||
2844 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2845 | { | ||
2846 | if (m_parentGroup.IsAttachment) | ||
2847 | { | ||
2848 | /* | ||
2849 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2850 | if (avatar != null) | ||
2851 | { | ||
2852 | Rotate the Av? | ||
2853 | } */ | ||
2854 | } | ||
2855 | else | ||
2856 | { | ||
2857 | APIDDamp = damping; | ||
2858 | APIDStrength = strength; | ||
2859 | APIDTarget = target; | ||
2860 | } | ||
2861 | } | ||
2862 | |||
2863 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2864 | { | ||
2865 | APIDDamp = damp; | ||
2866 | APIDStrength = strength; | ||
2867 | APIDTarget = rot; | ||
2868 | } | ||
2869 | |||
2870 | public void stopLookAt() | ||
2871 | { | ||
2872 | APIDTarget = Quaternion.Identity; | ||
2873 | } | ||
2874 | |||
2889 | /// <summary> | 2875 | /// <summary> |
2890 | /// Schedules this prim for a full update | 2876 | /// Schedules this prim for a full update |
2891 | /// </summary> | 2877 | /// </summary> |
2892 | public void ScheduleFullUpdate() | 2878 | public void ScheduleFullUpdate() |
2893 | { | 2879 | { |
2894 | // m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); | 2880 | // m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); |
2895 | 2881 | ||
2896 | if (m_parentGroup != null) | 2882 | if (m_parentGroup == null) |
2897 | { | 2883 | return; |
2898 | if (!m_parentGroup.areUpdatesSuspended) | 2884 | |
2899 | { | 2885 | m_parentGroup.QueueForUpdateCheck(); |
2900 | m_parentGroup.QueueForUpdateCheck(); | ||
2901 | } | ||
2902 | } | ||
2903 | 2886 | ||
2904 | int timeNow = Util.UnixTimeSinceEpoch(); | 2887 | int timeNow = Util.UnixTimeSinceEpoch(); |
2905 | 2888 | ||
@@ -2928,13 +2911,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2928 | /// </summary> | 2911 | /// </summary> |
2929 | public void ScheduleTerseUpdate() | 2912 | public void ScheduleTerseUpdate() |
2930 | { | 2913 | { |
2914 | if (m_parentGroup == null) | ||
2915 | return; | ||
2916 | |||
2931 | if (m_updateFlag < 1) | 2917 | if (m_updateFlag < 1) |
2932 | { | 2918 | { |
2933 | if (m_parentGroup != null) | 2919 | m_parentGroup.HasGroupChanged = true; |
2934 | { | 2920 | m_parentGroup.QueueForUpdateCheck(); |
2935 | m_parentGroup.HasGroupChanged = true; | 2921 | |
2936 | m_parentGroup.QueueForUpdateCheck(); | ||
2937 | } | ||
2938 | TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); | 2922 | TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); |
2939 | m_updateFlag = 1; | 2923 | m_updateFlag = 1; |
2940 | 2924 | ||
@@ -2944,40 +2928,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2944 | } | 2928 | } |
2945 | } | 2929 | } |
2946 | 2930 | ||
2947 | public void ScriptSetPhantomStatus(bool Phantom) | ||
2948 | { | ||
2949 | if (m_parentGroup != null) | ||
2950 | { | ||
2951 | m_parentGroup.ScriptSetPhantomStatus(Phantom); | ||
2952 | } | ||
2953 | } | ||
2954 | |||
2955 | public void ScriptSetTemporaryStatus(bool Temporary) | ||
2956 | { | ||
2957 | if (m_parentGroup != null) | ||
2958 | { | ||
2959 | m_parentGroup.ScriptSetTemporaryStatus(Temporary); | ||
2960 | } | ||
2961 | } | ||
2962 | |||
2963 | public void ScriptSetPhysicsStatus(bool UsePhysics) | 2931 | public void ScriptSetPhysicsStatus(bool UsePhysics) |
2964 | { | 2932 | { |
2965 | if (m_parentGroup == null) | 2933 | m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); |
2966 | DoPhysicsPropertyUpdate(UsePhysics, false); | ||
2967 | else | ||
2968 | m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); | ||
2969 | } | 2934 | } |
2970 | 2935 | ||
2971 | public void ScriptSetVolumeDetect(bool SetVD) | 2936 | /// <summary> |
2972 | { | 2937 | /// Set sculpt and mesh data, and tell the physics engine to process the change. |
2973 | 2938 | /// </summary> | |
2974 | if (m_parentGroup != null) | 2939 | /// <param name="texture">The mesh itself.</param> |
2975 | { | 2940 | public void SculptTextureCallback(AssetBase texture) |
2976 | m_parentGroup.ScriptSetVolumeDetect(SetVD); | ||
2977 | } | ||
2978 | } | ||
2979 | |||
2980 | public void SculptTextureCallback(UUID textureID, AssetBase texture) | ||
2981 | { | 2941 | { |
2982 | if (m_shape.SculptEntry) | 2942 | if (m_shape.SculptEntry) |
2983 | { | 2943 | { |
@@ -2985,14 +2945,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2985 | //if (texture != null) | 2945 | //if (texture != null) |
2986 | { | 2946 | { |
2987 | if (texture != null) | 2947 | if (texture != null) |
2948 | { | ||
2949 | // m_log.DebugFormat( | ||
2950 | // "[SCENE OBJECT PART]: Setting sculpt data for {0} on SculptTextureCallback()", Name); | ||
2951 | |||
2988 | m_shape.SculptData = texture.Data; | 2952 | m_shape.SculptData = texture.Data; |
2953 | } | ||
2989 | 2954 | ||
2990 | if (PhysActor != null) | 2955 | if (PhysActor != null) |
2991 | { | 2956 | { |
2992 | // Tricks physics engine into thinking we've changed the part shape. | 2957 | // Update the physics actor with the new loaded sculpt data and set the taint signal. |
2993 | PrimitiveBaseShape m_newshape = m_shape.Copy(); | 2958 | PhysActor.Shape = m_shape; |
2994 | PhysActor.Shape = m_newshape; | ||
2995 | m_shape = m_newshape; | ||
2996 | 2959 | ||
2997 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 2960 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); |
2998 | } | 2961 | } |
@@ -3000,16 +2963,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3000 | } | 2963 | } |
3001 | } | 2964 | } |
3002 | 2965 | ||
3003 | // /// <summary> | ||
3004 | // /// | ||
3005 | // /// </summary> | ||
3006 | // /// <param name="remoteClient"></param> | ||
3007 | // public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) | ||
3008 | // { | ||
3009 | // m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); | ||
3010 | // } | ||
3011 | |||
3012 | |||
3013 | /// <summary> | 2966 | /// <summary> |
3014 | /// Send a full update to the client for the given part | 2967 | /// Send a full update to the client for the given part |
3015 | /// </summary> | 2968 | /// </summary> |
@@ -3017,12 +2970,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3017 | /// <param name="clientFlags"></param> | 2970 | /// <param name="clientFlags"></param> |
3018 | protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) | 2971 | protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) |
3019 | { | 2972 | { |
2973 | if (m_parentGroup == null) | ||
2974 | return; | ||
2975 | |||
3020 | // m_log.DebugFormat( | 2976 | // m_log.DebugFormat( |
3021 | // "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); | 2977 | // "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); |
3022 | 2978 | ||
3023 | if (IsRoot) | 2979 | if (IsRoot) |
3024 | { | 2980 | { |
3025 | if (IsAttachment) | 2981 | if (m_parentGroup.IsAttachment) |
3026 | { | 2982 | { |
3027 | SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags); | 2983 | SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags); |
3028 | } | 2984 | } |
@@ -3042,6 +2998,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3042 | /// </summary> | 2998 | /// </summary> |
3043 | public void SendFullUpdateToAllClients() | 2999 | public void SendFullUpdateToAllClients() |
3044 | { | 3000 | { |
3001 | if (m_parentGroup == null) | ||
3002 | return; | ||
3003 | |||
3045 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 3004 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
3046 | { | 3005 | { |
3047 | SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID)); | 3006 | SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID)); |
@@ -3054,6 +3013,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3054 | /// <param name="agentID"></param> | 3013 | /// <param name="agentID"></param> |
3055 | public void SendFullUpdateToAllClientsExcept(UUID agentID) | 3014 | public void SendFullUpdateToAllClientsExcept(UUID agentID) |
3056 | { | 3015 | { |
3016 | if (m_parentGroup == null) | ||
3017 | return; | ||
3018 | |||
3057 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 3019 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
3058 | { | 3020 | { |
3059 | // Ugly reference :( | 3021 | // Ugly reference :( |
@@ -3082,9 +3044,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3082 | /// <param name="clientFlags"></param> | 3044 | /// <param name="clientFlags"></param> |
3083 | public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags) | 3045 | public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags) |
3084 | { | 3046 | { |
3047 | if (ParentGroup == null) | ||
3048 | return; | ||
3049 | |||
3085 | // Suppress full updates during attachment editing | 3050 | // Suppress full updates during attachment editing |
3086 | // | 3051 | // |
3087 | if (ParentGroup.IsSelected && IsAttachment) | 3052 | if (ParentGroup.IsSelected && ParentGroup.IsAttachment) |
3088 | return; | 3053 | return; |
3089 | 3054 | ||
3090 | if (ParentGroup.IsDeleted) | 3055 | if (ParentGroup.IsDeleted) |
@@ -3177,7 +3142,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3177 | 3142 | ||
3178 | UUID ownerID = _ownerID; | 3143 | UUID ownerID = _ownerID; |
3179 | UUID objectID = ParentGroup.RootPart.UUID; | 3144 | UUID objectID = ParentGroup.RootPart.UUID; |
3180 | UUID parentID = GetRootPartUUID(); | 3145 | UUID parentID = ParentGroup.UUID; |
3181 | 3146 | ||
3182 | UUID soundID = UUID.Zero; | 3147 | UUID soundID = UUID.Zero; |
3183 | Vector3 position = AbsolutePosition; // region local | 3148 | Vector3 position = AbsolutePosition; // region local |
@@ -3215,7 +3180,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3215 | ParentGroup.PlaySoundMasterPrim = this; | 3180 | ParentGroup.PlaySoundMasterPrim = this; |
3216 | ownerID = _ownerID; | 3181 | ownerID = _ownerID; |
3217 | objectID = ParentGroup.RootPart.UUID; | 3182 | objectID = ParentGroup.RootPart.UUID; |
3218 | parentID = GetRootPartUUID(); | 3183 | parentID = ParentGroup.UUID; |
3219 | position = AbsolutePosition; // region local | 3184 | position = AbsolutePosition; // region local |
3220 | regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; | 3185 | regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; |
3221 | if (triggered) | 3186 | if (triggered) |
@@ -3226,7 +3191,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3226 | { | 3191 | { |
3227 | ownerID = prim._ownerID; | 3192 | ownerID = prim._ownerID; |
3228 | objectID = prim.ParentGroup.RootPart.UUID; | 3193 | objectID = prim.ParentGroup.RootPart.UUID; |
3229 | parentID = prim.GetRootPartUUID(); | 3194 | parentID = prim.ParentGroup.UUID; |
3230 | position = prim.AbsolutePosition; // region local | 3195 | position = prim.AbsolutePosition; // region local |
3231 | regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; | 3196 | regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; |
3232 | if (triggered) | 3197 | if (triggered) |
@@ -3263,45 +3228,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
3263 | }); | 3228 | }); |
3264 | } | 3229 | } |
3265 | 3230 | ||
3266 | public void SetAttachmentPoint(uint AttachmentPoint) | ||
3267 | { | ||
3268 | this.AttachmentPoint = AttachmentPoint; | ||
3269 | |||
3270 | if (AttachmentPoint != 0) | ||
3271 | { | ||
3272 | IsAttachment = true; | ||
3273 | } | ||
3274 | else | ||
3275 | { | ||
3276 | IsAttachment = false; | ||
3277 | } | ||
3278 | |||
3279 | // save the attachment point. | ||
3280 | //if (AttachmentPoint != 0) | ||
3281 | //{ | ||
3282 | m_shape.State = (byte)AttachmentPoint; | ||
3283 | //} | ||
3284 | } | ||
3285 | |||
3286 | public void SetAxisRotation(int axis, int rotate) | 3231 | public void SetAxisRotation(int axis, int rotate) |
3287 | { | 3232 | { |
3288 | if (m_parentGroup != null) | 3233 | m_parentGroup.SetAxisRotation(axis, rotate); |
3289 | { | 3234 | |
3290 | m_parentGroup.SetAxisRotation(axis, rotate); | ||
3291 | } | ||
3292 | //Cannot use ScriptBaseClass constants as no referance to it currently. | 3235 | //Cannot use ScriptBaseClass constants as no referance to it currently. |
3293 | if (axis == 2)//STATUS_ROTATE_X | 3236 | if (axis == 2)//STATUS_ROTATE_X |
3294 | STATUS_ROTATE_X = rotate; | 3237 | STATUS_ROTATE_X = rotate; |
3238 | |||
3295 | if (axis == 4)//STATUS_ROTATE_Y | 3239 | if (axis == 4)//STATUS_ROTATE_Y |
3296 | STATUS_ROTATE_Y = rotate; | 3240 | STATUS_ROTATE_Y = rotate; |
3241 | |||
3297 | if (axis == 8)//STATUS_ROTATE_Z | 3242 | if (axis == 8)//STATUS_ROTATE_Z |
3298 | STATUS_ROTATE_Z = rotate; | 3243 | STATUS_ROTATE_Z = rotate; |
3299 | } | 3244 | } |
3300 | 3245 | ||
3301 | public void SetDieAtEdge(bool p) | 3246 | public void SetDieAtEdge(bool p) |
3302 | { | 3247 | { |
3303 | if (m_parentGroup == null) | ||
3304 | return; | ||
3305 | if (m_parentGroup.IsDeleted) | 3248 | if (m_parentGroup.IsDeleted) |
3306 | return; | 3249 | return; |
3307 | 3250 | ||
@@ -3554,7 +3497,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3554 | } | 3497 | } |
3555 | 3498 | ||
3556 | /// <summary> | 3499 | /// <summary> |
3557 | /// | 3500 | /// Set the parent group of this prim. |
3558 | /// </summary> | 3501 | /// </summary> |
3559 | public void SetParent(SceneObjectGroup parent) | 3502 | public void SetParent(SceneObjectGroup parent) |
3560 | { | 3503 | { |
@@ -3611,8 +3554,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3611 | { | 3554 | { |
3612 | Text = text; | 3555 | Text = text; |
3613 | 3556 | ||
3614 | ParentGroup.HasGroupChanged = true; | 3557 | if (ParentGroup != null) |
3615 | ScheduleFullUpdate(); | 3558 | { |
3559 | ParentGroup.HasGroupChanged = true; | ||
3560 | ScheduleFullUpdate(); | ||
3561 | } | ||
3616 | } | 3562 | } |
3617 | 3563 | ||
3618 | public void StopLookAt() | 3564 | public void StopLookAt() |
@@ -3646,24 +3592,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
3646 | } | 3592 | } |
3647 | public void StoreUndoState(UndoType type) | 3593 | public void StoreUndoState(UndoType type) |
3648 | { | 3594 | { |
3649 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) | 3595 | StoreUndoState(false); |
3596 | } | ||
3597 | |||
3598 | public void StoreUndoState(bool forGroup) | ||
3599 | { | ||
3600 | if (!Undoing) | ||
3650 | { | 3601 | { |
3651 | if (!IgnoreUndoUpdate) | 3602 | if (!IgnoreUndoUpdate) |
3652 | { | 3603 | { |
3653 | if (m_parentGroup != null) | 3604 | if (ParentGroup != null) |
3654 | { | 3605 | { |
3655 | lock (m_undo) | 3606 | lock (m_undo) |
3656 | { | 3607 | { |
3657 | if (m_undo.Count > 0) | 3608 | if (m_undo.Count > 0) |
3658 | { | 3609 | { |
3659 | UndoState last = m_undo.Peek(); | 3610 | UndoState last = m_undo.Peek(); |
3660 | 3611 | if (last != null) | |
3612 | { | ||
3613 | // TODO: May need to fix for group comparison | ||
3614 | if (last.Compare(this)) | ||
3615 | { | ||
3616 | // m_log.DebugFormat( | ||
3617 | // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", | ||
3618 | // Name, LocalId, m_undo.Count); | ||
3619 | |||
3620 | return; | ||
3621 | } | ||
3622 | } | ||
3661 | } | 3623 | } |
3662 | 3624 | ||
3625 | // m_log.DebugFormat( | ||
3626 | // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", | ||
3627 | // Name, LocalId, forGroup, m_undo.Count); | ||
3628 | |||
3663 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3629 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3664 | { | 3630 | { |
3665 | UndoState lastUndo = m_undo.Peek(); | 3631 | UndoState nUndo = new UndoState(this, forGroup); |
3666 | 3632 | ||
3667 | UndoState nUndo = new UndoState(this, type); | 3633 | UndoState nUndo = new UndoState(this, type); |
3668 | 3634 | ||
3669 | if (lastUndo != null) | 3635 | if (lastUndo != null) |
@@ -3677,11 +3643,114 @@ namespace OpenSim.Region.Framework.Scenes | |||
3677 | } | 3643 | } |
3678 | } | 3644 | } |
3679 | m_undo.Push(nUndo); | 3645 | m_undo.Push(nUndo); |
3646 | |||
3647 | if (m_redo.Count > 0) | ||
3648 | m_redo.Clear(); | ||
3649 | |||
3650 | // m_log.DebugFormat( | ||
3651 | // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", | ||
3652 | // Name, LocalId, forGroup, m_undo.Count); | ||
3680 | } | 3653 | } |
3654 | } | ||
3655 | } | ||
3656 | } | ||
3657 | // else | ||
3658 | // { | ||
3659 | // m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); | ||
3660 | // } | ||
3661 | } | ||
3662 | // else | ||
3663 | // { | ||
3664 | // m_log.DebugFormat( | ||
3665 | // "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); | ||
3666 | // } | ||
3667 | } | ||
3668 | |||
3669 | /// <summary> | ||
3670 | /// Return number of undos on the stack. Here temporarily pending a refactor. | ||
3671 | /// </summary> | ||
3672 | public int UndoCount | ||
3673 | { | ||
3674 | get | ||
3675 | { | ||
3676 | lock (m_undo) | ||
3677 | return m_undo.Count; | ||
3678 | } | ||
3679 | } | ||
3680 | |||
3681 | public void Undo() | ||
3682 | { | ||
3683 | lock (m_undo) | ||
3684 | { | ||
3685 | // m_log.DebugFormat( | ||
3686 | // "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}", | ||
3687 | // Name, LocalId, m_undo.Count); | ||
3688 | |||
3689 | if (m_undo.Count > 0) | ||
3690 | { | ||
3691 | UndoState goback = m_undo.Pop(); | ||
3681 | 3692 | ||
3693 | if (goback != null) | ||
3694 | { | ||
3695 | UndoState nUndo = null; | ||
3696 | |||
3697 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
3698 | { | ||
3699 | nUndo = new UndoState(this, goback.ForGroup); | ||
3682 | } | 3700 | } |
3701 | |||
3702 | goback.PlaybackState(this); | ||
3703 | |||
3704 | if (nUndo != null) | ||
3705 | m_redo.Push(nUndo); | ||
3683 | } | 3706 | } |
3684 | } | 3707 | } |
3708 | |||
3709 | // m_log.DebugFormat( | ||
3710 | // "[SCENE OBJECT PART]: Handled undo request for {0} {1}, stack size now {2}", | ||
3711 | // Name, LocalId, m_undo.Count); | ||
3712 | } | ||
3713 | } | ||
3714 | |||
3715 | public void Redo() | ||
3716 | { | ||
3717 | lock (m_undo) | ||
3718 | { | ||
3719 | // m_log.DebugFormat( | ||
3720 | // "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}", | ||
3721 | // Name, LocalId, m_redo.Count); | ||
3722 | |||
3723 | if (m_redo.Count > 0) | ||
3724 | { | ||
3725 | UndoState gofwd = m_redo.Pop(); | ||
3726 | |||
3727 | if (gofwd != null) | ||
3728 | { | ||
3729 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
3730 | { | ||
3731 | UndoState nUndo = new UndoState(this, gofwd.ForGroup); | ||
3732 | |||
3733 | m_undo.Push(nUndo); | ||
3734 | } | ||
3735 | |||
3736 | gofwd.PlayfwdState(this); | ||
3737 | } | ||
3738 | |||
3739 | // m_log.DebugFormat( | ||
3740 | // "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}", | ||
3741 | // Name, LocalId, m_redo.Count); | ||
3742 | } | ||
3743 | } | ||
3744 | } | ||
3745 | |||
3746 | public void ClearUndoState() | ||
3747 | { | ||
3748 | // m_log.DebugFormat("[SCENE OBJECT PART]: Clearing undo and redo stacks in {0} {1}", Name, LocalId); | ||
3749 | |||
3750 | lock (m_undo) | ||
3751 | { | ||
3752 | m_undo.Clear(); | ||
3753 | m_redo.Clear(); | ||
3685 | } | 3754 | } |
3686 | } | 3755 | } |
3687 | 3756 | ||
@@ -4145,46 +4214,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4145 | _nextOwnerMask &= (uint)PermissionMask.All; | 4214 | _nextOwnerMask &= (uint)PermissionMask.All; |
4146 | } | 4215 | } |
4147 | 4216 | ||
4148 | public void Undo() | ||
4149 | { | ||
4150 | lock (m_undo) | ||
4151 | { | ||
4152 | if (m_undo.Count > 0) | ||
4153 | { | ||
4154 | UndoState nUndo = null; | ||
4155 | UndoState goback = m_undo.Pop(); | ||
4156 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
4157 | { | ||
4158 | nUndo = new UndoState(this, goback.Type); | ||
4159 | } | ||
4160 | |||
4161 | |||
4162 | if (goback != null) | ||
4163 | { | ||
4164 | goback.PlaybackState(this); | ||
4165 | if (nUndo != null) | ||
4166 | m_redo.Push(nUndo); | ||
4167 | } | ||
4168 | } | ||
4169 | } | ||
4170 | } | ||
4171 | |||
4172 | public void Redo() | ||
4173 | { | ||
4174 | lock (m_redo) | ||
4175 | { | ||
4176 | UndoState gofwd = m_redo.Pop(); | ||
4177 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
4178 | { | ||
4179 | UndoState nUndo = new UndoState(this, gofwd.Type); | ||
4180 | |||
4181 | m_undo.Push(nUndo); | ||
4182 | } | ||
4183 | if (gofwd != null) | ||
4184 | gofwd.PlayfwdState(this); | ||
4185 | } | ||
4186 | } | ||
4187 | |||
4188 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) | 4217 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) |
4189 | { | 4218 | { |
4190 | m_shape.ReadInUpdateExtraParam(type, inUse, data); | 4219 | m_shape.ReadInUpdateExtraParam(type, inUse, data); |
@@ -4197,8 +4226,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4197 | } | 4226 | } |
4198 | } | 4227 | } |
4199 | 4228 | ||
4200 | ParentGroup.HasGroupChanged = true; | 4229 | if (ParentGroup != null) |
4201 | ScheduleFullUpdate(); | 4230 | { |
4231 | ParentGroup.HasGroupChanged = true; | ||
4232 | ScheduleFullUpdate(); | ||
4233 | } | ||
4202 | } | 4234 | } |
4203 | 4235 | ||
4204 | public void UpdateGroupPosition(Vector3 pos) | 4236 | public void UpdateGroupPosition(Vector3 pos) |
@@ -4345,14 +4377,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
4345 | } | 4377 | } |
4346 | } | 4378 | } |
4347 | 4379 | ||
4348 | public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom, bool IsVD) | 4380 | /// <summary> |
4381 | /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. | ||
4382 | /// </summary> | ||
4383 | /// <param name="UsePhysics"></param> | ||
4384 | /// <param name="SetTemporary"></param> | ||
4385 | /// <param name="SetPhantom"></param> | ||
4386 | /// <param name="SetVD"></param> | ||
4387 | public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD) | ||
4349 | { | 4388 | { |
4350 | bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); | 4389 | bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); |
4351 | bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); | 4390 | bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); |
4352 | bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0); | 4391 | bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0); |
4353 | bool wasVD = VolumeDetectActive; | 4392 | bool wasVD = VolumeDetectActive; |
4354 | 4393 | ||
4355 | if ((UsePhysics == wasUsingPhysics) && (wasTemporary == IsTemporary) && (wasPhantom == IsPhantom) && (IsVD==wasVD)) | 4394 | if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD == wasVD)) |
4356 | { | 4395 | { |
4357 | return; | 4396 | return; |
4358 | } | 4397 | } |
@@ -4362,32 +4401,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
4362 | // that... | 4401 | // that... |
4363 | // ... if VD is changed, all others are not. | 4402 | // ... if VD is changed, all others are not. |
4364 | // ... if one of the others is changed, VD is not. | 4403 | // ... if one of the others is changed, VD is not. |
4365 | if (IsVD) // VD is active, special logic applies | 4404 | if (SetVD) // VD is active, special logic applies |
4366 | { | 4405 | { |
4367 | // State machine logic for VolumeDetect | 4406 | // State machine logic for VolumeDetect |
4368 | // More logic below | 4407 | // More logic below |
4369 | bool phanReset = (IsPhantom != wasPhantom) && !IsPhantom; | 4408 | bool phanReset = (SetPhantom != wasPhantom) && !SetPhantom; |
4370 | 4409 | ||
4371 | if (phanReset) // Phantom changes from on to off switch VD off too | 4410 | if (phanReset) // Phantom changes from on to off switch VD off too |
4372 | { | 4411 | { |
4373 | IsVD = false; // Switch it of for the course of this routine | 4412 | SetVD = false; // Switch it of for the course of this routine |
4374 | VolumeDetectActive = false; // and also permanently | 4413 | VolumeDetectActive = false; // and also permanently |
4375 | if (PhysActor != null) | 4414 | if (PhysActor != null) |
4376 | PhysActor.SetVolumeDetect(0); // Let physics know about it too | 4415 | PhysActor.SetVolumeDetect(0); // Let physics know about it too |
4377 | } | 4416 | } |
4378 | else | 4417 | else |
4379 | { | 4418 | { |
4380 | IsPhantom = false; | ||
4381 | // If volumedetect is active we don't want phantom to be applied. | 4419 | // If volumedetect is active we don't want phantom to be applied. |
4382 | // If this is a new call to VD out of the state "phantom" | 4420 | // If this is a new call to VD out of the state "phantom" |
4383 | // this will also cause the prim to be visible to physics | 4421 | // this will also cause the prim to be visible to physics |
4422 | SetPhantom = false; | ||
4384 | } | 4423 | } |
4385 | |||
4386 | } | 4424 | } |
4387 | 4425 | ||
4388 | if (UsePhysics && IsJoint()) | 4426 | if (UsePhysics && IsJoint()) |
4389 | { | 4427 | { |
4390 | IsPhantom = true; | 4428 | SetPhantom = true; |
4391 | } | 4429 | } |
4392 | 4430 | ||
4393 | if (UsePhysics) | 4431 | if (UsePhysics) |
@@ -4396,14 +4434,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
4396 | if (!wasUsingPhysics) | 4434 | if (!wasUsingPhysics) |
4397 | { | 4435 | { |
4398 | DoPhysicsPropertyUpdate(UsePhysics, false); | 4436 | DoPhysicsPropertyUpdate(UsePhysics, false); |
4399 | if (m_parentGroup != null) | 4437 | |
4438 | if (!m_parentGroup.IsDeleted) | ||
4400 | { | 4439 | { |
4401 | if (!m_parentGroup.IsDeleted) | 4440 | if (LocalId == m_parentGroup.RootPart.LocalId) |
4402 | { | 4441 | { |
4403 | if (LocalId == m_parentGroup.RootPart.LocalId) | 4442 | m_parentGroup.CheckSculptAndLoad(); |
4404 | { | ||
4405 | m_parentGroup.CheckSculptAndLoad(); | ||
4406 | } | ||
4407 | } | 4443 | } |
4408 | } | 4444 | } |
4409 | } | 4445 | } |
@@ -4417,8 +4453,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4417 | } | 4453 | } |
4418 | } | 4454 | } |
4419 | 4455 | ||
4420 | 4456 | if (SetPhantom | |
4421 | if (IsPhantom || IsAttachment || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints | 4457 | || ParentGroup.IsAttachment |
4458 | || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints | ||
4422 | { | 4459 | { |
4423 | AddFlag(PrimFlags.Phantom); | 4460 | AddFlag(PrimFlags.Phantom); |
4424 | if (PhysActor != null) | 4461 | if (PhysActor != null) |
@@ -4432,7 +4469,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4432 | { | 4469 | { |
4433 | RemFlag(PrimFlags.Phantom); | 4470 | RemFlag(PrimFlags.Phantom); |
4434 | 4471 | ||
4472 | if (ParentGroup.Scene == null) | ||
4473 | return; | ||
4474 | |||
4435 | PhysicsActor pa = PhysActor; | 4475 | PhysicsActor pa = PhysActor; |
4476 | |||
4436 | if (pa == null) | 4477 | if (pa == null) |
4437 | { | 4478 | { |
4438 | // It's not phantom anymore. So make sure the physics engine get's knowledge of it | 4479 | // It's not phantom anymore. So make sure the physics engine get's knowledge of it |
@@ -4444,22 +4485,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
4444 | RotationOffset, | 4485 | RotationOffset, |
4445 | UsePhysics, | 4486 | UsePhysics, |
4446 | m_localId); | 4487 | m_localId); |
4447 | PhysActor.SetMaterial(Material); | ||
4448 | 4488 | ||
4449 | pa = PhysActor; | 4489 | pa = PhysActor; |
4450 | if (pa != null) | 4490 | if (pa != null) |
4451 | { | 4491 | { |
4492 | PhysActor.SetMaterial(Material); | ||
4452 | DoPhysicsPropertyUpdate(UsePhysics, true); | 4493 | DoPhysicsPropertyUpdate(UsePhysics, true); |
4453 | if (m_parentGroup != null) | 4494 | |
4495 | if (!m_parentGroup.IsDeleted) | ||
4454 | { | 4496 | { |
4455 | if (!m_parentGroup.IsDeleted) | 4497 | if (LocalId == m_parentGroup.RootPart.LocalId) |
4456 | { | 4498 | { |
4457 | if (LocalId == m_parentGroup.RootPart.LocalId) | 4499 | m_parentGroup.CheckSculptAndLoad(); |
4458 | { | ||
4459 | m_parentGroup.CheckSculptAndLoad(); | ||
4460 | } | ||
4461 | } | 4500 | } |
4462 | } | 4501 | } |
4502 | |||
4463 | if ( | 4503 | if ( |
4464 | ((AggregateScriptEvents & scriptEvents.collision) != 0) || | 4504 | ((AggregateScriptEvents & scriptEvents.collision) != 0) || |
4465 | ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || | 4505 | ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || |
@@ -4470,8 +4510,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4470 | (CollisionSound != UUID.Zero) | 4510 | (CollisionSound != UUID.Zero) |
4471 | ) | 4511 | ) |
4472 | { | 4512 | { |
4473 | PhysActor.OnCollisionUpdate += PhysicsCollision; | 4513 | PhysActor.OnCollisionUpdate += PhysicsCollision; |
4474 | PhysActor.SubscribeEvents(1000); | 4514 | PhysActor.SubscribeEvents(1000); |
4475 | } | 4515 | } |
4476 | } | 4516 | } |
4477 | } | 4517 | } |
@@ -4480,20 +4520,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
4480 | pa.IsPhysical = UsePhysics; | 4520 | pa.IsPhysical = UsePhysics; |
4481 | 4521 | ||
4482 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim | 4522 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim |
4483 | if (m_parentGroup != null) | 4523 | |
4524 | if (!m_parentGroup.IsDeleted) | ||
4484 | { | 4525 | { |
4485 | if (!m_parentGroup.IsDeleted) | 4526 | if (LocalId == m_parentGroup.RootPart.LocalId) |
4486 | { | 4527 | { |
4487 | if (LocalId == m_parentGroup.RootPart.LocalId) | 4528 | m_parentGroup.CheckSculptAndLoad(); |
4488 | { | ||
4489 | m_parentGroup.CheckSculptAndLoad(); | ||
4490 | } | ||
4491 | } | 4529 | } |
4492 | } | 4530 | } |
4493 | } | 4531 | } |
4494 | } | 4532 | } |
4495 | 4533 | ||
4496 | if (IsVD) | 4534 | if (SetVD) |
4497 | { | 4535 | { |
4498 | // If the above logic worked (this is urgent candidate to unit tests!) | 4536 | // If the above logic worked (this is urgent candidate to unit tests!) |
4499 | // we now have a physicsactor. | 4537 | // we now have a physicsactor. |
@@ -4508,18 +4546,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4508 | } | 4546 | } |
4509 | } | 4547 | } |
4510 | else | 4548 | else |
4511 | { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like | 4549 | { |
4550 | // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like | ||
4512 | // (mumbles, well, at least if you have infinte CPU powers :-)) | 4551 | // (mumbles, well, at least if you have infinte CPU powers :-)) |
4513 | PhysicsActor pa = this.PhysActor; | 4552 | PhysicsActor pa = this.PhysActor; |
4514 | if (pa != null) | 4553 | if (pa != null) |
4515 | { | 4554 | { |
4516 | PhysActor.SetVolumeDetect(0); | 4555 | PhysActor.SetVolumeDetect(0); |
4517 | } | 4556 | } |
4557 | |||
4518 | this.VolumeDetectActive = false; | 4558 | this.VolumeDetectActive = false; |
4519 | } | 4559 | } |
4520 | 4560 | ||
4521 | 4561 | if (SetTemporary) | |
4522 | if (IsTemporary) | ||
4523 | { | 4562 | { |
4524 | AddFlag(PrimFlags.TemporaryOnRez); | 4563 | AddFlag(PrimFlags.TemporaryOnRez); |
4525 | } | 4564 | } |
@@ -4529,8 +4568,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4529 | } | 4568 | } |
4530 | // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 4569 | // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
4531 | 4570 | ||
4532 | ParentGroup.HasGroupChanged = true; | 4571 | if (ParentGroup != null) |
4533 | ScheduleFullUpdate(); | 4572 | { |
4573 | ParentGroup.HasGroupChanged = true; | ||
4574 | ScheduleFullUpdate(); | ||
4575 | } | ||
4576 | |||
4577 | // m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); | ||
4534 | } | 4578 | } |
4535 | 4579 | ||
4536 | public void UpdateRotation(Quaternion rot) | 4580 | public void UpdateRotation(Quaternion rot) |
@@ -4541,8 +4585,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
4541 | (rot.W != RotationOffset.W)) | 4585 | (rot.W != RotationOffset.W)) |
4542 | { | 4586 | { |
4543 | RotationOffset = rot; | 4587 | RotationOffset = rot; |
4544 | ParentGroup.HasGroupChanged = true; | 4588 | |
4545 | ScheduleTerseUpdate(); | 4589 | if (ParentGroup != null) |
4590 | { | ||
4591 | ParentGroup.HasGroupChanged = true; | ||
4592 | ScheduleTerseUpdate(); | ||
4593 | } | ||
4546 | } | 4594 | } |
4547 | } | 4595 | } |
4548 | 4596 | ||
@@ -4570,6 +4618,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4570 | m_shape.PathTaperY = shapeBlock.PathTaperY; | 4618 | m_shape.PathTaperY = shapeBlock.PathTaperY; |
4571 | m_shape.PathTwist = shapeBlock.PathTwist; | 4619 | m_shape.PathTwist = shapeBlock.PathTwist; |
4572 | m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; | 4620 | m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; |
4621 | |||
4573 | if (PhysActor != null) | 4622 | if (PhysActor != null) |
4574 | { | 4623 | { |
4575 | PhysActor.Shape = m_shape; | 4624 | PhysActor.Shape = m_shape; |
@@ -4591,11 +4640,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
4591 | } | 4640 | } |
4592 | 4641 | ||
4593 | /// <summary> | 4642 | /// <summary> |
4643 | /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics | ||
4644 | /// engine can use it. | ||
4645 | /// </summary> | ||
4646 | /// <remarks> | ||
4647 | /// When the physics engine has finished with it, the sculpt data is discarded to save memory. | ||
4648 | /// </remarks> | ||
4649 | public void CheckSculptAndLoad() | ||
4650 | { | ||
4651 | // m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId); | ||
4652 | |||
4653 | if (ParentGroup.IsDeleted) | ||
4654 | return; | ||
4655 | |||
4656 | if ((ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) | ||
4657 | return; | ||
4658 | |||
4659 | if (Shape.SculptEntry && Shape.SculptTexture != UUID.Zero) | ||
4660 | { | ||
4661 | // check if a previously decoded sculpt map has been cached | ||
4662 | // We don't read the file here - the meshmerizer will do that later. | ||
4663 | // TODO: Could we simplify the meshmerizer code by reading and setting the data here? | ||
4664 | if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + Shape.SculptTexture.ToString()))) | ||
4665 | { | ||
4666 | SculptTextureCallback(null); | ||
4667 | } | ||
4668 | else | ||
4669 | { | ||
4670 | ParentGroup.Scene.AssetService.Get(Shape.SculptTexture.ToString(), this, AssetReceived); | ||
4671 | } | ||
4672 | } | ||
4673 | } | ||
4674 | |||
4675 | /// <summary> | ||
4594 | /// Update the textures on the part. | 4676 | /// Update the textures on the part. |
4595 | /// </summary> | 4677 | /// </summary> |
4678 | /// <remarks> | ||
4596 | /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() | 4679 | /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() |
4597 | /// not handling RGBA properly. Cycles through, and "fixes" the color | 4680 | /// not handling RGBA properly. Cycles through, and "fixes" the color |
4598 | /// info | 4681 | /// info |
4682 | /// </remarks> | ||
4599 | /// <param name="tex"></param> | 4683 | /// <param name="tex"></param> |
4600 | public void UpdateTexture(Primitive.TextureEntry tex) | 4684 | public void UpdateTexture(Primitive.TextureEntry tex) |
4601 | { | 4685 | { |
@@ -4687,7 +4771,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4687 | { | 4771 | { |
4688 | PhysActor.OnCollisionUpdate += PhysicsCollision; | 4772 | PhysActor.OnCollisionUpdate += PhysicsCollision; |
4689 | PhysActor.SubscribeEvents(1000); | 4773 | PhysActor.SubscribeEvents(1000); |
4690 | |||
4691 | } | 4774 | } |
4692 | } | 4775 | } |
4693 | else | 4776 | else |
@@ -4699,14 +4782,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4699 | } | 4782 | } |
4700 | } | 4783 | } |
4701 | 4784 | ||
4702 | if (m_parentGroup == null) | ||
4703 | { | ||
4704 | // m_log.DebugFormat( | ||
4705 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId); | ||
4706 | ScheduleFullUpdate(); | ||
4707 | return; | ||
4708 | } | ||
4709 | |||
4710 | //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) | 4785 | //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) |
4711 | //{ | 4786 | //{ |
4712 | // m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; | 4787 | // m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; |
@@ -4716,7 +4791,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4716 | // m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; | 4791 | // m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; |
4717 | //} | 4792 | //} |
4718 | 4793 | ||
4719 | LocalFlags=(PrimFlags)objectflagupdate; | 4794 | LocalFlags = (PrimFlags)objectflagupdate; |
4720 | 4795 | ||
4721 | if (m_parentGroup != null && m_parentGroup.RootPart == this) | 4796 | if (m_parentGroup != null && m_parentGroup.RootPart == this) |
4722 | { | 4797 | { |
@@ -4730,40 +4805,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4730 | } | 4805 | } |
4731 | } | 4806 | } |
4732 | 4807 | ||
4733 | public int registerTargetWaypoint(Vector3 target, float tolerance) | ||
4734 | { | ||
4735 | if (m_parentGroup != null) | ||
4736 | { | ||
4737 | return m_parentGroup.registerTargetWaypoint(target, tolerance); | ||
4738 | } | ||
4739 | return 0; | ||
4740 | } | ||
4741 | |||
4742 | public void unregisterTargetWaypoint(int handle) | ||
4743 | { | ||
4744 | if (m_parentGroup != null) | ||
4745 | { | ||
4746 | m_parentGroup.unregisterTargetWaypoint(handle); | ||
4747 | } | ||
4748 | } | ||
4749 | |||
4750 | public int registerRotTargetWaypoint(Quaternion target, float tolerance) | ||
4751 | { | ||
4752 | if (m_parentGroup != null) | ||
4753 | { | ||
4754 | return m_parentGroup.registerRotTargetWaypoint(target, tolerance); | ||
4755 | } | ||
4756 | return 0; | ||
4757 | } | ||
4758 | |||
4759 | public void unregisterRotTargetWaypoint(int handle) | ||
4760 | { | ||
4761 | if (m_parentGroup != null) | ||
4762 | { | ||
4763 | m_parentGroup.unregisterRotTargetWaypoint(handle); | ||
4764 | } | ||
4765 | } | ||
4766 | |||
4767 | public void SetCameraAtOffset(Vector3 v) | 4808 | public void SetCameraAtOffset(Vector3 v) |
4768 | { | 4809 | { |
4769 | m_cameraAtOffset = v; | 4810 | m_cameraAtOffset = v; |
@@ -4803,10 +4844,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4803 | 4844 | ||
4804 | public void SendTerseUpdateToClient(IClientAPI remoteClient) | 4845 | public void SendTerseUpdateToClient(IClientAPI remoteClient) |
4805 | { | 4846 | { |
4806 | if (ParentGroup == null || ParentGroup.IsDeleted) | 4847 | if (ParentGroup.IsDeleted) |
4807 | return; | 4848 | return; |
4808 | 4849 | ||
4809 | if (IsAttachment && ParentGroup.RootPart != this) | 4850 | if (ParentGroup.IsAttachment && ParentGroup.RootPart != this) |
4810 | return; | 4851 | return; |
4811 | 4852 | ||
4812 | // Causes this thread to dig into the Client Thread Data. | 4853 | // Causes this thread to dig into the Client Thread Data. |
@@ -4827,6 +4868,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4827 | 4868 | ||
4828 | Inventory.ApplyNextOwnerPermissions(); | 4869 | Inventory.ApplyNextOwnerPermissions(); |
4829 | } | 4870 | } |
4871 | |||
4830 | public void UpdateLookAt() | 4872 | public void UpdateLookAt() |
4831 | { | 4873 | { |
4832 | try | 4874 | try |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 56680df..1f0840d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -118,14 +118,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
118 | } | 118 | } |
119 | 119 | ||
120 | /// <summary> | 120 | /// <summary> |
121 | /// Reset UUIDs for all the items in the prim's inventory. This involves either generating | 121 | /// Reset UUIDs for all the items in the prim's inventory. |
122 | /// </summary> | ||
123 | /// <remarks> | ||
124 | /// This involves either generating | ||
122 | /// new ones or setting existing UUIDs to the correct parent UUIDs. | 125 | /// new ones or setting existing UUIDs to the correct parent UUIDs. |
123 | /// | 126 | /// |
124 | /// If this method is called and there are inventory items, then we regard the inventory as having changed. | 127 | /// If this method is called and there are inventory items, then we regard the inventory as having changed. |
125 | /// </summary> | 128 | /// </remarks> |
126 | /// <param name="linkNum">Link number for the part</param> | ||
127 | public void ResetInventoryIDs() | 129 | public void ResetInventoryIDs() |
128 | { | 130 | { |
131 | if (null == m_part) | ||
129 | m_items.LockItemsForWrite(true); | 132 | m_items.LockItemsForWrite(true); |
130 | 133 | ||
131 | if (Items.Count == 0) | 134 | if (Items.Count == 0) |
@@ -212,7 +215,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
212 | // Don't let this set the HasGroupChanged flag for attachments | 215 | // Don't let this set the HasGroupChanged flag for attachments |
213 | // as this happens during rez and we don't want a new asset | 216 | // as this happens during rez and we don't want a new asset |
214 | // for each attachment each time | 217 | // for each attachment each time |
215 | if (!m_part.ParentGroup.RootPart.IsAttachment) | 218 | if (!m_part.ParentGroup.IsAttachment) |
216 | { | 219 | { |
217 | HasInventoryChanged = true; | 220 | HasInventoryChanged = true; |
218 | m_part.ParentGroup.HasGroupChanged = true; | 221 | m_part.ParentGroup.HasGroupChanged = true; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d2f84e3..de9b1f3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
67 | 67 | ||
68 | public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); | 68 | public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); |
69 | 69 | ||
70 | public class ScenePresence : EntityBase, ISceneEntity | 70 | public class ScenePresence : EntityBase, IScenePresence |
71 | { | 71 | { |
72 | // ~ScenePresence() | 72 | // ~ScenePresence() |
73 | // { | 73 | // { |
@@ -76,6 +76,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
76 | 76 | ||
77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
78 | 78 | ||
79 | public PresenceType PresenceType { get; private set; } | ||
80 | |||
79 | // private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); | 81 | // private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); |
80 | private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); | 82 | private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); |
81 | private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); | 83 | private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); |
@@ -92,6 +94,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
92 | // Value revised by KF 091121 by comparison with SL. | 94 | // Value revised by KF 091121 by comparison with SL. |
93 | private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f); | 95 | private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f); |
94 | 96 | ||
97 | /// <summary> | ||
98 | /// Movement updates for agents in neighboring regions are sent directly to clients. | ||
99 | /// This value only affects how often agent positions are sent to neighbor regions | ||
100 | /// for things such as distance-based update prioritization | ||
101 | /// </summary> | ||
102 | public static readonly float SIGNIFICANT_MOVEMENT = 2.0f; | ||
103 | |||
95 | public UUID currentParcelUUID = UUID.Zero; | 104 | public UUID currentParcelUUID = UUID.Zero; |
96 | 105 | ||
97 | private ISceneViewer m_sceneViewer; | 106 | private ISceneViewer m_sceneViewer; |
@@ -105,14 +114,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
105 | } | 114 | } |
106 | protected ScenePresenceAnimator m_animator; | 115 | protected ScenePresenceAnimator m_animator; |
107 | 116 | ||
108 | /// <value> | 117 | /// <summary> |
109 | /// The scene objects attached to this avatar. Do not change this list directly - use methods such as | 118 | /// Attachments recorded on this avatar. |
110 | /// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it. | 119 | /// </summary> |
111 | /// </value> | 120 | /// <remarks> |
112 | public List<SceneObjectGroup> Attachments | 121 | /// TODO: For some reason, we effectively have a list both here and in Appearance. Need to work out if this is |
113 | { | 122 | /// necessary. |
114 | get { return m_attachments; } | 123 | /// </remarks> |
115 | } | ||
116 | 124 | ||
117 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | 125 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); |
118 | 126 | ||
@@ -120,7 +128,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
120 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; | 128 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; |
121 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; | 129 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; |
122 | private bool MouseDown = false; | 130 | private bool MouseDown = false; |
123 | private SceneObjectGroup proxyObjectGroup; | 131 | // private SceneObjectGroup proxyObjectGroup; |
124 | //private SceneObjectPart proxyObjectPart = null; | 132 | //private SceneObjectPart proxyObjectPart = null; |
125 | public Vector3 lastKnownAllowedPosition; | 133 | public Vector3 lastKnownAllowedPosition; |
126 | public Vector4 CollisionPlane = Vector4.UnitW; | 134 | public Vector4 CollisionPlane = Vector4.UnitW; |
@@ -178,7 +186,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
178 | 186 | ||
179 | private float m_speedModifier = 1.0f; | 187 | private float m_speedModifier = 1.0f; |
180 | 188 | ||
181 | private Quaternion m_bodyRot= Quaternion.Identity; | 189 | private Quaternion m_bodyRot = Quaternion.Identity; |
182 | 190 | ||
183 | private Quaternion m_bodyRotPrevious = Quaternion.Identity; | 191 | private Quaternion m_bodyRotPrevious = Quaternion.Identity; |
184 | 192 | ||
@@ -224,8 +232,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
224 | private string m_nextSitAnimation = String.Empty; | 232 | private string m_nextSitAnimation = String.Empty; |
225 | 233 | ||
226 | //PauPaw:Proper PID Controler for autopilot************ | 234 | //PauPaw:Proper PID Controler for autopilot************ |
227 | private bool m_moveToPositionInProgress; | 235 | public bool MovingToTarget { get; private set; } |
228 | private Vector3 m_moveToPositionTarget; | 236 | public Vector3 MoveToPositionTarget { get; private set; } |
229 | private Quaternion m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); | 237 | private Quaternion m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); |
230 | 238 | ||
231 | private bool m_followCamAuto; | 239 | private bool m_followCamAuto; |
@@ -455,9 +463,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
455 | 463 | ||
456 | protected PhysicsActor m_physicsActor; | 464 | protected PhysicsActor m_physicsActor; |
457 | 465 | ||
458 | /// <value> | ||
459 | /// The client controlling this presence | ||
460 | /// </value> | ||
461 | public IClientAPI ControllingClient | 466 | public IClientAPI ControllingClient |
462 | { | 467 | { |
463 | get { return m_controllingClient; } | 468 | get { return m_controllingClient; } |
@@ -765,15 +770,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
765 | 770 | ||
766 | #region Constructor(s) | 771 | #region Constructor(s) |
767 | 772 | ||
768 | public ScenePresence() | 773 | public ScenePresence( |
774 | IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type) | ||
769 | { | 775 | { |
770 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | 776 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; |
771 | CreateSceneViewer(); | 777 | m_sceneViewer = new SceneViewer(this); |
772 | m_animator = new ScenePresenceAnimator(this); | 778 | m_animator = new ScenePresenceAnimator(this); |
773 | } | 779 | PresenceType = type; |
774 | |||
775 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() | ||
776 | { | ||
777 | m_DrawDistance = world.DefaultDrawDistance; | 780 | m_DrawDistance = world.DefaultDrawDistance; |
778 | m_rootRegionHandle = reginfo.RegionHandle; | 781 | m_rootRegionHandle = reginfo.RegionHandle; |
779 | m_controllingClient = client; | 782 | m_controllingClient = client; |
@@ -817,19 +820,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
817 | 820 | ||
818 | RegisterToEvents(); | 821 | RegisterToEvents(); |
819 | SetDirectionVectors(); | 822 | SetDirectionVectors(); |
820 | } | ||
821 | 823 | ||
822 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) | ||
823 | : this(client, world, reginfo) | ||
824 | { | ||
825 | m_appearance = appearance; | 824 | m_appearance = appearance; |
826 | } | 825 | } |
827 | 826 | ||
828 | private void CreateSceneViewer() | ||
829 | { | ||
830 | m_sceneViewer = new SceneViewer(this); | ||
831 | } | ||
832 | |||
833 | public void RegisterToEvents() | 827 | public void RegisterToEvents() |
834 | { | 828 | { |
835 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; | 829 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; |
@@ -841,8 +835,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
841 | m_controllingClient.OnStartAnim += HandleStartAnim; | 835 | m_controllingClient.OnStartAnim += HandleStartAnim; |
842 | m_controllingClient.OnStopAnim += HandleStopAnim; | 836 | m_controllingClient.OnStopAnim += HandleStopAnim; |
843 | m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls; | 837 | m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls; |
844 | m_controllingClient.OnAutoPilotGo += DoAutoPilot; | 838 | m_controllingClient.OnAutoPilotGo += MoveToTarget; |
845 | m_controllingClient.AddGenericPacketHandler("autopilot", DoMoveToPosition); | ||
846 | 839 | ||
847 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 840 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
848 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 841 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
@@ -1029,11 +1022,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1029 | } | 1022 | } |
1030 | 1023 | ||
1031 | float localAVHeight = 1.56f; | 1024 | float localAVHeight = 1.56f; |
1032 | if (m_appearance != null) | 1025 | if (m_appearance.AvatarHeight > 0) |
1033 | { | 1026 | localAVHeight = m_appearance.AvatarHeight; |
1034 | if (m_appearance.AvatarHeight > 0) | ||
1035 | localAVHeight = m_appearance.AvatarHeight; | ||
1036 | } | ||
1037 | 1027 | ||
1038 | float posZLimit = 0; | 1028 | float posZLimit = 0; |
1039 | 1029 | ||
@@ -1047,26 +1037,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1047 | } | 1037 | } |
1048 | AbsolutePosition = pos; | 1038 | AbsolutePosition = pos; |
1049 | 1039 | ||
1050 | if (m_appearance != null) | ||
1051 | { | ||
1052 | if (m_appearance.AvatarHeight > 0) | ||
1053 | SetHeight(m_appearance.AvatarHeight); | ||
1054 | } | ||
1055 | else | ||
1056 | { | ||
1057 | m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName); | ||
1058 | // emergency; this really shouldn't happen | ||
1059 | m_appearance = new AvatarAppearance(UUID); | ||
1060 | } | ||
1061 | |||
1062 | AddToPhysicalScene(isFlying); | 1040 | AddToPhysicalScene(isFlying); |
1063 | 1041 | ||
1064 | if (m_appearance != null) | ||
1065 | { | ||
1066 | if (m_appearance.AvatarHeight > 0) | ||
1067 | SetHeight(m_appearance.AvatarHeight); | ||
1068 | } | ||
1069 | |||
1070 | if (m_forceFly) | 1042 | if (m_forceFly) |
1071 | { | 1043 | { |
1072 | m_physicsActor.Flying = true; | 1044 | m_physicsActor.Flying = true; |
@@ -1087,15 +1059,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1087 | // and it has already rezzed the attachments and started their scripts. | 1059 | // and it has already rezzed the attachments and started their scripts. |
1088 | // We do the following only for non-login agents, because their scripts | 1060 | // We do the following only for non-login agents, because their scripts |
1089 | // haven't started yet. | 1061 | // haven't started yet. |
1090 | if (wasChild && Attachments != null && Attachments.Count > 0) | 1062 | lock (m_attachments) |
1091 | { | 1063 | { |
1092 | m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); | 1064 | if (wasChild && HasAttachments()) |
1093 | // Resume scripts | ||
1094 | Attachments.ForEach(delegate(SceneObjectGroup sog) | ||
1095 | { | 1065 | { |
1096 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); | 1066 | m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); |
1097 | sog.ResumeScripts(); | 1067 | // Resume scripts |
1098 | }); | 1068 | foreach (SceneObjectGroup sog in m_attachments) |
1069 | { | ||
1070 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); | ||
1071 | sog.ResumeScripts(); | ||
1072 | } | ||
1073 | } | ||
1099 | } | 1074 | } |
1100 | 1075 | ||
1101 | // send the animations of the other presences to me | 1076 | // send the animations of the other presences to me |
@@ -1105,6 +1080,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1105 | presence.Animator.SendAnimPackToClient(ControllingClient); | 1080 | presence.Animator.SendAnimPackToClient(ControllingClient); |
1106 | }); | 1081 | }); |
1107 | 1082 | ||
1083 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will | ||
1084 | // stall on the border crossing since the existing child agent will still have the last movement | ||
1085 | // recorded, which stops the input from being processed. | ||
1086 | m_movementflag = 0; | ||
1087 | |||
1108 | m_scene.EventManager.TriggerOnMakeRootAgent(this); | 1088 | m_scene.EventManager.TriggerOnMakeRootAgent(this); |
1109 | } | 1089 | } |
1110 | 1090 | ||
@@ -1196,11 +1176,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1196 | CheckLandingPoint(ref pos); | 1176 | CheckLandingPoint(ref pos); |
1197 | AbsolutePosition = pos; | 1177 | AbsolutePosition = pos; |
1198 | AddToPhysicalScene(isFlying); | 1178 | AddToPhysicalScene(isFlying); |
1199 | if (m_appearance != null) | ||
1200 | { | ||
1201 | if (m_appearance.AvatarHeight > 0) | ||
1202 | SetHeight(m_appearance.AvatarHeight); | ||
1203 | } | ||
1204 | 1179 | ||
1205 | SendTerseUpdateToAllClients(); | 1180 | SendTerseUpdateToAllClients(); |
1206 | 1181 | ||
@@ -1216,22 +1191,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1216 | CheckLandingPoint(ref pos); | 1191 | CheckLandingPoint(ref pos); |
1217 | AbsolutePosition = pos; | 1192 | AbsolutePosition = pos; |
1218 | AddToPhysicalScene(isFlying); | 1193 | AddToPhysicalScene(isFlying); |
1219 | if (m_appearance != null) | ||
1220 | { | ||
1221 | if (m_appearance.AvatarHeight > 0) | ||
1222 | SetHeight(m_appearance.AvatarHeight); | ||
1223 | } | ||
1224 | 1194 | ||
1225 | SendTerseUpdateToAllClients(); | 1195 | SendTerseUpdateToAllClients(); |
1226 | } | 1196 | } |
1227 | 1197 | ||
1228 | /// <summary> | ||
1229 | /// | ||
1230 | /// </summary> | ||
1231 | public void StopMovement() | ||
1232 | { | ||
1233 | } | ||
1234 | |||
1235 | public void StopFlying() | 1198 | public void StopFlying() |
1236 | { | 1199 | { |
1237 | ControllingClient.StopFlying(this); | 1200 | ControllingClient.StopFlying(this); |
@@ -1281,7 +1244,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1281 | #region Event Handlers | 1244 | #region Event Handlers |
1282 | 1245 | ||
1283 | /// <summary> | 1246 | /// <summary> |
1284 | /// Sets avatar height in the phyiscs plugin | 1247 | /// Sets avatar height in the physics plugin |
1285 | /// </summary> | 1248 | /// </summary> |
1286 | public void SetHeight(float height) | 1249 | public void SetHeight(float height) |
1287 | { | 1250 | { |
@@ -1294,10 +1257,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1294 | 1257 | ||
1295 | /// <summary> | 1258 | /// <summary> |
1296 | /// Complete Avatar's movement into the region. | 1259 | /// Complete Avatar's movement into the region. |
1297 | /// This is called upon a very important packet sent from the client, | ||
1298 | /// so it's client-controlled. Never call this method directly. | ||
1299 | /// </summary> | 1260 | /// </summary> |
1300 | public void CompleteMovement(IClientAPI client) | 1261 | /// <param name="client"></param> |
1262 | /// <param name="openChildAgents"> | ||
1263 | /// If true, send notification to neighbour regions to expect | ||
1264 | /// a child agent from the client. These neighbours can be some distance away, depending right now on the | ||
1265 | /// configuration of DefaultDrawDistance in the [Startup] section of config | ||
1266 | /// </param> | ||
1267 | public void CompleteMovement(IClientAPI client, bool openChildAgents) | ||
1301 | { | 1268 | { |
1302 | // DateTime startTime = DateTime.Now; | 1269 | // DateTime startTime = DateTime.Now; |
1303 | 1270 | ||
@@ -1338,15 +1305,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1338 | SendInitialData(); | 1305 | SendInitialData(); |
1339 | 1306 | ||
1340 | // Create child agents in neighbouring regions | 1307 | // Create child agents in neighbouring regions |
1341 | if (!m_isChildAgent) | 1308 | if (openChildAgents && !m_isChildAgent) |
1342 | { | 1309 | { |
1343 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | 1310 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
1344 | if (m_agentTransfer != null) | 1311 | if (m_agentTransfer != null) |
1345 | m_agentTransfer.EnableChildAgents(this); | 1312 | m_agentTransfer.EnableChildAgents(this); |
1346 | else | ||
1347 | m_log.DebugFormat( | ||
1348 | "[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active for region {0}", | ||
1349 | m_scene.RegionInfo.RegionName); | ||
1350 | 1313 | ||
1351 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | 1314 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
1352 | if (friendsModule != null) | 1315 | if (friendsModule != null) |
@@ -1403,6 +1366,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1403 | /// </summary> | 1366 | /// </summary> |
1404 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 1367 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
1405 | { | 1368 | { |
1369 | // m_log.DebugFormat("[SCENE PRESENCE]: Received agent update from {0}", remoteClient.Name); | ||
1370 | |||
1406 | //if (m_isChildAgent) | 1371 | //if (m_isChildAgent) |
1407 | //{ | 1372 | //{ |
1408 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | 1373 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); |
@@ -1445,7 +1410,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1445 | #region Inputs | 1410 | #region Inputs |
1446 | 1411 | ||
1447 | AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; | 1412 | AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; |
1448 | Quaternion bodyRotation = agentData.BodyRotation; | ||
1449 | 1413 | ||
1450 | // Camera location in world. We'll need to raytrace | 1414 | // Camera location in world. We'll need to raytrace |
1451 | // from this location from time to time. | 1415 | // from this location from time to time. |
@@ -1530,23 +1494,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1530 | { | 1494 | { |
1531 | return; | 1495 | return; |
1532 | } | 1496 | } |
1533 | |||
1534 | bool update_movementflag = false; | ||
1535 | 1497 | ||
1536 | if (m_allowMovement && !SitGround) | 1498 | if (m_allowMovement && !SitGround) |
1537 | { | 1499 | { |
1500 | Quaternion bodyRotation = agentData.BodyRotation; | ||
1501 | bool update_rotation = false; | ||
1502 | |||
1503 | if (bodyRotation != m_bodyRot) | ||
1504 | { | ||
1505 | Rotation = bodyRotation; | ||
1506 | update_rotation = true; | ||
1507 | } | ||
1508 | |||
1509 | bool update_movementflag = false; | ||
1510 | |||
1538 | if (agentData.UseClientAgentPosition) | 1511 | if (agentData.UseClientAgentPosition) |
1539 | { | 1512 | { |
1540 | m_moveToPositionInProgress = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; | 1513 | MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; |
1541 | m_moveToPositionTarget = agentData.ClientAgentPosition; | 1514 | MoveToPositionTarget = agentData.ClientAgentPosition; |
1542 | } | 1515 | } |
1543 | 1516 | ||
1544 | int i = 0; | 1517 | int i = 0; |
1545 | |||
1546 | bool update_rotation = false; | ||
1547 | bool DCFlagKeyPressed = false; | 1518 | bool DCFlagKeyPressed = false; |
1548 | Vector3 agent_control_v3 = Vector3.Zero; | 1519 | Vector3 agent_control_v3 = Vector3.Zero; |
1549 | Quaternion q = bodyRotation; | ||
1550 | 1520 | ||
1551 | bool oldflying = PhysicsActor.Flying; | 1521 | bool oldflying = PhysicsActor.Flying; |
1552 | 1522 | ||
@@ -1577,7 +1547,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1577 | if (m_parentID == 0) | 1547 | if (m_parentID == 0) |
1578 | { | 1548 | { |
1579 | bool bAllowUpdateMoveToPosition = false; | 1549 | bool bAllowUpdateMoveToPosition = false; |
1580 | bool bResetMoveToPosition = false; | ||
1581 | 1550 | ||
1582 | Vector3[] dirVectors; | 1551 | Vector3[] dirVectors; |
1583 | 1552 | ||
@@ -1598,8 +1567,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1598 | { | 1567 | { |
1599 | if (((uint)flags & (uint)DCF) != 0) | 1568 | if (((uint)flags & (uint)DCF) != 0) |
1600 | { | 1569 | { |
1601 | bResetMoveToPosition = true; | ||
1602 | DCFlagKeyPressed = true; | 1570 | DCFlagKeyPressed = true; |
1571 | |||
1603 | try | 1572 | try |
1604 | { | 1573 | { |
1605 | agent_control_v3 += dirVectors[i]; | 1574 | agent_control_v3 += dirVectors[i]; |
@@ -1615,6 +1584,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1615 | 1584 | ||
1616 | if ((m_movementflag & (uint)DCF) == 0) | 1585 | if ((m_movementflag & (uint)DCF) == 0) |
1617 | { | 1586 | { |
1587 | |||
1588 | // m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with {1}", Name, DCF); | ||
1618 | m_movementflag += (byte)(uint)DCF; | 1589 | m_movementflag += (byte)(uint)DCF; |
1619 | update_movementflag = true; | 1590 | update_movementflag = true; |
1620 | } | 1591 | } |
@@ -1631,10 +1602,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1631 | bAllowUpdateMoveToPosition = true; | 1602 | bAllowUpdateMoveToPosition = true; |
1632 | } | 1603 | } |
1633 | } | 1604 | } |
1605 | |||
1634 | i++; | 1606 | i++; |
1635 | } | 1607 | } |
1636 | //Paupaw:Do Proper PID for Autopilot here | 1608 | if (MovingToTarget) |
1637 | if (bResetMoveToPosition) | ||
1638 | { | 1609 | { |
1639 | m_moveToPositionTarget = Vector3.Zero; | 1610 | m_moveToPositionTarget = Vector3.Zero; |
1640 | m_moveToPositionInProgress = false; | 1611 | m_moveToPositionInProgress = false; |
@@ -1680,12 +1651,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1680 | // if (there) | 1651 | // if (there) |
1681 | if (Util.GetDistanceTo(abspos, tgt) <= 0.5f) | 1652 | if (Util.GetDistanceTo(abspos, tgt) <= 0.5f) |
1682 | { | 1653 | { |
1683 | // we are close enough to the target | 1654 | ResetMoveToTarget(); |
1684 | m_moveToPositionTarget = Vector3.Zero; | ||
1685 | m_moveToPositionInProgress = false; | ||
1686 | update_movementflag = true; | 1655 | update_movementflag = true; |
1687 | } | 1656 | } |
1688 | else | 1657 | else if (bAllowUpdateMoveToPosition) |
1689 | { | 1658 | { |
1690 | try | 1659 | try |
1691 | { | 1660 | { |
@@ -1790,14 +1759,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1790 | // which occurs later in the main scene loop | 1759 | // which occurs later in the main scene loop |
1791 | if (update_movementflag || (update_rotation && DCFlagKeyPressed)) | 1760 | if (update_movementflag || (update_rotation && DCFlagKeyPressed)) |
1792 | { | 1761 | { |
1793 | // m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed)); | 1762 | // m_log.DebugFormat( |
1794 | // m_log.DebugFormat( | 1763 | // "[SCENE PRESENCE]: In {0} adding velocity of {1} to {2}, umf = {3}, ur = {4}", |
1795 | // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); | 1764 | // m_scene.RegionInfo.RegionName, agent_control_v3, Name, update_movementflag, update_rotation); |
1796 | 1765 | ||
1797 | AddNewMovement(agent_control_v3, q, Nudging); | 1766 | AddNewMovement(agent_control_v3, q, Nudging); |
1798 | 1767 | ||
1799 | 1768 | ||
1800 | } | 1769 | } |
1770 | // else | ||
1771 | // { | ||
1772 | // if (!update_movementflag) | ||
1773 | // { | ||
1774 | // m_log.DebugFormat( | ||
1775 | // "[SCENE PRESENCE]: In {0} ignoring requested update of {1} for {2} as update_movementflag = false", | ||
1776 | // m_scene.RegionInfo.RegionName, agent_control_v3, Name); | ||
1777 | // } | ||
1778 | // } | ||
1779 | |||
1780 | if (update_movementflag && m_parentID == 0) | ||
1781 | Animator.UpdateMovementAnimations(); | ||
1801 | } | 1782 | } |
1802 | 1783 | ||
1803 | if (update_movementflag && !SitGround) | 1784 | if (update_movementflag && !SitGround) |
@@ -1808,30 +1789,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1808 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 1789 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
1809 | } | 1790 | } |
1810 | 1791 | ||
1811 | public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) | 1792 | /// <summary> |
1793 | /// Calculate an update to move the presence to the set target. | ||
1794 | /// </summary> | ||
1795 | /// <remarks> | ||
1796 | /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3. | ||
1797 | /// </remarks> | ||
1798 | /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param> | ||
1799 | /// <returns>True if movement has been updated in some way. False otherwise.</returns> | ||
1800 | public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3) | ||
1812 | { | 1801 | { |
1813 | m_autopilotMoving = true; | 1802 | // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); |
1814 | m_autoPilotTarget = Pos; | 1803 | bool updated = false; |
1815 | m_sitAtAutoTarget = false; | ||
1816 | PrimitiveBaseShape proxy = PrimitiveBaseShape.Default; | ||
1817 | //proxy.PCode = (byte)PCode.ParticleSystem; | ||
1818 | proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy); | ||
1819 | proxyObjectGroup.AttachToScene(m_scene); | ||
1820 | |||
1821 | // Commented out this code since it could never have executed, but might still be informative. | ||
1822 | // if (proxyObjectGroup != null) | ||
1823 | // { | ||
1824 | proxyObjectGroup.SendGroupFullUpdate(); | ||
1825 | remote_client.SendSitResponse(proxyObjectGroup.UUID, Vector3.Zero, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false); | ||
1826 | m_scene.DeleteSceneObject(proxyObjectGroup, false); | ||
1827 | // } | ||
1828 | // else | ||
1829 | // { | ||
1830 | // m_autopilotMoving = false; | ||
1831 | // m_autoPilotTarget = Vector3.Zero; | ||
1832 | // ControllingClient.SendAlertMessage("Autopilot cancelled"); | ||
1833 | // } | ||
1834 | } | ||
1835 | 1804 | ||
1836 | public void StopMoveToPosition() | 1805 | public void StopMoveToPosition() |
1837 | { | 1806 | { |
@@ -1844,31 +1813,186 @@ namespace OpenSim.Region.Framework.Scenes | |||
1844 | //Console.WriteLine("SP:DoMoveToPosition"); | 1813 | //Console.WriteLine("SP:DoMoveToPosition"); |
1845 | try | 1814 | try |
1846 | { | 1815 | { |
1847 | float locx = 0f; | 1816 | double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, MoveToPositionTarget); |
1848 | float locy = 0f; | 1817 | // m_log.DebugFormat( |
1849 | float locz = 0f; | 1818 | // "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}", |
1850 | uint regionX = 0; | 1819 | // Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); |
1851 | uint regionY = 0; | 1820 | |
1852 | try | 1821 | // Check the error term of the current position in relation to the target position |
1822 | if (distanceToTarget <= 1) | ||
1853 | { | 1823 | { |
1854 | Utils.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY); | 1824 | // We are close enough to the target |
1855 | locx = Convert.ToSingle(args[0]) - (float)regionX; | 1825 | AbsolutePosition = MoveToPositionTarget; |
1856 | locy = Convert.ToSingle(args[1]) - (float)regionY; | 1826 | ResetMoveToTarget(); |
1857 | locz = Convert.ToSingle(args[2]); | 1827 | updated = true; |
1858 | } | 1828 | } |
1859 | catch (InvalidCastException) | 1829 | else |
1860 | { | 1830 | { |
1861 | m_log.Error("[CLIENT]: Invalid autopilot request"); | 1831 | try |
1862 | return; | 1832 | { |
1833 | // move avatar in 3D at one meter/second towards target, in avatar coordinate frame. | ||
1834 | // This movement vector gets added to the velocity through AddNewMovement(). | ||
1835 | // Theoretically we might need a more complex PID approach here if other | ||
1836 | // unknown forces are acting on the avatar and we need to adaptively respond | ||
1837 | // to such forces, but the following simple approach seems to works fine. | ||
1838 | Vector3 LocalVectorToTarget3D = | ||
1839 | (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords | ||
1840 | * Matrix4.CreateFromQuaternion(Quaternion.Inverse(Rotation)); // change to avatar coords | ||
1841 | // Ignore z component of vector | ||
1842 | // Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); | ||
1843 | LocalVectorToTarget3D.Normalize(); | ||
1844 | |||
1845 | // update avatar movement flags. the avatar coordinate system is as follows: | ||
1846 | // | ||
1847 | // +X (forward) | ||
1848 | // | ||
1849 | // ^ | ||
1850 | // | | ||
1851 | // | | ||
1852 | // | | ||
1853 | // | | ||
1854 | // (left) +Y <--------o--------> -Y | ||
1855 | // avatar | ||
1856 | // | | ||
1857 | // | | ||
1858 | // | | ||
1859 | // | | ||
1860 | // v | ||
1861 | // -X | ||
1862 | // | ||
1863 | |||
1864 | // based on the above avatar coordinate system, classify the movement into | ||
1865 | // one of left/right/back/forward. | ||
1866 | if (LocalVectorToTarget3D.X < 0) //MoveBack | ||
1867 | { | ||
1868 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; | ||
1869 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; | ||
1870 | updated = true; | ||
1871 | } | ||
1872 | else if (LocalVectorToTarget3D.X > 0) //Move Forward | ||
1873 | { | ||
1874 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; | ||
1875 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; | ||
1876 | updated = true; | ||
1877 | } | ||
1878 | |||
1879 | if (LocalVectorToTarget3D.Y > 0) //MoveLeft | ||
1880 | { | ||
1881 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; | ||
1882 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; | ||
1883 | updated = true; | ||
1884 | } | ||
1885 | else if (LocalVectorToTarget3D.Y < 0) //MoveRight | ||
1886 | { | ||
1887 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; | ||
1888 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; | ||
1889 | updated = true; | ||
1890 | } | ||
1891 | |||
1892 | if (LocalVectorToTarget3D.Z > 0) //Up | ||
1893 | { | ||
1894 | // Don't set these flags for up or down - doing so will make the avatar crouch or | ||
1895 | // keep trying to jump even if walking along level ground | ||
1896 | //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; | ||
1897 | //AgentControlFlags | ||
1898 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; | ||
1899 | updated = true; | ||
1900 | } | ||
1901 | else if (LocalVectorToTarget3D.Z < 0) //Down | ||
1902 | { | ||
1903 | //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; | ||
1904 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; | ||
1905 | updated = true; | ||
1906 | } | ||
1907 | |||
1908 | // m_log.DebugFormat( | ||
1909 | // "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}", | ||
1910 | // LocalVectorToTarget3D, agent_control_v3, Name); | ||
1911 | |||
1912 | agent_control_v3 += LocalVectorToTarget3D; | ||
1913 | } | ||
1914 | catch (Exception e) | ||
1915 | { | ||
1916 | //Avoid system crash, can be slower but... | ||
1917 | m_log.DebugFormat("Crash! {0}", e.ToString()); | ||
1918 | } | ||
1863 | } | 1919 | } |
1864 | m_moveToPositionInProgress = true; | ||
1865 | m_moveToPositionTarget = new Vector3(locx, locy, locz); | ||
1866 | } | 1920 | } |
1867 | catch (Exception ex) | 1921 | |
1868 | { | 1922 | return updated; |
1869 | //Why did I get this error? | 1923 | } |
1870 | m_log.Error("[SCENEPRESENCE]: DoMoveToPosition" + ex); | 1924 | |
1871 | } | 1925 | /// <summary> |
1926 | /// Move to the given target over time. | ||
1927 | /// </summary> | ||
1928 | /// <param name="pos"></param> | ||
1929 | /// <param name="noFly"> | ||
1930 | /// If true, then don't allow the avatar to fly to the target, even if it's up in the air. | ||
1931 | /// This is to allow movement to targets that are known to be on an elevated platform with a continuous path | ||
1932 | /// from start to finish. | ||
1933 | /// </param> | ||
1934 | public void MoveToTarget(Vector3 pos, bool noFly) | ||
1935 | { | ||
1936 | m_log.DebugFormat( | ||
1937 | "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", | ||
1938 | Name, pos, m_scene.RegionInfo.RegionName); | ||
1939 | |||
1940 | if (pos.X < 0 || pos.X >= Constants.RegionSize | ||
1941 | || pos.Y < 0 || pos.Y >= Constants.RegionSize | ||
1942 | || pos.Z < 0) | ||
1943 | return; | ||
1944 | |||
1945 | // Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2); | ||
1946 | // pos += heightAdjust; | ||
1947 | // | ||
1948 | // // Anti duck-walking measure | ||
1949 | // if (Math.Abs(pos.Z - AbsolutePosition.Z) < 0.2f) | ||
1950 | // { | ||
1951 | //// m_log.DebugFormat("[SCENE PRESENCE]: Adjusting MoveToPosition from {0} to {1}", pos, AbsolutePosition); | ||
1952 | // pos.Z = AbsolutePosition.Z; | ||
1953 | // } | ||
1954 | |||
1955 | float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; | ||
1956 | pos.Z = Math.Max(terrainHeight, pos.Z); | ||
1957 | |||
1958 | // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is | ||
1959 | // always slightly higher than the actual terrain height. | ||
1960 | // FIXME: This constrains NOC movements as well, so should be somewhere else. | ||
1961 | if (pos.Z - terrainHeight < 0.2) | ||
1962 | pos.Z = terrainHeight; | ||
1963 | |||
1964 | m_log.DebugFormat( | ||
1965 | "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", | ||
1966 | Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); | ||
1967 | |||
1968 | if (noFly) | ||
1969 | PhysicsActor.Flying = false; | ||
1970 | else if (pos.Z > terrainHeight) | ||
1971 | PhysicsActor.Flying = true; | ||
1972 | |||
1973 | MovingToTarget = true; | ||
1974 | MoveToPositionTarget = pos; | ||
1975 | |||
1976 | Vector3 agent_control_v3 = new Vector3(); | ||
1977 | HandleMoveToTargetUpdate(ref agent_control_v3); | ||
1978 | AddNewMovement(agent_control_v3); | ||
1979 | } | ||
1980 | |||
1981 | /// <summary> | ||
1982 | /// Reset the move to target. | ||
1983 | /// </summary> | ||
1984 | public void ResetMoveToTarget() | ||
1985 | { | ||
1986 | m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); | ||
1987 | |||
1988 | MovingToTarget = false; | ||
1989 | MoveToPositionTarget = Vector3.Zero; | ||
1990 | |||
1991 | // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct | ||
1992 | // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag. | ||
1993 | // However, the line is here rather than in the NPC module since it also appears necessary to stop a | ||
1994 | // viewer that uses "go here" from juddering on all subsequent avatar movements. | ||
1995 | AgentControlFlags = (uint)AgentManager.ControlFlags.NONE; | ||
1872 | } | 1996 | } |
1873 | 1997 | ||
1874 | private void CheckAtSitTarget() | 1998 | private void CheckAtSitTarget() |
@@ -1997,11 +2121,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1997 | m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); | 2121 | m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); |
1998 | SendAvatarDataToAllAgents(); | 2122 | SendAvatarDataToAllAgents(); |
1999 | m_requestedSitTargetID = 0; | 2123 | m_requestedSitTargetID = 0; |
2000 | if (m_physicsActor != null && m_appearance != null) | ||
2001 | { | ||
2002 | if (m_appearance.AvatarHeight > 0) | ||
2003 | SetHeight(m_appearance.AvatarHeight); | ||
2004 | } | ||
2005 | } | 2124 | } |
2006 | Animator.TrySetMovementAnimation("STAND"); | 2125 | Animator.TrySetMovementAnimation("STAND"); |
2007 | } | 2126 | } |
@@ -2057,7 +2176,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2057 | bool forceMouselook = false; | 2176 | bool forceMouselook = false; |
2058 | 2177 | ||
2059 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); | 2178 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); |
2060 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); | 2179 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); |
2061 | if (part == null) return; | 2180 | if (part == null) return; |
2062 | 2181 | ||
2063 | // TODO: determine position to sit at based on scene geometry; don't trust offset from client | 2182 | // TODO: determine position to sit at based on scene geometry; don't trust offset from client |
@@ -2215,14 +2334,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2215 | HandleAgentSit(remoteClient, UUID); | 2334 | HandleAgentSit(remoteClient, UUID); |
2216 | } | 2335 | } |
2217 | 2336 | ||
2337 | // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation) | ||
2218 | public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) | 2338 | public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) |
2219 | { | 2339 | { |
2220 | if (m_parentID != 0) | 2340 | if (m_parentID != 0) |
2221 | { | 2341 | { |
2222 | StandUp(); | 2342 | StandUp(); |
2223 | } | 2343 | } |
2344 | |||
2345 | // if (!String.IsNullOrEmpty(sitAnimation)) | ||
2346 | // { | ||
2347 | // m_nextSitAnimation = sitAnimation; | ||
2348 | // } | ||
2349 | // else | ||
2350 | // { | ||
2224 | m_nextSitAnimation = "SIT"; | 2351 | m_nextSitAnimation = "SIT"; |
2225 | 2352 | // } | |
2353 | |||
2226 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); | 2354 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); |
2227 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); | 2355 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); |
2228 | 2356 | ||
@@ -2247,7 +2375,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2247 | } | 2375 | } |
2248 | else | 2376 | else |
2249 | { | 2377 | { |
2250 | |||
2251 | m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); | 2378 | m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); |
2252 | } | 2379 | } |
2253 | 2380 | ||
@@ -2445,44 +2572,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2445 | SendSitResponse(ControllingClient, m_requestedSitTargetUUID, collisionPoint - m_requestedSitOffset, Quaternion.Identity); | 2572 | SendSitResponse(ControllingClient, m_requestedSitTargetUUID, collisionPoint - m_requestedSitOffset, Quaternion.Identity); |
2446 | } | 2573 | } |
2447 | */ | 2574 | */ |
2448 | public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation) | ||
2449 | { | ||
2450 | if (m_parentID != 0) | ||
2451 | { | ||
2452 | StandUp(); | ||
2453 | } | ||
2454 | if (!String.IsNullOrEmpty(sitAnimation)) | ||
2455 | { | ||
2456 | m_nextSitAnimation = sitAnimation; | ||
2457 | } | ||
2458 | else | ||
2459 | { | ||
2460 | m_nextSitAnimation = "SIT"; | ||
2461 | } | ||
2462 | |||
2463 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); | ||
2464 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); | ||
2465 | if (part != null) | ||
2466 | { | ||
2467 | m_requestedSitTargetID = part.LocalId; | ||
2468 | //m_requestedSitOffset = offset; | ||
2469 | m_requestedSitTargetUUID = targetID; | ||
2470 | 2575 | ||
2471 | m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset); | ||
2472 | |||
2473 | if (m_scene.PhysicsScene.SupportsRayCast()) | ||
2474 | { | ||
2475 | //SitRayCastAvatarPosition(part); | ||
2476 | //return; | ||
2477 | } | ||
2478 | } | ||
2479 | else | ||
2480 | { | ||
2481 | m_log.Warn("Sit requested on unknown object: " + targetID); | ||
2482 | } | ||
2483 | |||
2484 | SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity); | ||
2485 | } | ||
2486 | 2576 | ||
2487 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) | 2577 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) |
2488 | { | 2578 | { |
@@ -2669,8 +2759,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2669 | 2759 | ||
2670 | m_perfMonMS = Util.EnvironmentTickCount(); | 2760 | m_perfMonMS = Util.EnvironmentTickCount(); |
2671 | 2761 | ||
2672 | Rotation = rotation; | 2762 | Vector3 direc = vec * Rotation; |
2673 | Vector3 direc = vec * rotation; | ||
2674 | direc.Normalize(); | 2763 | direc.Normalize(); |
2675 | PhysicsActor actor = m_physicsActor; | 2764 | PhysicsActor actor = m_physicsActor; |
2676 | 2765 | ||
@@ -2901,13 +2990,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2901 | // We have an appearance but we may not have the baked textures. Check the asset cache | 2990 | // We have an appearance but we may not have the baked textures. Check the asset cache |
2902 | // to see if all the baked textures are already here. | 2991 | // to see if all the baked textures are already here. |
2903 | if (m_scene.AvatarFactory != null) | 2992 | if (m_scene.AvatarFactory != null) |
2904 | { | ||
2905 | cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); | 2993 | cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); |
2906 | } | ||
2907 | else | ||
2908 | { | ||
2909 | m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); | ||
2910 | } | ||
2911 | 2994 | ||
2912 | // If we aren't using a cached appearance, then clear out the baked textures | 2995 | // If we aren't using a cached appearance, then clear out the baked textures |
2913 | if (!cachedappearance) | 2996 | if (!cachedappearance) |
@@ -3064,19 +3147,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3064 | /// <param name="avatar"></param> | 3147 | /// <param name="avatar"></param> |
3065 | public void SendAppearanceToAgent(ScenePresence avatar) | 3148 | public void SendAppearanceToAgent(ScenePresence avatar) |
3066 | { | 3149 | { |
3067 | // m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); | 3150 | // m_log.DebugFormat( |
3151 | // "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); | ||
3068 | 3152 | ||
3069 | avatar.ControllingClient.SendAppearance( | 3153 | avatar.ControllingClient.SendAppearance( |
3070 | m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); | 3154 | UUID, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); |
3071 | } | 3155 | } |
3072 | 3156 | ||
3073 | // Because appearance setting is in a module, we actually need | ||
3074 | // to give it access to our appearance directly, otherwise we | ||
3075 | // get a synchronization issue. | ||
3076 | public AvatarAppearance Appearance | 3157 | public AvatarAppearance Appearance |
3077 | { | 3158 | { |
3078 | get { return m_appearance; } | 3159 | get { return m_appearance; } |
3079 | set { m_appearance = value; } | 3160 | set |
3161 | { | ||
3162 | m_appearance = value; | ||
3163 | // m_log.DebugFormat("[SCENE PRESENCE]: Set appearance for {0} to {1}", Name, value); | ||
3164 | } | ||
3080 | } | 3165 | } |
3081 | 3166 | ||
3082 | #endregion | 3167 | #endregion |
@@ -3088,15 +3173,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3088 | /// </summary> | 3173 | /// </summary> |
3089 | protected void CheckForSignificantMovement() | 3174 | protected void CheckForSignificantMovement() |
3090 | { | 3175 | { |
3091 | // Movement updates for agents in neighboring regions are sent directly to clients. | ||
3092 | // This value only affects how often agent positions are sent to neighbor regions | ||
3093 | // for things such as distance-based update prioritization | ||
3094 | const float SIGNIFICANT_MOVEMENT = 2.0f; | ||
3095 | |||
3096 | if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT) | 3176 | if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT) |
3097 | { | 3177 | { |
3098 | posLastSignificantMove = AbsolutePosition; | 3178 | posLastSignificantMove = AbsolutePosition; |
3099 | m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient); | 3179 | m_scene.EventManager.TriggerSignificantClientMovement(this); |
3100 | } | 3180 | } |
3101 | 3181 | ||
3102 | // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m | 3182 | // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m |
@@ -3579,7 +3659,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3579 | ISceneObject clone = sog.CloneForNewScene(); | 3659 | ISceneObject clone = sog.CloneForNewScene(); |
3580 | // Attachment module assumes that GroupPosition holds the offsets...! | 3660 | // Attachment module assumes that GroupPosition holds the offsets...! |
3581 | ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; | 3661 | ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; |
3582 | ((SceneObjectGroup)clone).RootPart.IsAttachment = false; | 3662 | ((SceneObjectGroup)clone).IsAttachment = false; |
3583 | cAgent.AttachmentObjects.Add(clone); | 3663 | cAgent.AttachmentObjects.Add(clone); |
3584 | string state = sog.GetStateSnapshot(); | 3664 | string state = sog.GetStateSnapshot(); |
3585 | cAgent.AttachmentObjectStates.Add(state); | 3665 | cAgent.AttachmentObjectStates.Add(state); |
@@ -3746,6 +3826,8 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
3746 | m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong | 3826 | m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong |
3747 | m_physicsActor.SubscribeEvents(500); | 3827 | m_physicsActor.SubscribeEvents(500); |
3748 | m_physicsActor.LocalID = LocalId; | 3828 | m_physicsActor.LocalID = LocalId; |
3829 | |||
3830 | SetHeight(m_appearance.AvatarHeight); | ||
3749 | } | 3831 | } |
3750 | 3832 | ||
3751 | private void OutOfBoundsCall(Vector3 pos) | 3833 | private void OutOfBoundsCall(Vector3 pos) |
@@ -4001,19 +4083,7 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
4001 | 4083 | ||
4002 | public void Close() | 4084 | public void Close() |
4003 | { | 4085 | { |
4004 | lock (m_attachments) | 4086 | m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false); |
4005 | { | ||
4006 | // Delete attachments from scene | ||
4007 | // Don't try to save, as this thread won't live long | ||
4008 | // enough to complete the save. This would cause no copy | ||
4009 | // attachments to poof! | ||
4010 | // | ||
4011 | foreach (SceneObjectGroup grp in m_attachments) | ||
4012 | { | ||
4013 | m_scene.DeleteSceneObject(grp, false); | ||
4014 | } | ||
4015 | m_attachments.Clear(); | ||
4016 | } | ||
4017 | 4087 | ||
4018 | lock (m_knownChildRegions) | 4088 | lock (m_knownChildRegions) |
4019 | { | 4089 | { |
@@ -4048,9 +4118,19 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
4048 | m_attachments.Add(gobj); | 4118 | m_attachments.Add(gobj); |
4049 | } | 4119 | } |
4050 | } | 4120 | } |
4051 | 4121 | ||
4122 | /// <summary> | ||
4123 | /// Get all the presence's attachments. | ||
4124 | /// </summary> | ||
4125 | /// <returns>A copy of the list which contains the attachments.</returns> | ||
4126 | public List<SceneObjectGroup> GetAttachments() | ||
4127 | { | ||
4128 | lock (m_attachments) | ||
4129 | return new List<SceneObjectGroup>(m_attachments); | ||
4130 | } | ||
4131 | |||
4052 | /// <summary> | 4132 | /// <summary> |
4053 | /// Get the scene object attached to the given point. | 4133 | /// Get the scene objects attached to the given point. |
4054 | /// </summary> | 4134 | /// </summary> |
4055 | /// <param name="attachmentPoint"></param> | 4135 | /// <param name="attachmentPoint"></param> |
4056 | /// <returns>Returns an empty list if there were no attachments at the point.</returns> | 4136 | /// <returns>Returns an empty list if there were no attachments at the point.</returns> |
@@ -4062,7 +4142,7 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
4062 | { | 4142 | { |
4063 | foreach (SceneObjectGroup so in m_attachments) | 4143 | foreach (SceneObjectGroup so in m_attachments) |
4064 | { | 4144 | { |
4065 | if (attachmentPoint == so.RootPart.AttachmentPoint) | 4145 | if (attachmentPoint == so.AttachmentPoint) |
4066 | attachments.Add(so); | 4146 | attachments.Add(so); |
4067 | } | 4147 | } |
4068 | } | 4148 | } |
@@ -4072,7 +4152,8 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
4072 | 4152 | ||
4073 | public bool HasAttachments() | 4153 | public bool HasAttachments() |
4074 | { | 4154 | { |
4075 | return m_attachments.Count > 0; | 4155 | lock (m_attachments) |
4156 | return m_attachments.Count > 0; | ||
4076 | } | 4157 | } |
4077 | 4158 | ||
4078 | public bool HasScriptedAttachments() | 4159 | public bool HasScriptedAttachments() |
@@ -4094,12 +4175,16 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
4094 | public void RemoveAttachment(SceneObjectGroup gobj) | 4175 | public void RemoveAttachment(SceneObjectGroup gobj) |
4095 | { | 4176 | { |
4096 | lock (m_attachments) | 4177 | lock (m_attachments) |
4097 | { | 4178 | m_attachments.Remove(gobj); |
4098 | if (m_attachments.Contains(gobj)) | 4179 | } |
4099 | { | 4180 | |
4100 | m_attachments.Remove(gobj); | 4181 | /// <summary> |
4101 | } | 4182 | /// Clear all attachments |
4102 | } | 4183 | /// </summary> |
4184 | public void ClearAttachments() | ||
4185 | { | ||
4186 | lock (m_attachments) | ||
4187 | m_attachments.Clear(); | ||
4103 | } | 4188 | } |
4104 | 4189 | ||
4105 | public bool ValidateAttachments() | 4190 | public bool ValidateAttachments() |
@@ -4110,12 +4195,22 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
4110 | foreach (SceneObjectGroup gobj in m_attachments) | 4195 | foreach (SceneObjectGroup gobj in m_attachments) |
4111 | { | 4196 | { |
4112 | if (gobj == null) | 4197 | if (gobj == null) |
4198 | { | ||
4199 | m_log.WarnFormat( | ||
4200 | "[SCENE PRESENCE]: Failed to validate an attachment for {0} since it was null", Name); | ||
4113 | return false; | 4201 | return false; |
4202 | } | ||
4114 | 4203 | ||
4115 | if (gobj.IsDeleted) | 4204 | if (gobj.IsDeleted) |
4205 | { | ||
4206 | m_log.WarnFormat( | ||
4207 | "[SCENE PRESENCE]: Failed to validate attachment {0} {1} for {2} since it had been deleted", | ||
4208 | gobj.Name, gobj.UUID, Name); | ||
4116 | return false; | 4209 | return false; |
4210 | } | ||
4117 | } | 4211 | } |
4118 | } | 4212 | } |
4213 | |||
4119 | return true; | 4214 | return true; |
4120 | } | 4215 | } |
4121 | 4216 | ||
@@ -4553,4 +4648,4 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
4553 | } | 4648 | } |
4554 | } | 4649 | } |
4555 | } | 4650 | } |
4556 | } | 4651 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index f04ed4d..501487a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs | |||
@@ -110,7 +110,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
110 | { | 110 | { |
111 | SceneObjectPart part = m_partsUpdateQueue.Dequeue(); | 111 | SceneObjectPart part = m_partsUpdateQueue.Dequeue(); |
112 | 112 | ||
113 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) | 113 | if (part.ParentGroup.IsDeleted) |
114 | continue; | 114 | continue; |
115 | 115 | ||
116 | if (m_updateTimes.ContainsKey(part.UUID)) | 116 | if (m_updateTimes.ContainsKey(part.UUID)) |
@@ -120,8 +120,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
120 | // We deal with the possibility that two updates occur at | 120 | // We deal with the possibility that two updates occur at |
121 | // the same unix time at the update point itself. | 121 | // the same unix time at the update point itself. |
122 | 122 | ||
123 | if ((update.LastFullUpdateTime < part.TimeStampFull) || | 123 | if ((update.LastFullUpdateTime < part.TimeStampFull) || part.ParentGroup.IsAttachment) |
124 | part.IsAttachment) | ||
125 | { | 124 | { |
126 | // m_log.DebugFormat( | 125 | // m_log.DebugFormat( |
127 | // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", | 126 | // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index d6e8223..11dad6c 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -53,19 +53,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
53 | /// <summary> | 53 | /// <summary> |
54 | /// Deserialize a scene object from the original xml format | 54 | /// Deserialize a scene object from the original xml format |
55 | /// </summary> | 55 | /// </summary> |
56 | /// <param name="serialization"></param> | 56 | /// <param name="xmlData"></param> |
57 | /// <returns></returns> | 57 | /// <returns></returns> |
58 | public static SceneObjectGroup FromOriginalXmlFormat(string serialization) | 58 | public static SceneObjectGroup FromOriginalXmlFormat(string xmlData) |
59 | { | ||
60 | return FromOriginalXmlFormat(UUID.Zero, serialization); | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// Deserialize a scene object from the original xml format | ||
65 | /// </summary> | ||
66 | /// <param name="serialization"></param> | ||
67 | /// <returns></returns> | ||
68 | public static SceneObjectGroup FromOriginalXmlFormat(UUID fromUserInventoryItemID, string xmlData) | ||
69 | { | 59 | { |
70 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | 60 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); |
71 | //int time = System.Environment.TickCount; | 61 | //int time = System.Environment.TickCount; |
@@ -87,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
87 | 77 | ||
88 | sr = new StringReader(parts[0].InnerXml); | 78 | sr = new StringReader(parts[0].InnerXml); |
89 | reader = new XmlTextReader(sr); | 79 | reader = new XmlTextReader(sr); |
90 | SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(fromUserInventoryItemID, reader)); | 80 | SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); |
91 | reader.Close(); | 81 | reader.Close(); |
92 | sr.Close(); | 82 | sr.Close(); |
93 | 83 | ||
@@ -102,7 +92,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
102 | sceneObject.AddPart(part); | 92 | sceneObject.AddPart(part); |
103 | part.LinkNum = linkNum; | 93 | part.LinkNum = linkNum; |
104 | part.TrimPermissions(); | 94 | part.TrimPermissions(); |
105 | part.StoreUndoState(UndoType.STATE_ALL); | ||
106 | reader.Close(); | 95 | reader.Close(); |
107 | sr.Close(); | 96 | sr.Close(); |
108 | } | 97 | } |
@@ -128,26 +117,36 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
128 | /// <returns></returns> | 117 | /// <returns></returns> |
129 | public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject) | 118 | public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject) |
130 | { | 119 | { |
120 | return ToOriginalXmlFormat(sceneObject, true); | ||
121 | } | ||
122 | |||
123 | /// <summary> | ||
124 | /// Serialize a scene object to the original xml format | ||
125 | /// </summary> | ||
126 | /// <param name="sceneObject"></param> | ||
127 | /// <param name="doScriptStates">Control whether script states are also serialized.</para> | ||
128 | /// <returns></returns> | ||
129 | public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, bool doScriptStates) | ||
130 | { | ||
131 | using (StringWriter sw = new StringWriter()) | 131 | using (StringWriter sw = new StringWriter()) |
132 | { | 132 | { |
133 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | 133 | using (XmlTextWriter writer = new XmlTextWriter(sw)) |
134 | { | 134 | { |
135 | ToOriginalXmlFormat(sceneObject, writer); | 135 | ToOriginalXmlFormat(sceneObject, writer, doScriptStates); |
136 | } | 136 | } |
137 | 137 | ||
138 | return sw.ToString(); | 138 | return sw.ToString(); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | |||
142 | 141 | ||
143 | /// <summary> | 142 | /// <summary> |
144 | /// Serialize a scene object to the original xml format | 143 | /// Serialize a scene object to the original xml format |
145 | /// </summary> | 144 | /// </summary> |
146 | /// <param name="sceneObject"></param> | 145 | /// <param name="sceneObject"></param> |
147 | /// <returns></returns> | 146 | /// <returns></returns> |
148 | public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer) | 147 | public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates) |
149 | { | 148 | { |
150 | ToOriginalXmlFormat(sceneObject, writer, false); | 149 | ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false); |
151 | } | 150 | } |
152 | 151 | ||
153 | /// <summary> | 152 | /// <summary> |
@@ -157,10 +156,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
157 | /// <param name="writer"></param> | 156 | /// <param name="writer"></param> |
158 | /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param> | 157 | /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param> |
159 | /// <returns></returns> | 158 | /// <returns></returns> |
160 | public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool noRootElement) | 159 | public static void ToOriginalXmlFormat( |
160 | SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates, bool noRootElement) | ||
161 | { | 161 | { |
162 | //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name); | 162 | // m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", sceneObject.Name); |
163 | //int time = System.Environment.TickCount; | 163 | // int time = System.Environment.TickCount; |
164 | 164 | ||
165 | if (!noRootElement) | 165 | if (!noRootElement) |
166 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | 166 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); |
@@ -183,12 +183,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
183 | } | 183 | } |
184 | 184 | ||
185 | writer.WriteEndElement(); // OtherParts | 185 | writer.WriteEndElement(); // OtherParts |
186 | sceneObject.SaveScriptedState(writer); | 186 | |
187 | if (doScriptStates) | ||
188 | sceneObject.SaveScriptedState(writer); | ||
187 | 189 | ||
188 | if (!noRootElement) | 190 | if (!noRootElement) |
189 | writer.WriteEndElement(); // SceneObjectGroup | 191 | writer.WriteEndElement(); // SceneObjectGroup |
190 | 192 | ||
191 | //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); | 193 | // m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time); |
192 | } | 194 | } |
193 | 195 | ||
194 | protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) | 196 | protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) |
@@ -236,15 +238,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
236 | if (originalLinkNum != 0) | 238 | if (originalLinkNum != 0) |
237 | part.LinkNum = originalLinkNum; | 239 | part.LinkNum = originalLinkNum; |
238 | 240 | ||
239 | part.StoreUndoState(UndoType.STATE_ALL); | ||
240 | reader.Close(); | 241 | reader.Close(); |
241 | sr.Close(); | 242 | sr.Close(); |
242 | } | 243 | } |
243 | 244 | ||
244 | // Script state may, or may not, exist. Not having any, is NOT | 245 | // Script state may, or may not, exist. Not having any, is NOT |
245 | // ever a problem. | 246 | // ever a problem. |
246 | |||
247 | sceneObject.LoadScriptState(doc); | 247 | sceneObject.LoadScriptState(doc); |
248 | |||
248 | return sceneObject; | 249 | return sceneObject; |
249 | } | 250 | } |
250 | catch (Exception e) | 251 | catch (Exception e) |
@@ -1592,4 +1593,4 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1592 | 1593 | ||
1593 | #endregion | 1594 | #endregion |
1594 | } | 1595 | } |
1595 | } | 1596 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs deleted file mode 100644 index cff649b..0000000 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ /dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Threading; | ||
33 | using System.Timers; | ||
34 | using Timer=System.Timers.Timer; | ||
35 | using Nini.Config; | ||
36 | using NUnit.Framework; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Communications; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.CoreModules.World.Serialiser; | ||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
44 | using OpenSim.Tests.Common; | ||
45 | using OpenSim.Tests.Common.Mock; | ||
46 | |||
47 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
48 | { | ||
49 | /// <summary> | ||
50 | /// Attachment tests | ||
51 | /// </summary> | ||
52 | [TestFixture] | ||
53 | public class AttachmentTests | ||
54 | { | ||
55 | public Scene scene, scene2; | ||
56 | public UUID agent1; | ||
57 | public static Random random; | ||
58 | public ulong region1, region2; | ||
59 | public AgentCircuitData acd1; | ||
60 | public SceneObjectGroup sog1, sog2, sog3; | ||
61 | |||
62 | [TestFixtureSetUp] | ||
63 | public void Init() | ||
64 | { | ||
65 | TestHelper.InMethod(); | ||
66 | |||
67 | scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); | ||
68 | scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); | ||
69 | |||
70 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | ||
71 | interregionComms.Initialise(new IniConfigSource()); | ||
72 | interregionComms.PostInitialise(); | ||
73 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); | ||
74 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); | ||
75 | |||
76 | agent1 = UUID.Random(); | ||
77 | random = new Random(); | ||
78 | sog1 = NewSOG(UUID.Random(), scene, agent1); | ||
79 | sog2 = NewSOG(UUID.Random(), scene, agent1); | ||
80 | sog3 = NewSOG(UUID.Random(), scene, agent1); | ||
81 | |||
82 | //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | ||
83 | region1 = scene.RegionInfo.RegionHandle; | ||
84 | region2 = scene2.RegionInfo.RegionHandle; | ||
85 | |||
86 | SceneSetupHelpers.AddRootAgent(scene, agent1); | ||
87 | } | ||
88 | |||
89 | [Test] | ||
90 | public void T030_TestAddAttachments() | ||
91 | { | ||
92 | TestHelper.InMethod(); | ||
93 | |||
94 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
95 | |||
96 | presence.AddAttachment(sog1); | ||
97 | presence.AddAttachment(sog2); | ||
98 | presence.AddAttachment(sog3); | ||
99 | |||
100 | Assert.That(presence.HasAttachments(), Is.True); | ||
101 | Assert.That(presence.ValidateAttachments(), Is.True); | ||
102 | } | ||
103 | |||
104 | [Test] | ||
105 | public void T031_RemoveAttachments() | ||
106 | { | ||
107 | TestHelper.InMethod(); | ||
108 | |||
109 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
110 | presence.RemoveAttachment(sog1); | ||
111 | presence.RemoveAttachment(sog2); | ||
112 | presence.RemoveAttachment(sog3); | ||
113 | Assert.That(presence.HasAttachments(), Is.False); | ||
114 | } | ||
115 | |||
116 | // I'm commenting this test because scene setup NEEDS InventoryService to | ||
117 | // be non-null | ||
118 | //[Test] | ||
119 | public void T032_CrossAttachments() | ||
120 | { | ||
121 | TestHelper.InMethod(); | ||
122 | |||
123 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
124 | ScenePresence presence2 = scene2.GetScenePresence(agent1); | ||
125 | presence2.AddAttachment(sog1); | ||
126 | presence2.AddAttachment(sog2); | ||
127 | |||
128 | ISharedRegionModule serialiser = new SerialiserModule(); | ||
129 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); | ||
130 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); | ||
131 | |||
132 | Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); | ||
133 | |||
134 | //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); | ||
135 | Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); | ||
136 | Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); | ||
137 | } | ||
138 | |||
139 | private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) | ||
140 | { | ||
141 | SceneObjectPart sop = new SceneObjectPart(); | ||
142 | sop.Name = RandomName(); | ||
143 | sop.Description = RandomName(); | ||
144 | sop.Text = RandomName(); | ||
145 | sop.SitName = RandomName(); | ||
146 | sop.TouchName = RandomName(); | ||
147 | sop.UUID = uuid; | ||
148 | sop.Shape = PrimitiveBaseShape.Default; | ||
149 | sop.Shape.State = 1; | ||
150 | sop.OwnerID = agent; | ||
151 | |||
152 | SceneObjectGroup sog = new SceneObjectGroup(sop); | ||
153 | sog.SetScene(scene); | ||
154 | |||
155 | return sog; | ||
156 | } | ||
157 | |||
158 | private static string RandomName() | ||
159 | { | ||
160 | StringBuilder name = new StringBuilder(); | ||
161 | int size = random.Next(5,12); | ||
162 | char ch; | ||
163 | for (int i = 0; i < size; i++) | ||
164 | { | ||
165 | ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; | ||
166 | name.Append(ch); | ||
167 | } | ||
168 | |||
169 | return name.ToString(); | ||
170 | } | ||
171 | } | ||
172 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs index 3a0dd00..ab6311b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
41 | [Test] | 41 | [Test] |
42 | public void TestCross() | 42 | public void TestCross() |
43 | { | 43 | { |
44 | TestHelper.InMethod(); | 44 | TestHelpers.InMethod(); |
45 | 45 | ||
46 | List<Border> testborders = new List<Border>(); | 46 | List<Border> testborders = new List<Border>(); |
47 | 47 | ||
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
99 | [Test] | 99 | [Test] |
100 | public void TestCrossSquare512() | 100 | public void TestCrossSquare512() |
101 | { | 101 | { |
102 | TestHelper.InMethod(); | 102 | TestHelpers.InMethod(); |
103 | 103 | ||
104 | List<Border> testborders = new List<Border>(); | 104 | List<Border> testborders = new List<Border>(); |
105 | 105 | ||
@@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
179 | [Test] | 179 | [Test] |
180 | public void TestCrossRectangle512x256() | 180 | public void TestCrossRectangle512x256() |
181 | { | 181 | { |
182 | TestHelper.InMethod(); | 182 | TestHelpers.InMethod(); |
183 | 183 | ||
184 | List<Border> testborders = new List<Border>(); | 184 | List<Border> testborders = new List<Border>(); |
185 | 185 | ||
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
259 | [Test] | 259 | [Test] |
260 | public void TestCrossOdd512x512w256hole() | 260 | public void TestCrossOdd512x512w256hole() |
261 | { | 261 | { |
262 | TestHelper.InMethod(); | 262 | TestHelpers.InMethod(); |
263 | 263 | ||
264 | List<Border> testborders = new List<Border>(); | 264 | List<Border> testborders = new List<Border>(); |
265 | // 512____ | 265 | // 512____ |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index f69a4b4..a5d2b23 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs | |||
@@ -45,12 +45,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
45 | { | 45 | { |
46 | static public Random random; | 46 | static public Random random; |
47 | SceneObjectGroup found; | 47 | SceneObjectGroup found; |
48 | Scene scene = SceneSetupHelpers.SetupScene(); | 48 | Scene scene = SceneHelpers.SetupScene(); |
49 | 49 | ||
50 | [Test] | 50 | [Test] |
51 | public void T010_AddObjects() | 51 | public void T010_AddObjects() |
52 | { | 52 | { |
53 | TestHelper.InMethod(); | 53 | TestHelpers.InMethod(); |
54 | 54 | ||
55 | random = new Random(); | 55 | random = new Random(); |
56 | SceneObjectGroup found; | 56 | SceneObjectGroup found; |
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
85 | [Test] | 85 | [Test] |
86 | public void T011_ThreadAddRemoveTest() | 86 | public void T011_ThreadAddRemoveTest() |
87 | { | 87 | { |
88 | TestHelper.InMethod(); | 88 | TestHelpers.InMethod(); |
89 | 89 | ||
90 | // This test adds and removes with mutiple threads, attempting to break the | 90 | // This test adds and removes with mutiple threads, attempting to break the |
91 | // uuid and localid dictionary coherence. | 91 | // uuid and localid dictionary coherence. |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 895f2bb..9a60e50 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -43,8 +43,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
43 | [Test] | 43 | [Test] |
44 | public void TestDuplicateObject() | 44 | public void TestDuplicateObject() |
45 | { | 45 | { |
46 | TestHelper.InMethod(); | 46 | TestHelpers.InMethod(); |
47 | Scene scene = SceneSetupHelpers.SetupScene(); | 47 | Scene scene = SceneHelpers.SetupScene(); |
48 | 48 | ||
49 | UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); | 49 | UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); |
50 | string part1Name = "part1"; | 50 | string part1Name = "part1"; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 0a82c4f..1ea2329 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -49,9 +49,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
49 | [Test] | 49 | [Test] |
50 | public void TestAddSceneObject() | 50 | public void TestAddSceneObject() |
51 | { | 51 | { |
52 | TestHelper.InMethod(); | 52 | TestHelpers.InMethod(); |
53 | 53 | ||
54 | Scene scene = SceneSetupHelpers.SetupScene(); | 54 | Scene scene = SceneHelpers.SetupScene(); |
55 | 55 | ||
56 | string objName = "obj1"; | 56 | string objName = "obj1"; |
57 | UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 57 | UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
@@ -76,9 +76,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
76 | /// </summary> | 76 | /// </summary> |
77 | public void TestAddExistingSceneObjectUuid() | 77 | public void TestAddExistingSceneObjectUuid() |
78 | { | 78 | { |
79 | TestHelper.InMethod(); | 79 | TestHelpers.InMethod(); |
80 | 80 | ||
81 | Scene scene = SceneSetupHelpers.SetupScene(); | 81 | Scene scene = SceneHelpers.SetupScene(); |
82 | 82 | ||
83 | string obj1Name = "Alfred"; | 83 | string obj1Name = "Alfred"; |
84 | string obj2Name = "Betty"; | 84 | string obj2Name = "Betty"; |
@@ -110,10 +110,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
110 | [Test] | 110 | [Test] |
111 | public void TestDeleteSceneObject() | 111 | public void TestDeleteSceneObject() |
112 | { | 112 | { |
113 | TestHelper.InMethod(); | 113 | TestHelpers.InMethod(); |
114 | 114 | ||
115 | TestScene scene = SceneSetupHelpers.SetupScene(); | 115 | TestScene scene = SceneHelpers.SetupScene(); |
116 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); | 116 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
117 | scene.DeleteSceneObject(part.ParentGroup, false); | 117 | scene.DeleteSceneObject(part.ParentGroup, false); |
118 | 118 | ||
119 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 119 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
@@ -126,20 +126,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
126 | [Test] | 126 | [Test] |
127 | public void TestDeleteSceneObjectAsync() | 127 | public void TestDeleteSceneObjectAsync() |
128 | { | 128 | { |
129 | TestHelper.InMethod(); | 129 | TestHelpers.InMethod(); |
130 | //log4net.Config.XmlConfigurator.Configure(); | 130 | //log4net.Config.XmlConfigurator.Configure(); |
131 | 131 | ||
132 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 132 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
133 | 133 | ||
134 | TestScene scene = SceneSetupHelpers.SetupScene(); | 134 | TestScene scene = SceneHelpers.SetupScene(); |
135 | 135 | ||
136 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | 136 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. |
137 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | 137 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; |
138 | sogd.Enabled = false; | 138 | sogd.Enabled = false; |
139 | 139 | ||
140 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); | 140 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
141 | 141 | ||
142 | IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); | 142 | IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; |
143 | scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); | 143 | scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); |
144 | 144 | ||
145 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 145 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 5357a06..654b1a2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -56,17 +56,17 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
56 | [Test] | 56 | [Test] |
57 | public void TestDeRezSceneObject() | 57 | public void TestDeRezSceneObject() |
58 | { | 58 | { |
59 | TestHelper.InMethod(); | 59 | TestHelpers.InMethod(); |
60 | // log4net.Config.XmlConfigurator.Configure(); | 60 | // log4net.Config.XmlConfigurator.Configure(); |
61 | 61 | ||
62 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | 62 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); |
63 | 63 | ||
64 | TestScene scene = SceneSetupHelpers.SetupScene(); | 64 | TestScene scene = SceneHelpers.SetupScene(); |
65 | IConfigSource configSource = new IniConfigSource(); | 65 | IConfigSource configSource = new IniConfigSource(); |
66 | IConfig config = configSource.AddConfig("Startup"); | 66 | IConfig config = configSource.AddConfig("Startup"); |
67 | config.Set("serverside_object_permissions", true); | 67 | config.Set("serverside_object_permissions", true); |
68 | SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); | 68 | SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); |
69 | TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); | 69 | IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; |
70 | 70 | ||
71 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | 71 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. |
72 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | 72 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; |
@@ -94,18 +94,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
94 | [Test] | 94 | [Test] |
95 | public void TestDeRezSceneObjectNotOwner() | 95 | public void TestDeRezSceneObjectNotOwner() |
96 | { | 96 | { |
97 | TestHelper.InMethod(); | 97 | TestHelpers.InMethod(); |
98 | // log4net.Config.XmlConfigurator.Configure(); | 98 | // log4net.Config.XmlConfigurator.Configure(); |
99 | 99 | ||
100 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | 100 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); |
101 | UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); | 101 | UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); |
102 | 102 | ||
103 | TestScene scene = SceneSetupHelpers.SetupScene(); | 103 | TestScene scene = SceneHelpers.SetupScene(); |
104 | IConfigSource configSource = new IniConfigSource(); | 104 | IConfigSource configSource = new IniConfigSource(); |
105 | IConfig config = configSource.AddConfig("Startup"); | 105 | IConfig config = configSource.AddConfig("Startup"); |
106 | config.Set("serverside_object_permissions", true); | 106 | config.Set("serverside_object_permissions", true); |
107 | SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); | 107 | SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); |
108 | TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); | 108 | IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; |
109 | 109 | ||
110 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | 110 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. |
111 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | 111 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index cb1d531..2912a46 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -50,14 +50,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
50 | [Test] | 50 | [Test] |
51 | public void TestLinkDelink2SceneObjects() | 51 | public void TestLinkDelink2SceneObjects() |
52 | { | 52 | { |
53 | TestHelper.InMethod(); | 53 | TestHelpers.InMethod(); |
54 | 54 | ||
55 | bool debugtest = false; | 55 | bool debugtest = false; |
56 | 56 | ||
57 | Scene scene = SceneSetupHelpers.SetupScene(); | 57 | Scene scene = SceneHelpers.SetupScene(); |
58 | SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); | 58 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); |
59 | SceneObjectGroup grp1 = part1.ParentGroup; | 59 | SceneObjectGroup grp1 = part1.ParentGroup; |
60 | SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); | 60 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); |
61 | SceneObjectGroup grp2 = part2.ParentGroup; | 61 | SceneObjectGroup grp2 = part2.ParentGroup; |
62 | 62 | ||
63 | grp1.AbsolutePosition = new Vector3(10, 10, 10); | 63 | grp1.AbsolutePosition = new Vector3(10, 10, 10); |
@@ -132,18 +132,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
132 | [Test] | 132 | [Test] |
133 | public void TestLinkDelink2groups4SceneObjects() | 133 | public void TestLinkDelink2groups4SceneObjects() |
134 | { | 134 | { |
135 | TestHelper.InMethod(); | 135 | TestHelpers.InMethod(); |
136 | 136 | ||
137 | bool debugtest = false; | 137 | bool debugtest = false; |
138 | 138 | ||
139 | Scene scene = SceneSetupHelpers.SetupScene(); | 139 | Scene scene = SceneHelpers.SetupScene(); |
140 | SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); | 140 | SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); |
141 | SceneObjectGroup grp1 = part1.ParentGroup; | 141 | SceneObjectGroup grp1 = part1.ParentGroup; |
142 | SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); | 142 | SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); |
143 | SceneObjectGroup grp2 = part2.ParentGroup; | 143 | SceneObjectGroup grp2 = part2.ParentGroup; |
144 | SceneObjectPart part3 = SceneSetupHelpers.AddSceneObject(scene); | 144 | SceneObjectPart part3 = SceneHelpers.AddSceneObject(scene); |
145 | SceneObjectGroup grp3 = part3.ParentGroup; | 145 | SceneObjectGroup grp3 = part3.ParentGroup; |
146 | SceneObjectPart part4 = SceneSetupHelpers.AddSceneObject(scene); | 146 | SceneObjectPart part4 = SceneHelpers.AddSceneObject(scene); |
147 | SceneObjectGroup grp4 = part4.ParentGroup; | 147 | SceneObjectGroup grp4 = part4.ParentGroup; |
148 | 148 | ||
149 | grp1.AbsolutePosition = new Vector3(10, 10, 10); | 149 | grp1.AbsolutePosition = new Vector3(10, 10, 10); |
@@ -266,10 +266,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
266 | [Test] | 266 | [Test] |
267 | public void TestNewSceneObjectLinkPersistence() | 267 | public void TestNewSceneObjectLinkPersistence() |
268 | { | 268 | { |
269 | TestHelper.InMethod(); | 269 | TestHelpers.InMethod(); |
270 | //log4net.Config.XmlConfigurator.Configure(); | 270 | //log4net.Config.XmlConfigurator.Configure(); |
271 | 271 | ||
272 | TestScene scene = SceneSetupHelpers.SetupScene(); | 272 | TestScene scene = SceneHelpers.SetupScene(); |
273 | 273 | ||
274 | string rootPartName = "rootpart"; | 274 | string rootPartName = "rootpart"; |
275 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 275 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
@@ -305,10 +305,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
305 | [Test] | 305 | [Test] |
306 | public void TestDelinkPersistence() | 306 | public void TestDelinkPersistence() |
307 | { | 307 | { |
308 | TestHelper.InMethod(); | 308 | TestHelpers.InMethod(); |
309 | //log4net.Config.XmlConfigurator.Configure(); | 309 | //log4net.Config.XmlConfigurator.Configure(); |
310 | 310 | ||
311 | TestScene scene = SceneSetupHelpers.SetupScene(); | 311 | TestScene scene = SceneHelpers.SetupScene(); |
312 | 312 | ||
313 | string rootPartName = "rootpart"; | 313 | string rootPartName = "rootpart"; |
314 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 314 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs new file mode 100644 index 0000000..b49c6e7 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using NUnit.Framework; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Communications; | ||
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | using OpenSim.Tests.Common; | ||
36 | using OpenSim.Tests.Common.Mock; | ||
37 | |||
38 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Basic scene object resize tests | ||
42 | /// </summary> | ||
43 | [TestFixture] | ||
44 | public class SceneObjectResizeTests | ||
45 | { | ||
46 | /// <summary> | ||
47 | /// Test resizing an object | ||
48 | /// </summary> | ||
49 | [Test] | ||
50 | public void TestResizeSceneObject() | ||
51 | { | ||
52 | TestHelpers.InMethod(); | ||
53 | // log4net.Config.XmlConfigurator.Configure(); | ||
54 | |||
55 | Scene scene = SceneHelpers.SetupScene(); | ||
56 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup; | ||
57 | |||
58 | g1.GroupResize(new Vector3(2, 3, 4)); | ||
59 | |||
60 | SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID); | ||
61 | |||
62 | Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2)); | ||
63 | Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3)); | ||
64 | Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4)); | ||
65 | |||
66 | Assert.That(g1Post.RootPart.UndoCount, Is.EqualTo(1)); | ||
67 | } | ||
68 | |||
69 | /// <summary> | ||
70 | /// Test resizing an individual part in a scene object. | ||
71 | /// </summary> | ||
72 | [Test] | ||
73 | public void TestResizeSceneObjectPart() | ||
74 | { | ||
75 | TestHelpers.InMethod(); | ||
76 | //log4net.Config.XmlConfigurator.Configure(); | ||
77 | |||
78 | Scene scene = SceneHelpers.SetupScene(); | ||
79 | |||
80 | SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero); | ||
81 | g1.RootPart.Scale = new Vector3(2, 3, 4); | ||
82 | g1.Parts[1].Scale = new Vector3(5, 6, 7); | ||
83 | |||
84 | scene.AddSceneObject(g1); | ||
85 | |||
86 | SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID); | ||
87 | |||
88 | g1Post.Parts[1].Resize(new Vector3(8, 9, 10)); | ||
89 | |||
90 | SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID); | ||
91 | |||
92 | SceneObjectPart g1RootPart = g1PostPost.RootPart; | ||
93 | SceneObjectPart g1ChildPart = g1PostPost.Parts[1]; | ||
94 | |||
95 | Assert.That(g1RootPart.Scale.X, Is.EqualTo(2)); | ||
96 | Assert.That(g1RootPart.Scale.Y, Is.EqualTo(3)); | ||
97 | Assert.That(g1RootPart.Scale.Z, Is.EqualTo(4)); | ||
98 | |||
99 | Assert.That(g1ChildPart.Scale.X, Is.EqualTo(8)); | ||
100 | Assert.That(g1ChildPart.Scale.Y, Is.EqualTo(9)); | ||
101 | Assert.That(g1ChildPart.Scale.Z, Is.EqualTo(10)); | ||
102 | } | ||
103 | } | ||
104 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs new file mode 100644 index 0000000..2a342d5 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using NUnit.Framework; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Communications; | ||
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | using OpenSim.Tests.Common; | ||
36 | using OpenSim.Tests.Common.Mock; | ||
37 | |||
38 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Basic scene object status tests | ||
42 | /// </summary> | ||
43 | [TestFixture] | ||
44 | public class SceneObjectStatusTests | ||
45 | { | ||
46 | [Test] | ||
47 | public void TestSetPhantom() | ||
48 | { | ||
49 | TestHelpers.InMethod(); | ||
50 | |||
51 | // Scene scene = SceneSetupHelpers.SetupScene(); | ||
52 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero); | ||
53 | SceneObjectPart rootPart = so.RootPart; | ||
54 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
55 | |||
56 | so.ScriptSetPhantomStatus(true); | ||
57 | |||
58 | // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); | ||
59 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); | ||
60 | |||
61 | so.ScriptSetPhantomStatus(false); | ||
62 | |||
63 | Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
64 | } | ||
65 | } | ||
66 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index 77bd4c2..c13d82e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs | |||
@@ -53,12 +53,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
53 | [Test] | 53 | [Test] |
54 | public void TestShareWithGroup() | 54 | public void TestShareWithGroup() |
55 | { | 55 | { |
56 | TestHelper.InMethod(); | 56 | TestHelpers.InMethod(); |
57 | // log4net.Config.XmlConfigurator.Configure(); | 57 | // log4net.Config.XmlConfigurator.Configure(); |
58 | 58 | ||
59 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | 59 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); |
60 | 60 | ||
61 | TestScene scene = SceneSetupHelpers.SetupScene(); | 61 | TestScene scene = SceneHelpers.SetupScene(); |
62 | IConfigSource configSource = new IniConfigSource(); | 62 | IConfigSource configSource = new IniConfigSource(); |
63 | 63 | ||
64 | IConfig startupConfig = configSource.AddConfig("Startup"); | 64 | IConfig startupConfig = configSource.AddConfig("Startup"); |
@@ -69,13 +69,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
69 | groupsConfig.Set("Module", "GroupsModule"); | 69 | groupsConfig.Set("Module", "GroupsModule"); |
70 | groupsConfig.Set("DebugEnabled", true); | 70 | groupsConfig.Set("DebugEnabled", true); |
71 | 71 | ||
72 | SceneSetupHelpers.SetupSceneModules( | 72 | SceneHelpers.SetupSceneModules( |
73 | scene, configSource, new object[] | 73 | scene, configSource, new object[] |
74 | { new PermissionsModule(), | 74 | { new PermissionsModule(), |
75 | new GroupsModule(), | 75 | new GroupsModule(), |
76 | new MockGroupsServicesConnector() }); | 76 | new MockGroupsServicesConnector() }); |
77 | 77 | ||
78 | TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); | 78 | IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; |
79 | 79 | ||
80 | IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>(); | 80 | IGroupsModule groupsModule = scene.RequestModuleInterface<IGroupsModule>(); |
81 | 81 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 03ac252..ce9d418 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
51 | /// Scene presence tests | 51 | /// Scene presence tests |
52 | /// </summary> | 52 | /// </summary> |
53 | [TestFixture] | 53 | [TestFixture] |
54 | public class ScenePresenceTests | 54 | public class ScenePresenceAgentTests |
55 | { | 55 | { |
56 | public Scene scene, scene2, scene3; | 56 | public Scene scene, scene2, scene3; |
57 | public UUID agent1, agent2, agent3; | 57 | public UUID agent1, agent2, agent3; |
@@ -64,90 +64,140 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
64 | [TestFixtureSetUp] | 64 | [TestFixtureSetUp] |
65 | public void Init() | 65 | public void Init() |
66 | { | 66 | { |
67 | TestHelper.InMethod(); | 67 | TestHelpers.InMethod(); |
68 | 68 | ||
69 | scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); | 69 | scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); |
70 | scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); | 70 | scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); |
71 | scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); | 71 | scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); |
72 | 72 | ||
73 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | 73 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); |
74 | interregionComms.Initialise(new IniConfigSource()); | 74 | interregionComms.Initialise(new IniConfigSource()); |
75 | interregionComms.PostInitialise(); | 75 | interregionComms.PostInitialise(); |
76 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); | 76 | SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); |
77 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); | 77 | SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); |
78 | SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); | 78 | SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); |
79 | 79 | ||
80 | agent1 = UUID.Random(); | 80 | agent1 = UUID.Random(); |
81 | agent2 = UUID.Random(); | 81 | agent2 = UUID.Random(); |
82 | agent3 = UUID.Random(); | 82 | agent3 = UUID.Random(); |
83 | random = new Random(); | 83 | random = new Random(); |
84 | sog1 = NewSOG(UUID.Random(), scene, agent1); | 84 | sog1 = SceneHelpers.CreateSceneObject(1, agent1); |
85 | sog2 = NewSOG(UUID.Random(), scene, agent1); | 85 | scene.AddSceneObject(sog1); |
86 | sog3 = NewSOG(UUID.Random(), scene, agent1); | 86 | sog2 = SceneHelpers.CreateSceneObject(1, agent1); |
87 | scene.AddSceneObject(sog2); | ||
88 | sog3 = SceneHelpers.CreateSceneObject(1, agent1); | ||
89 | scene.AddSceneObject(sog3); | ||
87 | 90 | ||
88 | //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | ||
89 | region1 = scene.RegionInfo.RegionHandle; | 91 | region1 = scene.RegionInfo.RegionHandle; |
90 | region2 = scene2.RegionInfo.RegionHandle; | 92 | region2 = scene2.RegionInfo.RegionHandle; |
91 | region3 = scene3.RegionInfo.RegionHandle; | 93 | region3 = scene3.RegionInfo.RegionHandle; |
92 | } | 94 | } |
93 | 95 | ||
94 | /// <summary> | ||
95 | /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. | ||
96 | /// </summary> | ||
97 | [Test] | 96 | [Test] |
98 | public void T010_TestAddRootAgent() | 97 | public void TestCloseAgent() |
99 | { | 98 | { |
100 | TestHelper.InMethod(); | 99 | TestHelpers.InMethod(); |
101 | 100 | // log4net.Config.XmlConfigurator.Configure(); | |
102 | string firstName = "testfirstname"; | ||
103 | |||
104 | AgentCircuitData agent = new AgentCircuitData(); | ||
105 | agent.AgentID = agent1; | ||
106 | agent.firstname = firstName; | ||
107 | agent.lastname = "testlastname"; | ||
108 | agent.SessionID = UUID.Random(); | ||
109 | agent.SecureSessionID = UUID.Random(); | ||
110 | agent.circuitcode = 123; | ||
111 | agent.BaseFolder = UUID.Zero; | ||
112 | agent.InventoryFolder = UUID.Zero; | ||
113 | agent.startpos = Vector3.Zero; | ||
114 | agent.CapsPath = GetRandomCapsObjectPath(); | ||
115 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); | ||
116 | agent.child = true; | ||
117 | 101 | ||
118 | scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); | 102 | TestScene scene = SceneHelpers.SetupScene(); |
103 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | ||
119 | 104 | ||
120 | string reason; | 105 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); |
121 | scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); | ||
122 | testclient = new TestClient(agent, scene); | ||
123 | scene.AddNewClient(testclient); | ||
124 | 106 | ||
125 | ScenePresence presence = scene.GetScenePresence(agent1); | 107 | scene.IncomingCloseAgent(sp.UUID); |
126 | 108 | ||
127 | Assert.That(presence, Is.Not.Null, "presence is null"); | 109 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); |
128 | Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); | 110 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); |
129 | acd1 = agent; | ||
130 | } | 111 | } |
131 | 112 | ||
132 | /// <summary> | 113 | /// <summary> |
133 | /// Test removing an uncrossed root agent from a scene. | 114 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region |
134 | /// </summary> | 115 | /// </summary> |
116 | /// <remarks> | ||
117 | /// Please note that unlike the other tests here, this doesn't rely on structures | ||
118 | /// </remarks> | ||
135 | [Test] | 119 | [Test] |
136 | public void T011_TestRemoveRootAgent() | 120 | public void TestChildAgentEstablished() |
137 | { | 121 | { |
138 | TestHelper.InMethod(); | 122 | TestHelpers.InMethod(); |
139 | 123 | // log4net.Config.XmlConfigurator.Configure(); | |
140 | scene.RemoveClient(agent1); | 124 | |
141 | 125 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); | |
142 | ScenePresence presence = scene.GetScenePresence(agent1); | 126 | |
127 | TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); | ||
128 | // TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); | ||
129 | |||
130 | IConfigSource configSource = new IniConfigSource(); | ||
131 | configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); | ||
132 | EntityTransferModule etm = new EntityTransferModule(); | ||
133 | |||
134 | SceneHelpers.SetupSceneModules(myScene1, configSource, etm); | ||
135 | |||
136 | SceneHelpers.AddScenePresence(myScene1, agent1Id); | ||
137 | // ScenePresence childPresence = myScene2.GetScenePresence(agent1); | ||
143 | 138 | ||
144 | Assert.That(presence, Is.Null, "presence is not null"); | 139 | // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents |
140 | // Assert.That(childPresence, Is.Not.Null); | ||
141 | // Assert.That(childPresence.IsChildAgent, Is.True); | ||
145 | } | 142 | } |
146 | 143 | ||
144 | // /// <summary> | ||
145 | // /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. | ||
146 | // /// </summary> | ||
147 | // [Test] | ||
148 | // public void T010_TestAddRootAgent() | ||
149 | // { | ||
150 | // TestHelpers.InMethod(); | ||
151 | // | ||
152 | // string firstName = "testfirstname"; | ||
153 | // | ||
154 | // AgentCircuitData agent = new AgentCircuitData(); | ||
155 | // agent.AgentID = agent1; | ||
156 | // agent.firstname = firstName; | ||
157 | // agent.lastname = "testlastname"; | ||
158 | // agent.SessionID = UUID.Random(); | ||
159 | // agent.SecureSessionID = UUID.Random(); | ||
160 | // agent.circuitcode = 123; | ||
161 | // agent.BaseFolder = UUID.Zero; | ||
162 | // agent.InventoryFolder = UUID.Zero; | ||
163 | // agent.startpos = Vector3.Zero; | ||
164 | // agent.CapsPath = GetRandomCapsObjectPath(); | ||
165 | // agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); | ||
166 | // agent.child = true; | ||
167 | // | ||
168 | // scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); | ||
169 | // | ||
170 | // string reason; | ||
171 | // scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); | ||
172 | // testclient = new TestClient(agent, scene); | ||
173 | // scene.AddNewClient(testclient); | ||
174 | // | ||
175 | // ScenePresence presence = scene.GetScenePresence(agent1); | ||
176 | // | ||
177 | // Assert.That(presence, Is.Not.Null, "presence is null"); | ||
178 | // Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); | ||
179 | // acd1 = agent; | ||
180 | // } | ||
181 | // | ||
182 | // /// <summary> | ||
183 | // /// Test removing an uncrossed root agent from a scene. | ||
184 | // /// </summary> | ||
185 | // [Test] | ||
186 | // public void T011_TestRemoveRootAgent() | ||
187 | // { | ||
188 | // TestHelpers.InMethod(); | ||
189 | // | ||
190 | // scene.RemoveClient(agent1); | ||
191 | // | ||
192 | // ScenePresence presence = scene.GetScenePresence(agent1); | ||
193 | // | ||
194 | // Assert.That(presence, Is.Null, "presence is not null"); | ||
195 | // } | ||
196 | |||
147 | [Test] | 197 | [Test] |
148 | public void T012_TestAddNeighbourRegion() | 198 | public void T012_TestAddNeighbourRegion() |
149 | { | 199 | { |
150 | TestHelper.InMethod(); | 200 | TestHelpers.InMethod(); |
151 | 201 | ||
152 | string reason; | 202 | string reason; |
153 | 203 | ||
@@ -157,7 +207,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
157 | scene.NewUserConnection(acd1, 0, out reason); | 207 | scene.NewUserConnection(acd1, 0, out reason); |
158 | if (testclient == null) | 208 | if (testclient == null) |
159 | testclient = new TestClient(acd1, scene); | 209 | testclient = new TestClient(acd1, scene); |
160 | scene.AddNewClient(testclient); | 210 | scene.AddNewClient(testclient, PresenceType.User); |
161 | 211 | ||
162 | ScenePresence presence = scene.GetScenePresence(agent1); | 212 | ScenePresence presence = scene.GetScenePresence(agent1); |
163 | presence.MakeRootAgent(new Vector3(90,90,90),false); | 213 | presence.MakeRootAgent(new Vector3(90,90,90),false); |
@@ -175,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
175 | [Test] | 225 | [Test] |
176 | public void T013_TestRemoveNeighbourRegion() | 226 | public void T013_TestRemoveNeighbourRegion() |
177 | { | 227 | { |
178 | TestHelper.InMethod(); | 228 | TestHelpers.InMethod(); |
179 | 229 | ||
180 | ScenePresence presence = scene.GetScenePresence(agent1); | 230 | ScenePresence presence = scene.GetScenePresence(agent1); |
181 | presence.RemoveNeighbourRegion(region3); | 231 | presence.RemoveNeighbourRegion(region3); |
@@ -188,37 +238,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
188 | CompleteAvatarMovement | 238 | CompleteAvatarMovement |
189 | */ | 239 | */ |
190 | } | 240 | } |
191 | |||
192 | /// <summary> | ||
193 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region | ||
194 | /// </summary> | ||
195 | /// <remarks> | ||
196 | /// Please note that unlike the other tests here, this doesn't rely on structures | ||
197 | /// </remarks> | ||
198 | [Test] | ||
199 | public void TestChildAgentEstablished() | ||
200 | { | ||
201 | TestHelper.InMethod(); | ||
202 | // log4net.Config.XmlConfigurator.Configure(); | ||
203 | |||
204 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
205 | |||
206 | TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); | ||
207 | TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); | ||
208 | |||
209 | IConfigSource configSource = new IniConfigSource(); | ||
210 | configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); | ||
211 | EntityTransferModule etm = new EntityTransferModule(); | ||
212 | |||
213 | SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm); | ||
214 | |||
215 | SceneSetupHelpers.AddRootAgent(myScene1, agent1Id); | ||
216 | ScenePresence childPresence = myScene2.GetScenePresence(agent1); | ||
217 | |||
218 | // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents | ||
219 | // Assert.That(childPresence, Is.Not.Null); | ||
220 | // Assert.That(childPresence.IsChildAgent, Is.True); | ||
221 | } | ||
222 | 241 | ||
223 | // I'm commenting this test because it does not represent | 242 | // I'm commenting this test because it does not represent |
224 | // crossings. The Thread.Sleep's in here are not meaningful mocks, | 243 | // crossings. The Thread.Sleep's in here are not meaningful mocks, |
@@ -230,7 +249,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
230 | //[Test] | 249 | //[Test] |
231 | public void T021_TestCrossToNewRegion() | 250 | public void T021_TestCrossToNewRegion() |
232 | { | 251 | { |
233 | TestHelper.InMethod(); | 252 | TestHelpers.InMethod(); |
234 | 253 | ||
235 | scene.RegisterRegionWithGrid(); | 254 | scene.RegisterRegionWithGrid(); |
236 | scene2.RegisterRegionWithGrid(); | 255 | scene2.RegisterRegionWithGrid(); |
@@ -238,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
238 | // Adding child agent to region 1001 | 257 | // Adding child agent to region 1001 |
239 | string reason; | 258 | string reason; |
240 | scene2.NewUserConnection(acd1,0, out reason); | 259 | scene2.NewUserConnection(acd1,0, out reason); |
241 | scene2.AddNewClient(testclient); | 260 | scene2.AddNewClient(testclient, PresenceType.User); |
242 | 261 | ||
243 | ScenePresence presence = scene.GetScenePresence(agent1); | 262 | ScenePresence presence = scene.GetScenePresence(agent1); |
244 | presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); | 263 | presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); |
@@ -338,6 +357,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
338 | agent.InventoryFolder = UUID.Zero; | 357 | agent.InventoryFolder = UUID.Zero; |
339 | agent.startpos = Vector3.Zero; | 358 | agent.startpos = Vector3.Zero; |
340 | agent.CapsPath = GetRandomCapsObjectPath(); | 359 | agent.CapsPath = GetRandomCapsObjectPath(); |
360 | agent.Appearance = new AvatarAppearance(); | ||
341 | 361 | ||
342 | acd1 = agent; | 362 | acd1 = agent; |
343 | } | 363 | } |
@@ -349,37 +369,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
349 | capsPath = capsPath.Remove(capsPath.Length - 4, 4); | 369 | capsPath = capsPath.Remove(capsPath.Length - 4, 4); |
350 | return capsPath; | 370 | return capsPath; |
351 | } | 371 | } |
352 | |||
353 | private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) | ||
354 | { | ||
355 | SceneObjectPart sop = new SceneObjectPart(); | ||
356 | sop.Name = RandomName(); | ||
357 | sop.Description = RandomName(); | ||
358 | sop.Text = RandomName(); | ||
359 | sop.SitName = RandomName(); | ||
360 | sop.TouchName = RandomName(); | ||
361 | sop.UUID = uuid; | ||
362 | sop.Shape = PrimitiveBaseShape.Default; | ||
363 | sop.Shape.State = 1; | ||
364 | sop.OwnerID = agent; | ||
365 | |||
366 | SceneObjectGroup sog = new SceneObjectGroup(sop); | ||
367 | sog.SetScene(scene); | ||
368 | |||
369 | return sog; | ||
370 | } | ||
371 | |||
372 | private static string RandomName() | ||
373 | { | ||
374 | StringBuilder name = new StringBuilder(); | ||
375 | int size = random.Next(5,12); | ||
376 | char ch ; | ||
377 | for (int i=0; i<size; i++) | ||
378 | { | ||
379 | ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; | ||
380 | name.Append(ch); | ||
381 | } | ||
382 | return name.ToString(); | ||
383 | } | ||
384 | } | 372 | } |
385 | } \ No newline at end of file | 373 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 1b5a54e..39bb43a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
44 | /// Teleport tests in a standalone OpenSim | 44 | /// Teleport tests in a standalone OpenSim |
45 | /// </summary> | 45 | /// </summary> |
46 | [TestFixture] | 46 | [TestFixture] |
47 | public class StandaloneTeleportTests | 47 | public class ScenePresenceTeleportTests |
48 | { | 48 | { |
49 | /// <summary> | 49 | /// <summary> |
50 | /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. | 50 | /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. |
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
54 | //[Test, LongRunning] | 54 | //[Test, LongRunning] |
55 | public void TestSimpleNotNeighboursTeleport() | 55 | public void TestSimpleNotNeighboursTeleport() |
56 | { | 56 | { |
57 | TestHelper.InMethod(); | 57 | TestHelpers.InMethod(); |
58 | ThreadRunResults results = new ThreadRunResults(); | 58 | ThreadRunResults results = new ThreadRunResults(); |
59 | results.Result = false; | 59 | results.Result = false; |
60 | results.Message = "Test did not run"; | 60 | results.Message = "Test did not run"; |
@@ -116,16 +116,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
116 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | 116 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); |
117 | 117 | ||
118 | 118 | ||
119 | Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); | 119 | Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); |
120 | SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); | 120 | SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); |
121 | sceneB.RegisterRegionWithGrid(); | 121 | sceneB.RegisterRegionWithGrid(); |
122 | 122 | ||
123 | Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); | 123 | Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); |
124 | SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); | 124 | SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); |
125 | sceneA.RegisterRegionWithGrid(); | 125 | sceneA.RegisterRegionWithGrid(); |
126 | 126 | ||
127 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); | 127 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); |
128 | TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); | 128 | TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient; |
129 | 129 | ||
130 | ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); | 130 | ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); |
131 | 131 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 13d93f9..8b8aea5 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -58,9 +58,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
58 | [Test] | 58 | [Test] |
59 | public void TestUpdateScene() | 59 | public void TestUpdateScene() |
60 | { | 60 | { |
61 | TestHelper.InMethod(); | 61 | TestHelpers.InMethod(); |
62 | 62 | ||
63 | Scene scene = SceneSetupHelpers.SetupScene(); | 63 | Scene scene = SceneHelpers.SetupScene(); |
64 | scene.Update(); | 64 | scene.Update(); |
65 | 65 | ||
66 | Assert.That(scene.Frame, Is.EqualTo(1)); | 66 | Assert.That(scene.Frame, Is.EqualTo(1)); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index f4e14d4..1abef8d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -55,12 +55,12 @@ namespace OpenSim.Region.Framework.Tests | |||
55 | [Test] | 55 | [Test] |
56 | public void TestRezObjectFromInventoryItem() | 56 | public void TestRezObjectFromInventoryItem() |
57 | { | 57 | { |
58 | TestHelper.InMethod(); | 58 | TestHelpers.InMethod(); |
59 | // log4net.Config.XmlConfigurator.Configure(); | 59 | // log4net.Config.XmlConfigurator.Configure(); |
60 | 60 | ||
61 | Scene scene = SceneSetupHelpers.SetupScene(); | 61 | Scene scene = SceneHelpers.SetupScene(); |
62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
63 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); | 63 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
64 | SceneObjectPart sop1 = sog1.RootPart; | 64 | SceneObjectPart sop1 = sog1.RootPart; |
65 | 65 | ||
66 | // Create an object embedded inside the first | 66 | // Create an object embedded inside the first |
@@ -98,12 +98,12 @@ namespace OpenSim.Region.Framework.Tests | |||
98 | [Test] | 98 | [Test] |
99 | public void TestMoveTaskInventoryItem() | 99 | public void TestMoveTaskInventoryItem() |
100 | { | 100 | { |
101 | TestHelper.InMethod(); | 101 | TestHelpers.InMethod(); |
102 | // log4net.Config.XmlConfigurator.Configure(); | 102 | // log4net.Config.XmlConfigurator.Configure(); |
103 | 103 | ||
104 | Scene scene = SceneSetupHelpers.SetupScene(); | 104 | Scene scene = SceneHelpers.SetupScene(); |
105 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 105 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
106 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); | 106 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
107 | SceneObjectPart sop1 = sog1.RootPart; | 107 | SceneObjectPart sop1 = sog1.RootPart; |
108 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); | 108 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); |
109 | 109 | ||
@@ -125,12 +125,12 @@ namespace OpenSim.Region.Framework.Tests | |||
125 | [Test] | 125 | [Test] |
126 | public void TestMoveTaskInventoryItemNoParent() | 126 | public void TestMoveTaskInventoryItemNoParent() |
127 | { | 127 | { |
128 | TestHelper.InMethod(); | 128 | TestHelpers.InMethod(); |
129 | // log4net.Config.XmlConfigurator.Configure(); | 129 | // log4net.Config.XmlConfigurator.Configure(); |
130 | 130 | ||
131 | Scene scene = SceneSetupHelpers.SetupScene(); | 131 | Scene scene = SceneHelpers.SetupScene(); |
132 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); | 132 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); |
133 | SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); | 133 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); |
134 | SceneObjectPart sop1 = sog1.RootPart; | 134 | SceneObjectPart sop1 = sog1.RootPart; |
135 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); | 135 | TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); |
136 | 136 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index abca792..55fc1e7 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | |||
@@ -55,12 +55,12 @@ namespace OpenSim.Region.Framework.Tests | |||
55 | [Test] | 55 | [Test] |
56 | public void TestGiveInventoryItem() | 56 | public void TestGiveInventoryItem() |
57 | { | 57 | { |
58 | TestHelper.InMethod(); | 58 | TestHelpers.InMethod(); |
59 | // log4net.Config.XmlConfigurator.Configure(); | 59 | // log4net.Config.XmlConfigurator.Configure(); |
60 | 60 | ||
61 | Scene scene = SceneSetupHelpers.SetupScene(); | 61 | Scene scene = SceneHelpers.SetupScene(); |
62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); | 62 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
63 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); | 63 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
64 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); | 64 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); |
65 | 65 | ||
66 | scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); | 66 | scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); |
@@ -82,12 +82,12 @@ namespace OpenSim.Region.Framework.Tests | |||
82 | [Test] | 82 | [Test] |
83 | public void TestGiveInventoryFolder() | 83 | public void TestGiveInventoryFolder() |
84 | { | 84 | { |
85 | TestHelper.InMethod(); | 85 | TestHelpers.InMethod(); |
86 | // log4net.Config.XmlConfigurator.Configure(); | 86 | // log4net.Config.XmlConfigurator.Configure(); |
87 | 87 | ||
88 | Scene scene = SceneSetupHelpers.SetupScene(); | 88 | Scene scene = SceneHelpers.SetupScene(); |
89 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); | 89 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |
90 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); | 90 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
91 | InventoryFolderBase folder1 | 91 | InventoryFolderBase folder1 |
92 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); | 92 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); |
93 | 93 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 4da8df1..24de56e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
47 | public void Init() | 47 | public void Init() |
48 | { | 48 | { |
49 | // FIXME: We don't need a full scene here - it would be enough to set up the asset service. | 49 | // FIXME: We don't need a full scene here - it would be enough to set up the asset service. |
50 | Scene scene = SceneSetupHelpers.SetupScene(); | 50 | Scene scene = SceneHelpers.SetupScene(); |
51 | m_assetService = scene.AssetService; | 51 | m_assetService = scene.AssetService; |
52 | m_uuidGatherer = new UuidGatherer(m_assetService); | 52 | m_uuidGatherer = new UuidGatherer(m_assetService); |
53 | } | 53 | } |
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
55 | [Test] | 55 | [Test] |
56 | public void TestCorruptAsset() | 56 | public void TestCorruptAsset() |
57 | { | 57 | { |
58 | TestHelper.InMethod(); | 58 | TestHelpers.InMethod(); |
59 | 59 | ||
60 | UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); | 60 | UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); |
61 | AssetBase corruptAsset | 61 | AssetBase corruptAsset |
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
75 | [Test] | 75 | [Test] |
76 | public void TestMissingAsset() | 76 | public void TestMissingAsset() |
77 | { | 77 | { |
78 | TestHelper.InMethod(); | 78 | TestHelpers.InMethod(); |
79 | 79 | ||
80 | UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); | 80 | UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); |
81 | IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>(); | 81 | IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>(); |
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index f71b507..81f41db 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs | |||
@@ -25,6 +25,9 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
28 | using OpenMetaverse; | 31 | using OpenMetaverse; |
29 | using OpenSim.Region.Framework.Interfaces; | 32 | using OpenSim.Region.Framework.Interfaces; |
30 | using System; | 33 | using System; |
@@ -47,6 +50,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
47 | 50 | ||
48 | public class UndoState | 51 | public class UndoState |
49 | { | 52 | { |
53 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
54 | |||
50 | public Vector3 Position = Vector3.Zero; | 55 | public Vector3 Position = Vector3.Zero; |
51 | public Vector3 Scale = Vector3.Zero; | 56 | public Vector3 Scale = Vector3.Zero; |
52 | public Quaternion Rotation = Quaternion.Identity; | 57 | public Quaternion Rotation = Quaternion.Identity; |
@@ -56,13 +61,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
56 | public DateTime LastUpdated = DateTime.Now; | 61 | public DateTime LastUpdated = DateTime.Now; |
57 | public UndoType Type; | 62 | public UndoType Type; |
58 | 63 | ||
59 | public UndoState(SceneObjectPart part, UndoType type) | 64 | /// <summary> |
65 | /// Is this undo state for an entire group? | ||
66 | /// </summary> | ||
67 | public bool ForGroup; | ||
68 | |||
69 | /// <summary> | ||
70 | /// Constructor. | ||
71 | /// </summary> | ||
72 | /// <param name="part"></param> | ||
73 | /// <param name="forGroup">True if the undo is for an entire group</param> | ||
74 | public UndoState(SceneObjectPart part, bool forGroup) | ||
60 | { | 75 | { |
61 | Type = type; | 76 | if (part.ParentID == 0) |
62 | if (part != null) | ||
63 | { | 77 | { |
64 | if (part.ParentID == 0) | 78 | ForGroup = forGroup; |
65 | { | 79 | |
80 | // if (ForGroup) | ||
66 | GroupScale = part.ParentGroup.RootPart.Shape.Scale; | 81 | GroupScale = part.ParentGroup.RootPart.Shape.Scale; |
67 | 82 | ||
68 | //FUBAR WARNING: Do NOT get the group's absoluteposition here | 83 | //FUBAR WARNING: Do NOT get the group's absoluteposition here |
@@ -70,23 +85,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
70 | GroupPosition = part.ParentGroup.RootPart.AbsolutePosition; | 85 | GroupPosition = part.ParentGroup.RootPart.AbsolutePosition; |
71 | GroupRotation = part.ParentGroup.GroupRotation; | 86 | GroupRotation = part.ParentGroup.GroupRotation; |
72 | Position = part.ParentGroup.RootPart.AbsolutePosition; | 87 | Position = part.ParentGroup.RootPart.AbsolutePosition; |
73 | Rotation = part.RotationOffset; | 88 | // else |
74 | Scale = part.Shape.Scale; | 89 | // Position = part.OffsetPosition; |
75 | LastUpdated = DateTime.Now; | ||
76 | } | ||
77 | else | ||
78 | { | ||
79 | GroupScale = part.Shape.Scale; | ||
80 | 90 | ||
81 | //FUBAR WARNING: Do NOT get the group's absoluteposition here | 91 | // m_log.DebugFormat( |
82 | //or you'll experience a loop and/or a stack issue | 92 | // "[UNDO STATE]: Storing undo position {0} for root part", Position); |
83 | GroupPosition = part.ParentGroup.RootPart.AbsolutePosition; | 93 | |
84 | GroupRotation = part.ParentGroup.Rotation; | 94 | Rotation = part.RotationOffset; |
85 | Position = part.OffsetPosition; | 95 | |
86 | Rotation = part.RotationOffset; | 96 | // m_log.DebugFormat( |
87 | Scale = part.Shape.Scale; | 97 | // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); |
88 | LastUpdated = DateTime.Now; | 98 | |
89 | } | 99 | Scale = part.Shape.Scale; |
100 | |||
101 | // m_log.DebugFormat( | ||
102 | // "[UNDO STATE]: Storing undo scale {0} for root part", Scale); | ||
103 | } | ||
104 | else | ||
105 | { | ||
106 | Position = part.OffsetPosition; | ||
107 | // m_log.DebugFormat( | ||
108 | // "[UNDO STATE]: Storing undo position {0} for child part", Position); | ||
109 | |||
110 | Rotation = part.RotationOffset; | ||
111 | // m_log.DebugFormat( | ||
112 | // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); | ||
113 | |||
114 | Scale = part.Shape.Scale; | ||
115 | // m_log.DebugFormat( | ||
116 | // "[UNDO STATE]: Storing undo scale {0} for child part", Scale); | ||
90 | } | 117 | } |
91 | } | 118 | } |
92 | public void Merge(UndoState last) | 119 | public void Merge(UndoState last) |
@@ -132,95 +159,143 @@ namespace OpenSim.Region.Framework.Scenes | |||
132 | return false; | 159 | return false; |
133 | } | 160 | } |
134 | } | 161 | } |
162 | /// <summary> | ||
163 | /// Compare the relevant state in the given part to this state. | ||
164 | /// </summary> | ||
165 | /// <param name="part"></param> | ||
166 | /// <returns>true if both the part's position, rotation and scale match those in this undo state. False otherwise.</returns> | ||
135 | public bool Compare(SceneObjectPart part) | 167 | public bool Compare(SceneObjectPart part) |
136 | { | 168 | { |
137 | if (part != null) | 169 | if (part != null) |
138 | { | 170 | { |
139 | if (part.ParentID == 0) | 171 | if (part.ParentID == 0) |
140 | { | 172 | return |
141 | if (Position == part.ParentGroup.RootPart.AbsolutePosition && Rotation == part.ParentGroup.Rotation && GroupPosition == part.ParentGroup.RootPart.AbsolutePosition && part.ParentGroup.Rotation == GroupRotation && part.Shape.Scale == GroupScale) | 173 | Position == part.ParentGroup.AbsolutePosition |
142 | return true; | 174 | && Rotation == part.RotationOffset |
143 | else | 175 | && Scale == part.Shape.Scale; |
144 | return false; | ||
145 | } | ||
146 | else | 176 | else |
147 | { | 177 | return |
148 | if (Position == part.OffsetPosition && Rotation == part.RotationOffset && Scale == part.Shape.Scale && GroupPosition == part.ParentGroup.RootPart.AbsolutePosition && part.ParentGroup.Rotation == GroupRotation && part.Shape.Scale == GroupScale) | 178 | Position == part.OffsetPosition |
149 | return true; | 179 | && Rotation == part.RotationOffset |
150 | else | 180 | && Scale == part.Shape.Scale; |
151 | return false; | ||
152 | |||
153 | } | ||
154 | } | 181 | } |
182 | |||
155 | return false; | 183 | return false; |
156 | } | 184 | } |
157 | 185 | ||
158 | private void RestoreState(SceneObjectPart part) | 186 | private void RestoreState(SceneObjectPart part) |
159 | { | 187 | { |
160 | bool GroupChange = false; | 188 | part.Undoing = true; |
161 | if ((Type & UndoType.STATE_GROUP_POSITION) != 0 | ||
162 | || (Type & UndoType.STATE_GROUP_ROTATION) != 0 | ||
163 | || (Type & UndoType.STATE_GROUP_SCALE) != 0) | ||
164 | { | ||
165 | GroupChange = true; | ||
166 | } | ||
167 | 189 | ||
168 | if (part != null) | 190 | if (part.ParentID == 0) |
169 | { | 191 | { |
170 | part.Undoing = true; | 192 | // m_log.DebugFormat( |
193 | // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", | ||
194 | // Position, part.Name, part.LocalId); | ||
171 | 195 | ||
172 | if (part.ParentID == 0 && GroupChange == false) | 196 | if (Position != Vector3.Zero) |
173 | { | 197 | { |
174 | if (Position != Vector3.Zero) | 198 | if (ForGroup) |
175 | 199 | part.ParentGroup.AbsolutePosition = Position; | |
176 | part.ParentGroup.UpdateSinglePosition(Position, part.LocalId); | 200 | else |
177 | part.ParentGroup.UpdateSingleRotation(Rotation, part.LocalId); | 201 | part.ParentGroup.UpdateRootPosition(Position); |
178 | if (Scale != Vector3.Zero) | ||
179 | part.Resize(Scale); | ||
180 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | ||
181 | } | 202 | } |
203 | |||
204 | // m_log.DebugFormat( | ||
205 | // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", | ||
206 | // part.RotationOffset, Rotation, part.Name, part.LocalId); | ||
207 | |||
208 | if (ForGroup) | ||
209 | part.UpdateRotation(Rotation); | ||
182 | else | 210 | else |
211 | part.ParentGroup.UpdateRootRotation(Rotation); | ||
212 | |||
213 | if (Scale != Vector3.Zero) | ||
183 | { | 214 | { |
184 | if (GroupChange) | 215 | // m_log.DebugFormat( |
185 | { | 216 | // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", |
186 | part.ParentGroup.RootPart.Undoing = true; | 217 | // part.Shape.Scale, Scale, part.Name, part.LocalId); |
187 | if (GroupPosition != Vector3.Zero) | 218 | |
188 | { | 219 | if (ForGroup) |
189 | //Calculate the scale... | 220 | part.ParentGroup.GroupResize(Scale); |
190 | Vector3 gs = part.Shape.Scale; | ||
191 | float scale = GroupScale.Z / gs.Z; | ||
192 | |||
193 | //Scale first since it can affect our position | ||
194 | part.ParentGroup.GroupResize(gs * scale, part.LocalId); | ||
195 | part.ParentGroup.AbsolutePosition = GroupPosition; | ||
196 | part.ParentGroup.UpdateGroupRotationR(GroupRotation); | ||
197 | |||
198 | } | ||
199 | part.ParentGroup.RootPart.Undoing = false; | ||
200 | } | ||
201 | else | 221 | else |
202 | { | 222 | part.Resize(Scale); |
203 | if (Position != Vector3.Zero) //We can use this for all the updates since all are set | ||
204 | { | ||
205 | part.OffsetPosition = Position; | ||
206 | part.UpdateRotation(Rotation); | ||
207 | part.Resize(Scale); part.ScheduleTerseUpdate(); | ||
208 | } | ||
209 | } | ||
210 | } | 223 | } |
211 | part.Undoing = false; | ||
212 | 224 | ||
225 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | ||
213 | } | 226 | } |
227 | else | ||
228 | { | ||
229 | if (Position != Vector3.Zero) | ||
230 | { | ||
231 | // m_log.DebugFormat( | ||
232 | // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", | ||
233 | // part.OffsetPosition, Position, part.Name, part.LocalId); | ||
234 | |||
235 | part.OffsetPosition = Position; | ||
236 | } | ||
237 | |||
238 | // m_log.DebugFormat( | ||
239 | // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", | ||
240 | // part.RotationOffset, Rotation, part.Name, part.LocalId); | ||
241 | |||
242 | part.UpdateRotation(Rotation); | ||
243 | |||
244 | if (Scale != Vector3.Zero) | ||
245 | { | ||
246 | // m_log.DebugFormat( | ||
247 | // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", | ||
248 | // part.Shape.Scale, Scale, part.Name, part.LocalId); | ||
249 | |||
250 | part.Resize(Scale); | ||
251 | } | ||
252 | |||
253 | part.ScheduleTerseUpdate(); | ||
254 | } | ||
255 | |||
256 | part.Undoing = false; | ||
214 | } | 257 | } |
215 | public void PlaybackState(SceneObjectPart part) | 258 | |
216 | { | ||
217 | RestoreState(part); | ||
218 | } | ||
219 | public void PlayfwdState(SceneObjectPart part) | 259 | public void PlayfwdState(SceneObjectPart part) |
220 | { | 260 | { |
221 | RestoreState(part); | 261 | part.Undoing = true; |
262 | |||
263 | if (part.ParentID == 0) | ||
264 | { | ||
265 | if (Position != Vector3.Zero) | ||
266 | part.ParentGroup.AbsolutePosition = Position; | ||
267 | |||
268 | if (Rotation != Quaternion.Identity) | ||
269 | part.UpdateRotation(Rotation); | ||
270 | |||
271 | if (Scale != Vector3.Zero) | ||
272 | { | ||
273 | if (ForGroup) | ||
274 | part.ParentGroup.GroupResize(Scale); | ||
275 | else | ||
276 | part.Resize(Scale); | ||
277 | } | ||
278 | |||
279 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | ||
280 | } | ||
281 | else | ||
282 | { | ||
283 | if (Position != Vector3.Zero) | ||
284 | part.OffsetPosition = Position; | ||
285 | |||
286 | if (Rotation != Quaternion.Identity) | ||
287 | part.UpdateRotation(Rotation); | ||
288 | |||
289 | if (Scale != Vector3.Zero) | ||
290 | part.Resize(Scale); | ||
291 | |||
292 | part.ScheduleTerseUpdate(); | ||
293 | } | ||
294 | |||
295 | part.Undoing = false; | ||
222 | } | 296 | } |
223 | } | 297 | } |
298 | |||
224 | public class LandUndoState | 299 | public class LandUndoState |
225 | { | 300 | { |
226 | public ITerrainModule m_terrainModule; | 301 | public ITerrainModule m_terrainModule; |
@@ -234,10 +309,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
234 | 309 | ||
235 | public bool Compare(ITerrainChannel terrainChannel) | 310 | public bool Compare(ITerrainChannel terrainChannel) |
236 | { | 311 | { |
237 | if (m_terrainChannel != terrainChannel) | 312 | return m_terrainChannel == terrainChannel; |
238 | return false; | ||
239 | else | ||
240 | return false; | ||
241 | } | 313 | } |
242 | 314 | ||
243 | public void PlaybackState() | 315 | public void PlaybackState() |
@@ -246,4 +318,3 @@ namespace OpenSim.Region.Framework.Scenes | |||
246 | } | 318 | } |
247 | } | 319 | } |
248 | } | 320 | } |
249 | |||