changed seletion code. SOP now knows about parts selection. UI actions are sent to SOP and this reports to SOG. Group is selected if any part is selected.sop.isSelect get() is only used in SOG. Will need to be improved for better performance on largelinksets. *UNTESTED* NEEDS CHECKING for side efects

avinationmerge
UbitUmarov 2012-04-20 18:51:32 +01:00
parent 2c7f035925
commit 3b56c44453
3 changed files with 104 additions and 24 deletions

View File

@ -129,27 +129,47 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param>
public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
{
/*
SceneObjectPart part = GetSceneObjectPart(primLocalID);
if (null == part)
return;
if (part.IsRoot)
{
SceneObjectGroup sog = part.ParentGroup;
sog.SendPropertiesToClient(remoteClient);
// A prim is only tainted if it's allowed to be edited by the person clicking it.
if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
|| Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
{
sog.IsSelected = true;
EventManager.TriggerParcelPrimCountTainted();
}
}
else
{
part.SendPropertiesToClient(remoteClient);
}
*/
SceneObjectPart part = GetSceneObjectPart(primLocalID);
if (null == part)
return;
if (part.IsRoot)
{
SceneObjectGroup sog = part.ParentGroup;
sog.SendPropertiesToClient(remoteClient);
SceneObjectGroup sog = part.ParentGroup;
if (sog == null)
return;
// A prim is only tainted if it's allowed to be edited by the person clicking it.
if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
|| Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
{
sog.IsSelected = true;
EventManager.TriggerParcelPrimCountTainted();
}
}
else
part.SendPropertiesToClient(remoteClient);
// A prim is only tainted if it's allowed to be edited by the person clicking it.
if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
|| Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
{
part.SendPropertiesToClient(remoteClient);
part.IsSelected = true;
EventManager.TriggerParcelPrimCountTainted();
}
}
@ -202,7 +222,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetSceneObjectPart(primLocalID);
if (part == null)
return;
/*
// A deselect packet contains all the local prims being deselected. However, since selection is still
// group based we only want the root prim to trigger a full update - otherwise on objects with many prims
// we end up sending many duplicate ObjectUpdates
@ -237,6 +257,22 @@ namespace OpenSim.Region.Framework.Scenes
part.UUID, remoteClient.AgentId))
EventManager.TriggerParcelPrimCountTainted();
}
*/
bool oldgprSelect = part.ParentGroup.IsSelected;
// This is wrong, wrong, wrong. Selection should not be
// handled by group, but by prim. Legacy cruft.
// TODO: Make selection flagging per prim!
//
if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)
|| Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId))
{
part.IsSelected = false;
if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected)
EventManager.TriggerParcelPrimCountTainted();
}
}
public virtual void ProcessMoneyTransferRequest(UUID source, UUID destination, int amount,

View File

@ -726,6 +726,11 @@ namespace OpenSim.Region.Framework.Scenes
m_isSelected = value;
// Tell physics engine that group is selected
// this is not right
// but ode engines should only really need to know about root part
// so they can put entire object simulation on hold and not colliding
// keep as was for now
PhysicsActor pa = m_rootPart.PhysActor;
if (pa != null)
{
@ -747,6 +752,40 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void PartSelectChanged(bool partSelect)
{
// any part selected makes group selected
if (m_isSelected == partSelect)
return;
if (partSelect)
{
IsSelected = partSelect;
// if (!IsAttachment)
// ScheduleGroupForFullUpdate();
}
else
{
// bad bad bad 2 heavy for large linksets
// since viewer does send lot of (un)selects
// this needs to be replaced by a specific list or count ?
// but that will require extra code in several places
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
if (part.IsSelected)
return;
}
IsSelected = partSelect;
if (!IsAttachment)
{
ScheduleGroupForFullUpdate();
}
}
}
private SceneObjectPart m_PlaySoundMasterPrim = null;
public SceneObjectPart PlaySoundMasterPrim
{
@ -3139,14 +3178,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/*
RootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect);
for (int i = 0; i < parts.Length; i++)
{
if (parts[i] != RootPart)
parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect);
}
*/
if (parts.Length > 1)
{
m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true);
@ -3163,7 +3194,6 @@ namespace OpenSim.Region.Framework.Scenes
}
else
m_rootPart.UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, false);
}
}

View File

@ -304,6 +304,9 @@ namespace OpenSim.Region.Framework.Scenes
protected float m_friction = 0.6f; // wood
protected float m_bounce = 0.5f; // wood
protected bool m_isSelected = false;
/// <summary>
/// Stores media texture data
/// </summary>
@ -577,6 +580,16 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public bool IsSelected
{
get { return m_isSelected; }
set
{
m_isSelected = value;
if (ParentGroup != null)
ParentGroup.PartSelectChanged(value);
}
}
public Dictionary<int, string> CollisionFilter
@ -1907,6 +1920,7 @@ namespace OpenSim.Region.Framework.Scenes
dupe.m_rezzed = m_rezzed;
dupe.m_UndoRedo = null;
dupe.m_isSelected = false;
dupe.IgnoreUndoUpdate = false;
dupe.Undoing = false;