Merge branch 'ubitworkmaster'

avinationmerge
Melanie Thielker 2014-11-21 04:10:38 +01:00
commit 3a94e20d70
6 changed files with 57 additions and 20 deletions

View File

@ -246,7 +246,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="objlist">The scene objects</param>
/// <param name="veclist">Relative offsets for each object</param>
/// <returns>true = success, false = the scene object asset couldn't be found</returns>
bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist);
bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist, out Vector3 bbox, out float offsetHeight);
/// <summary>
/// Update an existing inventory item.

View File

@ -2447,7 +2447,7 @@ namespace OpenSim.Region.Framework.Scenes
RayStart, RayEnd, RayTargetID, Quaternion.Identity,
BypassRayCast, bRayEndIsIntersection, true, scale, false);
RezObject(part, item, pos, null, Vector3.Zero, 0);
RezObject(part, item, pos, null, Vector3.Zero, 0, false);
}
}
@ -2463,15 +2463,18 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="param"></param>
/// <returns>The SceneObjectGroup(s) rezzed, or null if rez was unsuccessful</returns>
public virtual List<SceneObjectGroup> RezObject(
SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param)
SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param, bool atRoot)
{
if (null == item)
return null;
List<SceneObjectGroup> objlist;
List<Vector3> veclist;
Vector3 bbox;
float offsetHeight;
bool success = sourcePart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist,out bbox, out offsetHeight);
bool success = sourcePart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist);
if (!success)
return null;
@ -2488,6 +2491,28 @@ namespace OpenSim.Region.Framework.Scenes
sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
}
SceneObjectGroup sog;
// position adjust
if (totalPrims > 1) // nothing to do on a single prim
{
if (objlist.Count == 1)
{
// current object position is root position
if(!atRoot)
{
sog = objlist[0];
Quaternion orot;
if (rot == null)
orot = sog.RootPart.GetWorldRotation();
else
orot = rot.Value;
Vector3 off = sog.GetGeometricCenter();
off *= orot;
pos -= off;
}
}
}
for (int i = 0; i < objlist.Count; i++)
{
SceneObjectGroup group = objlist[i];

View File

@ -2468,12 +2468,23 @@ namespace OpenSim.Region.Framework.Scenes
public void stopMoveToTarget()
{
PhysicsActor pa = RootPart.PhysActor;
if (IsAttachment)
{
ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar != null)
{
avatar.ResetMoveToTarget();
}
}
else
{
PhysicsActor pa = RootPart.PhysActor;
if (pa != null)
pa.PIDActive = false;
if (pa != null)
pa.PIDActive = false;
RootPart.ScheduleTerseUpdate(); // send a stop information
RootPart.ScheduleTerseUpdate(); // send a stop information
}
}
public void rotLookAt(Quaternion target, float strength, float damping)

View File

@ -871,7 +871,7 @@ namespace OpenSim.Region.Framework.Scenes
return items;
}
public bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist)
public bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist, out Vector3 bbox, out float offsetHeight)
{
AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
@ -882,12 +882,11 @@ namespace OpenSim.Region.Framework.Scenes
item.AssetID, item.Name, m_part.Name);
objlist = null;
veclist = null;
bbox = Vector3.Zero;
offsetHeight = 0;
return false;
}
Vector3 bbox;
float offsetHeight;
bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight);
for (int i = 0; i < objlist.Count; i++)

View File

@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Tests
Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f);
Vector3 rezVel = new Vector3(2, 2, 2);
scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0);
scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0,false);
SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso");

View File

@ -3233,6 +3233,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
{
doObjectRez(inventory, pos, vel, rot, param, true);
}
public void doObjectRez(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, bool atRoot)
{
m_host.AddScriptLPS(1);
@ -3260,10 +3265,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
// need the magnitude later
// float velmag = (float)Util.GetMagnitude(llvel);
List<SceneObjectGroup> new_groups = World.RezObject(m_host, item, pos, rot, vel, param);
List<SceneObjectGroup> new_groups = World.RezObject(m_host, item, pos, rot, vel, param, atRoot);
// If either of these are null, then there was an unknown error.
if (new_groups == null)
@ -3311,7 +3313,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
{
llRezAtRoot(inventory, pos, vel, rot, param);
doObjectRez(inventory, pos, vel, rot, param, false);
}
public void llLookAt(LSL_Vector target, double strength, double damping)