aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-07-12 02:33:09 +0100
committerJustin Clark-Casey (justincc)2011-07-12 02:33:09 +0100
commitdf0e5cc9fe9b0851ae5442bdeeb49ab7778d5fe1 (patch)
tree1435bbc275609382086cd57c905b85f4bac67cb2
parentFix permissions problem where newly uploaded meshes rezzed from inventory cou... (diff)
downloadopensim-SC-df0e5cc9fe9b0851ae5442bdeeb49ab7778d5fe1.zip
opensim-SC-df0e5cc9fe9b0851ae5442bdeeb49ab7778d5fe1.tar.gz
opensim-SC-df0e5cc9fe9b0851ae5442bdeeb49ab7778d5fe1.tar.bz2
opensim-SC-df0e5cc9fe9b0851ae5442bdeeb49ab7778d5fe1.tar.xz
When a mesh object is added to a scene, delay adding the physics actor until the sculpt data has been added to the shape (possibly via an async asset service request)
This prevents spurious 'no asset data' for meshes added on startup.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs7
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs21
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs33
5 files changed, 39 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 8195a0d..0104a96 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1751,8 +1751,9 @@ namespace OpenSim.Region.Framework.Scenes
1751 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 1751 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
1752 rootPart.Flags &= ~PrimFlags.Scripted; 1752 rootPart.Flags &= ~PrimFlags.Scripted;
1753 rootPart.TrimPermissions(); 1753 rootPart.TrimPermissions();
1754 group.CheckSculptAndLoad(); 1754
1755 //rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); 1755 // Don't do this here - it will get done later on when sculpt data is loaded.
1756// group.CheckSculptAndLoad();
1756 } 1757 }
1757 1758
1758 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 1759 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index fa23fcd..905acd6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -584,7 +584,7 @@ namespace OpenSim.Region.Framework.Scenes
584 part.ParentID = m_rootPart.LocalId; 584 part.ParentID = m_rootPart.LocalId;
585 //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); 585 //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID);
586 } 586 }
587 587
588 ApplyPhysics(m_scene.m_physicalPrim); 588 ApplyPhysics(m_scene.m_physicalPrim);
589 589
590 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled 590 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 2026c53..e9571aa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1896,7 +1896,12 @@ namespace OpenSim.Region.Framework.Scenes
1896 } 1896 }
1897 } 1897 }
1898 1898
1899 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 1899 // If this part is a sculpt then delay the physics update until we've asynchronously loaded the
1900 // mesh data.
1901 if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh)
1902 CheckSculptAndLoad();
1903 else
1904 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
1900 } 1905 }
1901 } 1906 }
1902 } 1907 }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 123c8ff..56e3b7e 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -638,7 +638,7 @@ namespace OpenSim.Region.Physics.OdePlugin
638 float profileEnd; 638 float profileEnd;
639 639
640 if (_pbs.PathCurve == (byte)Extrusion.Straight || _pbs.PathCurve == (byte)Extrusion.Flexible) 640 if (_pbs.PathCurve == (byte)Extrusion.Straight || _pbs.PathCurve == (byte)Extrusion.Flexible)
641 { 641 {
642 taperX1 = _pbs.PathScaleX * 0.01f; 642 taperX1 = _pbs.PathScaleX * 0.01f;
643 if (taperX1 > 1.0f) 643 if (taperX1 > 1.0f)
644 taperX1 = 2.0f - taperX1; 644 taperX1 = 2.0f - taperX1;
@@ -648,9 +648,9 @@ namespace OpenSim.Region.Physics.OdePlugin
648 if (taperY1 > 1.0f) 648 if (taperY1 > 1.0f)
649 taperY1 = 2.0f - taperY1; 649 taperY1 = 2.0f - taperY1;
650 taperY = 1.0f - taperY1; 650 taperY = 1.0f - taperY1;
651 } 651 }
652 else 652 else
653 { 653 {
654 taperX = _pbs.PathTaperX * 0.01f; 654 taperX = _pbs.PathTaperX * 0.01f;
655 if (taperX < 0.0f) 655 if (taperX < 0.0f)
656 taperX = -taperX; 656 taperX = -taperX;
@@ -660,9 +660,7 @@ namespace OpenSim.Region.Physics.OdePlugin
660 if (taperY < 0.0f) 660 if (taperY < 0.0f)
661 taperY = -taperY; 661 taperY = -taperY;
662 taperY1 = 1.0f - taperY; 662 taperY1 = 1.0f - taperY;
663 663 }
664 }
665
666 664
667 volume *= (taperX1 * taperY1 + 0.5f * (taperX1 * taperY + taperX * taperY1) + 0.3333333333f * taperX * taperY); 665 volume *= (taperX1 * taperY1 + 0.5f * (taperX1 * taperY + taperX * taperY1) + 0.3333333333f * taperX * taperY);
668 666
@@ -859,7 +857,9 @@ namespace OpenSim.Region.Physics.OdePlugin
859 857
860 public void ProcessTaints(float timestep) 858 public void ProcessTaints(float timestep)
861 { 859 {
862//Console.WriteLine("ProcessTaints for " + Name); 860#if SPAM
861Console.WriteLine("ZProcessTaints for " + Name);
862#endif
863 if (m_taintadd) 863 if (m_taintadd)
864 { 864 {
865 changeadd(timestep); 865 changeadd(timestep);
@@ -1323,7 +1323,9 @@ namespace OpenSim.Region.Physics.OdePlugin
1323 1323
1324 public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) 1324 public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
1325 { 1325 {
1326//Console.WriteLine("CreateGeom:"); 1326#if SPAM
1327Console.WriteLine("CreateGeom:");
1328#endif
1327 if (_mesh != null) 1329 if (_mesh != null)
1328 { 1330 {
1329 setMesh(_parent_scene, _mesh); 1331 setMesh(_parent_scene, _mesh);
@@ -1944,7 +1946,6 @@ Console.WriteLine(" JointCreateFixed");
1944 if (_parent_scene.needsMeshing(_pbs)) 1946 if (_parent_scene.needsMeshing(_pbs))
1945 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); 1947 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
1946 1948
1947 //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
1948#if SPAM 1949#if SPAM
1949Console.WriteLine("changesize 1"); 1950Console.WriteLine("changesize 1");
1950#endif 1951#endif
@@ -2056,8 +2057,8 @@ Console.WriteLine("changesize 2");
2056 if (IsPhysical) 2057 if (IsPhysical)
2057 meshlod = _parent_scene.MeshSculptphysicalLOD; 2058 meshlod = _parent_scene.MeshSculptphysicalLOD;
2058 2059
2059 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
2060 // createmesh returns null when it doesn't mesh. 2060 // createmesh returns null when it doesn't mesh.
2061 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
2061#if SPAM 2062#if SPAM
2062Console.WriteLine("changeshape needed meshing"); 2063Console.WriteLine("changeshape needed meshing");
2063#endif 2064#endif
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 99392cc..7b8a80c 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -1723,20 +1723,21 @@ namespace OpenSim.Region.Physics.OdePlugin
1723 PhysicsActor result; 1723 PhysicsActor result;
1724 IMesh mesh = null; 1724 IMesh mesh = null;
1725 1725
1726 if (needsMeshing(pbs)) 1726 // Don't create the mesh here - wait until the mesh data is loaded from the asset store.
1727 { 1727// if (needsMeshing(pbs))
1728 try 1728// {
1729 { 1729// try
1730 mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical); 1730// {
1731 } 1731// mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical);
1732 catch(Exception e) 1732// }
1733 { 1733// catch(Exception e)
1734 m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName); 1734// {
1735 m_log.Debug(e.ToString()); 1735// m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName);
1736 mesh = null; 1736// m_log.Debug(e.ToString());
1737 return null; 1737// mesh = null;
1738 } 1738// return null;
1739 } 1739// }
1740// }
1740 1741
1741 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); 1742 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical);
1742 1743
@@ -2590,7 +2591,9 @@ namespace OpenSim.Region.Physics.OdePlugin
2590 { 2591 {
2591 if (!(_taintedPrimH.Contains(taintedprim))) 2592 if (!(_taintedPrimH.Contains(taintedprim)))
2592 { 2593 {
2593//Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.m_primName); 2594#if SPAM
2595Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2596#endif
2594 _taintedPrimH.Add(taintedprim); // HashSet for searching 2597 _taintedPrimH.Add(taintedprim); // HashSet for searching
2595 _taintedPrimL.Add(taintedprim); // List for ordered readout 2598 _taintedPrimL.Add(taintedprim); // List for ordered readout
2596 } 2599 }