How I would add new GEO, Camera or lights to my scene using the HDK?
Thank you
HDK: adding a new GEO node to my scene
3561 2 0- Gerome
- Member
- 85 posts
- Joined: July 2005
- Offline
- lucas
- Staff
- 270 posts
- Joined: July 2005
- Offline
One easy way you can do this is to use the HOM C++ interface. It follows the Python interface fairly closely. (In fact, the Python interface is generated from the C++ interface.) So, where in Python you would write:
g = hou.node(“/obj”).createNode(“geo”)
you could also write, in C++:
#include <HOM/HOM_Module.h>
#include <HOM/HOM_Node.h>
#include <boost/shared_ptr.hpp>
HOM_Module &hou = HOM();
boost::shared_ptr<HOM_Node> g(hou.node(“/obj”)->createNode(“geo”));
The code above, however, has a memory leak; HOM_Module::node() returns a new HOM_Node instance. However, we can use the handy HOMdel() function to automatically delete the object for us. The example then becomes:
#include <HOM/HOM_Module.h>
#include <HOM/HOM_Node.h>
#include <boost/shared_ptr.hpp>
HOM_Module &hou = HOM();
boost::shared_ptr<HOM_Node> g(HOMdel(hou.node(“/obj”))->createNode(“geo”));
g = hou.node(“/obj”).createNode(“geo”)
you could also write, in C++:
#include <HOM/HOM_Module.h>
#include <HOM/HOM_Node.h>
#include <boost/shared_ptr.hpp>
HOM_Module &hou = HOM();
boost::shared_ptr<HOM_Node> g(hou.node(“/obj”)->createNode(“geo”));
The code above, however, has a memory leak; HOM_Module::node() returns a new HOM_Node instance. However, we can use the handy HOMdel() function to automatically delete the object for us. The example then becomes:
#include <HOM/HOM_Module.h>
#include <HOM/HOM_Node.h>
#include <boost/shared_ptr.hpp>
HOM_Module &hou = HOM();
boost::shared_ptr<HOM_Node> g(HOMdel(hou.node(“/obj”))->createNode(“geo”));
- Gerome
- Member
- 85 posts
- Joined: July 2005
- Offline
-
- Quick Links