Modeler Commands Layout Commands Commands Table of Contents

Common Commands

These commands are available in both Layout and Modeler. They're handled by a set of editor modules that are common to both programs. Although the editors are represented to the user as separate windows, you can issue most of these commands regardless of whether the editor's window is open.

In the command list that follows, the data types of the arguments are denoted by the initial letter. (The same letters are used in C printf formatting.)

An integer.
A floating-point number.
A string, such as a filename or channel name.
A hexadecimal number. The value should be preceeded by "0x" or "0X". If it does not, some hexadecimal values may be confused with decimal values. Some data arguments can be 32bits or 64bits depending on the OS platform in use. Channel IDs and Channel Group IDs fall into this category. Although an item identifier (LWItemID) may appear to be 64bit value on some platforms, only the lower 32bits is ever used. Be mindful of how the '%p' printf type (useful for outputting 64bit hexidecimal values) functions on various platforms; some will prefix "0x" and some will not. It is essential that 64bit arguments be specified in hexidecimal format with the prefixed "0x" or "0X".

Surface Editor

The Surface Editor is a window for setting and changing surface parameters. These commands are a counterpart to the Surface Functions global.

Surf_SetWindowPos nx ny
Open and close the Surface Editor window, and set its position. In Layout, SurfaceEditor is a synonym for Surf_OpenWindow and Surf_CloseWindow.

Surf_SetSurf ssurfname sobjname
Set the current surface in the Surface Editor. All of the surface commands that modify surface parameters operate on the current surface. The object name is the name returned by the Item Info name function in Layout and the State Query object function in Modeler.

Surf_SetInt schannel nvalue
Set the integer value associated with the surface channel. Use this to add or remove an envelope or a texture (equivalent to pressing the E or T buttons in the interface). The channel name can be any of the strings defined in lwsurf.h. The value is one of the following.

0 - no envelope, no texture
1 - envelope, no texture
2 - texture, no envelope
3 - envelope and texture

Once you've added an envelope, you can create keys for it and manipulate it in other ways using the Animation Envelopes global. Use the Texture Functions global to modify the texture. You can get the envelope and texture IDs you'll need from the Surface Functions global. Getting the IDs also allows you to check whether an envelope or a texture exists before issuing this command.

Surf_SetFloat schannel gvalue
Set the value of a float-valued channel.

Surf_SetColor schannel gred ggreen gblue
Set the color of a color-valued channel.

Surf_Rename sname
Rename the current surface.

Surf_Copy ssurfname sobjname
Copy the settings of the current surface (the one set by Surf_SetSurf) to the surface specified in the arguments.

Surf_Load sfilename
Surf_Save sfilename
Surf_LoadText sfilename
Surf_SaveText sfilename
Load and save the current surface's data from and to the given file. The Text versions store/read the data in a human-readable text format.

Surf_Search stext
Performs a search of the surfaces shown in the Surface Editor. If the search text includes any spaces then it should be contained inside double-quotes. Issuing the command without any parameter will clear the search field.

Converts any Textures in the Standard Material node into Texture nodes and connects them into the appropriate inputs.

Performs the same conversion as Surf_ConvertToNodes and then adds a Principled BSDF Material and makes the appropriate connections and value conversions.


Selects all the other surfaces (across different objects) that match in some way to the currently selected surface.

Surf_SelectIdenticalNames Surface names must match
Surf_SelectIdenticalSurfaces Surface names, Material names, and Integrator (Shading Model) names must match between surfaces.
Surf_SelectSameMaterial Material names must match.
Surf_SelectSameIntegrator Integrator (Shading Model) names must match.
Surf_SelectSameResponse Material names, and Integrator (Shading Model) names must match between surfaces.

Preset Shelf

The Preset Shelf is a window where users can store and retrieve presets for plugin or LightWave® component These commands are a counterpart to the Shelf Functions global.

Shelf_SetWindowPos nx ny
Shelf_SetWindowSize nw nh
Open and close the Preset Shelf window, and set its position or size.

Shelf_SelectLibrary slocation slibrary
Set the Shelf to the given location and library within that location. e.g.
Shelf_SelectLibrary "This User" "WorkSpace"

Shelf_AddCustomLocation sname spath nwritable ndefault_save_location

