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.)

number
An integer.
gfloat
A floating-point number.
string
A string, such as a filename or channel name.
hex
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_OpenWindow
Surf_UpdateWindow
Surf_CloseWindow
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_AddShader sshader
Surf_RemShader sshader
Add or remove a shader. The argument is the shader's server name, the string in the name field of the shader's ServerRecord.

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_SetBakerImage sfilename
Set the base filename for the image file output of the Surface Baker shader.

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.

IE_OpenWindow
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.

GE_ClearBin
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.

GE_SelectAllCurves
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.

GE_BakeCurves
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_CopySelKeys
GE_PasteKeys gframe
Copy the selected keys and paste them at the given frame.

GE_DeleteSelKeys
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.

GE_SnapKeysToFrames
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.

GE_LeaveFootprints
GE_PickupFootprints
GE_BacktrackFootprints
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_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 compabable 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.