[Bf-extensions-cvs] [f801871] master: Update Group API, clean up. T37908
meta-androcto
noreply at git.blender.org
Tue Dec 29 01:09:18 CET 2015
Commit: f801871441f6fc4daabb1098ac5e9c6db0521f90
Author: meta-androcto
Date: Tue Dec 29 11:08:57 2015 +1100
Branches: master
https://developer.blender.org/rBACf801871441f6fc4daabb1098ac5e9c6db0521f90
Update Group API, clean up. T37908
===================================================================
M online_mat_lib/__init__.py
===================================================================
diff --git a/online_mat_lib/__init__.py b/online_mat_lib/__init__.py
index 75ca48c..c78ec08 100644
--- a/online_mat_lib/__init__.py
+++ b/online_mat_lib/__init__.py
@@ -30,7 +30,7 @@
bl_info = {
"name": "Online Material Library",
"author": "Peter Cassetta",
- "version": (0, 6, 1),
+ "version": (0, 7),
"blender": (2, 74, 5),
"location": "Properties > Material > Online Material Library",
"description": "Browse and download materials from online CC0 libraries.",
@@ -116,7 +116,15 @@ node_types = {
'MATERIAL_EXT': 'ShaderNodeExtendedMaterial',
'TEX_MUSGRAVE': 'ShaderNodeTexMusgrave',
'NORMAL_MAP': 'ShaderNodeNormalMap',
- 'RGBTOBW': 'ShaderNodeRGBToBW'},
+ 'RGBTOBW': 'ShaderNodeRGBToBW',
+ 'FRAME': 'NodeFrame',
+ 'REROUTE': 'NodeReroute',
+ 'VOLUME_ABSORPTION': 'ShaderNodeVolumeAbsorption',
+ 'VOLUME_SCATTER': 'ShaderNodeVolumeScatter',
+ 'UVMAP': 'ShaderNodeUVMap',
+ 'TEX_POINTDENSITY': 'ShaderNodeTexPointDensity',
+ 'SEPXYZ': 'ShaderNodeSeparateXYZ',
+ 'COMBXYZ': 'ShaderNodeCombineXYZ',},
'COMPOSITING': {
'KEYING': 'CompositorNodeKeying',
'TRANSFORM': 'CompositorNodeTransform',
@@ -244,6 +252,11 @@ import os.path
import http.client
import xml.dom.minidom
+debug = False
+def debugout(*args):
+ # only use print for info the user may need to see
+ if debug: print(*args)
+
library = ""
library_data = []
update_data = ["Up-to-date.", ""]
@@ -266,7 +279,7 @@ def findLibrary():
matlibpath = os.path.join(p, "addons_contrib", "online_mat_lib", "material-library")
if os.path.exists(matlibpath):
break
- return matlibpath
+ return matlibpath
findLibrary()
@@ -307,6 +320,7 @@ material_tileabilities = []
material_lines = []
material_file_contents = ""
+xml_header_string = '<?xml version="1.0" encoding="UTF-8"?>'
current_material_number = -1
current_material_cached = False
@@ -317,6 +331,7 @@ node_message = []
save_filename = ""
script_stack = []
group_stack = []
+group_translations = {}
curve_stack = []
group_curve_stack = []
group_script_stack = []
@@ -349,9 +364,48 @@ bpy.types.Scene.mat_lib_bcg_save_location = bpy.props.StringProperty(name = "Sav
bpy.types.Scene.mat_lib_bcm_open_location = bpy.props.StringProperty(name = "Open location", description = "Location of .bcm file to open", default=matlibpath + 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=matlibpath + os.sep + "my-materials" + os.sep + "untitled.bcg", options = {'SKIP_SAVE'})
+category_enum_items = [("None0", "None", "No category selected")]
+
#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'})
+def filenameClean(string):
+ string = string.replace("(", "")
+ string = string.replace(")", "")
+ string = string.replace("!", "")
+ string = string.replace("@", "")
+ string = string.replace("#", "")
+ string = string.replace("$", "")
+ string = string.replace("%", "")
+ string = string.replace("&", "")
+ string = string.replace("*", "")
+ string = string.replace("/", "")
+ string = string.replace("|", "")
+ string = string.replace("\\", "")
+ string = string.replace("'", "")
+ string = string.replace("\"", "")
+ string = string.replace("?", "")
+ string = string.replace(";", "")
+ string = string.replace(":", "")
+ string = string.replace("[", "")
+ string = string.replace("]", "")
+ string = string.replace("{", "")
+ string = string.replace("}", "")
+ string = string.replace("`", "")
+ string = string.replace("~", "")
+ string = string.replace("+", "")
+ string = string.replace("=", "")
+ string = string.replace(".", "")
+ string = string.replace(",", "")
+ string = string.replace("<", "")
+ string = string.replace(">", "")
+ string = string.replace(" ", "_")
+ string = string.replace("-", "_")
+ return string
+
+def filenameCleanLower(string):
+ return filenameClean(string).lower()
+
class OnlineMaterialLibraryPanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Online Material Library"
@@ -359,7 +413,7 @@ class OnlineMaterialLibraryPanel(bpy.types.Panel):
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "material"
-
+
def draw(self, context):
global show_success_message
global show_success_message_timeout
@@ -369,13 +423,13 @@ class OnlineMaterialLibraryPanel(bpy.types.Panel):
global prev_show_textured
global prev_category
global save_filename
-
+
layout = self.layout
-
+
if context.scene.render.engine == "CYCLES":
#Cycles is enabled!
row = layout.row()
-
+
if category_type is not "info" and category_type is not "settings" and category_type is not "tools":
if mat_lib_contents == "" or mat_lib_contents == "Please refresh.":
if matlibpath == "error":
@@ -383,19 +437,19 @@ class OnlineMaterialLibraryPanel(bpy.types.Panel):
else:
#Material Library Contents variable is empty -- show welcome message
row.label(text="Online Material Library Add-on -- Version 0.6", icon='SMOOTH')
-
+
row = layout.row()
rowcol = row.column(align=True)
rowcol.alignment = 'EXPAND'
rowcol.prop(context.scene, "mat_lib_library", text="")
-
+
rowcolrow = rowcol.row(align=True)
rowcolrow.alignment = 'EXPAND'
if "bundled" not in context.scene.mat_lib_library:
rowcolrow.operator("material.libraryconnect", text="Connect", icon='WORLD').mode = "online"
if "testing" not in context.scene.mat_lib_library:
rowcolrow.operator("material.libraryconnect", text="Work Offline", icon='DISK_DRIVE').mode = "offline"
-
+
elif working_mode is not "none":
#We have a valid material library
row = layout.row(align=True)
@@ -408,27 +462,27 @@ class OnlineMaterialLibraryPanel(bpy.types.Panel):
row.label(text=str(mat_lib_contents))
row = layout.row()
row.label(text="..." + str(mat_lib_contents)[-50:])
-
+
row = layout.row()
rowcol = row.column(align=True)
rowcol.alignment = 'EXPAND'
rowcol.prop(context.scene, "mat_lib_library", text="")
-
+
rowcolrow = rowcol.row(align=True)
rowcolrow.alignment = 'EXPAND'
if "bundled" not in context.scene.mat_lib_library:
rowcolrow.operator("material.libraryconnect", text="Attempt Reconnect", icon='WORLD').mode = "online"
if "testing" not in context.scene.mat_lib_library:
rowcolrow.operator("material.libraryconnect", text="Work Offline", icon='DISK_DRIVE').mode = "offline"
-
+
if category_type == "none":
#Not browsing category
if working_mode is not "none":
row = layout.row()
rowcol = row.column(align=True)
rowcol.alignment = 'EXPAND'
- rowcol.prop(context.scene, "mat_lib_library", text="")
-
+ rowcol.prop(context.scene, "mat_lib_library", text="Bundled")
+
rowcolrow = rowcol.row(align=True)
rowcolrow.alignment = 'EXPAND'
if "bundled" not in context.scene.mat_lib_library:
@@ -441,38 +495,32 @@ class OnlineMaterialLibraryPanel(bpy.types.Panel):
rowcolrow.operator("material.libraryconnect", text="Reload Library", icon='DISK_DRIVE').mode = "offline"
else:
rowcolrow.operator("material.libraryconnect", text="Work Offline", icon='DISK_DRIVE').mode = "offline"
-
+
row = layout.row(align=True)
row.alignment = 'EXPAND'
row.operator("material.libraryinfo", text="Info", icon='INFO')
row.operator("material.librarytools", text="Tools", icon='MODIFIER')
row.operator("material.librarysettings", text="Settings", icon='SETTINGS')
-
+
if "Up-to-date." not in update_data[0]:
row = layout.row()
row.label(text=update_data[0])
row.operator("wm.url_open", text="Get latest version", icon='WORLD').url = update_data[1]
-
+
elif category_type == "info":
row.label(text="Add-on Info", icon='INFO')
row.operator("material.libraryhome", text="", icon='LOOP_BACK')
-
+
row = layout.row()
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="Stay up-to-date on this add-on's development!", icon='TRIA_RIGHT', emboss=False).url = "http://blenderartists.org/forum/showthread.php?256334"
-
- if bpy.app.version[0] + (bpy.app.version[1] / 100.0) < 2.66:
- row = layout.
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list