@tool Plugin getting <null> when reading exported value from node in editor event though value is set

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

Hi everyone,

I am currently developing a plugin for Godot to merge my custom build state machine, states and edges into an AnimationTree to use the BlendSpaces etc. efficiently by not having to manually define both.
My state machine has a property “init_state” defined like this:

class_name StateMachine
extends State

@export var init_state: State

I set the value within the Inspector as you can see on this image:
Inspector Screenshot

When I now try to access this state machine within my plugin I get the value and not somthing like Move@abc123458 as should normally be printed for statemachine.init_state.

Is there a way I can read an @export value within my plugin to get this to work or do you have an idea how I could debug this?

:bust_in_silhouette: Reply From: OkariDraconis

Having the same thing happening, also working on a state machine plugin

I made this work around, cheers:

func load_editor_values(obj : Object) -> void:
	for meta in obj.get_meta_list():
		if meta.begins_with("_editor_prop_ptr_"):
			var prop_name = meta.trim_prefix("_editor_prop_ptr_")
			var prop_value = obj.get_meta(meta)
			if prop_value is NodePath:
				obj.set(prop_name, obj.get_node(prop_value))
				push_error("unknown type:", prop_value)

It’s not exactly what I was looking for, but the get_meta put me in the right direction. Thanks for sharing!

ipdramon | 2023-03-11 13:37