Merge branch 'ubitwork'
commit
b4adf652e7
|
@ -1320,6 +1320,8 @@ namespace OpenSim.Framework
|
|||
|
||||
void SendObjectPropertiesReply(ISceneEntity Entity);
|
||||
|
||||
void SendPartPhysicsProprieties(ISceneEntity Entity);
|
||||
|
||||
void SendAgentOffline(UUID[] agentIDs);
|
||||
|
||||
void SendAgentOnline(UUID[] agentIDs);
|
||||
|
|
|
@ -97,6 +97,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
private static readonly string m_copyFromNotecardPath = "0007/";
|
||||
// private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
|
||||
private static readonly string m_getObjectPhysicsDataPath = "0101/";
|
||||
private static readonly string m_getObjectCostPath = "0102/";
|
||||
private static readonly string m_ResourceCostSelectedPath = "0103/";
|
||||
|
||||
|
||||
// These are callbacks which will be setup by the scene so that we can update scene data when we
|
||||
|
@ -185,6 +187,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard));
|
||||
IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData);
|
||||
m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
|
||||
IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost);
|
||||
m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
|
||||
IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected);
|
||||
m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
|
||||
|
||||
|
||||
// As of RC 1.22.9 of the Linden client this is
|
||||
// supported
|
||||
|
@ -834,6 +841,115 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
Console.WriteLine(response);
|
||||
return response;
|
||||
}
|
||||
|
||||
public string GetObjectCost(string request, string path,
|
||||
string param, IOSHttpRequest httpRequest,
|
||||
IOSHttpResponse httpResponse)
|
||||
{
|
||||
// see being triggered but see no efect .. have something wrong ??
|
||||
//
|
||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
OSDMap resp = new OSDMap();
|
||||
|
||||
OSDArray object_ids = (OSDArray)req["object_ids"];
|
||||
|
||||
for (int i = 0; i < object_ids.Count; i++)
|
||||
{
|
||||
UUID uuid = object_ids[i].AsUUID();
|
||||
|
||||
// only see root parts .. so guess should go by SOG only
|
||||
SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid);
|
||||
if (obj != null)
|
||||
{
|
||||
OSDMap object_data = new OSDMap();
|
||||
|
||||
object_data["linked_set_resource_cost"] = 1.0f;
|
||||
object_data["resource_cost"] = 1.0f;
|
||||
object_data["physics_cost"] = 1.0f;
|
||||
object_data["linked_set_physics_cost"] = 1.0f;
|
||||
|
||||
resp[uuid.ToString()] = object_data;
|
||||
}
|
||||
}
|
||||
|
||||
string response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
Console.WriteLine(response);
|
||||
return response;
|
||||
}
|
||||
|
||||
public string ResourceCostSelected(string request, string path,
|
||||
string param, IOSHttpRequest httpRequest,
|
||||
IOSHttpResponse httpResponse)
|
||||
{
|
||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
OSDMap resp = new OSDMap();
|
||||
|
||||
|
||||
float phys=0;
|
||||
float stream=0;
|
||||
float simul=0;
|
||||
|
||||
if (req.ContainsKey("selected_roots"))
|
||||
{
|
||||
OSDArray object_ids = (OSDArray)req["selected_roots"];
|
||||
|
||||
// should go by SOG suming costs for all parts
|
||||
// ll v3 works ok with several objects select we get the list and adds ok
|
||||
// FS calls per object so results are wrong guess fs bug
|
||||
for (int i = 0; i < object_ids.Count; i++)
|
||||
{
|
||||
UUID uuid = object_ids[i].AsUUID();
|
||||
|
||||
SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid);
|
||||
if (obj != null)
|
||||
{
|
||||
phys += 0.1f; // just to see...
|
||||
stream += 0.2f;
|
||||
simul += 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (req.ContainsKey("selected_prims"))
|
||||
{
|
||||
OSDArray object_ids = (OSDArray)req["selected_prims"];
|
||||
|
||||
// don't see in use in any of the 2 viewers
|
||||
// guess it should be for edit linked but... nothing
|
||||
// should go to SOP per part
|
||||
for (int i = 0; i < object_ids.Count; i++)
|
||||
{
|
||||
UUID uuid = object_ids[i].AsUUID();
|
||||
|
||||
SceneObjectPart obj = m_Scene.GetSceneObjectPart(uuid);
|
||||
if (obj != null)
|
||||
{
|
||||
phys += 0.1f;
|
||||
stream += 0.2f;
|
||||
simul += 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (simul != 0)
|
||||
{
|
||||
OSDMap object_data = new OSDMap();
|
||||
|
||||
object_data["physics"] = phys;
|
||||
object_data["streaming"] = stream;
|
||||
object_data["simulation"] = simul;
|
||||
|
||||
resp["selected"] = object_data;
|
||||
}
|
||||
|
||||
string response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
Console.WriteLine(response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class AssetUploader
|
||||
|
|
|
@ -805,5 +805,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2609,6 +2609,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.Bounciness;
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SendGroupNameReply(UUID groupLLUID, string GroupName)
|
||||
{
|
||||
|
@ -7029,7 +7057,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1695,6 +1695,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
part.Material = Convert.ToByte(material);
|
||||
group.HasGroupChanged = true;
|
||||
remoteClient.SendPartPhysicsProprieties(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2723,6 +2723,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// When we delete a group, we currently have to force persist to the database if the object id has changed
|
||||
// (since delete works by deleting all rows which have a given object id)
|
||||
|
||||
// this is as it seems to be in sl now
|
||||
if(linkPart.PhysicsShapeType == (byte)PhysShapeType.none)
|
||||
linkPart.PhysicsShapeType = linkPart.DefaultPhysicsShapeType(); // root prims can't have type none for now
|
||||
|
||||
if (m_rootPart.PhysActor != null)
|
||||
m_rootPart.PhysActor.Building = false;
|
||||
|
||||
|
|
|
@ -986,7 +986,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public PrimitiveBaseShape Shape
|
||||
{
|
||||
get { return m_shape; }
|
||||
set { m_shape = value;}
|
||||
set
|
||||
{
|
||||
m_shape = value;
|
||||
m_physicsShapeType = DefaultPhysicsShapeType();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1377,31 +1381,68 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (value >= 0 && value <= (byte)SOPMaterialData.MaxMaterial)
|
||||
{
|
||||
bool update = false;
|
||||
|
||||
if (m_material != (Material)value)
|
||||
{
|
||||
update = true;
|
||||
m_material = (Material)value;
|
||||
}
|
||||
|
||||
if (m_friction != SOPMaterialData.friction(m_material))
|
||||
{
|
||||
update = true;
|
||||
m_friction = SOPMaterialData.friction(m_material);
|
||||
}
|
||||
|
||||
if (m_bounce != SOPMaterialData.bounce(m_material))
|
||||
{
|
||||
update = true;
|
||||
m_bounce = SOPMaterialData.bounce(m_material);
|
||||
}
|
||||
|
||||
if (update)
|
||||
{
|
||||
if (PhysActor != null)
|
||||
{
|
||||
PhysActor.SetMaterial((int)value);
|
||||
}
|
||||
if(ParentGroup != null)
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
ScheduleFullUpdateIfNone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// not a propriety to move to methods place later
|
||||
public byte DefaultPhysicsShapeType()
|
||||
{
|
||||
byte type;
|
||||
|
||||
if (Shape != null && (Shape.SculptType == (byte)SculptType.Mesh))
|
||||
type = (byte)PhysShapeType.convex;
|
||||
else
|
||||
type = (byte)PhysShapeType.prim;
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public byte PhysicsShapeType
|
||||
{
|
||||
get { return m_physicsShapeType; }
|
||||
set
|
||||
{
|
||||
if (value < 0 || value >= (byte)PhysShapeType.convex)
|
||||
value = (byte)PhysShapeType.prim; //convex not supported ?
|
||||
|
||||
else if (value == (byte)PhysShapeType.none)
|
||||
if (value >= 0 && value <= (byte)PhysShapeType.convex)
|
||||
{
|
||||
if (ParentGroup == null || ParentGroup.RootPart == this)
|
||||
value = (byte)PhysShapeType.prim;
|
||||
}
|
||||
if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this)
|
||||
m_physicsShapeType = DefaultPhysicsShapeType();
|
||||
else
|
||||
m_physicsShapeType = value;
|
||||
ScheduleFullUpdateIfNone();
|
||||
}
|
||||
else
|
||||
m_physicsShapeType = DefaultPhysicsShapeType();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1413,6 +1454,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (value >=1 && value <= 22587.0)
|
||||
{
|
||||
m_density = value;
|
||||
ScheduleFullUpdateIfNone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1423,6 +1465,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
set
|
||||
{ if( value >= -1 && value <=28.0f)
|
||||
m_gravitymod = value;
|
||||
ScheduleFullUpdateIfNone();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1434,6 +1477,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (value >= 0 && value <= 255.0f)
|
||||
{
|
||||
m_friction = value;
|
||||
ScheduleFullUpdateIfNone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1446,6 +1490,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (value >= 0 && value <= 1.0f)
|
||||
{
|
||||
m_bounce = value;
|
||||
ScheduleFullUpdateIfNone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2942,6 +2987,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
APIDTarget = Quaternion.Identity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ScheduleFullUpdateIfNone()
|
||||
{
|
||||
if (ParentGroup == null)
|
||||
return;
|
||||
|
||||
// ??? ParentGroup.HasGroupChanged = true;
|
||||
|
||||
if (UpdateFlag != UpdateRequired.FULL)
|
||||
ScheduleFullUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Schedules this prim for a full update
|
||||
/// </summary>
|
||||
|
|
|
@ -597,22 +597,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
|
||||
private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.Density = (byte)reader.ReadElementContentAsInt("Density", String.Empty);
|
||||
obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.Friction = (byte)reader.ReadElementContentAsInt("Friction", String.Empty);
|
||||
obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.Bounciness = (byte)reader.ReadElementContentAsInt("Bounce", String.Empty);
|
||||
obj.Bounciness = reader.ReadElementContentAsFloat("Bounce", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
obj.GravityModifier = (byte)reader.ReadElementContentAsInt("GravityModifier", String.Empty);
|
||||
obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
|
||||
}
|
||||
|
||||
private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader)
|
||||
|
@ -1321,7 +1321,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
if (sop.sopVehicle != null)
|
||||
sop.sopVehicle.ToXml2(writer);
|
||||
|
||||
if(sop.PhysicsShapeType != (byte)PhysShapeType.prim)
|
||||
if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType())
|
||||
writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
|
||||
if (sop.Density != 1000.0f)
|
||||
writer.WriteElementString("Density", sop.Density.ToString().ToLower());
|
||||
|
|
|
@ -1703,5 +1703,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
|
||||
{
|
||||
}
|
||||
|
||||
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1195,5 +1195,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
|
||||
{
|
||||
}
|
||||
|
||||
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1258,5 +1258,9 @@ namespace OpenSim.Tests.Common.Mock
|
|||
public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data)
|
||||
{
|
||||
}
|
||||
|
||||
public void SendPartPhysicsProprieties(ISceneEntity entity)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue