forked from bartvdbraak/blender
remove type checks on drawing uiList's,
if the list is given the wrong item then the script needs to be fixed, better not fail silently. left in checks as commented out asserts.
This commit is contained in:
parent
914b0aafa5
commit
d984c46701
@ -56,8 +56,7 @@ class MESH_MT_shape_key_specials(Menu):
|
||||
|
||||
class MESH_UL_vgroups(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if not isinstance(item, bpy.types.VertexGroup):
|
||||
return
|
||||
# assert(isinstance(item, bpy.types.VertexGroup)
|
||||
vgroup = item
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
layout.label(vgroup.name, icon_value=icon)
|
||||
@ -70,8 +69,7 @@ class MESH_UL_vgroups(UIList):
|
||||
|
||||
class MESH_UL_shape_keys(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if not isinstance(item, bpy.types.ShapeKey):
|
||||
return
|
||||
# assert(isinstance(item, bpy.types.ShapeKey)
|
||||
obj = active_data
|
||||
key = data
|
||||
key_block = item
|
||||
@ -93,9 +91,7 @@ class MESH_UL_shape_keys(UIList):
|
||||
|
||||
class MESH_UL_uvmaps_vcols(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if not isinstance(item, (bpy.types.MeshTexturePolyLayer, bpy.types.MeshLoopColorLayer)):
|
||||
print(item.__class__)
|
||||
return
|
||||
# assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, bpy.types.MeshLoopColorLayer))
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
layout.label(item.name, icon_value=icon)
|
||||
icon = 'RESTRICT_RENDER_OFF' if item.active_render else 'RESTRICT_RENDER_ON'
|
||||
|
@ -27,8 +27,7 @@ from bpy.types import Menu, UIList
|
||||
|
||||
class MASK_UL_layers(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if not isinstance(item, bpy.types.MaskLayer):
|
||||
return
|
||||
# assert(isinstance(item, bpy.types.MaskLayer)
|
||||
mask = item
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
split = layout.split()
|
||||
|
@ -71,8 +71,7 @@ class MATERIAL_MT_specials(Menu):
|
||||
|
||||
class MATERIAL_UL_matslots(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if not isinstance(item, bpy.types.MaterialSlot):
|
||||
return
|
||||
# assert(isinstance(item, bpy.types.MaterialSlot)
|
||||
ob = data
|
||||
slot = item
|
||||
ma = slot.material
|
||||
|
@ -27,8 +27,7 @@ from bl_ui.properties_physics_common import (point_cache_ui,
|
||||
|
||||
class PHYSICS_UL_dynapaint_surfaces(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if not isinstance(item, bpy.types.DynamicPaintSurface):
|
||||
return
|
||||
# assert(isinstance(item, bpy.types.DynamicPaintSurface)
|
||||
surf = item
|
||||
sticon = layout.enum_item_icon(surf, "surface_type", surf.surface_type)
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
|
@ -45,8 +45,7 @@ class RENDER_MT_framerate_presets(Menu):
|
||||
|
||||
class RENDER_UL_renderlayers(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if not isinstance(item, bpy.types.SceneRenderLayer):
|
||||
return
|
||||
# assert(isinstance(item, bpy.types.SceneRenderLayer)
|
||||
layer = item
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
layout.label(layer.name, icon_value=icon)
|
||||
|
@ -24,8 +24,7 @@ from rna_prop_ui import PropertyPanel
|
||||
|
||||
class SCENE_UL_keying_set_paths(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if not isinstance(item, bpy.types.KeyingSetPath):
|
||||
return
|
||||
# assert(isinstance(item, bpy.types.KeyingSetPath)
|
||||
kspath = item
|
||||
icon = layout.enum_item_icon(kspath, "id_type", kspath.id_type)
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
|
@ -58,8 +58,7 @@ class TEXTURE_MT_envmap_specials(Menu):
|
||||
|
||||
class TEXTURE_UL_texslots(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if not (item is None or isinstance(item, bpy.types.MaterialTextureSlot)):
|
||||
return
|
||||
# assert(isinstance(item, bpy.types.MaterialTextureSlot)
|
||||
ma = data
|
||||
slot = item
|
||||
tex = slot.texture if slot else None
|
||||
|
@ -24,8 +24,7 @@ from bpy.types import Panel, Header, Menu, UIList
|
||||
|
||||
class CLIP_UL_tracking_objects(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if not (item is None or isinstance(item, bpy.types.MovieTrackingObject)):
|
||||
return
|
||||
# assert(isinstance(item, bpy.types.MovieTrackingObject)
|
||||
tobj = item
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
layout.label(tobj.name, icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA')
|
||||
|
Loading…
Reference in New Issue
Block a user