Hello,
I'm currently in need of some way of knowing that script member value changed. I know this can be done in scripts via virtual properties (just use setter and do whatever logic is needed there), but my use cases are more low level and actually need to be handled on C++ side - think of transparent implementation of dirty flag, or having a requirement that we need to call some callback whenever value changes - implementing this in all setters will be error prone and very verbose.
What I'm thinking is some ability to be able to register some callback whenever a property setter is invoked (so basically some sort of implicit virtual property with a setter that's pass-through and just calls C++ func?). This could be maybe turned off/on on per property basis even, to give fine grained control. This callback will be on C++ side, and containing information like: type, current value, new value. With this implementing script-wide dirty flag would be trivial - I could use meta-info like [dirty]
on properties and then use this callback to figure out if the dirty flag for variable should be toggled. It would make network replication code writing a breeze.
I can't figure out if there is some way to hook into property execution for script declared variables. If I could wrap a specific property setter with another call that would be enough for me to control the setting of value, then calling original setter - but I have no idea that's even possible for script members.
Anyone had such use case and found some elegant solution maybe?