Merge pull request #58163 from jmb462/notification-chunk-A
This commit is contained in:
commit
b5c0a892d4
@ -46,10 +46,12 @@ bool ScriptServer::languages_finished = false;
|
|||||||
ScriptEditRequestFunction ScriptServer::edit_request_func = nullptr;
|
ScriptEditRequestFunction ScriptServer::edit_request_func = nullptr;
|
||||||
|
|
||||||
void Script::_notification(int p_what) {
|
void Script::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_POSTINITIALIZE) {
|
switch (p_what) {
|
||||||
if (EngineDebugger::is_active()) {
|
case NOTIFICATION_POSTINITIALIZE: {
|
||||||
EngineDebugger::get_script_debugger()->set_break_language(get_language());
|
if (EngineDebugger::is_active()) {
|
||||||
}
|
EngineDebugger::get_script_debugger()->set_break_language(get_language());
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,8 +562,6 @@ void InputEventConfigurationDialog::_notification(int p_what) {
|
|||||||
|
|
||||||
_update_input_list();
|
_update_input_list();
|
||||||
} break;
|
} break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1014,8 +1012,6 @@ void ActionMapEditor::_notification(int p_what) {
|
|||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
action_list_search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
action_list_search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||||
} break;
|
} break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,310 +220,65 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AnimationBezierTrackEdit::_notification(int p_what) {
|
void AnimationBezierTrackEdit::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
switch (p_what) {
|
||||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
}
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
|
} break;
|
||||||
bezier_icon = get_theme_icon(SNAME("KeyBezierPoint"), SNAME("EditorIcons"));
|
|
||||||
bezier_handle_icon = get_theme_icon(SNAME("KeyBezierHandle"), SNAME("EditorIcons"));
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
selected_icon = get_theme_icon(SNAME("KeyBezierSelected"), SNAME("EditorIcons"));
|
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||||
}
|
[[fallthrough]];
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
|
||||||
if (animation.is_null()) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
|
bezier_icon = get_theme_icon(SNAME("KeyBezierPoint"), SNAME("EditorIcons"));
|
||||||
|
bezier_handle_icon = get_theme_icon(SNAME("KeyBezierHandle"), SNAME("EditorIcons"));
|
||||||
|
selected_icon = get_theme_icon(SNAME("KeyBezierSelected"), SNAME("EditorIcons"));
|
||||||
|
} break;
|
||||||
|
|
||||||
int limit = timeline->get_name_limit();
|
case NOTIFICATION_DRAW: {
|
||||||
|
if (animation.is_null()) {
|
||||||
if (has_focus()) {
|
return;
|
||||||
Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
|
||||||
accent.a *= 0.7;
|
|
||||||
draw_rect(Rect2(Point2(), get_size()), accent, false, Math::round(EDSCALE));
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
|
|
||||||
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
|
|
||||||
Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
|
|
||||||
int hsep = get_theme_constant(SNAME("hseparation"), SNAME("ItemList"));
|
|
||||||
int vsep = get_theme_constant(SNAME("vseparation"), SNAME("ItemList"));
|
|
||||||
Color linecolor = color;
|
|
||||||
linecolor.a = 0.2;
|
|
||||||
|
|
||||||
draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor, Math::round(EDSCALE));
|
|
||||||
|
|
||||||
int right_limit = get_size().width;
|
|
||||||
|
|
||||||
int vofs = vsep;
|
|
||||||
int margin = 0;
|
|
||||||
|
|
||||||
Map<int, Color> subtrack_colors;
|
|
||||||
Color selected_track_color;
|
|
||||||
subtracks.clear();
|
|
||||||
subtrack_icons.clear();
|
|
||||||
|
|
||||||
Map<String, Vector<int>> track_indices;
|
|
||||||
int track_count = animation->get_track_count();
|
|
||||||
for (int i = 0; i < track_count; ++i) {
|
|
||||||
if (animation->track_get_type(i) != Animation::TrackType::TYPE_BEZIER) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String base_path = animation->track_get_path(i);
|
int limit = timeline->get_name_limit();
|
||||||
if (is_filtered) {
|
|
||||||
if (root && root->has_node(base_path)) {
|
if (has_focus()) {
|
||||||
Node *node = root->get_node(base_path);
|
Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||||
if (!node) {
|
accent.a *= 0.7;
|
||||||
continue; // No node, no filter.
|
draw_rect(Rect2(Point2(), get_size()), accent, false, Math::round(EDSCALE));
|
||||||
}
|
|
||||||
if (!EditorNode::get_singleton()->get_editor_selection()->is_selected(node)) {
|
|
||||||
continue; // Skip track due to not selected.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int end = base_path.find(":");
|
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
|
||||||
if (end != -1) {
|
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
|
||||||
base_path = base_path.substr(0, end + 1);
|
Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
|
||||||
}
|
int hsep = get_theme_constant(SNAME("hseparation"), SNAME("ItemList"));
|
||||||
Vector<int> indices = track_indices.has(base_path) ? track_indices[base_path] : Vector<int>();
|
int vsep = get_theme_constant(SNAME("vseparation"), SNAME("ItemList"));
|
||||||
indices.push_back(i);
|
Color linecolor = color;
|
||||||
track_indices[base_path] = indices;
|
linecolor.a = 0.2;
|
||||||
}
|
|
||||||
|
|
||||||
for (const KeyValue<String, Vector<int>> &E : track_indices) {
|
draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor, Math::round(EDSCALE));
|
||||||
String base_path = E.key;
|
|
||||||
|
|
||||||
Vector<int> tracks = E.value;
|
int right_limit = get_size().width;
|
||||||
|
|
||||||
// NAMES AND ICON
|
int vofs = vsep;
|
||||||
{
|
int margin = 0;
|
||||||
NodePath path = animation->track_get_path(tracks[0]);
|
|
||||||
|
|
||||||
Node *node = nullptr;
|
Map<int, Color> subtrack_colors;
|
||||||
|
Color selected_track_color;
|
||||||
if (root && root->has_node(path)) {
|
subtracks.clear();
|
||||||
node = root->get_node(path);
|
subtrack_icons.clear();
|
||||||
}
|
|
||||||
|
|
||||||
String text;
|
|
||||||
|
|
||||||
if (node) {
|
|
||||||
int ofs = 0;
|
|
||||||
|
|
||||||
Ref<Texture2D> icon = EditorNode::get_singleton()->get_object_icon(node, "Node");
|
|
||||||
|
|
||||||
text = node->get_name();
|
|
||||||
ofs += hsep;
|
|
||||||
|
|
||||||
TextLine text_buf = TextLine(text, font, font_size);
|
|
||||||
text_buf.set_width(limit - ofs - icon->get_width() - hsep);
|
|
||||||
|
|
||||||
int h = MAX(text_buf.get_size().y, icon->get_height());
|
|
||||||
|
|
||||||
draw_texture(icon, Point2(ofs, vofs + int(h - icon->get_height()) / 2));
|
|
||||||
ofs += icon->get_width();
|
|
||||||
|
|
||||||
margin = icon->get_width();
|
|
||||||
|
|
||||||
Vector2 string_pos = Point2(ofs, vofs);
|
|
||||||
string_pos = string_pos.floor();
|
|
||||||
text_buf.draw(get_canvas_item(), string_pos, color);
|
|
||||||
|
|
||||||
vofs += h + vsep;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref<Texture2D> remove = get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"));
|
|
||||||
float remove_hpos = limit - hsep - remove->get_width();
|
|
||||||
|
|
||||||
Ref<Texture2D> lock = get_theme_icon(SNAME("Lock"), SNAME("EditorIcons"));
|
|
||||||
Ref<Texture2D> unlock = get_theme_icon(SNAME("Unlock"), SNAME("EditorIcons"));
|
|
||||||
float lock_hpos = remove_hpos - hsep - lock->get_width();
|
|
||||||
|
|
||||||
Ref<Texture2D> visible = get_theme_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons"));
|
|
||||||
Ref<Texture2D> hidden = get_theme_icon(SNAME("GuiVisibilityHidden"), SNAME("EditorIcons"));
|
|
||||||
float visibility_hpos = lock_hpos - hsep - visible->get_width();
|
|
||||||
|
|
||||||
Ref<Texture2D> solo = get_theme_icon(SNAME("AudioBusSolo"), SNAME("EditorIcons"));
|
|
||||||
float solo_hpos = visibility_hpos - hsep - solo->get_width();
|
|
||||||
|
|
||||||
float buttons_width = remove->get_width() + lock->get_width() + visible->get_width() + solo->get_width() + hsep * 3;
|
|
||||||
|
|
||||||
for (int i = 0; i < tracks.size(); ++i) {
|
|
||||||
// RELATED TRACKS TITLES
|
|
||||||
|
|
||||||
int current_track = tracks[i];
|
|
||||||
|
|
||||||
String path = animation->track_get_path(current_track);
|
|
||||||
path = path.replace_first(base_path, "");
|
|
||||||
|
|
||||||
Color cc = color;
|
|
||||||
TextLine text_buf = TextLine(path, font, font_size);
|
|
||||||
text_buf.set_width(limit - margin - buttons_width);
|
|
||||||
|
|
||||||
Rect2 rect = Rect2(margin, vofs, solo_hpos - hsep - solo->get_width(), text_buf.get_size().y + vsep);
|
|
||||||
|
|
||||||
cc.a *= 0.7;
|
|
||||||
float h;
|
|
||||||
if (path.ends_with(":x")) {
|
|
||||||
h = 0;
|
|
||||||
} else if (path.ends_with(":y")) {
|
|
||||||
h = 0.33f;
|
|
||||||
} else if (path.ends_with(":z")) {
|
|
||||||
h = 0.66f;
|
|
||||||
} else {
|
|
||||||
uint32_t hash = path.hash();
|
|
||||||
hash = ((hash >> 16) ^ hash) * 0x45d9f3b;
|
|
||||||
hash = ((hash >> 16) ^ hash) * 0x45d9f3b;
|
|
||||||
hash = (hash >> 16) ^ hash;
|
|
||||||
h = (hash % 65535) / 65536.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current_track != selected_track) {
|
|
||||||
Color track_color;
|
|
||||||
if (locked_tracks.has(current_track)) {
|
|
||||||
track_color.set_hsv(h, 0, 0.4);
|
|
||||||
} else {
|
|
||||||
track_color.set_hsv(h, 0.2, 0.8);
|
|
||||||
}
|
|
||||||
track_color.a = 0.5;
|
|
||||||
draw_rect(Rect2(0, vofs, margin - hsep, text_buf.get_size().y * 0.8), track_color);
|
|
||||||
subtrack_colors[current_track] = track_color;
|
|
||||||
|
|
||||||
subtracks[current_track] = rect;
|
|
||||||
} else {
|
|
||||||
Color ac = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
|
||||||
ac.a = 0.5;
|
|
||||||
draw_rect(rect, ac);
|
|
||||||
if (locked_tracks.has(selected_track)) {
|
|
||||||
selected_track_color.set_hsv(h, 0.0, 0.4);
|
|
||||||
} else {
|
|
||||||
selected_track_color.set_hsv(h, 0.8, 0.8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2 string_pos = Point2(margin, vofs);
|
|
||||||
text_buf.draw(get_canvas_item(), string_pos, cc);
|
|
||||||
|
|
||||||
float icon_start_height = vofs + rect.size.y / 2;
|
|
||||||
Rect2 remove_rect = Rect2(remove_hpos, icon_start_height - remove->get_height() / 2, remove->get_width(), remove->get_height());
|
|
||||||
draw_texture(remove, remove_rect.position);
|
|
||||||
|
|
||||||
Rect2 lock_rect = Rect2(lock_hpos, icon_start_height - lock->get_height() / 2, lock->get_width(), lock->get_height());
|
|
||||||
if (locked_tracks.has(current_track)) {
|
|
||||||
draw_texture(lock, lock_rect.position);
|
|
||||||
} else {
|
|
||||||
draw_texture(unlock, lock_rect.position);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rect2 visible_rect = Rect2(visibility_hpos, icon_start_height - visible->get_height() / 2, visible->get_width(), visible->get_height());
|
|
||||||
if (hidden_tracks.has(current_track)) {
|
|
||||||
draw_texture(hidden, visible_rect.position);
|
|
||||||
} else {
|
|
||||||
draw_texture(visible, visible_rect.position);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rect2 solo_rect = Rect2(solo_hpos, icon_start_height - solo->get_height() / 2, solo->get_width(), solo->get_height());
|
|
||||||
draw_texture(solo, solo_rect.position);
|
|
||||||
|
|
||||||
Map<int, Rect2> track_icons;
|
|
||||||
track_icons[REMOVE_ICON] = remove_rect;
|
|
||||||
track_icons[LOCK_ICON] = lock_rect;
|
|
||||||
track_icons[VISIBILITY_ICON] = visible_rect;
|
|
||||||
track_icons[SOLO_ICON] = solo_rect;
|
|
||||||
|
|
||||||
subtrack_icons[current_track] = track_icons;
|
|
||||||
|
|
||||||
vofs += text_buf.get_size().y + vsep;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
|
||||||
|
|
||||||
{ //guides
|
|
||||||
float min_left_scale = font->get_height(font_size) + vsep;
|
|
||||||
|
|
||||||
float scale = (min_left_scale * 2) * v_zoom;
|
|
||||||
float step = Math::pow(10.0, Math::round(Math::log(scale / 5.0) / Math::log(10.0))) * 5.0;
|
|
||||||
scale = Math::snapped(scale, step);
|
|
||||||
|
|
||||||
while (scale / v_zoom < min_left_scale * 2) {
|
|
||||||
scale += step;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool first = true;
|
|
||||||
int prev_iv = 0;
|
|
||||||
for (int i = font->get_height(font_size); i < get_size().height; i++) {
|
|
||||||
float ofs = get_size().height / 2 - i;
|
|
||||||
ofs *= v_zoom;
|
|
||||||
ofs += v_scroll;
|
|
||||||
|
|
||||||
int iv = int(ofs / scale);
|
|
||||||
if (ofs < 0) {
|
|
||||||
iv -= 1;
|
|
||||||
}
|
|
||||||
if (!first && iv != prev_iv) {
|
|
||||||
Color lc = linecolor;
|
|
||||||
lc.a *= 0.5;
|
|
||||||
draw_line(Point2(limit, i), Point2(right_limit, i), lc, Math::round(EDSCALE));
|
|
||||||
Color c = color;
|
|
||||||
c.a *= 0.5;
|
|
||||||
draw_string(font, Point2(limit + 8, i - 2), TS->format_number(rtos(Math::snapped((iv + 1) * scale, step))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
first = false;
|
|
||||||
prev_iv = iv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{ //draw OTHER curves
|
|
||||||
|
|
||||||
float scale = timeline->get_zoom_scale();
|
|
||||||
Ref<Texture2D> point = get_theme_icon(SNAME("KeyValue"), SNAME("EditorIcons"));
|
|
||||||
for (const KeyValue<int, Color> &E : subtrack_colors) {
|
|
||||||
if (hidden_tracks.has(E.key)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
_draw_track(E.key, E.value);
|
|
||||||
|
|
||||||
for (int i = 0; i < animation->track_get_key_count(E.key); i++) {
|
|
||||||
float offset = animation->track_get_key_time(E.key, i);
|
|
||||||
float value = animation->bezier_track_get_key_value(E.key, i);
|
|
||||||
|
|
||||||
Vector2 pos((offset - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value));
|
|
||||||
|
|
||||||
if (pos.x >= limit && pos.x <= right_limit) {
|
|
||||||
draw_texture(point, pos - point->get_size() / 2, E.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (track_count > 0 && !hidden_tracks.has(selected_track)) {
|
|
||||||
//draw edited curve
|
|
||||||
_draw_track(selected_track, selected_track_color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//draw editor handles
|
|
||||||
{
|
|
||||||
edit_points.clear();
|
|
||||||
float scale = timeline->get_zoom_scale();
|
|
||||||
|
|
||||||
|
Map<String, Vector<int>> track_indices;
|
||||||
|
int track_count = animation->get_track_count();
|
||||||
for (int i = 0; i < track_count; ++i) {
|
for (int i = 0; i < track_count; ++i) {
|
||||||
if (animation->track_get_type(i) != Animation::TrackType::TYPE_BEZIER || hidden_tracks.has(i)) {
|
if (animation->track_get_type(i) != Animation::TrackType::TYPE_BEZIER) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hidden_tracks.has(i) || locked_tracks.has(i)) {
|
String base_path = animation->track_get_path(i);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int key_count = animation->track_get_key_count(i);
|
|
||||||
String path = animation->track_get_path(i);
|
|
||||||
|
|
||||||
if (is_filtered) {
|
if (is_filtered) {
|
||||||
if (root && root->has_node(path)) {
|
if (root && root->has_node(base_path)) {
|
||||||
Node *node = root->get_node(path);
|
Node *node = root->get_node(base_path);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
continue; // No node, no filter.
|
continue; // No node, no filter.
|
||||||
}
|
}
|
||||||
@ -533,102 +288,355 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < key_count; ++j) {
|
int end = base_path.find(":");
|
||||||
float offset = animation->track_get_key_time(i, j);
|
if (end != -1) {
|
||||||
float value = animation->bezier_track_get_key_value(i, j);
|
base_path = base_path.substr(0, end + 1);
|
||||||
|
}
|
||||||
|
Vector<int> indices = track_indices.has(base_path) ? track_indices[base_path] : Vector<int>();
|
||||||
|
indices.push_back(i);
|
||||||
|
track_indices[base_path] = indices;
|
||||||
|
}
|
||||||
|
|
||||||
if (moving_selection && selection.has(IntPair(i, j))) {
|
for (const KeyValue<String, Vector<int>> &E : track_indices) {
|
||||||
offset += moving_selection_offset.x;
|
String base_path = E.key;
|
||||||
value += moving_selection_offset.y;
|
|
||||||
|
Vector<int> tracks = E.value;
|
||||||
|
|
||||||
|
// NAMES AND ICON
|
||||||
|
{
|
||||||
|
NodePath path = animation->track_get_path(tracks[0]);
|
||||||
|
|
||||||
|
Node *node = nullptr;
|
||||||
|
|
||||||
|
if (root && root->has_node(path)) {
|
||||||
|
node = root->get_node(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 pos((offset - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value));
|
String text;
|
||||||
|
|
||||||
Vector2 in_vec = animation->bezier_track_get_key_in_handle(i, j);
|
if (node) {
|
||||||
if (moving_handle != 0 && moving_handle_track == i && moving_handle_key == j) {
|
int ofs = 0;
|
||||||
in_vec = moving_handle_left;
|
|
||||||
|
Ref<Texture2D> icon = EditorNode::get_singleton()->get_object_icon(node, "Node");
|
||||||
|
|
||||||
|
text = node->get_name();
|
||||||
|
ofs += hsep;
|
||||||
|
|
||||||
|
TextLine text_buf = TextLine(text, font, font_size);
|
||||||
|
text_buf.set_width(limit - ofs - icon->get_width() - hsep);
|
||||||
|
|
||||||
|
int h = MAX(text_buf.get_size().y, icon->get_height());
|
||||||
|
|
||||||
|
draw_texture(icon, Point2(ofs, vofs + int(h - icon->get_height()) / 2));
|
||||||
|
ofs += icon->get_width();
|
||||||
|
|
||||||
|
margin = icon->get_width();
|
||||||
|
|
||||||
|
Vector2 string_pos = Point2(ofs, vofs);
|
||||||
|
string_pos = string_pos.floor();
|
||||||
|
text_buf.draw(get_canvas_item(), string_pos, color);
|
||||||
|
|
||||||
|
vofs += h + vsep;
|
||||||
}
|
}
|
||||||
Vector2 pos_in(((offset + in_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + in_vec.y));
|
}
|
||||||
|
|
||||||
Vector2 out_vec = animation->bezier_track_get_key_out_handle(i, j);
|
Ref<Texture2D> remove = get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"));
|
||||||
|
float remove_hpos = limit - hsep - remove->get_width();
|
||||||
|
|
||||||
if (moving_handle != 0 && moving_handle_track == i && moving_handle_key == j) {
|
Ref<Texture2D> lock = get_theme_icon(SNAME("Lock"), SNAME("EditorIcons"));
|
||||||
out_vec = moving_handle_right;
|
Ref<Texture2D> unlock = get_theme_icon(SNAME("Unlock"), SNAME("EditorIcons"));
|
||||||
|
float lock_hpos = remove_hpos - hsep - lock->get_width();
|
||||||
|
|
||||||
|
Ref<Texture2D> visible = get_theme_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons"));
|
||||||
|
Ref<Texture2D> hidden = get_theme_icon(SNAME("GuiVisibilityHidden"), SNAME("EditorIcons"));
|
||||||
|
float visibility_hpos = lock_hpos - hsep - visible->get_width();
|
||||||
|
|
||||||
|
Ref<Texture2D> solo = get_theme_icon(SNAME("AudioBusSolo"), SNAME("EditorIcons"));
|
||||||
|
float solo_hpos = visibility_hpos - hsep - solo->get_width();
|
||||||
|
|
||||||
|
float buttons_width = remove->get_width() + lock->get_width() + visible->get_width() + solo->get_width() + hsep * 3;
|
||||||
|
|
||||||
|
for (int i = 0; i < tracks.size(); ++i) {
|
||||||
|
// RELATED TRACKS TITLES
|
||||||
|
|
||||||
|
int current_track = tracks[i];
|
||||||
|
|
||||||
|
String path = animation->track_get_path(current_track);
|
||||||
|
path = path.replace_first(base_path, "");
|
||||||
|
|
||||||
|
Color cc = color;
|
||||||
|
TextLine text_buf = TextLine(path, font, font_size);
|
||||||
|
text_buf.set_width(limit - margin - buttons_width);
|
||||||
|
|
||||||
|
Rect2 rect = Rect2(margin, vofs, solo_hpos - hsep - solo->get_width(), text_buf.get_size().y + vsep);
|
||||||
|
|
||||||
|
cc.a *= 0.7;
|
||||||
|
float h;
|
||||||
|
if (path.ends_with(":x")) {
|
||||||
|
h = 0;
|
||||||
|
} else if (path.ends_with(":y")) {
|
||||||
|
h = 0.33f;
|
||||||
|
} else if (path.ends_with(":z")) {
|
||||||
|
h = 0.66f;
|
||||||
|
} else {
|
||||||
|
uint32_t hash = path.hash();
|
||||||
|
hash = ((hash >> 16) ^ hash) * 0x45d9f3b;
|
||||||
|
hash = ((hash >> 16) ^ hash) * 0x45d9f3b;
|
||||||
|
hash = (hash >> 16) ^ hash;
|
||||||
|
h = (hash % 65535) / 65536.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 pos_out(((offset + out_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + out_vec.y));
|
if (current_track != selected_track) {
|
||||||
|
Color track_color;
|
||||||
if (i == selected_track || selection.has(IntPair(i, j))) {
|
if (locked_tracks.has(current_track)) {
|
||||||
_draw_line_clipped(pos, pos_in, accent, limit, right_limit);
|
track_color.set_hsv(h, 0, 0.4);
|
||||||
_draw_line_clipped(pos, pos_out, accent, limit, right_limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
EditPoint ep;
|
|
||||||
ep.track = i;
|
|
||||||
ep.key = j;
|
|
||||||
if (pos.x >= limit && pos.x <= right_limit) {
|
|
||||||
ep.point_rect.position = (pos - bezier_icon->get_size() / 2).floor();
|
|
||||||
ep.point_rect.size = bezier_icon->get_size();
|
|
||||||
if (selection.has(IntPair(i, j))) {
|
|
||||||
draw_texture(selected_icon, ep.point_rect.position);
|
|
||||||
draw_string(font, ep.point_rect.position + Vector2(8, -font->get_height(font_size) - 8), TTR("Time:") + " " + TS->format_number(rtos(Math::snapped(offset, 0.001))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, accent);
|
|
||||||
draw_string(font, ep.point_rect.position + Vector2(8, -8), TTR("Value:") + " " + TS->format_number(rtos(Math::snapped(value, 0.001))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, accent);
|
|
||||||
} else {
|
} else {
|
||||||
Color track_color = Color(1, 1, 1, 1);
|
track_color.set_hsv(h, 0.2, 0.8);
|
||||||
if (i != selected_track) {
|
}
|
||||||
track_color = subtrack_colors[i];
|
track_color.a = 0.5;
|
||||||
|
draw_rect(Rect2(0, vofs, margin - hsep, text_buf.get_size().y * 0.8), track_color);
|
||||||
|
subtrack_colors[current_track] = track_color;
|
||||||
|
|
||||||
|
subtracks[current_track] = rect;
|
||||||
|
} else {
|
||||||
|
Color ac = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||||
|
ac.a = 0.5;
|
||||||
|
draw_rect(rect, ac);
|
||||||
|
if (locked_tracks.has(selected_track)) {
|
||||||
|
selected_track_color.set_hsv(h, 0.0, 0.4);
|
||||||
|
} else {
|
||||||
|
selected_track_color.set_hsv(h, 0.8, 0.8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 string_pos = Point2(margin, vofs);
|
||||||
|
text_buf.draw(get_canvas_item(), string_pos, cc);
|
||||||
|
|
||||||
|
float icon_start_height = vofs + rect.size.y / 2;
|
||||||
|
Rect2 remove_rect = Rect2(remove_hpos, icon_start_height - remove->get_height() / 2, remove->get_width(), remove->get_height());
|
||||||
|
draw_texture(remove, remove_rect.position);
|
||||||
|
|
||||||
|
Rect2 lock_rect = Rect2(lock_hpos, icon_start_height - lock->get_height() / 2, lock->get_width(), lock->get_height());
|
||||||
|
if (locked_tracks.has(current_track)) {
|
||||||
|
draw_texture(lock, lock_rect.position);
|
||||||
|
} else {
|
||||||
|
draw_texture(unlock, lock_rect.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect2 visible_rect = Rect2(visibility_hpos, icon_start_height - visible->get_height() / 2, visible->get_width(), visible->get_height());
|
||||||
|
if (hidden_tracks.has(current_track)) {
|
||||||
|
draw_texture(hidden, visible_rect.position);
|
||||||
|
} else {
|
||||||
|
draw_texture(visible, visible_rect.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect2 solo_rect = Rect2(solo_hpos, icon_start_height - solo->get_height() / 2, solo->get_width(), solo->get_height());
|
||||||
|
draw_texture(solo, solo_rect.position);
|
||||||
|
|
||||||
|
Map<int, Rect2> track_icons;
|
||||||
|
track_icons[REMOVE_ICON] = remove_rect;
|
||||||
|
track_icons[LOCK_ICON] = lock_rect;
|
||||||
|
track_icons[VISIBILITY_ICON] = visible_rect;
|
||||||
|
track_icons[SOLO_ICON] = solo_rect;
|
||||||
|
|
||||||
|
subtrack_icons[current_track] = track_icons;
|
||||||
|
|
||||||
|
vofs += text_buf.get_size().y + vsep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||||
|
|
||||||
|
{ //guides
|
||||||
|
float min_left_scale = font->get_height(font_size) + vsep;
|
||||||
|
|
||||||
|
float scale = (min_left_scale * 2) * v_zoom;
|
||||||
|
float step = Math::pow(10.0, Math::round(Math::log(scale / 5.0) / Math::log(10.0))) * 5.0;
|
||||||
|
scale = Math::snapped(scale, step);
|
||||||
|
|
||||||
|
while (scale / v_zoom < min_left_scale * 2) {
|
||||||
|
scale += step;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool first = true;
|
||||||
|
int prev_iv = 0;
|
||||||
|
for (int i = font->get_height(font_size); i < get_size().height; i++) {
|
||||||
|
float ofs = get_size().height / 2 - i;
|
||||||
|
ofs *= v_zoom;
|
||||||
|
ofs += v_scroll;
|
||||||
|
|
||||||
|
int iv = int(ofs / scale);
|
||||||
|
if (ofs < 0) {
|
||||||
|
iv -= 1;
|
||||||
|
}
|
||||||
|
if (!first && iv != prev_iv) {
|
||||||
|
Color lc = linecolor;
|
||||||
|
lc.a *= 0.5;
|
||||||
|
draw_line(Point2(limit, i), Point2(right_limit, i), lc, Math::round(EDSCALE));
|
||||||
|
Color c = color;
|
||||||
|
c.a *= 0.5;
|
||||||
|
draw_string(font, Point2(limit + 8, i - 2), TS->format_number(rtos(Math::snapped((iv + 1) * scale, step))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
first = false;
|
||||||
|
prev_iv = iv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{ //draw OTHER curves
|
||||||
|
|
||||||
|
float scale = timeline->get_zoom_scale();
|
||||||
|
Ref<Texture2D> point = get_theme_icon(SNAME("KeyValue"), SNAME("EditorIcons"));
|
||||||
|
for (const KeyValue<int, Color> &E : subtrack_colors) {
|
||||||
|
if (hidden_tracks.has(E.key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
_draw_track(E.key, E.value);
|
||||||
|
|
||||||
|
for (int i = 0; i < animation->track_get_key_count(E.key); i++) {
|
||||||
|
float offset = animation->track_get_key_time(E.key, i);
|
||||||
|
float value = animation->bezier_track_get_key_value(E.key, i);
|
||||||
|
|
||||||
|
Vector2 pos((offset - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value));
|
||||||
|
|
||||||
|
if (pos.x >= limit && pos.x <= right_limit) {
|
||||||
|
draw_texture(point, pos - point->get_size() / 2, E.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (track_count > 0 && !hidden_tracks.has(selected_track)) {
|
||||||
|
//draw edited curve
|
||||||
|
_draw_track(selected_track, selected_track_color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//draw editor handles
|
||||||
|
{
|
||||||
|
edit_points.clear();
|
||||||
|
float scale = timeline->get_zoom_scale();
|
||||||
|
|
||||||
|
for (int i = 0; i < track_count; ++i) {
|
||||||
|
if (animation->track_get_type(i) != Animation::TrackType::TYPE_BEZIER || hidden_tracks.has(i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hidden_tracks.has(i) || locked_tracks.has(i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int key_count = animation->track_get_key_count(i);
|
||||||
|
String path = animation->track_get_path(i);
|
||||||
|
|
||||||
|
if (is_filtered) {
|
||||||
|
if (root && root->has_node(path)) {
|
||||||
|
Node *node = root->get_node(path);
|
||||||
|
if (!node) {
|
||||||
|
continue; // No node, no filter.
|
||||||
|
}
|
||||||
|
if (!EditorNode::get_singleton()->get_editor_selection()->is_selected(node)) {
|
||||||
|
continue; // Skip track due to not selected.
|
||||||
}
|
}
|
||||||
draw_texture(bezier_icon, ep.point_rect.position, track_color);
|
|
||||||
}
|
|
||||||
ep.point_rect = ep.point_rect.grow(ep.point_rect.size.width * 0.5);
|
|
||||||
}
|
|
||||||
if (i == selected_track || selection.has(IntPair(i, j))) {
|
|
||||||
if (pos_in.x >= limit && pos_in.x <= right_limit) {
|
|
||||||
ep.in_rect.position = (pos_in - bezier_handle_icon->get_size() / 2).floor();
|
|
||||||
ep.in_rect.size = bezier_handle_icon->get_size();
|
|
||||||
draw_texture(bezier_handle_icon, ep.in_rect.position);
|
|
||||||
ep.in_rect = ep.in_rect.grow(ep.in_rect.size.width * 0.5);
|
|
||||||
}
|
|
||||||
if (pos_out.x >= limit && pos_out.x <= right_limit) {
|
|
||||||
ep.out_rect.position = (pos_out - bezier_handle_icon->get_size() / 2).floor();
|
|
||||||
ep.out_rect.size = bezier_handle_icon->get_size();
|
|
||||||
draw_texture(bezier_handle_icon, ep.out_rect.position);
|
|
||||||
ep.out_rect = ep.out_rect.grow(ep.out_rect.size.width * 0.5);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!locked_tracks.has(i)) {
|
|
||||||
edit_points.push_back(ep);
|
for (int j = 0; j < key_count; ++j) {
|
||||||
|
float offset = animation->track_get_key_time(i, j);
|
||||||
|
float value = animation->bezier_track_get_key_value(i, j);
|
||||||
|
|
||||||
|
if (moving_selection && selection.has(IntPair(i, j))) {
|
||||||
|
offset += moving_selection_offset.x;
|
||||||
|
value += moving_selection_offset.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 pos((offset - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value));
|
||||||
|
|
||||||
|
Vector2 in_vec = animation->bezier_track_get_key_in_handle(i, j);
|
||||||
|
if (moving_handle != 0 && moving_handle_track == i && moving_handle_key == j) {
|
||||||
|
in_vec = moving_handle_left;
|
||||||
|
}
|
||||||
|
Vector2 pos_in(((offset + in_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + in_vec.y));
|
||||||
|
|
||||||
|
Vector2 out_vec = animation->bezier_track_get_key_out_handle(i, j);
|
||||||
|
|
||||||
|
if (moving_handle != 0 && moving_handle_track == i && moving_handle_key == j) {
|
||||||
|
out_vec = moving_handle_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 pos_out(((offset + out_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + out_vec.y));
|
||||||
|
|
||||||
|
if (i == selected_track || selection.has(IntPair(i, j))) {
|
||||||
|
_draw_line_clipped(pos, pos_in, accent, limit, right_limit);
|
||||||
|
_draw_line_clipped(pos, pos_out, accent, limit, right_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditPoint ep;
|
||||||
|
ep.track = i;
|
||||||
|
ep.key = j;
|
||||||
|
if (pos.x >= limit && pos.x <= right_limit) {
|
||||||
|
ep.point_rect.position = (pos - bezier_icon->get_size() / 2).floor();
|
||||||
|
ep.point_rect.size = bezier_icon->get_size();
|
||||||
|
if (selection.has(IntPair(i, j))) {
|
||||||
|
draw_texture(selected_icon, ep.point_rect.position);
|
||||||
|
draw_string(font, ep.point_rect.position + Vector2(8, -font->get_height(font_size) - 8), TTR("Time:") + " " + TS->format_number(rtos(Math::snapped(offset, 0.001))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, accent);
|
||||||
|
draw_string(font, ep.point_rect.position + Vector2(8, -8), TTR("Value:") + " " + TS->format_number(rtos(Math::snapped(value, 0.001))), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, accent);
|
||||||
|
} else {
|
||||||
|
Color track_color = Color(1, 1, 1, 1);
|
||||||
|
if (i != selected_track) {
|
||||||
|
track_color = subtrack_colors[i];
|
||||||
|
}
|
||||||
|
draw_texture(bezier_icon, ep.point_rect.position, track_color);
|
||||||
|
}
|
||||||
|
ep.point_rect = ep.point_rect.grow(ep.point_rect.size.width * 0.5);
|
||||||
|
}
|
||||||
|
if (i == selected_track || selection.has(IntPair(i, j))) {
|
||||||
|
if (pos_in.x >= limit && pos_in.x <= right_limit) {
|
||||||
|
ep.in_rect.position = (pos_in - bezier_handle_icon->get_size() / 2).floor();
|
||||||
|
ep.in_rect.size = bezier_handle_icon->get_size();
|
||||||
|
draw_texture(bezier_handle_icon, ep.in_rect.position);
|
||||||
|
ep.in_rect = ep.in_rect.grow(ep.in_rect.size.width * 0.5);
|
||||||
|
}
|
||||||
|
if (pos_out.x >= limit && pos_out.x <= right_limit) {
|
||||||
|
ep.out_rect.position = (pos_out - bezier_handle_icon->get_size() / 2).floor();
|
||||||
|
ep.out_rect.size = bezier_handle_icon->get_size();
|
||||||
|
draw_texture(bezier_handle_icon, ep.out_rect.position);
|
||||||
|
ep.out_rect = ep.out_rect.grow(ep.out_rect.size.width * 0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!locked_tracks.has(i)) {
|
||||||
|
edit_points.push_back(ep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < edit_points.size(); ++i) {
|
||||||
|
if (edit_points[i].track == selected_track) {
|
||||||
|
EditPoint ep = edit_points[i];
|
||||||
|
edit_points.remove_at(i);
|
||||||
|
edit_points.insert(0, ep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < edit_points.size(); ++i) {
|
if (box_selecting) {
|
||||||
if (edit_points[i].track == selected_track) {
|
Vector2 bs_from = box_selection_from;
|
||||||
EditPoint ep = edit_points[i];
|
Vector2 bs_to = box_selection_to;
|
||||||
edit_points.remove_at(i);
|
if (bs_from.x > bs_to.x) {
|
||||||
edit_points.insert(0, ep);
|
SWAP(bs_from.x, bs_to.x);
|
||||||
}
|
}
|
||||||
|
if (bs_from.y > bs_to.y) {
|
||||||
|
SWAP(bs_from.y, bs_to.y);
|
||||||
|
}
|
||||||
|
draw_rect(
|
||||||
|
Rect2(bs_from, bs_to - bs_from),
|
||||||
|
get_theme_color(SNAME("box_selection_fill_color"), SNAME("Editor")));
|
||||||
|
draw_rect(
|
||||||
|
Rect2(bs_from, bs_to - bs_from),
|
||||||
|
get_theme_color(SNAME("box_selection_stroke_color"), SNAME("Editor")),
|
||||||
|
false,
|
||||||
|
Math::round(EDSCALE));
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (box_selecting) {
|
|
||||||
Vector2 bs_from = box_selection_from;
|
|
||||||
Vector2 bs_to = box_selection_to;
|
|
||||||
if (bs_from.x > bs_to.x) {
|
|
||||||
SWAP(bs_from.x, bs_to.x);
|
|
||||||
}
|
|
||||||
if (bs_from.y > bs_to.y) {
|
|
||||||
SWAP(bs_from.y, bs_to.y);
|
|
||||||
}
|
|
||||||
draw_rect(
|
|
||||||
Rect2(bs_from, bs_to - bs_from),
|
|
||||||
get_theme_color(SNAME("box_selection_fill_color"), SNAME("Editor")));
|
|
||||||
draw_rect(
|
|
||||||
Rect2(bs_from, bs_to - bs_from),
|
|
||||||
get_theme_color(SNAME("box_selection_stroke_color"), SNAME("Editor")),
|
|
||||||
false,
|
|
||||||
Math::round(EDSCALE));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -214,25 +214,27 @@ void AudioStreamPreviewGenerator::_bind_methods() {
|
|||||||
AudioStreamPreviewGenerator *AudioStreamPreviewGenerator::singleton = nullptr;
|
AudioStreamPreviewGenerator *AudioStreamPreviewGenerator::singleton = nullptr;
|
||||||
|
|
||||||
void AudioStreamPreviewGenerator::_notification(int p_what) {
|
void AudioStreamPreviewGenerator::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_PROCESS) {
|
switch (p_what) {
|
||||||
List<ObjectID> to_erase;
|
case NOTIFICATION_PROCESS: {
|
||||||
for (KeyValue<ObjectID, Preview> &E : previews) {
|
List<ObjectID> to_erase;
|
||||||
if (!E.value.generating.is_set()) {
|
for (KeyValue<ObjectID, Preview> &E : previews) {
|
||||||
if (E.value.thread) {
|
if (!E.value.generating.is_set()) {
|
||||||
E.value.thread->wait_to_finish();
|
if (E.value.thread) {
|
||||||
memdelete(E.value.thread);
|
E.value.thread->wait_to_finish();
|
||||||
E.value.thread = nullptr;
|
memdelete(E.value.thread);
|
||||||
}
|
E.value.thread = nullptr;
|
||||||
if (!ObjectDB::get_instance(E.key)) { //no longer in use, get rid of preview
|
}
|
||||||
to_erase.push_back(E.key);
|
if (!ObjectDB::get_instance(E.key)) { //no longer in use, get rid of preview
|
||||||
|
to_erase.push_back(E.key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
while (to_erase.front()) {
|
while (to_erase.front()) {
|
||||||
previews.erase(to_erase.front()->get());
|
previews.erase(to_erase.front()->get());
|
||||||
to_erase.pop_front();
|
to_erase.pop_front();
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,29 +85,31 @@ GotoLineDialog::GotoLineDialog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FindReplaceBar::_notification(int p_what) {
|
void FindReplaceBar::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_READY) {
|
switch (p_what) {
|
||||||
find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons")));
|
case NOTIFICATION_READY:
|
||||||
find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons")));
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons")));
|
||||||
hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons")));
|
||||||
hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
||||||
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
|
hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
||||||
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
||||||
set_process_unhandled_input(is_visible_in_tree());
|
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
|
||||||
} else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
} break;
|
||||||
find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons")));
|
|
||||||
find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons")));
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
set_process_unhandled_input(is_visible_in_tree());
|
||||||
hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
} break;
|
||||||
hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
|
|
||||||
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
|
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||||
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
} break;
|
||||||
} else if (p_what == NOTIFICATION_PREDELETE) {
|
|
||||||
if (base_text_editor) {
|
case NOTIFICATION_PREDELETE: {
|
||||||
base_text_editor->remove_find_replace_bar();
|
if (base_text_editor) {
|
||||||
base_text_editor = nullptr;
|
base_text_editor->remove_find_replace_bar();
|
||||||
}
|
base_text_editor = nullptr;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1658,44 +1660,47 @@ void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeTextEditor::_update_status_bar_theme() {
|
||||||
|
error_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
|
||||||
|
error_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||||
|
error_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
|
||||||
|
error_button->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
|
||||||
|
|
||||||
|
warning_button->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")));
|
||||||
|
warning_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
|
||||||
|
warning_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
|
||||||
|
warning_button->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
|
||||||
|
|
||||||
|
line_and_col_txt->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
|
||||||
|
line_and_col_txt->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
|
||||||
|
}
|
||||||
|
|
||||||
void CodeTextEditor::_notification(int p_what) {
|
void CodeTextEditor::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
_update_status_bar_theme();
|
||||||
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
error_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
|
_update_status_bar_theme();
|
||||||
error_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
|
||||||
error_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
|
|
||||||
error_button->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
|
|
||||||
|
|
||||||
warning_button->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")));
|
|
||||||
warning_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
|
|
||||||
warning_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
|
|
||||||
warning_button->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
|
|
||||||
|
|
||||||
line_and_col_txt->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
|
|
||||||
line_and_col_txt->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (toggle_scripts_button->is_visible()) {
|
if (toggle_scripts_button->is_visible()) {
|
||||||
update_toggle_scripts_button();
|
update_toggle_scripts_button();
|
||||||
}
|
}
|
||||||
_update_text_editor_theme();
|
_update_text_editor_theme();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (toggle_scripts_button->is_visible()) {
|
if (toggle_scripts_button->is_visible()) {
|
||||||
update_toggle_scripts_button();
|
update_toggle_scripts_button();
|
||||||
}
|
}
|
||||||
set_process_input(is_visible_in_tree());
|
set_process_input(is_visible_in_tree());
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PREDELETE: {
|
case NOTIFICATION_PREDELETE: {
|
||||||
if (find_replace_bar) {
|
if (find_replace_bar) {
|
||||||
find_replace_bar->set_text_edit(nullptr);
|
find_replace_bar->set_text_edit(nullptr);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,6 +189,8 @@ class CodeTextEditor : public VBoxContainer {
|
|||||||
void _set_show_warnings_panel(bool p_show);
|
void _set_show_warnings_panel(bool p_show);
|
||||||
void _error_pressed(const Ref<InputEvent> &p_event);
|
void _error_pressed(const Ref<InputEvent> &p_event);
|
||||||
|
|
||||||
|
void _update_status_bar_theme();
|
||||||
|
|
||||||
void _delete_line(int p_line);
|
void _delete_line(int p_line);
|
||||||
void _toggle_scripts_pressed();
|
void _toggle_scripts_pressed();
|
||||||
|
|
||||||
|
@ -277,8 +277,10 @@ void ConnectDialog::_update_ok_enabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConnectDialog::_notification(int p_what) {
|
void ConnectDialog::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
bind_editor->edit(cdbinds);
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
|
bind_editor->edit(cdbinds);
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,6 +940,7 @@ void ConnectionsDock::_notification(int p_what) {
|
|||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
update_tree();
|
update_tree();
|
||||||
} break;
|
} break;
|
||||||
|
@ -429,9 +429,11 @@ void CreateDialog::_notification(int p_what) {
|
|||||||
connect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
|
connect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
|
||||||
_update_theme();
|
_update_theme();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
disconnect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
|
disconnect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
if (is_visible()) {
|
if (is_visible()) {
|
||||||
search_box->call_deferred(SNAME("grab_focus")); // still not visible
|
search_box->call_deferred(SNAME("grab_focus")); // still not visible
|
||||||
@ -440,6 +442,7 @@ void CreateDialog::_notification(int p_what) {
|
|||||||
EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2(get_position(), get_size()));
|
EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2(get_position(), get_size()));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
_update_theme();
|
_update_theme();
|
||||||
} break;
|
} break;
|
||||||
|
@ -42,12 +42,14 @@ DebugAdapterServer::DebugAdapterServer() {
|
|||||||
|
|
||||||
void DebugAdapterServer::_notification(int p_what) {
|
void DebugAdapterServer::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
start();
|
start();
|
||||||
break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_TREE:
|
|
||||||
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
stop();
|
stop();
|
||||||
break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
// The main loop can be run again during request processing, which modifies internal state of the protocol.
|
// The main loop can be run again during request processing, which modifies internal state of the protocol.
|
||||||
// Thus, "polling" is needed to prevent it from parsing other requests while the current one isn't finished.
|
// Thus, "polling" is needed to prevent it from parsing other requests while the current one isn't finished.
|
||||||
@ -57,6 +59,7 @@ void DebugAdapterServer::_notification(int p_what) {
|
|||||||
polling = false;
|
polling = false;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
protocol._request_timeout = EditorSettings::get_singleton()->get("network/debug_adapter/request_timeout");
|
protocol._request_timeout = EditorSettings::get_singleton()->get("network/debug_adapter/request_timeout");
|
||||||
protocol._sync_breakpoints = EditorSettings::get_singleton()->get("network/debug_adapter/sync_breakpoints");
|
protocol._sync_breakpoints = EditorSettings::get_singleton()->get("network/debug_adapter/sync_breakpoints");
|
||||||
|
@ -107,14 +107,13 @@ void EditorDebuggerInspector::_bind_methods() {
|
|||||||
|
|
||||||
void EditorDebuggerInspector::_notification(int p_what) {
|
void EditorDebuggerInspector::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_POSTINITIALIZE:
|
case NOTIFICATION_POSTINITIALIZE: {
|
||||||
connect("object_id_selected", callable_mp(this, &EditorDebuggerInspector::_object_selected));
|
connect("object_id_selected", callable_mp(this, &EditorDebuggerInspector::_object_selected));
|
||||||
break;
|
} break;
|
||||||
case NOTIFICATION_ENTER_TREE:
|
|
||||||
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
edit(variables);
|
edit(variables);
|
||||||
break;
|
} break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,112 +240,113 @@ void EditorDebuggerNode::_notification(int p_what) {
|
|||||||
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
|
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
_update_debug_options();
|
_update_debug_options();
|
||||||
} break;
|
} break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what != NOTIFICATION_PROCESS || !server.is_valid()) {
|
case NOTIFICATION_PROCESS: {
|
||||||
return;
|
if (!server.is_valid()) {
|
||||||
}
|
|
||||||
|
|
||||||
if (!server.is_valid() || !server->is_active()) {
|
|
||||||
stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
server->poll();
|
|
||||||
|
|
||||||
// Errors and warnings
|
|
||||||
int error_count = 0;
|
|
||||||
int warning_count = 0;
|
|
||||||
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
|
|
||||||
error_count += dbg->get_error_count();
|
|
||||||
warning_count += dbg->get_warning_count();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (error_count != last_error_count || warning_count != last_warning_count) {
|
|
||||||
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
|
|
||||||
dbg->update_tabs();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (error_count == 0 && warning_count == 0) {
|
|
||||||
debugger_button->set_text(TTR("Debugger"));
|
|
||||||
debugger_button->remove_theme_color_override("font_color");
|
|
||||||
debugger_button->set_icon(Ref<Texture2D>());
|
|
||||||
} else {
|
|
||||||
debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")");
|
|
||||||
if (error_count >= 1 && warning_count >= 1) {
|
|
||||||
debugger_button->set_icon(get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons")));
|
|
||||||
// Use error color to represent the highest level of severity reported.
|
|
||||||
debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
|
||||||
} else if (error_count >= 1) {
|
|
||||||
debugger_button->set_icon(get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
|
|
||||||
debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
|
||||||
} else {
|
|
||||||
debugger_button->set_icon(get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")));
|
|
||||||
debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
last_error_count = error_count;
|
|
||||||
last_warning_count = warning_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remote scene tree update
|
|
||||||
remote_scene_tree_timeout -= get_process_delta_time();
|
|
||||||
if (remote_scene_tree_timeout < 0) {
|
|
||||||
remote_scene_tree_timeout = EditorSettings::get_singleton()->get("debugger/remote_scene_tree_refresh_interval");
|
|
||||||
if (remote_scene_tree->is_visible_in_tree()) {
|
|
||||||
get_current_debugger()->request_remote_tree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remote inspector update
|
|
||||||
inspect_edited_object_timeout -= get_process_delta_time();
|
|
||||||
if (inspect_edited_object_timeout < 0) {
|
|
||||||
inspect_edited_object_timeout = EditorSettings::get_singleton()->get("debugger/remote_inspect_refresh_interval");
|
|
||||||
if (EditorDebuggerRemoteObject *obj = get_inspected_remote_object()) {
|
|
||||||
get_current_debugger()->request_remote_object(obj->remote_object_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take connections.
|
|
||||||
if (server->is_connection_available()) {
|
|
||||||
ScriptEditorDebugger *debugger = nullptr;
|
|
||||||
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
|
|
||||||
if (debugger || dbg->is_session_active()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
debugger = dbg;
|
|
||||||
});
|
if (!server->is_active()) {
|
||||||
if (debugger == nullptr) {
|
stop();
|
||||||
if (tabs->get_tab_count() <= 4) { // Max 4 debugging sessions active.
|
return;
|
||||||
debugger = _add_debugger();
|
|
||||||
} else {
|
|
||||||
// We already have too many sessions, disconnecting new clients to prevent them from hanging.
|
|
||||||
server->take_connection()->close();
|
|
||||||
return; // Can't add, stop here.
|
|
||||||
}
|
}
|
||||||
}
|
server->poll();
|
||||||
|
|
||||||
EditorNode::get_singleton()->get_pause_button()->set_disabled(false);
|
// Errors and warnings
|
||||||
// Switch to remote tree view if so desired.
|
int error_count = 0;
|
||||||
auto_switch_remote_scene_tree = (bool)EditorSettings::get_singleton()->get("debugger/auto_switch_to_remote_scene_tree");
|
int warning_count = 0;
|
||||||
if (auto_switch_remote_scene_tree) {
|
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
|
||||||
SceneTreeDock::get_singleton()->show_remote_tree();
|
error_count += dbg->get_error_count();
|
||||||
}
|
warning_count += dbg->get_warning_count();
|
||||||
// Good to go.
|
});
|
||||||
SceneTreeDock::get_singleton()->show_tab_buttons();
|
|
||||||
debugger->set_editor_remote_tree(remote_scene_tree);
|
|
||||||
debugger->start(server->take_connection());
|
|
||||||
// Send breakpoints.
|
|
||||||
for (const KeyValue<Breakpoint, bool> &E : breakpoints) {
|
|
||||||
const Breakpoint &bp = E.key;
|
|
||||||
debugger->set_breakpoint(bp.source, bp.line, E.value);
|
|
||||||
} // Will arrive too late, how does the regular run work?
|
|
||||||
|
|
||||||
debugger->update_live_edit_root();
|
if (error_count != last_error_count || warning_count != last_warning_count) {
|
||||||
|
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
|
||||||
|
dbg->update_tabs();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (error_count == 0 && warning_count == 0) {
|
||||||
|
debugger_button->set_text(TTR("Debugger"));
|
||||||
|
debugger_button->remove_theme_color_override("font_color");
|
||||||
|
debugger_button->set_icon(Ref<Texture2D>());
|
||||||
|
} else {
|
||||||
|
debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")");
|
||||||
|
if (error_count >= 1 && warning_count >= 1) {
|
||||||
|
debugger_button->set_icon(get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons")));
|
||||||
|
// Use error color to represent the highest level of severity reported.
|
||||||
|
debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||||
|
} else if (error_count >= 1) {
|
||||||
|
debugger_button->set_icon(get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
|
||||||
|
debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||||
|
} else {
|
||||||
|
debugger_button->set_icon(get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")));
|
||||||
|
debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
last_error_count = error_count;
|
||||||
|
last_warning_count = warning_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remote scene tree update
|
||||||
|
remote_scene_tree_timeout -= get_process_delta_time();
|
||||||
|
if (remote_scene_tree_timeout < 0) {
|
||||||
|
remote_scene_tree_timeout = EditorSettings::get_singleton()->get("debugger/remote_scene_tree_refresh_interval");
|
||||||
|
if (remote_scene_tree->is_visible_in_tree()) {
|
||||||
|
get_current_debugger()->request_remote_tree();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remote inspector update
|
||||||
|
inspect_edited_object_timeout -= get_process_delta_time();
|
||||||
|
if (inspect_edited_object_timeout < 0) {
|
||||||
|
inspect_edited_object_timeout = EditorSettings::get_singleton()->get("debugger/remote_inspect_refresh_interval");
|
||||||
|
if (EditorDebuggerRemoteObject *obj = get_inspected_remote_object()) {
|
||||||
|
get_current_debugger()->request_remote_object(obj->remote_object_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take connections.
|
||||||
|
if (server->is_connection_available()) {
|
||||||
|
ScriptEditorDebugger *debugger = nullptr;
|
||||||
|
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
|
||||||
|
if (debugger || dbg->is_session_active()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
debugger = dbg;
|
||||||
|
});
|
||||||
|
if (debugger == nullptr) {
|
||||||
|
if (tabs->get_tab_count() <= 4) { // Max 4 debugging sessions active.
|
||||||
|
debugger = _add_debugger();
|
||||||
|
} else {
|
||||||
|
// We already have too many sessions, disconnecting new clients to prevent them from hanging.
|
||||||
|
server->take_connection()->close();
|
||||||
|
return; // Can't add, stop here.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorNode::get_singleton()->get_pause_button()->set_disabled(false);
|
||||||
|
// Switch to remote tree view if so desired.
|
||||||
|
auto_switch_remote_scene_tree = (bool)EditorSettings::get_singleton()->get("debugger/auto_switch_to_remote_scene_tree");
|
||||||
|
if (auto_switch_remote_scene_tree) {
|
||||||
|
SceneTreeDock::get_singleton()->show_remote_tree();
|
||||||
|
}
|
||||||
|
// Good to go.
|
||||||
|
SceneTreeDock::get_singleton()->show_tab_buttons();
|
||||||
|
debugger->set_editor_remote_tree(remote_scene_tree);
|
||||||
|
debugger->start(server->take_connection());
|
||||||
|
// Send breakpoints.
|
||||||
|
for (const KeyValue<Breakpoint, bool> &E : breakpoints) {
|
||||||
|
const Breakpoint &bp = E.key;
|
||||||
|
debugger->set_breakpoint(bp.source, bp.line, E.value);
|
||||||
|
} // Will arrive too late, how does the regular run work?
|
||||||
|
|
||||||
|
debugger->update_live_edit_root();
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,10 +53,12 @@ EditorDebuggerTree::EditorDebuggerTree() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorDebuggerTree::_notification(int p_what) {
|
void EditorDebuggerTree::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_POSTINITIALIZE) {
|
switch (p_what) {
|
||||||
connect("cell_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_selected));
|
case NOTIFICATION_POSTINITIALIZE: {
|
||||||
connect("item_collapsed", callable_mp(this, &EditorDebuggerTree::_scene_tree_folded));
|
connect("cell_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_selected));
|
||||||
connect("item_rmb_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_rmb_selected));
|
connect("item_collapsed", callable_mp(this, &EditorDebuggerTree::_scene_tree_folded));
|
||||||
|
connect("item_rmb_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_rmb_selected));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,15 +39,18 @@ void EditorNetworkProfiler::_bind_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorNetworkProfiler::_notification(int p_what) {
|
void EditorNetworkProfiler::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
|
case NOTIFICATION_ENTER_TREE:
|
||||||
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
incoming_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowDown"), SNAME("EditorIcons")));
|
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
|
||||||
outgoing_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowUp"), SNAME("EditorIcons")));
|
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
|
||||||
|
incoming_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowDown"), SNAME("EditorIcons")));
|
||||||
|
outgoing_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowUp"), SNAME("EditorIcons")));
|
||||||
|
|
||||||
// This needs to be done here to set the faded color when the profiler is first opened
|
// This needs to be done here to set the faded color when the profiler is first opened
|
||||||
incoming_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5));
|
incoming_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5));
|
||||||
outgoing_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5));
|
outgoing_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,9 +393,13 @@ void EditorProfiler::_clear_pressed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorProfiler::_notification(int p_what) {
|
void EditorProfiler::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) {
|
switch (p_what) {
|
||||||
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
|
case NOTIFICATION_ENTER_TREE:
|
||||||
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||||
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
|
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
|
||||||
|
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,13 +423,17 @@ void EditorVisualProfiler::_clear_pressed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorVisualProfiler::_notification(int p_what) {
|
void EditorVisualProfiler::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) {
|
switch (p_what) {
|
||||||
if (is_layout_rtl()) {
|
case NOTIFICATION_ENTER_TREE:
|
||||||
activate->set_icon(get_theme_icon(SNAME("PlayBackwards"), SNAME("EditorIcons")));
|
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||||
} else {
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
|
if (is_layout_rtl()) {
|
||||||
}
|
activate->set_icon(get_theme_icon(SNAME("PlayBackwards"), SNAME("EditorIcons")));
|
||||||
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
|
} else {
|
||||||
|
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
|
||||||
|
}
|
||||||
|
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,8 +796,8 @@ void ScriptEditorDebugger::_notification(int p_what) {
|
|||||||
search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||||
|
|
||||||
reason->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
reason->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PROCESS: {
|
case NOTIFICATION_PROCESS: {
|
||||||
if (is_session_active()) {
|
if (is_session_active()) {
|
||||||
peer->poll();
|
peer->poll();
|
||||||
@ -857,6 +857,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
|
|||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
if (tabs->has_theme_stylebox_override("panel")) {
|
if (tabs->has_theme_stylebox_override("panel")) {
|
||||||
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
|
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
|
||||||
|
@ -98,6 +98,7 @@ void EditorAudioBus::_notification(int p_what) {
|
|||||||
update_bus();
|
update_bus();
|
||||||
set_process(true);
|
set_process(true);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
if (is_master) {
|
if (is_master) {
|
||||||
draw_style_box(get_theme_stylebox(SNAME("disabled"), SNAME("Button")), Rect2(Vector2(), get_size()));
|
draw_style_box(get_theme_stylebox(SNAME("disabled"), SNAME("Button")), Rect2(Vector2(), get_size()));
|
||||||
@ -113,6 +114,7 @@ void EditorAudioBus::_notification(int p_what) {
|
|||||||
draw_rect(Rect2(Point2(), get_size()), accent, false);
|
draw_rect(Rect2(Point2(), get_size()), accent, false);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PROCESS: {
|
case NOTIFICATION_PROCESS: {
|
||||||
if (cc != AudioServer::get_singleton()->get_bus_channels(get_index())) {
|
if (cc != AudioServer::get_singleton()->get_bus_channels(get_index())) {
|
||||||
cc = AudioServer::get_singleton()->get_bus_channels(get_index());
|
cc = AudioServer::get_singleton()->get_bus_channels(get_index());
|
||||||
@ -157,6 +159,7 @@ void EditorAudioBus::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
for (int i = 0; i < CHANNELS_MAX; i++) {
|
for (int i = 0; i < CHANNELS_MAX; i++) {
|
||||||
channel[i].peak_l = -100;
|
channel[i].peak_l = -100;
|
||||||
@ -952,12 +955,14 @@ void EditorAudioBusDrop::_notification(int p_what) {
|
|||||||
draw_rect(Rect2(Point2(), get_size()), accent, false);
|
draw_rect(Rect2(Point2(), get_size()), accent, false);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_MOUSE_ENTER: {
|
case NOTIFICATION_MOUSE_ENTER: {
|
||||||
if (!hovering_drop) {
|
if (!hovering_drop) {
|
||||||
hovering_drop = true;
|
hovering_drop = true;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_MOUSE_EXIT:
|
case NOTIFICATION_MOUSE_EXIT:
|
||||||
case NOTIFICATION_DRAG_END: {
|
case NOTIFICATION_DRAG_END: {
|
||||||
if (hovering_drop) {
|
if (hovering_drop) {
|
||||||
@ -1017,15 +1022,18 @@ void EditorAudioBuses::_notification(int p_what) {
|
|||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
bus_scroll->add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
|
bus_scroll->add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
_update_buses();
|
_update_buses();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAG_END: {
|
case NOTIFICATION_DRAG_END: {
|
||||||
if (drop_end) {
|
if (drop_end) {
|
||||||
drop_end->queue_delete();
|
drop_end->queue_delete();
|
||||||
drop_end = nullptr;
|
drop_end = nullptr;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PROCESS: {
|
case NOTIFICATION_PROCESS: {
|
||||||
// Check if anything was edited.
|
// Check if anything was edited.
|
||||||
bool edited = AudioServer::get_singleton()->is_edited();
|
bool edited = AudioServer::get_singleton()->is_edited();
|
||||||
@ -1401,6 +1409,7 @@ void EditorAudioMeterNotches::_notification(int p_what) {
|
|||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
notch_color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
|
notch_color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
_draw_audio_notches();
|
_draw_audio_notches();
|
||||||
} break;
|
} break;
|
||||||
|
@ -42,23 +42,27 @@
|
|||||||
#define PREVIEW_LIST_MAX_SIZE 10
|
#define PREVIEW_LIST_MAX_SIZE 10
|
||||||
|
|
||||||
void EditorAutoloadSettings::_notification(int p_what) {
|
void EditorAutoloadSettings::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
List<String> afn;
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
ResourceLoader::get_recognized_extensions_for_type("Script", &afn);
|
List<String> afn;
|
||||||
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &afn);
|
ResourceLoader::get_recognized_extensions_for_type("Script", &afn);
|
||||||
|
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &afn);
|
||||||
|
|
||||||
for (const String &E : afn) {
|
for (const String &E : afn) {
|
||||||
file_dialog->add_filter("*." + E);
|
file_dialog->add_filter("*." + E);
|
||||||
}
|
|
||||||
|
|
||||||
for (const AutoLoadInfo &info : autoload_cache) {
|
|
||||||
if (info.node && info.in_editor) {
|
|
||||||
get_tree()->get_root()->call_deferred(SNAME("add_child"), info.node);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
|
for (const AutoLoadInfo &info : autoload_cache) {
|
||||||
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
|
if (info.node && info.in_editor) {
|
||||||
browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
|
get_tree()->get_root()->call_deferred(SNAME("add_child"), info.node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
|
browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,29 +79,31 @@ void EditorDirDialog::reload(const String &p_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorDirDialog::_notification(int p_what) {
|
void EditorDirDialog::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload), make_binds(""));
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
reload();
|
|
||||||
|
|
||||||
if (!tree->is_connected("item_collapsed", callable_mp(this, &EditorDirDialog::_item_collapsed))) {
|
|
||||||
tree->connect("item_collapsed", callable_mp(this, &EditorDirDialog::_item_collapsed), varray(), CONNECT_DEFERRED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &EditorDirDialog::reload))) {
|
|
||||||
EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload), make_binds(""));
|
EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload), make_binds(""));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
|
||||||
if (EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &EditorDirDialog::reload))) {
|
|
||||||
EditorFileSystem::get_singleton()->disconnect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
|
||||||
if (must_reload && is_visible()) {
|
|
||||||
reload();
|
reload();
|
||||||
}
|
|
||||||
|
if (!tree->is_connected("item_collapsed", callable_mp(this, &EditorDirDialog::_item_collapsed))) {
|
||||||
|
tree->connect("item_collapsed", callable_mp(this, &EditorDirDialog::_item_collapsed), varray(), CONNECT_DEFERRED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &EditorDirDialog::reload))) {
|
||||||
|
EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload), make_binds(""));
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
if (EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &EditorDirDialog::reload))) {
|
||||||
|
EditorFileSystem::get_singleton()->disconnect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload));
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
|
if (must_reload && is_visible()) {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1544,6 +1544,7 @@ void EditorExport::_notification(int p_what) {
|
|||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
load_config();
|
load_config();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PROCESS: {
|
case NOTIFICATION_PROCESS: {
|
||||||
update_export_presets();
|
update_export_presets();
|
||||||
} break;
|
} break;
|
||||||
|
@ -309,18 +309,20 @@ EditorFeatureProfile::EditorFeatureProfile() {}
|
|||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|
||||||
void EditorFeatureProfileManager::_notification(int p_what) {
|
void EditorFeatureProfileManager::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_READY) {
|
switch (p_what) {
|
||||||
current_profile = EDITOR_GET("_default_feature_profile");
|
case NOTIFICATION_READY: {
|
||||||
if (!current_profile.is_empty()) {
|
current_profile = EDITOR_GET("_default_feature_profile");
|
||||||
current.instantiate();
|
if (!current_profile.is_empty()) {
|
||||||
Error err = current->load_from_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(current_profile + ".profile"));
|
current.instantiate();
|
||||||
if (err != OK) {
|
Error err = current->load_from_file(EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(current_profile + ".profile"));
|
||||||
ERR_PRINT("Error loading default feature profile: " + current_profile);
|
if (err != OK) {
|
||||||
current_profile = String();
|
ERR_PRINT("Error loading default feature profile: " + current_profile);
|
||||||
current.unref();
|
current_profile = String();
|
||||||
|
current.unref();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
_update_profile_list(current_profile);
|
||||||
_update_profile_list(current_profile);
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,48 +69,60 @@ VBoxContainer *EditorFileDialog::get_vbox() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorFileDialog::_notification(int p_what) {
|
void EditorFileDialog::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_READY || p_what == NOTIFICATION_THEME_CHANGED || p_what == Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) {
|
switch (p_what) {
|
||||||
_update_icons();
|
case NOTIFICATION_READY:
|
||||||
} else if (p_what == NOTIFICATION_PROCESS) {
|
case NOTIFICATION_THEME_CHANGED:
|
||||||
if (preview_waiting) {
|
case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||||
preview_wheel_timeout -= get_process_delta_time();
|
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||||
if (preview_wheel_timeout <= 0) {
|
_update_icons();
|
||||||
preview_wheel_index++;
|
} break;
|
||||||
if (preview_wheel_index >= 8) {
|
|
||||||
preview_wheel_index = 0;
|
case NOTIFICATION_PROCESS: {
|
||||||
|
if (preview_waiting) {
|
||||||
|
preview_wheel_timeout -= get_process_delta_time();
|
||||||
|
if (preview_wheel_timeout <= 0) {
|
||||||
|
preview_wheel_index++;
|
||||||
|
if (preview_wheel_index >= 8) {
|
||||||
|
preview_wheel_index = 0;
|
||||||
|
}
|
||||||
|
Ref<Texture2D> frame = item_list->get_theme_icon("Progress" + itos(preview_wheel_index + 1), SNAME("EditorIcons"));
|
||||||
|
preview->set_texture(frame);
|
||||||
|
preview_wheel_timeout = 0.1;
|
||||||
}
|
}
|
||||||
Ref<Texture2D> frame = item_list->get_theme_icon("Progress" + itos(preview_wheel_index + 1), SNAME("EditorIcons"));
|
|
||||||
preview->set_texture(frame);
|
|
||||||
preview_wheel_timeout = 0.1;
|
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
} else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
bool is_showing_hidden = EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files");
|
bool is_showing_hidden = EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files");
|
||||||
if (show_hidden_files != is_showing_hidden) {
|
if (show_hidden_files != is_showing_hidden) {
|
||||||
set_show_hidden_files(is_showing_hidden);
|
set_show_hidden_files(is_showing_hidden);
|
||||||
}
|
|
||||||
set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int());
|
|
||||||
|
|
||||||
_update_icons();
|
|
||||||
// DO NOT CALL UPDATE FILE LIST HERE, ALL HUNDREDS OF HIDDEN DIALOGS WILL RESPOND, CALL INVALIDATE INSTEAD
|
|
||||||
invalidate();
|
|
||||||
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
|
||||||
if (!is_visible()) {
|
|
||||||
set_process_unhandled_input(false);
|
|
||||||
}
|
|
||||||
} else if (p_what == NOTIFICATION_WM_WINDOW_FOCUS_IN) {
|
|
||||||
// Check if the current directory was removed externally (much less likely to happen while editor window is focused).
|
|
||||||
String previous_dir = get_current_dir();
|
|
||||||
while (!dir_access->dir_exists(get_current_dir())) {
|
|
||||||
_go_up();
|
|
||||||
|
|
||||||
// In case we can't go further up, use some fallback and break.
|
|
||||||
if (get_current_dir() == previous_dir) {
|
|
||||||
_dir_submitted(OS::get_singleton()->get_user_data_dir());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int());
|
||||||
|
|
||||||
|
_update_icons();
|
||||||
|
// DO NOT CALL UPDATE FILE LIST HERE, ALL HUNDREDS OF HIDDEN DIALOGS WILL RESPOND, CALL INVALIDATE INSTEAD
|
||||||
|
invalidate();
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
|
if (!is_visible()) {
|
||||||
|
set_process_unhandled_input(false);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
|
||||||
|
// Check if the current directory was removed externally (much less likely to happen while editor window is focused).
|
||||||
|
String previous_dir = get_current_dir();
|
||||||
|
while (!dir_access->dir_exists(get_current_dir())) {
|
||||||
|
_go_up();
|
||||||
|
|
||||||
|
// In case we can't go further up, use some fallback and break.
|
||||||
|
if (get_current_dir() == previous_dir) {
|
||||||
|
_dir_submitted(OS::get_singleton()->get_user_data_dir());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,6 +1163,7 @@ void EditorFileSystem::_notification(int p_what) {
|
|||||||
call_deferred(SNAME("scan")); //this should happen after every editor node entered the tree
|
call_deferred(SNAME("scan")); //this should happen after every editor node entered the tree
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
Thread &active_thread = thread.is_started() ? thread : thread_sources;
|
Thread &active_thread = thread.is_started() ? thread : thread_sources;
|
||||||
if (use_threads && active_thread.is_started()) {
|
if (use_threads && active_thread.is_started()) {
|
||||||
@ -1184,8 +1185,8 @@ void EditorFileSystem::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
filesystem = nullptr;
|
filesystem = nullptr;
|
||||||
new_filesystem = nullptr;
|
new_filesystem = nullptr;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PROCESS: {
|
case NOTIFICATION_PROCESS: {
|
||||||
if (use_threads) {
|
if (use_threads) {
|
||||||
if (scanning_changes) {
|
if (scanning_changes) {
|
||||||
|
@ -1770,17 +1770,17 @@ void EditorHelp::_notification(int p_what) {
|
|||||||
_wait_for_thread();
|
_wait_for_thread();
|
||||||
_update_doc();
|
_update_doc();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
if (is_inside_tree()) {
|
if (is_inside_tree()) {
|
||||||
_class_desc_resized(true);
|
_class_desc_resized(true);
|
||||||
}
|
}
|
||||||
update_toggle_scripts_button();
|
update_toggle_scripts_button();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED:
|
|
||||||
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
update_toggle_scripts_button();
|
update_toggle_scripts_button();
|
||||||
break;
|
} break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2041,6 +2041,7 @@ void FindBar::_notification(int p_what) {
|
|||||||
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
|
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
|
||||||
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
set_process_unhandled_input(is_visible_in_tree());
|
set_process_unhandled_input(is_visible_in_tree());
|
||||||
} break;
|
} break;
|
||||||
|
@ -111,9 +111,11 @@ void EditorHelpSearch::_notification(int p_what) {
|
|||||||
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", Rect2(get_position(), get_size()));
|
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", Rect2(get_position(), get_size()));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
_update_icons();
|
_update_icons();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
connect("confirmed", callable_mp(this, &EditorHelpSearch::_confirmed));
|
connect("confirmed", callable_mp(this, &EditorHelpSearch::_confirmed));
|
||||||
_update_icons();
|
_update_icons();
|
||||||
|
@ -103,22 +103,96 @@ void EditorProperty::emit_changed(const StringName &p_property, const Variant &p
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorProperty::_notification(int p_what) {
|
void EditorProperty::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_SORT_CHILDREN) {
|
switch (p_what) {
|
||||||
Size2 size = get_size();
|
case NOTIFICATION_SORT_CHILDREN: {
|
||||||
Rect2 rect;
|
Size2 size = get_size();
|
||||||
Rect2 bottom_rect;
|
Rect2 rect;
|
||||||
|
Rect2 bottom_rect;
|
||||||
|
|
||||||
right_child_rect = Rect2();
|
right_child_rect = Rect2();
|
||||||
bottom_child_rect = Rect2();
|
bottom_child_rect = Rect2();
|
||||||
|
|
||||||
{
|
{
|
||||||
int child_room = size.width * (1.0 - split_ratio);
|
int child_room = size.width * (1.0 - split_ratio);
|
||||||
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
|
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
|
||||||
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
|
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
|
||||||
int height = font->get_height(font_size);
|
int height = font->get_height(font_size);
|
||||||
bool no_children = true;
|
bool no_children = true;
|
||||||
|
|
||||||
//compute room needed
|
//compute room needed
|
||||||
|
for (int i = 0; i < get_child_count(); i++) {
|
||||||
|
Control *c = Object::cast_to<Control>(get_child(i));
|
||||||
|
if (!c) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c->is_set_as_top_level()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c == bottom_editor) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Size2 minsize = c->get_combined_minimum_size();
|
||||||
|
child_room = MAX(child_room, minsize.width);
|
||||||
|
height = MAX(height, minsize.height);
|
||||||
|
no_children = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (no_children) {
|
||||||
|
text_size = size.width;
|
||||||
|
rect = Rect2(size.width - 1, 0, 1, height);
|
||||||
|
} else {
|
||||||
|
text_size = MAX(0, size.width - (child_room + 4 * EDSCALE));
|
||||||
|
if (is_layout_rtl()) {
|
||||||
|
rect = Rect2(1, 0, child_room, height);
|
||||||
|
} else {
|
||||||
|
rect = Rect2(size.width - child_room, 0, child_room, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bottom_editor) {
|
||||||
|
int m = 0; //get_constant("item_margin", "Tree");
|
||||||
|
|
||||||
|
bottom_rect = Rect2(m, rect.size.height + get_theme_constant(SNAME("vseparation")), size.width - m, bottom_editor->get_combined_minimum_size().height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keying) {
|
||||||
|
Ref<Texture2D> key;
|
||||||
|
|
||||||
|
if (use_keying_next()) {
|
||||||
|
key = get_theme_icon(SNAME("KeyNext"), SNAME("EditorIcons"));
|
||||||
|
} else {
|
||||||
|
key = get_theme_icon(SNAME("Key"), SNAME("EditorIcons"));
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.size.x -= key->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
||||||
|
if (is_layout_rtl()) {
|
||||||
|
rect.position.x += key->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (no_children) {
|
||||||
|
text_size -= key->get_width() + 4 * EDSCALE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deletable) {
|
||||||
|
Ref<Texture2D> close;
|
||||||
|
|
||||||
|
close = get_theme_icon(SNAME("Close"), SNAME("EditorIcons"));
|
||||||
|
|
||||||
|
rect.size.x -= close->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
||||||
|
|
||||||
|
if (is_layout_rtl()) {
|
||||||
|
rect.position.x += close->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (no_children) {
|
||||||
|
text_size -= close->get_width() + 4 * EDSCALE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//set children
|
||||||
for (int i = 0; i < get_child_count(); i++) {
|
for (int i = 0; i < get_child_count(); i++) {
|
||||||
Control *c = Object::cast_to<Control>(get_child(i));
|
Control *c = Object::cast_to<Control>(get_child(i));
|
||||||
if (!c) {
|
if (!c) {
|
||||||
@ -131,28 +205,128 @@ void EditorProperty::_notification(int p_what) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Size2 minsize = c->get_combined_minimum_size();
|
fit_child_in_rect(c, rect);
|
||||||
child_room = MAX(child_room, minsize.width);
|
right_child_rect = rect;
|
||||||
height = MAX(height, minsize.height);
|
|
||||||
no_children = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (no_children) {
|
|
||||||
text_size = size.width;
|
|
||||||
rect = Rect2(size.width - 1, 0, 1, height);
|
|
||||||
} else {
|
|
||||||
text_size = MAX(0, size.width - (child_room + 4 * EDSCALE));
|
|
||||||
if (is_layout_rtl()) {
|
|
||||||
rect = Rect2(1, 0, child_room, height);
|
|
||||||
} else {
|
|
||||||
rect = Rect2(size.width - child_room, 0, child_room, height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bottom_editor) {
|
if (bottom_editor) {
|
||||||
int m = 0; //get_constant("item_margin", "Tree");
|
fit_child_in_rect(bottom_editor, bottom_rect);
|
||||||
|
bottom_child_rect = bottom_rect;
|
||||||
|
}
|
||||||
|
|
||||||
bottom_rect = Rect2(m, rect.size.height + get_theme_constant(SNAME("vseparation")), size.width - m, bottom_editor->get_combined_minimum_size().height);
|
update(); //need to redraw text
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_DRAW: {
|
||||||
|
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
|
||||||
|
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
|
||||||
|
Color dark_color = get_theme_color(SNAME("dark_color_2"), SNAME("Editor"));
|
||||||
|
bool rtl = is_layout_rtl();
|
||||||
|
|
||||||
|
Size2 size = get_size();
|
||||||
|
if (bottom_editor) {
|
||||||
|
size.height = bottom_editor->get_offset(SIDE_TOP);
|
||||||
|
} else if (label_reference) {
|
||||||
|
size.height = label_reference->get_size().height;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref<StyleBox> sb;
|
||||||
|
if (selected) {
|
||||||
|
sb = get_theme_stylebox(SNAME("bg_selected"));
|
||||||
|
} else {
|
||||||
|
sb = get_theme_stylebox(SNAME("bg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_style_box(sb, Rect2(Vector2(), size));
|
||||||
|
|
||||||
|
if (draw_top_bg && right_child_rect != Rect2()) {
|
||||||
|
draw_rect(right_child_rect, dark_color);
|
||||||
|
}
|
||||||
|
if (bottom_child_rect != Rect2()) {
|
||||||
|
draw_rect(bottom_child_rect, dark_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
Color color;
|
||||||
|
if (draw_warning) {
|
||||||
|
color = get_theme_color(is_read_only() ? SNAME("readonly_warning_color") : SNAME("warning_color"));
|
||||||
|
} else {
|
||||||
|
color = get_theme_color(is_read_only() ? SNAME("readonly_color") : SNAME("property_color"));
|
||||||
|
}
|
||||||
|
if (label.contains(".")) {
|
||||||
|
// FIXME: Move this to the project settings editor, as this is only used
|
||||||
|
// for project settings feature tag overrides.
|
||||||
|
color.a = 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ofs = get_theme_constant(SNAME("font_offset"));
|
||||||
|
int text_limit = text_size - ofs;
|
||||||
|
|
||||||
|
if (checkable) {
|
||||||
|
Ref<Texture2D> checkbox;
|
||||||
|
if (checked) {
|
||||||
|
checkbox = get_theme_icon(SNAME("GuiChecked"), SNAME("EditorIcons"));
|
||||||
|
} else {
|
||||||
|
checkbox = get_theme_icon(SNAME("GuiUnchecked"), SNAME("EditorIcons"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Color color2(1, 1, 1);
|
||||||
|
if (check_hover) {
|
||||||
|
color2.r *= 1.2;
|
||||||
|
color2.g *= 1.2;
|
||||||
|
color2.b *= 1.2;
|
||||||
|
}
|
||||||
|
check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height());
|
||||||
|
if (rtl) {
|
||||||
|
draw_texture(checkbox, Vector2(size.width - check_rect.position.x - checkbox->get_width(), check_rect.position.y), color2);
|
||||||
|
} else {
|
||||||
|
draw_texture(checkbox, check_rect.position, color2);
|
||||||
|
}
|
||||||
|
int check_ofs = get_theme_constant(SNAME("hseparator"), SNAME("Tree")) + checkbox->get_width() + get_theme_constant(SNAME("hseparation"), SNAME("CheckBox"));
|
||||||
|
ofs += check_ofs;
|
||||||
|
text_limit -= check_ofs;
|
||||||
|
} else {
|
||||||
|
check_rect = Rect2();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (can_revert && !is_read_only()) {
|
||||||
|
Ref<Texture2D> reload_icon = get_theme_icon(SNAME("ReloadSmall"), SNAME("EditorIcons"));
|
||||||
|
text_limit -= reload_icon->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree")) * 2;
|
||||||
|
revert_rect = Rect2(ofs + text_limit, (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height());
|
||||||
|
|
||||||
|
Color color2(1, 1, 1);
|
||||||
|
if (revert_hover) {
|
||||||
|
color2.r *= 1.2;
|
||||||
|
color2.g *= 1.2;
|
||||||
|
color2.b *= 1.2;
|
||||||
|
}
|
||||||
|
if (rtl) {
|
||||||
|
draw_texture(reload_icon, Vector2(size.width - revert_rect.position.x - reload_icon->get_width(), revert_rect.position.y), color2);
|
||||||
|
} else {
|
||||||
|
draw_texture(reload_icon, revert_rect.position, color2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
revert_rect = Rect2();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pin_hidden && pinned) {
|
||||||
|
Ref<Texture2D> pinned_icon = get_theme_icon(SNAME("Pin"), SNAME("EditorIcons"));
|
||||||
|
int margin_w = get_theme_constant(SNAME("hseparator"), SNAME("Tree")) * 2;
|
||||||
|
int total_icon_w = margin_w + pinned_icon->get_width();
|
||||||
|
int text_w = font->get_string_size(label, font_size, rtl ? HORIZONTAL_ALIGNMENT_RIGHT : HORIZONTAL_ALIGNMENT_LEFT, text_limit - total_icon_w).x;
|
||||||
|
int y = (size.height - pinned_icon->get_height()) / 2;
|
||||||
|
if (rtl) {
|
||||||
|
draw_texture(pinned_icon, Vector2(size.width - ofs - text_w - total_icon_w, y), color);
|
||||||
|
} else {
|
||||||
|
draw_texture(pinned_icon, Vector2(ofs + text_w + margin_w, y), color);
|
||||||
|
}
|
||||||
|
text_limit -= total_icon_w;
|
||||||
|
}
|
||||||
|
|
||||||
|
int v_ofs = (size.height - font->get_height(font_size)) / 2;
|
||||||
|
if (rtl) {
|
||||||
|
draw_string(font, Point2(size.width - ofs - text_limit, v_ofs + font->get_ascent(font_size)), label, HORIZONTAL_ALIGNMENT_RIGHT, text_limit, font_size, color);
|
||||||
|
} else {
|
||||||
|
draw_string(font, Point2(ofs, v_ofs + font->get_ascent(font_size)), label, HORIZONTAL_ALIGNMENT_LEFT, text_limit, font_size, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keying) {
|
if (keying) {
|
||||||
@ -164,14 +338,23 @@ void EditorProperty::_notification(int p_what) {
|
|||||||
key = get_theme_icon(SNAME("Key"), SNAME("EditorIcons"));
|
key = get_theme_icon(SNAME("Key"), SNAME("EditorIcons"));
|
||||||
}
|
}
|
||||||
|
|
||||||
rect.size.x -= key->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
ofs = size.width - key->get_width() - get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
||||||
if (is_layout_rtl()) {
|
|
||||||
rect.position.x += key->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
Color color2(1, 1, 1);
|
||||||
|
if (keying_hover) {
|
||||||
|
color2.r *= 1.2;
|
||||||
|
color2.g *= 1.2;
|
||||||
|
color2.b *= 1.2;
|
||||||
|
}
|
||||||
|
keying_rect = Rect2(ofs, ((size.height - key->get_height()) / 2), key->get_width(), key->get_height());
|
||||||
|
if (rtl) {
|
||||||
|
draw_texture(key, Vector2(size.width - keying_rect.position.x - key->get_width(), keying_rect.position.y), color2);
|
||||||
|
} else {
|
||||||
|
draw_texture(key, keying_rect.position, color2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (no_children) {
|
} else {
|
||||||
text_size -= key->get_width() + 4 * EDSCALE;
|
keying_rect = Rect2();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deletable) {
|
if (deletable) {
|
||||||
@ -179,205 +362,24 @@ void EditorProperty::_notification(int p_what) {
|
|||||||
|
|
||||||
close = get_theme_icon(SNAME("Close"), SNAME("EditorIcons"));
|
close = get_theme_icon(SNAME("Close"), SNAME("EditorIcons"));
|
||||||
|
|
||||||
rect.size.x -= close->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
ofs = size.width - close->get_width() - get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
||||||
|
|
||||||
if (is_layout_rtl()) {
|
Color color2(1, 1, 1);
|
||||||
rect.position.x += close->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
if (delete_hover) {
|
||||||
|
color2.r *= 1.2;
|
||||||
|
color2.g *= 1.2;
|
||||||
|
color2.b *= 1.2;
|
||||||
}
|
}
|
||||||
|
delete_rect = Rect2(ofs, ((size.height - close->get_height()) / 2), close->get_width(), close->get_height());
|
||||||
if (no_children) {
|
if (rtl) {
|
||||||
text_size -= close->get_width() + 4 * EDSCALE;
|
draw_texture(close, Vector2(size.width - delete_rect.position.x - close->get_width(), delete_rect.position.y), color2);
|
||||||
|
} else {
|
||||||
|
draw_texture(close, delete_rect.position, color2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//set children
|
|
||||||
for (int i = 0; i < get_child_count(); i++) {
|
|
||||||
Control *c = Object::cast_to<Control>(get_child(i));
|
|
||||||
if (!c) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (c->is_set_as_top_level()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (c == bottom_editor) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
fit_child_in_rect(c, rect);
|
|
||||||
right_child_rect = rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bottom_editor) {
|
|
||||||
fit_child_in_rect(bottom_editor, bottom_rect);
|
|
||||||
bottom_child_rect = bottom_rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
update(); //need to redraw text
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
|
||||||
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
|
|
||||||
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
|
|
||||||
Color dark_color = get_theme_color(SNAME("dark_color_2"), SNAME("Editor"));
|
|
||||||
bool rtl = is_layout_rtl();
|
|
||||||
|
|
||||||
Size2 size = get_size();
|
|
||||||
if (bottom_editor) {
|
|
||||||
size.height = bottom_editor->get_offset(SIDE_TOP);
|
|
||||||
} else if (label_reference) {
|
|
||||||
size.height = label_reference->get_size().height;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref<StyleBox> sb;
|
|
||||||
if (selected) {
|
|
||||||
sb = get_theme_stylebox(SNAME("bg_selected"));
|
|
||||||
} else {
|
|
||||||
sb = get_theme_stylebox(SNAME("bg"));
|
|
||||||
}
|
|
||||||
|
|
||||||
draw_style_box(sb, Rect2(Vector2(), size));
|
|
||||||
|
|
||||||
if (draw_top_bg && right_child_rect != Rect2()) {
|
|
||||||
draw_rect(right_child_rect, dark_color);
|
|
||||||
}
|
|
||||||
if (bottom_child_rect != Rect2()) {
|
|
||||||
draw_rect(bottom_child_rect, dark_color);
|
|
||||||
}
|
|
||||||
|
|
||||||
Color color;
|
|
||||||
if (draw_warning) {
|
|
||||||
color = get_theme_color(is_read_only() ? SNAME("readonly_warning_color") : SNAME("warning_color"));
|
|
||||||
} else {
|
|
||||||
color = get_theme_color(is_read_only() ? SNAME("readonly_color") : SNAME("property_color"));
|
|
||||||
}
|
|
||||||
if (label.contains(".")) {
|
|
||||||
// FIXME: Move this to the project settings editor, as this is only used
|
|
||||||
// for project settings feature tag overrides.
|
|
||||||
color.a = 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ofs = get_theme_constant(SNAME("font_offset"));
|
|
||||||
int text_limit = text_size - ofs;
|
|
||||||
|
|
||||||
if (checkable) {
|
|
||||||
Ref<Texture2D> checkbox;
|
|
||||||
if (checked) {
|
|
||||||
checkbox = get_theme_icon(SNAME("GuiChecked"), SNAME("EditorIcons"));
|
|
||||||
} else {
|
} else {
|
||||||
checkbox = get_theme_icon(SNAME("GuiUnchecked"), SNAME("EditorIcons"));
|
delete_rect = Rect2();
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
Color color2(1, 1, 1);
|
|
||||||
if (check_hover) {
|
|
||||||
color2.r *= 1.2;
|
|
||||||
color2.g *= 1.2;
|
|
||||||
color2.b *= 1.2;
|
|
||||||
}
|
|
||||||
check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height());
|
|
||||||
if (rtl) {
|
|
||||||
draw_texture(checkbox, Vector2(size.width - check_rect.position.x - checkbox->get_width(), check_rect.position.y), color2);
|
|
||||||
} else {
|
|
||||||
draw_texture(checkbox, check_rect.position, color2);
|
|
||||||
}
|
|
||||||
int check_ofs = get_theme_constant(SNAME("hseparator"), SNAME("Tree")) + checkbox->get_width() + get_theme_constant(SNAME("hseparation"), SNAME("CheckBox"));
|
|
||||||
ofs += check_ofs;
|
|
||||||
text_limit -= check_ofs;
|
|
||||||
} else {
|
|
||||||
check_rect = Rect2();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (can_revert && !is_read_only()) {
|
|
||||||
Ref<Texture2D> reload_icon = get_theme_icon(SNAME("ReloadSmall"), SNAME("EditorIcons"));
|
|
||||||
text_limit -= reload_icon->get_width() + get_theme_constant(SNAME("hseparator"), SNAME("Tree")) * 2;
|
|
||||||
revert_rect = Rect2(ofs + text_limit, (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height());
|
|
||||||
|
|
||||||
Color color2(1, 1, 1);
|
|
||||||
if (revert_hover) {
|
|
||||||
color2.r *= 1.2;
|
|
||||||
color2.g *= 1.2;
|
|
||||||
color2.b *= 1.2;
|
|
||||||
}
|
|
||||||
if (rtl) {
|
|
||||||
draw_texture(reload_icon, Vector2(size.width - revert_rect.position.x - reload_icon->get_width(), revert_rect.position.y), color2);
|
|
||||||
} else {
|
|
||||||
draw_texture(reload_icon, revert_rect.position, color2);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
revert_rect = Rect2();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pin_hidden && pinned) {
|
|
||||||
Ref<Texture2D> pinned_icon = get_theme_icon(SNAME("Pin"), SNAME("EditorIcons"));
|
|
||||||
int margin_w = get_theme_constant(SNAME("hseparator"), SNAME("Tree")) * 2;
|
|
||||||
int total_icon_w = margin_w + pinned_icon->get_width();
|
|
||||||
int text_w = font->get_string_size(label, font_size, rtl ? HORIZONTAL_ALIGNMENT_RIGHT : HORIZONTAL_ALIGNMENT_LEFT, text_limit - total_icon_w).x;
|
|
||||||
int y = (size.height - pinned_icon->get_height()) / 2;
|
|
||||||
if (rtl) {
|
|
||||||
draw_texture(pinned_icon, Vector2(size.width - ofs - text_w - total_icon_w, y), color);
|
|
||||||
} else {
|
|
||||||
draw_texture(pinned_icon, Vector2(ofs + text_w + margin_w, y), color);
|
|
||||||
}
|
|
||||||
text_limit -= total_icon_w;
|
|
||||||
}
|
|
||||||
|
|
||||||
int v_ofs = (size.height - font->get_height(font_size)) / 2;
|
|
||||||
if (rtl) {
|
|
||||||
draw_string(font, Point2(size.width - ofs - text_limit, v_ofs + font->get_ascent(font_size)), label, HORIZONTAL_ALIGNMENT_RIGHT, text_limit, font_size, color);
|
|
||||||
} else {
|
|
||||||
draw_string(font, Point2(ofs, v_ofs + font->get_ascent(font_size)), label, HORIZONTAL_ALIGNMENT_LEFT, text_limit, font_size, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keying) {
|
|
||||||
Ref<Texture2D> key;
|
|
||||||
|
|
||||||
if (use_keying_next()) {
|
|
||||||
key = get_theme_icon(SNAME("KeyNext"), SNAME("EditorIcons"));
|
|
||||||
} else {
|
|
||||||
key = get_theme_icon(SNAME("Key"), SNAME("EditorIcons"));
|
|
||||||
}
|
|
||||||
|
|
||||||
ofs = size.width - key->get_width() - get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
|
||||||
|
|
||||||
Color color2(1, 1, 1);
|
|
||||||
if (keying_hover) {
|
|
||||||
color2.r *= 1.2;
|
|
||||||
color2.g *= 1.2;
|
|
||||||
color2.b *= 1.2;
|
|
||||||
}
|
|
||||||
keying_rect = Rect2(ofs, ((size.height - key->get_height()) / 2), key->get_width(), key->get_height());
|
|
||||||
if (rtl) {
|
|
||||||
draw_texture(key, Vector2(size.width - keying_rect.position.x - key->get_width(), keying_rect.position.y), color2);
|
|
||||||
} else {
|
|
||||||
draw_texture(key, keying_rect.position, color2);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
keying_rect = Rect2();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (deletable) {
|
|
||||||
Ref<Texture2D> close;
|
|
||||||
|
|
||||||
close = get_theme_icon(SNAME("Close"), SNAME("EditorIcons"));
|
|
||||||
|
|
||||||
ofs = size.width - close->get_width() - get_theme_constant(SNAME("hseparator"), SNAME("Tree"));
|
|
||||||
|
|
||||||
Color color2(1, 1, 1);
|
|
||||||
if (delete_hover) {
|
|
||||||
color2.r *= 1.2;
|
|
||||||
color2.g *= 1.2;
|
|
||||||
color2.b *= 1.2;
|
|
||||||
}
|
|
||||||
delete_rect = Rect2(ofs, ((size.height - close->get_height()) / 2), close->get_width(), close->get_height());
|
|
||||||
if (rtl) {
|
|
||||||
draw_texture(close, Vector2(size.width - delete_rect.position.x - close->get_width(), delete_rect.position.y), color2);
|
|
||||||
} else {
|
|
||||||
draw_texture(close, delete_rect.position, color2);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
delete_rect = Rect2();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1078,30 +1080,32 @@ void EditorInspectorPlugin::_bind_methods() {
|
|||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
|
|
||||||
void EditorInspectorCategory::_notification(int p_what) {
|
void EditorInspectorCategory::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
switch (p_what) {
|
||||||
Ref<StyleBox> sb = get_theme_stylebox(SNAME("prop_category_style"), SNAME("Editor"));
|
case NOTIFICATION_DRAW: {
|
||||||
|
Ref<StyleBox> sb = get_theme_stylebox(SNAME("prop_category_style"), SNAME("Editor"));
|
||||||
|
|
||||||
draw_style_box(sb, Rect2(Vector2(), get_size()));
|
draw_style_box(sb, Rect2(Vector2(), get_size()));
|
||||||
|
|
||||||
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
||||||
int font_size = get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
|
int font_size = get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
|
||||||
|
|
||||||
int hs = get_theme_constant(SNAME("hseparation"), SNAME("Tree"));
|
int hs = get_theme_constant(SNAME("hseparation"), SNAME("Tree"));
|
||||||
|
|
||||||
int w = font->get_string_size(label, font_size).width;
|
int w = font->get_string_size(label, font_size).width;
|
||||||
if (icon.is_valid()) {
|
if (icon.is_valid()) {
|
||||||
w += hs + icon->get_width();
|
w += hs + icon->get_width();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ofs = (get_size().width - w) / 2;
|
int ofs = (get_size().width - w) / 2;
|
||||||
|
|
||||||
if (icon.is_valid()) {
|
if (icon.is_valid()) {
|
||||||
draw_texture(icon, Point2(ofs, (get_size().height - icon->get_height()) / 2).floor());
|
draw_texture(icon, Point2(ofs, (get_size().height - icon->get_height()) / 2).floor());
|
||||||
ofs += hs + icon->get_width();
|
ofs += hs + icon->get_width();
|
||||||
}
|
}
|
||||||
|
|
||||||
Color color = get_theme_color(SNAME("font_color"), SNAME("Tree"));
|
Color color = get_theme_color(SNAME("font_color"), SNAME("Tree"));
|
||||||
draw_string(font, Point2(ofs, font->get_ascent(font_size) + (get_size().height - font->get_height(font_size)) / 2).floor(), label, HORIZONTAL_ALIGNMENT_LEFT, get_size().width, font_size, color);
|
draw_string(font, Point2(ofs, font->get_ascent(font_size) + (get_size().height - font->get_height(font_size)) / 2).floor(), label, HORIZONTAL_ALIGNMENT_LEFT, get_size().width, font_size, color);
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1152,6 +1156,7 @@ void EditorInspectorSection::_notification(int p_what) {
|
|||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_SORT_CHILDREN: {
|
case NOTIFICATION_SORT_CHILDREN: {
|
||||||
if (!vbox_added) {
|
if (!vbox_added) {
|
||||||
return;
|
return;
|
||||||
@ -1205,6 +1210,7 @@ void EditorInspectorSection::_notification(int p_what) {
|
|||||||
fit_child_in_rect(c, Rect2(offset, size));
|
fit_child_in_rect(c, Rect2(offset, size));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
// Get the section header font.
|
// Get the section header font.
|
||||||
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
||||||
@ -1299,6 +1305,7 @@ void EditorInspectorSection::_notification(int p_what) {
|
|||||||
draw_style_box(section_indent_style, indent_rect);
|
draw_style_box(section_indent_style, indent_rect);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAG_BEGIN: {
|
case NOTIFICATION_DRAG_BEGIN: {
|
||||||
Dictionary dd = get_viewport()->gui_get_drag_data();
|
Dictionary dd = get_viewport()->gui_get_drag_data();
|
||||||
|
|
||||||
@ -1317,10 +1324,12 @@ void EditorInspectorSection::_notification(int p_what) {
|
|||||||
dropping = children_can_drop;
|
dropping = children_can_drop;
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAG_END: {
|
case NOTIFICATION_DRAG_END: {
|
||||||
dropping = false;
|
dropping = false;
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_MOUSE_ENTER: {
|
case NOTIFICATION_MOUSE_ENTER: {
|
||||||
if (dropping) {
|
if (dropping) {
|
||||||
dropping_unfold_timer->start();
|
dropping_unfold_timer->start();
|
||||||
@ -2025,6 +2034,7 @@ void EditorInspectorArray::_notification(int p_what) {
|
|||||||
add_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
add_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
||||||
update_minimum_size();
|
update_minimum_size();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAG_BEGIN: {
|
case NOTIFICATION_DRAG_BEGIN: {
|
||||||
Dictionary dict = get_viewport()->gui_get_drag_data();
|
Dictionary dict = get_viewport()->gui_get_drag_data();
|
||||||
if (dict.has("type") && dict["type"] == "property_array_element" && String(dict["property_array_prefix"]) == array_element_prefix) {
|
if (dict.has("type") && dict["type"] == "property_array_element" && String(dict["property_array_prefix"]) == array_element_prefix) {
|
||||||
@ -2032,6 +2042,7 @@ void EditorInspectorArray::_notification(int p_what) {
|
|||||||
control_dropping->update();
|
control_dropping->update();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAG_END: {
|
case NOTIFICATION_DRAG_END: {
|
||||||
if (dropping) {
|
if (dropping) {
|
||||||
dropping = false;
|
dropping = false;
|
||||||
@ -2183,11 +2194,14 @@ void EditorPaginator::update(int p_page, int p_max_page) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPaginator::_notification(int p_what) {
|
void EditorPaginator::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
first_page_button->set_icon(get_theme_icon(SNAME("PageFirst"), SNAME("EditorIcons")));
|
case NOTIFICATION_ENTER_TREE:
|
||||||
prev_page_button->set_icon(get_theme_icon(SNAME("PagePrevious"), SNAME("EditorIcons")));
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
next_page_button->set_icon(get_theme_icon(SNAME("PageNext"), SNAME("EditorIcons")));
|
first_page_button->set_icon(get_theme_icon(SNAME("PageFirst"), SNAME("EditorIcons")));
|
||||||
last_page_button->set_icon(get_theme_icon(SNAME("PageLast"), SNAME("EditorIcons")));
|
prev_page_button->set_icon(get_theme_icon(SNAME("PagePrevious"), SNAME("EditorIcons")));
|
||||||
|
next_page_button->set_icon(get_theme_icon(SNAME("PageNext"), SNAME("EditorIcons")));
|
||||||
|
last_page_button->set_icon(get_theme_icon(SNAME("PageLast"), SNAME("EditorIcons")));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3426,80 +3440,84 @@ void EditorInspector::_node_removed(Node *p_node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorInspector::_notification(int p_what) {
|
void EditorInspector::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_READY) {
|
switch (p_what) {
|
||||||
EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", callable_mp(this, &EditorInspector::_feature_profile_changed));
|
case NOTIFICATION_READY: {
|
||||||
set_process(is_visible_in_tree());
|
EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", callable_mp(this, &EditorInspector::_feature_profile_changed));
|
||||||
_update_inspector_bg();
|
set_process(is_visible_in_tree());
|
||||||
}
|
_update_inspector_bg();
|
||||||
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
if (!sub_inspector) {
|
if (!sub_inspector) {
|
||||||
get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
|
get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
if (p_what == NOTIFICATION_PREDELETE) {
|
|
||||||
edit(nullptr); //just in case
|
|
||||||
}
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
|
||||||
if (!sub_inspector) {
|
|
||||||
get_tree()->disconnect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
|
|
||||||
}
|
|
||||||
edit(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
case NOTIFICATION_PREDELETE: {
|
||||||
set_process(is_visible_in_tree());
|
edit(nullptr); //just in case
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_PROCESS) {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (update_scroll_request >= 0) {
|
if (!sub_inspector) {
|
||||||
get_v_scroll_bar()->call_deferred(SNAME("set_value"), update_scroll_request);
|
get_tree()->disconnect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
|
||||||
update_scroll_request = -1;
|
}
|
||||||
}
|
edit(nullptr);
|
||||||
if (refresh_countdown > 0) {
|
} break;
|
||||||
refresh_countdown -= get_process_delta_time();
|
|
||||||
if (refresh_countdown <= 0) {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
for (const KeyValue<StringName, List<EditorProperty *>> &F : editor_property_map) {
|
set_process(is_visible_in_tree());
|
||||||
for (EditorProperty *E : F.value) {
|
} break;
|
||||||
if (!E->is_cache_valid()) {
|
|
||||||
|
case NOTIFICATION_PROCESS: {
|
||||||
|
if (update_scroll_request >= 0) {
|
||||||
|
get_v_scroll_bar()->call_deferred(SNAME("set_value"), update_scroll_request);
|
||||||
|
update_scroll_request = -1;
|
||||||
|
}
|
||||||
|
if (refresh_countdown > 0) {
|
||||||
|
refresh_countdown -= get_process_delta_time();
|
||||||
|
if (refresh_countdown <= 0) {
|
||||||
|
for (const KeyValue<StringName, List<EditorProperty *>> &F : editor_property_map) {
|
||||||
|
for (EditorProperty *E : F.value) {
|
||||||
|
if (!E->is_cache_valid()) {
|
||||||
|
E->update_property();
|
||||||
|
E->update_revert_and_pin_status();
|
||||||
|
E->update_cache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
refresh_countdown = float(EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
changing++;
|
||||||
|
|
||||||
|
if (update_tree_pending) {
|
||||||
|
update_tree();
|
||||||
|
update_tree_pending = false;
|
||||||
|
pending.clear();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
while (pending.size()) {
|
||||||
|
StringName prop = pending.front()->get();
|
||||||
|
if (editor_property_map.has(prop)) {
|
||||||
|
for (EditorProperty *E : editor_property_map[prop]) {
|
||||||
E->update_property();
|
E->update_property();
|
||||||
E->update_revert_and_pin_status();
|
E->update_revert_and_pin_status();
|
||||||
E->update_cache();
|
E->update_cache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pending.erase(pending.front());
|
||||||
}
|
}
|
||||||
refresh_countdown = float(EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval"));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
changing++;
|
changing--;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
|
_update_inspector_bg();
|
||||||
|
|
||||||
if (update_tree_pending) {
|
|
||||||
update_tree();
|
update_tree();
|
||||||
update_tree_pending = false;
|
} break;
|
||||||
pending.clear();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
while (pending.size()) {
|
|
||||||
StringName prop = pending.front()->get();
|
|
||||||
if (editor_property_map.has(prop)) {
|
|
||||||
for (EditorProperty *E : editor_property_map[prop]) {
|
|
||||||
E->update_property();
|
|
||||||
E->update_revert_and_pin_status();
|
|
||||||
E->update_cache();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pending.erase(pending.front());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
changing--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
|
||||||
_update_inspector_bg();
|
|
||||||
|
|
||||||
update_tree();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,12 +93,11 @@ void EditorLog::_notification(int p_what) {
|
|||||||
_update_theme();
|
_update_theme();
|
||||||
_load_state();
|
_load_state();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
_update_theme();
|
_update_theme();
|
||||||
_rebuild_log();
|
_rebuild_log();
|
||||||
} break;
|
} break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,11 +849,14 @@ void EditorPlugin::_editor_project_settings_changed() {
|
|||||||
emit_signal(SNAME("project_settings_changed"));
|
emit_signal(SNAME("project_settings_changed"));
|
||||||
}
|
}
|
||||||
void EditorPlugin::_notification(int p_what) {
|
void EditorPlugin::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
EditorNode::get_singleton()->connect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed));
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
}
|
EditorNode::get_singleton()->connect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed));
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
} break;
|
||||||
EditorNode::get_singleton()->disconnect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed));
|
|
||||||
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
EditorNode::get_singleton()->disconnect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,11 +39,15 @@
|
|||||||
#include "scene/gui/margin_container.h"
|
#include "scene/gui/margin_container.h"
|
||||||
|
|
||||||
void EditorPluginSettings::_notification(int p_what) {
|
void EditorPluginSettings::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_WM_WINDOW_FOCUS_IN) {
|
switch (p_what) {
|
||||||
update_plugins();
|
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
|
||||||
} else if (p_what == Node::NOTIFICATION_READY) {
|
update_plugins();
|
||||||
plugin_config_dialog->connect("plugin_ready", Callable(EditorNode::get_singleton(), "_on_plugin_ready"));
|
} break;
|
||||||
plugin_list->connect("button_pressed", callable_mp(this, &EditorPluginSettings::_cell_button_pressed));
|
|
||||||
|
case Node::NOTIFICATION_READY: {
|
||||||
|
plugin_config_dialog->connect("plugin_ready", Callable(EditorNode::get_singleton(), "_on_plugin_ready"));
|
||||||
|
plugin_list->connect("button_pressed", callable_mp(this, &EditorPluginSettings::_cell_button_pressed));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,6 @@ void EditorPropertyMultilineText::_notification(int p_what) {
|
|||||||
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
|
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
|
||||||
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
|
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
|
||||||
text->set_custom_minimum_size(Vector2(0, font->get_height(font_size) * 6));
|
text->set_custom_minimum_size(Vector2(0, font->get_height(font_size) * 6));
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -294,11 +293,11 @@ void EditorPropertyTextEnum::_bind_methods() {
|
|||||||
void EditorPropertyTextEnum::_notification(int p_what) {
|
void EditorPropertyTextEnum::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE:
|
||||||
case NOTIFICATION_THEME_CHANGED:
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
edit_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
|
edit_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
|
||||||
accept_button->set_icon(get_theme_icon(SNAME("ImportCheck"), SNAME("EditorIcons")));
|
accept_button->set_icon(get_theme_icon(SNAME("ImportCheck"), SNAME("EditorIcons")));
|
||||||
cancel_button->set_icon(get_theme_icon(SNAME("ImportFail"), SNAME("EditorIcons")));
|
cancel_button->set_icon(get_theme_icon(SNAME("ImportFail"), SNAME("EditorIcons")));
|
||||||
break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,8 +373,11 @@ void EditorPropertyLocale::setup(const String &p_hint_text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyLocale::_notification(int p_what) {
|
void EditorPropertyLocale::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
locale_edit->set_icon(get_theme_icon(SNAME("Translation"), SNAME("EditorIcons")));
|
case NOTIFICATION_ENTER_TREE:
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
|
locale_edit->set_icon(get_theme_icon(SNAME("Translation"), SNAME("EditorIcons")));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,8 +469,11 @@ void EditorPropertyPath::set_save_mode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyPath::_notification(int p_what) {
|
void EditorPropertyPath::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
path_edit->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
|
case NOTIFICATION_ENTER_TREE:
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
|
path_edit->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1065,9 +1070,6 @@ void EditorPropertyLayersGrid::_notification(int p_what) {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1619,11 +1621,14 @@ void EditorPropertyVector2::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyVector2::_notification(int p_what) {
|
void EditorPropertyVector2::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 2; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 2; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1710,11 +1715,14 @@ void EditorPropertyRect2::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyRect2::_notification(int p_what) {
|
void EditorPropertyRect2::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 4; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i % 2]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 4; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i % 2]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1836,11 +1844,14 @@ Vector3 EditorPropertyVector3::get_vector() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyVector3::_notification(int p_what) {
|
void EditorPropertyVector3::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 3; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 3; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1923,11 +1934,14 @@ void EditorPropertyVector2i::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyVector2i::_notification(int p_what) {
|
void EditorPropertyVector2i::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 2; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 2; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2014,11 +2028,14 @@ void EditorPropertyRect2i::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyRect2i::_notification(int p_what) {
|
void EditorPropertyRect2i::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 4; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i % 2]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 4; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i % 2]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2113,11 +2130,14 @@ void EditorPropertyVector3i::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyVector3i::_notification(int p_what) {
|
void EditorPropertyVector3i::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 3; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 3; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2203,11 +2223,14 @@ void EditorPropertyPlane::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyPlane::_notification(int p_what) {
|
void EditorPropertyPlane::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 4; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 4; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2294,11 +2317,14 @@ void EditorPropertyQuaternion::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyQuaternion::_notification(int p_what) {
|
void EditorPropertyQuaternion::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 4; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 4; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2388,11 +2414,14 @@ void EditorPropertyAABB::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyAABB::_notification(int p_what) {
|
void EditorPropertyAABB::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 6; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i % 3]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 6; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i % 3]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2469,16 +2498,19 @@ void EditorPropertyTransform2D::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyTransform2D::_notification(int p_what) {
|
void EditorPropertyTransform2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 6; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
// For Transform2D, use the 4th color (cyan) for the origin vector.
|
const Color *colors = _get_property_colors();
|
||||||
if (i % 3 == 2) {
|
for (int i = 0; i < 6; i++) {
|
||||||
spin[i]->set_custom_label_color(true, colors[3]);
|
// For Transform2D, use the 4th color (cyan) for the origin vector.
|
||||||
} else {
|
if (i % 3 == 2) {
|
||||||
spin[i]->set_custom_label_color(true, colors[i % 3]);
|
spin[i]->set_custom_label_color(true, colors[3]);
|
||||||
|
} else {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i % 3]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2562,11 +2594,14 @@ void EditorPropertyBasis::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyBasis::_notification(int p_what) {
|
void EditorPropertyBasis::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 9; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i % 3]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 9; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i % 3]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2656,11 +2691,14 @@ void EditorPropertyTransform3D::update_using_transform(Transform3D p_transform)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyTransform3D::_notification(int p_what) {
|
void EditorPropertyTransform3D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
const Color *colors = _get_property_colors();
|
case NOTIFICATION_ENTER_TREE:
|
||||||
for (int i = 0; i < 12; i++) {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
spin[i]->set_custom_label_color(true, colors[i % 4]);
|
const Color *colors = _get_property_colors();
|
||||||
}
|
for (int i = 0; i < 12; i++) {
|
||||||
|
spin[i]->set_custom_label_color(true, colors[i % 4]);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2902,9 +2940,12 @@ void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringNam
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyNodePath::_notification(int p_what) {
|
void EditorPropertyNodePath::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
switch (p_what) {
|
||||||
Ref<Texture2D> t = get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"));
|
case NOTIFICATION_ENTER_TREE:
|
||||||
clear->set_icon(t);
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
|
Ref<Texture2D> t = get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"));
|
||||||
|
clear->set_icon(t);
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,34 +504,37 @@ void EditorPropertyArray::drop_data_fw(const Point2 &p_point, const Variant &p_d
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyArray::_notification(int p_what) {
|
void EditorPropertyArray::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
change_type->clear();
|
case NOTIFICATION_THEME_CHANGED:
|
||||||
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
String type = Variant::get_type_name(Variant::Type(i));
|
change_type->clear();
|
||||||
change_type->add_icon_item(get_theme_icon(type, SNAME("EditorIcons")), type, i);
|
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
|
||||||
}
|
String type = Variant::get_type_name(Variant::Type(i));
|
||||||
change_type->add_separator();
|
change_type->add_icon_item(get_theme_icon(type, SNAME("EditorIcons")), type, i);
|
||||||
change_type->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Remove Item"), Variant::VARIANT_MAX);
|
}
|
||||||
|
change_type->add_separator();
|
||||||
|
change_type->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Remove Item"), Variant::VARIANT_MAX);
|
||||||
|
|
||||||
if (Object::cast_to<Button>(button_add_item)) {
|
if (Object::cast_to<Button>(button_add_item)) {
|
||||||
button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_DRAG_BEGIN) {
|
case NOTIFICATION_DRAG_BEGIN: {
|
||||||
if (is_visible_in_tree()) {
|
if (is_visible_in_tree()) {
|
||||||
if (_is_drop_valid(get_viewport()->gui_get_drag_data())) {
|
if (_is_drop_valid(get_viewport()->gui_get_drag_data())) {
|
||||||
dropping = true;
|
dropping = true;
|
||||||
|
edit->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case NOTIFICATION_DRAG_END: {
|
||||||
|
if (dropping) {
|
||||||
|
dropping = false;
|
||||||
edit->update();
|
edit->update();
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_DRAG_END) {
|
|
||||||
if (dropping) {
|
|
||||||
dropping = false;
|
|
||||||
edit->update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1151,18 +1154,21 @@ void EditorPropertyDictionary::_object_id_selected(const StringName &p_property,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyDictionary::_notification(int p_what) {
|
void EditorPropertyDictionary::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
change_type->clear();
|
case NOTIFICATION_THEME_CHANGED:
|
||||||
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
String type = Variant::get_type_name(Variant::Type(i));
|
change_type->clear();
|
||||||
change_type->add_icon_item(get_theme_icon(type, SNAME("EditorIcons")), type, i);
|
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
|
||||||
}
|
String type = Variant::get_type_name(Variant::Type(i));
|
||||||
change_type->add_separator();
|
change_type->add_icon_item(get_theme_icon(type, SNAME("EditorIcons")), type, i);
|
||||||
change_type->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Remove Item"), Variant::VARIANT_MAX);
|
}
|
||||||
|
change_type->add_separator();
|
||||||
|
change_type->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Remove Item"), Variant::VARIANT_MAX);
|
||||||
|
|
||||||
if (Object::cast_to<Button>(button_add_item)) {
|
if (Object::cast_to<Button>(button_add_item)) {
|
||||||
button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,61 +35,63 @@
|
|||||||
#include "editor/editor_scale.h"
|
#include "editor/editor_scale.h"
|
||||||
|
|
||||||
void EditorRunNative::_notification(int p_what) {
|
void EditorRunNative::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
switch (p_what) {
|
||||||
for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(i);
|
for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) {
|
||||||
if (eep.is_null()) {
|
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(i);
|
||||||
continue;
|
if (eep.is_null()) {
|
||||||
}
|
continue;
|
||||||
Ref<ImageTexture> icon = eep->get_run_icon();
|
|
||||||
if (!icon.is_null()) {
|
|
||||||
Ref<Image> im = icon->get_image();
|
|
||||||
im = im->duplicate();
|
|
||||||
im->clear_mipmaps();
|
|
||||||
if (!im->is_empty()) {
|
|
||||||
im->resize(16 * EDSCALE, 16 * EDSCALE);
|
|
||||||
Ref<ImageTexture> small_icon;
|
|
||||||
small_icon.instantiate();
|
|
||||||
small_icon->create_from_image(im);
|
|
||||||
MenuButton *mb = memnew(MenuButton);
|
|
||||||
mb->get_popup()->connect("id_pressed", callable_mp(this, &EditorRunNative::run_native), varray(i));
|
|
||||||
mb->connect("pressed", callable_mp(this, &EditorRunNative::run_native), varray(-1, i));
|
|
||||||
mb->set_icon(small_icon);
|
|
||||||
add_child(mb);
|
|
||||||
menus[i] = mb;
|
|
||||||
}
|
}
|
||||||
}
|
Ref<ImageTexture> icon = eep->get_run_icon();
|
||||||
}
|
if (!icon.is_null()) {
|
||||||
}
|
Ref<Image> im = icon->get_image();
|
||||||
|
im = im->duplicate();
|
||||||
if (p_what == NOTIFICATION_PROCESS) {
|
im->clear_mipmaps();
|
||||||
bool changed = EditorExport::get_singleton()->poll_export_platforms() || first;
|
if (!im->is_empty()) {
|
||||||
|
im->resize(16 * EDSCALE, 16 * EDSCALE);
|
||||||
if (changed) {
|
Ref<ImageTexture> small_icon;
|
||||||
for (KeyValue<int, MenuButton *> &E : menus) {
|
small_icon.instantiate();
|
||||||
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(E.key);
|
small_icon->create_from_image(im);
|
||||||
MenuButton *mb = E.value;
|
MenuButton *mb = memnew(MenuButton);
|
||||||
int dc = eep->get_options_count();
|
mb->get_popup()->connect("id_pressed", callable_mp(this, &EditorRunNative::run_native), varray(i));
|
||||||
|
mb->connect("pressed", callable_mp(this, &EditorRunNative::run_native), varray(-1, i));
|
||||||
if (dc == 0) {
|
mb->set_icon(small_icon);
|
||||||
mb->hide();
|
add_child(mb);
|
||||||
} else {
|
menus[i] = mb;
|
||||||
mb->get_popup()->clear();
|
|
||||||
mb->show();
|
|
||||||
if (dc == 1) {
|
|
||||||
mb->set_tooltip(eep->get_option_tooltip(0));
|
|
||||||
} else {
|
|
||||||
mb->set_tooltip(eep->get_options_tooltip());
|
|
||||||
for (int i = 0; i < dc; i++) {
|
|
||||||
mb->get_popup()->add_icon_item(eep->get_option_icon(i), eep->get_option_label(i));
|
|
||||||
mb->get_popup()->set_item_tooltip(mb->get_popup()->get_item_count() - 1, eep->get_option_tooltip(i));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
first = false;
|
case NOTIFICATION_PROCESS: {
|
||||||
}
|
bool changed = EditorExport::get_singleton()->poll_export_platforms() || first;
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
for (KeyValue<int, MenuButton *> &E : menus) {
|
||||||
|
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(E.key);
|
||||||
|
MenuButton *mb = E.value;
|
||||||
|
int dc = eep->get_options_count();
|
||||||
|
|
||||||
|
if (dc == 0) {
|
||||||
|
mb->hide();
|
||||||
|
} else {
|
||||||
|
mb->get_popup()->clear();
|
||||||
|
mb->show();
|
||||||
|
if (dc == 1) {
|
||||||
|
mb->set_tooltip(eep->get_option_tooltip(0));
|
||||||
|
} else {
|
||||||
|
mb->set_tooltip(eep->get_options_tooltip());
|
||||||
|
for (int i = 0; i < dc; i++) {
|
||||||
|
mb->get_popup()->add_icon_item(eep->get_option_icon(i), eep->get_option_label(i));
|
||||||
|
mb->get_popup()->set_item_tooltip(mb->get_popup()->get_item_count() - 1, eep->get_option_tooltip(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,14 +121,17 @@ void EditorSettingsDialog::_notification(int p_what) {
|
|||||||
set_process_unhandled_input(false);
|
set_process_unhandled_input(false);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_READY: {
|
||||||
undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, nullptr);
|
undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, nullptr);
|
||||||
undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, nullptr);
|
undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, nullptr);
|
||||||
undo_redo->set_commit_notify_callback(_undo_redo_callback, this);
|
undo_redo->set_commit_notify_callback(_undo_redo_callback, this);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
_update_icons();
|
_update_icons();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
_update_icons();
|
_update_icons();
|
||||||
// Update theme colors.
|
// Update theme colors.
|
||||||
|
@ -430,47 +430,49 @@ void EditorSpinSlider::_draw_spin_slider() {
|
|||||||
void EditorSpinSlider::_notification(int p_what) {
|
void EditorSpinSlider::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE:
|
||||||
case NOTIFICATION_THEME_CHANGED:
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
_update_value_input_stylebox();
|
_update_value_input_stylebox();
|
||||||
break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_INTERNAL_PROCESS:
|
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||||
if (value_input_dirty) {
|
if (value_input_dirty) {
|
||||||
value_input_dirty = false;
|
value_input_dirty = false;
|
||||||
value_input->set_text(get_text_value());
|
value_input->set_text(get_text_value());
|
||||||
}
|
}
|
||||||
set_process_internal(false);
|
set_process_internal(false);
|
||||||
break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_DRAW:
|
case NOTIFICATION_DRAW: {
|
||||||
_draw_spin_slider();
|
_draw_spin_slider();
|
||||||
break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_WM_WINDOW_FOCUS_IN:
|
case NOTIFICATION_WM_WINDOW_FOCUS_IN:
|
||||||
case NOTIFICATION_WM_WINDOW_FOCUS_OUT:
|
case NOTIFICATION_WM_WINDOW_FOCUS_OUT:
|
||||||
case NOTIFICATION_EXIT_TREE:
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (grabbing_spinner) {
|
if (grabbing_spinner) {
|
||||||
grabber->hide();
|
grabber->hide();
|
||||||
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
|
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
|
||||||
grabbing_spinner = false;
|
grabbing_spinner = false;
|
||||||
grabbing_spinner_attempt = false;
|
grabbing_spinner_attempt = false;
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_MOUSE_ENTER:
|
case NOTIFICATION_MOUSE_ENTER: {
|
||||||
mouse_over_spin = true;
|
mouse_over_spin = true;
|
||||||
update();
|
update();
|
||||||
break;
|
} break;
|
||||||
case NOTIFICATION_MOUSE_EXIT:
|
|
||||||
|
case NOTIFICATION_MOUSE_EXIT: {
|
||||||
mouse_over_spin = false;
|
mouse_over_spin = false;
|
||||||
update();
|
update();
|
||||||
break;
|
} break;
|
||||||
case NOTIFICATION_FOCUS_ENTER:
|
|
||||||
|
case NOTIFICATION_FOCUS_ENTER: {
|
||||||
if ((Input::get_singleton()->is_action_pressed("ui_focus_next") || Input::get_singleton()->is_action_pressed("ui_focus_prev")) && !value_input_just_closed) {
|
if ((Input::get_singleton()->is_action_pressed("ui_focus_next") || Input::get_singleton()->is_action_pressed("ui_focus_prev")) && !value_input_just_closed) {
|
||||||
_focus_entered();
|
_focus_entered();
|
||||||
}
|
}
|
||||||
value_input_just_closed = false;
|
value_input_just_closed = false;
|
||||||
break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ void EditorToaster::_notification(int p_what) {
|
|||||||
main_button->update();
|
main_button->update();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE:
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
if (vbox_container->is_visible()) {
|
if (vbox_container->is_visible()) {
|
||||||
@ -134,12 +135,11 @@ void EditorToaster::_notification(int p_what) {
|
|||||||
main_button->update();
|
main_button->update();
|
||||||
disable_notifications_button->update();
|
disable_notifications_button->update();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
_update_vbox_position();
|
_update_vbox_position();
|
||||||
_update_disable_notifications_button();
|
_update_disable_notifications_button();
|
||||||
} break;
|
} break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,12 +144,10 @@ void EditorZoomWidget::set_zoom_by_increments(int p_increment_count, bool p_inte
|
|||||||
void EditorZoomWidget::_notification(int p_what) {
|
void EditorZoomWidget::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE:
|
case NOTIFICATION_ENTER_TREE:
|
||||||
case NOTIFICATION_THEME_CHANGED:
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
zoom_minus->set_icon(get_theme_icon(SNAME("ZoomLess"), SNAME("EditorIcons")));
|
zoom_minus->set_icon(get_theme_icon(SNAME("ZoomLess"), SNAME("EditorIcons")));
|
||||||
zoom_plus->set_icon(get_theme_icon(SNAME("ZoomMore"), SNAME("EditorIcons")));
|
zoom_plus->set_icon(get_theme_icon(SNAME("ZoomMore"), SNAME("EditorIcons")));
|
||||||
break;
|
} break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,9 +103,11 @@ void FindInFiles::set_filter(const Set<String> &exts) {
|
|||||||
_extension_filter = exts;
|
_extension_filter = exts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindInFiles::_notification(int p_notification) {
|
void FindInFiles::_notification(int p_what) {
|
||||||
if (p_notification == NOTIFICATION_PROCESS) {
|
switch (p_what) {
|
||||||
_process();
|
case NOTIFICATION_PROCESS: {
|
||||||
|
_process();
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,26 +458,28 @@ Set<String> FindInFilesDialog::get_filter() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FindInFilesDialog::_notification(int p_what) {
|
void FindInFilesDialog::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
switch (p_what) {
|
||||||
if (is_visible()) {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
// Doesn't work more than once if not deferred...
|
if (is_visible()) {
|
||||||
_search_text_line_edit->call_deferred(SNAME("grab_focus"));
|
// Doesn't work more than once if not deferred...
|
||||||
_search_text_line_edit->select_all();
|
_search_text_line_edit->call_deferred(SNAME("grab_focus"));
|
||||||
// Extensions might have changed in the meantime, we clean them and instance them again.
|
_search_text_line_edit->select_all();
|
||||||
for (int i = 0; i < _filters_container->get_child_count(); i++) {
|
// Extensions might have changed in the meantime, we clean them and instance them again.
|
||||||
_filters_container->get_child(i)->queue_delete();
|
for (int i = 0; i < _filters_container->get_child_count(); i++) {
|
||||||
}
|
_filters_container->get_child(i)->queue_delete();
|
||||||
Array exts = ProjectSettings::get_singleton()->get("editor/script/search_in_file_extensions");
|
}
|
||||||
for (int i = 0; i < exts.size(); ++i) {
|
Array exts = ProjectSettings::get_singleton()->get("editor/script/search_in_file_extensions");
|
||||||
CheckBox *cb = memnew(CheckBox);
|
for (int i = 0; i < exts.size(); ++i) {
|
||||||
cb->set_text(exts[i]);
|
CheckBox *cb = memnew(CheckBox);
|
||||||
if (!_filters_preferences.has(exts[i])) {
|
cb->set_text(exts[i]);
|
||||||
_filters_preferences[exts[i]] = true;
|
if (!_filters_preferences.has(exts[i])) {
|
||||||
|
_filters_preferences[exts[i]] = true;
|
||||||
|
}
|
||||||
|
cb->set_pressed(_filters_preferences[exts[i]]);
|
||||||
|
_filters_container->add_child(cb);
|
||||||
}
|
}
|
||||||
cb->set_pressed(_filters_preferences[exts[i]]);
|
|
||||||
_filters_container->add_child(cb);
|
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,11 +691,15 @@ void FindInFilesPanel::stop_search() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FindInFilesPanel::_notification(int p_what) {
|
void FindInFilesPanel::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_PROCESS) {
|
switch (p_what) {
|
||||||
_progress_bar->set_as_ratio(_finder->get_progress());
|
case NOTIFICATION_PROCESS: {
|
||||||
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
|
_progress_bar->set_as_ratio(_finder->get_progress());
|
||||||
_search_text_label->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts")));
|
} break;
|
||||||
_results_display->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts")));
|
|
||||||
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
|
_search_text_label->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts")));
|
||||||
|
_results_display->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts")));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public:
|
|||||||
float get_progress() const;
|
float get_progress() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_notification);
|
void _notification(int p_what);
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user