diff options
author | UbitUmarov | 2012-04-20 18:51:32 +0100 |
---|---|---|
committer | UbitUmarov | 2012-04-20 18:51:32 +0100 |
commit | 3b56c4445390461ea6cdef7bc9ad8f8b26fc97c1 (patch) | |
tree | 2ec58b80052a22550c1ddbc2527f9f20fd0e6914 /OpenSim/Region/Framework/Scenes | |
parent | ubitODE: - Change triangles used in terrain height estimation (diff) | |
download | opensim-SC_OLD-3b56c4445390461ea6cdef7bc9ad8f8b26fc97c1.zip opensim-SC_OLD-3b56c4445390461ea6cdef7bc9ad8f8b26fc97c1.tar.gz opensim-SC_OLD-3b56c4445390461ea6cdef7bc9ad8f8b26fc97c1.tar.bz2 opensim-SC_OLD-3b56c4445390461ea6cdef7bc9ad8f8b26fc97c1.tar.xz |
changed seletion code. SOP now knows about parts selection. UI actions are sent to SOP and this reports to SOG. Group is selected if any part is selected.sop.isSelect get() is only used in SOG. Will need to be improved for better performance on largelinksets. *UNTESTED* NEEDS CHECKING for side efects
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 66 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 48 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 14 |
3 files changed, 104 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 35ac908..3ef1e29 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -129,27 +129,47 @@ namespace OpenSim.Region.Framework.Scenes | |||
129 | /// <param name="remoteClient"></param> | 129 | /// <param name="remoteClient"></param> |
130 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) | 130 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) |
131 | { | 131 | { |
132 | /* | ||
133 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | ||
134 | |||
135 | if (null == part) | ||
136 | return; | ||
137 | |||
138 | if (part.IsRoot) | ||
139 | { | ||
140 | SceneObjectGroup sog = part.ParentGroup; | ||
141 | sog.SendPropertiesToClient(remoteClient); | ||
142 | |||
143 | // A prim is only tainted if it's allowed to be edited by the person clicking it. | ||
144 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) | ||
145 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) | ||
146 | { | ||
147 | sog.IsSelected = true; | ||
148 | EventManager.TriggerParcelPrimCountTainted(); | ||
149 | } | ||
150 | } | ||
151 | else | ||
152 | { | ||
153 | part.SendPropertiesToClient(remoteClient); | ||
154 | } | ||
155 | */ | ||
132 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | 156 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
133 | 157 | ||
134 | if (null == part) | 158 | if (null == part) |
135 | return; | 159 | return; |
136 | 160 | ||
137 | if (part.IsRoot) | 161 | SceneObjectGroup sog = part.ParentGroup; |
138 | { | 162 | if (sog == null) |
139 | SceneObjectGroup sog = part.ParentGroup; | 163 | return; |
140 | sog.SendPropertiesToClient(remoteClient); | ||
141 | 164 | ||
142 | // A prim is only tainted if it's allowed to be edited by the person clicking it. | 165 | part.SendPropertiesToClient(remoteClient); |
143 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) | 166 | |
144 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) | 167 | // A prim is only tainted if it's allowed to be edited by the person clicking it. |
145 | { | 168 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) |
146 | sog.IsSelected = true; | 169 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) |
147 | EventManager.TriggerParcelPrimCountTainted(); | ||
148 | } | ||
149 | } | ||
150 | else | ||
151 | { | 170 | { |
152 | part.SendPropertiesToClient(remoteClient); | 171 | part.IsSelected = true; |
172 | EventManager.TriggerParcelPrimCountTainted(); | ||
153 | } | 173 | } |
154 | } | 174 | } |
155 | 175 | ||
@@ -202,7 +222,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
202 | SceneObjectPart part = GetSceneObjectPart(primLocalID); | 222 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
203 | if (part == null) | 223 | if (part == null) |
204 | return; | 224 | return; |
205 | 225 | /* | |
206 | // A deselect packet contains all the local prims being deselected. However, since selection is still | 226 | // A deselect packet contains all the local prims being deselected. However, since selection is still |
207 | // group based we only want the root prim to trigger a full update - otherwise on objects with many prims | 227 | // group based we only want the root prim to trigger a full update - otherwise on objects with many prims |
208 | // we end up sending many duplicate ObjectUpdates | 228 | // we end up sending many duplicate ObjectUpdates |
@@ -237,6 +257,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
237 | part.UUID, remoteClient.AgentId)) | 257 | part.UUID, remoteClient.AgentId)) |
238 | EventManager.TriggerParcelPrimCountTainted(); | 258 | EventManager.TriggerParcelPrimCountTainted(); |
239 | } | 259 | } |
260 | */ | ||
261 | |||
262 | bool oldgprSelect = part.ParentGroup.IsSelected; | ||
263 | |||
264 | // This is wrong, wrong, wrong. Selection should not be | ||
265 | // handled by group, but by prim. Legacy cruft. | ||
266 | // TODO: Make selection flagging per prim! | ||
267 | // | ||
268 | if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId) | ||
269 | || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) | ||
270 | { | ||
271 | part.IsSelected = false; | ||
272 | if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected) | ||
273 | EventManager.TriggerParcelPrimCountTainted(); | ||
274 | } | ||
275 | |||
240 | } | 276 | } |
241 | 277 | ||
242 | public virtual void ProcessMoneyTransferRequest(UUID source, UUID destination, int amount, | 278 | public virtual void ProcessMoneyTransferRequest(UUID source, UUID destination, int amount, |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 47020af..0100ab3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -726,6 +726,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
726 | m_isSelected = value; | 726 | m_isSelected = value; |
727 | // Tell physics engine that group is selected | 727 | // Tell physics engine that group is selected |
728 | 728 | ||
729 | // this is not right | ||
730 | // but ode engines should only really need to know about root part | ||
731 | // so they can put entire object simulation on hold and not colliding | ||
732 | // keep as was for now | ||
733 | |||
729 | PhysicsActor pa = m_rootPart.PhysActor; | 734 | PhysicsActor pa = m_rootPart.PhysActor; |
730 | if (pa != null) | 735 | if (pa != null) |
731 | { | 736 | { |
@@ -747,6 +752,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
747 | } | 752 | } |
748 | } | 753 | } |
749 | 754 | ||
755 | public void PartSelectChanged(bool partSelect) | ||
756 | { | ||
757 | // any part selected makes group selected | ||
758 | if (m_isSelected == partSelect) | ||
759 | return; | ||
760 | |||
761 | if (partSelect) | ||
762 | { | ||
763 | IsSelected = partSelect; | ||
764 | // if (!IsAttachment) | ||
765 | // ScheduleGroupForFullUpdate(); | ||
766 | } | ||
767 | else | ||
768 | { | ||
769 | // bad bad bad 2 heavy for large linksets | ||
770 | // since viewer does send lot of (un)selects | ||
771 | // this needs to be replaced by a specific list or count ? | ||
772 | // but that will require extra code in several places | ||
773 | |||
774 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
775 | for (int i = 0; i < parts.Length; i++) | ||
776 | { | ||
777 | SceneObjectPart part = parts[i]; | ||
778 | if (part.IsSelected) | ||
779 | return; | ||
780 | } | ||
781 | IsSelected = partSelect; | ||
782 | if (!IsAttachment) | ||
783 | { | ||
784 | ScheduleGroupForFullUpdate(); | ||
785 | } | ||
786 | } | ||
787 | } | ||
788 | |||
750 | private SceneObjectPart m_PlaySoundMasterPrim = null; | 789 | private SceneObjectPart m_PlaySoundMasterPrim = null; |
751 | public SceneObjectPart PlaySoundMasterPrim | 790 | public SceneObjectPart PlaySoundMasterPrim |
752 | { | 791 | { |
@@ -3139,14 +3178,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3139 | } | 3178 | } |
3140 | } | 3179 | } |
3141 | 3180 | ||
3142 | /* | ||
3143 | RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); | ||
3144 | for (int i = 0; i < parts.Length; i++) | ||
3145 | { | ||
3146 | if (parts[i] != RootPart) | ||
3147 | parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect); | ||
3148 | } | ||
3149 | */ | ||
3150 | if (parts.Length > 1) | 3181 | if (parts.Length > 1) |
3151 | { | 3182 | { |
3152 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); | 3183 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); |
@@ -3163,7 +3194,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3163 | } | 3194 | } |
3164 | else | 3195 | else |
3165 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false); | 3196 | m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false); |
3166 | |||
3167 | } | 3197 | } |
3168 | } | 3198 | } |
3169 | 3199 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c73fc98..c9659cb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -304,6 +304,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
304 | protected float m_friction = 0.6f; // wood | 304 | protected float m_friction = 0.6f; // wood |
305 | protected float m_bounce = 0.5f; // wood | 305 | protected float m_bounce = 0.5f; // wood |
306 | 306 | ||
307 | |||
308 | protected bool m_isSelected = false; | ||
309 | |||
307 | /// <summary> | 310 | /// <summary> |
308 | /// Stores media texture data | 311 | /// Stores media texture data |
309 | /// </summary> | 312 | /// </summary> |
@@ -577,6 +580,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
577 | } | 580 | } |
578 | } | 581 | } |
579 | 582 | ||
583 | public bool IsSelected | ||
584 | { | ||
585 | get { return m_isSelected; } | ||
586 | set | ||
587 | { | ||
588 | m_isSelected = value; | ||
589 | if (ParentGroup != null) | ||
590 | ParentGroup.PartSelectChanged(value); | ||
591 | } | ||
592 | } | ||
580 | 593 | ||
581 | 594 | ||
582 | public Dictionary<int, string> CollisionFilter | 595 | public Dictionary<int, string> CollisionFilter |
@@ -1907,6 +1920,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1907 | dupe.m_rezzed = m_rezzed; | 1920 | dupe.m_rezzed = m_rezzed; |
1908 | 1921 | ||
1909 | dupe.m_UndoRedo = null; | 1922 | dupe.m_UndoRedo = null; |
1923 | dupe.m_isSelected = false; | ||
1910 | 1924 | ||
1911 | dupe.IgnoreUndoUpdate = false; | 1925 | dupe.IgnoreUndoUpdate = false; |
1912 | dupe.Undoing = false; | 1926 | dupe.Undoing = false; |