aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorDiva Canto2012-04-06 20:35:01 -0700
committerDiva Canto2012-04-06 20:35:01 -0700
commit806082cd6eef607791aced965056eb4ce24ac5ce (patch)
treebda5bbedd106638459f2e6674a674b0d0a25ab73 /OpenSim/Region/Framework
parentMoved the inventory manipulation from HGEntityTransferModule to HGInventoryAc... (diff)
parentRather than having a FromFolderID property on every single prim and only ever... (diff)
downloadopensim-SC-806082cd6eef607791aced965056eb4ce24ac5ce.zip
opensim-SC-806082cd6eef607791aced965056eb4ce24ac5ce.tar.gz
opensim-SC-806082cd6eef607791aced965056eb4ce24ac5ce.tar.bz2
opensim-SC-806082cd6eef607791aced965056eb4ce24ac5ce.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs39
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs162
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs16
4 files changed, 128 insertions, 97 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 29825a2..e488fe1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2163,12 +2163,6 @@ namespace OpenSim.Region.Framework.Scenes
2163 part.RemoveFromPhysics(); 2163 part.RemoveFromPhysics();
2164 } 2164 }
2165 } 2165 }
2166
2167// if (rootPart.PhysActor != null)
2168// {
2169// PhysicsScene.RemovePrim(rootPart.PhysActor);
2170// rootPart.PhysActor = null;
2171// }
2172 2166
2173 if (UnlinkSceneObject(group, false)) 2167 if (UnlinkSceneObject(group, false))
2174 { 2168 {
@@ -2572,7 +2566,7 @@ namespace OpenSim.Region.Framework.Scenes
2572 SceneObjectGroup grp = sceneObject; 2566 SceneObjectGroup grp = sceneObject;
2573 2567
2574 m_log.DebugFormat( 2568 m_log.DebugFormat(
2575 "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); 2569 "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID);
2576 m_log.DebugFormat( 2570 m_log.DebugFormat(
2577 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); 2571 "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
2578 2572
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 87fdc41..17f3be7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -571,7 +571,9 @@ namespace OpenSim.Region.Framework.Scenes
571 set { m_LoopSoundSlavePrims = value; } 571 set { m_LoopSoundSlavePrims = value; }
572 } 572 }
573 573
574 // The UUID for the Region this Object is in. 574 /// <summary>
575 /// The UUID for the region this object is in.
576 /// </summary>
575 public UUID RegionUUID 577 public UUID RegionUUID
576 { 578 {
577 get 579 get
@@ -584,6 +586,22 @@ namespace OpenSim.Region.Framework.Scenes
584 } 586 }
585 } 587 }
586 588
589 /// <summary>
590 /// The item ID that this object was rezzed from, if applicable.
591 /// </summary>
592 /// <remarks>
593 /// If not applicable will be UUID.Zero
594 /// </remarks>
595 public UUID FromItemID { get; set; }
596
597 /// <summary>
598 /// The folder ID that this object was rezzed from, if applicable.
599 /// </summary>
600 /// <remarks>
601 /// If not applicable will be UUID.Zero
602 /// </remarks>
603 public UUID FromFolderID { get; set; }
604
587 #endregion 605 #endregion
588 606
589// ~SceneObjectGroup() 607// ~SceneObjectGroup()
@@ -646,18 +664,6 @@ namespace OpenSim.Region.Framework.Scenes
646 } 664 }
647 } 665 }
648 666
649 public void SetFromItemID(UUID AssetId)
650 {
651 SceneObjectPart[] parts = m_parts.GetArray();
652 for (int i = 0; i < parts.Length; i++)
653 parts[i].FromItemID = AssetId;
654 }
655
656 public UUID GetFromItemID()
657 {
658 return m_rootPart.FromItemID;
659 }
660
661 /// <summary> 667 /// <summary>
662 /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. 668 /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
663 /// </summary> 669 /// </summary>
@@ -2687,6 +2693,7 @@ namespace OpenSim.Region.Framework.Scenes
2687 { 2693 {
2688 m_rootPart.AttachedPos = pos; 2694 m_rootPart.AttachedPos = pos;
2689 } 2695 }
2696
2690 if (RootPart.GetStatusSandbox()) 2697 if (RootPart.GetStatusSandbox())
2691 { 2698 {
2692 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10) 2699 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
@@ -2697,8 +2704,8 @@ namespace OpenSim.Region.Framework.Scenes
2697 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); 2704 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
2698 } 2705 }
2699 } 2706 }
2700 AbsolutePosition = pos;
2701 2707
2708 AbsolutePosition = pos;
2702 HasGroupChanged = true; 2709 HasGroupChanged = true;
2703 } 2710 }
2704 2711
@@ -3270,7 +3277,7 @@ namespace OpenSim.Region.Framework.Scenes
3270 3277
3271 public virtual string ExtraToXmlString() 3278 public virtual string ExtraToXmlString()
3272 { 3279 {
3273 return "<ExtraFromItemID>" + GetFromItemID().ToString() + "</ExtraFromItemID>"; 3280 return "<ExtraFromItemID>" + FromItemID.ToString() + "</ExtraFromItemID>";
3274 } 3281 }
3275 3282
3276 public virtual void ExtraFromXmlString(string xmlstr) 3283 public virtual void ExtraFromXmlString(string xmlstr)
@@ -3282,7 +3289,7 @@ namespace OpenSim.Region.Framework.Scenes
3282 UUID uuid = UUID.Zero; 3289 UUID uuid = UUID.Zero;
3283 UUID.TryParse(id, out uuid); 3290 UUID.TryParse(id, out uuid);
3284 3291
3285 SetFromItemID(uuid); 3292 FromItemID = uuid;
3286 } 3293 }
3287 3294
3288 #endregion 3295 #endregion
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 2b1fba0..046553b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -125,12 +125,14 @@ namespace OpenSim.Region.Framework.Scenes
125 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 125 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
126 126
127 /// <value> 127 /// <value>
128 /// Is this sop a root part? 128 /// Is this a root part?
129 /// </value> 129 /// </value>
130 130 /// <remarks>
131 /// This will return true even if the whole object is attached to an avatar.
132 /// </remarks>
131 public bool IsRoot 133 public bool IsRoot
132 { 134 {
133 get { return ParentGroup.RootPart == this; } 135 get { return ParentGroup.RootPart == this; }
134 } 136 }
135 137
136 #region Fields 138 #region Fields
@@ -159,15 +161,7 @@ namespace OpenSim.Region.Framework.Scenes
159 /// If another thread is simultaneously turning physics off on this part then this refernece could become 161 /// If another thread is simultaneously turning physics off on this part then this refernece could become
160 /// null at any time. 162 /// null at any time.
161 /// </remarks> 163 /// </remarks>
162 public PhysicsActor PhysActor 164 public PhysicsActor PhysActor { get; set; }
163 {
164 get { return m_physActor; }
165 set
166 {
167// m_log.DebugFormat("[SOP]: PhysActor set to {0} for {1} {2}", value, Name, UUID);
168 m_physActor = value;
169 }
170 }
171 165
172 //Xantor 20080528 Sound stuff: 166 //Xantor 20080528 Sound stuff:
173 // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. 167 // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
@@ -187,10 +181,6 @@ namespace OpenSim.Region.Framework.Scenes
187 public uint TimeStampLastActivity; // Will be used for AutoReturn 181 public uint TimeStampLastActivity; // Will be used for AutoReturn
188 182
189 public uint TimeStampTerse; 183 public uint TimeStampTerse;
190
191 public UUID FromItemID;
192
193 public UUID FromFolderID;
194 184
195 public int STATUS_ROTATE_X; 185 public int STATUS_ROTATE_X;
196 186
@@ -266,7 +256,6 @@ namespace OpenSim.Region.Framework.Scenes
266 256
267 private bool m_passTouches; 257 private bool m_passTouches;
268 258
269 private PhysicsActor m_physActor;
270 protected Vector3 m_acceleration; 259 protected Vector3 m_acceleration;
271 protected Vector3 m_angularVelocity; 260 protected Vector3 m_angularVelocity;
272 261
@@ -1112,6 +1101,14 @@ namespace OpenSim.Region.Framework.Scenes
1112 } 1101 }
1113 } 1102 }
1114 1103
1104 /// <summary>
1105 /// The parent ID of this part.
1106 /// </summary>
1107 /// <remarks>
1108 /// If this is a root part which is not attached to an avatar then the value will be 0.
1109 /// If this is a root part which is attached to an avatar then the value is the local id of that avatar.
1110 /// If this is a child part then the value is the local ID of the root part.
1111 /// </remarks>
1115 public uint ParentID 1112 public uint ParentID
1116 { 1113 {
1117 get { return _parentID; } 1114 get { return _parentID; }
@@ -1488,40 +1485,17 @@ namespace OpenSim.Region.Framework.Scenes
1488 if (VolumeDetectActive) 1485 if (VolumeDetectActive)
1489 isPhantom = false; 1486 isPhantom = false;
1490 1487
1491 // Added clarification.. since A rigid body is an object that you can kick around, etc.
1492 bool RigidBody = isPhysical && !isPhantom;
1493
1494 // 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 1488 // 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
1495 // or flexible 1489 // or flexible
1496 if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) 1490 if (!isPhantom && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible))
1497 { 1491 {
1498 try 1492 // Added clarification.. since A rigid body is an object that you can kick around, etc.
1499 { 1493 bool rigidBody = isPhysical && !isPhantom;
1500 PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
1501 string.Format("{0}/{1}", Name, UUID),
1502 Shape,
1503 AbsolutePosition,
1504 Scale,
1505 RotationOffset,
1506 RigidBody,
1507 m_localId);
1508 }
1509 catch
1510 {
1511 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
1512 PhysActor = null;
1513 }
1514 1494
1515 // Basic Physics can also return null as well as an exception catch. 1495 PhysicsActor pa = AddToPhysics(rigidBody);
1516 PhysicsActor pa = PhysActor;
1517 1496
1518 if (pa != null) 1497 if (pa != null)
1519 {
1520 pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
1521 pa.SetMaterial(Material);
1522 DoPhysicsPropertyUpdate(RigidBody, true);
1523 pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0); 1498 pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
1524 }
1525 } 1499 }
1526 } 1500 }
1527 } 1501 }
@@ -4322,41 +4296,36 @@ namespace OpenSim.Region.Framework.Scenes
4322 if (ParentGroup.Scene == null) 4296 if (ParentGroup.Scene == null)
4323 return; 4297 return;
4324 4298
4325 if (ParentGroup.Scene.CollidablePrims && PhysActor == null) 4299 if (ParentGroup.Scene.CollidablePrims && pa == null)
4326 { 4300 {
4327 // It's not phantom anymore. So make sure the physics engine get's knowledge of it 4301 pa = AddToPhysics(UsePhysics);
4328 PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape(
4329 string.Format("{0}/{1}", Name, UUID),
4330 Shape,
4331 AbsolutePosition,
4332 Scale,
4333 RotationOffset,
4334 UsePhysics,
4335 m_localId);
4336 4302
4337 PhysActor.SetMaterial(Material); 4303 if (pa != null)
4338 DoPhysicsPropertyUpdate(UsePhysics, true);
4339
4340 if (!ParentGroup.IsDeleted)
4341 { 4304 {
4342 if (LocalId == ParentGroup.RootPart.LocalId) 4305 pa.SetMaterial(Material);
4306 DoPhysicsPropertyUpdate(UsePhysics, true);
4307
4308 if (!ParentGroup.IsDeleted)
4343 { 4309 {
4344 ParentGroup.CheckSculptAndLoad(); 4310 if (LocalId == ParentGroup.RootPart.LocalId)
4311 {
4312 ParentGroup.CheckSculptAndLoad();
4313 }
4314 }
4315
4316 if (
4317 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
4318 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
4319 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4320 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4321 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4322 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
4323 (CollisionSound != UUID.Zero)
4324 )
4325 {
4326 pa.OnCollisionUpdate += PhysicsCollision;
4327 pa.SubscribeEvents(1000);
4345 } 4328 }
4346 }
4347
4348 if (
4349 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
4350 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
4351 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4352 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4353 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4354 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
4355 (CollisionSound != UUID.Zero)
4356 )
4357 {
4358 PhysActor.OnCollisionUpdate += PhysicsCollision;
4359 PhysActor.SubscribeEvents(1000);
4360 } 4329 }
4361 } 4330 }
4362 else // it already has a physical representation 4331 else // it already has a physical representation
@@ -4418,7 +4387,52 @@ namespace OpenSim.Region.Framework.Scenes
4418 } 4387 }
4419 4388
4420 /// <summary> 4389 /// <summary>
4421 /// This removes the part from physics 4390 /// Adds this part to the physics scene.
4391 /// </summary>
4392 /// <remarks>This method also sets the PhysActor property.</remarks>
4393 /// <param name="rigidBody">Add this prim with a rigid body.</param>
4394 /// <returns>
4395 /// The physics actor. null if there was a failure.
4396 /// </returns>
4397 private PhysicsActor AddToPhysics(bool rigidBody)
4398 {
4399 PhysicsActor pa;
4400
4401 try
4402 {
4403 pa = ParentGroup.Scene.PhysicsScene.AddPrimShape(
4404 string.Format("{0}/{1}", Name, UUID),
4405 Shape,
4406 AbsolutePosition,
4407 Scale,
4408 RotationOffset,
4409 rigidBody,
4410 m_localId);
4411 }
4412 catch
4413 {
4414 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
4415 pa = null;
4416 }
4417
4418 // FIXME: Ideally we wouldn't set the property here to reduce situations where threads changing physical
4419 // properties can stop on each other. However, DoPhysicsPropertyUpdate() currently relies on PhysActor
4420 // being set.
4421 PhysActor = pa;
4422
4423 // Basic Physics can also return null as well as an exception catch.
4424 if (pa != null)
4425 {
4426 pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
4427 pa.SetMaterial(Material);
4428 DoPhysicsPropertyUpdate(rigidBody, true);
4429 }
4430
4431 return pa;
4432 }
4433
4434 /// <summary>
4435 /// This removes the part from the physics scene.
4422 /// </summary> 4436 /// </summary>
4423 /// <remarks> 4437 /// <remarks>
4424 /// This isn't the same as turning off physical, since even without being physical the prim has a physics 4438 /// This isn't the same as turning off physical, since even without being physical the prim has a physics
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 19dab32..a21c66f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3514,6 +3514,22 @@ namespace OpenSim.Region.Framework.Scenes
3514 }); 3514 });
3515 } 3515 }
3516 3516
3517 /// <summary>
3518 /// Gets the mass.
3519 /// </summary>
3520 /// <returns>
3521 /// The mass.
3522 /// </returns>
3523 public float GetMass()
3524 {
3525 PhysicsActor pa = PhysicsActor;
3526
3527 if (pa != null)
3528 return pa.Mass;
3529 else
3530 return 0;
3531 }
3532
3517 internal void PushForce(Vector3 impulse) 3533 internal void PushForce(Vector3 impulse)
3518 { 3534 {
3519 if (PhysicsActor != null) 3535 if (PhysicsActor != null)