minor: Make SOG.DelinkFromGroup() return the newly delinked scene object instead of void

0.6.9
Justin Clark-Casey (justincc) 2010-02-16 14:36:08 +00:00
parent b2656e62ba
commit 052f2b3e27
2 changed files with 26 additions and 11 deletions

View File

@ -262,7 +262,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Returns a new unallocated local ID /// Returns a new unallocated local ID
/// </summary> /// </summary>
/// <returns>A brand new local ID</returns> /// <returns>A brand new local ID</returns>
protected internal uint AllocateLocalId() public uint AllocateLocalId()
{ {
uint myID; uint myID;

View File

@ -1468,6 +1468,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="part"></param> /// <param name="part"></param>
internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
{ {
// m_log.DebugFormat(
// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
if (m_rootPart.UUID == part.UUID) if (m_rootPart.UUID == part.UUID)
{ {
if (IsAttachment) if (IsAttachment)
@ -2284,7 +2287,6 @@ namespace OpenSim.Region.Framework.Scenes
AttachToBackup(); AttachToBackup();
// Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the
// position of linkset prims. IF YOU CHANGE THIS, YOU MUST TEST colliding with just linked and // position of linkset prims. IF YOU CHANGE THIS, YOU MUST TEST colliding with just linked and
// unmoved prims! // unmoved prims!
@ -2299,9 +2301,10 @@ namespace OpenSim.Region.Framework.Scenes
/// an independent SceneObjectGroup. /// an independent SceneObjectGroup.
/// </summary> /// </summary>
/// <param name="partID"></param> /// <param name="partID"></param>
public void DelinkFromGroup(uint partID) /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
public SceneObjectGroup DelinkFromGroup(uint partID)
{ {
DelinkFromGroup(partID, true); return DelinkFromGroup(partID, true);
} }
/// <summary> /// <summary>
@ -2310,29 +2313,40 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
/// <param name="partID"></param> /// <param name="partID"></param>
/// <param name="sendEvents"></param> /// <param name="sendEvents"></param>
public void DelinkFromGroup(uint partID, bool sendEvents) /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
public SceneObjectGroup DelinkFromGroup(uint partID, bool sendEvents)
{ {
SceneObjectPart linkPart = GetChildPart(partID); SceneObjectPart linkPart = GetChildPart(partID);
if (linkPart != null) if (linkPart != null)
{ {
DelinkFromGroup(linkPart, sendEvents); return DelinkFromGroup(linkPart, sendEvents);
} }
else else
{ {
m_log.InfoFormat("[SCENE OBJECT GROUP]: " + m_log.WarnFormat("[SCENE OBJECT GROUP]: " +
"DelinkFromGroup(): Child prim {0} not found in object {1}, {2}", "DelinkFromGroup(): Child prim {0} not found in object {1}, {2}",
partID, LocalId, UUID); partID, LocalId, UUID);
return null;
} }
} }
public void DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents) /// <summary>
/// Delink the given prim from this group. The delinked prim is established as
/// an independent SceneObjectGroup.
/// </summary>
/// <param name="partID"></param>
/// <param name="sendEvents"></param>
/// <returns>The object group of the newly delinked prim.</returns>
public SceneObjectGroup DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents)
{ {
linkPart.ClearUndoState();
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", // "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); // linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
linkPart.ClearUndoState();
Quaternion worldRot = linkPart.GetWorldRotation(); Quaternion worldRot = linkPart.GetWorldRotation();
// Remove the part from this object // Remove the part from this object
@ -2384,6 +2398,8 @@ namespace OpenSim.Region.Framework.Scenes
//HasGroupChanged = true; //HasGroupChanged = true;
//ScheduleGroupForFullUpdate(); //ScheduleGroupForFullUpdate();
return objectGroup;
} }
/// <summary> /// <summary>
@ -2422,7 +2438,6 @@ namespace OpenSim.Region.Framework.Scenes
part.LinkNum = linkNum; part.LinkNum = linkNum;
part.OffsetPosition = part.GroupPosition - AbsolutePosition; part.OffsetPosition = part.GroupPosition - AbsolutePosition;
Quaternion rootRotation = m_rootPart.RotationOffset; Quaternion rootRotation = m_rootPart.RotationOffset;