From b645c883c2f92d08cc2ca0b19646061b9591c439 Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 10 Jun 2023 18:50:48 -0700 Subject: [PATCH] more tidying --- .efrocachemap | 40 ++++---- CHANGELOG.md | 2 +- src/assets/ba_data/python/babase/__init__.py | 8 ++ .../ba_data/python/baclassic/_benchmark.py | 96 +++++++++---------- src/assets/ba_data/python/baenv.py | 2 +- .../python/methods/python_methods_graphics.cc | 24 +++++ src/ballistica/shared/ballistica.cc | 2 +- .../python/methods/python_methods_ui_v1.cc | 24 ----- 8 files changed, 100 insertions(+), 98 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 419eb8df..ccb2efcb 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4072,26 +4072,26 @@ "build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/18/4b/787a9267e17be3c49966072581a5", "build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/20/f6/4ce9bc3c1f3732f6adf8237fbe9b", "build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/a5/30/9058181df0b1255bf6950cbc7813", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/71/a6/af3d85ee30571b5d2ee6c1c983a6", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ba/b4/7e053a33756878603ba00826826b", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7c/e6/db247f005814b452c76163e5fa06", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/6a/89/4c80d68f001d348ba69e5ea2b245", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/8d/02/0f1ed7d6c2872a1272c03d84f3fb", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/19/cd/abc6f64d139ef2cac9cd3344833b", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a9/94/288e0610137a9f7676f09476b7ac", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/1b/3b/116944511f23d262d27428540840", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/af/cc/7f2a36e5596761e202dd6d868b67", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/be/a8/1455e76a1225c5a8352b58551d8c", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7d/f0/52640f401e3718b7d5820739e664", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/63/7c/17a12487d65bbc814926a3fbd99f", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/cd/cc/2eedc7d8e4b6a16d53cb11a2a717", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/1f/32/e330133cc7fd61e2ceed1a58789a", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ea/ee/55046a303844f5a9f23b071dbdaf", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7b/e1/0f59080a901b541ba836b301ad5d", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/67/6c/0554265899eeb170f819b7181148", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/c6/e1/c6485774e2085bb0078a026bbc84", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/ff/5d/a0bb46538cd6a98893ebffab0504", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/88/ab/60e65a8a1078d5232e8ada256b88", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/f2/dc/bf56d88353b11986373e899b5bf6", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/3c/43/731228e0f7c8e5396b06ca916ffd", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/71/24/b8bedec2fab3fd83381a23385a9a", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/5f/96/a43273ad50d90d9342f45c22c0e8", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/c9/75/393357c2a3f4d3eec2035bc3ecff", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/b0/85/d8778105cf5a536cb5e6e618c723", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e8/41/5128ac78c21f238d0613ab8e2ece", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7f/4d/96dadaf30683f4a69426518ca334", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/c3/ca/939e97f16820b0ee1af7d190ca85", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/12/37/d741089b132fbcb8b22d9795479a", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d7/ab/b4e7f9aa5b15b38606051341deae", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7e/2f/2e475906c60e960a63fdd3e5f24d", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/c1/fb/5c472b18817431b3e5d5dc7ed27e", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/1d/2f/ab1c77b292726178d0eb1f5699ad", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e5/f3/6ac25a8397a62ec4af1d9d5d2c37", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/14/59/2164e23d78a6b16a97b3bfe7bdb2", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/f1/74/0cd435f4a2c4c585f96f7f92f0d9", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/7b/af/0a54bb0a94e2054e486d41a54952", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e5/9a/0de72b7deec764c81076a97a0a00", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e0/69/2dd80316d1d73969095a85b1d0aa", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/29/dc/e5b08aae2dbe3222082aaa1e90e7", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ce/bb/5796a83ce9d1c9cf58e08f3ff351", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/31/65/014221e46f7974f40aa84c8922dc", diff --git a/CHANGELOG.md b/CHANGELOG.md index 30b32e0e..ee5eae32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.20 (build 21089, api 8, 2023-06-09) +### 1.7.20 (build 21090, api 8, 2023-06-10) - This seems like a good time for a `refactoring` release in anticipation of changes coming in 1.8. Basically this means that a lot of things will be diff --git a/src/assets/ba_data/python/babase/__init__.py b/src/assets/ba_data/python/babase/__init__.py index e251d883..22c2b243 100644 --- a/src/assets/ba_data/python/babase/__init__.py +++ b/src/assets/ba_data/python/babase/__init__.py @@ -12,6 +12,10 @@ from efro.util import set_canonical_module_names import _babase from _babase import ( + show_progress_bar, + print_load_info, + reload_media, + set_stress_testing, get_max_graphics_quality, add_clean_frame_callback, has_gamma_control, @@ -233,6 +237,10 @@ __all__ = [ 'get_remote_app_name', 'is_browser_likely_available', 'json_prep', + 'set_stress_testing', + 'reload_media', + 'print_load_info', + 'show_progress_bar', ] # We want stuff to show up as babase.Foo instead of babase._sub.Foo. diff --git a/src/assets/ba_data/python/baclassic/_benchmark.py b/src/assets/ba_data/python/baclassic/_benchmark.py index 5b36006c..4c583cb1 100644 --- a/src/assets/ba_data/python/baclassic/_benchmark.py +++ b/src/assets/ba_data/python/baclassic/_benchmark.py @@ -6,24 +6,19 @@ from __future__ import annotations import random from typing import TYPE_CHECKING -import _babase -import _bauiv1 -import _bascenev1 +import babase +import bascenev1 if TYPE_CHECKING: from typing import Any, Sequence - import babase - import bascenev1 - def run_cpu_benchmark() -> None: """Run a cpu benchmark.""" # pylint: disable=cyclic-import from bascenev1lib import tutorial - from bascenev1._session import Session - class BenchmarkSession(Session): + class BenchmarkSession(bascenev1.Session): """Session type for cpu benchmark.""" def __init__(self) -> None: @@ -33,23 +28,23 @@ def run_cpu_benchmark() -> None: super().__init__(depsets) # Store old graphics settings. - self._old_quality = _babase.app.config.resolve('Graphics Quality') - cfg = _babase.app.config + self._old_quality = babase.app.config.resolve('Graphics Quality') + cfg = babase.app.config cfg['Graphics Quality'] = 'Low' cfg.apply() self.benchmark_type = 'cpu' - self.setactivity(_bascenev1.newactivity(tutorial.TutorialActivity)) + self.setactivity(bascenev1.newactivity(tutorial.TutorialActivity)) def __del__(self) -> None: # When we're torn down, restore old graphics settings. - cfg = _babase.app.config + cfg = babase.app.config cfg['Graphics Quality'] = self._old_quality cfg.apply() def on_player_request(self, player: bascenev1.SessionPlayer) -> bool: return False - _bascenev1.new_host_session(BenchmarkSession, benchmark_type='cpu') + bascenev1.new_host_session(BenchmarkSession, benchmark_type='cpu') def run_stress_test( @@ -60,13 +55,12 @@ def run_stress_test( ) -> None: """Run a stress test.""" from babase import modutils - from babase._general import Call - _babase.screenmessage( + babase.screenmessage( "Beginning stress test.. use 'End Test' to stop testing.", color=(1, 1, 0), ) - with _babase.ContextRef.empty(): + with babase.ContextRef.empty(): start_stress_test( { 'playlist_type': playlist_type, @@ -75,10 +69,10 @@ def run_stress_test( 'round_duration': round_duration, } ) - _babase.apptimer( + babase.apptimer( 7.0, - Call( - _babase.screenmessage, + babase.Call( + babase.screenmessage, ( 'stats will be written to ' + modutils.get_human_readable_user_scripts_path() @@ -90,14 +84,14 @@ def run_stress_test( def stop_stress_test() -> None: """End a running stress test.""" - _babase.set_stress_testing(False, 0) - assert _babase.app.classic is not None + babase.set_stress_testing(False, 0) + assert babase.app.classic is not None try: - if _babase.app.classic.stress_test_reset_timer is not None: - _babase.screenmessage('Ending stress test...', color=(1, 1, 0)) + if babase.app.classic.stress_test_reset_timer is not None: + babase.screenmessage('Ending stress test...', color=(1, 1, 0)) except Exception: pass - _babase.app.classic.stress_test_reset_timer = None + babase.app.classic.stress_test_reset_timer = None def start_stress_test(args: dict[str, Any]) -> None: @@ -106,16 +100,16 @@ def start_stress_test(args: dict[str, Any]) -> None: from bascenev1._dualteamsession import DualTeamSession from bascenev1._freeforallsession import FreeForAllSession - assert _babase.app.classic is not None + assert babase.app.classic is not None - appconfig = _babase.app.config + appconfig = babase.app.config playlist_type = args['playlist_type'] if playlist_type == 'Random': if random.random() < 0.5: playlist_type = 'Teams' else: playlist_type = 'Free-For-All' - _babase.screenmessage( + babase.screenmessage( 'Running Stress Test (listType="' + playlist_type + '", listName="' @@ -125,25 +119,25 @@ def start_stress_test(args: dict[str, Any]) -> None: if playlist_type == 'Teams': appconfig['Team Tournament Playlist Selection'] = args['playlist_name'] appconfig['Team Tournament Playlist Randomize'] = 1 - _babase.apptimer( + babase.apptimer( 1.0, Call( - _babase.pushcall, - Call(_bascenev1.new_host_session, DualTeamSession), + babase.pushcall, + Call(bascenev1.new_host_session, DualTeamSession), ), ) else: appconfig['Free-for-All Playlist Selection'] = args['playlist_name'] appconfig['Free-for-All Playlist Randomize'] = 1 - _babase.apptimer( + babase.apptimer( 1.0, Call( - _babase.pushcall, - Call(_bascenev1.new_host_session, FreeForAllSession), + babase.pushcall, + Call(bascenev1.new_host_session, FreeForAllSession), ), ) - _babase.set_stress_testing(True, args['player_count']) - _babase.app.classic.stress_test_reset_timer = _babase.AppTimer( + babase.set_stress_testing(True, args['player_count']) + babase.app.classic.stress_test_reset_timer = babase.AppTimer( args['round_duration'], Call(_reset_stress_test, args) ) @@ -151,45 +145,45 @@ def start_stress_test(args: dict[str, Any]) -> None: def _reset_stress_test(args: dict[str, Any]) -> None: from babase._general import Call - _babase.set_stress_testing(False, args['player_count']) - _babase.screenmessage('Resetting stress test...') - session = _bascenev1.get_foreground_host_session() + babase.set_stress_testing(False, args['player_count']) + babase.screenmessage('Resetting stress test...') + session = bascenev1.get_foreground_host_session() assert session is not None session.end() - _babase.apptimer(1.0, Call(start_stress_test, args)) + babase.apptimer(1.0, Call(start_stress_test, args)) def run_gpu_benchmark() -> None: """Kick off a benchmark to test gpu speeds.""" # FIXME: Not wired up yet. - _babase.screenmessage('Not wired up yet.', color=(1, 0, 0)) + babase.screenmessage('Not wired up yet.', color=(1, 0, 0)) def run_media_reload_benchmark() -> None: """Kick off a benchmark to test media reloading speeds.""" from babase._general import Call - _babase.reload_media() - _bauiv1.show_progress_bar() + babase.reload_media() + babase.show_progress_bar() def delay_add(start_time: float) -> None: def doit(start_time_2: float) -> None: - _babase.screenmessage( - _babase.app.lang.get_resource( + babase.screenmessage( + babase.app.lang.get_resource( 'debugWindow.totalReloadTimeText' - ).replace('${TIME}', str(_babase.apptime() - start_time_2)) + ).replace('${TIME}', str(babase.apptime() - start_time_2)) ) - _babase.print_load_info() - if _babase.app.config.resolve('Texture Quality') != 'High': - _babase.screenmessage( - _babase.app.lang.get_resource( + babase.print_load_info() + if babase.app.config.resolve('Texture Quality') != 'High': + babase.screenmessage( + babase.app.lang.get_resource( 'debugWindow.reloadBenchmarkBestResultsText' ), color=(1, 1, 0), ) - _babase.add_clean_frame_callback(Call(doit, start_time)) + babase.add_clean_frame_callback(Call(doit, start_time)) # The reload starts (should add a completion callback to the # reload func to fix this). - _babase.apptimer(0.05, Call(delay_add, _babase.apptime())) + babase.apptimer(0.05, Call(delay_add, babase.apptime())) diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 50268bef..0075dfca 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21089 +TARGET_BALLISTICA_BUILD = 21090 TARGET_BALLISTICA_VERSION = '1.7.20' _g_env_config: EnvConfig | None = None diff --git a/src/ballistica/base/python/methods/python_methods_graphics.cc b/src/ballistica/base/python/methods/python_methods_graphics.cc index 38f82896..ba6f5107 100644 --- a/src/ballistica/base/python/methods/python_methods_graphics.cc +++ b/src/ballistica/base/python/methods/python_methods_graphics.cc @@ -619,6 +619,29 @@ static PyMethodDef PyGetDisplayResolutionDef = { "display. Returns None if resolutions cannot be directly set.", }; +// --------------------------- show_progress_bar ------------------------------- + +static auto PyShowProgressBar(PyObject* self, PyObject* args, PyObject* keywds) + -> PyObject* { + BA_PYTHON_TRY; + + g_base->graphics->EnableProgressBar(false); + Py_RETURN_NONE; + BA_PYTHON_CATCH; +} + +static PyMethodDef PyShowProgressBarDef = { + "show_progress_bar", // name + (PyCFunction)PyShowProgressBar, // method + METH_VARARGS | METH_KEYWORDS, // flags + + "show_progress_bar() -> None\n" + "\n" + "(internal)\n" + "\n" + "Category: **General Utility Functions**", +}; + // ----------------------------------------------------------------------------- auto PythonMethodsGraphics::GetMethods() -> std::vector { @@ -640,6 +663,7 @@ auto PythonMethodsGraphics::GetMethods() -> std::vector { PyGetMaxGraphicsQualityDef, PySafeColorDef, PyCharStrDef, + PyShowProgressBarDef, }; } diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 0427668b..077fad41 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21089; +const int kEngineBuildNumber = 21090; const char* kEngineVersion = "1.7.20"; auto MonolithicMain(const core::CoreConfig& core_config) -> int { diff --git a/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc b/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc index f736ac58..eb690e19 100644 --- a/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc +++ b/src/ballistica/ui_v1/python/methods/python_methods_ui_v1.cc @@ -2508,29 +2508,6 @@ static PyMethodDef PyShowAppInviteDef = { "Category: **General Utility Functions**", }; -// --------------------------- show_progress_bar ------------------------------- - -static auto PyShowProgressBar(PyObject* self, PyObject* args, PyObject* keywds) - -> PyObject* { - BA_PYTHON_TRY; - - g_base->graphics->EnableProgressBar(false); - Py_RETURN_NONE; - BA_PYTHON_CATCH; -} - -static PyMethodDef PyShowProgressBarDef = { - "show_progress_bar", // name - (PyCFunction)PyShowProgressBar, // method - METH_VARARGS | METH_KEYWORDS, // flags - - "show_progress_bar() -> None\n" - "\n" - "(internal)\n" - "\n" - "Category: **General Utility Functions**", -}; - // --------------------- set_party_icon_always_visible ------------------------- static auto PySetPartyIconAlwaysVisible(PyObject* self, PyObject* args, @@ -2880,7 +2857,6 @@ auto PythonMethodsUIV1::GetMethods() -> std::vector { PyGetSpecialWidgetDef, PySetPartyWindowOpenDef, PySetPartyIconAlwaysVisibleDef, - PyShowProgressBarDef, PyShowAppInviteDef, PyShowAdDef, PyShowAd2Def,