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

Trait Default is not implemented for EditorPlugin #47

Open
SpencerMycek opened this issue Jun 6, 2024 · 6 comments
Open

Trait Default is not implemented for EditorPlugin #47

SpencerMycek opened this issue Jun 6, 2024 · 6 comments
Labels
error Mistake in the book

Comments

@SpencerMycek
Copy link

When following the godot-rust book to create an editor plugin, the GodotClass derive macro throws an error while trying to compile

Code: Copied from Godot-rust book page on EditorPlugins

use godot::prelude::*;
use godot::engine::{EditorPlugin, IEditorPlugin};

#[derive(GodotClass)]
#[class(tool, init, editor_plugin, base=EditorPlugin)]
struct MyEditorPlugin {
    base: Base<EditorPlugin>,
}

#[godot_api]
impl IEditorPlugin for MyEditorPlugin {
    fn enter_tree(&mut self) {
        // Perform typical plugin operations here.
    }

    fn exit_tree(&mut self) {
        // Perform typical plugin operations here.
    }
}

#[derive(GodotClass)]
the trait Default is not implemented for godot::prelude::Base<godot::engine::EditorPlugin>

@Bromeon Bromeon transferred this issue from godot-rust/gdext Jun 6, 2024
@Bromeon Bromeon added the error Mistake in the book label Jun 6, 2024
@Bromeon
Copy link
Member

Bromeon commented Jun 6, 2024

Hm, I thought this is an error in the book, but it might be a proc-macro problem.

First, can you update to latest gdext master? The godot::engine module is deprecated.

And also, does the problem appear if you don't specify tool and/or editor_plugin keys, i.e.

#[derive(GodotClass)]
#[class(init, base=EditorPlugin)]
struct MyEditorPlugin {
    base: Base<EditorPlugin>,
}

@SpencerMycek
Copy link
Author

My cargo.toml has this, so I believe I'm up-to-date: godot = { git = "https://github.com/godot-rust/gdext", branch = "master" }

I did not know godot::engine was deprecated, I haven't been getting warnings about that

@Bromeon
Copy link
Member

Bromeon commented Jun 6, 2024

You need to run cargo update from time to time, Cargo doesn't change dependencies on its own.

What about my other question? 🙂

@SpencerMycek
Copy link
Author

The error I had does disappear, now I need to figure out how to change stuff from whatever old version I was in to the newest version.
Is there a changelog for things? I'm not sure what to do now, since #[derive(GodotClass)] is deprecated. And following along the godot-rust book might be more difficult

@Bromeon
Copy link
Member

Bromeon commented Jun 6, 2024

Is there a changelog for things?

Some #announcements on Discord.

But also, did you read the deprecation messages? They contain migration info.


since #[derive(GodotClass)] is deprecated.

No, that part hasn't changed 🙂

@Bromeon
Copy link
Member

Bromeon commented Jun 29, 2024

@SpencerMycek any update on this? Did you manage to check with the latest version (now godot crate on crates.io)?

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

No branches or pull requests

2 participants