Heritage attractions in Scotland saw a rise in visitor numbers last year as tourists were drawn to the country’s historic sites and filming locations.