Closed osstony closed 7 years ago
Hi, yes it is normal:
from unreal_engine.structs import SkeletalMaterial
skeletal_material = SkeletalMaterial()
skeletal_material.MaterialInterface = your_material_asset
mesh.Materials = [skeletal_material]
...
Thank you @rdeioris. Not sure I fully understand this (I am not fully up to speed on parts of Unreal). What would be your_material_asset? I need to know this ahead of time somehow?
What I'm hoping to get is a list of the UMaterials part of the SkeletalMesh which I can then get all of the UTextures from and finally be able to manipulate the UTexture source paths and reload the textures. Could I do this given only having access to a USkeletalMesh instance?
Unrelated, I have some code I'm working on that allows for adding Toolbar buttons. I will push it up in the next few days for you to check out. I'm not sure I've gone about it in the cleanest way so I would like to get your thoughts on it.
@rdeioris I may have gotten it using:
import unreal_engine
mesh = unreal_engine.get_selected_assets()[0]
for material in mesh.Materials:
for name, guid in material.MaterialInterface.get_material_texture_parameter_names():
print material.MaterialInterface.get_material_texture_parameter(name)
Does this seem correct (get_material_texture_parameter_names is a new method I added which I will push up)? I'm not fully understanding the relationships with UScriptStructs, SkeletalMaterials, MaterialInterface and MaterialInstanceConstant which is what is returned when I access UScriptStruct.MaterialInterface. Do you know if there is documentation explaining this anywhere?
Hi, i have just uploaded this 'huge' example:
https://github.com/20tab/UnrealEnginePython/blob/master/examples/kaiju_builder.py
hope it will be useful (requires latest code from github)
This is great, thank you!
As the subject says when I try to get the list of Materials from a USkeletalMesh a list of UScriptStruct objects is returned. Is this expected behavior?