drawLayer() - has anyone figured out all the possible layers?

as I scanned the Rack source I found:

  • layer == -1 // shadow on ModuleWidget
  • layer == 0 // call deprecated draw() method
  • layer == 1 // draw lights
  • layer == 2 // draw plugs and cables
  • layer == 3 // draw cable outline

has anyone found out more about layers?


A few corrections:

  • void Widget::draw(const DrawArgs& args) is not deprecated. Perhaps you are thinking of void Widget::draw(NVGcontext* vg) which was deprecated in Rack 1.0.
  • Layer 2 and 3 are drawn by Rack’s cable container which only contains cable widgets. Rack does not draw these layers for ModuleWidgets.

Layers are useful for a custom parent widget to draw its children in multiple passes. There’s no current standard for choosing layers by plugin developers, but I’d recommend using layer >= 1000 for custom layers to avoid interfering with any Rack-drawn layers in future updates.


Thanks for clarification.