diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-05-29 06:33:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-06-13 18:47:11 +0400 |
commit | c3c04fe5823494dcf9195a327b354c88ac9b6757 (patch) | |
tree | fc0d9874d075dba74af79d801d84e1fd854fdddc /source/blender | |
parent | 477f35559cf20ea6cc81fa3d3a0ec1b886dbf5e4 (diff) |
Code cleanup: remove redundant NULL check
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index dd951e48784..70791eaebc4 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -418,11 +418,9 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, TIP_(template_id_browse_tip(type))); - if (type) { - but->icon = RNA_struct_ui_icon(type); - if (id) but->icon = ui_id_icon_get(C, id, true); - uiButSetFlag(but, UI_HAS_ICON | UI_ICON_PREVIEW); - } + but->icon = id ? ui_id_icon_get(C, id, true) : RNA_struct_ui_icon(type); + uiButSetFlag(but, UI_HAS_ICON | UI_ICON_PREVIEW); + if ((idfrom && idfrom->lib) || !editable) uiButSetFlag(but, UI_BUT_DISABLED); @@ -431,14 +429,11 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str else if (flag & UI_ID_BROWSE) { but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 1.6, UI_UNIT_Y, TIP_(template_id_browse_tip(type))); - - if (type) { - but->icon = RNA_struct_ui_icon(type); - /* default dragging of icon for id browse buttons */ - uiButSetDragID(but, id); - uiButSetFlag(but, UI_HAS_ICON); - uiButSetDrawFlag(but, UI_BUT_ICON_LEFT); - } + but->icon = RNA_struct_ui_icon(type); + /* default dragging of icon for id browse buttons */ + uiButSetDragID(but, id); + uiButSetFlag(but, UI_HAS_ICON); + uiButSetDrawFlag(but, UI_BUT_ICON_LEFT); if ((idfrom && idfrom->lib) || !editable) uiButSetFlag(but, UI_BUT_DISABLED); |