materials_library_vx/ initial update for 2.8

This commit is contained in:
Brendon Murphy 2019-04-04 20:01:06 +11:00
parent 81b8ca6cf3
commit 05c959bb20
4 changed files with 63 additions and 99 deletions

View File

@ -1,73 +0,0 @@
# #####BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# #####END GPL LICENSE BLOCK #####
bl_info = {
"name": "Material Library",
"author": "Mackraken (mackraken2023@hotmail.com)",
"version": (0, 5, 61),
"blender": (2, 7, 2),
"api": 60995,
"location": "Properties > Material",
"description": "Material Library VX",
"warning": "",
"wiki_url": "https://sites.google.com/site/aleonserra/home/scripts/matlib-vx",
"tracker_url": "",
"category": "System"}
MATLIB 5.6.1
Installation:
- AVOID USING THE INSTALL ADDON BUTTON
- Copy the matlib folder inside Blender's addons.
Example: D:\Blender\2.72\scripts\addon\
- Start Blender.
- Goto File->User Preferences->Addons
- Enable "Material Library"
Updates:
v 0.5.61
- Libraries aren't read on each draw call, only on startup or when added. This fixes potential crashes and is less stressful, but when a library is deleted blender should be restarted.
- Moved the addon from "System" category to "Materials"
v 0.5.6
- Create new libraries.
Libraries are read from the matlib folder. If you want to change this behaviour, edit the variable "matlib_path" at line 40. (Untested)
To delete a library delete the blend file within the matlib folder.
- Apply material to all selected objects.
- Apply material in edit mesh mode.
- Improved Material preview.
You can apply a material to the last selected object/s while you are previewing.
- Categories are saved within the library blend file.
- More warnings when things goes wrong.
- Options Added:
- Force Import. False By default.
This option helps to avoid material duplicates when the same material its applied several times.
When this option is disabled the script will try to find the selected material within the working scene, instead of importing a new one from the library.
- Linked.
Import the material by making a link to the library.
- Hide search.
Shows or hides the search box.

View File

