initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
@ -0,0 +1,27 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class TargetActiveBlockContext
|
||||
{
|
||||
public List<BlockFieldDescriptor> activeBlocks { get; private set; }
|
||||
public List<BlockFieldDescriptor> currentBlocks { get; private set; }
|
||||
public PassDescriptor? pass { get; private set; }
|
||||
|
||||
public TargetActiveBlockContext(List<BlockFieldDescriptor> currentBlocks, PassDescriptor? pass)
|
||||
{
|
||||
activeBlocks = new List<BlockFieldDescriptor>();
|
||||
this.currentBlocks = currentBlocks;
|
||||
this.pass = pass;
|
||||
}
|
||||
|
||||
public void AddBlock(BlockFieldDescriptor block, bool conditional = true)
|
||||
{
|
||||
if (conditional == true)
|
||||
{
|
||||
activeBlocks.Add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 860eceef9d9eeb64789007e44a1935fe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,29 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class TargetFieldContext
|
||||
{
|
||||
public List<ConditionalField> conditionalFields { get; private set; }
|
||||
public PassDescriptor pass { get; private set; }
|
||||
public List<(BlockFieldDescriptor descriptor, bool isDefaultValue)> blocks { get; private set; }
|
||||
public List<BlockFieldDescriptor> connectedBlocks { get; private set; }
|
||||
public bool hasDotsProperties { get; private set; }
|
||||
|
||||
// NOTE: active blocks (and connectedBlocks) do not include temporarily added default blocks
|
||||
public TargetFieldContext(PassDescriptor pass, List<(BlockFieldDescriptor descriptor, bool isDefaultValue)> activeBlocks, List<BlockFieldDescriptor> connectedBlocks, bool hasDotsProperties)
|
||||
{
|
||||
conditionalFields = new List<ConditionalField>();
|
||||
this.pass = pass;
|
||||
this.blocks = activeBlocks;
|
||||
this.connectedBlocks = connectedBlocks;
|
||||
this.hasDotsProperties = hasDotsProperties;
|
||||
}
|
||||
|
||||
public void AddField(FieldDescriptor field, bool conditional = true)
|
||||
{
|
||||
conditionalFields.Add(new ConditionalField(field, conditional));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1b72eab244c7bf14cabec1afc06beebb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEditor.Graphing.Util;
|
||||
using UnityEditor.ShaderGraph.Drawing;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class TargetPropertyGUIContext : VisualElement
|
||||
{
|
||||
const int kIndentWidthInPixel = 15;
|
||||
|
||||
public int globalIndentLevel { get; set; } = 0;
|
||||
|
||||
public TargetPropertyGUIContext()
|
||||
{
|
||||
}
|
||||
|
||||
public void AddProperty<T>(string label, BaseField<T> field, bool condition, EventCallback<ChangeEvent<T>> evt)
|
||||
{
|
||||
if (condition == true)
|
||||
{
|
||||
AddProperty<T>(label, field, evt);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddProperty<T>(string label, int indentLevel, BaseField<T> field, bool condition, EventCallback<ChangeEvent<T>> evt)
|
||||
{
|
||||
if (condition == true)
|
||||
{
|
||||
AddProperty<T>(label, indentLevel, field, evt);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddProperty<T>(string label, BaseField<T> field, EventCallback<ChangeEvent<T>> evt)
|
||||
{
|
||||
AddProperty<T>(label, 0, field, evt);
|
||||
}
|
||||
|
||||
public void AddProperty<T>(string label, int indentLevel, BaseField<T> field, EventCallback<ChangeEvent<T>> evt)
|
||||
{
|
||||
AddProperty<T>(label, string.Empty, indentLevel, field, evt);
|
||||
}
|
||||
|
||||
public void AddProperty<T>(string label, string tooltip, int indentLevel, BaseField<T> field, EventCallback<ChangeEvent<T>> evt)
|
||||
{
|
||||
if (field is INotifyValueChanged<T> notifyValueChanged)
|
||||
{
|
||||
notifyValueChanged.RegisterValueChangedCallback(evt);
|
||||
}
|
||||
|
||||
var propertyLabel = new Label(label);
|
||||
propertyLabel.tooltip = tooltip;
|
||||
var propertyRow = new PropertyRow(propertyLabel);
|
||||
|
||||
ApplyPadding(propertyRow, indentLevel);
|
||||
propertyRow.Add(field);
|
||||
this.hierarchy.Add(propertyRow);
|
||||
}
|
||||
|
||||
public void AddLabel(string label, int indentLevel)
|
||||
{
|
||||
var propertyRow = new PropertyRow(new Label(label));
|
||||
ApplyPadding(propertyRow, indentLevel);
|
||||
this.hierarchy.Add(propertyRow);
|
||||
}
|
||||
|
||||
public void AddHelpBox(MessageType messageType, string messageText)
|
||||
{
|
||||
var helpBox = new HelpBoxRow(messageType);
|
||||
helpBox.Add(new Label(messageText));
|
||||
this.hierarchy.Add(helpBox);
|
||||
}
|
||||
|
||||
void ApplyPadding(PropertyRow row, int indentLevel)
|
||||
{
|
||||
row.Q(className: "unity-label").style.marginLeft = (globalIndentLevel + indentLevel) * kIndentWidthInPixel;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5b0e9f1f7df8dc34a984c30b56cf998b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEditor.ShaderGraph
|
||||
{
|
||||
[GenerationAPI]
|
||||
internal class TargetSetupContext
|
||||
{
|
||||
public List<SubShaderDescriptor> subShaders { get; private set; }
|
||||
public List<(string shaderGUI, string renderPipelineAssetType)> customEditorForRenderPipelines { get; private set; }
|
||||
public AssetCollection assetCollection { get; private set; }
|
||||
public string defaultShaderGUI { get; private set; }
|
||||
|
||||
// pass a HashSet to the constructor to have it gather asset dependency GUIDs
|
||||
public TargetSetupContext(AssetCollection assetCollection = null)
|
||||
{
|
||||
subShaders = new List<SubShaderDescriptor>();
|
||||
this.customEditorForRenderPipelines = new List<(string shaderGUI, string renderPipelineAssetType)>();
|
||||
this.assetCollection = assetCollection;
|
||||
}
|
||||
|
||||
public void AddSubShader(SubShaderDescriptor subShader)
|
||||
{
|
||||
subShaders.Add(subShader);
|
||||
}
|
||||
|
||||
public void AddAssetDependency(GUID guid, AssetCollection.Flags flags)
|
||||
{
|
||||
assetCollection?.AddAssetDependency(guid, flags);
|
||||
}
|
||||
|
||||
public void SetDefaultShaderGUI(string defaultShaderGUI)
|
||||
{
|
||||
this.defaultShaderGUI = defaultShaderGUI;
|
||||
}
|
||||
|
||||
public void AddCustomEditorForRenderPipeline(string shaderGUI, Type renderPipelineAssetType)
|
||||
{
|
||||
this.customEditorForRenderPipelines.Add((shaderGUI, renderPipelineAssetType.FullName));
|
||||
}
|
||||
|
||||
public bool HasCustomEditorForRenderPipeline(Type renderPipelineAssetType)
|
||||
=> this.customEditorForRenderPipelines.Any(c => c.renderPipelineAssetType == renderPipelineAssetType.FullName);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b681d2c61f5433e4e9be20bfb43db249
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue