File Type Pattern

Availability LightWave 6.0 | Component  Layout, Modeler | Header lwhost.h

This global returns a function that allows plug-ins to retrieve file name pattern strings. These can be used to translate the string in the fileType passed to file request plug-ins into a literal filter string.

Global Call

   LWFileTypeFunc *filetypes;
   filetypes = global( LWFILETYPEFUNC_GLOBAL, GFUSE_TRANSIENT );

The global function returns a pointer to an LWFileTypeFunc.

   typedef const char * LWFileTypeFunc (const char *type);

The type argument identifies the kind of file you want a pattern string for. It can be any of the following.

   LWFTYPE_ANIMATION    LWFTYPE_OBJECT     LWFTYPE_SCENE
   LWFTYPE_IMAGE        LWFTYPE_PLUGIN     LWFTYPE_SETTING
   LWFTYPE_ENVELOPE     LWFTYPE_PREVIEW    LWFTYPE_SURFACE
   LWFTYPE_MOTION       LWFTYPE_PSFONT

The association between a type string and a literal filter is usually stored in the configuration file. Pattern strings are platform-specific. Under Windows, the string is a list of wildcard extensions separated by semicolons, e.g. *.iff;*.tga for images. On the Mac, the string is a list of 4-character file types, also separated by semicolons. The Unix string uses a regular expression.

Example

This code fragment obtains the pattern string for image files.

   #include <lwserver.h>
   #include <lwhost.h>

   char *imgpat;
   LWFileTypeFunc *filetypes;

   filetypes = global( LWFILETYPEFUNC_GLOBAL, GFUSE_TRANSIENT );
   if ( filetypes )
      imgpat = filetypes( LWFTYPE_IMAGE );
   ...