Ejemplo n.º 1
0
        /// <summary>
        /// Creates an IILayer in 3ds Max.
        /// </summary>
        /// <returns>Returns the created IILayer</returns>
        public static IILayer CreateLayer(Boolean makeCurrent, Boolean addSelection)
        {
            IILayer layer = GlobalInterface.Instance.COREInterface14.LayerManager.CreateLayer();

            if (makeCurrent)
            {
                SetCurrentLayer(layer);
            }

            if (addSelection)
            {
                MaxNodes.MoveNodesToLayer(MaxNodes.SelectedNodes, layer);
            }

            return(layer);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deletes the provided IILayer object, and optionally all child nodes.
        /// </summary>
        /// <param name="layer"></param>
        /// <param name="deleteNodes"></param>
        public static void DeleteLayer(IILayer layer, Boolean deleteNodes)
        {
            // Check if layer has any child nodes.
            // If layer has children, this prevents the layer from being deleted.
            // Loop through all the children and delete them.
            if (deleteNodes)
            {
                using (IILayerProperties layerProps = GetLayerProperties(layer))
                {
                    IEnumerable <IINode> maxNodes = GetChildNodes(layer);
                    foreach (IINode maxNode in maxNodes)
                    {
                        MaxNodes.DeleteNode(maxNode);
                    }
                }
            }

            MaxInterfaces.Instance.FPLayerManager.DeleteLayer(layer.Name);
        }