This commit is contained in:
Eric 2023-05-23 19:12:58 -07:00
parent 0e18102d0a
commit b96d6c478c
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
20 changed files with 119 additions and 113 deletions

View File

@ -4072,50 +4072,50 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b",
"build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877",
"build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/61/9e/57f57350dd74322b8209df1c2ab2",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/19/0f/1b613ebce69d0051157f7304a6c0",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/62/95/9613eed0081ece44e16944cf197b",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/bb/c1/7006332df9f208c1d862926b243d",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/e4/15/b833330fb3f35cde84c349f8ad75",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/41/48/a6fa80b0cd9ce7f9fe39ce9fb1ad",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c4/53/508a28b711f2bb30f2bf203d01d6",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/94/b4/3b006c6726fe4d45574f72887b80",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/b7/f4/bf6d929838a3d62f97f48128283c",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/aa/44/9170a96ea7afb9856e94a19d68e6",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d5/fc/20f1fa8019eed78913c5d79b97bf",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0a/ea/1048057a56e1362137d97411a084",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d4/44/32bd2d8b2d405694100137dc80f9",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/74/76/659d7cc884f6b59f46f9eaa3bc08",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/1e/70/613c8dd9149b9c49591ebb85aab8",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/13/19/1b00d6b1286270745cb5fd1269f1",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/88/95/36c70cd911f080f752c78821d566",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/f0/04/a370fd8f428f3d8bbfa050a37f7f",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/29/f3/84c15946a1461b16c3cb017717a5",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/43/0a/1d5808a9c4532afc9d5eda69150f",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/44/96/ceccefa3e740b0a1543bc2473ab4",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/4c/f7/97e567f2fbb5f029e899b941ad48",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/7b/37/82cefa419a7bf2cf6d5501d99115",
"build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/99/7a/b1bed0a416fe4f049417b4f91ae5",
"build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/bb/fd/3c6239f33fc43db757b9ccfc3eb5",
"build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/99/a6/6bc6d018e69376764f0be1384327",
"build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/12/8a/34f91cc2398b69852f16549e0aff",
"build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b1/43/5ec5a46b79f6d6de0ff36c9d3f11",
"build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/be/d3/7a5e9216cac6ac635e6573e5e731",
"build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/44/bf/63799587d2e421474c117a6cc908",
"build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/13/67/6836f81cc90fbe9d37a04bbfcfff",
"build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/52/4c/a2a0d78b127ed5169f113da7d106",
"build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ec/6b/b01676a7ba1adce108eabf44f73c",
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/e1/84/5d9f9df50ff721e5c2c71cc56939",
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/66/8f/bf85aa04688d57e2a65f45f1fb6e",
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/0e/7f/01dcf9d4756fae48bed8ba99e4cb",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/29/11/cdaba86e4d8bf24a1a812e739250",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/8d/6c/4527e7a3a4d8949d55c93f1ea768",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/7a/71/3ffafe40432570e2cc56fc3cca0d",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/17/43/1e0ec75a6b021d177c96c4a05c92",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/ee/08/b90ac9959997a4d20c35270fc5c0",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/63/c7/ed1894b587b0551e4559850a19d5",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/e3/81/9dbf4b2383ffde62523a200a38da",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/08/02/e65aaab8e8726f9795f710fd85ab",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/cf/b3/64abb0ccdebfa72916a8ee762b4e",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/57/93/e11f79a8dc058214a6760b3898d0",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e6/c2/b813958185eefaa77223cd2ff53e",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a5/2e/b3d835ffd3435b7b9e72cf9b9930",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1c/df/01d7bfaa0cb74c7b53b0c73417db",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/6c/bf/fa6f465f583cb1899d0dcbe11a28",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/2f/c3/d8b851a447dad1f9a06477c6cd5b",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7e/3d/34e9cb37701e84eb773a0d886583",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/4f/ff/e2cdccbd3ada0d69b6959e70a071",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/76/08/6ae049775659b5f942ab1f213549",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/33/e1/ff18af39a66597adab1cdf7a5345",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/60/ff/3472a34d892c5dbc841d97799b15",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/3c/8e/d0216fe8a30fe4f583b89f395954",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e9/a5/429dd4fd1869b7f43c5c7623d304",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/7b/fa/86e36f79023c6ada69a6758a80e7",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e5/15/d2c75f7102103c763bd6dea40c27",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/3c/92/486671bf8e8cc57db875ed7264d3",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/5e/dc/c9c0b407dc89cfdb787b0edf6b8f",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/18/3c/7c3cc0299e586b39f413474d5953",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/bf/93/01882243ada503f7c0ed29ab3516",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f4/e7/32cfbd534ac61e626f6c6fbe2b01",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f3/f8/52577356f2ff5229ed4e5a6764cf",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/60/2b/35acb337afc2d997ffc94d2da757",
"build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3f/91/9d57b5688d3fdedc41ad0a91cfcc",
"build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/a9/92/58c58ab93d71d77eac753c7632ed",
"build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/40/35/f0ce16f78cb98281471dc4fb1048",
"build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/5b/b3/487175ffc786ab47da1220b95643",
"build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b6/e7/1d76994d633f5e189754b477da1d",
"build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/fb/7b/7a6549bb17264a5040d4db99a4cc",
"build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/eb/ab/4311e83907061aad56967531f41b",
"build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/85/0f/8d444fa4c7774c1c93d7b863ff59",
"build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/e6/c2/f5c2b4284534e68f6e41a4b4b2ca",
"build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/0d/d2/f99384c5c22ae99e0a70b7d2534a",
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/30/4a/aa281e0eb46722098ec29d7da4f8",
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/0b/e4/a9d278c1bc9a5d731f865ac91a0b",
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/92/f7/8898478ab4ef0a342c727dd64195",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/cb/5f/f1638adbe8eb9984c079b1a61888",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/92/be/7b77cfcfa107c1d33ea845b603c1",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/e9/04/118bc7ad2a64a0f31e11f08d69ff",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/e5/08/35c2f73c14264e15fe436bf4cd5e",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/fd/72/dd95f9df72e1785ecd5c4f68786d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/5a/9e/b473defe42a2ee3d8b4349f647d7",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/77/bc/36da2d04f8e04f865c8e3293e74d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/c8/b9/82d868f08eddc94b99e12c772138",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa",
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/b4/3d/e352190a0e5673d101c0f3ee3ad2",

View File

@ -1,4 +1,4 @@
### 1.7.20 (build 21020, api 8, 2023-05-17)
### 1.7.20 (build 21021, api 8, 2023-05-23)
- 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

View File

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

View File

@ -52,21 +52,22 @@ write `import babase` at the top of your Python module, this is what you are
doing - you are creating a `babase` global for yourself that you can then use
from anywhere in your module.
Our analog to Python modules in Ballistica C++ is the `FeatureSetFrontEnd`
class. Feature-sets can define a subclass of `FeatureSetFrontEnd` which exposes
some C++ functionality, and other feature-sets can call that class's static
`Import()` method to get access to a shared singleton instance of that
front-end. So far this sounds pretty similar to Python modules.
Our analog to Python modules in Ballistica C++ is the
`FeatureSetNativeComponent` class. Feature-sets can define a subclass of
`FeatureSetNativeComponent` which exposes some C++ functionality, and other
feature-sets can call that class's static `Import()` method to get access to the
shared single instance of that class. So far this sounds pretty similar to
Python modules.
Where it breaks down, however, is the concept of module globals - the `babase`
we imported at the top of our Python script and can then use throughout it. Yes,
we could create a global `g_base` pointer in C++ for the `BaseFeatureSet` we
just imported, but then *all* our C++ code can access that global and there's no
elegant way to ensure it has been imported before being used. Alternately we
could have *no* globals and just have each `FeatureSetFrontEnd` store pointers
to any other `FeatureSetFrontEnd` it uses, but then we'd have to be passing
around, storing, and jumping through tons of feature-set pointers constantly to
do anything in the engine.
could have *no* globals and just have each `FeatureSetNativeComponent` store
pointers to any other `FeatureSetNativeComponent` it uses, but then we'd have to
be passing around, storing, and jumping through tons of feature-set pointers
constantly to do anything in the engine.
In the end, the happy-medium solution employed by Ballistica is a combination of
globals and namespaces. Each feature-set has its own C++ namespace that is

View File

@ -89,12 +89,12 @@ void BaseFeatureSet::OnModuleExec(PyObject* module) {
assert(g_core == nullptr);
g_core = core::CoreFeatureSet::Import();
g_core->BootLog("_babase exec begin");
// Want to run this at the last possible moment before spinning up
// our BaseFeatureSet. This locks in baenv customizations.
g_core->python->ApplyBaEnvConfig();
g_core->BootLog("_babase exec begin");
// Create our feature-set's C++ front-end.
assert(g_base == nullptr);
g_base = new BaseFeatureSet();
@ -103,26 +103,20 @@ void BaseFeatureSet::OnModuleExec(PyObject* module) {
// know we're now present.
core::g_base_soft = g_base;
// Define our classes.
// NOTE: Normally we'd define our classes *after* we import stuff
// (like a regular Python module generally would) but for now we need
// FeatureSetData to exist or no modules can call StoreOnPythonModule
// which causes problems so we have to do this early. Maybe can revisit
// later when things are more untangled.
g_base->python->AddPythonClasses(module);
// Store our C++ front-end with our Python module.
// This lets anyone get at us by going through the Python
// import system (keeping things nice and consistent between
// Python and C++ worlds).
// This is what allows others to 'import' our C++ front end.
g_base->StoreOnPythonModule(module);
// baenv can now feed us logs and run some checks.
g_core->python->RunBaEnvOnBaBaseImport();
// ..and because baenv is now feeding us logs, we can push any logs through
// that we've been holding on to.
g_core->python->EnablePythonLoggingCalls();
g_base->python->ImportPythonObjs();
// Read the app config. Should this perhaps go in StartApp or something?
g_base->python->ReadConfig();
// Import any other C++ feature-set-front-ends we use.
// FIXME: neither of these should be here.
assert(g_classic == nullptr);
@ -130,6 +124,16 @@ void BaseFeatureSet::OnModuleExec(PyObject* module) {
assert(g_ui_v1 == nullptr);
g_ui_v1 = ui_v1::UIV1FeatureSet::Import();
// let baenv know it can now feed us logs and run some checks.
g_core->python->RunBaEnvOnBaBaseImport();
// ..and because baenv is now feeding us logs, we can push any logs through
// that we've been holding on to.
g_core->python->EnablePythonLoggingCalls();
// Read the app config. Should this perhaps go in StartApp or something?
g_base->python->ReadConfig();
// Marker we pop down at the very end so other modules can run sanity
// checks to make sure we aren't importing them reciprocally when they
// import us.
@ -285,12 +289,13 @@ void BaseFeatureSet::PlusDirectSendV1CloudLogs(const std::string& prefix,
}
}
auto BaseFeatureSet::CreateFeatureSetData(FeatureSetFrontEnd* featureset)
auto BaseFeatureSet::CreateFeatureSetData(FeatureSetNativeComponent* featureset)
-> PyObject* {
return PythonClassFeatureSetData::Create(featureset);
}
auto BaseFeatureSet::FeatureSetFromData(PyObject* obj) -> FeatureSetFrontEnd* {
auto BaseFeatureSet::FeatureSetFromData(PyObject* obj)
-> FeatureSetNativeComponent* {
if (!PythonClassFeatureSetData::Check(obj)) {
FatalError("Module FeatureSetData attr is an incorrect type.");
}

View File

@ -597,7 +597,7 @@ extern ui_v1::UIV1FeatureSet* g_ui_v1;
/// Our C++ front-end to our feature set. This is what other C++
/// feature-sets can 'Import' from us.
class BaseFeatureSet : public FeatureSetFrontEnd,
class BaseFeatureSet : public FeatureSetNativeComponent,
public core::BaseSoftInterface {
public:
/// Instantiates our FeatureSet if needed and returns the single
@ -660,9 +660,9 @@ class BaseFeatureSet : public FeatureSetFrontEnd,
void PlusDirectSendV1CloudLogs(const std::string& prefix,
const std::string& suffix, bool instant,
int* result) override;
auto CreateFeatureSetData(FeatureSetFrontEnd* featureset)
auto CreateFeatureSetData(FeatureSetNativeComponent* featureset)
-> PyObject* override;
auto FeatureSetFromData(PyObject* obj) -> FeatureSetFrontEnd* override;
auto FeatureSetFromData(PyObject* obj) -> FeatureSetNativeComponent* override;
void V1CloudLog(const std::string& msg) override;
void PushConsolePrintCall(const std::string& msg) override;
auto GetPyExceptionType(PyExcType exctype) -> PyObject* override;

View File

@ -19,7 +19,7 @@ void PythonClassFeatureSetData::SetupType(PyTypeObject* cls) {
cls->tp_methods = tp_methods;
}
auto PythonClassFeatureSetData::Create(FeatureSetFrontEnd* feature_set)
auto PythonClassFeatureSetData::Create(FeatureSetNativeComponent* feature_set)
-> PyObject* {
assert(feature_set);
assert(TypeIsSetUp(&type_obj));

View File

@ -10,13 +10,13 @@
namespace ballistica::base {
/// A simple Python class we use to hold a pointer to a C++
/// FeatureSetFrontEnd instance. This allows us to piggyback on Python's import
/// system in our C++ layer.
/// FeatureSetNativeComponent instance. This allows us to piggyback on Python's
/// import system in our C++ layer.
class PythonClassFeatureSetData : public PythonClass {
public:
static void SetupType(PyTypeObject* cls);
static auto type_name() -> const char*;
static auto Create(FeatureSetFrontEnd* feature_set) -> PyObject*;
static auto Create(FeatureSetNativeComponent* feature_set) -> PyObject*;
static auto Check(PyObject* o) -> bool {
return PyObject_TypeCheck(o, &type_obj);
}
@ -31,7 +31,7 @@ class PythonClassFeatureSetData : public PythonClass {
PyExcType::kType);
}
auto feature_set() const -> FeatureSetFrontEnd* {
auto feature_set() const -> FeatureSetNativeComponent* {
assert(feature_set_);
return feature_set_;
}
@ -43,7 +43,7 @@ class PythonClassFeatureSetData : public PythonClass {
static auto tp_new(PyTypeObject* type, PyObject* args, PyObject* keywds)
-> PyObject*;
static void tp_dealloc(PythonClassFeatureSetData* self);
FeatureSetFrontEnd* feature_set_{};
FeatureSetNativeComponent* feature_set_{};
static auto Play(PythonClassFeatureSetData* self, PyObject* args,
PyObject* keywds) -> PyObject*;
};

View File

@ -28,9 +28,7 @@ void ClassicFeatureSet::OnModuleExec(PyObject* module) {
g_classic = new ClassicFeatureSet();
// Store our C++ front-end with our Python module.
// This lets anyone get at us by going through the Python
// import system (keeping things nice and consistent between
// Python and C++ worlds).
// This is what allows others to 'import' our C++ front end.
g_classic->StoreOnPythonModule(module);
// Import any Python stuff we use into objs_.

View File

@ -55,7 +55,7 @@ extern ClassicFeatureSet* g_classic;
/// Our C++ front-end to our feature set. This is what other C++
/// feature-sets can 'Import' from us.
class ClassicFeatureSet : public FeatureSetFrontEnd {
class ClassicFeatureSet : public FeatureSetNativeComponent {
public:
/// Instantiate our FeatureSet if needed and return the single
/// instance of it. Basically a Python import statement.

View File

@ -29,9 +29,10 @@ class BaseSoftInterface {
virtual void PlusDirectSendV1CloudLogs(const std::string& prefix,
const std::string& suffix,
bool instant, int* result) = 0;
virtual auto CreateFeatureSetData(FeatureSetFrontEnd* featureset)
virtual auto CreateFeatureSetData(FeatureSetNativeComponent* featureset)
-> PyObject* = 0;
virtual auto FeatureSetFromData(PyObject* obj) -> FeatureSetFrontEnd* = 0;
virtual auto FeatureSetFromData(PyObject* obj)
-> FeatureSetNativeComponent* = 0;
virtual void V1CloudLog(const std::string& msg) = 0;
virtual void PushConsolePrintCall(const std::string& msg) = 0;
virtual auto GetPyExceptionType(PyExcType exctype) -> PyObject* = 0;

View File

@ -57,12 +57,9 @@ void SceneV1FeatureSet::OnModuleExec(PyObject* module) {
// Create our feature-set's C++ front-end.
assert(g_scene_v1 == nullptr);
g_scene_v1 = new SceneV1FeatureSet();
g_scene_v1->python->AddPythonClasses(module);
// Store our C++ front-end with our Python module.
// This lets anyone get at us by going through the Python
// import system (keeping things nice and consistent between
// Python and C++ worlds).
// This is what allows others to 'import' our C++ front end.
g_scene_v1->StoreOnPythonModule(module);
// Import any Python stuff we use into objs_.
@ -74,6 +71,9 @@ void SceneV1FeatureSet::OnModuleExec(PyObject* module) {
assert(g_classic == nullptr);
g_classic = classic::ClassicFeatureSet::Import();
// Define our classes.
g_scene_v1->python->AddPythonClasses(module);
g_core->BootLog("_bascenev1 exec end");
}

View File

@ -315,7 +315,7 @@ extern base::BaseFeatureSet* g_base;
extern SceneV1FeatureSet* g_scene_v1;
extern classic::ClassicFeatureSet* g_classic;
class SceneV1FeatureSet : public FeatureSetFrontEnd {
class SceneV1FeatureSet : public FeatureSetNativeComponent {
public:
/// Called when our associated Python module is instantiated.
static void OnModuleExec(PyObject* module);

View File

@ -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 = 21020;
const int kEngineBuildNumber = 21021;
const char* kEngineVersion = "1.7.20";
auto MonolithicMain(const core::CoreConfig& core_config) -> int {

View File

@ -10,10 +10,10 @@ namespace ballistica {
const char* kFeatureSetDataAttrName = "_ba_feature_set_data";
FeatureSetFrontEnd::~FeatureSetFrontEnd() = default;
FeatureSetNativeComponent::~FeatureSetNativeComponent() = default;
auto FeatureSetFrontEnd::BaseImportThroughPythonModule(const char* modulename)
-> FeatureSetFrontEnd* {
auto FeatureSetNativeComponent::BaseImportThroughPythonModule(
const char* modulename) -> FeatureSetNativeComponent* {
// Our feature-set has an associated Python module, so we want all
// importing to go through Python. This keeps things consistent no
// matter whether we are used from C++ or Python. We simply import
@ -58,7 +58,7 @@ auto FeatureSetFrontEnd::BaseImportThroughPythonModule(const char* modulename)
return feature_set;
}
void FeatureSetFrontEnd::StoreOnPythonModule(PyObject* module) {
void FeatureSetNativeComponent::StoreOnPythonModule(PyObject* module) {
// We need our feature-set-data class from _babase for this.
assert(core::g_core);
auto* basefs = core::g_core->SoftImportBase();

View File

@ -14,15 +14,15 @@ extern const char* kFeatureSetDataAttrName;
/// Using this, one can 'import' feature-sets directly in C++ without
/// worrying about wrangling the Python layer (or whether the feature-set
/// even has a Python component to it).
class FeatureSetFrontEnd {
class FeatureSetNativeComponent {
public:
virtual ~FeatureSetFrontEnd();
virtual ~FeatureSetNativeComponent();
/// FeatureSets with C++ front-ends AND Python binary module components
/// should use this during module exec to store themselves with the module.
/// Then their Import() method should use ImportThroughPythonModule below
/// to fetch the front-end. This keeps the C++ and Python layers nicely
/// synced.
/// Generally a feature-set's native component is stored in a special
/// Python object with a predefined name inside its native Python module.
/// This allows native feature set components to 'Import' each other by
/// importing each other's native Python modules and looking for said
/// special object. This method does that storing.
void StoreOnPythonModule(PyObject* module);
protected:
@ -38,7 +38,7 @@ class FeatureSetFrontEnd {
private:
static auto BaseImportThroughPythonModule(const char* modulename)
-> FeatureSetFrontEnd*;
-> FeatureSetNativeComponent*;
};
} // namespace ballistica

View File

@ -38,7 +38,7 @@ typedef int64_t microsecs_t;
// to keep compile times down.
struct cJSON;
class EventLoop;
class FeatureSetFrontEnd;
class FeatureSetNativeComponent;
class JsonDict;
class Matrix44f;
class Object;

View File

@ -33,12 +33,13 @@ extern core::CoreFeatureSet* g_core;
extern base::BaseFeatureSet* g_base;
extern TemplateFsFeatureSet* g_template_fs;
/// Our C++ front-end to our feature set. This is what other C++
/// feature-sets can 'Import' from us.
class TemplateFsFeatureSet : public FeatureSetFrontEnd {
/// The native C++ portion of our feature set. We can make this available
/// for other feature sets to 'Import' directly in C++ in addition to
/// exposing functionality though a Python api.
class TemplateFsFeatureSet : public FeatureSetNativeComponent {
public:
/// Instantiate our FeatureSet if needed and return the single
/// instance of it. Basically a Python import statement.
/// Instantiate and return our singleton instance.
/// Basically a Python import statement.
static auto Import() -> TemplateFsFeatureSet*;
/// Called when our binary Python module first gets imported.

View File

@ -42,7 +42,7 @@ extern UIV1FeatureSet* g_ui_v1;
/// Our C++ front-end to our feature set. This is what other C++
/// feature-sets can 'Import' from us.
class UIV1FeatureSet : public FeatureSetFrontEnd {
class UIV1FeatureSet : public FeatureSetNativeComponent {
public:
/// Instantiate our FeatureSet if needed and return the single
/// instance of it. Basically a Python import statement.

View File

@ -306,7 +306,7 @@ class LazyBuildContext:
if not self.printed_trigger:
self.printed_trigger = True
print(
f'{Clr.MAG}LazyBuildContext: '
f'{Clr.MAG}Lazybuild: '
f'{Clr.BLD}{self.target_name_pretty}{Clr.RST}{Clr.MAG}'
f' build triggered by change in '
f'{Clr.BLD}{path}{Clr.RST}{Clr.MAG}.{Clr.RST}',