Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim

master-beforevarregion
Melanie 2013-12-16 22:11:03 +00:00
commit fe01e7d1cc
11 changed files with 97 additions and 84 deletions

View File

@ -247,12 +247,18 @@ namespace OpenSim.Framework
/// <returns></returns> /// <returns></returns>
public static List<string> ParseNotecardToList(string rawInput) public static List<string> ParseNotecardToList(string rawInput)
{ {
string[] input = rawInput.Replace("\r", "").Split('\n'); string[] input;
int idx = 0; int idx = 0;
int level = 0; int level = 0;
List<string> output = new List<string>(); List<string> output = new List<string>();
string[] words; string[] words;
//The Linden format always ends with a } after the input data.
//Strip off trailing } so there is nothing after the input data.
int i = rawInput.LastIndexOf("}");
rawInput = rawInput.Remove(i, rawInput.Length-i);
input = rawInput.Replace("\r", "").Split('\n');
while (idx < input.Length) while (idx < input.Length)
{ {
if (input[idx] == "{") if (input[idx] == "{")
@ -287,24 +293,18 @@ namespace OpenSim.Framework
break; break;
if (words[0] == "Text") if (words[0] == "Text")
{ {
int len = int.Parse(words[2]); idx++; //Now points to first line of notecard text
idx++;
int count = -1; //Number of lines in notecard.
int lines = input.Length - idx;
int line = 0;
while (count < len && idx < input.Length) while (line < lines)
{ {
// int l = input[idx].Length; // m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", input[idx]);
string ln = input[idx]; output.Add(input[idx]);
int need = len-count-1;
if (ln.Length > need)
ln = ln.Substring(0, need);
// m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", ln);
output.Add(ln);
count += ln.Length + 1;
idx++; idx++;
line++;
} }
return output; return output;

View File

@ -135,8 +135,8 @@ namespace OpenSim.Framework.Servers
TimeSpan timeTaken = DateTime.Now - m_startuptime; TimeSpan timeTaken = DateTime.Now - m_startuptime;
m_log.InfoFormat( MainConsole.Instance.OutputFormat(
"[STARTUP]: Non-script portion of startup took {0}m {1}s. PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED.", "PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED. Non-script portion of startup took {0}m {1}s.",
timeTaken.Minutes, timeTaken.Seconds); timeTaken.Minutes, timeTaken.Seconds);
} }

View File

@ -216,13 +216,13 @@ namespace OpenSim.Region.CoreModules
// FIXME: If console region is root then this will be printed by every module. Currently, there is no // FIXME: If console region is root then this will be printed by every module. Currently, there is no
// way to prevent this, short of making the entire module shared (which is complete overkill). // way to prevent this, short of making the entire module shared (which is complete overkill).
// One possibility is to return a bool to signal whether the module has completely handled the command // One possibility is to return a bool to signal whether the module has completely handled the command
m_log.InfoFormat("[WIND]: Please change to a specific region in order to set Sun parameters."); MainConsole.Instance.Output("Please change to a specific region in order to set Sun parameters.");
return; return;
} }
if (m_scene.ConsoleScene() != m_scene) if (m_scene.ConsoleScene() != m_scene)
{ {
m_log.InfoFormat("[WIND]: Console Scene is not my scene."); MainConsole.Instance.Output("Console Scene is not my scene.");
return; return;
} }
} }
@ -233,7 +233,9 @@ namespace OpenSim.Region.CoreModules
private void HandleConsoleCommand(string module, string[] cmdparams) private void HandleConsoleCommand(string module, string[] cmdparams)
{ {
ValidateConsole(); ValidateConsole();
m_log.Info("[WIND] The wind command can be used to change the currently active wind model plugin and update the parameters for wind plugins.");
MainConsole.Instance.Output(
"The wind command can be used to change the currently active wind model plugin and update the parameters for wind plugins.");
} }
/// <summary> /// <summary>
@ -246,7 +248,9 @@ namespace OpenSim.Region.CoreModules
if ((cmdparams.Length != 4) if ((cmdparams.Length != 4)
|| !cmdparams[1].Equals("base")) || !cmdparams[1].Equals("base"))
{ {
m_log.Info("[WIND] Invalid parameters to change parameters for Wind module base, usage: wind base <parameter> <value>"); MainConsole.Instance.Output(
"Invalid parameters to change parameters for Wind module base, usage: wind base <parameter> <value>");
return; return;
} }
@ -261,7 +265,9 @@ namespace OpenSim.Region.CoreModules
} }
else else
{ {
m_log.InfoFormat("[WIND] Invalid value {0} specified for {1}", cmdparams[3], cmdparams[2]); MainConsole.Instance.OutputFormat(
"Invalid value {0} specified for {1}", cmdparams[3], cmdparams[2]);
return; return;
} }
@ -271,22 +277,23 @@ namespace OpenSim.Region.CoreModules
if (desiredPlugin.Equals(m_activeWindPlugin.Name)) if (desiredPlugin.Equals(m_activeWindPlugin.Name))
{ {
m_log.InfoFormat("[WIND] Wind model plugin {0} is already active", cmdparams[3]); MainConsole.Instance.OutputFormat("Wind model plugin {0} is already active", cmdparams[3]);
return; return;
} }
if (m_availableWindPlugins.ContainsKey(desiredPlugin)) if (m_availableWindPlugins.ContainsKey(desiredPlugin))
{ {
m_activeWindPlugin = m_availableWindPlugins[cmdparams[3]]; m_activeWindPlugin = m_availableWindPlugins[cmdparams[3]];
m_log.InfoFormat("[WIND] {0} wind model plugin now active", m_activeWindPlugin.Name);
MainConsole.Instance.OutputFormat("{0} wind model plugin now active", m_activeWindPlugin.Name);
} }
else else
{ {
m_log.InfoFormat("[WIND] Could not find wind model plugin {0}", desiredPlugin); MainConsole.Instance.OutputFormat("Could not find wind model plugin {0}", desiredPlugin);
} }
break; break;
} }
} }
/// <summary> /// <summary>
@ -300,7 +307,7 @@ namespace OpenSim.Region.CoreModules
if ((cmdparams.Length != 4) if ((cmdparams.Length != 4)
&& (cmdparams.Length != 3)) && (cmdparams.Length != 3))
{ {
m_log.Info("[WIND] Usage: wind <plugin> <param> [value]"); MainConsole.Instance.Output("Usage: wind <plugin> <param> [value]");
return; return;
} }
@ -311,16 +318,17 @@ namespace OpenSim.Region.CoreModules
{ {
if (!float.TryParse(cmdparams[3], out value)) if (!float.TryParse(cmdparams[3], out value))
{ {
m_log.InfoFormat("[WIND] Invalid value {0}", cmdparams[3]); MainConsole.Instance.OutputFormat("Invalid value {0}", cmdparams[3]);
} }
try try
{ {
WindParamSet(plugin, param, value); WindParamSet(plugin, param, value);
MainConsole.Instance.OutputFormat("{0} set to {1}", param, value);
} }
catch (Exception e) catch (Exception e)
{ {
m_log.InfoFormat("[WIND] {0}", e.Message); MainConsole.Instance.OutputFormat("{0}", e.Message);
} }
} }
else else
@ -328,11 +336,11 @@ namespace OpenSim.Region.CoreModules
try try
{ {
value = WindParamGet(plugin, param); value = WindParamGet(plugin, param);
m_log.InfoFormat("[WIND] {0} : {1}", param, value); MainConsole.Instance.OutputFormat("{0} : {1}", param, value);
} }
catch (Exception e) catch (Exception e)
{ {
m_log.InfoFormat("[WIND] {0}", e.Message); MainConsole.Instance.OutputFormat("{0}", e.Message);
} }
} }
@ -366,13 +374,11 @@ namespace OpenSim.Region.CoreModules
{ {
IWindModelPlugin windPlugin = m_availableWindPlugins[plugin]; IWindModelPlugin windPlugin = m_availableWindPlugins[plugin];
windPlugin.WindParamSet(param, value); windPlugin.WindParamSet(param, value);
m_log.InfoFormat("[WIND] {0} set to {1}", param, value);
} }
else else
{ {
throw new Exception(String.Format("Could not find plugin {0}", plugin)); throw new Exception(String.Format("Could not find plugin {0}", plugin));
} }
} }
public float WindParamGet(string plugin, string param) public float WindParamGet(string plugin, string param)

