* Send prim flags as booleans from LLClientView rather than in the native LL array * Thanks idb0.6.0-stable
parent
4ace67a81d
commit
bf9384d594
|
@ -113,7 +113,7 @@ namespace OpenSim.Framework
|
||||||
public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient);
|
public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient);
|
||||||
public delegate void ObjectDrop(uint localID, IClientAPI remoteClient);
|
public delegate void ObjectDrop(uint localID, IClientAPI remoteClient);
|
||||||
|
|
||||||
public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient);
|
public delegate void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient);
|
||||||
|
|
||||||
public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
|
public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
|
||||||
|
|
||||||
|
|
|
@ -4690,7 +4690,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
if (handlerUpdatePrimFlags != null)
|
if (handlerUpdatePrimFlags != null)
|
||||||
{
|
{
|
||||||
handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this);
|
byte[] data = Pack.ToBytes();
|
||||||
|
int i = 46;
|
||||||
|
bool UsePhysics = (data[i++] != 0) ? true : false;
|
||||||
|
bool IsTemporary = (data[i++] != 0) ? true : false;
|
||||||
|
bool IsPhantom = (data[i++] != 0) ? true : false;
|
||||||
|
handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketType.ObjectImage:
|
case PacketType.ObjectImage:
|
||||||
|
|
|
@ -1194,14 +1194,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="localID"></param>
|
/// <param name="localID"></param>
|
||||||
/// <param name="packet"></param>
|
/// <param name="packet"></param>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
protected internal void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
|
protected internal void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
SceneObjectGroup group = GetGroupByPrim(localID);
|
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId))
|
if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId))
|
||||||
{
|
{
|
||||||
group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes());
|
group.UpdatePrimFlags(localID, UsePhysics, IsTemporary, IsPhantom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1407,34 +1407,23 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
||||||
{
|
{
|
||||||
if (m_scene.m_physicalPrim)
|
bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0);
|
||||||
{
|
bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0);
|
||||||
lock (m_parts)
|
UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, IsPhantom);
|
||||||
{
|
}
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
|
||||||
{
|
|
||||||
if (UsePhysics)
|
|
||||||
part.AddFlag(PrimFlags.Physics);
|
|
||||||
else
|
|
||||||
part.RemFlag(PrimFlags.Physics);
|
|
||||||
|
|
||||||
part.DoPhysicsPropertyUpdate(UsePhysics, false);
|
public void ScriptSetTemporaryStatus(bool TemporaryStatus)
|
||||||
IsSelected = false;
|
{
|
||||||
}
|
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
|
||||||
}
|
bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0);
|
||||||
}
|
UpdatePrimFlags(RootPart.LocalId, UsePhysics, TemporaryStatus, IsPhantom);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScriptSetPhantomStatus(bool PhantomStatus)
|
public void ScriptSetPhantomStatus(bool PhantomStatus)
|
||||||
{
|
{
|
||||||
byte[] flags = new byte[50];
|
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
|
||||||
// only the following 3 flags are updated by UpdatePrimFlags
|
bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0);
|
||||||
flags[46] = (byte)((RootPart.Flags & PrimFlags.Physics) != 0 ? 1 : 0);
|
UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, PhantomStatus);
|
||||||
flags[47] = (byte)((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0 ? 1 : 0);
|
|
||||||
flags[48] = (byte)(PhantomStatus ? 1 : 0);
|
|
||||||
// 94 is the packet type that comes from the ll viewer when selecting/unselecting
|
|
||||||
// so pretend we are from the viewer
|
|
||||||
UpdatePrimFlags(RootPart.LocalId, (ushort)94, true, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyImpulse(PhysicsVector impulse)
|
public void applyImpulse(PhysicsVector impulse)
|
||||||
|
@ -2160,11 +2149,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <param name="inUse"></param>
|
/// <param name="inUse"></param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
public void UpdatePrimFlags(uint localID, ushort type, bool inUse, byte[] data)
|
public void UpdatePrimFlags(uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom)
|
||||||
{
|
{
|
||||||
SceneObjectPart selectionPart = GetChildPart(localID);
|
SceneObjectPart selectionPart = GetChildPart(localID);
|
||||||
|
|
||||||
if (data[47] != 0) // Temporary
|
if (IsTemporary)
|
||||||
{
|
{
|
||||||
DetachFromBackup();
|
DetachFromBackup();
|
||||||
// Remove from database and parcel prim count
|
// Remove from database and parcel prim count
|
||||||
|
@ -2181,14 +2170,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
if (part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0)
|
if (part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0)
|
||||||
{
|
{
|
||||||
data[46] = 0; // Reset physics
|
UsePhysics = false; // Reset physics
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
part.UpdatePrimFlags(type, inUse, data);
|
part.UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2031,6 +2031,14 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ScriptSetTemporaryStatus(bool Temporary)
|
||||||
|
{
|
||||||
|
if (m_parentGroup != null)
|
||||||
|
{
|
||||||
|
m_parentGroup.ScriptSetTemporaryStatus(Temporary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
||||||
{
|
{
|
||||||
if (m_parentGroup == null)
|
if (m_parentGroup == null)
|
||||||
|
@ -3046,45 +3054,17 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePrimFlags(ushort type, bool inUse, byte[] data)
|
public void UpdatePrimFlags(bool UsePhysics, bool IsTemporary, bool IsPhantom)
|
||||||
{
|
{
|
||||||
//m_log.Info("TSomething1:" + ((type & (ushort)ExtraParamType.Something1) == (ushort)ExtraParamType.Something1));
|
|
||||||
//m_log.Info("TSomething2:" + ((type & (ushort)ExtraParamType.Something2) == (ushort)ExtraParamType.Something2));
|
|
||||||
//m_log.Info("TSomething3:" + ((type & (ushort)ExtraParamType.Something3) == (ushort)ExtraParamType.Something3));
|
|
||||||
//m_log.Info("TSomething4:" + ((type & (ushort)ExtraParamType.Something4) == (ushort)ExtraParamType.Something4));
|
|
||||||
//m_log.Info("TSomething5:" + ((type & (ushort)ExtraParamType.Something5) == (ushort)ExtraParamType.Something5));
|
|
||||||
//m_log.Info("TSomething6:" + ((type & (ushort)ExtraParamType.Something6) == (ushort)ExtraParamType.Something6));
|
|
||||||
|
|
||||||
bool usePhysics = false;
|
|
||||||
bool IsTemporary = false;
|
|
||||||
bool IsPhantom = false;
|
|
||||||
// bool castsShadows = false;
|
|
||||||
bool wasUsingPhysics = ((ObjectFlags & (uint) PrimFlags.Physics) != 0);
|
bool wasUsingPhysics = ((ObjectFlags & (uint) PrimFlags.Physics) != 0);
|
||||||
//bool IsLocked = false;
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
try
|
if (UsePhysics)
|
||||||
{
|
|
||||||
i += 46;
|
|
||||||
//IsLocked = (data[i++] != 0) ? true : false;
|
|
||||||
usePhysics = ((data[i++] != 0) && m_parentGroup.Scene.m_physicalPrim) ? true : false;
|
|
||||||
//System.Console.WriteLine("U" + packet.ToBytes().Length.ToString());
|
|
||||||
IsTemporary = (data[i++] != 0) ? true : false;
|
|
||||||
IsPhantom = (data[i++] != 0) ? true : false;
|
|
||||||
// castsShadows = (data[i++] != 0) ? true : false;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Ignoring invalid Packet:");
|
|
||||||
//Silently ignore it - TODO: FIXME Quick
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usePhysics)
|
|
||||||
{
|
{
|
||||||
AddFlag(PrimFlags.Physics);
|
AddFlag(PrimFlags.Physics);
|
||||||
if (!wasUsingPhysics)
|
if (!wasUsingPhysics)
|
||||||
{
|
{
|
||||||
DoPhysicsPropertyUpdate(usePhysics, false);
|
DoPhysicsPropertyUpdate(UsePhysics, false);
|
||||||
if (m_parentGroup != null)
|
if (m_parentGroup != null)
|
||||||
{
|
{
|
||||||
if (m_parentGroup.RootPart != null)
|
if (m_parentGroup.RootPart != null)
|
||||||
|
@ -3102,7 +3082,7 @@ if (m_shape != null) {
|
||||||
RemFlag(PrimFlags.Physics);
|
RemFlag(PrimFlags.Physics);
|
||||||
if (wasUsingPhysics)
|
if (wasUsingPhysics)
|
||||||
{
|
{
|
||||||
DoPhysicsPropertyUpdate(usePhysics, false);
|
DoPhysicsPropertyUpdate(UsePhysics, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3127,12 +3107,12 @@ if (m_shape != null) {
|
||||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
||||||
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
||||||
RotationOffset,
|
RotationOffset,
|
||||||
usePhysics);
|
UsePhysics);
|
||||||
|
|
||||||
if (PhysActor != null)
|
if (PhysActor != null)
|
||||||
{
|
{
|
||||||
PhysActor.LocalID = LocalId;
|
PhysActor.LocalID = LocalId;
|
||||||
DoPhysicsPropertyUpdate(usePhysics, true);
|
DoPhysicsPropertyUpdate(UsePhysics, true);
|
||||||
if (m_parentGroup != null)
|
if (m_parentGroup != null)
|
||||||
{
|
{
|
||||||
if (m_parentGroup.RootPart != null)
|
if (m_parentGroup.RootPart != null)
|
||||||
|
@ -3147,8 +3127,8 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PhysActor.IsPhysical = usePhysics;
|
PhysActor.IsPhysical = UsePhysics;
|
||||||
DoPhysicsPropertyUpdate(usePhysics, false);
|
DoPhysicsPropertyUpdate(UsePhysics, false);
|
||||||
if (m_parentGroup != null)
|
if (m_parentGroup != null)
|
||||||
{
|
{
|
||||||
if (m_parentGroup.RootPart != null)
|
if (m_parentGroup.RootPart != null)
|
||||||
|
|
Loading…
Reference in New Issue