Namespace: | Sirenix.OdinInspector.Editor.ValueResolvers |
Assembly: | Sirenix.OdinInspector.Editor |
public abstract class ValueResolver
A ValueResolver resolves a string to a value of a given type, given an InspectorProperty instance to use as context. Call Get<TResult>(InspectorProperty, String) to get an instance of a ValueResolver.
Value resolvers are a globally extendable system that can be hooked into and modified or changed by creating and registering a ValueResolverCreator.
See Odin's tutorials for details and examples of how to use ValueResolvers.
protected ValueResolver()
public ValueResolverContext Context
public string ErrorMessage { get; }
public bool HasError { get; }
public abstract Type ValueType { get; }
public void DrawError()
public static void DrawErrors(ValueResolver r1 = null, ValueResolver r2 = null, ValueResolver r3 = null, ValueResolver r4 = null, ValueResolver r5 = null, ValueResolver r6 = null, ValueResolver r7 = null, ValueResolver r8 = null)
ValueResolver | r1 | |
ValueResolver | r2 | |
ValueResolver | r3 | |
ValueResolver | r4 | |
ValueResolver | r5 | |
ValueResolver | r6 | |
ValueResolver | r7 | |
ValueResolver | r8 |
public static void DrawErrors(ValueResolver r1 = null, ValueResolver r2 = null, ValueResolver r3 = null, ValueResolver r4 = null, ValueResolver r5 = null, ValueResolver r6 = null, ValueResolver r7 = null, ValueResolver r8 = null, params ValueResolver[] remainder)
ValueResolver | r1 | |
ValueResolver | r2 | |
ValueResolver | r3 | |
ValueResolver | r4 | |
ValueResolver | r5 | |
ValueResolver | r6 | |
ValueResolver | r7 | |
ValueResolver | r8 | |
ValueResolver[] | remainder |
public static ValueResolver Get(Type resultType, InspectorProperty property, string resolvedString)
System.Type | resultType | The type of value that the new resolver should resolve. |
InspectorProperty | property | The property that is the context for the resolution to happen in. |
System.String | resolvedString | The string that should be resolved to a value. |
ValueResolver |
public static ValueResolver Get(Type resultType, InspectorProperty property, string resolvedString, params NamedValue[] namedArgs)
System.Type | resultType | The type of value that the new resolver should resolve. |
InspectorProperty | property | The property that is the context for the resolution to happen in. |
System.String | resolvedString | The string that should be resolved to a value. |
NamedValue[] | namedArgs | The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg. |
ValueResolver |
public static ValueResolver Get(Type resultType, InspectorProperty property, string resolvedString, object fallbackValue)
System.Type | resultType | The type of value that the new resolver should resolve. |
InspectorProperty | property | The property that is the context for the resolution to happen in. |
System.String | resolvedString | The string that should be resolved to a value. |
System.Object | fallbackValue | The value that the resolver should return if the string cannot be resolved to anything, or if there is an error in creating a resolver, or if resolution itself throws an exception. |
ValueResolver |
public static ValueResolver Get(Type resultType, InspectorProperty property, string resolvedString, object fallbackValue, params NamedValue[] namedArgs)
System.Type | resultType | The type of value that the new resolver should resolve. |
InspectorProperty | property | The property that is the context for the resolution to happen in. |
System.String | resolvedString | The string that should be resolved to a value. |
System.Object | fallbackValue | The value that the resolver should return if the string cannot be resolved to anything, or if there is an error in creating a resolver, or if resolution itself throws an exception. |
NamedValue[] | namedArgs | The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg. |
ValueResolver |
public static ValueResolver<TResult> Get<TResult>(InspectorProperty property, string resolvedString)
InspectorProperty | property | The property that is the context for the resolution to happen in. |
System.String | resolvedString | The string that should be resolved to a value. |
ValueResolver<TResult> |
TResult | The type of value that the new resolver should resolve. |
public static ValueResolver<TResult> Get<TResult>(InspectorProperty property, string resolvedString, TResult fallbackValue)
InspectorProperty | property | The property that is the context for the resolution to happen in. |
System.String | resolvedString | The string that should be resolved to a value. |
TResult | fallbackValue | The value that the resolver should return if the string cannot be resolved to anything, or if there is an error in creating a resolver, or if resolution itself throws an exception. |
ValueResolver<TResult> |
TResult | The type of value that the new resolver should resolve. |
public static ValueResolver<TResult> Get<TResult>(InspectorProperty property, string resolvedString, TResult fallbackValue, params NamedValue[] namedArgs)
InspectorProperty | property | The property that is the context for the resolution to happen in. |
System.String | resolvedString | The string that should be resolved to a value. |
TResult | fallbackValue | The value that the resolver should return if the string cannot be resolved to anything, or if there is an error in creating a resolver, or if resolution itself throws an exception. |
NamedValue[] | namedArgs | The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg. |
ValueResolver<TResult> |
TResult | The type of value that the new resolver should resolve. |
public static ValueResolver<TResult> Get<TResult>(InspectorProperty property, string resolvedString, params NamedValue[] namedArgs)
InspectorProperty | property | The property that is the context for the resolution to happen in. |
System.String | resolvedString | The string that should be resolved to a value. |
NamedValue[] | namedArgs | The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg. |
ValueResolver<TResult> |
TResult | The type of value that the new resolver should resolve. |
public static string GetCombinedErrors(ValueResolver r1 = null, ValueResolver r2 = null, ValueResolver r3 = null, ValueResolver r4 = null, ValueResolver r5 = null, ValueResolver r6 = null, ValueResolver r7 = null, ValueResolver r8 = null)
ValueResolver | r1 | |
ValueResolver | r2 | |
ValueResolver | r3 | |
ValueResolver | r4 | |
ValueResolver | r5 | |
ValueResolver | r6 | |
ValueResolver | r7 | |
ValueResolver | r8 |
System.String |
public static string GetCombinedErrors(ValueResolver r1, ValueResolver r2, ValueResolver r3, ValueResolver r4, ValueResolver r5, ValueResolver r6, ValueResolver r7, ValueResolver r8, params ValueResolver[] remainder)
ValueResolver | r1 | |
ValueResolver | r2 | |
ValueResolver | r3 | |
ValueResolver | r4 | |
ValueResolver | r5 | |
ValueResolver | r6 | |
ValueResolver | r7 | |
ValueResolver | r8 | |
ValueResolver[] | remainder |
System.String |
Creates a new value resolver instance meant to resolve a string value in particular. This is a shorthand for creating a string resolver that has the resolved string as a fallback value.
This special case will get you the behaviour where, if you pass in a string that is not meant to be resolved in a special way, the value resolver will just pass you that string back as the result value.
public static ValueResolver<string> GetForString(InspectorProperty property, string resolvedString)
InspectorProperty | property | The property that is the context for the resolution to happen in. |
System.String | resolvedString | The string that should be resolved to a value. |
ValueResolver<System.String> |
Creates a new value resolver instance meant to resolve a string value in particular. This is a shorthand for creating a string resolver that has the resolved string as a fallback value.
This special case will get you the behaviour where, if you pass in a string that is not meant to be resolved in a special way, the value resolver will just pass you that string back as the result value.
public static ValueResolver<string> GetForString(InspectorProperty property, string resolvedString, params NamedValue[] namedArgs)
InspectorProperty | property | The property that is the context for the resolution to happen in. |
System.String | resolvedString | The string that should be resolved to a value. |
NamedValue[] | namedArgs | The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg. |
ValueResolver<System.String> |
public static ValueResolver<TResult> GetFromContext<TResult>(ref ValueResolverContext context)
ValueResolverContext | context | The pre-built context that should be used to get a resolver. |
ValueResolver<TResult> |
TResult |
public static ValueResolver GetFromContextWeak(ref ValueResolverContext context)
ValueResolverContext | context | The pre-built context that should be used to get a resolver. |
ValueResolver |
public abstract object GetWeakValue(int selectionIndex = 0)
System.Int32 | selectionIndex | The selection index at which to get the value, in the case of multi-selection. Defaults to 0. |
System.Object | The value that was gotten. |