The EditCondition meta tag is no longer limited to a single boolean property. It is now evaluated using a full-fledged expression parser, meaning you can include a full C++ expression.
so that if the array has no elements I can edit that FName property but it should be greyed out if there are elements in it.
I’ve also tried:
TestArray.IsEmpty() - doesn’t hide it as expected (just for testing purposes)
TestArray.Num() == 0- not wotking
1 == 0 - always hides it.
also tried assigning TestArray.Num() to a bool variable and using that (inspired by my c# knowledge) and unsurprisingly does not work either (i.e. bool bTest = TestArray.Num(); and meta = (EditContidion = "bTest ")
Obviously it is not working as expected otherwise I wouldn’t ask here, so why is that so? am I misreading the documentation?
I have seen this basic doc but that seems like an overkill for the simple thing I’m trying to achive.
Was this a recent change? I don’t remember reading this in any of the recent patchnotes.
I’d guess that the typo in EditContidion (instead of EditCondition) is part of the problem. Would be interesting to know if it works after fixing that.
You can also specify custom metadata as well so that’s likely why the typo doesn’t cause an error.
The expression parser isn’t fully compiled C++ code, it’s a unique little custom-made parser that can essentially assemble and run a simple math expression. I think it can only contain UPROPERTYs and basic C++ operators.
Storing the array’s Num() into a dummy UPROPERTY variable and then reading that variable in the EditCondition will work, if you can figure out how to update the dummy variable. On an actor you can use PostEditChangeProperty(…) for this.
You can wrap the dummy variable in #if WITH_EDITORONLY_DATA to keep some of the silliness out of shipping builds.
That’s somewhat unfortunate. My hope was that something similar to ReplicatedUsing would be possible now. With ReplicatedUsing you simply specify the UFUNCTION that will be called whenever the variable updates from replication over the network. So here you would simply specify a (editor-only) UFUNCTION that can implement the editcondition.