@ -22,8 +22,7 @@ bl_info = {
"name": "Material Library",
"author": "Mackraken (mackraken2023@hotmail.com)",
"version": (0, 5, 8),
"blender": (2, 78, 0),
"api": 60995,
"blender": (2, 80, 0),
"location": "Properties > Material",
"description": "Material Library VX",
"warning": "",
@ -42,10 +41,11 @@ from bpy.props import (
)
from bpy.types import (
Panel, Menu, AddonPreferences, Operator,
PropertyGroup,
PropertyGroup, UIList,
Scene
)
from rna_prop_ui import PropertyPanel
dev = False
@ -727,9 +727,9 @@ bpy.ops.wm.save_mainfile(filepath="%s", check_existing=False, compress=True)'''
except:
me = bpy.data.meshes.new(dummy_mesh)
dummy = bpy.data.objects.new(dummy_name, me)
scn.objects.link(dummy)
context.collection.objects.link(dummy)
dummy.hide = True
dummy.hide_set(True)
dummy.hide_render = True
dummy.hide_select = True
return dummy
@ -1140,9 +1140,9 @@ class MATLIB_PT_vxPanel(Panel):
text = "Select a Library"
row.menu("MATLIB_MT_LibsMenu",text=text)
row.operator("matlib.operator", icon="ZOOMIN", text="").cmd = "LIBRARY_ADD"
row.operator("matlib.operator", icon="ADD", text="").cmd = "LIBRARY_ADD"
if matlib.active_material:
row.label(matlib.active_material.category)
row.label(text = matlib.active_material.category)
else:
row.label(text="")
#
@ -1158,12 +1158,12 @@ class MATLIB_PT_vxPanel(Panel):
row = layout.row()
#operators
col.operator("matlib.add", icon="ZOOMIN", text="")
col.operator("matlib.remove", icon="ZOOMOUT", text="")
col.operator("matlib.reload", icon="FILE_REFRESH", text="")
col.operator("matlib.apply", icon="MATERIAL", text="")
col.operator("matlib.preview", icon="COLOR", text="")
col.operator("matlib.flush", icon="GHOST_DISABLED", text="")
col.operator("matlib.operator", icon="ADD", text="").cmd="ADD"
col.operator("matlib.operator", icon="REMOVE", text="").cmd="REMOVE"
col.operator("matlib.operator", icon="FILE_REFRESH", text="").cmd="RELOAD"
col.operator("matlib.operator", icon="MATERIAL", text="").cmd="APPLY"
col.operator("matlib.operator", icon="COLOR", text="").cmd="PREVIEW"
col.operator("matlib.operator", icon="GHOST_DISABLED", text="").cmd="FLUSH"
col.prop(matlib, "show_prefs", icon="MODIFIER", text="")
#categories
@ -1173,8 +1173,8 @@ class MATLIB_PT_vxPanel(Panel):
row.menu("MATLIB_MT_CatsMenu",text=text)
row.prop(matlib, "filter", icon="FILTER", text="")
row.operator("matlib.operator", icon="FILE_PARENT", text="").cmd="FILTER_SET"
row.operator("matlib.operator", icon="ZOOMIN", text="").cmd="FILTER_ADD"
row.operator("matlib.operator", icon="ZOOMOUT", text="").cmd="FILTER_REMOVE"
row.operator("matlib.operator", icon="ADD", text="").cmd="FILTER_ADD"
row.operator("matlib.operator", icon="REMOVE", text="").cmd="FILTER_REMOVE"
#prefs
if matlib.show_prefs:
@ -1192,10 +1192,18 @@ class MATLIB_PT_vxPanel(Panel):
# row.label(matlib.current_library.name)
# else:
# row.label("Library not found!.")
#classes = [MATLIB_PT_vxPanel, MATLIB_OT_operator, MATLIB_MT_LibsMenu, MATLIB_MT_CatsMenu]
"""
classes = [
matlibMaterials,
matlibProperties,
EmptyGroup,
MATLIB_PT_vxPanel,
MATLIB_OT_operator,
MATLIB_MT_LibsMenu,
MATLIB_MT_CatsMenu
]
#print(bpy.context.scene)
"""
@persistent
def refresh_libs(dummy=None):
@ -1221,12 +1229,41 @@ class matlibvxPref(AddonPreferences):
layout = self.layout
layout.prop(self, "matlib_path")
classes = [
matlibMaterials,
EmptyGroup,
MATLIB_PT_vxPanel,
MATLIB_OT_operator,
MATLIB_MT_LibsMenu,
MATLIB_MT_CatsMenu,
matlibProperties,
]
"""
classes = [
matlibProperties,
EmptyGroup,
matlibMaterials,
Categories,
Library,
MATLIB_MT_LibsMenu,
MATLIB_MT_CatsMenu,
MATLIB_OT_add,
MATLIB_OT_remove,
MATLIB_OT_remove,
MATLIB_OT_apply,
MATLIB_OT_preview,
MATLIB_OT_flush,
MATLIB_OT_operator,
MATLIB_PT_vxPanel,
matlibvxPref
]
"""
def register():
global libraries
bpy.utils.register_module(__name__)
# for c in classes:
# bpy.utils.register_class(c)
#bpy.utils.register_module(__name__)
for c in classes:
bpy.utils.register_class(c)
Scene.matlib_categories = CollectionProperty(type=EmptyGroup)
Scene.matlib = PointerProperty(type = matlibProperties)
bpy.app.handlers.load_post.append(refresh_libs)
@ -1235,7 +1272,7 @@ def register():
def unregister():
global libraries
bpy.utils.unregister_module(__name__)
#bpy.utils.unregister_module(__name__)
try:
# raise ValueError list.remove(x): x not in list
del Scene.matlib_categories
@ -1244,8 +1281,8 @@ def unregister():
del Scene.matlib
libraries.clear()
bpy.app.handlers.load_post.remove(refresh_libs)
# for c in classes:
# bpy.utils.unregister_class(c)
for c in classes:
bpy.utils.unregister_class(c)
if __name__ == "__main__":

View File

@ -111,4 +111,4 @@
"Flaky Tangelo"
]
]
]
]