bugfix: root modifier now works with test apps

stl_dim
Marius Kintel 2011-09-04 18:53:09 +02:00
parent bdd7c1f583
commit 723c6b7cf2
5 changed files with 39 additions and 6 deletions

View File

@ -71,6 +71,15 @@ void cgalTree(Tree &tree)
evaluate.execute();
}
AbstractNode *find_root_tag(AbstractNode *n)
{
foreach(AbstractNode *v, n->children) {
if (v->modinst->tag_root) return v;
if (AbstractNode *vroot = find_root_tag(v)) return vroot;
}
return NULL;
}
struct CsgInfo
{
OffscreenView *glview;
@ -131,7 +140,6 @@ int main(int argc, char **argv)
AbstractModule *root_module;
ModuleInstantiation root_inst;
AbstractNode *root_node;
QFileInfo fileInfo(filename);
handle_dep(filename);
@ -158,7 +166,10 @@ int main(int argc, char **argv)
QDir::setCurrent(fileInfo.absolutePath());
AbstractNode::resetIndexCounter();
root_node = root_module->evaluate(&root_ctx, &root_inst);
AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst);
AbstractNode *root_node;
// Do we have an explicit root node (! modifier)?
if (!(root_node = find_root_tag(absolute_root_node))) root_node = absolute_root_node;
Tree tree(root_node);

View File

@ -66,6 +66,15 @@ void cgalTree(Tree &tree)
evaluate.execute();
}
AbstractNode *find_root_tag(AbstractNode *n)
{
foreach(AbstractNode *v, n->children) {
if (v->modinst->tag_root) return v;
if (AbstractNode *vroot = find_root_tag(v)) return vroot;
}
return NULL;
}
int main(int argc, char **argv)
{
if (argc != 2) {
@ -121,7 +130,6 @@ int main(int argc, char **argv)
AbstractModule *root_module;
ModuleInstantiation root_inst;
AbstractNode *root_node;
QFileInfo fileInfo(filename);
handle_dep(filename);
@ -148,7 +156,10 @@ int main(int argc, char **argv)
QDir::setCurrent(fileInfo.absolutePath());
AbstractNode::resetIndexCounter();
root_node = root_module->evaluate(&root_ctx, &root_inst);
AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst);
AbstractNode *root_node;
// Do we have an explicit root node (! modifier)?
if (!(root_node = find_root_tag(absolute_root_node))) root_node = absolute_root_node;
Tree tree(root_node);

View File

@ -43,6 +43,15 @@ struct CsgInfo
OffscreenView *glview;
};
AbstractNode *find_root_tag(AbstractNode *n)
{
foreach(AbstractNode *v, n->children) {
if (v->modinst->tag_root) return v;
if (AbstractNode *vroot = find_root_tag(v)) return vroot;
}
return NULL;
}
int main(int argc, char *argv[])
{
if (argc != 2) {
@ -99,7 +108,6 @@ int main(int argc, char *argv[])
AbstractModule *root_module;
ModuleInstantiation root_inst;
AbstractNode *root_node;
QFileInfo fileInfo(filename);
handle_dep(filename);
@ -126,7 +134,10 @@ int main(int argc, char *argv[])
QDir::setCurrent(fileInfo.absolutePath());
AbstractNode::resetIndexCounter();
root_node = root_module->evaluate(&root_ctx, &root_inst);
AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst);
AbstractNode *root_node;
// Do we have an explicit root node (! modifier)?
if (!(root_node = find_root_tag(absolute_root_node))) root_node = absolute_root_node;
Tree tree(root_node);

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB