Moved % modifier handling from node to nodedumper. This makes nodes with % operators use the existing cache instead of recalculating the object

export-menu
Marius Kintel 2014-02-04 23:49:10 -05:00
parent 6a1d91dc76
commit 716d8a7ab3
7 changed files with 16 additions and 16 deletions

View File

@ -97,8 +97,6 @@ void AbstractNode::progress_report() const
std::ostream &operator<<(std::ostream &stream, const AbstractNode &node) std::ostream &operator<<(std::ostream &stream, const AbstractNode &node)
{ {
// FIXME: Don't use deep access to modinst members
if (node.modinst->isBackground()) stream << "%";
stream << node.toString(); stream << node.toString();
return stream; return stream;
} }

View File

@ -1,5 +1,6 @@
#include "nodedumper.h" #include "nodedumper.h"
#include "state.h" #include "state.h"
#include "module.h"
#include <string> #include <string>
#include <sstream> #include <sstream>
@ -47,6 +48,7 @@ std::string NodeDumper::dumpChildren(const AbstractNode &node)
iter != this->visitedchildren[node.index()].end(); iter != this->visitedchildren[node.index()].end();
iter++) { iter++) {
assert(isCached(**iter)); assert(isCached(**iter));
if ((*iter)->modinst->isBackground()) dump << "%";
dump << this->cache[**iter] << "\n"; dump << this->cache[**iter] << "\n";
} }

View File

@ -1,12 +1,12 @@
group() { group() {
difference() { difference() {
sphere($fn = 0, $fa = 12, $fs = 2, r = 10); sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
%cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true); % cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
} }
%group() { % group() {
cube(size = [25, 6, 3], center = true); cube(size = [25, 6, 3], center = true);
} }
%multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) { % multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() { difference() {
color([0, 0.501961, 0, 1]) { color([0, 0.501961, 0, 1]) {
cube(size = [10, 4, 10], center = true); cube(size = [10, 4, 10], center = true);
@ -20,7 +20,7 @@ group() {
} }
multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
minkowski(convexity = 0) { minkowski(convexity = 0) {
%cube(size = [10, 10, 10], center = true); % cube(size = [10, 10, 10], center = true);
cube(size = [5, 5, 5], center = true); cube(size = [5, 5, 5], center = true);
} }
} }

View File

@ -1,8 +1,8 @@
group() { group() {
%linear_extrude(height = 22, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { % linear_extrude(height = 22, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example009.dxf", layer = "body", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); import(file = "example009.dxf", layer = "body", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
} }
%group() { % group() {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) {
linear_extrude(height = 2, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { linear_extrude(height = 2, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);

View File

@ -188,7 +188,7 @@ group() {
} }
} }
} }
%multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) { % multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) {
group() { group() {
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) { rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
square(size = [25, 68], center = false); square(size = [25, 68], center = false);

View File

@ -17,7 +17,7 @@ group() {
} }
} }
} }
%group() { % group() {
difference() { difference() {
sphere($fn = 0, $fa = 30, $fs = 2, r = 25); sphere($fn = 0, $fa = 30, $fs = 2, r = 25);
cylinder($fn = 0, $fa = 30, $fs = 2, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); cylinder($fn = 0, $fa = 30, $fs = 2, h = 62.5, r1 = 12.5, r2 = 6.25, center = true);
@ -251,7 +251,7 @@ group() {
} }
} }
} }
%group() { % group() {
difference() { difference() {
sphere($fn = 0, $fa = 30, $fs = 2, r = 25); sphere($fn = 0, $fa = 30, $fs = 2, r = 25);
cylinder($fn = 0, $fa = 30, $fs = 2, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); cylinder($fn = 0, $fa = 30, $fs = 2, h = 62.5, r1 = 12.5, r2 = 6.25, center = true);

View File

@ -1,12 +1,12 @@
group() { group() {
difference() { difference() {
sphere($fn = 0, $fa = 12, $fs = 2, r = 10); sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
%cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true); % cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
%group() { % group() {
cube(size = [25, 6, 3], center = true); cube(size = [25, 6, 3], center = true);
} }
} }
%multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) { % multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() { difference() {
color([0, 0.501961, 0, 1]) { color([0, 0.501961, 0, 1]) {
cube(size = [10, 4, 10], center = true); cube(size = [10, 4, 10], center = true);
@ -18,7 +18,7 @@ group() {
} }
} }
} }
%multmatrix([[1, 0, 0, 13], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { % multmatrix([[1, 0, 0, 13], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() { difference() {
sphere($fn = 0, $fa = 12, $fs = 2, r = 10); sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true); cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
@ -47,7 +47,7 @@ group() {
cube(size = [25, 6, 3], center = true); cube(size = [25, 6, 3], center = true);
} }
} }
%multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) { % multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() { difference() {
color([0, 0.501961, 0, 1]) { color([0, 0.501961, 0, 1]) {
cube(size = [10, 4, 10], center = true); cube(size = [10, 4, 10], center = true);