Hide other nodes when not in node tool
parent
7f6a4a3efd
commit
1a63090a20
|
@ -22,6 +22,10 @@ viewport_bottom_right = right
|
|||
# 2: Normal lighting (like in Minetest)
|
||||
lighting = 2
|
||||
|
||||
# If true, nodes that are not selected will be hidden
|
||||
# when not in the node tool
|
||||
hide_other_nodes = true
|
||||
|
||||
# Driver used to render
|
||||
driver = opengl
|
||||
|
||||
|
|
|
@ -213,7 +213,6 @@ void FileDialog::doOpen(const SEvent &event)
|
|||
win->remove();
|
||||
win = NULL;
|
||||
state->project = tmp;
|
||||
state->project->remesh();
|
||||
state->project->SelectNode(0);
|
||||
state->Mode()->unload();
|
||||
state->menu->init();
|
||||
|
|
|
@ -43,6 +43,11 @@ void NBEditor::load()
|
|||
IGUIStaticText* sidebar = state->menu->sidebar;
|
||||
IGUIEnvironment* guienv = state->device->getGUIEnvironment();
|
||||
|
||||
if (state->settings->getBool("hide_other_nodes"))
|
||||
state->project->hideAllButCurrentNode();
|
||||
else
|
||||
state->project->remesh();
|
||||
|
||||
if (sidebar) {
|
||||
sidebar->setText(L"Node Box Tool");
|
||||
IGUIStaticText* t = guienv->addStaticText(L"No node selected",
|
||||
|
|
25
src/Node.cpp
25
src/Node.cpp
|
@ -28,7 +28,8 @@ void Node::setAllTextures(Media::Image *def)
|
|||
}
|
||||
}
|
||||
|
||||
Node::~Node() {
|
||||
Node::~Node()
|
||||
{
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (images[i])
|
||||
images[i]->drop();
|
||||
|
@ -42,11 +43,13 @@ Node::~Node() {
|
|||
boxes.clear();
|
||||
}
|
||||
|
||||
NodeBox* Node::GetCurrentNodeBox() {
|
||||
NodeBox* Node::GetCurrentNodeBox()
|
||||
{
|
||||
return GetNodeBox(GetId());
|
||||
}
|
||||
|
||||
NodeBox* Node::GetNodeBox(int id) {
|
||||
NodeBox* Node::GetNodeBox(int id)
|
||||
{
|
||||
if (id < 0 || id > boxes.size()) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -55,7 +58,8 @@ NodeBox* Node::GetNodeBox(int id) {
|
|||
}
|
||||
|
||||
// Operation functions
|
||||
NodeBox* Node::addNodeBox(){
|
||||
NodeBox* Node::addNodeBox()
|
||||
{
|
||||
_box_count++;
|
||||
// Name it
|
||||
std::string name = "NodeBox" + num_to_str(_box_count);
|
||||
|
@ -103,4 +107,17 @@ void Node::remesh() {
|
|||
}
|
||||
}
|
||||
|
||||
void Node::hide()
|
||||
{
|
||||
for (std::vector<NodeBox*>::iterator it = boxes.begin();
|
||||
it != boxes.end();
|
||||
++it) {
|
||||
NodeBox *box = *it;
|
||||
if (box->model) {
|
||||
box->model->remove();
|
||||
box->model = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
// Node bulk updaters
|
||||
void remesh(); // creates the node mesh
|
||||
void setAllTextures(Media::Image *def);
|
||||
void hide();
|
||||
|
||||
void setTexture(CubeSide face, Media::Image *image);
|
||||
Media::Image *getTexture(CubeSide face) { return images[face]; }
|
||||
|
|
|
@ -11,6 +11,7 @@ NodeEditor::NodeEditor(EditorState* st) :
|
|||
|
||||
void NodeEditor::load()
|
||||
{
|
||||
state->project->remesh();
|
||||
IGUIStaticText* sidebar = state->menu->sidebar;
|
||||
IGUIEnvironment* guienv = state->device->getGUIEnvironment();
|
||||
|
||||
|
|
|
@ -26,13 +26,28 @@ Node* Project::GetNode(int id) const
|
|||
for (std::list<Node*>::const_iterator it = nodes.begin();
|
||||
it != nodes.end();
|
||||
++it, ++curid) {
|
||||
if (*it && curid == id) {
|
||||
if (curid == id) {
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void Project::hideAllButCurrentNode()
|
||||
{
|
||||
int curid = 0;
|
||||
for (std::list<Node*>::const_iterator it = nodes.begin();
|
||||
it != nodes.end();
|
||||
++it, ++curid) {
|
||||
if (snode == curid) {
|
||||
(*it)->remesh();
|
||||
} else {
|
||||
(*it)->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Node* Project::GetNode(vector3di pos) const
|
||||
{
|
||||
for (std::list<Node*>::const_iterator it = nodes.begin();
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
void AddNode(Node* node, bool select = true);
|
||||
void DeleteNode(int id);
|
||||
void SelectNode(int id) { snode = id; }
|
||||
void hideAllButCurrentNode();
|
||||
void remesh();
|
||||
Node* GetNode(int id) const;
|
||||
Node* GetNode(vector3di pos) const;
|
||||
|
|
|
@ -9,7 +9,12 @@ TextureEditor::TextureEditor(EditorState* st) :
|
|||
}
|
||||
|
||||
void TextureEditor::load()
|
||||
{
|
||||
{
|
||||
if (state->settings->getBool("hide_other_nodes"))
|
||||
state->project->hideAllButCurrentNode();
|
||||
else
|
||||
state->project->remesh();
|
||||
|
||||
IGUIStaticText* sidebar = state->menu->sidebar;
|
||||
|
||||
if (!sidebar)
|
||||
|
|
|
@ -75,6 +75,7 @@ int main(int argc, char *argv[]) {
|
|||
conf->set("viewport_bottom_left", "front");
|
||||
conf->set("viewport_bottom_right", "right");
|
||||
conf->set("lighting", "2");
|
||||
conf->set("hide_other_nodes", "true");
|
||||
conf->set("fullscreen", "false");
|
||||
conf->set("width", "896");
|
||||
conf->set("height", "520");
|
||||
|
|
Loading…
Reference in New Issue