Skip to content
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

Material Maker 0.92 Macos fails to load resources #140

Closed
robw001 opened this issue Jul 30, 2020 · 10 comments
Closed

Material Maker 0.92 Macos fails to load resources #140

robw001 opened this issue Jul 30, 2020 · 10 comments

Comments

@robw001
Copy link

robw001 commented Jul 30, 2020

On macOS Catalina (10.15.6), Material Maker runs fine in Godot engine but fails to load resources after export to MacOS.

When run inside Godot engine, the app stats up fine and I can create materials. Run as a compiled app, it starts up, but with an empty library.

when I start the compiled app from the command line, I get the following errors:

./Material\ Maker 
arguments
0: ./Material Maker
Current path: /Users/[___]/Downloads/Godot/Material Maker.app/Contents/MacOS
Godot Engine v3.2.2.stable.official - https://godotengine.org
OpenGL ES 3.0 Renderer: AMD Radeon Pro 580X OpenGL Engine
 
Registered camera FaceTime HD Camera (Built-in) with id 1 position 0 at index 0
ERROR: load_source_code: Condition "err" is true. Returned: err
   At: modules/gdscript/gdscript.cpp:829.
ERROR: load: Cannot load source code from file 'res://addons/material_maker/engine/gen_iterate_buffer.gd'.
   At: modules/gdscript/gdscript.cpp:2285.
ERROR: _load: Failed loading resource: res://addons/material_maker/engine/gen_iterate_buffer.gd.
   At: core/io/resource_loader.cpp:278.
SCRIPT ERROR: GDScript::load_byte_code: Parse Error: The class "MMGenIterateBuffer" was found in global scope, but its script couldn't be loaded.
   At: res://addons/material_maker/engine/loader.gdc:135.
ERROR: load_byte_code: Method failed. Returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:801.
ERROR: load: Cannot load byte code from file 'res://addons/material_maker/engine/loader.gdc'.
   At: modules/gdscript/gdscript.cpp:2281.
ERROR: _load: Failed loading resource: res://addons/material_maker/engine/loader.gdc.
   At: core/io/resource_loader.cpp:278.
ERROR: start: Can't autoload: res://addons/material_maker/engine/loader.gd
   At: main/main.cpp:1749.
SCRIPT ERROR: _ready: Invalid call. Nonexistent function 'get_nodes_paths' in base 'Nil'.
   At: res://addons/material_maker/engine/io_types.gdc:9.
ERROR: create_from_image: Condition "p_image.is_null()" is true.
   At: scene/resources/texture.cpp:199.
ERROR: texture_set_size_override: Condition "p_width <= 0 || p_width > 16384" is true.
   At: drivers/gles3/rasterizer_storage_gles3.cpp:1528.
SCRIPT ERROR: generate_preview_shader: Invalid get index 'f' (on base: 'Dictionary').
   At: res://addons/material_maker/engine/gen_base.gdc:223.
SCRIPT ERROR: set_generator: Invalid set index 'code' (on base: 'Shader') with value of type 'Nil'.
   At: res://material_maker/preview/preview_2d_panel.gdc:35.
SCRIPT ERROR: generate_preview_shader: Invalid get index 'f' (on base: 'Dictionary').
   At: res://addons/material_maker/engine/gen_base.gdc:223.
SCRIPT ERROR: set_generator: Invalid set index 'code' (on base: 'Shader') with value of type 'Nil'.
   At: res://material_maker/widgets/histogram/histogram.gdc:33.
SCRIPT ERROR: generate_preview_shader: Invalid get index 'f' (on base: 'Dictionary').
   At: res://addons/material_maker/engine/gen_base.gdc:223.
SCRIPT ERROR: set_generator: Invalid set index 'code' (on base: 'Shader') with value of type 'Nil'.
   At: res://material_maker/preview/preview_2d.gdc:35.
SCRIPT ERROR: MMGraphEdit.new_material: Invalid call. Nonexistent function 'create_gen' in base 'Nil'.
   At: res://material_maker/graph_edit.gdc:198.
SCRIPT ERROR: generate_preview_shader: Invalid get index 'f' (on base: 'Dictionary').
   At: res://addons/material_maker/engine/gen_base.gdc:223.
SCRIPT ERROR: set_generator: Invalid set index 'code' (on base: 'Shader') with value of type 'Nil'.
   At: res://material_maker/preview/preview_2d_panel.gdc:35.
SCRIPT ERROR: generate_preview_shader: Invalid get index 'f' (on base: 'Dictionary').
   At: res://addons/material_maker/engine/gen_base.gdc:223.
SCRIPT ERROR: set_generator: Invalid set index 'code' (on base: 'Shader') with value of type 'Nil'.
   At: res://material_maker/widgets/histogram/histogram.gdc:33.
SCRIPT ERROR: generate_preview_shader: Invalid get index 'f' (on base: 'Dictionary').
   At: res://addons/material_maker/engine/gen_base.gdc:223.
