Newer
Older
bm.select_flush_mode()
bmesh.update_edit_mesh(object.data)
return {'FINISHED'}
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
"""
Make symmetric
"""
bl_idname = "mesh.make_symmetric"
bl_label = "Make Symmetric"
bl_options = {'UNDO', 'REGISTER'}
@classmethod
def poll(cls, context):
object = context.object
if object:
return object.mode == 'EDIT' and object.type == 'MESH'
return False
def execute(self, context):
threshold = 1e-6
object = context.object
bm = bmesh.from_edit_mesh(object.data)
for v1 in bm.verts:
if v1.co[0] < threshold:
continue
if not v1.select:
continue
closest_vert = None
closest_distance = -1
for v2 in bm.verts:
if v1 == v2:
continue
if v2.co[0] > threshold:
continue
if not v2.select:
continue
mirror_coord = Vector(v2.co)
mirror_coord[0] *= -1
distance = (mirror_coord - v1.co).length_squared
if closest_vert is None or distance < closest_distance:
closest_distance = distance
closest_vert = v2
if closest_vert:
closest_vert.select = False
closest_vert.co = Vector(v1.co)
closest_vert.co[0] *= -1
v1.select = False
for v1 in bm.verts:
if v1.select:
closest_vert = None
closest_distance = -1
for v2 in bm.verts:
if v1 != v2:
mirror_coord = Vector(v2.co)
mirror_coord[0] *= -1
distance = (mirror_coord - v1.co).length_squared
if closest_vert is None or distance < closest_distance:
closest_distance = distance
closest_vert = v2
if closest_vert:
v1.select = False
v1.co = Vector(closest_vert.co)
v1.co[0] *= -1
bm.select_flush_mode()
bmesh.update_edit_mesh(object.data)
return {'FINISHED'}
# // FEATURE: Mesh Symmetry Tools by Sergey Sharybin
def render_cycles_scene_samples(self, context):
layout = self.layout
scenes = bpy.data.scenes
scene = context.scene
cscene = scene.cycles
render = scene.render
list_sampling = scene.amaranth_cycles_list_sampling
if cscene.progressive == 'BRANCHED_PATH':
layout.separator()
split = layout.split()
col = split.column()
col.operator(
AMTH_RENDER_OT_cycles_samples_percentage_set.bl_idname,
text="%s" % 'Set as Render Samples' if cscene.use_samples_final else 'Set New Render Samples',
icon="%s" % 'PINNED' if cscene.use_samples_final else 'UNPINNED')
col = split.column()
row = col.row(align=True)
row.enabled = True if scene.get('amth_cycles_samples_final') else False
row.operator(
AMTH_RENDER_OT_cycles_samples_percentage.bl_idname,
text="100%").percent=100
row.operator(
AMTH_RENDER_OT_cycles_samples_percentage.bl_idname,
text="75%").percent=75
row.operator(
AMTH_RENDER_OT_cycles_samples_percentage.bl_idname,
text="50%").percent=50
row.operator(
AMTH_RENDER_OT_cycles_samples_percentage.bl_idname,
text="25%").percent=25
# List Lamps
if (len(scene.render.layers) > 1) or \
(len(bpy.data.scenes) > 1):
box = layout.box()
row = box.row(align=True)
col = row.column(align=True)
row.alignment = 'LEFT'
row.prop(scene, 'amaranth_cycles_list_sampling',
icon="%s" % 'TRIA_DOWN' if list_sampling else 'TRIA_RIGHT',
emboss=False)
if list_sampling:
if len(scene.render.layers) == 1 and \
render.layers[0].samples == 0:
pass
else:
col.separator()
col.label(text="RenderLayers:", icon='RENDERLAYERS')
for rl in scene.render.layers:
row = col.row(align=True)
row.label(rl.name, icon='BLANK1')
row.prop(rl, "samples", text="%s" %
"Samples" if rl.samples > 0 else "Automatic (%s)" % (
cscene.aa_samples if cscene.progressive == 'BRANCHED_PATH' else cscene.samples))
if (len(bpy.data.scenes) > 1):
col.separator()
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
col.label(text="Scenes:", icon='SCENE_DATA')
row = col.row(align=True)
if cscene.progressive == 'PATH':
for s in bpy.data.scenes:
if s != scene:
row = col.row(align=True)
if s.render.engine == 'CYCLES':
cscene = s.cycles
row.label(s.name)
row.prop(cscene, "samples", icon='BLANK1')
else:
row.label(text="Scene: '%s' is not using Cycles" % s.name)
else:
for s in bpy.data.scenes:
if s != scene:
row = col.row(align=True)
if s.render.engine == 'CYCLES':
cscene = s.cycles
row.label(s.name, icon='BLANK1')
row.prop(cscene, "aa_samples",
text="AA Samples")
else:
row.label(text="Scene: '%s' is not using Cycles" % s.name)
CoDEmanX
committed
"""Clear motion paths from all bones"""
bl_idname = "pose.paths_clear_all"
bl_label = "Clear All Motion Paths"
bl_options = {'UNDO'}
CoDEmanX
committed
@classmethod
def poll(cls, context):
return context.mode == 'POSE'
def execute(self, context):
#silly but works
for b in context.object.data.bones:
b.select = True
bpy.ops.pose.paths_clear()
b.select = False
return {'FINISHED'}
"""Match Start/End frame of scene to motion path range"""
bl_idname = "pose.paths_frame_match"
bl_label = "Match Frame Range"
bl_options = {'UNDO'}
def execute(self, context):
avs = context.object.pose.animation_visualization
scene = context.scene
if avs.motion_path.type == 'RANGE':
if scene.use_preview_range:
avs.motion_path.frame_start = scene.frame_preview_start
avs.motion_path.frame_end = scene.frame_preview_end
else:
avs.motion_path.frame_start = scene.frame_start
avs.motion_path.frame_end = scene.frame_end
CoDEmanX
committed
if scene.use_preview_range:
avs.motion_path.frame_before = scene.frame_preview_start
avs.motion_path.frame_after = scene.frame_preview_end
else:
avs.motion_path.frame_before = scene.frame_start
avs.motion_path.frame_after = scene.frame_end
CoDEmanX
committed
return {'FINISHED'}
def pose_motion_paths_ui(self, context):
CoDEmanX
committed
layout = self.layout
scene = context.scene
avs = context.object.pose.animation_visualization
if context.active_pose_bone:
mpath = context.active_pose_bone.motion_path
layout.separator()
layout.label(text="Motion Paths Extras:")
CoDEmanX
committed
split = layout.split()
col = split.column(align=True)
if context.selected_pose_bones:
if mpath:
sub = col.row(align=True)
sub.operator("pose.paths_update", text="Update Path", icon='BONE_DATA')
sub.operator("pose.paths_clear", text="", icon='X')
else:
col.operator("pose.paths_calculate", text="Calculate Path", icon='BONE_DATA')
else:
col.label(text="Select Bones First", icon="ERROR")
col = split.column(align=True)
col.operator(AMTH_POSE_OT_paths_frame_match.bl_idname,
text="{}".format( "Set Preview Frame Range"
if scene.use_preview_range else "Set Frame Range"),
icon="{}".format("PREVIEW_RANGE"
if scene.use_preview_range else "TIME"))
col = layout.column()
row = col.row(align=True)
if avs.motion_path.type == 'RANGE':
row.prop(avs.motion_path, "frame_start", text="Start")
row.prop(avs.motion_path, "frame_end", text="End")
else:
row.prop(avs.motion_path, "frame_before", text="Before")
row.prop(avs.motion_path, "frame_after", text="After")
layout.separator()
layout.operator(AMTH_POSE_OT_paths_clear_all.bl_idname, icon="X")
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
# // FEATURE: Motion Paths Extras
# FEATURE: Final Render Resolution Display
def render_final_resolution_ui(self, context):
rd = context.scene.render
layout = self.layout
final_res_x = (rd.resolution_x * rd.resolution_percentage) / 100
final_res_y = (rd.resolution_y * rd.resolution_percentage) / 100
if rd.use_border:
final_res_x_border = round((final_res_x * (rd.border_max_x - rd.border_min_x)))
final_res_y_border = round((final_res_y * (rd.border_max_y - rd.border_min_y)))
layout.label(text="Final Resolution: {} x {} [Border: {} x {}]".format(
str(final_res_x)[:-2], str(final_res_y)[:-2],
str(final_res_x_border), str(final_res_y_border)))
else:
layout.label(text="Final Resolution: {} x {}".format(
str(final_res_x)[:-2], str(final_res_y)[:-2]))
# // FEATURE: Final Render Resolution Display
# FEATURE: Shader Nodes Extra Info
def node_shader_extra(self, context):
if context.space_data.tree_type == 'ShaderNodeTree':
ob = context.active_object
snode = context.space_data
layout = self.layout
if ob and snode.shader_type != 'WORLD':
if ob.type == 'LAMP':
layout.label(text="%s" % ob.name,
icon="LAMP_%s" % ob.data.type)
else:
layout.label(text="%s" % ob.name,
icon="OUTLINER_DATA_%s" % ob.type)
# // FEATURE: Shader Nodes Extra Info
# FEATURE: Scene Debug
class AMTH_SCENE_OT_cycles_shader_list_nodes(Operator):
"""List Cycles materials containing a specific shader"""
bl_idname = "scene.cycles_list_nodes"
bl_label = "List Materials"
@classmethod
def poll(cls, context):
return context.scene.render.engine == 'CYCLES'
def execute(self, context):
node_type = context.scene.amaranth_cycles_node_types
roughness = False
shaders_roughness = ['BSDF_GLOSSY','BSDF_DIFFUSE','BSDF_GLASS']
print("\n=== Cycles Shader Type: %s === \n" % node_type)
for ma in bpy.data.materials:
if ma.node_tree:
nodes = ma.node_tree.nodes
print_unconnected = ('Note: \nOutput from "%s" node' % node_type,
'in material "%s"' % ma.name, 'not connected\n')
for no in nodes:
if no.type == node_type:
for ou in no.outputs:
if ou.links:
connected = True
if no.type in shaders_roughness:
roughness = 'R: %.4f' % no.inputs['Roughness'].default_value
else:
roughness = False
else:
self.__class__.materials.append('%s%s [%s] %s%s%s' % (
'[L] ' if ma.library else '',
ma.name, ma.users,
'[F]' if ma.use_fake_user else '',
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
' - [%s]' % roughness if roughness else '',
' * Output not connected' if not connected else ''))
elif no.type == 'GROUP':
if no.node_tree:
for nog in no.node_tree.nodes:
if nog.type == node_type:
for ou in nog.outputs:
if ou.links:
connected = True
if nog.type in shaders_roughness:
roughness = 'R: %.4f' % nog.inputs['Roughness'].default_value
else:
roughness = False
else:
connected = False
print(print_unconnected)
if ma.name not in self.__class__.materials:
self.__class__.materials.append('%s%s%s [%s] %s%s%s' % (
'[L] ' if ma.library else '',
'Node Group: %s%s -> ' % (
'[L] ' if no.node_tree.library else '',
no.node_tree.name),
ma.name, ma.users,
'[F]' if ma.use_fake_user else '',
' - [%s]' % roughness if roughness else '',
' * Output not connected' if not connected else ''))
self.__class__.materials = sorted(list(set(self.__class__.materials)))
self.report({"INFO"}, "No materials with nodes type %s found" % node_type)
print("* A total of %d %s using %s was found \n" % (
len(self.__class__.materials),
"material" if len(self.__class__.materials) == 1 else "materials",
print('%02d. %s' % (count+1, self.__class__.materials[count]))
self.__class__.materials = sorted(list(set(self.__class__.materials)))
class AMTH_SCENE_OT_cycles_shader_list_nodes_clear(Operator):
"""Clear the list below"""
bl_idname = "scene.cycles_list_nodes_clear"
bl_label = "Clear Materials List"
def execute(self, context):
AMTH_SCENE_OT_cycles_shader_list_nodes.materials[:] = []
class AMTH_SCENE_OT_amaranth_object_select(Operator):
'''Select object'''
bl_idname = "scene.amaranth_object_select"
bl_label = "Select Object"
object = bpy.props.StringProperty()
if self.object:
object = bpy.data.objects[self.object]
bpy.ops.object.select_all(action='DESELECT')
object.select = True
context.scene.objects.active = object
class AMTH_SCENE_OT_list_missing_node_links(Operator):
'''Print a list of missing node links'''
bl_idname = "scene.list_missing_node_links"
bl_label = "List Missing Node Links"
self.__class__.count_groups = 0
self.__class__.count_images = 0
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_groups += 1
users_ngroup = []
for ob in bpy.data.objects:
if ob.material_slots and ma.name in ob.material_slots:
users_ngroup.append("%s%s%s" % (
"[L] " if ob.library else "",
"[F] " if ob.use_fake_user else "",
ob.name))
missing_groups.append("MA: %s%s%s [%s]%s%s%s\n" % (
"[L] " if ma.library else "",
"[F] " if ma.use_fake_user else "",
ma.name, ma.users,
"\nLI: %s" %
ma.library.filepath if ma.library else "",
"\nOB: %s" % ', '.join(users_ngroup) if users_ngroup else ""))
if ma.library:
libraries.append(ma.library.filepath)
outputs_empty = not no.outputs['Color'].is_linked and not no.outputs['Alpha'].is_linked
if no.image:
import os.path
image_path_exists = os.path.exists(
bpy.path.abspath(
no.image.filepath, library=no.image.library))
if outputs_empty or not \
no.image or not \
image_path_exists:
users_images = []
for ob in bpy.data.objects:
if ob.material_slots and ma.name in ob.material_slots:
users_images.append("%s%s%s" % (
"[L] " if ob.library else "",
"[F] " if ob.use_fake_user else "",
ob.name))
if outputs_empty:
self.__class__.count_image_node_unlinked += 1
image_nodes_unlinked.append("%s%s%s%s%s [%s]%s%s%s%s%s\n" % (
"NO: %s" % no.name,
"\nMA: ",
"[L] " if ma.library else "",
"[F] " if ma.use_fake_user else "",
ma.name, ma.users,
"\nLI: %s" %
ma.library.filepath if ma.library else "",
"\nIM: %s" % no.image.name if no.image else "",
"\nLI: %s" % no.image.filepath if no.image and no.image.filepath else "",
"\nOB: %s" % ', '.join(users_images) if users_images else ""))
if not no.image or not image_path_exists:
self.__class__.count_images += 1
missing_images.append("MA: %s%s%s [%s]%s%s%s%s%s\n" % (
"[L] " if ma.library else "",
"[F] " if ma.use_fake_user else "",
ma.name, ma.users,
"\nLI: %s" %
ma.library.filepath if ma.library else "",
"\nIM: %s" % no.image.name if no.image else "",
"\nLI: %s" % no.image.filepath if no.image and no.image.filepath else "",
"\nOB: %s" % ', '.join(users_images) if users_images else ""))
if ma.library:
libraries.append(ma.library.filepath)
# Remove duplicates and sort
missing_groups = sorted(list(set(missing_groups)))
missing_images = sorted(list(set(missing_images)))
image_nodes_unlinked = sorted(list(set(image_nodes_unlinked)))
print("\n\n== %s missing image %s, %s missing node %s and %s image %s unlinked ==" %
("No" if self.__class__.count_images == 0 else str(self.__class__.count_images),
"node" if self.__class__.count_images == 1 else "nodes",
"no" if self.__class__.count_groups == 0 else str(self.__class__.count_groups),
"group" if self.__class__.count_groups == 1 else "groups",
"no" if self.__class__.count_image_node_unlinked == 0 else str(self.__class__.count_image_node_unlinked),
"node" if self.__class__.count_groups == 1 else "nodes"))
# List Missing Node Groups
if missing_groups:
for mig in missing_groups:
print(mig)
# List Missing Image Nodes
if missing_images:
# List Image Nodes with its outputs unlinked
if image_nodes_unlinked:
for nou in image_nodes_unlinked:
print(nou)
if missing_groups or \
missing_images or \
image_nodes_unlinked:
"this library" if len(libraries) == 1 else "these libraries"))
for li in libraries:
print(li)
else:
self.report({"INFO"}, "Yay! No missing node links")
print("\n")
if missing_groups and missing_images:
self.report({"WARNING"}, "%d missing image %s and %d missing node %s found" %
(self.__class__.count_images, "node" if self.__class__.count_images == 1 else "nodes",
self.__class__.count_groups, "group" if self.__class__.count_groups == 1 else "groups"))
return{'FINISHED'}
class AMTH_SCENE_OT_list_missing_material_slots(Operator):
'''List objects with empty material slots'''
bl_idname = "scene.list_missing_material_slots"
bl_label = "List Empty Material Slots"
def execute(self, context):
self.__class__.objects = []
for ob in bpy.data.objects:
for ma in ob.material_slots:
if not ma.material:
self.__class__.objects.append('%s%s' % (
'[L] ' if ob.library else '',
ob.name))
if ob.library:
self.__class__.libraries.append(ob.library.filepath)
self.__class__.objects = sorted(list(set(self.__class__.objects)))
self.__class__.libraries = sorted(list(set(self.__class__.libraries)))
if len(self.__class__.objects) == 0:
self.report({"INFO"}, "No objects with empty material slots found")
else:
print("\n* A total of %d %s with empty material slots was found \n" % (
len(self.__class__.objects),
"object" if len(self.__class__.objects) == 1 else "objects"))
count = 0
print('%02d. %s' % (
count+1, self.__class__.objects[count]))
if self.__class__.libraries:
print("\n\n* Check %s:\n" %
("this library" if len(self.__class__.libraries) == 1
else "these libraries"))
for libs in self.__class__.libraries:
print('%02d. %s' % (
count_lib+1, self.__class__.libraries[count_lib]))
count_lib += 1
class AMTH_SCENE_OT_list_missing_material_slots_clear(Operator):
"""Clear the list below"""
bl_idname = "scene.list_missing_material_slots_clear"
bl_label = "Clear Empty Material Slots List"
def execute(self, context):
AMTH_SCENE_OT_list_missing_material_slots.objects[:] = []
print("* Cleared Empty Material Slots List")
return {'FINISHED'}
class AMTH_SCENE_OT_blender_instance_open(Operator):
'''Open in a new Blender instance'''
bl_idname = "scene.blender_instance_open"
bl_label = "Open Blender Instance"
filepath = bpy.props.StringProperty()
import os.path
filepath = os.path.normpath(bpy.path.abspath(self.filepath))
import subprocess
try:
subprocess.Popen([bpy.app.binary_path, filepath])
except:
print("Error on the new Blender instance")
import traceback
traceback.print_exc()
'''Scene Debug'''
bl_label = 'Scene Debug'
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "scene"
def draw(self, context):
layout = self.layout
scene = context.scene
objects = bpy.data.objects
ob_act = context.active_object
images = bpy.data.images
lamps = bpy.data.lamps
images_missing = []
list_lamps = scene.amaranth_debug_scene_list_lamps
list_missing_images = scene.amaranth_debug_scene_list_missing_images
materials = AMTH_SCENE_OT_cycles_shader_list_nodes.materials
materials_count = len(AMTH_SCENE_OT_cycles_shader_list_nodes.materials)
missing_material_slots_obs = AMTH_SCENE_OT_list_missing_material_slots.objects
missing_material_slots_count = len(AMTH_SCENE_OT_list_missing_material_slots.objects)
missing_material_slots_lib = AMTH_SCENE_OT_list_missing_material_slots.libraries
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
engine = scene.render.engine
# List Lamps
box = layout.box()
row = box.row(align=True)
split = row.split()
col = split.column()
if lamps:
row = col.row(align=True)
row.alignment = 'LEFT'
row.prop(scene, 'amaranth_debug_scene_list_lamps',
icon="%s" % 'TRIA_DOWN' if list_lamps else 'TRIA_RIGHT',
emboss=False)
if objects and list_lamps:
row = box.row(align=True)
split = row.split(percentage=0.42)
col = split.column()
col.label(text="Name")
split = split.split(percentage=0.1)
col = split.column()
col.label(text="", icon="BLANK1")
if engine in ['CYCLES', 'BLENDER_RENDER']:
if engine == 'BLENDER_RENDER':
split = split.split(percentage=0.7)
else:
split = split.split(percentage=0.35)
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
col.label(text="Samples")
if engine == 'CYCLES':
split = split.split(percentage=0.35)
col = split.column()
col.label(text="Size")
split = split.split(percentage=0.8)
col = split.column()
col.label(text="Visibility")
for ob in objects:
if ob and ob.type == 'LAMP':
lamp = ob.data
clamp = ob.data.cycles
row = box.row(align=True)
split = row.split(percentage=0.5)
col = split.column()
row = col.row()
row.alignment = 'LEFT'
row.operator(AMTH_SCENE_OT_amaranth_object_select.bl_idname,
text='%s %s%s' % (
" [L] " if ob.library else "",
ob.name,
"" if ob.name in context.scene.objects else " [Not in Scene]"),
icon="LAMP_%s" % ob.data.type,
if ob.library:
row = col.row(align=True)
row.alignment = "LEFT"
row.operator(AMTH_SCENE_OT_blender_instance_open.bl_idname,
text=ob.library.filepath,
icon="LINK_BLEND",
emboss=False).filepath=ob.library.filepath
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
if engine == 'CYCLES':
split = split.split(percentage=0.35)
col = split.column()
if scene.cycles.progressive == 'BRANCHED_PATH':
col.prop(clamp, "samples", text="")
if scene.cycles.progressive == 'PATH':
col.label(text="N/A")
if engine == 'BLENDER_RENDER':
split = split.split(percentage=0.7)
col = split.column()
if lamp.type == 'HEMI':
col.label(text="Not Available")
elif lamp.type == 'AREA' and lamp.shadow_method == 'RAY_SHADOW':
row = col.row(align=True)
row.prop(lamp, "shadow_ray_samples_x", text="X")
if lamp.shape == 'RECTANGLE':
row.prop(lamp, "shadow_ray_samples_y", text="Y")
elif lamp.shadow_method == 'RAY_SHADOW':
col.prop(lamp, "shadow_ray_samples", text="Ray Samples")
elif lamp.shadow_method == 'BUFFER_SHADOW':
col.prop(lamp, "shadow_buffer_samples", text="Buffer Samples")
else:
col.label(text="No Shadow")
if engine == 'CYCLES':
split = split.split(percentage=0.4)
if lamp.type in ['POINT','SUN', 'SPOT']:
col.label(text="%.2f" % lamp.shadow_soft_size)
elif lamp.type == 'HEMI':
col.label(text="N/A")
elif lamp.type == 'AREA' and lamp.shape == 'RECTANGLE':
col.label(text="%.2fx%.2f" % (lamp.size, lamp.size_y))
else:
col.label(text="%.2f" % lamp.size)
split = split.split(percentage=0.8)
col = split.column()
row = col.row(align=True)
row.prop(ob, "hide", text="", emboss=False)
row.prop(ob, "hide_render", text="", emboss=False)
split = split.split(percentage=0.3)
col = split.column()
col.label(text="", icon="%s" % "TRIA_LEFT" if ob == ob_act else "BLANK1")
else:
row = col.row(align=True)
row.alignment = 'LEFT'
row.label(text="Lamps List", icon="RIGHTARROW_THIN")
split = split.split()
col = split.column()
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
for im in images:
if im.type not in ['UV_TEST', 'RENDER_RESULT', 'COMPOSITING']:
if not os.path.exists(bpy.path.abspath(im.filepath, library=im.library)):
images_missing.append(["%s%s [%s]%s" % (
'[L] ' if im.library else '',
im.name, im.users,
' [F]' if im.use_fake_user else ''),
im.filepath if im.filepath else 'No Filepath',
im.library.filepath if im.library else ''])
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
if images_missing:
row = col.row(align=True)
row.alignment = 'LEFT'
row.prop(scene, 'amaranth_debug_scene_list_missing_images',
icon="%s" % 'TRIA_DOWN' if list_missing_images else 'TRIA_RIGHT',
emboss=False)
split = split.split()
col = split.column()
col.label(text="%s missing %s" % (
str(len(images_missing)),
'image' if len(images_missing) == 1 else 'images'),
icon="ERROR")
if list_missing_images:
col = box.column(align=True)
for mis in images_missing:
col.label(text=mis[0],
icon="IMAGE_DATA")
col.label(text=mis[1], icon="LIBRARY_DATA_DIRECT")
if mis[2]:
row = col.row(align=True)
row.alignment = "LEFT"
row.operator(AMTH_SCENE_OT_blender_instance_open.bl_idname,
text=mis[2],
icon="LINK_BLEND",
emboss=False).filepath=mis[2]
col.separator()
else:
row = col.row(align=True)
row.alignment = 'LEFT'
row.label(text="Great! No missing images", icon="RIGHTARROW_THIN")
split = split.split()
col = split.column()
col.label(text="%s %s loading correctly" % (
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(AMTH_SCENE_OT_cycles_shader_list_nodes.bl_idname,
icon="SORTSIZE",
text="List Materials Using Shader")
if materials_count != 0:
row.operator(AMTH_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
box = layout.box()
row = box.row(align=True)
split = row.split()
col = split.column(align=True)
split = col.split()
split.label(text="Node Links")
split.operator(AMTH_SCENE_OT_list_missing_node_links.bl_idname,
if AMTH_SCENE_OT_list_missing_node_links.count_groups != 0 or \
AMTH_SCENE_OT_list_missing_node_links.count_images != 0 or \
AMTH_SCENE_OT_list_missing_node_links.count_image_node_unlinked != 0:
col.label(text="Warning! Check Console", icon="ERROR")
if AMTH_SCENE_OT_list_missing_node_links.count_groups != 0:
str(AMTH_SCENE_OT_list_missing_node_links.count_groups),
"group" if AMTH_SCENE_OT_list_missing_node_links.count_groups == 1 else "groups")),
if AMTH_SCENE_OT_list_missing_node_links.count_images != 0:
str(AMTH_SCENE_OT_list_missing_node_links.count_images),
"node" if AMTH_SCENE_OT_list_missing_node_links.count_images == 1 else "nodes")),
if AMTH_SCENE_OT_list_missing_node_links.count_image_node_unlinked != 0:
col.label(text="%s" % ("%s image %s with no output conected" % (
str(AMTH_SCENE_OT_list_missing_node_links.count_image_node_unlinked),
"node" if AMTH_SCENE_OT_list_missing_node_links.count_image_node_unlinked == 1 else "nodes")),
icon="NODE")
# List Empty Materials Slots
box = layout.box()
split = box.split()
col = split.column(align=True)
col.label(text="Material Slots")
row = split.row(align=True)
row.operator(AMTH_SCENE_OT_list_missing_material_slots.bl_idname,
icon="MATERIAL",
text="List Empty Materials Slots")
if missing_material_slots_count != 0:
row.operator(AMTH_SCENE_OT_list_missing_material_slots_clear.bl_idname,
icon="X", text="")
col.separator()
try:
missing_material_slots_obs
except NameError:
pass
else:
if missing_material_slots_count != 0:
col = box.column(align=True)
count = 0
col.label(text="%s %s with empty material slots found" % (
missing_material_slots_count,
'object' if missing_material_slots_count == 1 else 'objects'),
icon="INFO")
for obs in missing_material_slots_obs:
count += 1
row = col.row()
row.alignment = 'LEFT'
row.operator(AMTH_SCENE_OT_amaranth_object_select.bl_idname,
text='%s' % (
missing_material_slots_obs[count-1]),
icon="OBJECT_DATA",
emboss=False).object = missing_material_slots_obs[count-1]
if missing_material_slots_lib:
col.separator()
col.label("Check %s:" % (
"this library" if
len(missing_material_slots_lib) == 1
else "these libraries"))
for libs in missing_material_slots_lib:
count_lib += 1
row = col.row(align=True)
row.alignment = "LEFT"
row.operator(AMTH_SCENE_OT_blender_instance_open.bl_idname,
text=missing_material_slots_lib[count_lib-1],
icon="LINK_BLEND",
emboss=False).filepath=missing_material_slots_lib[count_lib-1]