Layer

ILxLayerService

class ILxLayerService

A portion of the Layer API is wrapped as a Global Service object.

Public Functions

LxResult ScriptQuery(LXtObjectID self, void **ppvObj)

As with all globals, the first method gets the ILxScriptQueryID interface for the system.

LxResult SetScene(LXtObjectID self, LXtObjectID scene)

The layer service functions operate with to a certain scene. This scene should be specified by the client BEFORE any other methods are used, as an initialization step. The scene can also be reset at any time, either to a new scene, or to force a refresh of the layer data.

LxResult Scene(LXtObjectID self, void **ppvObj)
LxResult Count(LXtObjectID self, unsigned int *count)

The following functions operate on these lists, with indices based, naturally, on the position within the given list.

LxResult Name(LXtObjectID self, unsigned int index, const char **name)
LxResult Slot(LXtObjectID self, unsigned int index, int *slot)
LxResult Item(LXtObjectID self, unsigned int index, void **ppvObj)
LxResult Mesh(LXtObjectID self, unsigned int index, void **ppvObj)
LxResult Flags(LXtObjectID self, unsigned int index, int *flags)
LxResult Pivot(LXtObjectID self, unsigned int index, double *pivot)
LxResult PatchSubdivision(LXtObjectID self, unsigned int index, int *level)
LxResult Bounds(LXtObjectID self, unsigned int index, LXtVector min, LXtVector max)
LxResult CurveSmoothAngle(LXtObjectID self, unsigned int index, double *angle)
LxResult SplinePatchSubdivision(LXtObjectID self, unsigned int index, int *level)
LxResult ItemLookup(LXtObjectID self, int mode, LXtObjectID item, int *index)

These methods find an item’s position in one of the lists based on the item itself, or on its name. They will return an error AND set the index to -1 if the item is not found in the specified list. To use this index in layer commands, use LXi_LAYER_ALL mode.

LxResult NameLookup(LXtObjectID self, int mode, const char *name, int *index)
LxResult LayerParent(LXtObjectID self, int index, int *parentIndex)

These methods access the parent-child relationships among layers. They return an index into the LXi_LAYER_ALL list, or -1.

LxResult LayerChildCount(LXtObjectID self, int index, int *num)
LxResult LayerChild(LXtObjectID self, int index, int childNumber, int *childIndex)
LxResult LayerVMapCount(LXtObjectID self, int *num)

The meshes in the layer list have a number of associated entities like vertex maps, image clips, and textures. APIs are provided to access these entities, presumable as the appropriate COM objects. The list of vert. maps present in the active and background layers can be accessed using these methods. Multiple VMaps with the same name and type are represented as a single entry.

LxResult LayerVMap(LXtObjectID self, unsigned int index, void **ppvObj)
LxResult LayerClipCount(LXtObjectID self, int *num)

  • LayerVMapCount() Return the number of vertex maps. If type is non-NULL, only maps of that type will be included.

  • LayerVMap() Return the vertex maps at ‘index’. If type is non-NULL, only maps of that type will be considered. Similar methods provide access to the Clips and Textures used by

LxResult LayerClip(LXtObjectID self, unsigned int index, void **ppvObj)
LxResult LayerMaterialCount(LXtObjectID self, int *num)
LxResult LayerMaterial(LXtObjectID self, unsigned int index, void **ppvObj)
LxResult LayerPartCount(LXtObjectID self, int *num)

LxResult LayerPart(LXtObjectID self, unsigned int index, const char **part)
LxResult LayerSelSetCount(LXtObjectID self, unsigned int type, int *num)

  • LayerPartCount() Returns the number of parts in the active layers.

  • LayerPart() Returns the part name at the given index. Access the selection sets for items, polys, or vert/edge using types ID_ITEM, ID_POLY, or ID_VERX/ID_EDGE respectively

LxResult LayerSelSet(LXtObjectID self, unsigned int type, unsigned int index, const char **selSet)
LxResult LayerTextureCount(LXtObjectID self, int layer, int *num)

The set of texture items applied to an item, or a part thereof are accessed with these functions.

LxResult LayerTexture(LXtObjectID self, int layer, unsigned int index, void **ppvObj)
LxResult LayerTagTextureCount(LXtObjectID self, int layer, unsigned int type, const char *tag, int *num)

  • LayerTextureCount() Return the number of textures applied to the given mesh layer.

  • LayerTexture() Returns the texture item at the given index in the list of textures applied to the specified mesh layer. The set of textures applied based on a given (PART or MATR) polygon tag may also be accessed.

LxResult LayerTagTexture(LXtObjectID self, int layer, unsigned int type, const char *tag, unsigned int index, void **ppvObj)
LxResult LayerVertexCount(LXtObjectID self, int mode, int *num)

Mesh elements (vertices, polygons, edges) can also retrieved, hopefully based on the layer list mode as well as a marking system yet to be described…

LxResult LayerVertex(LXtObjectID self, int mode, unsigned int index, void **ppvObj)
LxResult LayerPolyCount(LXtObjectID self, int mode, int *num)
LxResult LayerPoly(LXtObjectID self, int mode, unsigned int index, void **ppvObj)
LxResult LayerEdgeCount(LXtObjectID self, int mode, int *num)
LxResult LayerEdge(LXtObjectID self, int mode, unsigned int index, void **ppvObj)
LxResult ScanAllocate(LXtObjectID self, unsigned flags, void **ppvObj)

LxResult CurrentMap(LXtObjectID self, LXtID4 type, const char **name)
LxResult XfrmAllocate(LXtObjectID self, LXtObjectID toolVec, void **ppvObj)

A transform scan object is allocated using the layer service. The client must also pass the tool vector object which contains info about weights and axes.

LxResult ScanAllocateItem(LXtObjectID self, LXtObjectID item, unsigned flags, void **ppvObj)

You can also allocate a layer scan object for one mesh layer.

LxResult IsProcedural(LXtObjectID self, unsigned int index)

The IsProcedural function determines if a layer is procedural or not. However, this function also takes the UI state into account, so if ghosting is enabled in the mesh operation stack and the base mesh is selected, the function will return false, even if the mesh is procedural. This is useful for setting the enable and disable state of tools or commands that operate on procedural layers.

LxResult SetMark(LXtObjectID self, LXtObjectID item)

These functions set, clear and test for the mark used .

LxResult ClearMark(LXtObjectID self, LXtObjectID item)
int TestMark(LXtObjectID self, LXtObjectID item)
LxResult CurrentDeformer(LXtObjectID self, LXtObjectID meshItem, const char **name)

This function returns the name of the user’s currently selected deformer for the mesh item passed in, allowing the expected mesh to be retrieved through ILxMeshFilterIdent. If ghosting is disabled, no deformer is currently selected, or the item passed in is not a mesh, then LXs_MESHFILTER_TOP will be returned. If the base mesh for the given mesh item is currently selected, LXs_MESHFILTER_BASE will be returned. Any other selection will return the identity of the currently selected deformer.

  • LXi_LAYER_PRIMARY

  • LXi_LAYER_FOREGROUND

  • LXi_LAYER_BACKGROUND

  • LXi_LAYER_ALL

  • LXf_LAYER_FOREGROUND

  • LXf_LAYER_BACKGROUND

  • LXf_LAYER_MAIN


LXf_LAYERSCAN_ACTIVE

Flags select the layers to be processed: ACTIVE is all current meshes; BACKGROUND is all visible but inactive meshes; PRIMARY is the one main selected mesh. The marking flags will mark the various element types as selected. So if MARKVERTS is set, for example, all selected vertices will have the “select” mark mode set. As always if no vertices are selected all will be marked. Set WRITEMESH to enable layer edits.

  • LXf_LAYERSCAN_BACKGROUND

  • LXf_LAYERSCAN_PRIMARY

  • LXf_LAYERSCAN_ALL

  • LXf_LAYERSCAN_MARKVERTS

  • LXf_LAYERSCAN_MARKEDGES

  • LXf_LAYERSCAN_MARKPOLYS

  • LXf_LAYERSCAN_MARKDVRTS

  • LXf_LAYERSCAN_MARKALL

  • LXf_LAYERSCAN_WRITEMESH

  • LXf_LAYERSCAN_EDIT

  • LXf_LAYERSCAN_EDIT_POLYS

  • LXf_LAYERSCAN_EDIT_VERTS

  • LXf_LAYERSCAN_EDIT_EDGES

  • LXf_LAYERSCAN_EDIT_DVRTS

  • LXf_LAYERSCAN_EDIT_POLVRT

