MQDocument class

MQDocument contains objects and materials.

Property

get set Type Name Description
x int numObject number of objects
x int numMaterial number of materials
x list<MQObject> object list of objects
x list<MQMaterial> material list of material
x x int currentObjectIndex index of current object
x x int currentMaterialIndex index of current material
x string filename file name
x MQEnvMap envmap environment map
x int numMaxUVChannel a maximum number of UV channels per an object

Method

Member Description
getScene Get a scene in this document.
addObject Add an object into this document.
insertObject Insert an object into this document.
removeObject Remove the object from this document without deletion.
deleteObject Delete the object in this document.
getObjectIndex Get an index of the object.
getParentObject Get a parent object of the specified object. Return 'None' if the specified object exists in the root.
getChildObjectCount Get a number of children objects under the specified object.
getChildObject Get a child object under the specified object.
isAncestorObject Check if a child object under the specified object.
getUnusedObjectName Get an unused object name.
getGlobalMatrix Get a global matrix of the specified object.
getGlobalInverseMatrix Get a global inverse matrix of the specified object.
addMaterial Add a material into this document.
deleteMaterial Delete a material in this document.
getUnusedMaterialName Get an unused material name.
clearSelect Clear the selection.
addSelectVertex Add a selection of the vertex.
deleteSelectVertex Delete a selection of the vertex.
isSelectVertex Get a selection of the vertex.
addSelectLine Add a selection of the line.
deleteSelectLine Delete a selection of the line.
isSelectLine Get a selection of the line.
addSelectFace Add a selection of the face.
deleteSelectFace Delete a selection of the face.
isSelectFace Get a selection of the face.
addSelectUVVertex Add a selection of the UV vertex.
deleteSelectUVVertex Delete a selection of the UV vertex.
isSelectUVVertex Get a selection of the UV vertex.
createObjectUserData Create an user data for an object.
deleteObjectUserData Delete an user data for an object.
findObjectUserData Find an existing user data for an object.
createVertexUserData Create an user data for vertices.
deleteVertexUserData Delete an user data for vertices.
findVertexUserData Find an existing user data for vertices.
createFaceUserData Create an user data for faces.
deleteFaceUserData Delete an user data for faces.
findFaceUserData Find an existing user data for faces.
createMaterialUserData Create an user data for a material.
deleteMaterialUserData Delete an user data for a material.
findMaterialUserData Find an existing user data for a material.
getUVChannelID Get or generate an UV channel ID from a name.
getUVChannelName Get an UV channel name from an UV channel ID.
compact Shorten arrays in the document by removing Null.
save Save to a file.
undo Execute an undo operation.
redo Execute an redo operation.
clearUndoBuffer Clear an undo buffer.

getScene(index)

Get a scene in this document.

Parameters:
int index - index of the scene
Return value:
MQScene - scene

addObject(obj[, parent])

Add an object into this document.

Parameters:
MQObject obj - object
MQObject parent - parent
Return value:
int - index of object
Notes:
indices of other objects will be changed when you insert an object.

insertObject(obj, brother)

Insert an object into this document.

Parameters:
MQObject obj - object
MQObject brother - A brother object
Return value:
int - index of object
Notes:
indices of other objects will be changed when you add a child (not root) object.

removeObject(object)

Remove the object from this document without deletion.

Parameters:
MQObject object - an object
Notes:
object[index] will return 'None' after removing the object.

deleteObject(index)

Delete the object in this document.

Parameters:
int index - index of the object
Notes:
object[index] will return 'None' after deleting the object.

getObjectIndex(obj)

Get an index of the object.

Parameters:
MQObject obj - object
Return value:
int - index of object
[-1] The object isn't added into the document.

getParentObject(obj)

Get a parent object of the specified object. Return 'None' if the specified object exists in the root.

Parameters:
MQObject obj - child object
Return value:
MQObject - parent object
[None] the object exists under a root.

getChildObjectCount(obj)

Get a number of children objects under the specified object.

Parameters:
MQObject obj - child object
Return value:
int - number of children objects

getChildObject(obj, index)

Get a child object under the specified object.

Parameters:
MQObject obj - parent object
int index - index of the child object
Return value:
MQObject - children object

isAncestorObject(ancestor, descendant)

Check if a child object under the specified object.

Parameters:
MQObject ancestor - ancestor object
MQObject descendant - descendant object
Return value:
int - result
[0] not an ancestor and a descedant object
[1] an ancestor and a descedant object

getUnusedObjectName([base_name])

Get an unused object name.

Parameters:
string base_name - based name
Return value:
string - name

getGlobalMatrix(obj)

Get a global matrix of the specified object.

Parameters:
MQObject obj - parent object
Return value:
MQMatrix - global matrix

getGlobalInverseMatrix(obj)

Get a global inverse matrix of the specified object.

Parameters:
MQObject obj - parent object
Return value:
MQMatrix - global matrix

addMaterial(mat)

Add a material into this document.

Parameters:
MQMaterial mat - material
Return value:
int - index of the material

deleteMaterial(index)

Delete a material in this document.

Parameters:
int index - index of the material
Notes:
material[index] will return 'None' after deleting the material.

getUnusedMaterialName([base_name])

Get an unused material name.

Parameters:
string base_name - based name
Return value:
string - name

clearSelect

Clear the selection.

addSelectVertex(obj_index, vert_index)

Add a selection of the vertex.

Parameters:
int obj_index - index of object
int vert_index - index of vertex

deleteSelectVertex(obj_index, vert_index)

Delete a selection of the vertex.

Parameters:
int obj_index - index of object
int vert_index - index of vertex

isSelectVertex(obj_index, vert_index)

Get a selection of the vertex.

Parameters:
int obj_index - index of object
int vert_index - index of vertex
Return value:
int - selection state
[0] not selected
[1] selected

addSelectLine(obj_index, face_index, line_index)

Add a selection of the line.

Parameters:
int obj_index - index of object
int face_index - index of face
int line_index - index of line

deleteSelectLine(obj_index, face_index, line_index)

Delete a selection of the line.

Parameters:
int obj_index - index of object
int face_index - index of face
int line_index - index of line

isSelectLine(obj_index, face_index, line_index)

Get a selection of the line.

Parameters:
int obj_index - index of object
int face_index - index of face
int line_index - index of line
Return value:
int - selection state
[0] not selected
[1] selected

addSelectFace(obj_index, face_index)

Add a selection of the face.

Parameters:
int obj_index - index of object
int face_index - index of face

deleteSelectFace(obj_index, face_index)

Delete a selection of the face.

Parameters:
int obj_index - index of object
int face_index - index of face

isSelectFace(obj_index, face_index)

Get a selection of the face.

Parameters:
int obj_index - index of object
int face_index - index of face
Return value:
int - selection state
[0] not selected
[1] selected

addSelectUVVertex(obj_index, face_index, apex_index)

Add a selection of the UV vertex.

Parameters:
int obj_index - index of object
int face_index - index of face
int apex_index - index of vertex in the face

deleteSelectUVVertex(obj_index, face_index, apex_index)

Delete a selection of the UV vertex.

Parameters:
int obj_index - index of object
int face_index - index of face
int apex_index - index of vertex in the face

isSelectUVVertex(obj_index, face_index, apex_index)

Get a selection of the UV vertex.

Parameters:
int obj_index - index of object
int face_index - index of face
int apex_index - index of vertex in the face
Return value:
int - selection state
[0] not selected
[1] selected

createObjectUserData(productID, pluginID, identifier, bytes_per_object)

Create an user data for an object.

Parameters:
long productID - A product ID
long pluginID - A plug-in ID
string identifier - An arbitrary string for indentifying (max. 15 characters)
int bytes_per_object - A size of data attached for each object in bytes (max. 65535 bytes)
Return value:
int - An object user data ID
[0] Failed
Notes:
When the same values are specified for productID, pluginID and identifier, a new user data is not created and the existing user data ID will be returned. You can generate multiple user data by specifying different strings for identifier.

deleteObjectUserData(userdata_id)

Delete an user data for an object.

Parameters:
long userdata_id - An object user data ID

findObjectUserData(productID, pluginID, identifier)

Find an existing user data for an object.

Parameters:
long productID - A product ID
long pluginID - A plug-in ID
string identifier - An arbitrary string for indentifying (max. 15 characters)
Return value:
int - An object user data ID
[0] Failed

createVertexUserData(productID, pluginID, identifier, bytes_per_vertex)

Create an user data for vertices.

Parameters:
long productID - A product ID
long pluginID - A plug-in ID
string identifier - An arbitrary string for indentifying (max. 15 characters)
int bytes_per_vertex - A size of data attached for each vertex in bytes (max. 65535 bytes)
Return value:
int - A vertex user data ID
[0] Failed
Notes:
When the same values are specified for productID, pluginID and identifier, a new user data is not created and the existing user data ID will be returned. You can generate multiple user data by specifying different strings for identifier.

deleteVertexUserData(userdata_id)

Delete an user data for vertices.

Parameters:
long userdata_id - A vertex user data ID

findVertexUserData(productID, pluginID, identifier)

Find an existing user data for vertices.

Parameters:
long productID - A product ID
long pluginID - A plug-in ID
string identifier - An arbitrary string for indentifying (max. 15 characters)
Return value:
int - A vertex user data ID
[0] Failed

createFaceUserData(productID, pluginID, identifier, bytes_per_face)

Create an user data for faces.

Parameters:
long productID - A product ID
long pluginID - A plug-in ID
string identifier - An arbitrary string for indentifying (max. 15 characters)
int bytes_per_face - A size of data attached for each face in bytes (max. 65535 bytes)
Return value:
int - A face user data ID
[0] Failed
Notes:
When the same values are specified for productID, pluginID and identifier, a new user data is not created and the existing user data ID will be returned. You can generate multiple user data by specifying different strings for identifier.

deleteFaceUserData(userdata_id)

Delete an user data for faces.

Parameters:
long userdata_id - A face user data ID

findFaceUserData(productID, pluginID, identifier)

Find an existing user data for faces.

Parameters:
long productID - A product ID
long pluginID - A plug-in ID
string identifier - An arbitrary string for indentifying (max. 15 characters)
Return value:
int - A face user data ID
[0] Failed

createMaterialUserData(productID, pluginID, identifier, bytes_per_material)

Create an user data for a material.

Parameters:
long productID - A product ID
long pluginID - A plug-in ID
string identifier - An arbitrary string for indentifying (max. 15 characters)
int bytes_per_material - A size of data attached for each material in bytes (max. 65535 bytes)
Return value:
int - A material user data ID
[0] Failed
Notes:
When the same values are specified for productID, pluginID and identifier, a new user data is not created and the existing user data ID will be returned. You can generate multiple user data by specifying different strings for identifier.

deleteMaterialUserData(userdata_id)

Delete an user data for a material.

Parameters:
long userdata_id - A material user data ID

findMaterialUserData(productID, pluginID, identifier)

Find an existing user data for a material.

Parameters:
long productID - A product ID
long pluginID - A plug-in ID
string identifier - An arbitrary string for indentifying (max. 15 characters)
Return value:
int - A material user data ID
[0] Failed

getUVChannelID(name)

Get or generate an UV channel ID from a name.

Parameters:
string name - UV channel name
Return value:
int - UV channel ID
Notes:
If a non-existent name is specified, a new UV channel ID is generated.

getUVChannelName(channel)

Get an UV channel name from an UV channel ID.

Parameters:
int channel - UV channel ID
Return value:
string - UV channel name
Notes:
If a non-existent ID or 0 is specified, an empty string is returned.

compact

Shorten arrays in the document by removing Null.

save(filename[, productID, pluginID, index])

Save to a file.

Parameters:
string filename - File name
long productID - A product ID
long pluginID - A plug-in ID
int index - An index of an extension in the plugin
Return value:
int - Result
[0] failed
[1] succeeded

undo

Execute an undo operation.

Return value:
int - Result
[0] failed
[1] succeeded

redo

Execute an redo operation.

Return value:
int - Result
[0] failed
[1] succeeded

clearUndoBuffer

Clear an undo buffer.