[Bf-extensions-cvs] [6e152a8] master: Upgrade to Amaranth 0.8.2 - List Missing Images - List Missing Node Groups - Dupli Groups UI: Display Library Path - VSE: Display Image File Name on header - Several UI tweaks and fixes.
Pablo Vazquez
noreply at git.blender.org
Sun Mar 9 06:13:53 CET 2014
Commit: 6e152a80efbee93a168589e4541b450e436313d9
Author: Pablo Vazquez
Date: Sun Mar 9 02:11:55 2014 -0300
https://developer.blender.org/rBAC6e152a80efbee93a168589e4541b450e436313d9
Upgrade to Amaranth 0.8.2
- List Missing Images
- List Missing Node Groups
- Dupli Groups UI: Display Library Path
- VSE: Display Image File Name on header
- Several UI tweaks and fixes.
Full changelog at: http://pablovazquez.org/amaranth
===================================================================
M scene_amaranth_toolset.py
===================================================================
diff --git a/scene_amaranth_toolset.py b/scene_amaranth_toolset.py
index 55c52c1..6e7a679 100755
--- a/scene_amaranth_toolset.py
+++ b/scene_amaranth_toolset.py
@@ -19,7 +19,7 @@
bl_info = {
"name": "Amaranth Toolset",
"author": "Pablo Vazquez, Bassam Kurdali, Sergey Sharybin",
- "version": (0, 8, 1),
+ "version": (0, 8, 2),
"blender": (2, 70),
"location": "Everywhere!",
"description": "A collection of tools and settings to improve productivity",
@@ -189,8 +189,6 @@ def init_properties():
name="List Missing Images",
description="Display a list of all the missing images")
- global materials
-
def clear_properties():
props = (
@@ -1197,6 +1195,8 @@ class SCENE_OT_cycles_shader_list_nodes(Operator):
"""List Cycles materials containing a specific shader"""
bl_idname = "scene.cycles_list_nodes"
bl_label = "List Materials"
+ count_ma = 0
+ materials = []
@classmethod
def poll(cls, context):
@@ -1204,10 +1204,11 @@ class SCENE_OT_cycles_shader_list_nodes(Operator):
def execute(self, context):
node_type = context.scene.amaranth_cycles_node_types
- count_ma = 0
roughness = False
- materials = []
- global materials
+
+ # Reset the list and counter
+ self.__class__.materials = []
+ self.__class__.count_ma = 0
print("\n=== Cycles Shader Type: %s === \n" % node_type)
@@ -1228,32 +1229,33 @@ class SCENE_OT_cycles_shader_list_nodes(Operator):
'not connected',
'\n')
- materials = list(set(materials))
-
- count_ma = len(materials)
+ self.__class__.materials = list(set(self.__class__.materials))
+ self.__class__.count_ma += 1
- if ma.name not in materials:
- materials.append('%s%s [%s] %s%s' % (
+ if ma.name not in self.__class__.materials:
+ self.__class__.materials.append('%s%s [%s] %s%s' % (
'[L] ' if ma.library else '',
ma.name, ma.users,
'[F]' if ma.use_fake_user else '',
' - [%s]' % roughness if roughness else ''))
- if count_ma == 0:
- print("* No materials with nodes type %s found" % node_type)
+ if self.__class__.count_ma == 0:
+ self.report({"INFO"}, "No materials with nodes type %s found" % node_type)
else:
- print("* A total of %s materials using %s was found \n" % (
- count_ma + 1, node_type))
+ print("* A total of %s %s using %s was found \n" % (
+ self.__class__.count_ma,
+ "material" if self.__class__.count_ma == 1 else "materials",
+ node_type))
count = 0
- for mat in materials:
- print('%02d. %s' % (count + 1, materials[count]))
- count = count + 1
+ for mat in self.__class__.materials:
+ print('%02d. %s' % (count + 1, self.__class__.materials[count]))
+ count += 1
print("\n")
- materials = list(set(materials))
+ self.__class__.materials = list(set(self.__class__.materials))
return {'FINISHED'}
@@ -1263,7 +1265,9 @@ class SCENE_OT_cycles_shader_list_nodes_clear(Operator):
bl_label = "Clear Materials List"
def execute(self, context):
- materials[:] = []
+ SCENE_OT_cycles_shader_list_nodes.materials[:] = []
+ SCENE_OT_cycles_shader_list_nodes.count_ma = 0
+ print("* Cleared Cycles Materials List")
return {'FINISHED'}
class SCENE_OT_amaranth_debug_lamp_select(Operator):
@@ -1280,8 +1284,59 @@ class SCENE_OT_amaranth_debug_lamp_select(Operator):
lamp.select = True
context.scene.objects.active = lamp
- return{'FINISHED'}
+ return{'FINISHED'}
+class SCENE_OT_list_missing_node_tree(Operator):
+ '''Print a list of missing (link lost) node groups'''
+ bl_idname = "scene.list_missing_node_tree"
+ bl_label = "List Missing Node Groups"
+
+ count = 0
+
+ def execute(self, context):
+ missing = []
+ libraries = []
+ self.__class__.count = 0
+
+ print("\n* Missing Node Groups\n")
+ for ma in bpy.data.materials:
+ if ma.node_tree:
+ for no in ma.node_tree.nodes:
+ if no.type == 'GROUP':
+ if not no.node_tree:
+ self.__class__.count += 1
+
+ missing.append("%02d. %s%s%s [%s]%s" % (
+ self.__class__.count,
+ "[L] " if ma.library else "",
+ "[F] " if ma.use_fake_user else "",
+ ma.name, ma.users,
+ "\n %s" %
+ ma.library.filepath if ma.library else ""))
+
+ if ma.library:
+ libraries.append(ma.library.filepath)
+
+ # Remove duplicates and sort
+ missing = list(set(missing))
+ missing = sorted(missing)
+ libraries = list(set(libraries))
+
+ for mi in missing:
+ print(mi)
+
+ if missing:
+ self.report({"INFO"}, "%d missing node %s found! Check console" %
+ (self.__class__.count, "group" if self.__class__.count == 1 else "groups"))
+ if libraries:
+ print("\nThat's bad, run this check on %s:" % (
+ "this library" if len(libraries) == 1 else "these libraries"))
+ for li in libraries:
+ print(li)
+ print("\n")
+ else:
+ self.report({"INFO"}, "Yay! No missing node groups")
+ return{'FINISHED'}
class SCENE_PT_scene_debug(Panel):
'''Scene Debug'''
@@ -1300,33 +1355,10 @@ class SCENE_PT_scene_debug(Panel):
images_missing = []
list_lamps = scene.amaranth_debug_scene_list_lamps
list_missing_images = scene.amaranth_debug_scene_list_missing_images
+ materials = SCENE_OT_cycles_shader_list_nodes.materials
+ materials_count = SCENE_OT_cycles_shader_list_nodes.count_ma
engine = scene.render.engine
- if engine == 'CYCLES':
-
- layout.label(text="List Cycles Materials:")
-
- split = layout.split(percentage=0.5)
- split.prop(scene, 'amaranth_cycles_node_types')
-
- row = split.row(align=True)
- row.operator(SCENE_OT_cycles_shader_list_nodes.bl_idname,
- icon="SORTALPHA")
- row.operator(SCENE_OT_cycles_shader_list_nodes_clear.bl_idname,
- icon="X", text="")
-
- try:
- materials
- except NameError:
- layout.label(text="No materials to show", icon="INFO")
- else:
- count = 0
- layout.label(text="%s %s found" % (len(materials),
- 'material' if len(materials) < 2 else 'materials'), icon="INFO")
- for mat in materials:
- count = count + 1
- layout.label(text='%s' % (materials[count-1]), icon="MATERIAL")
-
# List Lamps
box = layout.box()
row = box.row(align=True)
@@ -1441,6 +1473,11 @@ class SCENE_PT_scene_debug(Panel):
col.label(text="No Lamps", icon="LAMP_DATA")
# List Missing Images
+ box = layout.box()
+ row = box.row(align=True)
+ split = row.split()
+ col = split.column()
+
if images:
import os.path
@@ -1453,11 +1490,6 @@ class SCENE_PT_scene_debug(Panel):
' [F]' if im.use_fake_user else ''),
im.filepath if im.filepath else 'No Filepath'])
- box = layout.box()
- row = box.row(align=True)
- split = row.split()
- col = split.column()
-
if images_missing:
row = col.row(align=True)
row.alignment = 'LEFT'
@@ -1492,9 +1524,62 @@ class SCENE_PT_scene_debug(Panel):
str(len(images)),
'image' if len(images) == 1 else 'images'),
icon="IMAGE_DATA")
+ else:
+ row = col.row(align=True)
+ row.alignment = 'LEFT'
+ row.label(text="No images loaded yet", icon="RIGHTARROW_THIN")
+
+ # List Cycles Materials by Shader
+ if engine == 'CYCLES':
+ box = layout.box()
+ split = box.split()
+ col = split.column(align=True)
+ col.prop(scene, 'amaranth_cycles_node_types',
+ icon="MATERIAL")
+
+ row = split.row(align=True)
+ row.operator(SCENE_OT_cycles_shader_list_nodes.bl_idname,
+ icon="SORTSIZE",
+ text="List Materials Using Shader")
+ if materials_count != 0:
+ row.operator(SCENE_OT_cycles_shader_list_nodes_clear.bl_idname,
+ icon="X", text="")
+ col.separator()
+
+ try:
+ materials
+ except NameError:
+ pass
+ else:
+ if materials_count != 0:
+ count = 0
+ col.label(text="%s %s found" % (materials_count,
+ 'material' if materials_count == 1 else 'materials'), icon="INFO")
+ for mat in materials:
+ count += 1
+ col.label(text='%s' % (materials[count-1]), icon="MATERIAL")
+
+ # List Missing Node Trees
+ split = layout.split()
+ split.label(tex
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list