* Removed permissions flag appliance from Xml deserialization

* Various code convention compliance
afrisby
lbsa71 2007-11-30 08:08:14 +00:00
parent 31cec30aa0
commit d2b1b54f49
5 changed files with 66 additions and 48 deletions

View File

@ -491,7 +491,7 @@ namespace OpenSim.Region.Environment.Scenes
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
rootPart.doPhysicsPropertyUpdate(UsePhysics, true); rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
} }
rootPart.ScheduleFullUpdate(); rootPart.ScheduleFullUpdate();

View File

@ -765,7 +765,7 @@ namespace OpenSim.Region.Environment.Scenes
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
rootPart.doPhysicsPropertyUpdate(UsePhysics, true); rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
} }
MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
} }
@ -869,7 +869,7 @@ namespace OpenSim.Region.Environment.Scenes
new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
new Quaternion(), UsePhysics); new Quaternion(), UsePhysics);
// subscribe to physics events. // subscribe to physics events.
rootPart.doPhysicsPropertyUpdate(UsePhysics, true); rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
} }
} }

View File

@ -264,6 +264,7 @@ namespace OpenSim.Region.Environment.Scenes
reader.ReadStartElement("SceneObjectGroup"); reader.ReadStartElement("SceneObjectGroup");
reader.ReadStartElement("RootPart"); reader.ReadStartElement("RootPart");
m_rootPart = SceneObjectPart.FromXml(reader); m_rootPart = SceneObjectPart.FromXml(reader);
reader.ReadEndElement(); reader.ReadEndElement();
while (reader.Read()) while (reader.Read())
@ -274,10 +275,13 @@ namespace OpenSim.Region.Environment.Scenes
if (reader.Name == "Part") if (reader.Name == "Part")
{ {
reader.Read(); reader.Read();
SceneObjectPart Part = SceneObjectPart.FromXml(reader); SceneObjectPart part = SceneObjectPart.FromXml(reader);
Part.LocalID = m_scene.PrimIDAllocate(); part.LocalID = m_scene.PrimIDAllocate();
AddPart(Part); AddPart(part);
Part.RegionHandle = m_regionHandle; part.RegionHandle = m_regionHandle;
part.ApplyPermissions();
part.ApplyPhysics();
} }
break; break;
case XmlNodeType.EndElement: case XmlNodeType.EndElement:
@ -286,8 +290,9 @@ namespace OpenSim.Region.Environment.Scenes
} }
reader.Close(); reader.Close();
sr.Close(); sr.Close();
m_rootPart.SetParent(this);
m_parts.Add(m_rootPart.UUID, m_rootPart); AddPart( m_rootPart );
m_rootPart.LocalID = m_scene.PrimIDAllocate(); m_rootPart.LocalID = m_scene.PrimIDAllocate();
m_rootPart.ParentID = 0; m_rootPart.ParentID = 0;
m_rootPart.RegionHandle = m_regionHandle; m_rootPart.RegionHandle = m_regionHandle;
@ -524,7 +529,7 @@ namespace OpenSim.Region.Environment.Scenes
new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z), dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z),
dupe.RootPart.PhysActor.IsPhysical); dupe.RootPart.PhysActor.IsPhysical);
dupe.RootPart.doPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
} }
// Now we've made a copy that replaces this one, we need to // Now we've made a copy that replaces this one, we need to
@ -906,7 +911,7 @@ namespace OpenSim.Region.Environment.Scenes
new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X,
linkPart.RotationOffset.Y, linkPart.RotationOffset.Z), linkPart.RotationOffset.Y, linkPart.RotationOffset.Z),
m_rootPart.PhysActor.IsPhysical); m_rootPart.PhysActor.IsPhysical);
m_rootPart.doPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true); m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true);
} }
@ -1216,7 +1221,7 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z), m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z),
m_rootPart.PhysActor.IsPhysical); m_rootPart.PhysActor.IsPhysical);
bool UsePhysics = ((m_rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); bool UsePhysics = ((m_rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
m_rootPart.doPhysicsPropertyUpdate(UsePhysics, true); m_rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
} }
} }

