summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-09-12 13:29:28 +0200
committerGitHub <noreply@github.com>2017-09-12 13:29:28 +0200
commit0e8f44016e3aea614a35b531887ad2df2e36df0d (patch)
tree8476116ec118f13872b9f31b0787a94cd989d8ed
parent6aa90e35bb57c8465e99693a24d89ce7f39a2af3 (diff)
parente835d80a3f673cb12dbad71b90469243bf9b55ab (diff)
Merge pull request #11020 from toger5/theme_animation_editor_colors
removed hardcoded color and added theme update for animation editor
-rw-r--r--editor/animation_editor.cpp75
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp130
2 files changed, 106 insertions, 99 deletions
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 702adf0c68..f4e3bf4894 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -1092,10 +1092,14 @@ void AnimationKeyEditor::_track_editor_draw() {
int sep = get_constant("vseparation", "Tree");
int hsep = get_constant("hseparation", "Tree");
Color color = get_color("font_color", "Tree");
- Color sepcolor = Color(1, 1, 1, 0.2);
- Color timecolor = Color(1, 1, 1, 0.2);
- Color hover_color = Color(1, 1, 1, 0.05);
- Color select_color = Color(1, 1, 1, 0.1);
+ Color sepcolor = color;
+ sepcolor.a = 0.2;
+ Color timecolor = color;
+ timecolor.a = 0.2;
+ Color hover_color = color;
+ hover_color.a = 0.05;
+ Color select_color = color;
+ select_color.a = 0.1;
Color invalid_path_color = get_color("error_color", "Editor");
Color track_select_color = get_color("highlight_color", "Editor");
@@ -1157,7 +1161,8 @@ void AnimationKeyEditor::_track_editor_draw() {
int settings_limit = size.width - right_separator_ofs;
int name_limit = settings_limit * name_column_ratio;
- Color linecolor = Color(1, 1, 1, 0.2);
+ Color linecolor = color;
+ linecolor.a = 0.2;
te->draw_line(ofs + Point2(name_limit, 0), ofs + Point2(name_limit, size.height), linecolor);
te->draw_line(ofs + Point2(settings_limit, 0), ofs + Point2(settings_limit, size.height), linecolor);
te->draw_texture(hsize_icon, ofs + Point2(name_limit - hsize_icon->get_width() - hsep, (h - hsize_icon->get_height()) / 2));
@@ -2890,11 +2895,9 @@ void AnimationKeyEditor::_notification(int p_what) {
key_editor->edit(key_edit);
- zoomicon->set_texture(get_icon("Zoom", "EditorIcons"));
zoomicon->set_custom_minimum_size(Size2(24 * EDSCALE, 0));
zoomicon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
- menu_add_track->set_icon(get_icon("Add", "EditorIcons"));
menu_add_track->get_popup()->add_icon_item(get_icon("KeyValue", "EditorIcons"), "Add Normal Track", ADD_TRACK_MENU_ADD_VALUE_TRACK);
menu_add_track->get_popup()->add_icon_item(get_icon("KeyXform", "EditorIcons"), "Add Transform Track", ADD_TRACK_MENU_ADD_TRANSFORM_TRACK);
menu_add_track->get_popup()->add_icon_item(get_icon("KeyCall", "EditorIcons"), "Add Call Func Track", ADD_TRACK_MENU_ADD_CALL_TRACK);
@@ -2921,18 +2924,10 @@ void AnimationKeyEditor::_notification(int p_what) {
optimize_dialog->connect("confirmed", this, "_animation_optimize");
menu_track->get_popup()->add_child(tpp);
- //menu_track->get_popup()->add_submenu_item("Set Transitions..","Transitions");
- //menu_track->get_popup()->add_separator();
+
menu_track->get_popup()->add_item(TTR("Optimize Animation"), TRACK_MENU_OPTIMIZE);
menu_track->get_popup()->add_item(TTR("Clean-Up Animation"), TRACK_MENU_CLEAN_UP);
- curve_linear->set_icon(get_icon("CurveLinear", "EditorIcons"));
- curve_in->set_icon(get_icon("CurveIn", "EditorIcons"));
- curve_out->set_icon(get_icon("CurveOut", "EditorIcons"));
- curve_inout->set_icon(get_icon("CurveInOut", "EditorIcons"));
- curve_outin->set_icon(get_icon("CurveOutIn", "EditorIcons"));
- curve_constant->set_icon(get_icon("CurveConstant", "EditorIcons"));
-
curve_linear->connect("pressed", this, "_menu_track", varray(CURVE_SET_LINEAR));
curve_in->connect("pressed", this, "_menu_track", varray(CURVE_SET_IN));
curve_out->connect("pressed", this, "_menu_track", varray(CURVE_SET_OUT));
@@ -2940,17 +2935,39 @@ void AnimationKeyEditor::_notification(int p_what) {
curve_outin->connect("pressed", this, "_menu_track", varray(CURVE_SET_OUTIN));
curve_constant->connect("pressed", this, "_menu_track", varray(CURVE_SET_CONSTANT));
+ edit_button->connect("pressed", this, "_toggle_edit_curves");
+
+ curve_edit->connect("transition_changed", this, "_curve_transition_changed");
+ call_select->connect("selected", this, "_add_call_track");
+
+ _update_menu();
+
+ } break;
+
+ case NOTIFICATION_THEME_CHANGED: {
+ zoomicon->set_texture(get_icon("Zoom", "EditorIcons"));
+
+ menu_add_track->set_icon(get_icon("Add", "EditorIcons"));
+
+ menu_track->set_icon(get_icon("Tools", "EditorIcons"));
+
+ menu_add_track->get_popup()->set_item_icon(ADD_TRACK_MENU_ADD_VALUE_TRACK, get_icon("KeyValue", "EditorIcons"));
+ menu_add_track->get_popup()->set_item_icon(ADD_TRACK_MENU_ADD_TRANSFORM_TRACK, get_icon("KeyXform", "EditorIcons"));
+ menu_add_track->get_popup()->set_item_icon(ADD_TRACK_MENU_ADD_CALL_TRACK, get_icon("KeyCall", "EditorIcons"));
+
+ curve_linear->set_icon(get_icon("CurveLinear", "EditorIcons"));
+ curve_in->set_icon(get_icon("CurveIn", "EditorIcons"));
+ curve_out->set_icon(get_icon("CurveOut", "EditorIcons"));
+ curve_inout->set_icon(get_icon("CurveInOut", "EditorIcons"));
+ curve_outin->set_icon(get_icon("CurveOutIn", "EditorIcons"));
+ curve_constant->set_icon(get_icon("CurveConstant", "EditorIcons"));
+
move_up_button->set_icon(get_icon("MoveUp", "EditorIcons"));
move_down_button->set_icon(get_icon("MoveDown", "EditorIcons"));
remove_button->set_icon(get_icon("Remove", "EditorIcons"));
edit_button->set_icon(get_icon("EditKey", "EditorIcons"));
- edit_button->connect("pressed", this, "_toggle_edit_curves");
loop->set_icon(get_icon("Loop", "EditorIcons"));
- curve_edit->connect("transition_changed", this, "_curve_transition_changed");
-
- //edit_button->add_color_override("font_color",get_color("font_color","Tree"));
- //edit_button->add_color_override("font_color_hover",get_color("font_color","Tree"));
{
@@ -2976,24 +2993,8 @@ void AnimationKeyEditor::_notification(int p_what) {
get_icon("InterpWrapClamp", "EditorIcons"),
get_icon("InterpWrapLoop", "EditorIcons"),
};
-
- //right_data_size_cache = remove_icon->get_width() + move_up_icon->get_width() + move_down_icon->get_width() + down_icon->get_width() *2 + interp_icon[0]->get_width() + cont_icon[0]->get_width() + add_key_icon->get_width() + hsep*11;
right_data_size_cache = down_icon->get_width() * 3 + add_key_icon->get_width() + interp_icon[0]->get_width() + cont_icon[0]->get_width() + wrap_icon[0]->get_width() + hsep * 8;
}
- call_select->connect("selected", this, "_add_call_track");
- //rename_anim->set_icon( get_icon("Rename","EditorIcons") );
- /*
- edit_anim->set_icon( get_icon("Edit","EditorIcons") );
- blend_anim->set_icon( get_icon("Blend","EditorIcons") );
- play->set_icon( get_icon("Play","EditorIcons") );
- stop->set_icon( get_icon("Stop","EditorIcons") );
- pause->set_icon( get_icon("Pause","EditorIcons") );
-*/
- //menu->set_icon(get_icon("Animation","EditorIcons"));
- //play->set_icon(get_icon("AnimationPlay","EditorIcons"));
- //menu->set_icon(get_icon("Animation","EditorIcons"));
- _update_menu();
-
} break;
}
}
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index cc7fc57cde..d7762a66df 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -55,79 +55,87 @@ void AnimationPlayerEditor::_gui_input(Ref<InputEvent> p_event) {
}
void AnimationPlayerEditor::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_PROCESS: {
- if (p_what == NOTIFICATION_PROCESS) {
-
- if (!player)
- return;
+ if (!player)
+ return;
- updating = true;
+ updating = true;
- if (player->is_playing()) {
+ if (player->is_playing()) {
- {
- String animname = player->get_current_animation();
+ {
+ String animname = player->get_current_animation();
- if (player->has_animation(animname)) {
- Ref<Animation> anim = player->get_animation(animname);
- if (!anim.is_null()) {
+ if (player->has_animation(animname)) {
+ Ref<Animation> anim = player->get_animation(animname);
+ if (!anim.is_null()) {
- frame->set_max(anim->get_length());
+ frame->set_max(anim->get_length());
+ }
}
}
+ frame->set_value(player->get_current_animation_pos());
+ key_editor->set_anim_pos(player->get_current_animation_pos());
+ EditorNode::get_singleton()->get_property_editor()->refresh();
+
+ } else if (last_active) {
+ //need the last frame after it stopped
+
+ frame->set_value(player->get_current_animation_pos());
}
- frame->set_value(player->get_current_animation_pos());
- key_editor->set_anim_pos(player->get_current_animation_pos());
- EditorNode::get_singleton()->get_property_editor()->refresh();
- } else if (last_active) {
- //need the last frame after it stopped
+ last_active = player->is_playing();
+ //seek->set_val(player->get_position());
+ updating = false;
- frame->set_value(player->get_current_animation_pos());
- }
+ } break;
- last_active = player->is_playing();
- //seek->set_val(player->get_position());
- updating = false;
- }
+ case NOTIFICATION_ENTER_TREE: {
+
+ save_anim->get_popup()->connect("id_pressed", this, "_animation_save_menu");
+
+ tool_anim->get_popup()->connect("id_pressed", this, "_animation_tool_menu");
+
+ blend_editor.next->connect("item_selected", this, "_blend_editor_next_changed");
- if (p_what == NOTIFICATION_ENTER_TREE) {
-
- //editor->connect("hide_animation_player_editors",this,"_hide_anim_editors");
- add_anim->set_icon(get_icon("New", "EditorIcons"));
- rename_anim->set_icon(get_icon("Rename", "EditorIcons"));
- duplicate_anim->set_icon(get_icon("Duplicate", "EditorIcons"));
- autoplay->set_icon(get_icon("AutoPlay", "EditorIcons"));
- load_anim->set_icon(get_icon("Folder", "EditorIcons"));
- save_anim->set_icon(get_icon("Save", "EditorIcons"));
- save_anim->get_popup()->connect("id_pressed", this, "_animation_save_menu");
- remove_anim->set_icon(get_icon("Remove", "EditorIcons"));
-
- blend_anim->set_icon(get_icon("Blend", "EditorIcons"));
- play->set_icon(get_icon("PlayStart", "EditorIcons"));
- play_from->set_icon(get_icon("Play", "EditorIcons"));
- play_bw->set_icon(get_icon("PlayStartBackwards", "EditorIcons"));
- play_bw_from->set_icon(get_icon("PlayBackwards", "EditorIcons"));
-
- autoplay_icon = get_icon("AutoPlay", "EditorIcons");
- stop->set_icon(get_icon("Stop", "EditorIcons"));
- resource_edit_anim->set_icon(get_icon("EditResource", "EditorIcons"));
- pin->set_icon(get_icon("Pin", "EditorIcons"));
- tool_anim->set_icon(get_icon("Tools", "EditorIcons"));
- tool_anim->get_popup()->connect("id_pressed", this, "_animation_tool_menu");
-
- blend_editor.next->connect("item_selected", this, "_blend_editor_next_changed");
-
- /*
- anim_editor_load->set_normal_texture( get_icon("AnimGet","EditorIcons"));
- anim_editor_store->set_normal_texture( get_icon("AnimSet","EditorIcons"));
- anim_editor_load->set_pressed_texture( get_icon("AnimGet","EditorIcons"));
- anim_editor_store->set_pressed_texture( get_icon("AnimSet","EditorIcons"));
- anim_editor_load->set_hover_texture( get_icon("AnimGetHl","EditorIcons"));
- anim_editor_store->set_hover_texture( get_icon("AnimSetHl","EditorIcons"));
-*/
-
- get_tree()->connect("node_removed", this, "_node_removed");
+ get_tree()->connect("node_removed", this, "_node_removed");
+
+ add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
+ add_constant_override("separation", get_constant("separation", "VBoxContainer"));
+ } break;
+
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+
+ add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
+ add_constant_override("separation", get_constant("separation", "VBoxContainer"));
+ } break;
+
+ case NOTIFICATION_THEME_CHANGED: {
+
+ add_anim->set_icon(get_icon("New", "EditorIcons"));
+ rename_anim->set_icon(get_icon("Rename", "EditorIcons"));
+ duplicate_anim->set_icon(get_icon("Duplicate", "EditorIcons"));
+ autoplay->set_icon(get_icon("AutoPlay", "EditorIcons"));
+ load_anim->set_icon(get_icon("Folder", "EditorIcons"));
+ save_anim->set_icon(get_icon("Save", "EditorIcons"));
+
+ remove_anim->set_icon(get_icon("Remove", "EditorIcons"));
+
+ blend_anim->set_icon(get_icon("Blend", "EditorIcons"));
+ play->set_icon(get_icon("PlayStart", "EditorIcons"));
+ play_from->set_icon(get_icon("Play", "EditorIcons"));
+ play_bw->set_icon(get_icon("PlayStartBackwards", "EditorIcons"));
+ play_bw_from->set_icon(get_icon("PlayBackwards", "EditorIcons"));
+
+ autoplay_icon = get_icon("AutoPlay", "EditorIcons");
+ stop->set_icon(get_icon("Stop", "EditorIcons"));
+ resource_edit_anim->set_icon(get_icon("EditResource", "EditorIcons"));
+ pin->set_icon(get_icon("Pin", "EditorIcons"));
+ tool_anim->set_icon(get_icon("Tools", "EditorIcons"));
+
+ } break;
}
}
@@ -1176,7 +1184,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
set_focus_mode(FOCUS_ALL);
player = NULL;
- add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
Label *l;
@@ -1376,7 +1383,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
key_editor = memnew(AnimationKeyEditor);
add_child(key_editor);
- add_constant_override("separation", get_constant("separation", "VBoxContainer"));
key_editor->set_v_size_flags(SIZE_EXPAND_FILL);
key_editor->connect("timeline_changed", this, "_animation_key_editor_seek");
key_editor->connect("animation_len_changed", this, "_animation_key_editor_anim_len_changed");