Esempio n. 1
0
        public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient)
        {
            List <EntityBase> EntityList = GetEntities();

            foreach (EntityBase ent in EntityList)
            {
                if (ent is SceneObjectGroup)
                {
                    SceneObjectGroup obj = ent as SceneObjectGroup;

                    // Is this prim part of the group
                    if (obj.HasChildPrim(localID))
                    {
                        SceneObjectPart part = obj.GetChildPart(localID);
                        if (part != null)
                        {
                            // If the touched prim handles touches, deliver it
                            // If not, deliver to root prim
                            if ((part.ScriptEvents & scriptEvents.touch_end) != 0)
                            {
                                EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient);
                            }
                            else
                            {
                                EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient);
                            }

                            return;
                        }
                        return;
                    }
                }
            }
        }
Esempio n. 2
0
        public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List <SurfaceTouchEventArgs> surfaceArgs)
        {
            List <EntityBase> EntityList = GetEntities();

            SurfaceTouchEventArgs surfaceArg = null;

            if (surfaceArgs != null && surfaceArgs.Count > 0)
            {
                surfaceArg = surfaceArgs[0];
            }

            foreach (EntityBase ent in EntityList)
            {
                if (ent is SceneObjectGroup)
                {
                    SceneObjectGroup obj = ent as SceneObjectGroup;
                    if (obj != null)
                    {
                        // Is this prim part of the group
                        if (obj.HasChildPrim(localID))
                        {
                            // Currently only grab/touch for the single prim
                            // the client handles rez correctly
                            obj.ObjectGrabHandler(localID, offsetPos, remoteClient);

                            SceneObjectPart part = obj.GetChildPart(localID);

                            // If the touched prim handles touches, deliver it
                            // If not, deliver to root prim
                            if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
                            {
                                EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
                            }
                            // Deliver to the root prim if the touched prim doesn't handle touches
                            // or if we're meant to pass on touches anyway. Don't send to root prim
                            // if prim touched is the root prim as we just did it
                            if (((part.ScriptEvents & scriptEvents.touch_start) == 0) ||
                                (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
                            {
                                EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
                            }

                            return;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List <SurfaceTouchEventArgs> surfaceArgs)
        {
            SurfaceTouchEventArgs surfaceArg = null;

            if (surfaceArgs != null && surfaceArgs.Count > 0)
            {
                surfaceArg = surfaceArgs[0];
            }

            SceneObjectGroup obj = this.GetGroupByPrim(localID);

            if (obj != null)
            {
                // Is this prim part of the group
                if (obj.HasChildPrim(localID))
                {
                    // Currently only grab/touch for the single prim
                    // the client handles rez correctly
                    obj.ObjectGrabHandler(localID, offsetPos, remoteClient);

                    SceneObjectPart part = obj.GetChildPart(localID);

                    int touchEvents = ((int)ScriptEvents.touch_start | (int)ScriptEvents.touch | (int)ScriptEvents.touch_end);

                    bool hasTouchEvent = (((int)part.ScriptEvents & touchEvents) != 0);

                    // If the touched prim handles touches, deliver it
                    if (hasTouchEvent)
                    {
                        EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
                    }

                    // If not, or if PassTouches and we haven't just delivered it to the root prim, deliver it there
                    if ((!hasTouchEvent) || (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
                    {
                        EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
                    }
                }
            }
        }
Esempio n. 4
0
        public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List <SurfaceTouchEventArgs> surfaceArgs)
        {
            SurfaceTouchEventArgs surfaceArg = null;

            if (surfaceArgs != null && surfaceArgs.Count > 0)
            {
                surfaceArg = surfaceArgs[0];
            }

            SceneObjectGroup obj = this.GetGroupByPrim(localID);

            // Is this prim part of the group
            if (obj != null && obj.HasChildPrim(localID))
            {
                SceneObjectPart  part  = obj.GetChildPart(localID);
                SceneObjectGroup group = part.ParentGroup;
                if (part != null)
                {
                    // If the touched prim handles touches, deliver it
                    // If not, deliver to root prim
                    ScriptEvents eventsThatNeedDegrab = (ScriptEvents.touch_end | ScriptEvents.touch);

                    if ((part.ScriptEvents & eventsThatNeedDegrab) != 0)
                    {
                        EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg);
                    }
                    else if ((group.RootPart.ScriptEvents & eventsThatNeedDegrab) != 0)
                    {
                        EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg);
                    }

                    // Always send an object degrab.
                    m_sceneGraph.DegrabObject(localID, remoteClient, surfaceArgs);

                    return;
                }
                return;
            }
        }