Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
avinationmerge
Melanie 2012-01-26 00:21:21 +00:00
commit 4ce42762ee
20 changed files with 225 additions and 116 deletions

View File

@ -685,7 +685,7 @@ namespace OpenSim.Data.Tests
SceneObjectGroup sog = GetMySOG("object1"); SceneObjectGroup sog = GetMySOG("object1");
InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero);
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True);
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))"); Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))");
@ -762,7 +762,7 @@ namespace OpenSim.Data.Tests
i.CreationDate = creationd; i.CreationDate = creationd;
SceneObjectGroup sog = GetMySOG("object1"); SceneObjectGroup sog = GetMySOG("object1");
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True);
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id); TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id);
Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))"); Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))");
@ -807,10 +807,10 @@ namespace OpenSim.Data.Tests
SceneObjectGroup sog = FindSOG("object1", region1); SceneObjectGroup sog = FindSOG("object1", region1);
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib1, zero), Is.True); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib1, zero), Is.True);
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib2, zero), Is.True); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib2, zero), Is.True);
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib3, zero), Is.True); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib3, zero), Is.True);
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib4, zero), Is.True); Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib4, zero), Is.True);
TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1); TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1);
Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))"); Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))");

View File

@ -130,5 +130,11 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
/// <param name="url"></param> /// <param name="url"></param>
void SetMusicUrl(string url); void SetMusicUrl(string url);
/// <summary>
/// Get the music url for this land parcel
/// </summary>
/// <returns>The music url.</returns>
string GetMusicUrl();
} }
} }

View File

@ -291,10 +291,10 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "save oar", m_console.Commands.AddCommand("region", false, "save oar",
//"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]", //"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
"save oar [-p|--profile=<url>] [--noassets] [--perm=<permissions>] [<OAR path>]", "save oar [-h|--home=<url>] [--noassets] [--perm=<permissions>] [<OAR path>]",
"Save a region's data to an OAR archive.", "Save a region's data to an OAR archive.",
// "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine // "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
"-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
+ "--noassets stops assets being saved to the OAR." + Environment.NewLine + "--noassets stops assets being saved to the OAR." + Environment.NewLine
+ "--perm stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine + "--perm stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine
+ " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine

View File

@ -122,12 +122,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
scene.AddCommand( scene.AddCommand(
this, "save iar", this, "save iar",
"save iar [--p|-profile=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [--v|-verbose]", "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [--v|-verbose]",
"Save user inventory archive (IAR).", "Save user inventory archive (IAR).",
"<first> is the user's first name." + Environment.NewLine "<first> is the user's first name." + Environment.NewLine
+ "<last> is the user's last name." + Environment.NewLine + "<last> is the user's last name." + Environment.NewLine
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
+ "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine + "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
+ "-c|--creators preserves information about foreign creators." + Environment.NewLine + "-c|--creators preserves information about foreign creators." + Environment.NewLine
+ "-v|--verbose extra debug messages." + Environment.NewLine + "-v|--verbose extra debug messages." + Environment.NewLine
+ "--noassets stops assets being saved to the IAR." + "--noassets stops assets being saved to the IAR."

View File

@ -1153,7 +1153,16 @@ namespace OpenSim.Region.CoreModules.World.Land
LandData.MusicURL = url; LandData.MusicURL = url;
SendLandUpdateToAvatarsOverMe(); SendLandUpdateToAvatarsOverMe();
} }
/// <summary>
/// Get the music url for this land parcel
/// </summary>
/// <returns>The music url.</returns>
public string GetMusicUrl()
{
return LandData.MusicURL;
}
#endregion #endregion
} }
} }

View File

@ -1463,7 +1463,7 @@ namespace OpenSim.Region.Framework.Scenes
// If we've found the item in the user's inventory or in the library // If we've found the item in the user's inventory or in the library
if (item != null) if (item != null)
{ {
part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID);
m_log.InfoFormat( m_log.InfoFormat(
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
item.Name, primLocalID, remoteClient.Name); item.Name, primLocalID, remoteClient.Name);
@ -1572,104 +1572,130 @@ namespace OpenSim.Region.Framework.Scenes
/// Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory /// Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="itemID"> </param> /// <param name="itemBase"> </param>
/// <param name="transactionID"></param>
/// <param name="localID"></param> /// <param name="localID"></param>
public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID) public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID)
{ {
UUID itemID = itemBase.ID; SceneObjectPart partWhereRezzed;
if (itemBase.ID != UUID.Zero)
partWhereRezzed = RezScriptFromAgentInventory(remoteClient.AgentId, itemBase.ID, localID);
else
partWhereRezzed = RezNewScript(remoteClient.AgentId, itemBase);
if (partWhereRezzed != null)
partWhereRezzed.SendPropertiesToClient(remoteClient);
}
/// <summary>
/// Rez a script into a prim from an agent inventory.
/// </summary>
/// <param name="agentID"></param>
/// <param name="fromItemID"></param>
/// <param name="localID"></param>
/// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
public SceneObjectPart RezScriptFromAgentInventory(UUID agentID, UUID fromItemID, uint localID)
{
UUID copyID = UUID.Random(); UUID copyID = UUID.Random();
InventoryItemBase item = new InventoryItemBase(fromItemID, agentID);
item = InventoryService.GetItem(item);
if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory // Try library
// XXX clumsy, possibly should be one call
if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
{ {
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = LibraryService.LibraryRootFolder.FindItem(fromItemID);
item = InventoryService.GetItem(item); }
// Try library if (item != null)
// XXX clumsy, possibly should be one call {
if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) SceneObjectPart part = GetSceneObjectPart(localID);
if (part != null)
{ {
item = LibraryService.LibraryRootFolder.FindItem(itemID); if (!Permissions.CanEditObjectInventory(part.UUID, agentID))
} return null;
if (item != null) part.ParentGroup.AddInventoryItem(agentID, localID, item, copyID);
{ // TODO: switch to posting on_rez here when scripts
SceneObjectPart part = GetSceneObjectPart(localID); // have state in inventory
if (part != null) part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
{
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
return;
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); // m_log.InfoFormat("[PRIMINVENTORY]: " +
// TODO: switch to posting on_rez here when scripts // "Rezzed script {0} into prim local ID {1} for user {2}",
// have state in inventory // item.inventoryName, localID, remoteClient.Name);
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); part.ParentGroup.ResumeScripts();
// m_log.InfoFormat("[PRIMINVENTORY]: " + return part;
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
part.SendPropertiesToClient(remoteClient);
part.ParentGroup.ResumeScripts();
}
else
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Could not rez script {0} into prim local ID {1} for user {2}"
+ " because the prim could not be found in the region!",
item.Name, localID, remoteClient.Name);
}
} }
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!", "[PRIM INVENTORY]: " +
itemID, remoteClient.Name); "Could not rez script {0} into prim local ID {1} for user {2}"
+ " because the prim could not be found in the region!",
item.Name, localID, agentID);
} }
} }
else // script has been rezzed directly into a prim's inventory else
{ {
SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); m_log.ErrorFormat(
if (part == null) "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!",
return; fromItemID, agentID);
if (!Permissions.CanCreateObjectInventory(
itemBase.InvType, part.UUID, remoteClient.AgentId))
return;
AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType,
Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"),
remoteClient.AgentId);
AssetService.Store(asset);
TaskInventoryItem taskItem = new TaskInventoryItem();
taskItem.ResetIDs(itemBase.Folder);
taskItem.ParentID = itemBase.Folder;
taskItem.CreationDate = (uint)itemBase.CreationDate;
taskItem.Name = itemBase.Name;
taskItem.Description = itemBase.Description;
taskItem.Type = itemBase.AssetType;
taskItem.InvType = itemBase.InvType;
taskItem.OwnerID = itemBase.Owner;
taskItem.CreatorID = itemBase.CreatorIdAsUuid;
taskItem.BasePermissions = itemBase.BasePermissions;
taskItem.CurrentPermissions = itemBase.CurrentPermissions;
taskItem.EveryonePermissions = itemBase.EveryOnePermissions;
taskItem.GroupPermissions = itemBase.GroupPermissions;
taskItem.NextPermissions = itemBase.NextPermissions;
taskItem.GroupID = itemBase.GroupID;
taskItem.GroupPermissions = 0;
taskItem.Flags = itemBase.Flags;
taskItem.PermsGranter = UUID.Zero;
taskItem.PermsMask = 0;
taskItem.AssetID = asset.FullID;
part.Inventory.AddInventoryItem(taskItem, false);
part.SendPropertiesToClient(remoteClient);
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
part.ParentGroup.ResumeScripts();
} }
return null;
}
/// <summary>
/// Rez a new script from nothing.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemBase"></param>
/// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase)
{
// The part ID is the folder ID!
SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
if (part == null)
return null;
if (!Permissions.CanCreateObjectInventory(itemBase.InvType, part.UUID, agentID))
return null;
AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType,
Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"),
agentID);
AssetService.Store(asset);
TaskInventoryItem taskItem = new TaskInventoryItem();
taskItem.ResetIDs(itemBase.Folder);
taskItem.ParentID = itemBase.Folder;
taskItem.CreationDate = (uint)itemBase.CreationDate;
taskItem.Name = itemBase.Name;
taskItem.Description = itemBase.Description;
taskItem.Type = itemBase.AssetType;
taskItem.InvType = itemBase.InvType;
taskItem.OwnerID = itemBase.Owner;
taskItem.CreatorID = itemBase.CreatorIdAsUuid;
taskItem.BasePermissions = itemBase.BasePermissions;
taskItem.CurrentPermissions = itemBase.CurrentPermissions;
taskItem.EveryonePermissions = itemBase.EveryOnePermissions;
taskItem.GroupPermissions = itemBase.GroupPermissions;
taskItem.NextPermissions = itemBase.NextPermissions;
taskItem.GroupID = itemBase.GroupID;
taskItem.GroupPermissions = 0;
taskItem.Flags = itemBase.Flags;
taskItem.PermsGranter = UUID.Zero;
taskItem.PermsMask = 0;
taskItem.AssetID = asset.FullID;
part.Inventory.AddInventoryItem(taskItem, false);
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
part.ParentGroup.ResumeScripts();
return part;
} }
/// <summary> /// <summary>
@ -1678,7 +1704,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="itemID"> </param> /// <param name="itemID"> </param>
/// <param name="localID"></param> /// <param name="localID"></param>
public void RezScript(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param) public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param)
{ {
TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId); TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId);

View File

@ -79,13 +79,12 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Add an inventory item from a user's inventory to a prim in this scene object. /// Add an inventory item from a user's inventory to a prim in this scene object.
/// </summary> /// </summary>
/// <param name="remoteClient">The client adding the item.</param> /// <param name="agentID">The agent adding the item.</param>
/// <param name="localID">The local ID of the part receiving the add.</param> /// <param name="localID">The local ID of the part receiving the add.</param>
/// <param name="item">The user inventory item being added.</param> /// <param name="item">The user inventory item being added.</param>
/// <param name="copyItemID">The item UUID that should be used by the new item.</param> /// <param name="copyItemID">The item UUID that should be used by the new item.</param>
/// <returns></returns> /// <returns></returns>
public bool AddInventoryItem(IClientAPI remoteClient, uint localID, public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID)
InventoryItemBase item, UUID copyItemID)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}", // "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}",
@ -107,9 +106,7 @@ namespace OpenSim.Region.Framework.Scenes
taskItem.Type = item.AssetType; taskItem.Type = item.AssetType;
taskItem.InvType = item.InvType; taskItem.InvType = item.InvType;
if (remoteClient != null && if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions())
remoteClient.AgentId != part.OwnerID &&
m_scene.Permissions.PropagatePermissions())
{ {
taskItem.BasePermissions = item.BasePermissions & taskItem.BasePermissions = item.BasePermissions &
item.NextPermissions; item.NextPermissions;
@ -144,11 +141,7 @@ namespace OpenSim.Region.Framework.Scenes
// taskItem.SaleType = item.SaleType; // taskItem.SaleType = item.SaleType;
taskItem.CreationDate = (uint)item.CreationDate; taskItem.CreationDate = (uint)item.CreationDate;
bool addFromAllowedDrop = false; bool addFromAllowedDrop = agentID != part.OwnerID;
if (remoteClient != null)
{
addFromAllowedDrop = remoteClient.AgentId != part.OwnerID;
}
part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop); part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);

View File

