public static bool HasNode(this IILayer layer, IINode node, bool checkInChild = true) { #if MAX2020 ITab <IINode> nodes = Loader.Global.INodeTab.Create(); #else ITab <IINode> nodes = Loader.Global.INodeTabNS.Create(); #endif IILayerProperties layerProperties = Loader.IIFPLayerManager.GetLayer(layer.Name); layerProperties.Nodes(nodes); foreach (IINode n in Tools.ITabToIEnumerable(nodes)) { if (node.Handle == n.Handle) { return(true); } } for (int i = 0; i < layer.NumOfChildLayers; i++) { IILayer child = layer.GetChildLayer(i); if (child.HasNode(node, checkInChild)) { return(true); } } return(false); }
/// <summary> /// Returns all child IINode objects of provided IILayer. /// </summary> /// <param name="layer"></param> /// <returns></returns> public static IEnumerable <IINode> GetChildNodes(IILayer layer) { IILayerProperties layerProps = GetLayerProperties(layer); ITab <IINode> layerNodes = GlobalInterface.Instance.Tab.Create <IINode>(); layerProps.Nodes(layerNodes); for (int i = 0; i < layerNodes.Count; i++) { yield return(layerNodes[(IntPtr)i]); } }
public static IEnumerable <IINode> LayerNodes(this IILayer layer) { IILayerProperties layerProp = Loader.IIFPLayerManager.GetLayer(layer.Name); #if MAX2020 ITab <IINode> nodes = Loader.Global.INodeTab.Create(); #else ITab <IINode> nodes = Loader.Global.INodeTabNS.Create(); #endif layerProp.Nodes(nodes); return(Tools.ITabToIEnumerable(nodes)); }