SCRIPT ERROR: set_generator: Invalid set index 'code' (on base: 'Shader') with value of type 'Nil'.
   At: res://material_maker/preview/preview_2d.gdc:35.
ERROR: ~List: Condition "_first != __null" is true.
   At: ./core/self_list.h:112.
ERROR: ~List: Condition "_first != __null" is true.
   At: ./core/self_list.h:112.
WARNING: cleanup: ObjectDB instances leaked at exit (run with --verbose for details).
   At: core/object.cpp:2135.
ERROR: clear: Resources still in use at exit (run with --verbose for details).
   At: core/resource.cpp:477.

Where are the resources supposed to be located?

@RodZill4
Copy link
Owner

I don't have a Mac and thus cannot maintain a Mac release.

Your current problem is that there are missing resources in your export. Replicating the resources exported in the Windows or Linux release should solve it.

It is also necessary to copy some of the files alongside the executable (and I absolutely don't know how this applies to Mac). You may want to download a Windows or Linux release to know which files are needed.

If you succeed in creating a working Mac release, I'd really like to hear about it. :)

@robw001
Copy link
Author

robw001 commented Aug 12, 2020

Hi @RodZill4, I can find the resource files, the issue is where to put them 👍

Is there a way in Godot to trace "res://" to a file location?

On macOS there's an equivalent for %APPDATA%, called "Application Support". Also, the application bundle itself (the .app file) may contain resource files. However, when generated, the Material Maker.app seems to be looking somewhere else for it's resources.

A solution might be in the material here. Question: do the project settings create a portable application on export? I don't know how to verify that in Godot as I have too little experience with it.

I'll investigate further, will update here if I find a solution.

@Calinou
Copy link
Contributor

Calinou commented Aug 12, 2020

Is there a way in Godot to trace "res://" to a file location?

Yes: ProjectSettings.globalize_path("res://")

Question: do the project settings create a portable application on export? I don't know how to verify that in Godot as I have too little experience with it.

By default, exported projects are "portable" in the sense that they don't need to be installed, but they will save user configuration to a location in %APPDATA%. If you want the application to save user data next to the executable, this must be done manually by the project developer.

@RodZill4
Copy link
Owner

Material Maker tries to find its resource files (node definitions, nodes IO definitions, documentation etc.) next to the executable file.
I know nothing about how applications should be packaged for MacOS, but in Pixelorama's MacOS release, it seems the resource files (pixelorama directory that contains brushes, palettes, patterns) are next to the pkg file.

@robw001
Copy link
Author

robw001 commented Aug 13, 2020

@Calinou thanks! I'll look into that.

@RodZill4 On macOS, applications are a bit more involved, they are (generally) copy-paste-install containers, acting a bit like zip files (if you look at them on Windows, they appear to be directories).

The actual (unix style) executable is inside the container in the folder [application.app]/Contents/MacOS. The container also contains required libraries, frameworks and resources, the last ones in [application.app]/Contents/Resources. That is where I would expect the Material Maker resources initially. This is where Godot puts the .pck file.

Applications are generally located in the /Applications folder. Being containers, you won't find any accessory files next to them. You could, but it would be considered bad form, I guess.

On install or use files in ~/Library/Application Support/[application name] may be created. Also, on use, temporary files may be created in /var/[somewhere, not entirely sure], which could contain read-write copies of the resources.

I'm guessing Godot needs additional direction on where to put the project/application resource files. I'll try and dig some more. In the mean time, I can run MM from within the Godot environment. I will also try and manually put the resources next to the pkg file to see what happens.

@robw001
Copy link
Author

robw001 commented Aug 13, 2020

@Calinou

Is there a way in Godot to trace "res://" to a file location?
Yes: ProjectSettings.globalize_path("res://")

A question: where can I find this setting in Godot?

@Calinou
Copy link
Contributor

Calinou commented Aug 13, 2020

@robw001 res:// is always the project root, no matter the project settings. In an exported project, res:// isn't guaranteed to be a writeable location. For user data, user:// should be used instead.

@RodZill4
Copy link
Owner

@robw001
Hi!
Based on how Pixelorama is packaged for Mac OSX, I tried to generate a Material Maker release: https://github.com/RodZill4/material-maker/actions/runs/209650849

Would it be possible for you to test it (I'd say there's 0.7% chance that it will work, but that's all I have for now :D)?

@fluttergust
Copy link

FYI, while trying to get the latest snapshot of material maker (https://github.com/RodZill4/material-maker/actions/runs/526845726) launching on Mojave, I've had success by moving the resource files beside the executable (material_maker.app/Contents/MacOS) instead of under material_maker.app/Contents/Resources.

RodZill4 added a commit that referenced this issue Feb 4, 2021
Moved resources into MacOS directory
@RodZill4
Copy link
Owner

RodZill4 commented Feb 4, 2021

@ZiJingToh thanks a lot for testing. I modified the scripts, the new build should be a bit better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants