Common types (Python)¶
Buffers¶
All of the following types support the buffer protocol.
-
class
oead.
Bytes
¶ Mutable bytes-like object. This is used to avoid possibly expensive data copies.
This class is the equivalent to
std::vector<u8>
. Pythonbytes
will be implicitly converted to oead.Bytes, so explicitly doing something likeoead.Bytes(b"my bytes")
is unnecessary.-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.Bytes, arg0: buffer) -> None
__init__(self: oead.Bytes) -> None
__init__(self: oead.Bytes, arg0: oead.Bytes) -> None
Copy constructor
__init__(self: oead.Bytes, arg0: iterable) -> None
-
append
(self: oead.Bytes, x: int) → None¶ Add an item to the end of the list
-
count
(self: oead.Bytes, x: int) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
extend(self: oead.Bytes, L: oead.Bytes) -> None
Extend the list by appending all the items in the given list
extend(self: oead.Bytes, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: oead.Bytes, i: int, x: int) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
pop(self: oead.Bytes) -> int
Remove and return the last item
pop(self: oead.Bytes, i: int) -> int
Remove and return the item at index
i
-
remove
(self: oead.Bytes, x: int) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
oead.
BufferBool
¶ Mutable list-like object that stores booleans.
This is a list that can only store booleans. This class is the equivalent to
std::vector<bool>
.-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.BufferBool) -> None
__init__(self: oead.BufferBool, arg0: oead.BufferBool) -> None
Copy constructor
__init__(self: oead.BufferBool, arg0: iterable) -> None
-
append
(self: oead.BufferBool, x: bool) → None¶ Add an item to the end of the list
-
count
(self: oead.BufferBool, x: bool) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
extend(self: oead.BufferBool, L: oead.BufferBool) -> None
Extend the list by appending all the items in the given list
extend(self: oead.BufferBool, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: oead.BufferBool, i: int, x: bool) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
pop(self: oead.BufferBool) -> bool
Remove and return the last item
pop(self: oead.BufferBool, i: int) -> bool
Remove and return the item at index
i
-
remove
(self: oead.BufferBool, x: bool) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
oead.
BufferInt
¶ Mutable list-like object that stores signed 32-bit integers.
This is a list that can only store signed 32-bit integers. This class is the equivalent to
std::vector<int>
.-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.BufferInt, arg0: buffer) -> None
__init__(self: oead.BufferInt) -> None
__init__(self: oead.BufferInt, arg0: oead.BufferInt) -> None
Copy constructor
__init__(self: oead.BufferInt, arg0: iterable) -> None
-
append
(self: oead.BufferInt, x: int) → None¶ Add an item to the end of the list
-
count
(self: oead.BufferInt, x: int) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
extend(self: oead.BufferInt, L: oead.BufferInt) -> None
Extend the list by appending all the items in the given list
extend(self: oead.BufferInt, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: oead.BufferInt, i: int, x: int) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
pop(self: oead.BufferInt) -> int
Remove and return the last item
pop(self: oead.BufferInt, i: int) -> int
Remove and return the item at index
i
-
remove
(self: oead.BufferInt, x: int) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
oead.
BufferF32
¶ Mutable list-like object that stores binary32 floats.
This is a list that can only store binary32 floating point numbers. This class is the equivalent to
std::vector<f32>
.-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.BufferF32, arg0: buffer) -> None
__init__(self: oead.BufferF32) -> None
__init__(self: oead.BufferF32, arg0: oead.BufferF32) -> None
Copy constructor
__init__(self: oead.BufferF32, arg0: iterable) -> None
-
append
(self: oead.BufferF32, x: float) → None¶ Add an item to the end of the list
-
count
(self: oead.BufferF32, x: float) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
extend(self: oead.BufferF32, L: oead.BufferF32) -> None
Extend the list by appending all the items in the given list
extend(self: oead.BufferF32, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: oead.BufferF32, i: int, x: float) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
pop(self: oead.BufferF32) -> float
Remove and return the last item
pop(self: oead.BufferF32, i: int) -> float
Remove and return the item at index
i
-
remove
(self: oead.BufferF32, x: float) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
oead.
BufferString
¶ Mutable list-like object that stores strings.
This is a list that can only store strings. This class is the equivalent to
std::vector<std::string>
.-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.BufferString) -> None
__init__(self: oead.BufferString, arg0: oead.BufferString) -> None
Copy constructor
__init__(self: oead.BufferString, arg0: iterable) -> None
-
append
(self: oead.BufferString, x: str) → None¶ Add an item to the end of the list
-
count
(self: oead.BufferString, x: str) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
extend(self: oead.BufferString, L: oead.BufferString) -> None
Extend the list by appending all the items in the given list
extend(self: oead.BufferString, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: oead.BufferString, i: int, x: str) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
pop(self: oead.BufferString) -> str
Remove and return the last item
pop(self: oead.BufferString, i: int) -> str
Remove and return the item at index
i
-
remove
(self: oead.BufferString, x: str) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
oead.
BufferU32
¶ Mutable list-like object that stores unsigned 32-bit integers.
This is a list that can only store unsigned 32-bit integers. This class is the equivalent to
std::vector<u32>
.-
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.BufferU32, arg0: buffer) -> None
__init__(self: oead.BufferU32) -> None
__init__(self: oead.BufferU32, arg0: oead.BufferU32) -> None
Copy constructor
__init__(self: oead.BufferU32, arg0: iterable) -> None
-
append
(self: oead.BufferU32, x: int) → None¶ Add an item to the end of the list
-
count
(self: oead.BufferU32, x: int) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
extend(self: oead.BufferU32, L: oead.BufferU32) -> None
Extend the list by appending all the items in the given list
extend(self: oead.BufferU32, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: oead.BufferU32, i: int, x: int) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
pop(self: oead.BufferU32) -> int
Remove and return the last item
pop(self: oead.BufferU32, i: int) -> int
Remove and return the item at index
i
-
remove
(self: oead.BufferU32, x: int) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
Numbers¶
In order to preserve type information – which matters for binary formats such as BYML – when passing types between oead and Python code, several number wrapper classes are used.
All of the wrappers can be converted to int
or float
with int()
or float()
.
Warning
Unlike Python’s int
class, these integer classes represent fixed-size integers. Just like in C++, unsigned integer types use modulo 2^N arithmetic (e.g. -1 is 255) and signed integer overflow is undefined behavior.
-
class
oead.
U8
¶ Unsigned 8-bit integer.
-
__init__
(self: oead.U8, value: int_ = 0) → None¶
-
property
v
¶ Value
-
-
class
oead.
U16
¶ Unsigned 16-bit integer.
-
__init__
(self: oead.U16, value: int_ = 0) → None¶
-
property
v
¶ Value
-
-
class
oead.
U32
¶ Unsigned 32-bit integer.
-
__init__
(self: oead.U32, value: int_ = 0) → None¶
-
property
v
¶ Value
-
-
class
oead.
U64
¶ Unsigned 64-bit integer.
-
__init__
(self: oead.U64, value: int_ = 0) → None¶
-
property
v
¶ Value
-
-
class
oead.
S8
¶ Signed 8-bit integer.
-
__init__
(self: oead.S8, value: int_ = 0) → None¶
-
property
v
¶ Value
-
-
class
oead.
S16
¶ Signed 16-bit integer.
-
__init__
(self: oead.S16, value: int_ = 0) → None¶
-
property
v
¶ Value
-
-
class
oead.
S32
¶ Signed 32-bit integer.
-
__init__
(self: oead.S32, value: int_ = 0) → None¶
-
property
v
¶ Value
-
-
class
oead.
S64
¶ Signed 64-bit integer.
-
__init__
(self: oead.S64, value: int_ = 0) → None¶
-
property
v
¶ Value
-
Utils¶
-
class
oead.
Vector2f
¶ See also
oead::Vector2f
-
__init__
(self: oead.Vector2f) → None¶
-
property
x
¶
-
property
y
¶
-
-
class
oead.
Vector3f
¶ See also
oead::Vector3f
-
__init__
(self: oead.Vector3f) → None¶
-
property
x
¶
-
property
y
¶
-
property
z
¶
-
-
class
oead.
Vector4f
¶ See also
oead::Vector4f
-
__init__
(self: oead.Vector4f) → None¶
-
property
t
¶
-
property
x
¶
-
property
y
¶
-
property
z
¶
-
-
class
oead.
Quatf
¶ See also
oead::Quatf
-
__init__
(self: oead.Quatf) → None¶
-
property
a
¶
-
property
b
¶
-
property
c
¶
-
property
d
¶
-
Strings¶
Note
Any string that is too long to be stored in a FixedSafeString
is truncated.
Warning
As Python does not have implicit conversions, str()
must be explicitly called to turn a FixedSafeString into an actual string.
-
class
oead.
FixedSafeString16
¶ -
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.FixedSafeString16) -> None
__init__(self: oead.FixedSafeString16, arg0: str) -> None
-
-
class
oead.
FixedSafeString32
¶ -
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.FixedSafeString32) -> None
__init__(self: oead.FixedSafeString32, arg0: str) -> None
-
-
class
oead.
FixedSafeString48
¶ -
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.FixedSafeString48) -> None
__init__(self: oead.FixedSafeString48, arg0: str) -> None
-
-
class
oead.
FixedSafeString64
¶ -
__init__
(*args, **kwargs)¶ Overloaded function.
__init__(self: oead.FixedSafeString64) -> None
__init__(self: oead.FixedSafeString64, arg0: str) -> None
-