godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Expose 'points' array in Curves as a property in GDScript #10577

Open SamDevelopsCode opened 2 months ago

SamDevelopsCode commented 2 months ago

Describe the project you are working on

A game.

Describe the problem or limitation you are having in your project

The points array is already there so it should be exposed as a scripting property for general use. As of now, I have to write up a simple loop to return a vector that the curve is already using. image

There is no 'points' array by default. image

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Reduce boilerplate code while using Curves to access pre-existing data.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

image

If this enhancement will not be used often, can it be worked around with a few lines of script?

Yes it can be worked around with a line or 2 of code.

Is there a reason why this should be core and not an add-on in the asset library?

Because we should allow property of nodes to be exposed for general use and not assume why users might want the data.

dalexeev commented 2 months ago

Note that properties of Array, Packed*Array, and Dictionary types generally do not allow modification of individual elements. You must assign the entire property for the setter to be called. See: