JustPaste.it
tool
export(String,"small", "mid", "full") var staff_mode = "small" setget set_staff_mode;


func set_staff_mode(new_val):
print('flag 1');

if staff_mode == new_val:
return;

print('flag 2');

if not is_inside_tree():
return;

print('flag 3');

var animation_tree := get_node("/path/");

if not is_instance_valid(animation_tree):
return;

print('flag 4');

var ani_state:AnimationNodeStateMachinePlayback = animation_tree.get("parameters/playback");

if not ani_state.is_playing():
ani_state.start(new_val);

print('flag 5');

var anim_player_path = animation_tree.anim_player;
var animation_player := animation_tree.get_node(anim_player_path) as AnimationPlayer;

print('flag 6');

yield(animation_player, "animation_started");

print('flag 7');

ani_state.travel(new_val)

staff_mode = new_val;