Created
July 9, 2025 00:16
-
-
Save MajorTomAW/edc44097312fb6ac972e171cfc417423 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "ScriptedAction_OverrideGamepadName.h" | |
| #include "CommonInputBaseTypes.h" | |
| #include "EditorUtilityLibrary.h" | |
| #include UE_INLINE_GENERATED_CPP_BY_NAME(ScriptedAction_OverrideGamepadName) | |
| UScriptedAction_OverrideGamepadName::UScriptedAction_OverrideGamepadName() | |
| { | |
| bIsActionForBlueprints = true; | |
| SupportedClasses.Add(UCommonInputBaseControllerData::StaticClass()); | |
| } | |
| void UScriptedAction_OverrideGamepadName::OverrideGamepadName(FName NewGamepadName) | |
| { | |
| TArray<UObject*> SelectedObjects = UEditorUtilityLibrary::GetSelectedAssets(); | |
| for (UObject* SelectedObject : SelectedObjects) | |
| { | |
| if (const UBlueprint* Blueprint = Cast<UBlueprint>(SelectedObject)) | |
| { | |
| if (UCommonInputBaseControllerData* CDO = | |
| Blueprint->GeneratedClass->GetDefaultObject<UCommonInputBaseControllerData>()) | |
| { | |
| CDO->GamepadName = NewGamepadName; | |
| CDO->PostEditChange(); | |
| CDO->MarkPackageDirty(); | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| #include "AssetActionUtility.h" | |
| #include "ScriptedAction_OverrideGamepadName.generated.h" | |
| UCLASS() | |
| class UScriptedAction_OverrideGamepadName : public UAssetActionUtility | |
| { | |
| GENERATED_BODY() | |
| public: | |
| UScriptedAction_OverrideGamepadName(); | |
| public: | |
| UFUNCTION(BlueprintCallable, Category=CommonInput, CallInEditor) | |
| void OverrideGamepadName(FName NewGamepadName); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment