Esempio n. 1
0
        private void AddSpriteNode(ulong nodeId, string nodeName)
        {
            var node          = _editor.CurrentDocument.GetNode(nodeId);
            var itemViewModel = new DrawOrderItemViewModel
            {
                Name          = nodeName,
                NodeId        = nodeId,
                IsNodeVisible = _editor.GetNodePropertyAsBool(nodeId, PropertyType.Visibility)
            };

            itemViewModel.Selected   += (sender, args) => _editor.SelectNodeAndChangeToModifyTool(nodeId);
            itemViewModel.Deselected += (sender, args) => _editor.NodeSelection.Remove(nodeId);
            _index.Add(nodeId, itemViewModel);
            Items.Insert(0, itemViewModel); // new sprites are always in front of all other sprites
        }
Esempio n. 2
0
        private HierarchyNodeViewModel CreateNode(ulong nodeId, string name, bool isVisible)
        {
            var node          = _editor.CurrentDocument.GetNode(nodeId);
            var nodeViewModel = new HierarchyNodeViewModel(_editor, nodeId)
            {
                IsNodeVisible = isVisible,
                IsExpanded    = false,
                IsBone        = node is BoneNode,
                IsSprite      = node is SpriteNode
            };

            nodeViewModel.SetName(name);
            nodeViewModel.NameChanged += () => _editor.RenameNode(nodeId, nodeViewModel.Name);
            nodeViewModel.Selected    += () => _editor.SelectNodeAndChangeToModifyTool(nodeId);;
            nodeViewModel.Deselected  += () => _editor.NodeSelection.Remove(nodeId);
            nodeViewModel.Keyed       += () => _editor.AddOrUpdateKeyAtCurrentFrame(nodeId, PropertyType.Visibility);
            nodeViewModel.Unkeyed     += () => _editor.RemoveKeyAtCurrentFrame(nodeId, PropertyType.Visibility);
            _index.Add(nodeId, nodeViewModel);
            return(nodeViewModel);
        }