Exposing slots requires more code than it should
Creating a new node takes a lot of code, so reducing it is always good for the developers.
The issue here is that every slot on a node needs to have its properties manually exposed in the properties panel.
Proposed solution
- Instead of interface nodes storing their properties in an enum, the interface node struct a vector of properties.
- Each property stores things like its name, default value, and allowed range for things like floats.
- From this vec of properties we can generate input slots as well as editable properties in the GUI.
- When using the properties in the node when doing calculations, we refer to them by their string name.
- We can keep the enum, because it helps identify what node type it is, but we won't store any data on it like we do now.
This is not an ideal solution since we lose the compile time type checking in Rust in some places. However, the important thing is that it's at least better than what we have right now, where it's really cumbersome to work with nodes.
One consideration is that undo/redo still needs to work. This shouldn't be an issue, but it's just easy to forget.
Another consideration is how we should deal with loading saved nodes. Since the data is stored in a vec, someone could easily just add a float value to an output node for instance. When this happen we need to do something. The easiest solution is to discard invalid properties, and add default properties for missing ones. This means each node type needs to have a template node that can be created to compare against. This template node can probably also be automatically generated from the vector of values.