The best way to paint an engine is clearly to completely dismantle it, clean it, mask the parts off, paint / bake etc. each part and then reassemble.
I'm not a huge fan of painting an assembled engine - I understand of course why people do it, kind of like I understand why some people spray spoked wheels after lacing them up and with tires already on the rims. It's easier, less work, and who among us actually re-torques their spokes? might be an issue when you go to replace the tires, but that's down the road anyhow.
IMHO if you're going to go to the effort of painting an engine, go all the way. Having disassembled my first engine ever - my XS650 just a few months ago, I can honestly say it's pretty darn simple.