This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I'm visually editing a simple curve like this

export(Curve) var bezier

I have no problem saving them as presets .tres files, problem arises because I don't know how to load them, I want to store many and then dynamically interchange them at will

doc's dont say nothing about loading presets

https://docs.godotengine.org/en/stable/classes/class_curve.html

storing them in variables indeed works

var stored = load("res//path/file.tres")

but then how do i apply it?

just in case the node path2d also manage curves if somebody does know how to load curves there by code maybe the same could apply to Curves class

Godot version 3.2.3
in Engine by (106 points)

1 Answer

+1 vote
Best answer

Nevermind I figured out,

visually editing them like this makes easier to achieve desired shapes

export(Curve) var bezier

when you have some shape you want, you save it as a .tres file

then to load them you either use load or preload

var stored = load("res//path/file.tres")

or

var stored = preload("res//path/file.tres")

and finally call it by its name, in this case I used it to interpolate some values from linear to exponential

var get_new_value = stored.interpolate(range_lerp(some_value, value_origin, value_ending, 0.0, 1.0))
by (106 points)
selected by

I like how u choose your own answer as best . Anyway I was also trying to figure that out in vain. Thanks.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.