6 using SiliconStudio.Core.Reflection;
7 using SiliconStudio.Quantum.References;
9 namespace SiliconStudio.Quantum
21 return modelNode.Children.FirstOrDefault(x => x.Name == name);
32 var child = modelNode.GetChild(name);
33 return child != null ? child.ResolveTarget() : null;
45 var child = modelNode.GetChild(name) ?? modelNode.ResolveTarget().GetChild(name);
57 return objReference != null ? objReference.TargetNode : modelNode;
70 Type elementType = null;
71 if (collectionDescriptor != null)
73 elementType = collectionDescriptor.ElementType;
75 else if (dictionaryDescriptor != null)
77 elementType = dictionaryDescriptor.ValueType;
80 if (elementType != null)
82 if (elementType.IsNullable())
83 elementType =
Nullable.GetUnderlyingType(elementType);
85 return elementType.IsPrimitive || elementType == typeof(
string) || elementType.IsEnum;
Provides a descriptor for a System.Collections.ICollection.
static IModelNode GetChildThroughReferences(this IModelNode modelNode, string name)
Gets the child of the given node that matches the given name. If the given node holds an object refer...
static IModelNode GetReferencedChild(this IModelNode modelNode, string name)
Retrieve the child node of the given IModelNode that matches the given name. If the node represents a...
Provides a descriptor for a System.Collections.IDictionary.
Provides access members of a type.
static bool IsPrimitiveCollection(this ITypeDescriptor descriptor)
Gets whether a given ITypeDescriptor represents a collection or a dictionary of primitive values...
static IModelNode ResolveTarget(this IModelNode modelNode)
Gets the target node of the given IModelNode if it holds an object reference, or returns the node its...
static IModelNode GetChild(this IModelNode modelNode, string name)
Retrieve the child node of the given IModelNode that matches the given name.
A class representing a reference to another object that has a different model.
The IModelNode interface represents a node in a model object. A model object is represented by a grap...