Problem with baking Geometry with Materials

Problem is strange because it doesn’t occur every time.

When I bake geometry with assigned material as an attribute, created geometry instead of using already manually prepared earlier material, makes a new material with the same name.
I used three different plugins to test: Human, Elefront, Flexhopper

Everything is shown in the video.
Note, that if I delete created geometry, the material is also deleted.

Please take a look.

Files:material baking.3dm (40.2 KB) Bake with materials.gh (14.7 KB)

Ok, I think I understand how it works.

You can only bake material if it was earlier applied to any geometry in the file. If it wasn’t used even once it will not bake.

How to reproduce the bug (at least I consider it as a bug):

The error lies with the plug-ins Elefront, Human and Flexhopper. I’m guessing they use ‘old-style’ material table access to figure out what material to use. Regular Grasshopper will bake just fine as it should. If a material already exists in the render material table it will use that. If a material doesn’t exist yet a new one will be created.

This is how it works: