PSUnreal: Difference between revisions

From PSwiki
Jump to navigation Jump to search
IFire (talk | contribs)
No edit summary
IFire (talk | contribs)
No edit summary
Line 91: Line 91:
=== FText and Localization ===
=== FText and Localization ===


<Unreal API> FText represents a "display string". Any text you want to display to the user should be handled with FText. The FText class has built-in support for localization, and can handle text content that is localized and stored in a lookup table, as well as text that is localized at runtime, such as numbers, dates, times, and formatted text.
 
FText is Unreal's class for user viewable strings. It is localizable. See https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/StringHandling/FText/index.html

Revision as of 16:25, 23 April 2015

Import a level

In the FBX exporter set the Units to "Centimeters", this will scale the model up 100 times, as in UE the units are 1 unit = 1cm, while in CS they are 1 unit = 1 meter


Import a char

You cannot import a skeleton by itself, if you export only the skeleton from max with FBX, UE will import nothing, you need some geometry associated

OLD (Bake Animations fixes this problem): FBX export seems to have issues if the controllers or bones have a "orientation constraint" on the Motion panel under assign controller. With that it doesn't export, without it does

OLD (Bake Animations fixes this problem): UE doesn't import skeletons with multiple root bones, need to have one

You cannot import DDS files, unless they are specific format. Better to just import PNGs.

Only way I found to import a char is to hide all helpers, shapes, then select geometry and bones, and "Export Selected" to FBX with "Bake Animations" selected.


Engine inner working

> MyProjectServer.exe!UIpNetDriver::InitListen(FNetworkNotify * InNotify, FURL & LocalURL, bool bReuseAddressAndPort, FString & Error) Line 152 C++

	MyProjectServer.exe!UWorld::Listen(FURL & InURL) Line 3927	C++
	MyProjectServer.exe!UEngine::LoadMap(FWorldContext & WorldContext, FURL URL, UPendingNetGame * Pending, FString & Error) Line 8983	C++
	MyProjectServer.exe!UEngine::Browse(FWorldContext & WorldContext, FURL URL, FString & Error) Line 8144	C++
	MyProjectServer.exe!UGameInstance::StartGameInstance() Line 262	C++
	MyProjectServer.exe!UGameEngine::Init(IEngineLoop * InEngineLoop) Line 465	C++
	MyProjectServer.exe!FEngineLoop::Init() Line 1967	C++
	MyProjectServer.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 138	C++
	MyProjectServer.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 191	C++


Code convertion

Types

csString -> psString or FString

psStringArray with TArray<psString>

uint -> uint32

csHash<Value,Key> -> TMap<Key,Value> (notice the swap of Key and Value)

csArray<> -> TArray


Types conversion

FString to char* -> const char *myData = TCHAR_TO_ANSI(*NameString);

FString to TCHAR -> *myFString

char* to FString -> ANSI_TO_TCHAR(NameString);


Functions

Replace string.Format("hey %s", string) with string.Printf(TEXT("hey %s"), string)

csString.Truncate(5) -> FString.Left(5)

csString.DeleteAt(start,count) -> FString.RemoveAt(start,count)

csString.Downcase() -> FString.ToLower()

output.Insert(0, time_buffer) -> output.InsertAt(0, time_buffer)

output.GetAt(output.Length()-1) -> output [ output.Len()-1 ]

Cross platform types are defined in Platform.h , like uint32. Those can be included with #include "EngineMinimal.h"

CS_ASSERT() -> check()

strcasecmp and strcmp, I added those two defines, so the code can stay as it is

 #define strcasecmp(expr1,expr2) FCString::Strcmp( ANSI_TO_TCHAR(expr1), ANSI_TO_TCHAR(expr2)) == 0
 #define strcmp(expr1,expr2) FCString::Stricmp( ANSI_TO_TCHAR(expr1), ANSI_TO_TCHAR(expr2)) == 0

CPrintf(CON_CMDOUTPUT,str.GetDataSafe()); -> UE_LOG(LogTemp, Warning, TEXT("%s"), str);

time(NULL) -> FString buf = FDateTime().GetDate().ToString();

FText and Localization

FText is Unreal's class for user viewable strings. It is localizable. See https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/StringHandling/FText/index.html