|
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.
The Mesh(),
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");
...
However,
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
objects:
...
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
follows:
mesh: 268,435,456
bone: 1,073,741,824
light: 536,870,912
camera: 805,306,368
Data Members
name
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
filename holds a character string that represents the filename
(including path, if any) that contains this Layout object.
parent
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
none).
target
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
is none).
goal
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
none).
type
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
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
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
shadows holds an array of three Boolean values that represent the
Layout object's current shadow options:
[1] == true if Self Shadow is on, or false if off
[2] == true if Casts Shadow is on, or false if off
[3] == true if Receive Shadow is on, or false if off
selected
childrenvisible,
channelsvisible
locked
selected, childrenvisible, channelsvisible, and locked are each Boolean
flags that indicate the state of the indicated condition.
id
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
generic
{
obj = Light();
info(hex(obj.id)); //
prints "0x20000000"
}
genus
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
visibility contains one of the values returned by the Scene Object
Agent's visibility() method.
Methods
param(specifier)
Given a specifier (POSITION, ROTATION, WPOSITION etc.), you can acquire
information on an item’s attribute.
getPosition(time)
getRight(time)
getUp(time)
getForward(time)
getRotation(time)
getScaling(time)
getPivot(time)
getWorldPosition(time)
getWorldRotation(time)
getWorldRight(time)
getWorldUp(time)
getWorldForward(time)
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);
isValid()
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.
isOriginal()
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()
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)
channels available.
nextChannel()
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();
while(c)
{
…
c = light.nextChannel();
}
axislocks[]. 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).
keyExists(<time>)
returns all channels of the
object which contain a key at the specified time index.
next()
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()
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)
nextChild()
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()
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)
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).
isMesh()
isLight()
isCamera()
isBone()
isScene()
isImage()
isChannel()
isEnvelope()
isVMap()
isChannelGroup()
These methods return a Boolean true/false
indicating the type of the object for which the Object Agent is a proxy.
setTag(integer, string)
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
object.
getTag(integer)
Given an integer index value, the getTag() method returns the tag value
for that index, or 'nil' if no tag exists.
schemaPosition()
schemaPosition()returns two floating-point values that represent the
object's position in Layout's schematic viewport.
server(<class>,[index])
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
specific plug-in.
The plug-in class can be a literal string (like
"ItemMotionHandler"), or you can use one of the following predefined
constants:
SERVER_ANIMLOADER_H SERVER_ANIMLOADER_I
SERVER_ANIMSAVER_H SERVER_ANIMSAVER_I
SERVER_CHANNEL_H SERVER_CHANNEL_I
SERVER_CUSTOMOBJ_H SERVER_CUSTOMOBJ_I
SERVER_DISPLACEMENT_H SERVER_DISPLACEMENT_I
SERVER_ENVIRONMENT_H SERVER_ENVIRONMENT_I
SERVER_IMAGEFILTER_H SERVER_IMAGEFILTER_I
SERVER_PIXELFILTER_H SERVER_PIXELFILTER_I
SERVER_FRAMEBUFFER_H SERVER_FRAMEBUFFER_I
SERVER_MASTER_H SERVER_MASTER_I
SERVER_ITEMMOTION_H SERVER_ITEMMOTION_I
SERVER_OBJREPLACEMENT_H SERVER_OBJREPLACEMENT_I
SERVER_SHADER_H SERVER_SHADER_I
SERVER_TEXTURE_H SERVER_TEXTURE_I
SERVER_VOLUMETRIC_H SERVER_VOLUMETRIC_I
Where _H indicates a Handler-type server (e.g.,
ItemMotionHandler) and _I indicates an Interface-type server (e.g.,
ItemMotionInterface).
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 );
}
ServerIndex--;
}
General Commands
ApplyServer(class,name)
This allows you to add the specified plugin to the currently selected
item.
EditServer(class,index)
This allows you to open the options dialogue for the specified plugin
class.
RemoveServer(class,index)
This allows you to remove the specified plugin class at the index
specified.
|