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.
bulletsim
Justin Clark-Casey (justincc) 2011-07-11 03:13:59 +01:00
parent ce85675e70
commit 2f3d0e209f
5 changed files with 26 additions and 11 deletions

View File

@ -1726,6 +1726,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Loads the World's objects /// Loads the World's objects
/// </summary> /// </summary>
/// <param name="regionID"></param>
public virtual void LoadPrimsFromStorage(UUID regionID) public virtual void LoadPrimsFromStorage(UUID regionID)
{ {
LoadingPrims = true; LoadingPrims = true;

View File

@ -3297,7 +3297,10 @@ namespace OpenSim.Region.Framework.Scenes
if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0) if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
return; return;
// m_log.Debug("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
SceneObjectPart part = parts[i]; SceneObjectPart part = parts[i];

View File

@ -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); ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name);
} }
} }
else else
{ {
@ -1872,7 +1871,6 @@ namespace OpenSim.Region.Framework.Scenes
PhysActor.IsPhysical = UsePhysics; PhysActor.IsPhysical = UsePhysics;
// If we're not what we're supposed to be in the physics scene, recreate ourselves. // If we're not what we're supposed to be in the physics scene, recreate ourselves.
//m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); //m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
/// that's not wholesome. Had to make Scene public /// that's not wholesome. Had to make Scene public
@ -1896,6 +1894,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
} }
} }
@ -2967,14 +2966,17 @@ namespace OpenSim.Region.Framework.Scenes
//if (texture != null) //if (texture != null)
{ {
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; m_shape.SculptData = texture.Data;
}
if (PhysActor != null) if (PhysActor != null)
{ {
// Tricks physics engine into thinking we've changed the part shape. // Update the physics actor with the new loaded sculpt data and set the taint signal.
PrimitiveBaseShape m_newshape = m_shape.Copy(); PhysActor.Shape = m_shape;
PhysActor.Shape = m_newshape;
m_shape = m_newshape;
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
} }
@ -3270,11 +3272,14 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_parentGroup.SetAxisRotation(axis, rotate); m_parentGroup.SetAxisRotation(axis, rotate);
} }
//Cannot use ScriptBaseClass constants as no referance to it currently. //Cannot use ScriptBaseClass constants as no referance to it currently.
if (axis == 2)//STATUS_ROTATE_X if (axis == 2)//STATUS_ROTATE_X
STATUS_ROTATE_X = rotate; STATUS_ROTATE_X = rotate;
if (axis == 4)//STATUS_ROTATE_Y if (axis == 4)//STATUS_ROTATE_Y
STATUS_ROTATE_Y = rotate; STATUS_ROTATE_Y = rotate;
if (axis == 8)//STATUS_ROTATE_Z if (axis == 8)//STATUS_ROTATE_Z
STATUS_ROTATE_Z = rotate; STATUS_ROTATE_Z = rotate;
} }
@ -4418,6 +4423,7 @@ namespace OpenSim.Region.Framework.Scenes
RemFlag(PrimFlags.Phantom); RemFlag(PrimFlags.Phantom);
PhysicsActor pa = PhysActor; PhysicsActor pa = PhysActor;
if (pa == null) if (pa == null)
{ {
// It's not phantom anymore. So make sure the physics engine get's knowledge of it // 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) if (pa != null)
{ {
DoPhysicsPropertyUpdate(UsePhysics, true); DoPhysicsPropertyUpdate(UsePhysics, true);
if (m_parentGroup != null) if (m_parentGroup != null)
{ {
if (!m_parentGroup.IsDeleted) if (!m_parentGroup.IsDeleted)
@ -4444,6 +4451,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
if ( if (
((AggregateScriptEvents & scriptEvents.collision) != 0) || ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) || ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
@ -4492,13 +4500,15 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
else 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 :-)) // (mumbles, well, at least if you have infinte CPU powers :-))
PhysicsActor pa = this.PhysActor; PhysicsActor pa = this.PhysActor;
if (pa != null) if (pa != null)
{ {
PhysActor.SetVolumeDetect(0); PhysActor.SetVolumeDetect(0);
} }
this.VolumeDetectActive = false; this.VolumeDetectActive = false;
} }

View File

@ -2104,6 +2104,7 @@ Console.WriteLine("changeshape not need meshing");
parent.ChildSetGeom(this); parent.ChildSetGeom(this);
} }
} }
resetCollisionAccounting(); resetCollisionAccounting();
m_taintshape = false; m_taintshape = false;
} }

View File

@ -26,7 +26,7 @@
*/ */
//#define USE_DRAWSTUFF //#define USE_DRAWSTUFF
#define SPAM //#define SPAM
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;