public void CopyAttachments(AgentData ad, IScenePresence sp) { if (ad.AttachmentObjects != null && ad.AttachmentObjects.Count > 0) { lock (sp.AttachmentsSyncLock) sp.ClearAttachments(); int i = 0; foreach (ISceneObject so in ad.AttachmentObjects) { ((SceneObjectGroup)so).LocalId = 0; ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule(); so.SetState(ad.AttachmentObjectStates[i++], m_scene); m_scene.IncomingCreateObject(Vector3.Zero, so); } } }
public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) { // m_log.DebugFormat( // "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", // m_scene.RegionInfo.RegionName, sp.Name, silent); if (!Enabled) { return; } foreach (SceneObjectGroup sop in sp.GetAttachments()) { sop.Scene.DeleteSceneObject(sop, silent); } sp.ClearAttachments(); }
public void DeRezAttachments(IScenePresence sp) { if (!Enabled) { return; } // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); lock (sp.AttachmentsSyncLock) { foreach (SceneObjectGroup so in sp.GetAttachments()) { UpdateDetachedObject(sp, so); } sp.ClearAttachments(); } }
public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) { if (!Enabled) return; if (DebugLevel > 0) m_log.DebugFormat( "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", m_scene.RegionInfo.RegionName, sp.Name, silent); foreach (SceneObjectGroup sop in sp.GetAttachments()) { sop.Scene.DeleteSceneObject(sop, silent); } sp.ClearAttachments(); }
public void DeRezAttachments(IScenePresence sp) { if (!Enabled) return; if (DebugLevel > 0) m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); List<SceneObjectGroup> attachments = sp.GetAttachments(); if (attachments.Count <= 0) return; Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>(); foreach (SceneObjectGroup so in attachments) { // 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. scriptStates[so] = PrepareScriptInstanceForSave(so, false); } lock (sp.AttachmentsSyncLock) { foreach (SceneObjectGroup so in attachments) UpdateDetachedObject(sp, so, scriptStates[so]); sp.ClearAttachments(); } }
public void DeRezAttachments(IScenePresence sp) { if (!Enabled) return; // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); lock (sp.AttachmentsSyncLock) { foreach (SceneObjectGroup so in sp.GetAttachments()) { UpdateDetachedObject(sp, so); } sp.ClearAttachments(); } }
public void CopyAttachments(AgentData ad, IScenePresence sp) { // m_log.DebugFormat("[ATTACHMENTS MODULE]: Copying attachment data into {0} in {1}", sp.Name, m_scene.Name); if (ad.AttachmentObjects != null && ad.AttachmentObjects.Count > 0) { lock (sp.AttachmentsSyncLock) sp.ClearAttachments(); int i = 0; foreach (ISceneObject so in ad.AttachmentObjects) { ((SceneObjectGroup)so).LocalId = 0; ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule(); // m_log.DebugFormat( // "[ATTACHMENTS MODULE]: Copying script state with {0} bytes for object {1} for {2} in {3}", // ad.AttachmentObjectStates[i].Length, so.Name, sp.Name, m_scene.Name); so.SetState(ad.AttachmentObjectStates[i++], m_scene); m_scene.IncomingCreateObject(Vector3.Zero, so); } } }
public void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted) { if (!Enabled) return; // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); lock (sp.AttachmentsSyncLock) { foreach (SceneObjectGroup grp in sp.GetAttachments()) { grp.Scene.DeleteSceneObject(grp, false); if (saveChanged || saveAllScripted) { grp.IsAttachment = false; grp.AbsolutePosition = grp.RootPart.AttachedPos; UpdateKnownItem(sp, grp, saveAllScripted); } } sp.ClearAttachments(); } }