Open Jeremi360 opened 4 years ago
I work around it, by just change all my graphic assets to atlases. So I can think I can close this bug - nobody bother about this bug anyway.
@jebedaia360 Using atlases sounds like a useful workaround of the underlying issue--would you be able to give a brief explanation of how you did that?
This seems to be the commit that changed but it wasn't immediately apparent how it worked: https://github.com/rakugoteam/Rakugo/commit/87eeaf4214331aa119f11f7e4888b53100767b04
After further reading I'm guessing the relevant part is here: https://github.com/rakugoteam/Rakugo/commit/87eeaf4214331aa119f11f7e4888b53100767b04#diff-a72a87a94b7682824d242b0e1358764fL138
So it seems maybe the change to using a .tres
adds a level of indirection that results in the load succeeding. Which makes me wonder whether just using an ImageTexture
resource file would also work. In which case perhaps the docs just need to be updated to advise against loading an image file directly.
(It's still reasonable to consider the underlying issue an engine bug in need of fixing though--particularly if there's other resources where an equivalent workaround isn't available.)
Edit: Now I'm reminded of it, I guess using an atlas is similar to the approach I took here: https://github.com/follower/godot-camera-plugin-demo/commit/2d7db76cce767252654771f380a605bde553971b#diff-d749e27f47e3083735056a69118dc89f but with the key difference that there's no direct loading of the .png
file:
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():
(As I recall my patch prevented errors on load but still didn't display the texture correctly when first opened.)
It's still reasonable to consider the underlying issue an engine bug in need of fixing though--particularly if there's other resources where an equivalent workaround isn't available.
@follower Yes you are right, so I reopen this issue .
Using atlases sounds like a useful workaround of the underlying issue--would you be able to give a brief explanation of how you did that?
Yes, so I use TexturePacker and their plugin to generate atlases and tres files, but to use TexturePacker with godot you need to buy license or use in 7days trial.
Also you don't need to use add_custom_type()
at all you can just in your camera_view.gd do this:
extends Control
class_name CameraView, "res://addons/godot-camera-plugin.funabab/icon_node.png"
~# it works also with *.tres files~
@follower I was wrong class_name
don't work with *.tres files :(
Godot version: 3.2.1
OS/device including version: Ubuntu 20.04, Windows 10
Issue description: So I making addon with a lot of resources called Rakugo. And I publish template project that use it. When people try to open it for first time it crashes Godot with bug simmilar this:
But when they try to open it once again every thing works fine.
Steps to reproduce:
Minimal reproduction project: