Initial material exporting work

Not sure if the method I'm using to get the texture name is
reliable. Needs testing.