Matt Dean
7 年前
当前提交
9c0b93c1
共有 20 个文件被更改,包括 296 次插入 和 226 次删除
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/AbstractMaterialNode.cs
-
17MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Input/PropertyNode.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Blackboard/BlackboardField.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Blackboard/BlackboardProvider.cs
-
1MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/EdgeConnectorListener.cs
-
59MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Manipulators/WindowDraggable.cs
-
82MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/SearchWindowProvider.cs
-
43MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Importers/ShaderGraphImporter.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/SerializationTests.cs
-
5MaterialGraphProject/Assets/UnityShaderEditor/Editor/Util/CopyPasteGraph.cs
-
105MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/WindowDockingLayout.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/WindowDockingLayout.cs.meta
-
40MaterialGraphProject/Assets/Vector1PropGraph.ShaderGraph
-
7MaterialGraphProject/Assets/Vector1PropGraph.ShaderGraph.meta
-
65MaterialGraphProject/Assets/TestAssets/RockMaterial1.sbsar.meta
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/PropertyControl.cs.meta
-
53MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/PropertyControl.cs
|
|||
using System; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing |
|||
{ |
|||
[Serializable] |
|||
public class WindowDockingLayout |
|||
{ |
|||
[SerializeField] |
|||
bool m_DockingLeft; |
|||
|
|||
public bool dockingLeft |
|||
{ |
|||
get { return m_DockingLeft; } |
|||
} |
|||
|
|||
[SerializeField] |
|||
bool m_DockingTop; |
|||
|
|||
public bool dockingTop |
|||
{ |
|||
get { return m_DockingTop; } |
|||
} |
|||
|
|||
[SerializeField] |
|||
float m_VerticalOffset; |
|||
|
|||
public float verticalOffset |
|||
{ |
|||
get { return m_VerticalOffset; } |
|||
} |
|||
|
|||
[SerializeField] |
|||
float m_HorizontalOffset; |
|||
|
|||
public float horizontalOffset |
|||
{ |
|||
get { return m_HorizontalOffset; } |
|||
} |
|||
|
|||
[SerializeField] |
|||
Vector2 m_Size; |
|||
|
|||
public Vector2 size |
|||
{ |
|||
get { return m_Size; } |
|||
} |
|||
|
|||
public void CalculateDockingCornerAndOffset(Rect layout, Rect parentLayout) |
|||
{ |
|||
Vector2 layoutCenter = new Vector2(layout.x + layout.width * .5f, layout.y + layout.height * .5f); |
|||
layoutCenter /= parentLayout.size; |
|||
|
|||
m_DockingLeft = layoutCenter.x < .5f; |
|||
m_DockingTop = layoutCenter.y < .5f; |
|||
|
|||
if (m_DockingLeft) |
|||
{ |
|||
m_HorizontalOffset = layout.x; |
|||
} |
|||
else |
|||
{ |
|||
m_HorizontalOffset = parentLayout.width - layout.x - layout.width; |
|||
} |
|||
|
|||
if (m_DockingTop) |
|||
{ |
|||
m_VerticalOffset = layout.y; |
|||
} |
|||
else |
|||
{ |
|||
m_VerticalOffset = parentLayout.height - layout.y - layout.height; |
|||
} |
|||
|
|||
m_Size = layout.size; |
|||
} |
|||
|
|||
public Rect GetLayout(Rect parentLayout) |
|||
{ |
|||
Rect layout = new Rect(); |
|||
|
|||
layout.size = size; |
|||
|
|||
if (dockingLeft) |
|||
{ |
|||
layout.x = horizontalOffset; |
|||
} |
|||
else |
|||
{ |
|||
layout.x = parentLayout.width - size.x - horizontalOffset; |
|||
} |
|||
|
|||
if (dockingTop) |
|||
{ |
|||
layout.y = verticalOffset; |
|||
} |
|||
else |
|||
{ |
|||
layout.y = parentLayout.height - size.y - verticalOffset; |
|||
} |
|||
|
|||
return layout; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 5f70875ecccbc924b8f9f0d58bbb37e8 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
40
MaterialGraphProject/Assets/Vector1PropGraph.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 7d765c30286182d4a9e23edbdaf01865 |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} |
|
|||
fileFormatVersion: 2 |
|||
guid: b69a7e88e13e24260acb38513f619ff2 |
|||
timeCreated: 1495753980 |
|||
licenseType: Pro |
|||
SubstanceImporter: |
|||
serializedVersion: 5 |
|||
materialInstances: |
|||
- serializedVersion: 16 |
|||
name: RockMaterial1 |
|||
prototypeName: RockMaterial1 |
|||
shaderName: |
|||
shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} |
|||
shaderKeywords: |
|||
renderQueue: -1 |
|||
lightmapFlags: 4 |
|||
inputs: [] |
|||
materialInformation: |
|||
serializedVersion: 5 |
|||
offset: {x: 0, y: 0} |
|||
scale: {x: 1, y: 1} |
|||
generateMipmaps: 1 |
|||
generateAllOutputs: 0 |
|||
animationUpdateRate: 0 |
|||
materialProperties: |
|||
serializedVersion: 3 |
|||
texEnvs: [] |
|||
floats: [] |
|||
colors: [] |
|||
textureParameters: |
|||
- name: RockMaterial1_basecolor |
|||
alphaSource: 6 |
|||
filterMode: 1 |
|||
aniso: 1 |
|||
wrapMode: 0 |
|||
- name: RockMaterial1_normal |
|||
alphaSource: 0 |
|||
filterMode: 1 |
|||
aniso: 1 |
|||
wrapMode: 0 |
|||
- name: RockMaterial1_metallic |
|||
alphaSource: 7 |
|||
filterMode: 1 |
|||
aniso: 1 |
|||
wrapMode: 0 |
|||
textureAssignments: |
|||
- shaderProp: _MainTex |
|||
material: {instanceID: 0} |
|||
baseUID: 779270956 |
|||
- shaderProp: _BumpMap |
|||
material: {instanceID: 0} |
|||
baseUID: 779270958 |
|||
- shaderProp: _MetallicGlossMap |
|||
material: {instanceID: 0} |
|||
baseUID: 779270954 |
|||
buildTargetSettings: |
|||
- serializedVersion: 2 |
|||
buildTarget: |
|||
textureWidth: 512 |
|||
textureHeight: 512 |
|||
textureFormat: 0 |
|||
loadingBehavior: 1 |
|||
deletedPrototypes: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: bb1167be0ec94c0a849394d34df45a98 |
|||
timeCreated: 1507819549 |
|
|||
using System; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using UnityEditor.Graphing; |
|||
using UnityEngine.Experimental.UIElements; |
|||
using UnityEditor.ShaderGraph; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing.Controls |
|||
{ |
|||
[AttributeUsage(AttributeTargets.Property)] |
|||
public class PropertyControlAttribute : Attribute, IControlAttribute |
|||
{ |
|||
public VisualElement InstantiateControl(AbstractMaterialNode node, PropertyInfo propertyInfo) |
|||
{ |
|||
return new PropertyControlView(node); |
|||
} |
|||
} |
|||
|
|||
public class PropertyControlView : VisualElement, INodeModificationListener |
|||
{ |
|||
PropertyNode m_Node; |
|||
|
|||
public PropertyControlView(AbstractMaterialNode node) |
|||
{ |
|||
m_Node = (PropertyNode)node; |
|||
|
|||
Add(new IMGUIContainer(OnGUIHandler)); |
|||
} |
|||
|
|||
void OnGUIHandler() |
|||
{ |
|||
var graph = m_Node.owner as AbstractMaterialGraph; |
|||
var currentGUID = m_Node.propertyGuid; |
|||
var properties = graph.properties.ToList(); |
|||
var propertiesGUID = properties.Select(x => x.guid).ToList(); |
|||
var currentSelectedIndex = propertiesGUID.IndexOf(currentGUID); |
|||
using (var changeCheckScope = new EditorGUI.ChangeCheckScope()) |
|||
{ |
|||
var value = EditorGUILayout.Popup(currentSelectedIndex, properties.Select(x => x.displayName).ToArray()); |
|||
if (changeCheckScope.changed) |
|||
{ |
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Change " + m_Node.name); |
|||
m_Node.propertyGuid = propertiesGUID[value]; |
|||
} |
|||
} |
|||
} |
|||
|
|||
public void OnNodeModified(ModificationScope scope) |
|||
{ |
|||
Dirty(ChangeType.Repaint); |
|||
} |
|||
} |
|||
} |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue