/** * Determines whether or not a property should be visible in the default generated detail layout * * @param PropertyNode The property node to check * @param ParentNode The parent property node to check * @return true if the property should be visible */ static bool IsVisibleStandaloneProperty(const FPropertyNode& PropertyNode, const FPropertyNode& ParentNode) { const UProperty* Property = PropertyNode.GetProperty(); const UArrayProperty* ParentArrayProperty = Cast<const UArrayProperty>(ParentNode.GetProperty()); bool bIsVisibleStandalone = false; if(Property) { if(Property->IsA(UObjectPropertyBase::StaticClass())) { // Do not add this child node to the current map if its a single object property in a category (serves no purpose for UI) bIsVisibleStandalone = !ParentArrayProperty && (PropertyNode.GetNumChildNodes() == 0 || PropertyNode.GetNumChildNodes() > 1); } else if(Property->IsA(UArrayProperty::StaticClass()) || (Property->ArrayDim > 1 && PropertyNode.GetArrayIndex() == INDEX_NONE)) { // Base array properties are always visible bIsVisibleStandalone = true; } else { bIsVisibleStandalone = true; } } return bIsVisibleStandalone; }
bool FPropertyEditor::GetEditConditionPropertyAddress( UBoolProperty*& ConditionProperty, FPropertyNode& InPropertyNode, TArray<FPropertyConditionInfo>& ConditionPropertyAddresses ) { bool bResult = false; bool bNegate = false; UBoolProperty* EditConditionProperty = PropertyCustomizationHelpers::GetEditConditionProperty(InPropertyNode.GetProperty(), bNegate); if ( EditConditionProperty != NULL ) { FPropertyNode* ParentNode = InPropertyNode.GetParentNode(); check(ParentNode); UProperty* Property = InPropertyNode.GetProperty(); if (Property) { bool bStaticArray = (Property->ArrayDim > 1) && (InPropertyNode.GetArrayIndex() != INDEX_NONE); if (bStaticArray) { //in the case of conditional static arrays, we have to go up one more level to get the proper parent struct. ParentNode = ParentNode->GetParentNode(); check(ParentNode); } } auto ComplexParentNode = ParentNode->FindComplexParent(); if (ComplexParentNode) { for (int32 Index = 0; Index < ComplexParentNode->GetInstancesNum(); ++Index) { TWeakObjectPtr<UObject> Object = ComplexParentNode->GetInstanceAsUObject(Index); if( Object.IsValid() ) { UObject* Obj = Object.Get(); // Get the address corresponding to the base of this property (i.e. if a struct property, set BaseOffset to the address of value for the whole struct) uint8* BaseOffset = ParentNode->GetValueAddress((uint8*)Obj); check(BaseOffset != NULL); FPropertyConditionInfo NewCondition; // now calculate the address of the property value being used as the condition and add it to the array. NewCondition.Address = EditConditionProperty->ContainerPtrToValuePtr<uint8>(BaseOffset); NewCondition.bNegateValue = bNegate; ConditionPropertyAddresses.Add(NewCondition); bResult = true; } } } } if ( bResult ) { // set the output variable ConditionProperty = EditConditionProperty; } return bResult; }