Godot-Collapsible-Container icon indicating copy to clipboard operation
Godot-Collapsible-Container copied to clipboard

problem with exporting

Open vcircus opened this issue 1 year ago • 6 comments

Hi, thanks for the nice plugin. Works as I need in the editor. Ran in to a problem with exporting to android: I get the error: "parser error: Could not find type "EditorPlugin" in the current scope. Which points to line 403 in collapsible_container.gd.

Tried it in Godot 4.1, 4.1.1 and 4.2 on a mac and version 4.2 on windows with same result. Tried a few things to fix it but am not much of a programmer :-(
Can you point me in a direction to fix this? Thanks in advance. Paul

vcircus avatar Dec 05 '23 11:12 vcircus

@vcircus Hey Paul, I can't replicate this error and everything seems to be exporting fine for me for android. Some pictures might help. If you want, you can also create a minimum reproduction project with only relevant stuff and send me a zipped folder of the project IF it contains the error as well. I'm also assuming that you are using version 1.0.0 of this plugin so let me know if that's wrong.

Some information/advice that MAY help

The EditorPlugin is a Godot class that this plugin uses when you want to undo/redo anything related to the CollapsibleContainer (e.g., when you press ctrl+z or ctrl+y) while in the editor. It is NOT needed or used when you're in game - only in the editor.

Because it's not needed in game, you could try to simply comment out that line, export, and then just uncomment that line after exporting. Let me know if that works or not.

Since I can't replicate the issue, I can't really help too much without more information.

ArshvirGoraya avatar Dec 06 '23 02:12 ArshvirGoraya

Hi

Thanks for the quick reply. I made a simple project and put it on https://vcircus.stackstorage.com/s/nEANphmyb7lnboQA so you can have a look at what I put together.

In this version i have out-commented the line and then it exports (as you suggested) Can’t export if the line is uncommented. If it exports I see another error ( "sizing node is null” )

Regards Paul

Op 6 dec. 2023, om 03:42 heeft Arshvir Goraya @.***> het volgende geschreven:

@vcircus https://github.com/vcircus Hey Paul, I can't replicate this error and everything seems to be exporting fine for me for android. Some pictures might help. If you want, you can also create a minimum reproduction project with only relevant stuff and send me a zipped folder of the project IF it contains the error as well. I'm also assuming that you are using version 1.0.0 of this plugin so let me know if that's wrong.

Some information/advice that MAY help

The EditorPlugin is a Godot class that this plugin uses when you want to undo/redo anything related to the CollapsibleContainer (e.g., when you press ctrl+z or ctrl+y) while in the editor. It is NOT needed or used when you're in game - only in the editor.

Because it's not needed in game, you could try to simply comment out that line, export, and then just uncomment that line after exporting. Let me know if that works or not.

Since I can't replicate the issue, I can't really help too much without more information.

— Reply to this email directly, view it on GitHub https://github.com/ArshvirGoraya/Godot-Collapsible-Container/issues/1#issuecomment-1841994511, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECBOO26PFEYPG2UIITRSEDYH7LRXAVCNFSM6AAAAABAHQJTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBRHE4TINJRGE. You are receiving this because you were mentioned.

vcircus avatar Dec 06 '23 09:12 vcircus

@vcircus

Hey, there seems to be 2 issues here.

Editor Plugin not being recognized on Android.

This seems like a Godot specific issue and I've filed an issue you can find here: https://github.com/godotengine/godot/issues/86013

  • ANY script trying to use the EditorPlugin class seems to throw this error on Android, not just this plugin.

Workaround: instead of commenting out the line anytime you export to android, simply remove the EditorPlugin type hint: So instead of this old line var _editor_plugin : EditorPlugin Use this new line: var _editor_plugin OR var _editor_plugin# : EditorPlugin

sizing_node is null.

I got this error from the zip file you sent. Fix: It seems that when you enable "Small Deploy with Network FileSystem," it goes away. Screenshot (33)

With both these changes, I was able to export to android without a problem.

Please let me know if this fixes everything for you since I need to know whether to close this issue or not.

Sorry for not responding faster. Just got a job so can't give this my 100% attention.

ArshvirGoraya avatar Dec 10 '23 20:12 ArshvirGoraya

Hi

Thanks for looking in to it. Will try the workarounds tomorrow evening. Found out that it also works if you fill in a number for the custom open size as well as for the custom close size.

thanks, Paul

Op 10 dec. 2023, om 21:15 heeft Arshvir Goraya @.***> het volgende geschreven:

@vcircus https://github.com/vcircus Hey, there seems to be 2 issues here.

Editor Plugin not being recognized on Android.

This seems like a Godot specific issue and I've filled an issue you can find here: godotengine/godot#86013 https://github.com/godotengine/godot/issues/86013 ANY script trying to use the EditorPlugin class seems to throw this error on Android, no just this plugin. Workaround: instead of commenting out the line anytime you export to android, simply remove the EditorPlugin type hint: So instead of this old line var _editor_plugin : EditorPlugin Use this new line: var _editor_plugin OR var _editor_plugin# : EditorPlugin

sizing_node is null.

I got this error from in the folder you sent. Fix: It seems that when you enable "Small Deploy with Network FileSystem," it goes away. Screenshot.33.png (view on web) https://github.com/ArshvirGoraya/Godot-Collapsible-Container/assets/113562877/e01d8192-8763-4b43-b6e9-3c0767aae46d With both these changes, I was able to export to android without a problem.

Please let me know if this fixes everything for you since I need to know whether to close this issue or not.

Sorry I couldn't respond faster. Just got a job so can't give this my 100% attention.

— Reply to this email directly, view it on GitHub https://github.com/ArshvirGoraya/Godot-Collapsible-Container/issues/1#issuecomment-1849070996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECBOO5B5E64NP5LMRUFVGLYIYJ5BAVCNFSM6AAAAABAHQJTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBZGA3TAOJZGY. You are receiving this because you were mentioned.

vcircus avatar Dec 10 '23 21:12 vcircus

Found out that it also works if you fill in a number for the custom open size as well as for the custom close size.

Yeah, the problem is the Collapsible node doesn't know what to size to because the sizing_node is not set. However, if you're using custom sizes, then the sizing_node isn't used.

The reason the sizing_node doesn't get set is because it's setter function does not automatically get called without the "Small Deploy with Network FileSystem" being enabled. I have no idea why this is.

The setter function is set_sizing_node_path(node_path). Since it doesn't get called automatically like it should, what you can do instead is call it yourself in some script's ready function. This will ALSO remove the sizing_node is null error. Alternatively, you can just do sizing_node = node_path_of_a_control_node and this TOO will call the set_sizing_node_path() setter function. All in all, the sizing_node's setter function isn't called automatically as it should which is causing the error, but you can set the sizing_node through code to avoid the error.

You shouldn't have to do any of this with the "Small Deploy with Network FileSystem" option enabled though.

P.S. I only tested all of this in one-click deploy exports and not with like an APK export. Would love it if you did a normal export and saw if it works on your phone before reporting that everything is working.

ArshvirGoraya avatar Dec 10 '23 22:12 ArshvirGoraya

Hi

It works as you told with the one click deploy on a connected android device ( if the 'small deploy with network network filesystem’ is selected) But not if I make an APK file, then the issue is still there. Will try to set the sizing_node in the script as you suggest. Gonna try that tomorrow, today was a busy long day in a museum.

Thanks for the help, and there is no hurry in solving this. Can work around it for now, but would be nice if there is a solution.

regards Paul

Op 10 dec. 2023, om 23:02 heeft Arshvir Goraya @.***> het volgende geschreven:

Found out that it also works if you fill in a number for the custom open size as well as for the custom close size.

Yeah, the problem is the Collapsible node doesn't know what to size to because the sizing_node is not set. However, if you're using custom sizes, then the sizing_node isn't used.

The reason the sizing_node doesn't get set is because it's setter function does not automatically get called without the "Small Deploy with Network FileSystem" being enabled. I have no idea why this is.

The setter function is set_sizing_node_path(node_path). Since it doesn't get called automatically like it should, what you can do instead is call it yourself in some script's ready function. This will ALSO remove the sizing_node is null error. Alternatively, you can just do sizing_node = node_path_of_a_control_node and this TOO will call the set_sizing_node_path() setter function. All in all, the sizing_node's setter function isn't called automatically as it should which is causing the error, but you can set the sizing_node through code to avoid the error.

You shouldn't have to do any of this with the "Small Deploy with Network FileSystem" option enabled though.

P.S. I only tested all of this in one-click deploy exports and not with like an APK export. Would love it if you did a normal export and saw if it works on your phone before reporting that everything is working.

— Reply to this email directly, view it on GitHub https://github.com/ArshvirGoraya/Godot-Collapsible-Container/issues/1#issuecomment-1849100407, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECBOO2QNPFWVTFV4M75QR3YIYWPZAVCNFSM6AAAAABAHQJTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBZGEYDANBQG4. You are receiving this because you were mentioned.

vcircus avatar Dec 11 '23 18:12 vcircus

Hello and thanks for the excellent plugin. I am experiencing very similar errors but I am trying to export for Windows using 4.3 stable.

I have applied the comment on line 403 but I struggle with the part where the sizing node is null, could you provide assistance?

I suspect it is related to https://github.com/godotengine/godot/issues/91882?

filkata avatar Aug 28 '24 19:08 filkata

@filkata

Hi, I'm looking into this and may have found a quick solution.

The problem and the quick fix: The setter function is not running for some reason, but it seems to be only for the sizing_node variable. So, I can just make a new variable and, on ready, just set the sizing_node's value to that one, and it should be good.

What you can do: For now, you can replace the "collapsible_container.gd" script with the one zipped in here: collapsible_container - quick fix script.zip

What's changed: There is now a sizing_node_test variable that can be found in the inspector. Simply put your desired node into that one as well as the sizing_node, and it should work.

The Outcome: I tested an windows export from Godot 4.3 and everything seems fine. I've also tested it on android exports and it works there too.

The Future: This is just a quick fix, and shouldn't be needed in the future. I'm still looking into why the sizing_node setter function is not running. When I find the solution, I'll close this issue and update the plugin.

Caution: If it's a big project you should probably back it up before replacing the "collapsible_container.gd" script. Let me know how it goes for you.

image

ArshvirGoraya avatar Aug 29 '24 00:08 ArshvirGoraya

I had this issue trying to export to Android. Spent more than a few hours trying to figure out what was going on. I guess I should have just come and read the docs all the way to the end!

I was working around this by explicitly defining my SizingContainer as the default sizing_node value in code, but obviously that's not a very general solution.

I tried dropping your new .gd file directly into my project, replacing the old .gd file, but that didn't work properly--the editor complained, and the inspector didn't update correctly. So I just grabbed your updated lines and copy-pasted them into the old collapsible_container.gd. It threw the following errors on launch, but still seems to be working:

E 0:00:04:0836 collapsible_container.gd:733 @ (): Signal 'resized' is already connected to given callable 'Control(collapsible_container.gd)::_sizing_node_resized' in that object. <C++ Error> Method/function failed. Returning: ERR_INVALID_PARAMETER <C++ Source> core/object/object.cpp:1402 @ connect() <Stack Trace> collapsible_container.gd:733 @ () collapsible_container.gd:741 @ set_sizing_node_path()

E 0:00:04:0836 collapsible_container.gd:734 @ (): Signal 'tree_exiting' is already connected to given callable 'Control(collapsible_container.gd)::_sizing_node_exiting' in that object. <C++ Error> Method/function failed. Returning: ERR_INVALID_PARAMETER <C++ Source> core/object/object.cpp:1402 @ connect() <Stack Trace> collapsible_container.gd:734 @ () collapsible_container.gd:741 @ set_sizing_node_path()

GreeneLighte avatar Aug 29 '24 05:08 GreeneLighte

@ArshvirGoraya Thank you, for now this fix will do.

filkata avatar Aug 29 '24 12:08 filkata

@filkata @GreeneLighte

I believe I fixed this issue, but I'll keep the issue open for now in case any of you still have problems.

It had to do with the await ready line inside the sizing_node's setter function. I'm not sure why it works differently in exports vs in engine. Regardless, I changed the code for this and everything seems to be functioning well in exports.

  • I've checked exports on windows and android.
  • Checked in Godot versions: 4.3-stable, 4.2.2-stable, 4.2-stable, 4.1.4-stable and 4.1-stable.

After updating the script, I noticed I had to re-attach it to at least one CollapsibleContainer node in my scene and it should update all of them. But sometimes I have to re-attach it to all of them.

As before, I've attached the new "collapsible_container.gd" script to this post, but you can also get it from this repository's latest commit. collapsible_container - export null fix.zip

This fix also fixes the issue on android exports mentioned here by @vcircus

If this also works for you folks, let me know and I can update the plugin.

ArshvirGoraya avatar Aug 30 '24 01:08 ArshvirGoraya

UPDATE: Everything seems to be working fine now, in-engine and on-device. It just took restarting the engine (a few times?). I thought I had already tried restarting the engine, multiple times, but after one last restart, everything seems to be working now. The preview buttons are functioning properly in the editor, and the collapsible container is functioning properly on device. Thanks!

Original post below:

It took some fiddling to get Godot to accept the new code. It really doesn't like me to change the script file in the file system, so I end up just copy-paste the entire script contents over. I assume if you update it in the plugin, there won't be any issues.

This now works on Android device as expected. Yay! Unfortunately, in-editor previews no longer function properly. Specifically, the preview buttons no longer tween the CollapsibleContainer open or closed. In fact, pressing the preview buttons no longer registers the change in state until I do something to force an update.

For example, with the collapsible showing as open in the editor, I can hit "close" button in the Inspector, but nothing happens. Then, I toggle Preview->Enabled off and the state instantly updates to show the collapsible as closed. I toggle Preview->Enabled back on, press the "open" button, and nothing happens. Toggle Preview->Enabled off, and the collapsible instantly updates to show as open.

Other settings: CollapsibleContainer-> Starts Opened: False Start With Clip Contents: True Sizing Constraint: Only Height Auto Update Size: With Tween Sizing Node: SizingContainer

Sizing-> Use Custom Open Size: False Use Custom Close Size: False

Tween Settings-> In Physics Process: False Duration (sec): 0.5 Transition Type: Trans Sine Ease Type: Ease Out

Preview-> Enabled: True Starts Opened: False Auto Update Size: With Tween Tweening: True

Process-> Preview Always Process in Editor: True Starts With Process Mode: PRocess Mode Inherit

Running in Godot v4.3.stable.official on Windows 10 Pro

Thanks!

GreeneLighte avatar Aug 30 '24 07:08 GreeneLighte

Fixed in release version 1.0.1: https://github.com/ArshvirGoraya/Godot-Collapsible-Container/releases/tag/v1.0.1

ArshvirGoraya avatar Aug 31 '24 14:08 ArshvirGoraya