Shader disabling bugs

This fixes two things that weren't working :

- Shaders used twice in a network, once via a disabled node and once directly.
- Several disabled shaders in a row.

I suspect that although they will both merge cleanly on their own, this will conflict with #467. If this one seems good to go I suggest we merge it first while waiting for a consensus on the indexing question in #467. I'll then rejig that one for a clean merge.