IC Python API:RLPy RIMaterialComponent

From Reallusion Wiki!
Jump to: navigation, search

Contents

Main article: Modules.
Last modified: 04/15/2020

Description

This class is used to manipulate material surface properties. The main material properties are Ambient color, Diffuse color, Specular color, Glossiness value, Self-illumination value, Opacity value, textures, and more. A material is affiliated with an object, therefore, member functions of this class must specify a mesh and material name.

Inheritance

RIBase > RIMaterialComponent 

Member Functions

AddAmbientKey ( self, kKey, strMeshName, strMaterialName, kColor )

Add an Ambient key for the material according to the time and Transition Type of kKey.

See Also: AddDiffuseKey, AddGlossinessKey, AddOpacityKey, AddSelfIlluminationKey, AddSpecularKey, AddTextureWeightKey, AddUvDataKey, AddVideoVolumeKey

Parameters

kKey [IN] The key for time and transition control - RKey
strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
kColor [IN] The color of a material’s ambient component - RRgb

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Add an ambient key value
13 material_component.AddAmbientKey(key, mesh_name, material_name, RLPy.RRgb.RED)

AddDiffuseKey ( self, kKey, strMeshName, strMaterialName, kColor )

Add a Diffuse key for the material according to the time and Transition Type of kKey.

See Also: AddAmbientKey, AddGlossinessKey, AddOpacityKey, AddSelfIlluminationKey, AddSpecularKey, AddTextureWeightKey, AddUvDataKey, AddVideoVolumeKey

Parameters

kKey [IN] The key to add a diffuse key value - RKey
strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
kColor [IN] The color for diffuse - RRgb

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Add a diffuse key value
13 material_component.AddDiffuseKey(key, mesh_name, material_name, RLPy.RRgb.RED)

AddGlossinessKey ( self, kKey, strMeshName, strMaterialName, fWeight )

Add a Glossiness key for the material according to the time and Transition Type of kKey.

See Also: AddAmbientKey, AddDiffuseKey, AddOpacityKey, AddSelfIlluminationKey, AddSpecularKey, AddTextureWeightKey, AddUvDataKey, AddVideoVolumeKey

Parameters

kKey [IN] The key for time and transition control - RKey
strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
fWeight [IN] The weight for glossiness - float [0~100]

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Add a glossiness key value
13 material_component.AddGlossinessKey(key, mesh_name, material_name, 0.5)

AddSpecularKey ( self, kKey, strMeshName, strMaterialName, kColor )

Add a Specular key for the material according to the time and Transition Type of kKey.

See Also: AddAmbientKey, AddDiffuseKey, AddGlossinessKey, AddOpacityKey, AddSelfIlluminationKey, AddTextureWeightKey, AddUvDataKey, AddVideoVolumeKey

Parameters

kKey [IN] The key for time and transition control - RKey
strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
kColor [IN] The color for specular - RRgb

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Add a specular key value
13 material_component.AddSpecularKey(key, mesh_name, material_name, RLPy.RRgb.RED)

AddSelfIlluminationKey ( self, kKey, strMeshName, strMaterialName, kColor )

Add a Self-illumination key for the material according to the time and Transition Type of kKey.

See Also: AddAmbientKey, AddDiffuseKey, AddGlossinessKey, AddOpacityKey, AddSpecularKey, AddTextureWeightKey, AddUvDataKey, AddVideoVolumeKey

Parameters

kKey [IN] The key for time and transition control - RKey

strMeshName [IN] Name of the mesh - string strMaterialName [IN] Name of a mesh material - string fWeight [IN] The weight for self-illumination - float [0~100]

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Add a self-illumination key value
13 material_component.AddSelfIlluminationKey(key, mesh_name, material_name, 0.5)

AddOpacityKey ( self, kKey, strMeshName, strMaterialName, fWeight )

Add an Opacity key for the material according to the time and Transition Type of kKey.

See Also: AddAmbientKey, AddDiffuseKey, AddGlossinessKey, AddSelfIlluminationKey, AddSpecularKey, AddTextureWeightKey, AddUvDataKey, AddVideoVolumeKey

Parameters

kKey [IN] The key for time and transition control - RKey
strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
fWeight [IN] The weight for opacity - float [0~100]

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Add a opacity key value
13 material_component.AddOpacityKey(key, mesh_name, material_name, 0.5)

AddTextureWeightKey ( self, kKey, strMeshName, strMaterialName, eChannel, fWeight )

Add a Texture Channel Weight key for the material according to the time and Transition Type of kKey.

See Also: AddAmbientKey, AddDiffuseKey, AddGlossinessKey, AddOpacityKey, AddSelfIlluminationKey, AddSpecularKey, AddTextureWeightKey, AddUvDataKey, AddVideoVolumeKey

Parameters

kKey [IN] The key for time and transition control - RKey
strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
eChannel [IN] A material texture channel - RLPy.EMaterialTextureChannel
  • RLPy.EMaterialTextureChannel_Metallic
  • RLPy.EMaterialTextureChannel_Diffuse
  • RLPy.EMaterialTextureChannel_Specular
  • RLPy.EMaterialTextureChannel_Shininess
  • RLPy.EMaterialTextureChannel_Glow
  • RLPy.EMaterialTextureChannel_Displacement
  • RLPy.EMaterialTextureChannel_Opacity
  • RLPy.EMaterialTextureChannel_DiffuseBlend
  • RLPy.EMaterialTextureChannel_Bump
  • RLPy.EMaterialTextureChannel_Reflection
  • RLPy.EMaterialTextureChannel_Refraction
  • RLPy.EMaterialTextureChannel_Cube
  • RLPy.EMaterialTextureChannel_AmbientOcclusion
  • RLPy.EMaterialTextureChannel_Quantity
fWeight [IN] The weight for channel - float [0~100] ui 上是 0~100, 傳到核心沒乘 0.01

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Modify texture weight
13 texture_channel = RLPy.EMaterialTextureChannel_Diffuse
14 diffuse_weight = 0.1
15 material_component.AddTextureWeightKey(key, mesh_name, material_name,
16                                        texture_channel, diffuse_weight)

AddUvDataKey ( self, kKey, strMeshName, strMaterialName, eChannel, kUvOffset, kUvTile, fUvRotate )

Add an UV Texture Coordinates key for the material according to the time and Transition Type of kKey. This key can be used to set the texture channel's UV offset, tile, and rotate values.

See Also: AddAmbientKey, AddDiffuseKey, AddGlossinessKey, AddOpacityKey, AddSelfIlluminationKey, AddSpecularKey, AddTextureWeightKey, AddVideoVolumeKey

Parameters

kKey [IN] The key for time and transition control - RKey
strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
eChannel [IN] A material texture channel - RLPy.EMaterialTextureChannel
  • RLPy.EMaterialTextureChannel_Metallic
  • RLPy.EMaterialTextureChannel_Diffuse
  • RLPy.EMaterialTextureChannel_Specular
  • RLPy.EMaterialTextureChannel_Shininess
  • RLPy.EMaterialTextureChannel_Glow
  • RLPy.EMaterialTextureChannel_Displacement
  • RLPy.EMaterialTextureChannel_Opacity
  • RLPy.EMaterialTextureChannel_DiffuseBlend
  • RLPy.EMaterialTextureChannel_Bump
  • RLPy.EMaterialTextureChannel_Reflection
  • RLPy.EMaterialTextureChannel_Refraction
  • RLPy.EMaterialTextureChannel_Cube
  • RLPy.EMaterialTextureChannel_AmbientOcclusion
  • RLPy.EMaterialTextureChannel_Quantity
kUvOffset [IN] The uv's offset for channel - RLPy.RVector2f
kUvTile [IN] The uv's tile for channel - RLPy.RVector2f
fUvRotate [IN] The uv's rotate for channel ( radians) - float

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Modify uv data
13 texture_channel = RLPy.EMaterialTextureChannel_Bump
14 uv_offset = RLPy.RVector2(0.1, 0)
15 uv_tile = RLPy.RVector2(1, 1)
16 uv_rotate = 3.14
17 material_component.AddUvDataKey(key, mesh_name, material_name,
18                           texture_channel, uv_offset, uv_tile, uv_rotate)

AddVideoVolumeKey ( self, kKey, strMeshName, strMaterialName, eChannel, fVol, bMute )

Add a Video Volume key for the material according to the time and Transition Type of kKey. This key can be used to set the video material's channel video volume.

See Also: AddAmbientKey, AddDiffuseKey, AddGlossinessKey, AddOpacityKey, AddSelfIlluminationKey, AddSpecularKey, AddTextureWeightKey, AddUvDataKey

Parameters

kKey [IN] The key for time and transition control - RKey
strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
eChannel [IN] A material texture channel - RLPy.EMaterialTextureChannel
  • RLPy.EMaterialTextureChannel_Metallic
  • RLPy.EMaterialTextureChannel_Diffuse
  • RLPy.EMaterialTextureChannel_Specular
  • RLPy.EMaterialTextureChannel_Shininess
  • RLPy.EMaterialTextureChannel_Glow
  • RLPy.EMaterialTextureChannel_Displacement
  • RLPy.EMaterialTextureChannel_Opacity
  • RLPy.EMaterialTextureChannel_DiffuseBlend
  • RLPy.EMaterialTextureChannel_Bump
  • RLPy.EMaterialTextureChannel_Reflection
  • RLPy.EMaterialTextureChannel_Refraction
  • RLPy.EMaterialTextureChannel_Cube
  • RLPy.EMaterialTextureChannel_AmbientOcclusion
  • RLPy.EMaterialTextureChannel_Quantity
fVol [IN] The volume of video ( 0-100 ) - float
bMute [IN] mute - bool

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Load video to material channel
13 texture_channel = RLPy.EMaterialTextureChannel_Bump
14 video_file = "C://MaterialVideoTest.mp4"
15 video_volume = 50
16 is_mute = False
17 material_component.LoadVideoToTexture(key, mesh_name, material_name,
18                                       texture_channel, video_file)
19 material_component.AddVideoVolumeKey(key, mesh_name, material_name,
20                                     texture_channel, video_volume, is_mute)

GetAmbientColor ( self, strMeshName, strMaterialName )

Get the material's Ambient color.

See Also: GetDiffuseColor, GetGlossinessWeight, GetMaterialNames, GetOpacity, GetSelfIlluminationWeight, GetSpecularColor, GetSpecularWeight, GetTextureWeights, GetUvData, GetVideoVolume

Parameters

strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string

Returns

ambient color - RRgb
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Get ambient color
10 print(material_component.GetAmbientColor(mesh_name, material_name))

GetDiffuseColor ( self, strMeshName, strMaterialName)

Get the material's Diffuse color.

See Also: GetAmbientColor, GetGlossinessWeight, GetMaterialNames, GetOpacity, GetSelfIlluminationWeight, GetSpecularColor, GetSpecularWeight, GetTextureWeights, GetUvData, GetVideoVolume

Parameters

strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string

Returns

diffuse color - RRgb
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Get diffuse color
10 print(material_component.GetDiffuseColor(mesh_name, material_name))

GetGlossinessWeight ( self, strMeshName, strMaterialName)

Get the material's Glossiness weight.

See Also: GetMaterialNameParameters

Parameters

strMeshName [IN] Name for the mesh - string
strMaterialName [IN] Name of the material on the mesh - string

Returns

weight of specular - float
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Get glossiness weight
10 print(material_component.GetGlossinessWeight(mesh_name, material_name))

GetMaterialNames ( self, strMeshName )

Get all the material names for the mesh.

See Also: GetAmbientColor, GetDiffuseColor, GetGlossinessWeight, GetOpacity, GetSelfIlluminationWeight, GetSpecularColor, GetSpecularWeight, GetTextureWeights, GetUvData, GetVideoVolume

Parameters

strMeshName [IN] Name of the mesh - string

Returns

material names - string list.
1 # Get Object mesh and material
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 material_component = avatar.GetMaterialComponent()
5 mesh_list = avatar.GetMeshNames()
6 mesh_name = mesh_list[0]
7 material_list = material_component.GetMaterialNames(mesh_name)
8 material_name = material_list[0]

GetOpacity ( self, strMeshName, strMaterialName )

Get the material opacity value.

See Also: GetAmbientColor, GetDiffuseColor, GetGlossinessWeight, GetMaterialNames, GetSelfIlluminationWeight, GetSpecularColor, GetSpecularWeight, GetTextureWeights, GetUvData, GetVideoVolume

Parameters

strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string

Returns

weight of opacity - float
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Get opacity
10 print(material_component.GetOpacity(mesh_name, material_name))

GetSelfIlluminationWeight ( self, strMeshName, strMaterialName )

Get the material's self-illumination weight.

See Also: GetAmbientColor, GetDiffuseColor, GetGlossinessWeight, GetMaterialNames, GetOpacity, GetSpecularColor, GetSpecularWeight, GetTextureWeights, GetUvData, GetVideoVolume

Parameters

strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string

Returns

weight of self-illumination - float
 1 ( Experimental API )
 2 # Get object, mesh and material
 3 avatar_list = RLPy.RScene.GetAvatars()
 4 avatar = avatar_list[0]
 5 material_component = avatar.GetMaterialComponent()
 6 mesh_list = avatar.GetMeshNames()
 7 mesh_name = mesh_list[0]
 8 material_list = material_component.GetMaterialNames(mesh_name)
 9 material_name = material_list[0]
10 # Get self-illumination weight
11 print(material_component.GetSelfIlluminationWeight(mesh_name, material_name))

GetSpecularColor ( self, strMeshName, strMaterialName )

Get the material's Specular color.

See Also: GetAmbientColor, GetDiffuseColor, GetGlossinessWeight, GetMaterialNames, GetOpacity, GetSelfIlluminationWeight, GetSpecularWeight, GetTextureWeights, GetUvData, GetVideoVolume

Parameters

strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string

Returns

Specular color - RRgb
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Get specular color
10 print(material_component.GetSpecularColor(mesh_name, material_name))

GetSpecularWeight ( self, strMeshName, strMaterialName )

Get the material's Specular weight.

See Also: GetAmbientColor, GetDiffuseColor, GetGlossinessWeight, GetMaterialNames, GetOpacity, GetSelfIlluminationWeight, GetSpecularColor, GetTextureWeights, GetUvData, GetVideoVolume

Parameters

strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string

Returns

Specular weight - float
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Get specular weight
10 print(material_component.GetSpecularWeight(mesh_name, material_name))

GetTextureWeights ( self, strMeshName, strMaterialName )

Get all texture channel weights for the material.

See Also: GetAmbientColor, GetDiffuseColor, GetGlossinessWeight, GetMaterialNames, GetOpacity, GetSelfIlluminationWeight, GetSpecularColor, GetSpecularWeight, GetUvData, GetVideoVolume

Parameters

strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string

Returns

Ordered list of all texture channel weights - float list
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Get all texture weights
10 temp_texture_weight_list = material_component.GetTextureWeights(mesh_name, material_name)
11 print(temp_texture_weight_list)

GetUvData ( self, strMeshName, strMaterialName, eChannel, kUvOffest, kUvTile, fUvRotate )

Get all texture channel UV coordinates (offset, tiling, rotation) for the material.

See Also: GetAmbientColor, GetDiffuseColor, GetGlossinessWeight, GetMaterialNames, GetOpacity, GetSelfIlluminationWeight, GetSpecularColor, GetSpecularWeight, GetTextureWeights, GetVideoVolume

Parameters

strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
eChannel [IN] A material texture channel - RLPy.EMaterialTextureChannel
  • RLPy.EMaterialTextureChannel_Metallic
  • RLPy.EMaterialTextureChannel_Diffuse
  • RLPy.EMaterialTextureChannel_Specular
  • RLPy.EMaterialTextureChannel_Shininess
  • RLPy.EMaterialTextureChannel_Glow
  • RLPy.EMaterialTextureChannel_Displacement
  • RLPy.EMaterialTextureChannel_Opacity
  • RLPy.EMaterialTextureChannel_DiffuseBlend
  • RLPy.EMaterialTextureChannel_Bump
  • RLPy.EMaterialTextureChannel_Reflection
  • RLPy.EMaterialTextureChannel_Refraction
  • RLPy.EMaterialTextureChannel_Cube
  • RLPy.EMaterialTextureChannel_AmbientOcclusion
  • RLPy.EMaterialTextureChannel_Quantity
kUvOffset [OUT] UV offset - RVector2
kUvTile [OUT] UV tiling - RVector2
fUvRotate [OUT] UV rotation in radians- float

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Get UV data
10 uv_offset = RLPy.RVector2()
11 uv_tile = RLPy.RVector2()
12 uv_rotate = 0.0
13 uv_data = material_component.GetUvData(mesh_name, material_name, texture_channel, uv_offset, uv_tile, uv_rotate)
14 print(uv_data[0])

GetVideoVolume ( self, strMeshName, strMaterialName, eChannel )

Get the video volume for all the video channels of the material.

See Also: GetAmbientColor, GetDiffuseColor, GetGlossinessWeight, GetMaterialNames, GetOpacity, GetSelfIlluminationWeight, GetSpecularColor, GetSpecularWeight, GetTextureWeights, GetUvData

Parameters

strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
eChannel [IN] A material texture channel - RLPy.EMaterialTextureChannel
  • RLPy.EMaterialTextureChannel_Metallic
  • RLPy.EMaterialTextureChannel_Diffuse
  • RLPy.EMaterialTextureChannel_Specular
  • RLPy.EMaterialTextureChannel_Shininess
  • RLPy.EMaterialTextureChannel_Glow
  • RLPy.EMaterialTextureChannel_Displacement
  • RLPy.EMaterialTextureChannel_Opacity
  • RLPy.EMaterialTextureChannel_DiffuseBlend
  • RLPy.EMaterialTextureChannel_Bump
  • RLPy.EMaterialTextureChannel_Reflection
  • RLPy.EMaterialTextureChannel_Refraction
  • RLPy.EMaterialTextureChannel_Cube
  • RLPy.EMaterialTextureChannel_AmbientOcclusion
  • RLPy.EMaterialTextureChannel_Quantity

Returns

video volume - float
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Get video volume
10 texture_channel = RLPy.EMaterialTextureChannel_Bump
11 print(material_component.GetVideoVolume(mesh_name, material_name, texture_channel))

LoadImageToTexture ( self, strMeshName, strMaterialName, eChannel, strImagePath )

Import an image into a material texture channel.

See Also: LoadVideoToTexture

Parameters

strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
eChannel [IN] A material texture channel - RLPy.EMaterialTextureChannel
  • RLPy.EMaterialTextureChannel_Metallic
  • RLPy.EMaterialTextureChannel_Diffuse
  • RLPy.EMaterialTextureChannel_Specular
  • RLPy.EMaterialTextureChannel_Shininess
  • RLPy.EMaterialTextureChannel_Glow
  • RLPy.EMaterialTextureChannel_Displacement
  • RLPy.EMaterialTextureChannel_Opacity
  • RLPy.EMaterialTextureChannel_DiffuseBlend
  • RLPy.EMaterialTextureChannel_Bump
  • RLPy.EMaterialTextureChannel_Reflection
  • RLPy.EMaterialTextureChannel_Refraction
  • RLPy.EMaterialTextureChannel_Cube
  • RLPy.EMaterialTextureChannel_AmbientOcclusion
  • RLPy.EMaterialTextureChannel_Quantity
strImagePath [IN] Image file path - string

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 #Load image to material channel
10 texture_channel = RLPy.EMaterialTextureChannel_Diffuse
11 image_file = "C://diffuse.png"
12 result = material_component.LoadImageToTexture(mesh_name, material_name, texture_channel, image_file)

LoadVideoToTexture ( self, strMeshName, strMaterialName, eChannel, strVideoPath )

Import a video into a material texture channel.

See Also: LoadImageToTexture

Parameters

kKey [IN] The key for time and transition control - RKey
strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
eChannel [IN] A material texture channel - RLPy.EMaterialTextureChannel
  • RLPy.EMaterialTextureChannel_Metallic
  • RLPy.EMaterialTextureChannel_Diffuse
  • RLPy.EMaterialTextureChannel_Specular
  • RLPy.EMaterialTextureChannel_Shininess
  • RLPy.EMaterialTextureChannel_Glow
  • RLPy.EMaterialTextureChannel_Displacement
  • RLPy.EMaterialTextureChannel_Opacity
  • RLPy.EMaterialTextureChannel_DiffuseBlend
  • RLPy.EMaterialTextureChannel_Bump
  • RLPy.EMaterialTextureChannel_Reflection
  • RLPy.EMaterialTextureChannel_Refraction
  • RLPy.EMaterialTextureChannel_Cube
  • RLPy.EMaterialTextureChannel_AmbientOcclusion
  • RLPy.EMaterialTextureChannel_Quantity
strVideoPath [IN] Video file path - string

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Load video to material channel
13 texture_channel = RLPy.EMaterialTextureChannel_Bump
14 video_file = "C://MaterialVideoTest.mp4"
15 material_component.LoadVideoToTexture(key, mesh_name, material_name, texture_channel, video_file)

RemoveUvDataKey ( self, kKey, strMeshName, strMaterialName, eChannel )

Remove an UV data key from a material texture channel.

See Also: AddUvDataKey

Parameters

kKey [IN] The key for time and transition control - RKey
strMeshName [IN] Name of the mesh - string
strMaterialName [IN] Name of a mesh material - string
eChannel [IN] A material texture channel - RLPy.EMaterialTextureChannel
  • RLPy.EMaterialTextureChannel_Metallic
  • RLPy.EMaterialTextureChannel_Diffuse
  • RLPy.EMaterialTextureChannel_Specular
  • RLPy.EMaterialTextureChannel_Shininess
  • RLPy.EMaterialTextureChannel_Glow
  • RLPy.EMaterialTextureChannel_Displacement
  • RLPy.EMaterialTextureChannel_Opacity
  • RLPy.EMaterialTextureChannel_DiffuseBlend
  • RLPy.EMaterialTextureChannel_Bump
  • RLPy.EMaterialTextureChannel_Reflection
  • RLPy.EMaterialTextureChannel_Refraction
  • RLPy.EMaterialTextureChannel_Cube
  • RLPy.EMaterialTextureChannel_AmbientOcclusion
  • RLPy.EMaterialTextureChannel_Quantity

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get object, mesh and material
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 material_component = avatar.GetMaterialComponent()
 5 mesh_list = avatar.GetMeshNames()
 6 mesh_name = mesh_list[0]
 7 material_list = material_component.GetMaterialNames(mesh_name)
 8 material_name = material_list[0]
 9 # Create a key
10 key = RLPy.RKey()
11 key.SetTime(RLPy.RTime(1200))
12 # Remove UV data key
13 texture_channel = RLPy.EMaterialTextureChannel_Bump  test other channel
14 material_component.RemoveUvDataKey(key, mesh_name, material_name, texture_channel)