浏览代码
Merge pull request #93 from Unity-Technologies/inspector-preview-mesh
Merge pull request #93 from Unity-Technologies/inspector-preview-mesh
Inspector preview mesh/main
GitHub
7 年前
当前提交
a5b781b9
共有 8 个文件被更改,包括 166 次插入 和 49 次删除
-
17MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs
-
73MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
-
14MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Manipulators/Draggable.cs
-
15MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs
-
40MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SerializableMesh.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SerializableMesh.cs.meta
-
34MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Manipulators/Scrollable.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Manipulators/Scrollable.cs.meta
|
|||
using System; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
[Serializable] |
|||
public class SerializableMesh |
|||
{ |
|||
[SerializeField] |
|||
private string m_SerializedMesh; |
|||
|
|||
[Serializable] |
|||
private class MeshHelper |
|||
{ |
|||
public Mesh mesh; |
|||
} |
|||
|
|||
public Mesh mesh |
|||
{ |
|||
get |
|||
{ |
|||
if (string.IsNullOrEmpty(m_SerializedMesh)) |
|||
return null; |
|||
|
|||
var meshHelper = new MeshHelper(); |
|||
EditorJsonUtility.FromJsonOverwrite(m_SerializedMesh, meshHelper); |
|||
return meshHelper.mesh; |
|||
} |
|||
set |
|||
{ |
|||
if (mesh == value) |
|||
return; |
|||
|
|||
var meshHelper = new MeshHelper(); |
|||
meshHelper.mesh = value; |
|||
m_SerializedMesh = EditorJsonUtility.ToJson(meshHelper, true); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 944c4fc9d004e7845adb3f86843ab742 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing |
|||
{ |
|||
public class Scrollable : MouseManipulator |
|||
{ |
|||
Action<float> m_Handler; |
|||
|
|||
public Scrollable(Action<float> handler) |
|||
{ |
|||
m_Handler = handler; |
|||
activators.Add(new ManipulatorActivationFilter() |
|||
{ |
|||
button = MouseButton.LeftMouse |
|||
}); |
|||
} |
|||
|
|||
protected override void RegisterCallbacksOnTarget() |
|||
{ |
|||
target.RegisterCallback(new EventCallback<WheelEvent>(OnMouseWheel), Capture.NoCapture); |
|||
} |
|||
|
|||
protected override void UnregisterCallbacksFromTarget() |
|||
{ |
|||
target.UnregisterCallback(new EventCallback<WheelEvent>(OnMouseWheel), Capture.NoCapture); |
|||
} |
|||
|
|||
void OnMouseWheel(WheelEvent evt) |
|||
{ |
|||
m_Handler(evt.delta.y); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1fde0872f0455304bb082dbee731fabf |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue