diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_editor.cpp | 4 | ||||
-rw-r--r-- | editor/editor_data.cpp | 4 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 33 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 4 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 6 |
6 files changed, 45 insertions, 8 deletions
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index 7e49d1300c..91aa189c8f 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -3119,12 +3119,12 @@ void AnimationKeyEditor::set_animation(const Ref<Animation> &p_anim) { void AnimationKeyEditor::set_root(Node *p_root) { if (root) - root->disconnect("tree_exited", this, "_root_removed"); + root->disconnect("tree_exiting", this, "_root_removed"); root = p_root; if (root) - root->connect("tree_exited", this, "_root_removed", make_binds(), CONNECT_ONESHOT); + root->connect("tree_exiting", this, "_root_removed", make_binds(), CONNECT_ONESHOT); } Node *AnimationKeyEditor::get_root() const { diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 374688f2db..95ed40d889 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -829,7 +829,7 @@ void EditorSelection::add_node(Node *p_node) { } selection[p_node] = meta; - p_node->connect("tree_exited", this, "_node_removed", varray(p_node), CONNECT_ONESHOT); + p_node->connect("tree_exiting", this, "_node_removed", varray(p_node), CONNECT_ONESHOT); //emit_signal("selection_changed"); } @@ -847,7 +847,7 @@ void EditorSelection::remove_node(Node *p_node) { if (meta) memdelete(meta); selection.erase(p_node); - p_node->disconnect("tree_exited", this, "_node_removed"); + p_node->disconnect("tree_exiting", this, "_node_removed"); //emit_signal("selection_changed"); } bool EditorSelection::is_selected(Node *p_node) const { diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 9fda9d2ff6..9f031b5a80 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1053,7 +1053,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color word_highlighted_color = alpha1; const Color number_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3); const Color function_color = main_color; - const Color member_variable_color = mono_color; + const Color member_variable_color = main_color.linear_interpolate(mono_color, 0.6); const Color mark_color = Color(error_color.r, error_color.g, error_color.b, 0.3); const Color breakpoint_color = error_color; const Color code_folding_color = alpha4; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index f1ed984fee..2a6b4ee173 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -63,6 +63,7 @@ void ScriptTextEditor::apply_code() { //print_line("applying code"); script->set_source_code(code_editor->get_text_edit()->get_text()); script->update_exports(); + _update_member_keywords(); } Ref<Script> ScriptTextEditor::get_edited_script() const { @@ -70,6 +71,37 @@ Ref<Script> ScriptTextEditor::get_edited_script() const { return script; } +void ScriptTextEditor::_update_member_keywords() { + member_keywords.clear(); + code_editor->get_text_edit()->clear_member_keywords(); + Color member_variable_color = EDITOR_GET("text_editor/highlighting/member_variable_color"); + + StringName instance_base = script->get_instance_base_type(); + + if (instance_base == StringName()) + return; + List<PropertyInfo> plist; + ClassDB::get_property_list(instance_base, &plist); + + for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) { + String name = E->get().name; + if (E->get().usage & PROPERTY_USAGE_CATEGORY || E->get().usage & PROPERTY_USAGE_GROUP) + continue; + if (name.find("/") != -1) + continue; + + code_editor->get_text_edit()->add_member_keyword(name, member_variable_color); + } + + List<String> clist; + ClassDB::get_integer_constant_list(instance_base, &clist); + + for (List<String>::Element *E = clist.front(); E; E = E->next()) { + + code_editor->get_text_edit()->add_member_keyword(E->get(), member_variable_color); + } +} + void ScriptTextEditor::_load_theme_settings() { TextEdit *text_edit = code_editor->get_text_edit(); @@ -563,6 +595,7 @@ void ScriptTextEditor::_validate_script() { if (!script->is_tool()) { script->set_source_code(text); script->update_exports(); + _update_member_keywords(); //script->reload(); //will update all the variables in property editors } diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index ebbe865cee..22e8fbce25 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -44,6 +44,8 @@ class ScriptTextEditor : public ScriptEditorBase { Vector<String> functions; + Vector<String> member_keywords; + HBoxContainer *edit_hb; MenuButton *edit_menu; @@ -58,6 +60,8 @@ class ScriptTextEditor : public ScriptEditorBase { int color_line; String color_args; + void _update_member_keywords(); + struct ColorsCache { Color symbol_color; Color keyword_color; diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index b677017371..cef1da1d06 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2689,7 +2689,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { if (!p_activate) { - previewing->disconnect("tree_exited", this, "_preview_exited_scene"); + previewing->disconnect("tree_exiting", this, "_preview_exited_scene"); previewing = NULL; VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore if (!preview) @@ -2700,7 +2700,7 @@ void SpatialEditorViewport::_toggle_camera_preview(bool p_activate) { } else { previewing = preview; - previewing->connect("tree_exited", this, "_preview_exited_scene"); + previewing->connect("tree_exiting", this, "_preview_exited_scene"); VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), preview->get_camera()); //replace view_menu->hide(); surface->update(); @@ -2851,7 +2851,7 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) { Node *pv = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["previewing"]); if (Object::cast_to<Camera>(pv)) { previewing = Object::cast_to<Camera>(pv); - previewing->connect("tree_exited", this, "_preview_exited_scene"); + previewing->connect("tree_exiting", this, "_preview_exited_scene"); VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), previewing->get_camera()); //replace view_menu->hide(); surface->update(); |