Cant hide inherited properties in Details Customization

Hi,

So I have UBaseClass that looks like this:

UCLASS()
class UBaseClass : public UObject
{
	GENERATED_BODY()
public:

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Base")
	FVector BaseVector;
};

and derived class:

UCLASS()
class UDerivedClass : public UBaseClass
{
	GENERATED_BODY()
public:

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Derived")
	int32 SampleProperty;
};

Now, I’d like to customize DerivedClass details, so I’ve created DerivedClassDetails and in CustomizeDetails function I want to hide BaseVector property. I’m using MarkHiddenByCustomization function like this:

TSharedPtr<IPropertyHandle> BasePropHandle = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(UDerivedClass , BaseVector));

BasePropHandle ->MarkHiddenByCustomization();

But it simply doesnt work - BaseVector property is still visible in DerivedClass details panel. I’ve tried to hide it via Category with same effect.

Another bug I found was that if you try to add a property manually to Details, using CreatePropertyValueWidget() returns empty widget for properties that should have customized details view (like vector). So if you have a code that looks like this:

TSharedPtr<IPropertyHandle> BaseVectorProperty = DetailLayout.GetProperty(GET_MEMBER_NAME_CHECKED(UBaseClass, BaseVector));
BaseVectorProperty->MarkHiddenByCustomization();
OutputCategory.AddCustomRow(LOCTEXT("BaseObjectLabel", "Base"))
	.NameContent()
	[
		BaseVectorProperty->CreatePropertyValueWidget()
	]
	.ValueContent()
	[
		BaseVectorProperty->CreatePropertyValueWidget()
	];

you expect to see row that looks like this:

45817-detailspanel_expected.png

What you really get is:

45818-detailspanel_sadreality.png

Any tips or explanation the logic behind this is much appreciated.

Hey szyszek-

I’m trying to reproduce the same thing you’re seeing and I’m somewhat confused. Where did you add the code for the third and forth code snippets you posted? Additionally, are you able to use the “HideProperties=()” specifier inside the UCLASS macro of your derived class?

Cheers

Hi ,

There is no specifier like HideProperties for UClass in documentation or source code. Could you provide an example?

About the second bug report - I create and register Derived properties customization - DerivedDetails like this:

class FDerivedDetails : public IDetailCustomization
{
public:
	/** Makes a new instance of this detail layout class for a specific detail view requesting it */
	static TSharedRef<IDetailCustomization> MakeInstance();

	// IDetailCustomization interface
	virtual void CustomizeDetails(IDetailLayoutBuilder& DetailLayout) override;
	// End of IDetailCustomization interface
};

And In the CustomizeDetails function you put the last snippet from OP.

Cheers

Hey szyszek-

I apologize, that was an oversight on my part. I meant to say “HideCategories” rather than “HideProperties”. Using HideCategories=(Base) inside the UCLASS of the derived class should hide all properties that are in the Base Category.

If using HideCategories does not give the desired result then could you send me your project so that I can see exactly how you are setting up your classes?

Cheers

Hey ,

HideCategories does not work for me because I want to hide just one property from given category.

I’ve put it on github in a form of a plugin: GitHub - szyszq/BugShowcase: Showing off a bug described in https://answers.unrealengine.com/questions/240512/cant-hide-inherited-properties-in-details-customiz.html

You should be able to put it inside of YourProject/Plugins/BugShowcase and after compiling you should get a button on the LevelToolbar, when you click it, a tab will spawn with 2 property panels.
Panel on the left shows property for UBaseClass and panel on the right shows UDerivedClass properties with some customization that does not work.

Crucial code is inside of DerivedCustomization.cpp, BaseClass.h and DerivedClass files.

Hope you wont have any problems with it,
Thanks

I unzipped the folder into the Plugins of my project and generated project files and build the project again. When I opened the project I did not see any new button in the toolbar and I couldn’t find the plugin in the Plugins window. If you can upload the project to Dropbox you can send me a private link on the forums with the link to download it from there.

I have no problem with posting it here, there you go: https://db.tt/KJH16deu

I just thought it would be easier to get it done via github.

Anyway, ‘BugShowcase’ works on my side and I tested it on two computers with different engine versions so there should be no problem with getting it up. So if you dont mind I’d like to see your project ;D Are you using launcher or source build?

Hey szyszek-

Hiding a specific property inside a category is not supported. One option would be to use AdvancedDisplay which would put the property into a collapsed section of the category. Alternatively you may want to use private instead of public for the property or set the UPROPERTY() macro to not include EditAnywhere so that it won’t show up in the editor.

Cheers

Ummm… thats OK I guess, but what about other bugs I described and recreated? Did you manage to get BugShowcase running? If not, can I see your project please?

I understand its a quite complex and specific bug but dont give up yet please ;B

Hey szyszek-

We encourage unrelated issues to be entered in separate posts to make it easier and faster for others to search for information about a topic. If others have experienced the same problem they can then add their info to the topic as well. I would suggest creating a new post for the plugin issue so that the information isn’t buried within another post. You may also want to check out the github section of the forums where others discuss using plugins and engine source code.

I’ve faced the second problem when making PropertyTypeCustomizations - the solution was to replace

SomeIPropertyHandle->CreatePropertyValueWidget()

with

//void CustomizeChildren(StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, StructCustomizationUtils)
StructBuilder.GenerateStructValueWidget(SomeIPropertyHandle)

As you are trying to do the same thing in Details customization, you will probably have to copypaste this function from the engine, because it is not static. It does this voodo magic (CustomChildBuilder.cpp):

UStructProperty* StructProperty = CastChecked<UStructProperty>( StructPropertyHandle->GetProperty() );
FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
IDetailsViewPrivate& DetailsView = ParentCategory.Pin()->GetDetailsView();
TSharedRef<IDetailsView> DetailsViewPtr = StaticCastSharedRef<IDetailsView>( DetailsView.AsShared() );
FPropertyTypeLayoutCallback LayoutCallback = PropertyEditorModule.GetPropertyTypeCustomization(StructProperty, *StructPropertyHandle, DetailsViewPtr );
if (LayoutCallback.IsValid())
{
    TSharedRef<IPropertyTypeCustomization> CustomStructInterface = LayoutCallback.GetCustomizationInstance();
    return SNew( SStandaloneCustomStructValue, CustomStructInterface, StructPropertyHandle, ParentCategory.Pin().ToSharedRef() );
}

ParentCategory is just a weak pointer to a IDetailCategoryBuilder which you get with DetailBuilder.EditCategory.

I believe you can tackle the first problem with DetailsViewPtr as well, but I’m not really sure how exactly. It just has a bunch of methods related to property visibility.

Thanks! Thats what I was looking for!

And when it comes to hiding derived property - just dont use GET_MEMBER_NAME_CHECKED macro, since it returns property handle with invalid PropertyNode. Instead, to get valid property from DetailLayout use DetailLayout.GetProperty(FName("PropertyName"), UBaseClass::StaticClass());