Skip to content
Snippets Groups Projects
Commit c613fb19 authored by Alfonso's avatar Alfonso Committed by meta-androcto
Browse files

matlib vx fix add/remove from library

parent 0510a4d7
No related branches found
No related tags found
No related merge requests found
......@@ -785,7 +785,7 @@ class MatlibRemove(bpy.types.Operator):
def execute(self, context):
matlib = context.scene.matlib
success = matlib.remove_material(context.object.active_material)
success = matlib.remove_material()
if type(success).__name__ == "tuple":
print(success)
self.report({success[0]}, success[1])
......
import bpy
bpy.ops.wm.save_mainfile(filepath="D:\\Blender Foundation\\Blender\\2.73\\scripts\\addons\\matlib\\Otherlib.blend", check_existing=False, compress=True)
\ No newline at end of file
print(30*"+")
import bpy
if not hasattr(bpy.context.scene, "matlib_categories"):
class EmptyProps(bpy.types.PropertyGroup):
pass
bpy.utils.register_class(EmptyProps)
bpy.types.Scene.matlib_categories = bpy.props.CollectionProperty(type=EmptyProps)
cats = bpy.context.scene.matlib_categories
for cat in cats:
cats.remove(0)
cat = cats.add()
cat.name = "Colors"
cat = cats.add()
cat.name = "Nature"
cat = cats.add()
cat.name = "Woods"
bpy.ops.wm.save_mainfile(filepath="D:\\Blender Foundation\\Blender\\2.73\\scripts\\addons\\matlib\\Otherlib.blend", check_existing=False, compress=True)
\ No newline at end of file
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))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment