Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request feature request todo Internal development tasks
Projects
None yet
Development

No branches or pull requests

2 participants