From 2f3d0e209ff5c3028e3e29179b67504be9b2f887 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 11 Jul 2011 03:13:59 +0100
Subject: When a sculpt/mesh texture is received by a part on a callback
request, don't do the unnecessary work of copying the base shape.
Just setting the new base shape is enough to reinsert the sculpt data and set the taint.
Also cleans up a few more left-in debugging messages.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 1 +
.../Region/Framework/Scenes/SceneObjectGroup.cs | 3 +++
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 28 +++++++++++++++-------
OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 3 ++-
OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 2 +-
5 files changed, 26 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ec6044b..8195a0d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1726,6 +1726,7 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Loads the World's objects
///
+ ///
public virtual void LoadPrimsFromStorage(UUID regionID)
{
LoadingPrims = true;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4b8e370..a184445 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3297,7 +3297,10 @@ namespace OpenSim.Region.Framework.Scenes
if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
return;
+// m_log.Debug("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
+
SceneObjectPart[] parts = m_parts.GetArray();
+
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 4fa3a68..5b203e9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1810,7 +1810,6 @@ namespace OpenSim.Region.Framework.Scenes
{
ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name);
}
-
}
else
{
@@ -1872,7 +1871,6 @@ namespace OpenSim.Region.Framework.Scenes
PhysActor.IsPhysical = UsePhysics;
-
// If we're not what we're supposed to be in the physics scene, recreate ourselves.
//m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
/// that's not wholesome. Had to make Scene public
@@ -1896,6 +1894,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
+
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
}
}
@@ -2967,14 +2966,17 @@ namespace OpenSim.Region.Framework.Scenes
//if (texture != null)
{
if (texture != null)
+ {
+// m_log.DebugFormat(
+// "[SCENE OBJECT PART]: Setting sculpt data for {0} on SculptTextureCallback()", Name);
+
m_shape.SculptData = texture.Data;
+ }
if (PhysActor != null)
{
- // Tricks physics engine into thinking we've changed the part shape.
- PrimitiveBaseShape m_newshape = m_shape.Copy();
- PhysActor.Shape = m_newshape;
- m_shape = m_newshape;
+ // Update the physics actor with the new loaded sculpt data and set the taint signal.
+ PhysActor.Shape = m_shape;
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
}
@@ -3270,11 +3272,14 @@ namespace OpenSim.Region.Framework.Scenes
{
m_parentGroup.SetAxisRotation(axis, rotate);
}
+
//Cannot use ScriptBaseClass constants as no referance to it currently.
if (axis == 2)//STATUS_ROTATE_X
STATUS_ROTATE_X = rotate;
+
if (axis == 4)//STATUS_ROTATE_Y
STATUS_ROTATE_Y = rotate;
+
if (axis == 8)//STATUS_ROTATE_Z
STATUS_ROTATE_Z = rotate;
}
@@ -4418,6 +4423,7 @@ namespace OpenSim.Region.Framework.Scenes
RemFlag(PrimFlags.Phantom);
PhysicsActor pa = PhysActor;
+
if (pa == null)
{
// It's not phantom anymore. So make sure the physics engine get's knowledge of it
@@ -4434,6 +4440,7 @@ namespace OpenSim.Region.Framework.Scenes
if (pa != null)
{
DoPhysicsPropertyUpdate(UsePhysics, true);
+
if (m_parentGroup != null)
{
if (!m_parentGroup.IsDeleted)
@@ -4444,6 +4451,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
+
if (
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
@@ -4454,8 +4462,8 @@ namespace OpenSim.Region.Framework.Scenes
(CollisionSound != UUID.Zero)
)
{
- PhysActor.OnCollisionUpdate += PhysicsCollision;
- PhysActor.SubscribeEvents(1000);
+ PhysActor.OnCollisionUpdate += PhysicsCollision;
+ PhysActor.SubscribeEvents(1000);
}
}
}
@@ -4492,13 +4500,15 @@ namespace OpenSim.Region.Framework.Scenes
}
}
else
- { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
+ {
+ // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
// (mumbles, well, at least if you have infinte CPU powers :-))
PhysicsActor pa = this.PhysActor;
if (pa != null)
{
PhysActor.SetVolumeDetect(0);
}
+
this.VolumeDetectActive = false;
}
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 0cf2f5d..123c8ff 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -2104,6 +2104,7 @@ Console.WriteLine("changeshape not need meshing");
parent.ChildSetGeom(this);
}
}
+
resetCollisionAccounting();
m_taintshape = false;
}
@@ -2343,7 +2344,7 @@ Console.WriteLine("changeshape not need meshing");
{
lock (_parent_scene.OdeLock)
{
- m_isVolumeDetect = (param!=0);
+ m_isVolumeDetect = (param != 0);
}
}
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index f5172aa..99392cc 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -26,7 +26,7 @@
*/
//#define USE_DRAWSTUFF
-#define SPAM
+//#define SPAM
using System;
using System.Collections.Generic;
--
cgit v1.1