Skip to content

Commit

Permalink
Better error handling for Blender RPC import
Browse files Browse the repository at this point in the history
- If RPC import fails, then try a direct import as well. While it's
 slower, it may be better than failing the import completely.
- Connection errors will disable RPC automatically, to avoid having to
wait the full 30 seconds timeout each time.
  This should be properly fixed by allowing to override the timeout
per HTTPClient.
  • Loading branch information
RedMser committed Feb 6, 2023
1 parent 8a37fad commit 8f099c7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/gltf/editor/editor_import_blend_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,18 @@ Error EditorImportBlendRunner::start_blender(const String &p_python_script, bool

Error EditorImportBlendRunner::do_import(const Dictionary &p_options) {
if (is_using_rpc()) {
return do_import_rpc(p_options);
Error err = do_import_rpc(p_options);
if (err != OK) {
// Retry without using RPC (slow, but better than the import failing completely).
if (err == ERR_CONNECTION_ERROR) {
// Disable RPC if the connection could not be established.
print_error(vformat("Failed to connect to Blender via RPC, switching to direct imports of .blend files. Check your proxy and firewall settings, then RPC can be re-enabled by changing the editor setting `filesystem/import/blender/rpc_port` to %d.", rpc_port));
EditorSettings::get_singleton()->set_manually("filesystem/import/blender/rpc_port", 0);
rpc_port = 0;
}
err = do_import_direct(p_options);
}
return err;
} else {
return do_import_direct(p_options);
}
Expand Down

0 comments on commit 8f099c7

Please sign in to comment.