diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 328 |
1 files changed, 268 insertions, 60 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 566605a..91293c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -231,6 +231,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
231 | 231 | ||
232 | public double SoundRadius; | 232 | public double SoundRadius; |
233 | 233 | ||
234 | /// <summary> | ||
235 | /// Should sounds played from this prim be queued? | ||
236 | /// </summary> | ||
237 | /// <remarks> | ||
238 | /// This should only be changed by sound modules. It is up to sound modules as to how they interpret this setting. | ||
239 | /// </remarks> | ||
240 | public bool SoundQueueing { get; set; } | ||
234 | 241 | ||
235 | public uint TimeStampFull; | 242 | public uint TimeStampFull; |
236 | 243 | ||
@@ -244,9 +251,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
244 | public byte AttachPoint = 0; | 251 | public byte AttachPoint = 0; |
245 | 252 | ||
246 | [XmlIgnore] | 253 | [XmlIgnore] |
247 | public Vector3 AttachOffset = Vector3.Zero; | ||
248 | |||
249 | [XmlIgnore] | ||
250 | public Quaternion AttachRotation = Quaternion.Identity; | 254 | public Quaternion AttachRotation = Quaternion.Identity; |
251 | 255 | ||
252 | [XmlIgnore] | 256 | [XmlIgnore] |
@@ -383,8 +387,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
383 | 387 | ||
384 | private SOPVehicle m_vehicleParams = null; | 388 | private SOPVehicle m_vehicleParams = null; |
385 | 389 | ||
386 | private KeyframeMotion m_keyframeMotion = null; | ||
387 | |||
388 | public KeyframeMotion KeyframeMotion | 390 | public KeyframeMotion KeyframeMotion |
389 | { | 391 | { |
390 | get; set; | 392 | get; set; |
@@ -506,7 +508,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
506 | { | 508 | { |
507 | get | 509 | get |
508 | { | 510 | { |
509 | if (CreatorData != null && CreatorData != string.Empty) | 511 | if (!string.IsNullOrEmpty(CreatorData)) |
510 | return CreatorID.ToString() + ';' + CreatorData; | 512 | return CreatorID.ToString() + ';' + CreatorData; |
511 | else | 513 | else |
512 | return CreatorID.ToString(); | 514 | return CreatorID.ToString(); |
@@ -536,7 +538,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
536 | CreatorID = uuid; | 538 | CreatorID = uuid; |
537 | } | 539 | } |
538 | if (parts.Length >= 2) | 540 | if (parts.Length >= 2) |
541 | { | ||
539 | CreatorData = parts[1]; | 542 | CreatorData = parts[1]; |
543 | if (!CreatorData.EndsWith("/")) | ||
544 | CreatorData += "/"; | ||
545 | } | ||
540 | if (parts.Length >= 3) | 546 | if (parts.Length >= 3) |
541 | name = parts[2]; | 547 | name = parts[2]; |
542 | 548 | ||
@@ -660,6 +666,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
660 | m_isSelected = value; | 666 | m_isSelected = value; |
661 | if (ParentGroup != null) | 667 | if (ParentGroup != null) |
662 | ParentGroup.PartSelectChanged(value); | 668 | ParentGroup.PartSelectChanged(value); |
669 | |||
663 | } | 670 | } |
664 | } | 671 | } |
665 | 672 | ||
@@ -765,9 +772,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
765 | set { m_damage = value; } | 772 | set { m_damage = value; } |
766 | } | 773 | } |
767 | 774 | ||
775 | |||
776 | |||
777 | |||
778 | public void setGroupPosition(Vector3 pos) | ||
779 | { | ||
780 | m_groupPosition = pos; | ||
781 | } | ||
782 | |||
768 | /// <summary> | 783 | /// <summary> |
769 | /// The position of the entire group that this prim belongs to. | 784 | /// The position of the entire group that this prim belongs to. |
770 | /// </summary> | 785 | /// </summary> |
786 | /// | ||
787 | |||
788 | |||
771 | public Vector3 GroupPosition | 789 | public Vector3 GroupPosition |
772 | { | 790 | { |
773 | get | 791 | get |
@@ -805,7 +823,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
805 | // Root prim actually goes at Position | 823 | // Root prim actually goes at Position |
806 | if (ParentID == 0) | 824 | if (ParentID == 0) |
807 | { | 825 | { |
808 | actor.Position = value; | 826 | actor.Position = value; |
809 | } | 827 | } |
810 | else | 828 | else |
811 | { | 829 | { |
@@ -815,7 +833,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
815 | } | 833 | } |
816 | 834 | ||
817 | // Tell the physics engines that this prim changed. | 835 | // Tell the physics engines that this prim changed. |
818 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 836 | if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null) |
837 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | ||
819 | } | 838 | } |
820 | catch (Exception e) | 839 | catch (Exception e) |
821 | { | 840 | { |
@@ -825,6 +844,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
825 | } | 844 | } |
826 | } | 845 | } |
827 | 846 | ||
847 | public void setOffsetPosition(Vector3 pos) | ||
848 | { | ||
849 | m_offsetPosition = pos; | ||
850 | } | ||
851 | |||
828 | public Vector3 OffsetPosition | 852 | public Vector3 OffsetPosition |
829 | { | 853 | { |
830 | get { return m_offsetPosition; } | 854 | get { return m_offsetPosition; } |
@@ -855,7 +879,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
855 | { | 879 | { |
856 | Vector3 offset = (m_offsetPosition - oldpos); | 880 | Vector3 offset = (m_offsetPosition - oldpos); |
857 | av.AbsolutePosition += offset; | 881 | av.AbsolutePosition += offset; |
858 | av.SendAvatarDataToAllAgents(); | 882 | // av.SendAvatarDataToAllAgents(); |
883 | av.SendTerseUpdateToAllClients(); | ||
859 | } | 884 | } |
860 | } | 885 | } |
861 | } | 886 | } |
@@ -882,6 +907,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
882 | } | 907 | } |
883 | } | 908 | } |
884 | 909 | ||
910 | public void setRotationOffset(Quaternion q) | ||
911 | { | ||
912 | m_rotationOffset = q; | ||
913 | } | ||
914 | |||
885 | public Quaternion RotationOffset | 915 | public Quaternion RotationOffset |
886 | { | 916 | { |
887 | get | 917 | get |
@@ -933,7 +963,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
933 | //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); | 963 | //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); |
934 | } | 964 | } |
935 | 965 | ||
936 | if (ParentGroup != null) | 966 | if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null) |
937 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 967 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
938 | //} | 968 | //} |
939 | } | 969 | } |
@@ -1218,23 +1248,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1218 | // the mappings more consistant. | 1248 | // the mappings more consistant. |
1219 | public Vector3 SitTargetPositionLL | 1249 | public Vector3 SitTargetPositionLL |
1220 | { | 1250 | { |
1221 | get { return new Vector3(m_sitTargetPosition.X, m_sitTargetPosition.Y,m_sitTargetPosition.Z); } | 1251 | get { return m_sitTargetPosition; } |
1222 | set { m_sitTargetPosition = value; } | 1252 | set { m_sitTargetPosition = value; } |
1223 | } | 1253 | } |
1224 | 1254 | ||
1225 | public Quaternion SitTargetOrientationLL | 1255 | public Quaternion SitTargetOrientationLL |
1226 | { | 1256 | { |
1227 | get | 1257 | get { return m_sitTargetOrientation; } |
1228 | { | 1258 | set { m_sitTargetOrientation = value; } |
1229 | return new Quaternion( | ||
1230 | m_sitTargetOrientation.X, | ||
1231 | m_sitTargetOrientation.Y, | ||
1232 | m_sitTargetOrientation.Z, | ||
1233 | m_sitTargetOrientation.W | ||
1234 | ); | ||
1235 | } | ||
1236 | |||
1237 | set { m_sitTargetOrientation = new Quaternion(value.X, value.Y, value.Z, value.W); } | ||
1238 | } | 1259 | } |
1239 | 1260 | ||
1240 | public bool Stopped | 1261 | public bool Stopped |
@@ -2111,7 +2132,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2111 | /// <param name="linkNum"></param> | 2132 | /// <param name="linkNum"></param> |
2112 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> | 2133 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> |
2113 | /// <returns></returns> | 2134 | /// <returns></returns> |
2114 | public SceneObjectPart Copy(uint localID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) | 2135 | public SceneObjectPart Copy(uint plocalID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) |
2115 | { | 2136 | { |
2116 | SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); | 2137 | SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); |
2117 | dupe.m_shape = m_shape.Copy(); | 2138 | dupe.m_shape = m_shape.Copy(); |
@@ -2157,7 +2178,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2157 | } | 2178 | } |
2158 | 2179 | ||
2159 | // Move afterwards ResetIDs as it clears the localID | 2180 | // Move afterwards ResetIDs as it clears the localID |
2160 | dupe.LocalId = localID; | 2181 | dupe.LocalId = plocalID; |
2161 | 2182 | ||
2162 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 2183 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
2163 | dupe.LastOwnerID = OwnerID; | 2184 | dupe.LastOwnerID = OwnerID; |
@@ -2187,7 +2208,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2187 | } | 2208 | } |
2188 | 2209 | ||
2189 | if (dupe.PhysActor != null) | 2210 | if (dupe.PhysActor != null) |
2190 | dupe.PhysActor.LocalID = localID; | 2211 | dupe.PhysActor.LocalID = plocalID; |
2191 | 2212 | ||
2192 | ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed); | 2213 | ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed); |
2193 | 2214 | ||
@@ -2687,6 +2708,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2687 | detobj.velVector = obj.Velocity; | 2708 | detobj.velVector = obj.Velocity; |
2688 | detobj.colliderType = 0; | 2709 | detobj.colliderType = 0; |
2689 | detobj.groupUUID = obj.GroupID; | 2710 | detobj.groupUUID = obj.GroupID; |
2711 | detobj.linkNumber = LinkNum; // pass my link number | ||
2690 | 2712 | ||
2691 | return detobj; | 2713 | return detobj; |
2692 | } | 2714 | } |
@@ -2702,6 +2724,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2702 | detobj.velVector = av.Velocity; | 2724 | detobj.velVector = av.Velocity; |
2703 | detobj.colliderType = 0; | 2725 | detobj.colliderType = 0; |
2704 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | 2726 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; |
2727 | detobj.linkNumber = LinkNum; // pass my link number | ||
2705 | 2728 | ||
2706 | return detobj; | 2729 | return detobj; |
2707 | } | 2730 | } |
@@ -2717,6 +2740,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2717 | detobj.velVector = Vector3.Zero; | 2740 | detobj.velVector = Vector3.Zero; |
2718 | detobj.colliderType = 0; | 2741 | detobj.colliderType = 0; |
2719 | detobj.groupUUID = UUID.Zero; | 2742 | detobj.groupUUID = UUID.Zero; |
2743 | detobj.linkNumber = LinkNum; // pass my link number not sure needed.. but no harm | ||
2720 | 2744 | ||
2721 | return detobj; | 2745 | return detobj; |
2722 | } | 2746 | } |
@@ -2965,7 +2989,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2965 | } | 2989 | } |
2966 | //ParentGroup.RootPart.m_groupPosition = newpos; | 2990 | //ParentGroup.RootPart.m_groupPosition = newpos; |
2967 | } | 2991 | } |
2968 | 2992 | /* ubit: there are no flexible links | |
2993 | if (pa != null && ParentID != 0 && ParentGroup != null) | ||
2994 | { | ||
2995 | // Special case where a child object is requesting property updates. | ||
2996 | // This happens when linksets are modified to use flexible links rather than | ||
2997 | // the default links. | ||
2998 | // The simulator code presumes that child parts are only modified by scripts | ||
2999 | // so the logic for changing position/rotation/etc does not take into | ||
3000 | // account the physical object actually moving. | ||
3001 | // This code updates the offset position and rotation of the child and then | ||
3002 | // lets the update code push the update to the viewer. | ||
3003 | // Since physics engines do not normally generate this event for linkset children, | ||
3004 | // this code will not be active unless you have a specially configured | ||
3005 | // physics engine. | ||
3006 | Quaternion invRootRotation = Quaternion.Normalize(Quaternion.Inverse(ParentGroup.RootPart.RotationOffset)); | ||
3007 | m_offsetPosition = pa.Position - m_groupPosition; | ||
3008 | RotationOffset = pa.Orientation * invRootRotation; | ||
3009 | // m_log.DebugFormat("{0} PhysicsRequestingTerseUpdate child: pos={1}, rot={2}, offPos={3}, offRot={4}", | ||
3010 | // "[SCENE OBJECT PART]", pa.Position, pa.Orientation, m_offsetPosition, RotationOffset); | ||
3011 | } | ||
3012 | */ | ||
2969 | ScheduleTerseUpdate(); | 3013 | ScheduleTerseUpdate(); |
2970 | } | 3014 | } |
2971 | 3015 | ||
@@ -3144,7 +3188,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3144 | return; | 3188 | return; |
3145 | 3189 | ||
3146 | // This was pulled from SceneViewer. Attachments always receive full updates. | 3190 | // This was pulled from SceneViewer. Attachments always receive full updates. |
3147 | // I could not verify if this is a requirement but this maintains existing behavior | 3191 | // This is needed because otherwise if only the root prim changes position, then |
3192 | // it looks as if the entire object has moved (including the other prims). | ||
3148 | if (ParentGroup.IsAttachment) | 3193 | if (ParentGroup.IsAttachment) |
3149 | { | 3194 | { |
3150 | ScheduleFullUpdate(); | 3195 | ScheduleFullUpdate(); |
@@ -3217,7 +3262,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3217 | 3262 | ||
3218 | // m_log.DebugFormat( | 3263 | // m_log.DebugFormat( |
3219 | // "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); | 3264 | // "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId); |
3220 | 3265 | ||
3266 | |||
3267 | if (ParentGroup.IsAttachment) | ||
3268 | { | ||
3269 | ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); | ||
3270 | if (sp != null) | ||
3271 | { | ||
3272 | sp.SendAttachmentUpdate(this, UpdateRequired.FULL); | ||
3273 | } | ||
3274 | } | ||
3275 | |||
3276 | /* this does nothing | ||
3277 | SendFullUpdateToClient(remoteClient, Position) ignores position parameter | ||
3221 | if (IsRoot) | 3278 | if (IsRoot) |
3222 | { | 3279 | { |
3223 | if (ParentGroup.IsAttachment) | 3280 | if (ParentGroup.IsAttachment) |
@@ -3229,6 +3286,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3229 | SendFullUpdateToClient(remoteClient, AbsolutePosition); | 3286 | SendFullUpdateToClient(remoteClient, AbsolutePosition); |
3230 | } | 3287 | } |
3231 | } | 3288 | } |
3289 | */ | ||
3232 | else | 3290 | else |
3233 | { | 3291 | { |
3234 | SendFullUpdateToClient(remoteClient); | 3292 | SendFullUpdateToClient(remoteClient); |
@@ -3238,7 +3296,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3238 | /// <summary> | 3296 | /// <summary> |
3239 | /// Send a full update for this part to all clients. | 3297 | /// Send a full update for this part to all clients. |
3240 | /// </summary> | 3298 | /// </summary> |
3241 | public void SendFullUpdateToAllClients() | 3299 | public void SendFullUpdateToAllClientsInternal() |
3242 | { | 3300 | { |
3243 | if (ParentGroup == null) | 3301 | if (ParentGroup == null) |
3244 | return; | 3302 | return; |
@@ -3257,6 +3315,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3257 | }); | 3315 | }); |
3258 | } | 3316 | } |
3259 | 3317 | ||
3318 | public void SendFullUpdateToAllClients() | ||
3319 | { | ||
3320 | if (ParentGroup == null) | ||
3321 | return; | ||
3322 | |||
3323 | // Update the "last" values | ||
3324 | m_lastPosition = OffsetPosition; | ||
3325 | m_lastRotation = RotationOffset; | ||
3326 | m_lastVelocity = Velocity; | ||
3327 | m_lastAcceleration = Acceleration; | ||
3328 | m_lastAngularVelocity = AngularVelocity; | ||
3329 | m_lastUpdateSentTime = Environment.TickCount; | ||
3330 | |||
3331 | if (ParentGroup.IsAttachment) | ||
3332 | { | ||
3333 | ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); | ||
3334 | if (sp != null) | ||
3335 | { | ||
3336 | sp.SendAttachmentUpdate(this, UpdateRequired.FULL); | ||
3337 | } | ||
3338 | } | ||
3339 | else | ||
3340 | { | ||
3341 | ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | ||
3342 | { | ||
3343 | SendFullUpdate(avatar.ControllingClient); | ||
3344 | }); | ||
3345 | } | ||
3346 | } | ||
3347 | |||
3260 | /// <summary> | 3348 | /// <summary> |
3261 | /// Sends a full update to the client | 3349 | /// Sends a full update to the client |
3262 | /// </summary> | 3350 | /// </summary> |
@@ -3277,9 +3365,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3277 | return; | 3365 | return; |
3278 | 3366 | ||
3279 | // Suppress full updates during attachment editing | 3367 | // Suppress full updates during attachment editing |
3280 | // | 3368 | // sl Does send them |
3281 | if (ParentGroup.IsSelected && ParentGroup.IsAttachment) | 3369 | // if (ParentGroup.IsSelected && ParentGroup.IsAttachment) |
3282 | return; | 3370 | // return; |
3283 | 3371 | ||
3284 | if (ParentGroup.IsDeleted) | 3372 | if (ParentGroup.IsDeleted) |
3285 | return; | 3373 | return; |
@@ -3326,24 +3414,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
3326 | !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || | 3414 | !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || |
3327 | Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE) | 3415 | Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE) |
3328 | { | 3416 | { |
3329 | SendTerseUpdateToAllClients(); | 3417 | SendTerseUpdateToAllClientsInternal(); |
3330 | |||
3331 | } | 3418 | } |
3332 | break; | 3419 | break; |
3333 | } | 3420 | } |
3334 | case UpdateRequired.FULL: | 3421 | case UpdateRequired.FULL: |
3335 | { | 3422 | { |
3336 | ClearUpdateSchedule(); | 3423 | ClearUpdateSchedule(); |
3337 | SendFullUpdateToAllClients(); | 3424 | SendFullUpdateToAllClientsInternal(); |
3338 | break; | 3425 | break; |
3339 | } | 3426 | } |
3340 | } | 3427 | } |
3341 | } | 3428 | } |
3342 | 3429 | ||
3430 | |||
3343 | /// <summary> | 3431 | /// <summary> |
3344 | /// Send a terse update to all clients | 3432 | /// Send a terse update to all clients |
3345 | /// </summary> | 3433 | /// </summary> |
3346 | public void SendTerseUpdateToAllClients() | 3434 | public void SendTerseUpdateToAllClientsInternal() |
3347 | { | 3435 | { |
3348 | if (ParentGroup == null || ParentGroup.Scene == null) | 3436 | if (ParentGroup == null || ParentGroup.Scene == null) |
3349 | return; | 3437 | return; |
@@ -3362,6 +3450,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3362 | }); | 3450 | }); |
3363 | } | 3451 | } |
3364 | 3452 | ||
3453 | public void SendTerseUpdateToAllClients() | ||
3454 | { | ||
3455 | if (ParentGroup == null || ParentGroup.Scene == null) | ||
3456 | return; | ||
3457 | |||
3458 | // Update the "last" values | ||
3459 | m_lastPosition = OffsetPosition; | ||
3460 | m_lastRotation = RotationOffset; | ||
3461 | m_lastVelocity = Velocity; | ||
3462 | m_lastAcceleration = Acceleration; | ||
3463 | m_lastAngularVelocity = AngularVelocity; | ||
3464 | m_lastUpdateSentTime = Environment.TickCount; | ||
3465 | |||
3466 | if (ParentGroup.IsAttachment) | ||
3467 | { | ||
3468 | ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); | ||
3469 | if (sp != null) | ||
3470 | { | ||
3471 | sp.SendAttachmentUpdate(this, UpdateRequired.TERSE); | ||
3472 | } | ||
3473 | } | ||
3474 | else | ||
3475 | { | ||
3476 | ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) | ||
3477 | { | ||
3478 | SendTerseUpdateToClient(client); | ||
3479 | }); | ||
3480 | } | ||
3481 | } | ||
3482 | |||
3365 | public void SetAxisRotation(int axis, int rotate) | 3483 | public void SetAxisRotation(int axis, int rotate) |
3366 | { | 3484 | { |
3367 | ParentGroup.SetAxisRotation(axis, rotate); | 3485 | ParentGroup.SetAxisRotation(axis, rotate); |
@@ -3714,8 +3832,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3714 | // Name, groupID, OwnerID); | 3832 | // Name, groupID, OwnerID); |
3715 | 3833 | ||
3716 | GroupID = groupID; | 3834 | GroupID = groupID; |
3717 | if (client != null) | 3835 | // if (client != null) |
3718 | SendPropertiesToClient(client); | 3836 | // SendPropertiesToClient(client); |
3719 | UpdateFlag = UpdateRequired.FULL; | 3837 | UpdateFlag = UpdateRequired.FULL; |
3720 | } | 3838 | } |
3721 | 3839 | ||
@@ -4357,30 +4475,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
4357 | } | 4475 | } |
4358 | } | 4476 | } |
4359 | 4477 | ||
4360 | public void UpdateGroupPosition(Vector3 pos) | 4478 | public void UpdateGroupPosition(Vector3 newPos) |
4361 | { | 4479 | { |
4362 | if ((pos.X != GroupPosition.X) || | 4480 | Vector3 oldPos = GroupPosition; |
4363 | (pos.Y != GroupPosition.Y) || | 4481 | |
4364 | (pos.Z != GroupPosition.Z)) | 4482 | if ((newPos.X != oldPos.X) || |
4483 | (newPos.Y != oldPos.Y) || | ||
4484 | (newPos.Z != oldPos.Z)) | ||
4365 | { | 4485 | { |
4366 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); | ||
4367 | GroupPosition = newPos; | 4486 | GroupPosition = newPos; |
4368 | ScheduleTerseUpdate(); | 4487 | ScheduleTerseUpdate(); |
4369 | } | 4488 | } |
4370 | } | 4489 | } |
4371 | 4490 | ||
4372 | /// <summary> | 4491 | /// <summary> |
4373 | /// | 4492 | /// Update this part's offset position. |
4374 | /// </summary> | 4493 | /// </summary> |
4375 | /// <param name="pos"></param> | 4494 | /// <param name="pos"></param> |
4376 | public void UpdateOffSet(Vector3 pos) | 4495 | public void UpdateOffSet(Vector3 newPos) |
4377 | { | 4496 | { |
4378 | if ((pos.X != OffsetPosition.X) || | 4497 | Vector3 oldPos = OffsetPosition; |
4379 | (pos.Y != OffsetPosition.Y) || | ||
4380 | (pos.Z != OffsetPosition.Z)) | ||
4381 | { | ||
4382 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); | ||
4383 | 4498 | ||
4499 | if ((newPos.X != oldPos.X) || | ||
4500 | (newPos.Y != oldPos.Y) || | ||
4501 | (newPos.Z != oldPos.Z)) | ||
4502 | { | ||
4384 | if (ParentGroup.RootPart.GetStatusSandbox()) | 4503 | if (ParentGroup.RootPart.GetStatusSandbox()) |
4385 | { | 4504 | { |
4386 | if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10) | 4505 | if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10) |
@@ -4527,7 +4646,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4527 | // For now, we use the NINJA naming scheme for identifying joints. | 4646 | // For now, we use the NINJA naming scheme for identifying joints. |
4528 | // In the future, we can support other joint specification schemes such as a | 4647 | // In the future, we can support other joint specification schemes such as a |
4529 | // custom checkbox in the viewer GUI. | 4648 | // custom checkbox in the viewer GUI. |
4530 | if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) | 4649 | if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) |
4531 | { | 4650 | { |
4532 | return IsHingeJoint() || IsBallJoint(); | 4651 | return IsHingeJoint() || IsBallJoint(); |
4533 | } | 4652 | } |
@@ -4649,6 +4768,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4649 | } | 4768 | } |
4650 | } | 4769 | } |
4651 | */ | 4770 | */ |
4771 | if (pa != null) | ||
4772 | { | ||
4773 | pa.SetMaterial(Material); | ||
4774 | DoPhysicsPropertyUpdate(UsePhysics, true); | ||
4775 | } | ||
4652 | } | 4776 | } |
4653 | else // it already has a physical representation | 4777 | else // it already has a physical representation |
4654 | { | 4778 | { |
@@ -5021,6 +5145,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5021 | oldTex.DefaultTexture = fallbackOldFace; | 5145 | oldTex.DefaultTexture = fallbackOldFace; |
5022 | } | 5146 | } |
5023 | 5147 | ||
5148 | // Materials capable viewers can send a ObjectImage packet | ||
5149 | // when nothing in TE has changed. MaterialID should be updated | ||
5150 | // by the RenderMaterials CAP handler, so updating it here may cause a | ||
5151 | // race condtion. Therefore, if no non-materials TE fields have changed, | ||
5152 | // we should ignore any changes and not update Shape.TextureEntry | ||
5153 | |||
5154 | bool otherFieldsChanged = false; | ||
5155 | |||
5024 | for (int i = 0 ; i < GetNumberOfSides(); i++) | 5156 | for (int i = 0 ; i < GetNumberOfSides(); i++) |
5025 | { | 5157 | { |
5026 | 5158 | ||
@@ -5047,18 +5179,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
5047 | // Max change, skip the rest of testing | 5179 | // Max change, skip the rest of testing |
5048 | if (changeFlags == (Changed.TEXTURE | Changed.COLOR)) | 5180 | if (changeFlags == (Changed.TEXTURE | Changed.COLOR)) |
5049 | break; | 5181 | break; |
5182 | |||
5183 | if (!otherFieldsChanged) | ||
5184 | { | ||
5185 | if (oldFace.Bump != newFace.Bump) otherFieldsChanged = true; | ||
5186 | if (oldFace.Fullbright != newFace.Fullbright) otherFieldsChanged = true; | ||
5187 | if (oldFace.Glow != newFace.Glow) otherFieldsChanged = true; | ||
5188 | if (oldFace.MediaFlags != newFace.MediaFlags) otherFieldsChanged = true; | ||
5189 | if (oldFace.OffsetU != newFace.OffsetU) otherFieldsChanged = true; | ||
5190 | if (oldFace.OffsetV != newFace.OffsetV) otherFieldsChanged = true; | ||
5191 | if (oldFace.RepeatU != newFace.RepeatU) otherFieldsChanged = true; | ||
5192 | if (oldFace.RepeatV != newFace.RepeatV) otherFieldsChanged = true; | ||
5193 | if (oldFace.Rotation != newFace.Rotation) otherFieldsChanged = true; | ||
5194 | if (oldFace.Shiny != newFace.Shiny) otherFieldsChanged = true; | ||
5195 | if (oldFace.TexMapType != newFace.TexMapType) otherFieldsChanged = true; | ||
5196 | } | ||
5050 | } | 5197 | } |
5051 | 5198 | ||
5052 | m_shape.TextureEntry = newTex.GetBytes(); | 5199 | if (changeFlags != 0 || otherFieldsChanged) |
5053 | if (changeFlags != 0) | 5200 | { |
5054 | TriggerScriptChangedEvent(changeFlags); | 5201 | m_shape.TextureEntry = newTex.GetBytes(); |
5055 | UpdateFlag = UpdateRequired.FULL; | 5202 | if (changeFlags != 0) |
5056 | ParentGroup.HasGroupChanged = true; | 5203 | TriggerScriptChangedEvent(changeFlags); |
5204 | UpdateFlag = UpdateRequired.FULL; | ||
5205 | ParentGroup.HasGroupChanged = true; | ||
5057 | 5206 | ||
5058 | //This is madness.. | 5207 | //This is madness.. |
5059 | //ParentGroup.ScheduleGroupForFullUpdate(); | 5208 | //ParentGroup.ScheduleGroupForFullUpdate(); |
5060 | //This is sparta | 5209 | //This is sparta |
5061 | ScheduleFullUpdate(); | 5210 | ScheduleFullUpdate(); |
5211 | } | ||
5062 | } | 5212 | } |
5063 | 5213 | ||
5064 | 5214 | ||
@@ -5246,6 +5396,64 @@ namespace OpenSim.Region.Framework.Scenes | |||
5246 | { | 5396 | { |
5247 | ParentGroup.AddScriptLPS(count); | 5397 | ParentGroup.AddScriptLPS(count); |
5248 | } | 5398 | } |
5399 | |||
5400 | /// <summary> | ||
5401 | /// Sets a prim's owner and permissions when it's rezzed. | ||
5402 | /// </summary> | ||
5403 | /// <param name="item">The inventory item from which the item was rezzed</param> | ||
5404 | /// <param name="userInventory">True: the item is being rezzed from the user's inventory. False: from a prim's inventory.</param> | ||
5405 | /// <param name="scene">The scene the prim is being rezzed into</param> | ||
5406 | public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene) | ||
5407 | { | ||
5408 | if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)) | ||
5409 | { | ||
5410 | if (scene.Permissions.PropagatePermissions()) | ||
5411 | { | ||
5412 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
5413 | { | ||
5414 | // Apply the item's permissions to the object | ||
5415 | //LogPermissions("Before applying item permissions"); | ||
5416 | if (userInventory) | ||
5417 | { | ||
5418 | EveryoneMask = item.EveryOnePermissions; | ||
5419 | NextOwnerMask = item.NextPermissions; | ||
5420 | } | ||
5421 | else | ||
5422 | { | ||
5423 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
5424 | EveryoneMask = item.EveryOnePermissions; | ||
5425 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
5426 | NextOwnerMask = item.NextPermissions; | ||
5427 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
5428 | GroupMask = item.GroupPermissions; | ||
5429 | } | ||
5430 | //LogPermissions("After applying item permissions"); | ||
5431 | } | ||
5432 | } | ||
5433 | |||
5434 | GroupMask = 0; // DO NOT propagate here | ||
5435 | } | ||
5436 | |||
5437 | if (OwnerID != item.Owner) | ||
5438 | { | ||
5439 | //LogPermissions("Before ApplyNextOwnerPermissions"); | ||
5440 | ApplyNextOwnerPermissions(); | ||
5441 | //LogPermissions("After ApplyNextOwnerPermissions"); | ||
5442 | |||
5443 | LastOwnerID = OwnerID; | ||
5444 | OwnerID = item.Owner; | ||
5445 | Inventory.ChangeInventoryOwner(item.Owner); | ||
5446 | } | ||
5447 | } | ||
5448 | |||
5449 | /// <summary> | ||
5450 | /// Logs the prim's permissions. Useful when debugging permission problems. | ||
5451 | /// </summary> | ||
5452 | /// <param name="message"></param> | ||
5453 | private void LogPermissions(String message) | ||
5454 | { | ||
5455 | PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask); | ||
5456 | } | ||
5249 | 5457 | ||
5250 | public void ApplyNextOwnerPermissions() | 5458 | public void ApplyNextOwnerPermissions() |
5251 | { | 5459 | { |