Add type hints to python for class constructors

* We enforce default and copy constructors where possible, this isn't very
  pythonic but we can't use copy.deepcopy on our types.
* The structs that have specialised constructors e.g. FloatVector or Subresource
  also have those documented though we have no way to enforce it.
This commit is contained in:
baldurk
2026-08-13 17:46:47 +01:00
parent 950568fb8f
commit 5e462c5ebe
20 changed files with 1336 additions and 225 deletions
@@ -87,5 +87,10 @@ fail:
template <>
inline SDFile *MakeFromArgsTuple<SDFile>(PyObject *args)
{
if(!SWIG_Python_UnpackTuple(args, "new_SDFile", 0, 0, 0))
SWIG_fail;
return new SDFile();
fail:
return NULL;
}
+3
View File
@@ -114,6 +114,9 @@ TEMPLATE_FIXEDARRAY_DECLARE(rdcfixedarray);
static int capviewer_init(PyObject *self, PyObject *args) {
PyObject *resultobj = 0;
ICaptureViewer *result = 0;
if(!SWIG_Python_UnpackTuple(args, "new_CaptureViewer", 0, 0, 0))
return -1;
result = new PythonCaptureViewer(self);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ICaptureViewer, SWIG_BUILTIN_INIT | 0);