ex-makina / marklight

MarkLight is a presentation framework for Unity that allows you to create scene elements in a language similar to HTML.
MIT License
75 stars 35 forks source link

Code-Calculated View Fields #4

Open mrpmorris opened 8 years ago

mrpmorris commented 8 years ago

This isn't quite working, the calculated view field isn't having the ML framework re-request its value for display and I don't know why.

mrpmorris commented 5 years ago

@patrik-github Did you consider implementing this feature? I don't need it as I don't do Unity3D any longer, but I just spotted it.

patrik-u commented 5 years ago

@patrik-github Did you consider implementing this feature? I don't need it as I don't do Unity3D any longer, but I just spotted it.

Hi I appreciate your interest. Right now the framework is being rewritten from scratch using code-generation and (proper) dependency properties - not sure what a code-calculated field is, have you examples how this is intended to be used? Might be something I'd want to keep in mind.

mrpmorris commented 5 years ago

It's like a memento.

  1. The consumer tries to read the value, it isn't set in its cache so it should calculate it and store the result in its cache. 2: The consumer tries to read the value again, the cached value should be returned to avoid potentially expensive calculation.
  2. If any value that this is dependent on are altered it should invalidate its cache, but not recalculate.

This way you have a value than might be computationally expensive that can be read multiple times very quickly because it is cached, but that isn't calculated unless A) It is demanded and B) The cached value is suspected to be stale.

My code might not be ideal because I had to try to patch it into existing code.

patrik-u commented 5 years ago

I see, that is useful. Thanks for the explanation.