Naotsun19B / PulldownBuilder

By creating the PulldownContents asset added by this plugin, you can easily add a structure that displays a pull-down menu based on a data table, string table, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PulldownBuilder

Plugin

Description

This plugin allows you to easily create a pull-down structure using a dedicated asset.
For example, you can specify the Row Name of the data table in a pull-down menu like an enum instead of a string.

PulldownDetails

Requirement

Target version : UE4.24 ~ 5.4
Target platform : Windows, Mac, Linux (Runtime module has no platform restrictions)

Installation

Put the Plugins/PulldownBuilder folder in your project's Plugins folder.
Or install from the marketplace.
If the feature is not available after installing the plugin, it is possible that the plugin has not been enabled, so please check if the plugin is enabled from Edit > Plugins.

Usage

・When using C++

/Source/PulldownBuilderTest/PulldownBuilderTest.Build.cs

using UnrealBuildTool;

public class PulldownBuilderTest : ModuleRules
{
	public PulldownBuilderTest(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

		PrivateDependencyModuleNames.AddRange(new string[] { "PulldownStruct" });
	}
}

First, we will use the structure included in the runtime module(PulldownStruct), so add it to the dependent module in [Project].Build.cs.

/Source/PulldownBuilderTest/TestPulldown.h

#pragma once

#include "CoreMinimal.h"
#include "PulldownStructBase.h"
#include "TestPulldown.generated.h"

USTRUCT(BlueprintType)
struct FTestPulldown : public FPulldownStructBase
{
	GENERATED_BODY()
	SETUP_PULLDOWN_STRUCT()

public:
	UPROPERTY(BlueprintReadOnly, EditAnywhere)
	int32 TestInt;

	UPROPERTY(BlueprintReadOnly, EditAnywhere)
	FString TestString;
};

USTRUCT(BlueprintType)
struct FTestPulldown2 : public FPulldownStructBase
{
	GENERATED_BODY()
	SETUP_PULLDOWN_STRUCT()
};

Next, define a structure that inherits from FPulldownStructBase included in the runtime module(PulldownStruct). You can define variables in addition to the string selected in the pull-down menu.
The structure defined here is the structure for which the pull-down menu is displayed.
By using 'SETUP_PULLDOWN_STRUCT' added in version 2.4, you can now see which asset uses which pulldown structure and which value in the reference viewer.
Please note that by resaving assets created with the previous version, the contents of the reference viewer will be updated.

CreatePulldownContents

Then build, launch the editor, and create a PulldownContents asset in the Content Browser.

PulldownStructType

Open the created asset and set Pulldown Struct Type to the structure defined earlier.
You can't set the same structure for multiple PulldownContents assets.

PulldownListGenerator

Next, set the class that builds the list from which the pull-down menu is based.
See the Pulldown List Generator section below for the classes that build lists.

Preview

With the settings up to this point, you can see the pull-down menu built by this PulldownContents asset in Preview.
After that, if you use a structure defined by variables or function arguments, the pull-down menu will be displayed automatically.

PulldownPin PulldownDetails

・When don't using C++

CreatePulldownContents

First, create a PulldownContents asset in the Content Browser.

PulldownListGenerator

Next, set the class that builds the list from which the pull-down menu is based.
See the PulldownListGenerator section below for the classes that build lists.

Preview

With the settings up to this point, you can see the pull-down menu built by this PulldownContents asset in Preview.
After that, if you use NativeLessPulldownStruct for variables and function arguments, the pull-down menu will be displayed automatically.
Unlike the one defined in C++, you can switch the PulldownContents asset from which the pull-down menu is based.

NativeLessPin NativeLessDetails

・PulldownListGenerator

There is PulldownListGenerator as a class that builds the list that is the basis of the pull-down menu. The following three PulldownListGenerators are provided as standard.

Class Function Tooltip
DataTablePulldownListGenerator List the Row Names of the data table assets set in SourceDataTable in the pull-down menu. If there is a variable named "PulldownTooltip" of type FString in the structure used as the row of the Data Table, that string is displayed.
StringTablePulldownListGenerator List the Keys of the string table assets set in SourceStringTable in the pull-down menu. Displays the corresponding character string for each item.
NameArrayPulldownListGenerator List the elements of the array in the pull-down menu under SourceNameArray. Displays the character string set in the Value of each item.
InputMappingsPulldownListGenerator List the elements of the input mapping set in the input of the project settings in the pull-down menu. Displays the name of the button corresponding to the input name.

To create your own PulldownListGenerator, inherit the UPulldownListGeneratorBase in C++ or BP and override the GetPulldownRows.
The return value array will be listed in the pull-down menu.
Since the object with the variable being edited and the variable being edited are passed as arguments, the contents of the list generated based on it can be changed.

BP_TestPulldown4PulldownListGenerator-GetPulldownRowsFromBlueprint

EditTestPulldown4.mp4

・RowNameUpdater

If the underlying data of the pull-down menu is updated (for example, the Row Name of the data table has changed), there is a mechanism to replace the already used value with the new name.
The following assets are supported as standard.

Asset type Updater class
Blueprint UBlueprintUpdater
DataTable UDataTableUpdater
DataAsset UDataAssetUpdater

In order to support assets other than these, it is necessary to inherit URowNameUpdaterBase in C ++ and implement the update process.

・Nodes

CompareNodes

Nodes is available that compares pull-down structures of the same type.
If the comparison target is NativeLessPulldownStruct, you can set whether to also compare Pulldown Source of NativeLessPulldownStruct when comparing with Strict Comparison property from node details panel.

SwitchNodes

Switch nodes is available that consists of the items that appear in the pull-down menu of the pull-down structure.
If the target pulldown structure is NativeLessPulldownStruct, the property Pulldown Contents from the node details panel allows you to select the asset that the node's pin items are based on.
Also, if the target pulldown structure is Native Less Pulldown Struct and a value that is not one of the items is passed, it will be output to the default pin.

Settings

EditorPreferences

The items that can be set from the editor preferences are as follows.

Section Item Description
Appearance Panel Size Specifies the panel size of the pull-down menu.
Is Select when Double Click If this flag is true, you will need to double-click to select an item in the pull-down menu.
Should Inline Display When Single Property If this flag is true, automatically inline a single property pull-down structure.
Notification Severity Specifies the severity to focus the message log of notifications issued by this plugin.
Redirect Should Update When Source Row Name Changed Specifies whether to perform automatic update processing of the pull-down menu using RowNameUpdater.
Active Row Name Updater Specifies the RowNameUpdater class to enable. Only the RowNameUpdater set here will perform the update process.

Note

・The PulldownContents asset is an editor-only asset and will not be cooked into the package.

License

MIT License

Author

Naotsun

History

  • (2024/04/24) v2.4
    Added support for UE5.4
    Added a node that converts the pulldown structure to a string with the value set in Selected Value
    Fixed a bug that caused an error on K 2 Node during packaging
    Changed the pulldown content asset to be loaded asynchronously when the editor starts
    It is now possible to specify the vertical and horizontal sizes of the pull-down menu individually in the pull-down content asset
    Fixed a bug that caused a crash when using a pulldown structure in the sequencer key property
    Fixed a bug where the value could not be saved correctly if the default value of the pulldown structure pin contained special characters
    Added a feature that allows you to check which asset uses which pulldown structure and which value in the reference viewer

  • (2023/09/07) v2.3
    Added support for UE5.3
    Added the ability to set the values used at runtime and the data displayed in the pull-down menu on the editor separately
    Added LexFromString function for pulldown structure

  • (2023/06/09) v2.2
    Fixed a bug that the details customization of the pull-down structure was not registered
    Fixed a bug that caused nodes placed in level blueprints to update unnecessarily when the editor was launched
    Added redefinition countermeasures to version-separated macros
    Added LexToString function for pulldown structure

  • (2023/05/16) v2.1
    Fixed a bug that crashes when exiting the editor
    Added macro to indicate if pulldown structure is available
    Added support for UE5.2

  • (2023/03/06) v2.0
    Added compare nodes for NativeLessPulldownStruct
    Added switch nodes for pull-down structure

  • (2023/02/01) v1.9
    Fixed a bug that crashes when starting the editor
    Fixed a bug where generic not equal node was converted to pull-down structure not equal node
    Fixed a bug that the display was not updated when the default value of the graph pin was changed
    Default values can now be copied or pasted from the graph pin context menu
    You can now open the PulldownContents asset underlying the variable pull-down structure from the context menu of the graph pin or details panel

  • (2022/11/08) v1.8
    Fixed a crash when searching for a node when the editor language is other than English
    Fixed a bug that pin value becomes invalid data
    Fixed a bug that the search field did not work properly
    Added support for UE5.1

  • (2022/07/07) v1.7
    Changed to pass the object with the variable being edited and the variable being edited to the argument of GetPulldownRows of PulldownListGenerator

  • (2022/06/12) v1.6
    Added comparison blueprint node between pull-down structures
    The settings related to appearance are saved for each individual, and the settings related to redirect processing are saved in the project share
    Added PulldownListGenerator to generate a pull-down list from the input settings

  • (2022/04/06) v1.5
    Fixed errors when building with strict includes

  • (2021/10/17) v1.4
    Added support for UE5.0

  • (2021/07/29) v1.3
    The pull-down menu widget has been significantly improved so that tooltips can be displayed for each item

  • (2021/06/02) v1.2
    Added the ability to replace already used values with new names when the underlying data in the pull-down menu is updated

  • (2021/05/29) v1.1
    Fixed an issue where specifying a data table created from UserDefinedStruct as a PulldownContents asset would not work properly

  • (2021/05/09) v1.0
    Publish plugin

About

By creating the PulldownContents asset added by this plugin, you can easily add a structure that displays a pull-down menu based on a data table, string table, etc.

License:MIT License


Languages

Language:C++ 98.4%Language:C# 1.4%Language:C 0.2%