From 3a3f0c027115f171a7f1da2747493d4a71b5e08d Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 19 Oct 2024 21:33:20 -0400 Subject: [PATCH] 63. Ghost Globe --- .vscode/c_cpp_properties.json | 3 +- GASATHON.code-workspace | 20 +++++++ .../Win64/UnrealEditor-GasaEditor.dll | 2 +- Project/Gasa.uproject | 10 ++-- Project/Source/Gasa/GasaCommon.h | 2 +- Project/Source/Gasa/UI/GlobeProgressBar.cpp | 54 +++++++++++++++++- Project/Source/Gasa/UI/GlobeProgressBar.h | 26 ++++++++- Project/Source/GasaGen/gen.cpp | 3 +- Rengerate Unreal Project Files.lnk | Bin 1095 -> 1089 bytes 9 files changed, 108 insertions(+), 12 deletions(-) create mode 100644 GASATHON.code-workspace diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index aa85bfc..1d5fae5 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -9,7 +9,8 @@ "_DEBUG", "UNICODE", "_UNICODE", - "GASA_INTELLISENSE_DIRECTIVES=1" + "GASA_INTELLISENSE_DIRECTIVES=1", + "WITH_EDITOR=1", ], "windowsSdkVersion": "10.0.22621.0", "compilerPath": "cl.exe" diff --git a/GASATHON.code-workspace b/GASATHON.code-workspace new file mode 100644 index 0000000..5d2ec8b --- /dev/null +++ b/GASATHON.code-workspace @@ -0,0 +1,20 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../Surgo/UE" + } + ], + "settings": { + "autoHide.autoHideSideBar": false, + "autoHide.autoHidePanel": false, + "files.associations": { + "*.rmd": "markdown", + "*.ipp": "cpp", + "__hash_table": "cpp", + "string": "cpp" + } + } +} \ No newline at end of file diff --git a/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll b/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll index 7804e91..1cb5d39 100644 --- a/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll +++ b/Project/Binaries/Win64/UnrealEditor-GasaEditor.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c4d8f779d383418aaffb7201fcacaf7234dc549691c8b11343b0205869a67bdb +oid sha256:87d9080034e6e697cb0457875a7c667ae01ef5da077e74f113491aac544d4bd5 size 81408 diff --git a/Project/Gasa.uproject b/Project/Gasa.uproject index b33ad17..9e9492c 100644 --- a/Project/Gasa.uproject +++ b/Project/Gasa.uproject @@ -210,8 +210,7 @@ "SupportedTargetPlatforms": [ "Win64", "Linux", - "Android", - "VisionOS" + "Android" ] }, { @@ -293,8 +292,7 @@ "SupportedTargetPlatforms": [ "Win64", "Linux", - "Android", - "VisionOS" + "Android" ] }, { @@ -340,6 +338,10 @@ { "Name": "LiveUpdateForSlate", "Enabled": true + }, + { + "Name": "SunPosition", + "Enabled": true } ] } \ No newline at end of file diff --git a/Project/Source/Gasa/GasaCommon.h b/Project/Source/Gasa/GasaCommon.h index f8ab2ef..b2354b5 100644 --- a/Project/Source/Gasa/GasaCommon.h +++ b/Project/Source/Gasa/GasaCommon.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "GasaEngineMinimal.h" diff --git a/Project/Source/Gasa/UI/GlobeProgressBar.cpp b/Project/Source/Gasa/UI/GlobeProgressBar.cpp index 134de82..264f9b0 100644 --- a/Project/Source/Gasa/UI/GlobeProgressBar.cpp +++ b/Project/Source/Gasa/UI/GlobeProgressBar.cpp @@ -8,6 +8,7 @@ #include "Components/OverlaySlot.h" #include "Blueprint/WidgetBlueprintGeneratedClass.h" #include "Blueprint/WidgetTree.h" +#include "TimerManager.h" #include "Extensions/WidgetBlueprintGeneratedClassExtension.h" #if WITH_EDITOR @@ -61,6 +62,11 @@ void UGlobeProgressBar::GenerateDesignerWidgetTemplate() #endif } +void UGlobeProgressBar::GhostPercentUpdateViaTimer() +{ + GhostTargetPercent = Bar->GetPercent(); +} + #pragma region Bindings void UGlobeProgressBar::SetBezelStyle(FSlateBrush brush) { @@ -78,6 +84,11 @@ void UGlobeProgressBar::SetBarStyle(FProgressBarStyle style) Bar->SetWidgetStyle( style ); } +void UGlobeProgressBar::SetGhostBarStyle(FProgressBarStyle style) +{ + GhostBar->SetWidgetStyle( style ); +} + void UGlobeProgressBar::SetGlassPadding(FMargin margin) { UOverlaySlot* GlassSlot = CastChecked(Glass->Slot); @@ -91,7 +102,26 @@ void UGlobeProgressBar::SetGlassStyle(FSlateBrush brush) void UGlobeProgressBar::SetPercentage(float CurrentValue, float MaxValue) { - Bar->SetPercent( MaxValue > 0.f ? CurrentValue / MaxValue : 0.f ); + float PreviousValue = Bar->GetPercent(); + float CurrentValueClamped = MaxValue > 0.f ? CurrentValue / MaxValue : 0.f; + Bar->SetPercent( CurrentValueClamped ); + + UWorld* World = GetWorld(); + FTimerManager& TM = World->GetTimerManager(); + + if ( CurrentValueClamped < PreviousValue ) + { + // Timer will auto-clear previous set delay + TM.SetTimer( GhostPercentChangeTimer, this, & UGlobeProgressBar::GhostPercentUpdateViaTimer, GhostPercentChangeDelay ); + } + else + { + if ( TM.TimerExists( GhostPercentChangeTimer )) + TM.ClearTimer( GhostPercentChangeTimer ); + + GhostBar->SetPercent( CurrentValueClamped ); + GhostTargetPercent = CurrentValueClamped; + } } void UGlobeProgressBar::SetSize(float width, float height) @@ -131,10 +161,31 @@ void UGlobeProgressBar::NativePreConstruct() DesiredFocusWidget.Resolve(WidgetTree); + // Basic initialization + { + GhostTargetPercent = Bar->GetPercent(); + GhostBar->SetPercent( GhostTargetPercent ); + } + // Blueprint Callback PreConstruct(bIsDesignTime); } +void UGlobeProgressBar::NativeTick(const FGeometry& MyGeometry, float InDeltaTime) +{ + Super::NativeTick(MyGeometry, InDeltaTime); + + UWorld* World = GetWorld(); + FTimerManager& TM = World->GetTimerManager(); + + // Ghost Percent Interpolation + if ( ! TM.TimerExists( GhostPercentChangeTimer )) + { + float NextPercent = FMath::FInterpTo( GhostBar->GetPercent(), GhostTargetPercent, InDeltaTime, GhostPercentInterpolationSpeed ); + GhostBar->SetPercent( NextPercent ); + } +} + void UGlobeProgressBar::Serialize(FArchive& Ar) { Super::Serialize(Ar); @@ -145,3 +196,4 @@ void UGlobeProgressBar::Serialize(FStructuredArchive::FRecord Record) Super::Serialize(Record); } #pragma endregion UserWidget + diff --git a/Project/Source/Gasa/UI/GlobeProgressBar.h b/Project/Source/Gasa/UI/GlobeProgressBar.h index 3a92387..72725f3 100644 --- a/Project/Source/Gasa/UI/GlobeProgressBar.h +++ b/Project/Source/Gasa/UI/GlobeProgressBar.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "GasaCommon.h" #include "GasaUserWidget.h" @@ -15,6 +15,20 @@ public: // Just learning: https://benui.ca/unreal/build-widgets-in-editor/?utm_medium=social&utm_source=Discord UFUNCTION(CallInEditor, Category="Generate Designer Widget Template") void GenerateDesignerWidgetTemplate(); + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Globe") + float GhostTargetPercent; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Globe") + float GhostPercentInterpolationSpeed; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Globe") + float GhostPercentChangeDelay; + + FTimerHandle GhostPercentChangeTimer; + + UFUNCTION() + void GhostPercentUpdateViaTimer(); #pragma region Bindings UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidgetOptional), Category="Globe") @@ -26,12 +40,15 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidgetOptional), Category="Globe") UGasaImage* Bezel; + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidgetOptional), Category="Globe") + UGasaProgressBar* GhostBar; + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidgetOptional), Category="Globe") UGasaProgressBar* Bar; UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidgetOptional), Category="Globe") UGasaImage* Glass; - + UFUNCTION(BlueprintCallable, Category="Globe") void SetBezelStyle(FSlateBrush brush); @@ -41,6 +58,9 @@ public: UFUNCTION(BlueprintCallable, Category="Globe") void SetBarStyle(FProgressBarStyle style); + UFUNCTION(BlueprintCallable, Category="Globe") + void SetGhostBarStyle(FProgressBarStyle style); + UFUNCTION(BlueprintCallable, Category="Globe") void SetGlassPadding( FMargin margin ); @@ -64,6 +84,8 @@ public: #pragma region UserWidget void NativePreConstruct() override; + + void NativeTick(const FGeometry& MyGeometry, float InDeltaTime); #pragma endregion UserWidget #pragma region Object diff --git a/Project/Source/GasaGen/gen.cpp b/Project/Source/GasaGen/gen.cpp index 6387334..d557b84 100644 --- a/Project/Source/GasaGen/gen.cpp +++ b/Project/Source/GasaGen/gen.cpp @@ -9933,8 +9933,7 @@ namespace parser param->Name = get_cached_string( name ); param->PostNameMacro = post_name_macro; - - param->ValueType = type; + param->ValueType = type; if ( value ) param->Value = value; diff --git a/Rengerate Unreal Project Files.lnk b/Rengerate Unreal Project Files.lnk index 7eb7e3a175bd8db89ebe7cedd0c3cde75b1d0977..476a0f8ce965752ed57b7e1694d28d6653c4408c 100644 GIT binary patch delta 27 hcmX@kagbv}6ceM)=0qkz#>v~6dnOk#yRt9<0RVXE2P6Oh delta 33 mcmX@eahzjA6cf8XgB}pZY>s9UWSsni*>!Rba}Nsx5C8z0#t0e!