# copy linked materials nodes to local material

DISCLAIMER: I rewrite my post upon the latest success to not flood my own post with already solved parts so I left only the part that really is still not working...

PROBLEM: I need to replace all nodes of one material with all nodes of another linked material from another external .blend file via script.

I ALREADY HAVE ALMOST COMPLETELY WORKING SCRIPT NOW ALL MADE BY MYSELF AT LEAST, except the last thing: copying links between nodes...

Does anyone know how exactly write those two parameters, please?

I am using Blender v2.70.5

P.S.: I need strictly SCRIPT BASED ANSWERS ONLY...I know how to do it manually, of course

• The answer may be more complex than you hope. There is a rather large contrib addon called online_material_library that exports materials to xml and imports them. There is also a patch that updates it for the new group api as well as support for nested groups. Maybe you could use that or adapt it to bypass the xml file step. – sambler May 13 '14 at 7:45
• @sambler: did you noticed I edited my post stating I WAS ABLE TO DO IT except the last part of simple copying links from nodes? ;) So now I think it can be quite easily done like this I just still didn't figured out how to extract just the values itself from every link in node.links, or even better said: I am able to obtain every link values but when I try to apply it to nodes it says there is problem with type of value – bublible May 13 '14 at 11:09
• @admins: please flag this post as [SOLVED] as I come to solution myself as described above...thanx ;) – bublible May 13 '14 at 16:26
• @bublible Feel free to put your script in an answer below and accept it. Answering your own question is in fact encouraged, and to be "solved" a question needs an accepted answer. – gandalf3 May 13 '14 at 18:44

# ...some quite long code here and now: