mirror of
https://github.com/Relintai/godot-resources-as-sheets-plugin.git
synced 2025-02-21 08:34:26 +01:00
Improve csv import stability
This commit is contained in:
parent
43b8ca587c
commit
d6dd3fe489
7
addons/editor_icon_previewer/plugin.cfg
Normal file
7
addons/editor_icon_previewer/plugin.cfg
Normal file
@ -0,0 +1,7 @@
|
||||
[plugin]
|
||||
|
||||
name="Editor Icon Previewer"
|
||||
description="Preview available editor icons in Godot Editor."
|
||||
author="Andrii Doroshenko (Xrayez)"
|
||||
version="1.2"
|
||||
script="editor_icon_previewer.gd"
|
@ -18,13 +18,14 @@ static func import_as_arrays(import_data) -> Array:
|
||||
import_data.delimeter = ","
|
||||
line = line[0].split(import_data.delimeter)
|
||||
text_lines[0] = line
|
||||
if line[1].begins_with(" "):
|
||||
for i in line.size():
|
||||
line[i] = line[i].trim_prefix(" ")
|
||||
|
||||
text_lines[0] = line
|
||||
space_after_delimeter = true
|
||||
import_data.delimeter = ", "
|
||||
|
||||
if line[1].begins_with(" "):
|
||||
for i in line.size():
|
||||
line[i] = line[i].trim_prefix(" ")
|
||||
|
||||
text_lines[0] = line
|
||||
space_after_delimeter = true
|
||||
import_data.delimeter += " "
|
||||
|
||||
while !file.eof_reached():
|
||||
line = file.get_csv_line(import_data.delimeter[0])
|
||||
|
@ -95,7 +95,8 @@ func _generate_class(save_script = true):
|
||||
|
||||
# Properties
|
||||
for i in import_data.prop_names.size():
|
||||
new_script.source_code += import_data.create_property_line_for_prop(i)
|
||||
if import_data.prop_names[i] != "resource_name":
|
||||
new_script.source_code += import_data.create_property_line_for_prop(i)
|
||||
|
||||
import_data.new_script = new_script
|
||||
new_script.reload()
|
||||
@ -136,6 +137,10 @@ func _on_import_edit_pressed():
|
||||
import_data.save()
|
||||
yield(get_tree(), "idle_frame")
|
||||
editor_view.display_folder(import_data.resource_path)
|
||||
editor_view.hidden_columns[editor_view.current_path] = {
|
||||
"resource_path" : true,
|
||||
"resource_local_to_scene" : true,
|
||||
}
|
||||
yield(get_tree(), "idle_frame")
|
||||
editor_view.refresh()
|
||||
|
||||
|
@ -83,6 +83,7 @@ func string_to_property(string : String, col_index : int):
|
||||
|
||||
|
||||
func property_to_string(value, col_index : int) -> String:
|
||||
if value == null: return ""
|
||||
if prop_types[col_index] is PoolStringArray:
|
||||
return TextEditingUtils.string_snake_to_naming_case(
|
||||
prop_types[col_index][value]
|
||||
@ -90,7 +91,7 @@ func property_to_string(value, col_index : int) -> String:
|
||||
|
||||
match prop_types[col_index]:
|
||||
PropType.STRING:
|
||||
return value
|
||||
return str(value)
|
||||
|
||||
PropType.BOOL:
|
||||
return str(value) # TODO: make this actually persist
|
||||
|
Loading…
Reference in New Issue
Block a user