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

Update docs for GDScript 2.0 #3623

Closed
wants to merge 5 commits into from
Closed

Conversation

vnen
Copy link
Member

@vnen vnen commented May 31, 2020

GDScript syntax will change a bit after godotengine/godot#39093, so this is an update of the basics and export pages to fit the new way.

I removed the section for exporting arrays because it's still not supported, but I'll add it back once typing is re-added and there is a syntax for typed arrays.

I also removed the groups/categories sections because I plan to add those as annotations.

@mhilbrunner
Copy link
Member

Looks good so far, will have a more in-depth look later. Should we mark this as draft until godotengine/godot#39093 is finished/merged?

@vnen
Copy link
Member Author

vnen commented Jun 2, 2020

Should we mark this as draft until godotengine/godot#39093 is finished/merged?

Sure, if you prefer.

@akien-mga akien-mga changed the title Gdscript 2.0 Update docs for GDScript 2.0 Jun 25, 2020
@vnen
Copy link
Member Author

vnen commented Jul 24, 2020

Now that godotengine/godot#40598 is merged we can also merge this.

Include suggestions from Calinou

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
return local_var2

match param3:
3: print("param3 is 3!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be indented like the one below.

@Xrayez
Copy link
Contributor

Xrayez commented Aug 16, 2020

I also removed the groups/categories sections because I plan to add those as annotations.

I've added those sections in #3444. Can annotations provide a way to add groups and categories dynamically? Perhaps this can be adapted to "Adding script groups and categories dynamically via code". Maybe it deserves more detailed documentation on _get_propety_list() (not necessarily GDScript documentation, but C++). Unless we're moving away from using _get_propety_list() in GDScript at all... 😮

See example use case in godotengine/godot#10303 (comment).

@vnen
Copy link
Member Author

vnen commented Aug 17, 2020

I also removed the groups/categories sections because I plan to add those as annotations.

I've added those sections in #3444. Can annotations provide a way to add groups and categories dynamically? Perhaps this can be adapted to "Adding script groups and categories dynamically via code". Maybe it deserves more detailed documentation on _get_propety_list() (not necessarily GDScript documentation, but C++). Unless we're moving away from using _get_propety_list() in GDScript at all...

See example use case in godotengine/godot#10303 (comment).

Annotations cannot do anything dynamically, they are only evaluated at compile-time.

I guess we can leave this info here but should be worded as an advanced method for dynamic changes (I know right now it's the only way to do it, but annotations for this should come before Godot 4 is released). So if you want I can remove the deletion.

Though I wish this could be approved and merged soon, as it already have conflicts again.

@Xrayez
Copy link
Contributor

Xrayez commented Aug 18, 2020

I think that's fine to remove those sections for now, I was just curious how it plays with existing annotations system. As I said, it probably needs a better introduction on _get_property_list() in the first place.

@NathanLovato
Copy link
Contributor

NathanLovato commented Sep 3, 2020

Hey @vnen it's looking good. I just fixed the remaining review comment. If you can fix the conflicts, I'll merge your PR. Alternatively, I can fix them for you if you'd like.

To call a function in a *parent class* (i.e. one ``extend``-ed in your current
class), prepend ``.`` to the function name::
To call a function in a *super class* (i.e. one ``extend``-ed in your current
class), user the ``super`` keyword::
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class), user the ``super`` keyword::
class), use the ``super`` keyword::


# Named enum values

# Editor will enumerate as THING_1, THING_2, ANOTHER_THING.
enum NamedEnum {THING_1, THING_2, ANOTHER_THING = -1}
export(NamedEnum) var x
@export var x: NamedEnum
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to work for me in the current master branch (godotengine/godot@a6bb4f7).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I need to fix the export because it's missing some stuff still.

@NathanLovato
Copy link
Contributor

NathanLovato commented Oct 10, 2020

@vnen I'd like to merge this and other GDScript-related PRs, even if there'll be more changes in the coming weeks or months, to avoid merge conflicts down the road. Can I go ahead and rebase and merge?

It's fine if there are some docs that don't work yet, the engine isn't even in alpha so the latest docs are just a work-in-progress at this point.

@NathanLovato NathanLovato added this to the Godot 4.0 milestone Oct 10, 2020
@vnen
Copy link
Member Author

vnen commented Oct 10, 2020

@NathanLovato I'll try to take sometime this week to fix the conflicts. Unless someone else is willing to do it sooner.

@NathanLovato
Copy link
Contributor

I can do it. Unless you want to make changes, you can leave it to me.

@NathanLovato
Copy link
Contributor

I had to open a new PR to fix the merge conflicts due to the rebase on master: #4247. Closing this one and merging the new PR

@vnen vnen deleted the gdscript-2.0 branch October 14, 2020 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants