Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
UbitUmarov 2012-04-04 15:43:07 +01:00
commit 823895b997
18 changed files with 261 additions and 124 deletions

View File

@ -36,6 +36,7 @@ using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Client; using OpenSim.Framework.Client;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
@ -1761,9 +1762,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
if (!grp.IsDeleted) if (!grp.IsDeleted)
{ {
if (grp.RootPart.PhysActor != null) PhysicsActor pa = grp.RootPart.PhysActor;
if (pa != null)
{ {
grp.RootPart.PhysActor.CrossingFailure(); pa.CrossingFailure();
if (grp.RootPart.KeyframeMotion != null) if (grp.RootPart.KeyframeMotion != null)
{ {
grp.RootPart.Velocity = Vector3.Zero; grp.RootPart.Velocity = Vector3.Zero;

View File

@ -72,5 +72,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{ {
return "BMP"; return "BMP";
} }
//Returns true if this extension is supported for terrain save-tile
public override bool SupportsTileSave()
{
return false;
}
} }
} }

View File

@ -57,5 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{ {
return "GIF"; return "GIF";
} }
//Returns true if this extension is supported for terrain save-tile
public override bool SupportsTileSave()
{
return false;
}
} }
} }

View File

@ -177,6 +177,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
return "SYS.DRAWING"; return "SYS.DRAWING";
} }
//Returns true if this extension is supported for terrain save-tile
public virtual bool SupportsTileSave()
{
return false;
}
/// <summary> /// <summary>
/// Protected method, generates a grayscale bitmap /// Protected method, generates a grayscale bitmap
/// image from a specified terrain channel. /// image from a specified terrain channel.

View File

@ -91,6 +91,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
return "JPEG"; return "JPEG";
} }
//Returns true if this extension is supported for terrain save-tile
public bool SupportsTileSave()
{
return false;
}
private static Bitmap CreateBitmapFromMap(ITerrainChannel map) private static Bitmap CreateBitmapFromMap(ITerrainChannel map)
{ {
Bitmap gradientmapLd = new Bitmap("defaultstripe.png"); Bitmap gradientmapLd = new Bitmap("defaultstripe.png");

View File

@ -254,5 +254,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{ {
return "LL/SL RAW"; return "LL/SL RAW";
} }
//Returns true if this extension is supported for terrain save-tile
public bool SupportsTileSave()
{
return false;
}
} }
} }

View File

@ -57,5 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{ {
return "PNG"; return "PNG";
} }
//Returns true if this extension is supported for terrain save-tile
public override bool SupportsTileSave()
{
return true;
}
} }
} }

View File

@ -173,5 +173,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{ {
return "RAW32"; return "RAW32";
} }
//Returns true if this extension is supported for terrain save-tile
public bool SupportsTileSave()
{
return false;
}
} }
} }

View File

@ -57,5 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{ {
return "TIFF"; return "TIFF";
} }
//Returns true if this extension is supported for terrain save-tile
public bool SupportsTileSave()
{
return false;
}
} }
} }

View File

@ -323,6 +323,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
return "Terragen"; return "Terragen";
} }
//Returns true if this extension is supported for terrain save-tile
public bool SupportsTileSave()
{
return false;
}
/// <summary> /// <summary>
/// terragen SCAL floats need to be written intel ordered regardless of /// terragen SCAL floats need to be written intel ordered regardless of
/// big or little endian system /// big or little endian system

View File

@ -32,6 +32,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
{ {
public interface ITerrainLoader public interface ITerrainLoader
{ {
// Returns true if that extension can be used for terrain save-tile
// (Look into each file in Region.CoreModules.World.Terrain.FileLoaders)
bool SupportsTileSave();
string FileExtension { get; } string FileExtension { get; }
ITerrainChannel LoadFile(string filename); ITerrainChannel LoadFile(string filename);
ITerrainChannel LoadFile(string filename, int fileStartX, int fileStartY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight); ITerrainChannel LoadFile(string filename, int fileStartX, int fileStartY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight);

View File

@ -93,6 +93,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
/// </summary> /// </summary>
private string m_supportedFileExtensions = ""; private string m_supportedFileExtensions = "";
//For terrain save-tile file extensions
private string m_supportFileExtensionsForTileSave = "";
#region ICommandableModule Members #region ICommandableModule Members
public ICommander CommandInterface public ICommander CommandInterface
@ -148,11 +151,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain
// Generate user-readable extensions list // Generate user-readable extensions list
string supportedFilesSeparator = ""; string supportedFilesSeparator = "";
string supportedFilesSeparatorForTileSave = "";
m_supportFileExtensionsForTileSave = "";
foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
{ {
m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")"; m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")";
supportedFilesSeparator = ", "; supportedFilesSeparator = ", ";
//For terrain save-tile file extensions
if (loader.Value.SupportsTileSave() == true)
{
m_supportFileExtensionsForTileSave += supportedFilesSeparatorForTileSave + loader.Key + " (" + loader.Value + ")";
supportedFilesSeparatorForTileSave = ", ";
}
} }
} }
@ -589,7 +601,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
// this region is included in the tile request // this region is included in the tile request
foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
{ {
if (filename.EndsWith(loader.Key)) if (filename.EndsWith(loader.Key) && loader.Value.SupportsTileSave())
{ {
lock (m_scene) lock (m_scene)
{ {
@ -610,7 +622,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
MainConsole.Instance.OutputFormat( MainConsole.Instance.OutputFormat(
"ERROR: Could not save terrain from {0} to {1}. Valid file extensions are {2}", "ERROR: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); m_scene.RegionInfo.RegionName, filename, m_supportFileExtensionsForTileSave);
} }
/// <summary> /// <summary>
@ -1194,7 +1206,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file."); new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file.");
saveToTileCommand.AddArgument("filename", saveToTileCommand.AddArgument("filename",
"The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " + "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " +
m_supportedFileExtensions, "String"); m_supportFileExtensionsForTileSave, "String");
saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer");
saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer");
saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file",

View File

@ -666,10 +666,6 @@ namespace OpenSim.Region.Framework.Scenes
#endregion Region Settings #endregion Region Settings
MainConsole.Instance.Commands.AddCommand("Estates", false, "reload estate",
"reload estate",
"Reload the estate data", HandleReloadEstate);
//Bind Storage Manager functions to some land manager functions for this scene //Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded += EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(simDataService.StoreLandObject); new EventManager.LandObjectAdded(simDataService.StoreLandObject);

View File

@ -348,7 +348,8 @@ namespace OpenSim.Region.Framework.Scenes
if (rot != null) if (rot != null)
sceneObject.UpdateGroupRotationR((Quaternion)rot); sceneObject.UpdateGroupRotationR((Quaternion)rot);
if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) PhysicsActor pa = sceneObject.RootPart.PhysActor;
if (pa != null && pa.IsPhysical && vel != Vector3.Zero)
{ {
sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false); sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false);
sceneObject.Velocity = vel; sceneObject.Velocity = vel;

View File

@ -725,16 +725,21 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_isSelected = value; m_isSelected = value;
// Tell physics engine that group is selected // Tell physics engine that group is selected
if (m_rootPart.PhysActor != null)
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{ {
m_rootPart.PhysActor.Selected = value; pa.Selected = value;
// Pass it on to the children. // Pass it on to the children.
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 child = parts[i]; SceneObjectPart child = parts[i];
if (child.PhysActor != null)
child.PhysActor.Selected = value; PhysicsActor childPa = child.PhysActor;
if (childPa != null)
childPa.Selected = value;
} }
} }
if (RootPart.KeyframeMotion != null) if (RootPart.KeyframeMotion != null)
@ -2166,22 +2171,26 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
if (RootPart.PhysActor != null) PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
{ {
RootPart.PhysActor.AddForce(impulse, true); pa.AddForce(impulse, true);
m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }
} }
public void applyAngularImpulse(Vector3 impulse) public void setAngularImpulse(Vector3 impulse)
{ {
if (RootPart.PhysActor != null) PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
{ {
if (!IsAttachment) if (!IsAttachment)
{ {
RootPart.PhysActor.AddAngularForce(impulse, true); pa.Torque = impulse;
m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }
} }
@ -2204,19 +2213,23 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
if (RootPart.PhysActor != null) PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
{ {
RootPart.PhysActor.PIDTarget = target; pa.PIDTarget = target;
RootPart.PhysActor.PIDTau = tau; pa.PIDTau = tau;
RootPart.PhysActor.PIDActive = true; pa.PIDActive = true;
} }
} }
} }
public void stopMoveToTarget() public void stopMoveToTarget()
{ {
if (RootPart.PhysActor != null) PhysicsActor pa = RootPart.PhysActor;
RootPart.PhysActor.PIDActive = false;
if (pa != null)
pa.PIDActive = false;
} }
public void rotLookAt(Quaternion target, float strength, float damping) public void rotLookAt(Quaternion target, float strength, float damping)
@ -2267,18 +2280,20 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="tau">Number of seconds over which to reach target</param> /// <param name="tau">Number of seconds over which to reach target</param>
public void SetHoverHeight(float height, PIDHoverType hoverType, float tau) public void SetHoverHeight(float height, PIDHoverType hoverType, float tau)
{ {
if (RootPart.PhysActor != null) PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
{ {
if (height != 0f) if (height != 0f)
{ {
RootPart.PhysActor.PIDHoverHeight = height; pa.PIDHoverHeight = height;
RootPart.PhysActor.PIDHoverType = hoverType; pa.PIDHoverType = hoverType;
RootPart.PhysActor.PIDTau = tau; pa.PIDTau = tau;
RootPart.PhysActor.PIDHoverActive = true; pa.PIDHoverActive = true;
} }
else else
{ {
RootPart.PhysActor.PIDHoverActive = false; pa.PIDHoverActive = false;
} }
} }
} }
@ -2771,10 +2786,10 @@ namespace OpenSim.Region.Framework.Scenes
linkPart.ParentID = 0; linkPart.ParentID = 0;
linkPart.LinkNum = 0; linkPart.LinkNum = 0;
if (linkPart.PhysActor != null) PhysicsActor linkPartPa = linkPart.PhysActor;
{
m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); if (linkPartPa != null)
} m_scene.PhysicsScene.RemovePrim(linkPartPa);
// We need to reset the child part's position // We need to reset the child part's position
// ready for life as a separate object after being a part of another object // ready for life as a separate object after being a part of another object
@ -2875,17 +2890,19 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
{ {
if (m_rootPart.PhysActor != null) PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{ {
if (m_rootPart.PhysActor.IsPhysical) if (pa.IsPhysical)
{ {
if (!m_rootPart.BlockGrab) if (!m_rootPart.BlockGrab)
{ {
Vector3 llmoveforce = pos - AbsolutePosition; Vector3 llmoveforce = pos - AbsolutePosition;
Vector3 grabforce = llmoveforce; Vector3 grabforce = llmoveforce;
grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; grabforce = (grabforce / 10) * pa.Mass;
m_rootPart.PhysActor.AddForce(grabforce, true); pa.AddForce(grabforce, true);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }
else else
@ -2915,9 +2932,11 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_scene.EventManager.TriggerGroupSpinStart(UUID)) if (m_scene.EventManager.TriggerGroupSpinStart(UUID))
{ {
if (m_rootPart.PhysActor != null) PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{ {
if (m_rootPart.PhysActor.IsPhysical) if (pa.IsPhysical)
{ {
m_rootPart.IsWaitingForFirstSpinUpdatePacket = true; m_rootPart.IsWaitingForFirstSpinUpdatePacket = true;
} }
@ -2958,12 +2977,13 @@ namespace OpenSim.Region.Framework.Scenes
// but it will result in over-shoot or under-shoot of the target orientation. // but it will result in over-shoot or under-shoot of the target orientation.
// For the end user, this means that ctrl+shift+drag can be used for relative, // For the end user, this means that ctrl+shift+drag can be used for relative,
// but not absolute, adjustments of orientation for physical prims. // but not absolute, adjustments of orientation for physical prims.
if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation)) if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation))
{ {
if (m_rootPart.PhysActor != null) PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{ {
if (m_rootPart.PhysActor.IsPhysical) if (pa.IsPhysical)
{ {
if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) if (m_rootPart.IsWaitingForFirstSpinUpdatePacket)
{ {
@ -2989,9 +3009,9 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z); Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
spinforce = (spinforce/8) * m_rootPart.PhysActor.Mass; // 8 is an arbitrary torque scaling factor spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor
m_rootPart.PhysActor.AddAngularForce(spinforce,true); pa.AddAngularForce(spinforce,true);
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }
else else
@ -3199,8 +3219,10 @@ namespace OpenSim.Region.Framework.Scenes
{ {
part.UpdateShape(shapeBlock); part.UpdateShape(shapeBlock);
if (part.PhysActor != null) PhysicsActor pa = m_rootPart.PhysActor;
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
if (pa != null)
m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }
@ -3218,7 +3240,9 @@ namespace OpenSim.Region.Framework.Scenes
scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys);
scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys);
if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null && pa.IsPhysical)
{ {
scale.X = Math.Min(scale.X, Scene.m_maxPhys); scale.X = Math.Min(scale.X, Scene.m_maxPhys);
scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); scale.Y = Math.Min(scale.Y, Scene.m_maxPhys);
@ -3243,7 +3267,7 @@ namespace OpenSim.Region.Framework.Scenes
float f = 1.0f; float f = 1.0f;
float a = 1.0f; float a = 1.0f;
if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) if (pa != null && pa.IsPhysical)
{ {
if (oldSize.X * x > m_scene.m_maxPhys) if (oldSize.X * x > m_scene.m_maxPhys)
{ {
@ -3561,10 +3585,13 @@ namespace OpenSim.Region.Framework.Scenes
//Don't use UpdateRotation because it schedules an update prematurely //Don't use UpdateRotation because it schedules an update prematurely
m_rootPart.RotationOffset = rot; m_rootPart.RotationOffset = rot;
if (m_rootPart.PhysActor != null)
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{ {
m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset; pa.Orientation = m_rootPart.RotationOffset;
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); m_scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();

View File

@ -152,6 +152,14 @@ namespace OpenSim.Region.Framework.Scenes
public int[] PayPrice = {-2,-2,-2,-2,-2}; public int[] PayPrice = {-2,-2,-2,-2,-2};
[XmlIgnore] [XmlIgnore]
/// <summary>
/// The representation of this part in the physics scene.
/// </summary>
/// <remarks>
/// If you use this property more than once in a section of code then you must take a reference and use that.
/// If another thread is simultaneously turning physics off on this part then this refernece could become
/// null at any time.
/// </remarks>
public PhysicsActor PhysActor public PhysicsActor PhysActor
{ {
get { return m_physActor; } get { return m_physActor; }
@ -555,10 +563,11 @@ namespace OpenSim.Region.Framework.Scenes
set set
{ {
m_name = value; m_name = value;
if (PhysActor != null)
{ PhysicsActor pa = PhysActor;
PhysActor.SOPName = value;
} if (pa != null)
pa.SOPName = value;
} }
} }
@ -1017,7 +1026,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Shape.SculptEntry) if (Shape.SculptEntry)
CheckSculptAndLoad(); CheckSculptAndLoad();
else else
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
} }
} }
} }
@ -1780,7 +1789,7 @@ namespace OpenSim.Region.Framework.Scenes
impulse = newimpulse; impulse = newimpulse;
} }
ParentGroup.applyAngularImpulse(impulse); ParentGroup.setAngularImpulse(impulse);
} }
/// <summary> /// <summary>
@ -1868,33 +1877,35 @@ namespace OpenSim.Region.Framework.Scenes
} }
// Basic Physics can also return null as well as an exception catch. // Basic Physics can also return null as well as an exception catch.
if (PhysActor != null) PhysicsActor pa = PhysActor;
if (pa != null)
{ {
PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
PhysActor.SetMaterial(Material); pa.SetMaterial(Material);
// if root part apply vehicle // if root part apply vehicle
if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId)
m_vehicle.SetVehicle(PhysActor); m_vehicle.SetVehicle(pa);
DoPhysicsPropertyUpdate(isPhysical, true); DoPhysicsPropertyUpdate(isPhysical, true);
if(VolumeDetectActive) // change if not the default only if(VolumeDetectActive) // change if not the default only
PhysActor.SetVolumeDetect(1); pa.SetVolumeDetect(1);
if (!building) if (!building)
PhysActor.Building = false; pa.Building = false;
Velocity = velocity; Velocity = velocity;
AngularVelocity = rotationalVelocity; AngularVelocity = rotationalVelocity;
PhysActor.Velocity = velocity; pa.Velocity = velocity;
PhysActor.RotationalVelocity = rotationalVelocity; pa.RotationalVelocity = rotationalVelocity;
// if not vehicle and root part apply force and torque // if not vehicle and root part apply force and torque
if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE) if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE)
&& LocalId == ParentGroup.RootPart.LocalId) && LocalId == ParentGroup.RootPart.LocalId)
{ {
PhysActor.Force = Force; pa.Force = Force;
PhysActor.Torque = Torque; pa.Torque = Torque;
} }
} }
} }
@ -2125,11 +2136,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
if (PhysActor != null) PhysicsActor pa = PhysActor;
if (pa != null)
{ {
if (UsePhysics != PhysActor.IsPhysical || isNew) if (UsePhysics != pa.IsPhysical || isNew)
{ {
if (PhysActor.IsPhysical) if (pa.IsPhysical) // implies UsePhysics==false for this block
{ {
if (!isNew) // implies UsePhysics==false for this block if (!isNew) // implies UsePhysics==false for this block
{ {
@ -2173,9 +2186,18 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentID != 0 && ParentID != LocalId) if (ParentID != 0 && ParentID != LocalId)
{ {
if (ParentGroup.RootPart.PhysActor != null) ParentGroup.Scene.AddPhysicalPrim(1);
pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
pa.OnOutOfBounds += PhysicsOutOfBounds;
if (ParentID != 0 && ParentID != LocalId)
{ {
PhysActor.link(ParentGroup.RootPart.PhysActor); PhysicsActor parentPa = ParentGroup.RootPart.PhysActor;
if (parentPa != null)
{
pa.link(parentPa);
}
} }
} }
} }
@ -2191,7 +2213,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Shape.SculptEntry) if (Shape.SculptEntry)
CheckSculptAndLoad(); CheckSculptAndLoad();
else else
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }
} }
@ -2302,16 +2324,20 @@ namespace OpenSim.Region.Framework.Scenes
public Vector3 GetGeometricCenter() public Vector3 GetGeometricCenter()
{ {
if (PhysActor != null) PhysicsActor pa = PhysActor;
return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z);
if (pa != null)
return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z);
else else
return new Vector3(0, 0, 0); return new Vector3(0, 0, 0);
} }
public float GetMass() public float GetMass()
{ {
if (PhysActor != null) PhysicsActor pa = PhysActor;
return PhysActor.Mass;
if (pa != null)
return pa.Mass;
else else
return 0; return 0;
} }
@ -2947,9 +2973,11 @@ namespace OpenSim.Region.Framework.Scenes
public void PhysicsRequestingTerseUpdate() public void PhysicsRequestingTerseUpdate()
{ {
if (PhysActor != null) PhysicsActor pa = PhysActor;
if (pa != null)
{ {
Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0);
if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N)
|| ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S)
@ -2961,6 +2989,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
//ParentGroup.RootPart.m_groupPosition = newpos; //ParentGroup.RootPart.m_groupPosition = newpos;
} }
ScheduleTerseUpdate(); ScheduleTerseUpdate();
} }
@ -3052,7 +3081,9 @@ namespace OpenSim.Region.Framework.Scenes
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
if (PhysActor != null && PhysActor.IsPhysical) PhysicsActor pa = PhysActor;
if (pa != null && pa.IsPhysical)
{ {
scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys);
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys);
@ -3214,12 +3245,14 @@ namespace OpenSim.Region.Framework.Scenes
m_shape.SculptData = texture.Data; m_shape.SculptData = texture.Data;
} }
if (PhysActor != null) PhysicsActor pa = PhysActor;
if (pa != null)
{ {
// Update the physics actor with the new loaded sculpt data and set the taint signal. // Update the physics actor with the new loaded sculpt data and set the taint signal.
PhysActor.Shape = m_shape; pa.Shape = m_shape;
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
} }
} }
@ -3495,17 +3528,10 @@ namespace OpenSim.Region.Framework.Scenes
public void SetFloatOnWater(int floatYN) public void SetFloatOnWater(int floatYN)
{ {
if (PhysActor != null) PhysicsActor pa = PhysActor;
{
if (floatYN == 1) if (pa != null)
{ pa.FloatOnWater = floatYN == 1;
PhysActor.FloatOnWater = true;
}
else
{
PhysActor.FloatOnWater = false;
}
}
} }
public void SetForce(Vector3 force) public void SetForce(Vector3 force)
@ -4793,6 +4819,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
PhysicsActor pa = PhysActor;
if (SetVD) if (SetVD)
{ {
// If the above logic worked (this is urgent candidate to unit tests!) // If the above logic worked (this is urgent candidate to unit tests!)
@ -4800,9 +4827,9 @@ namespace OpenSim.Region.Framework.Scenes
// Defensive programming calls for a check here. // Defensive programming calls for a check here.
// Better would be throwing an exception that could be catched by a unit test as the internal // Better would be throwing an exception that could be catched by a unit test as the internal
// logic should make sure, this Physactor is always here. // logic should make sure, this Physactor is always here.
if (this.PhysActor != null) if (pa != null)
{ {
PhysActor.SetVolumeDetect(1); pa.SetVolumeDetect(1);
// AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active // AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
this.VolumeDetectActive = true; this.VolumeDetectActive = true;
} }
@ -4811,13 +4838,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// 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 :-))
if (this.PhysActor != null) if (pa != null)
{ {
PhysActor.SetVolumeDetect(0); pa.SetVolumeDetect(0);
}
this.VolumeDetectActive = false; this.VolumeDetectActive = false;
} }
}
if (SetTemporary) if (SetTemporary)
{ {
@ -4827,11 +4853,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
RemFlag(PrimFlags.TemporaryOnRez); RemFlag(PrimFlags.TemporaryOnRez);
} }
// m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
// and last in case we have a new actor and not building // and last in case we have a new actor and not building
if (PhysActor != null && PhysActor.Building != building) if (pa != null && pa.Building != building)
PhysActor.Building = building; pa.Building = building;
if (ParentGroup != null) if (ParentGroup != null)
{ {
ParentGroup.HasGroupChanged = true; ParentGroup.HasGroupChanged = true;
@ -4898,10 +4925,12 @@ namespace OpenSim.Region.Framework.Scenes
m_shape.PathTwist = shapeBlock.PathTwist; m_shape.PathTwist = shapeBlock.PathTwist;
m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
if (PhysActor != null) PhysicsActor pa = PhysActor;
if (pa != null)
{ {
PhysActor.Shape = m_shape; pa.Shape = m_shape;
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
} }
// This is what makes vehicle trailers work // This is what makes vehicle trailers work
@ -5043,6 +5072,8 @@ namespace OpenSim.Region.Framework.Scenes
objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
} }
PhysicsActor pa = PhysActor;
if ( if (
((AggregateScriptEvents & scriptEvents.collision) != 0) || ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) || ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
@ -5054,18 +5085,18 @@ namespace OpenSim.Region.Framework.Scenes
) )
{ {
// subscribe to physics updates. // subscribe to physics updates.
if (PhysActor != null) if (pa != null)
{ {
PhysActor.OnCollisionUpdate += PhysicsCollision; pa.OnCollisionUpdate += PhysicsCollision;
PhysActor.SubscribeEvents(1000); pa.SubscribeEvents(1000);
} }
} }
else else
{ {
if (PhysActor != null) if (pa != null)
{ {
PhysActor.UnSubscribeEvents(); pa.UnSubscribeEvents();
PhysActor.OnCollisionUpdate -= PhysicsCollision; pa.OnCollisionUpdate -= PhysicsCollision;
} }
} }

View File

@ -1474,7 +1474,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (scale.z < 0.01) if (scale.z < 0.01)
scale.z = 0.01; scale.z = 0.01;
if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical) PhysicsActor pa = part.ParentGroup.RootPart.PhysActor;
if (pa != null && pa.IsPhysical)
{ {
if (scale.x > World.m_maxPhys) if (scale.x > World.m_maxPhys)
scale.x = World.m_maxPhys; scale.x = World.m_maxPhys;
@ -2345,7 +2347,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// but only if the object is not physial and active. This is important for rotating doors. // but only if the object is not physial and active. This is important for rotating doors.
// without the absoluteposition = absoluteposition happening, the doors do not move in the physics // without the absoluteposition = absoluteposition happening, the doors do not move in the physics
// scene // scene
if (part.PhysActor != null && !part.PhysActor.IsPhysical) PhysicsActor pa = part.PhysActor;
if (pa != null && !pa.IsPhysical)
{ {
part.ParentGroup.ResetChildPrimPhysicsPositions(); part.ParentGroup.ResetChildPrimPhysicsPositions();
} }
@ -3073,7 +3077,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
float groupmass = new_group.GetMass(); float groupmass = new_group.GetMass();
if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero) PhysicsActor pa = new_group.RootPart.PhysActor;
if (pa != null && pa.IsPhysical && llvel != Vector3.Zero)
{ {
//Recoil. //Recoil.
llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
@ -3510,6 +3516,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetHoverHeight(double height, int water, double tau) public void llSetHoverHeight(double height, int water, double tau)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.PhysActor != null) if (m_host.PhysActor != null)
{ {
PIDHoverType hoverType = PIDHoverType.Ground; PIDHoverType hoverType = PIDHoverType.Ground;
@ -3560,7 +3567,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Per discussion with Melanie, for non-physical objects llLookAt appears to simply // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
// set the rotation of the object, copy that behavior // set the rotation of the object, copy that behavior
if (strength == 0 || m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) PhysicsActor pa = m_host.PhysActor;
if (strength == 0 || pa == null || !pa.IsPhysical)
{ {
llSetLocalRot(target); llSetLocalRot(target);
} }

View File

@ -1550,7 +1550,7 @@
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/> <Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="CSJ2K" path="../../../bin/"/> <Reference name="CSJ2K" path="../../../bin/"/>
<Reference name="Warp3D" path="../../../bin/" localCopy="true"/> <Reference name="Warp3D" path="../../../bin/"/>
<Reference name="OpenSim.Capabilities"/> <Reference name="OpenSim.Capabilities"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>