aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorUbitUmarov2012-03-06 05:13:39 +0000
committerUbitUmarov2012-03-06 05:13:39 +0000
commitcca94aaefc36fad366e789d6d2e902dda078e3f7 (patch)
tree8bd6bb928db2ef969ed768ee3f8ede8abf3afa91 /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
downloadopensim-SC_OLD-cca94aaefc36fad366e789d6d2e902dda078e3f7.zip
opensim-SC_OLD-cca94aaefc36fad366e789d6d2e902dda078e3f7.tar.gz
opensim-SC_OLD-cca94aaefc36fad366e789d6d2e902dda078e3f7.tar.bz2
opensim-SC_OLD-cca94aaefc36fad366e789d6d2e902dda078e3f7.tar.xz
make copied parts have diferent LocalIds than original. More building control for ubitODE. for all let physics know about linking of physical parts. Assume UNTESTED
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs74
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs5
2 files changed, 74 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index c9ea8e4..b99f80d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -957,12 +957,21 @@ namespace OpenSim.Region.Framework.Scenes
957 /// <returns></returns> 957 /// <returns></returns>
958 public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) 958 public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
959 { 959 {
960 /* ????
960 maxX = -256f; 961 maxX = -256f;
961 maxY = -256f; 962 maxY = -256f;
962 maxZ = -256f; 963 maxZ = -256f;
963 minX = 256f; 964 minX = 256f;
964 minY = 256f; 965 minY = 256f;
965 minZ = 8192f; 966 minZ = 8192f;
967 */
968
969 maxX = float.MinValue;
970 maxY = float.MinValue;
971 maxZ = float.MinValue;
972 minX = float.MaxValue;
973 minY = float.MaxValue;
974 minZ = float.MaxValue;
966 975
967 SceneObjectPart[] parts = m_parts.GetArray(); 976 SceneObjectPart[] parts = m_parts.GetArray();
968 foreach (SceneObjectPart part in parts) 977 foreach (SceneObjectPart part in parts)
@@ -1918,6 +1927,8 @@ namespace OpenSim.Region.Framework.Scenes
1918 dupe.IsAttachment = previousAttachmentStatus; 1927 dupe.IsAttachment = previousAttachmentStatus;
1919 } 1928 }
1920 1929
1930
1931
1921 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 1932 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
1922 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 1933 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
1923 1934
@@ -1988,7 +1999,12 @@ namespace OpenSim.Region.Framework.Scenes
1988 /// <param name="cGroupID"></param> 1999 /// <param name="cGroupID"></param>
1989 public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) 2000 public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
1990 { 2001 {
1991 SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed)); 2002 // SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed));
2003 // give newpart a new local ID lettng old part keep same
2004 SceneObjectPart newpart = part.Copy(part.LocalId, OwnerID, GroupID, 0, userExposed);
2005 newpart.LocalId = m_scene.AllocateLocalId();
2006
2007 SetRootPart(newpart);
1992 if (userExposed) 2008 if (userExposed)
1993 RootPart.Velocity = Vector3.Zero; // In case source is moving 2009 RootPart.Velocity = Vector3.Zero; // In case source is moving
1994 } 2010 }
@@ -2191,7 +2207,10 @@ namespace OpenSim.Region.Framework.Scenes
2191 /// <param name="cGroupID"></param> 2207 /// <param name="cGroupID"></param>
2192 public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) 2208 public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
2193 { 2209 {
2194 SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed); 2210 // give new ID to the new part, letting old keep original
2211 // SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed);
2212 SceneObjectPart newPart = part.Copy(part.LocalId, OwnerID, GroupID, m_parts.Count, userExposed);
2213 newPart.LocalId = m_scene.AllocateLocalId();
2195 newPart.SetParent(this); 2214 newPart.SetParent(this);
2196 2215
2197 AddPart(newPart); 2216 AddPart(newPart);
@@ -2485,6 +2504,11 @@ namespace OpenSim.Region.Framework.Scenes
2485 2504
2486 SceneObjectPart linkPart = objectGroup.m_rootPart; 2505 SceneObjectPart linkPart = objectGroup.m_rootPart;
2487 2506
2507 if (m_rootPart.PhysActor != null)
2508 m_rootPart.PhysActor.Building = true;
2509 if (linkPart.PhysActor != null)
2510 linkPart.PhysActor.Building = true;
2511
2488 Vector3 oldGroupPosition = linkPart.GroupPosition; 2512 Vector3 oldGroupPosition = linkPart.GroupPosition;
2489 Quaternion oldRootRotation = linkPart.RotationOffset; 2513 Quaternion oldRootRotation = linkPart.RotationOffset;
2490 2514
@@ -2528,6 +2552,13 @@ namespace OpenSim.Region.Framework.Scenes
2528 linkPart.SetParent(this); 2552 linkPart.SetParent(this);
2529 linkPart.CreateSelected = true; 2553 linkPart.CreateSelected = true;
2530 2554
2555 // let physics know
2556 if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
2557 {
2558 linkPart.PhysActor.link(m_rootPart.PhysActor);
2559 this.Scene.PhysicsScene.AddPhysicsActorTaint(linkPart.PhysActor);
2560 }
2561
2531 linkPart.LinkNum = linkNum++; 2562 linkPart.LinkNum = linkNum++;
2532 2563
2533 SceneObjectPart[] ogParts = objectGroup.Parts; 2564 SceneObjectPart[] ogParts = objectGroup.Parts;
@@ -2540,7 +2571,15 @@ namespace OpenSim.Region.Framework.Scenes
2540 { 2571 {
2541 SceneObjectPart part = ogParts[i]; 2572 SceneObjectPart part = ogParts[i];
2542 if (part.UUID != objectGroup.m_rootPart.UUID) 2573 if (part.UUID != objectGroup.m_rootPart.UUID)
2574 {
2543 LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++); 2575 LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++);
2576 // let physics know
2577 if (part.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
2578 {
2579 part.PhysActor.link(m_rootPart.PhysActor);
2580 this.Scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
2581 }
2582 }
2544 part.ClearUndoState(); 2583 part.ClearUndoState();
2545 } 2584 }
2546 } 2585 }
@@ -2560,6 +2599,9 @@ namespace OpenSim.Region.Framework.Scenes
2560 // unmoved prims! 2599 // unmoved prims!
2561 ResetChildPrimPhysicsPositions(); 2600 ResetChildPrimPhysicsPositions();
2562 2601
2602 if (m_rootPart.PhysActor != null)
2603 m_rootPart.PhysActor.Building = false;
2604
2563 //HasGroupChanged = true; 2605 //HasGroupChanged = true;
2564 //ScheduleGroupForFullUpdate(); 2606 //ScheduleGroupForFullUpdate();
2565 } 2607 }
@@ -2612,7 +2654,10 @@ namespace OpenSim.Region.Framework.Scenes
2612// m_log.DebugFormat( 2654// m_log.DebugFormat(
2613// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", 2655// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
2614// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); 2656// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
2615 2657
2658 if (m_rootPart.PhysActor != null)
2659 m_rootPart.PhysActor.Building = true;
2660
2616 linkPart.ClearUndoState(); 2661 linkPart.ClearUndoState();
2617 2662
2618 Quaternion worldRot = linkPart.GetWorldRotation(); 2663 Quaternion worldRot = linkPart.GetWorldRotation();
@@ -2672,6 +2717,10 @@ namespace OpenSim.Region.Framework.Scenes
2672 2717
2673 // When we delete a group, we currently have to force persist to the database if the object id has changed 2718 // When we delete a group, we currently have to force persist to the database if the object id has changed
2674 // (since delete works by deleting all rows which have a given object id) 2719 // (since delete works by deleting all rows which have a given object id)
2720
2721 if (m_rootPart.PhysActor != null)
2722 m_rootPart.PhysActor.Building = false;
2723
2675 objectGroup.HasGroupChangedDueToDelink = true; 2724 objectGroup.HasGroupChangedDueToDelink = true;
2676 2725
2677 return objectGroup; 2726 return objectGroup;
@@ -3284,6 +3333,10 @@ namespace OpenSim.Region.Framework.Scenes
3284 part.StoreUndoState(false); 3333 part.StoreUndoState(false);
3285 part.IgnoreUndoUpdate = true; 3334 part.IgnoreUndoUpdate = true;
3286 3335
3336// unlock parts position change
3337 if (m_rootPart.PhysActor != null)
3338 m_rootPart.PhysActor.Building = true;
3339
3287 if (part.UUID == m_rootPart.UUID) 3340 if (part.UUID == m_rootPart.UUID)
3288 { 3341 {
3289 UpdateRootPosition(pos); 3342 UpdateRootPosition(pos);
@@ -3293,6 +3346,9 @@ namespace OpenSim.Region.Framework.Scenes
3293 part.UpdateOffSet(pos); 3346 part.UpdateOffSet(pos);
3294 } 3347 }
3295 3348
3349 if (m_rootPart.PhysActor != null)
3350 m_rootPart.PhysActor.Building = false;
3351
3296 HasGroupChanged = true; 3352 HasGroupChanged = true;
3297 part.IgnoreUndoUpdate = false; 3353 part.IgnoreUndoUpdate = false;
3298 } 3354 }
@@ -3434,6 +3490,9 @@ namespace OpenSim.Region.Framework.Scenes
3434// m_log.DebugFormat( 3490// m_log.DebugFormat(
3435// "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot); 3491// "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot);
3436 3492
3493 if (m_rootPart.PhysActor != null)
3494 m_rootPart.PhysActor.Building = true;
3495
3437 if (part.UUID == m_rootPart.UUID) 3496 if (part.UUID == m_rootPart.UUID)
3438 { 3497 {
3439 UpdateRootRotation(rot); 3498 UpdateRootRotation(rot);
@@ -3442,6 +3501,9 @@ namespace OpenSim.Region.Framework.Scenes
3442 { 3501 {
3443 part.UpdateRotation(rot); 3502 part.UpdateRotation(rot);
3444 } 3503 }
3504
3505 if (m_rootPart.PhysActor != null)
3506 m_rootPart.PhysActor.Building = false;
3445 } 3507 }
3446 } 3508 }
3447 3509
@@ -3462,6 +3524,9 @@ namespace OpenSim.Region.Framework.Scenes
3462 part.StoreUndoState(); 3524 part.StoreUndoState();
3463 part.IgnoreUndoUpdate = true; 3525 part.IgnoreUndoUpdate = true;
3464 3526
3527 if (m_rootPart.PhysActor != null)
3528 m_rootPart.PhysActor.Building = true;
3529
3465 if (part.UUID == m_rootPart.UUID) 3530 if (part.UUID == m_rootPart.UUID)
3466 { 3531 {
3467 UpdateRootRotation(rot); 3532 UpdateRootRotation(rot);
@@ -3482,6 +3547,9 @@ namespace OpenSim.Region.Framework.Scenes
3482 part.OffsetPosition = pos; 3547 part.OffsetPosition = pos;
3483 } 3548 }
3484 3549
3550 if (m_rootPart.PhysActor != null)
3551 m_rootPart.PhysActor.Building = false;
3552
3485 part.IgnoreUndoUpdate = false; 3553 part.IgnoreUndoUpdate = false;
3486 } 3554 }
3487 } 3555 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 1c72b10..b132a19 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1727,8 +1727,6 @@ namespace OpenSim.Region.Framework.Scenes
1727 1727
1728 // Move afterwards ResetIDs as it clears the localID 1728 // Move afterwards ResetIDs as it clears the localID
1729 dupe.LocalId = localID; 1729 dupe.LocalId = localID;
1730 if(dupe.PhysActor != null)
1731 dupe.PhysActor.LocalID = localID;
1732 1730
1733 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. 1731 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
1734 dupe.LastOwnerID = OwnerID; 1732 dupe.LastOwnerID = OwnerID;
@@ -1749,6 +1747,9 @@ namespace OpenSim.Region.Framework.Scenes
1749 dupe.DoPhysicsPropertyUpdate(UsePhysics, true); 1747 dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
1750 } 1748 }
1751 1749
1750 if (dupe.PhysActor != null)
1751 dupe.PhysActor.LocalID = localID;
1752
1752 ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed); 1753 ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed);
1753 1754
1754// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); 1755// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID);