Open ArpegorPSGH opened 2 years ago
Here is the pseudo code:
from mmd_tools.core.material import FnMaterial
source = FnMaterial(source_material)
target = FnMaterial(target_material)
source_base_tex = source.get_texture()
if source_base_tex:
target.create_texture(source_base_tex.image.filepath)
source_sphere_tex = source.get_sphere_texture()
if source_sphere_tex:
target.create_sphere_texture(source_sphere_tex.image.filepath)
target_material.mmd_material.sphere_texture_type = source_material.mmd_material.sphere_texture_type
target_material.mmd_material.is_shared_toon_texture = source_material.mmd_material.is_shared_toon_texture
target_material.mmd_material.shared_toon_texture = source_material.mmd_material.shared_toon_texture
target_material.mmd_material.toon_texture = source_material.mmd_material.toon_texture
#Another way
copy_material = source_material.copy()
FnMaterial(copy_material).create_texture(filepath_of_base_texture)
FnMaterial(copy_material)..create_sphere_texture(filepath_of_sphere_texture)
copy_material.mmd_material.sphere_texture_type = "0", "1", "2", or "3"
copy_material.mmd_material.is_shared_toon_texture = True or False
copy_material.mmd_material.shared_toon_texture = 0 ~ 9
copy_material.mmd_material.toon_texture = filepath_of_custom_toon_texture
Hello, I am trying to write a script to automatically create MMD materials inside Blender as copy of existing ones, but with the addition of a texture. However, I can't find a way to access the texture field of the MMD material to give it a value. How could I manage that?
Thank you in advance, ArpegorPSGH