I wan't a script that could append a particular material only from a particular blend file so that i can just run the script and the material is there
1 Answer
$\begingroup$
$\endgroup$
1
This links a number of named materials from materiallibrary.blend
import bpy
# Load materials
bpy.ops.wm.link(filepath="materiallibrary.blend/Material/LL_WireTrans", directory="materiallibrary.blend/Material/", filename="LL_WireTrans", files=[{"name":"LL_Clay", "name":"LL_Clay"}, {"name":"LL_Glass", "name":"LL_Glass"}, {"name":"LL_WireHold", "name":"LL_WireHold"}, {"name":"LL_WireTrans", "name":"LL_WireTrans"}], relative_path=True)
I did not write the above, Blender created it for me. Run blender.exe --debug-all and manually link your required materials, then in the console will be the python code generated, similar to the above.
Because of the --debug-all you will will also get a ton of other stuff that you will need to sort through.
Link to the project I use this in Camera-track-endevour
-
$\begingroup$ Wow, thumbs up for --debug-all ! $\endgroup$Georges D– Georges D2022-02-26 20:12:00 +00:00Commented Feb 26, 2022 at 20:12