From 143f66478a7768d6efc604fb18e1a3ef363e892f Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 15 Dec 2020 11:23:13 +0000 Subject: [PATCH] Support converting an rdcarray pointer to rdcarray * This means if there's no intervening list() it still works, e.g. passing an rdcarray property to a function paramater that expects an rdcarray in python. --- qrenderdoc/Code/pyrenderdoc/pyconversion.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qrenderdoc/Code/pyrenderdoc/pyconversion.h b/qrenderdoc/Code/pyrenderdoc/pyconversion.h index eb3eb63b5..b4619521a 100644 --- a/qrenderdoc/Code/pyrenderdoc/pyconversion.h +++ b/qrenderdoc/Code/pyrenderdoc/pyconversion.h @@ -557,6 +557,18 @@ struct TypeConversion, false> // nicer failure error messages out with the index that failed static int ConvertFromPy(PyObject *in, rdcarray &out, int *failIdx) { + swig_type_info *own_type = GetTypeInfo(); + if(own_type) + { + rdcarray *ptr = NULL; + int ret = SWIG_ConvertPtr(in, (void **)&ptr, own_type, 0); + if(SWIG_IsOK(ret)) + { + out = *ptr; + return SWIG_OK; + } + } + if(!PyList_Check(in)) return SWIG_TypeError;