[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4261] contrib/py/scripts/addons/ online_mat_lib/__init__.py: Committing Online Material Library Add-on v0.6

Peter Cassetta peter at fingertipsoft.com
Tue Feb 12 02:31:56 CET 2013


Revision: 4261
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4261
Author:   petercassetta
Date:     2013-02-12 01:31:55 +0000 (Tue, 12 Feb 2013)
Log Message:
-----------
Committing Online Material Library Add-on v0.6

Here's the latest version of my Online Material Library add-on.
Version 0.6 brings numerous improvements, including nodegroup support and native Cycles preview support.
Libraries are now able to show not only its materials, but also the textures, OSL scripts, and nodegroups its materials use.

In addition, version 0.6 brings many bug fixes and drops support for Blender 2.63.

Due to the recent addition of the Cycles material preview, image previews will no longer be needed for the bundled library.

Modified Paths:
--------------
    contrib/py/scripts/addons/online_mat_lib/__init__.py

Modified: contrib/py/scripts/addons/online_mat_lib/__init__.py
===================================================================
--- contrib/py/scripts/addons/online_mat_lib/__init__.py	2013-02-11 06:45:22 UTC (rev 4260)
+++ contrib/py/scripts/addons/online_mat_lib/__init__.py	2013-02-12 01:31:55 UTC (rev 4261)
@@ -30,8 +30,8 @@
 bl_info = {
     "name": "Online Material Library",
     "author": "Peter Cassetta",
-    "version": (0, 5),
-    "blender": (2, 63, 0),
+    "version": (0, 6),
+    "blender": (2, 64, 0),
     "location": "Properties > Material > Online Material Library",
     "description": "Browse and download materials from online CC0 libraries.",
     "warning": "Beta version",
@@ -105,6 +105,7 @@
 category_materials = 0
 
 category_type = "none"
+category_special = "none"
 
 sub_category_contents = "None"
 sub_category_name = ""
@@ -120,8 +121,13 @@
 material_fireflies = []
 material_speeds = []
 material_complexities = []
+material_groups = []
 material_scripts = []
 material_images = []
+material_filesizes = []
+material_dimensions = []
+material_tileabilities = []
+material_lines = []
 
 material_file_contents = ""
 
@@ -133,28 +139,36 @@
 node_message = []
 save_filename = ""
 script_stack = []
+group_stack = []
 osl_scripts = []
+node_groups = []
 
 bpy.types.Scene.mat_lib_auto_preview = bpy.props.BoolProperty(name = "Auto-download previews", description = "Automatically download material previews in online mode", default = True, options = {'SKIP_SAVE'})
 bpy.types.Scene.mat_lib_show_osl_materials = bpy.props.BoolProperty(name = "Show OSL materials", description = "Enable to show materials with OSL shading scripts", default = False, options = {'SKIP_SAVE'})
 bpy.types.Scene.mat_lib_show_textured_materials = bpy.props.BoolProperty(name = "Show textured materials", description = "Enable to show materials with image textures", default = True, options = {'SKIP_SAVE'})
 bpy.types.Scene.mat_lib_osl_only_trusted = bpy.props.BoolProperty(name = "Use OSL scripts from trusted sources only", description = "Disable to allow downloading OSL scripts from anywhere on the web (Not recommended)", default = True, options = {'SKIP_SAVE'})
 bpy.types.Scene.mat_lib_images_only_trusted = bpy.props.BoolProperty(name = "Use image textures from trusted sources only", description = "Disable to allow downloading image textures from anywhere on the web (Not recommended)", default = True, options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_external_groups = bpy.props.BoolProperty(name = "Write nodegroups to separate files", description = "Enable to write nodegroups to separate .bcg files when saving materials to disk", default = False, options = {'SKIP_SAVE'})
 
+
+tools_enum_items = [("material", "Material Tools", "Material import-export tools"), ("nodegroup", "Nodegroup Tools", "Nodegroup import-export tools")]
+bpy.types.Scene.mat_lib_tools_view = bpy.props.EnumProperty(items = tools_enum_items, name = "View", description = "Change tools view")
+
 bpy.types.Scene.mat_lib_bcm_write = bpy.props.StringProperty(name = "Text Datablock", description = "Name of text datablock to write .bcm data to", default="bcm_file", options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_bcg_write = bpy.props.StringProperty(name = "Text Datablock", description = "Name of text datablock to write .bcg data to", default="bcg_file", options = {'SKIP_SAVE'})
 bpy.types.Scene.mat_lib_bcm_read = bpy.props.StringProperty(name = "Text Datablock", description = "Name of text datablock to read .bcm data from", default="bcm_file", options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_bcg_read = bpy.props.StringProperty(name = "Text Datablock", description = "Name of text datablock to read .bcg data from", default="bcg_file", options = {'SKIP_SAVE'})
 bpy.types.Scene.mat_lib_bcm_name = bpy.props.StringProperty(name = "Material Name", description = "Specify a name for the new material", default="Untitled", options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_bcg_name = bpy.props.StringProperty(name = "Nodegroup Name", description = "Specify a name for the new nodegroup", default="Untitled", options = {'SKIP_SAVE'})
 
 bpy.types.Scene.mat_lib_bcm_save_location = bpy.props.StringProperty(name = "Save location", description = "Directory to save .bcm files in", default=mat_lib_folder + os.sep + "my-materials" + os.sep, options = {'SKIP_SAVE'}, subtype="DIR_PATH")
+bpy.types.Scene.mat_lib_bcg_save_location = bpy.props.StringProperty(name = "Save location", description = "Directory to save .bcg files in", default=mat_lib_folder + os.sep + "my-materials" + os.sep, options = {'SKIP_SAVE'}, subtype="DIR_PATH")
 bpy.types.Scene.mat_lib_bcm_open_location = bpy.props.StringProperty(name = "Open location", description = "Location of .bcm file to open", default=mat_lib_folder + os.sep + "my-materials" + os.sep + "untitled.bcm", options = {'SKIP_SAVE'})
+bpy.types.Scene.mat_lib_bcg_open_location = bpy.props.StringProperty(name = "Open location", description = "Location of .bcg file to open", default=mat_lib_folder + os.sep + "my-materials" + os.sep + "untitled.bcg", options = {'SKIP_SAVE'})
 
-category_enum_items = [("None0", "None", "No category selected")]
-bpy.types.Scene.mat_lib_material_category = bpy.props.EnumProperty(name = "", items = category_enum_items, description = "Choose a category", options = {'SKIP_SAVE'})
-prev_category = "None0"
+#subcategory_enum_items = [("None0", "None", "No Subcategory Selected")]
+#bpy.types.Scene.mat_lib_material_subcategory = bpy.props.EnumProperty(name = "", items = subcategory_enum_items, description = "Choose a subcategory", options = {'SKIP_SAVE'})
 
-subcategory_enum_items = [("None0", "None", "No Subcategory Selected")]
-bpy.types.Scene.mat_lib_material_subcategory = bpy.props.EnumProperty(name = "", items = subcategory_enum_items, description = "Choose a subcategory", options = {'SKIP_SAVE'})
-
 class OnlineMaterialLibraryPanel(bpy.types.Panel):
     """Creates a Panel in the Object properties window"""
     bl_label = "Online Material Library"
@@ -168,6 +182,8 @@
         global show_success_message_timeout
         global current_material_number
         global mat_lib_contents
+        global prev_show_osl
+        global prev_show_textured
         global prev_category
         global save_filename
         
@@ -183,7 +199,7 @@
                         row.label(text="ERROR: Could not find installation path!", icon='ERROR')
                     else:
                         #Material Library Contents variable is empty -- show welcome message
-                        row.label(text="Online Material Library Add-on -- Version 0.5", icon='SMOOTH')
+                        row.label(text="Online Material Library Add-on -- Version 0.6", icon='SMOOTH')
                         
                         row = layout.row()
                         rowcol = row.column(align=True)
@@ -222,11 +238,6 @@
                     if "testing" not in context.scene.mat_lib_library:
                         rowcolrow.operator("material.libraryconnect", text="Work Offline", icon='DISK_DRIVE').mode = "offline"
             
-            #Here we check if the user has changed the category, if so, update.
-            if prev_category != bpy.context.scene.mat_lib_material_category:
-                prev_category = bpy.context.scene.mat_lib_material_category
-                libraryCategoryUpdate()
-            
             if category_type == "none":
                 #Not browsing category
                 if working_mode is not "none":
@@ -264,23 +275,46 @@
                 row.operator("material.libraryhome", text="", icon='LOOP_BACK')
                 
                 row = layout.row()
-                row.operator("wm.url_open", text="All materials are CC0 - learn more.", emboss=False).url = "http://creativecommons.org/publicdomain/zero/1.0/"
+                row.operator("wm.url_open", text="All materials are CC0 - learn more.", icon='TRIA_RIGHT', emboss=False).url = "http://creativecommons.org/publicdomain/zero/1.0/"
                 
                 row = layout.row()
-                row.operator("wm.url_open", text="Material previews generated with B.M.P.S.", emboss=False).url = "https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests/rendering/cycles/blend_files/bmps.blend"
-                row = layout.row()
-                row.operator("wm.url_open", text="B.M.P.S. created by Robin \"tuqueque\" Marín", emboss=False).url = "http://blenderartists.org/forum/showthread.php?151903-b.m.p.s.-1.5!"
+                row.operator("wm.url_open", text="Stay up-to-date on this add-on's development!", icon='TRIA_RIGHT', emboss=False).url = "http://blenderartists.org/forum/showthread.php?256334"
+                
+                if int(bpy.app.build_revision.decode()) < 54153:
+                    row = layout.row()
+                    row.operator("wm.url_open", text="Material previews generated with B.M.P.S.", icon='TRIA_RIGHT', emboss=False).url = "https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests/rendering/cycles/blend_files/bmps.blend"
+                    row = layout.row()
+                    row.operator("wm.url_open", text="B.M.P.S. created by Robin \"tuqueque\" Marín", icon='TRIA_RIGHT', emboss=False).url = "http://blenderartists.org/forum/showthread.php?151903-b.m.p.s.-1.5!"
             
             elif category_type == "settings":
-                row.label(text="Library Settings", icon='SETTINGS')
+                row.label(text="Add-on Settings", icon='SETTINGS')
                 row.operator("material.libraryhome", text="", icon='LOOP_BACK')
                 
                 row = layout.row()
-                row.prop(bpy.context.scene, "mat_lib_auto_preview")
+                row.label(text="Browsing settings")
                 row = layout.row()
-                row.prop(bpy.context.scene, "mat_lib_osl_only_trusted")
+                box = row.box()
+                boxrow = box.row()
+                boxrow.prop(bpy.context.scene, "mat_lib_auto_preview")
+                boxrow = box.row()
+                boxrow.prop(bpy.context.scene, "mat_lib_show_osl_materials")
+                boxrow = box.row()
+                boxrow.prop(bpy.context.scene, "mat_lib_show_textured_materials")
+                
                 row = layout.row()

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list