Skip to content

Commit

Permalink
Merge pull request #1 from JanSeliv/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
JanSeliv authored Jun 9, 2023
2 parents a24df1e + 5b97a31 commit 53f1c23
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 19 deletions.
74 changes: 74 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Visual Studio 2015 user specific files
.vs/

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
*.ipa

# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.sln
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb

# Precompiled Assets
SourceArt/**/*.png
SourceArt/**/*.tga

# Binary Files
Binaries/*
Plugins/*/Binaries/*

# Builds
Build/*

# Whitelist PakBlacklist-<BuildConfiguration>.txt files
!Build/*/
Build/*/**
!Build/*/PakBlacklist*.txt

# Don't ignore icon files in Build
!Build/**/*.ico

# Built data for maps
*_BuiltData.uasset

# Configuration files generated by the Editor
Saved/*

# Compiled source files for the engine to use
Intermediate/*
Plugins/*/Intermediate/*

# Cache files for the editor to use
DerivedDataCache/*
Binary file modified Binaries/Win64/UnrealEditor-FunctionPicker.dll
Binary file not shown.
Binary file modified Binaries/Win64/UnrealEditor-FunctionPicker.pdb
Binary file not shown.
Binary file modified Binaries/Win64/UnrealEditor-FunctionPickerEditor.dll
Binary file not shown.
Binary file modified Binaries/Win64/UnrealEditor-FunctionPickerEditor.pdb
Binary file not shown.
12 changes: 3 additions & 9 deletions FunctionPicker.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "Function Picker",
"Description": "Plugin allows select the function right in the uproperty.",
"Description": "Plugin allows choose a function for a specific property from any blueprint.",
"Category": "Programming",
"CreatedBy": "Yevhenii Selivanov",
"CreatedByURL": "https://github.com/JanSeliv/Bomber",
"CreatedByURL": "https://github.com/JanSeliv/FunctionPicker",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "mailto:janseliw@gmail.com",
"EngineVersion": "5.1.0",
"EngineVersion": "5.1",
"EnabledByDefault": true,
"CanContainContent": false,
"IsBetaVersion": false,
Expand All @@ -26,11 +26,5 @@
"Type": "Editor",
"LoadingPhase": "Default"
}
],
"Plugins": [
{
"Name": "MyEditorUtils",
"Enabled": true
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Yevhenii Selivanov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# ƒ Function Picker

The Function Picker is a user-friendly plugin designed for Unreal Engine 5. It lets you choose a function for a specific property from any available asset or blueprint. You can either call it directly in your code as a callback, or bind the chosen function to a delegate, eliminating the traditional method of hardcoding the binding by referencing the function directly.

![FunctionPicker](https://github.com/JanSeliv/FunctionPicker/assets/20540872/6371cfb4-7e4e-4f4e-84e6-12eab9adb375)

## 📚 Documentation

Detailed documentation about the Function Picker can be found [here](https://docs.google.com/document/d/1OcSFNPq_ZU5jt3nuFPSXep7BEQu5bC2CMEpWwsUJhxY).

## 🎓 Sample Projects

Check out our [Release](https://github.com/JanSeliv/FunctionPicker/releases) page a sample project showcasing the Function Picker.

Also, explore this [game project repository](https://github.com/JanSeliv/Bomber) to view the Function Picker in action.

## 📅 Changelog
#### 2023-06-09
- 🎉 Initial public release.

## 📫 Feedback & Contribution

This is an open-source project and we encourage you to contribute. If you encounter any bugs, or if you have any feature requests, please file an issue in the GitHub repository.

## 📜 License

This project is licensed under the terms of the MIT license. See [LICENSE](LICENSE) for more details.

We hope you find this plugin useful and we look forward to your feedback and contributions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const FFunctionPicker FFunctionPicker::Empty = FFunctionPicker();
// Custom constructor to set all members values
FFunctionPicker::FFunctionPicker(UClass* InFunctionClass, FName InFunctionName)
: FunctionClass(InFunctionClass)
, FunctionName(InFunctionName) {}
, FunctionName(InFunctionName) {}

// Returns the function pointer based on set data to this structure
UFunction* FFunctionPicker::GetFunction() const
Expand All @@ -19,7 +19,7 @@ UFunction* FFunctionPicker::GetFunction() const
}

if (FunctionClass
&& !FunctionName.IsNone())
&& !FunctionName.IsNone())
{
UFunction* FoundFunction = FunctionClass->FindFunctionByName(FunctionName, EIncludeSuperFlag::ExcludeSuper);
CachedFunctionInternal = FoundFunction;
Expand All @@ -29,11 +29,10 @@ UFunction* FFunctionPicker::GetFunction() const
return nullptr;
}

// Compares for equality
bool FFunctionPicker::operator==(const FFunctionPicker& Other) const
// Returns string in text format: Class::Function
FString FFunctionPicker::ToDisplayString() const
{
return Other.FunctionClass->IsChildOf(this->FunctionClass)
&& Other.FunctionName == this->FunctionName;
return IsValid() ? FString::Printf(TEXT("%s::%s"), *FunctionClass->GetName(), *FunctionName.ToString()) : FString();
}

// Creates a hash value
Expand Down
17 changes: 13 additions & 4 deletions Source/FunctionPicker/Public/FunctionPickerData/FunctionPicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,36 @@ struct FUNCTIONPICKER_API FFunctionPicker
FFunctionPicker(UClass* InFunctionClass, FName InFunctionName);

/** The class where function can be found. */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (DisplayName = "Class"))
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (DisplayName = "Class", ShowOnlyInnerProperties))
TObjectPtr<UClass> FunctionClass = nullptr;

/** The function name to choose for specified class.*/
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (DisplayName = "Function"))
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (DisplayName = "Function", ShowOnlyInnerProperties))
FName FunctionName = NAME_None;

/** Returns true if is valid. */
FORCEINLINE bool IsValid() const { return !(*this == Empty); }
FORCEINLINE bool IsValid() const { return FunctionClass && !FunctionName.IsNone(); }

/** Returns the function pointer based on set data to this structure. */
UFunction* GetFunction() const;

/** Returns string in text format: Class::Function. */
FString ToDisplayString() const;

/** Compares for equality.
* @param Other The other object being compared. */
bool operator==(const FFunctionPicker& Other) const;
FORCEINLINE bool operator==(const FFunctionPicker& Other) const { return GetTypeHash(*this) == GetTypeHash(Other); }

/** Creates a hash value.
* @param Other the other object to create a hash value for. */
friend FUNCTIONPICKER_API uint32 GetTypeHash(const FFunctionPicker& Other);

/** bool operator */
FORCEINLINE operator bool() const { return IsValid(); }

/** FName operator */
FORCEINLINE operator FName() const { return FunctionName; }

protected:
/** Contains cached function ptr for performance reasons. */
mutable TWeakObjectPtr<UFunction> CachedFunctionInternal = nullptr;
Expand Down

0 comments on commit 53f1c23

Please sign in to comment.