Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

[10bdc130](https://github.com/bl-sdk/pyunrealsdk/commit/10bdc130)

- Added a `_get_address` method to `WrappedArray`, `WrappedMulticastDelegate`, and `WrappedStruct`.

[1b3e9686](https://github.com/bl-sdk/pyunrealsdk/commit/1b3e9686)

## v1.5.2

### unrealsdk v1.6.1
Expand Down
5 changes: 5 additions & 0 deletions src/pyunrealsdk/unreal_bindings/wrapped_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ void register_wrapped_array(py::module_& mod) {
" key: A one-arg function used to extract a comparison key.\n"
" reverse: If true, the list is sorted as if each comparison were reversed.",
py::kw_only{}, "key"_a = py::none{}, "reverse"_a = false)
.def("_get_address", &impl::array_py_getaddress,
"Gets the address of this array, for debugging.\n"
"\n"
"Returns:\n"
" This array's address.")
.def_readwrite("_type", &WrappedArray::type);

// Create as a class method, see pybind11#1693
Expand Down
2 changes: 2 additions & 0 deletions src/pyunrealsdk/unreal_bindings/wrapped_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ void array_py_remove(WrappedArray& self, const py::object& value);
void array_py_reverse(WrappedArray& self);
// sort
void array_py_sort(WrappedArray& self, const py::object& key, bool reverse);
// _get_address
uintptr_t array_py_getaddress(const WrappedArray& self);

} // namespace impl

Expand Down
4 changes: 4 additions & 0 deletions src/pyunrealsdk/unreal_bindings/wrapped_array_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ void array_py_sort(WrappedArray& self, const py::object& key, bool reverse) {
});
}

uintptr_t array_py_getaddress(const WrappedArray& self) {
return reinterpret_cast<uintptr_t>(self.base.get());
}

} // namespace pyunrealsdk::unreal::impl

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,15 @@ void register_wrapped_multicast_delegate(py::module_& mod) {
"Args:\n"
" value: The function to remove.",
"value"_a)
.def(
"_get_address",
[](const WrappedMulticastDelegate& self) {
return reinterpret_cast<uintptr_t>(self.base.get());
},
"Gets the address of this delegate, for debugging.\n"
"\n"
"Returns:\n"
" This delegate's address.")
.def_readwrite("_signature", &WrappedMulticastDelegate::signature);
}

Expand Down
7 changes: 7 additions & 0 deletions src/pyunrealsdk/unreal_bindings/wrapped_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ void register_wrapped_struct(py::module_& mod) {
"Returns:\n"
" A new, python-owned copy of this struct.",
"memo"_a)
.def(
"_get_address",
[](const WrappedStruct& self) { return reinterpret_cast<uintptr_t>(self.base.get()); },
"Gets the address of this struct, for debugging.\n"
"\n"
"Returns:\n"
" This struct's address.")
.def_readwrite("_type", &WrappedStruct::type);
}

Expand Down
7 changes: 7 additions & 0 deletions stubs/unrealsdk/unreal/_wrapped_array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ class WrappedArray[T]:
range: The range to set.
value: The values to set.
"""
def _get_address(self) -> int:
"""
Gets the address of this array, for debugging.

Returns:
This array's address.
"""
def append(self, value: T) -> None:
"""
Appends a value to the end of the array.
Expand Down
8 changes: 8 additions & 0 deletions stubs/unrealsdk/unreal/_wrapped_multicast_delegate.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ class WrappedMulticastDelegate:
The string representation.
"""

def _get_address(self) -> int:
"""
Gets the address of this delegate, for debugging.

Returns:
This delegate's address.
"""

def add(self, value: BoundFunction) -> None:
"""
Binds a new function to this delegate.
Expand Down
7 changes: 7 additions & 0 deletions stubs/unrealsdk/unreal/_wrapped_struct.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ class WrappedStruct:
name: The name of the field to set.
value: The value to write.
"""
def _get_address(self) -> int:
"""
Gets the address of this struct, for debugging.

Returns:
This struct's address.
"""
def _get_field(self, field: UField) -> Any:
"""
Reads an unreal field off of the struct.
Expand Down
Loading