[HDK] - Should we not use HOMextendLibrary() anymore...
3157 7 0- Anonymous
- Member
- 678 posts
- Joined: July 2005
- Offline
- Anonymous
- Member
- 678 posts
- Joined: July 2005
- Offline
- lucas
- Staff
- 270 posts
- Joined: July 2005
- Offline
HOMextendLibrary is still supported, but it is much more cumbersome to use than inlinecpp. For example, getting the creation time with inlinecpp is very little code (untested code below):
>>> inlinecpp.extendClass(hou.Node, “cpp_node_methods”, function_sources=[“”“
… int creationTime(OP_Node *node)
… {
… return (int)node->getStat().getCreateTime();
… }”“”])
…
>>> import time
>>> time.ctime(hou.node(“/obj/geo1”).creationTime())
'Thu Apr 24 11:06:12 2014'
Libraries created with inlinecpp can be distributed to other machines, so those machines do not need to have to be able to compile the C++ code on demand. inlinecpp is also entirely written in Python, so you can inspect and modify it to better suit your needs, or suggest patches to us.
>>> inlinecpp.extendClass(hou.Node, “cpp_node_methods”, function_sources=[“”“
… int creationTime(OP_Node *node)
… {
… return (int)node->getStat().getCreateTime();
… }”“”])
…
>>> import time
>>> time.ctime(hou.node(“/obj/geo1”).creationTime())
'Thu Apr 24 11:06:12 2014'
Libraries created with inlinecpp can be distributed to other machines, so those machines do not need to have to be able to compile the C++ code on demand. inlinecpp is also entirely written in Python, so you can inspect and modify it to better suit your needs, or suggest patches to us.
- Anonymous
- Member
- 678 posts
- Joined: July 2005
- Offline
Since it's not depracated, can we get some more love to the documentation for it, for example:
- add more examples to HDK files
- add doc how to convert back from c++ to all python types
- and add explanation of those “s” “si” and other flags that we pass to the PY_PyArg_ParseTuple() to extract *args
- explain what PY_METH_VARARGS() means
Thanks!
- add more examples to HDK files
- add doc how to convert back from c++ to all python types
- and add explanation of those “s” “si” and other flags that we pass to the PY_PyArg_ParseTuple() to extract *args
- explain what PY_METH_VARARGS() means
Thanks!
- mark
- Staff
- 2590 posts
- Joined: July 2005
- Offline
mantragora
Since it's not depracated, can we get some more love to the documentation for it, for example:
- add more examples to HDK files
- add doc how to convert back from c++ to all python types
- and add explanation of those “s” “si” and other flags that we pass to the PY_PyArg_ParseTuple() to extract *args
- explain what PY_METH_VARARGS() means
Thanks!
A lot of these are described in the Python documentation. For example:
https://docs.python.org/release/1.5.1p1/ext/parseTuple.html [docs.python.org]
The PY library is a thin wrapper to the underlying Python API.
- Anonymous
- Member
- 678 posts
- Joined: July 2005
- Offline
- mark
- Staff
- 2590 posts
- Joined: July 2005
- Offline
mantragora
Hm… Thanks.
Still, I would love to know what PY_METH_VARARGS() and simila flags that we pass to PY_PyMethodDef means.
BTW. All the flags are supported from the link you posted or is it similar list to the one in inlineCPP docs?
Please see section 1.4 at https://docs.python.org/2/extending/extending.html [docs.python.org]
- Anonymous
- Member
- 678 posts
- Joined: July 2005
- Offline
Yay, more reading, thanks!
Now there is only this part of the puzzle left -> http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=146680#146680 [sidefx.com]
Now there is only this part of the puzzle left -> http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=146680#146680 [sidefx.com]
-
- Quick Links