MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ToVariantType

Method ToVariantType

Source/Engine/Utilities/VariantUtils.cs:160–259  ·  view source on GitHub ↗
(this Type type)

Source from the content-addressed store, hash-verified

158
159#if FLAX_EDITOR
160 internal static VariantType ToVariantType(this Type type)
161 {
162 VariantType variantType;
163 if (type == null)
164 variantType = VariantType.Null;
165 else if (type == typeof(void))
166 variantType = VariantType.Void;
167 else if (type == typeof(bool))
168 variantType = VariantType.Bool;
169 else if (type == typeof(short))
170 variantType = VariantType.Int16;
171 else if (type == typeof(ushort))
172 variantType = VariantType.Uint16;
173 else if (type == typeof(int))
174 variantType = VariantType.Int;
175 else if (type == typeof(uint))
176 variantType = VariantType.Uint;
177 else if (type == typeof(long))
178 variantType = VariantType.Int64;
179 else if (type == typeof(ulong))
180 variantType = VariantType.Uint64;
181 else if (type.IsEnum)
182 variantType = VariantType.Enum;
183 else if (type == typeof(float))
184 variantType = VariantType.Float;
185 else if (type == typeof(double))
186 variantType = VariantType.Double;
187 else if (type == typeof(IntPtr))
188 variantType = VariantType.Pointer;
189 else if (type == typeof(string))
190 variantType = VariantType.String;
191 else if (type == typeof(Type))
192 variantType = VariantType.Typename;
193 else if (type == typeof(ScriptType))
194 variantType = VariantType.Typename;
195 else if (typeof(Asset).IsAssignableFrom(type))
196 variantType = VariantType.Asset;
197 else if (typeof(FlaxEngine.Object).IsAssignableFrom(type))
198 variantType = VariantType.Object;
199 else if (type == typeof(BoundingBox))
200 variantType = VariantType.BoundingBox;
201 else if (type == typeof(Transform))
202 variantType = VariantType.Transform;
203 else if (type == typeof(Ray))
204 variantType = VariantType.Ray;
205 else if (type == typeof(Matrix))
206 variantType = VariantType.Matrix;
207 else if (type == typeof(Float2))
208 variantType = VariantType.Float2;
209 else if (type == typeof(Float3))
210 variantType = VariantType.Float3;
211 else if (type == typeof(Float4))
212 variantType = VariantType.Float4;
213 else if (type == typeof(Double2))
214 variantType = VariantType.Double2;
215 else if (type == typeof(Double3))
216 variantType = VariantType.Double3;
217 else if (type == typeof(Double4))

Callers

nothing calls this directly

Calls 4

GetManagedTypeMethod · 0.80
SubstringMethod · 0.80
IsAssignableFromMethod · 0.45

Tested by

no test coverage detected