Being able to reset is a critical feature in deterministic design systems. For instance the DOM can do this:
const a = document.createElement("div") a.style.color // -> "" a.style.color = "red" a.style.color // -> "red" a.style.color = null a.style.color // -> ""
This is why we can simply delete a style from Chrome Devtools and it goes back to its default.
or in React we can write:
<meshBasicMaterial color="red" />
Now we could simply remove the color, save the file, and hot module reload will tell the reconciler that “color” does not exist any longer on the same element:
But, since there is no way to know the default, it is stuck on red. I discussed this with Dan Abramov, and he was surprised that Three doesn’t have this. All other platforms seem to be able to do this, i asked around: Dom, Android, Ios, Konva, Ink, etc.
It would be a simple addition for all value types, so classes that have set/clone/copy. It could be a reset method for instance that puts the item back to the state it had:
const color = new THREE.Color() color.set("red") color.reset() color.getHexString() // -> "ffffff"
Or a defaults collection on the prototype:
Color.prototype.defaultArguments = [0, 0, 0] // ... color.set(...color.defaultArguments)
This is not something that would only help React, it would also be relevant to any design system that is driven by Three, visual editors, IDEs and so on.