Whenever the value of a node property changes, a “change” signal is emitted. This signal is used for two main purposes:
Originally, change signals in K-3D were empty notifications that a change occurred without providing any additional data:
sigc::signal<void> foo_changed_signal;
These notifications had correspondingly-simple signal handlers:
void on_foo_changed() { // Deal with the change here ... }
Although trivial to understand and implement, this approach missed-out on a key optimization - for certain complex data types, downstream nodes may be able to significantly reduce their computational costs if they have additional information about what exactly changed.
As an example, a bitmap modifier cannot alter its input bitmap - it must make a copy of its input, then change the copy. If the input bitmap changes, a naive modifier starts over from scratch, deleting the old copy, creating a new copy, then reapplying its changes. Depending on what changed in the input bitmap, this can lead to unnecessary, time-wasting heap allocations. If the dimensions of the input bitmap changed, then reallocation is required, but if the dimensions of the input bitmap didn’t change (e.g. only pixel values changed), then most modifiers don’t need to reallocate anything - they could simply reapply their changes, if only they knew for certain that the dimensions didn’t change.
In a nutshell, whenever a property changes, we want upstream nodes to be able to pass “hints” to downstream nodes to provide more information about what changed.