-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathNativeDesignView.cs
More file actions
73 lines (55 loc) · 2.4 KB
/
Copy pathNativeDesignView.cs
File metadata and controls
73 lines (55 loc) · 2.4 KB
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
//Copyright © 2014 Sony Computer Entertainment America LLC. See License.txt.
using System;
using System.ComponentModel.Composition;
using System.Collections.Generic;
using Sce.Atf;
using Sce.Atf.Dom;
using Sce.Atf.Adaptation;
using Sce.Atf.Applications;
using LevelEditorCore;
using ViewTypes = Sce.Atf.Rendering.ViewTypes;
namespace RenderingInterop
{
[Export(typeof(ISnapSettings))]
[Export(typeof(IDesignView))]
[Export(typeof(DesignView))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class NativeDesignView : DesignView
{
public NativeDesignView()
{
QuadView.TopLeft = new NativeDesignControl(this) { ViewType = ViewTypes.Perspective };
QuadView.TopRight = new NativeDesignControl(this) { ViewType = ViewTypes.Right };
QuadView.BottomLeft = new NativeDesignControl(this) { ViewType = ViewTypes.Top };
QuadView.BottomRight = new NativeDesignControl(this) { ViewType = ViewTypes.Front };
// set control names.
QuadView.TopLeft.Name = "TopLeft";
QuadView.TopRight.Name = "TopRight";
QuadView.BottomLeft.Name = "BottomLeft";
QuadView.BottomRight.Name = "BottomRight";
ViewMode = ViewModes.Single;
ContextChanged += NativeDesignView_ContextChanged;
}
void NativeDesignView_ContextChanged(object sender, EventArgs e)
{
if (m_selectionContext != null)
{
m_selectionContext.SelectionChanged -= new EventHandler(m_selectionContext_SelectionChanged);
}
m_selectionContext = Context.As<ISelectionContext>();
if (m_selectionContext != null)
{
m_selectionContext.SelectionChanged += new EventHandler(m_selectionContext_SelectionChanged);
}
}
void m_selectionContext_SelectionChanged(object sender, EventArgs e)
{
IEnumerable<DomNode> domNodes = m_selectionContext.Selection.AsIEnumerable<DomNode>();
IEnumerable<DomNode> roots = DomNode.GetRoots(domNodes);
IEnumerable<NativeObjectAdapter> nativeObjects = roots.AsIEnumerable<NativeObjectAdapter>();
GameEngine.SetSelection(nativeObjects);
InvalidateViews();
}
private ISelectionContext m_selectionContext;
}
}