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

avinationmerge
UbitUmarov 2012-02-27 01:31:29 +00:00
commit f451f67213
10 changed files with 93 additions and 41 deletions

View File

@ -170,7 +170,7 @@ namespace OpenSim.Data.MySQL
"ParticleSystem, ClickAction, Material, " + "ParticleSystem, ClickAction, Material, " +
"CollisionSound, CollisionSoundVolume, " + "CollisionSound, CollisionSoundVolume, " +
"PassTouches, " + "PassTouches, " +
"LinkNumber, MediaURL) values (" + "?UUID, " + "LinkNumber, MediaURL, KeyframeMotion) values (" + "?UUID, " +
"?CreationDate, ?Name, ?Text, " + "?CreationDate, ?Name, ?Text, " +
"?Description, ?SitName, ?TouchName, " + "?Description, ?SitName, ?TouchName, " +
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
@ -201,7 +201,7 @@ namespace OpenSim.Data.MySQL
"?SaleType, ?ColorR, ?ColorG, " + "?SaleType, ?ColorR, ?ColorG, " +
"?ColorB, ?ColorA, ?ParticleSystem, " + "?ColorB, ?ColorA, ?ParticleSystem, " +
"?ClickAction, ?Material, ?CollisionSound, " + "?ClickAction, ?Material, ?CollisionSound, " +
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL, ?KeyframeMotion)";
FillPrimCommand(cmd, prim, obj.UUID, regionUUID); FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
@ -446,7 +446,11 @@ namespace OpenSim.Data.MySQL
foreach (SceneObjectPart prim in prims.Values) foreach (SceneObjectPart prim in prims.Values)
{ {
if (prim.ParentUUID == UUID.Zero) if (prim.ParentUUID == UUID.Zero)
{
objects[prim.UUID] = new SceneObjectGroup(prim); objects[prim.UUID] = new SceneObjectGroup(prim);
if (prim.KeyframeMotion != null)
prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]);
}
} }
// Add all of the children objects to the SOGs // Add all of the children objects to the SOGs
@ -1227,6 +1231,18 @@ namespace OpenSim.Data.MySQL
if (!(row["MediaURL"] is System.DBNull)) if (!(row["MediaURL"] is System.DBNull))
prim.MediaUrl = (string)row["MediaURL"]; prim.MediaUrl = (string)row["MediaURL"];
if (!(row["KeyframeMotion"] is DBNull))
{
Byte[] data = (byte[])row["KeyframeMotion"];
if (data.Length > 0)
prim.KeyframeMotion = KeyframeMotion.FromData(null, data);
else
prim.KeyframeMotion = null;
}
else
{
prim.KeyframeMotion = null;
}
return prim; return prim;
} }
@ -1579,6 +1595,11 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
if (prim.KeyframeMotion != null)
cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize());
else
cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
} }
/// <summary> /// <summary>

View File

@ -1746,6 +1746,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (grp.RootPart.PhysActor != null) if (grp.RootPart.PhysActor != null)
{ {
grp.RootPart.PhysActor.CrossingFailure(); grp.RootPart.PhysActor.CrossingFailure();
if (grp.RootPart.KeyframeMotion != null)
{
grp.RootPart.Velocity = Vector3.Zero;
grp.RootPart.KeyframeMotion.CrossingFailure();
grp.SendGroupRootTerseUpdate();
}
} }
} }

View File

@ -355,11 +355,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
foreach (SceneObjectGroup objectGroup in objlist) foreach (SceneObjectGroup objectGroup in objlist)
{ {
if (objectGroup.KeyframeMotion != null) if (objectGroup.RootPart.KeyframeMotion != null)
objectGroup.KeyframeMotion.Stop(); objectGroup.RootPart.KeyframeMotion.Stop();
objectGroup.RootPart.SetForce(Vector3.Zero); objectGroup.RootPart.SetForce(Vector3.Zero);
objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false); objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false);
objectGroup.KeyframeMotion = null; objectGroup.RootPart.KeyframeMotion = null;
Vector3 inventoryStoredPosition = new Vector3 Vector3 inventoryStoredPosition = new Vector3
(((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)

View File

@ -406,5 +406,17 @@ namespace OpenSim.Region.Framework.Scenes
m_group = tmp; m_group = tmp;
return ms.ToArray(); return ms.ToArray();
} }
public void CrossingFailure()
{
// The serialization has stopped the timer, so let's wait a moment
// then retry the crossing. We'll get back here if it fails.
Util.FireAndForget(delegate (object x)
{
Thread.Sleep(60000);
if (m_running)
m_timer.Start();
});
}
} }
} }

