Enhance NodePath property editing

This commit is contained in:
kobewi
2023-03-23 21:55:58 +01:00
parent 0ca8542329
commit cf36afd9d2
2 changed files with 118 additions and 36 deletions

View File

@ -40,6 +40,7 @@ class EditorFileDialog;
class EditorLocaleDialog;
class EditorResourcePicker;
class EditorSpinSlider;
class MenuButton;
class PropertySelector;
class SceneTreeDialog;
class TextEdit;
@ -649,8 +650,18 @@ public:
class EditorPropertyNodePath : public EditorProperty {
GDCLASS(EditorPropertyNodePath, EditorProperty);
enum {
ACTION_CLEAR,
ACTION_COPY,
ACTION_EDIT,
ACTION_SELECT,
};
Button *assign = nullptr;
Button *clear = nullptr;
MenuButton *menu = nullptr;
LineEdit *edit = nullptr;
SceneTreeDialog *scene_tree = nullptr;
NodePath base_hint;
bool use_path_from_scene_root = false;
@ -659,8 +670,12 @@ class EditorPropertyNodePath : public EditorProperty {
Vector<StringName> valid_types;
void _node_selected(const NodePath &p_path);
void _node_assign();
void _node_clear();
Node *get_base_node();
void _update_menu();
void _menu_option(int p_idx);
void _accept_text();
void _text_submitted(const String &p_text);
const NodePath _get_node_path() const;
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
@ -670,7 +685,6 @@ class EditorPropertyNodePath : public EditorProperty {
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
void _notification(int p_what);
public: