zoukankan      html  css  js  c++  java
  • UE4源码摘录(424)

    https://docs.unrealengine.com/en-US/Programming/Introduction/index.html

    UE4 prefix:

    • Classes derived from Actor prefixed with A, such as AController.

    • Classes derived from Object are prefixed with U, such as UComponent.

    • Enums are prefixed with E, such as EFortificationType.

    • Interface classes are usually prefixed with I, such as IAbilitySystemInterface.

    • Template classes are prefixed by T, such as TArray.

    • Classes that derive from SWidget (Slate UI) are prefixed by S, such as SButton.

    • Everything else is prefixed by the letter F , such as FVector.

    Letter F:

    This gets asked all the time and I thought I would share the official story, as I remember wondering the same thing.

    'U' stands for UObject, 'A' stands for actor, 'T' stands for Template. Everyone gets that. But what does 'F' stand for? It's used almost everywhere else!

    The 'F' prefix actually stands for "Float" (as in Floating Point.)

    Tim Sweeney wrote the original "FVector" class along with many of the original math classes, and the 'F' prefix was useful to distinguish from math constructs that would support either integers or doubles, even before such classes were written. Much of the engine code dealt with floating point values, so the pattern spread quickly to other new engine classes at the time, then eventually became standard everywhere.

    This was in the mid-nineties sometime. Even though most of Unreal Engine has been rewritten a few times over since then, some of the original math classes still resemble their Unreal 1 counterparts, and certain idioms remain part of Epic's coding standard today.

    Just a quick and fun story about Unreal's history I thought I'd share.


    --Mike

    创建对象方法(转载:https://blog.csdn.net/luofeixiongsix/article/details/81061764 )

    Actor:

    UWorld* World = GetWorld();  
    FVector pos(150, 0, 20);  
     //生成Actor
    AMyActor* MyActor = World->SpawnActor<AMyActor>(pos, FRotator::ZeroRotator);
    //创建Component
    MyComponent = CreateDefaultSubobject<UMyActorComponent>(TEXT("MyComponent"));

    //加载资源对象
    UStaticMesh* SM_Vase = Cast<UStaticMesh>(StaticLoadObject(UStaticMesh::StaticClass(), NULL, TEXT("/Game/Assets/StaticMeshes/SM_Vase")) ); StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("StaticMeshComponent")); StaticMeshComponent->SetStaticMesh(SM_Vase);

    //创建UObject
    MyObject = NewObject<UMyObject>();

      

    UE4 Commandlet:

    execute project:

    "D:UE_4.24EngineBinariesWin64UE4Editor-Cmd.exe" "D:UE_ProjProj424MyProject2MyProject2.uproject" 

    注意引号

    ContentBrowser import:

    SContentBrowser.cpp 1005

    FReply SContentBrowser::HandleImportClicked()
    {
        ImportAsset( GetCurrentPath() );
        return FReply::Handled();
    }
    void SContentBrowser::ImportAsset( const FString& InPath )
    {
    	if ( ensure( !InPath.IsEmpty() ) )
    	{
    		FAssetToolsModule& AssetToolsModule = FModuleManager::Get().LoadModuleChecked<FAssetToolsModule>( "AssetTools" );
    		AssetToolsModule.Get().ImportAssetsWithDialog( InPath );
    	}
    }
  • 相关阅读:
    WC2021 游记
    TC11054
    P5904
    CF741D
    CF1467 题解
    [CTSC2008]网络管理 [树剖+整体二分]
    [HNOI2015]接水果[整体二分]
    [SDOI2010]粟粟的书架 [主席树]
    整体二分的一些见解[整体二分学习笔记]
    P2710 数列[fhq treap]
  • 原文地址:https://www.cnblogs.com/sunchuankai/p/13266561.html
Copyright © 2011-2022 走看看