View File

@ -2866,16 +2866,33 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 up = new Vector3((float)x, (float)y, (float)z); Vector3 up = new Vector3((float)x, (float)y, (float)z);
Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f;
m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; Vector3 newPos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT;
Quaternion newRot;
if (part.IsRoot)
{
newRot = sitTargetOrient;
}
else
{
newPos = newPos * part.RotationOffset;
newRot = part.RotationOffset * sitTargetOrient;
}
newPos += part.OffsetPosition;
m_pos = newPos;
Rotation = newRot;
// m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset;
Rotation = sitTargetOrient;
// ParentPosition = part.AbsolutePosition; // ParentPosition = part.AbsolutePosition;
part.ParentGroup.AddAvatar(UUID); part.ParentGroup.AddAvatar(UUID);
} }
else else
{ {
m_pos -= part.AbsolutePosition; // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is
// being sat upon.
m_pos -= part.GroupPosition;
// ParentPosition = part.AbsolutePosition; // ParentPosition = part.AbsolutePosition;
part.ParentGroup.AddAvatar(UUID); part.ParentGroup.AddAvatar(UUID);

View File

@ -111,15 +111,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
// We need to preserve this here because phys actor is removed by the sit.
Vector3 spPhysActorSize = m_sp.PhysicsActor.Size;
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
// FIXME: This is different for live avatars - z position is adjusted. This is half the height of the
// default avatar.
// Curiously, Vector3.ToString() will not display the last two places of the float. For example,
// printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337>
Assert.That( Assert.That(
m_sp.AbsolutePosition, m_sp.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, spPhysActorSize.Z / 2)));
m_sp.StandUp(); m_sp.StandUp();
@ -147,9 +145,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID)); Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID));
Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
Assert.That( // Assert.That(
m_sp.AbsolutePosition, // m_sp.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); // Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
Assert.That(m_sp.PhysicsActor, Is.Null); Assert.That(m_sp.PhysicsActor, Is.Null);
Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));

