aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs203
1 files changed, 156 insertions, 47 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 566605a..98ea880 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
@@ -815,7 +821,8 @@ namespace OpenSim.Region.Framework.Scenes
815 } 821 }
816 822
817 // Tell the physics engines that this prim changed. 823 // Tell the physics engines that this prim changed.
818 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 824 if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null)
825 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
819 } 826 }
820 catch (Exception e) 827 catch (Exception e)
821 { 828 {
@@ -933,7 +940,7 @@ namespace OpenSim.Region.Framework.Scenes
933 //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); 940 //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString());
934 } 941 }
935 942
936 if (ParentGroup != null) 943 if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null)
937 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 944 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
938 //} 945 //}
939 } 946 }
@@ -1218,23 +1225,14 @@ namespace OpenSim.Region.Framework.Scenes
1218 // the mappings more consistant. 1225 // the mappings more consistant.
1219 public Vector3 SitTargetPositionLL 1226 public Vector3 SitTargetPositionLL
1220 { 1227 {
1221 get { return new Vector3(m_sitTargetPosition.X, m_sitTargetPosition.Y,m_sitTargetPosition.Z); } 1228 get { return m_sitTargetPosition; }
1222 set { m_sitTargetPosition = value; } 1229 set { m_sitTargetPosition = value; }
1223 } 1230 }
1224 1231
1225 public Quaternion SitTargetOrientationLL 1232 public Quaternion SitTargetOrientationLL
1226 { 1233 {
1227 get 1234 get { return m_sitTargetOrientation; }
1228 { 1235 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 } 1236 }
1239 1237
1240 public bool Stopped 1238 public bool Stopped
@@ -2965,7 +2963,27 @@ namespace OpenSim.Region.Framework.Scenes
2965 } 2963 }
2966 //ParentGroup.RootPart.m_groupPosition = newpos; 2964 //ParentGroup.RootPart.m_groupPosition = newpos;
2967 } 2965 }
2968 2966/* ubit: there are no flexible links
2967 if (pa != null && ParentID != 0 && ParentGroup != null)
2968 {
2969 // Special case where a child object is requesting property updates.
2970 // This happens when linksets are modified to use flexible links rather than
2971 // the default links.
2972 // The simulator code presumes that child parts are only modified by scripts
2973 // so the logic for changing position/rotation/etc does not take into
2974 // account the physical object actually moving.
2975 // This code updates the offset position and rotation of the child and then
2976 // lets the update code push the update to the viewer.
2977 // Since physics engines do not normally generate this event for linkset children,
2978 // this code will not be active unless you have a specially configured
2979 // physics engine.
2980 Quaternion invRootRotation = Quaternion.Normalize(Quaternion.Inverse(ParentGroup.RootPart.RotationOffset));
2981 m_offsetPosition = pa.Position - m_groupPosition;
2982 RotationOffset = pa.Orientation * invRootRotation;
2983 // m_log.DebugFormat("{0} PhysicsRequestingTerseUpdate child: pos={1}, rot={2}, offPos={3}, offRot={4}",
2984 // "[SCENE OBJECT PART]", pa.Position, pa.Orientation, m_offsetPosition, RotationOffset);
2985 }
2986*/
2969 ScheduleTerseUpdate(); 2987 ScheduleTerseUpdate();
2970 } 2988 }
2971 2989
@@ -3144,7 +3162,8 @@ namespace OpenSim.Region.Framework.Scenes
3144 return; 3162 return;
3145 3163
3146 // This was pulled from SceneViewer. Attachments always receive full updates. 3164 // 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 3165 // This is needed because otherwise if only the root prim changes position, then
3166 // it looks as if the entire object has moved (including the other prims).
3148 if (ParentGroup.IsAttachment) 3167 if (ParentGroup.IsAttachment)
3149 { 3168 {
3150 ScheduleFullUpdate(); 3169 ScheduleFullUpdate();
@@ -3277,9 +3296,9 @@ namespace OpenSim.Region.Framework.Scenes
3277 return; 3296 return;
3278 3297
3279 // Suppress full updates during attachment editing 3298 // Suppress full updates during attachment editing
3280 // 3299 // sl Does send them
3281 if (ParentGroup.IsSelected && ParentGroup.IsAttachment) 3300 // if (ParentGroup.IsSelected && ParentGroup.IsAttachment)
3282 return; 3301 // return;
3283 3302
3284 if (ParentGroup.IsDeleted) 3303 if (ParentGroup.IsDeleted)
3285 return; 3304 return;
@@ -4357,30 +4376,31 @@ namespace OpenSim.Region.Framework.Scenes
4357 } 4376 }
4358 } 4377 }
4359 4378
4360 public void UpdateGroupPosition(Vector3 pos) 4379 public void UpdateGroupPosition(Vector3 newPos)
4361 { 4380 {
4362 if ((pos.X != GroupPosition.X) || 4381 Vector3 oldPos = GroupPosition;
4363 (pos.Y != GroupPosition.Y) || 4382
4364 (pos.Z != GroupPosition.Z)) 4383 if ((newPos.X != oldPos.X) ||
4384 (newPos.Y != oldPos.Y) ||
4385 (newPos.Z != oldPos.Z))
4365 { 4386 {
4366 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
4367 GroupPosition = newPos; 4387 GroupPosition = newPos;
4368 ScheduleTerseUpdate(); 4388 ScheduleTerseUpdate();
4369 } 4389 }
4370 } 4390 }
4371 4391
4372 /// <summary> 4392 /// <summary>
4373 /// 4393 /// Update this part's offset position.
4374 /// </summary> 4394 /// </summary>
4375 /// <param name="pos"></param> 4395 /// <param name="pos"></param>
4376 public void UpdateOffSet(Vector3 pos) 4396 public void UpdateOffSet(Vector3 newPos)
4377 { 4397 {
4378 if ((pos.X != OffsetPosition.X) || 4398 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 4399
4400 if ((newPos.X != oldPos.X) ||
4401 (newPos.Y != oldPos.Y) ||
4402 (newPos.Z != oldPos.Z))
4403 {
4384 if (ParentGroup.RootPart.GetStatusSandbox()) 4404 if (ParentGroup.RootPart.GetStatusSandbox())
4385 { 4405 {
4386 if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10) 4406 if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
@@ -4527,7 +4547,7 @@ namespace OpenSim.Region.Framework.Scenes
4527 // For now, we use the NINJA naming scheme for identifying joints. 4547 // 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 4548 // In the future, we can support other joint specification schemes such as a
4529 // custom checkbox in the viewer GUI. 4549 // custom checkbox in the viewer GUI.
4530 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) 4550 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4531 { 4551 {
4532 return IsHingeJoint() || IsBallJoint(); 4552 return IsHingeJoint() || IsBallJoint();
4533 } 4553 }
@@ -4649,6 +4669,11 @@ namespace OpenSim.Region.Framework.Scenes
4649 } 4669 }
4650 } 4670 }
4651*/ 4671*/
4672 if (pa != null)
4673 {
4674 pa.SetMaterial(Material);
4675 DoPhysicsPropertyUpdate(UsePhysics, true);
4676 }
4652 } 4677 }
4653 else // it already has a physical representation 4678 else // it already has a physical representation
4654 { 4679 {
@@ -5021,6 +5046,14 @@ namespace OpenSim.Region.Framework.Scenes
5021 oldTex.DefaultTexture = fallbackOldFace; 5046 oldTex.DefaultTexture = fallbackOldFace;
5022 } 5047 }
5023 5048
5049 // Materials capable viewers can send a ObjectImage packet
5050 // when nothing in TE has changed. MaterialID should be updated
5051 // by the RenderMaterials CAP handler, so updating it here may cause a
5052 // race condtion. Therefore, if no non-materials TE fields have changed,
5053 // we should ignore any changes and not update Shape.TextureEntry
5054
5055 bool otherFieldsChanged = false;
5056
5024 for (int i = 0 ; i < GetNumberOfSides(); i++) 5057 for (int i = 0 ; i < GetNumberOfSides(); i++)
5025 { 5058 {
5026 5059
@@ -5047,18 +5080,36 @@ namespace OpenSim.Region.Framework.Scenes
5047 // Max change, skip the rest of testing 5080 // Max change, skip the rest of testing
5048 if (changeFlags == (Changed.TEXTURE | Changed.COLOR)) 5081 if (changeFlags == (Changed.TEXTURE | Changed.COLOR))
5049 break; 5082 break;
5083
5084 if (!otherFieldsChanged)
5085 {
5086 if (oldFace.Bump != newFace.Bump) otherFieldsChanged = true;
5087 if (oldFace.Fullbright != newFace.Fullbright) otherFieldsChanged = true;
5088 if (oldFace.Glow != newFace.Glow) otherFieldsChanged = true;
5089 if (oldFace.MediaFlags != newFace.MediaFlags) otherFieldsChanged = true;
5090 if (oldFace.OffsetU != newFace.OffsetU) otherFieldsChanged = true;
5091 if (oldFace.OffsetV != newFace.OffsetV) otherFieldsChanged = true;
5092 if (oldFace.RepeatU != newFace.RepeatU) otherFieldsChanged = true;
5093 if (oldFace.RepeatV != newFace.RepeatV) otherFieldsChanged = true;
5094 if (oldFace.Rotation != newFace.Rotation) otherFieldsChanged = true;
5095 if (oldFace.Shiny != newFace.Shiny) otherFieldsChanged = true;
5096 if (oldFace.TexMapType != newFace.TexMapType) otherFieldsChanged = true;
5097 }
5050 } 5098 }
5051 5099
5052 m_shape.TextureEntry = newTex.GetBytes(); 5100 if (changeFlags != 0 || otherFieldsChanged)
5053 if (changeFlags != 0) 5101 {
5054 TriggerScriptChangedEvent(changeFlags); 5102 m_shape.TextureEntry = newTex.GetBytes();
5055 UpdateFlag = UpdateRequired.FULL; 5103 if (changeFlags != 0)
5056 ParentGroup.HasGroupChanged = true; 5104 TriggerScriptChangedEvent(changeFlags);
5105 UpdateFlag = UpdateRequired.FULL;
5106 ParentGroup.HasGroupChanged = true;
5057 5107
5058 //This is madness.. 5108 //This is madness..
5059 //ParentGroup.ScheduleGroupForFullUpdate(); 5109 //ParentGroup.ScheduleGroupForFullUpdate();
5060 //This is sparta 5110 //This is sparta
5061 ScheduleFullUpdate(); 5111 ScheduleFullUpdate();
5112 }
5062 } 5113 }
5063 5114
5064 5115
@@ -5246,6 +5297,64 @@ namespace OpenSim.Region.Framework.Scenes
5246 { 5297 {
5247 ParentGroup.AddScriptLPS(count); 5298 ParentGroup.AddScriptLPS(count);
5248 } 5299 }
5300
5301 /// <summary>
5302 /// Sets a prim's owner and permissions when it's rezzed.
5303 /// </summary>
5304 /// <param name="item">The inventory item from which the item was rezzed</param>
5305 /// <param name="userInventory">True: the item is being rezzed from the user's inventory. False: from a prim's inventory.</param>
5306 /// <param name="scene">The scene the prim is being rezzed into</param>
5307 public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene)
5308 {
5309 if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0))
5310 {
5311 if (scene.Permissions.PropagatePermissions())
5312 {
5313 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
5314 {
5315 // Apply the item's permissions to the object
5316 //LogPermissions("Before applying item permissions");
5317 if (userInventory)
5318 {
5319 EveryoneMask = item.EveryOnePermissions;
5320 NextOwnerMask = item.NextPermissions;
5321 }
5322 else
5323 {
5324 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
5325 EveryoneMask = item.EveryOnePermissions;
5326 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
5327 NextOwnerMask = item.NextPermissions;
5328 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
5329 GroupMask = item.GroupPermissions;
5330 }
5331 //LogPermissions("After applying item permissions");
5332 }
5333 }
5334
5335 GroupMask = 0; // DO NOT propagate here
5336 }
5337
5338 if (OwnerID != item.Owner)
5339 {
5340 //LogPermissions("Before ApplyNextOwnerPermissions");
5341 ApplyNextOwnerPermissions();
5342 //LogPermissions("After ApplyNextOwnerPermissions");
5343
5344 LastOwnerID = OwnerID;
5345 OwnerID = item.Owner;
5346 Inventory.ChangeInventoryOwner(item.Owner);
5347 }
5348 }
5349
5350 /// <summary>
5351 /// Logs the prim's permissions. Useful when debugging permission problems.
5352 /// </summary>
5353 /// <param name="message"></param>
5354 private void LogPermissions(String message)
5355 {
5356 PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask);
5357 }
5249 5358
5250 public void ApplyNextOwnerPermissions() 5359 public void ApplyNextOwnerPermissions()
5251 { 5360 {