Skip to content

Commit

Permalink
fix PUERTS_WITH_EDITOR_SUFFIX
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoChenFx committed Aug 8, 2024
1 parent f885625 commit 59cd536
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ bool FTypeScriptDeclarationGenerator::GenFunction(
}

FString FuncName = Function->GetName();
#if PUERTS_WITH_EDITOR_SUFFIX
#ifdef PUERTS_WITH_EDITOR_SUFFIX
if (puerts::IsEditorOnlyUFunction(Function))
{
FuncName += EditorOnlyPropertySuffix;
Expand Down Expand Up @@ -1229,10 +1229,12 @@ void FTypeScriptDeclarationGenerator::GenClass(UClass* Class)

FStringBuffer TmpBuff;
FString SN = Property->GetName();
#ifdef PUERTS_WITH_EDITOR_SUFFIX
if (Property->IsEditorOnlyProperty())
{
SN += EditorOnlyPropertySuffix;
}
#endif
TmpBuff << SafeFieldName(SN) << ": ";
TArray<UObject*> RefTypesTmp;
if (!GenTypeDecl(TmpBuff, Property, RefTypesTmp))
Expand Down
2 changes: 1 addition & 1 deletion unreal/Puerts/Source/JsEnv/Private/PropertyTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void FPropertyTranslator::SetAccessor(v8::Isolate* Isolate, v8::Local<v8::Functi
Property->GetDisplayNameText().ToString()
#endif
: Property->GetName();
#if PUERTS_WITH_EDITOR_SUFFIX
#ifdef PUERTS_WITH_EDITOR_SUFFIX
if (Property->IsEditorOnlyProperty())
{
PropertyName += EditorOnlyPropertySuffix;
Expand Down
6 changes: 3 additions & 3 deletions unreal/Puerts/Source/JsEnv/Private/StructWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ v8::Local<v8::FunctionTemplate> FStructWrapper::ToFunctionTemplate(v8::Isolate*

FString FuncName = Function->GetName();
auto Key = FV8Utils::InternalString(Isolate, FuncName);
#if PUERTS_WITH_EDITOR_SUFFIX
#ifdef PUERTS_WITH_EDITOR_SUFFIX
// 这里同时绑定带Suffix和不带Suffix的后缀是为了兼容现有的一些js写的代码(PuertsEditor)
v8::Local<v8::String> AdditionalKey{};
if (puerts::IsEditorOnlyUFunction(Function))
Expand All @@ -268,7 +268,7 @@ v8::Local<v8::FunctionTemplate> FStructWrapper::ToFunctionTemplate(v8::Isolate*
if (!IsReuseTemplate)
{
Result->Set(Key, FunctionTranslator->ToFunctionTemplate(Isolate));
#if PUERTS_WITH_EDITOR_SUFFIX
#ifdef PUERTS_WITH_EDITOR_SUFFIX
if (!AdditionalKey.IsEmpty())
{
Result->Set(AdditionalKey, FunctionTranslator->ToFunctionTemplate(Isolate));
Expand All @@ -283,7 +283,7 @@ v8::Local<v8::FunctionTemplate> FStructWrapper::ToFunctionTemplate(v8::Isolate*
if (!IsReuseTemplate)
{
Result->PrototypeTemplate()->Set(Key, FunctionTranslator->ToFunctionTemplate(Isolate));
#if PUERTS_WITH_EDITOR_SUFFIX
#ifdef PUERTS_WITH_EDITOR_SUFFIX
if (!AdditionalKey.IsEmpty())
{
Result->PrototypeTemplate()->Set(AdditionalKey, FunctionTranslator->ToFunctionTemplate(Isolate));
Expand Down

0 comments on commit 59cd536

Please sign in to comment.