View File

@ -74,7 +74,6 @@ namespace OpenSim.Region.Environment.Scenes
[XmlIgnore] public uint TimeStampTerse = 0; [XmlIgnore] public uint TimeStampTerse = 0;
[XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn
protected SceneObjectGroup m_parentGroup;
/// <summary> /// <summary>
/// Only used internally to schedule client updates /// Only used internally to schedule client updates
@ -386,6 +385,8 @@ namespace OpenSim.Region.Environment.Scenes
get { return OwnerID; } get { return OwnerID; }
} }
// FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
protected SceneObjectGroup m_parentGroup;
public SceneObjectGroup ParentGroup public SceneObjectGroup ParentGroup
{ {
get { return m_parentGroup; } get { return m_parentGroup; }
@ -533,7 +534,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
doPhysicsPropertyUpdate(UsePhysics, true); DoPhysicsPropertyUpdate(UsePhysics, true);
ScheduleFullUpdate(); ScheduleFullUpdate();
} }
@ -547,28 +548,33 @@ namespace OpenSim.Region.Environment.Scenes
public static SceneObjectPart FromXml(XmlReader xmlReader) public static SceneObjectPart FromXml(XmlReader xmlReader)
{ {
XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
return newobject;
}
if (!newobject.ParentGroup.m_scene.PermissionsMngr.BypassPermissions) public void ApplyPhysics()
{
bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
DoPhysicsPropertyUpdate(UsePhysics, true);
}
public void ApplyPermissions()
{
if (!ParentGroup.m_scene.PermissionsMngr.BypassPermissions)
{ {
newobject.EveryoneMask = newobject.ObjectFlags; EveryoneMask = ObjectFlags;
newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner;
newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer;
newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectCopy; EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectCopy;
newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify; EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify;
newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectMove; EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectMove;
newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectAnyOwner; EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectAnyOwner;
newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer;
} }
else else
{ {
newobject.EveryoneMask = newobject.ObjectFlags; EveryoneMask = ObjectFlags;
} }
bool UsePhysics = ((newobject.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
newobject.doPhysicsPropertyUpdate(UsePhysics, true);
return newobject;
} }
/// <summary> /// <summary>
@ -719,7 +725,7 @@ namespace OpenSim.Region.Environment.Scenes
Array.Copy(Shape.ExtraParams, extraP, extraP.Length); Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
dupe.Shape.ExtraParams = extraP; dupe.Shape.ExtraParams = extraP;
bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
dupe.doPhysicsPropertyUpdate(UsePhysics, true); dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
return dupe; return dupe;
} }
@ -961,10 +967,10 @@ namespace OpenSim.Region.Environment.Scenes
public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) public void UpdatePrimFlags(ushort type, bool inUse, byte[] data)
{ {
bool hasPrim = false; bool hasPrim = false;
bool UsePhysics = false; bool usePhysics = false;
bool IsTemporary = false; bool IsTemporary = false;
bool IsPhantom = false; bool IsPhantom = false;
bool CastsShadows = false; bool castsShadows = false;
bool wasUsingPhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); bool wasUsingPhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
//bool IsLocked = false; //bool IsLocked = false;
int i = 0; int i = 0;
@ -974,11 +980,11 @@ namespace OpenSim.Region.Environment.Scenes
{ {
i += 46; i += 46;
//IsLocked = (data[i++] != 0) ? true : false; //IsLocked = (data[i++] != 0) ? true : false;
UsePhysics = ((data[i++] != 0) && m_parentGroup.m_scene.m_physicalPrim) ? true : false; usePhysics = ((data[i++] != 0) && m_parentGroup.m_scene.m_physicalPrim) ? true : false;
//System.Console.WriteLine("U" + packet.ToBytes().Length.ToString()); //System.Console.WriteLine("U" + packet.ToBytes().Length.ToString());
IsTemporary = (data[i++] != 0) ? true : false; IsTemporary = (data[i++] != 0) ? true : false;
IsPhantom = (data[i++] != 0) ? true : false; IsPhantom = (data[i++] != 0) ? true : false;
CastsShadows = (data[i++] != 0) ? true : false; castsShadows = (data[i++] != 0) ? true : false;
} }
catch (Exception) catch (Exception)
{ {
@ -986,12 +992,12 @@ namespace OpenSim.Region.Environment.Scenes
//Silently ignore it - TODO: FIXME Quick //Silently ignore it - TODO: FIXME Quick
} }
if (UsePhysics ) if (usePhysics )
{ {
AddFlag(LLObject.ObjectFlags.Physics); AddFlag(LLObject.ObjectFlags.Physics);
if (!wasUsingPhysics) if (!wasUsingPhysics)
{ {
doPhysicsPropertyUpdate(UsePhysics,false); DoPhysicsPropertyUpdate(usePhysics,false);
} }
} }
@ -1000,7 +1006,7 @@ namespace OpenSim.Region.Environment.Scenes
RemFlag(LLObject.ObjectFlags.Physics); RemFlag(LLObject.ObjectFlags.Physics);
if (wasUsingPhysics) if (wasUsingPhysics)
{ {
doPhysicsPropertyUpdate(UsePhysics, false); DoPhysicsPropertyUpdate(usePhysics, false);
} }
} }
@ -1030,13 +1036,13 @@ namespace OpenSim.Region.Environment.Scenes
AbsolutePosition.Z), AbsolutePosition.Z),
new PhysicsVector(Scale.X, Scale.Y, Scale.Z), new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
new Quaternion(RotationOffset.W, RotationOffset.X, new Quaternion(RotationOffset.W, RotationOffset.X,
RotationOffset.Y, RotationOffset.Z), UsePhysics); RotationOffset.Y, RotationOffset.Z), usePhysics);
doPhysicsPropertyUpdate(UsePhysics, true); DoPhysicsPropertyUpdate(usePhysics, true);
} }
else else
{ {
PhysActor.IsPhysical = UsePhysics; PhysActor.IsPhysical = usePhysics;
doPhysicsPropertyUpdate(UsePhysics,false); DoPhysicsPropertyUpdate(usePhysics,false);
} }
} }
@ -1051,7 +1057,7 @@ namespace OpenSim.Region.Environment.Scenes
// System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
ScheduleFullUpdate(); ScheduleFullUpdate();
} }
public void doPhysicsPropertyUpdate(bool UsePhysics, bool isNew) public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
{ {
if (PhysActor != null) if (PhysActor != null)
@ -1271,13 +1277,20 @@ namespace OpenSim.Region.Environment.Scenes
{ {
clientFlags = ObjectFlags; clientFlags = ObjectFlags;
if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanCopyPermission(remoteClient.AgentId, this.ParentGroup.UUID)) if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanCopyPermission(remoteClient.AgentId, this.ParentGroup.UUID))
clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectCopy; {
clientFlags = (clientFlags &= ~(uint) LLObject.ObjectFlags.ObjectCopy);
}
if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanMovePermission(remoteClient.AgentId, this.ParentGroup.UUID)) if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanMovePermission(remoteClient.AgentId, this.ParentGroup.UUID))
clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectMove; {
clientFlags = clientFlags &= ~(uint) LLObject.ObjectFlags.ObjectMove;
}
clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify; clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify;
clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop;
clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer;
// TODO, FIXME, ERROR : This whole block amounts to moot because of this.
clientFlags = EveryoneMask; clientFlags = EveryoneMask;
} }
} }
@ -1372,7 +1385,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds."); OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds.");
RemFlag(LLObject.ObjectFlags.Physics); RemFlag(LLObject.ObjectFlags.Physics);
doPhysicsPropertyUpdate(false,true); DoPhysicsPropertyUpdate(false,true);
m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); m_parentGroup.m_scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Scenes
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
rootPart.doPhysicsPropertyUpdate(UsePhysics, true); rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
} }
primCount++; primCount++;
@ -125,7 +125,7 @@ namespace OpenSim.Region.Environment.Scenes
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
rootPart.doPhysicsPropertyUpdate(UsePhysics, true); rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
} }
} }