Why is the number 0x232b318c in AZ_CRC("Game", 0x232b318c)?

0

According to AppearsInAddComponentMenu's document example


 ...
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
...

Why is the number 0x232b318c in AZ_CRC("Game", 0x232b318c)?

질문됨 6년 전163회 조회
5개 답변
0
수락된 답변

Hi @REDACTEDUSER

There is a post build utility called crc_fix.exe that is invoked by waf. This utility scans .cpp files for the AZ_CRC macro and then calculates the CRC32 value for it. 0x232b318c is the CRC32 value for the string "Game" in hexadecimal format.

This is done as a compile time performance optimization, CRC32 are often used as unique identifiers throughout the code, their calculation is not insignificant in terms of performance cost, so by doing it during compilation it is avoided altogether.

답변함 6년 전
0

I really don't think that is a GUID, I think we use GUID in AZ_EDITOR_COMPONENT() macro.

.

답변함 6년 전
0

It is a GUID, so just a genuine identifier for the gem, every component needs to have one. Normally you can generate this number with the "Generate GUID" Tool in Visual Studio. Or it is auto generated by the Amazon Launcher on creation of the gem, not sure of this atm.

답변함 6년 전
0

I got it, so it's recommended to add the hex number after the string for this macro to improve performance.

답변함 6년 전
0

I just tried the crc_fix.exe, I see that it can't detect the AZ_CRC in the cpp files.

I typed this cmd:

crcfix -v -log:timestamp.log C:\Amazon\Lumberyard\LumberyardSDK\dev\Empty_Project\Gem\Code\Source*

where C:\Amazon\Lumberyard\LumberyardSDK\dev\Empty_Project\Gem\Code\Source\ is my source location.

Its output is ...CrcFix: Unchanged for all the files.

답변함 6년 전

이 게시물은 마감됨: 새 답변, 댓글 및 투표 추가가 비활성화되었습니다.

관련 콘텐츠