[Bf-python] Ideal way to store material data for matlib add-on?

Dan Eicher dan at trollwerks.org
Sat May 11 19:55:46 CEST 2013


This may or may not be helpful...

A while back I was working on a similar idea to convert blender materials
to/from JSON format and used a slightly different method, instead of
maintaining a list of properties to save I had a list of common props that
I didn't want to save and did a (in probably non-valid python):

for prop in dir(mat) if not in exclude_list:
    do_something_with_prop(getattribute(mat, prop))

IIRC this fed the props into a python dict (used as a switch statement) to
dispatch into handler functions that converted them into a format JSON was
happy with.

The inverse was super easy, create a material/texture, read the props from
the JSON file and if the prop exists set it else it stays as the default.

Two things killed my little project: 1) there was no way to read/set curve
mapping points and nodes/node trees (both fixed now) and 2) my idea to use
a python function as an input method for the file browser was veto'd so
there's no non-sucky way to browse through an internets based material
library from within blender -- which doesn't really matter to the current
discussion but I like to vent...

Anyways, I was thinking on this yesterday and if one were to use an XML
schema, a schema to python generator (eg. generateds) and a little py-magic
it would be possible to have a fully versioned material library database
system without too much hassle.

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20130511/8a67615c/attachment.html>


More information about the Bf-python mailing list