Skip to content

Commit c2901db

Browse files
committed
closed 20tab#575
1 parent 3eb78c5 commit c2901db

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

Source/UnrealEnginePython/Private/Slate/UEPySlate.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,18 @@ void FPythonSlateDelegate::MenuPyAssetBuilder(FMenuBuilder &Builder, TArray<FAss
417417
}
418418

419419

420+
TSharedRef<FExtender> FPythonSlateDelegate::OnExtendContentBrowserMenu(const TArray<FAssetData>& SelectedAssets)
421+
{
422+
TSharedRef<FExtender> Extender(new FExtender());
423+
424+
Extender->AddMenuExtension((char *)"GetAssetActions", EExtensionHook::After, nullptr, FMenuExtensionDelegate::CreateSP(this, &FPythonSlateDelegate::MenuPyAssetBuilder, SelectedAssets));
425+
426+
return Extender;
427+
}
428+
429+
#endif
430+
431+
420432
void FPythonSlateDelegate::SubMenuPyBuilder(FMenuBuilder &Builder)
421433
{
422434
FScopePythonGIL gil;
@@ -430,16 +442,6 @@ void FPythonSlateDelegate::SubMenuPyBuilder(FMenuBuilder &Builder)
430442
Py_DECREF(ret);
431443
}
432444

433-
TSharedRef<FExtender> FPythonSlateDelegate::OnExtendContentBrowserMenu(const TArray<FAssetData>& SelectedAssets)
434-
{
435-
TSharedRef<FExtender> Extender(new FExtender());
436-
437-
Extender->AddMenuExtension((char *)"GetAssetActions", EExtensionHook::After, nullptr, FMenuExtensionDelegate::CreateSP(this, &FPythonSlateDelegate::MenuPyAssetBuilder, SelectedAssets));
438-
439-
return Extender;
440-
}
441-
442-
#endif
443445

444446
TSharedRef<SWidget> FPythonSlateDelegate::OnGenerateWidget(TSharedPtr<FPythonItem> py_item)
445447
{

Source/UnrealEnginePython/Private/Slate/UEPySlateDelegate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ class FPythonSlateDelegate : public FPythonSmartDelegate
4545
void OnAssetSelected(const FAssetData& AssetData);
4646
TSharedRef<FExtender> OnExtendContentBrowserMenu(const TArray<FAssetData> &SelectedAssets);
4747
void MenuPyAssetBuilder(FMenuBuilder &Builder, TArray<FAssetData> SelectedAssets);
48-
void SubMenuPyBuilder(FMenuBuilder &Builder);
4948
void OnAssetChanged(const FAssetData &AssetData);
5049
bool OnShouldFilterAsset(const FAssetData& AssetData);
5150
#endif
5251

5352
void OnWindowClosed(const TSharedRef<SWindow> &Window);
53+
void SubMenuPyBuilder(FMenuBuilder &Builder);
5454

5555
TSharedPtr<SWidget> OnContextMenuOpening();
5656
TSharedRef<SWidget> OnGenerateWidget(TSharedPtr<FPythonItem> py_item);

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,9 +1697,9 @@ void unreal_engine_init_py_module()
16971697
ue_python_init_enumsimporter(new_unreal_engine_module);
16981698
ue_python_init_ustructsimporter(new_unreal_engine_module);
16991699

1700+
#if WITH_EDITOR
17001701
ue_python_init_ffoliage_instance(new_unreal_engine_module);
17011702

1702-
#if WITH_EDITOR
17031703
ue_python_init_fslowtask(new_unreal_engine_module);
17041704
ue_python_init_swidget(new_unreal_engine_module);
17051705
ue_python_init_farfilter(new_unreal_engine_module);

Source/UnrealEnginePython/Private/Wrappers/UEPyFFoliageInstance.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "Components/ActorComponent.h"
77
#include "Runtime/Foliage/Public/InstancedFoliageActor.h"
88

9+
#if WITH_EDITOR
10+
911
#define get_instance(x) FFoliageInstance *instance = get_foliage_instance(x);\
1012
if (!instance)\
1113
return nullptr;
@@ -14,6 +16,8 @@
1416
if (!instance)\
1517
return -1;
1618

19+
20+
1721
static FFoliageInstance* get_foliage_instance(ue_PyFFoliageInstance *self)
1822
{
1923
if (!self->foliage_actor.IsValid())
@@ -45,6 +49,7 @@ static PyObject *ue_PyFFoliageInstance_str(ue_PyFFoliageInstance *self)
4549
self->instance_id);
4650
}
4751

52+
4853
static PyObject *py_ue_ffoliage_instance_get_location(ue_PyFFoliageInstance *self, void *closure)
4954
{
5055
get_instance(self);
@@ -257,4 +262,6 @@ PyObject *py_ue_new_ffoliage_instance(AInstancedFoliageActor *foliage_actor, UFo
257262
ret->foliage_type = TWeakObjectPtr<UFoliageType>(foliage_type);
258263
ret->instance_id = instance_id;
259264
return (PyObject *)ret;
260-
}
265+
}
266+
267+
#endif

Source/UnrealEnginePython/Private/Wrappers/UEPyFFoliageInstance.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22
#include "UnrealEnginePython.h"
33

4+
#if WITH_EDITOR
45
#include "InstancedFoliage.h"
56

67
typedef struct
@@ -14,3 +15,4 @@ typedef struct
1415
void ue_python_init_ffoliage_instance(PyObject *);
1516

1617
PyObject *py_ue_new_ffoliage_instance(AInstancedFoliageActor *foliage_actor, UFoliageType *foliage_type, int32 instance_id);
18+
#endif

0 commit comments

Comments
 (0)