(OpenSG trac is down again, so I'll post here lest I forget it.)

Hi,

The following makes it easier to use boost::bind to process nodes:

namespace OSG
{
     template<class T, class P>
     T* get_pointer(const OSG::RefCountPtr<T, P>& p) {
         return p.get();
     }
}

That means I can do cool stuff like:

     std::vector<std::string> geom_files = ...;
     typedef std::vector<OSG::NodeRefPtr> Nodes;
     Nodes n = QtConcurrent::blockingMapped<Nodes>(geom_files, 
boost::bind(&MyClass::loadFile, this, _1));
     std::for_each(n.begin(), n.end(), boost::bind(static_cast<void 
(OSG::Node::*const)(OSG::Node*)>(&OSG::Node::addChild), m_scene, _1));

:)

(Note that overloaded functions, addChild in this case, aren't really 
bind friendly either.)

Also, why no editMFChildren() in OSG::Node? .. It'd be easier to just 
call insert(n.begin(), n.end()) than having to call addChild x times.

Cheers,
/Marcus


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to