Skip to content

Commit e63d127

Browse files
author
Roberto De Ioris
committed
support for sync_to_browser when importing assets
1 parent 8ece049 commit e63d127

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Source/PythonConsole/Public/PyFbxFactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ UPyFbxFactory::UPyFbxFactory(const FObjectInitializer& ObjectInitializer)
1111

1212
bool UPyFbxFactory::ConfigureProperties() {
1313
bDetectImportTypeOnImport = true;
14-
bShowOption = false;
14+
bShowOption = false;
1515

1616
return true;
1717
}

Source/PythonConsole/Public/PyFbxFactory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88

9-
UCLASS(hidecategories=Object)
9+
UCLASS(hidecategories = Object)
1010
class UPyFbxFactory : public UFbxFactory
1111
{
1212
GENERATED_BODY()

Source/UnrealEnginePython/Private/UEPyEditor.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ PyObject *py_unreal_engine_import_asset(PyObject * self, PyObject * args) {
199199
PyObject * assetsObject = nullptr;
200200
char *destination;
201201
PyObject *obj = nullptr;
202-
if (!PyArg_ParseTuple(args, "Os|O:import_asset", &assetsObject, &destination, &obj)) {
202+
PyObject *py_sync = nullptr;
203+
if (!PyArg_ParseTuple(args, "Os|OO:import_asset", &assetsObject, &destination, &obj, &py_sync)) {
203204
return NULL;
204205
}
205206

@@ -211,6 +212,7 @@ PyObject *py_unreal_engine_import_asset(PyObject * self, PyObject * args) {
211212

212213
UClass *factory_class = nullptr;
213214
UFactory *factory = nullptr;
215+
bool sync_to_browser = false;
214216

215217
if (!obj || obj == Py_None) {
216218
factory_class = nullptr;
@@ -279,13 +281,17 @@ PyObject *py_unreal_engine_import_asset(PyObject * self, PyObject * args) {
279281
char * filename = PyString_AsString(PyObject_Str(assetsObject));
280282
#endif
281283
files.Add(UTF8_TO_TCHAR(filename));
282-
}
284+
}
283285
else {
284286
return PyErr_Format(PyExc_Exception, "Not a string nor valid list of string");
285287
}
286288

289+
if (py_sync && PyObject_IsTrue(py_sync)) {
290+
sync_to_browser = true;
291+
}
292+
287293
FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools");
288-
TArray<UObject *> objects = AssetToolsModule.Get().ImportAssets(files, UTF8_TO_TCHAR(destination), factory, false);
294+
TArray<UObject *> objects = AssetToolsModule.Get().ImportAssets(files, UTF8_TO_TCHAR(destination), factory, sync_to_browser);
289295

290296
if (objects.Num() == 1) {
291297

0 commit comments

Comments
 (0)