-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove incorrect *.import
from .gitignore
as it breaks plugin & add missing *.import
files
#1
base: master
Are you sure you want to change the base?
Conversation
NOTE: This is part 1 of a 2 part fix. If the plugin does not contain the image-related `*.import` files then the plugin fails to load the first time project is opened. See here for "official" Godot `.gitignore` file: <https://github.com/github/gitignore/blob/master/Godot.gitignore> The error on opening is (in a dialog box): Unable to load addon script from path: 'res://addons/godot-camera-plugin.funabab/plugin.gd' There seems to be an error in the code, please check the syntax. But the underlying error (in the Output console) is: No loader found for resource: res://addons/godot-camera-plugin.funabab/icon_camera.png. res://addons/godot-camera-plugin.funabab/camera_view.gd:6 - Parse Error: Can't preload resource at path: res://addons/godot-camera-plugin.funabab/icon_camera.png For additional context, see: <https://old.reddit.com/r/godot/comments/f4uhpk/i_get_stuck_with_android_plugin/>
NOTE: This is part 2 of a 2 part fix. If the plugin does not contain the image-related `*.import` files then the plugin fails to load the first time project is opened. See here for "official" Godot `.gitignore` file: <https://github.com/github/gitignore/blob/master/Godot.gitignore> The error on opening is (in a dialog box): Unable to load addon script from path: 'res://addons/godot-camera-plugin.funabab/plugin.gd' There seems to be an error in the code, please check the syntax. But the underlying error (in the Output console) is: No loader found for resource: res://addons/godot-camera-plugin.funabab/icon_camera.png. res://addons/godot-camera-plugin.funabab/camera_view.gd:6 - Parse Error: Can't preload resource at path: res://addons/godot-camera-plugin.funabab/icon_camera.png For additional context, see: <https://old.reddit.com/r/godot/comments/f4uhpk/i_get_stuck_with_android_plugin/>
*.import
from .gitignore
as it breaks plugin.*.import
from .gitignore
as it breaks plugin & add missing *.import
files
Actually, no, the fix isn't this easy--because the files in
This was testing via a fresh checkout of my fork. :/ It may be a Godot plugin issue... |
So, even with the following patch to use diff --git a/addons/godot-camera-plugin.funabab/camera_view.gd b/addons/godot-camera-plugin.funabab/camera_view.gd
index 3f0c640..88bf956 100644
--- a/addons/godot-camera-plugin.funabab/camera_view.gd
+++ b/addons/godot-camera-plugin.funabab/camera_view.gd
@@ -3,7 +3,7 @@ extends Control
const CameraViewNativeBridge = preload("camera_view_native_bridge.gd").CameraViewNativeBridge;
const ERROR_FATAL = 1;
-const ICON_CAMERA = preload("icon_camera.png");
+var ICON_CAMERA = load("res://addons/godot-camera-plugin.funabab/icon_camera.png");
const COLOR_BG = Color.black;
enum ERROR {
diff --git a/addons/godot-camera-plugin.funabab/plugin.gd b/addons/godot-camera-plugin.funabab/plugin.gd
index f93656b..4352a19 100644
--- a/addons/godot-camera-plugin.funabab/plugin.gd
+++ b/addons/godot-camera-plugin.funabab/plugin.gd
@@ -5,7 +5,7 @@ const ANDROID_MODULE = "org/godotengine/godot/funabab/camera/FunababCameraPlugin
const CUSTOM_NODE_NAME = "CameraView";
func _enter_tree():
- add_custom_type(CUSTOM_NODE_NAME, "Control", preload("camera_view.gd"), preload("icon_node.png"));
+ add_custom_type(CUSTOM_NODE_NAME, "Control", preload("camera_view.gd"), load("res://addons/godot-camera-plugin.funabab/icon_node.png"));
pass
func _exit_tree(): An error is still displayed on opening for the "first" time (i.e. after deleting
No pop-up appears in this scenario & the plugin maybe still seems to "work" but the Node tree displays a generic icon. |
Yeah, this seems to be an engine issue: godotengine/godot#17483 Particularly relevant comment: godotengine/godot#17483 (comment) |
Okay, for the record, with this patch (and no existing diff --git a/addons/godot-camera-plugin.funabab/camera_view.gd b/addons/godot-camera-plugin.funabab/camera_view.gd
index 3f0c640..88bf956 100644
--- a/addons/godot-camera-plugin.funabab/camera_view.gd
+++ b/addons/godot-camera-plugin.funabab/camera_view.gd
@@ -3,7 +3,7 @@ extends Control
const CameraViewNativeBridge = preload("camera_view_native_bridge.gd").CameraViewNativeBridge;
const ERROR_FATAL = 1;
-const ICON_CAMERA = preload("icon_camera.png");
+var ICON_CAMERA = load("res://addons/godot-camera-plugin.funabab/icon_camera.png");
const COLOR_BG = Color.black;
enum ERROR {
diff --git a/addons/godot-camera-plugin.funabab/plugin.gd b/addons/godot-camera-plugin.funabab/plugin.gd
index f93656b..3a42c89 100644
--- a/addons/godot-camera-plugin.funabab/plugin.gd
+++ b/addons/godot-camera-plugin.funabab/plugin.gd
@@ -5,7 +5,13 @@ const ANDROID_MODULE = "org/godotengine/godot/funabab/camera/FunababCameraPlugin
const CUSTOM_NODE_NAME = "CameraView";
func _enter_tree():
- add_custom_type(CUSTOM_NODE_NAME, "Control", preload("camera_view.gd"), preload("icon_node.png"));
+ var custom_icon: Image = Image.new()
+ custom_icon.load("res://addons/godot-camera-plugin.funabab/icon_node.png")
+
+ var custom_icon_texture: ImageTexture = ImageTexture.new()
+ custom_icon_texture.create_from_image(custom_icon)
+
+ add_custom_type(CUSTOM_NODE_NAME, "Control", preload("camera_view.gd"), custom_icon_texture);
pass
func _exit_tree(): The warning is:
Given the node icon is only used in the editor I assume it's not going to be an issue on export? (lol) Note: I haven't tested an export. |
There's a simpler workaround that has some trade-offs but for now here's the diff: master...follower:workaround-plugin-init-png-issue-alt In brief, change from add_custom_type(CUSTOM_NODE_NAME, "Control", preload("camera_view.gd"), ResourceLoader.load("res://addons/godot-camera-plugin.funabab/icon_node.png")) |
This PR contains a two step fix--first we fix the
.gitignore
file & then we add the missing*.png.import
files.If the plugin does not contain the image-related
*.import
filesthen the plugin fails to load the first time project is opened.
See here for "official" Godot
.gitignore
file: https://github.com/github/gitignore/blob/master/Godot.gitignoreThe error on opening is (in a dialog box):
But the underlying error (in the Output console) is:
For additional context, see: https://old.reddit.com/r/godot/comments/f4uhpk/i_get_stuck_with_android_plugin/