Move all nodes up when a node is placed below the ground

master
rubenwardy 2015-03-01 18:52:57 +00:00
parent 229649a961
commit 3b1060e7b0
3 changed files with 18 additions and 2 deletions

View File

@ -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

View File

@ -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");

View File

@ -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<Node*> & nodes = state->project->nodes;
for (std::list<Node*>::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();