Skip to content

[9.x.x] Internal Inspector #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 77 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
9b394e6
Initial implementation
Kink3d Nov 7, 2019
b1bc7a6
Remove Master Preview
Kink3d Nov 7, 2019
a1da944
Migrate blackboard field views
Kink3d Nov 8, 2019
e39f40f
Migrate graph options
Kink3d Nov 8, 2019
e8458a8
Inspectable StickyNotes
Kink3d Nov 8, 2019
9bf669f
Handle other selectables
Kink3d Nov 8, 2019
6940b26
Fix for shader graph nodes not pasting at the cursor location
sainarayan-cse Feb 18, 2020
a817799
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Feb 18, 2020
bb72709
Revert "Fix for shader graph nodes not pasting at the cursor location"
Nightmask3 Feb 18, 2020
847d7ab
Added comments
Nightmask3 Feb 20, 2020
c5e482d
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Feb 24, 2020
2195af3
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Feb 26, 2020
73249d3
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Feb 28, 2020
46551c4
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Mar 3, 2020
6bcec64
Reflection based data gathering for the inspector
Nightmask3 Mar 4, 2020
e0080cf
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Mar 4, 2020
1e808db
Added property drawers and drawer registration with view to handle ce…
Nightmask3 Mar 5, 2020
85c8ae0
Added GraphSubWindow class and switched inspector over to it
Nightmask3 Mar 10, 2020
7d37d2d
fixed scrolling issues and single object selection
Nightmask3 Mar 10, 2020
29a6520
Added GetUnderlyingObject() to IInspectable
Nightmask3 Mar 11, 2020
490881f
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Mar 11, 2020
a49ac71
Moved property drawer stuff to its own class file
Nightmask3 Mar 12, 2020
ad9543f
Added float/slider property drawers
Nightmask3 Mar 17, 2020
a30ad23
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Mar 17, 2020
4b86947
Removed ugly callback mess, running into issues with UI updating
Nightmask3 Mar 17, 2020
696b8b1
Finished vector1 property drawer support
Nightmask3 Mar 18, 2020
c53758a
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Mar 18, 2020
d5de054
Finished porting blackboard to property drawer system
Nightmask3 Mar 23, 2020
618261d
Removing exception for MaterialNodeView
Nightmask3 Mar 24, 2020
56ebea6
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Mar 24, 2020
718ed66
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Mar 24, 2020
7a735e1
Merge branch 'master' into sg/inspectorview-v2
Nightmask3 Mar 26, 2020
3af7441
Fixed compilation issues with merge
Nightmask3 Mar 26, 2020
42d25b7
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
Nightmask3 Mar 26, 2020
79cb5ba
Merge branch 'master' into sg/inspectorview-v2
Nightmask3 Mar 26, 2020
f8f9715
Added missing files from master
Nightmask3 Mar 26, 2020
0f421d6
Fixed issue with undo/redo killing the blackboard property selection
Nightmask3 Mar 27, 2020
9f52081
Fixed issues with updating inspector
Nightmask3 Mar 30, 2020
8213926
Added support for HDRP and removed old settings views for master nodes
sainarayan-cse Apr 16, 2020
1f9c796
updated changelog
sainarayan-cse Apr 16, 2020
3d29416
Fixed softlock bug when connecting master nodes and making keywords
sainarayan-cse Apr 16, 2020
3a63294
Converted unsafe cast to safe cast
sainarayan-cse Apr 16, 2020
16075a4
converted is to equality check
sainarayan-cse Apr 16, 2020
6aa0ec1
Merge branch 'master' into sg/inspectorview-v2
sainarayan-cse Apr 17, 2020
a7616a3
Removed changes to master nodes to get more clean PR for inspector
sainarayan-cse Apr 17, 2020
179df8a
Added master node views back for universal nodes
sainarayan-cse Apr 17, 2020
3c3c20f
more fixes for PR cleanup
sainarayan-cse Apr 17, 2020
b94a5d9
Fixing issue to prevent touching HD files in PR
sainarayan-cse Apr 17, 2020
f865524
Trying to reduce master branch delta
sainarayan-cse Apr 17, 2020
a11ba53
issues with CRLF vs LF
sainarayan-cse Apr 17, 2020
039a7a0
More cleanup for PR submission
sainarayan-cse Apr 17, 2020
69e928b
undoing unrelated change to xr file
sainarayan-cse Apr 17, 2020
933f6b3
undoing change to xr file
sainarayan-cse Apr 17, 2020
acde56b
not sure why it keeps undoing itself
sainarayan-cse Apr 17, 2020
c3df6fe
more pre-PR cleanup
sainarayan-cse Apr 17, 2020
60649b0
fixed weird styling issue with property rows
sainarayan-cse Apr 17, 2020
d3c67d8
Fixing issue with scrollbars being visible on hidden inspector
sainarayan-cse Apr 17, 2020
63b8f3a
Fixing issue with exception when boolean default changed
sainarayan-cse Apr 17, 2020
49d3b75
fixed issue with sampler state reference name not updating
sainarayan-cse Apr 17, 2020
471a389
Fixed a bunch of bugs and added support for property node views
sainarayan-cse Apr 21, 2020
f11a7be
removed code to handle min > max and vice versa for now
sainarayan-cse Apr 21, 2020
b105f46
should handle reverse sliders
sainarayan-cse Apr 21, 2020
89afe4e
Fixed issue with slider property drawing
sainarayan-cse Apr 21, 2020
41ad40e
Fixed issue with min/max sliders
sainarayan-cse Apr 23, 2020
587eec2
undoing change for PR cleanup
sainarayan-cse Apr 23, 2020
4fc2340
cleaned up files for PR
sainarayan-cse Apr 23, 2020
500c175
Added test to check if slider property range has min < max
sainarayan-cse Apr 23, 2020
eb80a60
swapped values for min/max slider range test property
sainarayan-cse Apr 23, 2020
a3f7cdf
Added fix for slider behavior and graph sub-window serialization
sainarayan-cse Apr 28, 2020
500a509
Removed TODOs, separated property drawers into individual files
sainarayan-cse Apr 28, 2020
ec3ecbf
Fixed up vector2 property drawer
sainarayan-cse Apr 28, 2020
e6406ed
Merge branch 'master' into sg/inspectorview-v2
sainarayan-cse Apr 28, 2020
31b8c76
addressing more review coments from Marc
sainarayan-cse Apr 29, 2020
89389dc
Merge branch 'master' into sg/inspectorview-v2
sainarayan-cse Apr 29, 2020
b7b9227
Merge branch 'master' into sg/inspectorview-v2
sainarayan-cse Apr 29, 2020
09c4ef5
removed commented code [skip ci]
sainarayan-cse Apr 29, 2020
635988a
removing unneeded access modifiers
sainarayan-cse Apr 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using UnityEngine;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Internal;

namespace UnityEditor.ShaderGraph.UnitTests
{
[TestFixture]
internal class PropertyTests
{
static string kGraphName = "Assets/CommonAssets/Graphs/Properties.shadergraph";
GraphData m_Graph;

PropertyCollector m_Collector;

Dictionary<string, PreviewNode> m_TestNodes = new Dictionary<string, PreviewNode>();

[OneTimeSetUp]
public void LoadGraph()
{
List<PropertyCollector.TextureInfo> lti;
var lsadp = new List<string>();
ShaderGraphImporter.GetShaderText(kGraphName, out lti, lsadp, out m_Graph);
Assert.NotNull(m_Graph, $"Invalid graph data found for {kGraphName}");

m_Graph.ValidateGraph();

m_Collector = new PropertyCollector();
m_Graph.CollectShaderProperties(m_Collector, GenerationMode.ForReals);
}

[Test]
public void SliderPropertyRangeMinLesserThanMax()
{
foreach(AbstractShaderProperty property in m_Collector.properties)
{
if (property is Vector1ShaderProperty vector1ShaderProperty && vector1ShaderProperty.floatType == FloatType.Slider)
{
Assert.IsTrue(vector1ShaderProperty.rangeValues.x < vector1ShaderProperty.rangeValues.y,
"Slider property cannot have min be greater than max!");
}
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"m_SerializedProperties": [
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty"
},
"JSONnodeData": "{\n \"m_Guid\": {\n \"m_GuidSerialized\": \"d13f1c8f-912c-4202-88dd-1d81f762d260\"\n },\n \"m_Name\": \"FlippedSliderProperty\",\n \"m_DefaultReferenceName\": \"Vector1_829D8397\",\n \"m_OverrideReferenceName\": \"\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Precision\": 0,\n \"m_GPUInstanced\": false,\n \"m_Hidden\": false,\n \"m_Value\": 1.0,\n \"m_FloatType\": 1,\n \"m_RangeValues\": {\n \"x\": 1.0,\n \"y\": -1.0\n }\n}"
}
],
"m_SerializedKeywords": [],
"m_SerializableNodes": [
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.PropertyNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"419f7fde-45d3-413d-a681-3f80de32bc31\",\n \"m_GroupGuidSerialized\": \"a0c9f82f-8f00-4690-8ef3-bf4079519d15\",\n \"m_Name\": \"Property\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -551.0000610351563,\n \"y\": 283.0,\n \"width\": 190.00001525878907,\n \"height\": 34.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"FlippedSliderProperty\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_PropertyGuidSerialized\": \"d13f1c8f-912c-4202-88dd-1d81f762d260\"\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.PreviewNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"47df49fd-91a7-4c8a-8404-c3710b050632\",\n \"m_GroupGuidSerialized\": \"a0c9f82f-8f00-4690-8ef3-bf4079519d15\",\n \"m_Name\": \"Preview\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -301.00006103515627,\n \"y\": 242.0,\n \"width\": 208.0,\n \"height\": 278.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"In\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"In\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_Width\": 208.0,\n \"m_Height\": 208.0\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.UnlitMasterNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"faac5ed4-8a55-4c7e-a36f-e4380ae3593a\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Unlit Master\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 287.0,\n \"y\": 168.99998474121095,\n \"width\": 200.00001525878907,\n \"height\": 197.00001525878907\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 9,\\n \\\"m_DisplayName\\\": \\\"Vertex Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Position\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.NormalMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 10,\\n \\\"m_DisplayName\\\": \\\"Vertex Normal\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Normal\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.TangentMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 11,\\n \\\"m_DisplayName\\\": \\\"Vertex Tangent\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Tangent\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.ColorRGBMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Color\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Color\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.7353569269180298,\\n \\\"y\\\": 0.7353569269180298,\\n \\\"z\\\": 0.7353569269180298\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_ColorMode\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"Alpha\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Alpha\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.5,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_SurfaceType\": 0,\n \"m_AlphaMode\": 0,\n \"m_TwoSided\": false,\n \"m_AddPrecomputedVelocity\": false,\n \"m_DOTSInstancing\": false,\n \"m_ShaderGUIOverride\": \"\",\n \"m_OverrideEnabled\": false\n}"
}
],
"m_Groups": [
{
"m_GuidSerialized": "a0c9f82f-8f00-4690-8ef3-bf4079519d15",
"m_Title": "Min < Max",
"m_Position": {
"x": 10.0,
"y": 10.0
}
}
],
"m_StickyNotes": [],
"m_SerializableEdges": [
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"419f7fde-45d3-413d-a681-3f80de32bc31\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"47df49fd-91a7-4c8a-8404-c3710b050632\"\n }\n}"
}
],
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
"m_Guid": ""
}
},
"m_Path": "Shader Graphs",
"m_ConcretePrecision": 0,
"m_ActiveOutputNodeGuidSerialized": "faac5ed4-8a55-4c7e-a36f-e4380ae3593a"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions com.unity.render-pipelines.core/Editor/Drawing.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions com.unity.shadergraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
### Added
- Added the Internal Inspector which allows the user to view data contained in selected nodes and properties in a new floating graph sub-window. Also added support for custom property drawers to let you visualize any data type you like and expose it to the inspector.
- Added samples for Procedural Patterns to the package.
- You can now use the right-click context menu to delete Sticky Notes.
- You can now save your graph as a new Asset.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;

