diff --git a/doc/project_structure.md b/doc/project_structure.md index a9f34592..7d571075 100644 --- a/doc/project_structure.md +++ b/doc/project_structure.md @@ -38,8 +38,8 @@ It's also responsible for scene and session updates during viewport render sessi Note: If we have a context (i.e. `context is not None`) then we are in viewport render mode. If we have no context (`context is None`) then we are in final render or material preview mode. This is not explained/commented all the time in the code because it's such a fundamental concept. -However, it's not like we have no context at all in final render mode, you can still get it with `bpy.context`. -But it is not passed into the methods by the RenderEngine API in Blender. +Important: It is forbidden by the Blender API to access the context during final render, so you +should not resort to hacks like using `bpy.context` when there is no context passed into a function. Note also that nodes are not exported here, they have their own export methods in their classes (in the **nodes** directory, see below). diff --git a/export/config.py b/export/config.py index 07ea0ca5..55881ce5 100644 --- a/export/config.py +++ b/export/config.py @@ -247,7 +247,7 @@ def _convert_filesaver(scene, definitions, luxcore_engine): filesaver_path = config.filesaver_path output_path = utils.get_abspath(filesaver_path, must_exist=True, must_be_existing_dir=True) - blend_name = bpy.path.basename(bpy.context.blend_data.filepath) + blend_name = bpy.path.basename(bpy.data.filepath) blend_name = os.path.splitext(blend_name)[0] # remove ".blend" if not blend_name: