mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Delay initialization of the visual shader editor UI
This makes sure that the theme is ready to be used before the methods is called. Also add missing icons (and update some existing). Co-authored-by: Samuel Wilson <yokomeshi@gmail.com>
This commit is contained in:
parent
d5c1b9f883
commit
edf47f1ee4
8 changed files with 36 additions and 29 deletions
|
@ -1845,31 +1845,31 @@ void VisualShaderEditor::_update_options_menu() {
|
|||
}
|
||||
switch (options[i].return_type) {
|
||||
case VisualShaderNode::PORT_TYPE_SCALAR:
|
||||
item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("float"), SNAME("EditorIcons")));
|
||||
item->set_icon(0, get_theme_icon(SNAME("float"), SNAME("EditorIcons")));
|
||||
break;
|
||||
case VisualShaderNode::PORT_TYPE_SCALAR_INT:
|
||||
item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("int"), SNAME("EditorIcons")));
|
||||
item->set_icon(0, get_theme_icon(SNAME("int"), SNAME("EditorIcons")));
|
||||
break;
|
||||
case VisualShaderNode::PORT_TYPE_SCALAR_UINT:
|
||||
item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("uint"), SNAME("EditorIcons")));
|
||||
item->set_icon(0, get_theme_icon(SNAME("uint"), SNAME("EditorIcons")));
|
||||
break;
|
||||
case VisualShaderNode::PORT_TYPE_VECTOR_2D:
|
||||
item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Vector2"), SNAME("EditorIcons")));
|
||||
item->set_icon(0, get_theme_icon(SNAME("Vector2"), SNAME("EditorIcons")));
|
||||
break;
|
||||
case VisualShaderNode::PORT_TYPE_VECTOR_3D:
|
||||
item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Vector3"), SNAME("EditorIcons")));
|
||||
item->set_icon(0, get_theme_icon(SNAME("Vector3"), SNAME("EditorIcons")));
|
||||
break;
|
||||
case VisualShaderNode::PORT_TYPE_VECTOR_4D:
|
||||
item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Vector4"), SNAME("EditorIcons")));
|
||||
item->set_icon(0, get_theme_icon(SNAME("Vector4"), SNAME("EditorIcons")));
|
||||
break;
|
||||
case VisualShaderNode::PORT_TYPE_BOOLEAN:
|
||||
item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("bool"), SNAME("EditorIcons")));
|
||||
item->set_icon(0, get_theme_icon(SNAME("bool"), SNAME("EditorIcons")));
|
||||
break;
|
||||
case VisualShaderNode::PORT_TYPE_TRANSFORM:
|
||||
item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Transform3D"), SNAME("EditorIcons")));
|
||||
item->set_icon(0, get_theme_icon(SNAME("Transform3D"), SNAME("EditorIcons")));
|
||||
break;
|
||||
case VisualShaderNode::PORT_TYPE_SAMPLER:
|
||||
item->set_icon(0, EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("ImageTexture"), SNAME("EditorIcons")));
|
||||
item->set_icon(0, get_theme_icon(SNAME("ImageTexture"), SNAME("EditorIcons")));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -4051,6 +4051,10 @@ void VisualShaderEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
|
|||
|
||||
void VisualShaderEditor::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_POSTINITIALIZE: {
|
||||
_update_options_menu();
|
||||
} break;
|
||||
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
||||
graph->set_warped_panning(bool(EDITOR_GET("editors/panning/warped_mouse_panning")));
|
||||
|
@ -4077,8 +4081,8 @@ void VisualShaderEditor::_notification(int p_what) {
|
|||
|
||||
graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
||||
graph->set_warped_panning(bool(EDITOR_GET("editors/panning/warped_mouse_panning")));
|
||||
[[fallthrough]];
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
highend_label->set_modulate(get_theme_color(SNAME("highend_color"), SNAME("Editor")));
|
||||
|
||||
|
@ -4130,7 +4134,7 @@ void VisualShaderEditor::_notification(int p_what) {
|
|||
error_label->add_theme_color_override("font_color", error_color);
|
||||
}
|
||||
|
||||
tools->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Tools"), SNAME("EditorIcons")));
|
||||
tools->set_icon(get_theme_icon(SNAME("Tools"), SNAME("EditorIcons")));
|
||||
|
||||
if (p_what == NOTIFICATION_THEME_CHANGED && is_visible_in_tree()) {
|
||||
_update_graph();
|
||||
|
@ -6130,8 +6134,6 @@ VisualShaderEditor::VisualShaderEditor() {
|
|||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
_update_options_menu();
|
||||
|
||||
Ref<VisualShaderNodePluginDefault> default_plugin;
|
||||
default_plugin.instantiate();
|
||||
default_plugin->set_editor(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue