godotengine / godotengine/godot-cpp

Using NodePath editor hint with NativeScript

Open
#613 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.7k
Forks
809
Avg merge
1d 3h
Merged PRs (30d)
8

Description

So I am currently trying to replicate some like this with GDNative:
```gdscript
export(NodePath) var sample;
```
Desired Result:
![image](https://user-images.githubusercontent.com/21203171/133925068-b4b1fb05-49d5-4c41-b5e6-6a3a94d6a54f.png)

Here is what I've been testing, but it doesn't seem to get what I am looking for.
```cpp
register_property("sample", &SampleClass::sample, "", GODOT_METHOD_RPC_MODE_DISABLED, GODOT_PROPERTY_USAGE_EDITOR, GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE);
```
![image](https://user-images.githubusercontent.com/21203171/133925165-ccb30128-355e-425a-a2ec-95d628cde2f8.png)

Since `NodePath` is not a valid type for register_property, my thought is I could have used a string with the editor hint and convert it in my code.

I've also tried using a setter and getter, but I am guessing there is an alternative to `GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE` or something entirely outside of `register_property` I should be looking for.

Any suggestions or guidance would be amazing appreciated!!! :smile:

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.