Is there a way to make a Tween TransitionType an export variable?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gabriel

Hi, I’m implementing a moving platform that follows a Path2d curve. The movement per se is controlled by a Tween node, like this:

extends Node2D

onready var follow = $Path2D/PathFollow2D
onready var tween = $Tween

export (int) var idle_duration = 1
export (int) var interpolation_duration = 6

func _ready():
    tween.interpolate_property(follow, "unit_offset", 0, 1, interpolation_duration,
    Tween.TRANS_SINE, Tween.EASE_IN_OUT, idle_duration)
    tween.start()

By using exported variables I make each platform instantiated on the stage have different speeds, and idle times. But I can’t figure out how to easily export the “Tween.TRANS_SINE” part so that I can also change the TransitionType.
One thing that I thought was to recreate the TransitionType enum and set it to the exported var, but that does not sound like a good solution. I’d like to use the enum that is already there. Any ideas?

Thanks in advance.

:bust_in_silhouette: Reply From: Kidoncio

I don’t know if that’s exactly what you asked for, but by following this you limit yourself to the values in ENUM:

export (int, 0, 10, 1) var TRANSITION_TYPE: int = 10
export (int, 0, 3, 1) var EASY_TYPE: int = 1
:bust_in_silhouette: Reply From: Pavel Kotlyar

something like this

enum TRANSITION_TYPES  { 
	LINEAR = 0,
	SINE = 1,
	QUINT = 2,
	QUART = 3,
	QUAD = 4,
	EXPO = 5,
	ELASTIC = 6,
	CUBIC = 7,
	CIRC = 8,
	BOUNCE = 9,
	BACK = 10
}
export(TRANSITION_TYPES) var transition_type = TRANSITION_TYPES.LINEAR

this will create a dropdown in the inspector