diff --git a/editor.conf.example b/editor.conf.example index b5fbf19..c7b3cb8 100644 --- a/editor.conf.example +++ b/editor.conf.example @@ -18,7 +18,7 @@ viewport_bottom_right = right # Lighting # 0: no lighting / shadows -# 1: Depth lighting (things further away from camera are darker) +# 1: Depth lighting (things further away from camera are darker) (TODO) # 2: Normal lighting (like in Minetest) lighting = 2 @@ -26,6 +26,9 @@ lighting = 2 # when not in the node tool hide_other_nodes = true +# Move all nodes up when a node is placed at negative y +no_negative_node_y = true + # Driver used to render driver = opengl diff --git a/src/main.cpp b/src/main.cpp index cc70e72..2223360 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -77,6 +77,7 @@ int main(int argc, char *argv[]) { conf->set("viewport_bottom_right", "right"); conf->set("lighting", "2"); conf->set("hide_other_nodes", "true"); + conf->set("no_negative_node_y", "true"); conf->set("fullscreen", "false"); conf->set("width", "896"); conf->set("height", "520"); diff --git a/src/modes/NodeEditor.cpp b/src/modes/NodeEditor.cpp index e68a957..f9a879b 100644 --- a/src/modes/NodeEditor.cpp +++ b/src/modes/NodeEditor.cpp @@ -222,9 +222,21 @@ void NodeEditor::updateProperties() { try { irr::core::stringc name = prop->getElementFromId(ENG_GUI_PROP_NAME)->getText(); node->name = str_replace(std::string(name.c_str(), name.size()), ' ', '_'); + int y = wcstod(prop->getElementFromId(ENG_GUI_PROP_Y)->getText(), NULL); + if (state->settings->getBool("no_negative_node_y") && y < 0) { + std::list & nodes = state->project->nodes; + for (std::list::const_iterator it = nodes.begin(); + it != nodes.end(); + ++it) { + (*it)->position.Y -= y; // Remember, y is negative + } + state->project->remesh(); + y = 0; + } + node->position = vector3di( wcstod(prop->getElementFromId(ENG_GUI_PROP_X)->getText(), NULL), - wcstod(prop->getElementFromId(ENG_GUI_PROP_Y)->getText(), NULL), + y, wcstod(prop->getElementFromId(ENG_GUI_PROP_Z)->getText(), NULL) ); node->remesh();