View File

@ -2421,8 +2421,8 @@ namespace OpenSim.Region.Framework.Scenes
if (newPosition != Vector3.Zero) if (newPosition != Vector3.Zero)
newObject.RootPart.GroupPosition = newPosition; newObject.RootPart.GroupPosition = newPosition;
if (newObject.KeyframeMotion != null) if (newObject.RootPart.KeyframeMotion != null)
newObject.KeyframeMotion.UpdateSceneObject(newObject); newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
if (!AddSceneObject(newObject)) if (!AddSceneObject(newObject))
{ {

View File

@ -1731,6 +1731,12 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="childPrims"></param> /// <param name="childPrims"></param>
protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children) protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children)
{ {
if (root.KeyframeMotion != null)
{
root.KeyframeMotion.Stop();
root.KeyframeMotion = null;
}
SceneObjectGroup parentGroup = root.ParentGroup; SceneObjectGroup parentGroup = root.ParentGroup;
if (parentGroup == null) return; if (parentGroup == null) return;
@ -1823,6 +1829,11 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (part != null) if (part != null)
{ {
if (part.KeyframeMotion != null)
{
part.KeyframeMotion.Stop();
part.KeyframeMotion = null;
}
if (part.ParentGroup.PrimCount != 1) // Skip single if (part.ParentGroup.PrimCount != 1) // Skip single
{ {
if (part.LinkNum < 2) // Root if (part.LinkNum < 2) // Root

View File

@ -114,12 +114,6 @@ namespace OpenSim.Region.Framework.Scenes
private Random m_rand; private Random m_rand;
private bool m_suspendUpdates; private bool m_suspendUpdates;
private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>();
private KeyframeMotion m_keyframeMotion = null;
public KeyframeMotion KeyframeMotion
{
get; set;
}
public bool areUpdatesSuspended public bool areUpdatesSuspended
{ {
@ -726,8 +720,8 @@ namespace OpenSim.Region.Framework.Scenes
child.PhysActor.Selected = value; child.PhysActor.Selected = value;
} }
} }
if (KeyframeMotion != null) if (RootPart.KeyframeMotion != null)
KeyframeMotion.Selected = value; RootPart.KeyframeMotion.Selected = value;
} }
} }
@ -1829,11 +1823,6 @@ namespace OpenSim.Region.Framework.Scenes
// Name, UUID, m_scene.RegionInfo.RegionName); // Name, UUID, m_scene.RegionInfo.RegionName);
SceneObjectGroup backup_group = Copy(false); SceneObjectGroup backup_group = Copy(false);
if (KeyframeMotion != null)
{
backup_group.KeyframeMotion = KeyframeMotion.FromData(backup_group, KeyframeMotion.Serialize());
KeyframeMotion.UpdateSceneObject(this);
}
backup_group.RootPart.Velocity = RootPart.Velocity; backup_group.RootPart.Velocity = RootPart.Velocity;
backup_group.RootPart.Acceleration = RootPart.Acceleration; backup_group.RootPart.Acceleration = RootPart.Acceleration;
backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
@ -1846,6 +1835,11 @@ namespace OpenSim.Region.Framework.Scenes
backup_group.ForEachPart(delegate(SceneObjectPart part) backup_group.ForEachPart(delegate(SceneObjectPart part)
{ {
if (part.KeyframeMotion != null)
{
part.KeyframeMotion = KeyframeMotion.FromData(backup_group, part.KeyframeMotion.Serialize());
part.KeyframeMotion.UpdateSceneObject(this);
}
part.Inventory.ProcessInventoryBackup(datastore); part.Inventory.ProcessInventoryBackup(datastore);
}); });
@ -2001,9 +1995,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (usePhysics) if (usePhysics)
{ {
if (KeyframeMotion != null) if (RootPart.KeyframeMotion != null)
KeyframeMotion.Stop(); RootPart.KeyframeMotion.Stop();
KeyframeMotion = null; RootPart.KeyframeMotion = null;
} }
UpdatePrimFlags(RootPart.LocalId, usePhysics, IsTemporary, IsPhantom, IsVolumeDetect); UpdatePrimFlags(RootPart.LocalId, usePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
} }

View File

@ -315,6 +315,14 @@ namespace OpenSim.Region.Framework.Scenes
private SOPVehicle m_vehicle = null; private SOPVehicle m_vehicle = null;
private KeyframeMotion m_keyframeMotion = null;
public KeyframeMotion KeyframeMotion
{
get; set;
}
#endregion Fields #endregion Fields
// ~SceneObjectPart() // ~SceneObjectPart()
@ -1924,9 +1932,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (UsePhysics) if (UsePhysics)
{ {
if (ParentGroup.KeyframeMotion != null) if (ParentGroup.RootPart.KeyframeMotion != null)
ParentGroup.KeyframeMotion.Stop(); ParentGroup.RootPart.KeyframeMotion.Stop();
ParentGroup.KeyframeMotion = null; ParentGroup.RootPart.KeyframeMotion = null;
ParentGroup.Scene.AddPhysicalPrim(1); ParentGroup.Scene.AddPhysicalPrim(1);
PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;

View File

@ -246,9 +246,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion");
if (keymotion.Count > 0) if (keymotion.Count > 0)
sceneObject.KeyframeMotion = KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(keymotion[0].InnerText)); sceneObject.RootPart.KeyframeMotion = KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(keymotion[0].InnerText));
else else
sceneObject.KeyframeMotion = null; sceneObject.RootPart.KeyframeMotion = null;
// Script state may, or may not, exist. Not having any, is NOT // Script state may, or may not, exist. Not having any, is NOT
// ever a problem. // ever a problem.
@ -1174,9 +1174,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteEndElement(); writer.WriteEndElement();
if (sog.KeyframeMotion != null) if (sog.RootPart.KeyframeMotion != null)
{ {
Byte[] data = sog.KeyframeMotion.Serialize(); Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
writer.WriteBase64(data, 0, data.Length); writer.WriteBase64(data, 0, data.Length);

View File

@ -11908,9 +11908,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (frames.Data.Length > 0) // We are getting a new motion if (frames.Data.Length > 0) // We are getting a new motion
{ {
if (group.KeyframeMotion != null) if (group.RootPart.KeyframeMotion != null)
group.KeyframeMotion.Stop(); group.RootPart.KeyframeMotion.Stop();
group.KeyframeMotion = null; group.RootPart.KeyframeMotion = null;
int idx = 0; int idx = 0;
@ -11953,7 +11953,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
group.KeyframeMotion = new KeyframeMotion(group, mode, data); group.RootPart.KeyframeMotion = new KeyframeMotion(group, mode, data);
idx = 0; idx = 0;
@ -11990,17 +11990,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
keyframes.Add(frame); keyframes.Add(frame);
} }
group.KeyframeMotion.SetKeyframes(keyframes.ToArray()); group.RootPart.KeyframeMotion.SetKeyframes(keyframes.ToArray());
group.KeyframeMotion.Start(); group.RootPart.KeyframeMotion.Start();
} }
else else
{ {
if (group.KeyframeMotion == null) if (group.RootPart.KeyframeMotion == null)
return; return;
if (options.Data.Length == 0) if (options.Data.Length == 0)
{ {
group.KeyframeMotion.Stop(); group.RootPart.KeyframeMotion.Stop();
return; return;
} }
@ -12020,13 +12020,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
switch (cmd) switch (cmd)
{ {
case ScriptBaseClass.KFM_CMD_PLAY: case ScriptBaseClass.KFM_CMD_PLAY:
group.KeyframeMotion.Start(); group.RootPart.KeyframeMotion.Start();
break; break;
case ScriptBaseClass.KFM_CMD_STOP: case ScriptBaseClass.KFM_CMD_STOP:
group.KeyframeMotion.Stop(); group.RootPart.KeyframeMotion.Stop();
break; break;
case ScriptBaseClass.KFM_CMD_PAUSE: case ScriptBaseClass.KFM_CMD_PAUSE:
group.KeyframeMotion.Pause(); group.RootPart.KeyframeMotion.Pause();
break; break;
} }
break; break;