more tidying

This commit is contained in:
Eric 2023-06-10 18:50:48 -07:00
parent 2035e8ee30
commit b645c883c2
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
8 changed files with 100 additions and 98 deletions

40
.efrocachemap generated
View File

@ -4072,26 +4072,26 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/18/4b/787a9267e17be3c49966072581a5", "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/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/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/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/ba/b4/7e053a33756878603ba00826826b", "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/7c/e6/db247f005814b452c76163e5fa06", "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/6a/89/4c80d68f001d348ba69e5ea2b245", "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/8d/02/0f1ed7d6c2872a1272c03d84f3fb", "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/19/cd/abc6f64d139ef2cac9cd3344833b", "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/a9/94/288e0610137a9f7676f09476b7ac", "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/1b/3b/116944511f23d262d27428540840", "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/af/cc/7f2a36e5596761e202dd6d868b67", "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/be/a8/1455e76a1225c5a8352b58551d8c", "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/7d/f0/52640f401e3718b7d5820739e664", "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/63/7c/17a12487d65bbc814926a3fbd99f", "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/cd/cc/2eedc7d8e4b6a16d53cb11a2a717", "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/1f/32/e330133cc7fd61e2ceed1a58789a", "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/ea/ee/55046a303844f5a9f23b071dbdaf", "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/7b/e1/0f59080a901b541ba836b301ad5d", "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/67/6c/0554265899eeb170f819b7181148", "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/c6/e1/c6485774e2085bb0078a026bbc84", "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/ff/5d/a0bb46538cd6a98893ebffab0504", "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/88/ab/60e65a8a1078d5232e8ada256b88", "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/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_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", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/31/65/014221e46f7974f40aa84c8922dc",

View File

@ -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 - 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 changes coming in 1.8. Basically this means that a lot of things will be

View File

