Materials Library

Can’t enable the addon in 2.58 with cache cleared.

Yesterday I published a script with a debugger enabled by mistake (which will fail if you dont have that debugger). I uploaded a correct file as soon as i knew so try to download again or enable the console to see whats happening. If its not the debugger pls let me know.

To open the console go to Help -> Toggle System Console.

Getting the following error when trying to enable the addon:

IOError [Errno 13] Permission denied: ‘C:\Program Files\Blender Foundation\Blender\materials.xml’

Maybe the thing is the file is not there. It should be created the first time you run the script I believe (correct me if I’m wrong) but it doesn’t. It searches for it but it’s not there and hence the error. I might be completely wrong here though.

Thats not the case, the script does checks if the file exists before doing something. And if it doesnt find the file, it creates a new one.

Permission Denied, means that even if the file exists you (or your application, “Blender in this case”) dont have enough privileges to access the file or folder which contains it. Those are matters of your operating system security. Configure you OS to gain enough priviliges to access the file.

This is common problem if you share materials.xml on a local network. First, you must configure your network to have enough permissions to access the file and on second hand, if 2 users tries to update a material at “the same time” one of them could have that error.

On windows, you can change security settings by having an administrator account and right clicking the Blender folder.
I dont about security in linux, sry i cant help there.

Hey guys.

Ive just released a new version of the script.
This time it supports everything, all external renders, all nodes, materials and textures and much more. if you can create it in blender it can be stored.
I had to change the database type into a native blend file, this is a more natural way to save materials, it also makes use of blender internal compression and most important, its almost bug free.

Check it out

you have a malformed link to the download… please fix…
i was able to download by removing the stuff at the end.
seems to workok so far…

Thanks for the advise, im fixing it.

umm… you know what…
i like it, its just that the interface it a a bit confusing…

i think it needs a bit improving(simplify it a little bit if possible)

When i try to “link” to that Clay material that i showed to you before the i try
to apply that material to a second Object in the scene i get this error message “clay doesnt exist in library”
but, i can see “clay” in the material library i added it already. hmmm…

Hmm, ok ill publish the installation process at the main post,
The steps are:
1.-Create the library first by creating a new blend file and saving it as materials.blend into your blender.exe folder.
2.-Delete the previous versions of the script at your addon folder. matlib.py or matlib258.py
3.-Install as a regular addon. Copy the script to your addon folder and enable it at File -> User preferences ->Addons -> System -> Material Library.

About the interface, i dont know how to simplify it, all the tools are needed. if you have any suggestion its welcome.

Ok i figured out whats wrong, the first time you import a material, the script does a setup to be able to export it to the database, at that proccess it may not export this first material succesfully but the second time you try it does right.

Thats a minor bug that i didnt know about, you can use the current script without problems just make sure to import your very first material twice.

Ubuntu should be as simple as right click to properties and set permissions


anyone else have trouble moving the box up in the interface of 2.58?

Thanks for the info about linux saltima, Do you mean moving the panel isnt it? What kind of problem do you have?

Hi,

In windows, could the following lines

matlibpath = bpy.app.binary_path[0:-len(“blender.exe”)]+“materials.blend”
catspath = bpy.app.binary_path[0:-len(“blender.exe”)]+“categories.xml”

be replaced by

matlibpath = bpy.app.binary_path[0:-len(“blender”)]+“materials.blend”
catspath = bpy.app.binary_path[0:-len(“blender”)]+“categories.xml”

and still work? current version does not work flawlessly in linux, i get the following error

Warning: /home/user/blender-2.58-linux-glibc27-imaterials.blend doesnt exists!. Please create materials.blend at that path.

folder is actually /home/user/blender-2.58-linux-glibc27-i686

but this works fine for me

bpy.app.binary_path[0:-len(“blender”)]

possibly OSX users that don’t use .exe either

unlike 2.4, when i click and drag it wont move

Thanks for clearing that out, I couldnt test the script on linux, or Mac. About draggin the panel im not sure, did you clicked on the panels top right corner?

That’s it! many thanks, great addon!!!

ive posted a materials.blend with over 100 materials and its categories, and instructions if you want to add them to your existing library.

If you want to share your library just send a link.

Regards.

Mackraken,

Thinking about work and consideration I been doing on an add-on I have been developing, something you might want to consider to make the script a little easier for those beginning to use Blender is to have a small sample materials.blend that you can distribute with the add-on. This will probably require that you morph your current script into a proper Python module (has its own folder and an init.py) that you could then put the sample materials.blend into. This would also make the script a little more portable since instead of relying on the relative location to blender.exe you could instead know that it will be accessible by it being in the same folder as the script. An easy way to get it would be something like:

import inspect
path = inspect.getfile(inspect.currentframe())[0:-len("matlibvx.py")] + "materials.blend"

Also, it would make the script more cross-platform compatible since users on other platforms would not have to change the path to the material.blend file.
Something else that I feel like would be a nice feature (or maybe already is and I missed it?) would be the ability to merge in a material library. For example someone posts an awesome library of a bajillion materials and you want to add it to your library of, like, 50, it would be a pain to manually combine the two.
Anyway, just a couple of thoughts.
BTW, the script is pretty sweet. Keep advancing it!

Hi BrikBot.

Theres quite some documentation at the download page. Im not saying that you have to read everything in order to run the addon, just only the installation process and what each button does, thats all.

On other post someone suggested the same, that is a bit confusing at the begining but i dont know what can i do to simplify the addon, without removing functionality.

I published some days ago, my materials.blend with over 100 categorized materials, but the point is that the addon “should
never be used into the database”. materials.blend is meant to be just a container for all those materials. not a file to work with this addon.

I think the script is portable in the way that you can copy the database, categories.xml and matlibvx.py to another computer and will work the same. Im providing instruction into the web site. Change the first 2 variables, matlibpath and catspath on the new machine and its done.

A folder would make things a bit easier, thats right. and you can change the script to point to a specific folder instead the binary path, if u like, just make sure that path is absolute.

That problem about other platforms is that i dont know how linux or mac mount their drives. so i provided the instructions to fix that.

Merge materials is a cool thing that you can do, if you think about it materials.blend is a blend file. So you can append straight to the library all the materials you want. Just make sure those materials are using a fake user to avoid that they are flushed after saving.

I guess im providing the code to change all fake users at once. After the appending run this:

for mat in bpy.data.materials:
mat.use_fake_user=True

save the file and its done, 50 more materials added to the database.

I run out of ideas, i dont know what can i do to improve it further, as far as i know its working good. Well i thought about thumbnails but i dont know if it possible to capture the Materials image preview.

Thanks for the comments and ideas.