using System; using System.Collections.Generic; using Newtonsoft.Json; using Unity.Pipeline.Models; namespace Unity.Pipeline.Editor.Commands.Materials { /// /// Result of get_material_properties (CLI-213): the material's shader, render queue, enabled /// keywords, and the full list of shader properties with their current values. /// [Serializable] public class MaterialPropertiesResult { [JsonProperty("assetPath")] public string AssetPath { get; set; } /// Shader name, e.g. "Universal Render Pipeline/Lit". [JsonProperty("shader")] public string Shader { get; set; } /// Render queue; -1 means "inherit from shader". [JsonProperty("renderQueue")] public int RenderQueue { get; set; } [JsonProperty("enabledKeywords")] public List EnabledKeywords { get; set; } = new List(); [JsonProperty("properties")] public List Properties { get; set; } = new List(); } /// A single shader property of a material with its current value. [Serializable] public class MaterialPropertyValue { [JsonProperty("name")] public string Name { get; set; } /// "Float" | "Range" | "Color" | "Vector" | "Texture" | "Int". [JsonProperty("type")] public string Type { get; set; } /// /// number | [r,g,b,a] | [x,y,z,w] | { texture: ObjectRef } | null, per the property type. /// [JsonProperty("value")] public object Value { get; set; } /// Min/max for a Range property; null otherwise. [JsonProperty("range", NullValueHandling = NullValueHandling.Ignore)] public MaterialRange Range { get; set; } } /// Inclusive min/max bounds of a Range shader property. [Serializable] public class MaterialRange { [JsonProperty("min")] public float Min { get; set; } [JsonProperty("max")] public float Max { get; set; } } /// /// Result of set_material_properties (CLI-213): the canonical /// identity of the edited material, extended with which properties applied vs. were unknown (with a /// reason), and the material's (possibly reassigned) shader name. /// [Serializable] public class SetMaterialPropertiesResult : AuthoringResult { /// Shader name after any reassignment. [JsonProperty("shader")] public string Shader { get; set; } /// Property names (and keyword/renderQueue tokens) that were applied. [JsonProperty("applied")] public List Applied { get; set; } = new List(); /// /// Inputs that could not be applied, each as "name: reason" (unknown property name, or a type /// mismatch like "_Metallic: expected Float, got array"). /// [JsonProperty("unknown")] public List Unknown { get; set; } = new List(); } /// A single discovered shader entry from list_shaders. [Serializable] public class ShaderInfo { [JsonProperty("name")] public string Name { get; set; } /// Project asset path for a project shader; null for a built-in/engine shader. [JsonProperty("assetPath")] public string AssetPath { get; set; } [JsonProperty("isBuiltin")] public bool IsBuiltin { get; set; } /// Reflects Shader.isSupported for the active render pipeline. [JsonProperty("isSupported")] public bool IsSupported { get; set; } } /// Result of get_shader_properties (CLI-213): a shader's declared property list. [Serializable] public class ShaderPropertiesResult { [JsonProperty("shader")] public string Shader { get; set; } [JsonProperty("properties")] public List Properties { get; set; } = new List(); } /// A single declared shader property, introspected via ShaderUtil. [Serializable] public class ShaderPropertyInfo { [JsonProperty("name")] public string Name { get; set; } /// ShaderUtil property description (the UI label). [JsonProperty("description")] public string Description { get; set; } /// "Color" | "Vector" | "Float" | "Range" | "TexEnv" | "Int". [JsonProperty("type")] public string Type { get; set; } /// Min/max for a Range property; null otherwise. [JsonProperty("range", NullValueHandling = NullValueHandling.Ignore)] public MaterialRange Range { get; set; } /// "Tex2D" | "Cube" | "Tex3D" | "Tex2DArray" for a TexEnv property; null otherwise. [JsonProperty("textureDimension", NullValueHandling = NullValueHandling.Ignore)] public string TextureDimension { get; set; } /// Property flags, e.g. "HideInInspector", "Normal", "HDR", "NoScaleOffset". [JsonProperty("flags")] public List Flags { get; set; } = new List(); } }