Skip to content

NodePath is missing constructors with Vector<StringName> #1766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aaronfranke opened this issue Apr 13, 2025 · 0 comments
Open

NodePath is missing constructors with Vector<StringName> #1766

aaronfranke opened this issue Apr 13, 2025 · 0 comments

Comments

@aaronfranke
Copy link
Member

aaronfranke commented Apr 13, 2025

Godot version

4.4.stable

godot-cpp version

4d8c05f

System information

macOS 14.6.1

Issue description

In the core engine, NodePath has the following constructors:

NodePath(const Vector<StringName> &p_path, bool p_absolute);
NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p_subpath, bool p_absolute);

These seem to be missing in godot-cpp. They're not in the generated NodePath header because the bindings don't have Vector<StringName>. We could manually add them in a separate header, but would that just convert it to a slash-delimited String and have the engine re-parse it, or should we have the engine expose TypedArray<StringName> functions?

Easy work-around:

NodePath _make_node_path(const Vector<StringName> &p_path) const {
#if GDEXTENSION
	PackedStringArray path_array;
	for (const StringName &name : p_path) {
		path_array.push_back(name);
	}
	String path_str = String("/").join(path_array);
	return NodePath(path_str);
#elif GODOT_MODULE
	return NodePath(p_path, false);
#endif
}

Steps to reproduce

N/A

Minimal reproduction project

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant