diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2017-04-15 19:48:10 +0200 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2017-04-17 01:51:30 +0200 |
commit | 4b8568006d1f83d518d98ef3c7354b7c25de46cc (patch) | |
tree | 62d39934c808c4a53ea27fc6e1771b7b57da7136 /modules/visual_script | |
parent | fce779a4ef02f1b14f95cab6a06e75db170f3448 (diff) |
External editor improvements and fixes
Notable changes:
- Now ScriptLanguages have the option to override the global external editor setting.
If `ScriptLanguage::open_in_external_editor()` returns `ERR_UNAVAILABLE` (which it does by default), then the global external editor option will be used.
- Added formatting to the external editor execution arguments. Now it's possible to write something like this: `{project} -g {file}:{line}:{col}`.
- `VisualScript::get_member_line()` now can return the line of functions (well, it returns the id of the _Function_ node of the function). I guess there is nothing else we can get a "line" from.
Fixes:
- Fixes a bug where `ScriptEditor::script_goto_method()` would not work if the script is not already open in the built-in editor.
- Fixes wrong DEFVAL for `cursor_set_column` and `cursor_set_line` in TextEdit.
- `Script::get_member_line()` now returns -1 ("found nothing") by default.
Diffstat (limited to 'modules/visual_script')
-rw-r--r-- | modules/visual_script/visual_script.cpp | 12 | ||||
-rw-r--r-- | modules/visual_script/visual_script.h | 2 | ||||
-rw-r--r-- | modules/visual_script/visual_script_editor.cpp | 14 | ||||
-rw-r--r-- | modules/visual_script/visual_script_editor.h | 1 |
4 files changed, 15 insertions, 14 deletions
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 53521c55a7..aec60391d3 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -1073,6 +1073,18 @@ void VisualScript::get_script_property_list(List<PropertyInfo> *p_list) const { } } +int VisualScript::get_member_line(const StringName &p_member) const { +#ifdef TOOLS_ENABLED + if (has_function(p_member)) { + for (Map<int, Function::NodeData>::Element *E = functions[p_member].nodes.front(); E; E = E->next()) { + if (E->get().node->cast_to<VisualScriptFunction>()) + return E->key(); + } + } +#endif + return -1; +} + #ifdef TOOLS_ENABLED bool VisualScript::are_subnodes_edited() const { diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index ee8ed2c965..273a819611 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -356,6 +356,8 @@ public: virtual void get_script_property_list(List<PropertyInfo> *p_list) const; + virtual int get_member_line(const StringName &p_member) const; + #ifdef TOOLS_ENABLED virtual bool are_subnodes_edited() const; #endif diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index ee5bd66aa2..5a765f9342 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -2153,7 +2153,7 @@ void VisualScriptEditor::goto_line(int p_line, bool p_with_error) { _update_graph(); _update_members(); - call_deferred("_center_on_node", p_line); //editor might be just created and size might not exist yet + call_deferred("call_deferred", "_center_on_node", p_line); //editor might be just created and size might not exist yet return; } @@ -2192,18 +2192,6 @@ void VisualScriptEditor::get_breakpoints(List<int> *p_breakpoints) { } } -bool VisualScriptEditor::goto_method(const String &p_method) { - - if (!script->has_function(p_method)) - return false; - - edited_func = p_method; - selected = edited_func; - _update_members(); - _update_graph(); - return true; -} - void VisualScriptEditor::add_callback(const String &p_function, PoolStringArray p_args) { if (script->has_function(p_function)) { diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 7322da5cfb..52f5d28a36 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -244,7 +244,6 @@ public: virtual void tag_saved_version(); virtual void reload(bool p_soft); virtual void get_breakpoints(List<int> *p_breakpoints); - virtual bool goto_method(const String &p_method); virtual void add_callback(const String &p_function, PoolStringArray p_args); virtual void update_settings(); virtual void set_debugger_active(bool p_active); |