ILxLayerScan

class ILxLayerScan

The LayerScan interface is the main way to do mesh edits. It can also be used in a non-edit mode to confirm what will happen when editing.

Public Functions

LxResult Apply(LXtObjectID self)

Called at the end of an edit operation, Apply() performs all the mesh edits and terminates the scan. If this is not called for an edit scan any edits will be abandonded.

LxResult Count(LXtObjectID self, unsigned *count)

Get the number of layers in the scan.

LxResult GetState(LXtObjectID self, unsigned index, unsigned *state)

Query the state of a given layer. The state is a combination of the ACTIVE, BACKGROUND or PRIMARY layer scan flags.

LxResult MeshItem(LXtObjectID self, unsigned index, void **ppvObj)

Each layer is associated with a mesh item. The client can also get the action for the item to read channel values.

LxResult MeshAction(LXtObjectID self, unsigned index, void **ppvObj)
LxResult MeshBase(LXtObjectID self, unsigned index, void **ppvObj)

Clients can access the mesh in one of three forms. The “base” mesh is the mesh as stored in the scene. The “instance” mesh is the same mesh but deformed by the currently selected modeling morph. The “edit” mesh is the same mesh again, but allowing modifications. This version is only available if the WRITEMESH flag was set.

LxResult MeshInstance(LXtObjectID self, unsigned index, void **ppvObj)
LxResult MeshEdit(LXtObjectID self, unsigned index, void **ppvObj)
LxResult SetMeshChange(LXtObjectID self, unsigned index, unsigned int edits)

The layer scan client is responsible for indicating what types of changes they are making to a mesh. The mesh change bit mask should be set for all edited meshes before changes are applied.

LxResult Update(LXtObjectID self)

Called at intermediate points of an edit operation, Update() performs the mesh edits, but does not terminate the scan.

LxResult MeshTransform(LXtObjectID self, unsigned index, LXtMatrix4 matrix)

Clients can access the mesh item transforms using this function. It returns a Matrix4 representing the world transform of the mesh item.

ILxTransformScan

class ILxTransformScan

Public Functions

LxResult Enumerate(LXtObjectID self, LXtObjectID visitor)

The transform scan interface is also for editing, but is specifically for use in tools which perform transformations. The encapsulates all the different element types meshes, items, pivots, etc. as well as some tricky elements of the tool pipe like per-element centers and axes. The client passes a visitor to enumerate over all the elements to transform, and will be called back for each one in sequence. The flags method can read out the properties of the current element.

unsigned int Flags(LXtObjectID self)
const float *Position(LXtObjectID self)

The main function of the transform is to read the current position and write a new one.

LxResult SetPosition(LXtObjectID self, LXtFVector pos)
double Weight(LXtObjectID self)

The methods allow values to be read for per-element properties indicated by the flags.

LxResult AlternateCenter(LXtObjectID self, LXtFVector center)
LxResult AlternateAxis(LXtObjectID self, LXtMatrix matrix, LXtMatrix inverse)
LxResult Enum(CLxImpl_AbstractVisitor *visitor)

User Class Only: The user class method allows easier access to the enumeration method.


LXfXFRMSCAN_WEIGHT

The flag bits determine which properties apply to the current element. If the weight is not set it can be assumed to be unity.

  • LXfXFRMSCAN_ALTCENTER

  • LXfXFRMSCAN_ALTAXIS

ILxScene1Service

class ILxScene1Service

Public Functions

LxResult ScriptQuery(LXtObjectID self, void **ppvObj)

The Scene1Service interface is obsolete. There is a new one with more and better methods, and these methods have been moved to ILxTransform.

LxResult ItemWorldTransform(LXtObjectID self, LXtObjectID locator, double time, LXtMatrix xfrm, LXtVector pos)
LxResult ItemWorldRotation(LXtObjectID self, LXtObjectID locator, double time, LXtMatrix xfrm)