Skip to content

Commit beea905

Browse files
authored
Merge pull request #49 from ncsoft/4.23
4.23
2 parents b66d81c + c0064d5 commit beea905

31 files changed

+4736
-649
lines changed

Source/JavascriptEditor/JavascriptEditorViewport.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ class FJavascriptPreviewScene : public FAdvancedPreviewScene
3737
{
3838
return SkyComponent;
3939
}
40-
40+
#if ENGINE_MINOR_VERSION < 23
4141
class USphereReflectionCaptureComponent* GetDefaultSphereReflectionComponent()
4242
{
4343
return SphereReflectionComponent;
4444
}
45-
45+
#endif
4646
class UMaterialInstanceConstant* GetDefaultInstancedSkyMaterial()
4747
{
4848
return InstancedSkyMaterial;
@@ -495,12 +495,12 @@ class SAutoRefreshEditorViewport : public SEditorViewport
495495
{
496496
return PreviewScene.GetDefaultSkySphereComponent();
497497
}
498-
498+
#if ENGINE_MINOR_VERSION < 23
499499
class USphereReflectionCaptureComponent* GetDefaultSphereReflectionComponent()
500500
{
501501
return PreviewScene.GetDefaultSphereReflectionComponent();
502502
}
503-
503+
#endif
504504
class UMaterialInstanceConstant* GetDefaultInstancedSkyMaterial()
505505
{
506506
return PreviewScene.GetDefaultInstancedSkyMaterial();
@@ -949,11 +949,12 @@ class UStaticMeshComponent* UJavascriptEditorViewport::GetDefaultSkySphereCompon
949949

950950
class USphereReflectionCaptureComponent* UJavascriptEditorViewport::GetDefaultSphereReflectionComponent()
951951
{
952+
#if ENGINE_MINOR_VERSION < 23
952953
if (ViewportWidget.IsValid())
953954
{
954955
return ViewportWidget->GetDefaultSphereReflectionComponent();
955956
}
956-
957+
#endif
957958
return nullptr;
958959
}
959960

Source/JavascriptGraphEditor/JavascriptGraphEditorLibrary.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,21 @@ FJavascriptArrangedWidget UJavascriptGraphEditorLibrary::FindPinGeometries(FJava
230230
FJavascriptPinWidget UJavascriptGraphEditorLibrary::FindPinToPinWidgetMap(FJavascriptDetermineLinkGeometryContainer Container, FJavascriptEdGraphPin Pin)
231231
{
232232
FJavascriptPinWidget Widget = FJavascriptPinWidget();
233-
233+
#if ENGINE_MINOR_VERSION > 22
234+
TSharedPtr<SGraphPin>* SGraphPinHandle = Container.PinToPinWidgetMap->Find(Pin);
235+
if (SGraphPinHandle)
236+
{
237+
TSharedRef<SWidget> SWidgetHandle = static_cast<SWidget&>(*SGraphPinHandle->Get()).AsShared();
238+
Widget.Handle = &SWidgetHandle;
239+
}
240+
#else
234241
TSharedRef<SGraphPin>* SGraphPinHandle = Container.PinToPinWidgetMap->Find(Pin);
235242
if (SGraphPinHandle)
236243
{
237-
TSharedRef<SWidget> SWidgetHandle = static_cast<SWidget&>(SGraphPinHandle->Get()).AsShared();
244+
TSharedRef<SWidget> SWidgetHandle = static_cast<SWidget&>(SGraphPinHandle->Get()).AsShared();
238245
Widget.Handle = &SWidgetHandle;
239246
}
247+
#endif
240248

241249
return Widget;
242250
}

Source/JavascriptGraphEditor/JavascriptGraphEditorLibrary.h

+16-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "SJavascriptGraphEdNode.h"
55
#include "ConnectionDrawingPolicy.h"
66
#include "EdGraph/EdGraph.h"
7+
#include "../../Launch/Resources/Version.h"
78
#include "JavascriptGraphEditorLibrary.generated.h"
89

910
class UEdGraph;
@@ -99,7 +100,17 @@ struct FJavascriptDetermineLinkGeometryContainer
99100
GENERATED_BODY()
100101

101102
FJavascriptDetermineLinkGeometryContainer() {}
102-
FJavascriptDetermineLinkGeometryContainer(FArrangedChildren* InArrangedNodes, TSharedRef<SWidget>* InOutputPinWidget, TMap<UEdGraphNode*, int32>* InNodeWidgetMap, TMap<TSharedRef<SWidget>, FArrangedWidget>* InPinGeometries, TMap< UEdGraphPin*, TSharedRef<SGraphPin> >* InPinToPinWidgetMap)
103+
FJavascriptDetermineLinkGeometryContainer(
104+
FArrangedChildren* InArrangedNodes,
105+
TSharedRef<SWidget>* InOutputPinWidget,
106+
TMap<UEdGraphNode*, int32>* InNodeWidgetMap,
107+
TMap<TSharedRef<SWidget>, FArrangedWidget>* InPinGeometries,
108+
#if ENGINE_MINOR_VERSION > 22
109+
TMap< UEdGraphPin*, TSharedPtr<SGraphPin> >* InPinToPinWidgetMap
110+
#else
111+
TMap< UEdGraphPin*, TSharedRef<SGraphPin> >* InPinToPinWidgetMap
112+
#endif
113+
)
103114
: ArrangedNodes(InArrangedNodes)
104115
, OutputPinWidget(InOutputPinWidget)
105116
, NodeWidgetMap(InNodeWidgetMap)
@@ -113,7 +124,11 @@ struct FJavascriptDetermineLinkGeometryContainer
113124
TMap<UEdGraphNode*, int32>* NodeWidgetMap;
114125

115126
TMap<TSharedRef<SWidget>, FArrangedWidget>* PinGeometries;
127+
#if ENGINE_MINOR_VERSION > 22
128+
TMap< UEdGraphPin*, TSharedPtr<SGraphPin> >* PinToPinWidgetMap;
129+
#else
116130
TMap< UEdGraphPin*, TSharedRef<SGraphPin> >* PinToPinWidgetMap;
131+
#endif
117132
};
118133

119134
USTRUCT(BlueprintType)

Source/JavascriptGraphEditor/SJavascriptGraphEdNodePin.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ void SJavascriptGraphPin::Construct(const FArguments& InArgs, UEdGraphPin* InPin
9494
}
9595
}
9696
// Create the widget used for the pin body (status indicator, label, and value)
97+
#if ENGINE_MINOR_VERSION > 22
98+
LabelAndValue =
99+
#else
97100
TSharedRef<SWrapBox> LabelAndValue =
101+
#endif
98102
SNew(SWrapBox)
99103
.PreferredWidth(150.f);
100104

@@ -168,7 +172,11 @@ void SJavascriptGraphPin::Construct(const FArguments& InArgs, UEdGraphPin* InPin
168172
.AutoWidth()
169173
.VAlign(VAlign_Center)
170174
[
175+
#if ENGINE_MINOR_VERSION > 22
176+
LabelAndValue.ToSharedRef()
177+
#else
171178
LabelAndValue
179+
#endif
172180
];
173181
}
174182
else
@@ -179,7 +187,11 @@ void SJavascriptGraphPin::Construct(const FArguments& InArgs, UEdGraphPin* InPin
179187
.AutoWidth()
180188
.VAlign(VAlign_Center)
181189
[
190+
#if ENGINE_MINOR_VERSION > 22
191+
LabelAndValue.ToSharedRef()
192+
#else
182193
LabelAndValue
194+
#endif
183195
]
184196
+ SHorizontalBox::Slot()
185197
.AutoWidth()

Source/JavascriptUMG/JavascriptMenuLibrary.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "Components/Widget.h"
55
#include "Framework/Commands/GenericCommands.h"
66
#include "JavascriptUICommands.h"
7+
#include "../../Launch/Resources/Version.h"
78

89
FJavascriptUICommandList UJavascriptMenuLibrary::CreateUICommandList()
910
{
@@ -242,7 +243,11 @@ FJavascriptUICommandInfo UJavascriptMenuLibrary::UI_COMMAND_Function(FJavascript
242243
const FString DotOutCommandName = FString::Printf(TEXT(".%s"), *info.Id);
243244
const TCHAR* FriendlyName = *info.FriendlyName;
244245
const TCHAR* InDescription = *info.Description;
246+
#if ENGINE_MINOR_VERSION > 22
247+
const EUserInterfaceActionType CommandType = EUserInterfaceActionType(info.ActionType.GetValue());
248+
#else
245249
const EUserInterfaceActionType::Type CommandType = EUserInterfaceActionType::Type(info.ActionType.GetValue());
250+
#endif
246251
const FInputChord& InDefaultChord = info.DefaultChord;
247252
const FInputChord& InAlternateDefaultChord = FInputChord();
248253
const FString IconStyleName = *info.IconStyleName;

Source/V8/Private/Delegates.cpp

+22-10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "Translator.h"
44
#include "JavascriptStats.h"
55
#include "UObject/GCObject.h"
6+
#include "../../Launch/Resources/Version.h"
7+
#include "v8-version.h"
68

79
PRAGMA_DISABLE_SHADOW_VARIABLE_WARNINGS
810

@@ -106,29 +108,31 @@ class FJavascriptDelegate : public FGCObject, public TSharedFromThis<FJavascript
106108
auto toJSON = [](const FunctionCallbackInfo<Value>& info) {
107109
auto payload = reinterpret_cast<FJavascriptDelegate*>(Local<External>::Cast(info.Data())->Value());
108110

109-
uint32_t Index = 0;
110-
auto arr = Array::New(info.GetIsolate(), payload->DelegateObjects.Num());
111+
uint32_t Index = 0;
112+
auto isolate_ = info.GetIsolate();
113+
auto context_ = isolate_->GetCurrentContext();
114+
auto arr = Array::New(isolate_, payload->DelegateObjects.Num());
111115
const bool bIsMulticastDelegate = payload->Property->IsA(UMulticastDelegateProperty::StaticClass());
112116

113117
for (auto DelegateObject : payload->DelegateObjects)
114118
{
115119
auto JavascriptFunction = payload->functions.Find(DelegateObject->UniqueId);
116120
if (JavascriptFunction)
117121
{
118-
auto function = Local<Function>::New(info.GetIsolate(), *JavascriptFunction);
122+
auto function = Local<Function>::New(isolate_, *JavascriptFunction);
119123
if (!bIsMulticastDelegate)
120124
{
121125
info.GetReturnValue().Set(function);
122126
return;
123127
}
124128

125-
arr->Set(Index++, function);
129+
arr->Set(context_, Index++, function);
126130
}
127131
}
128132

129133
if (!bIsMulticastDelegate)
130134
{
131-
info.GetReturnValue().Set(Null(info.GetIsolate()));
135+
info.GetReturnValue().Set(Null(isolate_));
132136
}
133137
else
134138
{
@@ -224,8 +228,12 @@ class FJavascriptDelegate : public FGCObject, public TSharedFromThis<FJavascript
224228
FScriptDelegate Delegate;
225229
Delegate.BindUFunction(DelegateObject, NAME_Fire);
226230

231+
#if ENGINE_MINOR_VERSION > 22
232+
p->AddDelegate(Delegate, WeakObject.Get());
233+
#else
227234
auto Target = p->GetPropertyValuePtr_InContainer(WeakObject.Get());
228235
Target->Add(Delegate);
236+
#endif
229237
}
230238
else if (auto p = Cast<UDelegateProperty>(Property))
231239
{
@@ -250,9 +258,12 @@ class FJavascriptDelegate : public FGCObject, public TSharedFromThis<FJavascript
250258
{
251259
FScriptDelegate Delegate;
252260
Delegate.BindUFunction(DelegateObject, NAME_Fire);
253-
261+
#if ENGINE_MINOR_VERSION > 22
262+
p->RemoveDelegate(Delegate, WeakObject.Get());
263+
#else
254264
auto Target = p->GetPropertyValuePtr_InContainer(WeakObject.Get());
255265
Target->Remove(Delegate);
266+
#endif
256267
}
257268
else if (auto p = Cast<UDelegateProperty>(Property))
258269
{
@@ -374,17 +385,18 @@ struct FDelegateManager : IDelegateManager
374385
virtual Local<Value> GetProxy(Local<Object> This, UObject* Object, UProperty* Property) override
375386
{
376387
auto cache_id = V8_KeywordString(isolate_, FString::Printf(TEXT("$internal_%s"), *(Property->GetName())));
377-
auto cached = This->Get(cache_id);
378-
if (cached.IsEmpty() || cached->IsUndefined())
388+
auto context_ = isolate_->GetCurrentContext();
389+
auto maybe_cached = This->Get(context_, cache_id);
390+
if (maybe_cached.IsEmpty() || maybe_cached.ToLocalChecked()->IsUndefined())
379391
{
380392
auto created = CreateDelegate(Object, Property);
381393

382-
This->Set(cache_id, created);
394+
This->Set(context_, cache_id, created);
383395
return created;
384396
}
385397
else
386398
{
387-
return cached;
399+
return maybe_cached.ToLocalChecked();
388400
}
389401
}
390402
};

Source/V8/Private/FunctionCall.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,22 @@ namespace v8
100100
// pass return parameter as '$'
101101
if (PropertyFlags & CPF_ReturnParm)
102102
{
103-
auto sub_value = Object->Get(I.Keyword("$"));
103+
auto sub_value = Object->Get(context, I.Keyword("$"));
104104

105-
WriteProperty(isolate, ReturnParam, Buffer, sub_value, FNoPropertyOwner());
105+
if (!sub_value.IsEmpty())
106+
{
107+
WriteProperty(isolate, ReturnParam, Buffer, sub_value.ToLocalChecked(), FNoPropertyOwner());
108+
}
106109
}
107110
// rejects 'const T&' and pass 'T&' as its name
108111
else if ((PropertyFlags & (CPF_ConstParm | CPF_OutParm)) == CPF_OutParm)
109112
{
110-
auto sub_value = Object->Get(I.Keyword(Param->GetName()));
113+
auto sub_value = Object->Get(context, I.Keyword(Param->GetName()));
111114

112115
if (!sub_value.IsEmpty())
113116
{
114117
// value can be null if isolate is in trouble
115-
WriteProperty(isolate, Param, Buffer, sub_value, FNoPropertyOwner());
118+
WriteProperty(isolate, Param, Buffer, sub_value.ToLocalChecked(), FNoPropertyOwner());
116119
}
117120
}
118121
}

Source/V8/Private/Inspector.cpp

+36-23
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,11 @@ class FInspector : public IJavascriptInspector, public FTickableAnyObject, publi
427427
FIsolateHelper I(isolate_);
428428

429429
{
430-
auto console = InContext->Global()->Get(I.Keyword("console"));
431-
InContext->Global()->Set(I.Keyword("$console"), console);
430+
auto console = InContext->Global()->Get(InContext, I.Keyword("console"));
431+
if (!console.IsEmpty())
432+
{
433+
InContext->Global()->Set(InContext, I.Keyword("$console"), console.ToLocalChecked());
434+
}
432435
}
433436

434437
v8inspector = v8_inspector::V8Inspector::create(isolate_, this);
@@ -487,33 +490,43 @@ class FInspector : public IJavascriptInspector, public FTickableAnyObject, publi
487490
HandleScope handle_scope(isolate_);
488491

489492
FIsolateHelper I(isolate_);
490-
493+
auto context_ = context();
491494
Isolate::Scope isolate_scope(isolate_);
492-
Context::Scope context_scope(context());
495+
Context::Scope context_scope(context_);
493496

494497
TryCatch try_catch(isolate_);
495498

496-
auto console = context()->Global()->Get(I.Keyword("console")).As<v8::Object>();
499+
auto maybe_console = context_->Global()->Get(context_, I.Keyword("console"));
500+
if (!maybe_console.IsEmpty())
501+
{
502+
auto console = maybe_console.ToLocalChecked().As<v8::Object>();
497503

498-
auto method =
499-
Verbosity == ELogVerbosity::Fatal || Verbosity == ELogVerbosity::Error ? I.Keyword("$error") :
500-
Verbosity == ELogVerbosity::Warning ? I.Keyword("$warn") :
501-
Verbosity == ELogVerbosity::Display ? I.Keyword("info") :
502-
I.Keyword("$log");
503-
auto function = console->Get(method).As<v8::Function>();
504+
auto method =
505+
Verbosity == ELogVerbosity::Fatal || Verbosity == ELogVerbosity::Error ? I.Keyword("$error") :
506+
Verbosity == ELogVerbosity::Warning ? I.Keyword("$warn") :
507+
Verbosity == ELogVerbosity::Display ? I.Keyword("info") :
508+
I.Keyword("$log");
504509

505-
if (Verbosity == ELogVerbosity::Display)
506-
{
507-
Handle<Value> argv[2];
508-
argv[0] = I.String(FString::Printf(TEXT("%%c%s: %s"), *Category.ToString(), V));
509-
argv[1] = I.String(TEXT("color:gray"));
510-
(void)function->Call(context(), console, 2, argv);
511-
}
512-
else
513-
{
514-
Handle<Value> argv[1];
515-
argv[0] = I.String(FString::Printf(TEXT("%s: %s"), *Category.ToString(), V));
516-
(void)function->Call(context(), console, 1, argv);
510+
auto maybe_function = console->Get(context_, method);
511+
512+
if (!maybe_function.IsEmpty())
513+
{
514+
auto function = maybe_function.ToLocalChecked().As<v8::Function>();
515+
516+
if (Verbosity == ELogVerbosity::Display)
517+
{
518+
Handle<Value> argv[2];
519+
argv[0] = I.String(FString::Printf(TEXT("%%c%s: %s"), *Category.ToString(), V));
520+
argv[1] = I.String(TEXT("color:gray"));
521+
(void)function->Call(context(), console, 2, argv);
522+
}
523+
else
524+
{
525+
Handle<Value> argv[1];
526+
argv[0] = I.String(FString::Printf(TEXT("%s: %s"), *Category.ToString(), V));
527+
(void)function->Call(context(), console, 1, argv);
528+
}
529+
}
517530
}
518531
}
519532
}

0 commit comments

Comments
 (0)