View File

@ -181,9 +181,18 @@ namespace OpenSim.Region.Framework.Scenes
if (part.ParticleSystem.Length > 0) if (part.ParticleSystem.Length > 0)
{ {
Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0); try
if (ps.Texture != UUID.Zero) {
assetUuids[ps.Texture] = AssetType.Texture; Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0);
if (ps.Texture != UUID.Zero)
assetUuids[ps.Texture] = AssetType.Texture;
}
catch (Exception e)
{
m_log.WarnFormat(
"[UUID GATHERER]: Could not check particle system for part {0} {1} in object {2} {3} since it is corrupt. Continuing.",
part.Name, part.UUID, sceneObject.Name, sceneObject.UUID);
}
} }
TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();

View File

@ -216,9 +216,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
// m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
// m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
// Warn level because the region cannot be used while logins are disabled // Putting this out to console to make it eye-catching for people who are running OpenSimulator
m_log.WarnFormat( // without info log messages enabled. Making this a warning is arguably misleading since it isn't a
"[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); // warning, and monitor scripts looking for warn/error/fatal messages will received false positives.
// Arguably, log4net needs a status log level (like Apache).
MainConsole.Instance.OutputFormat("INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
} }
m_scene.SceneGridService.InformNeighborsThatRegionisUp( m_scene.SceneGridService.InformNeighborsThatRegionisUp(

View File

@ -323,9 +323,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
Assert.That( // Assert.That(
npc.AbsolutePosition, // npc.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); // Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
m_npcMod.Stand(npc.UUID, m_scene); m_npcMod.Stand(npc.UUID, m_scene);
@ -337,7 +337,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
public void TestSitAndStandWithNoSitTarget() public void TestSitAndStandWithNoSitTarget()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // TestHelpers.EnableLogging();
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
@ -355,13 +355,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
// FIXME: This is different for live avatars - z position is adjusted. This is half the height of the // We should really be using the NPC size but this would mean preserving the physics actor since it is
// default avatar. // removed on sit.
// Curiously, Vector3.ToString() will not display the last two places of the float. For example,
// printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337>
Assert.That( Assert.That(
npc.AbsolutePosition, npc.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, sp.PhysicsActor.Size.Z / 2)));
m_npcMod.Stand(npc.UUID, m_scene); m_npcMod.Stand(npc.UUID, m_scene);

View File

@ -118,14 +118,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
public override Vector3 Position { get; set; } public override Vector3 Position { get; set; }
public override Vector3 Size public override Vector3 Size { get; set; }
{
get { return _size; }
set {
_size = value;
_size.Z = _size.Z / 2.0f;
}
}
public override PrimitiveBaseShape Shape public override PrimitiveBaseShape Shape
{ {

View File

@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
string[] ncLines = { "One", "Two", "Three" }; string[] ncLines = { "One", "Twoè", "Three" };
TaskInventoryItem ncItem TaskInventoryItem ncItem
= TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); = TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines));

View File

@ -1709,9 +1709,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public bool GetScriptState(UUID itemID) public bool GetScriptState(UUID itemID)
{ {
IScriptInstance instance = GetInstance(itemID); IScriptInstance instance = GetInstance(itemID);
if (instance != null) return instance != null && instance.Running;
return instance.Running;
return false;
} }
public void ApiResetScript(UUID itemID) public void ApiResetScript(UUID itemID)
@ -1755,9 +1753,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public DetectParams GetDetectParams(UUID itemID, int idx) public DetectParams GetDetectParams(UUID itemID, int idx)
{ {
IScriptInstance instance = GetInstance(itemID); IScriptInstance instance = GetInstance(itemID);
if (instance != null) return instance != null ? instance.GetDetectParams(idx) : null;
return instance.GetDetectParams(idx);
return null;
} }
public void SetMinEventDelay(UUID itemID, double delay) public void SetMinEventDelay(UUID itemID, double delay)
@ -1770,9 +1766,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public UUID GetDetectID(UUID itemID, int idx) public UUID GetDetectID(UUID itemID, int idx)
{ {
IScriptInstance instance = GetInstance(itemID); IScriptInstance instance = GetInstance(itemID);
if (instance != null) return instance != null ? instance.GetDetectID(idx) : UUID.Zero;
return instance.GetDetectID(idx);
return UUID.Zero;
} }
public void SetState(UUID itemID, string newState) public void SetState(UUID itemID, string newState)
@ -1786,9 +1780,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public int GetStartParameter(UUID itemID) public int GetStartParameter(UUID itemID)
{ {
IScriptInstance instance = GetInstance(itemID); IScriptInstance instance = GetInstance(itemID);
if (instance == null) return instance == null ? 0 : instance.StartParam;
return 0;
return instance.StartParam;
} }
public void OnShutdown() public void OnShutdown()
@ -1822,9 +1814,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public IScriptApi GetApi(UUID itemID, string name) public IScriptApi GetApi(UUID itemID, string name)
{ {
IScriptInstance instance = GetInstance(itemID); IScriptInstance instance = GetInstance(itemID);
if (instance == null) return instance == null ? null : instance.GetApi(name);
return null;
return instance.GetApi(name);
} }
public void OnGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) public void OnGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)