Added synchronization of SOP property VolumnDetectActive, and proper actions following
its setting to true.dsg
parent
486497331c
commit
c3c566cd24
OpenSim/Region
CoreModules/RegionSync/RegionSyncModule/SymmetricSync
Framework/Scenes
|
@ -1111,6 +1111,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
debugMsg += ", Text = " + part.Text+", Color = "+part.Color.ToString();
|
debugMsg += ", Text = " + part.Text+", Color = "+part.Color.ToString();
|
||||||
}
|
}
|
||||||
debugMsg += ", AggregateScriptEvents = " + part.AggregateScriptEvents;
|
debugMsg += ", AggregateScriptEvents = " + part.AggregateScriptEvents;
|
||||||
|
debugMsg += ", VolumeDetectActive" + part.VolumeDetectActive;
|
||||||
|
|
||||||
ScenePresence sp = m_scene.GetScenePresence(part.AttachedAvatar);
|
ScenePresence sp = m_scene.GetScenePresence(part.AttachedAvatar);
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
|
@ -2955,6 +2956,23 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_property = property;
|
m_property = property;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PropertySyncInfo(PropertySyncInfo pSyncInfo)
|
||||||
|
{
|
||||||
|
m_property = pSyncInfo.Property;
|
||||||
|
m_lastUpdateValue = pSyncInfo.LastUpdateValue;
|
||||||
|
m_lastUpdateTimeStamp = pSyncInfo.LastUpdateTimeStamp;
|
||||||
|
m_lastUpdateSyncID = pSyncInfo.LastUpdateSyncID;
|
||||||
|
//m_lastSyncUpdateRecvTime == ??
|
||||||
|
|
||||||
|
switch (m_property)
|
||||||
|
{
|
||||||
|
case SceneObjectPartSyncProperties.Shape:
|
||||||
|
case SceneObjectPartSyncProperties.TaskInventory:
|
||||||
|
m_lastUpdateValueHash = GetPropertyHashValue((string)pSyncInfo.LastUpdateValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public PropertySyncInfo(SceneObjectPartSyncProperties property, Object initValue, long initTS, string syncID)
|
public PropertySyncInfo(SceneObjectPartSyncProperties property, Object initValue, long initTS, string syncID)
|
||||||
{
|
{
|
||||||
m_property = property;
|
m_property = property;
|
||||||
|
@ -3846,8 +3864,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//different than the value in SOP
|
//different than the value in SOP
|
||||||
if (!m_propertiesSyncInfo.ContainsKey(property))
|
if (!m_propertiesSyncInfo.ContainsKey(property))
|
||||||
{
|
{
|
||||||
//Should not happen
|
//could happen if PhysActor is just created (object stops being phantom)
|
||||||
DebugLog.WarnFormat("PrimSyncInfo.UpdatePropertiesBySync -- no record of property {0} for SOP {1},{2}", property, part.Name, part.UUID);
|
if (PrimSyncInfo.PrimPhysActorProperties.Contains(property))
|
||||||
|
{
|
||||||
|
PropertySyncInfo syncInfo = new PropertySyncInfo(pSyncInfo);
|
||||||
|
m_propertiesSyncInfo.Add(property, syncInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugLog.WarnFormat("PrimSyncInfo.UpdatePropertiesBySync -- no record of property {0} for SOP {1},{2}", property, part.Name, part.UUID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5478,8 +5504,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
///////////////////////
|
///////////////////////
|
||||||
case SceneObjectPartSyncProperties.AggregateScriptEvents:
|
case SceneObjectPartSyncProperties.AggregateScriptEvents:
|
||||||
part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue;
|
part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue;
|
||||||
part.aggregateScriptEventSubscriptions();
|
|
||||||
DebugLog.DebugFormat("set {0} value to be {1}", property.ToString(), part.AggregateScriptEvents);
|
DebugLog.DebugFormat("set {0} value to be {1}", property.ToString(), part.AggregateScriptEvents);
|
||||||
|
part.aggregateScriptEventSubscriptions();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SceneObjectPartSyncProperties.AllowedDrop:
|
case SceneObjectPartSyncProperties.AllowedDrop:
|
||||||
|
@ -5688,7 +5714,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
part.Velocity = (Vector3)pSyncInfo.LastUpdateValue;
|
part.Velocity = (Vector3)pSyncInfo.LastUpdateValue;
|
||||||
break;
|
break;
|
||||||
case SceneObjectPartSyncProperties.VolumeDetectActive:
|
case SceneObjectPartSyncProperties.VolumeDetectActive:
|
||||||
part.VolumeDetectActive = (bool)pSyncInfo.LastUpdateValue;
|
//part.ParentGroup.UpdatePrimFlagsBySync(part.LocalId, part., IsTemporary, IsPhantom, part.VolumeDetectActive);
|
||||||
|
bool isVD = (bool)pSyncInfo.LastUpdateValue;
|
||||||
|
DebugLog.DebugFormat("VolumeDetectActive updated on SOP {0}, to {1}", part.Name, part.VolumeDetectActive);
|
||||||
|
if (part.ParentGroup != null)
|
||||||
|
{
|
||||||
|
DebugLog.DebugFormat("calling ScriptSetVolumeDetectBySync");
|
||||||
|
part.ParentGroup.ScriptSetVolumeDetectBySync(isVD);
|
||||||
|
}
|
||||||
|
part.VolumeDetectActive = isVD;
|
||||||
part.aggregateScriptEventSubscriptions();
|
part.aggregateScriptEventSubscriptions();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -3932,6 +3932,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
parts[i].UpdatePrimFlagsBySync(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
|
parts[i].UpdatePrimFlagsBySync(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ScriptSetVolumeDetectBySync(bool SetVD)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("ScriptSetVolumeDetectBySync called for SOG {0}", Name);
|
||||||
|
|
||||||
|
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
|
||||||
|
bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0);
|
||||||
|
bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0);
|
||||||
|
UpdatePrimFlagsBySync(RootPart.LocalId, UsePhysics, IsTemporary, IsPhantom, SetVD);
|
||||||
|
}
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
// Per SOP property based sync
|
// Per SOP property based sync
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -3017,6 +3017,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_parentGroup != null)
|
if (m_parentGroup != null)
|
||||||
{
|
{
|
||||||
m_parentGroup.ScriptSetVolumeDetect(SetVD);
|
m_parentGroup.ScriptSetVolumeDetect(SetVD);
|
||||||
|
|
||||||
|
//DSG: report that VolumeDetect has changed
|
||||||
|
ScheduleFullUpdate(new List<SceneObjectPartSyncProperties>() { SceneObjectPartSyncProperties.VolumeDetectActive });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4414,9 +4417,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == IsTemporary) && (wasPhantom == IsPhantom) && (IsVD==wasVD))
|
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == IsTemporary) && (wasPhantom == IsPhantom) && (IsVD==wasVD))
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("UpdatePrimFlags called on {0}, nothing changed", Name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat("UpdatePrimFlags for SOP {0}, with args UsePhysics ={1}, IsTemporary= {2}, IsPhantom= {3}, IsVD = {4}", Name, UsePhysics, IsTemporary, IsPhantom, IsVD);
|
||||||
|
|
||||||
// Special cases for VD. VD can only be called from a script
|
// Special cases for VD. VD can only be called from a script
|
||||||
// and can't be combined with changes to other states. So we can rely
|
// and can't be combined with changes to other states. So we can rely
|
||||||
// that...
|
// that...
|
||||||
|
@ -4424,6 +4430,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// ... if one of the others is changed, VD is not.
|
// ... if one of the others is changed, VD is not.
|
||||||
if (IsVD) // VD is active, special logic applies
|
if (IsVD) // VD is active, special logic applies
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("VolumnDetectActive is set");
|
||||||
|
|
||||||
// State machine logic for VolumeDetect
|
// State machine logic for VolumeDetect
|
||||||
// More logic below
|
// More logic below
|
||||||
bool phanReset = (IsPhantom != wasPhantom) && !IsPhantom;
|
bool phanReset = (IsPhantom != wasPhantom) && !IsPhantom;
|
||||||
|
@ -4496,6 +4504,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (pa == null)
|
if (pa == null)
|
||||||
{
|
{
|
||||||
// It's not phantom anymore. So make sure the physics engine get's knowledge of it
|
// It's not phantom anymore. So make sure the physics engine get's knowledge of it
|
||||||
|
|
||||||
|
m_log.DebugFormat("Create PhysActor for {0}", Name);
|
||||||
|
|
||||||
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||||
LocalId,
|
LocalId,
|
||||||
string.Format("{0}/{1}", Name, UUID),
|
string.Format("{0}/{1}", Name, UUID),
|
||||||
|
@ -4556,6 +4567,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (IsVD)
|
if (IsVD)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("more logic on VD");
|
||||||
|
|
||||||
// If the above logic worked (this is urgent candidate to unit tests!)
|
// If the above logic worked (this is urgent candidate to unit tests!)
|
||||||
// we now have a physicsactor.
|
// we now have a physicsactor.
|
||||||
// Defensive programming calls for a check here.
|
// Defensive programming calls for a check here.
|
||||||
|
@ -4563,6 +4576,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// logic should make sure, this Physactor is always here.
|
// logic should make sure, this Physactor is always here.
|
||||||
if (this.PhysActor != null)
|
if (this.PhysActor != null)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("PhysActor.SetVolumnDetect");
|
||||||
|
|
||||||
PhysActor.SetVolumeDetect(1);
|
PhysActor.SetVolumeDetect(1);
|
||||||
AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
|
AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
|
||||||
this.VolumeDetectActive = true;
|
this.VolumeDetectActive = true;
|
||||||
|
@ -5273,9 +5288,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
(CollisionSound != UUID.Zero)
|
(CollisionSound != UUID.Zero)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("Need to Hook up collision events for {0} ", Name);
|
||||||
|
|
||||||
// subscribe to physics updates.
|
// subscribe to physics updates.
|
||||||
if (PhysActor != null)
|
if (PhysActor != null)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("Hook up with PhysicsCollision for {0} ", Name);
|
||||||
|
|
||||||
PhysActor.OnCollisionUpdate += PhysicsCollision;
|
PhysActor.OnCollisionUpdate += PhysicsCollision;
|
||||||
PhysActor.SubscribeEvents(1000);
|
PhysActor.SubscribeEvents(1000);
|
||||||
|
|
||||||
|
@ -5321,8 +5340,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0);
|
bool wasPhantom = ((Flags & PrimFlags.Phantom) != 0);
|
||||||
bool wasVD = VolumeDetectActive;
|
bool wasVD = VolumeDetectActive;
|
||||||
|
|
||||||
|
m_log.DebugFormat("UpdatePrimFlagsBySync called for SOP {0}, UsePhysics ={1}, IsTemporary= {2}, IsPhantom= {3}, IsVD = {4}", Name, UsePhysics, IsTemporary, IsPhantom, IsVD);
|
||||||
|
|
||||||
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == IsTemporary) && (wasPhantom == IsPhantom) && (IsVD == wasVD))
|
if ((UsePhysics == wasUsingPhysics) && (wasTemporary == IsTemporary) && (wasPhantom == IsPhantom) && (IsVD == wasVD))
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("no property changed, return");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5333,6 +5355,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// ... if one of the others is changed, VD is not.
|
// ... if one of the others is changed, VD is not.
|
||||||
if (IsVD) // VD is active, special logic applies
|
if (IsVD) // VD is active, special logic applies
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("{0}: IsVD", Name);
|
||||||
|
if (PhysActor == null)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("But {0}'s PhysActor is null", Name);
|
||||||
|
}
|
||||||
|
|
||||||
// State machine logic for VolumeDetect
|
// State machine logic for VolumeDetect
|
||||||
// More logic below
|
// More logic below
|
||||||
bool phanReset = (IsPhantom != wasPhantom) && !IsPhantom;
|
bool phanReset = (IsPhantom != wasPhantom) && !IsPhantom;
|
||||||
|
|
Loading…
Reference in New Issue