init_blender
Inheritance diagram
- class xrfeitoria.factory.init_blender(new_process: bool = False, 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, cleanup: bool = True)[source]
Initialize Blender with
XRFeitoria, which would start Blender as RPC server, and yield aXRFeitoriaBlenderobject.Examples
Use as context manager:
>>> import xrfeitoria as xf >>> with xf.init_blender() as xf_runner: >>> ...
Or use directly:
>>> import xrfeitoria as xf >>> xf_runner = xf.init_blender() >>> ... >>> xf_runner.close()
- Yields:
XRFeitoriaBlender– XRFeitoria Factory class for Blender.
- __init__(new_process: bool = False, 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, cleanup: bool = True) None[source]
Giving arguments to initialize.
- Parameters:
new_process (bool, optional) – Whether to start Blender in a new process. Defaults to False.
exec_path (Optional[PathLike], optional) – Path to Blender executable. Defaults to None.
project_path (Optional[PathLike], optional) – Path to Blender project. Defaults to None.
background (bool, optional) – Whether to start Blender 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.
cleanup (bool, optional) – Whether to clean up the scene. Defaults to True.
Note
If
dev_plugin=True, the plugin under local directory would be used, which is undersrc/XRFeitoriaBlender. 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_blender(replace_plugin=True, dev_plugin=True)"