A game about forced loneliness, made by TACStudios
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4using UnityEngine.UIElements;
5using UnityEditor.ShaderGraph.Serialization;
6
7namespace UnityEditor.ShaderGraph
8{
9 [Serializable, GenerationAPI] // TODO: Public
10 internal abstract class SubTarget : JsonObject
11 {
12 internal abstract Type targetType { get; }
13 internal Target target { get; set; }
14 public string displayName { get; set; }
15 public bool isHidden { get; set; }
16 public abstract bool IsActive();
17 public abstract void Setup(ref TargetSetupContext context);
18 public abstract void GetFields(ref TargetFieldContext context);
19 public abstract void GetActiveBlocks(ref TargetActiveBlockContext context);
20 public abstract void GetPropertiesGUI(ref TargetPropertyGUIContext context, Action onChange, Action<String> registerUndo);
21
22 public virtual void CollectShaderProperties(PropertyCollector collector, GenerationMode generationMode) { }
23 public virtual void ProcessPreviewMaterial(Material material) { }
24 public virtual object saveContext => null;
25 public virtual bool IsNodeAllowedBySubTarget(Type nodeType) => true;
26
27 // Call after SubTarget parent Target has been deserialized and Subtarget.target has been set to a non-null value.
28 internal virtual void OnAfterParentTargetDeserialized() { }
29 }
30
31 [GenerationAPI] // TODO: Public
32 internal abstract class SubTarget<T> : SubTarget where T : Target
33 {
34 internal override Type targetType => typeof(T);
35
36 public new T target
37 {
38 get => base.target as T;
39 set => base.target = value;
40 }
41 }
42}