diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-11-12 09:20:38 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-11-12 09:20:38 -0300 |
commit | c1855dcff14a118828de16e850b0698dc76b25e9 (patch) | |
tree | aac5e3efbaa061305ecdf195fa169e884439d279 | |
parent | 7eabbeb5af3ded3e291afc3d743082429e532d86 (diff) |
Properly fix node path selection in input ports, closes #12152
-rw-r--r-- | modules/visual_script/visual_script_editor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 03015df844..15e20effc0 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -2764,6 +2764,23 @@ void VisualScriptEditor::_default_value_edited(Node *p_button, int p_id, int p_i default_value_edit->set_position(Object::cast_to<Control>(p_button)->get_global_position() + Vector2(0, Object::cast_to<Control>(p_button)->get_size().y)); default_value_edit->set_size(Size2(1, 1)); + + if (pinfo.type == Variant::NODE_PATH) { + + Node *edited_scene = get_tree()->get_edited_scene_root(); + Node *script_node = _find_script_node(edited_scene, edited_scene, script); + + if (script_node) { + //pick a node relative to the script, IF the script exists + pinfo.hint = PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE; + pinfo.hint_string = script_node->get_path(); + } else { + //pick a path relative to edited scene + pinfo.hint = PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE; + pinfo.hint_string = get_tree()->get_edited_scene_root()->get_path(); + } + } + if (default_value_edit->edit(NULL, pinfo.name, pinfo.type, existing, pinfo.hint, pinfo.hint_string)) { if (pinfo.hint == PROPERTY_HINT_MULTILINE_TEXT) default_value_edit->popup_centered_ratio(); |