9Evgeny9
(9Evgeny9)
August 18, 2023, 1:57pm
1
I want to change Texture2D parameter in given MaterialInstance class with Python.
Code
new_material.set_texture_parameter_value("UnderwearMask",torso_mask)
Invokes with error
LogPython: Error: AttributeError: ‘MaterialInstanceConstant’ object has no attribute ‘set_texture_parameter_value’
class description
MaterialInstanceConstant
OK.
set_texture_parameter_value
has “MaterialInstanceDynamic” class.
class description
MaterialInstanceDynamic
So, how i can convert “MaterialInstanceConstant” to “MaterialInstanceDynamic” with Python?
OR
How to create “MaterialInstanceDynamic” with Python? (There is no Factory for Dynamic instance creation. Only for constant unreal.MaterialInstanceConstantFactoryNew()
)
Joachim.L
(Joachim)
August 28, 2023, 11:35am
2
Hello there!
I have the exact same problem, but it seems that changing MaterialInstanceConstant
parameters is fine…
Here is how I do it:
material_editing_library = unreal.MaterialEditingLibrary
asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
editor_asset_library = unreal.EditorAssetLibrary
mybaseMat= editor_asset_library.find_asset_data('/mypath/myMat')
materialInstance = asset_tools.create_asset('myInstance', '/myPath/', unreal.MaterialInstanceConstant, unreal.MaterialInstanceConstantFactoryNew())
material_editing_library.set_material_instance_scalar_parameter_value( materialInstance, 'myScalarParam', 42.0)
texAsset= editor_asset_library.find_asset_data('/mypath/myTex')
material_editing_library.set_material_instance_texture_parameter_value(materialInstance, 'myTexParam', texasset.get_asset())
Cheers!
1 Like
system
(system)
Closed
September 27, 2023, 11:35am
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.