Home > other >  Small white help, should how to write a blueprint for elegant threads?
Small white help, should how to write a blueprint for elegant threads?

Time:04-03

Description: a code farmer in the process of writing UE4 blueprint an amazing thing happened, after accepting a tuo port transmission of data, it cannot compile miserable!!!
HTML code is as follows (omit a serial port calls) :
H:
 UCLASS () 
The class MYPJT_API UmainBP: public UBlueprintFunctionLibrary
{
GENERATED_BODY ()
UFUNCTION (BlueprintCallable BlueprintPure, Category=Game)
The static FString BodyTurn
(
FString& LX_uparm,
FString& LY_uparm,
FString& LZ_uparm,
FString& LZ_lowarm,
FString& LX_hand,
FString& LY_hand,
FString& RX_uparm,
FString& RY_uparm,
FString& RZ_uparm,
FString& RZ_lowarm,
FString& RX_hand,
FString& RY_hand
);
};

CPP:
 String UmainBP: : BodyTurn (
FString& LX_uparm,
FString& LY_uparm,
FString& LZ_uparm,
FString& LZ_lowarm,
FString& LX_hand,
FString& LY_hand,
FString& RX_uparm,
FString& RY_uparm,
FString& RZ_uparm,
FString& RZ_lowarm,
FString& RX_hand,
FString& RY_hand
)

{
Int32_t wTempList [20]={0}, I=0;
HANDLE hCom1=init_com (" COM3 ");
Char readBuf [1000]={0}, bufTemp1 [1024]={0}, bufTemp2 [1024]={0};
DWORD readsize;
Int n=2;
String STR="";
int index=0;
While (n -) {
ReadFile (hCom1 readBuf, 256, & amp; Readsize, NULL);
STR +=readBuf;
Memset (readBuf, 0, sizeof (readBuf));
The index=STR. Find (' \ n ');
If (index & lt; 0) {}
Else if (index==113)
{
String p=STR. Substr (0, index + 1);

If (p [0]==':' & amp; & P=='\ n' [113])
{
for (i=0; I & lt; 14. I++)
{
WTempList [I]=strtoul (p. ubstr (I * 8 + 1, 8) c_str (), NULL, 16);
}
Uint32_t crcData=https://bbs.csdn.net/topics/wTempList [13];
Uint32_t crcRes=crc32_in_c (0, (uint8_t *) wTempList, 52).

}
The index=0;
Float lz_uparm=180 * wTempList [1]/32768;
Float ly_uparm=180 * wTempList [2]/32768;
Float lx_uparm=180 * wTempList [3]/32768;
Float lz_lowarm=180 * wTempList [4]/32768;
Float lx_hand=180 * wTempList [5]/32768;
Float ly_hand=180 * wTempList [6]/32768;
Float rz_uparm=180 * wTempList [7]/32768;
Float ry_uparm=180 * wTempList [8]/32768;
Float rx_uparm=180 * wTempList [9]/32768;
Float rz_lowarm=180 * wTempList [10]/32768;
Float rx_hand=180 * wTempList [11]/32768;
Float ry_hand=180 * wTempList [12]/32768;
LZ_uparm=FString: : SanitizeFloat (LZ_uparm);
LY_uparm=FString: : SanitizeFloat (LY_uparm);
LX_uparm=FString: : SanitizeFloat (LX_uparm);
LZ_lowarm=FString: : SanitizeFloat (LZ_lowarm);
LX_hand=FString: : SanitizeFloat (LX_hand);
LY_hand=FString: : SanitizeFloat (LY_hand);
RZ_uparm=FString: : SanitizeFloat (RZ_uparm);
RY_uparm=FString: : SanitizeFloat (RY_uparm);
RX_uparm=FString: : SanitizeFloat (RX_uparm);
RZ_lowarm=FString: : SanitizeFloat (RZ_lowarm);
RX_hand=FString: : SanitizeFloat (RX_hand);
RY_hand=FString: : SanitizeFloat (RY_hand);

}
The else
{
STR. Erase (0, index + 1);
LZ_uparm="0".
LY_uparm="0".
LX_uparm="0".
LZ_lowarm="0".
LX_hand="0".
LY_hand="0".
RZ_uparm="0".
RY_uparm="0".
RX_uparm="0".
RZ_lowarm="0".
RX_hand="0".
RY_hand="0".

}
}
Return "0";
}

So on loading UE4, compile animation blueprint, after the tragedy happened:

Ask you a great god, and this can not run by multithreading safety how broken is not an error?
  • Related