Skip to content

Commit

Permalink
Fix Houdini sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
ababak committed Aug 5, 2022
1 parent 705999b commit 9ca5d5a
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions examples/source_houdini/houdini_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
* (c) Andriy Babak 2022
*
* date: 05/08/2022
* modified: 05/08/2022 17:13:48
* modified: 05/08/2022 18:55:46
*
* Author: Andriy Babak
* e-mail: ababak@gmail.com
* ------------------------------
* description: Sample Houdini module
* ------------------------------
* Call from Houdini Python:
* import cgcpp
* cgcpp.call("/obj", lib="houdini_module", func="ls")
*
* # Result: ['/obj/box1', '/obj/sphere1']
*/
* >>> import cgcpp
* >>> cgcpp.call("/", lib="d:/cgcpp/out/houdini_module", func="ls")
* ['/obj', '/out', '/ch', '/shop', '/img', '/img/comp1', '/vex', '/mat', '/stage', '/tasks', '/tasks/topnet1', '/tasks/topnet1/localscheduler']
*/


#include <iostream>
#include <boost/format.hpp>
Expand All @@ -30,6 +30,15 @@
using namespace std;
namespace py = boost::python;

py::object raise_attribute_error(const string &error_message)
{
PyErr_SetString(
PyExc_AttributeError,
error_message.c_str());
py::throw_error_already_set();
return py::object();
}

void traverse(OP_Network *parent, py::list &result)
{
OP_Node *node;
Expand All @@ -43,7 +52,7 @@ void traverse(OP_Network *parent, py::list &result)
cout << full_path << "\n";
if (node->isNetwork())
{
traverse(node, result);
traverse((OP_Network *)node, result);
}
}
}
Expand Down

0 comments on commit 9ca5d5a

Please sign in to comment.