namespace UnityEditor.ShaderGraph.Drawing
{
[AttributeUsage(AttributeTargets.Property)]
public class InspectableAttribute : Attribute
{
// String value to use in the Property name TextLabel
public string labelName { get; private set; }

// The default value of this property
public object defaultValue { get; private set; }

// String value to supply if you wish to use a custom style when drawing this property
public string customStyleName { get; private set; }

public InspectableAttribute(string labelName, object defaultValue, string customStyleName = "")
{
this.labelName = labelName;
this.defaultValue = defaultValue;
this.customStyleName = customStyleName;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace UnityEditor.ShaderGraph.Drawing
{
[AttributeUsage(AttributeTargets.Class)]
public class SGPropertyDrawerAttribute : Attribute
{
public Type propertyType { get; private set; }

public SGPropertyDrawerAttribute(Type propertyType)
{
this.propertyType = propertyType;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using UnityEngine.UIElements;

namespace UnityEditor.Graphing
{
interface ICanChangeShaderGUI
Expand Down
25 changes: 25 additions & 0 deletions com.unity.shadergraph/Editor/Data/Interfaces/IInspectable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Reflection;
using Data.Interfaces;
using Drawing.Inspector;
using UnityEngine.UIElements;

namespace UnityEditor.ShaderGraph.Drawing
{
interface IInspectable
{
// Implementors can override this in order to display their desired string when selected and viewed through the inscetor
string inspectorTitle { get; }

// This function should return the underlying data object that user wishes to expose to the Inspector
object GetObjectToInspect();

// This function should return the property information of whatever object has been marked up for metadata gathering by the inspector
// This might be the same as the object returned by GetObjectToInspect(), it might not
PropertyInfo[] GetPropertyInfo();

// Used to provide any data needed by the property drawer from the inspectable
// The inspectorUpdateDelegate is used to trigger an inspector update
void SupplyDataToPropertyDrawer(IPropertyDrawer propertyDrawer, Action inspectorUpdateDelegate);
}
}
11 changes: 11 additions & 0 deletions com.unity.shadergraph/Editor/Data/Interfaces/IInspectable.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions com.unity.shadergraph/Editor/Data/Interfaces/IPropertyDrawer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Reflection;
using UnityEditor.ShaderGraph.Drawing;
using UnityEngine.UIElements;

namespace Data.Interfaces
{
// Interface that should be implemented by any property drawer for the inspector view
public interface IPropertyDrawer
{
Action inspectorUpdateDelegate { get; set; }

VisualElement DrawProperty(PropertyInfo propertyInfo, object actualObject, InspectableAttribute attribute);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using UnityEditor.ShaderGraph.Drawing.Colors;
using UnityEditor.ShaderGraph.Internal;
using UnityEditor.Graphing.Util;
using UnityEditor.ShaderGraph.Drawing;

namespace UnityEditor.ShaderGraph
{
Expand Down Expand Up @@ -104,6 +105,7 @@ public virtual bool canSetPrecision

private ConcretePrecision m_ConcretePrecision = ConcretePrecision.Float;

[Inspectable("Precision", ConcretePrecision.Float)]
public ConcretePrecision concretePrecision
{
get => m_ConcretePrecision;
Expand Down
Loading