Giter Site home page Giter Site logo

Comments (4)

Bromeon avatar Bromeon commented on September 17, 2024 3

As I understood, there are two things:

  1. A feature request/discussion whether @export_file("*.filter") could potentially be allowed on Array -- visualized as a list in UI.
  2. If not: the question whether the error message "@export_file" requires a variable of type "String" but type "XY" was given instead is exclusive to the GDScript parser, or it can/could also be used for GDExtension properties.

On Rust side, we should in parallel make sure that the property is registered properly with Godot.

from godot.

lilizoey avatar lilizoey commented on September 17, 2024

i dont think this is a godot issue? isn't this just an issue with the rust bindings? im not sure what godot could do here.

from godot.

dsnopek avatar dsnopek commented on September 17, 2024

2. If not: the question whether the error message "@export_file" requires a variable of type "String" but type "XY" was given instead is exclusive to the GDScript parser, or it can/could also be used for GDExtension properties.

Currently, this message comes from gdscript_parser.cpp.

I suppose we could put similar validation in ClassDB::add_property(), however, the error message couldn't really be as good.

From Godot's perspective, it's looking at data passed on the PropertyInfo struct, and the error message could only refer to that (for example, saying the PropertyInfo::hint won't work with the given PropertyInfo::type). However, the binding probably doesn't directly expose PropertyInfo, but instead some binding-specific way of doing it, and so it'd be able to provide a better error message that refers to that.

So, I personally think giving a nice error message should be up to the GDExtension binding (in this case, the Rust binding).

from godot.

dsnopek avatar dsnopek commented on September 17, 2024

Discussed at the GDExtension meeting:

  • It would be nice to have an API that that could check if a property is valid, that could potentially be used by GDScript, ClassDB and GDExtension bindings, and still provide nice error messages.
  • However, some bindings may be able to check for property validity at compile time (making this unnecessary)
  • The property hints have decent documentation but we'd need to make sure it's complete and stays that way.
  • We'd also need to ensure that the potential future validation API would remain in sync.
  • For now, we recommend that GDExtension bindings attempt to handle this validation themselves, based on the documentation linked above.

from godot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.