x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: alt text

What you really get is: alt text

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

Product Version: UE 4.7
Tags:
more ▼

asked Jun 10 '15 at 01:46 PM in Bug Reports

avatar image

szyszek
600 16 11 36

avatar image Doug E ♦♦ STAFF Jun 10 '15 at 05:29 PM

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

Doug Wilson

avatar image szyszek Jun 11 '15 at 10:42 AM

Hi Doug,

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

avatar image Doug E ♦♦ STAFF Jun 19 '15 at 12:23 PM

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

Doug Wilson

avatar image szyszek Jun 23 '15 at 10:32 AM

Hey Doug,

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: https://github.com/szyszq/BugShowcase

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

avatar image Doug E ♦♦ STAFF Jun 25 '15 at 09:03 PM

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.

avatar image szyszek Jun 25 '15 at 09:41 PM

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?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered Jul 28 '15 at 02:11 AM

avatar image

fed0r
623 21 27 163

avatar image szyszek Jul 28 '15 at 03:27 PM

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());

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

Doug Wilson

more ▼

answered Jul 01 '15 at 08:50 PM

avatar image szyszek Jul 01 '15 at 09:49 PM

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

avatar image Doug E ♦♦ STAFF Jul 02 '15 at 06:27 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question