diff options
author | Marius Kintel <marius@kintel.net> | 2013-04-09 04:28:16 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-04-09 04:28:16 (GMT) |
commit | a37813a8999571f4b9235f33fdc7c22bcbe5fd17 (patch) | |
tree | 266d8c106100edab9f51b93cf229cf55cd083918 /src/rotateextrude.cc | |
parent | b16c24fb2888d932ec035fff27cb29b4ffbc256b (diff) |
Refactored context handling into using separate Module contexts and Eval contexts. This allows for recursive module calls, and cascading children. I believe this fixes issue #116
Diffstat (limited to 'src/rotateextrude.cc')
-rw-r--r-- | src/rotateextrude.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rotateextrude.cc b/src/rotateextrude.cc index c4d9342..29a873f 100644 --- a/src/rotateextrude.cc +++ b/src/rotateextrude.cc @@ -26,7 +26,7 @@ #include "rotateextrudenode.h" #include "module.h" -#include "context.h" +#include "evalcontext.h" #include "printutils.h" #include "builtin.h" #include "polyset.h" @@ -45,10 +45,10 @@ class RotateExtrudeModule : public AbstractModule { public: RotateExtrudeModule() { } - virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const; + virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst, const EvalContext *evalctx) const; }; -AbstractNode *RotateExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const +AbstractNode *RotateExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst, const EvalContext *evalctx) const { RotateExtrudeNode *node = new RotateExtrudeNode(inst); @@ -57,7 +57,7 @@ AbstractNode *RotateExtrudeModule::evaluate(const Context *ctx, const ModuleInst std::vector<Expression*> argexpr; Context c(ctx); - c.args(argnames, argexpr, inst->argnames, inst->argvalues); + c.setVariables(argnames, argexpr, evalctx); node->fn = c.lookup_variable("$fn").toDouble(); node->fs = c.lookup_variable("$fs").toDouble(); @@ -86,7 +86,7 @@ AbstractNode *RotateExtrudeModule::evaluate(const Context *ctx, const ModuleInst node->scale = 1; if (node->filename.empty()) { - std::vector<AbstractNode *> evaluatednodes = inst->evaluateChildren(); + std::vector<AbstractNode *> evaluatednodes = inst->evaluateChildren(evalctx); node->children.insert(node->children.end(), evaluatednodes.begin(), evaluatednodes.end()); } |