1

I have a master class called Door, and this door has 3 variables, aimationDuration, Start Delay and an Enum with 2 options - ClosingDoor and OpeningDoor. Now, I would like to know if its possible when I choose ClosingDoor the editor will display only the animationDuration variable and hide the StartDelay variable, and then choose the openingDoor and hide the animationDuration and show the StartDelay. Is this possible or is there another way to accomplish this?

1
  • can you please add more code in your question? Like this people should be able to test a sample :)
    – pix
    Nov 7, 2017 at 10:20

2 Answers 2

4

There were improvements related to MetaTags since this question was asked and answered.

Starting with UE4.23:

The EditCondition meta tag is no longer limited to a single boolean property. It is now evaluated using a full-fledged expression parser, meaning you can include a full C++ expression.

This means we can do things like disabling (or even hiding) a property based on the value of an enum UPROPERTY. Hiding can be achieved by using the EditConditionHides MetaTag. Example:

UENUM(BlueprintType)
enum class EInterpolationMode : uint8 { Linear, Curve };

USTRUCT(BlueprintType)
struct FBlendableInterpolationData
{
    GENERATED_BODY()

    UPROPERTY(BlueprintReadWrite, EditAnywhere)
    EInterpolationMode InterpolationMode = EInterpolationMode::Linear;

    UPROPERTY(EditAnywhere, meta = (EditCondition = "InterpolationMode == EInterpolationMode::Linear", EditConditionHides))
    float Duration;

    UPROPERTY(EditAnywhere, meta = (EditCondition = "InterpolationMode == EInterpolationMode::Curve", EditConditionHides))
    UCurveFloat* Curve;
};

WARNING: There is a special case where EditConditionHides can crash the editor for engine versions 4.26 and 4.27.

More examples for property disabling/hiding can be found here: https://thomassampson.co.uk/posts/ue4-uproperty-editcondition/

0

There is infact exactly something for this, but it might require a little bit of hackery as you need ENUM values and the method seems to be for boolean values.

Unreal's metadata specifiers have a 'editcondition' specifier that lets you point to a boolean variable and say, when that variable is true, let me edit this property, and it doesn't matter what the property is it works for everything.

Here's an example from the Unreal answerhub with some code:

https://answers.unrealengine.com/questions/189864/hide-and-show-variable-in-property-window.html

If the boolean method works for you that's great, otherwise you'll need to look into overriding AActor::PostEditChangeProperty() in order to do a hack where when you change the enum values, it sets a boolean value in that function (which gets called after any change in the property window for an actor), and then should work as you need it to.

If you actually want proper hiding/showing that's more complicated and requires you to use Slate which I have no idea of but here's the documentation:

https://docs.unrealengine.com/latest/INT/Programming/Slate/DetailsCustomization/index.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.