I’m trying to conditionally hide a property from the details panel based on what CanEditChange returns. In general it works well when using the EditCondition and EditConditionHides specifier. Am I doing something wrong?
The property is displayed as read-only right now, but not hidden.
.h:
UCLASS(DisplayName="Complete Quest Task")
class GREENHEAVEN_API UGH_DE_CompleteTask : public UGH_DE_QuestBase
{
...
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly)
TSubclassOf<UQuestTask> QuestTask;
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, meta=(EditConditionHides))
bool FillProgressToMax;
...
#if WITH_EDITOR
virtual bool CanEditChange(const FProperty* InProperty) const override;
#endif
};
.cpp:
bool UGH_DE_CompleteTask::CanEditChange(const FProperty* InProperty) const
{
bool bCanEditChange = Super::CanEditChange(InProperty);
if (InProperty->GetFName() == GET_MEMBER_NAME_CHECKED(ThisClass, FillProgressToMax))
{
bCanEditChange = bCanEditChange && QuestTask && QuestTask->GetDefaultObject<UQuestTask>()->ProgressRequired > 0;
}
return bCanEditChange;
}