3
$\begingroup$

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

$\endgroup$

1 Answer 1

1
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ Wow, thumbs up for --debug-all ! $\endgroup$
    – Georges D
    Commented Feb 26, 2022 at 20:12

You must log in to answer this question.