Exemplo n.º 1
0
        /// <summary>
        /// Return the type of the direct descendants of the node
        /// </summary>
        /// <param name="mDagPath"></param>
        /// <returns> Return Mesh, Camera, Light or Unknown</returns>
        private MFn.Type getApiTypeOfDirectDescendants(MDagPath mDagPath)
        {
            for (uint i = 0; i < mDagPath.childCount; i++)
            {
                MObject    childObject = mDagPath.child(i);
                MFnDagNode nodeObject  = new MFnDagNode(childObject);

                switch (childObject.apiType)
                {
                case MFn.Type.kMesh:
                    if (IsMeshExportable(nodeObject, mDagPath))
                    {
                        return(MFn.Type.kMesh);
                    }
                    break;

                case MFn.Type.kCamera:
                    if (IsCameraExportable(nodeObject, mDagPath))
                    {
                        return(MFn.Type.kCamera);
                    }
                    break;
                }
                // Lights api type are kPointLight, kSpotLight...
                // Easier to check if has generic light function set rather than check all cases
                if (mDagPath.hasFn(MFn.Type.kLight) && IsLightExportable(nodeObject, mDagPath))
                {
                    // Return generic kLight api type
                    return(MFn.Type.kLight);
                }
            }

            return(MFn.Type.kUnknown);
        }