diff --git a/README.md b/README.md index 5c22be2e0..ee5af65dc 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ It's still work in progress so there are some pages missing. If you want to cont Pixelorama uses Godot 3.2, so you will need to have it in order to run the project. As of right now, most of the code is written using GDScript, so the mono version of Godot is not required, but Pixelorama should also work with it. -Pixelorama uses a GDNative addon for gif exporting, since it's not possible to do it natively with Godot. In order to ensure that your clone works properly, you will need to use the command `git submodule update --init` right after you clone. +Pixelorama uses a [GDNative addon for gif exporting](https://github.com/novhack/godot-gifexporter), since it's not possible to do it natively with Godot. In order to ensure that your clone works properly, you will need to use the command `git submodule update --init` right after you clone. Note that the addon only works in Windows and Linux platforms, for the time being. Pixelorama should run without it fine on other platforms. diff --git a/src/Autoload/Import.gd b/src/Autoload/Import.gd index 6dc10bafd..99a1cf411 100644 --- a/src/Autoload/Import.gd +++ b/src/Autoload/Import.gd @@ -265,6 +265,7 @@ func import_patterns(priority_ordered_search_path: Array) -> void: func import_gpl(path : String) -> Palette: + # Refer to app/core/gimppalette-load.c of the GIMP for the "living spec" var result : Palette = null var file = File.new() if file.file_exists(path): @@ -280,6 +281,8 @@ func import_gpl(path : String) -> Palette: break else: result = Palette.new() + # Use filename as palette name in case reading old + # palette format (must read more to determine) var name_start = path.find_last('/') + 1 var name_end = path.find_last('.') if name_end > name_start: @@ -288,15 +291,27 @@ func import_gpl(path : String) -> Palette: # Comments if line.begins_with('#'): comments += line.trim_prefix('#') + '\n' + # Some programs output palette name in a comment for old format + if line.begins_with("#Palette Name: "): + result.name = line.replace("#Palette Name: ", "") pass - elif line_number > 0 && line.length() >= 12: + elif line.begins_with("Name: "): + result.name = line.replace("Name: ", "") + pass + elif line.begins_with("Columns: "): + # Number of colors in this palette. Unecessary and often wrong + pass + elif line_number > 0 && line.length() >= 9: line = line.replace("\t", " ") var color_data : PoolStringArray = line.split(" ", false, 4) var red : float = color_data[0].to_float() / 255.0 var green : float = color_data[1].to_float() / 255.0 var blue : float = color_data[2].to_float() / 255.0 var color = Color(red, green, blue) - result.add_color(color, color_data[3]) + if color_data.size() >= 4: + result.add_color(color, color_data[3]) + else: + result.add_color(color) line_number += 1 if result: diff --git a/src/Main.gd b/src/Main.gd index 0fa25adb3..ccb44c20a 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -68,8 +68,7 @@ func _input(event : InputEvent) -> void: func setup_application_window_size() -> void: # Set a minimum window size to prevent UI elements from collapsing on each other. - # This property is only available in 3.2alpha or later, so use `set()` to fail gracefully if it doesn't exist. - OS.set("min_window_size", Vector2(1024, 576)) + OS.min_window_size = Vector2(1024, 576) # Restore the window position/size if values are present in the configuration cache if Global.config_cache.has_section_key("window", "screen"):