This commit is contained in:
2026-11-24 15:51:02 +01:00
parent cca4d73e41
commit f4aa17114a
22092 changed files with 5042406 additions and 0 deletions
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace UnityEditor.ShaderGraph.Drawing
{
[AttributeUsage(AttributeTargets.Method)]
class BuiltinKeywordAttribute : Attribute
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9c9d769f1b8c48746bca5318ac6d2dfb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
using System;
namespace UnityEditor.ShaderGraph
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
internal abstract class ContextFilterableAttribute : Attribute
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e74ce62c866dd564fb6420aabd9beacf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -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;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 135160e3cb114b679f9d5363c349b289
timeCreated: 1587157677
@@ -0,0 +1,9 @@
using System;
namespace UnityEditor.ShaderGraph
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
internal class NeverAllowedByTargetAttribute : ContextFilterableAttribute
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2c583d077fd8e8e479fe6e4e74df4bee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -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;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 291f21a1598748ba8fe53ab69eb10b5e
timeCreated: 1588090538
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
internal class SRPFilterAttribute : ContextFilterableAttribute
{
public Type[] srpTypes = null;
public SRPFilterAttribute(params Type[] WorksWithSRP)
{
srpTypes = WorksWithSRP;
}
}
internal static class SRPFilterUtil
{
internal static bool IsCompatibleWithSRPs(this AbstractMaterialNode node, HashSet<Type> srpTypes, out HashSet<Type> incompatibleSet)
{
var srpFilter = NodeClassCache.GetAttributeOnNodeType<SRPFilterAttribute>(node.GetType());
incompatibleSet = null;
if (srpFilter == null || srpTypes.IsSubsetOf(srpFilter.srpTypes))
return true;
incompatibleSet = new(srpTypes);
incompatibleSet.ExceptWith(srpFilter.srpTypes);
return false;
}
internal static void GatherSRPCompatibility(this AbstractMaterialNode node, ref HashSet<Type> srpTypes)
{
var srpFilter = NodeClassCache.GetAttributeOnNodeType<SRPFilterAttribute>(node.GetType());
if (srpFilter == null)
return;
HashSet<Type> supportedTypes = new HashSet<Type>(srpFilter.srpTypes);
srpTypes.UnionWith(supportedTypes);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9bdc66ff87a9fb141b0cb9e8aa3ae0bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
internal class SubTargetFilterAttribute : ContextFilterableAttribute
{
public Type[] subTargetTypes = null;
public SubTargetFilterAttribute(params Type[] WorksWithSubTargets)
{
subTargetTypes = WorksWithSubTargets;
}
}
internal static class SubTargetFilterUtil
{
// This is to check actual compatibility with a subtarget.
internal static bool IsSubTargetCompatible(this AbstractMaterialNode node, Type subTarget)
{
var subTargetFilter = NodeClassCache.GetAttributeOnNodeType<SubTargetFilterAttribute>(node.GetType());
if (subTargetFilter == null)
return true;
foreach (var type in subTargetFilter.subTargetTypes)
if (type.IsAssignableFrom(subTarget))
return true;
return false;
}
// This does not check for inheritance, it's mainly for comparing between filters of two or more nodes.
internal static bool IsCompatibleWithSubTargetFilters(this AbstractMaterialNode node, HashSet<Type> subTargetTypes, out HashSet<Type> incompatibleSet)
{
var subTargetFilter = NodeClassCache.GetAttributeOnNodeType<SubTargetFilterAttribute>(node.GetType());
incompatibleSet = null;
if (subTargetFilter == null || subTargetTypes.IsSubsetOf(subTargetFilter.subTargetTypes))
return true;
incompatibleSet = new(subTargetTypes);
incompatibleSet.ExceptWith(subTargetFilter.subTargetTypes);
return false;
}
// This does not gather inherited types, it's for populating the declared subtarget filters.
// There is not currently a case where inherited types would need to be dealt with here, but this won't work
// correctly if that's needed.
internal static void GatherSubTargetCompatibility(this AbstractMaterialNode node, ref HashSet<Type> subTargetTypes)
{
var subTargetFilter = NodeClassCache.GetAttributeOnNodeType<SubTargetFilterAttribute>(node.GetType());
if (subTargetFilter == null)
return;
HashSet<Type> supportedTypes = new HashSet<Type>(subTargetFilter.subTargetTypes);
subTargetTypes.UnionWith(supportedTypes);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d2c11681665d4bbdbfb8e733b901fde5
timeCreated: 1615524028