File tree Expand file tree Collapse file tree 6 files changed +18
-13
lines changed Expand file tree Collapse file tree 6 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,14 @@ accept arguments into `sys.argv`.
3535
3636## Initialization Script
3737If you want to make more permanent mods, you'll want to use the initialization script. By default
38- this is ` __main__.py ` in the game's cwd. The initialization script is automatically run after sdk
39- initialization, so you can use it to import other files and generally perform all your setup.
38+ this is ` __main__.py ` in the same folder as the ` pyunrealsdk.dll ` . The initialization script is
39+ automatically run after sdk initialization, so you can use it to import other files and generally
40+ perform all your setup.
4041
4142You can swap to a different initialization script by using setting ` pyunrealsdk.init_script ` in the
4243[ unrealsdk configuration file] ( https://github.com/bl-sdk/unrealsdk/#configuration ) . If you do this
4344you may also want to set ` pyunrealsdk.pyexec_root ` , so that ` pyexec ` commands work from the same
44- folder.
45+ folder. These are relative to the folder ` pyunrealsdk.dll ` is in (or you can supply absolute paths).
4546
4647## Using SDK bindings
4748Once you've got code running, you probably want to setup some hooks - the sdk can run callbacks
Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## Upcoming
4+ - The ` pyunrealsdk.init_script ` and ` pyunrealsdk.pyexec_root ` config options are now relative to the
5+ folder containing the ` pyunrealsdk.dll ` . Previously, they were relative to the cwd, which could
6+ cause issues if it changed.
7+
38## v1.8.0
49- Added ` WeakPointer.replace ` , to modify a pointer in-place.
510
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ namespace {
1515
1616void pyexec_cmd_handler (const wchar_t * line, size_t size, size_t cmd_len) {
1717 static const std::filesystem::path root =
18- unrealsdk::config::get_str (" pyunrealsdk.pyexec_root" ).value_or (" " );
18+ unrealsdk::utils::get_this_dll ().parent_path ()
19+ / unrealsdk::config::get_str (" pyunrealsdk.pyexec_root" ).value_or (" " );
1920
2021 auto file_start = std::find_if_not (line + cmd_len, line + size, &std::iswspace);
2122 const size_t file_len = (line + size) - file_start;
Original file line number Diff line number Diff line change 88#include " pyunrealsdk/version.h"
99#include " unrealsdk/config.h"
1010#include " unrealsdk/unrealsdk.h"
11+ #include " unrealsdk/utils.h"
1112#include " unrealsdk/version.h"
1213
1314#ifdef PYUNREALSDK_INTERNAL
@@ -73,8 +74,10 @@ void init(void) {
7374 try {
7475 // Use a custom globals to make sure we don't contaminate `py`/`pyexec` commands
7576 // This also ensures `__file__` gets redefined properly
76- py::eval_file (unrealsdk::config::get_str (" pyunrealsdk.init_script" ).value_or (" __main__.py" ),
77- py::dict{});
77+ auto startup =
78+ unrealsdk::utils::get_this_dll ().parent_path ()
79+ / unrealsdk::config::get_str (" pyunrealsdk.init_script" ).value_or (" __main__.py" );
80+ py::eval_file (startup.generic_string (), py::dict{});
7881 } catch (const std::exception& ex) {
7982 LOG (ERROR, " Error running python initialization script:" );
8083 logging::log_python_exception (ex);
Original file line number Diff line number Diff line change 1- # ruff: noqa: D205
2-
31from __future__ import annotations
42
53from typing import Any , ClassVar
Original file line number Diff line number Diff line change @@ -7,8 +7,6 @@ from ._uobject import UObject
77from ._wrapped_array import WrappedArray
88from ._wrapped_struct import WrappedStruct
99
10- # ruff: noqa: N802, N803
11-
1210# ======== First Layer Subclasses ========
1311
1412class UField (UObject ):
@@ -107,14 +105,13 @@ class UBoolProperty(UProperty):
107105 FieldMask : int
108106
109107class UByteProperty (UProperty ):
110- @property
111- def Enum (self ) -> UEnum | None : ...
108+ Enum : UEnum | None
112109
113110class UClass (UStruct ):
114111 ClassDefaultObject : UObject
115112
116113 @property
117- def Interfaces (self ) -> list [UClass ]: ...
114+ def Interfaces (self ) -> list [UClass ]: ... # noqa: N802
118115 def _implements (self , interface : UClass ) -> bool :
119116 """
120117 Checks if this class implements a given interface.
You can’t perform that action at this time.
0 commit comments