/// <summary> /// Invoked when the client selects a prim. /// </summary> /// <param name="primLocalID"></param> /// <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); sog.IsSelected = true; // 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)) { EventManager.TriggerParcelPrimCountTainted(); } } else { part.SendPropertiesToClient(remoteClient); } }
/// <summary> /// Invoked when the client selects a prim. /// </summary> /// <param name="primLocalID"></param> /// <param name="remoteClient"></param> public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { SceneObjectGroup group = m_sceneGraph.GetGroupByPrim(primLocalID); if (group == null) { return; } if (group.LocalId == primLocalID) { group.GetProperties(remoteClient); group.IsSelected = true; // A prim is only tainted if it's allowed to be edited by the person clicking it. if (Permissions.CanEditObject(group.UUID, remoteClient.AgentId, 0) || Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) { EventManager.TriggerParcelPrimCountTainted(); } } else { //it's one of the child prims SceneObjectPart part = group.GetChildPart(primLocalID); part.GetProperties(remoteClient); } }
/// <summary> /// Handle the deselection of a prim from the client. /// </summary> /// <param name="primLocalID"></param> /// <param name="remoteClient"></param> public void DeselectPrim(uint primLocalID, IClientAPI remoteClient) { SceneObjectPart part = GetSceneObjectPart(primLocalID); if (part == null) { return; } 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(); } // restore targetOmega if (part.AngularVelocity != Vector3.Zero) { part.ScheduleTerseUpdate(); } } }
/// <summary> /// Invoked when the client selects a prim. /// </summary> /// <param name="primLocalID"></param> /// <param name="remoteClient"></param> public void SelectPrim(List <uint> primIDs, IClientAPI remoteClient) { foreach (uint primLocalID in primIDs) { SceneObjectPart part = GetSceneObjectPart(primLocalID); if (part == null) { continue; } SceneObjectGroup sog = part.ParentGroup; if (sog == null) { continue; } // waste of time because properties do not send prim flags as they should // if a friend got or lost edit rights after login, a full update is needed if (sog.OwnerID != remoteClient.AgentId) { part.SendFullUpdate(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.IsSelected = true; EventManager.TriggerParcelPrimCountTainted(); } part.SendPropertiesToClient(remoteClient); } }
public virtual void ProcessObjectGrabUpdate( UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List <SurfaceTouchEventArgs> surfaceArgs) { SceneObjectPart part = GetSceneObjectPart(objectID); if (part == null) { return; } SceneObjectGroup group = part.ParentGroup; if (group == null || group.IsDeleted) { return; } if (Permissions.CanMoveObject(group, remoteClient)) { group.GrabMovement(objectID, offset, pos, remoteClient); } // This is outside the above permissions condition // so that if the object is locked the client moving the object // get's it's position on the simulator even if it was the same as before // This keeps the moving user's client in sync with the rest of the world. group.SendGroupTerseUpdate(); SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) { surfaceArg = surfaceArgs[0]; } Vector3 grabOffset = pos - part.AbsolutePosition; // If the touched prim handles touches, deliver it uint partLocalId = part.LocalId; if ((part.ScriptEvents & scriptEvents.touch) != 0) { EventManager.TriggerObjectGrabbing(partLocalId, 0, grabOffset, remoteClient, surfaceArg); if (!part.PassTouches) { return; } } uint rootLocalId = group.RootPart.LocalId; // Deliver to the root prim if the touched prim doesn't handle touches // or if we're meant to pass on touches anyway. if (partLocalId != rootLocalId && (group.RootPart.ScriptEvents & scriptEvents.touch) != 0) { EventManager.TriggerObjectGrabbing(rootLocalId, partLocalId, grabOffset, remoteClient, surfaceArg); } }
/// <summary> /// Invoked when the client selects a prim. /// </summary> /// <param name="primLocalID"></param> /// <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; } SceneObjectGroup sog = part.ParentGroup; if (sog == null) { return; } part.SendPropertiesToClient(remoteClient); // waste of time because properties do not send prim flags as they should // if a friend got or lost edit rights after login, a full update is needed if (sog.OwnerID != remoteClient.AgentId) { part.SendFullUpdate(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.IsSelected = true; EventManager.TriggerParcelPrimCountTainted(); } }
/// <summary> /// Handle the deselection of a prim from the client. /// </summary> /// <param name="primLocalID"></param> /// <param name="remoteClient"></param> public void DeselectPrim(uint primLocalID, IClientAPI remoteClient) { SceneObjectPart part = GetSceneObjectPart(primLocalID); if (part == null) { return; } // The prim is in the process of being deleted. if (null == part.ParentGroup.RootPart) { 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 if (part.ParentGroup.RootPart.LocalId != part.LocalId) { return; } bool isAttachment = false; // This is wrong, wrong, wrong. Selection should not be // handled by group, but by prim. Legacy cruft. // TODO: Make selection flagging per prim! // part.ParentGroup.IsSelected = false; if (part.ParentGroup.IsAttachment) { isAttachment = true; } else { part.ParentGroup.ScheduleGroupForFullUpdate(); } // If it's not an attachment, and we are allowed to move it, // then we might have done so. If we moved across a parcel // boundary, we will need to recount prims on the parcels. // For attachments, that makes no sense. // if (!isAttachment) { if (Permissions.CanEditObject( part.UUID, remoteClient.AgentId) || Permissions.CanMoveObject( part.UUID, remoteClient.AgentId)) { EventManager.TriggerParcelPrimCountTainted(); } } }
/// <summary> /// Start spinning the given object /// </summary> /// <param name="objectID"></param> /// <param name="rotation"></param> /// <param name="remoteClient"></param> public virtual void ProcessSpinStart(UUID objectID, IClientAPI remoteClient) { SceneObjectGroup group = GetGroupByPrim(objectID); if (group != null) { if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.) { group.SpinStart(remoteClient); } } }
/// <summary> /// Spin the given object /// </summary> /// <param name="objectID"></param> /// <param name="rotation"></param> /// <param name="remoteClient"></param> public virtual void ProcessSpinObject(UUID objectID, Quaternion rotation, IClientAPI remoteClient) { SceneObjectGroup group = GetGroupByPrim(objectID); if (group != null) { if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.) { group.SpinMovement(rotation, remoteClient); } // This is outside the above permissions condition // so that if the object is locked the client moving the object // get's it's position on the simulator even if it was the same as before // This keeps the moving user's client in sync with the rest of the world. group.SendGroupTerseUpdate(); } }
/// <summary> /// Invoked when the client selects a prim. /// </summary> /// <param name="primLocalID"></param> /// <param name="remoteClient"></param> public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { EntityBase[] entityList = GetEntities(); foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { if (((SceneObjectGroup)ent).LocalId == primLocalID) { ((SceneObjectGroup)ent).GetProperties(remoteClient); ((SceneObjectGroup)ent).IsSelected = true; // A prim is only tainted if it's allowed to be edited by the person clicking it. if (Permissions.CanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) || Permissions.CanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) { EventManager.TriggerParcelPrimCountTainted(); } break; } else { // We also need to check the children of this prim as they // can be selected as well and send property information bool foundPrim = false; SceneObjectGroup sog = ent as SceneObjectGroup; SceneObjectPart[] partList = sog.Parts; foreach (SceneObjectPart part in partList) { if (part.LocalId == primLocalID) { part.GetProperties(remoteClient); foundPrim = true; break; } } if (foundPrim) { break; } } } } }
/// <summary> /// Handle the deselection of a prim from the client. /// </summary> /// <param name="primLocalID"></param> /// <param name="remoteClient"></param> public void DeselectPrim(uint primLocalID, IClientAPI remoteClient) { 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 * if (part.ParentGroup.RootPart.LocalId != part.LocalId) * return; * * // 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.ParentGroup.IsSelected = false; || || part.ParentGroup.ScheduleGroupForFullUpdate(); || || // If it's not an attachment, and we are allowed to move it, || // then we might have done so. If we moved across a parcel || // boundary, we will need to recount prims on the parcels. || // For attachments, that makes no sense. || // || if (!part.ParentGroup.IsAttachment) || { || if (Permissions.CanEditObject( || part.UUID, remoteClient.AgentId) || Permissions.CanMoveObject( || 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(); } // restore targetOmega if (part.AngularVelocity != Vector3.Zero) { part.ScheduleTerseUpdate(); } } }