Skip to content

Commit 53f1c23

Browse files
authored
Merge pull request #1 from JanSeliv/develop
Develop
2 parents a24df1e + 5b97a31 commit 53f1c23

10 files changed

Lines changed: 145 additions & 19 deletions

File tree

.gitignore

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Visual Studio 2015 user specific files
2+
.vs/
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
22+
# Compiled Static libraries
23+
*.lai
24+
*.la
25+
*.a
26+
*.lib
27+
28+
# Executables
29+
*.exe
30+
*.out
31+
*.app
32+
*.ipa
33+
34+
# These project files can be generated by the engine
35+
*.xcodeproj
36+
*.xcworkspace
37+
*.sln
38+
*.suo
39+
*.opensdf
40+
*.sdf
41+
*.VC.db
42+
*.VC.opendb
43+
44+
# Precompiled Assets
45+
SourceArt/**/*.png
46+
SourceArt/**/*.tga
47+
48+
# Binary Files
49+
Binaries/*
50+
Plugins/*/Binaries/*
51+
52+
# Builds
53+
Build/*
54+
55+
# Whitelist PakBlacklist-<BuildConfiguration>.txt files
56+
!Build/*/
57+
Build/*/**
58+
!Build/*/PakBlacklist*.txt
59+
60+
# Don't ignore icon files in Build
61+
!Build/**/*.ico
62+
63+
# Built data for maps
64+
*_BuiltData.uasset
65+
66+
# Configuration files generated by the Editor
67+
Saved/*
68+
69+
# Compiled source files for the engine to use
70+
Intermediate/*
71+
Plugins/*/Intermediate/*
72+
73+
# Cache files for the editor to use
74+
DerivedDataCache/*
-239 KB
Binary file not shown.
8 KB
Binary file not shown.
-241 KB
Binary file not shown.
8 KB
Binary file not shown.

FunctionPicker.uplugin

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"Version": 1,
44
"VersionName": "1.0",
55
"FriendlyName": "Function Picker",
6-
"Description": "Plugin allows select the function right in the uproperty.",
6+
"Description": "Plugin allows choose a function for a specific property from any blueprint.",
77
"Category": "Programming",
88
"CreatedBy": "Yevhenii Selivanov",
9-
"CreatedByURL": "https://github.com/JanSeliv/Bomber",
9+
"CreatedByURL": "https://github.com/JanSeliv/FunctionPicker",
1010
"DocsURL": "",
1111
"MarketplaceURL": "",
1212
"SupportURL": "mailto:janseliw@gmail.com",
13-
"EngineVersion": "5.1.0",
13+
"EngineVersion": "5.1",
1414
"EnabledByDefault": true,
1515
"CanContainContent": false,
1616
"IsBetaVersion": false,
@@ -26,11 +26,5 @@
2626
"Type": "Editor",
2727
"LoadingPhase": "Default"
2828
}
29-
],
30-
"Plugins": [
31-
{
32-
"Name": "MyEditorUtils",
33-
"Enabled": true
34-
}
3529
]
3630
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Yevhenii Selivanov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ƒ Function Picker
2+
3+
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.
4+
5+
![FunctionPicker](https://github.com/JanSeliv/FunctionPicker/assets/20540872/6371cfb4-7e4e-4f4e-84e6-12eab9adb375)
6+
7+
## 📚 Documentation
8+
9+
Detailed documentation about the Function Picker can be found [here](https://docs.google.com/document/d/1OcSFNPq_ZU5jt3nuFPSXep7BEQu5bC2CMEpWwsUJhxY).
10+
11+
## 🎓 Sample Projects
12+
13+
Check out our [Release](https://github.com/JanSeliv/FunctionPicker/releases) page a sample project showcasing the Function Picker.
14+
15+
Also, explore this [game project repository](https://github.com/JanSeliv/Bomber) to view the Function Picker in action.
16+
17+
## 📅 Changelog
18+
#### 2023-06-09
19+
- 🎉 Initial public release.
20+
21+
## 📫 Feedback & Contribution
22+
23+
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.
24+
25+
## 📜 License
26+
27+
This project is licensed under the terms of the MIT license. See [LICENSE](LICENSE) for more details.
28+
29+
We hope you find this plugin useful and we look forward to your feedback and contributions.

Source/FunctionPicker/Private/FunctionPickerData/FunctionPicker.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const FFunctionPicker FFunctionPicker::Empty = FFunctionPicker();
88
// Custom constructor to set all members values
99
FFunctionPicker::FFunctionPicker(UClass* InFunctionClass, FName InFunctionName)
1010
: FunctionClass(InFunctionClass)
11-
, FunctionName(InFunctionName) {}
11+
, FunctionName(InFunctionName) {}
1212

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

2121
if (FunctionClass
22-
&& !FunctionName.IsNone())
22+
&& !FunctionName.IsNone())
2323
{
2424
UFunction* FoundFunction = FunctionClass->FindFunctionByName(FunctionName, EIncludeSuperFlag::ExcludeSuper);
2525
CachedFunctionInternal = FoundFunction;
@@ -29,11 +29,10 @@ UFunction* FFunctionPicker::GetFunction() const
2929
return nullptr;
3030
}
3131

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

3938
// Creates a hash value

Source/FunctionPicker/Public/FunctionPickerData/FunctionPicker.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,36 @@ struct FUNCTIONPICKER_API FFunctionPicker
3838
FFunctionPicker(UClass* InFunctionClass, FName InFunctionName);
3939

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

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

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

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

54+
/** Returns string in text format: Class::Function. */
55+
FString ToDisplayString() const;
56+
5457
/** Compares for equality.
5558
* @param Other The other object being compared. */
56-
bool operator==(const FFunctionPicker& Other) const;
59+
FORCEINLINE bool operator==(const FFunctionPicker& Other) const { return GetTypeHash(*this) == GetTypeHash(Other); }
5760

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

65+
/** bool operator */
66+
FORCEINLINE operator bool() const { return IsValid(); }
67+
68+
/** FName operator */
69+
FORCEINLINE operator FName() const { return FunctionName; }
70+
6271
protected:
6372
/** Contains cached function ptr for performance reasons. */
6473
mutable TWeakObjectPtr<UFunction> CachedFunctionInternal = nullptr;

0 commit comments

Comments
 (0)