Skip to content

aquanox/BlueprintComponentReferencePlugin

Repository files navigation

GitHub release GitHub license GitHub forks GitHub stars UE5 UE4

Blueprint Component Reference Plugin for Unreal Engine

Blueprint Component Reference Plugin provides a struct and set of accessors that allow referencing actor components from blueprint editor details view with a component picker, it automatically identifies context and builds list of components for selection menu.

Features

Plugin provides component picker in following use cases:

  • Actor class member UPROPERTY
  • Struct member UPROPERTY within Actor class or blueprint.
  • Local variable in an Actor Blueprint.
  • Function local variable in an Actor Blueprint.
  • Generic member UPROPERTY (if ActorClass meta specifier is used).
  • Generic Blueprint variable (if ActorClass meta specifier is used).
  • Array in one of above
  • Set in one of above
  • Map (Key or value) in one of above

Component Selection Customizations

Component reference property display can be customized with UPROPERTY meta specifiers.

Component Filtering:

  • AllowedClasses - List of classes for component filter
  • DisallowedClasses - List of classes for component filter
  • ShowNative - Include native (created with CreateDefaultSubobject) components in picker. Default = True.
  • ShowBlueprint - Include blueprint (added in Blueprint Editor) components in picker. Default = True.
  • ShowInstanced - Include instanced components with assosicated property in picker. Default = False.
  • ShowHidden - Include any components without associated property in picker. Default = False.
  • ShowEditor - Include editor-only components in picker. Default = True.

Item Display:

  • NoClear - Hide 'Clear' button. Default = False.
  • NoNavigate - Hide 'Navigate to' button. Default = False.
  • NoPicker - Disable component picker. Default = False. Deprecated.
  • ComponentViewMode - Specifies component viewer display mode. Values: [Off, Menu, Table, Default]

Out-of-Actor Use:

  • ActorClass - Class to use for component selection dropdown if context detection is not possible.

Blueprint variables supported via variable editor extension.

Unreal Engine Versions

Plugin is compatible with 4.27, 5.0+, ue5-main and can be modified to work with other engine versions.

License

Blueprint Component Reference Plugin is available under the MIT license. See the LICENSE file for more info.

Examples

UCLASS()
class ABCRTestActor : public AInfo
{
	GENERATED_BODY()
public:
    /** Reference to any component within current class */
    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    FBlueprintComponentReference SimpleReference;
    
    /** Reference to any native component within current class */
    UPROPERTY(EditAnywhere, BlueprintReadOnly, meta=(ShowNative=true, ShowBlueprint=false))
    FBlueprintComponentReference NativeOnlyReference;
    
    /** Reference to any component within current class */
    UPROPERTY(EditAnywhere, BlueprintReadOnly, meta=(AllowedClasses="/Script/Engine.SceneComponent"))
    FBlueprintComponentReference SceneCompReference;
	
    /** Reference to any component within current class, picker would use table view mode */
    UPROPERTY(EditAnywhere, BlueprintReadOnly, meta=(ComponentViewMode=Table))
    FBlueprintComponentReference ReferenceWithTableView;
};

UCLASS()
class UBCRTestDataAsset : public UDataAsset
{
	GENERATED_BODY()
public:
    /** Reference to any component within a BCRTestActor class */
    UPROPERTY(EditAnywhere, meta=(ActorClass="/Script/BlueprintComponentReferenceTests.BCRTestActor"))
    FBlueprintComponentReference ExternalRef;
};

void AMyActor::Foo()
{
    if (auto* Component = Reference.GetComponent<UBCRActorComponent>(this))
    {
        Component->Activate();
    }
}

Code examples can be found in BCRTestActor.h

Editor View:

Details View Menu mode:

Details View Table mode:

Blueprint Graph Nodes:

Example use: