{"action":"created","issue":{"url":"https://api.github.com/repos/godotengine/godot/issues/19501","repository_url":"https://api.github.com/repos/godotengine/godot","labels_url":"https://api.github.com/repos/godotengine/godot/issues/19501/labels{/name}","comments_url":"https://api.github.com/repos/godotengine/godot/issues/19501/comments","events_url":"https://api.github.com/repos/godotengine/godot/issues/19501/events","html_url":"https://github.com/godotengine/godot/pull/19501","id":331018461,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzODU2Mjc3","number":19501,"title":"Added basic support for custom resource savers and loaders","user":{"login":"Zylann","id":1311555,"node_id":"MDQ6VXNlcjEzMTE1NTU=","avatar_url":"https://avatars1.githubusercontent.com/u/1311555?v=4","gravatar_id":"","url":"https://api.github.com/users/Zylann","html_url":"https://github.com/Zylann","followers_url":"https://api.github.com/users/Zylann/followers","following_url":"https://api.github.com/users/Zylann/following{/other_user}","gists_url":"https://api.github.com/users/Zylann/gists{/gist_id}","starred_url":"https://api.github.com/users/Zylann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zylann/subscriptions","organizations_url":"https://api.github.com/users/Zylann/orgs","repos_url":"https://api.github.com/users/Zylann/repos","events_url":"https://api.github.com/users/Zylann/events{/privacy}","received_events_url":"https://api.github.com/users/Zylann/received_events","type":"User","site_admin":false},"labels":[{"id":73330066,"node_id":"MDU6TGFiZWw3MzMzMDA2Ng==","url":"https://api.github.com/repos/godotengine/godot/labels/enhancement","name":"enhancement","color":"44bbff","default":true},{"id":279097966,"node_id":"MDU6TGFiZWwyNzkwOTc5NjY=","url":"https://api.github.com/repos/godotengine/godot/labels/topic:core","name":"topic:core","color":"ffdd44","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/godotengine/godot/milestones/7","html_url":"https://github.com/godotengine/godot/milestone/7","labels_url":"https://api.github.com/repos/godotengine/godot/milestones/7/labels","id":2529217,"node_id":"MDk6TWlsZXN0b25lMjUyOTIxNw==","number":7,"title":"3.1","description":"","creator":{"login":"akien-mga","id":4701338,"node_id":"MDQ6VXNlcjQ3MDEzMzg=","avatar_url":"https://avatars0.githubusercontent.com/u/4701338?v=4","gravatar_id":"","url":"https://api.github.com/users/akien-mga","html_url":"https://github.com/akien-mga","followers_url":"https://api.github.com/users/akien-mga/followers","following_url":"https://api.github.com/users/akien-mga/following{/other_user}","gists_url":"https://api.github.com/users/akien-mga/gists{/gist_id}","starred_url":"https://api.github.com/users/akien-mga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akien-mga/subscriptions","organizations_url":"https://api.github.com/users/akien-mga/orgs","repos_url":"https://api.github.com/users/akien-mga/repos","events_url":"https://api.github.com/users/akien-mga/events{/privacy}","received_events_url":"https://api.github.com/users/akien-mga/received_events","type":"User","site_admin":false},"open_issues":923,"closed_issues":4684,"state":"open","created_at":"2017-05-18T13:33:56Z","updated_at":"2018-12-01T22:05:22Z","due_on":null,"closed_at":null},"comments":15,"created_at":"2018-06-11T01:05:12Z","updated_at":"2018-12-01T23:13:22Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/godotengine/godot/pulls/19501","html_url":"https://github.com/godotengine/godot/pull/19501","diff_url":"https://github.com/godotengine/godot/pull/19501.diff","patch_url":"https://github.com/godotengine/godot/pull/19501.patch"},"body":"Adds support for custom loaders and savers, so you can add new file types for Godot to load and save using `ResourceLoader` and `ResourceSaver`.\r\n\r\n**Jump here for updated proposal -->** https://github.com/godotengine/godot/pull/19501#issuecomment-399802029\r\n\r\n---------------\r\nOld proposal:\r\n\r\nIt basically exposes an internal API which was however unfit for the scripting API, but changing this core API could be more work, so a compromise is taken:\r\nCustom loaders and savers are nodes, which you can add as autoloads.\r\nPlugins defining new filetypes can then add those autoloads automatically when the get activated and deactivated (however, see #19499).\r\n\r\nNotes:\r\n- I only exposed the bare minimum, there are more methods that could be exposed but I either don't understand them or maybe they aren't needed for now. They can be exposed in the future.\r\n- I used multiple inheritance, but it should be OK because one of the classes is an interface (it doesn't contain data and has only virtual methods).\r\n- When you save a custom resource inheriting Resource, Godot still defaults to `.tres` in the save dialog, so you have to select the custom extension manually. I would like to make it default to the custom extension (or even remove the others), but I couldn't find how.\r\n- **If I use `remove_autoload_singleton` when my plugin exits the tree, Godot now crashes everytime on exit with errors about the scene tree**. I think `EditorPlugin` needs an additional function to know when it's disabled or enabled, as opposed to just being added or removed from the tree, because there is no clean way to differentiate this from an editor launch or exit (can't use `is_plugin_enabled` because it isn't updated in time) @vnen \r\n- Here is the test project I used:\r\n[CustomResourceLoader.zip](https://github.com/godotengine/godot/files/2088459/CustomResourceLoader.zip)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/godotengine/godot/issues/comments/443466512","html_url":"https://github.com/godotengine/godot/pull/19501#issuecomment-443466512","issue_url":"https://api.github.com/repos/godotengine/godot/issues/19501","id":443466512,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzQ2NjUxMg==","user":{"login":"Zylann","id":1311555,"node_id":"MDQ6VXNlcjEzMTE1NTU=","avatar_url":"https://avatars1.githubusercontent.com/u/1311555?v=4","gravatar_id":"","url":"https://api.github.com/users/Zylann","html_url":"https://github.com/Zylann","followers_url":"https://api.github.com/users/Zylann/followers","following_url":"https://api.github.com/users/Zylann/following{/other_user}","gists_url":"https://api.github.com/users/Zylann/gists{/gist_id}","starred_url":"https://api.github.com/users/Zylann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zylann/subscriptions","organizations_url":"https://api.github.com/users/Zylann/orgs","repos_url":"https://api.github.com/users/Zylann/repos","events_url":"https://api.github.com/users/Zylann/events{/privacy}","received_events_url":"https://api.github.com/users/Zylann/received_events","type":"User","site_admin":false},"created_at":"2018-12-01T23:13:22Z","updated_at":"2018-12-01T23:13:22Z","author_association":"CONTRIBUTOR","body":"I updated the PR:\r\n\r\n- Now registration is done through global class names (`class_name` in GDScript)\r\n- Tested with the following project: [CustomLoaders.zip](https://github.com/godotengine/godot/files/2636400/CustomLoaders.zip)\r\n"}}
{"actor":{"display_login":"Zylann"}}