private void RenderTransparentWidgetPivots(Widget canvas)
        {
            if (
                Core.Document.Current.ExpositionMode ||
                Core.Document.Current.PreviewAnimation
                )
            {
                return;
            }
            canvas.PrepareRendererState();
            var widgets = Core.Document.Current.Container.Nodes.Editable().
                          OfType <Widget>().Where(w => w.Color.A == 0).ToList();

            if (widgets.Count == 0)
            {
                return;
            }
            var iconSize = new Vector2(16, 16);

            foreach (var widget in widgets)
            {
                var t = NodeIconPool.GetTexture(widget.GetType());
                var p = widget.CalcPositionInSpaceOf(canvas);
                Renderer.DrawSprite(t, Color4.White, p - iconSize / 2, iconSize, Vector2.Zero, Vector2.One);
            }
        }
        private void RenderWidgetsPivotMark(Widget canvas)
        {
            if (
                Core.Document.Current.ExpositionMode ||
                Core.Document.Current.PreviewAnimation
                )
            {
                return;
            }
            var widgets = WidgetsWithDisplayedPivot().ToList();

            if (widgets.Count == 0)
            {
                return;
            }
            canvas.PrepareRendererState();
            var iconSize = new Vector2(16, 16);

            foreach (var widget in widgets)
            {
                var t        = NodeIconPool.GetTexture(widget.GetType());
                var p        = widget.CalcPositionInSpaceOf(canvas);
                var position = p - iconSize / 2;
                position.X = (float)System.Math.Truncate(position.X);
                position.Y = (float)System.Math.Truncate(position.Y);
                Renderer.DrawSprite(t, Color4.White, position, iconSize, Vector2.Zero, Vector2.One);
            }
        }
Exemple #3
0
        private void RenderWidgetsPivotMark(Widget canvas)
        {
            if (Document.Current.PreviewScene)
            {
                return;
            }
            var widgets = WidgetsWithDisplayedPivot().ToList();

            if (widgets.Count == 0)
            {
                return;
            }
            canvas.PrepareRendererState();
            var iconSize = new Vector2(16, 16);

            foreach (var widget in widgets)
            {
                var t        = NodeIconPool.GetTexture(widget.GetType());
                var p        = sceneView.CalcTransitionFromSceneSpace(sceneView.Frame).TransformVector(widget.GlobalPivotPosition);
                var position = p - iconSize / 2;
                position.X = (float)System.Math.Truncate(position.X);
                position.Y = (float)System.Math.Truncate(position.Y);
                Renderer.DrawSprite(t, Color4.White, position, iconSize, Vector2.Zero, Vector2.One);
            }
        }
Exemple #4
0
        private void RenderSelection(Widget canvas)
        {
            if (
                Core.Document.Current.ExpositionMode ||
                Core.Document.Current.PreviewAnimation
                )
            {
                return;
            }
            canvas.PrepareRendererState();
            var widgets = Core.Document.Current.SelectedNodes().Editable().OfType <Widget>().ToList();

            if (widgets.Count == 0)
            {
                return;
            }
            // Render boreder and icon for widgets.
            var iconSize = new Vector2(16, 16);

            foreach (var widget in widgets)
            {
                var t = NodeIconPool.GetTexture(widget.GetType());
                var h = widget.CalcHullInSpaceOf(canvas);
                for (int i = 0; i < 4; i++)
                {
                    var a = h[i];
                    var b = h[(i + 1) % 4];
                    Renderer.DrawLine(a, b, ColorTheme.Current.SceneView.SelectedWidget, 1);
                }
                var p = widget.CalcPositionInSpaceOf(canvas);
                Renderer.DrawSprite(t, Color4.White, p - iconSize / 2, iconSize, Vector2.Zero, Vector2.One);
            }
            Quadrangle hull;
            Vector2    pivot;

            Utils.CalcHullAndPivot(widgets, canvas, out hull, out pivot);
            // Render rectangles.
            var locked = widgets.Any(w => w.GetTangerineFlag(TangerineFlags.Locked));
            var color  = locked ? ColorTheme.Current.SceneView.LockedWidgetBorder : ColorTheme.Current.SceneView.Selection;

            for (int i = 0; i < 4; i++)
            {
                var a = hull[i];
                var b = hull[(i + 1) % 4];
                Renderer.DrawLine(a, b, color, 1);
                DrawStretchMark(a);
                DrawStretchMark((a + b) / 2);
            }
            // Render multi-pivot mark.
            if (widgets.Count > 1)
            {
                DrawMultiPivotMark(pivot);
            }
        }
