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

Commit

Permalink
Finish v1.1-r29.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ufna committed Apr 8, 2020
2 parents 3ac2d5b + ad7c6fa commit f90debf
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
10 changes: 7 additions & 3 deletions Source/VaRest/Private/VaRestSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "Developer/Settings/Public/ISettingsModule.h"
#include "Misc/FileHelper.h"
#include "Misc/Paths.h"
#include "Subsystems/SubsystemBlueprintLibrary.h"

UVaRestSubsystem::UVaRestSubsystem()
: UEngineSubsystem()
Expand All @@ -30,9 +31,6 @@ void UVaRestSubsystem::Deinitialize()

void UVaRestSubsystem::CallURL(const FString& URL, EVaRestRequestVerb Verb, EVaRestRequestContentType ContentType, UVaRestJsonObject* VaRestJson, const FVaRestCallDelegate& Callback)
{
UWorld* World = GetWorld();
check(World);

// Check we have valid data json
if (VaRestJson == nullptr)
{
Expand Down Expand Up @@ -94,6 +92,12 @@ UVaRestJsonObject* UVaRestSubsystem::ConstructVaRestJsonObject()
return NewObject<UVaRestJsonObject>(this);
}

UVaRestJsonObject* UVaRestSubsystem::StaticConstructVaRestJsonObject()
{
auto SelfSystem = CastChecked<UVaRestSubsystem>(USubsystemBlueprintLibrary::GetEngineSubsystem(UVaRestSubsystem::StaticClass()), ECastCheckedType::NullChecked);
return SelfSystem->ConstructVaRestJsonObject();
}

UVaRestJsonValue* UVaRestSubsystem::ConstructJsonValueNumber(float Number)
{
TSharedPtr<FJsonValue> NewVal = MakeShareable(new FJsonValueNumber(Number));
Expand Down
4 changes: 4 additions & 0 deletions Source/VaRest/Public/VaRestSubsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ class VAREST_API UVaRestSubsystem : public UEngineSubsystem
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Construct Json Object"), Category = "VaRest|Subsystem")
UVaRestJsonObject* ConstructVaRestJsonObject();

/** Create new Json object (static one for MakeJson node, hack for #293) */
UFUNCTION()
static UVaRestJsonObject* StaticConstructVaRestJsonObject();

/** Create new Json Number value
* Attn.!! float used instead of double to make the function blueprintable! */
UFUNCTION(BlueprintPure, meta = (DisplayName = "Construct Json Number Value"), Category = "VaRest|Subsystem")
Expand Down
13 changes: 5 additions & 8 deletions Source/VaRestEditor/Private/VaRest_BreakJson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ FText UVaRest_BreakJson::GetMenuCategory() const
if (CachedCategory.IsOutOfDate(this))
{
// FText::Format() is slow, so we cache this to save on performance
CachedCategory.SetCachedText(FEditorCategoryUtils::BuildCategoryString(FCommonEditorCategory::Utilities, LOCTEXT("ActionMenuCategory", "Va Rest")), this);
CachedCategory.SetCachedText(FEditorCategoryUtils::BuildCategoryString(FCommonEditorCategory::Utilities, LOCTEXT("ActionMenuCategory", "VaRest")), this);
}
return CachedCategory;
}
Expand All @@ -273,7 +273,6 @@ void UVaRest_BreakJson::CreateProjectionPins(UEdGraphPin* Source)
#endif

UObject* Subtype = nullptr;
FString FieldName = (*it).Name.ToString();

switch ((*it).Type)
{
Expand All @@ -297,7 +296,7 @@ void UVaRest_BreakJson::CreateProjectionPins(UEdGraphPin* Source)

UEdGraphNode::FCreatePinParams OutputPinParams;
OutputPinParams.ContainerType = (*it).bIsArray ? EPinContainerType::Array : EPinContainerType::None;
UEdGraphPin* OutputPin = CreatePin(EGPD_Output, Type, TEXT(""), Subtype, FName((*(*it).Name.ToString())), OutputPinParams);
UEdGraphPin* OutputPin = CreatePin(EGPD_Output, Type, TEXT(""), Subtype, (*it).Name, OutputPinParams);
}
}

Expand Down Expand Up @@ -340,7 +339,7 @@ class FKCHandler_MakeJson : public FNodeHandlingFunctor
{
UClass* SubsystemClass = Cast<UClass>(StaticLoadObject(UClass::StaticClass(), NULL, TEXT("class'VaRest.VaRestSubsystem'")));

FName FunctionName = TEXT("ConstructVaRestJsonObject");
FName FunctionName = TEXT("StaticConstructVaRestJsonObject");
UFunction* FunctionPtr = SubsystemClass->FindFunctionByName(FunctionName);
FBlueprintCompiledStatement& Statement = Context.AppendStatementForNode(Node);
Statement.Type = KCST_CallFunction;
Expand All @@ -360,7 +359,6 @@ class FKCHandler_MakeJson : public FNodeHandlingFunctor
UEdGraphPin* Pin = Node->Pins[PinIndex];
if (Pin && (EGPD_Input == Pin->Direction))
{

FBPTerminal** Source = Context.NetMap.Find(FEdGraphUtilities::GetNetFromPin(Pin));

#if ENGINE_MINOR_VERSION >= 19
Expand Down Expand Up @@ -548,7 +546,7 @@ FText UVaRest_MakeJson::GetMenuCategory() const
if (CachedCategory.IsOutOfDate(this))
{
// FText::Format() is slow, so we cache this to save on performance
CachedCategory.SetCachedText(FEditorCategoryUtils::BuildCategoryString(FCommonEditorCategory::Utilities, LOCTEXT("ActionMenuCategory", "Va Rest")), this);
CachedCategory.SetCachedText(FEditorCategoryUtils::BuildCategoryString(FCommonEditorCategory::Utilities, LOCTEXT("ActionMenuCategory", "VaRest")), this);
}
return CachedCategory;
}
Expand All @@ -562,7 +560,6 @@ void UVaRest_MakeJson::CreateProjectionPins(UEdGraphPin* Source)
{
FName Type;
UObject* Subtype = nullptr;
FString FieldName = (*it).Name.ToString();

switch ((*it).Type)
{
Expand All @@ -586,7 +583,7 @@ void UVaRest_MakeJson::CreateProjectionPins(UEdGraphPin* Source)

UEdGraphNode::FCreatePinParams InputPinParams;
InputPinParams.ContainerType = (*it).bIsArray ? EPinContainerType::Array : EPinContainerType::None;
UEdGraphPin* InputPin = CreatePin(EGPD_Input, Type, TEXT(""), Subtype, FName((*(*it).Name.ToString())), InputPinParams);
UEdGraphPin* InputPin = CreatePin(EGPD_Input, Type, TEXT(""), Subtype, (*it).Name, InputPinParams);

#if ENGINE_MINOR_VERSION >= 20
InputPin->SetSavePinIfOrphaned(false);
Expand Down
4 changes: 2 additions & 2 deletions Source/VaRestEditor/Public/VaRest_BreakJson.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ enum class EVaRest_JsonType : uint8
USTRUCT(BlueprintType)
struct FVaRest_NamedType
{
GENERATED_USTRUCT_BODY();
GENERATED_USTRUCT_BODY()

UPROPERTY(EditAnywhere, Category = NamedType)
FText Name;
FName Name;

UPROPERTY(EditAnywhere, Category = NamedType)
EVaRest_JsonType Type;
Expand Down
2 changes: 1 addition & 1 deletion VaRest.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"FriendlyName" : "VaRest",
"Version" : 29,
"VersionName" : "1.1-r29",
"VersionName" : "1.1-r29.2",
"CreatedBy" : "Vladimir Alyamkin",
"CreatedByURL" : "https://alyamkin.com",
"EngineVersion" : "4.24.0",
Expand Down

0 comments on commit f90debf

Please sign in to comment.