[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4030] contrib/py/scripts/addons/ online_mat_lib: Committing latest add-on version.

Peter Cassetta peter at fingertipsoft.com
Sun Dec 9 11:00:20 CET 2012


Revision: 4030
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4030
Author:   petercassetta
Date:     2012-12-09 10:00:18 +0000 (Sun, 09 Dec 2012)
Log Message:
-----------
Committing latest add-on version.

This version (0.5) includes support for image textures and OSL scripts.
Image texture, environment texture, and script nodes are now fully supported.

Modified Paths:
--------------
    contrib/py/scripts/addons/online_mat_lib/__init__.py
    contrib/py/scripts/addons/online_mat_lib/material-library/my-materials/read-me.txt

Modified: contrib/py/scripts/addons/online_mat_lib/__init__.py
===================================================================
--- contrib/py/scripts/addons/online_mat_lib/__init__.py	2012-12-06 02:00:57 UTC (rev 4029)
+++ contrib/py/scripts/addons/online_mat_lib/__init__.py	2012-12-09 10:00:18 UTC (rev 4030)
@@ -30,10 +30,10 @@
 bl_info = {
     "name": "Online Material Library",
     "author": "Peter Cassetta",
-    "version": (0, 4),
+    "version": (0, 5),
     "blender": (2, 6, 3),
     "location": "Properties > Material > Online Material Library",
-    "description": "Browse and download materials from a online CC0 library.",
+    "description": "Browse and download materials from online CC0 libraries.",
     "warning": "Beta version",
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Material/Online_Material_Library",
     "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=31802",
@@ -101,17 +101,26 @@
 material_fireflies = []
 material_speeds = []
 material_complexities = []
+material_scripts = []
+material_images = []
 
 material_file_contents = ""
 
 current_material_number = -1
 current_material_cached = False
 current_material_previewed = False
+material_detail_view = "RENDER"
 preview_message = []
 node_message = []
 save_filename = ""
+script_stack = []
+osl_scripts = []
 
 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_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_bcm_read = bpy.props.StringProperty(name = "Text Datablock", description = "Name of text datablock to read .bcm data from", default="bcm_file", options = {'SKIP_SAVE'})
@@ -155,7 +164,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.4", icon='SMOOTH')
+                        row.label(text="Online Material Library Add-on -- Version 0.5", icon='SMOOTH')
                         
                         row = layout.row()
                         rowcol = row.column(align=True)
@@ -249,6 +258,10 @@
                 
                 row = layout.row()
                 row.prop(bpy.context.scene, "mat_lib_auto_preview")
+                row = layout.row()
+                row.prop(bpy.context.scene, "mat_lib_osl_only_trusted")
+                row = layout.row()
+                row.prop(bpy.context.scene, "mat_lib_images_only_trusted")
                 
                 row = layout.row()
                 row.label(text="Cached data for active library:")
@@ -410,14 +423,14 @@
                     #Close button
                     inforow.operator("material.libraryviewmaterial", text="", icon='PANEL_CLOSE').material = -1
                     
-                    inforow = infobox.row()
+                    #inforow = infobox.row()
+                    inforowsplit = infobox.split(percentage=0.5)
                     
                     #Display a preview
                     if bpy.data.textures.find("mat_lib_preview_texture") == -1:
                         bpy.data.textures.new("mat_lib_preview_texture", "IMAGE")
                         preview_texture = bpy.data.textures["mat_lib_preview_texture"]
-                        inforowcol = inforow.column(align=True)
-                        inforowcol.alignment = 'EXPAND'
+                        inforowcol = inforowsplit.column()
                         
                         if material_contributors[current_material_number] != "Unknown" and material_contributors[current_material_number] != "Anonymous":
                             inforowcolrow = inforowcol.row()
@@ -429,8 +442,7 @@
                         inforowcolrow.template_preview(preview_texture)
                     else:
                         preview_texture = bpy.data.textures['mat_lib_preview_texture']
-                        inforowcol = inforow.column(align=True)
-                        inforowcol.alignment = 'EXPAND'
+                        inforowcol = inforowsplit.column()
                         if material_contributors[current_material_number] != "Unknown" and material_contributors[current_material_number] != "Anonymous":
                             inforowcolrow = inforowcol.row()
                             inforowcolrow.label(text="By %s." % material_contributors[current_material_number])
@@ -440,54 +452,87 @@
                         inforowcolrow = inforowcol.row()
                         inforowcolrow.template_preview(preview_texture)
                     
-                    inforowcol = inforow.column()
+                    inforowcol = inforowsplit.column()
                     inforowcolrow = inforowcol.row()
                     inforowcolcol = inforowcol.column(align=True)
                     inforowcolcol.alignment = 'EXPAND'
                     inforowcolcolrow = inforowcolcol.row()
+                    if material_detail_view == 'RENDER':
+                        if material_fireflies[current_material_number] == "high":
+                            inforowcolcolrow.label(text="Firefly Level: High")
+                            inforowcolcolrow.label(text="", icon='PARTICLES')
+                        elif material_fireflies[current_material_number] == "medium":
+                            inforowcolcolrow.label(text="Firefly Level: Medium")
+                            inforowcolcolrow.label(text="", icon='MOD_PARTICLES')
+                        else:
+                            inforowcolcolrow.label(text="Firefly Level: Low")
+                        inforowcolcolrow = inforowcolcol.row()
+                            
+                        if material_complexities[current_material_number] == "simple":
+                            inforowcolcolrow.label(text="Complexity: Simple")
+                        elif material_complexities[current_material_number] == "intermediate":
+                            inforowcolcolrow.label(text="Complexity: Intermediate")
+                        elif material_complexities[current_material_number] == "complex":
+                            inforowcolcolrow.label(text="Complexity: Complex")
+                        inforowcolcolrow = inforowcolcol.row()
+                        
+                        if material_speeds[current_material_number] == "slow":
+                            inforowcolcolrow.label(text="Render Speed: Slow")
+                            inforowcolcolrow.label(text="", icon='PREVIEW_RANGE')
+                        elif material_speeds[current_material_number] == "fair":
+                            inforowcolcolrow.label(text="Render Speed: Fair")
+                            inforowcolcolrow.label(text="", icon='TIME')
+                        else:
+                            inforowcolcolrow.label(text="Render Speed: Good")
+                        inforowcolcolrow = inforowcolcol.row()
+                        details = inforowcolcolrow.row(align=True)
+                        details.alignment = 'RIGHT'
+                        detailshidden = details.row()
+                        detailshidden.enabled = False
+                        detailshidden.operator("material.librarydetailview", text="", icon='PLAY_REVERSE').mode = "PREVIOUS"
+                        details.operator("material.librarydetailview", text="", icon='PLAY').mode = "NEXT"
+                    elif material_detail_view == "DATA":
+                        if material_scripts[current_material_number] == "0":
+                            inforowcolcolrow.label(text="OSL Scripts: 0")
+                        else:
+                            inforowcolcolrow.label(text="OSL Scripts: %s" % material_scripts[current_material_number])
+                            inforowcolcolrow.label(text="", icon='TEXT')
+                        inforowcolcolrow = inforowcolcol.row()
                     
-                    if material_fireflies[current_material_number] == "high":
-                        inforowcolcolrow.label(text="Firefly Level: High")
-                        inforowcolcolrow.label(text="", icon='PARTICLES')
-                    elif material_fireflies[current_material_number] == "medium":
-                        inforowcolcolrow.label(text="Firefly Level: Medium")
-                        inforowcolcolrow.label(text="", icon='MOD_PARTICLES')
-                    else:
-                        inforowcolcolrow.label(text="Firefly Level: Low")
-                    inforowcolcolrow = inforowcolcol.row()
-                    
-                    if material_speeds[current_material_number] == "slow":
-                        inforowcolcolrow.label(text="Render Speed: Slow")
-                        inforowcolcolrow.label(text="", icon='PREVIEW_RANGE')
-                    elif material_speeds[current_material_number] == "fair":
-                        inforowcolcolrow.label(text="Render Speed: Fair")

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list