I’m trying to look into the concept of using Python in editor to create levels, setup assets, build lights, and finally build the package. (Looking for quick turnaround from customer assets to final playable result).
From my research and experimentation so far I know we can create levels and populate it with assets, but I seem unable to find the correct API calls to start the light-bake processes or the packaging processes. I’m finding python classes to make LightingBuild settings, and ProjectPackaging settings, but nothing to actually start the process.
What are my options here, or can you help point me in the correct direction?
Any help would be greatly appreciated, thanks.
Still need answer and assistance, but will provide update on current research, in the event someone else is looking to solve the same issues.
Figured out how to call C++ code from a python script from this very helpful video. Not at all complicated as everything (may be some exceptions) exposed to Blueprints will also be exposed to Python.
class PYTHONPROJECT_API UPythonFunctions : public UBlueprintFunctionLibrary
static void CalledFromPython(FString InputString);
LogPython: unreal.PythonFunctions.called_from_python("Hello world")
LogTemp: Error: Hello world
(Exactly as expected)
Things to note:
Functions declared in PascalCase in C++ will be converted to snake_case within the unreal python module.
To be able to call the build lighting commands, or the package project commands, it seems I either will need to go into the engine and expose that code to Blueprints/Python, or write some custom C++ code (Plugin perhaps) to call it for me.
Thank you for your clue, I followed this method and find a function in c++ file.
in the header file “Editor/LevelEditor/Public/LevelEditorActions.h” FlevelEditorActionCallbacks::BuildLightingOnly_execute().
I tried to include the header file and call the function, but it doesn’t pass the compiling.