From ebc612f87aeef6e4b8ecc7ea22381d28b41a08b0 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Tue, 14 May 2013 14:23:08 -0700 Subject: [PATCH] Start out with gray, fix coloring smaller portions by (similar to deleting) breaking up leaf nodes into their components. --- interface/src/Application.cpp | 4 +++- libraries/voxels/src/VoxelTree.cpp | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 289c2b7a45..0275de2d9f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1093,7 +1093,9 @@ void Application::initMenu() { (_logOn = toolsMenu->addAction("Log"))->setCheckable(true); _logOn->setChecked(true); _voxelPaintColor = toolsMenu->addAction("Voxel Paint Color", this, SLOT(chooseVoxelPaintColor()), Qt::Key_7); - _voxelPaintColor->setIcon(createSwatchIcon(QColor())); + QColor paintColor(128, 128, 128); + _voxelPaintColor->setData(paintColor); + _voxelPaintColor->setIcon(createSwatchIcon(paintColor)); QMenu* frustumMenu = menuBar->addMenu("Frustum"); (_frustumOn = frustumMenu->addAction("Display Frustum"))->setCheckable(true); diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index d22073a54b..fb9e33dc47 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -103,7 +103,13 @@ VoxelNode* VoxelTree::createMissingNode(VoxelNode* lastParentNode, unsigned char int indexOfNewChild = branchIndexWithDescendant(lastParentNode->getOctalCode(), codeToReach); // we could be coming down a branch that was already created, so don't stomp on it. - if (!lastParentNode->getChildAtIndex(indexOfNewChild)) { + if (lastParentNode->isLeaf() && lastParentNode->isColored()) { + // for colored leaves, we must add *all* the children + for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { + lastParentNode->addChildAtIndex(i); + lastParentNode->getChildAtIndex(i)->setColor(lastParentNode->getColor()); + } + } else if (!lastParentNode->getChildAtIndex(indexOfNewChild)) { lastParentNode->addChildAtIndex(indexOfNewChild); }