当前位置: 首页>>代码示例>>C#>>正文


C# SceneObjectGroup.RemoveScriptInstances方法代码示例

本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.RemoveScriptInstances方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.RemoveScriptInstances方法的具体用法?C# SceneObjectGroup.RemoveScriptInstances怎么用?C# SceneObjectGroup.RemoveScriptInstances使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Region.Framework.Scenes.SceneObjectGroup的用法示例。


在下文中一共展示了SceneObjectGroup.RemoveScriptInstances方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteSceneObject

            /// <summary>
            /// Synchronously delete the given object from the scene.
            /// </summary>
            /// <param name="group">Object Id</param>
            /// <param name="DeleteScripts">Remove the scripts from the ScriptEngine as well</param>
            /// <param name="removeFromDatabase">Remove from the database?</param>
            protected bool DeleteSceneObject(SceneObjectGroup group, bool DeleteScripts, bool removeFromDatabase)
            {
                //m_log.DebugFormat("[Backup]: Deleting scene object {0} {1}", group.Name, group.UUID);

                lock (group.RootPart.SitTargetAvatar)
                {
                    if (group.RootPart.SitTargetAvatar.Count != 0)
                    {
                        UUID[] ids = new UUID[group.RootPart.SitTargetAvatar.Count];
                        group.RootPart.SitTargetAvatar.CopyTo(ids);
                        foreach (UUID avID in ids)
                        {
                            IScenePresence SP = m_scene.GetScenePresence(avID);
                            if (SP != null)
                                SP.StandUp();
                        }
                    }
                }

                // Serialise calls to RemoveScriptInstances to avoid
                // deadlocking on m_parts inside SceneObjectGroup
                if (DeleteScripts)
                {
                    group.RemoveScriptInstances(true);
                }

                foreach (SceneObjectPart part in group.ChildrenList)
                {
                    if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
                    {
                        m_scene.PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
                    }
                    else if (part.PhysActor != null)
                    {
                        m_scene.PhysicsScene.RemovePrim(part.PhysActor);
                        part.PhysActor = null;
                    }
                }

                if (m_scene.SceneGraph.DeleteEntity(group))
                {
                    if(removeFromDatabase)
                        DeleteFromStorage(group.UUID);

                    // We need to keep track of this state in case this group is still queued for backup.
                    group.IsDeleted = true;
                    //Clear the update schedule HERE so that IsDeleted will not have to fire as well
                    lock (group.ChildrenListLock)
                    {
                        foreach (SceneObjectPart part in group.ChildrenList)
                        {
                            //Make sure it isn't going to be updated again
                            part.ClearUpdateSchedule();
                        }
                    }
                    m_scene.EventManager.TriggerObjectBeingRemovedFromScene(group);
                    return true;
                }

                //m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
                return false;
            }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:68,代码来源:Backup.cs

示例2: UpdateDetachedObject

        private void UpdateDetachedObject(IScenePresence sp, SceneObjectGroup so, string scriptedState)
        {
            // Don't save attachments for HG visitors, it
            // messes up their inventory. When a HG visitor logs
            // out on a foreign grid, their attachments will be
            // reloaded in the state they were in when they left
            // the home grid. This is best anyway as the visited
            // grid may use an incompatible script engine.
            bool saveChanged
                    = sp.PresenceType != PresenceType.Npc
                    && (m_scene.UserManagementModule == null
                    || m_scene.UserManagementModule.IsLocalGridUser(sp.UUID));

            // Remove the object from the scene so no more updates
            // are sent. Doing this before the below changes will ensure
            // updates can't cause "HUD artefacts"
            m_scene.DeleteSceneObject(so, false, false);

            // Prepare sog for storage
            so.AttachedAvatar = UUID.Zero;
            so.RootPart.SetParentLocalId(0);
            so.IsAttachment = false;

            if (saveChanged)
            {
                // We cannot use AbsolutePosition here because that would
                // attempt to cross the prim as it is detached
                so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; });

                UpdateKnownItem(sp, so, scriptedState);
            }

            // Now, remove the scripts
            so.RemoveScriptInstances(true);
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:35,代码来源:AttachmentsModule.cs

示例3: DeleteSceneObject

        /// <summary>
        /// Synchronously delete the given object from the scene.
        /// </summary>
        /// <param name="group">Object Id</param>
        /// <param name="silent">Suppress broadcasting changes to other clients.</param>
        /// <param name="removeScripts">If true, then scripts are removed.  If false, then they are only stopped.</para>
        public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts)
        {            
//            m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);

            if (removeScripts)
                group.RemoveScriptInstances(true);
            else
                group.StopScriptInstances();

            SceneObjectPart[] partList = group.Parts;

            foreach (SceneObjectPart part in partList)
            {
                if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
                {
                    PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
                }
                else if (part.PhysActor != null)
                {
                    part.RemoveFromPhysics();
                }
            }

            if (UnlinkSceneObject(group, false))
            {
                EventManager.TriggerObjectBeingRemovedFromScene(group);
                EventManager.TriggerParcelPrimCountTainted();
            }

            group.DeleteGroupFromScene(silent);

//            m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);            
        }
开发者ID:CCIR,项目名称:opensim,代码行数:39,代码来源:Scene.cs

示例4: DeleteSceneObject

        /// <summary>
        /// Synchronously delete the given object from the scene.
        /// </summary>
        /// <param name="group">Object Id</param>
        /// <param name="silent">Suppress broadcasting changes to other clients.</param>
        public void DeleteSceneObject(SceneObjectGroup group, bool silent)
        {
            //SceneObjectPart rootPart = group.GetChildPart(group.UUID);

            // Serialise calls to RemoveScriptInstances to avoid
            // deadlocking on m_parts inside SceneObjectGroup
            lock (m_deleting_scene_object)
            {
                group.RemoveScriptInstances();
            }

            foreach (SceneObjectPart part in group.Children.Values)
            {
                if (part.IsJoint() && ((part.ObjectFlags&(uint)PrimFlags.Physics) != 0))
                {
                    PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
                }
                else if (part.PhysActor != null)
                {
                    PhysicsScene.RemovePrim(part.PhysActor);
                    part.PhysActor = null;
                }
            }
//            if (rootPart.PhysActor != null)
//            {
//                PhysicsScene.RemovePrim(rootPart.PhysActor);
//                rootPart.PhysActor = null;
//            }

            if (UnlinkSceneObject(group.UUID, false))
            {
                EventManager.TriggerObjectBeingRemovedFromScene(group);
                EventManager.TriggerParcelPrimCountTainted();
            }

            group.DeleteGroup(silent);
        }
开发者ID:Ideia-Boa,项目名称:opensim,代码行数:42,代码来源:Scene.cs

示例5: DeleteSceneObject

        /// <summary>
        /// Synchronously delete the given object from the scene.
        /// </summary>
        /// <param name="group">Object Id</param>
        /// <param name="silent">Suppress broadcasting changes to other clients.</param>
        public void DeleteSceneObject(SceneObjectGroup group, bool silent)
        {
            //            m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);

            //SceneObjectPart rootPart = group.GetChildPart(group.UUID);

            // Serialise calls to RemoveScriptInstances to avoid
            // deadlocking on m_parts inside SceneObjectGroup
            lock (m_deleting_scene_object)
            {
                group.RemoveScriptInstances(true);
            }

            SceneObjectPart[] partList = group.Parts;

            if (group.RootPart.PhysActor != null)
                group.RootPart.PhysActor.Building = true;

            foreach (SceneObjectPart part in partList)
            {
                if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
                {
                    PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
                }
                else if (part.PhysActor != null)
                {
                    part.RemoveFromPhysics();
                }
            }

            //            if (rootPart.PhysActor != null)
            //            {
            //                PhysicsScene.RemovePrim(rootPart.PhysActor);
            //                rootPart.PhysActor = null;
            //            }

            if (UnlinkSceneObject(group, false))
            {
                EventManager.TriggerObjectBeingRemovedFromScene(group);
                EventManager.TriggerParcelPrimCountTainted();
            }

            group.DeleteGroupFromScene(silent);

            //            m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);            
        }
开发者ID:UbitUmarov,项目名称:Ubit-opensim,代码行数:51,代码来源:Scene.cs

示例6: DeleteSceneObject

        /// <summary>
        /// Synchronously delete the given object from the scene.
        /// </summary>
        /// <param name="group">Object Id</param>
        /// <param name="silent">Suppress broadcasting changes to other clients.</param>
        /// <param name="removeScripts">If true, then scripts are removed.  If false, then they are only stopped.</para>
        public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts)
        {
            // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);

            if (removeScripts)
                group.RemoveScriptInstances(true);
            else
                group.StopScriptInstances();

            List<ScenePresence> avatars = group.GetSittingAvatars();
            foreach (ScenePresence av in avatars)
            {
                if(av.ParentUUID == UUID.Zero)
                    av.StandUp();
            }

            SceneObjectPart[] partList = group.Parts;

            foreach (SceneObjectPart part in partList)
            {
                if (part.KeyframeMotion != null)
                {
                    part.KeyframeMotion.Delete();
                    part.KeyframeMotion = null;
                }

                if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
                {
                    PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
                }
                else if (part.PhysActor != null)
                {
                    part.RemoveFromPhysics();
                }
            }

            if (UnlinkSceneObject(group, false))
            {
                EventManager.TriggerObjectBeingRemovedFromScene(group);
                EventManager.TriggerParcelPrimCountTainted();
            }

            group.DeleteGroupFromScene(silent);

            // use this to mean also full delete
            if (removeScripts)
                group.Clear();
            partList = null;
            // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);          
        }
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:56,代码来源:Scene.cs