Exemple #5
0
        public static void RebuildCreateImportedTypeMenu()
        {
            var menus = new[] { customNodes.Menu, GenericCommands.NewTanWithCustomRoot.Menu, create };

            foreach (var menu in menus)
            {
                foreach (var command in menu)
                {
                    CommandHandlerList.Global.Disconnect(command);
                }
            }
            CreateNodeCommands.Clear();
            customNodes.Menu.Clear();
            GenericCommands.NewTanWithCustomRoot.Menu.Clear();
            create.Clear();
            create.Add(customNodes = new Command("Custom Nodes", new Menu()));

            foreach (var type in Project.Current.RegisteredNodeTypes)
            {
                var cmd = new Command("Create " + type.Name)
                {
                    Icon = NodeIconPool.GetIcon(type)
                };
                CommandRegistry.Register(cmd, "CreateCommands", "Create" + type.Name, @override: true);
                CommandHandlerList.Global.Connect(cmd, new CreateNode(type, cmd));
                if (type.Namespace == "Lime")
                {
                    create.Add(cmd);
                    CreateNodeCommands.Add(cmd);
                }
                else
                {
                    customNodes.Menu.Add(cmd);
                }
                if (IsNodeTypeCanBeRoot(type))
                {
                    var newFileCmd = new Command(type.Name);
                    var format     = typeof(Node3D).IsAssignableFrom(type) ? DocumentFormat.T3D : DocumentFormat.Tan;
                    CommandHandlerList.Global.Connect(newFileCmd, new FileNew(format, type));
                    GenericCommands.NewTanWithCustomRoot.Menu.Add(newFileCmd);
                }
            }
            customNodes.Enabled = customNodes.Menu.Count > 0;
            GenericCommands.NewTanWithCustomRoot.Enabled = GenericCommands.NewTanWithCustomRoot.Menu.Count > 0;
            TangerineApp.Instance?.RefreshCreateNodeCommands();
        }
Exemple #6
0
 public static void RebuildCreateImportedTypeMenu()
 {
     foreach (var c in imported)
     {
         create.Remove(c);
     }
     imported.Clear();
     foreach (var t in Orange.PluginLoader.EnumerateTangerineExportedTypes())
     {
         var cmd = new Command(t.Name)
         {
             Icon = NodeIconPool.GetTexture(t)
         };
         CommandHandlerList.Global.Connect(cmd, new CreateNode(t));
         create.Add(cmd);
         imported.Add(cmd);
     }
 }
