Add a __str__ function for ResourceId

This commit is contained in:
baldurk
2017-03-28 17:07:45 +01:00
parent 3e1275ed50
commit c49670cfad
+10 -5
View File
@@ -327,6 +327,16 @@ CONTAINER_TYPEMAPS(rdctype::arr)
%ignore ITargetControl::~ITargetControl();
%ignore IRemoteServer::~IRemoteServer();
// add __str__ functions
%feature("python:tp_str") ResourceId "resid_str";
%wrapper %{
static PyObject *resid_str(PyObject *resid)
{
return PyUnicode_FromFormat("<ResourceId %S>", PyObject_GetAttrString(resid, "id"));
}
%}
%{
#include "renderdoc_replay.h"
%}
@@ -345,11 +355,6 @@ CONTAINER_TYPEMAPS(rdctype::arr)
%include "shader_types.h"
%include "vk_pipestate.h"
// add a built-in __str__ function that will generate string representations in python
%extend rdctype::str {
const char *__str__() const { return $self->c_str(); }
};
// declare a function for passing external objects into python
%wrapper %{