Classes: LayoutGeneric

LightWave

ItemMotionHandler LayoutTool Classes Table of Contents

LayoutGeneric

Availability  LightWave 6.0
Component  Layout
Header  lwgeneric.h

Layout generic plug-ins can issue commands to alter the scene. They can also manipulate scene settings at a lower level by saving, altering, and reloading scene files. Generics also supply general-purpose, non-rendering functionality for doing things like configuring external devices, performing scratch calculations, or displaying scene information.

Activation Function

   XCALL_( int ) MyGeneric( long version, GlobalFunc *global,
      LWLayoutGeneric *local, void *serverData );

The local argument to a generic's activation function is an LWLayoutGeneric.

   typedef struct st_LWLayoutGeneric {
      int           (*saveScene)(const char *file);
      int           (*loadScene)(const char *file, const char *name);
      void          *data;
      LWCommandCode (*lookup)   (void *, const char *cmdName);
      int           (*execute)  (void *, LWCommandCode cmd, int argc,
                                   const DynaValue *argv,
                                   DynaValue *result);
      int           (*evaluate) (void *, const char *command);
   } LWLayoutGeneric;
ok = saveScene( filename )
Save the scene in its current state as a LightWave scene file.

ok = loadScene( filename, newname )
Load a scene file. The scene is loaded from the file named in the first argument. The second argument is the default filename for subsequent saving of the scene and the name that will be displayed to the user.

data
An opaque pointer to data used internally by Layout. Pass this as the first argument to the lookup, execute and evaluate functions.

cmdcode = lookup( data, cmdname )
Returns an integer code corresponding to the command name. The command is issued by passing the command code to the execute function. Command codes are constant for a given Layout session, so this only needs to be called once per command, after which the codes can be cached and used multiple times.

result = execute( data, cmdcode, argc, argv, cmdresult )
Issue the command given by the command code argument. argv is an array of DynaValue arguments. argc is the number of arguments in the argv array. The result of the command is written in cmdresult. The function returns 1 if it succeeds or 0 if it does not.

result = evaluate( data, cmdstring )
Issue the command with the name and arguments in the command string. This is an alternative to using lookup and execute. The command and its arguments are written to a single string and delimited by spaces. The function returns 1 if it succeeds or 0 if it does not.

See the Commands pages for a complete list of the commands that can be issued in Layout, as well as a detailed explanation of the formatting of command arguments for both the execute and evaluate methods.

Example

The hello sample is the LightWave version of everybody's favorite "Hello, World!" program. It opens a panel with an edit field, displays messages, and issues a command.