|
|
|
|
|
|
[SerializeField] |
|
|
|
GraphInspectorPresenter m_Presenter; |
|
|
|
|
|
|
|
int m_EditorHash; |
|
|
|
int m_PresenterHash; |
|
|
|
VisualElement m_EditorContainer; |
|
|
|
VisualElement m_ContentContainer; |
|
|
|
VisualElement m_MultipleSelectionsElement; |
|
|
|
|
|
|
|
TypeMapper m_TypeMapper; |
|
|
|
|
|
|
|
|
|
|
var headerContainer = new VisualElement() { name = "header" }; |
|
|
|
m_Title = new VisualElement() { name = "title" }; |
|
|
|
headerContainer.Add(m_Title); |
|
|
|
|
|
|
|
var headerContainer = new VisualElement { name = "header" }; |
|
|
|
{ |
|
|
|
m_Title = new VisualElement() { name = "title" }; |
|
|
|
headerContainer.Add(m_Title); |
|
|
|
} |
|
|
|
Add(m_EditorContainer = new VisualElement {name = "editorContainer"}); |
|
|
|
|
|
|
|
m_ContentContainer = new VisualElement { name = "contentContainer" }; |
|
|
|
Add(m_ContentContainer); |
|
|
|
|
|
|
|
{typeof(StandardNodeEditorPresenter), typeof(StandardNodeEditorView)}, |
|
|
|
{typeof(SurfaceMasterNodeEditorPresenter), typeof(SurfaceMasterNodeEditorView)} |
|
|
|
{ typeof(StandardNodeEditorPresenter), typeof(StandardNodeEditorView) }, |
|
|
|
{ typeof(SurfaceMasterNodeEditorPresenter), typeof(SurfaceMasterNodeEditorView) } |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
m_EditorContainer.Clear(); |
|
|
|
m_EditorHash = 0; |
|
|
|
m_ContentContainer.Clear(); |
|
|
|
m_PresenterHash = 0; |
|
|
|
m_Title.text = presenter.title; |
|
|
|
|
|
|
|
var editorHash = 17; |
|
|
|
var presenterHash = 17; |
|
|
|
foreach (var editorPresenter in presenter.editors) |
|
|
|
editorHash = editorHash * 31 + editorPresenter.GetHashCode(); |
|
|
|
presenterHash = presenterHash * 31 + (presenter.editor == null ? 79 : presenter.editor.GetHashCode()); |
|
|
|
presenterHash = presenterHash * 31 + presenter.selectionCount; |
|
|
|
if (editorHash != m_EditorHash) |
|
|
|
m_Title.text = presenter.title; |
|
|
|
|
|
|
|
if (presenterHash != m_PresenterHash) |
|
|
|
m_EditorHash = editorHash; |
|
|
|
m_EditorContainer.Clear(); |
|
|
|
foreach (var editorPresenter in presenter.editors) |
|
|
|
m_PresenterHash = presenterHash; |
|
|
|
m_ContentContainer.Clear(); |
|
|
|
if (presenter.selectionCount > 1) |
|
|
|
{ |
|
|
|
var element = new VisualElement { name = "selectionCount", text = string.Format("{0} nodes selected.", presenter.selectionCount) }; |
|
|
|
m_ContentContainer.Add(element); |
|
|
|
} |
|
|
|
else if (presenter.editor != null) |
|
|
|
var view = (AbstractNodeEditorView) Activator.CreateInstance(m_TypeMapper.MapType(editorPresenter.GetType())); |
|
|
|
view.presenter = editorPresenter; |
|
|
|
m_EditorContainer.Add(view); |
|
|
|
var view = (AbstractNodeEditorView)Activator.CreateInstance(m_TypeMapper.MapType(presenter.editor.GetType())); |
|
|
|
view.presenter = presenter.editor; |
|
|
|
m_ContentContainer.Add(view); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override Object[] toWatch |
|
|
|
{ |
|
|
|
get { return new Object[] {m_Presenter}; } |
|
|
|
get { return new Object[] { m_Presenter }; } |
|
|
|
} |
|
|
|
} |
|
|
|
} |