Skip to content

Commit

Permalink
Fix minor issues in the editor plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
ephread committed Dec 20, 2021
1 parent 78d2d88 commit ce6123c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .inkgd_ink.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ stories=[ {
"source_file_path": "res://examples/ink/ld41_emoji/ld41_emoji.ink",
"target_file_path": "res://examples/ink/ld41_emoji/ld41_emoji.ink.json",
"watched_folder_path": "res://examples/ink/ld41_emoji"
}, {
"source_file_path": "res://examples/ink/not_a_halloween_game/not_a_halloween_game.ink",
"target_file_path": "res://examples/ink/not_a_halloween_game/not_a_halloween_game.ink.json",
"watched_folder_path": "res://examples/ink/not_a_halloween_game"
} ]

[format]
Expand Down
16 changes: 8 additions & 8 deletions addons/inkgd/editor/common/ink_configuration.gd
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ func append_new_story_configuration(
TARGET_FILE_PATH: target_file_path,
WATCHED_FOLDER_PATH: wacthed_folder_path
})

emit_signal("story_configuration_changed")

func remove_story_configuration_at_index(index: int):
if index >= 0 && index < stories.size():
stories.remove(index)

emit_signal("story_configuration_changed")

func get_story_configuration_at_index(index):
Expand Down Expand Up @@ -150,7 +150,7 @@ func _retrieve_inklecate():
use_mono = _compiler_config_file.get_value(INKGD_SECTION, USE_MONO, false)
mono_path = _compiler_config_file.get_value(INKGD_SECTION, MONO_PATH, "")
inklecate_path = _compiler_config_file.get_value(INKGD_SECTION, INKLECATE_PATH, "")

if _compiler_config_file.get_value(FORMAT_SECTION, VERSION, 0) >= 2:
compilation_mode = _compiler_config_file.get_value(INKGD_SECTION, COMPILATION_MODE, 0)

Expand All @@ -160,14 +160,14 @@ func _retrieve_ink():
if err != OK:
# Assuming it doesn't exist.
return

if _ink_config_file.get_value(FORMAT_SECTION, VERSION, 0) >= 2:
stories = _ink_config_file.get_value(INKGD_SECTION, STORIES, DEFAULT_STORIES)
else:
var source_file_path = _ink_config_file.get_value(INKGD_SECTION, SOURCE_FILE_PATH, "")
var target_file_path = _ink_config_file.get_value(INKGD_SECTION, TARGET_FILE_PATH, "")
var watched_folder_path = _ink_config_file.get_value(INKGD_SECTION, WATCHED_FOLDER_PATH, "")

stories[0] = {
SOURCE_FILE_PATH: source_file_path,
TARGET_FILE_PATH: target_file_path,
Expand All @@ -177,7 +177,7 @@ func _retrieve_ink():
## Stores the content of the inklecate configuration to the disk.
func _persist_inklecate():
_compiler_config_file.set_value(FORMAT_SECTION, VERSION, COMPILER_CONFIG_FORMAT_VERSION)

_compiler_config_file.set_value(INKGD_SECTION, USE_MONO, use_mono)
_compiler_config_file.set_value(INKGD_SECTION, MONO_PATH, mono_path)
_compiler_config_file.set_value(INKGD_SECTION, INKLECATE_PATH, inklecate_path)
Expand All @@ -192,10 +192,10 @@ func _persist_ink():
# Clean up the file if it was created before version 2.
if _ink_config_file.has_section_key(INKGD_SECTION, SOURCE_FILE_PATH):
_ink_config_file.erase_section_key(INKGD_SECTION, SOURCE_FILE_PATH)

if _ink_config_file.has_section_key(INKGD_SECTION, TARGET_FILE_PATH):
_ink_config_file.erase_section_key(INKGD_SECTION, TARGET_FILE_PATH)

# Write version 2 values.
_ink_config_file.set_value(FORMAT_SECTION, VERSION, COMPILER_CONFIG_FORMAT_VERSION)
_ink_config_file.set_value(INKGD_SECTION, STORIES, stories)
Expand Down
14 changes: 7 additions & 7 deletions addons/inkgd/editor/panel/stories/ink_story_configuration.gd
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ func _ready():
_apply_custom_header_color()
_set_button_icons()
_connect_signals()

show_watched_folder(false)

# ############################################################################ #
# Signals
# Signals
# ############################################################################ #

func _configuration_entered(new_text):
Expand All @@ -85,8 +85,8 @@ func _configuration_focus_exited():

func _remove_button_pressed():
emit_signal("remove_button_pressed", self)


func _build_button_pressed():
emit_signal("build_button_pressed", self)

Expand Down Expand Up @@ -125,18 +125,18 @@ func _set_button_icons():
source_file_dialog_button.icon = folder_icon
target_file_dialog_button.icon = folder_icon
watched_folder_dialog_button.icon = folder_icon

var trash_icon = get_icon("Remove", "EditorIcons")
remove_button.icon = trash_icon


func _connect_signals():
source_file_line_edit.connect("text_entered", self, "_configuration_entered")
source_file_line_edit.connect("focus_exited", self, "_configuration_focus_exited")

target_file_line_edit.connect("text_entered", self, "_configuration_entered")
target_file_line_edit.connect("focus_exited", self, "_configuration_focus_exited")

source_file_dialog_button.connect("pressed", self, "_source_file_button_pressed")
target_file_dialog_button.connect("pressed", self, "_target_file_button_pressed")
watched_folder_dialog_button.connect("pressed", self, "_watched_folder_button_pressed")
Expand Down
3 changes: 3 additions & 0 deletions addons/inkgd/editor/panel/stories/ink_story_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ func _add_new_story_configuration() -> InkStoryConfiguration:
var count = _story_configuration_container.get_child_count()
story_configuration.story_label.text = "Story %d" % count

var show_folder = (configuration.compilation_mode == InkConfiguration.BuildMode.AFTER_CHANGE)
story_configuration.show_watched_folder(show_folder)

return story_configuration


Expand Down
4 changes: 2 additions & 2 deletions addons/inkgd/ink_player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,6 @@ func _finalise_story_creation():
_push_error("InkRuntime not found, did you remove it from the tree?", ErrorType.ERROR)
return

ink_runtime.connect("exception_raised", self, "_exception_raised")

emit_signal("loaded", true)


Expand All @@ -566,6 +564,8 @@ func _add_runtime():
_manages_runtime = true
runtime = InkRuntime.init(get_tree().root)

runtime.connect("exception_raised", self, "_exception_raised")

_ink_runtime = weakref(runtime)


Expand Down
1 change: 1 addition & 0 deletions addons/inkgd/runtime/static/ink_runtime.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# warning-ignore-all:unused_class_variable
# warning-ignore-all:shadowed_variable
# ############################################################################ #
# Copyright © 2015-present inkle Ltd.
# Copyright © 2019-present Frédéric Maquin <[email protected]>
Expand Down

0 comments on commit ce6123c

Please sign in to comment.