示例7: CrossAsync


//.........这里部分代码省略.........
                if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason))
                {
                    return sog;
                }
                m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName);
            }

            // We unparent the SP quietly so that it won't
            // be made to stand up

            List<avtocrossInfo> avsToCross = new List<avtocrossInfo>();

            foreach (ScenePresence av in sog.m_sittingAvatars)
            {
                byte cflags = 1;

                avtocrossInfo avinfo = new avtocrossInfo();
                SceneObjectPart parentPart = sogScene.GetSceneObjectPart(av.ParentID);
                if (parentPart != null)
                {
                    av.ParentUUID = parentPart.UUID;
                    if(parentPart.SitTargetAvatar == av.UUID)
                        cflags = 7; // low 3 bits set
                    else
                        cflags = 3;
                }

                // 1 is crossing
                // 2 is sitting
                // 4 is sitting at sittarget
                av.crossingFlags = cflags;

                avinfo.av = av;
                avinfo.ParentID = av.ParentID;
                avsToCross.Add(avinfo);

                av.PrevSitOffset = av.OffsetPosition;
                av.ParentID = 0;
            }

            if (entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, false))
            {
                foreach (avtocrossInfo avinfo in avsToCross)
                {
                    ScenePresence av = avinfo.av;
                    if (!av.IsInTransit) // just in case...
                    {
                        m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);

                        av.IsInTransit = true;

//                        CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
//                        d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d);
                        entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, av.Flying, ctx);
                        if (av.IsChildAgent)
                        {
                            // avatar crossed do some extra cleanup
                            if (av.ParentUUID != UUID.Zero)
                            {
                                av.ClearControls();
                                av.ParentPart = null;
                            }
                        }
                        else
                        {
                            // avatar cross failed we need do dedicated standUp
                            // part of it was done at CrossAgentToNewRegionAsync
                            // so for now just remove the sog controls
                            // this may need extra care 
                            av.UnRegisterSeatControls(sog.UUID);
                        }

                        av.ParentUUID = UUID.Zero;
                        // In any case
                        av.IsInTransit = false;
                        av.crossingFlags = 0;
                        m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname);
                    }
                    else
                        m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar already in transit {0} to {1}", av.Name, val);
                }
                avsToCross.Clear();
                sog.RemoveScriptInstances(true);
                sog.Clear();
                return sog;
            }
            else // cross failed, put avas back ??
            {
                foreach (avtocrossInfo avinfo in avsToCross)
                {
                    ScenePresence av = avinfo.av;
                    av.ParentUUID = UUID.Zero;
                    av.ParentID = avinfo.ParentID;
                    av.crossingFlags = 0;
                }
            }
            avsToCross.Clear();

            return sog;
        }
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:101,代码来源:SceneObjectGroup.cs

示例8: DetachSingleAttachmentToInv

        public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so)
        {
            if (so.AttachedAvatar != sp.UUID)
            {
                m_log.WarnFormat(
                    "[ATTACHMENTS MODULE]: Tried to detach object {0} from {1} {2} but attached avatar id was {3} in {4}",
                    so.Name, sp.Name, sp.UUID, so.AttachedAvatar, m_scene.RegionInfo.RegionName);

                return;
            }

            // If this didn't come from inventory, it also shouldn't go there
            // on detach. It's likely a temp attachment.
            if (so.FromItemID == UUID.Zero)
            {
                // Retirn value is ignored
                PrepareScriptInstanceForSave(so, true);

                lock (sp.AttachmentsSyncLock)
                {
                    bool changed = sp.Appearance.DetachAttachment(so.FromItemID);
                    if (changed && m_scene.AvatarFactory != null)
                        m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);

                    sp.RemoveAttachment(so);
                }

                m_scene.DeleteSceneObject(so, false, false);
                so.RemoveScriptInstances(true);
                so.Clear();

                return;
            }

            if (DebugLevel > 0)
                m_log.DebugFormat(
                    "[ATTACHMENTS MODULE]: Detaching object {0} {1} (FromItemID {2}) for {3} in {4}", 
                    so.Name, so.LocalId, so.FromItemID, sp.Name, m_scene.Name);

            // Scripts MUST be snapshotted before the object is
            // removed from the scene because doing otherwise will
            // clobber the run flag
            // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from
            // scripts performing attachment operations at the same time.  Getting object states stops the scripts.
            string scriptedState = PrepareScriptInstanceForSave(so, true);

            lock (sp.AttachmentsSyncLock)
            {
                // Save avatar attachment information
//                m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID);

                bool changed = sp.Appearance.DetachAttachment(so.FromItemID);
                if (changed && m_scene.AvatarFactory != null)
                    m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);

                sp.RemoveAttachment(so);
                UpdateDetachedObject(sp, so, scriptedState);
            }
        }
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:59,代码来源:AttachmentsModule.cs

