Merge branch 'master' into careminster

avinationmerge
Melanie 2012-10-19 00:32:25 +01:00
commit 29ab5a6bfe
2 changed files with 190 additions and 41 deletions

View File

@ -141,7 +141,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
"show object uuid",
"show object uuid [--full] <UUID>",
"Show details of a scene object with the given UUID",
"The --full option will print out information on all the parts of the object.",
"The --full option will print out information on all the parts of the object.\n"
+ "For yet more detailed part information, use the \"show part\" commands.",
HandleShowObjectByUuid);
m_console.Commands.AddCommand(
@ -151,6 +152,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
"show object name [--full] [--regex] <name>",
"Show details of scene objects with the given name.",
"The --full option will print out information on all the parts of the object.\n"
+ "For yet more detailed part information, use the \"show part\" commands.\n"
+ "If --regex is specified then the name is treatead as a regular expression.",
HandleShowObjectByName);
@ -161,6 +163,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
"show object pos [--full] <start-coord> to <end-coord>",
"Show details of scene objects within the given area.",
"The --full option will print out information on all the parts of the object.\n"
+ "For yet more detailed part information, use the \"show part\" commands.\n"
+ "Each component of the coord is comma separated. There must be no spaces between the commas.\n"
+ "If you don't care about the z component you can simply omit it.\n"
+ "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
@ -242,7 +245,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
m_console.OutputFormat(sb.ToString());
}
private void OutputSopsToConsole(Predicate<SceneObjectPart> searchPredicate)
private void OutputSopsToConsole(Predicate<SceneObjectPart> searchPredicate, bool showFull)
{
List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups();
List<SceneObjectPart> parts = new List<SceneObjectPart>();
@ -253,7 +256,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
foreach (SceneObjectPart part in parts)
{
AddScenePartReport(sb, part);
AddScenePartReport(sb, part, showFull);
sb.Append("\n");
}
@ -362,21 +365,27 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
OutputSogsToConsole(searchPredicate, showFull);
}
private void HandleShowPartByUuid(string module, string[] cmd)
private void HandleShowPartByUuid(string module, string[] cmdparams)
{
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
return;
if (cmd.Length < 4)
// bool showFull = false;
OptionSet options = new OptionSet();
// options.Add("full", v => showFull = v != null );
List<string> mainParams = options.Parse(cmdparams);
if (mainParams.Count < 4)
{
m_console.OutputFormat("Usage: show part uuid <uuid>");
m_console.OutputFormat("Usage: show part uuid [--full] <uuid>");
return;
}
UUID objectUuid;
if (!UUID.TryParse(cmd[3], out objectUuid))
if (!UUID.TryParse(mainParams[3], out objectUuid))
{
m_console.OutputFormat("{0} is not a valid uuid", cmd[3]);
m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
return;
}
@ -389,7 +398,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
}
StringBuilder sb = new StringBuilder();
AddScenePartReport(sb, sop);
AddScenePartReport(sb, sop, true);
m_console.OutputFormat(sb.ToString());
}
@ -399,13 +408,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
return;
if (cmdparams.Length < 5)
// bool showFull = false;
OptionSet options = new OptionSet();
// options.Add("full", v => showFull = v != null );
List<string> mainParams = options.Parse(cmdparams);
if (mainParams.Count < 5)
{
m_console.OutputFormat("Usage: show part pos <start-coord> to <end-coord>");
m_console.OutputFormat("Usage: show part pos [--full] <start-coord> to <end-coord>");
return;
}
string rawConsoleStartVector = cmdparams[3];
string rawConsoleStartVector = mainParams[3];
Vector3 startVector;
if (!ConsoleUtil.TryParseConsoleMinVector(rawConsoleStartVector, out startVector))
@ -414,7 +429,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
return;
}
string rawConsoleEndVector = cmdparams[5];
string rawConsoleEndVector = mainParams[5];
Vector3 endVector;
if (!ConsoleUtil.TryParseConsoleMaxVector(rawConsoleEndVector, out endVector))
@ -423,7 +438,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
return;
}
OutputSopsToConsole(sop => Util.IsInsideBox(sop.AbsolutePosition, startVector, endVector));
OutputSopsToConsole(sop => Util.IsInsideBox(sop.AbsolutePosition, startVector, endVector), true);
}
private void HandleShowPartByName(string module, string[] cmdparams)
@ -431,14 +446,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
return;
// bool showFull = false;
bool useRegex = false;
OptionSet options = new OptionSet().Add("regex", v=> useRegex = v != null );
OptionSet options = new OptionSet();
// options.Add("full", v => showFull = v != null );
options.Add("regex", v => useRegex = v != null );
List<string> mainParams = options.Parse(cmdparams);
if (mainParams.Count < 4)
{
m_console.OutputFormat("Usage: show part name [--regex] <name>");
m_console.OutputFormat("Usage: show part name [--full] [--regex] <name>");
return;
}
@ -456,16 +474,26 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
searchPredicate = sop => sop.Name == name;
}
OutputSopsToConsole(searchPredicate);
OutputSopsToConsole(searchPredicate, true);
}
/// <summary>
/// Append a scene object report to an input StringBuilder
/// </summary>
/// <returns></returns>
/// <param name='sb'></param>
/// <param name='so'</param>
/// <param name='showFull'>
/// If true then information on all parts of an object is appended.
/// If false then only summary information about an object is appended.
/// </param>
private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so, bool showFull)
{
if (showFull)
{
foreach (SceneObjectPart sop in so.Parts)
{
AddScenePartReport(sb, sop);
AddScenePartReport(sb, sop, false);
sb.Append("\n");
}
}
@ -491,7 +519,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
return sb.Append(cdl.ToString());
}
private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop)
/// <summary>
/// Append a scene object part report to an input StringBuilder
/// </summary>
/// <returns></returns>
/// <param name='sb'></param>
/// <param name='sop'</param>
/// <param name='showFull'>
/// If true then information on each inventory item will be shown.
/// If false then only summary inventory information is shown.
/// </param>
private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop, bool showFull)
{
ConsoleDisplayList cdl = new ConsoleDisplayList();
cdl.AddRow("Name", sop.Name);
@ -504,11 +542,46 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
sop.IsRoot ? "Is Root" : string.Format("{0} {1}", sop.ParentGroup.Name, sop.ParentGroup.UUID));
cdl.AddRow("Link number", sop.LinkNum);
cdl.AddRow("Flags", sop.Flags);
cdl.AddRow("Items", sop.Inventory.Count);
object itemsOutput;
if (showFull)
{
StringBuilder itemsSb = new StringBuilder("\n");
itemsOutput = AddScenePartItemsReport(itemsSb, sop.Inventory).ToString();
}
else
{
itemsOutput = sop.Inventory.Count;
}
cdl.AddRow("Items", itemsOutput);
return sb.Append(cdl.ToString());
}
private StringBuilder AddScenePartItemsReport(StringBuilder sb, IEntityInventory inv)
{
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.Indent = 2;
cdt.AddColumn("Name", 50);
cdt.AddColumn("Type", 12);
cdt.AddColumn("Running", 7);
cdt.AddColumn("Item UUID", 36);
cdt.AddColumn("Asset UUID", 36);
foreach (TaskInventoryItem item in inv.GetInventoryItems())
cdt.AddRow(
item.Name,
((InventoryType)item.InvType).ToString(),
(InventoryType)item.InvType == InventoryType.LSL ? item.ScriptRunning.ToString() : "n/a",
item.ItemID.ToString(),
item.AssetID.ToString());
return sb.Append(cdt.ToString());
}
private void HandleDeleteObject(string module, string[] cmd)
{
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))

