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

Editor plugin #113

Open
wants to merge 121 commits into
base: main
Choose a base branch
from
Open

Editor plugin #113

wants to merge 121 commits into from

Conversation

migueldeicaza
Copy link
Owner

No description provided.

…e, to prevent gratuitous rebuilds - sadly does not seem to make a difference
Godot sadly does not annotate their functions and properties to
include information whether they are optional or not.  This is an
issue that has been raised a long time ago and has gained little to no
traction:

godotengine/godot-proposals#2241

This poses a problem, because certain Godot APIs would return nil, and
I would try to create an object out of it, and crash, while a nil
return is ok.

It also posed a problem for APIs that could take a nil parameter, but
instead, in SwiftGodot, you had to create an instance of the object,
even if it is unnecesary or not the desired outcome.

So I have now settled on an evolutionary plan:

* For now, all reference types that could have been nil either as a
  parameter or a return value, are declared as swift optionals.

* I have introduced a hardcoded list of method return types and method
  arguments that can be used to flag exceptions to this: scenarios
  where we can verify that the return value would never be nil, or the
  parameter demands a non-nil argument.

The list currently is hardcoded in Swift, but will eventually move to
a Json file to make it easier to work with.

Sadly, this means that there will be some churn, until all this is
properly validated.

This is a fix for this issue:

#63

Some additional data:

* Some 114 property returns were affected
* Some 432 method returns were affected
migueldeicaza and others added 30 commits September 27, 2023 19:15
Port over the macros meant to go upstream. As the sole author of the
macro library, I give permission to have these licensed under the same
license as the SwiftGodot project.
Utilizes thew new macros introduced in the previous commit.
This should emit a message to the Godot console before crashing that a
texture couldn't be loaded, with the respective file and line.
This is missing the SwiftGodotMacros import (see #131).
The tutorial now includes the step for adding SwiftGodotMacros to
Package.swift.

The README now also demonstrates the initSwiftExtension macro.
…'.shared' idiom; Following what C# does here
…: the generated uid is broken, and I need solve the need for two libraries rather than one, and the clash with the Editor
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

Successfully merging this pull request may close these issues.

5 participants