ViewModel Editor MVP - barsandcat/HMS-Sunflower GitHub Wiki
View model is data interface. You can run your interface without game. Arrays of view models are perfect match to the list views. There is built in support for this trick. But there were some issues, and now there are some warnings.
View model is data, but can have functions that pretend to be data. Setter and getters are just way to guarantee notifications to work.
View model binding layer is just autogenerated blue print. You can edit that blueprint in case of binding event to the function, but it will be reset on any change in view model.
valid = Private::IsValidCommon(InFunction) && !InFunction->HasAnyFunctionFlags(FUNC_Const | FUNC_BlueprintPure | FUNC_BlueprintEvent);
Why do they have distinction between valid for source, valid for destination and valid for event? Why event is not source? if source - that means that field can be used to read from if destination - that means that field can be written to if event - can be called by event
On sending input from view model. Best: dynamic multicast delegate, if you need input. You can use function, if you do not care about parameters. If you need actual data - the data field, and subscribe to it.
Not all events but you can simply add handlers in bluprint And you can extend widgets so they are easy to connect to viewmodel - combox that can accept list of viewmodels for its content.
Animations can easily be bound to the data properties.
Upgrading engine 5.4 to 5.6 - looks like new delegate binding support. I.e. you can now bind functions to delegates. Or maybe you can bind delegates to delegates? Anyway I do need an engine upgrade!
I found a place that does adds parameters additional rows: SFunctionParameterRow::BuildRowWidget Still, do not understand the functionality that is missing or I do not know how to use it. Any way, what is more intresting is conversion functions. They added some? Conversion functions are collected from everywhere, but:
- For
UUserWidgetclasses: the function must beBlueprintPureandConst. - For Blueprint function libraries: the function must be
StaticandBlueprintPure. - The function must have a return value.
- The function must have at least one argument.
- The function must not be an inherited Blueprint function (i.e., not overridden).