@ -12,6 +12,10 @@ from efro.util import set_canonical_module_names
import _babase import _babase
from _babase import ( from _babase import (
show_progress_bar,
print_load_info,
reload_media,
set_stress_testing,
get_max_graphics_quality, get_max_graphics_quality,
add_clean_frame_callback, add_clean_frame_callback,
has_gamma_control, has_gamma_control,
@ -233,6 +237,10 @@ __all__ = [
'get_remote_app_name', 'get_remote_app_name',
'is_browser_likely_available', 'is_browser_likely_available',
'json_prep', '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. # We want stuff to show up as babase.Foo instead of babase._sub.Foo.

View File

@ -6,24 +6,19 @@ from __future__ import annotations
import random import random
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
import _babase import babase
import _bauiv1 import bascenev1
import _bascenev1
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Sequence from typing import Any, Sequence
import babase
import bascenev1
def run_cpu_benchmark() -> None: def run_cpu_benchmark() -> None:
"""Run a cpu benchmark.""" """Run a cpu benchmark."""
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
from bascenev1lib import tutorial from bascenev1lib import tutorial
from bascenev1._session import Session
class BenchmarkSession(Session): class BenchmarkSession(bascenev1.Session):
"""Session type for cpu benchmark.""" """Session type for cpu benchmark."""
def __init__(self) -> None: def __init__(self) -> None:
@ -33,23 +28,23 @@ def run_cpu_benchmark() -> None:
super().__init__(depsets) super().__init__(depsets)
# Store old graphics settings. # Store old graphics settings.
self._old_quality = _babase.app.config.resolve('Graphics Quality') self._old_quality = babase.app.config.resolve('Graphics Quality')
cfg = _babase.app.config cfg = babase.app.config
cfg['Graphics Quality'] = 'Low' cfg['Graphics Quality'] = 'Low'
cfg.apply() cfg.apply()
self.benchmark_type = 'cpu' self.benchmark_type = 'cpu'
self.setactivity(_bascenev1.newactivity(tutorial.TutorialActivity)) self.setactivity(bascenev1.newactivity(tutorial.TutorialActivity))
def __del__(self) -> None: def __del__(self) -> None:
# When we're torn down, restore old graphics settings. # When we're torn down, restore old graphics settings.
cfg = _babase.app.config cfg = babase.app.config
cfg['Graphics Quality'] = self._old_quality cfg['Graphics Quality'] = self._old_quality
cfg.apply() cfg.apply()
def on_player_request(self, player: bascenev1.SessionPlayer) -> bool: def on_player_request(self, player: bascenev1.SessionPlayer) -> bool:
return False return False
_bascenev1.new_host_session(BenchmarkSession, benchmark_type='cpu') bascenev1.new_host_session(BenchmarkSession, benchmark_type='cpu')
def run_stress_test( def run_stress_test(
@ -60,13 +55,12 @@ def run_stress_test(
) -> None: ) -> None:
"""Run a stress test.""" """Run a stress test."""
from babase import modutils from babase import modutils
from babase._general import Call
_babase.screenmessage( babase.screenmessage(
"Beginning stress test.. use 'End Test' to stop testing.", "Beginning stress test.. use 'End Test' to stop testing.",
color=(1, 1, 0), color=(1, 1, 0),
) )
with _babase.ContextRef.empty(): with babase.ContextRef.empty():
start_stress_test( start_stress_test(
{ {
'playlist_type': playlist_type, 'playlist_type': playlist_type,
@ -75,10 +69,10 @@ def run_stress_test(
'round_duration': round_duration, 'round_duration': round_duration,
} }
) )
_babase.apptimer( babase.apptimer(
7.0, 7.0,
Call( babase.Call(
_babase.screenmessage, babase.screenmessage,
( (
'stats will be written to ' 'stats will be written to '
+ modutils.get_human_readable_user_scripts_path() + modutils.get_human_readable_user_scripts_path()
@ -90,14 +84,14 @@ def run_stress_test(
def stop_stress_test() -> None: def stop_stress_test() -> None:
"""End a running stress test.""" """End a running stress test."""
_babase.set_stress_testing(False, 0) babase.set_stress_testing(False, 0)
assert _babase.app.classic is not None assert babase.app.classic is not None
try: try:
if _babase.app.classic.stress_test_reset_timer is not None: if babase.app.classic.stress_test_reset_timer is not None:
_babase.screenmessage('Ending stress test...', color=(1, 1, 0)) babase.screenmessage('Ending stress test...', color=(1, 1, 0))
except Exception: except Exception:
pass 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: 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._dualteamsession import DualTeamSession
from bascenev1._freeforallsession import FreeForAllSession 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'] playlist_type = args['playlist_type']
if playlist_type == 'Random': if playlist_type == 'Random':
if random.random() < 0.5: if random.random() < 0.5:
playlist_type = 'Teams' playlist_type = 'Teams'
else: else:
playlist_type = 'Free-For-All' playlist_type = 'Free-For-All'
_babase.screenmessage( babase.screenmessage(
'Running Stress Test (listType="' 'Running Stress Test (listType="'
+ playlist_type + playlist_type
+ '", listName="' + '", listName="'
@ -125,25 +119,25 @@ def start_stress_test(args: dict[str, Any]) -> None:
if playlist_type == 'Teams': if playlist_type == 'Teams':
appconfig['Team Tournament Playlist Selection'] = args['playlist_name'] appconfig['Team Tournament Playlist Selection'] = args['playlist_name']
appconfig['Team Tournament Playlist Randomize'] = 1 appconfig['Team Tournament Playlist Randomize'] = 1
_babase.apptimer( babase.apptimer(
1.0, 1.0,
Call( Call(
_babase.pushcall, babase.pushcall,
Call(_bascenev1.new_host_session, DualTeamSession), Call(bascenev1.new_host_session, DualTeamSession),
), ),
) )
else: else:
appconfig['Free-for-All Playlist Selection'] = args['playlist_name'] appconfig['Free-for-All Playlist Selection'] = args['playlist_name']
appconfig['Free-for-All Playlist Randomize'] = 1 appconfig['Free-for-All Playlist Randomize'] = 1
_babase.apptimer( babase.apptimer(
1.0, 1.0,
Call( Call(
_babase.pushcall, babase.pushcall,
Call(_bascenev1.new_host_session, FreeForAllSession), Call(bascenev1.new_host_session, FreeForAllSession),
), ),
) )
_babase.set_stress_testing(True, args['player_count']) babase.set_stress_testing(True, args['player_count'])
_babase.app.classic.stress_test_reset_timer = _babase.AppTimer( babase.app.classic.stress_test_reset_timer = babase.AppTimer(
args['round_duration'], Call(_reset_stress_test, args) 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: def _reset_stress_test(args: dict[str, Any]) -> None:
from babase._general import Call from babase._general import Call
_babase.set_stress_testing(False, args['player_count']) babase.set_stress_testing(False, args['player_count'])
_babase.screenmessage('Resetting stress test...') babase.screenmessage('Resetting stress test...')
session = _bascenev1.get_foreground_host_session() session = bascenev1.get_foreground_host_session()
assert session is not None assert session is not None
session.end() 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: def run_gpu_benchmark() -> None:
"""Kick off a benchmark to test gpu speeds.""" """Kick off a benchmark to test gpu speeds."""
# FIXME: Not wired up yet. # 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: def run_media_reload_benchmark() -> None:
"""Kick off a benchmark to test media reloading speeds.""" """Kick off a benchmark to test media reloading speeds."""
from babase._general import Call from babase._general import Call
_babase.reload_media() babase.reload_media()
_bauiv1.show_progress_bar() babase.show_progress_bar()
def delay_add(start_time: float) -> None: def delay_add(start_time: float) -> None:
def doit(start_time_2: float) -> None: def doit(start_time_2: float) -> None:
_babase.screenmessage( babase.screenmessage(
_babase.app.lang.get_resource( babase.app.lang.get_resource(
'debugWindow.totalReloadTimeText' 'debugWindow.totalReloadTimeText'
).replace('${TIME}', str(_babase.apptime() - start_time_2)) ).replace('${TIME}', str(babase.apptime() - start_time_2))
) )
_babase.print_load_info() babase.print_load_info()
if _babase.app.config.resolve('Texture Quality') != 'High': if babase.app.config.resolve('Texture Quality') != 'High':
_babase.screenmessage( babase.screenmessage(
_babase.app.lang.get_resource( babase.app.lang.get_resource(
'debugWindow.reloadBenchmarkBestResultsText' 'debugWindow.reloadBenchmarkBestResultsText'
), ),
color=(1, 1, 0), 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 # The reload starts (should add a completion callback to the
# reload func to fix this). # reload func to fix this).
_babase.apptimer(0.05, Call(delay_add, _babase.apptime())) babase.apptimer(0.05, Call(delay_add, babase.apptime()))

View File

@ -28,7 +28,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be # Build number and version of the ballistica binary we expect to be
# using. # using.
TARGET_BALLISTICA_BUILD = 21089 TARGET_BALLISTICA_BUILD = 21090
TARGET_BALLISTICA_VERSION = '1.7.20' TARGET_BALLISTICA_VERSION = '1.7.20'
_g_env_config: EnvConfig | None = None _g_env_config: EnvConfig | None = None

View File

@ -619,6 +619,29 @@ static PyMethodDef PyGetDisplayResolutionDef = {
"display. Returns None if resolutions cannot be directly set.", "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<PyMethodDef> { auto PythonMethodsGraphics::GetMethods() -> std::vector<PyMethodDef> {
@ -640,6 +663,7 @@ auto PythonMethodsGraphics::GetMethods() -> std::vector<PyMethodDef> {
PyGetMaxGraphicsQualityDef, PyGetMaxGraphicsQualityDef,
PySafeColorDef, PySafeColorDef,
PyCharStrDef, PyCharStrDef,
PyShowProgressBarDef,
}; };
} }

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica { namespace ballistica {
// These are set automatically via script; don't modify them here. // 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"; const char* kEngineVersion = "1.7.20";
auto MonolithicMain(const core::CoreConfig& core_config) -> int { auto MonolithicMain(const core::CoreConfig& core_config) -> int {

View File

@ -2508,29 +2508,6 @@ static PyMethodDef PyShowAppInviteDef = {
"Category: **General Utility Functions**", "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 ------------------------- // --------------------- set_party_icon_always_visible -------------------------
static auto PySetPartyIconAlwaysVisible(PyObject* self, PyObject* args, static auto PySetPartyIconAlwaysVisible(PyObject* self, PyObject* args,
@ -2880,7 +2857,6 @@ auto PythonMethodsUIV1::GetMethods() -> std::vector<PyMethodDef> {
PyGetSpecialWidgetDef, PyGetSpecialWidgetDef,
PySetPartyWindowOpenDef, PySetPartyWindowOpenDef,
PySetPartyIconAlwaysVisibleDef, PySetPartyIconAlwaysVisibleDef,
PyShowProgressBarDef,
PyShowAppInviteDef, PyShowAppInviteDef,
PyShowAdDef, PyShowAdDef,
PyShowAd2Def, PyShowAd2Def,