It is not possible to set the color of the object added from the file. What am I doing wrong?
import bpy
import os
from pathlib import Path
file_path = 'd:/BlendetSkin002/280154.blend'
inner_path = 'Object'
object_name = 'scirt01'
def append_scirt( path: Path):
bpy.ops.wm.append(
filepath=os.path.join(file_path, inner_path, object_name),
directory=os.path.join(file_path, inner_path),
filename=object_name,
active_collection = True
)
rgba_color = (220, 0, 220, 0.99)
material = bpy.data.materials.new(f"scirt01")
material.diffuse_color = rgba_color
bpy.context.active_object.data.materials.append(material)
bpy.context.object.active_material.diffuse_color = rgba_color
append_scirt( Path(f'd:/BlendetSkin002/280154.blend'))
diffuse_color
is only for the viewport. $\endgroup$