Example of get_arg with Enum?


#1

I was looking at adding FTransform GetUnitAxis to the plugin, it takes an enum argument EAxis. I searched through the plugin source but didn’t see any specific examples of using SkInvokedMethod->get_arg with an enum argument. Anything you can point me to?


#2

To be consistent with our C++ binding code you would handle enums like this: EAxis::Type which_axis = (EAxis::Type)scope_p->get_arg<SkEnum>(SkArg_1)

However, ideally we would like to keep UE4-specific types out of the interface for the VectorMath overlay as the plan is to keep this overlay compatible across engines. We are currently using the UE4 types internally since they are available but would like to keep the script interface UE4-agnostic if at all possible.

To achieve this, you could either define a specific enum in the VectorMath overlay that happens to use the same integer values as EAxis, or if passing around an enum is actually not crucial, then have three individual methods unit_axis_x, unit_axis_y and unit_axis_z.


#3

Ahh, I didn’t realize that. I was thinking of some of the other FTransform functions I needed for this particular project and decided to just make some easy static wrappers in the project.


#4

Ah ok - yeah whatever you do in your project is of course entirely up to you :slight_smile: So in that case, use the code snippet I posted above.