aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-07-11 02:09:11 +0100
committerJustin Clark-Casey (justincc)2011-07-11 02:09:11 +0100
commitc964114f7e1fd76970db4904a9bfd6a2cfad10b9 (patch)
tree5a2c7dbeb90bad16687678a95f8136ff0992b896 /OpenSim/Region/Framework
parentrefactor: slightly simplify test (diff)
downloadopensim-SC-c964114f7e1fd76970db4904a9bfd6a2cfad10b9.zip
opensim-SC-c964114f7e1fd76970db4904a9bfd6a2cfad10b9.tar.gz
opensim-SC-c964114f7e1fd76970db4904a9bfd6a2cfad10b9.tar.bz2
opensim-SC-c964114f7e1fd76970db4904a9bfd6a2cfad10b9.tar.xz
refactor: make argument to SOP.UpdatePrimFlags() more readable
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs33
1 files changed, 19 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 307c92a..1a58952 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1068,7 +1068,6 @@ namespace OpenSim.Region.Framework.Scenes
1068 } 1068 }
1069 } 1069 }
1070 1070
1071
1072 public bool CreateSelected 1071 public bool CreateSelected
1073 { 1072 {
1074 get { return m_createSelected; } 1073 get { return m_createSelected; }
@@ -1241,7 +1240,9 @@ namespace OpenSim.Region.Framework.Scenes
1241 /// <summary> 1240 /// <summary>
1242 /// Property flags. See OpenMetaverse.PrimFlags 1241 /// Property flags. See OpenMetaverse.PrimFlags
1243 /// </summary> 1242 /// </summary>
1243 /// <remarks>
1244 /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge 1244 /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge
1245 /// </remarks>
1245 public PrimFlags Flags 1246 public PrimFlags Flags
1246 { 1247 {
1247 get { return _flags; } 1248 get { return _flags; }
@@ -4324,14 +4325,21 @@ namespace OpenSim.Region.Framework.Scenes
4324 } 4325 }
4325 } 4326 }
4326 4327
4327 public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom, bool IsVD) 4328 /// <summary>
4329 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary.
4330 /// </summary>
4331 /// <param name="UsePhysics"></param>
4332 /// <param name="SetTemporary"></param>
4333 /// <param name="SetPhantom"></param>
4334 /// <param name="SetVD"></param>
4335 public void UpdatePrimFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVD)
4328 { 4336 {
4329 bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0); 4337 bool wasUsingPhysics = ((Flags & PrimFlags.Physics) != 0);
4330 bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0); 4338 bool wasTemporary = ((Flags & PrimFlags.TemporaryOnRez) != 0);
4331 bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0); 4339 bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0);
4332 bool wasVD = VolumeDetectActive; 4340 bool wasVD = VolumeDetectActive;
4333 4341
4334 if ((UsePhysics == wasUsingPhysics) && (wasTemporary == IsTemporary) && (wasPhantom == IsPhantom) && (IsVD==wasVD)) 4342 if ((UsePhysics == wasUsingPhysics) && (wasTemporary == SetTemporary) && (wasPhantom == SetPhantom) && (SetVD== wasVD))
4335 { 4343 {
4336 return; 4344 return;
4337 } 4345 }
@@ -4341,32 +4349,31 @@ namespace OpenSim.Region.Framework.Scenes
4341 // that... 4349 // that...
4342 // ... if VD is changed, all others are not. 4350 // ... if VD is changed, all others are not.
4343 // ... if one of the others is changed, VD is not. 4351 // ... if one of the others is changed, VD is not.
4344 if (IsVD) // VD is active, special logic applies 4352 if (SetVD) // VD is active, special logic applies
4345 { 4353 {
4346 // State machine logic for VolumeDetect 4354 // State machine logic for VolumeDetect
4347 // More logic below 4355 // More logic below
4348 bool phanReset = (IsPhantom != wasPhantom) && !IsPhantom; 4356 bool phanReset = (SetPhantom != wasPhantom) && !SetPhantom;
4349 4357
4350 if (phanReset) // Phantom changes from on to off switch VD off too 4358 if (phanReset) // Phantom changes from on to off switch VD off too
4351 { 4359 {
4352 IsVD = false; // Switch it of for the course of this routine 4360 SetVD = false; // Switch it of for the course of this routine
4353 VolumeDetectActive = false; // and also permanently 4361 VolumeDetectActive = false; // and also permanently
4354 if (PhysActor != null) 4362 if (PhysActor != null)
4355 PhysActor.SetVolumeDetect(0); // Let physics know about it too 4363 PhysActor.SetVolumeDetect(0); // Let physics know about it too
4356 } 4364 }
4357 else 4365 else
4358 { 4366 {
4359 IsPhantom = false;
4360 // If volumedetect is active we don't want phantom to be applied. 4367 // If volumedetect is active we don't want phantom to be applied.
4361 // If this is a new call to VD out of the state "phantom" 4368 // If this is a new call to VD out of the state "phantom"
4362 // this will also cause the prim to be visible to physics 4369 // this will also cause the prim to be visible to physics
4370 SetPhantom = false;
4363 } 4371 }
4364
4365 } 4372 }
4366 4373
4367 if (UsePhysics && IsJoint()) 4374 if (UsePhysics && IsJoint())
4368 { 4375 {
4369 IsPhantom = true; 4376 SetPhantom = true;
4370 } 4377 }
4371 4378
4372 if (UsePhysics) 4379 if (UsePhysics)
@@ -4396,8 +4403,7 @@ namespace OpenSim.Region.Framework.Scenes
4396 } 4403 }
4397 } 4404 }
4398 4405
4399 4406 if (SetPhantom || IsAttachment || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
4400 if (IsPhantom || IsAttachment || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
4401 { 4407 {
4402 AddFlag(PrimFlags.Phantom); 4408 AddFlag(PrimFlags.Phantom);
4403 if (PhysActor != null) 4409 if (PhysActor != null)
@@ -4471,7 +4477,7 @@ namespace OpenSim.Region.Framework.Scenes
4471 } 4477 }
4472 } 4478 }
4473 4479
4474 if (IsVD) 4480 if (SetVD)
4475 { 4481 {
4476 // If the above logic worked (this is urgent candidate to unit tests!) 4482 // If the above logic worked (this is urgent candidate to unit tests!)
4477 // we now have a physicsactor. 4483 // we now have a physicsactor.
@@ -4496,8 +4502,7 @@ namespace OpenSim.Region.Framework.Scenes
4496 this.VolumeDetectActive = false; 4502 this.VolumeDetectActive = false;
4497 } 4503 }
4498 4504
4499 4505 if (SetTemporary)
4500 if (IsTemporary)
4501 { 4506 {
4502 AddFlag(PrimFlags.TemporaryOnRez); 4507 AddFlag(PrimFlags.TemporaryOnRez);
4503 } 4508 }