xrfeitoria.utils.runner
Runner for starting blender or unreal as a rpc server.
- class xrfeitoria.utils.runner.BlenderRPCRunner(new_process: bool = False, engine_exec: str | Path | None = None, project_path: str | Path = '', reload_rpc_code: bool = False, replace_plugin: bool = False, dev_plugin: bool = False, background: bool = True)[source]
- class xrfeitoria.utils.runner.RPCRunner(new_process: bool = False, engine_exec: str | Path | None = None, project_path: str | Path = '', reload_rpc_code: bool = False, replace_plugin: bool = False, dev_plugin: bool = False, background: bool = True)[source]
A wrapper for starting blender as a rpc server.
- __init__(new_process: bool = False, engine_exec: str | Path | None = None, project_path: str | Path = '', reload_rpc_code: bool = False, replace_plugin: bool = False, dev_plugin: bool = False, background: bool = True) None[source]
Initialize RPCRunner.
- Parameters:
new_process (bool, optional) – whether to start a new process. Defaults to False.
engine_exec (Optional[PathLike], optional) – path to engine executable. Defaults to None.
project_path (PathLike, optional) – path to project. Defaults to ‘’.
reload_rpc_code (bool, optional) – whether to reload the registered rpc functions and classes. If you are developing the package or writing a custom remote function, set this to True to reload the code. This will only be in effect when new_process=False if the engine process is reused. Defaults to False.
replace_plugin (bool, optional) – whether to replace the plugin installed for the engine. Defaults to False.
dev_plugin (bool, optional) – Whether to use the plugin under local directory. If False, would use the plugin downloaded from a remote server. Defaults to False.
background (bool, optional) – whether to run the engine in background without GUI. Defaults to True.
- check_engine_alive() None[source]
Check if the engine process is alive. This function should be called in a separate thread.
- Raises:
RuntimeError – if engine process is not alive.
- check_engine_alive_psutil() None[source]
Check if the engine process is alive using psutil. This function should be called in a separate thread.
- Raises:
RuntimeError – if engine process is not alive.
- get_process_output(process: Popen) str[source]
Get process output when process is exited with non-zero code.
- abstract get_src_plugin_path() Path[source]
Get plugin source path, including downloading or symlinking/copying from local directory.
- priority:
if self.dev_plugin=False: download from url > build from source
if self.dev_plugin=True: build from source
- Returns:
Path – plugin source path
- reuse() bool[source]
Try to reuse existing engine process.
- Returns:
bool – whether the engine process is reused.
- Raises:
RuntimeError – if new_process=True but an existing engine process is found.
- wait_for_start(process: Popen) None[source]
Wait 3 minutes for RPC server to start.
After 3 minutes, ask user if they want to quit if it takes too long.
- Parameters:
process (subprocess.Popen) – process to wait for.
- property dst_plugin_dir: Path
Get plugin directory to install.
- property installed_plugin_version: str
Get plugin version installed.
- property plugin_info: PluginInfo
- property plugin_url: str | None
- property port: int
Get RPC port depending on engine type.
- class xrfeitoria.utils.runner.UnrealRPCRunner(new_process: bool = False, engine_exec: str | Path | None = None, project_path: str | Path = '', reload_rpc_code: bool = False, replace_plugin: bool = False, dev_plugin: bool = False, background: bool = True)[source]
UnrealRPCRunner.
- xrfeitoria.utils.runner.plugin_info_type
alias of
PluginInfo