diff --git a/.efrocachemap b/.efrocachemap index 42ec3c4d..a0988d5d 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3932,40 +3932,40 @@ "assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450", "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", - "build/prefab/full/linux_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/05/97/c75696243a0e63432d7a07b9e541", - "build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/4f/f4/58b1276d799f260a917151942188", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4a/27/83c7019c59300c2aca4f5a754051", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2b/38/ce62f31635fe2e55878a64fe83cd", - "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/cb/7e/c443e2cbfe0e801b55052884f439", - "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/83/a6/c12fd0f06e2d4a1fd321e7167cca", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/bd/23/b1d1778ecf9b94fc2f0dbae16871", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/16/42/b1f3e1e5402b678803a2293b4bca", - "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f0/a8/be099908c78b407dfc9b09124ee6", - "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/72/04/18d03c9d9f77c44c16d088fbb70b", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/da/f1/727f2ac37aa51173dc5e3015644d", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/94/1b/4f45419c394074d8f5c1e047c96f", - "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/68/2d/9c107b87643a661f096c044ab8ef", - "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/7a/29/18fcde057dc0e188216378155bba", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d5/e2/d243cb95d5311bbfe1f1e0b98243", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e3/4e/1ff439845d41e434797237c66d50", - "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/15/ab/01a1b43e6cecc51996bb767a5a60", - "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/56/19/5616c88a0027a1d55cf1b13311aa", - "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/1f/24/3bf3efb77893fe8a3bf5e67a7df2", - "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/19/b2/01519693dc088ba6b2024ff14890", - "build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f1/c8/a4a550a865921406b9ff2200b4e9", - "build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/64/d2/d78ca40dfa9160204852a285cbcb", - "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4c/2e/71b22e2c2215ab9c23f48bf865bc", - "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8c/e8/3216f8d6ee4a579bcfbd8328006c", - "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0c/09/c000299176fa0befab116264bc0f", - "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ab/b4/cceb8aebfe34ff004c1d5d731e82", - "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ba/a7/5770e8eb3dfd4aa9eab8d5d21140", - "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/56/13/c0b33bddae9718f8f6a08b232fbb", - "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f2/54/c06d0c7be96d8189bcb9f1f973ee", - "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e6/9f/d454ad6d0a929cf50a25e00fbb1c", - "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c4/34/5547240bb2426fef6f94f86c56f4", - "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5e/df/35bc323b5d93d7b87072962b1c42", - "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5e/cb/2a6a8335774f4fba807f0b76c80e", - "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b1/2a/70248a9b34e2ff29ee755698f3b4", - "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/73/12/ad5165079a5a7a6617cd7754d90d", - "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1c/a9/8a27edf168183efb6aa0b8284862" + "build/prefab/full/linux_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/77/45/69456cef2c9fddd5bb6a3497972b", + "build/prefab/full/linux_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/87/6d/1bc0e1c667216e278e7c95050955", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f6/b1/713661602c7580e060a5b2f5391c", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a4/2c/526bd742d1a1763d500bbfdfd763", + "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/30/f1/57680bd744ac6825dc44641c7f3f", + "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/71/5a/738514f3af01ecf3c806239e22e6", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/20/26/2145ff72ccd4f408a27da6b42b82", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/34/e1/9dc07498dd96f73540290c884287", + "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e5/99/22214c0b91bcc3298568c87b6487", + "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/75/ae/0d37c72901fdfb64e8104aa1406f", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cb/24/c5bb95114f793bc857504446a59e", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/53/0e/6725c8e8fa2c25e431e10b40384d", + "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/06/5e/694a00eb244e4925a1c3f74b5f02", + "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/32/f1/3a137d806dff7845d7e2dc766452", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f2/c6/b97c5eeea5307d0c679a9d2fa869", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/76/80/08157eac8b97c0d68802f90120f9", + "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/c8/88/996fd4b6e10df4afbd23263da36f", + "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/27/98/b2fff1ad82e5cbc25eac397e4ae6", + "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/c1/69/62108258025dea6f8e7488e0e802", + "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/3d/4d/b6cee501623ef5d78fb15bc87215", + "build/prefab/lib/linux_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b8/55/25ff15308d89838699e158024f9c", + "build/prefab/lib/linux_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/dd/84/13497d8139e3b6095a87940188af", + "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b5/de/6e368b0f405c9fbed0e9e6ab0e6a", + "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/f0/6296ed8275094c2c1c96bbe98b56", + "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d9/7c/f166ddf0d1720ccea1720a1c2965", + "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/75/b3/5cad6cf47697b6f03bea6369ef5b", + "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d5/3a/fa01e178b6da2879864b50252c98", + "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/48/4d/a3d1385420e5866559c210c584f1", + "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6e/3e/1f7b71a7639703bb13d71fb36ae9", + "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8e/c1/373ad978ad9807f64baf6215a230", + "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8a/d6/17652e3a94201b26b228d2fc53df", + "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7a/36/3267309a349385e52af77a2738a1", + "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b8/d1/0318bfa712c7e6ef0d46c9b25033", + "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/58/5f/1f0121bd900ad5345e9a27cd6198", + "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/be/53/9de41660d67305ac5669141e557c", + "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/27/d6/b5d5e1a56aaa00acf174dc609b59" } \ No newline at end of file diff --git a/docs/ba_module.md b/docs/ba_module.md index 667d9e75..8866ae06 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2021-04-15 for Ballistica version 1.6.0 build 20337

+

last updated on 2021-04-15 for Ballistica version 1.6.0 build 20338

This page documents the Python classes and functions in the 'ba' module, which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!


diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index 8d4adbfc..000d1378 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -21,7 +21,7 @@ namespace ballistica { // These are set automatically via script; don't change here. -const int kAppBuildNumber = 20338; +const int kAppBuildNumber = 20339; const char* kAppVersion = "1.6.0"; // Our standalone globals. diff --git a/src/ballistica/python/python.cc b/src/ballistica/python/python.cc index 84e9500d..2c096a68 100644 --- a/src/ballistica/python/python.cc +++ b/src/ballistica/python/python.cc @@ -947,7 +947,7 @@ void Python::Reset(bool do_init) { + std::string(ver)); } - SetObj(ObjID::kEmptyTuple, PyTuple_New(0)); + StoreObj(ObjID::kEmptyTuple, PyTuple_New(0)); // Get the app up and running. // Run a few core bootstrappy things first: @@ -970,7 +970,7 @@ void Python::Reset(bool do_init) { throw Exception("Unable to get value: '" + std::string("app_state") + "'."); } - SetObj(ObjID::kApp, appstate); + StoreObj(ObjID::kApp, appstate); // Import and grab all the Python stuff we use. #include "generated/ballistica/binding.inc" @@ -985,7 +985,7 @@ void Python::Reset(bool do_init) { // Read the config file and store the config dict for easy access. obj(ObjID::kReadConfigCall).Call(); - SetObj(ObjID::kConfig, obj(ObjID::kApp).GetAttr("config").get()); + StoreObj(ObjID::kConfig, obj(ObjID::kApp).GetAttr("config").get()); assert(PyDict_Check(obj(ObjID::kConfig).get())); // Turn off fancy-pants cyclic garbage-collection. @@ -2345,21 +2345,21 @@ void Python::PartyInviteRevoke(const std::string& invite_id) { obj(ObjID::kHandlePartyInviteRevokeCall).Call(args); } -void Python::SetObj(ObjID id, PyObject* pyobj, bool incref) { +void Python::StoreObj(ObjID id, PyObject* pyobj, bool incref) { assert(id < ObjID::kLast); assert(pyobj); if (g_buildconfig.debug_build()) { // Assuming we're setting everything once // (make sure we don't accidentally overwrite things we don't intend to). if (objs_[static_cast(id)].exists()) { - throw Exception("Python::SetObj() called twice for val '" + throw Exception("Python::StoreObj() called twice for val '" + std::to_string(static_cast(id)) + "'."); } // Also make sure we're not storing an object that's already been stored. for (auto&& i : objs_) { if (i.get() != nullptr && i.get() == pyobj) { - throw Exception("Python::SetObj() called twice for same ptr; id=" + throw Exception("Python::StoreObj() called twice for same ptr; id=" + std::to_string(static_cast(id)) + "."); } } @@ -2370,27 +2370,27 @@ void Python::SetObj(ObjID id, PyObject* pyobj, bool incref) { objs_[static_cast(id)].Steal(pyobj); } -void Python::SetObjCallable(ObjID id, PyObject* pyobj, bool incref) { - SetObj(id, pyobj, incref); +void Python::StoreObjCallable(ObjID id, PyObject* pyobj, bool incref) { + StoreObj(id, pyobj, incref); BA_PRECONDITION(obj(id).CallableCheck()); } -void Python::SetObj(ObjID id, const char* expr, PyObject* context) { +void Python::StoreObj(ObjID id, const char* expr, PyObject* context) { PyObject* obj = PythonCommand(expr, "").RunReturnObj(false, context); if (obj == nullptr) { throw Exception("Unable to get value: '" + std::string(expr) + "'."); } - SetObj(id, obj); + StoreObj(id, obj); } -void Python::SetObjCallable(ObjID id, const char* expr, PyObject* context) { +void Python::StoreObjCallable(ObjID id, const char* expr, PyObject* context) { PyObject* obj = PythonCommand(expr, "").RunReturnObj(false, context); if (obj == nullptr) { throw Exception("Unable to get value: '" + std::string(expr) + "'."); } - SetObjCallable(id, obj); + StoreObjCallable(id, obj); } void Python::SetRawConfigValue(const char* name, float value) { diff --git a/src/ballistica/python/python.h b/src/ballistica/python/python.h index 39ef32ea..876f05f4 100644 --- a/src/ballistica/python/python.h +++ b/src/ballistica/python/python.h @@ -396,18 +396,18 @@ class Python { void SetupPythonHome(); /// Set the value for a named object. - void SetObj(ObjID id, PyObject* pyobj, bool incref = false); + void StoreObj(ObjID id, PyObject* pyobj, bool incref = false); /// Set the value for a named object and verify that it is a callable. - void SetObjCallable(ObjID id, PyObject* pyobj, bool incref = false); + void StoreObjCallable(ObjID id, PyObject* pyobj, bool incref = false); /// Set the value for a named object to the result of a Python expression. - void SetObj(ObjID id, const char* expression, PyObject* context = nullptr); + void StoreObj(ObjID id, const char* expression, PyObject* context = nullptr); /// Set the value for a named object to the result of a Python expression /// and verify that it is callable. - void SetObjCallable(ObjID id, const char* expression, - PyObject* context = nullptr); + void StoreObjCallable(ObjID id, const char* expression, + PyObject* context = nullptr); std::set do_once_locations_; PythonRef objs_[static_cast(ObjID::kLast)]; diff --git a/src/generated_src/Makefile b/src/generated_src/Makefile index 647a32a1..8e357d35 100644 --- a/src/generated_src/Makefile +++ b/src/generated_src/Makefile @@ -10,9 +10,9 @@ generated_code: ../generated/ballistica/binding.inc \ clean: @rm -rf ../generated -../generated/ballistica/bootstrap.inc : ballistica/bootstrap.py +../generated/ballistica/bootstrap.inc : ballistica/bootstrap.py ../../tools/batools/codegen.py @../../tools/pcommand gen_flat_data_code $< $@ bootstrap_code -../generated/ballistica/binding.inc : ballistica/binding.py +../generated/ballistica/binding.inc : ballistica/binding.py ../../tools/batools/codegen.py @../../tools/pcommand gen_binding_code $< $@ diff --git a/tools/batools/build.py b/tools/batools/build.py index af9e3c4b..f11700ae 100644 --- a/tools/batools/build.py +++ b/tools/batools/build.py @@ -168,7 +168,10 @@ def lazybuild(target: str, category: SourceCategory, command: str) -> None: # Everything possibly affecting generated code. if category is SourceCategory.CODE_GEN: - paths = ['Makefile', 'tools/generate_code', 'src/generated_src'] + paths = [ + 'Makefile', 'tools/generate_code', 'tools/batools/codegen.py', + 'src/generated_src' + ] # Everything possibly affecting asset builds. elif category is SourceCategory.ASSETS: diff --git a/tools/batools/codegen.py b/tools/batools/codegen.py index d10b1214..11c4e89f 100644 --- a/tools/batools/codegen.py +++ b/tools/batools/codegen.py @@ -57,7 +57,7 @@ def gen_binding_code(projroot: str, in_path: str, out_path: str) -> None: with open(in_path) as infile: pycode = infile.read() - # Double quotes causes errors. + # Double quotes cause errors. if '"' in pycode: raise Exception('bindings file can\'t contain double quotes.') lines = [ @@ -89,7 +89,7 @@ def gen_binding_code(projroot: str, in_path: str, out_path: str) -> None: # Then it pulls the individual values out of the returned tuple. for i, line in enumerate(lines): - ccode += ('SetObjCallable(ObjID::' + line[1] + + ccode += ('StoreObjCallable(ObjID::' + line[1] + ', PyTuple_GET_ITEM(bindvals, ' + str(i) + '), true);\n') # Lastly it cleans up after itself.