From bcf27feb980aec593c7cb771984e46113cfad757 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 16 Dec 2014 22:31:57 -0300 Subject: New Code Completion -=-=-=-=-=-=-=-=-=- -Massive improvement to code completion -Argument hinting for functions If you manage to out-smart the code-completion in a situation where completion should be possible to guess, let me know. Please enter the commit message for your changes. Lines starting --- scene/main/node.cpp | 20 ++++++++++++++++++++ scene/main/node.h | 1 + 2 files changed, 21 insertions(+) (limited to 'scene/main') diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 45a30d7bca..d9b208d6d3 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1731,6 +1731,26 @@ NodePath Node::get_import_path() const { #endif +static void _add_nodes_to_options(const Node *p_base,const Node *p_node,List*r_options) { + + if (p_node!=p_base && !p_node->get_owner()) + return; + String n = p_base->get_path_to(p_node); + r_options->push_back("\""+n+"\""); + for(int i=0;iget_child_count();i++) { + _add_nodes_to_options(p_base,p_node->get_child(i),r_options); + } +} + +void Node::get_argument_options(const StringName& p_function,int p_idx,List*r_options) const { + + String pf=p_function; + if ((pf=="has_node" || pf=="get_node") && p_idx==0) { + + _add_nodes_to_options(this,this,r_options); + } + Object::get_argument_options(p_function,p_idx,r_options); +} void Node::_bind_methods() { diff --git a/scene/main/node.h b/scene/main/node.h index 371a5325ca..47f49eb625 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -284,6 +284,7 @@ public: NodePath get_import_path() const; #endif + void get_argument_options(const StringName& p_function,int p_idx,List*r_options) const; _FORCE_INLINE_ Viewport *get_viewport() const { return data.viewport; } -- cgit v1.2.3