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

avinationmerge
Melanie 2011-11-02 23:42:37 +01:00
commit 26a4f32013
16 changed files with 120 additions and 113 deletions

View File

@ -297,7 +297,6 @@ namespace OpenSim.Data.Tests
pbshap.ProfileEnd = ushort.MaxValue;
pbshap.ProfileHollow = ushort.MaxValue;
Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next());
byte updatef = (byte) random.Next(127);
RegionInfo regionInfo = new RegionInfo();
regionInfo.RegionID = region3;
@ -336,7 +335,6 @@ namespace OpenSim.Data.Tests
sop.LinkNum = linknum;
sop.ClickAction = clickaction;
sop.Scale = scale;
sop.UpdateFlag = updatef;
//Tests if local part accepted the parameters:
Assert.That(regionh,Is.EqualTo(sop.RegionHandle), "Assert.That(regionh,Is.EqualTo(sop.RegionHandle))");
@ -369,7 +367,6 @@ namespace OpenSim.Data.Tests
Assert.That(linknum,Is.EqualTo(sop.LinkNum), "Assert.That(linknum,Is.EqualTo(sop.LinkNum))");
Assert.That(clickaction,Is.EqualTo(sop.ClickAction), "Assert.That(clickaction,Is.EqualTo(sop.ClickAction))");
Assert.That(scale,Is.EqualTo(sop.Scale), "Assert.That(scale,Is.EqualTo(sop.Scale))");
Assert.That(updatef,Is.EqualTo(sop.UpdateFlag), "Assert.That(updatef,Is.EqualTo(sop.UpdateFlag))");
// This is necessary or object will not be inserted in DB
sop.Flags = PrimFlags.None;
@ -469,7 +466,6 @@ namespace OpenSim.Data.Tests
PrimitiveBaseShape pbshap = new PrimitiveBaseShape();
pbshap = PrimitiveBaseShape.Default;
Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next());
byte updatef = (byte) random.Next(127);
// Updates the region with new values
SceneObjectGroup sog2 = FindSOG("Adam West", region3);
@ -499,7 +495,6 @@ namespace OpenSim.Data.Tests
sog2.RootPart.LinkNum = linknum;
sog2.RootPart.ClickAction = clickaction;
sog2.RootPart.Scale = scale;
sog2.RootPart.UpdateFlag = updatef;
db.StoreObject(sog2, region3);
List<SceneObjectGroup> sogs = db.LoadObjects(region3);

View File

@ -332,7 +332,7 @@ namespace OpenSim.Region.ClientStack.Linden
grp.IsAttachment = false;
// Required for linking
grp.RootPart.UpdateFlag = 0;
grp.RootPart.ClearUpdateSchedule();
if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos))
{
@ -345,8 +345,9 @@ namespace OpenSim.Region.ClientStack.Linden
for (int j = 1; j < allparts.Length; j++)
{
rootGroup.RootPart.UpdateFlag = 0;
allparts[j].RootPart.UpdateFlag = 0;
// Required for linking
rootGroup.RootPart.ClearUpdateSchedule();
allparts[j].RootPart.ClearUpdateSchedule();
rootGroup.LinkToGroup(allparts[j]);
}

View File

@ -169,6 +169,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
public bool SendAppearance(UUID agentId)
{
// m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId);
ScenePresence sp = m_scene.GetScenePresence(agentId);
if (sp == null)
{
@ -257,7 +259,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
/// </summary>
public void QueueAppearanceSend(UUID agentid)
{
// m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
// m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
// 10000 ticks per millisecond, 1000 milliseconds per second
long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 1000 * 10000);
@ -391,10 +393,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
Dictionary<UUID, long> sends = new Dictionary<UUID, long>(m_sendqueue);
foreach (KeyValuePair<UUID, long> kvp in sends)
{
if (kvp.Value < now)
// We have to load the key and value into local parameters to avoid a race condition if we loop
// around and load kvp with a different value before FireAndForget has launched its thread.
UUID avatarID = kvp.Key;
long sendTime = kvp.Value;
// m_log.DebugFormat("[AVFACTORY]: Handling queued appearance updates for {0}, update delta to now is {1}", avatarID, sendTime - now);
if (sendTime < now)
{
Util.FireAndForget(delegate(object o) { SendAppearance(kvp.Key); });
m_sendqueue.Remove(kvp.Key);
Util.FireAndForget(o => SendAppearance(avatarID));
m_sendqueue.Remove(avatarID);
}
}
}
@ -404,10 +413,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
Dictionary<UUID, long> saves = new Dictionary<UUID, long>(m_savequeue);
foreach (KeyValuePair<UUID, long> kvp in saves)
{
if (kvp.Value < now)
// We have to load the key and value into local parameters to avoid a race condition if we loop
// around and load kvp with a different value before FireAndForget has launched its thread.
UUID avatarID = kvp.Key;
long sendTime = kvp.Value;
if (sendTime < now)
{
Util.FireAndForget(delegate(object o) { SaveAppearance(kvp.Key); });
m_savequeue.Remove(kvp.Key);
Util.FireAndForget(o => SaveAppearance(avatarID));
m_savequeue.Remove(avatarID);
}
}
}

View File

@ -1740,7 +1740,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
//m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
bool successYN = false;
grp.RootPart.UpdateFlag = 0;
grp.RootPart.ClearUpdateSchedule();
//int primcrossingXMLmethod = 0;
if (destination != null)

View File

@ -395,9 +395,11 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
{
result = OpenJPEG.EncodeFromImage(joint, true);
}
catch (Exception)
catch (Exception e)
{
m_log.Error("[DYNAMICTEXTUREMODULE]: OpenJpeg Encode Failed. Empty byte data returned!");
m_log.ErrorFormat(
"[DYNAMICTEXTUREMODULE]: OpenJpeg Encode Failed. Exception {0}{1}",
e.Message, e.StackTrace);
}
return result;

View File

@ -338,10 +338,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
{
imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true);
}
catch (Exception)
catch (Exception e)
{
m_log.Error(
"[VECTORRENDERMODULE]: OpenJpeg Encode Failed. Empty byte data returned!");
m_log.ErrorFormat(
"[VECTORRENDERMODULE]: OpenJpeg Encode Failed. Exception {0}{1}",
e.Message, e.StackTrace);
}
m_textureManager.ReturnData(id, imageJ2000);

View File

@ -1908,7 +1908,7 @@ namespace OpenSim.Region.Framework.Scenes
newSet.RemoveAt(0);
foreach (SceneObjectPart newChild in newSet)
newChild.UpdateFlag = 0;
newChild.ClearUpdateSchedule();
newRoot.ParentGroup.areUpdatesSuspended = true;
LinkObjects(newRoot, newSet);

View File

@ -1480,7 +1480,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!silent)
{
part.UpdateFlag = 0;
part.ClearUpdateSchedule();
if (part == m_rootPart)
{
if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) ||
@ -2123,13 +2123,13 @@ namespace OpenSim.Region.Framework.Scenes
if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f))
{
m_rootPart.UpdateFlag = 1;
m_rootPart.UpdateFlag = UpdateRequired.TERSE;
lastPhysGroupPos = AbsolutePosition;
}
if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f))
{
m_rootPart.UpdateFlag = 1;
m_rootPart.UpdateFlag = UpdateRequired.TERSE;
lastPhysGroupRot = GroupRotation;
}

View File

@ -107,6 +107,13 @@ namespace OpenSim.Region.Framework.Scenes
SCULPT = 7
}
public enum UpdateRequired : byte
{
NONE = 0,
TERSE = 1,
FULL = 2
}
#endregion Enumerations
public class SceneObjectPart : IScriptHost, ISceneEntity
@ -265,15 +272,7 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_passTouches;
/// <summary>
/// Only used internally to schedule client updates.
/// 0 - no update is scheduled
/// 1 - terse update scheduled
/// 2 - full update scheduled
///
/// TODO - This should be an enumeration
/// </summary>
private byte m_updateFlag;
private UpdateRequired m_updateFlag;
private PhysicsActor m_physActor;
protected Vector3 m_acceleration;
@ -908,7 +907,15 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary></summary>
/// <summary>Update angular velocity and schedule terse update.</summary>
public void UpdateAngularVelocity(Vector3 avel)
{
AngularVelocity = avel;
ScheduleTerseUpdate();
ParentGroup.HasGroupChanged = true;
}
/// <summary>Get or set angular velocity. Does not schedule update.</summary>
public Vector3 AngularVelocity
{
get
@ -1057,7 +1064,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public byte UpdateFlag
public UpdateRequired UpdateFlag
{
get { return m_updateFlag; }
set { m_updateFlag = value; }
@ -1362,9 +1369,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Clear all pending updates of parts to clients
/// </summary>
private void ClearUpdateSchedule()
public void ClearUpdateSchedule()
{
m_updateFlag = 0;
UpdateFlag = UpdateRequired.NONE;
}
/// <summary>
@ -2884,7 +2891,7 @@ namespace OpenSim.Region.Framework.Scenes
TimeStampFull = (uint)timeNow;
}
m_updateFlag = 2;
UpdateFlag = UpdateRequired.FULL;
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}",
@ -2900,13 +2907,13 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentGroup == null)
return;
if (m_updateFlag < 1)
if (UpdateFlag == UpdateRequired.NONE)
{
m_parentGroup.HasGroupChanged = true;
m_parentGroup.QueueForUpdateCheck();
TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
m_updateFlag = 1;
UpdateFlag = UpdateRequired.TERSE;
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1} at {2}",
@ -3073,7 +3080,9 @@ namespace OpenSim.Region.Framework.Scenes
const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
if (m_updateFlag == 1)
switch (UpdateFlag)
{
case UpdateRequired.TERSE:
{
// Throw away duplicate or insignificant updates
if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
@ -3085,15 +3094,7 @@ namespace OpenSim.Region.Framework.Scenes
Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
{
AddTerseUpdateToAllAvatars();
// This causes the Scene to 'poll' physical objects every couple of frames
// bad, so it's been replaced by an event driven method.
//if ((ObjectFlags & (uint)PrimFlags.Physics) != 0)
//{
// Only send the constant terse updates on physical objects!
//ScheduleTerseUpdate();
//}
ClearUpdateSchedule();
// Update the "last" values
m_lastPosition = OffsetPosition;
@ -3103,18 +3104,16 @@ namespace OpenSim.Region.Framework.Scenes
m_lastAngularVelocity = AngularVelocity;
m_lastTerseSent = Environment.TickCount;
}
//Moved this outside of the if clause so updates don't get blocked.. *sigh*
m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
break;
}
else
{
if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
case UpdateRequired.FULL:
{
AddFullUpdateToAllAvatars();
m_updateFlag = 0; //Same here
break;
}
}
m_updateFlag = 0;
ClearUpdateSchedule();
}
/// <summary>
@ -3492,7 +3491,7 @@ namespace OpenSim.Region.Framework.Scenes
_groupID = groupID;
if (client != null)
SendPropertiesToClient(client);
m_updateFlag = 2;
UpdateFlag = UpdateRequired.FULL;
}
/// <summary>
@ -4699,7 +4698,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_shape.TextureEntry = textureEntry;
TriggerScriptChangedEvent(Changed.TEXTURE);
m_updateFlag = 1;
UpdateFlag = UpdateRequired.FULL;
ParentGroup.HasGroupChanged = true;
//This is madness..

View File

@ -2980,7 +2980,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SendAppearanceToAllOtherAgents()
{
//m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} ({1})", Name, UUID);
// m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID);
// only send update from root agents to other clients; children are only "listening posts"
if (IsChildAgent)
{
@ -3008,7 +3009,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SendOtherAgentsAppearanceToMe()
{
//m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID);
// m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} {1}", Name, UUID);
int count = 0;
m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
@ -3564,7 +3565,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (ISceneObject so in cAgent.AttachmentObjects)
{
((SceneObjectGroup)so).LocalId = 0;
((SceneObjectGroup)so).RootPart.UpdateFlag = 0;
((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
m_scene.IncomingCreateObject(so);
}

View File

@ -316,7 +316,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors.Add("ClickAction", ProcessClickAction);
m_SOPXmlProcessors.Add("Shape", ProcessShape);
m_SOPXmlProcessors.Add("Scale", ProcessScale);
m_SOPXmlProcessors.Add("UpdateFlag", ProcessUpdateFlag);
m_SOPXmlProcessors.Add("SitTargetOrientation", ProcessSitTargetOrientation);
m_SOPXmlProcessors.Add("SitTargetPosition", ProcessSitTargetPosition);
m_SOPXmlProcessors.Add("SitTargetPositionLL", ProcessSitTargetPositionLL);
@ -586,11 +585,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
obj.Scale = Util.ReadVector(reader, "Scale");
}
private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader)
{
obj.UpdateFlag = (byte)reader.ReadElementContentAsInt("UpdateFlag", String.Empty);
}
private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader)
{
obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation");
@ -1194,7 +1188,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
WriteShape(writer, sop.Shape, options);
WriteVector(writer, "Scale", sop.Scale);
writer.WriteElementString("UpdateFlag", sop.UpdateFlag.ToString());
WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation);
WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition);
WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL);

