Skip to content

Commit

Permalink
v1.3.1 (#18)
Browse files Browse the repository at this point in the history
* [InputSystem] try to fix "WhileInputActive"(not possible), "OnInputTriggered" fix activation while ability already active

* [Docs] BlueprintNodes

* Update README.md

* Update UHLAbilitySystemComponent.cpp

* [DebugSubsystem] check Blocks not empty

* [Anim] ANS_UHL_Base add ShouldUseExperimentalUHLFeatures, NotifyEndOrBlendOut

* ANS_EnableRootMotionZAxisMovement land check

* ANS_EnableRootMotionZAxisMovement ground check

* Update README.md

* Update README.md

* [Editor] CustomThumbnails refactoring

* [Debug] experimental debug lines through "AHUD::DrawHUD"

* [Debug] experimental debug lines through "AHUD::DrawHUD" 2

* ANS_UHL_Base fix critical build err

* UUHLTraceUtilsBPL::SweepCapsuleMultiByChannel

* Update README.md

* [BPL] GetMostDistantActor

* [Editor] CustomIcons add classes array support

* [DebugSubsystem] fix RandomColors for DebugCategories

* by default InstancingPolicy = InstancedPerActor

* Revert "by default InstancingPolicy = InstancedPerActor"

This reverts commit 5bf688b.

* update readme.md

* update readme.md
  • Loading branch information
Ciberusps authored Jan 5, 2025
1 parent ae5a64a commit 77ec1fd
Show file tree
Hide file tree
Showing 24 changed files with 555 additions and 84 deletions.
Binary file added Content/BP_UHL_BlueprintNode.uasset
Binary file not shown.
Binary file removed Content/BP_UHL_BlueprintNodes.uasset
Binary file not shown.
50 changes: 41 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ UHL consists of 3 modules:
> - [TurnTo](#turnto)
> - [Subsystems](#subsystems)
> - [DebugSubsystem](#debugsubsystem)
> - [UHLHUD](#uhlhud)
> - [UnrealHelperLibraryBPL](#unrealhelperlibrarybpl)
> - Gameplay
> - GetActorClosestToCenterOfScreen
> - GetMostDistantActor
> - GAS
> - TryActivateAbilityWithTag
> - TryCancelAbilityWithTag
Expand All @@ -122,13 +126,17 @@ UHL consists of 3 modules:
> - [GetPointAtAngleRelativeToOtherActor](#getpointatanglerelativetootheractor)
> - [GetPointAtDirectionRelativeToOtherActor](#getpointatdirectionrelativetootheractor)
> - [DirectionToAngle](#directiontoangle)
> - UI/Screen
> - GetViewportSizeUnscaled
> - Misc
> - [GetProjectVersion](#getprojectversion)
> - [GetNamesOfComponentsOnObject](#getnamesofcomponentsonobject)
> - [GetAssetsOfClass](#getassetsofclass)
> - GetBuildType
> <!-- - GetActorComponentByName -->
> <!-- - GetSceneComponentByName -->
> - Debug
> - DrawDebugLineOnCanvas
> - Other
> - [GetHighestPoint](#gethighestpoint)
> - [LoadingUtilLibrary](#loadingutillibrary)
Expand All @@ -141,7 +149,7 @@ UHL consists of 3 modules:
> - [TraceUtilsBPL](#traceutilsbpl)
> - SweepCapsuleSingleByChannel
> - [Settings](#settings)
> - [UHL Settings](#)
> - [UHL Settings](#uhl-settings)
**UnrealHelperEditor**

Expand Down Expand Up @@ -647,6 +655,22 @@ void AUHLPlayerController::BeginPlay()
How to add DebugCategory:
1)

How to subscribe on debug category change in C++

```c++
UAA_WaitDebugCategoryChange* WaitDebugCategoryChangeTask = UAA_WaitDebugCategoryChange::WaitDebugCategoryChange(
Actor->GetWorld(),
YourGameplayTags::TAG_DebugCategory_Combat // same as FGameplayTag("DebugCategory.Something")
);
WaitDebugCategoryChangeTask->OnChange.AddUniqueDynamic(this, &UCombatSubsystem::OnDebugCategoryChanged);
// on activation "OnDebugCategoryChanged" will be fired
WaitDebugCategoryChangeTask->Activate();
```

#### UHLHUD

HUD with debugging abilities, for now used to display debug bars(e.g. HP/hidden attributes)

### LoadingUtilLibrary

**UHLLoadingUtilLibrary** - loading utils from Lyra
Expand Down Expand Up @@ -684,7 +708,11 @@ if you don't want to copy paste your `AttributeSets`

**Custom thumnails** - to override thumbnail by your own, just implement `IUHECustomThumbnail` interface and define your own icon using `GetCustomThumbnailIcon()`

> [!WARNING]
> ⚠️ NOT sure that blueprints supported for now
```C++
// UInventoryItem.h
#if WITH_EDITOR
#include "UHECustomThumbnail.h"
#endif
Expand All @@ -697,19 +725,23 @@ class IUHECustomThumbnail {};
class GAMECODE_API UInventoryItem : public UObject,
public IUHECustomThumbnail
{
// ...

/** IUHECustomThumbnail **/
/** IUHECustomThumbnail **/
#if WITH_EDITOR
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
UTexture2D* GetCustomThumbnailIcon() { return Description.Icon; };
virtual UTexture2D* GetCustomThumbnailIcon_Implementation() const override;
#endif
/** ~IUHECustomThumbnail **/
}

// ...
```
------------------------------------------------------------------

⚠️ for now works only with C++, TODO add support for blueprints
// UInventoryItem.cpp
#if WITH_EDITOR
UTexture2D* UInventoryItem::GetCustomThumbnailIcon_Implementation()
{
return Description.Icon;
}
#endif
```
Thanks to [this post](https://forums.unrealengine.com/t/custom-thumbnail-not-display-asset-is-never-loaded/143155/2?u=ciberus) and [this](https://forums.unrealengine.com/t/custom-thumbnail-on-blueprint/337532/3?u=ciberus)
Expand Down
7 changes: 6 additions & 1 deletion Source/UnrealHelperEditor/Private/UHECustomThumbnail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@

// Add default functionality here for any IUHECustomThumbnail functions that are not pure virtual.

#include UE_INLINE_GENERATED_CPP_BY_NAME(UHECustomThumbnail)
#include UE_INLINE_GENERATED_CPP_BY_NAME(UHECustomThumbnail)

UTexture2D* IUHECustomThumbnail::GetCustomThumbnailIcon_Implementation() const
{
return nullptr;
}
19 changes: 14 additions & 5 deletions Source/UnrealHelperEditor/Private/UnrealHelperEditorStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,25 @@ TSharedRef< FSlateStyleSet > FUnrealHelperEditorStyle::Create()
FString Path = CustomClassIcon.Texture2D.GetLongPackageName();
UObject* IconImageObject = LoadObject<UObject>(nullptr, *Path);

if (IsValid(IconImageObject) && IsValid(CustomClassIcon.Class))
if (IsValid(IconImageObject))
{
UTexture2D* IconImage = Cast<UTexture2D>(IconImageObject);
// FSlateDynamicImageBrush* DynamicImageBrush = new FSlateDynamicImageBrush(IconImage, Icon20x20, FName("CapsuleHitRegistrator"));
FSlateImageBrush* ImageBrush = new FSlateImageBrush(IconImage, Icon20x20);

FString ClassName = CustomClassIcon.Class->GetName();
// Modify the class icons to use our new awesome icons
FString IconStyleName = FString::Printf(TEXT("ClassIcon.%s"), *ClassName);
Style->Set(FName(IconStyleName), ImageBrush);
TArray<TSubclassOf<UObject>> AllClasses = CustomClassIcon.Classes;
// support deprecated value
if (IsValid(CustomClassIcon.Class))
{
AllClasses.Add(CustomClassIcon.Class);
}
for (const TSubclassOf<UObject> Class : AllClasses)
{
FString ClassName = Class->GetName();
// Modify the class icons to use our new awesome icons
FString IconStyleName = FString::Printf(TEXT("ClassIcon.%s"), *ClassName);
Style->Set(FName(IconStyleName), ImageBrush);
}
}
}

Expand Down
5 changes: 4 additions & 1 deletion Source/UnrealHelperEditor/Public/Development/UHESettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ struct UNREALHELPEREDITOR_API FUHECustomClassIconDescription

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="CustomClassIconDescription")
TSoftObjectPtr<UTexture2D> Texture2D;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="CustomClassIconDescription")
// deprecated, TODO: remove
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="CustomClassIconDescription", meta=(DeprecatedProperty, DeprecationMessage="Deprecated use Classes"))
TSubclassOf<UObject> Class;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="CustomClassIconDescription")
TArray<TSubclassOf<UObject>> Classes;
};

/**
Expand Down
3 changes: 2 additions & 1 deletion Source/UnrealHelperEditor/Public/UHECustomThumbnail.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class UNREALHELPEREDITOR_API IUHECustomThumbnail

/** IUHECustomThumbnail **/
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Custom Thumbnail")
UTexture2D* GetCustomThumbnailIcon();
UTexture2D* GetCustomThumbnailIcon() const;
virtual UTexture2D* GetCustomThumbnailIcon_Implementation() const;
/** ~IUHECustomThumbnail **/
};
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,9 @@ void UUHLAbilitySystemComponent::ProcessAbilityInput(float DeltaTime, bool bGame
{
if (!bUseInputConfig) return;

// TODO: mb check how Lyra use that tag?
if (HasMatchingGameplayTag(UHLGameplayTags::TAG_Gameplay_AbilityInputBlocked))
{
InputPressedSpecHandles.Reset();
InputReleasedSpecHandles.Reset();
InputHeldSpecHandles.Reset();
ClearAbilityInput();
return;
}

Expand All @@ -389,8 +386,7 @@ void UUHLAbilitySystemComponent::ProcessAbilityInput(float DeltaTime, bool bGame
{
if (AbilitySpec->Ability && !AbilitySpec->IsActive())
{
const UUHLGameplayAbility* AbilityCDO = CastChecked<UUHLGameplayAbility>(AbilitySpec->Ability);

const UUHLGameplayAbility* AbilityCDO = Cast<UUHLGameplayAbility>(AbilitySpec->Ability);
if (AbilityCDO->GetActivationPolicy() == EUHLAbilityActivationPolicy::WhileInputActive)
{
AbilitiesToActivate.AddUnique(AbilitySpec->Handle);
Expand All @@ -410,30 +406,25 @@ void UUHLAbilitySystemComponent::ProcessAbilityInput(float DeltaTime, bool bGame
{
AbilitySpec->InputPressed = true;

// TODO: если абилка активна, нужно пытаться все равно ее активировать, а не просто данные слать
// If ability active, we should try to activate it again, instead of sending data

// if (AbilitySpec->IsActive())
// {
// // Ability is active so pass along the input event.
// AbilitySpecInputPressed(*AbilitySpec);
// }
// else
// {
const UUHLGameplayAbility* AbilityCDO = CastChecked<UUHLGameplayAbility>(AbilitySpec->Ability);

if (AbilityCDO->GetActivationPolicy() == EUHLAbilityActivationPolicy::OnInputTriggered)
const UUHLGameplayAbility* AbilityCDO = Cast<UUHLGameplayAbility>(AbilitySpec->Ability);
if (AbilitySpec->IsActive()
// TODO move this logic to "OnInputTriggeredForceReactivate" ??
// If ability active, we should try to activate it again, instead of sending data
// so that's why if "OnInputTriggered" choosed - skip
&& AbilityCDO
&& AbilityCDO->GetActivationPolicy() != EUHLAbilityActivationPolicy::OnInputTriggered)
{
AbilitiesToActivate.AddUnique(AbilitySpec->Handle);

// TODO: testing
// if (AbilitySpec->IsActive())
// {
// Ability is active so pass along the input event.
AbilitySpecInputPressed(*AbilitySpec);
// }
// Ability is active so pass along the input event.
AbilitySpecInputPressed(*AbilitySpec);
}
// }
else
{
// const UUHLGameplayAbility* AbilityCDO = Cast<UUHLGameplayAbility>(AbilitySpec->Ability);
if (AbilityCDO && AbilityCDO->GetActivationPolicy() == EUHLAbilityActivationPolicy::OnInputTriggered)
{
AbilitiesToActivate.AddUnique(AbilitySpec->Handle);
}
}
}
}
}
Expand Down Expand Up @@ -502,6 +493,19 @@ void UUHLAbilitySystemComponent::ProcessAbilityInput(float DeltaTime, bool bGame
{
// Ability is active so pass along the input event.
AbilitySpecInputReleased(*AbilitySpec);

// if "WhileInputActive" EndAbility automatically
// const UUHLGameplayAbility* AbilityCDO = Cast<UUHLGameplayAbility>(AbilitySpec->Ability);
// if (AbilityCDO && AbilityCDO->GetActivationPolicy() == EUHLAbilityActivationPolicy::WhileInputActive)
// {
// const FUHLWhileInputActiveSettings& WhileInputActiveSettings = AbilityCDO->GetWhileInputActiveSettings();
// if (WhileInputActiveSettings.bCancelAbilityAutomatically)
// {
// // "EndAbility" not accessible, so try to cancel if "bCancelAbilityAutomatically"
// AbilitySpec->Ability->CancelAbility(AbilitySpec->Handle, AbilityActorInfo.Get(), AbilitySpec->ActivationInfo, WhileInputActiveSettings.bReplicateEndAbility);
// // AbilitySpec->Ability->EndAbility(AbilitySpec->Handle, AbilityActorInfo.Get(), AbilitySpec->ActivationInfo, WhileInputActiveSettings.bReplicateEndAbility, WhileInputActiveSettings.bMarkAsCanceledOnEnd);
// }
// }
}
}
}
Expand All @@ -513,3 +517,10 @@ void UUHLAbilitySystemComponent::ProcessAbilityInput(float DeltaTime, bool bGame
InputPressedSpecHandles.Reset();
InputReleasedSpecHandles.Reset();
}

void UUHLAbilitySystemComponent::ClearAbilityInput()
{
InputPressedSpecHandles.Reset();
InputReleasedSpecHandles.Reset();
InputHeldSpecHandles.Reset();
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ void UANS_ActivateAbility::NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequ

void UANS_ActivateAbility::OnMontageBlendingOut(UAnimMontage* Montage, bool bInterrupted)
{
if (!bDeactivateOnMontageBlendingOut
|| !CurrentAnimMontage.IsValid()
|| Montage != CurrentAnimMontage)
if (!bDeactivateOnMontageBlendingOut || !Montage)
{
return;
}
Expand Down
Loading

0 comments on commit 77ec1fd

Please sign in to comment.