浏览代码

Update audio effect icon when theme changes

(cherry picked from commit 20ed798e590ace9f99526cbe911ee1d01cf3e1d0)
Haoyu Qiu 3 年之前
父节点
当前提交
a26afe807f
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      editor/editor_audio_buses.cpp

+ 6 - 2
editor/editor_audio_buses.cpp

@@ -90,6 +90,12 @@ void EditorAudioBus::_notification(int p_what) {
 			audio_value_preview_label->add_color_override("font_color", get_color("font_color", "TooltipLabel"));
 			audio_value_preview_label->add_color_override("font_color", get_color("font_color", "TooltipLabel"));
 			audio_value_preview_label->add_color_override("font_color_shadow", get_color("font_color_shadow", "TooltipLabel"));
 			audio_value_preview_label->add_color_override("font_color_shadow", get_color("font_color_shadow", "TooltipLabel"));
 			audio_value_preview_box->add_style_override("panel", get_stylebox("panel", "TooltipPanel"));
 			audio_value_preview_box->add_style_override("panel", get_stylebox("panel", "TooltipPanel"));
+
+			for (int i = 0; i < effect_options->get_item_count(); i++) {
+				String class_name = effect_options->get_item_metadata(i);
+				Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(class_name);
+				effect_options->set_item_icon(i, icon);
+			}
 		} break;
 		} break;
 
 
 		case NOTIFICATION_READY: {
 		case NOTIFICATION_READY: {
@@ -932,11 +938,9 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
 			continue;
 			continue;
 		}
 		}
 
 
-		Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(E->get());
 		String name = E->get().operator String().replace("AudioEffect", "");
 		String name = E->get().operator String().replace("AudioEffect", "");
 		effect_options->add_item(name);
 		effect_options->add_item(name);
 		effect_options->set_item_metadata(effect_options->get_item_count() - 1, E->get());
 		effect_options->set_item_metadata(effect_options->get_item_count() - 1, E->get());
-		effect_options->set_item_icon(effect_options->get_item_count() - 1, icon);
 	}
 	}
 
 
 	bus_popup = bus_options->get_popup();
 	bus_popup = bus_options->get_popup();