MQMaterial class

MQMaterial class manages a material.

Basic
DeleteThis Delete this material class
GetUniqueID Get an unique ID of this material
Attributes
GetName Get a name
GetSelected Get a selection status of a material
GetShader Get a shader type
GetVertexColor Get a type of a vertex color
GetDoubleSided Get single or double sided faces.
GetColor Get a base color
GetAlpha Get a transparency
GetDiffuse Get a diffuse value
GetAmbient Get an ambient value
GetAmbientColor Get an ambient color
GetEmission Get an emission value
GetEmissionColor Get an emission color
GetSpecular Get a specular value
GetSpecularColor Get a specular color
GetPower Get a power of a specular
GetReflection Get a reflection
GetRefraction Get a refraction
SetName Set a name
SetSelected Set a selection status of a material
SetShader Set a shader type
SetVertexColor Set a type of a vertex color
SetDoubleSided Set single or double sided faces
SetColor Set a base color
SetAlpha Set a transparency
SetDiffuse Set a diffuse value
SetAmbient Set an ambient value
SetAmbientColor Set an ambient color
SetEmission Set an emission value
SetEmissionColor Set an emission color
SetSpecular Set a specular value
SetSpecularColor Set a specular color
SetPower Set a power of a specular
SetReflection Set a reflection
SetRefraction Set a refraction
Mappings
GetTextureName Get a filename of a texture mapping
GetAlphaName Get a filename of an alpha mapping
GetBumpName Get a filename of a bump mapping
GetMappingType Get a projection type for a mapping
GetMappingPosition Get a projection position for a mapping
GetMappingScaling Get a projection scaling for a mapping
GetMappingAngle Get a projection angle for a mapping
GetMappingFilter Get a filter type for a mapping
GetWrapModeU Get a wrapping mode for an U axis of a mapping
GetWrapModeV Get a wrapping mode for a V axis of a mapping
SetTextureName Set a filename of a texture mapping
SetAlphaName Set a filename of an alpha mapping
SetBumpName Set a filename of a bump mapping
SetMappingType Set a projection type for a mapping
SetMappingPosition Set a projection position for a mapping
SetMappingScaling Set a projection scaling for a mapping
SetMappingAngle Set a projection angle for a mapping
SetMappingFilter Set a filter type for a mapping
SetWrapModeU Set a wrapping mode for an U axis of a mapping
SetWrapModeV Set a wrapping mode for a V axis of a mapping
Shader parameters
GetShaderName Get a shader's name
SetShaderName Set a shader's name
GetShaderParameterNum Get a number of shader parameters
GetShaderParameterName Get a shader parameter's name
GetShaderParameterValueType Get a value type of a shader parameter
GetShaderParameterArraySize Get an array size of a shader parameter
GetShaderParameterBoolValue Get a bool value in a shader parameter
GetShaderParameterIntValue Get an int value in a shader parameter
GetShaderParameterFloatValue Get a float value in a shader parameter
GetShaderParameterColorValue Get a color in a shader parameter
SetShaderParameterBoolValue Set a bool value in a shader parameter
SetShaderParameterIntValue Set an int value in a shader parameter
SetShaderParameterFloatValue Set a float value in a shader parameter
SetShaderParameterColorValue Set a color in a shader parameter
GetShaderMappingNum Get a number of shader mappings
GetShaderMappingName Get a shader mapping's name
GetShaderMappingFilename Get a filename in a shader mapping
SetShaderMappingFilename Set a filename in a shader mapping
Shader node
GetMainShaderNode Get a main shader node
GetSubShaderNodeNum Get a number of sub shader nodes
GetSubShaderNodeID Get a sub shader node's ID
GetSubShaderNode Get a sub shader node
User data
AllocUserData Allocate an user data
FreeUserData Free an user data
GetUserData Get an user data
GetUserDataPart Get an user data partially
SetUserData Set an user data
SetUserDataPart Set an user data partially

void MQMaterial::DeleteThis(void);

It deletes a material class.

This function is available for the material registered in a document. You must use MQDocument::DeleteMaterial() to delete a material that is not registered to any documents.


UINT MQMaterial::GetUniqueID(void);

Return value
An unique ID

(new in Rev2.40)

It gets an unique ID of the material.

An unique ID is assigned when the material is registered to the document by MQDocument::AddMaterial().


void MQMaterial::GetName(char *buffer, int size);

void MQMaterial::GetNameW(wchar_t *buffer, int size);

std::string MQMaterial::GetName();

std::wstring MQMaterial::GetNameW();

buffer
A buffer to receive a material name
size
A length of a buffer

The function with arguments stores this material's name to 'buffer'. And, the function without argument returns the name as ANSI or Wide string.


BOOL MQMaterial::GetSelected();

Return value
Selection status

(new in Rev3.10)

it gets a selection status of the material.

This selection indicates a status for multiple selections on the material panel. A current material can be obtained by MQDocument::GetCurrentMaterialIndex().


int MQMaterial::GetShader(void);

Return value
A type of a shader
[MQMATERIAL_SHADER_CLASSIC] Classic shader
[MQMATERIAL_SHADER_CONSTANT] Constant shader
[MQMATERIAL_SHADER_LAMBERT] Lambert shader
[MQMATERIAL_SHADER_PHONG] Phong shader
[MQMATERIAL_SHADER_BLINN] Blinn shader
[MQMATERIAL_SHADER_HLSL] HLSL shader (new in Rev4.33)

(new in Rev2.30)

It gets a type of a shader of the material.


int MQMaterial::GetVertexColor(void);

Return value
A type of a vertex color
[MQMATERIAL_VERTEXCOLOR_DISABLE] Disabled
[MQMATERIAL_VERTEXCOLOR_DIFFUSE] Applies to a diffuse color

(new in Rev2.30)

It gets a type of a vertex color.


BOOL MQMaterial::GetDoubleSided(void);

Return value
A shown type for faces
[TRUE] Double sided face
[FALSE] Single sided face

(new in Rev3.10)

It gets whether to show single or double sided faces.


MQColor MQMaterial::GetColor(void);

Return value
Color

It gets a base color of this material.


float MQMaterial::GetAlpha(void);

float MQMaterial::GetDiffuse(void);

Return value
A value for the attribute

It gets an alpha value (transparency) or a diffuse value.

It returns from 0 to 1.


float MQMaterial::GetAmbient(void);

float MQMaterial::GetEmission(void);

float MQMaterial::GetSpecular(void);

Return value
A value for the attribute

It gets an ambient, an emission or a specular value.

It returns from 0 to 1.


MQColor MQMaterial::GetAmbientColor(void);

MQColor MQMaterial::GetEmissionColor(void);

MQColor MQMaterial::GetSpecularColor(void);

Return value
A color for the attribute

It gets an ambient, an emission or a specular color.

Each value in returned color is from 0 to 1.

(in Rev4.20)

When the attribute has a color, this function returns a monochrome value. It will be still available in the future version, but it is recommended to replace with GetAmbientColor(), GetEmissionColor() and GetSpecularColor() if possible.


float MQMaterial::GetPower(void);

Return value
A value for the attribute

It gets a power of a specular.

It returns from 0 to 100.


float MQMaterial::GetReflection(void);

Return value
Reflection

(new in Rev4.00)

It returns a reflection of the material.

The return value is from 0 to 1.


float MQMaterial::GetRefraction(void);

Return value
Refraction

(new in Rev4.00)

It returns a reflection of the material.


void MQMaterial::GetTextureName(char *buffer, int size);

void MQMaterial::GetTextureNameW(wchar_t *buffer, int size);

void MQMaterial::GetAlphaName(char *buffer, int size);

void MQMaterial::GetAlphaNameW(wchar_t *buffer, int size);

void MQMaterial::GetBumpName(char *buffer, int size);

void MQMaterial::GetBumpNameW(wchar_t *buffer, int size);

buffer
A buffer to receive a filename
size
A length of a buffer

std::string MQMaterial::GetTextureName();

std::wstring void MQMaterial::GetTextureNameW();

std::string MQMaterial::GetAlphaName();

std::wstring MQMaterial::GetAlphaNameW();

std::string MQMaterial::GetBumpName();

std::wstring MQMaterial::GetBumpNameW();

Return value
A filename

It stores a filename of a texture mapping, an alpha mapping and a bump mapping to the 'buffer', or returns it. The 'filename' is usually a relative path, and it is an absolute path in case that the filename is originally set as an absolute path.

You can use MQDocument::FindMappingFile() to convert a returned relative path to an absolute path.


int MQMaterial::GetMappingType(void);

Return value
A type of a projection
[MQMATERIAL_PROJECTION_UV] UV mapping
[MQMATERIAL_PROJECTION_FLAT] Flat mapping
[MQMATERIAL_PROJECTION_CYLINDER] Cylinder mapping
[MQMATERIAL_PROJECTION_SPHERE] Sphere mapping

(new in Rev2.30)

It gets a type of a projection for a mapping.


MQPoint MQMaterial::GetMappingPosition(void);

Return value
A projection position for a mapping

(new in Rev2.30)

It gets a projection position for a mapping.


MQPoint MQMaterial::GetMappingScaling(void);

Return value
A projection scaling for a mapping

(new in Rev2.30)

It gets a projection scaling rate for a mapping.


MQAngle MQMaterial::GetMappingAngle(void);

Return value
A projection angle for a mapping

(new in Rev2.30)

It gets a projection angle for a mapping.


int MQMaterial::GetMappingFilter(void);

Return value
A type of a filter for a mapping
[MQMATERIAL_FILTER_NEAREST] Nearest neighbor
[MQMATERIAL_FILTER_LINEAR] Bilinear interpolation

(new in Rev4.70)

It gets a type of a filter for a mapping.


int MQMaterial::GetWrapModeU(void);

Return value
A wrapping mode for an U axis of a mapping
[MQMATERIAL_WRAP_REPEAT] Repeat
[MQMATERIAL_WRAP_MIRROR] Mirror
[MQMATERIAL_WRAP_CLAMP] Clamp

(new in Rev4.70)

It gets a wrapping mode for an U axis of a mapping.


int MQMaterial::GetWrapModeV(void);

Return value
A wrapping mode for a V axis of a mapping
[MQMATERIAL_WRAP_REPEAT] Repeat
[MQMATERIAL_WRAP_MIRROR] Mirror
[MQMATERIAL_WRAP_CLAMP] Clamp

(new in Rev4.70)

It gets a wrapping mode for a V axis of a mapping.


void MQMaterial::SetName(const char *name);

void MQMaterial::SetName(const wchar_t *name);

name
A buffer contains a name

It sets the material's name.


void MQMaterial::SetSelected(BOOL flag);

flag
Selection status

(new in Rev3.10)

it sets a selection status of the material.

This selection indicates a status for multiple selections on the material panel. A current material can be set by MQDocument::SetCurrentMaterialIndex().


void MQMaterial::SetShader(int shader);

shader
A type of a shader
[MQMATERIAL_SHADER_CLASSIC] Classic shader
[MQMATERIAL_SHADER_CONSTANT] Constant shader
[MQMATERIAL_SHADER_LAMBERT] Lambert shader
[MQMATERIAL_SHADER_PHONG] Phong shader
[MQMATERIAL_SHADER_BLINN] Blinn shader
[MQMATERIAL_SHADER_HLSL] HLSL shader (new in Rev4.33)

(new in Rev2.30)

It sets a type of a shader.


void MQMaterial::SetVertexColor(int value);

value
A type of a vertex color
[MQMATERIAL_VERTEXCOLOR_DISABLE] Disabled
[MQMATERIAL_VERTEXCOLOR_DIFFUSE] Applies to a diffuse color

(new in Rev2.30)

It sets a type of a vertex color.


void MQMaterial::SetDoubleSided(BOOL value);

value
A shown type for faces
[TRUE] Double sided face
[FALSE] Single sided face

(new in Rev3.10)

It sets whether to show single or double sided faces.


void MQMaterial::SetColor(MQColor color);

color
Color

It sets a base color of the material.


void MQMaterial::SetAlpha(float value);

void MQMaterial::SetDiffuse(float value);

value
A value for each attribute

It sets an alpha value (transparency) and a diffuse value.

The 'value' must be from 0 to 1.


void MQMaterial::SetAmbient(float value);

void MQMaterial::SetEmission(float value);

void MQMaterial::SetSpecular(float value);

value
A value for each attribute

It sets an ambient value, an emission value and a specular value.

The 'value' must be from 0 to 1.

(in Rev4.20)

All RGB components are filled with 'value'. This function will be still available in the future version, but it is recommended to replace with SetAmbientColor(), SetEmissionColor() and SetSpecularColor() if possible.


void MQMaterial::SetAmbientColor(MQColor color);

void MQMaterial::SetEmissionColor(MQColor color);

void MQMaterial::SetSpecularColor(MQColor color);

value
A color for each attribute

It sets an ambient, an emission color or a specular color.

Each component in 'color' must be from 0 to 1.


void MQMaterial::SetPower(float value);

value
A value for each attribute

It sets a power of a specular.

The 'value' must be from 0 to 100.


void MQMaterial::SetReflection(float value);

value
Reflection

(new in Rev4.00)

It sets a reflection of the material.

The value is from 0 to 1.


void MQMaterial::SetRefraction(float value);

value
Refraction

(new in Rev4.00)

It sets a refraction of the material.


void MQMaterial::SetTextureName(const char *name);

void MQMaterial::SetTextureName(const wchar_t *name);

void MQMaterial::SetAlphaName(const char *name);

void MQMaterial::SetAlphaName(const wchar_t *name);

void MQMaterial::SetBumpName(const char *name);

void MQMaterial::SetBumpName(const wchar_t *name);

name
A buffer contains a new name

It assigns a texture mapping, an alpha mapping and a bump mapping with the specified filename. The name can be both a relative path and an absolute path.


void MQMaterial::SetMappingType(int type);

type
A type of a projection
[MQMATERIAL_PROJECTION_UV] UV mapping
[MQMATERIAL_PROJECTION_FLAT] Flat mapping
[MQMATERIAL_PROJECTION_CYLINDER] Cylinder mapping
[MQMATERIAL_PROJECTION_SPHERE] Sphere mapping

(new in Rev2.30)

It sets a type of a projection for a mapping.


void MQMaterial::SetMappingPosition(MQPoint pos);

pos
A projection position for a mapping

(new in Rev2.30)

It sets a projection position for a mapping.


void MQMaterial::SetMappingScaling(MQPoint scale);

scale
A projection scaling for a mapping

(new in Rev2.30)

It sets a projection scaling for a mapping.


void MQMaterial::SetMappingAngle(MQAngle angle);

angle
A projection angle for a mapping

(new in Rev2.30)

It sets a projection angle for a mapping.


void MQMaterial::SetMappingFilter(int type);

type
A type of a filter for a mapping
[MQMATERIAL_FILTER_NEAREST] Nearest neighbor
[MQMATERIAL_FILTER_LINEAR] Bilinear interpolation

(new in Rev4.70)

It sets a type of a filter for a mapping.


void MQMaterial::SetWrapModeU(int type);

type
A wrapping mode for an U axis of a mapping
[MQMATERIAL_WRAP_REPEAT] Repeat
[MQMATERIAL_WRAP_MIRROR] Mirror
[MQMATERIAL_WRAP_CLAMP] Clamp

(new in Rev4.70)

It sets a wrapping mode for an U axis of a mapping.


void MQMaterial::SetWrapModeV(int type);

type
A wrapping mode for a V axis of a mapping
[MQMATERIAL_WRAP_REPEAT] Repeat
[MQMATERIAL_WRAP_MIRROR] Mirror
[MQMATERIAL_WRAP_CLAMP] Clamp

(new in Rev4.70)

It sets a wrapping mode for a V axis of a mapping.


int MQMaterial::GetShaderName(char *buffer, int buffer_size);
std::string MQMaterial::GetShaderName(void);

buffer
A buffer to receive a shader name
buffer_size
A length of a buffer (by a number of characters)
Return value
int : An actual number of characters
std::string : A name

(new in Rev4.33)

It returns a HLSL shader's name.


bool MQMaterial::SetShaderName(const char *name);

name
A shader name
Return value
Whether to set a name

(new in Rev4.33)

It specifies a HLSL shader's name. When an invalid name is specified, false will be returned.


int MQMaterial::GetShaderParameterNum(void);

Return value
A number of parameters

(new in Rev4.33)

It returns a number of parameters in a shader.

This method is equal to GetMainShaderNode()->GetParameterNum().


int MQMaterial::GetShaderParameterName(int index, char *buffer, int buffer_size);
std::string MQMaterial::GetShaderParameterName(int index);

index
An index of a parameter
buffer
A buffer to receive a parameter name
buffer_size
A length of a buffer (by a number of characters)
Return value
iint : An actual number of characters
std::string : A name

(new in Rev4.33)

It returns a parameter's name in a shader.

This method is equal to GetMainShaderNode()->GetParameterName().


int MQMaterial::GetShaderParameterValueType(int index);
int MQMaterial::GetShaderParameterValueType(const char *name);

index
An index of a parameter
name
A parameter's name
Return value
A type of a value
[MQMATERIAL_SHADER_PARAM_TYPE_NONE] None
[MQMATERIAL_SHADER_PARAM_TYPE_BOOL] bool value
[MQMATERIAL_SHADER_PARAM_TYPE_INT] int value
[MQMATERIAL_SHADER_PARAM_TYPE_FLOAT] float value
[MQMATERIAL_SHADER_PARAM_TYPE_COLOR] color

(new in Rev4.33)

It returns a type of values in a shader parameter specified by an index or a name.

This method is equal to GetMainShaderNode()->GetParameterValueType().


int MQMaterial::GetShaderParameterArraySize(int index);
int MQMaterial::GetShaderParameterArraySize(const char *name);

index
An index of a parameter
name
A parameter's name
Return value
A number of an array

(new in Rev4.33)

It returns a number of an array in a shader parameter specified by an index or a name.

This method is equal to GetMainShaderNode()->GetParameterArraySize().


bool MQMaterial::GetShaderParameterBoolValue(int index, int array_index);
bool MQMaterial::GetShaderParameterBoolValue(const char *name, int array_index);
int MQMaterial::GetShaderParameterIntValue(int index, int array_index);
int MQMaterial::GetShaderParameterIntValue(const char *name, int array_index);
float MQMaterial::GetShaderParameterFloatValue(int index, int array_index);
float MQMaterial::GetShaderParameterFloatValue(const char *name, int array_index);
MQColorRGBA MQMaterial::GetShaderParameterColorValue(int index, int array_index);
MQColorRGBA MQMaterial::GetShaderParameterColorValue(const char *name, int array_index);

index
An index of a parameter
name
A parameter's name
array_index
An index in an array
Return value
A value

(new in Rev4.33)

It returns a value as bool, int, float or color value in a shader parameter specified by an index or a name.

This method is equal to GetMainShaderNode()->GetParameter****Value().


void MQMaterial::SetShaderParameterBoolValue(int index, int array_index, bool value);
void MQMaterial::SetShaderParameterBoolValue(const char *name, int array_index, bool value);
void MQMaterial::SetShaderParameterIntValue(int index, int array_index, int value);
void MQMaterial::SetShaderParameterIntValue(const char *name, int array_index, int value);
void MQMaterial::SetShaderParameterFloatValue(int index, int array_index, float value);
void MQMaterial::SetShaderParameterFloatValue(const char *name, int array_index, float value);
void MQMaterial::SetShaderParameterColorValue(int index, int array_index, MQColorRGBA color);
void MQMaterial::SetShaderParameterColorValue(const char *name, int array_index, MQColorRGBA color);

index
An index of a parameter
name
A parameter's name
array_index
An index in an array
value
A value

(new in Rev4.33)

It specifies a value as bool, int, float or color value in a shader parameter specified by an index or a name.

This method is equal to GetMainShaderNode()->SetParameter****Value().


int MQMaterial::GetShaderMappingNum(void);

Return value
A number of shader mapping

(new in Rev4.33)

It returns a number of mappings in a shader.

This method is equal to GetMainShaderNode()->GetMappingNum().


int MQMaterial::GetShaderMappingName(int index, char *buffer, int buffer_size);
std::string MQMaterial::GetShaderMappingName(int index);

index
An index of a mapping
buffer
A buffer to receive a mapping name
buffer_size
A length of a buffer (by a number of characters)
Return value
int : An actual number of characters
std::string : A name

(new in Rev4.33)

It returns a mapping's name in a shader.

This method is equal to GetMainShaderNode()->GetMappingName().


int MQMaterial::GetShaderMappingFilename(int index, char *buffer, int buffer_size);
int MQMaterial::GetShaderMappingFilename(const char *name, char *buffer, int buffer_size);
int MQMaterial::GetShaderMappingFilename(int index, wchar_t *buffer, int buffer_size);
int MQMaterial::GetShaderMappingFilename(const char *name, wchar_t *buffer, int buffer_size);
std::string MQMaterial::GetShaderMappingFilename(int index);
std::string MQMaterial::GetShaderMappingFilename(const char *name);
std::wstring MQMaterial::GetShaderMappingFilenameW(int index);
std::wstring MQMaterial::GetShaderMappingFilenameW(const char *name);

index
An index of a mapping
buffer
A buffer to receive a filename (ANSI or wide characters)
buffer_size
A length of a buffer (by a number of characters)
name
A mapping's name
Return value
int : An actual number of characters
std::string : A filename (ANSI characters)
std::wstring A filename (Wide characters)

(new in Rev4.33)

It returns a filename for a mapping in a shader.

This method is equal to GetMainShaderNode()->GetMappingFilename().


void MQMaterial::SetShaderMappingFilename(int index, char *buffer);
void MQMaterial::SetShaderMappingFilename(const char *name, char *buffer);
void MQMaterial::SetShaderMappingFilename(int index, wchar_t *buffer);
void MQMaterial::SetShaderMappingFilename(const char *name, wchar_t *buffer);

index
An index of a mapping
buffer
A buffer to receive a filename (ANSI or wide characters)
name
A mapping's name
Return value

(new in Rev4.33)

It specifies a filename for a mapping in a shader.

This method is equal to GetMainShaderNode()->SetMappingFilename().


MQShaderNode MQMaterial::GetMainShaderNode();

Return value
A shader node

(new in Rev4.50)

It returns a main shader node.

A main shader exists when MQMATERIAL_SHADER_HLSL is specified in SetShader() and a valid shader name is specified in SetShaderName(). Otherwise, it returns NULL.


int MQMaterial::GetSubShaderNodeNum();

Return value
A number of sub shader nodes

(new in Rev4.50)

It returns a number of sub shader nodes.


std::string MQMaterial::GetSubShaderNodeID(int index);

index
An index of a sub shader node
Return value
A shader node's ID

(new in Rev4.50)

It returns a shader node's ID.


MQShaderNode MQMaterial::GetSubShaderNode(int index);
MQShaderNode MQMaterial::GetSubShaderNode(const char *id);

index
An index of a sub shader node
id
A shader node's ID
Return value
A shader node

(new in Rev4.50)

It returns a sub shader node by an index of an ID.


BOOL MQMaterial::AllocUserData(int userdata_id);

userdata_id
A material user data ID
Return value
[TRUE] Succeeded
[FALSE] Failed

(new in Rev3.10)

It allocates a memory area for an user data in the material.

It uses an user data ID created by MQDocument::CreateMaterialUserData() for 'userdata_id'.

When an user data that is already allocated is specified, this function will return TRUE without performing anything.

Please do not allocate an user data until it is actually needed because it is necessary for a memory.


void MQMaterial::FreeUserData(int userdata_id);

userdata_id
A material user data ID

(new in Rev3.10)

It frees a memory area for an user data allocated by MQMaterial::AllocUserData().

Please free it immediately when it is not necessary any longer. A memory will be wasted if it continues allocating carelessly.


BOOL MQMaterial::GetUserData(int userdata_id, void *buffer);

userdata_id
A material user data ID
buffer
A number for storing an user data
Return value
[TRUE] Succeeded
[FALSE] Failed

(new in Rev3.10)

It gets an user data for a material.

A size of buffer must be equal to or larger than a size specified in MQDocument::CreateMaterialUserData().

It will return FALSE when you specify an user data that has not been allocated yet. And the buffer are filled with 0 when you specify an user data that has not been set yet by MQMaterial::SetUserData().


BOOL MQMaterial::GetUserDataPart(int userdata_id, int offset, int copy_bytes, void *buffer);

userdata_id
A material user data ID
offset
An offset from a head of an user data
copy_bytes
A number of bytes to copy data
buffer
A number for storing an user data
Return value
[TRUE] Succeeded
[FALSE] Failed

(new in Rev3.10)

It partially gets an user data for a material.

An area begins from the offset is stored to the buffer.

A size of buffer must be equal to or larger than copy_bytes. A whole user data, that is, a number of bytes specified in MQDocument::CreateMaterialUserData() is copied when 0 is specified for copy_bytes.

It will return FALSE when you specify an user data that has not been allocated yet. And the buffer are filled with 0 when you specify an user data that has not been set yet by MQMaterial::SetUserData().


BOOL MQMaterial::SetUserData(int userdata_id, const void *buffer);

userdata_id
A material user data ID
buffer
A buffer stores an user data
Return value
[TRUE] Succeeded
[FALSE] Failed

(new in Rev3.10)

It sets an user data with the buffer.

A size of buffer must be equal to or larger than a size specified in MQDocument::CreateMaterialUserData().

It will return FALSE when you specify an user data that has not been allocated yet.


BOOL MQMaterial::SetUserDataPart(int userdata_id, int offset, int copy_bytes, const void *buffer);

userdata_id
A material user data ID
offset
An offset from a head of an user data
copy_bytes
A number of bytes to copy data
buffer
A buffer stores an user data
Return value
[TRUE] Succeeded
[FALSE] Failed

(new in Rev3.10)

It partially sets an user data for a material.

A data in the buffer is copied to an area begins from the offset.

A size of buffer must be equal to or larger than copy_bytes. A whole user data, that is, a number of bytes specified in MQDocument::CreateMaterialUserData() is copied when 0 is specified for copy_bytes.

It will return FALSE when you specify an user data that has not been allocated yet.