function autoblksMbcLicCheck(Block, ButtonNames)
% Returns true if MBC license is available. 
% 
% LicCheck = autoblksMbcLicCheck(Block, ButtonNames)
% If license is available buttons listed in ButtonNames are enabled. If
% false, buttons are disabled.
%

% Copyright 2018 The MathWorks, Inc. 
if ~bdIsLibrary(bdroot(Block))
    LicCheck = license('test', 'MBC_Toolbox');
    if nargin >= 2
        ButtonNames = cellstr(ButtonNames);
        MaskObj = get_param(Block, 'MaskObject');
        for i = 1:length(ButtonNames)
            Button = MaskObj.getDialogControl(ButtonNames{i});
            if LicCheck
                Button.Enabled = 'on';
                Button.Visible = 'on';
            else
                Button.Enabled = 'off';
                Button.Visible = 'on';
            end
        end
    end
    
end