浏览代码

Add OnVlaueChanged callback to preview mesh picker for master node

/main
Jens Holm 7 年前
当前提交
35d08f0d
共有 1 个文件被更改,包括 13 次插入3 次删除
  1. 16
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs

16
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs


VisualElement m_PropertyItems;
VisualElement m_LayerItems;
VisualElement m_ContentContainer;
Experimental.UIElements.ObjectField m_PreviewMeshPicker;
ObjectField m_PreviewMeshPicker;
AbstractNodeEditorView m_EditorView;
TypeMapper m_TypeMapper;

m_PreviewTextureView = new PreviewTextureView {name = "preview", image = Texture2D.blackTexture};
bottomContainer.Add(m_PreviewTextureView);
m_PreviewMeshPicker = new Experimental.UIElements.ObjectField() { objectType = typeof(Mesh) };
m_PreviewMeshPicker = new ObjectField() { objectType = typeof(Mesh) };
m_PreviewMeshPicker.OnValueChanged(OnPreviewMeshChanged);
bottomContainer.Add(m_PreviewMeshPicker);
}
Add(bottomContainer);

void OnPreviewChanged()
{
m_PreviewTextureView.image = m_PreviewHandle.texture ?? Texture2D.blackTexture;
m_PreviewHandle.mesh = m_PreviewMeshPicker.value as Mesh;
}
void OnPreviewMeshChanged(ChangeEvent<UnityEngine.Object> changeEvent)
{
Mesh changedMesh = changeEvent.newValue as Mesh;
if (changedMesh)
{
m_PreviewHandle.mesh = changedMesh;
}
}
public void UpdateSelection(IEnumerable<INode> nodes)

正在加载...
取消
保存