Conversation
worron
requested changes
Sep 10, 2024
Collaborator
worron
left a comment
There was a problem hiding this comment.
Seems like some fixes required.
Comment on lines
+66
to
+75
| static func _get_key(keys:Array[String]) -> String: | ||
| return ".".join(keys) | ||
|
|
||
| static func get_value(keys:Array[String], default:Variant = null) -> Variant: | ||
| var key := _get_key(keys) | ||
| var cfg := _get_config() | ||
| return cfg.get(key, default) | ||
|
|
||
| static func set_value(key:String, val:Variant) -> void: | ||
| var config = _get_config(USER_CONFIG_FILE_PATH) | ||
| config[key] = val | ||
| set_config(config) | ||
| static func set_value(keys:Array[String], val:Variant) -> void: | ||
| var key := _get_key(keys) |
Collaborator
There was a problem hiding this comment.
This cause many errors for me, since every PankuConfig.set_value/PankuConfig.get_value I can see have String as first argument, not array. I miss the point why key array and join used here.
Seems it works fine with key-value args
static func get_value(key: String, default:Variant = null) -> Variant:
var cfg := _get_config()
return cfg.get(key, default)
static func set_value(key: String, val:Variant) -> void:
var cfg := _get_config()
cfg[key] = val
save_config_with_delay()
Comment on lines
+9
to
+12
| "engine_tools": { | ||
| "time_scale": "1" | ||
| }, | ||
| "engine_tools.time_scale": "1", |
Collaborator
There was a problem hiding this comment.
Is not it some kind of duplication? Which dictionary structure was originally planned: nested or plain with joined keys?
|
|
||
| const INITIAL_DEFAULT_CONFIG_FILE_PATH = "res://addons/panku_console/default_panku_config.cfg" | ||
| const USER_CONFIG_FILE_PATH = "user://panku_config.cfg" | ||
| const INITIAL_DEFAULT_CONFIG_FILE_PATH = "res://addons/panku_console/default_panku_config.tres" |
Collaborator
There was a problem hiding this comment.
I believe we need to change file extension hint here too.
Also, do we need to keep default_panku_config.cfg file in project or may be we can delete it within this pull request?
Owner
Author
|
a new pr has been upload #195 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
str_to_var(), so you can edit default config (default_panku_config.tres) in godot editor.set_valueand to better adapt something like slider value realtime change saving.