mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/World/Land/LandObject.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
This commit is contained in:
@@ -27,8 +27,10 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenSim.Framework;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
using Animation = OpenSim.Framework.Animation;
|
||||
|
||||
@@ -37,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
[Serializable]
|
||||
public class AnimationSet
|
||||
{
|
||||
public static AvatarAnimations Animations = new AvatarAnimations();
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation();
|
||||
private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>();
|
||||
@@ -132,9 +134,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
/// </summary>
|
||||
public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID)
|
||||
{
|
||||
if (Animations.AnimsUUID.ContainsKey(anim))
|
||||
// m_log.DebugFormat(
|
||||
// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}",
|
||||
// anim, sequenceNum, objectID);
|
||||
|
||||
if (DefaultAvatarAnimations.AnimsUUID.ContainsKey(anim))
|
||||
{
|
||||
return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum, objectID);
|
||||
return SetDefaultAnimation(DefaultAvatarAnimations.AnimsUUID[anim], sequenceNum, objectID);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
{
|
||||
public class AvatarAnimations
|
||||
{
|
||||
public Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
|
||||
public Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
|
||||
public Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
|
||||
|
||||
public AvatarAnimations()
|
||||
{
|
||||
using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(reader);
|
||||
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
|
||||
{
|
||||
if (nod.Attributes["name"] != null)
|
||||
{
|
||||
string name = (string)nod.Attributes["name"].Value;
|
||||
UUID id = (UUID)nod.InnerText;
|
||||
string animState = (string)nod.Attributes["state"].Value;
|
||||
|
||||
AnimsUUID.Add(name, id);
|
||||
AnimsNames.Add(id, name);
|
||||
if (animState != "")
|
||||
AnimStateNames.Add(id, animState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
{
|
||||
public class DefaultAvatarAnimations
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public static readonly string DefaultAnimationsPath = "data/avataranimations.xml";
|
||||
|
||||
public static Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
|
||||
public static Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
|
||||
public static Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
|
||||
|
||||
static DefaultAvatarAnimations()
|
||||
{
|
||||
LoadAnimations(DefaultAnimationsPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the default SL avatar animations.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static void LoadAnimations(string path)
|
||||
{
|
||||
// Dictionary<string, UUID> animations = new Dictionary<string, UUID>();
|
||||
|
||||
using (XmlTextReader reader = new XmlTextReader(path))
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(reader);
|
||||
// if (doc.DocumentElement != null)
|
||||
// {
|
||||
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
|
||||
{
|
||||
if (nod.Attributes["name"] != null)
|
||||
{
|
||||
string name = nod.Attributes["name"].Value;
|
||||
UUID id = (UUID)nod.InnerText;
|
||||
string animState = (string)nod.Attributes["state"].Value;
|
||||
|
||||
AnimsUUID.Add(name, id);
|
||||
AnimsNames.Add(id, name);
|
||||
if (animState != "")
|
||||
AnimStateNames.Add(id, animState);
|
||||
|
||||
// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
// return animations;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default avatar animation with the given name.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static UUID GetDefaultAnimation(string name)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name);
|
||||
|
||||
if (AnimsUUID.ContainsKey(name))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name);
|
||||
|
||||
return AnimsUUID[name];
|
||||
}
|
||||
|
||||
return UUID.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
if (m_scenePresence.IsChildAgent)
|
||||
return;
|
||||
|
||||
UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name);
|
||||
// XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
|
||||
// are referenced with lower case names!
|
||||
UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper());
|
||||
if (animID == UUID.Zero)
|
||||
return;
|
||||
|
||||
@@ -121,7 +123,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
if (m_scenePresence.IsChildAgent)
|
||||
return;
|
||||
|
||||
UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name);
|
||||
// XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
|
||||
// are referenced with lower case names!
|
||||
UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name);
|
||||
if (animID == UUID.Zero)
|
||||
return;
|
||||
|
||||
|
||||
@@ -65,7 +65,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
#region Fields
|
||||
|
||||
public bool EmergencyMonitoring = false;
|
||||
public bool DEBUG = false;
|
||||
|
||||
/// <summary>
|
||||
/// Show debug information about teleports.
|
||||
/// </summary>
|
||||
public bool DebugTeleporting { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show debug information about the scene loop.
|
||||
/// </summary>
|
||||
public bool DebugUpdates { get; private set; }
|
||||
|
||||
public SynchronizeSceneHandler SynchronizeScene;
|
||||
public SimStatsReporter StatsReporter;
|
||||
@@ -1053,44 +1062,66 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSceneCoreDebug(bool ScriptEngine, bool CollisionEvents, bool PhysicsEngine)
|
||||
public void SetSceneCoreDebug(Dictionary<string, string> options)
|
||||
{
|
||||
if (m_scripts_enabled != !ScriptEngine)
|
||||
if (options.ContainsKey("scripting"))
|
||||
{
|
||||
if (ScriptEngine)
|
||||
bool enableScripts = true;
|
||||
if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts)
|
||||
{
|
||||
m_log.Info("Stopping all Scripts in Scene");
|
||||
|
||||
EntityBase[] entities = Entities.GetEntities();
|
||||
foreach (EntityBase ent in entities)
|
||||
if (!enableScripts)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
((SceneObjectGroup)ent).RemoveScriptInstances(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("Starting all Scripts in Scene");
|
||||
|
||||
EntityBase[] entities = Entities.GetEntities();
|
||||
foreach (EntityBase ent in entities)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
m_log.Info("Stopping all Scripts in Scene");
|
||||
|
||||
EntityBase[] entities = Entities.GetEntities();
|
||||
foreach (EntityBase ent in entities)
|
||||
{
|
||||
SceneObjectGroup sog = (SceneObjectGroup)ent;
|
||||
sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
|
||||
sog.ResumeScripts();
|
||||
if (ent is SceneObjectGroup)
|
||||
((SceneObjectGroup)ent).RemoveScriptInstances(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("Starting all Scripts in Scene");
|
||||
|
||||
EntityBase[] entities = Entities.GetEntities();
|
||||
foreach (EntityBase ent in entities)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
SceneObjectGroup sog = (SceneObjectGroup)ent;
|
||||
sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
|
||||
sog.ResumeScripts();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_scripts_enabled = !ScriptEngine;
|
||||
m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
|
||||
m_scripts_enabled = enableScripts;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_physics_enabled != !PhysicsEngine)
|
||||
if (options.ContainsKey("physics"))
|
||||
{
|
||||
m_physics_enabled = !PhysicsEngine;
|
||||
bool enablePhysics;
|
||||
if (bool.TryParse(options["physics"], out enablePhysics))
|
||||
m_physics_enabled = enablePhysics;
|
||||
}
|
||||
|
||||
if (options.ContainsKey("teleport"))
|
||||
{
|
||||
bool enableTeleportDebugging;
|
||||
if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
|
||||
DebugTeleporting = enableTeleportDebugging;
|
||||
}
|
||||
|
||||
if (options.ContainsKey("updates"))
|
||||
{
|
||||
bool enableUpdateDebugging;
|
||||
if (bool.TryParse(options["updates"], out enableUpdateDebugging))
|
||||
{
|
||||
DebugUpdates = enableUpdateDebugging;
|
||||
GcNotify.Enabled = DebugUpdates;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1427,7 +1458,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// Tell the watchdog that this thread is still alive
|
||||
Watchdog.UpdateThread();
|
||||
|
||||
// previousFrameTick = m_lastFrameTick;
|
||||
previousFrameTick = m_lastFrameTick;
|
||||
m_lastFrameTick = Util.EnvironmentTickCount();
|
||||
maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc);
|
||||
maintc = (int)(MinFrameTime * 1000) - maintc;
|
||||
@@ -1442,12 +1473,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_firstHeartbeat = false;
|
||||
|
||||
// Optionally warn if a frame takes double the amount of time that it should.
|
||||
// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))
|
||||
// m_log.WarnFormat(
|
||||
// "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
|
||||
// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
|
||||
// MinFrameTime * 1000,
|
||||
// RegionInfo.RegionName);
|
||||
if (DebugUpdates
|
||||
&& Util.EnvironmentTickCountSubtract(
|
||||
m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))
|
||||
m_log.WarnFormat(
|
||||
"[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
|
||||
Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
|
||||
MinFrameTime * 1000,
|
||||
RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3920,7 +3920,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||
if (land != null)
|
||||
{
|
||||
if (Scene.DEBUG)
|
||||
if (Scene.DebugTeleporting)
|
||||
TeleportFlagsDebug();
|
||||
|
||||
// If we come in via login, landmark or map, we want to
|
||||
|
||||
Reference in New Issue
Block a user