-
Notifications
You must be signed in to change notification settings - Fork 6
/
BlueprintEditor.cs
79 lines (69 loc) · 2.32 KB
/
BlueprintEditor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using BlueprintEditorPlugin.Editors.BlueprintEditor;
using BlueprintEditorPlugin.Editors.GraphEditor;
using BlueprintEditorPlugin.Extensions;
using BlueprintEditorPlugin.Windows;
using Frosty.Core;
using Frosty.Core.Controls;
using Frosty.Core.Windows;
using FrostySdk.Managers;
namespace BlueprintEditorPlugin
{
[TemplatePart (Name = ContentPresenter, Type = typeof(ContentPresenter))]
public class BlueprintEditor : FrostyBaseEditor
{
private const string ContentPresenter = "ContentPresenter";
private ContentPresenter _presenter;
private IEbxGraphEditor _graphEditor;
private EbxAssetEntry _assetEntry;
private bool _hasLoaded;
public override ImageSource Icon => ViewBlueprintContextMenuItem.IconImageSource;
static BlueprintEditor()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(BlueprintEditor), new FrameworkPropertyMetadata(typeof(BlueprintEditor)));
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_presenter = GetTemplateChild(ContentPresenter) as ContentPresenter;
_presenter.Content = _graphEditor;
Loaded += (sender, args) =>
{
if (_hasLoaded)
return;
_hasLoaded = true;
InternalLoad();
};
}
public void LoadBlueprint(EbxAssetEntry assetEntry, IEbxGraphEditor graphEditor)
{
_graphEditor = graphEditor;
_assetEntry = assetEntry;
InternalLoad();
}
private void InternalLoad()
{
_hasLoaded = true;
FrostyTaskWindow.Show("Loading Blueprint...", "", task =>
{
_graphEditor.LoadAsset(_assetEntry);
});
}
public override void Closed()
{
base.Closed();
_graphEditor.Closed();
}
public BlueprintEditor()
{
}
public BlueprintEditor(EbxAssetEntry assetEntry, IEbxGraphEditor graphEditor)
{
_graphEditor = graphEditor;
_assetEntry = assetEntry;
}
}
}