View File

@ -341,8 +341,17 @@ namespace OpenSim.Region.Physics.OdePlugin
prim_geom = geom;
//Console.WriteLine("SetGeom to " + prim_geom + " for " + Name);
if (m_assetFailed)
{
d.GeomSetCategoryBits(prim_geom, 0);
d.GeomSetCollideBits(prim_geom, 0);
}
else
{
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
}
_parent_scene.geom_name_map[prim_geom] = Name;
_parent_scene.actor_name_map[prim_geom] = this;
@ -405,8 +414,17 @@ namespace OpenSim.Region.Physics.OdePlugin
myrot.W = _orientation.W;
d.BodySetQuaternion(Body, ref myrot);
d.GeomSetBody(prim_geom, Body);
if (m_assetFailed)
{
d.GeomSetCategoryBits(prim_geom, 0);
d.GeomSetCollideBits(prim_geom, 0);
}
else
{
m_collisionCategories |= CollisionCategories.Body;
m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
}
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
@ -778,8 +796,16 @@ namespace OpenSim.Region.Physics.OdePlugin
m_collisionCategories &= ~CollisionCategories.Body;
m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
if (m_assetFailed)
{
d.GeomSetCategoryBits(prim_geom, 0);
d.GeomSetCollideBits(prim_geom, 0);
}
else
{
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
}
d.BodyDestroy(Body);
lock (childrenPrim)
@ -803,8 +829,17 @@ namespace OpenSim.Region.Physics.OdePlugin
m_collisionCategories &= ~CollisionCategories.Body;
m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
if (m_assetFailed)
{
d.GeomSetCategoryBits(prim_geom, 0);
d.GeomSetCollideBits(prim_geom, 0);
}
else
{
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
}
Body = IntPtr.Zero;
}
@ -1094,8 +1129,16 @@ Console.WriteLine("ZProcessTaints for " + Name);
prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
//Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name);
if (prm.m_assetFailed)
{
d.GeomSetCategoryBits(prm.prim_geom, 0);
d.GeomSetCollideBits(prm.prim_geom, 0);
}
else
{
d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories);
d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags);
}
d.Quaternion quat = new d.Quaternion();
quat.W = prm._orientation.W;
@ -1140,10 +1183,18 @@ Console.WriteLine("ZProcessTaints for " + Name);
m_collisionCategories |= CollisionCategories.Body;
m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
//Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name);
if (m_assetFailed)
{
d.GeomSetCategoryBits(prim_geom, 0);
d.GeomSetCollideBits(prim_geom, 0);
}
else
{
//Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name);
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
//Console.WriteLine(" Post GeomSetCategoryBits 2");
//Console.WriteLine(" Post GeomSetCategoryBits 2");
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
}
d.Quaternion quat2 = new d.Quaternion();
quat2.W = _orientation.W;
@ -1304,8 +1355,16 @@ Console.WriteLine("ZProcessTaints for " + Name);
disableBodySoft();
}
if (m_assetFailed)
{
d.GeomSetCategoryBits(prim_geom, 0);
d.GeomSetCollideBits(prim_geom, 0);
}
else
{
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
}
if (IsPhysical)
{
@ -1326,8 +1385,16 @@ Console.WriteLine("ZProcessTaints for " + Name);
if (m_collidesWater)
m_collisionFlags |= CollisionCategories.Water;
if (m_assetFailed)
{
d.GeomSetCategoryBits(prim_geom, 0);
d.GeomSetCollideBits(prim_geom, 0);
}
else
{
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
}
if (IsPhysical)
{
@ -1504,6 +1571,8 @@ Console.WriteLine("CreateGeom:");
// m_log.Debug(m_localID);
if (mesh == null)
CheckMeshAsset();
else
m_assetFailed = false;
}
#if SPAM
@ -2007,6 +2076,8 @@ Console.WriteLine(" JointCreateFixed");
mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical);
if (mesh == null)
CheckMeshAsset();
else
m_assetFailed = false;
}
}
@ -2060,9 +2131,12 @@ Console.WriteLine(" JointCreateFixed");
m_collisionFlags &= ~CollisionCategories.Water;
}
if (m_assetFailed)
d.GeomSetCollideBits(prim_geom, 0);
else
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
}
/// <summary>
/// Change prim in response to a shape taint.
/// </summary>
@ -2110,6 +2184,8 @@ Console.WriteLine(" JointCreateFixed");
mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical);
if (mesh == null)
CheckMeshAsset();
else
m_assetFailed = false;
}
CreateGeom(m_targetSpace, mesh);
@ -3278,7 +3354,7 @@ Console.WriteLine(" JointCreateFixed");
_pbs.SculptData = new byte[asset.Data.Length];
asset.Data.CopyTo(_pbs.SculptData, 0);
m_assetFailed = false;
// m_assetFailed = false;
m_taintshape = true;
_parent_scene.AddPhysicsActorTaint(this);
}