@ -72,6 +72,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
private bool m_initialized = false; private bool m_initialized = false;
private int m_detailedStatsStep = 0;
public IMesher mesher; public IMesher mesher;
private float m_meshLOD; private float m_meshLOD;
public float MeshLOD public float MeshLOD
@ -192,6 +194,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
m_meshLOD = 8f; m_meshLOD = 8f;
m_sculptLOD = 32f; m_sculptLOD = 32f;
m_detailedStatsStep = 0; // disabled
m_maxSubSteps = 10; m_maxSubSteps = 10;
m_fixedTimeStep = 1f / 60f; m_fixedTimeStep = 1f / 60f;
m_maxCollisionsPerFrame = 2048; m_maxCollisionsPerFrame = 2048;
@ -209,8 +213,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
parms.deactivationTime = 0.2f; parms.deactivationTime = 0.2f;
parms.linearSleepingThreshold = 0.8f; parms.linearSleepingThreshold = 0.8f;
parms.angularSleepingThreshold = 1.0f; parms.angularSleepingThreshold = 1.0f;
parms.ccdMotionThreshold = 0.5f; // set to zero to disable parms.ccdMotionThreshold = 0.0f; // set to zero to disable
parms.ccdSweptSphereRadius = 0.2f; parms.ccdSweptSphereRadius = 0.0f;
parms.contactProcessingThreshold = 0.1f;
parms.terrainFriction = 0.5f; parms.terrainFriction = 0.5f;
parms.terrainHitFraction = 0.8f; parms.terrainHitFraction = 0.8f;
@ -231,6 +236,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
_meshSculptedPrim = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim); _meshSculptedPrim = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim);
_forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing); _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing);
m_detailedStatsStep = pConfig.GetInt("DetailedStatsStep", m_detailedStatsStep);
m_meshLOD = pConfig.GetFloat("MeshLevelOfDetail", m_meshLOD); m_meshLOD = pConfig.GetFloat("MeshLevelOfDetail", m_meshLOD);
m_sculptLOD = pConfig.GetFloat("SculptLevelOfDetail", m_sculptLOD); m_sculptLOD = pConfig.GetFloat("SculptLevelOfDetail", m_sculptLOD);
@ -253,6 +259,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
parms.angularSleepingThreshold = pConfig.GetFloat("AngularSleepingThreshold", parms.angularSleepingThreshold); parms.angularSleepingThreshold = pConfig.GetFloat("AngularSleepingThreshold", parms.angularSleepingThreshold);
parms.ccdMotionThreshold = pConfig.GetFloat("CcdMotionThreshold", parms.ccdMotionThreshold); parms.ccdMotionThreshold = pConfig.GetFloat("CcdMotionThreshold", parms.ccdMotionThreshold);
parms.ccdSweptSphereRadius = pConfig.GetFloat("CcdSweptSphereRadius", parms.ccdSweptSphereRadius); parms.ccdSweptSphereRadius = pConfig.GetFloat("CcdSweptSphereRadius", parms.ccdSweptSphereRadius);
parms.contactProcessingThreshold = pConfig.GetFloat("ContactProcessingThreshold", parms.contactProcessingThreshold);
parms.terrainFriction = pConfig.GetFloat("TerrainFriction", parms.terrainFriction); parms.terrainFriction = pConfig.GetFloat("TerrainFriction", parms.terrainFriction);
parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction); parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction);
@ -398,6 +405,14 @@ public class BSScene : PhysicsScene, IPhysicsParameters
} }
} }
if (m_detailedStatsStep > 0)
{
if ((m_simulationStep % m_detailedStatsStep) == 0)
{
BulletSimAPI.DumpBulletStatistics();
}
}
// TODO: FIX THIS: fps calculation wrong. This calculation always returns about 1 in normal operation. // TODO: FIX THIS: fps calculation wrong. This calculation always returns about 1 in normal operation.
return timeStep / (numSubSteps * m_fixedTimeStep) * 1000f; return timeStep / (numSubSteps * m_fixedTimeStep) * 1000f;
} }
@ -671,6 +686,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
new PhysParameterEntry("MaxSubStep", "In simulation step, maximum number of substeps"), new PhysParameterEntry("MaxSubStep", "In simulation step, maximum number of substeps"),
new PhysParameterEntry("FixedTimeStep", "In simulation step, seconds of one substep (1/60)"), new PhysParameterEntry("FixedTimeStep", "In simulation step, seconds of one substep (1/60)"),
new PhysParameterEntry("MaxObjectMass", "Maximum object mass (10000.01)"), new PhysParameterEntry("MaxObjectMass", "Maximum object mass (10000.01)"),
new PhysParameterEntry("DetailedStats", "Frames between outputting detailed phys stats. Zero is off"),
new PhysParameterEntry("DefaultFriction", "Friction factor used on new objects"), new PhysParameterEntry("DefaultFriction", "Friction factor used on new objects"),
new PhysParameterEntry("DefaultDensity", "Density for new objects" ), new PhysParameterEntry("DefaultDensity", "Density for new objects" ),
@ -685,6 +701,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ),
// new PhysParameterEntry("CcdMotionThreshold", "" ), // new PhysParameterEntry("CcdMotionThreshold", "" ),
// new PhysParameterEntry("CcdSweptSphereRadius", "" ), // new PhysParameterEntry("CcdSweptSphereRadius", "" ),
new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ),
new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ), new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ),
new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ), new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ),
@ -715,6 +732,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
string lparm = parm.ToLower(); string lparm = parm.ToLower();
switch (lparm) switch (lparm)
{ {
case "detailedstats": m_detailedStatsStep = (int)val; break;
case "meshlod": m_meshLOD = (int)val; break; case "meshlod": m_meshLOD = (int)val; break;
case "sculptlod": m_sculptLOD = (int)val; break; case "sculptlod": m_sculptLOD = (int)val; break;
case "maxsubstep": m_maxSubSteps = (int)val; break; case "maxsubstep": m_maxSubSteps = (int)val; break;
@ -725,7 +743,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
case "defaultdensity": m_params[0].defaultDensity = val; break; case "defaultdensity": m_params[0].defaultDensity = val; break;
case "defaultrestitution": m_params[0].defaultRestitution = val; break; case "defaultrestitution": m_params[0].defaultRestitution = val; break;
case "collisionmargin": m_params[0].collisionMargin = val; break; case "collisionmargin": m_params[0].collisionMargin = val; break;
case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break; case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break;
case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break; case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break;
case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break;
@ -734,6 +752,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
case "angularsleepingthreshold": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; case "angularsleepingthreshold": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break;
case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break; case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break;
case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break;
case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break;
// set a terrain physical feature and cause terrain to be recalculated // set a terrain physical feature and cause terrain to be recalculated
case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break; case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break;
@ -741,10 +760,10 @@ public class BSScene : PhysicsScene, IPhysicsParameters
case "terrainrestitution": m_params[0].terrainRestitution = val; TaintedUpdateParameter("terrain", 0, val); break; case "terrainrestitution": m_params[0].terrainRestitution = val; TaintedUpdateParameter("terrain", 0, val); break;
// set an avatar physical feature and cause avatar(s) to be recalculated // set an avatar physical feature and cause avatar(s) to be recalculated
case "avatarfriction": UpdateParameterAvatars(ref m_params[0].avatarFriction, "avatar", localID, val); break; case "avatarfriction": UpdateParameterAvatars(ref m_params[0].avatarFriction, "avatar", localID, val); break;
case "avatardensity": UpdateParameterAvatars(ref m_params[0].avatarDensity, "avatar", localID, val); break; case "avatardensity": UpdateParameterAvatars(ref m_params[0].avatarDensity, "avatar", localID, val); break;
case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break;
case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break;
case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break;
default: ret = false; break; default: ret = false; break;
} }
@ -816,6 +835,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
bool ret = true; bool ret = true;
switch (parm.ToLower()) switch (parm.ToLower())
{ {
case "detailedstats": val = (int)m_detailedStatsStep; break;
case "meshlod": val = (float)m_meshLOD; break; case "meshlod": val = (float)m_meshLOD; break;
case "sculptlod": val = (float)m_sculptLOD; break; case "sculptlod": val = (float)m_sculptLOD; break;
case "maxsubstep": val = (float)m_maxSubSteps; break; case "maxsubstep": val = (float)m_maxSubSteps; break;
@ -835,6 +855,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
case "angularsleepingthreshold": val = m_params[0].angularDamping; break; case "angularsleepingthreshold": val = m_params[0].angularDamping; break;
case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break; case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break;
case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break; case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break;
case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break;
case "terrainfriction": val = m_params[0].terrainFriction; break; case "terrainfriction": val = m_params[0].terrainFriction; break;
case "terrainhitfraction": val = m_params[0].terrainHitFraction; break; case "terrainhitfraction": val = m_params[0].terrainHitFraction; break;

View File

@ -122,6 +122,7 @@ public struct ConfigurationParameters
public float angularSleepingThreshold; public float angularSleepingThreshold;
public float ccdMotionThreshold; public float ccdMotionThreshold;
public float ccdSweptSphereRadius; public float ccdSweptSphereRadius;
public float contactProcessingThreshold;
public float terrainFriction; public float terrainFriction;
public float terrainHitFraction; public float terrainHitFraction;
@ -248,6 +249,9 @@ public static extern RaycastHit RayTest(uint worldID, uint id, Vector3 from, Vec
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Vector3 RecoverFromPenetration(uint worldID, uint id); public static extern Vector3 RecoverFromPenetration(uint worldID, uint id);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern void DumpBulletStatistics();
// Log a debug message // Log a debug message
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg);

View File

@ -1048,6 +1048,7 @@ namespace OpenSim.Region.Physics.OdePlugin
CAPSULE_RADIUS = 0.01f; CAPSULE_RADIUS = 0.01f;
} }
// lock (OdeScene.UniversalColliderSyncObject)
Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
@ -1179,7 +1180,9 @@ namespace OpenSim.Region.Physics.OdePlugin
if (Shell != IntPtr.Zero) if (Shell != IntPtr.Zero)
{ {
// lock (OdeScene.UniversalColliderSyncObject)
d.GeomDestroy(Shell); d.GeomDestroy(Shell);
_parent_scene.geom_name_map.Remove(Shell); _parent_scene.geom_name_map.Remove(Shell);
_parent_scene.actor_name_map.Remove(Shell); _parent_scene.actor_name_map.Remove(Shell);

View File

@ -105,6 +105,32 @@ namespace OpenSim.Region.Physics.OdePlugin
private readonly ILog m_log; private readonly ILog m_log;
// private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
/// <summary>
/// Provide a sync object so that only one thread calls d.Collide() at a time across all OdeScene instances.
/// </summary>
/// <remarks>
/// With ODE as of r1755 (though also tested on r1860), only one thread can call d.Collide() at a
/// time, even where physics objects are in entirely different ODE worlds. This is because generating contacts
/// uses a static cache at the ODE level.
///
/// Without locking, simulators running multiple regions will eventually crash with a native stack trace similar
/// to
///
/// mono() [0x489171]
/// mono() [0x4d154f]
/// /lib/x86_64-linux-gnu/libpthread.so.0(+0xfc60) [0x7f6ded592c60]
/// .../opensim/bin/libode-x86_64.so(_ZN6Opcode11OBBCollider8_CollideEPKNS_14AABBNoLeafNodeE+0xd7a) [0x7f6dd822628a]
///
/// ODE provides an experimental option to cache in thread local storage but compiling ODE with this option
/// causes OpenSimulator to immediately crash with a native stack trace similar to
///
/// mono() [0x489171]
/// mono() [0x4d154f]
/// /lib/x86_64-linux-gnu/libpthread.so.0(+0xfc60) [0x7f03c9849c60]
/// .../opensim/bin/libode-x86_64.so(_Z12dCollideCCTLP6dxGeomS0_iP12dContactGeomi+0x92) [0x7f03b44bcf82]
/// </remarks>
internal static Object UniversalColliderSyncObject = new Object();
private Random fluidRandomizer = new Random(Environment.TickCount); private Random fluidRandomizer = new Random(Environment.TickCount);
private const uint m_regionWidth = Constants.RegionSize; private const uint m_regionWidth = Constants.RegionSize;
@ -799,7 +825,9 @@ namespace OpenSim.Region.Physics.OdePlugin
if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
return; return;
count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf); lock (OdeScene.UniversalColliderSyncObject)
count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf);
if (count > contacts.Length) if (count > contacts.Length)
m_log.Error("[ODE SCENE]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length); m_log.Error("[ODE SCENE]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length);
} }

View File

@ -7003,7 +7003,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((scriptItem.BasePermissions & (uint)PermissionMask.Transfer) != 0 || dest.ParentGroup.RootPart.OwnerID == m_host.ParentGroup.RootPart.OwnerID) if ((scriptItem.BasePermissions & (uint)PermissionMask.Transfer) != 0 || dest.ParentGroup.RootPart.OwnerID == m_host.ParentGroup.RootPart.OwnerID)
{ {
// the rest of the permission checks are done in RezScript, so check the pin there as well // the rest of the permission checks are done in RezScript, so check the pin there as well
World.RezScript(srcId, m_host, destId, pin, running, start_param); World.RezScriptFromPrim(srcId, m_host, destId, pin, running, start_param);
if ((scriptItem.BasePermissions & (uint)PermissionMask.Copy) == 0) if ((scriptItem.BasePermissions & (uint)PermissionMask.Copy) == 0)
m_host.Inventory.RemoveInventoryItem(srcId); m_host.Inventory.RemoveInventoryItem(srcId);
@ -8065,6 +8065,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(2000); ScriptSleep(2000);
} }
public LSL_String llGetParcelMusicURL()
{
m_host.AddScriptLPS(1);
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (land.LandData.OwnerID != m_host.OwnerID)
return String.Empty;
return land.GetMusicUrl();
}
public LSL_Vector llGetRootPosition() public LSL_Vector llGetRootPosition()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);

View File

@ -162,6 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param); LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param);
LSL_Integer llGetParcelFlags(LSL_Vector pos); LSL_Integer llGetParcelFlags(LSL_Vector pos);
LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide); LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide);
LSL_String llGetParcelMusicURL();
LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide); LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide);
LSL_List llGetParcelPrimOwners(LSL_Vector pos); LSL_List llGetParcelPrimOwners(LSL_Vector pos);
LSL_Integer llGetPermissions(); LSL_Integer llGetPermissions();

View File

@ -661,6 +661,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide); return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide);
} }
public LSL_String llGetParcelMusicURL()
{
return m_LSL_Functions.llGetParcelMusicURL();
}
public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
{ {
return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide); return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide);

View File

@ -442,7 +442,7 @@ namespace OpenSim.Region.UserStatistics
public string ViewerStatsReport(string request, string path, string param, public string ViewerStatsReport(string request, string path, string param,
UUID agentID, Caps caps) UUID agentID, Caps caps)
{ {
//m_log.Debug(request); // m_log.DebugFormat("[WEB STATS MODULE]: Received viewer starts report from {0}", agentID);
UpdateUserStats(ParseViewerStats(request,agentID), dbConn); UpdateUserStats(ParseViewerStats(request,agentID), dbConn);
@ -655,13 +655,13 @@ namespace OpenSim.Region.UserStatistics
updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString())); updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString())); updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString()));
updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString())); updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString()));
m_log.Debug("UPDATE"); // m_log.Debug("UPDATE");
int result = updatecmd.ExecuteNonQuery(); int result = updatecmd.ExecuteNonQuery();
if (result == 0) if (result == 0)
{ {
m_log.Debug("INSERT"); // m_log.Debug("INSERT");
updatecmd.CommandText = SQL_STATS_TABLE_INSERT; updatecmd.CommandText = SQL_STATS_TABLE_INSERT;
try try
{ {

Binary file not shown.

Binary file not shown.

View File

@ -842,8 +842,9 @@
DeactivationTime = 0.2 DeactivationTime = 0.2
LinearSleepingThreshold = 0.8 LinearSleepingThreshold = 0.8
AngularSleepingThreshold = 1.0 AngularSleepingThreshold = 1.0
CcdMotionThreshold = 0.5 CcdMotionThreshold = 0.0
CcdSweptSphereRadius = 0.2 CcdSweptSphereRadius = 0.0
ContactProcessingThreshold = 0.1
; Whether to mesh sculpties ; Whether to mesh sculpties
MeshSculptedPrim = true MeshSculptedPrim = true

Binary file not shown.

Binary file not shown.