Announcement

Collapse
No announcement yet.

How to create a DetailBuilder to show properties in a plugin tab?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to create a DetailBuilder to show properties in a plugin tab?

    I'm trying to display properties of my class in a plugin tab, not in the detail window.

    In the docs, https://docs.unrealengine.com/en-US/...ion/index.html


    Property Handles

    The two main functions of property handles are to read and write the value of a property and to identify the property to Slate customization widgets. How properties are accessed by the details view/property tree is somewhat complicated, so property handles hide all that away and handles undo/redo, pre/post edit change, package dirtying, world switching etc., for you.

    To get a property handle, you must ask the IDetailCategory where you want to customize it for one. You do this by calling IDetailCategory::GetProperty. Usually you simply pass in the name of the property as follows:
    Code:
    IDetailCategoryBuilder& LightingCategory = DetailBuilder.EditCategory( "Lighting" );
    // Get a handle to the "bOverrideLightmapRes" property
    TSharedPtr<IPropertyHandle> OverrideLightmapRes = LightingCategory.GetProperty( "bOverrideLightmapRes" );

    How to create a DetailBuilder?

    There is only a single IDetailCategoryBuilder implementation called FDetailCategoryImpl in UnrealEngine\Engine\Source\Editor\PropertyEditor\Private\DetailCategoryBuilderImpl.h. I don't think I can use it.

    #2
    Just found out:

    Code:
    class MyDetailCustomization : IDetailCustomization
    {
    public:
        void CustomizeDetails( IDetailLayoutBuilder& DetailBuilder) override
        {
            //use DetailBuilder
        }
    };
    
    TSharedRef<class IDetailCustomization> OnGetDetailCustomization()
    {
        return MakeShared<MyDetailCustomization>();
    }
    
    //...
    DetailsPanel->SetGenericLayoutDetailsDelegate(FOnGetDetailCustomizationInstance::CreateStatic(&OnGetDetailCustomization));
    I never noticed SetGenericLayoutDetailsDelegate before.
    Last edited by zwcloud; 01-02-2020, 05:10 AM.

    Comment


      #3
      But this seems to be appending UI widgets to the original DetailsView, not replacing. I want to replace the original UI and create UI myself. I have noticed RegisterInstancedCustomPropertyLayout but it just did nothing: call it or not will have no effect on the UI.

      Comment


        #4
        Property handles, for no obvious good reason, seem to be tied to detail customizations.

        You can create detail views anywhere though, with variants for objects, structs and single properties.
        The standard one is tied to one or more objects, and as you say, the generic layout delegate will append its customization to UI generated for the objects. There's nothing stopping you from setting the object to nullptr though, in which case you'll just get whatever you add in the generic delegate.

        The instanced layout is for customizing specific object types - like normal detail customizations, but applied only to a specific details view widget.

        Comment

        Working...
        X