summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_profiler.cpp37
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp11
-rw-r--r--editor/project_manager.cpp27
3 files changed, 48 insertions, 27 deletions
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index 3fdeaff19d..e5a9c4d699 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -165,12 +165,10 @@ void EditorProfiler::_item_edited() {
void EditorProfiler::_update_plot() {
- int w = graph->get_size().width;
- int h = graph->get_size().height;
-
+ const int w = graph->get_size().width;
+ const int h = graph->get_size().height;
bool reset_texture = false;
-
- int desired_len = w * h * 4;
+ const int desired_len = w * h * 4;
if (graph_image.size() != desired_len) {
reset_texture = true;
@@ -178,18 +176,19 @@ void EditorProfiler::_update_plot() {
}
PoolVector<uint8_t>::Write wr = graph_image.write();
+ const Color background_color = get_color("dark_color_2", "Editor");
- //clear
+ // Clear the previous frame and set the background color.
for (int i = 0; i < desired_len; i += 4) {
- wr[i + 0] = 0;
- wr[i + 1] = 0;
- wr[i + 2] = 0;
+ wr[i + 0] = Math::fast_ftoi(background_color.r * 255);
+ wr[i + 1] = Math::fast_ftoi(background_color.g * 255);
+ wr[i + 2] = Math::fast_ftoi(background_color.b * 255);
wr[i + 3] = 255;
}
//find highest value
- bool use_self = display_time->get_selected() == DISPLAY_SELF_TIME;
+ const bool use_self = display_time->get_selected() == DISPLAY_SELF_TIME;
float highest = 0;
for (int i = 0; i < frame_metrics.size(); i++) {
@@ -321,21 +320,23 @@ void EditorProfiler::_update_plot() {
for (int j = 0; j < h * 4; j += 4) {
- int a = column[j + 3];
+ const int a = column[j + 3];
if (a > 0) {
column[j + 0] /= a;
column[j + 1] /= a;
column[j + 2] /= a;
}
- uint8_t r = uint8_t(column[j + 0]);
- uint8_t g = uint8_t(column[j + 1]);
- uint8_t b = uint8_t(column[j + 2]);
+ const uint8_t red = uint8_t(column[j + 0]);
+ const uint8_t green = uint8_t(column[j + 1]);
+ const uint8_t blue = uint8_t(column[j + 2]);
+ const bool is_filled = red >= 1 || green >= 1 || blue >= 1;
+ const int widx = ((j >> 2) * w + i) * 4;
- int widx = ((j >> 2) * w + i) * 4;
- wr[widx + 0] = r;
- wr[widx + 1] = g;
- wr[widx + 2] = b;
+ // If the pixel isn't filled by any profiler line, apply the background color instead.
+ wr[widx + 0] = is_filled ? red : Math::fast_ftoi(background_color.r * 255);
+ wr[widx + 1] = is_filled ? green : Math::fast_ftoi(background_color.g * 255);
+ wr[widx + 2] = is_filled ? blue : Math::fast_ftoi(background_color.b * 255);
wr[widx + 3] = 255;
}
}
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 507ea0b83d..94aef60f1f 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -546,6 +546,17 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
edit_draw->update();
}
}
+
+ Ref<InputEventMagnifyGesture> magnify_gesture = p_input;
+ if (magnify_gesture.is_valid()) {
+ _zoom_on_position(draw_zoom * magnify_gesture->get_factor(), magnify_gesture->get_position());
+ }
+
+ Ref<InputEventPanGesture> pan_gesture = p_input;
+ if (pan_gesture.is_valid()) {
+ hscroll->set_value(hscroll->get_value() + hscroll->get_page() * pan_gesture->get_delta().x / 8);
+ vscroll->set_value(vscroll->get_value() + vscroll->get_page() * pan_gesture->get_delta().y / 8);
+ }
}
void TextureRegionEditor::_scroll_changed(float) {
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 30e31cb530..ee434aaac2 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -163,7 +163,7 @@ private:
}
if (valid_path == "") {
- set_message(TTR("The path does not exist."), MESSAGE_ERROR);
+ set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
return "";
@@ -177,7 +177,7 @@ private:
}
if (valid_install_path == "") {
- set_message(TTR("The path does not exist."), MESSAGE_ERROR, INSTALL_PATH);
+ set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR, INSTALL_PATH);
memdelete(d);
get_ok()->set_disabled(true);
return "";
@@ -195,7 +195,7 @@ private:
unzFile pkg = unzOpen2(valid_path.utf8().get_data(), &io);
if (!pkg) {
- set_message(TTR("Error opening package file, not in ZIP format."), MESSAGE_ERROR);
+ set_message(TTR("Error opening package file (it's not in ZIP format)."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
unzClose(pkg);
@@ -216,7 +216,7 @@ private:
}
if (ret == UNZ_END_OF_LIST_OF_FILE) {
- set_message(TTR("Invalid '.zip' project file, does not contain a 'project.godot' file."), MESSAGE_ERROR);
+ set_message(TTR("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
unzClose(pkg);
@@ -230,7 +230,11 @@ private:
bool is_empty = true;
String n = d->get_next();
while (n != String()) {
- if (n != "." && n != "..") {
+ if (!n.begins_with(".")) {
+ // Allow `.`, `..` (reserved current/parent folder names)
+ // and hidden files/folders to be present.
+ // For instance, this lets users initialize a Git repository
+ // and still be able to create a project in the directory afterwards.
is_empty = false;
break;
}
@@ -247,7 +251,7 @@ private:
}
} else {
- set_message(TTR("Please choose a 'project.godot' or '.zip' file."), MESSAGE_ERROR);
+ set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR);
memdelete(d);
install_path_container->hide();
get_ok()->set_disabled(true);
@@ -256,7 +260,7 @@ private:
} else if (valid_path.ends_with("zip")) {
- set_message(TTR("Directory already contains a Godot project."), MESSAGE_ERROR, INSTALL_PATH);
+ set_message(TTR("This directory already contains a Godot project."), MESSAGE_ERROR, INSTALL_PATH);
memdelete(d);
get_ok()->set_disabled(true);
return "";
@@ -269,7 +273,11 @@ private:
bool is_empty = true;
String n = d->get_next();
while (n != String()) {
- if (n != "." && n != "..") { // i don't know if this is enough to guarantee an empty dir
+ if (!n.begins_with(".")) {
+ // Allow `.`, `..` (reserved current/parent folder names)
+ // and hidden files/folders to be present.
+ // For instance, this lets users initialize a Git repository
+ // and still be able to create a project in the directory afterwards.
is_empty = false;
break;
}
@@ -332,7 +340,7 @@ private:
install_path_container->show();
get_ok()->set_disabled(false);
} else {
- set_message(TTR("Please choose a 'project.godot' or '.zip' file."), MESSAGE_ERROR);
+ set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR);
get_ok()->set_disabled(true);
return;
}
@@ -1316,6 +1324,7 @@ void ProjectList::create_project_item_control(int p_index) {
// The project icon may not be loaded by the time the control is displayed,
// so use a loading placeholder.
tf->set_texture(get_icon("ProjectIconLoading", "EditorIcons"));
+ tf->set_v_size_flags(SIZE_SHRINK_CENTER);
if (item.missing) {
tf->set_modulate(Color(1, 1, 1, 0.5));
}