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"

Show property based on enum

Hi guys,

I would like to have an enum in my classin which the user can select a mode. Based on this mode more properties should show up. Do you know any way to do this. A example is in the skeletal mesh component you can select the animation mode and based on this you can either select an animation blueprint or an animation asset. But I couldn't figure out how to do this

Product Version: UE 4.9
Tags:
more ▼

asked Jan 13 '16 at 11:19 AM in C++ Programming

avatar image

HenningAx
87 8 8 12

avatar image padmalcom Jan 13 '16 at 12:52 PM

You might be looking for UENUM? Using the keyword lets you define an enum type that can be displayed in any slate widget in the editor's UI. Here is an example:

 UENUM(BlueprintType)
 enum class LaneSplitter : uint8
 {
     None UMETA(DisplayName = "None"),
     Color UMETA(DisplayName = "Color"),
     Piles UMETA(DisplayName = "Piles"),
     Grass UMETA(DisplayName = "Grass")
 };
avatar image HenningAx Jan 13 '16 at 01:08 PM

Yeah I got an UENUM in my class and it is shown in the editor properly. But I would like to do, is to have another property that is shown in the editor based on what the user select in the enum

For example I have an

 enum Mode
 {
      ModeA
      ModeB
 }

and 2 properties 1 of the type A and 1 of the type B, if the user selects ModeA I want to shown him property A and let him edit it. But if he selects ModeB, property A is not shown and only property B is shown and can be edited.

avatar image Greywacke Jul 28 '18 at 01:13 PM

Does anyone have an answer for this?

I'm yet to try this, but it seems to me that one has to utilise Details Panel Customisation.

avatar image ps2invader Dec 03 '18 at 02:24 PM

i'm interested to

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

1 answer: sort voted first

No, only property limiting build in features i know is for bools with EditCondition specifier on URPOPERTY(). Beyond that you need to do detail panel customization as Greywacke said. The animation mode is actually done that way in Skeletal Mesh component customization:

https://github.com/EpicGames/UnrealEngine/blob/f509bb2d6c62806882d9a10476f3654cf1ee0634/Engine/Source/Editor/DetailCustomizations/Private/SkeletalMeshComponentDetails.cpp#L107

Other good example is collision profile settings, as it using enums to limit access to other properties of it's struct

https://github.com/EpicGames/UnrealEngine/blob/b70f31f6645d764bcb55829228918a6e3b571e0b/Engine/Source/Editor/DetailCustomizations/Private/CollisionProfileDetails.cpp

more ▼

answered Dec 05 '18 at 12:06 AM

avatar image

Shadowriver
35.7k 926 168 1104

(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