ivanskodje-godotengine / godot-plugin-calendar-button

A Godot Engine plugin for 2D GUI. This is a "Calendar Button", which allows you to easily select a date for various purposes. As there is currently (v2.2.alpha) no Date objects, I have created my own Date and Calendar classes for reuse.
MIT License
49 stars 13 forks source link

Image export error and uppercase issue #6

Open mutantant opened 3 years ago

mutantant commented 3 years ago

Hey there. Great widget.

Godot 3.2.3 stable.

Installed the addon, activated it. Added the CalendarButton to the scene. Shows up as a small calendar icon. So far so good.

But when you try to run the project you get: Parser Error: Unique global class "Calendar" already exists at path: res://addons/calendar_button/class/Calendar.gd

Also: `W 0:00:00.711 _open: Case mismatch opening requested file 'calendar.gd', stored as 'Calendar.gd' in the filesystem. This file will not open when exported to other case-sensitive platforms. <C++ Source> drivers/windows/file_access_windows.cpp:105 @ _open()

calendar_buttons.gd:4 @ _init() calendar_script.gd:40 @ create_calendar_buttons() calendar_script.gd:17 @ _enter_tree() ` `W 0:00:00.692 load: Loaded resource as image file, this will not work on export: 'res://addons/calendar_button/btn_img/btn_32x32_03.png'. Instead, import the image file as an Image resource and load it normally as a resource. core/image.cpp:1894 @ load() calendar_script.gd:30 @ create_button_texture() calendar_script.gd:22 @ setup_calendar_icon() calendar_script.gd:15 @ _enter_tree() ` `W 0:00:00.702 load: Loaded resource as image file, this will not work on export: 'res://addons/calendar_button/btn_img/btn_32x32_04.png'. Instead, import the image file as an Image resource and load it normally as a resource. core/image.cpp:1894 @ load() calendar_script.gd:30 @ create_button_texture() calendar_script.gd:25 @ setup_calendar_icon() calendar_script.gd:15 @ _enter_tree() ` Oddly, if I change `var calendar = load("res://addons/calendar_button/class/calendar.gd").new()` in caneldar_buttons.gd to `var calendar = load("res://addons/calendar_button/class/Calendar.gd").new()` (note the capital C), it runs fine, but still throws errors about exporting and the images. And it is true, as I exported and the calendar button does not display in the exported file, though it still reads clicks if you know where it is supposed to be. In other words, as the errors warn, the images for the calendar buttons are *not* being exported, leaving a blank button.
ivanskodje commented 3 years ago

Thanks for letting me know!

Can you download the ZIP file of this branch and test to see if that fixes it? https://github.com/ivanskodje-godotengine/godot-plugin-calendar-button/tree/test-fix1

This works on 3.3 for me, without any of the errors you mention.

Install instructions:

revoltek commented 3 years ago

Hello, thanks for the plugin! I confirm the bug in 3.2.3 stable also with the new branch (not tested in 3.3 yet)

ivanskodje commented 3 years ago

Hello, thanks for the plugin! I confirm the bug in 3.2.3 stable also with the new branch (not tested in 3.3 yet)

Did you try the branch I posted?

revoltek commented 3 years ago

yes, the "test-fix1", I see a few changes in terms of spaces but the error is the same. I think the suggestion of @mutantant to add the capital C in caneldar_buttons.gd would help (at least it starts with that)

Kiwinir commented 3 years ago

As it is still open issue, I have found than in calendar_script.gd you have to change line 22 - 23 in func setup_calendar_icon() to this line self.texture_normal = load("res://addons/calendar_button/btn_img/" + "btn_32x32_03.png") and second line with var pressed_texture to this line self.texture_pressed = load("res://addons/calendar_button/btn_img/" + "btn_32x32_04.png")

I have also commented out func create_button_texture

Hope this helps anyone

jokehzg commented 2 years ago

Thanks for this plugin, it helps me a lot.

And I met this message in 3.4 stable too.

I tried to change line 4 to var calendar : Calendar in calendar_buttons.gd and modify func _init like this

func _init(var calendar_script, var buttons_container : GridContainer, var cal: Calendar):
    self.buttons_container = buttons_container
    setup_button_signals(calendar_script)
    calendar = cal

then change line 40 to return CalendarButtons.new(self, calendar_container, calendar) in calendar_script.gd

Now it's working without error msg (by the way, i have to restart the editor to make the scripts reload)

2nafish117 commented 2 years ago

I also had this issue. This is probably related to windows being case insensitive. I had to delete some of the files and paste the contents back into new files to fix this. Can anyone running linux see if this error appears?