So we’re working on a Web Server ↔ Unreal communication mechanism (for a virtual production company – NOTE: we’re weird in that we use packaged builds, not the editor, which we feed webcam/iPhone video through – it’s a hands-off subscription service).
We are able to do list/read/write properties, call UFunctions, etc.
One problem is that, when we set properties that should cause code to run, such as changing a component’s RelativeLocation or a CineCamera component’s CurrentFocalLength, we would not move the object or change its focal length. This makes sense, because SetRelativeLocation and SetCurrentFocalLength do a lot more than just set the field value, but we’re just writing to memory and calling it a day (if we target the property). Again, we could call the function, but stakeholders want to feel like they’re accessing the properties as if it was Sequencer.
Some properties have ex: SetCurrentFocalLength listed as a BlueprintSetter, and other properties are listed as Interp (for Sequencer – although I don’t think that’s relevant to running code on set). I’ve tried HasSetter()/CallSetter() on one of the FFloatProperties corresponding to a BlueprintSetter property (IIRC CurrentFocalLength) but it returned false, so I assume it’s something else.
Is there a way to see from runtime (not editor) reflection whether there’s a better thing to do (ex: redirect to a UFunction call) than just write to its memory if we’re asked to set a specific UProperty to a specific value?
So, even though I’ve been working on this problem for days and haven’t seen this yet, apparently Remote Control has a duck test to try to find setter functions given a property name and an owning class.
So… when I check HasSetter() it comes up false, but, yes, SetValue_InContainer (instead of SetPropertyValue_InContainer) seems to set the focal length. Not sure what’s up with that. Could be a bug in my test or something.
Current process is:
Try Remote Control’s FindSetterFunction() (because RelativeLocation doesn’t seem to work with SetValue_InContainer). If no UFunction* is found, then:
Is this a custom property or the USceneComponent::RelativeLocation? If the latter then HasGetter probably returns false since the property doesn’t have the BlueprintSetter specifier even if it’s private and there is a SetRelativeLocation function. For this case the FindSetterFunction is probably the way to go.