Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sendmat.py « materials_library_vx - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3cbb8aa78a28145da23010e918b489f92eba396c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

import bpy, json
class EmptyProps(bpy.types.PropertyGroup):
	pass
bpy.utils.register_class(EmptyProps)
bpy.types.Scene.matlib_categories = bpy.props.CollectionProperty(type=EmptyProps)
cats = []
for cat in bpy.context.scene.matlib_categories:
	materials = []
	for mat in bpy.data.materials:
		if "category" in mat.keys() and mat['category'] == cat.name:
			materials.append(mat.name)
	cats.append([cat.name, materials])
with open("D:\Blender Foundation\Blender\2.78\scripts\addons\matlib\categories.txt", "w") as f: 
	f.write(json.dumps(cats, sort_keys=True, indent=4))