mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Fix premature theme item access in editor tools
This commit is contained in:
@@ -234,7 +234,9 @@ TreeItem *EditorPerformanceProfiler::_get_monitor_base(const StringName &p_base_
|
||||
base->set_editable(0, false);
|
||||
base->set_selectable(0, false);
|
||||
base->set_expand_right(0, true);
|
||||
base->set_custom_font(0, get_theme_font(SNAME("bold"), SNAME("EditorFonts")));
|
||||
if (is_inside_tree()) {
|
||||
base->set_custom_font(0, get_theme_font(SNAME("bold"), SNAME("EditorFonts")));
|
||||
}
|
||||
base_map.insert(p_base_name, base);
|
||||
return base;
|
||||
}
|
||||
@@ -368,6 +370,16 @@ List<float> *EditorPerformanceProfiler::get_monitor_data(const StringName &p_nam
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void EditorPerformanceProfiler::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
for (KeyValue<StringName, TreeItem *> &E : base_map) {
|
||||
E.value->set_custom_font(0, get_theme_font(SNAME("bold"), SNAME("EditorFonts")));
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
EditorPerformanceProfiler::EditorPerformanceProfiler() {
|
||||
set_name(TTR("Monitors"));
|
||||
set_split_offset(340 * EDSCALE);
|
||||
|
||||
@@ -79,6 +79,9 @@ private:
|
||||
TreeItem *_create_monitor_item(const StringName &p_monitor_name, TreeItem *p_base);
|
||||
void _marker_input(const Ref<InputEvent> &p_event);
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
public:
|
||||
void reset();
|
||||
void update_monitors(const Vector<StringName> &p_names);
|
||||
|
||||
Reference in New Issue
Block a user