From bf9384d5943e755df9bbfce793c0cd89252e4044 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 7 Nov 2008 22:57:32 +0000
Subject: * Apply http://opensimulator.org/mantis/view.php?id=2582 * Send prim
flags as booleans from LLClientView rather than in the native LL array *
Thanks idb
---
OpenSim/Region/Environment/Scenes/InnerScene.cs | 4 +-
.../Region/Environment/Scenes/SceneObjectGroup.cs | 43 +++++++-----------
.../Region/Environment/Scenes/SceneObjectPart.cs | 52 +++++++---------------
3 files changed, 34 insertions(+), 65 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes')
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 2f7ca21..0b24ce9 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -1194,14 +1194,14 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- 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);
if (group != null)
{
if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId))
{
- group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes());
+ group.UpdatePrimFlags(localID, UsePhysics, IsTemporary, IsPhantom);
}
}
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 949ac3d..b428269 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1407,34 +1407,23 @@ namespace OpenSim.Region.Environment.Scenes
public void ScriptSetPhysicsStatus(bool UsePhysics)
{
- if (m_scene.m_physicalPrim)
- {
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (UsePhysics)
- part.AddFlag(PrimFlags.Physics);
- else
- part.RemFlag(PrimFlags.Physics);
+ bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0);
+ bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0);
+ UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, IsPhantom);
+ }
- part.DoPhysicsPropertyUpdate(UsePhysics, false);
- IsSelected = false;
- }
- }
- }
+ public void ScriptSetTemporaryStatus(bool TemporaryStatus)
+ {
+ 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)
{
- byte[] flags = new byte[50];
- // only the following 3 flags are updated by UpdatePrimFlags
- flags[46] = (byte)((RootPart.Flags & PrimFlags.Physics) != 0 ? 1 : 0);
- 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);
+ bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
+ bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0);
+ UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, PhantomStatus);
}
public void applyImpulse(PhysicsVector impulse)
@@ -2160,11 +2149,11 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- 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);
- if (data[47] != 0) // Temporary
+ if (IsTemporary)
{
DetachFromBackup();
// 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)
{
- data[46] = 0; // Reset physics
+ UsePhysics = false; // Reset physics
break;
}
}
foreach (SceneObjectPart part in m_parts.Values)
{
- part.UpdatePrimFlags(type, inUse, data);
+ part.UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom);
}
}
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index d2c4253..bdeaa6f 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -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)
{
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 IsLocked = false;
- int i = 0;
- try
- {
- 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)
+ if (UsePhysics)
{
AddFlag(PrimFlags.Physics);
if (!wasUsingPhysics)
{
- DoPhysicsPropertyUpdate(usePhysics, false);
+ DoPhysicsPropertyUpdate(UsePhysics, false);
if (m_parentGroup != null)
{
if (m_parentGroup.RootPart != null)
@@ -3102,7 +3082,7 @@ if (m_shape != null) {
RemFlag(PrimFlags.Physics);
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(Scale.X, Scale.Y, Scale.Z),
RotationOffset,
- usePhysics);
+ UsePhysics);
if (PhysActor != null)
{
PhysActor.LocalID = LocalId;
- DoPhysicsPropertyUpdate(usePhysics, true);
+ DoPhysicsPropertyUpdate(UsePhysics, true);
if (m_parentGroup != null)
{
if (m_parentGroup.RootPart != null)
@@ -3147,8 +3127,8 @@ if (m_shape != null) {
}
else
{
- PhysActor.IsPhysical = usePhysics;
- DoPhysicsPropertyUpdate(usePhysics, false);
+ PhysActor.IsPhysical = UsePhysics;
+ DoPhysicsPropertyUpdate(UsePhysics, false);
if (m_parentGroup != null)
{
if (m_parentGroup.RootPart != null)
--
cgit v1.1