private Widget CreateAnimationsPane() { var pane = new ThemedScrollView { Padding = new Thickness { Right = 15, }, }; var list = new Widget { Layout = new VBoxLayout(), }; pane.Content.Layout = new VBoxLayout { Spacing = AttachmentMetrics.Spacing }; pane.Content.AddNode(list); var widgetFactory = new AttachmentWidgetFactory <Model3DAttachment.Animation>( w => new AnimationRow(w, attachment.Animations), attachment.Animations); widgetFactory.AddHeader(AnimationRow.CreateHeader()); widgetFactory.AddFooter(AnimationRow.CreateFooter(() => { attachment.Animations.Add(new Model3DAttachment.Animation { Name = "Animation", }); })); if (!attachment.Animations.Any(a => a.Name == Model3DAttachment.DefaultAnimationName)) { attachment.Animations.Insert(0, new Model3DAttachment.Animation { Name = Model3DAttachment.DefaultAnimationName, }); } list.Components.Add(widgetFactory); return(pane); }
private static Widget CreateAnimationsPane(Model3DAttachment attachment) { var pane = new ThemedScrollView { Padding = new Thickness { Right = 10 }, }; var list = new Widget { Layout = new VBoxLayout(), }; pane.Content.Layout = new VBoxLayout { Spacing = AttachmentMetrics.Spacing }; pane.Content.AddNode(list); var widgetFactory = new AttachmentWidgetFactory <Model3DAttachment.Animation>( w => new AnimationRow(w, attachment.Animations), attachment.Animations); widgetFactory.AddHeader(AnimationRow.CreateHeader()); widgetFactory.AddFooter(AnimationRow.CreateFooter(() => { history.DoTransaction(() => Core.Operations.InsertIntoList.Perform( attachment.Animations, attachment.Animations.Count, new Model3DAttachment.Animation { Name = "Animation", } )); })); if (attachment.Animations.All(a => a.Name != Model3DAttachment.DefaultAnimationName)) { attachment.Animations.Insert(0, new Model3DAttachment.Animation { Name = Model3DAttachment.DefaultAnimationName, }); } list.Components.Add(widgetFactory); return(pane); }