示例9: DeleteSceneObject

        /// <summary>
        /// Synchronously delete the given object from the scene.
        /// </summary>
        /// <param name="group">Object Id</param>
        /// <param name="silent">Suppress broadcasting changes to other clients.</param>
        public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool DeleteScripts)
        {
//            m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);

            //SceneObjectPart rootPart = group.GetChildPart(group.UUID);

            // Serialise calls to RemoveScriptInstances to avoid
            // deadlocking on m_parts inside SceneObjectGroup
            lock (group.RootPart.SitTargetAvatar)
            {
                if (group.RootPart.SitTargetAvatar.Count != 0)
                {
                    foreach (UUID avID in group.RootPart.SitTargetAvatar)
                    {
                        ScenePresence SP = GetScenePresence(avID);
                        if (SP != null)
                            SP.StandUp();
                    }
                }
            }

            if (DeleteScripts)
            {
                lock (m_deleting_scene_object)
                {
                    group.RemoveScriptInstances(true);
                }
            }
            foreach (SceneObjectPart part in group.ChildrenList)
            {
                if (part.IsJoint() && ((part.ObjectFlags&(uint)PrimFlags.Physics) != 0))
                {
                    PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
                }
                else if (part.PhysActor != null)
                {
                    PhysicsScene.RemovePrim(part.PhysActor);
                    part.PhysActor = null;
                }
            }

            if (UnlinkSceneObject(group, false))
            {
                EventManager.TriggerObjectBeingRemovedFromScene(group);
                EventManager.TriggerParcelPrimCountTainted();
            }

            group.DeleteGroup(silent);

            //m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:56,代码来源:Scene.cs

示例10: DeleteSceneObject

            /// <summary>
            /// Synchronously delete the given object from the scene.
            /// </summary>
            /// <param name="group">Object Id</param>
            /// <param name="DeleteScripts">Remove the scripts from the ScriptEngine as well</param>
            /// <param name="removeFromDatabase">Remove from the database?</param>
            protected bool DeleteSceneObject(SceneObjectGroup group, bool DeleteScripts, bool removeFromDatabase)
            {
                //m_log.DebugFormat("[Backup]: Deleting scene object {0} {1}", group.Name, group.UUID);

                lock (group.RootPart.SitTargetAvatar)
                {
                    if (group.RootPart.SitTargetAvatar.Count != 0)
                    {
                        UUID[] ids = new UUID[group.RootPart.SitTargetAvatar.Count];
                        group.RootPart.SitTargetAvatar.CopyTo(ids);
                        foreach (UUID avID in ids)
                        {
                            //Don't screw up avatar's that are sitting on us!
                            IScenePresence SP = m_scene.GetScenePresence(avID);
                            if (SP != null)
                                SP.StandUp();
                        }
                    }
                }

                // Serialise calls to RemoveScriptInstances to avoid
                // deadlocking on m_parts inside SceneObjectGroup
                if (DeleteScripts)
                {
                    group.RemoveScriptInstances(true);
                }

                foreach (SceneObjectPart part in group.ChildrenList)
                {
                    if (part.PhysActor != null)
                    {
                        //Remove us from the physics sim
                        m_scene.PhysicsScene.RemovePrim(part.PhysActor);
                        //We MUST leave this to the PhysicsScene or it will hate us forever!
                        //part.PhysActor = null;
                    }
                }

                m_scene.SimulationDataService.Tainted ();
                if (m_scene.SceneGraph.DeleteEntity(group))
                {
                    // We need to keep track of this state in case this group is still queued for backup.
                    group.IsDeleted = true;
                    //Clear the update schedule HERE so that IsDeleted will not have to fire as well
                    
                    foreach (SceneObjectPart part in group.ChildrenList)
                    {
                        //Make sure it isn't going to be updated again
                        part.ClearUpdateSchedule ();
                    }
                    m_scene.EventManager.TriggerObjectBeingRemovedFromScene(group);
                    return true;
                }

                //m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
                return false;
            }
开发者ID:RevolutionSmythe,项目名称:Aurora-Sim,代码行数:63,代码来源:Backup.cs


注:本文中的OpenSim.Region.Framework.Scenes.SceneObjectGroup.RemoveScriptInstances方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。