bool FSequencerObjectChangeListener::IsTypeKeyable(const UClass& ObjectClass, const IPropertyHandle& PropertyHandle) const { const UProperty* Property = PropertyHandle.GetProperty(); const UStructProperty* StructProperty = Cast<const UStructProperty>(Property); const UStructProperty* ParentStructProperty = nullptr; const TSharedPtr<IPropertyHandle> ParentHandle = PropertyHandle.GetParentHandle(); if(ParentHandle->IsValidHandle()) { ParentStructProperty = Cast<const UStructProperty>(ParentHandle->GetProperty()); } FString PropertyVarName; bool bFound = false; if( StructProperty ) { bFound = FindPropertySetter( ObjectClass, StructProperty->Struct->GetFName(), StructProperty->GetName() ); } if( !bFound && ParentStructProperty ) { // If the property parent is a struct, see if this property parent can be keyed. (e.g R,G,B,A for a color) bFound = FindPropertySetter( ObjectClass, ParentStructProperty->Struct->GetFName(), ParentStructProperty->GetName() ); } if( !bFound ) { // the property in question is not a struct or an inner of the struct. See if it is directly keyable bFound = FindPropertySetter( ObjectClass, Property->GetClass()->GetFName(), Property->GetName() ); } return bFound; }
bool FSequencerObjectChangeListener::CanKeyProperty(FCanKeyPropertyParams CanKeyPropertyParams) const { const UStructProperty* StructProperty = Cast<const UStructProperty>(CanKeyPropertyParams.PropertyPath.Last()); const UStructProperty* ParentStructProperty = nullptr; if (CanKeyPropertyParams.PropertyPath.Num() > 1) { ParentStructProperty = Cast<const UStructProperty>(CanKeyPropertyParams.PropertyPath[CanKeyPropertyParams.PropertyPath.Num() - 2]); } FString PropertyVarName; bool bFound = false; if ( StructProperty ) { bFound = FindPropertySetter(*CanKeyPropertyParams.ObjectClass, StructProperty->Struct->GetFName(), StructProperty->GetName() ); } if( !bFound && ParentStructProperty ) { // If the property parent is a struct, see if this property parent can be keyed. bFound = FindPropertySetter(*CanKeyPropertyParams.ObjectClass, ParentStructProperty->Struct->GetFName(), ParentStructProperty->GetName()); } if( !bFound ) { // the property in question is not a struct or an inner of the struct. See if it is directly keyable bFound = FindPropertySetter(*CanKeyPropertyParams.ObjectClass, CanKeyPropertyParams.PropertyPath.Last()->GetClass()->GetFName(), CanKeyPropertyParams.PropertyPath.Last()->GetName()); } return bFound; }