Пример #1
0
        private Widget CreateMeshOptionsPane()
        {
            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.MeshOption>(
                w => new MeshRow(w, attachment.MeshOptions), attachment.MeshOptions);

            widgetFactory.AddHeader(MeshRow.CreateHeader());
            widgetFactory.AddFooter(MeshRow.CreateFooter(() => {
                attachment.MeshOptions.Add(new Model3DAttachment.MeshOption {
                    Id = "MeshOption",
                });
            }));
            list.Components.Add(widgetFactory);
            return(pane);
        }
Пример #2
0
        private Widget CreateMaterialEffectsPane()
        {
            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.MaterialEffect>(
                w => new MaterialEffectRow(w, attachment.MaterialEffects), attachment.MaterialEffects);

            widgetFactory.AddHeader(MaterialEffectRow.CreateHeader());
            widgetFactory.AddFooter(DeletableRow <Model3DAttachment.MaterialEffect> .CreateFooter(() => {
                attachment.MaterialEffects.Add(new Model3DAttachment.MaterialEffect {
                    Name         = "MaterialEffect",
                    MaterialName = "MaterialName",
                    Path         = "MaterialPath",
                });
            }));
            list.Components.Add(widgetFactory);
            return(pane);
        }
Пример #3
0
        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);
        }
Пример #4
0
            private static void BuildList(ObservableCollection <Lime.NodeComponent> source, Widget container)
            {
                var list = new Widget {
                    Layout = new VBoxLayout {
                        Spacing = 5
                    },
                    Padding = new Thickness {
                        Top = AttachmentMetrics.Spacing
                    },
                };

                container.AddNode(list);
                var validComponents = Project.Current.RegisteredComponentTypes
                                      .Where(t => NodeCompositionValidator.ValidateComponentType(typeof(Node3D), t)).ToList();
                var widgetFactory = new AttachmentWidgetFactory <NodeComponent>(w => new NodeComponentRow(w, source), source);
                var footer        = DeletableRow <NodeComponentRow> .CreateFooter(() => {
                    var menu = new Menu();
                    foreach (var type in validComponents.Except(GetExceptedTypes(source)))
                    {
                        ICommand command = new Command(CamelCaseToLabel(type.Name), () => {
                            var constructor = type.GetConstructor(Type.EmptyTypes);
                            history.DoTransaction(() => Core.Operations.InsertIntoList.Perform(
                                                      source, source.Count, constructor.Invoke(new object[] { })));
                        });
                        menu.Add(command);
                    }
                    menu.Popup();
                });

                footer.AddChangeWatcher(() => validComponents.Except(GetExceptedTypes(source)).Any(), any => footer.Visible = any);
                widgetFactory.AddFooter(footer);
                list.Components.Add(widgetFactory);
            }
Пример #5
0
        private static Widget CreateMaterialEffectsPane(Model3DAttachment attachment)
        {
            var pane = new ThemedScrollView();

            pane.Content.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.MaterialEffect>(
                w => new MaterialEffectRow(w, attachment.MaterialEffects), attachment.MaterialEffects);

            widgetFactory.AddHeader(MaterialEffectRow.CreateHeader());
            widgetFactory.AddFooter(DeletableRow <Model3DAttachment.MaterialEffect> .CreateFooter(() => {
                history.DoTransaction(() => {
                    Core.Operations.InsertIntoList.Perform(
                        attachment.MaterialEffects,
                        attachment.MaterialEffects.Count,
                        new Model3DAttachment.MaterialEffect {
                        Name         = "MaterialEffect",
                        MaterialName = "MaterialName",
                        Path         = "MaterialPath",
                    }
                        );
                });
            }));
            list.Components.Add(widgetFactory);
            return(pane);
        }
Пример #6
0
        private static Widget CreateMeshOptionsPane(Model3DAttachment attachment)
        {
            var pane = new ThemedScrollView();

            pane.Content.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.MeshOption>(
                w => new MeshRow(w, attachment.MeshOptions), attachment.MeshOptions);

            widgetFactory.AddHeader(MeshRow.CreateHeader());
            widgetFactory.AddFooter(MeshRow.CreateFooter(() => {
                history.DoTransaction(() => Core.Operations.InsertIntoList.Perform(
                                          attachment.MeshOptions,
                                          attachment.MeshOptions.Count,
                                          new Model3DAttachment.MeshOption {
                    Id = "MeshOption"
                }
                                          ));
            }));
            list.Components.Add(widgetFactory);
            return(pane);
        }
Пример #7
0
            private void BuildList <TData, TRow>(ObservableCollection <TData> source, Widget container, string title, Func <TData> activator, Widget header) where TRow : DeletableRow <TData>
            {
                ThemedExpandButton markersExpandButton;

                container.AddNode(new Widget {
                    Layout = new HBoxLayout {
                        Spacing = AttachmentMetrics.Spacing
                    },
                    Nodes =
                    {
                        (markersExpandButton = new ThemedExpandButton {
                            MinMaxSize       = new Vector2(AttachmentMetrics.ExpandButtonSize)
                        }),
                        new ThemedSimpleText {
                            Text             = title
                        },
                    }
                });
                var list = new Widget {
                    Layout  = new VBoxLayout(),
                    Padding = new Thickness {
                        Left = AttachmentMetrics.ExpandContentPadding,
                        Top  = AttachmentMetrics.Spacing
                    },
                };

                container.AddNode(list);
                var widgetFactory = new AttachmentWidgetFactory <TData>(
                    w => (TRow)Activator.CreateInstance(typeof(TRow), new object[] { w, source }), source);

                widgetFactory.AddHeader(header);
                widgetFactory.AddFooter(DeletableRow <TData> .CreateFooter(() => {
                    source.Add(activator());
                }));
                list.Components.Add(widgetFactory);
                this.AddChangeWatcher(() => markersExpandButton.Expanded, (e) => list.Visible = e);
            }
Пример #8
0
        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);
        }