Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode json should be static and accept a string #115

Closed
Ruhrpottpatriot opened this issue Sep 11, 2017 · 1 comment
Closed

Decode json should be static and accept a string #115

Ruhrpottpatriot opened this issue Sep 11, 2017 · 1 comment
Labels
enhancement New feature or request feature request todo Internal development tasks

Comments

@Ruhrpottpatriot
Copy link

Currently the DecodeJson function needs an already pre constructed json object as an input parameter. However this method should be static, take just an input string and return the decoded json object for the user to store. In addition the function should also have two execute node instead of a boolean return node.

This changes would make for cleaner, more concise and less cluttered code, especially in blueprints.

P.S. You create multiple execute nodes for blueprints like this:

// in the .h file
UENUM(BlueprintType)
enum class EMyEnum : uint8
{
    BranchA,
    BranchB
};

UFUNCTION(BlueprintCallable, Category = "Stuff", Meta = (ExpandEnumAsExecs = "Branches"))
void DoSomeBranch(int32 SomeInput, TEnumAsByte<EMyEnum>& Branches)

// in the .cpp file
void AMyClass::DoSomeBranch(int32 SomeInput, TEnumAsByte<EMyEnum>& Branches)
{
    if (SomeInput == 1)
    {
        Branches = EMyEnum::BranchA;
    }
    else
    {
        Branches = EMyEnum::BranchB;
    }
}

Even in cpp you could check the enum out param and switch on that for "multiple return" nodes.

@ufna ufna added enhancement New feature or request feature request todo Internal development tasks labels Oct 4, 2017
@ufna
Copy link
Owner

ufna commented Oct 4, 2017

Thanks for the idea, I'll implement it now :)

@ufna ufna closed this as completed in 94f8c29 Jan 15, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request todo Internal development tasks
Projects
None yet
Development

No branches or pull requests

2 participants