Preserve attachment rotation on objects rezzed via a script. Makes toasters
work right, finally.avinationmerge
parent
fc3cf2b5a3
commit
98e9f22544
|
@ -371,14 +371,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
: objectGroup.AbsolutePosition.Y,
|
: objectGroup.AbsolutePosition.Y,
|
||||||
objectGroup.AbsolutePosition.Z);
|
objectGroup.AbsolutePosition.Z);
|
||||||
|
|
||||||
|
Quaternion inventoryStoredRotation = objectGroup.GroupRotation;
|
||||||
originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
|
originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
|
||||||
|
|
||||||
// Restore attachment data after trip through the sim
|
// Restore attachment data after trip through the sim
|
||||||
if (objectGroup.RootPart.AttachPoint > 0)
|
if (objectGroup.RootPart.AttachPoint > 0)
|
||||||
|
{
|
||||||
inventoryStoredPosition = objectGroup.RootPart.AttachOffset;
|
inventoryStoredPosition = objectGroup.RootPart.AttachOffset;
|
||||||
|
inventoryStoredRotation = objectGroup.RootPart.AttachRotation;
|
||||||
|
}
|
||||||
objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
|
objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
|
||||||
|
|
||||||
objectGroup.AbsolutePosition = inventoryStoredPosition;
|
objectGroup.AbsolutePosition = inventoryStoredPosition;
|
||||||
|
objectGroup.RootPart.RotationOffset = inventoryStoredRotation;
|
||||||
|
|
||||||
// Make sure all bits but the ones we want are clear
|
// Make sure all bits but the ones we want are clear
|
||||||
// on take.
|
// on take.
|
||||||
|
@ -768,6 +773,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
{
|
{
|
||||||
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
||||||
g.RootPart.AttachOffset = g.AbsolutePosition;
|
g.RootPart.AttachOffset = g.AbsolutePosition;
|
||||||
|
g.RootPart.AttachRotation = g.GroupRotation;
|
||||||
g.RootPart.Shape.State = 0;
|
g.RootPart.Shape.State = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -801,6 +807,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
|
SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
|
||||||
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
g.RootPart.AttachPoint = g.RootPart.Shape.State;
|
||||||
g.RootPart.AttachOffset = g.AbsolutePosition;
|
g.RootPart.AttachOffset = g.AbsolutePosition;
|
||||||
|
g.RootPart.AttachRotation = g.GroupRotation;
|
||||||
g.RootPart.Shape.State = 0;
|
g.RootPart.Shape.State = 0;
|
||||||
|
|
||||||
objlist.Add(g);
|
objlist.Add(g);
|
||||||
|
|
|
@ -196,6 +196,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public Vector3 AttachOffset = Vector3.Zero;
|
public Vector3 AttachOffset = Vector3.Zero;
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public Quaternion AttachRotation = Quaternion.Identity;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public int STATUS_ROTATE_X;
|
public int STATUS_ROTATE_X;
|
||||||
|
|
||||||
|
|
|
@ -812,6 +812,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
group.RootPart.AttachPoint = group.RootPart.Shape.State;
|
group.RootPart.AttachPoint = group.RootPart.Shape.State;
|
||||||
group.RootPart.AttachOffset = group.AbsolutePosition;
|
group.RootPart.AttachOffset = group.AbsolutePosition;
|
||||||
|
group.RootPart.AttachRotation = group.GroupRotation;
|
||||||
|
|
||||||
group.ResetIDs();
|
group.ResetIDs();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue