Allow opening and editing of any utf_8 file in script editor

This commit is contained in:
Paulb23
2018-05-28 16:52:28 +01:00
parent e33ab40567
commit 97dd489974
2 changed files with 14 additions and 15 deletions

View File

@@ -1962,22 +1962,16 @@ void VisualScriptEditor::_button_resource_previewed(const String &p_path, const
void VisualScriptEditor::apply_code() {
}
Ref<Script> VisualScriptEditor::get_edited_script() const {
RES VisualScriptEditor::get_edited_resource() const {
return script;
}
Vector<String> VisualScriptEditor::get_functions() {
void VisualScriptEditor::set_edited_resource(const RES &p_res) {
return Vector<String>();
}
void VisualScriptEditor::set_edited_script(const Ref<Script> &p_script) {
script = p_script;
signal_editor->script = p_script;
script = p_res;
signal_editor->script = script;
signal_editor->undo_redo = undo_redo;
variable_editor->script = p_script;
variable_editor->script = script;
variable_editor->undo_redo = undo_redo;
script->connect("node_ports_changed", this, "_node_ports_changed");
@@ -1986,6 +1980,11 @@ void VisualScriptEditor::set_edited_script(const Ref<Script> &p_script) {
_update_available_nodes();
}
Vector<String> VisualScriptEditor::get_functions() {
return Vector<String>();
}
void VisualScriptEditor::reload_text() {
}
@@ -3515,9 +3514,9 @@ VisualScriptEditor::~VisualScriptEditor() {
memdelete(variable_editor);
}
static ScriptEditorBase *create_editor(const Ref<Script> &p_script) {
static ScriptEditorBase *create_editor(const RES &p_resource) {
if (Object::cast_to<VisualScript>(*p_script)) {
if (Object::cast_to<VisualScript>(*p_resource)) {
return memnew(VisualScriptEditor);
}

View File

@@ -250,9 +250,9 @@ public:
virtual void set_syntax_highlighter(SyntaxHighlighter *p_highlighter);
virtual void apply_code();
virtual Ref<Script> get_edited_script() const;
virtual RES get_edited_resource() const;
virtual void set_edited_resource(const RES &p_res);
virtual Vector<String> get_functions();
virtual void set_edited_script(const Ref<Script> &p_script);
virtual void reload_text();
virtual String get_name();
virtual Ref<Texture> get_icon();