The following Data Members and Methods are
common to all Layout items including: MESH, BONE, LIGHT, CAMERA, or
SCENE. However it is important to note that not all items can utilize
these Data Members and Methods; they can use only those that apply to
their type. For example, a Light Object cannot reference a Camera
Object’s ZoomFactor Method.
Camera(), Light() and Image() constructors have had their scanning code
enhanced. When an object name is provided, these constructors will
match the first object found with that name, regardless of alphabetic
case. However, if two or more objects of that type exist in the
system with the same name, then one must match the name provided
exactly in order for a sucessful match to occur.
For example, an object called "Cow.lwo" is loaded into the
application. The following code will
successfully match that object:
obj = Mesh("cow");
subsequently an object called "COW.lwo" is loaded, leaving "Cow" and
"COW" in the application. The previous code would fail (returning
'nil'), and must be altered to unambiguously match one of the loaded
obj = Mesh("Cow");
Object names returned to the script by the application will contain
their respective case settings, and so should always match the correct
objects when used.
You can also give
Mesh(), Light() and Camera() Object agent constructors an item ID in
layout and it will return that item.
Item ids start as
name holds a character string that represents the name of this Layout
object (as it appears to the user in Layout’s object lists).
filename holds a character string that represents the filename
(including path, if any) that contains this Layout object.
parent points to an Object Agent that represents the Layout object that
is considered the parent of this Layout object (or 'nil' if there is
target points to an Object Agent that represents the Layout object that
is designated as the target for this Layout object (or 'nil' if there
goal points to an Object Agent that represents the Layout object that
is designated as the goal for this Layout object (or 'nil' if there is
type holds a constant (i.e., read-only) value that identifies the type
of this Layout object (one of MESH, BONE, LIGHT, CAMERA, or SCENE).
THIS IS BROKEN FOR CAMERAS. USE .genus INSTEAD
pointcount, when appropriate, contains an integer value that represents
the number of points in the Layout object, or 'nil' when not
appropriate (i.e., CAMERA).
polycount, when appropriate, contains an integer value that represents
the number of polygons in the Layout object, or 'nil' when not
appropriate (i.e., CAMERA).
shadows holds an array of three Boolean values that represent the
Layout object's current shadow options:
 == true if Self Shadow is on, or false if off
 == true if Casts Shadow is on, or false if off
 == true if Receive Shadow is on, or false if off
selected, childrenvisible, channelsvisible, and locked are each Boolean
flags that indicate the state of the indicated condition.
id holds the integer identifier of the Layout object for which it
serves as proxy. This integer identifier is the same one used by Layout
to uniquely identify objects in the scene file.
Mesh ids start at 268435456
Light ids start at 536870912
Camera ids start at 805306368
Bone ids start at 1073741824
obj = Light();
genus holds the type of the object. It holds one of MESH, LIGHT,
CAMERA, BONE, SCENE, or CHANNEL.
Mesh is genus 1
Light is genus 2
Camera is genus 3
Bone is genus 4
visibility contains one of the values returned by the Scene Object
Agent's visibility() method.
Given a specifier (POSITION, ROTATION, WPOSITION etc.), you can acquire
information on an item’s attribute.
Each of these methods returns a vector
containing the three numeric values corresponding to the parameter at
the specified time index.
mypos = myobj.param(POSITION);
mywrot = myobj.getWorldRotation(time);
will cause the object identifier cached in
the Object Agent to be validated
against those objects in the Scene. If the object identifier is no
longer valid, then
Boolean false is returned.
will indicate whether the underlying object identifier has been changed
by some event in the Scene (typically object loading or removal). If
Boolean true is returned, then the object identifier has not
changed since the Object Agent was created.
firstChannel()returns the first channel associated with an object. Like
the firstChild() method, this method must be used as the preface of an
iteration through all channels. Return 'nil' if there are no (further)
nextChannel()returns the next channel in the list of channels for an
object. Returns 'nil' if there are no (further) channels available.
light = Light();
c = light.firstChannel();
c = light.nextChannel();
This array contains nine elements, where each triplet corresponds to the object's Position, Rotation and
Scaling channels. Each triplet element corresponds to the appropriate axis for the transformational
category, and is a Boolean value that indicates the lock status of that particular channel/axis element
(true == locked).
returns all channels of the
object which contain a key at the specified time index.
next()returns the next Layout object (as a LScript Object Agent) in the
list of the same category, or 'nil' if there is none.
firstChild()returns an Object Agent that represents the Layout object
that is designated as the first child belonging to this Layout object
(or 'nil' if there is none)
firstChild()returns the next Object Agent that represents the Layout
object that is designated as a child of this Layout object (or 'nil' if
there is none).
bone()returns the first Object Agent that represents the Layout object
designated as the first bone assigned to this Layout object (using the
Object Agent method next(), you can traverse all Layout bones that are
assigned to this Layout object).
limits(state)returns an array of six numbers that represent the minimum
[elements 1-3] and maximum [elements 4-6] limits that have been
established on a particular Layout object state (POSITION, RIGHT, UP,
FOWARD, ROTATION, SCALING, PIVOT WRIGHT, WUP, WFORWARD or WPOSITION).
These methods return a Boolean true/false
indicating the type of the object for which the Object Agent is a proxy.
Given an index value, and a string tag value, the setTag() method
applies it to the object. When the current scene is saved, the tag
information will be stored into the scene file in association with the
Given an integer index value, the getTag() method returns the tag value
for that index, or 'nil' if no tag exists.
schemaPosition()returns two floating-point values that represent the
object's position in Layout's schematic viewport.
The server(<class>,[index]) method returns the name of an active
plug-in applied to the object. The first argument is the plug-in class
to be queried. The second is an optional index value for selecting a
The plug-in class can be a literal string (like
"ItemMotionHandler"), or you can use one of the following predefined
Where _H indicates a Handler-type server (e.g.,
ItemMotionHandler) and _I indicates an Interface-type server (e.g.,
Certain classes of plug-in are itemless, such as
Image Filter and Master. While you can provide these class types to a
Layout Object, you will get a valid return value only when you use
these with the Scene Object Agent (and, of course, plug-ins of that
type are active). Likewise, classes that are associated with objects
will not return valid values with the Scene Object Agent.
serverFlags( <serverType>, [serverIndex] )
The serverFlags method returns the state of a plug-in applied to the objectAgent. The first argument is the plug-in class
to be queried. The second is an optional index value for selecting a specific plug-in.
isApplied = false;
scene = Scene();
item = scene.firstSelect();
Servers = item.server( ServerType );
ServerIndex = Servers.size();
while( ServerIndex )
isDisabled = item.serverFlags( ServerType, ServerIndex );
if( Servers[ServerIndex] == ServerName )
isApplied = true;
RemoveServer( ServerType, ServerIndex );
This allows you to add the specified plugin to the currently selected
This allows you to open the options dialogue for the specified plugin
This allows you to remove the specified plugin class at the index