Adds a Custom Location to the Shelf's list of preset locations. "Built-in" and "This User" would be examples of locations which contain presets. The writable and default_save_location accept 1 (for true) and 0 (for false).

If writable is 0 then the location will appear with a lock icon and changes cannot be made to the presets/libraries in this location.

If default_save_location is 1 then a library in this location will be used whenever a new preset is created. This excludes presets created via the right-click menu, those will always be created in the library that was right-clicked in.

Editing a custom location can be done by issuing this command using the same name as the existing location plus the other, potentially changed, values.

Shelf_RenameCustomLocation scurrent_name snew_name
Changes the name of a custom location.

Shelf_RemoveCustomLocation sname
Removes the custom location from the list.

Opens the Custom Location Editor window which provides the user with an easy and visual way to manage any custom locations.

Image Editor

The Image Editor is a window for managing LightWave®'s list of images, image sequences and animation files. See also the Image List global.

Open the Image Editor window. In Layout, ImageEditor is a synonym for IE_OpenWindow.

IE_SetWindowPos nx ny
Set the position of the Image Editor.

IE_CreateImage sname nwidth nheight ntype
Creates a new image in the Image Editor. The name should be unique. The created image will be blank. Although the image can be referenced (in for example textures), the contents of the image will not be saved. When the scene is loaded, a blank image will be recreated instead. The type specifies the format of the image:

0 - RGB, 8 bits per channel
1 - greyscale, 8 bits
2 - indexed color, 8 bits
3 - greyscale, floating point
4 - RGB, floating point
5 - RGBA, 8 bits per channel
6 - RGBA, floating point

Graph Editor

The Graph Editor is a window for editing parameters that vary with time. These functions of time are called channels. The function is assigned a value at specific times, and the (value, time) pair is called a key. The value at other times is found by interpolating between keys, or by extrapolating from the first and last key. See the envelope SDK sample to find out exactly how this is done.

The channels available for editing are displayed in a list, called the channel bin. Channels are selected for editing from the bin, and commands can be used both to select channels and to change the contents of the bin. One or more keys in the selected channels can also be selected. Commands typically operate on the selected channels and keys.

The Graph Editor commands complement the functions available through the Animation Envelopes and Channel Info globals.

GE_OpenWindow nmode
GE_SetWindowPos nx xy
GE_SetWindowSize nwidth nheight
Open the Graph Editor window, and set its position and size. In Layout, GraphEditor is a synonym for GE_OpenWindow.

Remove all channels from the channel bin.

GE_SetEnv schannelname nappend
GE_SetEnvID xchannelid nappend
Add the channel to the channel bin and select it. If append is true, the channel bin isn't cleared, and the channel is added to the current selection. Otherwise the added channel replaces the contents of the channel bin.

GE_GetLayoutSel nappend
Get motion channels for the items selected in Layout and add them to the channel bin. If append is true (non-zero), the channel bin isn't cleared, and selected item channels are added to the bin. Otherwise the selected item channels replace the contents of the channel bin.

GE_FilterSelection sfilter
Remove channels from the channel bin whose names don't match the filter string. (Contrary to what the name implies, this command filters the bin contents, not the selection.) The filter is a regular expression. "*.Position.*" leaves only position channels in the list, for example. If the filter can't be parsed, the user will be prompted for a valid filter. Currently, the filter string must be enclosed in double-quotes.

Select all of the channels in the channel list.

GE_SetGroup xgroupid
Assign the selected channels to a group.

GE_ApplyServer sclass sserver
GE_RemoveServer sclass nindex
Apply a plug-in to the selected channels, or remove it. The class and server arguments are the first and second fields of the ServerRecord for the plug-in. The index refers to the list of applied servers of a given class. The first server in each list has an index of 1.

Create a keyframe at every frame of the selected channels, and make every span's interpolation linear.

GE_SelectAllKeys ndeselect
Select all of the keys in the selected channels, if deselect is false, or deselect all keys if deselect is true.

GE_PasteKeys gframe
Copy the selected keys and paste them at the given frame.

Delete the selected keys.

GE_MoveKeys gdeltaframe gdeltavalue
Shift the selected keys in both time and value. The deltas are added to the time and value, so to shift only one of these, set the other delta to 0.

Shift each selected key in time to the nearest integral frame. (Keys may be set at fractional frame times.)

GE_ReduceKeys nrecursive gthreshold
Delete neighboring keys with values that differ by less than the threshold. For example, consider consecutive keys A B C D E with values that all lie within the threshold. When recursive is false, the first GE_ReduceKeys deletes keys B and D, leaving A C E. The second call deletes C, and the third deletes E. When recursive is true, a single call to GE_ReduceKeys deletes all the keys except A.

GE_LockKeys nunlock
Lock the selected keys, if unlock is false, or unlock the keys if unlock is true. A locked key can still be selected but can't be edited in the interface, a protection against accidental changes.

Apply, remove or revert to footprints. A footprint is a static copy of a selected curve. It's displayed in the Graph Editor window as a reference while the user edits the curve, and the user can undo the changes made after the footprint was created. GE_LeaveFootprints records the current state of the selected curves. GE_PickupFootprints removes the footprints. GE_BacktrackFootprints reverts the curves to the state recorded in the footprints.

GE_CopyTimeslice nfromfootprint gframe
GE_PasteTimeslice gframe
Copy and paste keys at specific times. If fromfootprint is true, the keys are copied from the footprint rather than the curve.

GE_MatchFootprintAtFrame frame
Create a key at the specified frame with the value of the footprint at that frame.

GE_CreateExpression sname sexpression
Create an expression. The name is used to refer to the expression in both the interface and the GE_AttachExpression commands. Consult the LightWave® user documentation for information about what an expression can contain.

GE_AttachExpression schannelname sexpressionname
GE_AttachExpressionID xchannelid sexpressionname
Associate an expression with the channel identified either by name or by channel ID.

GE_DetachExpression schannelname sexpressionname [nclear]
GE_DetachExpressionID xchannelid sexpressionname [nclear]
Detached an expression from the channel identified either by name or by channel ID. If the optional clear argument is set to 1, then the expression will be cleared if it is no longer used by any channel.

GE_DetachExpressions schannelname [nclear]
GE_DetachExpressionsID xchannelid [nclear]
Detached all expressions from the channel identified either by name or by channel ID. If the optional clear argument is set to 1, then any expression detached will be cleared if it is no longer used by any channel.

GE_ClearUnusedExpression sexpressionname
Clears an expression, or all expressions, that are not in use by any channel.

GE_LoadExpressions sfilename
GE_SaveExpressions sfilename
Store all of the expressions in a file, or retrieve them from a file.

OBJ Loader and Saver

The OBJ loader and saver has several options. When loading, the order of the vertices can be changed in memory. Several of the options do change the vertex order.

OBJWriteNormals nenabled
Saves vertex normal into the OBJ file if enabled.

OBJMergePoints nenabled
Removes duplicate vertices from the OBJ file. This command does affect vertex order.

OBJZBrushMode nenabled
Uses LightWaves old OBJ exporter. It is compatible with ZBrush.
This command does affect vertex order.

OBJPivotInCenter nenabled
If enabled,the OBJ is loaded with the pivot point in the center.
Otherwise the OBJ is loaded with the pivot point at the origin.

OBJOneLayer nenabled
Saves all OBJ data in a single layer. This command does affect vertex order.

OBJOneVMap nenabled
If enabled, the vertex map is merged into a single vertex map when saved.

OBJImportScale gscale
All OBJ vertices are scaled to this value when loaded.

OBJExportScale gscale
All OBJ vertices are scaled to this value when saved.

STL PLY WRL Exporters

Mesh Exporters take the following arguments. Missing arguments will take the default interface setting. Filename is a file path to the destination.

STL options
sfilename nfiletype nupaxis npositivecoordinates gscale
Filetype is a 0 for ACSII, 1 for binary.

PLY options
sfilename nfiletype nupaxis gscale
Filetype is a 0 for ACSII, 1 for binary with little endian and 2 for big endian.

WRL options


AutoSaveObj nseconds
Sets the number of seconds between autosaving any changed objects. Set to 0 to disable autosaving.

ClientCommandInput sclient scommand
Executes a command on a given client. The client in typically LWLayout or LWModeler.