Skip to content

Commit

Permalink
added create_transient_texture()
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto De Ioris committed Jun 11, 2017
1 parent e15b946 commit a1a7c5e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/UnrealEnginePython/Private/UEPyModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ static PyMethodDef unreal_engine_methods[] = {

{ "compress_image_array", py_unreal_engine_compress_image_array, METH_VARARGS, "" },
{ "create_checkerboard_texture", py_unreal_engine_create_checkerboard_texture, METH_VARARGS, "" },
{ "create_transient_texture", py_unreal_engine_create_transient_texture, METH_VARARGS, "" },

// slate

Expand Down
19 changes: 19 additions & 0 deletions Source/UnrealEnginePython/Private/UEPyTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,22 @@ PyObject *py_unreal_engine_create_checkerboard_texture(PyObject * self, PyObject
return (PyObject *)ret;
}

PyObject *py_unreal_engine_create_transient_texture(PyObject * self, PyObject * args) {
int width;
int height;
int format = PF_B8G8R8A8;
if (!PyArg_ParseTuple(args, "ii|i:create_transient_texture", &width, &height, &format)) {
return NULL;
}


UTexture2D *texture = UTexture2D::CreateTransient(width, height, (EPixelFormat)format);
texture->UpdateResource();

ue_PyUObject *ret = ue_get_python_wrapper(texture);
if (!ret)
return PyErr_Format(PyExc_Exception, "uobject is in invalid state");
Py_INCREF(ret);
return (PyObject *)ret;
}

4 changes: 3 additions & 1 deletion Source/UnrealEnginePython/Private/UEPyTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ PyObject *py_ue_texture_get_width(ue_PyUObject *, PyObject *);
PyObject *py_ue_texture_get_height(ue_PyUObject *, PyObject *);

PyObject *py_unreal_engine_compress_image_array(PyObject *, PyObject *);
PyObject *py_unreal_engine_create_checkerboard_texture(PyObject *, PyObject *);
PyObject *py_unreal_engine_create_checkerboard_texture(PyObject *, PyObject *);

PyObject *py_unreal_engine_create_transient_texture(PyObject *, PyObject *);

0 comments on commit a1a7c5e

Please sign in to comment.