The draw manager iters over each object in the deps graph and
forward this to the enabled draw engines. There were exceptions
made for specific configurations. After a design discussion
we decided that the draw module is responsible for this optimization
but we see in the near future additional optimizations like only loop
over active objects or selected objects in a specific mode.
This patch concerns moving the logic in a separate file and change the bool to an enum value.
Additional checks added:
- Don't loop when drawing an image editor displaying a render result/composite viewer.
- Don't loop when drawing an image editor in masks mode
- Don't loop when overlays are turned off.
Performance isn't tiny, but would help with huge scenes as unneeded loops are avoided.