diff --git a/direct/src/plugin/p3dInstance.cxx b/direct/src/plugin/p3dInstance.cxx index 8f19b24b30..80c0c7553c 100644 --- a/direct/src/plugin/p3dInstance.cxx +++ b/direct/src/plugin/p3dInstance.cxx @@ -131,6 +131,7 @@ P3DInstance(P3D_request_ready_func *func, _allow_python_dev = false; _keep_user_env = (_fparams.lookup_token_int("keep_user_env") != 0); _auto_start = (_fparams.lookup_token_int("auto_start") != 0); + _stop_on_ready = (_fparams.lookup_token_int("stop_on_ready") != 0); _auto_install = true; if (_fparams.has_token("auto_install")) { _auto_install = (_fparams.lookup_token_int("auto_install") != 0); @@ -1960,7 +1961,9 @@ scan_app_desc_file(TiXmlDocument *doc) { } nout << "_auto_install = " << _auto_install - << ", _auto_start = " << _auto_start << "\n"; + << ", _auto_start = " << _auto_start + << ", _stop_on_ready = " << _stop_on_ready + << "\n"; if (_hidden && _got_wparams) { _wparams.set_window_type(P3D_WT_hidden); @@ -2465,7 +2468,8 @@ make_splash_window() { } if (_wparams.get_window_type() != P3D_WT_embedded && - !_stuff_to_download && _auto_install && _auto_start && _p3d_trusted) { + !_stuff_to_download && _auto_install && + (_auto_start || _stop_on_ready) && _p3d_trusted) { // If it's a toplevel or fullscreen window, then we don't want a // splash window unless we have stuff to download, or a button to // display. @@ -2869,9 +2873,17 @@ ready_to_start() { _panda_script_object->set_string_property("status", "ready"); send_notify("onready"); + + P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr(); + if (_stop_on_ready) { + // If we've got the "stop_on_ready" token, then exit abruptly + // now, instead of displaying the splash window. + request_stop_main_thread(); + return; + } + if (_auto_start) { set_background_image(IT_launch); - P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr(); inst_mgr->start_instance(this); } else { diff --git a/direct/src/plugin/p3dInstance.h b/direct/src/plugin/p3dInstance.h index f877b52f6a..b889a62000 100644 --- a/direct/src/plugin/p3dInstance.h +++ b/direct/src/plugin/p3dInstance.h @@ -284,6 +284,7 @@ private: bool _keep_user_env; bool _auto_install; bool _auto_start; + bool _stop_on_ready; bool _auth_button_clicked; bool _failed;