Fix: Create script template not working as expected
This commit is contained in:
parent
68b2aaf9d5
commit
59537138bc
|
@ -611,7 +611,7 @@ void LimboAIEditor::_misc_option_selected(int p_id) {
|
||||||
|
|
||||||
if (!FILE_EXISTS(template_path)) {
|
if (!FILE_EXISTS(template_path)) {
|
||||||
if (!DirAccess::dir_exists_absolute(template_dir)) {
|
if (!DirAccess::dir_exists_absolute(template_dir)) {
|
||||||
Error err = DirAccess::make_dir_absolute(template_dir);
|
Error err = DirAccess::make_dir_recursive_absolute(template_dir);
|
||||||
ERR_FAIL_COND(err != OK);
|
ERR_FAIL_COND(err != OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,12 +644,18 @@ void LimboAIEditor::_misc_option_selected(int p_id) {
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"# Called each time this task is ticked (aka executed).\n"
|
"# Called each time this task is ticked (aka executed).\n"
|
||||||
"func _tick(delta: float) -> Status:\n"
|
"func _tick(delta: float) -> Status:\n"
|
||||||
"_TS_return SUCCESS\n";
|
"_TS_return SUCCESS\n"
|
||||||
|
"\n\n"
|
||||||
|
"# Strings returned from this method are displayed as warnings in the behavior tree editor (requires @tool).\n"
|
||||||
|
"func _get_configuration_warnings() -> PackedStringArray:\n"
|
||||||
|
"_TS_var warnings := PackedStringArray()\n"
|
||||||
|
"_TS_return warnings\n";
|
||||||
|
|
||||||
f->store_string(script_template);
|
f->store_string(script_template);
|
||||||
f->close();
|
f->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EDITOR_FILE_SYSTEM()->scan();
|
||||||
EDIT_SCRIPT(template_path);
|
EDIT_SCRIPT(template_path);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ void EDIT_SCRIPT(const String &p_path) {
|
||||||
Ref<Script> res = RESOURCE_LOAD(p_path, "Script");
|
Ref<Script> res = RESOURCE_LOAD(p_path, "Script");
|
||||||
ERR_FAIL_COND_MSG(res.is_null(), "Failed to load script: " + p_path);
|
ERR_FAIL_COND_MSG(res.is_null(), "Failed to load script: " + p_path);
|
||||||
EditorInterface::get_singleton()->edit_script(res);
|
EditorInterface::get_singleton()->edit_script(res);
|
||||||
|
EditorInterface::get_singleton()->set_main_screen_editor("Script");
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed, bool p_ignore_value_in_docs, bool p_basic, bool p_internal) {
|
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed, bool p_ignore_value_in_docs, bool p_basic, bool p_internal) {
|
||||||
|
|
Loading…
Reference in New Issue