[HDK] How can I get the return value by HOMextendLibrary()

   1446   1   0
User Avatar
Member
27 posts
Joined: Sept. 2016
Offline
static PY_PyObject *ObjNode_checkIn_Wrapper(PY_PyObject *self, PY_PyObject *args)
{
    const char *geo_path, *cam_path;
    if(!PY_PyArg_ParseTuple(args, "ss", &geo_path, &cam_path))
        return NULL;
    HOM_AutoLock hom_lock;
    int res = ObjNode_checkIn(geo_path, cam_path);
    return PY_Py_BuildValue("i", res);
}
void HOMextendLibrary()
{
    PY_InterpreterAutoLock interpreter_auto_lock;
    static PY_PyMethodDef hom_extension_methods[] = 
    {
        {"ObjNode_checkIn", ObjNode_checkIn_Wrapper, PY_METH_VARARGS(), ""},
        {NULL, NULL, 0, NULL}
    };
    PY_Py_InitModule("_hom_extensions", hom_extension_methods);
    PYrunPythonStatementsAndExpectNoErrors(
        "def _checkIn(self, other):\n"
        "   '''Check the geometry from this node in the camera view or not'''\n"
        "   import _hom_extensions\n"
        "   _hom_extensions.ObjNode_checkIn(self.path(), other.path())\n"
        "__import__('hou').ObjNode.checkIn = _checkIn\n"
        "del _checkIn\n");
}

This is my code, I use the PY_Py_BuildValue function and return this value. But I can't get anything in hython.
Where is the problem ?
Edited by calving - Sept. 14, 2016 14:11:46
User Avatar
Member
27 posts
Joined: Sept. 2016
Offline
I solve this problem.
I must use return in _checkIn function.
  • Quick Links