FName UTimelineTemplate::GetTrackPropertyName(const FName TrackName) const { const FString TimelineName = TimelineTemplateNameToVariableName(GetFName()); FString PropertyName = FString::Printf(TEXT("%s_%s_%s"), *TimelineName, *TrackName.ToString(), *TimelineGuid.ToString()); SanitizePropertyName(PropertyName); return FName(*PropertyName); }
void print_source_nesting_structure( void ) /*****************************************/ { struct src_item *curr; unsigned tab = 1; /* in main source file? */ if ( src_stack == NULL || src_stack->next == NULL ) return; for( curr = src_stack; curr->next ; curr = curr->next ) { if( curr->type == SIT_FILE ) { PrintNote( NOTE_INCLUDED_BY, tab, "", GetFName( curr->srcfile )->fname, curr->line_num ); tab++; } else { //char fname[_MAX_FNAME+_MAX_EXT]; if (*(curr->mi->macro->name) == NULLC ) { PrintNote( NOTE_ITERATION_MACRO_CALLED_FROM, tab, "", "MacroLoop", curr->line_num, curr->mi->macro->value + 1 ); } else { PrintNote( NOTE_MACRO_CALLED_FROM, tab, "", curr->mi->macro->name, curr->line_num, GetFNamePart( GetFName(((struct dsym *)curr->mi->macro)->e.macroinfo->srcfile)->fname ) ) ; } tab++; } } PrintNote( NOTE_MAIN_LINE_CODE, tab, "", GetFName( curr->srcfile )->fname, curr->line_num ); }
char *GetTextLine( char *buffer ) /*******************************/ { struct src_item *curr = src_stack; if ( curr->type == SIT_FILE ) { if( my_fgets( buffer, MAX_LINE_LEN, curr->file ) ) { curr->line_num++; #ifdef DEBUG_OUT if ( Parse_Pass == PASS_1 ) cntlines++; #endif return( buffer ); } DebugCmd( ModuleInfo.g.FNames[curr->srcfile].lines = curr->line_num ); DebugMsg1(("GetTextLine: ***** EOF file %s (idx=%u) *****\n", GetFName( curr->srcfile )->fname, curr->srcfile )); /* don't close and remove main source file */ if ( curr->next ) { fclose( curr->file ); src_stack = curr->next; curr->next = SrcFree; SrcFree = curr; } /* update value of @FileCur variable */ for( curr = src_stack; curr->type != SIT_FILE; curr = curr->next ); FileCur->string_ptr = GetFName( curr->srcfile)->fname; #if FILESEQ if ( Options.line_numbers && Parse_Pass == PASS_1 ) AddFileSeq( curr->srcfile ); #endif } else { curr->mi->currline = ( curr->mi->currline ? curr->mi->currline->next : curr->mi->startline ); if ( curr->mi->currline ) { /* if line contains placeholders, replace them by current values */ if ( curr->mi->currline->ph_count ) { fill_placeholders( buffer, curr->mi->currline->line, curr->mi->parmcnt, curr->mi->localstart, curr->mi->parm_array ); } else { strcpy( buffer, curr->mi->currline->line ); } curr->line_num++; #ifdef DEBUG_OUT if ( Parse_Pass == PASS_1 ) cntlines++; #endif return( buffer ); } src_stack = curr->next; curr->next = SrcFree; SrcFree = curr; } return( NULL ); /* end of file or macro reached */ }
BOOL MYRTLEXP IsSameFile( const MyString& f1,const MyString& f2 ) { MyString s,s1; //Both path exist if ( f1.Chr(SLASH_CHAR) != -1 && f2.Chr(SLASH_CHAR) != -1 && !CMP_FILE(GetFPath(f1).Text(),GetFPath(f2).Text()) ) return FALSE; return CMP_FILE( GetFName(f1).Text(),GetFName(f2).Text() ); }
void UUserDefinedStruct::ValidateGuid() { // Backward compatibility: // The guid is created in an deterministic way using existing name. if (!Guid.IsValid() && (GetFName() != NAME_None)) { const FString HashString = GetFName().ToString(); ensure(HashString.Len()); const uint32 BufferLength = HashString.Len() * sizeof(HashString[0]); uint32 HashBuffer[5]; FSHA1::HashBuffer(*HashString, BufferLength, reinterpret_cast<uint8*>(HashBuffer)); Guid = FGuid(HashBuffer[1], HashBuffer[2], HashBuffer[3], HashBuffer[4]); } }
void UBTNode::InitializeInSubtree(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, int32& NextInstancedIndex, EBTMemoryInit::Type InitType) const { if (bCreateNodeInstance) { // composite nodes can't be instanced! check(IsA(UBTCompositeNode::StaticClass()) == false); UBTNode* NodeInstance = OwnerComp.NodeInstances.IsValidIndex(NextInstancedIndex) ? OwnerComp.NodeInstances[NextInstancedIndex] : NULL; if (NodeInstance == NULL) { NodeInstance = NewObject<UBTNode>(&OwnerComp, GetClass(), GetFName(), RF_NoFlags, (UObject*)(this)); NodeInstance->InitializeNode(GetParentNode(), GetExecutionIndex(), GetMemoryOffset(), GetTreeDepth()); NodeInstance->bIsInstanced = true; OwnerComp.NodeInstances.Add(NodeInstance); } check(NodeInstance); NodeInstance->SetOwner(OwnerComp.GetOwner()); FBTInstancedNodeMemory* MyMemory = GetSpecialNodeMemory<FBTInstancedNodeMemory>(NodeMemory); MyMemory->NodeIdx = NextInstancedIndex; NodeInstance->OnInstanceCreated(OwnerComp); NextInstancedIndex++; } else { InitializeMemory(OwnerComp, NodeMemory, InitType); } }
FAISenseID UAISense_Blueprint::UpdateSenseID() { #if WITH_EDITOR // ignore skeleton and "old version"-classes if (FKismetEditorUtilities::IsClassABlueprintSkeleton(GetClass()) || GetClass()->HasAnyClassFlags(CLASS_NewerVersionExists) || (GetOutermost() == GetTransientPackage())) { return FAISenseID::InvalidID(); } #endif if (GetClass()->HasAnyClassFlags(CLASS_Abstract) == false) { const NAME_INDEX NameIndex = GetClass()->GetFName().GetDisplayIndex(); const FAISenseID* StoredID = BPSenseToSenseID.Find(NameIndex); if (StoredID != nullptr) { ForceSenseID(*StoredID); } else { const FAISenseID NewSenseID = FAISenseID(GetFName()); ForceSenseID(NewSenseID); BPSenseToSenseID.Add(NameIndex, GetSenseID()); } } return GetSenseID(); }
void AController::Possess(APawn* InPawn) { if (!HasAuthority()) { FMessageLog("PIE").Warning(FText::Format( LOCTEXT("ControllerPossessAuthorityOnly", "Possess function should only be used by the network authority for {0}"), FText::FromName(GetFName()) )); return; } REDIRECT_OBJECT_TO_VLOG(InPawn, this); if (InPawn != NULL) { if (GetPawn() && GetPawn() != InPawn) { UnPossess(); } if (InPawn->Controller != NULL) { InPawn->Controller->UnPossess(); } InPawn->PossessedBy(this); SetPawn(InPawn); // update rotation to match possessed pawn's rotation SetControlRotation( Pawn->GetActorRotation() ); Pawn->Restart(); } }
void EnPartCntSample::Init(pdb_setup::Atoms const& atoms, config_setup::Output const& output) { InitVals(output.statistics.settings.hist); if (enableOut) { stepsPerSample = output.state.files.hist.stepsPerHistSample; uint samplesPerFrame = output.statistics.settings.hist.frequency / stepsPerSample + 1; samplesCollectedInFrame = 0; for (uint b = 0; b < BOXES_WITH_U_NB; ++b) { name[b] = GetFName(output.state.files.hist.sampleName, output.state.files.hist.number, output.state.files.hist.letter, b); samplesE[b] = new double [samplesPerFrame]; samplesN[b] = new uint * [var->numKinds]; for (uint k = 0; k < var->numKinds; ++k) { samplesN[b][k] = new uint [samplesPerFrame]; } outF[b].open(name[b].c_str(), std::ofstream::out); } WriteHeader(); } }
char *GetTopSrcName( void ) /*************************/ { if ( src_stack->type == SIT_MACRO ) return( src_stack->mi->macro->name ); return( GetFName( src_stack->srcfile )->fname ); }
void AActor::DebugShowComponentHierarchy( const TCHAR* Info, bool bShowPosition ) { TArray<AActor*> ParentedActors; GetAttachedActors( ParentedActors ); if( Info ) { UE_LOG( LogActor, Warning, TEXT("--%s--"), Info ); } else { UE_LOG( LogActor, Warning, TEXT("--------------------------------------------------") ); } UE_LOG( LogActor, Warning, TEXT("--------------------------------------------------") ); UE_LOG( LogActor, Warning, TEXT("Actor [%x] (%s)"), this, *GetFName().ToString() ); USceneComponent* SceneComp = GetRootComponent(); if( SceneComp ) { int32 NestLevel = 0; DebugShowOneComponentHierarchy( SceneComp, NestLevel, bShowPosition ); } else { UE_LOG( LogActor, Warning, TEXT("Actor has no root.") ); } UE_LOG( LogActor, Warning, TEXT("--------------------------------------------------") ); }
BOOL CPagePlugins::OnInitDialog() { CPropertyPage::OnInitDialog(); LOCWIN(this); if(!m_Game) return TRUE; for(int i=0; i<m_Game->m_PluginMgr->m_Plugins.GetSize(); i++) { CBPlugin* Plugin = m_Game->m_PluginMgr->m_Plugins[i]; CString ShortName = GetFName(Plugin->m_DllPath); m_PluginList.AddString(ShortName); for(int j=0; j<m_SelectedPlugins.GetSize(); j++) { if(m_SelectedPlugins[j].CompareNoCase(ShortName)==0) m_PluginList.SetCheck(i, 1); } } if(m_PluginList.GetCount() > 0) { m_PluginList.SetCurSel(0); OnLbnSelchangePluginList(); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
TSharedRef<SWidget> UNamedSlot::RebuildWidget() { MyBox = SNew(SBox); if ( IsDesignTime() ) { MyBox->SetContent( SNew(SBox) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(STextBlock) .Text(FText::FromName(GetFName())) ] ); } // Add any existing content to the new slate box if ( GetChildrenCount() > 0 ) { UPanelSlot* ContentSlot = GetContentSlot(); if ( ContentSlot->Content ) { MyBox->SetContent(ContentSlot->Content->TakeWidget()); } } return MyBox.ToSharedRef(); }
void InputInit( void ) /********************/ { struct src_item *fl; #if 0 char path[FILENAME_MAX]; char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; #endif DebugMsg(( "InputInit() enter\n" )); //ModuleInfo.g.cnt_fnames = 0; //ModuleInfo.g.FNames = NULL; //IncludePath = NULL; //src_stack = NULL; SrcFree = NULL; /* v2.11 */ #if FILESEQ FileSeq.head = NULL; #endif #ifdef DEBUG_OUT cntppl0 = 0; cntppl1 = 0; cntppl2 = 0; cnttok0 = 0; cnttok1 = 0; cntflines = 0; cntlines = 0; #endif /* add path of main module to the include path. * v2.12: unnecessary since v2.10, since the directory part of the * current source is added if a file is to be included; see SearchFile(). */ //_splitpath( CurrFName[ASM], drive, dir, NULL, NULL ); //if ( drive[0] || dir[0] ) { // _makepath( path, drive, dir, NULL, NULL ); // AddStringToIncludePath( path ); //} srclinebuffer = LclAlloc( SIZE_SRCLINES + SIZE_TOKENARRAY + SIZE_STRINGBUFFER ); /* the comment buffer is at the end of the source line buffer */ commentbuffer = srclinebuffer + SIZE_SRCLINES - MAX_LINE_LEN; /* behind the comment buffer is the token buffer */ ModuleInfo.tokenarray = (struct asm_tok *)( srclinebuffer + SIZE_SRCLINES ); token_stringbuf = srclinebuffer + SIZE_SRCLINES + SIZE_TOKENARRAY; #ifdef DEBUG_OUT end_tokenarray = (struct asm_tok *)token_stringbuf; end_stringbuf = token_stringbuf + SIZE_STRINGBUFFER; DebugMsg(( "InputInit: srclinebuffer=%p, tokenarray=%p, token_stringbuf=%p end_stringbuf=%p\n", srclinebuffer, ModuleInfo.tokenarray, token_stringbuf, end_stringbuf )); #endif fl = PushSrcItem( SIT_FILE, CurrFile[ASM] ); fl->srcfile = ModuleInfo.srcfile = AddFile( CurrFName[ASM] ); /* setting a function pointer won't work for text macros! */ //FileCur->sfunc_ptr = &GetFileCur; FileCur->string_ptr = GetFName( fl->srcfile )->fname; DebugMsg(( "InputInit() exit\n" )); }
bool UActorComponent::Rename( const TCHAR* InName, UObject* NewOuter, ERenameFlags Flags ) { bRoutedPostRename = false; const FName OldName = GetFName(); const UObject* OldOuter = GetOuter(); const bool bRenameSuccessful = Super::Rename(InName, NewOuter, Flags); const bool bMoved = (OldName != GetFName()) || (OldOuter != GetOuter()); if (!bRoutedPostRename && ((Flags & REN_Test) == 0) && bMoved) { UE_LOG(LogActorComponent, Fatal, TEXT("%s failed to route PostRename. Please call Super::PostRename() in your <className>::PostRename() function. "), *GetFullName() ); } return bRenameSuccessful; }
/* function to get value of @FileCur. * won't work, because text macros don't use asym.sfunc_ptr */ static void GetFileCur( struct asym *sym ) /****************************************/ { struct src_item *curr; for( curr = src_stack; curr && curr->type != SIT_FILE; curr = curr->next ); sym->string_ptr = GetFName( curr->srcfile )->name; DebugMsg1(("GetFileCur: curr value=%s\n", sym->string_ptr )); }
FName UTimelineTemplate::GetEventTrackFunctionName(int32 EventTrackIndex) const { check(EventTrackIndex < EventTracks.Num()); const FName TrackName = EventTracks[EventTrackIndex].TrackName; const FString TimelineName = TimelineTemplateNameToVariableName(GetFName()); FString UpdateFuncString = FString::Printf(TEXT("%s__%s__EventFunc"), *TimelineName, *TrackName.ToString()); return FName(*UpdateFuncString); }
void PPCThread::SetBranch(const u64 pc) { if(!Memory.IsGoodAddr(pc)) { ConLog.Error("%s branch error: bad address 0x%llx #pc: 0x%llx", GetFName(), pc, PC); Emu.Pause(); } nPC = pc; isBranch = true; }
FAISenseID UAISense::UpdateSenseID() { check(HasAnyFlags(RF_ClassDefaultObject) == true && GetClass()->HasAnyClassFlags(CLASS_Abstract | CLASS_CompiledFromBlueprint) == false); if (SenseID.IsValid() == false) { SenseID = FAISenseID(GetFName()); } return SenseID; }
void UActorComponent::PostLoad() { Super::PostLoad(); if (GetLinkerUE4Version() < VER_UE4_ACTOR_COMPONENT_CREATION_METHOD) { if (IsTemplate()) { CreationMethod = EComponentCreationMethod::Native; } else if (bCreatedByConstructionScript_DEPRECATED) { CreationMethod = EComponentCreationMethod::SimpleConstructionScript; } else if (bInstanceComponent_DEPRECATED) { CreationMethod = EComponentCreationMethod::Instance; } if (CreationMethod == EComponentCreationMethod::SimpleConstructionScript) { UBlueprintGeneratedClass* Class = CastChecked<UBlueprintGeneratedClass>(GetOuter()->GetClass()); while (Class) { USimpleConstructionScript* SCS = Class->SimpleConstructionScript; if (SCS != nullptr && SCS->FindSCSNode(GetFName())) { break; } else { Class = Cast<UBlueprintGeneratedClass>(Class->GetSuperClass()); if (Class == nullptr) { CreationMethod = EComponentCreationMethod::UserConstructionScript; } } } } } if (CreationMethod == EComponentCreationMethod::SimpleConstructionScript) { if ((GetLinkerUE4Version() < VER_UE4_TRACK_UCS_MODIFIED_PROPERTIES) && !HasAnyFlags(RF_ClassDefaultObject)) { DetermineUCSModifiedProperties(); } } else { // For a brief period of time we were inadvertently storing these for all components, need to clear it out UCSModifiedProperties.Empty(); } }
void CPUThread::SetBranch(const u64 pc) { if(!Memory.IsGoodAddr(m_offset + pc)) { ConLog.Error("%s branch error: bad address 0x%llx #pc: 0x%llx", GetFName(), m_offset + pc, m_offset + PC); Emu.Pause(); } m_is_branch = true; nPC = pc; }
virtual void Serialize(void* Data, int64 Num) override { // Collect serialized properties so we can later update their values on instances if they change auto SerializedProperty = GetSerializedProperty(); if (SerializedProperty != nullptr) { FCDOProperty& PropertyInfo = PropertyData.Properties.FindOrAdd(SerializedProperty->GetFName()); if (PropertyInfo.Property == nullptr) { PropertyInfo.Property = SerializedProperty; PropertyInfo.SubobjectName = SubobjectName; PropertyInfo.SerializedValueOffset = Tell(); PropertyInfo.SerializedValueSize = Num; PropertyData.Properties.Add(SerializedProperty->GetFName(), PropertyInfo); } else { PropertyInfo.SerializedValueSize += Num; } } FMemoryWriter::Serialize(Data, Num); }
const FString& AActor::GetActorLabel() const { // If the label string is empty then we'll use the default actor label (usually the actor's class name.) // We actually cache the default name into our ActorLabel property. This will be saved out with the // actor if the actor gets saved. The reasons we like caching the name here is: // // a) We can return it by const& (performance) // b) Calling GetDefaultActorLabel() is slow because of FName stuff (performance) // c) If needed, we could always empty the ActorLabel string if it matched the default // // Remember, ActorLabel is currently an editor-only property. if( ActorLabel.IsEmpty() ) { // Treating ActorLabel as mutable here (no 'mutable' keyword in current script compiler) AActor* MutableThis = const_cast< AActor* >( this ); // Get the class UClass* ActorClass = GetClass(); // NOTE: Calling GetName() is actually fairly slow (does ANSI->Wide conversion, lots of copies, etc.) FString DefaultActorLabel = ActorClass->GetName(); // Strip off the ugly "_C" suffix for Blueprint class actor instances UBlueprint* GeneratedByClassBlueprint = Cast<UBlueprint>( ActorClass->ClassGeneratedBy ); if( GeneratedByClassBlueprint != nullptr && DefaultActorLabel.EndsWith( TEXT( "_C" ) ) ) { DefaultActorLabel.RemoveFromEnd( TEXT( "_C" ) ); } // We want the actor's label to be initially unique, if possible, so we'll use the number of the // actor's FName when creating the initially. It doesn't actually *need* to be unique, this is just // an easy way to tell actors apart when observing them in a list. The user can always go and rename // these labels such that they're no longer unique. { // Don't bother adding a suffix for number '0' const int32 NameNumber = NAME_INTERNAL_TO_EXTERNAL( GetFName().GetNumber() ); if( NameNumber != 0 ) { DefaultActorLabel.AppendInt(NameNumber); } } // Remember, there could already be an actor with the same label in the level. But that's OK, because // actor labels aren't supposed to be unique. We just try to make them unique initially to help // disambiguate when opening up a new level and there are hundreds of actors of the same type. MutableThis->ActorLabel = DefaultActorLabel; } return ActorLabel; }
void CPUThread::SetBranch(const u64 pc, bool record_branch) { if(!Memory.IsGoodAddr(m_offset + pc)) { ConLog.Error("%s branch error: bad address 0x%llx #pc: 0x%llx", GetFName().wx_str(), m_offset + pc, m_offset + PC); Emu.Pause(); } m_is_branch = true; nPC = pc; if(record_branch) CallStackBranch(pc); }
UActorComponent* UInheritableComponentHandler::CreateOverridenComponentTemplate(FComponentKey Key) { for (int32 Index = 0; Index < Records.Num(); ++Index) { FComponentOverrideRecord& Record = Records[Index]; if (Record.ComponentKey.Match(Key)) { if (Record.ComponentTemplate) { return Record.ComponentTemplate; } Records.RemoveAtSwap(Index); break; } } auto BestArchetype = FindBestArchetype(Key); if (!BestArchetype) { UE_LOG(LogBlueprint, Warning, TEXT("CreateOverridenComponentTemplate '%s': cannot find archetype for component '%s' from '%s'"), *GetPathNameSafe(this), *Key.GetSCSVariableName().ToString(), *GetPathNameSafe(Key.GetComponentOwner())); return NULL; } ensure(Cast<UBlueprintGeneratedClass>(GetOuter())); auto NewComponentTemplate = NewObject<UActorComponent>( GetOuter(), BestArchetype->GetClass(), BestArchetype->GetFName(), RF_ArchetypeObject | RF_Public | RF_InheritableComponentTemplate, BestArchetype); // HACK: NewObject can return a pre-existing object which will not have been initialized to the archetype. When we remove the old handlers, we mark them pending // kill so we can identify that situation here (see UE-13987/UE-13990) if (NewComponentTemplate->IsPendingKill()) { NewComponentTemplate->ClearFlags(RF_PendingKill); UEngine::FCopyPropertiesForUnrelatedObjectsParams CopyParams; CopyParams.bDoDelta = false; UEngine::CopyPropertiesForUnrelatedObjects(BestArchetype, NewComponentTemplate, CopyParams); } FComponentOverrideRecord NewRecord; NewRecord.ComponentKey = Key; NewRecord.ComponentTemplate = NewComponentTemplate; Records.Add(NewRecord); return NewComponentTemplate; }
TSharedRef<SWidget> URetainerBox::RebuildWidget() { MyRetainerWidget = SNew(SRetainerWidget) .Phase(Phase) .PhaseCount(PhaseCount) #if STATS .StatId( FName( *FString::Printf(TEXT("%s [%s]"), *GetFName().ToString(), *GetClass()->GetName() ) ) ) #endif//STATS ; MyRetainerWidget->SetRetainedRendering(IsDesignTime() ? false : true); if ( GetChildrenCount() > 0 ) { MyRetainerWidget->SetContent(GetContentSlot()->Content ? GetContentSlot()->Content->TakeWidget() : SNullWidget::NullWidget); } return BuildDesignTimeWidget(MyRetainerWidget.ToSharedRef()); }
void LstInit( void ) /******************/ { const struct fname_item *fn; const char *buffer; list_pos = 0; if( Options.write_listing ) { int namelen; buffer = MsgGetEx( MSG_HJWASM ); list_pos = strlen( buffer ); fwrite( buffer, 1, list_pos, CurrFile[LST] ); LstNL(); fn = GetFName( ModuleInfo.srcfile ); namelen = strlen( fn->fname ); fwrite( fn->fname, 1, namelen, CurrFile[LST] ); list_pos += namelen; LstNL(); } }
void UNamedSlot::OnSlotRemoved(UPanelSlot* Slot) { // Remove the widget from the live slot if it exists. if ( MyBox.IsValid() ) { MyBox->SetContent(SNullWidget::NullWidget); if ( IsDesignTime() ) { MyBox->SetContent( SNew(SBox) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(STextBlock) .Text(FText::FromName(GetFName())) ] ); } } }
void FEmitDefaultValueHelper::OuterGenerate(FEmitterLocalContext& Context , const UProperty* Property , const FString& OuterPath , const uint8* DataContainer , const uint8* OptionalDefaultDataContainer , EPropertyAccessOperator AccessOperator , bool bAllowProtected) { // Determine if the given property contains an instanced default subobject reference. We only get here if the values are not identical. auto IsInstancedSubobjectLambda = [&](int32 ArrayIndex) -> bool { if (auto ObjectProperty = Cast<UObjectProperty>(Property)) { check(DataContainer); check(OptionalDefaultDataContainer); auto ObjectPropertyValue = ObjectProperty->GetObjectPropertyValue_InContainer(DataContainer, ArrayIndex); auto DefaultObjectPropertyValue = ObjectProperty->GetObjectPropertyValue_InContainer(OptionalDefaultDataContainer, ArrayIndex); if (ObjectPropertyValue && ObjectPropertyValue->IsDefaultSubobject() && DefaultObjectPropertyValue && DefaultObjectPropertyValue->IsDefaultSubobject() && ObjectPropertyValue->GetFName() == DefaultObjectPropertyValue->GetFName()) { return true; } } return false; }; if (Property->HasAnyPropertyFlags(CPF_EditorOnly | CPF_Transient)) { UE_LOG(LogK2Compiler, Verbose, TEXT("FEmitDefaultValueHelper Skip EditorOnly or Transient property: %s"), *Property->GetPathName()); return; } for (int32 ArrayIndex = 0; ArrayIndex < Property->ArrayDim; ++ArrayIndex) { if (!OptionalDefaultDataContainer || (!Property->Identical_InContainer(DataContainer, OptionalDefaultDataContainer, ArrayIndex) && !IsInstancedSubobjectLambda(ArrayIndex))) { FString PathToMember; UBlueprintGeneratedClass* PropertyOwnerAsBPGC = Cast<UBlueprintGeneratedClass>(Property->GetOwnerClass()); UScriptStruct* PropertyOwnerAsScriptStruct = Cast<UScriptStruct>(Property->GetOwnerStruct()); const bool bNoexportProperty = PropertyOwnerAsScriptStruct && PropertyOwnerAsScriptStruct->IsNative() && (PropertyOwnerAsScriptStruct->StructFlags & STRUCT_NoExport) // && !PropertyOwnerAsScriptStruct->GetBoolMetaData(TEXT("BlueprintType")) && ensure(EPropertyAccessOperator::Dot == AccessOperator); if (PropertyOwnerAsBPGC && !Context.Dependencies.WillClassBeConverted(PropertyOwnerAsBPGC)) { ensure(EPropertyAccessOperator::None != AccessOperator); const FString OperatorStr = (EPropertyAccessOperator::Dot == AccessOperator) ? TEXT("&") : TEXT(""); const FString ContainerStr = (EPropertyAccessOperator::None == AccessOperator) ? TEXT("this") : FString::Printf(TEXT("%s(%s)"), *OperatorStr, *OuterPath); PathToMember = FString::Printf(TEXT("FUnconvertedWrapper__%s(%s).GetRef__%s()"), *FEmitHelper::GetCppName(PropertyOwnerAsBPGC), *ContainerStr , *UnicodeToCPPIdentifier(Property->GetName(), false, nullptr)); } else if (bNoexportProperty || Property->HasAnyPropertyFlags(CPF_NativeAccessSpecifierPrivate) || (!bAllowProtected && Property->HasAnyPropertyFlags(CPF_NativeAccessSpecifierProtected))) { ensure(EPropertyAccessOperator::None != AccessOperator); const FString OperatorStr = (EPropertyAccessOperator::Dot == AccessOperator) ? TEXT("&") : TEXT(""); const FString ContainerStr = (EPropertyAccessOperator::None == AccessOperator) ? TEXT("this") : OuterPath; const FString GetPtrStr = bNoexportProperty ? FEmitHelper::AccessInaccessiblePropertyUsingOffset(Context, Property, ContainerStr, OperatorStr, ArrayIndex) : FEmitHelper::AccessInaccessibleProperty(Context, Property, ContainerStr, OperatorStr, ArrayIndex, false); PathToMember = Context.GenerateUniqueLocalName(); Context.AddLine(FString::Printf(TEXT("auto& %s = %s;"), *PathToMember, *GetPtrStr)); } else { const FString AccessOperatorStr = (EPropertyAccessOperator::None == AccessOperator) ? TEXT("") : ((EPropertyAccessOperator::Pointer == AccessOperator) ? TEXT("->") : TEXT(".")); const bool bStaticArray = (Property->ArrayDim > 1); const FString ArrayPost = bStaticArray ? FString::Printf(TEXT("[%d]"), ArrayIndex) : TEXT(""); PathToMember = FString::Printf(TEXT("%s%s%s%s"), *OuterPath, *AccessOperatorStr, *FEmitHelper::GetCppName(Property), *ArrayPost); } const uint8* ValuePtr = Property->ContainerPtrToValuePtr<uint8>(DataContainer, ArrayIndex); const uint8* DefaultValuePtr = OptionalDefaultDataContainer ? Property->ContainerPtrToValuePtr<uint8>(OptionalDefaultDataContainer, ArrayIndex) : nullptr; InnerGenerate(Context, Property, PathToMember, ValuePtr, DefaultValuePtr); } } }
bool UK2Node_Event::CanPasteHere(const UEdGraph* TargetGraph) const { // By default, to be safe, we don't allow events to be pasted, except under special circumstances (see below) bool bDisallowPaste = !Super::CanPasteHere(TargetGraph); if(!bDisallowPaste) { // Find the Blueprint that owns the target graph UBlueprint* Blueprint = FBlueprintEditorUtils::FindBlueprintForGraph(TargetGraph); if(Blueprint && Blueprint->SkeletonGeneratedClass) { TArray<FName> ExistingNamesInUse; TArray<FString> ExcludedEventNames; TArray<UK2Node_Event*> ExistingEventNodes; TArray<UClass*> ImplementedInterfaceClasses; // Gather all names in use by the Blueprint class FBlueprintEditorUtils::GetFunctionNameList(Blueprint, ExistingNamesInUse); FBlueprintEditorUtils::GetClassVariableList(Blueprint, ExistingNamesInUse); // Gather all existing event nodes FBlueprintEditorUtils::GetAllNodesOfClass<UK2Node_Event>(Blueprint, ExistingEventNodes); // Gather any event names excluded by the Blueprint class const FString ExclusionListKeyName = TEXT("KismetHideOverrides"); if(Blueprint->ParentClass->HasMetaData(*ExclusionListKeyName)) { const FString ExcludedEventNameString = Blueprint->ParentClass->GetMetaData(*ExclusionListKeyName); ExcludedEventNameString.ParseIntoArray(&ExcludedEventNames, TEXT(","), true); } // Gather all interfaces implemented by the Blueprint class FBlueprintEditorUtils::FindImplementedInterfaces(Blueprint, true, ImplementedInterfaceClasses); // If this is an internal event, don't paste this event if(!bInternalEvent) { // If this is a function override if(bOverrideFunction) { // If the function name is hidden by the parent class, don't paste this event bDisallowPaste = EventSignatureClass == Blueprint->ParentClass && ExcludedEventNames.Contains(EventSignatureName.ToString()); if(!bDisallowPaste) { // If the event function is already handled in this Blueprint, don't paste this event for(int32 i = 0; i < ExistingEventNodes.Num() && !bDisallowPaste; ++i) { bDisallowPaste = ExistingEventNodes[i]->bOverrideFunction && ExistingEventNodes[i]->EventSignatureName == EventSignatureName && ExistingEventNodes[i]->EventSignatureClass == EventSignatureClass; } if(!bDisallowPaste) { // If the signature class is not implemented by the Blueprint parent class or an interface, don't paste this event bDisallowPaste = !Blueprint->ParentClass->IsChildOf(EventSignatureClass) && !ImplementedInterfaceClasses.Contains(EventSignatureClass); if(bDisallowPaste) { UE_LOG(LogBlueprint, Log, TEXT("Cannot paste event node (%s) directly because the event signature class (%s) is incompatible with this Blueprint."), *GetFName().ToString(), EventSignatureClass ? *EventSignatureClass->GetFName().ToString() : TEXT("NONE")); } } else { UE_LOG(LogBlueprint, Log, TEXT("Cannot paste event node (%s) directly because the event function (%s) is already handled."), *GetFName().ToString(), *EventSignatureName.ToString()); } } else { UE_LOG(LogBlueprint, Log, TEXT("Cannot paste event node (%s) directly because the event function (%s) is hidden by the Blueprint parent class (%s)."), *GetFName().ToString(), *EventSignatureName.ToString(), EventSignatureClass ? *EventSignatureClass->GetFName().ToString() : TEXT("NONE")); } } else if(CustomFunctionName != NAME_None) { // If this name is already in use, we can't paste this event bDisallowPaste = ExistingNamesInUse.Contains(CustomFunctionName); if(!bDisallowPaste) { // Handle events that have a custom function name with an actual signature name/class that is not an override (e.g. AnimNotify events) if(EventSignatureName != NAME_None) { // If the signature class is not implemented by the Blueprint parent class or an interface, don't paste this event bDisallowPaste = !Blueprint->ParentClass->IsChildOf(EventSignatureClass) && !ImplementedInterfaceClasses.Contains(EventSignatureClass); if(bDisallowPaste) { UE_LOG(LogBlueprint, Log, TEXT("Cannot paste event node (%s) directly because the custom event function (%s) with event signature name (%s) has an event signature class (%s) that is incompatible with this Blueprint."), *GetFName().ToString(), *CustomFunctionName.ToString(), *EventSignatureName.ToString(), EventSignatureClass ? *EventSignatureClass->GetFName().ToString() : TEXT("NONE")); } } } else { UE_LOG(LogBlueprint, Log, TEXT("Cannot paste event node (%s) directly because the custom event function (%s) is already handled."), *GetFName().ToString(), *CustomFunctionName.ToString()); } } else { UE_LOG(LogBlueprint, Log, TEXT("Cannot paste event node (%s) directly because the event configuration is not specifically handled (EventSignatureName=%s, EventSignatureClass=%s)."), *GetFName().ToString(), *EventSignatureName.ToString(), EventSignatureClass ? *EventSignatureClass->GetFName().ToString() : TEXT("NONE")); } } else { UE_LOG(LogBlueprint, Log, TEXT("Cannot paste event node (%s) directly because it is flagged as an internal event."), *GetFName().ToString()); } } } return !bDisallowPaste; }