Plumb the path from the client to the extra physics params and back

user_profiles
Melanie 2013-02-07 22:25:28 +00:00
parent 338b02a8bc
commit 7bf33d333a
10 changed files with 127 additions and 7 deletions

View File

@ -124,7 +124,7 @@ namespace OpenSim.Framework
public delegate void ObjectDrop(uint localID, IClientAPI remoteClient);
public delegate void UpdatePrimFlags(
uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient);
uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient);
public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
@ -1356,6 +1356,8 @@ namespace OpenSim.Framework
void SendObjectPropertiesReply(ISceneEntity Entity);
void SendPartPhysicsProprieties(ISceneEntity Entity);
void SendAgentOffline(UUID[] agentIDs);
void SendAgentOnline(UUID[] agentIDs);

View File

@ -807,5 +807,13 @@ namespace OpenSim.Region.ClientStack.Linden
{
return EventQueueHelper.BuildEvent(eventName, eventBody);
}
public void partPhysicsProperties(uint localID, byte physhapetype,
float density, float friction, float bounce, float gravmod,UUID avatarID)
{
OSD item = EventQueueHelper.partPhysicsProperties(localID, physhapetype,
density, friction, bounce, gravmod);
Enqueue(item, avatarID);
}
}
}

View File

@ -395,5 +395,25 @@ namespace OpenSim.Region.ClientStack.Linden
return message;
}
public static OSD partPhysicsProperties(uint localID, byte physhapetype,
float density, float friction, float bounce, float gravmod)
{
OSDMap physinfo = new OSDMap(6);
physinfo["LocalID"] = localID;
physinfo["Density"] = density;
physinfo["Friction"] = friction;
physinfo["GravityMultiplier"] = gravmod;
physinfo["Restitution"] = bounce;
physinfo["PhysicsShapeType"] = (int)physhapetype;
OSDArray array = new OSDArray(1);
array.Add(physinfo);
OSDMap llsdBody = new OSDMap(1);
llsdBody.Add("ObjectData", array);
return BuildEvent("ObjectPhysicsProperties", llsdBody);
}
}
}

View File

@ -2627,6 +2627,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
public void SendPartPhysicsProprieties(ISceneEntity entity)
{
SceneObjectPart part = (SceneObjectPart)entity;
if (part != null && AgentId != UUID.Zero)
{
try
{
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
uint localid = part.LocalId;
byte physshapetype = part.PhysicsShapeType;
float density = part.Density;
float friction = part.Friction;
float bounce = part.Restitution;
float gravmod = part.GravityModifier;
eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId);
}
}
catch (Exception ex)
{
m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString());
}
part.UpdatePhysRequired = false;
}
}
public void SendGroupNameReply(UUID groupLLUID, string GroupName)
{
@ -7035,10 +7063,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// 46,47,48 are special positions within the packet
// This may change so perhaps we need a better way
// of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?)
bool UsePhysics = (data[46] != 0) ? true : false;
bool IsTemporary = (data[47] != 0) ? true : false;
bool IsPhantom = (data[48] != 0) ? true : false;
handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this);
/*
bool UsePhysics = (data[46] != 0) ? true : false;
bool IsTemporary = (data[47] != 0) ? true : false;
bool IsPhantom = (data[48] != 0) ? true : false;
handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this);
*/
bool UsePhysics = flags.AgentData.UsePhysics;
bool IsPhantom = flags.AgentData.IsPhantom;
bool IsTemporary = flags.AgentData.IsTemporary;
ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = flags.ExtraPhysics;
ExtraPhysicsData physdata = new ExtraPhysicsData();
if (blocks == null || blocks.Length == 0)
{
physdata.PhysShapeType = PhysShapeType.invalid;
}
else
{
ObjectFlagUpdatePacket.ExtraPhysicsBlock phsblock = blocks[0];
physdata.PhysShapeType = (PhysShapeType)phsblock.PhysicsShapeType;
physdata.Bounce = phsblock.Restitution;
physdata.Density = phsblock.Density;
physdata.Friction = phsblock.Friction;
physdata.GravitationModifier = phsblock.GravityMultiplier;
}
handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this);
}
return true;
}

View File

@ -59,5 +59,7 @@ namespace OpenSim.Region.Framework.Interfaces
void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID);
OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono);
OSD BuildEvent(string eventName, OSD eventBody);
void partPhysicsProperties(uint localID, byte physhapetype, float density, float friction, float bounce, float gravmod, UUID avatarID);
}
}

View File

@ -1408,7 +1408,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="SetPhantom"></param>
/// <param name="remoteClient"></param>
protected internal void UpdatePrimFlags(
uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, IClientAPI remoteClient)
uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient)
{
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
@ -1416,7 +1416,28 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
{
// VolumeDetect can't be set via UI and will always be off when a change is made there
group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false);
// now only change volume dtc if phantom off
if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data
{
bool vdtc;
if (SetPhantom) // if phantom keep volumedtc
vdtc = group.RootPart.VolumeDetectActive;
else // else turn it off
vdtc = false;
group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, vdtc);
}
else
{
SceneObjectPart part = GetSceneObjectPart(localID);
if (part != null)
{
part.UpdateExtraPhysics(PhysData);
if (part.UpdatePhysRequired)
remoteClient.SendPartPhysicsProprieties(part);
}
}
}
}
}

View File

@ -1042,6 +1042,7 @@ namespace OpenSim.Region.Framework.Scenes
}
public UpdateRequired UpdateFlag { get; set; }
public bool UpdatePhysRequired { get; set; }
/// <summary>
/// Used for media on a prim.

View File

@ -1678,5 +1678,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
{
}
public void SendPartPhysicsProprieties(ISceneEntity entity)
{
}
}
}

View File

@ -1234,5 +1234,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
{
}
public void SendPartPhysicsProprieties(ISceneEntity entity)
{
}
}
}

View File

@ -1276,5 +1276,10 @@ namespace OpenSim.Tests.Common.Mock
public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
{
}
public void SendPartPhysicsProprieties(ISceneEntity entity)
{
}
}
}