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.cs192
1 files changed, 152 insertions, 40 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 261e958..ce9baaa 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
@@ -383,8 +390,6 @@ namespace OpenSim.Region.Framework.Scenes
383 390
384 private SOPVehicle m_vehicleParams = null; 391 private SOPVehicle m_vehicleParams = null;
385 392
386 private KeyframeMotion m_keyframeMotion = null;
387
388 public KeyframeMotion KeyframeMotion 393 public KeyframeMotion KeyframeMotion
389 { 394 {
390 get; set; 395 get; set;
@@ -506,7 +511,7 @@ namespace OpenSim.Region.Framework.Scenes
506 { 511 {
507 get 512 get
508 { 513 {
509 if (CreatorData != null && CreatorData != string.Empty) 514 if (!string.IsNullOrEmpty(CreatorData))
510 return CreatorID.ToString() + ';' + CreatorData; 515 return CreatorID.ToString() + ';' + CreatorData;
511 else 516 else
512 return CreatorID.ToString(); 517 return CreatorID.ToString();
@@ -536,7 +541,11 @@ namespace OpenSim.Region.Framework.Scenes
536 CreatorID = uuid; 541 CreatorID = uuid;
537 } 542 }
538 if (parts.Length >= 2) 543 if (parts.Length >= 2)
544 {
539 CreatorData = parts[1]; 545 CreatorData = parts[1];
546 if (!CreatorData.EndsWith("/"))
547 CreatorData += "/";
548 }
540 if (parts.Length >= 3) 549 if (parts.Length >= 3)
541 name = parts[2]; 550 name = parts[2];
542 551
@@ -815,7 +824,8 @@ namespace OpenSim.Region.Framework.Scenes
815 } 824 }
816 825
817 // Tell the physics engines that this prim changed. 826 // Tell the physics engines that this prim changed.
818 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 827 if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null)
828 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
819 } 829 }
820 catch (Exception e) 830 catch (Exception e)
821 { 831 {
@@ -933,7 +943,7 @@ namespace OpenSim.Region.Framework.Scenes
933 //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); 943 //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString());
934 } 944 }
935 945
936 if (ParentGroup != null) 946 if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null)
937 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 947 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
938 //} 948 //}
939 } 949 }
@@ -1218,23 +1228,14 @@ namespace OpenSim.Region.Framework.Scenes
1218 // the mappings more consistant. 1228 // the mappings more consistant.
1219 public Vector3 SitTargetPositionLL 1229 public Vector3 SitTargetPositionLL
1220 { 1230 {
1221 get { return new Vector3(m_sitTargetPosition.X, m_sitTargetPosition.Y,m_sitTargetPosition.Z); } 1231 get { return m_sitTargetPosition; }
1222 set { m_sitTargetPosition = value; } 1232 set { m_sitTargetPosition = value; }
1223 } 1233 }
1224 1234
1225 public Quaternion SitTargetOrientationLL 1235 public Quaternion SitTargetOrientationLL
1226 { 1236 {
1227 get 1237 get { return m_sitTargetOrientation; }
1228 { 1238 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 } 1239 }
1239 1240
1240 public bool Stopped 1241 public bool Stopped
@@ -2959,6 +2960,26 @@ namespace OpenSim.Region.Framework.Scenes
2959 //ParentGroup.RootPart.m_groupPosition = newpos; 2960 //ParentGroup.RootPart.m_groupPosition = newpos;
2960 } 2961 }
2961 2962
2963 if (pa != null && ParentID != 0 && ParentGroup != null)
2964 {
2965 // Special case where a child object is requesting property updates.
2966 // This happens when linksets are modified to use flexible links rather than
2967 // the default links.
2968 // The simulator code presumes that child parts are only modified by scripts
2969 // so the logic for changing position/rotation/etc does not take into
2970 // account the physical object actually moving.
2971 // This code updates the offset position and rotation of the child and then
2972 // lets the update code push the update to the viewer.
2973 // Since physics engines do not normally generate this event for linkset children,
2974 // this code will not be active unless you have a specially configured
2975 // physics engine.
2976 Quaternion invRootRotation = Quaternion.Normalize(Quaternion.Inverse(ParentGroup.RootPart.RotationOffset));
2977 m_offsetPosition = pa.Position - m_groupPosition;
2978 RotationOffset = pa.Orientation * invRootRotation;
2979 // m_log.DebugFormat("{0} PhysicsRequestingTerseUpdate child: pos={1}, rot={2}, offPos={3}, offRot={4}",
2980 // "[SCENE OBJECT PART]", pa.Position, pa.Orientation, m_offsetPosition, RotationOffset);
2981 }
2982
2962 ScheduleTerseUpdate(); 2983 ScheduleTerseUpdate();
2963 } 2984 }
2964 2985
@@ -3137,7 +3158,8 @@ namespace OpenSim.Region.Framework.Scenes
3137 return; 3158 return;
3138 3159
3139 // This was pulled from SceneViewer. Attachments always receive full updates. 3160 // This was pulled from SceneViewer. Attachments always receive full updates.
3140 // I could not verify if this is a requirement but this maintains existing behavior 3161 // This is needed because otherwise if only the root prim changes position, then
3162 // it looks as if the entire object has moved (including the other prims).
3141 if (ParentGroup.IsAttachment) 3163 if (ParentGroup.IsAttachment)
3142 { 3164 {
3143 ScheduleFullUpdate(); 3165 ScheduleFullUpdate();
@@ -4350,30 +4372,31 @@ namespace OpenSim.Region.Framework.Scenes
4350 } 4372 }
4351 } 4373 }
4352 4374
4353 public void UpdateGroupPosition(Vector3 pos) 4375 public void UpdateGroupPosition(Vector3 newPos)
4354 { 4376 {
4355 if ((pos.X != GroupPosition.X) || 4377 Vector3 oldPos = GroupPosition;
4356 (pos.Y != GroupPosition.Y) || 4378
4357 (pos.Z != GroupPosition.Z)) 4379 if ((newPos.X != oldPos.X) ||
4380 (newPos.Y != oldPos.Y) ||
4381 (newPos.Z != oldPos.Z))
4358 { 4382 {
4359 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
4360 GroupPosition = newPos; 4383 GroupPosition = newPos;
4361 ScheduleTerseUpdate(); 4384 ScheduleTerseUpdate();
4362 } 4385 }
4363 } 4386 }
4364 4387
4365 /// <summary> 4388 /// <summary>
4366 /// 4389 /// Update this part's offset position.
4367 /// </summary> 4390 /// </summary>
4368 /// <param name="pos"></param> 4391 /// <param name="pos"></param>
4369 public void UpdateOffSet(Vector3 pos) 4392 public void UpdateOffSet(Vector3 newPos)
4370 { 4393 {
4371 if ((pos.X != OffsetPosition.X) || 4394 Vector3 oldPos = OffsetPosition;
4372 (pos.Y != OffsetPosition.Y) ||
4373 (pos.Z != OffsetPosition.Z))
4374 {
4375 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
4376 4395
4396 if ((newPos.X != oldPos.X) ||
4397 (newPos.Y != oldPos.Y) ||
4398 (newPos.Z != oldPos.Z))
4399 {
4377 if (ParentGroup.RootPart.GetStatusSandbox()) 4400 if (ParentGroup.RootPart.GetStatusSandbox())
4378 { 4401 {
4379 if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10) 4402 if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
@@ -4520,7 +4543,7 @@ namespace OpenSim.Region.Framework.Scenes
4520 // For now, we use the NINJA naming scheme for identifying joints. 4543 // For now, we use the NINJA naming scheme for identifying joints.
4521 // In the future, we can support other joint specification schemes such as a 4544 // In the future, we can support other joint specification schemes such as a
4522 // custom checkbox in the viewer GUI. 4545 // custom checkbox in the viewer GUI.
4523 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) 4546 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4524 { 4547 {
4525 return IsHingeJoint() || IsBallJoint(); 4548 return IsHingeJoint() || IsBallJoint();
4526 } 4549 }
@@ -4642,6 +4665,11 @@ namespace OpenSim.Region.Framework.Scenes
4642 } 4665 }
4643 } 4666 }
4644*/ 4667*/
4668 if (pa != null)
4669 {
4670 pa.SetMaterial(Material);
4671 DoPhysicsPropertyUpdate(UsePhysics, true);
4672 }
4645 } 4673 }
4646 else // it already has a physical representation 4674 else // it already has a physical representation
4647 { 4675 {
@@ -5014,6 +5042,14 @@ namespace OpenSim.Region.Framework.Scenes
5014 oldTex.DefaultTexture = fallbackOldFace; 5042 oldTex.DefaultTexture = fallbackOldFace;
5015 } 5043 }
5016 5044
5045 // Materials capable viewers can send a ObjectImage packet
5046 // when nothing in TE has changed. MaterialID should be updated
5047 // by the RenderMaterials CAP handler, so updating it here may cause a
5048 // race condtion. Therefore, if no non-materials TE fields have changed,
5049 // we should ignore any changes and not update Shape.TextureEntry
5050
5051 bool otherFieldsChanged = false;
5052
5017 for (int i = 0 ; i < GetNumberOfSides(); i++) 5053 for (int i = 0 ; i < GetNumberOfSides(); i++)
5018 { 5054 {
5019 5055
@@ -5040,18 +5076,36 @@ namespace OpenSim.Region.Framework.Scenes
5040 // Max change, skip the rest of testing 5076 // Max change, skip the rest of testing
5041 if (changeFlags == (Changed.TEXTURE | Changed.COLOR)) 5077 if (changeFlags == (Changed.TEXTURE | Changed.COLOR))
5042 break; 5078 break;
5079
5080 if (!otherFieldsChanged)
5081 {
5082 if (oldFace.Bump != newFace.Bump) otherFieldsChanged = true;
5083 if (oldFace.Fullbright != newFace.Fullbright) otherFieldsChanged = true;
5084 if (oldFace.Glow != newFace.Glow) otherFieldsChanged = true;
5085 if (oldFace.MediaFlags != newFace.MediaFlags) otherFieldsChanged = true;
5086 if (oldFace.OffsetU != newFace.OffsetU) otherFieldsChanged = true;
5087 if (oldFace.OffsetV != newFace.OffsetV) otherFieldsChanged = true;
5088 if (oldFace.RepeatU != newFace.RepeatU) otherFieldsChanged = true;
5089 if (oldFace.RepeatV != newFace.RepeatV) otherFieldsChanged = true;
5090 if (oldFace.Rotation != newFace.Rotation) otherFieldsChanged = true;
5091 if (oldFace.Shiny != newFace.Shiny) otherFieldsChanged = true;
5092 if (oldFace.TexMapType != newFace.TexMapType) otherFieldsChanged = true;
5093 }
5043 } 5094 }
5044 5095
5045 m_shape.TextureEntry = newTex.GetBytes(); 5096 if (changeFlags != 0 || otherFieldsChanged)
5046 if (changeFlags != 0) 5097 {
5047 TriggerScriptChangedEvent(changeFlags); 5098 m_shape.TextureEntry = newTex.GetBytes();
5048 UpdateFlag = UpdateRequired.FULL; 5099 if (changeFlags != 0)
5049 ParentGroup.HasGroupChanged = true; 5100 TriggerScriptChangedEvent(changeFlags);
5101 UpdateFlag = UpdateRequired.FULL;
5102 ParentGroup.HasGroupChanged = true;
5050 5103
5051 //This is madness.. 5104 //This is madness..
5052 //ParentGroup.ScheduleGroupForFullUpdate(); 5105 //ParentGroup.ScheduleGroupForFullUpdate();
5053 //This is sparta 5106 //This is sparta
5054 ScheduleFullUpdate(); 5107 ScheduleFullUpdate();
5108 }
5055 } 5109 }
5056 5110
5057 5111
@@ -5239,6 +5293,64 @@ namespace OpenSim.Region.Framework.Scenes
5239 { 5293 {
5240 ParentGroup.AddScriptLPS(count); 5294 ParentGroup.AddScriptLPS(count);
5241 } 5295 }
5296
5297 /// <summary>
5298 /// Sets a prim's owner and permissions when it's rezzed.
5299 /// </summary>
5300 /// <param name="item">The inventory item from which the item was rezzed</param>
5301 /// <param name="userInventory">True: the item is being rezzed from the user's inventory. False: from a prim's inventory.</param>
5302 /// <param name="scene">The scene the prim is being rezzed into</param>
5303 public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene)
5304 {
5305 if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0))
5306 {
5307 if (scene.Permissions.PropagatePermissions())
5308 {
5309 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
5310 {
5311 // Apply the item's permissions to the object
5312 //LogPermissions("Before applying item permissions");
5313 if (userInventory)
5314 {
5315 EveryoneMask = item.EveryOnePermissions;
5316 NextOwnerMask = item.NextPermissions;
5317 }
5318 else
5319 {
5320 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
5321 EveryoneMask = item.EveryOnePermissions;
5322 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
5323 NextOwnerMask = item.NextPermissions;
5324 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
5325 GroupMask = item.GroupPermissions;
5326 }
5327 //LogPermissions("After applying item permissions");
5328 }
5329 }
5330
5331 GroupMask = 0; // DO NOT propagate here
5332 }
5333
5334 if (OwnerID != item.Owner)
5335 {
5336 //LogPermissions("Before ApplyNextOwnerPermissions");
5337 ApplyNextOwnerPermissions();
5338 //LogPermissions("After ApplyNextOwnerPermissions");
5339
5340 LastOwnerID = OwnerID;
5341 OwnerID = item.Owner;
5342 Inventory.ChangeInventoryOwner(item.Owner);
5343 }
5344 }
5345
5346 /// <summary>
5347 /// Logs the prim's permissions. Useful when debugging permission problems.
5348 /// </summary>
5349 /// <param name="message"></param>
5350 private void LogPermissions(String message)
5351 {
5352 PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask);
5353 }
5242 5354
5243 public void ApplyNextOwnerPermissions() 5355 public void ApplyNextOwnerPermissions()
5244 { 5356 {