Layer Functions

Functions to add, get, set, delete, and query objects, names, and descriptions in a layer.

MTK_Layer_AppendObject()

Add an object to a layer.

Signature
int MTK_Layer_AppendObject(
    MTK_Layer* layer, MTK_Object* obj);
Parameters
  • layer: Pointer to an MTK_Layer struct.
  • obj: The object to add to the layer.
Returns

0 on success; any other value indicates failure.

MTK_Layer_Close()

Clean up the layer.

Signature
int MTK_Layer_Close(MTK_Layer* layer);
Parameters

layer: Pointer to an MTK_Layer struct.

Returns

0 on success; any other value indicates failure.

MTK_Layer_DeleteObject()

Delete an object from a layer.

Signature
int MTK_Layer_DeleteObject(
    MTK_Layer* layer, const int& index);
Parameters
  • layer: Pointer to an MTK_Layer struct.
  • index: Index of the object.
Returns

0 on success; any other value indicates failure.

MTK_Layer_GetDescription()

Get the description of a layer.

Signature
int MTK_Layer_GetDescription(
    MTK_Layer* layer, char* desc);
Parameters
  • layer: Pointer to an MTK_Layer struct.
  • desc: Buffer to receive the layer description.
Returns

0 on success; any other value indicates failure.

MTK_Layer_GetName()

Get the name of a layer.

Signature
int MTK_Layer_GetName(
    MTK_Layer* layer, char* name);
Parameters
  • layer: Pointer to an MTK_Layer struct.
  • name: Buffer to receive the layer name.
Returns

0 on success; any other value indicates failure.

MTK_Layer_GetObject()

Get an object from a layer. Allocates a new object which must be freed with MTK_Object_Close.

Signature
MTK_Object* MTK_Layer_GetObject(
    MTK_Layer* layer, const int& index);
Parameters
  • layer: Pointer to an MTK_Layer struct.
  • index: Index of the object.
Returns

A pointer to an MTK_Object on success; NULL on failure.

MTK_Layer_IsEdited()

Checks if a layer has been edited.

Signature
int MTK_Layer_IsEdited(MTK_Layer* layer);
Parameters

layer: Pointer to an MTK_Layer struct.

Returns

1 if edited, 0 if not edited, any other value indicates failure.

MTK_Object_3DText_AppendRecord()

Append a record (line) to a 3D text object.

Signature
int MTK_Object_3DText_AppendRecord(
    MTK_Object* obj, const char* record);
Parameters
  • obj: Pointer to the 3D text object.

  • record: The record to append.

Return Value

0 on success; any other value indicates failure.

MTK_Layer_NObjects()

Get the number of objects in a layer.

Signature
int MTK_Layer_NObjects(MTK_Layer* layer);
Parameters

layer: Pointer to an MTK_Layer struct.

Return Value
  • int: Number of objects in the layer.

  • -1: Failed.

MTK_Layer_SetDescription()

Set the description of a layer.

Signature
int MTK_Layer_SetDescription(
    MTK_Layer* layer, const char* desc);
Parameters
  • layer: Pointer to an MTK_Layer struct.

  • desc: Layer description).

Return Value

0 on success; any other value indicates failure.

MTK_Layer_SetName()

Set the name of a layer.

Signature
int MTK_Layer_SetName(
    MTK_Layer* layer, const char* name);
Parameters
  • layer: Pointer to an MTK_Layer struct.

  • name: Layer name.

Return Value

0 on success; any other value indicates failure.

MTK_Layer_SetObject()

Set an object in a layer.

Signature
int MTK_Layer_SetObject(
    MTK_Layer* layer, MTK_Object* obj, const int& index);
Parameters
  • layer: Pointer to an MTK_Layer struct.

  • obj: The object to add.

  • index: Index of the object.

Return Value

0: Success.

Other: Failure.