View File

@ -70,8 +70,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0));
// Required for linking
grp1.RootPart.UpdateFlag = 0;
grp2.RootPart.UpdateFlag = 0;
grp1.RootPart.ClearUpdateSchedule();
grp2.RootPart.ClearUpdateSchedule();
// Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated.
grp1.LinkToGroup(grp2);
@ -164,10 +164,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
grp4.UpdateGroupRotationR(Quaternion.CreateFromEulers(0, 90 * Utils.DEG_TO_RAD, 0));
// Required for linking
grp1.RootPart.UpdateFlag = 0;
grp2.RootPart.UpdateFlag = 0;
grp3.RootPart.UpdateFlag = 0;
grp4.RootPart.UpdateFlag = 0;
grp1.RootPart.ClearUpdateSchedule();
grp2.RootPart.ClearUpdateSchedule();
grp3.RootPart.ClearUpdateSchedule();
grp4.RootPart.ClearUpdateSchedule();
// Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated.
grp1.LinkToGroup(grp2);
@ -198,8 +198,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
}
// Required for linking
grp1.RootPart.UpdateFlag = 0;
grp3.RootPart.UpdateFlag = 0;
grp1.RootPart.ClearUpdateSchedule();
grp3.RootPart.ClearUpdateSchedule();
// root part should have no offset position or rotation
Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity,

View File

@ -173,6 +173,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
// Note: Updating these properties on sop automatically schedules an update if needed
if (Position != Vector3.Zero)
{
// m_log.DebugFormat(
@ -196,8 +197,6 @@ namespace OpenSim.Region.Framework.Scenes
part.Resize(Scale);
}
part.ScheduleTerseUpdate();
}
part.Undoing = false;
@ -227,6 +226,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
// Note: Updating these properties on sop automatically schedules an update if needed
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
@ -235,8 +235,6 @@ namespace OpenSim.Region.Framework.Scenes
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ScheduleTerseUpdate();
}
part.Undoing = false;

View File

@ -3653,10 +3653,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain)
{
part.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate));
part.ScheduleTerseUpdate();
part.SendTerseUpdateToAllClients();
part.ParentGroup.HasGroupChanged = true;
part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)));
}
public LSL_Integer llGetStartParameter()
@ -3958,11 +3955,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
parentPrim = targetPart.ParentGroup;
childPrim = m_host.ParentGroup;
}
// byte uf = childPrim.RootPart.UpdateFlag;
childPrim.RootPart.UpdateFlag = 0;
// Required for linking
childPrim.RootPart.ClearUpdateSchedule();
parentPrim.LinkToGroup(childPrim);
// if (uf != (Byte)0)
// parent.RootPart.UpdateFlag = uf;
}
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
@ -4059,7 +4055,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
parts[0].ParentGroup.areUpdatesSuspended = true;
foreach (SceneObjectPart part in parts)
{
part.UpdateFlag = 0;
part.ClearUpdateSchedule();
newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
}
}

View File

@ -265,9 +265,16 @@ namespace OpenSim.Server.Base
public virtual int Run()
{
while (m_Running)
{
try
{
MainConsole.Instance.Prompt();
}
catch (Exception e)
{
m_log.ErrorFormat("Command error: {0}", e);
}
}
if (m_pidFile != String.Empty)
File.Delete(m_pidFile);

View File

@ -473,7 +473,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
// Grab the asset data from the response stream
using (MemoryStream stream = new MemoryStream())
{
responseStream.CopyTo(stream, Int32.MaxValue);
responseStream.CopyTo(stream);
asset.Data = stream.ToArray();
}
}