You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Add EditorStringNames singleton
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_scale.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_string_names.h"
|
||||
#include "editor/editor_undo_redo_manager.h"
|
||||
#include "editor/gui/editor_spin_slider.h"
|
||||
#include "editor/gui/scene_tree_editor.h"
|
||||
@@ -1304,10 +1305,10 @@ void AnimationTimelineEdit::_anim_loop_pressed() {
|
||||
}
|
||||
|
||||
int AnimationTimelineEdit::get_buttons_width() const {
|
||||
Ref<Texture2D> interp_mode = get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> interp_type = get_theme_icon(SNAME("InterpRaw"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> loop_type = get_theme_icon(SNAME("InterpWrapClamp"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> remove_icon = get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> interp_mode = get_editor_theme_icon(SNAME("TrackContinuous"));
|
||||
Ref<Texture2D> interp_type = get_editor_theme_icon(SNAME("InterpRaw"));
|
||||
Ref<Texture2D> loop_type = get_editor_theme_icon(SNAME("InterpWrapClamp"));
|
||||
Ref<Texture2D> remove_icon = get_editor_theme_icon(SNAME("Remove"));
|
||||
Ref<Texture2D> down_icon = get_theme_icon(SNAME("select_arrow"), SNAME("Tree"));
|
||||
|
||||
int total_w = interp_mode->get_width() + interp_type->get_width() + loop_type->get_width() + remove_icon->get_width();
|
||||
@@ -1317,7 +1318,7 @@ int AnimationTimelineEdit::get_buttons_width() const {
|
||||
}
|
||||
|
||||
int AnimationTimelineEdit::get_name_limit() const {
|
||||
Ref<Texture2D> hsize_icon = get_theme_icon(SNAME("Hsize"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> hsize_icon = get_editor_theme_icon(SNAME("Hsize"));
|
||||
|
||||
int limit = MAX(name_limit, add_track->get_minimum_size().width + hsize_icon->get_width());
|
||||
|
||||
@@ -1331,20 +1332,20 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
||||
add_track->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
||||
loop->set_icon(get_theme_icon(SNAME("Loop"), SNAME("EditorIcons")));
|
||||
time_icon->set_texture(get_theme_icon(SNAME("Time"), SNAME("EditorIcons")));
|
||||
add_track->set_icon(get_editor_theme_icon(SNAME("Add")));
|
||||
loop->set_icon(get_editor_theme_icon(SNAME("Loop")));
|
||||
time_icon->set_texture(get_editor_theme_icon(SNAME("Time")));
|
||||
|
||||
add_track->get_popup()->clear();
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyValue"), SNAME("EditorIcons")), TTR("Property Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyXPosition"), SNAME("EditorIcons")), TTR("3D Position Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyXRotation"), SNAME("EditorIcons")), TTR("3D Rotation Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyXScale"), SNAME("EditorIcons")), TTR("3D Scale Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyBlendShape"), SNAME("EditorIcons")), TTR("Blend Shape Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyCall"), SNAME("EditorIcons")), TTR("Call Method Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyBezier"), SNAME("EditorIcons")), TTR("Bezier Curve Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyAudio"), SNAME("EditorIcons")), TTR("Audio Playback Track"));
|
||||
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyAnimation"), SNAME("EditorIcons")), TTR("Animation Playback Track"));
|
||||
add_track->get_popup()->add_icon_item(get_editor_theme_icon(SNAME("KeyValue")), TTR("Property Track"));
|
||||
add_track->get_popup()->add_icon_item(get_editor_theme_icon(SNAME("KeyXPosition")), TTR("3D Position Track"));
|
||||
add_track->get_popup()->add_icon_item(get_editor_theme_icon(SNAME("KeyXRotation")), TTR("3D Rotation Track"));
|
||||
add_track->get_popup()->add_icon_item(get_editor_theme_icon(SNAME("KeyXScale")), TTR("3D Scale Track"));
|
||||
add_track->get_popup()->add_icon_item(get_editor_theme_icon(SNAME("KeyBlendShape")), TTR("Blend Shape Track"));
|
||||
add_track->get_popup()->add_icon_item(get_editor_theme_icon(SNAME("KeyCall")), TTR("Call Method Track"));
|
||||
add_track->get_popup()->add_icon_item(get_editor_theme_icon(SNAME("KeyBezier")), TTR("Bezier Curve Track"));
|
||||
add_track->get_popup()->add_icon_item(get_editor_theme_icon(SNAME("KeyAudio")), TTR("Audio Playback Track"));
|
||||
add_track->get_popup()->add_icon_item(get_editor_theme_icon(SNAME("KeyAnimation")), TTR("Animation Playback Track"));
|
||||
} break;
|
||||
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
@@ -1376,7 +1377,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
||||
l = 0.0001; // Avoid crashor.
|
||||
}
|
||||
|
||||
Ref<Texture2D> hsize_icon = get_theme_icon(SNAME("Hsize"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> hsize_icon = get_editor_theme_icon(SNAME("Hsize"));
|
||||
hsize_rect = Rect2(get_name_limit() - hsize_icon->get_width() - 2 * EDSCALE, (get_size().height - hsize_icon->get_height()) / 2, hsize_icon->get_width(), hsize_icon->get_height());
|
||||
draw_texture(hsize_icon, hsize_rect.position);
|
||||
|
||||
@@ -1417,7 +1418,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
|
||||
|
||||
int end_px = (l - get_value()) * scale;
|
||||
int begin_px = -get_value() * scale;
|
||||
Color notimecol = get_theme_color(SNAME("dark_color_2"), SNAME("Editor"));
|
||||
Color notimecol = get_theme_color(SNAME("dark_color_2"), EditorStringName(Editor));
|
||||
Color timecolor = color;
|
||||
timecolor.a = 0.2;
|
||||
Color linecolor = color;
|
||||
@@ -1553,7 +1554,7 @@ Size2 AnimationTimelineEdit::get_minimum_size() const {
|
||||
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
|
||||
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
|
||||
ms.height = MAX(ms.height, font->get_height(font_size));
|
||||
ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_theme_icon(SNAME("Hsize"), SNAME("EditorIcons"))->get_width() + 2;
|
||||
ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_editor_theme_icon(SNAME("Hsize"))->get_width() + 2;
|
||||
return ms;
|
||||
}
|
||||
|
||||
@@ -1602,15 +1603,15 @@ void AnimationTimelineEdit::update_values() {
|
||||
|
||||
switch (animation->get_loop_mode()) {
|
||||
case Animation::LOOP_NONE: {
|
||||
loop->set_icon(get_theme_icon(SNAME("Loop"), SNAME("EditorIcons")));
|
||||
loop->set_icon(get_editor_theme_icon(SNAME("Loop")));
|
||||
loop->set_pressed(false);
|
||||
} break;
|
||||
case Animation::LOOP_LINEAR: {
|
||||
loop->set_icon(get_theme_icon(SNAME("Loop"), SNAME("EditorIcons")));
|
||||
loop->set_icon(get_editor_theme_icon(SNAME("Loop")));
|
||||
loop->set_pressed(true);
|
||||
} break;
|
||||
case Animation::LOOP_PINGPONG: {
|
||||
loop->set_icon(get_theme_icon(SNAME("PingPongLoop"), SNAME("EditorIcons")));
|
||||
loop->set_icon(get_editor_theme_icon(SNAME("PingPongLoop")));
|
||||
loop->set_pressed(true);
|
||||
} break;
|
||||
default:
|
||||
@@ -1631,11 +1632,11 @@ void AnimationTimelineEdit::_play_position_draw() {
|
||||
int px = (-get_value() + play_position_pos) * scale + get_name_limit();
|
||||
|
||||
if (px >= get_name_limit() && px < (play_position->get_size().width - get_buttons_width())) {
|
||||
Color color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||
Color color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
||||
play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE));
|
||||
play_position->draw_texture(
|
||||
get_theme_icon(SNAME("TimelineIndicator"), SNAME("EditorIcons")),
|
||||
Point2(px - get_theme_icon(SNAME("TimelineIndicator"), SNAME("EditorIcons"))->get_width() * 0.5, 0),
|
||||
get_editor_theme_icon(SNAME("TimelineIndicator")),
|
||||
Point2(px - get_editor_theme_icon(SNAME("TimelineIndicator"))->get_width() * 0.5, 0),
|
||||
color);
|
||||
}
|
||||
}
|
||||
@@ -1813,7 +1814,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
||||
ERR_FAIL_INDEX(track, animation->get_track_count());
|
||||
|
||||
type_icon = _get_key_type_icon();
|
||||
selected_icon = get_theme_icon(SNAME("KeySelected"), SNAME("EditorIcons"));
|
||||
selected_icon = get_editor_theme_icon(SNAME("KeySelected"));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_DRAW: {
|
||||
@@ -1835,10 +1836,10 @@ void AnimationTrackEdit::_notification(int p_what) {
|
||||
}
|
||||
|
||||
if (has_focus()) {
|
||||
Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||
Color accent = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
||||
accent.a *= 0.7;
|
||||
// Offside so the horizontal sides aren't cutoff.
|
||||
draw_style_box(get_theme_stylebox(SNAME("Focus"), SNAME("EditorStyles")), Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)));
|
||||
draw_style_box(get_theme_stylebox(SNAME("Focus"), EditorStringName(EditorStyles)), Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)));
|
||||
}
|
||||
|
||||
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
|
||||
@@ -1848,7 +1849,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
||||
Color linecolor = color;
|
||||
linecolor.a = 0.2;
|
||||
|
||||
Color dc = get_theme_color(SNAME("disabled_font_color"), SNAME("Editor"));
|
||||
Color dc = get_theme_color(SNAME("disabled_font_color"), EditorStringName(Editor));
|
||||
|
||||
// NAMES AND ICONS //
|
||||
|
||||
@@ -1874,7 +1875,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
||||
String text;
|
||||
Color text_color = color;
|
||||
if (node && EditorNode::get_singleton()->get_editor_selection()->is_selected(node)) {
|
||||
text_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||
text_color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
||||
}
|
||||
|
||||
if (in_group) {
|
||||
@@ -1949,24 +1950,24 @@ void AnimationTrackEdit::_notification(int p_what) {
|
||||
|
||||
{
|
||||
Ref<Texture2D> wrap_icon[2] = {
|
||||
get_theme_icon(SNAME("InterpWrapClamp"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("InterpWrapLoop"), SNAME("EditorIcons")),
|
||||
get_editor_theme_icon(SNAME("InterpWrapClamp")),
|
||||
get_editor_theme_icon(SNAME("InterpWrapLoop")),
|
||||
};
|
||||
Ref<Texture2D> interp_icon[5] = {
|
||||
get_theme_icon(SNAME("InterpRaw"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("InterpLinear"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("InterpCubic"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("InterpLinearAngle"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("InterpCubicAngle"), SNAME("EditorIcons")),
|
||||
get_editor_theme_icon(SNAME("InterpRaw")),
|
||||
get_editor_theme_icon(SNAME("InterpLinear")),
|
||||
get_editor_theme_icon(SNAME("InterpCubic")),
|
||||
get_editor_theme_icon(SNAME("InterpLinearAngle")),
|
||||
get_editor_theme_icon(SNAME("InterpCubicAngle")),
|
||||
};
|
||||
Ref<Texture2D> cont_icon[3] = {
|
||||
get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons"))
|
||||
get_editor_theme_icon(SNAME("TrackContinuous")),
|
||||
get_editor_theme_icon(SNAME("TrackDiscrete")),
|
||||
get_editor_theme_icon(SNAME("TrackCapture"))
|
||||
};
|
||||
Ref<Texture2D> blend_icon[2] = {
|
||||
get_theme_icon(SNAME("UseBlendEnable"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("UseBlendDisable"), SNAME("EditorIcons")),
|
||||
get_editor_theme_icon(SNAME("UseBlendEnable")),
|
||||
get_editor_theme_icon(SNAME("UseBlendDisable")),
|
||||
};
|
||||
|
||||
int ofs = get_size().width - timeline->get_buttons_width();
|
||||
@@ -2096,7 +2097,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
||||
{
|
||||
// Erase.
|
||||
|
||||
Ref<Texture2D> icon = get_theme_icon(animation->track_is_compressed(track) ? SNAME("Lock") : SNAME("Remove"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> icon = get_editor_theme_icon(animation->track_is_compressed(track) ? SNAME("Lock") : SNAME("Remove"));
|
||||
|
||||
remove_rect.position.x = ofs + ((get_size().width - ofs) - icon->get_width());
|
||||
remove_rect.position.y = int(get_size().height - icon->get_height()) / 2;
|
||||
@@ -2117,7 +2118,7 @@ void AnimationTrackEdit::_notification(int p_what) {
|
||||
}
|
||||
|
||||
if (dropping_at != 0) {
|
||||
Color drop_color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||
Color drop_color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
||||
if (dropping_at < 0) {
|
||||
draw_line(Vector2(0, 0), Vector2(get_size().width, 0), drop_color, Math::round(EDSCALE));
|
||||
} else {
|
||||
@@ -2202,7 +2203,7 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
|
||||
|
||||
if (animation->track_get_type(track) == Animation::TYPE_VALUE && !Math::is_equal_approx(animation->track_get_key_transition(track, p_index), real_t(1.0))) {
|
||||
// Use a different icon for keys with non-linear easing.
|
||||
icon_to_draw = get_theme_icon(p_selected ? SNAME("KeyEasedSelected") : SNAME("KeyValueEased"), SNAME("EditorIcons"));
|
||||
icon_to_draw = get_editor_theme_icon(p_selected ? SNAME("KeyEasedSelected") : SNAME("KeyValueEased"));
|
||||
}
|
||||
|
||||
// Override type icon for invalid value keys, unless selected.
|
||||
@@ -2210,7 +2211,7 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
|
||||
const Variant &v = animation->track_get_key_value(track, p_index);
|
||||
Variant::Type valid_type = Variant::NIL;
|
||||
if (!_is_value_key_valid(v, valid_type)) {
|
||||
icon_to_draw = get_theme_icon(SNAME("KeyInvalid"), SNAME("EditorIcons"));
|
||||
icon_to_draw = get_editor_theme_icon(SNAME("KeyInvalid"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2333,7 +2334,7 @@ void AnimationTrackEdit::set_animation_and_track(const Ref<Animation> &p_animati
|
||||
|
||||
node_path = animation->track_get_path(p_track);
|
||||
type_icon = _get_key_type_icon();
|
||||
selected_icon = get_theme_icon(SNAME("KeySelected"), SNAME("EditorIcons"));
|
||||
selected_icon = get_editor_theme_icon(SNAME("KeySelected"));
|
||||
}
|
||||
|
||||
NodePath AnimationTrackEdit::get_path() const {
|
||||
@@ -2341,7 +2342,7 @@ NodePath AnimationTrackEdit::get_path() const {
|
||||
}
|
||||
|
||||
Size2 AnimationTrackEdit::get_minimum_size() const {
|
||||
Ref<Texture2D> texture = get_theme_icon(SNAME("Object"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> texture = get_editor_theme_icon(SNAME("Object"));
|
||||
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
|
||||
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
|
||||
int separation = get_theme_constant(SNAME("v_separation"), SNAME("ItemList"));
|
||||
@@ -2374,7 +2375,7 @@ void AnimationTrackEdit::_play_position_draw() {
|
||||
int px = (-timeline->get_value() + play_position_pos) * scale + timeline->get_name_limit();
|
||||
|
||||
if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
|
||||
Color color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||
Color color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
||||
play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(2 * EDSCALE));
|
||||
}
|
||||
}
|
||||
@@ -2432,15 +2433,15 @@ bool AnimationTrackEdit::_is_value_key_valid(const Variant &p_key_value, Variant
|
||||
|
||||
Ref<Texture2D> AnimationTrackEdit::_get_key_type_icon() const {
|
||||
const Ref<Texture2D> type_icons[9] = {
|
||||
get_theme_icon(SNAME("KeyValue"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("KeyTrackPosition"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("KeyTrackRotation"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("KeyTrackScale"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("KeyTrackBlendShape"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("KeyCall"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("KeyBezier"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("KeyAudio"), SNAME("EditorIcons")),
|
||||
get_theme_icon(SNAME("KeyAnimation"), SNAME("EditorIcons"))
|
||||
get_editor_theme_icon(SNAME("KeyValue")),
|
||||
get_editor_theme_icon(SNAME("KeyTrackPosition")),
|
||||
get_editor_theme_icon(SNAME("KeyTrackRotation")),
|
||||
get_editor_theme_icon(SNAME("KeyTrackScale")),
|
||||
get_editor_theme_icon(SNAME("KeyTrackBlendShape")),
|
||||
get_editor_theme_icon(SNAME("KeyCall")),
|
||||
get_editor_theme_icon(SNAME("KeyBezier")),
|
||||
get_editor_theme_icon(SNAME("KeyAudio")),
|
||||
get_editor_theme_icon(SNAME("KeyAnimation"))
|
||||
};
|
||||
return type_icons[animation->track_get_type(track)];
|
||||
}
|
||||
@@ -2663,12 +2664,12 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
menu->clear();
|
||||
if (animation->track_get_type(track) == Animation::TYPE_AUDIO) {
|
||||
menu->add_icon_item(get_theme_icon(SNAME("UseBlendEnable"), SNAME("EditorIcons")), TTR("Use Blend"), MENU_USE_BLEND_ENABLED);
|
||||
menu->add_icon_item(get_theme_icon(SNAME("UseBlendDisable"), SNAME("EditorIcons")), TTR("Don't Use Blend"), MENU_USE_BLEND_DISABLED);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("UseBlendEnable")), TTR("Use Blend"), MENU_USE_BLEND_ENABLED);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("UseBlendDisable")), TTR("Don't Use Blend"), MENU_USE_BLEND_DISABLED);
|
||||
} else {
|
||||
menu->add_icon_item(get_theme_icon(SNAME("TrackContinuous"), SNAME("EditorIcons")), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS);
|
||||
menu->add_icon_item(get_theme_icon(SNAME("TrackDiscrete"), SNAME("EditorIcons")), TTR("Discrete"), MENU_CALL_MODE_DISCRETE);
|
||||
menu->add_icon_item(get_theme_icon(SNAME("TrackCapture"), SNAME("EditorIcons")), TTR("Capture"), MENU_CALL_MODE_CAPTURE);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("TrackContinuous")), TTR("Continuous"), MENU_CALL_MODE_CONTINUOUS);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("TrackDiscrete")), TTR("Discrete"), MENU_CALL_MODE_DISCRETE);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("TrackCapture")), TTR("Capture"), MENU_CALL_MODE_CAPTURE);
|
||||
}
|
||||
menu->reset_size();
|
||||
|
||||
@@ -2685,9 +2686,9 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||
menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected));
|
||||
}
|
||||
menu->clear();
|
||||
menu->add_icon_item(get_theme_icon(SNAME("InterpRaw"), SNAME("EditorIcons")), TTR("Nearest"), MENU_INTERPOLATION_NEAREST);
|
||||
menu->add_icon_item(get_theme_icon(SNAME("InterpLinear"), SNAME("EditorIcons")), TTR("Linear"), MENU_INTERPOLATION_LINEAR);
|
||||
menu->add_icon_item(get_theme_icon(SNAME("InterpCubic"), SNAME("EditorIcons")), TTR("Cubic"), MENU_INTERPOLATION_CUBIC);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("InterpRaw")), TTR("Nearest"), MENU_INTERPOLATION_NEAREST);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("InterpLinear")), TTR("Linear"), MENU_INTERPOLATION_LINEAR);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("InterpCubic")), TTR("Cubic"), MENU_INTERPOLATION_CUBIC);
|
||||
// Check whether it is angle property.
|
||||
AnimationPlayerEditor *ape = AnimationPlayerEditor::get_singleton();
|
||||
if (ape) {
|
||||
@@ -2700,8 +2701,8 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||
ClassDB::get_property_info(nd->get_class(), prop, &prop_info);
|
||||
bool is_angle = prop_info.type == Variant::FLOAT && prop_info.hint_string.find("radians") != -1;
|
||||
if (is_angle) {
|
||||
menu->add_icon_item(get_theme_icon(SNAME("InterpLinearAngle"), SNAME("EditorIcons")), TTR("Linear Angle"), MENU_INTERPOLATION_LINEAR_ANGLE);
|
||||
menu->add_icon_item(get_theme_icon(SNAME("InterpCubicAngle"), SNAME("EditorIcons")), TTR("Cubic Angle"), MENU_INTERPOLATION_CUBIC_ANGLE);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("InterpLinearAngle")), TTR("Linear Angle"), MENU_INTERPOLATION_LINEAR_ANGLE);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("InterpCubicAngle")), TTR("Cubic Angle"), MENU_INTERPOLATION_CUBIC_ANGLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2720,8 +2721,8 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||
menu->connect("id_pressed", callable_mp(this, &AnimationTrackEdit::_menu_selected));
|
||||
}
|
||||
menu->clear();
|
||||
menu->add_icon_item(get_theme_icon(SNAME("InterpWrapClamp"), SNAME("EditorIcons")), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP);
|
||||
menu->add_icon_item(get_theme_icon(SNAME("InterpWrapLoop"), SNAME("EditorIcons")), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("InterpWrapClamp")), TTR("Clamp Loop Interp"), MENU_LOOP_CLAMP);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("InterpWrapLoop")), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP);
|
||||
menu->reset_size();
|
||||
|
||||
Vector2 popup_pos = get_screen_position() + loop_wrap_rect.position + Vector2(0, loop_wrap_rect.size.height);
|
||||
@@ -2818,18 +2819,18 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
menu->clear();
|
||||
menu->add_icon_item(get_theme_icon(SNAME("Key"), SNAME("EditorIcons")), TTR("Insert Key"), MENU_KEY_INSERT);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("Key")), TTR("Insert Key"), MENU_KEY_INSERT);
|
||||
if (editor->is_selection_active()) {
|
||||
menu->add_separator();
|
||||
menu->add_icon_item(get_theme_icon(SNAME("Duplicate"), SNAME("EditorIcons")), TTR("Duplicate Key(s)"), MENU_KEY_DUPLICATE);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("Duplicate")), TTR("Duplicate Key(s)"), MENU_KEY_DUPLICATE);
|
||||
|
||||
AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player();
|
||||
if (!player->has_animation(SceneStringNames::get_singleton()->RESET) || animation != player->get_animation(SceneStringNames::get_singleton()->RESET)) {
|
||||
menu->add_icon_item(get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")), TTR("Add RESET Value(s)"), MENU_KEY_ADD_RESET);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("Reload")), TTR("Add RESET Value(s)"), MENU_KEY_ADD_RESET);
|
||||
}
|
||||
|
||||
menu->add_separator();
|
||||
menu->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Delete Key(s)"), MENU_KEY_DELETE);
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("Remove")), TTR("Delete Key(s)"), MENU_KEY_DELETE);
|
||||
}
|
||||
menu->reset_size();
|
||||
|
||||
@@ -3215,11 +3216,11 @@ void AnimationTrackEditGroup::_notification(int p_what) {
|
||||
if (root && root->has_node(node)) {
|
||||
Node *n = root->get_node(node);
|
||||
if (n && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) {
|
||||
color = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||
color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
||||
}
|
||||
}
|
||||
|
||||
Color bgcol = get_theme_color(SNAME("dark_color_2"), SNAME("Editor"));
|
||||
Color bgcol = get_theme_color(SNAME("dark_color_2"), EditorStringName(Editor));
|
||||
bgcol.a *= 0.6;
|
||||
draw_rect(Rect2(Point2(), get_size()), bgcol);
|
||||
Color linecolor = color;
|
||||
@@ -3237,7 +3238,7 @@ void AnimationTrackEditGroup::_notification(int p_what) {
|
||||
int px = (-timeline->get_value() + timeline->get_play_position()) * timeline->get_zoom_scale() + timeline->get_name_limit();
|
||||
|
||||
if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
|
||||
Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||
Color accent = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
|
||||
draw_line(Point2(px, 0), Point2(px, get_size().height), accent, Math::round(2 * EDSCALE));
|
||||
}
|
||||
} break;
|
||||
@@ -4434,7 +4435,7 @@ void AnimationTrackEditor::_update_tracks() {
|
||||
|
||||
if (!group_sort.has(base_path)) {
|
||||
AnimationTrackEditGroup *g = memnew(AnimationTrackEditGroup);
|
||||
Ref<Texture2D> icon = get_theme_icon(SNAME("Node"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> icon = get_editor_theme_icon(SNAME("Node"));
|
||||
String name = base_path;
|
||||
String tooltip;
|
||||
if (root && root->has_node(base_path)) {
|
||||
@@ -4615,14 +4616,14 @@ void AnimationTrackEditor::_notification(int p_what) {
|
||||
[[fallthrough]];
|
||||
}
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
zoom_icon->set_texture(get_theme_icon(SNAME("Zoom"), SNAME("EditorIcons")));
|
||||
bezier_edit_icon->set_icon(get_theme_icon(SNAME("EditBezier"), SNAME("EditorIcons")));
|
||||
snap->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons")));
|
||||
view_group->set_icon(get_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup"), SNAME("EditorIcons")));
|
||||
selected_filter->set_icon(get_theme_icon(SNAME("AnimationFilter"), SNAME("EditorIcons")));
|
||||
imported_anim_warning->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")));
|
||||
zoom_icon->set_texture(get_editor_theme_icon(SNAME("Zoom")));
|
||||
bezier_edit_icon->set_icon(get_editor_theme_icon(SNAME("EditBezier")));
|
||||
snap->set_icon(get_editor_theme_icon(SNAME("Snap")));
|
||||
view_group->set_icon(get_editor_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup")));
|
||||
selected_filter->set_icon(get_editor_theme_icon(SNAME("AnimationFilter")));
|
||||
imported_anim_warning->set_icon(get_editor_theme_icon(SNAME("NodeWarning")));
|
||||
main_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("Tree")));
|
||||
edit->get_popup()->set_item_icon(edit->get_popup()->get_item_index(EDIT_APPLY_RESET), get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
|
||||
edit->get_popup()->set_item_icon(edit->get_popup()->get_item_index(EDIT_APPLY_RESET), get_editor_theme_icon(SNAME("Reload")));
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_READY: {
|
||||
@@ -5312,8 +5313,8 @@ float AnimationTrackEditor::get_moving_selection_offset() const {
|
||||
|
||||
void AnimationTrackEditor::_box_selection_draw() {
|
||||
const Rect2 selection_rect = Rect2(Point2(), box_selection->get_size());
|
||||
box_selection->draw_rect(selection_rect, get_theme_color(SNAME("box_selection_fill_color"), SNAME("Editor")));
|
||||
box_selection->draw_rect(selection_rect, get_theme_color(SNAME("box_selection_stroke_color"), SNAME("Editor")), false, Math::round(EDSCALE));
|
||||
box_selection->draw_rect(selection_rect, get_theme_color(SNAME("box_selection_fill_color"), EditorStringName(Editor)));
|
||||
box_selection->draw_rect(selection_rect, get_theme_color(SNAME("box_selection_stroke_color"), EditorStringName(Editor)), false, Math::round(EDSCALE));
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
|
||||
@@ -5590,10 +5591,10 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
||||
}
|
||||
|
||||
String text;
|
||||
Ref<Texture2D> icon = get_theme_icon(SNAME("Node"), SNAME("EditorIcons"));
|
||||
Ref<Texture2D> icon = get_editor_theme_icon(SNAME("Node"));
|
||||
if (node) {
|
||||
if (has_theme_icon(node->get_class(), SNAME("EditorIcons"))) {
|
||||
icon = get_theme_icon(node->get_class(), SNAME("EditorIcons"));
|
||||
if (has_theme_icon(node->get_class(), EditorStringName(EditorIcons))) {
|
||||
icon = get_editor_theme_icon(node->get_class());
|
||||
}
|
||||
|
||||
text = node->get_name();
|
||||
@@ -6249,7 +6250,7 @@ void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) {
|
||||
|
||||
void AnimationTrackEditor::_view_group_toggle() {
|
||||
_update_tracks();
|
||||
view_group->set_icon(get_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup"), SNAME("EditorIcons")));
|
||||
view_group->set_icon(get_editor_theme_icon(view_group->is_pressed() ? SNAME("AnimationTrackList") : SNAME("AnimationTrackGroup")));
|
||||
bezier_edit->set_filtered(selected_filter->is_pressed());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user