init_unreal

Inheritance diagram of init_unreal

Inheritance diagram


class xrfeitoria.factory.init_unreal(exec_path: str | Path | None = None, project_path: str | Path | None = None, background: bool = False, reload_rpc_code: bool = False, replace_plugin: bool = False, dev_plugin: bool = False, new_process: bool = False)[source]

Initialize Unreal with XRFeitoria, which would start Unreal as RPC server, and yield a XRFeitoriaUnreal object.

Examples

  • Use as context manager:

    >>> import xrfeitoria as xf
    >>> with xf.init_unreal() as xf_runner:
    >>>     ...
    
  • Or use directly:

    >>> import xrfeitoria as xf
    >>> xf_runner = xf.init_unreal()
    >>> ...
    >>> xf_runner.close()
    
Yields:

XRFeitoriaUnreal – XRFeitoria Factory class for Unreal.

__init__(exec_path: str | Path | None = None, project_path: str | Path | None = None, background: bool = False, reload_rpc_code: bool = False, replace_plugin: bool = False, dev_plugin: bool = False, new_process: bool = False) None[source]

Giving arguments to initialize.

Parameters:
  • exec_path (Optional[PathLike], optional) – Path to Unreal executable. Defaults to None.

  • project_path (Optional[PathLike], optional) – Path to Unreal project. Defaults to None.

  • background (bool, optional) – Whether to start Unreal in background. Defaults to False.

  • 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. 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.

  • new_process (bool, optional) – Whether to start Unreal in a new process. Defaults to False.

Note

If dev_plugin=True, the plugin under local directory would be used, which is under src/XRFeitoriaUnreal. You should git clone first, and then use this option if you want to develop the plugin. Please ref to How to use the plugin of Blender/Unreal under development.

1git clone https://github.com/openxrlab/xrfeitoria.git
2cd xrfeitoria
3pip install -e .
4python -c "import xrfeitoria as xf; xf.init_unreal(replace_plugin=True, dev_plugin=True)"
close() None[source]

Close the RPC server.