-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix setting file doesn't get read AND memory leak fix
- actually an important patch since the first release the setting file doesn't work at all - script/unused now getting gitignored - found memory leak (`push_input` error), fixed with new method of switching scene (very fast timer) - new option to set volume of audioplayer - `test_save_feature_on_editor` typo fix - automatically update config file if a new category (key) is added - `OS.has_feature("standalone")` changed to `OS.has_feature("template")` (the correct working one) - main window is minimized now on `no_ending_screen` - updated export presets with exclusion - new editorscript `toggleaddons`. This script modifies project.godot, used to disable addons i used locally (discord rpc and script ide) before push the repo. running the script again will enable the addon back. disabled addons are saved in `disabledaddons.cfg`
- Loading branch information
1 parent
990cfc4
commit bcc40be
Showing
11 changed files
with
143 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[autoload] | ||
|
||
DiscordSDKLoader="*res://addons/discord-sdk-gd/nodes/discord_autoload.gd" | ||
MyDiscordRPC="*res://scripts/autoloads/discordrpc.gd" | ||
|
||
[editor_plugins] | ||
|
||
enabled=PackedStringArray("res://addons/discord-sdk-gd/plugin.cfg", "res://addons/script-ide/plugin.cfg") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@tool | ||
extends EditorScript | ||
|
||
var mode_disableplugin = false | ||
var projectsettingfile_path = "res://project.godot" | ||
var disabledaddonsfile_path = "res://disabledaddons.cfg" | ||
func config_check_and_remove(config : ConfigFile, disabledconfig : ConfigFile, section, key): | ||
if config.has_section_key(section, key): | ||
disabledconfig.set_value(section, key, config.get_value(section, key)) | ||
config.set_value(section, key, null) | ||
mode_disableplugin = true | ||
|
||
func get_array_of_comments(projectsettingtext : String) -> Array: | ||
var settingtextarray = projectsettingtext.split("\n") | ||
var projectsettingcomment : Array | ||
for line in settingtextarray: | ||
if line.begins_with(";"): | ||
projectsettingcomment.append(line) | ||
return projectsettingcomment | ||
|
||
func open_file_and_get_text(filepath : String) -> String: | ||
var file = FileAccess.open(filepath, FileAccess.READ) | ||
var textfromfile : String = file.get_as_text() | ||
file.close() | ||
return textfromfile | ||
|
||
# Called when the script is executed (using File -> Run in Script Editor). | ||
func _run(): | ||
var projectsettingtext = open_file_and_get_text(projectsettingfile_path) # res://project.godot # res://project.godot_test.cfg | ||
var projectsettingcomment = get_array_of_comments(projectsettingtext) | ||
|
||
var projectconfig = ConfigFile.new() | ||
var disabledconfig = ConfigFile.new() | ||
projectconfig.parse(projectsettingtext) | ||
config_check_and_remove(projectconfig, disabledconfig, "autoload", "DiscordSDKLoader") | ||
config_check_and_remove(projectconfig, disabledconfig, "autoload", "MyDiscordRPC") | ||
config_check_and_remove(projectconfig, disabledconfig, "editor_plugins", "enabled") | ||
|
||
var configtext | ||
if mode_disableplugin: | ||
disabledconfig.save(disabledaddonsfile_path) | ||
print("Active addons now deactivated. Please reload the project on Project > Reload Current Project") | ||
else: | ||
projectconfig.load(projectsettingfile_path) | ||
disabledconfig.load(disabledaddonsfile_path) | ||
for section in disabledconfig.get_sections(): | ||
for key in disabledconfig.get_section_keys(section): | ||
projectconfig.set_value(section, key, disabledconfig.get_value(section, key)) | ||
disabledconfig.set_value(section, key, null) | ||
disabledconfig.save(disabledaddonsfile_path) | ||
print("Inactive addons now reactivated. Please reload the project on Project > Reload Current Project") | ||
|
||
configtext = projectconfig.encode_to_text() | ||
var projectsettingfile = FileAccess.open(projectsettingfile_path, FileAccess.WRITE) | ||
for line in projectsettingcomment: | ||
projectsettingfile.store_line(line) | ||
projectsettingfile.store_line("") # extra empty line | ||
projectsettingfile.store_string(configtext) | ||
projectsettingfile.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.