Turning the optimization off when the factor value is animated is not that difficult, it’s just an extra step that has to be taken into account (exactly what you’ve said). What makes it more difficult is to check if the connected nodes are animated and because of that it’s better to only optimize when the factor input is unconnected (= is a constant value).
The same problems apply to auto-baking: although this should be technically possible it is very difficult, a lot of work and it probably slows down the export a lot:
- You’d have to specify a resolution and a UV map for the auto-baked texture and you must decide if those settings apply to all baked textures.
- You’d have to traverse the entire node tree that could affect the procedural texture in order to check if nothing there is animated. I’m afraid that this would make the material parsing code extremly complicated and slow.
- An object can have texture coords based on its position for example, this should be taken into account because it could affect the procedural textures (most procedural textures don’t repeat themselves, they are just infinite).
If you need a lot of procedural materials and they slow the game down, you can still bake them manually.
A simple check for 0/1 as a constant should be easy to do, it’s just important to keep in mind that this must be updated when someday animated materials will work. If that particular property is animated, it cannot be optimized. That’s all I wanted to say, sorry if it sounded complicated in the above post^^