Skip to content

Commit 57987b2

Browse files
committed
added texture_has_alpha_channel
1 parent 6f6fa94 commit 57987b2

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,7 @@ static PyMethodDef ue_PyUObject_methods[] = {
10531053
{ "texture_set_data", (PyCFunction)py_ue_texture_set_data, METH_VARARGS, "" },
10541054
{ "texture_get_width", (PyCFunction)py_ue_texture_get_width, METH_VARARGS, "" },
10551055
{ "texture_get_height", (PyCFunction)py_ue_texture_get_height, METH_VARARGS, "" },
1056+
{ "texture_has_alpha_channel", (PyCFunction)py_ue_texture_has_alpha_channel, METH_VARARGS, "" },
10561057
{ "render_target_get_data", (PyCFunction)py_ue_render_target_get_data, METH_VARARGS, "" },
10571058
{ "render_target_get_data_to_buffer", (PyCFunction)py_ue_render_target_get_data_to_buffer, METH_VARARGS, "" },
10581059
{ "texture_update_resource", (PyCFunction)py_ue_texture_update_resource, METH_VARARGS, "" },

Source/UnrealEnginePython/Private/UObject/UEPyTexture.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ PyObject *py_ue_texture_get_height(ue_PyUObject *self, PyObject * args)
4444
return PyLong_FromLong(texture->GetSizeY());
4545
}
4646

47+
PyObject *py_ue_texture_has_alpha_channel(ue_PyUObject *self, PyObject * args)
48+
{
49+
50+
ue_py_check(self);
51+
52+
UTexture2D *texture = ue_py_check_type<UTexture2D>(self);
53+
if (!texture)
54+
return PyErr_Format(PyExc_Exception, "object is not a Texture");
55+
56+
if (texture->HasAlphaChannel())
57+
Py_RETURN_TRUE;
58+
Py_RETURN_FALSE;
59+
}
60+
4761
PyObject *py_ue_texture_get_data(ue_PyUObject *self, PyObject * args)
4862
{
4963

Source/UnrealEnginePython/Private/UObject/UEPyTexture.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ PyObject *py_ue_texture_set_data(ue_PyUObject *, PyObject *);
1212
PyObject *py_ue_texture_get_width(ue_PyUObject *, PyObject *);
1313
PyObject *py_ue_texture_get_height(ue_PyUObject *, PyObject *);
1414

15+
PyObject *py_ue_texture_has_alpha_channel(ue_PyUObject *, PyObject *);
16+
1517
PyObject *py_unreal_engine_compress_image_array(PyObject *, PyObject *);
1618
PyObject *py_unreal_engine_create_checkerboard_texture(PyObject *, PyObject *);
1719

0 commit comments

Comments
 (0)