Browse Source

Some control fixes and removed useless lines

Gilles Roudiere 8 năm trước cách đây
mục cha
commit
06256cd778

+ 0 - 1
editor/plugins/cube_grid_theme_editor_plugin.cpp

@@ -368,7 +368,6 @@ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) {
 
 	p_node->get_viewport()->add_child(theme_editor);
 	theme_editor->set_area_as_parent_rect();
-	theme_editor->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
 	theme_editor->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_BEGIN);
 	theme_editor->set_end(Point2(0, 22));
 	theme_editor->hide();

+ 2 - 2
editor/plugins/sample_editor_plugin.cpp

@@ -374,8 +374,8 @@ SampleEditor::SampleEditor() {
 	sample_texframe->add_child(info_label);
 	info_label->set_area_as_parent_rect();
 	info_label->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,-15);
-	info_label->set_margin(MARGIN_BOTTOM,4);
-	info_label->set_margin(MARGIN_RIGHT,4);
+	info_label->set_margin(MARGIN_BOTTOM,-4);
+	info_label->set_margin(MARGIN_RIGHT,-4);
 	info_label->set_align(Label::ALIGN_RIGHT);
 
 

+ 0 - 1
editor/plugins/tile_set_editor_plugin.cpp

@@ -294,7 +294,6 @@ TileSetEditorPlugin::TileSetEditorPlugin(EditorNode *p_node) {
 
 	p_node->get_viewport()->add_child(tileset_editor);
 	tileset_editor->set_area_as_parent_rect();
-	tileset_editor->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
 	tileset_editor->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_BEGIN);
 	tileset_editor->set_end(Point2(0, 22));
 	tileset_editor->hide();

+ 1 - 2
editor/project_manager.cpp

@@ -969,7 +969,6 @@ void ProjectManager::_run_project_confirm() {
 			return;
 		}
 
-
 		const String &selected = E->key();
 		String path = EditorSettings::get_singleton()->get("projects/" + selected);
 
@@ -1220,7 +1219,7 @@ ProjectManager::ProjectManager() {
 	panel->add_child(vb);
 	vb->set_area_as_parent_rect(20 * EDSCALE);
 	vb->set_margin(MARGIN_TOP, 4 * EDSCALE);
-	vb->set_margin(MARGIN_BOTTOM, 4 * EDSCALE);
+	vb->set_margin(MARGIN_BOTTOM, -4 * EDSCALE);
 	vb->add_constant_override("separation", 15 * EDSCALE);
 
 	String cp;

+ 2 - 4
editor/property_editor.cpp

@@ -1938,10 +1938,8 @@ CustomPropertyEditor::CustomPropertyEditor() {
 
 	text_edit = memnew(TextEdit);
 	add_child(text_edit);
-	text_edit->set_area_as_parent_rect();
-	for (int i = 0; i < 4; i++)
-		text_edit->set_margin((Margin)i, 5);
-	text_edit->set_margin(MARGIN_BOTTOM, 30);
+	text_edit->set_area_as_parent_rect(5);
+	text_edit->set_margin(MARGIN_BOTTOM, -30);
 
 	text_edit->hide();
 	text_edit->connect("text_changed", this, "_text_edit_changed");

+ 1 - 1
modules/gridmap/grid_map_editor_plugin.cpp

@@ -1203,7 +1203,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
 	edit_mode = memnew(OptionButton);
 	edit_mode->set_area_as_parent_rect();
 	edit_mode->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 24);
-	edit_mode->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -14);
+	edit_mode->set_margin(MARGIN_RIGHT, -14);
 	edit_mode->add_item("Tiles");
 	edit_mode->add_item("Areas");
 	hb->add_child(edit_mode);

+ 0 - 1
modules/visual_script/visual_script_editor.cpp

@@ -3268,7 +3268,6 @@ VisualScriptEditor::VisualScriptEditor() {
 	select_func_text->set_valign(Label::VALIGN_CENTER);
 	select_func_text->set_h_size_flags(SIZE_EXPAND_FILL);
 	add_child(select_func_text);
-	graph->set_area_as_parent_rect();
 
 	hint_text = memnew(Label);
 	hint_text->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -100);

+ 4 - 3
scene/gui/popup.cpp

@@ -276,9 +276,10 @@ void PopupPanel::set_child_rect(Control *p_child) {
 
 	Ref<StyleBox> p = get_stylebox("panel");
 	p_child->set_area_as_parent_rect();
-	for (int i = 0; i < 4; i++) {
-		p_child->set_margin(Margin(i), p->get_margin(Margin(i)));
-	}
+	p_child->set_margin(MARGIN_LEFT, p->get_margin(MARGIN_LEFT));
+	p_child->set_margin(MARGIN_RIGHT, -p->get_margin(MARGIN_RIGHT));
+	p_child->set_margin(MARGIN_TOP, p->get_margin(MARGIN_TOP));
+	p_child->set_margin(MARGIN_BOTTOM, -p->get_margin(MARGIN_BOTTOM));
 }
 
 void PopupPanel::_notification(int p_what) {