Exemple #7
0
        public RollNodeView(Row row)
        {
            this.row = row;
            nodeData = row.Components.Get <NodeRow>();
            label    = new ThemedSimpleText {
                ForceUncutText = false,
                VAlignment     = VAlignment.Center,
                OverflowMode   = TextOverflowMode.Ellipsis,
                LayoutCell     = new LayoutCell(Alignment.LeftCenter, float.MaxValue)
            };
            editBoxContainer = new Widget {
                Visible    = false,
                Layout     = new HBoxLayout(),
                LayoutCell = new LayoutCell(Alignment.LeftCenter, float.MaxValue),
            };
            nodeIcon = new Image(NodeIconPool.GetTexture(nodeData.Node.GetType()))
            {
                HitTestTarget = true,
                MinMaxSize    = new Vector2(21, 16),
                Padding       = new Thickness {
                    Left = 5
                }
            };
            expandButton = CreateExpandButton();
            var expandButtonContainer = new Widget {
                Layout = new StackLayout {
                    IgnoreHidden = false
                },
                LayoutCell = new LayoutCell(Alignment.Center, stretchX: 0),
                Nodes      = { expandButton }
            };

            expandButtonContainer.CompoundPresenter.Add(new SyncDelegatePresenter <Widget>(widget => {
                widget.PrepareRendererState();
                var a          = new Vector2(0, -4);
                var b          = widget.Size + new Vector2(0, 3);
                int colorIndex = nodeData.Node.EditorState().ColorIndex;
                Renderer.DrawRect(a, b, ColorMarks[colorIndex]);
                if (colorIndex != 0)
                {
                    Renderer.DrawRectOutline(a, b, ColorTheme.Current.TimelineRoll.Lines);
                }
            }));
            expandButtonContainer.Updating += delta => {
                bool visible = false;
                foreach (var a in nodeData.Node.Animators)
                {
                    if (!a.IsZombie && a.AnimationId == Document.Current.AnimationId)
                    {
                        visible = true;
                        break;
                    }
                }
                expandButton.Visible = visible;
            };
            enterButton         = NodeCompositionValidator.CanHaveChildren(nodeData.Node.GetType()) ? CreateEnterButton() : null;
            eyeButton           = CreateEyeButton();
            lockButton          = CreateLockButton();
            lockAnimationButton = CreateLockAnimationButton();
            widget = new Widget {
                HitTestTarget = true,
                Padding       = new Thickness {
                    Right = 2
                },
                MinHeight = TimelineMetrics.DefaultRowHeight,
                Layout    = new HBoxLayout {
                    DefaultCell = new DefaultLayoutCell(Alignment.Center)
                },
                Nodes =
                {
                    expandButtonContainer,
                    (indentSpacer = new Widget()),
                    nodeIcon,
                    Spacer.HSpacer(3),
                    label,
                    editBoxContainer,
                    linkIndicatorButtonContainer,
                    (Widget)enterButton ?? (Widget)Spacer.HSpacer(Theme.Metrics.DefaultToolbarButtonSize.X),
                    lockAnimationButton,
                    eyeButton,
                    lockButton,
                },
            };
            widget.Components.Add(new AwakeBehavior());
            label.AddChangeWatcher(() => nodeData.Node.Id, s => RefreshLabel());
            label.AddChangeWatcher(() => IsGrayedLabel(nodeData.Node), s => RefreshLabel());
            label.AddChangeWatcher(() => nodeData.Node.ContentsPath, s => RefreshLabel());
            widget.CompoundPresenter.Push(new SyncDelegatePresenter <Widget>(RenderBackground));
            nodeIdEditor        = new ObjectIdInplaceEditor(row, nodeData.Node, label, editBoxContainer);
            label.HitTestTarget = true;
            label.Gestures.Add(new DoubleClickGesture(() => {
                Document.Current.History.DoTransaction(() => {
                    if (NodeData.Node.EditorState().Locked)
                    {
                        return;
                    }
                    var labelExtent = label.MeasureUncutText();
                    if (label.LocalMousePosition().X < labelExtent.X)
                    {
                        nodeIdEditor.Rename();
                    }
                    else
                    {
                        EnterNode.Perform(nodeData.Node);
                    }
                });
            }));
            widget.Gestures.Add(new ClickGesture(1, ShowContextMenu));
        }
Exemple #8
0
        private void RenderSelection(Widget canvas)
        {
            if (Document.Current.PreviewScene)
            {
                return;
            }

            canvas.PrepareRendererState();
            var widgets = Document.Current.SelectedNodes().Editable().OfType <Widget>().ToList();

            if (widgets.Count == 0)
            {
                return;
            }

            Quadrangle hull;
            Vector2    pivot;

            Utils.CalcHullAndPivot(widgets, out hull, out pivot);
            hull  = hull.Transform(sceneView.CalcTransitionFromSceneSpace(canvas));
            pivot = pivot * sceneView.CalcTransitionFromSceneSpace(canvas);
            // Render rectangles.
            var locked = widgets.Any(w => w.GetTangerineFlag(TangerineFlags.Locked));
            var color  = locked ? ColorTheme.Current.SceneView.LockedWidgetBorder : ColorTheme.Current.SceneView.Selection;

            for (int i = 0; i < 4; i++)
            {
                var a = hull[i];
                var b = hull[(i + 1) % 4];
                Renderer.DrawLine(a, b, color);
                DrawStretchMark(a);

                if (i < 2)
                {
                    var c        = hull[(i + 2) % 4];
                    var d        = hull[(i + 3) % 4];
                    var abCenter = (a + b) * 0.5f;
                    var cdCenter = (c + d) * 0.5f;
                    Renderer.DrawLine(abCenter, cdCenter, color);
                    DrawStretchMark(abCenter);
                    DrawStretchMark(cdCenter);
                }
            }
            // Render border and icon for widgets.
            var iconSize = new Vector2(16, 16);

            foreach (var widget in widgets)
            {
                var t = NodeIconPool.GetTexture(widget.GetType());
                var h = widget.CalcHull().Transform(sceneView.CalcTransitionFromSceneSpace(canvas));
                for (int i = 0; i < 4; i++)
                {
                    var a = h[i];
                    var b = h[(i + 1) % 4];
                    Renderer.DrawLine(a, b, ColorTheme.Current.SceneView.SelectedWidget, 1);
                }
                var p = widget.GlobalPivotPosition * sceneView.CalcTransitionFromSceneSpace(canvas);
                Renderer.DrawSprite(t, ColorTheme.Current.SceneView.SelectedWidgetPivotOutline, p - iconSize / 2, iconSize, Vector2.Zero, Vector2.One);
                if (selectedWidgetPivotVisualHint.Enabled)
                {
                    Renderer.DrawRectOutline(
                        p - iconSize / 2 - 5 * Vector2.One,
                        p + iconSize / 2 + 5 * Vector2.One,
                        ColorTheme.Current.SceneView.SelectedWidgetPivotOutline,
                        2.0f
                        );
                }
            }
            // Render multi-pivot mark.
            if (widgets.Count > 1)
            {
                DrawMultiPivotMark(pivot);
            }
        }
Exemple #9
0
        private static void CreateMainMenu()
        {
            Menu viewMenu;

            Application.MainMenu = new Menu {
#if MAC
                new Command("Application", new Menu {
                    GenericCommands.PreferencesDialog,
                    Command.MenuSeparator,
                    GenericCommands.Quit,
                }),
#endif
                new Command("File", new Menu {
                    GenericCommands.New,
                    Command.MenuSeparator,
                    GenericCommands.Open,
                    GenericCommands.OpenProject,
                    Command.MenuSeparator,
                    GenericCommands.Save,
                    GenericCommands.SaveAs,
                    GenericCommands.Revert,
                    GenericCommands.UpgradeDocumentFormat,
                    Command.MenuSeparator,
#if !MAC
                    GenericCommands.PreferencesDialog,
                    Command.MenuSeparator,
#endif
                    GenericCommands.CloseDocument,
#if !MAC
                    GenericCommands.Quit,
#endif
                }),
                new Command("Edit", new Menu {
                    Command.Undo,
                    Command.Redo,
                    Command.MenuSeparator,
                    Command.Cut,
                    Command.Copy,
                    Command.Paste,
                    Command.Delete,
                    SceneViewCommands.Duplicate,
                    TimelineCommands.DeleteKeyframes,
                    TimelineCommands.CreateMarkerPlay,
                    TimelineCommands.CreateMarkerStop,
                    TimelineCommands.CreateMarkerJump,
                    TimelineCommands.DeleteMarker,
                    TimelineCommands.InsertFrame,
                    TimelineCommands.DeleteFrame,
                    Command.MenuSeparator,
                    Command.SelectAll,
                    Command.MenuSeparator,
                    GenericCommands.Group,
                    GenericCommands.Ungroup,
                    GenericCommands.InsertTimelineColumn,
                    GenericCommands.RemoveTimelineColumn,
                    Command.MenuSeparator,
                    SceneViewCommands.TieWidgetsWithBones,
                    SceneViewCommands.UntieWidgetsFromBones,
                    GenericCommands.GroupContentsToMorphableMeshes,
                    GenericCommands.ExportScene,
                    GenericCommands.UpsampleAnimationTwice,
                }),
                new Command("Create", (create = new Menu())),
                new Command("View", (viewMenu = new Menu {
                    GenericCommands.DefaultLayout,
                    new Command("Pads", PadsMenu),
                    new Command("Resolution", resolution),
                    SceneViewCommands.DisplayBones,
                    Command.MenuSeparator,
                    new Command("Overlays", overlaysMenu),
                    new Command("Rulers", rulerMenu),
                    SceneViewCommands.SnapWidgetBorderToRuler,
                    SceneViewCommands.SnapWidgetPivotToRuler,
                })),
                new Command("Window", new Menu {
                    GenericCommands.NextDocument,
                    GenericCommands.PreviousDocument
                }),
                new Command("Orange", new Menu {
                    OrangeCommands.Run,
                    OrangeCommands.OptionsDialog
                }),
            };
            var nodeTypes = new[] {
                typeof(Frame),
                typeof(Button),
                typeof(Image),
                typeof(Audio),
                typeof(Movie),
                typeof(Bone),
                typeof(ParticleEmitter),
                typeof(ParticleModifier),
                typeof(EmitterShapePoint),
                typeof(ParticlesMagnet),
                typeof(SimpleText),
                typeof(RichText),
                typeof(TextStyle),
                typeof(NineGrid),
                typeof(DistortionMesh),
                typeof(Spline),
                typeof(SplinePoint),
                typeof(SplineGear),
                typeof(Slider),
                typeof(ImageCombiner),
                typeof(Viewport3D),
                typeof(Camera3D),
                typeof(Model3D),
                typeof(Node3D),
                typeof(WidgetAdapter3D),
                typeof(Spline3D),
                typeof(SplinePoint3D),
                typeof(SplineGear3D),
                typeof(LightSource),
                typeof(Polyline),
                typeof(PolylinePoint),
            };
            foreach (var t in nodeTypes)
            {
                var cmd = new Command(t.Name)
                {
                    Icon = NodeIconPool.GetTexture(t)
                };
                CommandHandlerList.Global.Connect(cmd, new CreateNode(t));
                create.Add(cmd);
            }
        }
