diff options
author | Marius Kintel <marius@kintel.net> | 2013-03-06 18:08:31 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-03-06 18:08:31 (GMT) |
commit | cfc67f928fc86310614940f126d9f6c76d4e9ea7 (patch) | |
tree | 162be7579d3acd0eeb5b7b509ef9a0b428d6831f /src/node.cc | |
parent | fe44758f5096be0e98c82d2cb0d54bdeffc4403a (diff) | |
parent | 974abf13049d5e73227418e3990af8a9bbf9db09 (diff) |
Merge branch 'master' of github.com:openscad/openscad
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc index e61174f..a7a7630 100644 --- a/src/node.cc +++ b/src/node.cc @@ -32,6 +32,7 @@ #include <iostream> #include <algorithm> +#include <boost/foreach.hpp> size_t AbstractNode::idx_counter; @@ -101,3 +102,14 @@ std::ostream &operator<<(std::ostream &stream, const AbstractNode &node) stream << node.toString(); return stream; } + +// Do we have an explicit root node (! modifier)? +AbstractNode *find_root_tag(AbstractNode *n) +{ + BOOST_FOREACH(AbstractNode *v, n->children) { + if (v->modinst->tag_root) return v; + if (AbstractNode *vroot = find_root_tag(v)) return vroot; + } + return NULL; +} + |