public M2Array <M2Attachment> GetAttachments() { M2Array <M2Attachment> attachments = new M2Array <M2Attachment>(); if (!_model.Has <ATCH>()) { return(attachments); } foreach (var a in _model.Get <ATCH>()) { M2Attachment attach = new M2Attachment() { Id = (uint)a.AttachmentId, Position = _model.Get <PIVT>().ElementAt(a.ObjectId).ToC3Vector, Bone = (uint)a.ParentId, }; attach.AnimateAttached.Timestamps.Add(new M2Array <uint>() { 0 }); attach.AnimateAttached.Values.Add(new M2Array <bool>() { true }); attachments.Add(attach); } return(attachments); }
private void attachment_PropertyChanged(object sender, PropertyChangedEventArgs e) { M2Attachment g = sender as M2Attachment; if (e.PropertyName == "Visible") { M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode; if (node != null) { node.ShowAttachment(g.Index, g.Visible); } } }
public void Update() { M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode; Attachments.Clear(); if (node == null) { return; } int num = (int)node.FileM2.numAttachments; for (int i = 0; i < num; ++i) { M2Attachment a = new M2Attachment(i, node.IsAttachmentShow(i)); Attachments.Add(a); a.PropertyChanged += new PropertyChangedEventHandler(attachment_PropertyChanged); } attachmentsView = CollectionViewSource.GetDefaultView(Attachments); }