Exemple #10
0
        private static void CreateMainMenu()
        {
            Menu viewMenu;

            Application.MainMenu = new Menu {
#if MAC
                new Command("Application", new Menu {
                    GenericCommands.PreferencesDialog,
                    Command.MenuSeparator,
                    GenericCommands.Quit,
                }),
#endif
                new Command("File", new Menu {
                    new Command("New", new Menu {
                        GenericCommands.NewTan,
                        GenericCommands.NewTanWithCustomRoot,
                    }),
                    GenericCommands.NewProject,
                    Command.MenuSeparator,
                    GenericCommands.Open,
                    GenericCommands.OpenProject,
                    GenericCommands.CloseProject,
                    Command.MenuSeparator,
                    GenericCommands.RecentDocuments,
                    GenericCommands.RecentProjects,
                    Command.MenuSeparator,
                    GenericCommands.Save,
                    GenericCommands.SaveAs,
                    GenericCommands.SaveAll,
                    GenericCommands.Revert,
                    GenericCommands.UpgradeDocumentFormat,
                    Command.MenuSeparator,
#if !MAC
                    GenericCommands.PreferencesDialog,
                    Command.MenuSeparator,
#endif
                    GenericCommands.Close,
                    GenericCommands.CloseAll,
                    GenericCommands.CloseAllButCurrent,
#if !MAC
                    GenericCommands.Quit,
#endif
                }),
                new Command("Edit", new Menu {
                    Command.Undo,
                    Command.Redo,
                    Command.MenuSeparator,
                    Command.Cut,
                    Command.Copy,
                    Command.Paste,
                    Command.Delete,
                    SceneViewCommands.Duplicate,
                    TimelineCommands.DeleteKeyframes,
                    TimelineCommands.CreateMarkerPlay,
                    TimelineCommands.CreateMarkerStop,
                    TimelineCommands.CreateMarkerJump,
                    TimelineCommands.DeleteMarker,
                    Command.MenuSeparator,
                    Command.SelectAll,
                    Command.MenuSeparator,
                    GenericCommands.Group,
                    GenericCommands.Ungroup,
                    GenericCommands.InsertTimelineColumn,
                    GenericCommands.RemoveTimelineColumn,
                    Command.MenuSeparator,
                    SceneViewCommands.TieWidgetsWithBones,
                    SceneViewCommands.UntieWidgetsFromBones,
                    GenericCommands.GroupContentsToMorphableMeshes,
                    GenericCommands.ExportScene,
                    GenericCommands.UpsampleAnimationTwice,
                    GenericCommands.ConvertToButton,
                    SceneViewCommands.GeneratePreview
                }),
                new Command("Create", (create = new Menu())),
                new Command("Tools", new Menu {
                    ToolsCommands.RenderToPngSequence,
                }),
                new Command("View", (viewMenu = new Menu {
                    new Command("Layouts", (layoutMenu = new Menu {
                        GenericCommands.SaveLayout,
                        GenericCommands.LoadLayout,
                        GenericCommands.DefaultLayout,
                    })),
                    new Command("Panels", PanelsMenu),
                    new Command("Resolution", resolution),
                    Command.MenuSeparator,
                    new Command("Overlays", overlaysMenu),
                    new Command("Rulers", rulerMenu),
                    SceneViewCommands.SnapWidgetBorderToRuler,
                    SceneViewCommands.SnapWidgetPivotToRuler,
                    SceneViewCommands.SnapRulerLinesToWidgets,
                    SceneViewCommands.ResolutionChanger,
                    SceneViewCommands.ResolutionReverceChanger,
                    SceneViewCommands.ResolutionOrientation,
                    TimelineCommands.CenterTimelineOnCurrentColumn,
                    new Command("Locale", localizationMenu = new Menu()),
                })),
                new Command("Window", new Menu {
                    GenericCommands.NextDocument,
                    GenericCommands.PreviousDocument
                }),
                orangeMenuCommand,
                new Command("Git", new Menu {
                    GitCommands.ForceUpdate,
                    GitCommands.Update,
                }),
                new Command("Help", new Menu {
                    GenericCommands.ViewHelp,
                    GenericCommands.HelpMode,
                    GenericCommands.ViewChangelog
                }),
                new Command("System", new Menu {
                    GenericCommands.ResetGlobalSettings,
                    GenericCommands.ClearCache,
                    GenericCommands.PurgeBackups,
                }),
            };
            create.Add(customNodes = new Command("Custom Nodes", new Menu()));
            foreach (var t in Project.GetNodesTypesOrdered("Lime"))
            {
                var cmd = new Command(t.Name)
                {
                    Icon = NodeIconPool.GetIcon(t)
                };
                CommandHandlerList.Global.Connect(cmd, new CreateNode(t, cmd));
                create.Add(cmd);
                CreateNodeCommands.Add(cmd);
            }
            Command.Undo.Icon           = IconPool.GetIcon("Tools.Undo");
            Command.Redo.Icon           = IconPool.GetIcon("Tools.Redo");
            GenericCommands.Revert.Icon = IconPool.GetIcon("Tools.Revert");
        }
 public BoneLinkIndicatorButton() : base(NodeIconPool.GetTexture(typeof(Bone)), clickable: true)
 {
     Tooltip = "Linked to Bone(s)";
 }
Exemple #12
0
        public RollNodeView(Row row)
        {
            this.row = row;
            nodeData = row.Components.Get <NodeRow>();
            label    = new ThemedSimpleText {
                ForceUncutText = false,
                VAlignment     = VAlignment.Center,
                LayoutCell     = new LayoutCell(Alignment.LeftCenter, float.MaxValue)
            };
            editBox = new ThemedEditBox {
                LayoutCell = new LayoutCell(Alignment.LeftCenter, float.MaxValue)
            };
            nodeIcon = new Image(NodeIconPool.GetTexture(nodeData.Node.GetType()))
            {
                HitTestTarget = true,
                MinMaxSize    = new Vector2(21, 16),
                Padding       = new Thickness {
                    Left = 5
                }
            };
            expandButton = CreateExpandButton();
            var expandButtonContainer = new Widget {
                Layout = new StackLayout {
                    IgnoreHidden = false
                },
                LayoutCell = new LayoutCell(Alignment.Center, stretchX: 0),
                Nodes      = { expandButton }
            };

            expandButtonContainer.CompoundPresenter.Add(new DelegatePresenter <Widget>(widget => {
                widget.PrepareRendererState();
                var a = new Vector2(0, -4);
                var b = widget.Size + new Vector2(0, 3);
                Renderer.DrawRect(a, b, nodeData.Node.GetColor());
                if (nodeData.Node.GetColorIndex() != 0)
                {
                    Renderer.DrawRectOutline(a, b, ColorTheme.Current.TimelineRoll.Lines);
                }
            }));
            expandButtonContainer.Updating += delta =>
                                              expandButton.Visible = nodeData.Node.Animators.Count > 0;
            enterButton         = NodeCompositionValidator.CanHaveChildren(nodeData.Node.GetType()) ? CreateEnterButton() : null;
            eyeButton           = CreateEyeButton();
            lockButton          = CreateLockButton();
            lockAnimationButton = CreateLockAnimationButton();
            widget = new Widget {
                Padding = new Thickness {
                    Right = 2
                },
                MinHeight = TimelineMetrics.DefaultRowHeight,
                Layout    = new HBoxLayout {
                    CellDefaults = new LayoutCell(Alignment.Center)
                },
                HitTestTarget = true,
                Nodes         =
                {
                    expandButtonContainer,
                    (indentSpacer = new Widget()),
                    nodeIcon,
                    new HSpacer(3),
                    label,
                    editBox,
                    new Widget(),
                    (Widget)enterButton ?? (Widget) new HSpacer(Theme.Metrics.DefaultToolbarButtonSize.X),
                    lockAnimationButton,
                    eyeButton,
                    lockButton,
                }
            };
            label.AddChangeWatcher(() => nodeData.Node.Id, s => RefreshLabel());
            label.AddChangeWatcher(() => IsGrayedLabel(nodeData.Node), s => RefreshLabel());
            label.AddChangeWatcher(() => nodeData.Node.ContentsPath, s => RefreshLabel());
            widget.CompoundPresenter.Push(new DelegatePresenter <Widget>(RenderBackground));
            editBox.Visible = false;
            widget.Gestures.Add(new ClickGesture(1, ShowPropertyContextMenu));
            widget.Gestures.Add(new DoubleClickGesture(() => {
                var labelExtent = label.MeasureUncutText();
                if (label.LocalMousePosition().X < labelExtent.X)
                {
                    Rename();
                }
                else
                {
                    Core.Operations.EnterNode.Perform(nodeData.Node);
                }
            }));
            nodeIcon.Gestures.Add(new DoubleClickGesture(() => {
                Core.Operations.ClearRowSelection.Perform();
                Core.Operations.SelectRow.Perform(row);
                Rename();
            }));
        }
 public SplineGear3DLinkIndicatorButton() : base(NodeIconPool.GetTexture(typeof(SplineGear3D)), clickable: true)
 {
     Tooltip = "Linked to Node3D(s)";
 }
 public void ShowNormal(string tip = "Has linked arguments") => SetTipAndTexture(tip, NodeIconPool.GetTexture(typeof(ImageCombiner)));
 public ImageCombinerLinkIndicatorButton() : base(NodeIconPool.GetTexture(typeof(ImageCombiner)))
 {
     Tip = "Linked to ImageCombiner";
 }
Exemple #16
0
 public SplineGearLinkIndicatorButton() : base(NodeIconPool.GetTexture(typeof(SplineGear)), clickable: true)
 {
     Tip = "Linked to Widget(s)";
 }