I have a FStateTreePropertyFunctionCommonBase derived property function, and in its instance data, I am trying to use a TStateTreePropertyRef,
[Image Removed]
In the execute function for it, I’m trying to get the mutable pointer to the object, as you do with property references.
[Image Removed]
However, the problem is that I’m getting a check failure during the resolution of the property reference
[Image Removed]
[Image Removed]
The SourceView coming into this struct is empty
[Image Removed]
Is there any reason why a TStateTreePropertyRef would not be valid like this within a property binding function? I believe this is the first time I have tried to use one in a property binding, but I use them in numerous tasks.
I noticed that in FStateTreeExecutionContext::EvaluatePropertyFunctionsWithValidation, prior to the property function executing, there is no Func.BindingsBatch is not valid
[Image Removed]Shouldn’t there be bindings for this property function that would resolve the TStateTreePropertyRef ?
Also, is there a way to make a TStateTreePropertyRef optional? I would like to use TStateTreePropertyRef properties to optionally reference parameters, so they could be allowed to be unbound and the GetMutable and such would just return null.
Seems you can do this in the state tree itself, but not in native classes?
[Image Removed]
[Attachment Removed]
TStateTreePropertyRef requires that what it is bound to be an accessible struct type. The list of valid things for property refs can be found in IsPropertyAccessibleForPropertyRef which is in StateTreePropertyRefHelpers.cpp. I believe it comes down to how property functions are handled in StateTree by evaluating right before the binding to the property. I’m searching for more info on why it is explicitly disallowed, but it is taking a bit more time as the dev who wrote it originally is no longer at Epic.
As for marking a TStateTreePropertyRef as optional, this should be possible by having the meta-specifiers include Optional in the list. Are these property refs being done for task instance data? Or is this trying to populate a global parameters list from code?
-James
[Attachment Removed]
The ability to use StateTreePropertyRefs as an input for property functions should be allowed. It seems the issue is coming from how the bindings are updated for use in the property function. Can you share a screenshot of how you have this setup on your tree? It appears that the property ref is a state parameter, and state parameters only update their bindings on Enter/ExitState currently. Did it work for you in any context prior to the other change you made? Or was it something that is used only in this pattern in your tree?
I have also shared out with the team the other change you made that enables this functionality as well. The team has been busy wrapping up things for the end of the year, but I have a setup a reminder for this to ping me once we are back in the office.
-James
[Attachment Removed]
To be clear. This is a compatible struct ref type used in any other context. It’s only when used in a property binding that it will not resolve, so it seems to be specific to a property binding.
However. I think this issue might be addressed with the fixes I mentioned in my other UDN post, related to a bug that seems to be present with copying bindings in certain circumstances
[Content removed]
Since I applied that fix, my property function is working fine, though I did not confirm whether the property batch that I fixed in my other post also included this broken property binding, and I don’t think it was on my radar at the time of this bug/post whether it was specifically inside a nested state tree frame.
[Attachment Removed]