Sfoglia il codice sorgente

If using relationship lines (now default) hide guides.

Juan Linietsky 6 anni fa
parent
commit
0f7a86ca52

+ 4 - 1
editor/scene_tree_editor.cpp

@@ -980,8 +980,11 @@ void SceneTreeEditor::_editor_settings_changed() {
 	if (enable_rl) {
 		tree->add_constant_override("draw_relationship_lines", 1);
 		tree->add_color_override("relationship_line_color", rl_color);
-	} else
+		tree->add_constant_override("draw_guides", 0);
+	} else {
 		tree->add_constant_override("draw_relationship_lines", 0);
+		tree->add_constant_override("draw_guides", 1);
+	}
 }
 
 void SceneTreeEditor::_bind_methods() {

+ 4 - 1
scene/gui/tree.cpp

@@ -901,6 +901,7 @@ void Tree::update_cache() {
 	cache.item_margin = get_constant("item_margin");
 	cache.button_margin = get_constant("button_margin");
 	cache.guide_width = get_constant("guide_width");
+	cache.draw_guides = get_constant("draw_guides");
 	cache.draw_relationship_lines = get_constant("draw_relationship_lines");
 	cache.relationship_line_color = get_color("relationship_line_color");
 	cache.scroll_border = get_constant("scroll_border");
@@ -1132,7 +1133,9 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
 				cell_rect.size.x += cache.hseparation;
 			}
 
-			VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(cell_rect.position.x, cell_rect.position.y + cell_rect.size.height), cell_rect.position + cell_rect.size, cache.guide_color, 1);
+			if (cache.draw_guides) {
+				VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(cell_rect.position.x, cell_rect.position.y + cell_rect.size.height), cell_rect.position + cell_rect.size, cache.guide_color, 1);
+			}
 
 			if (i == 0) {
 

+ 1 - 0
scene/gui/tree.h

@@ -434,6 +434,7 @@ private:
 		int button_margin;
 		Point2 offset;
 		int draw_relationship_lines;
+		int draw_guides;
 		int scroll_border;
 		int scroll_speed;
 

+ 1 - 0
scene/resources/default_theme/default_theme.cpp

@@ -653,6 +653,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
 	theme->set_constant("item_margin", "Tree", 12 * scale);
 	theme->set_constant("button_margin", "Tree", 4 * scale);
 	theme->set_constant("draw_relationship_lines", "Tree", 0);
+	theme->set_constant("draw_guides", "Tree", 1);
 	theme->set_constant("scroll_border", "Tree", 4);
 	theme->set_constant("scroll_speed", "Tree", 12);