浏览代码
Added a Settings menu for Nodes. Implementation of IHasSettings. Nodes can derive from this interface and implement their own VisualElement as their settings menu.
/main
Added a Settings menu for Nodes. Implementation of IHasSettings. Nodes can derive from this interface and implement their own VisualElement as their settings menu.
/main
Martin Thorzen
7 年前
当前提交
77b49204
共有 29 个文件被更改,包括 593 次插入 和 6 次删除
-
13MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/MasterNodes/PBRMasterNode.cs
-
17MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/MasterNodes/UnlitMasterNode.cs
-
1MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
-
24MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs
-
59MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs
-
10MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Interfaces/IHasSettings.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Interfaces/IHasSettings.cs.meta
-
40MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/NodeSettingsView.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/NodeSettingsView.cs.meta
-
58MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PBRSettingsView.cs
-
11MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PBRSettingsView.cs.meta
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Icons.meta
-
15MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/NodeSettings.uss
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/NodeSettings.uss.meta
-
21MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PBRMaster.uss
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PBRMaster.uss.meta
-
15MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PBRSettings.uss
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/PBRSettings.uss.meta
-
9MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/NodeSettings.uxml
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/NodeSettings.uxml.meta
-
6MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRMaster.uxml
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRMaster.uxml.meta
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRSettings.uxml
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/UXML/PBRSettings.uxml.meta
-
7MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Icons/settings_button.png
-
105MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Icons/settings_button.png.meta
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Icons/settingsbutton.png
-
105MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Icons/settingsbutton.png.meta
|
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.Graphing |
|||
{ |
|||
public interface IHasSettings |
|||
{ |
|||
VisualElement CreateSettingsElement(); |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: aaccc11846e23c84093c0d6780172063 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Linq; |
|||
using UnityEditor.Graphing; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing |
|||
{ |
|||
public class NodeSettingsView : VisualElement |
|||
{ |
|||
VisualElement m_ContentContainer; |
|||
|
|||
public NodeSettingsView() |
|||
{ |
|||
var uxml = Resources.Load<VisualTreeAsset>("UXML/NodeSettings"); |
|||
uxml.CloneTree(this, null); |
|||
// Get the element we want to use as content container
|
|||
m_ContentContainer = this.Q("contentContainer"); |
|||
RegisterCallback<MouseDownEvent>(OnMouseDown); |
|||
RegisterCallback<MouseUpEvent>(OnMouseUp); |
|||
} |
|||
|
|||
void OnMouseUp(MouseUpEvent evt) |
|||
{ |
|||
evt.StopPropagation(); |
|||
} |
|||
|
|||
void OnMouseDown(MouseDownEvent evt) |
|||
{ |
|||
evt.StopPropagation(); |
|||
} |
|||
|
|||
public override VisualElement contentContainer |
|||
{ |
|||
get { return m_ContentContainer; } |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 827eeffd55f0ac94b9c13553edbe457b |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Linq; |
|||
using UnityEditor.Experimental.UIElements; |
|||
using UnityEditor.Graphing; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing |
|||
{ |
|||
public class PBRSettingsView : VisualElement |
|||
{ |
|||
VisualElement m_Container; |
|||
|
|||
EnumField m_Model; |
|||
EnumField m_AlphaMode; |
|||
PBRMasterNode m_Node; |
|||
public PBRSettingsView(INode node) |
|||
{ |
|||
m_Node = (PBRMasterNode)node; |
|||
var uxml = Resources.Load<VisualTreeAsset>("UXML/PBRSettings"); |
|||
uxml.CloneTree(this, null); |
|||
|
|||
m_Container = this.Q("container"); |
|||
|
|||
m_Model = new EnumField(m_Node.model); |
|||
m_AlphaMode = new EnumField(m_Node.alphaMode); |
|||
|
|||
m_Model.AddToClassList("enumcontainer"); |
|||
m_AlphaMode.AddToClassList("enumcontainer"); |
|||
|
|||
m_Container.Add(m_Model); |
|||
m_Container.Add(m_AlphaMode); |
|||
|
|||
m_Model.OnValueChanged(ChangeModel); |
|||
m_AlphaMode.OnValueChanged(ChangeAlphaMode); |
|||
} |
|||
|
|||
void ChangeModel(ChangeEvent<Enum> evt) |
|||
{ |
|||
if (Equals(m_Node.model, evt.newValue)) |
|||
return; |
|||
|
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Enum Change"); |
|||
m_Node.model = (PBRMasterNode.Model)evt.newValue; |
|||
} |
|||
|
|||
void ChangeAlphaMode(ChangeEvent<Enum> evt) |
|||
{ |
|||
if (Equals(m_Node.alphaMode, evt.newValue)) |
|||
return; |
|||
|
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Alpha Mode Change"); |
|||
m_Node.alphaMode = (AlphaMode)evt.newValue; |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: fb3f520aadbbd854985c98fa2134a207 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: f4d6d4aaf7f25a14fb15dabc0b24d7ef |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
NodeSettingsView > #mainContainer { |
|||
width: 200; |
|||
|
|||
/*background-color: #e8596e;*/ |
|||
border-color: #e8596e; |
|||
border-style: solid; |
|||
border-top-width: 5px; |
|||
border-right-width: 25px; |
|||
border-top-right-radius: 6px; |
|||
} |
|||
|
|||
NodeSettingsView > #mainContainer > #title { |
|||
font-style: bold; |
|||
text-color: #e8596e; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 59bba4c88ab5f464d9a8f51088561c48 |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} |
|
|||
NodeSettingsView > #mainContainer > #title { |
|||
font-style: bold; |
|||
font-color: rgb(200,0,200); |
|||
background-color: #F0F0F0; |
|||
width: 200; |
|||
} |
|||
|
|||
NodeSettingsView > #mainContainer > .row { |
|||
flex-direction: row; |
|||
} |
|||
|
|||
NodeSettingsView > #mainContainer > .indented { |
|||
padding-left: 8; |
|||
} |
|||
|
|||
NodeSettingsView > #mainContainer > .row > .rowLabel{ |
|||
padding-left: 8; |
|||
width: 200; |
|||
font-color: rgb(200,0,200); |
|||
background-color: #F0F0F0; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 44d43a48d3bb65e4f846a9aa36118670 |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} |
|
|||
PBRSettingsView > #container{ |
|||
font-style: bold; |
|||
text-color: rgb(200,0,200); |
|||
background-color: #F0F0F0; |
|||
} |
|||
PBRSettingsView > #container > #nodename { |
|||
font-style: bold; |
|||
text-color: rgb(200,0,200); |
|||
background-color: #F0F0F0; |
|||
} |
|||
|
|||
PBRSettingsView > #container > .enumcontainer{ |
|||
text-color: rgb(245, 155, 225); |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: f3ab823364001e34f97c37dc09d9f9a4 |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} |
|
|||
<UXML xmlns:ui="UnityEngine.Experimental.UIElements"> |
|||
<ui:VisualElement name="mainContainer"> |
|||
<Style path="Styles/NodeSettings"/> |
|||
<ui:Label name="title" text="Node Settings"/> |
|||
<ui:VisualElement name="contentContainer"> |
|||
</ui:VisualElement> |
|||
</ui:VisualElement> |
|||
</UXML> |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: b70651993c98eda43810c32b7416a21b |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} |
|
|||
<UXML xmlns:ui="UnityEngine.Experimental.UIElements"> |
|||
<ui:VisualElement name="container" class="row"> |
|||
<Style path="Styles/NodeSettings"/> |
|||
<ui:Label name="nodename" text="PBR Master"/> |
|||
</ui:VisualElement> |
|||
</UXML> |
|
|||
fileFormatVersion: 2 |
|||
guid: 8173c8df1ca473b4b800b9816fdb8669 |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} |
|
|||
<UXML xmlns:ui="UnityEngine.Experimental.UIElements"> |
|||
<ui:VisualElement name="container"> |
|||
<Style path="Styles/PBRSettings"/> |
|||
<ui:Label name="nodename" text="PBR Master"/> |
|||
</ui:VisualElement> |
|||
</UXML> |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 18608cc1dad140b47ab3321c8d9d59fe |
|||
ScriptedImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3140f217cba5a6f4ca8d41675ac44819 |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
externalObjects: {} |
|||
serializedVersion: 5 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 0 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: -1 |
|||
aniso: 1 |
|||
mipBias: -1 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: -1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 0 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spritePixelsToUnits: 100 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 2 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
platformSettings: |
|||
- serializedVersion: 2 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
- serializedVersion: 2 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
- serializedVersion: 2 |
|||
buildTarget: iPhone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: c881a10bb6578f04ba6d52f6c3f0c9d6 |
|||
TextureImporter: |
|||
fileIDToRecycleName: {} |
|||
externalObjects: {} |
|||
serializedVersion: 5 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 0 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: -1 |
|||
aniso: 1 |
|||
mipBias: -1 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: -1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 0 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spritePixelsToUnits: 100 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 2 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
platformSettings: |
|||
- serializedVersion: 2 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
- serializedVersion: 2 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
- serializedVersion: 2 |
|||
buildTarget: iPhone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
spritePackingTag: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue