ソースを参照

Proper function/property selection in visual script editing for property.
This one has an ordered list, built-in description, search, etc.

Juan Linietsky 9 年 前
コミット
ad8f208bdb

+ 8 - 0
core/object.h

@@ -70,6 +70,14 @@ enum PropertyHint {
 	PROPERTY_HINT_OBJECT_ID,
 	PROPERTY_HINT_TYPE_STRING, ///< a type string, the hint is the base type to choose
 	PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, ///< so something else can provide this (used in scripts)
+	PROPERTY_HINT_METHOD_OF_VARIANT_TYPE, ///< a method of a type
+	PROPERTY_HINT_METHOD_OF_BASE_TYPE, ///< a method of a base type
+	PROPERTY_HINT_METHOD_OF_INSTANCE, ///< a method of an instance
+	PROPERTY_HINT_METHOD_OF_SCRIPT, ///< a method of a script & base
+	PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type
+	PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, ///< a property of a base type
+	PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance
+	PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base
 	PROPERTY_HINT_MAX,
 };
 

+ 1 - 0
core/script_language.h

@@ -114,6 +114,7 @@ public:
 
 	virtual void update_exports() {} //editor tool
 	virtual void get_script_method_list(List<MethodInfo> *p_list) const=0;
+	virtual void get_script_property_list(List<PropertyInfo> *p_list) const=0;
 
 
 	Script() {}

+ 35 - 0
modules/gdscript/gd_script.cpp

@@ -267,6 +267,41 @@ void GDScript::get_script_method_list(List<MethodInfo> *p_list) const {
 	}
 }
 
+void GDScript::get_script_property_list(List<PropertyInfo> *p_list) const {
+
+	const GDScript *sptr=this;
+	List<PropertyInfo> props;
+
+	while(sptr) {
+
+		Vector<_GDScriptMemberSort> msort;
+		for(Map<StringName,PropertyInfo>::Element *E=sptr->member_info.front();E;E=E->next()) {
+
+			_GDScriptMemberSort ms;
+			ERR_CONTINUE(!sptr->member_indices.has(E->key()));
+			ms.index=sptr->member_indices[E->key()].index;
+			ms.name=E->key();
+			msort.push_back(ms);
+
+		}
+
+		msort.sort();
+		msort.invert();
+		for(int i=0;i<msort.size();i++) {
+
+			props.push_front(sptr->member_info[msort[i].name]);
+
+		}
+
+		sptr = sptr->_base;
+	}
+
+	for (List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
+		p_list->push_back(E->get());
+	}
+
+}
+
 bool GDScript::has_method(const StringName& p_method) const {
 
 	return member_functions.has(p_method);

+ 3 - 0
modules/gdscript/gd_script.h

@@ -186,6 +186,9 @@ public:
 	virtual bool has_method(const StringName& p_method) const;
 	virtual MethodInfo get_method_info(const StringName& p_method) const;
 
+	virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
+
+
 	virtual ScriptLanguage *get_language() const;
 
 	GDScript();

+ 1 - 1
modules/visual_script/register_types.cpp

@@ -66,7 +66,7 @@ void register_visual_script_types() {
 	ObjectTypeDB::register_type<VisualScriptFunctionCall>();
 	ObjectTypeDB::register_type<VisualScriptPropertySet>();
 	ObjectTypeDB::register_type<VisualScriptPropertyGet>();
-	ObjectTypeDB::register_type<VisualScriptScriptCall>();
+//	ObjectTypeDB::register_type<VisualScriptScriptCall>();
 	ObjectTypeDB::register_type<VisualScriptEmitSignal>();
 
 	ObjectTypeDB::register_type<VisualScriptReturn>();

+ 12 - 1
modules/visual_script/visual_script.cpp

@@ -656,7 +656,7 @@ Dictionary VisualScript::_get_variable_info(const StringName& p_name) const{
 	return d;
 }
 
-void VisualScript::get_variable_list(List<StringName> *r_variables){
+void VisualScript::get_variable_list(List<StringName> *r_variables) const{
 
 
 	for (Map<StringName,Variable>::Element *E=variables.front();E;E=E->next()) {
@@ -1045,6 +1045,17 @@ MethodInfo VisualScript::get_method_info(const StringName& p_method) const{
 	return mi;
 }
 
+void VisualScript::get_script_property_list(List<PropertyInfo> *p_list) const {
+
+	List<StringName> vars;
+	get_variable_list(&vars);
+
+	for (List<StringName>::Element *E=vars.front();E;E=E->next()) {
+
+		p_list->push_back(variables[E->get()].info);
+	}
+}
+
 
 void VisualScript::_set_data(const Dictionary& p_data) {
 

+ 2 - 1
modules/visual_script/visual_script.h

@@ -275,7 +275,7 @@ public:
 	Variant get_variable_default_value(const StringName& p_name) const;
 	void set_variable_info(const StringName& p_name,const PropertyInfo& p_info);
 	PropertyInfo get_variable_info(const StringName& p_name) const;
-	void get_variable_list(List<StringName> *r_variables);
+	void get_variable_list(List<StringName> *r_variables) const;
 	void rename_variable(const StringName& p_name,const StringName& p_new_name);
 
 
@@ -325,6 +325,7 @@ public:
 	virtual bool has_method(const StringName& p_method) const;
 	virtual MethodInfo get_method_info(const StringName& p_method) const;
 
+	virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
 
 
 	VisualScript();

+ 12 - 1
modules/visual_script/visual_script_editor.cpp

@@ -438,6 +438,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
 			gnode->set_modulate(EditorSettings::get_singleton()->get("visual_script_editor/color_"+node->get_category()));
 		}
 
+
+
 		gnode->set_meta("__vnode",node);
 		gnode->set_name(itos(E->get()));
 		gnode->connect("dragged",this,"_node_moved",varray(E->get()));
@@ -1530,7 +1532,7 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
 			}
 
 			ofs/=EDSCALE;
-
+#if 0
 			Ref<VisualScriptScriptCall> vnode;
 			vnode.instance();
 			vnode->set_call_mode(VisualScriptScriptCall::CALL_MODE_SELF);
@@ -1550,6 +1552,7 @@ void VisualScriptEditor::drop_data_fw(const Point2& p_point,const Variant& p_dat
 				graph->set_selected(node);
 				_node_selected(node);
 			}
+#endif
 		}
 
 
@@ -2251,6 +2254,11 @@ void VisualScriptEditor::_graph_disconnected(const String& p_from,int p_from_slo
 }
 
 
+void VisualScriptEditor::_graph_connect_to_empty(const String& p_from,int p_from_slot,const Vector2& p_release_pos) {
+
+
+}
+
 void VisualScriptEditor::_default_value_changed() {
 
 
@@ -2410,6 +2418,8 @@ void VisualScriptEditor::_bind_methods() {
 
 	ObjectTypeDB::bind_method("_graph_connected",&VisualScriptEditor::_graph_connected);
 	ObjectTypeDB::bind_method("_graph_disconnected",&VisualScriptEditor::_graph_disconnected);
+	ObjectTypeDB::bind_method("_graph_connect_to_empty",&VisualScriptEditor::_graph_connect_to_empty);
+
 	ObjectTypeDB::bind_method("_update_graph_connections",&VisualScriptEditor::_update_graph_connections);
 	ObjectTypeDB::bind_method("_node_filter_changed",&VisualScriptEditor::_node_filter_changed);
 
@@ -2532,6 +2542,7 @@ VisualScriptEditor::VisualScriptEditor() {
 
 	graph->connect("connection_request",this,"_graph_connected");
 	graph->connect("disconnection_request",this,"_graph_disconnected");
+	graph->connect("connection_to_empty",this,"_graph_connect_to_empty");
 
 	edit_signal_dialog = memnew( AcceptDialog );
 	edit_signal_dialog->get_ok()->set_text(TTR("Close"));

+ 4 - 0
modules/visual_script/visual_script_editor.h

@@ -119,6 +119,8 @@ class VisualScriptEditor : public ScriptEditorBase {
 	void _remove_node(int p_id);
 	void _graph_connected(const String& p_from,int p_from_slot,const String& p_to,int p_to_slot);
 	void _graph_disconnected(const String& p_from,int p_from_slot,const String& p_to,int p_to_slot);
+	void _graph_connect_to_empty(const String& p_from,int p_from_slot,const Vector2& p_release_pos);
+
 	void _node_ports_changed(const String& p_func,int p_id);
 	void _available_node_doubleclicked();
 
@@ -147,6 +149,8 @@ class VisualScriptEditor : public ScriptEditorBase {
 	void _menu_option(int p_what);
 
 	void _graph_ofs_changed(const Vector2& p_ofs);
+
+
 protected:
 
 	void _notification(int p_what);

+ 59 - 603
modules/visual_script/visual_script_func_nodes.cpp

@@ -372,48 +372,30 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const
 	}
 
 	if (property.name=="function/function") {
-		property.hint=PROPERTY_HINT_ENUM;
-
-
-		List<MethodInfo> methods;
 
 		if (call_mode==CALL_MODE_BASIC_TYPE) {
 
-			if (basic_type==Variant::NIL) {
-				property.usage=0;
-				return; //nothing for nil
-			}
-			Variant::CallError ce;
-			Variant v = Variant::construct(basic_type,NULL,0,ce);
-			v.get_method_list(&methods);
-
-
-		} else {
-
-			StringName base = _get_base_type();
-			ObjectTypeDB::get_method_list(base,&methods);
-
-
-		}
-
-		List<String> mstring;
-		for (List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
-			if (E->get().name.begins_with("_"))
-				continue;
-			mstring.push_back(E->get().name.get_slice(":",0));
-		}
-
-		mstring.sort();
+			property.hint=PROPERTY_HINT_METHOD_OF_VARIANT_TYPE;
+			property.hint_string=Variant::get_type_name(basic_type);
 
-		String ml;
-		for (List<String>::Element *E=mstring.front();E;E=E->next()) {
+		} else if (call_mode==CALL_MODE_SELF && get_visual_script().is_valid()) {
+			property.hint=PROPERTY_HINT_METHOD_OF_SCRIPT;
+			property.hint_string=itos(get_visual_script()->get_instance_ID());
+		} else if (call_mode==CALL_MODE_INSTANCE) {
+			property.hint=PROPERTY_HINT_METHOD_OF_BASE_TYPE;
+			property.hint_string=base_type;
+		} else if (call_mode==CALL_MODE_NODE_PATH) {
+			Node *node = _get_base_node();
+			if (node) {
+				property.hint=PROPERTY_HINT_METHOD_OF_INSTANCE;
+				property.hint_string=itos(node->get_instance_ID());
+			} else {
+				property.hint=PROPERTY_HINT_METHOD_OF_BASE_TYPE;
+				property.hint_string=get_base_type();
+			}
 
-			if (ml!=String())
-				ml+=",";
-			ml+=E->get();
 		}
 
-		property.hint_string=ml;
 	}
 
 	if (property.name=="function/use_default_args") {
@@ -472,7 +454,7 @@ void VisualScriptFunctionCall::_bind_methods() {
 		bt+=Variant::get_type_name(Variant::Type(i));
 	}
 
-	ADD_PROPERTY(PropertyInfo(Variant::INT,"function/call_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance,Basic Type",PROPERTY_USAGE_NOEDITOR),_SCS("set_call_mode"),_SCS("get_call_mode"));
+	ADD_PROPERTY(PropertyInfo(Variant::INT,"function/call_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance,Basic Type"),_SCS("set_call_mode"),_SCS("get_call_mode"));
 	ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/base_type",PROPERTY_HINT_TYPE_STRING,"Object"),_SCS("set_base_type"),_SCS("get_base_type"));
 	ADD_PROPERTY(PropertyInfo(Variant::INT,"function/basic_type",PROPERTY_HINT_ENUM,bt),_SCS("set_basic_type"),_SCS("get_basic_type"));
 	ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH,"function/node_path",PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE),_SCS("set_base_path"),_SCS("get_base_path"));
@@ -577,7 +559,7 @@ VisualScriptNodeInstance* VisualScriptFunctionCall::instance(VisualScriptInstanc
 }
 VisualScriptFunctionCall::VisualScriptFunctionCall() {
 
-	call_mode=CALL_MODE_INSTANCE;
+	call_mode=CALL_MODE_SELF;
 	basic_type=Variant::NIL;
 	use_default_args=0;
 	base_type="Object";
@@ -978,61 +960,30 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo& property) const {
 	}
 
 	if (property.name=="property/property") {
-		property.hint=PROPERTY_HINT_ENUM;
-
-
-		List<PropertyInfo> pinfo;
-
 
 		if (call_mode==CALL_MODE_BASIC_TYPE) {
-			Variant::CallError ce;
-			Variant v;
-			if (basic_type==Variant::INPUT_EVENT) {
-				InputEvent ev;
-				ev.type=event_type;
-				v=ev;
-			} else {
-				v = Variant::construct(basic_type,NULL,0,ce);
-			}
-			v.get_property_list(&pinfo);
 
-		} else if (call_mode==CALL_MODE_NODE_PATH) {
+			property.hint=PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE;
+			property.hint_string=Variant::get_type_name(basic_type);
 
-			Node *n = _get_base_node();
-			if (n) {
-				n->get_property_list(&pinfo);
+		} else if (call_mode==CALL_MODE_SELF && get_visual_script().is_valid()) {
+			property.hint=PROPERTY_HINT_PROPERTY_OF_SCRIPT;
+			property.hint_string=itos(get_visual_script()->get_instance_ID());
+		} else if (call_mode==CALL_MODE_INSTANCE) {
+			property.hint=PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
+			property.hint_string=base_type;
+		} else if (call_mode==CALL_MODE_NODE_PATH) {
+			Node *node = _get_base_node();
+			if (node) {
+				property.hint=PROPERTY_HINT_PROPERTY_OF_INSTANCE;
+				property.hint_string=itos(node->get_instance_ID());
 			} else {
-				ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
+				property.hint=PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
+				property.hint_string=get_base_type();
 			}
-		} else {
-
 
-			ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
-
-		}
-
-		List<String> mstring;
-
-		for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
-
-			if (E->get().usage&PROPERTY_USAGE_EDITOR) {
-				mstring.push_back(E->get().name);
-			}
 		}
 
-		String ml;
-		for (List<String>::Element *E=mstring.front();E;E=E->next()) {
-
-			if (ml!=String())
-				ml+=",";
-			ml+=E->get();
-		}
-
-		if (ml==String()) {
-			property.usage=PROPERTY_USAGE_NOEDITOR; //do not show for editing if empty
-		} else {
-			property.hint_string=ml;
-		}
 	}
 
 	if (property.name=="value/builtin") {
@@ -1117,7 +1068,7 @@ void VisualScriptPropertySet::_bind_methods() {
 	}
 
 
-	ADD_PROPERTY(PropertyInfo(Variant::INT,"property/set_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance,Basic Type",PROPERTY_USAGE_NOEDITOR),_SCS("set_call_mode"),_SCS("get_call_mode"));
+	ADD_PROPERTY(PropertyInfo(Variant::INT,"property/set_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance,Basic Type"),_SCS("set_call_mode"),_SCS("get_call_mode"));
 	ADD_PROPERTY(PropertyInfo(Variant::STRING,"property/base_type",PROPERTY_HINT_TYPE_STRING,"Object"),_SCS("set_base_type"),_SCS("get_base_type"));
 	ADD_PROPERTY(PropertyInfo(Variant::INT,"property/basic_type",PROPERTY_HINT_ENUM,bt),_SCS("set_basic_type"),_SCS("get_basic_type"));
 	ADD_PROPERTY(PropertyInfo(Variant::INT,"property/event_type",PROPERTY_HINT_ENUM,et),_SCS("set_event_type"),_SCS("get_event_type"));
@@ -1250,7 +1201,7 @@ VisualScriptNodeInstance* VisualScriptPropertySet::instance(VisualScriptInstance
 
 VisualScriptPropertySet::VisualScriptPropertySet() {
 
-	call_mode=CALL_MODE_INSTANCE;
+	call_mode=CALL_MODE_SELF;
 	base_type="Object";
 	basic_type=Variant::NIL;
 	event_type=InputEvent::NONE;
@@ -1586,55 +1537,28 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo& property) const {
 	}
 
 	if (property.name=="property/property") {
-		property.hint=PROPERTY_HINT_ENUM;
-
-
-		List<PropertyInfo> pinfo;
 
 		if (call_mode==CALL_MODE_BASIC_TYPE) {
-			Variant::CallError ce;
-			Variant v;
-			if (basic_type==Variant::INPUT_EVENT) {
-				InputEvent ev;
-				ev.type=event_type;
-				v=ev;
-			} else {
-				v = Variant::construct(basic_type,NULL,0,ce);
-			}
-			v.get_property_list(&pinfo);
 
-		} else if (call_mode==CALL_MODE_NODE_PATH) {
+			property.hint=PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE;
+			property.hint_string=Variant::get_type_name(basic_type);
 
-			Node *n = _get_base_node();
-			if (n) {
-				n->get_property_list(&pinfo);
+		} else if (call_mode==CALL_MODE_SELF && get_visual_script().is_valid()) {
+			property.hint=PROPERTY_HINT_PROPERTY_OF_SCRIPT;
+			property.hint_string=itos(get_visual_script()->get_instance_ID());
+		} else if (call_mode==CALL_MODE_INSTANCE) {
+			property.hint=PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
+			property.hint_string=base_type;
+		} else if (call_mode==CALL_MODE_NODE_PATH) {
+			Node *node = _get_base_node();
+			if (node) {
+				property.hint=PROPERTY_HINT_PROPERTY_OF_INSTANCE;
+				property.hint_string=itos(node->get_instance_ID());
 			} else {
-				ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
+				property.hint=PROPERTY_HINT_PROPERTY_OF_BASE_TYPE;
+				property.hint_string=get_base_type();
 			}
-		} else {
-			ObjectTypeDB::get_property_list(_get_base_type(),&pinfo);
-		}
-
-		List<String> mstring;
 
-		for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
-
-			if (E->get().usage&PROPERTY_USAGE_EDITOR)
-				mstring.push_back(E->get().name);
-		}
-
-		String ml;
-		for (List<String>::Element *E=mstring.front();E;E=E->next()) {
-
-			if (ml!=String())
-				ml+=",";
-			ml+=E->get();
-		}
-
-		if (ml==String()) {
-			property.usage=PROPERTY_USAGE_NOEDITOR; //do not show for editing if empty
-		} else {
-			property.hint_string=ml;
 		}
 
 	}
@@ -1680,7 +1604,7 @@ void VisualScriptPropertyGet::_bind_methods() {
 	}
 
 
-	ADD_PROPERTY(PropertyInfo(Variant::INT,"property/set_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance",PROPERTY_USAGE_NOEDITOR),_SCS("set_call_mode"),_SCS("get_call_mode"));
+	ADD_PROPERTY(PropertyInfo(Variant::INT,"property/set_mode",PROPERTY_HINT_ENUM,"Self,Node Path,Instance"),_SCS("set_call_mode"),_SCS("get_call_mode"));
 	ADD_PROPERTY(PropertyInfo(Variant::STRING,"property/base_type",PROPERTY_HINT_TYPE_STRING,"Object"),_SCS("set_base_type"),_SCS("get_base_type"));
 	ADD_PROPERTY(PropertyInfo(Variant::INT,"property/basic_type",PROPERTY_HINT_ENUM,bt),_SCS("set_basic_type"),_SCS("get_basic_type"));
 	ADD_PROPERTY(PropertyInfo(Variant::INT,"property/event_type",PROPERTY_HINT_ENUM,et),_SCS("set_event_type"),_SCS("get_event_type"));
@@ -1797,7 +1721,7 @@ VisualScriptNodeInstance* VisualScriptPropertyGet::instance(VisualScriptInstance
 
 VisualScriptPropertyGet::VisualScriptPropertyGet() {
 
-	call_mode=CALL_MODE_INSTANCE;
+	call_mode=CALL_MODE_SELF;
 	base_type="Object";
 	basic_type=Variant::NIL;
 	event_type=InputEvent::NONE;
@@ -1814,463 +1738,6 @@ static Ref<VisualScriptNode> create_property_get_node(const String& p_name) {
 }
 
 
-//////////////////////////////////////////
-////////////////SCRIPT CALL//////////////////////
-//////////////////////////////////////////
-
-int VisualScriptScriptCall::get_output_sequence_port_count() const {
-
-	return 1;
-}
-
-bool VisualScriptScriptCall::has_input_sequence_port() const{
-
-	return true;
-}
-
-Node *VisualScriptScriptCall::_get_base_node() const {
-
-#ifdef TOOLS_ENABLED
-	Ref<Script> script = get_visual_script();
-	if (!script.is_valid())
-		return NULL;
-
-	MainLoop * main_loop = OS::get_singleton()->get_main_loop();
-	if (!main_loop)
-		return NULL;
-
-	SceneTree *scene_tree = main_loop->cast_to<SceneTree>();
-
-	if (!scene_tree)
-		return NULL;
-
-	Node *edited_scene = scene_tree->get_edited_scene_root();
-
-	if (!edited_scene)
-		return NULL;
-
-	Node* script_node = _find_script_node(edited_scene,edited_scene,script);
-
-	if (!script_node)
-		return NULL;
-
-	if (!script_node->has_node(base_path))
-		return NULL;
-
-	Node *path_to = script_node->get_node(base_path);
-
-	return path_to;
-#else
-
-	return NULL;
-#endif
-}
-
-
-int VisualScriptScriptCall::get_input_value_port_count() const{
-
-#if 1
-	return argument_count;
-#else
-	if (call_mode==CALL_MODE_SELF) {
-
-		Ref<VisualScript> vs = get_visual_script();
-		if (vs.is_valid()) {
-
-			if (!vs->has_function(function))
-				return 0;
-
-			int id = vs->get_function_node_id(function);
-			if (id<0)
-				return 0;
-
-			Ref<VisualScriptFunction> func = vs->get_node(function,id);
-
-			return func->get_argument_count();
-		}
-	} else {
-
-		Node*base = _get_base_node();
-		if (!base)
-			return 0;
-		Ref<Script> script = base->get_script();
-		if (!script.is_valid())
-			return 0;
-
-		List<MethodInfo> functions;
-		script->get_method_list(&functions);
-		for (List<MethodInfo>::Element *E=functions.front();E;E=E->next()) {
-			if (E->get().name==function) {
-				return E->get().arguments.size();
-			}
-		}
-
-	}
-
-
-	return 0;
-#endif
-
-}
-int VisualScriptScriptCall::get_output_value_port_count() const{
-	return 1;
-}
-
-String VisualScriptScriptCall::get_output_sequence_port_text(int p_port) const {
-
-	return String();
-}
-
-PropertyInfo VisualScriptScriptCall::get_input_value_port_info(int p_idx) const{
-
-	if (call_mode==CALL_MODE_SELF) {
-
-		Ref<VisualScript> vs = get_visual_script();
-		if (vs.is_valid()) {
-
-			if (!vs->has_function(function))
-				return PropertyInfo();
-
-			int id = vs->get_function_node_id(function);
-			if (id<0)
-				return PropertyInfo();
-
-			Ref<VisualScriptFunction> func = vs->get_node(function,id);
-
-			if (p_idx>=func->get_argument_count())
-				return PropertyInfo();
-			return PropertyInfo(func->get_argument_type(p_idx),func->get_argument_name(p_idx));
-		}
-	} else {
-
-		Node*base = _get_base_node();
-		if (!base)
-			return PropertyInfo();
-		Ref<Script> script = base->get_script();
-		if (!script.is_valid())
-			return PropertyInfo();
-
-		List<MethodInfo> functions;
-		script->get_script_method_list(&functions);
-		for (List<MethodInfo>::Element *E=functions.front();E;E=E->next()) {
-			if (E->get().name==function) {
-				if (p_idx<0 || p_idx>=E->get().arguments.size())
-					return PropertyInfo();
-				return E->get().arguments[p_idx];
-			}
-		}
-
-	}
-
-	return PropertyInfo();
-
-}
-
-PropertyInfo VisualScriptScriptCall::get_output_value_port_info(int p_idx) const{
-
-	return PropertyInfo();
-}
-
-
-String VisualScriptScriptCall::get_caption() const {
-
-	return "ScriptCall";
-}
-
-String VisualScriptScriptCall::get_text() const {
-
-	return "  "+String(function)+"()";
-}
-
-void VisualScriptScriptCall::_update_argument_count() {
-
-	//try to remember the amount of arguments in the function, because if loaded from scratch
-	//this information will not be available
-
-	if (call_mode==CALL_MODE_SELF) {
-
-		Ref<VisualScript> vs = get_visual_script();
-		if (vs.is_valid()) {
-
-			if (!vs->has_function(function))
-				return ;
-
-			int id = vs->get_function_node_id(function);
-			if (id<0)
-				return;
-
-			Ref<VisualScriptFunction> func = vs->get_node(function,id);
-
-			argument_count=func->get_argument_count();
-		}
-	} else {
-
-		Node*base = _get_base_node();
-		if (!base)
-			return;
-
-		Ref<Script> script = base->get_script();
-		if (!script.is_valid())
-			return ;
-
-		List<MethodInfo> functions;
-		script->get_method_list(&functions);
-		for (List<MethodInfo>::Element *E=functions.front();E;E=E->next()) {
-			if (E->get().name==function) {
-				argument_count=E->get().arguments.size();
-				return;
-			}
-		}
-
-	}
-}
-
-
-void VisualScriptScriptCall::set_function(const StringName& p_type){
-
-	if (function==p_type)
-		return;
-
-	function=p_type;
-	_update_argument_count();
-	_change_notify();
-	ports_changed_notify();
-}
-StringName VisualScriptScriptCall::get_function() const {
-
-
-	return function;
-}
-
-void VisualScriptScriptCall::set_base_path(const NodePath& p_type) {
-
-	if (base_path==p_type)
-		return;
-
-	base_path=p_type;
-	_update_argument_count();
-	_change_notify();
-	ports_changed_notify();
-}
-
-NodePath VisualScriptScriptCall::get_base_path() const {
-
-	return base_path;
-}
-
-
-void VisualScriptScriptCall::set_call_mode(CallMode p_mode) {
-
-	if (call_mode==p_mode)
-		return;
-
-	call_mode=p_mode;
-	_update_argument_count();
-	_change_notify();
-	ports_changed_notify();
-
-}
-
-void VisualScriptScriptCall::set_argument_count(int p_count) {
-
-	argument_count=p_count;
-	_change_notify();
-	ports_changed_notify();
-
-}
-
-int VisualScriptScriptCall::get_argument_count() const {
-
-	return argument_count;
-}
-
-VisualScriptScriptCall::CallMode VisualScriptScriptCall::get_call_mode() const {
-
-	return call_mode;
-}
-
-void VisualScriptScriptCall::_validate_property(PropertyInfo& property) const {
-
-
-
-	if (property.name=="function/node_path") {
-		if (call_mode!=CALL_MODE_NODE_PATH) {
-			property.usage=0;
-		} else {
-
-			Node *bnode = _get_base_node();
-			if (bnode) {
-				property.hint_string=bnode->get_path(); //convert to loong string
-			} else {
-
-			}
-		}
-	}
-
-	if (property.name=="function/function") {
-		property.hint=PROPERTY_HINT_ENUM;
-
-
-		List<MethodInfo> methods;
-
-		if (call_mode==CALL_MODE_SELF) {
-
-			Ref<VisualScript> vs = get_visual_script();
-			if (vs.is_valid()) {
-
-				vs->get_script_method_list(&methods);
-
-			}
-		} else {
-
-			Node*base = _get_base_node();
-			if (!base)
-				return;
-			Ref<Script> script = base->get_script();
-			if (!script.is_valid())
-				return;
-
-			script->get_script_method_list(&methods);
-
-		}
-
-		List<String> mstring;
-		for (List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
-			if (E->get().name.begins_with("_"))
-				continue;
-			mstring.push_back(E->get().name.get_slice(":",0));
-		}
-
-		mstring.sort();
-
-		String ml;
-		for (List<String>::Element *E=mstring.front();E;E=E->next()) {
-
-			if (ml!=String())
-				ml+=",";
-			ml+=E->get();
-		}
-
-		property.hint_string=ml;
-	}
-
-}
-
-
-void VisualScriptScriptCall::_bind_methods() {
-
-	ObjectTypeDB::bind_method(_MD("set_function","function"),&VisualScriptScriptCall::set_function);
-	ObjectTypeDB::bind_method(_MD("get_function"),&VisualScriptScriptCall::get_function);
-
-	ObjectTypeDB::bind_method(_MD("set_call_mode","mode"),&VisualScriptScriptCall::set_call_mode);
-	ObjectTypeDB::bind_method(_MD("get_call_mode"),&VisualScriptScriptCall::get_call_mode);
-
-	ObjectTypeDB::bind_method(_MD("set_base_path","base_path"),&VisualScriptScriptCall::set_base_path);
-	ObjectTypeDB::bind_method(_MD("get_base_path"),&VisualScriptScriptCall::get_base_path);
-
-	ObjectTypeDB::bind_method(_MD("set_argument_count","argument_count"),&VisualScriptScriptCall::set_argument_count);
-	ObjectTypeDB::bind_method(_MD("get_argument_count"),&VisualScriptScriptCall::get_argument_count);
-
-	ADD_PROPERTY(PropertyInfo(Variant::INT,"function/call_mode",PROPERTY_HINT_ENUM,"Self,Node Path"),_SCS("set_call_mode"),_SCS("get_call_mode"));
-	ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH,"function/node_path",PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE),_SCS("set_base_path"),_SCS("get_base_path"));
-	ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/function"),_SCS("set_function"),_SCS("get_function"));
-	ADD_PROPERTY(PropertyInfo(Variant::STRING,"function/argument_count"),_SCS("set_argument_count"),_SCS("get_argument_count"));
-
-	BIND_CONSTANT( CALL_MODE_SELF );
-	BIND_CONSTANT( CALL_MODE_NODE_PATH);
-
-}
-
-class VisualScriptNodeInstanceScriptCall : public VisualScriptNodeInstance {
-public:
-
-
-	VisualScriptScriptCall::CallMode call_mode;
-	NodePath node_path;
-	int input_args;
-	bool returns;
-	StringName function;
-
-	VisualScriptScriptCall *node;
-	VisualScriptInstance *instance;
-
-
-
-	//virtual int get_working_memory_size() const { return 0; }
-	//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
-	//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; }
-
-	virtual int step(const Variant** p_inputs,Variant** p_outputs,StartMode p_start_mode,Variant* p_working_mem,Variant::CallError& r_error,String& r_error_str) {
-
-
-		switch(call_mode) {
-
-			case VisualScriptScriptCall::CALL_MODE_SELF: {
-
-				Object *object=instance->get_owner_ptr();
-
-				*p_outputs[0] = object->call(function,p_inputs,input_args,r_error);
-
-			} break;
-			case VisualScriptScriptCall::CALL_MODE_NODE_PATH: {
-
-				Node* node = instance->get_owner_ptr()->cast_to<Node>();
-				if (!node) {
-					r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
-					r_error_str="Base object is not a Node!";
-					return 0;
-				}
-
-				Node* another = node->get_node(node_path);
-				if (!node) {
-					r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
-					r_error_str="Path does not lead Node!";
-					return 0;
-				}
-
-
-				*p_outputs[0] = another->call(function,p_inputs,input_args,r_error);
-
-			} break;
-
-		}
-		return 0;
-
-	}
-
-
-};
-
-VisualScriptNodeInstance* VisualScriptScriptCall::instance(VisualScriptInstance* p_instance) {
-
-	VisualScriptNodeInstanceScriptCall * instance = memnew(VisualScriptNodeInstanceScriptCall );
-	instance->node=this;
-	instance->instance=p_instance;
-	instance->function=function;
-	instance->call_mode=call_mode;
-	instance->node_path=base_path;
-	instance->input_args = argument_count;
-	return instance;
-}
-
-VisualScriptScriptCall::VisualScriptScriptCall() {
-
-	call_mode=CALL_MODE_SELF;
-	argument_count=0;
-
-
-}
-
-template<VisualScriptScriptCall::CallMode cmode>
-static Ref<VisualScriptNode> create_script_call_node(const String& p_name) {
-
-	Ref<VisualScriptScriptCall> node;
-	node.instance();
-	node->set_call_mode(cmode);
-	return node;
-}
-
-
 //////////////////////////////////////////
 ////////////////EMIT//////////////////////
 //////////////////////////////////////////
@@ -2475,24 +1942,13 @@ static Ref<VisualScriptNode> create_basic_type_call_node(const String& p_name) {
 
 void register_visual_script_func_nodes() {
 
-	VisualScriptLanguage::singleton->add_register_func("functions/call_method/call_instance",create_function_call_node<VisualScriptFunctionCall::CALL_MODE_INSTANCE>);
-	VisualScriptLanguage::singleton->add_register_func("functions/call_method/call_basic_type",create_function_call_node<VisualScriptFunctionCall::CALL_MODE_BASIC_TYPE>);
-	VisualScriptLanguage::singleton->add_register_func("functions/call_method/call_self",create_function_call_node<VisualScriptFunctionCall::CALL_MODE_SELF>);
-	VisualScriptLanguage::singleton->add_register_func("functions/call_method/call_node",create_function_call_node<VisualScriptFunctionCall::CALL_MODE_NODE_PATH>);
-
-	VisualScriptLanguage::singleton->add_register_func("functions/property_set/instace_set",create_property_set_node<VisualScriptPropertySet::CALL_MODE_INSTANCE>);
-	VisualScriptLanguage::singleton->add_register_func("functions/property_set/basic_type_set",create_property_set_node<VisualScriptPropertySet::CALL_MODE_BASIC_TYPE>);
-	VisualScriptLanguage::singleton->add_register_func("functions/property_set/self_set",create_property_set_node<VisualScriptPropertySet::CALL_MODE_SELF>);
-	VisualScriptLanguage::singleton->add_register_func("functions/property_set/node_set",create_property_set_node<VisualScriptPropertySet::CALL_MODE_NODE_PATH>);
-
-	VisualScriptLanguage::singleton->add_register_func("functions/property_get/instance_get",create_property_get_node<VisualScriptPropertyGet::CALL_MODE_INSTANCE>);
-	VisualScriptLanguage::singleton->add_register_func("functions/property_get/basic_type_get",create_property_get_node<VisualScriptPropertyGet::CALL_MODE_BASIC_TYPE>);
-	VisualScriptLanguage::singleton->add_register_func("functions/property_get/self_get",create_property_get_node<VisualScriptPropertyGet::CALL_MODE_SELF>);
-	VisualScriptLanguage::singleton->add_register_func("functions/property_get/node_get",create_property_get_node<VisualScriptPropertyGet::CALL_MODE_NODE_PATH>);
+	VisualScriptLanguage::singleton->add_register_func("functions/call",create_node_generic<VisualScriptFunctionCall>);
+	VisualScriptLanguage::singleton->add_register_func("functions/set",create_node_generic<VisualScriptPropertySet>);
+	VisualScriptLanguage::singleton->add_register_func("functions/get",create_node_generic<VisualScriptPropertyGet>);
 
-	VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_self",create_script_call_node<VisualScriptScriptCall::CALL_MODE_SELF>);
-	VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_node",create_script_call_node<VisualScriptScriptCall::CALL_MODE_NODE_PATH>);
-	VisualScriptLanguage::singleton->add_register_func("functions/call_script/emit_signal",create_node_generic<VisualScriptEmitSignal>);
+	//VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_self",create_script_call_node<VisualScriptScriptCall::CALL_MODE_SELF>);
+//	VisualScriptLanguage::singleton->add_register_func("functions/call_script/call_node",create_script_call_node<VisualScriptScriptCall::CALL_MODE_NODE_PATH>);
+	VisualScriptLanguage::singleton->add_register_func("functions/emit_signal",create_node_generic<VisualScriptEmitSignal>);
 
 
 	for(int i=0;i<Variant::VARIANT_MAX;i++) {

+ 0 - 68
modules/visual_script/visual_script_func_nodes.h

@@ -244,74 +244,6 @@ VARIANT_ENUM_CAST(VisualScriptPropertyGet::CallMode );
 
 
 
-class VisualScriptScriptCall : public VisualScriptNode {
-
-	OBJ_TYPE(VisualScriptScriptCall,VisualScriptNode)
-public:
-	enum CallMode {
-		CALL_MODE_SELF,
-		CALL_MODE_NODE_PATH,
-	};
-private:
-
-	CallMode call_mode;
-	NodePath base_path;
-	StringName function;
-	int argument_count;
-
-
-	Node *_get_base_node() const;
-
-
-	void _update_argument_count();
-protected:
-	virtual void _validate_property(PropertyInfo& property) const;
-
-	static void _bind_methods();
-
-public:
-
-	virtual int get_output_sequence_port_count() const;
-	virtual bool has_input_sequence_port() const;
-
-
-	virtual String get_output_sequence_port_text(int p_port) const;
-
-
-	virtual int get_input_value_port_count() const;
-	virtual int get_output_value_port_count() const;
-
-
-	virtual PropertyInfo get_input_value_port_info(int p_idx) const;
-	virtual PropertyInfo get_output_value_port_info(int p_idx) const;
-
-	virtual String get_caption() const;
-	virtual String get_text() const;
-	virtual String get_category() const { return "functions"; }
-
-	void set_function(const StringName& p_type);
-	StringName get_function() const;
-
-	void set_base_path(const NodePath& p_type);
-	NodePath get_base_path() const;
-
-	void set_call_mode(CallMode p_mode);
-	CallMode get_call_mode() const;
-
-	void set_argument_count(int p_count);
-	int get_argument_count() const;
-
-
-	virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
-
-	VisualScriptScriptCall();
-};
-
-VARIANT_ENUM_CAST(VisualScriptScriptCall::CallMode );
-
-
-
-
 class VisualScriptEmitSignal : public VisualScriptNode {
 
 	OBJ_TYPE(VisualScriptEmitSignal,VisualScriptNode)

+ 1 - 1
modules/visual_script/visual_script_yield_nodes.cpp

@@ -595,7 +595,7 @@ VisualScriptNodeInstance* VisualScriptYieldSignal::instance(VisualScriptInstance
 }
 VisualScriptYieldSignal::VisualScriptYieldSignal() {
 
-	call_mode=CALL_MODE_INSTANCE;
+	call_mode=CALL_MODE_SELF;
 	base_type="Object";
 
 }

+ 6 - 0
scene/gui/graph_edit.cpp

@@ -575,6 +575,11 @@ void GraphEdit::_top_layer_input(const InputEvent& p_ev) {
 			}
 			emit_signal("connection_request",from,from_slot,to,to_slot);
 
+		} else {
+			String from = connecting_from;
+			int from_slot = connecting_index;
+			Vector2 ofs = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);
+			emit_signal("connection_to_empty",from,from_slot,ofs);
 		}
 		connecting=false;
 		top_layer->update();
@@ -1166,6 +1171,7 @@ void GraphEdit::_bind_methods() {
 	ADD_SIGNAL(MethodInfo("popup_request", PropertyInfo(Variant::VECTOR2,"p_position")));
 	ADD_SIGNAL(MethodInfo("duplicate_nodes_request"));
 	ADD_SIGNAL(MethodInfo("node_selected",PropertyInfo(Variant::OBJECT,"node")));
+	ADD_SIGNAL(MethodInfo("connection_to_empty",PropertyInfo(Variant::STRING,"from"),PropertyInfo(Variant::INT,"from_slot"),PropertyInfo(Variant::VECTOR2,"release_pos")));
 	ADD_SIGNAL(MethodInfo("delete_nodes_request"));
 	ADD_SIGNAL(MethodInfo("_begin_node_move"));
 	ADD_SIGNAL(MethodInfo("_end_node_move"));

+ 138 - 0
tools/editor/property_editor.cpp

@@ -46,6 +46,7 @@
 #include "scene/main/viewport.h"
 #include "editor_file_system.h"
 #include "create_dialog.h"
+#include "property_selector.h"
 
 void CustomPropertyEditor::_notification(int p_what) {
 
@@ -438,6 +439,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
 
 			} else if (hint==PROPERTY_HINT_TYPE_STRING) {
 
+
 				if (!create_dialog) {
 					create_dialog = memnew( CreateDialog );
 					create_dialog->connect("create",this,"_create_dialog_callback");
@@ -452,6 +454,112 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
 
 				create_dialog->popup(false);
 				hide();
+				updating=false;
+				return false;
+
+
+			} else if (hint==PROPERTY_HINT_METHOD_OF_VARIANT_TYPE) {
+#define MAKE_PROPSELECT if (!property_select) { property_select = memnew(PropertySelector); property_select->connect("selected",this,"_create_selected_property"); add_child(property_select); } hide();
+
+				MAKE_PROPSELECT;
+
+				Variant::Type type=Variant::NIL;
+				for(int i=0;i<Variant::VARIANT_MAX;i++) {
+					if (hint_text==Variant::get_type_name(Variant::Type(i))) {
+						type=Variant::Type(i);
+					}
+				}
+				if (type)
+					property_select->select_method_from_basic_type(type,v);
+				updating=false;
+				return false;
+
+			} else if (hint==PROPERTY_HINT_METHOD_OF_BASE_TYPE) {
+				MAKE_PROPSELECT
+
+				property_select->select_method_from_base_type(hint_text,v);
+
+				updating=false;
+				return false;
+
+			} else if (hint==PROPERTY_HINT_METHOD_OF_INSTANCE) {
+
+				MAKE_PROPSELECT
+
+				Object *instance = ObjectDB::get_instance(hint_text.to_int64());
+				if (instance)
+					property_select->select_method_from_instance(instance,v);
+				updating=false;
+				return false;
+
+			} else if (hint==PROPERTY_HINT_METHOD_OF_SCRIPT) {
+				MAKE_PROPSELECT
+
+				Object *obj = ObjectDB::get_instance(hint_text.to_int64());
+				if (obj && obj->cast_to<Script>()) {
+					property_select->select_method_from_script(obj->cast_to<Script>(),v);
+				}
+
+				updating=false;
+				return false;
+
+			} else if (hint==PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE) {
+
+				MAKE_PROPSELECT
+				Variant::Type type=Variant::NIL;
+				String tname=hint_text;
+				if (tname.find(".")!=-1)
+					tname=tname.get_slice(".",0);
+				for(int i=0;i<Variant::VARIANT_MAX;i++) {
+					if (tname==Variant::get_type_name(Variant::Type(i))) {
+						type=Variant::Type(Variant::Type(i));
+					}
+				}
+				InputEvent::Type iet = InputEvent::NONE;
+				if (hint_text.find(".")!=-1) {
+					iet=InputEvent::Type(int(hint_text.get_slice(".",1).to_int()));
+				}
+				if (type)
+					property_select->select_property_from_basic_type(type,iet,v);
+
+				updating=false;
+				return false;
+
+			} else if (hint==PROPERTY_HINT_PROPERTY_OF_BASE_TYPE) {
+
+				MAKE_PROPSELECT
+
+				property_select->select_property_from_base_type(hint_text,v);
+
+				updating=false;
+				return false;
+
+			} else if (hint==PROPERTY_HINT_PROPERTY_OF_INSTANCE) {
+
+				Object *instance = ObjectDB::get_instance(hint_text.to_int64());
+				if (instance)
+					property_select->select_property_from_instance(instance,v);
+
+				updating=false;
+				return false;
+
+			} else if (hint==PROPERTY_HINT_PROPERTY_OF_SCRIPT) {
+				MAKE_PROPSELECT
+
+				Object *obj = ObjectDB::get_instance(hint_text.to_int64());
+				if (obj && obj->cast_to<Script>()) {
+					property_select->select_property_from_script(obj->cast_to<Script>(),v);
+				}
+
+				updating=false;
+				return false;
+
+			} else if (hint==PROPERTY_HINT_TYPE_STRING) {
+				if (!create_dialog) {
+					create_dialog = memnew( CreateDialog );
+					create_dialog->connect("create",this,"_create_dialog_callback");
+					add_child(create_dialog);
+				}
 
 			} else {
 				List<String> names;
@@ -1360,6 +1468,13 @@ void CustomPropertyEditor::_create_dialog_callback() {
 	emit_signal("variant_changed");
 }
 
+void CustomPropertyEditor::_create_selected_property(const String& p_prop) {
+
+
+	v=p_prop;
+	emit_signal("variant_changed");
+}
+
 void CustomPropertyEditor::_modified(String p_string) {
 
 	if (updating)
@@ -1753,6 +1868,7 @@ void CustomPropertyEditor::_bind_methods() {
 	ObjectTypeDB::bind_method( "_text_edit_changed",&CustomPropertyEditor::_text_edit_changed);
 	ObjectTypeDB::bind_method( "_menu_option",&CustomPropertyEditor::_menu_option);
 	ObjectTypeDB::bind_method( "_create_dialog_callback",&CustomPropertyEditor::_create_dialog_callback);
+	ObjectTypeDB::bind_method( "_create_selected_property",&CustomPropertyEditor::_create_selected_property);
 
 
 
@@ -1877,6 +1993,7 @@ CustomPropertyEditor::CustomPropertyEditor() {
 	slider->connect("value_changed",this,"_range_modified");
 
 	create_dialog = NULL;
+	property_select = NULL;
 }
 
 bool PropertyEditor::_might_be_in_instance() {
@@ -2150,6 +2267,19 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
 				p_item->set_text(1,obj->get(p_name));
 			}
 
+			if (	p_hint==PROPERTY_HINT_METHOD_OF_VARIANT_TYPE ||
+				p_hint==PROPERTY_HINT_METHOD_OF_BASE_TYPE ||
+				p_hint==PROPERTY_HINT_METHOD_OF_INSTANCE ||
+				p_hint==PROPERTY_HINT_METHOD_OF_SCRIPT ||
+				p_hint==PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE ||
+				p_hint==PROPERTY_HINT_PROPERTY_OF_BASE_TYPE ||
+				p_hint==PROPERTY_HINT_PROPERTY_OF_INSTANCE ||
+				p_hint==PROPERTY_HINT_PROPERTY_OF_SCRIPT ) {
+
+				p_item->set_text(1,obj->get(p_name));
+			}
+
+
 			if (p_hint==PROPERTY_HINT_ENUM) {
 
 				Vector<String> strings = p_hint_text.split(",");
@@ -3172,6 +3302,13 @@ void PropertyEditor::update_tree() {
 
 
 					} break;
+					case PROPERTY_HINT_METHOD_OF_BASE_TYPE: ///< a method of a base type
+					case PROPERTY_HINT_METHOD_OF_INSTANCE: ///< a method of an instance
+					case PROPERTY_HINT_METHOD_OF_SCRIPT: ///< a method of a script & base
+					case PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE: ///< a property of a type
+					case PROPERTY_HINT_PROPERTY_OF_BASE_TYPE: ///< a property of a base type
+					case PROPERTY_HINT_PROPERTY_OF_INSTANCE: ///< a property of an instance
+					case PROPERTY_HINT_PROPERTY_OF_SCRIPT: ///< a property of a script & base
 					case PROPERTY_HINT_TYPE_STRING: {
 
 						item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM);
@@ -3181,6 +3318,7 @@ void PropertyEditor::update_tree() {
 						item->set_text(1,obj->get(p.name));
 
 					} break;
+
 					default: {
 
 						item->set_cell_mode( 1, TreeItem::CELL_MODE_STRING );

+ 4 - 0
tools/editor/property_editor.h

@@ -49,6 +49,8 @@
 
 class PropertyValueEvaluator;
 class CreateDialog;
+class PropertySelector;
+
 class CustomPropertyEditor : public Popup {
 
 	OBJ_TYPE( CustomPropertyEditor, Popup );
@@ -103,6 +105,7 @@ class CustomPropertyEditor : public Popup {
 
 	Control *easing_draw;
 	CreateDialog *create_dialog;
+	PropertySelector *property_select;
 
 	Object* owner;
 
@@ -120,6 +123,7 @@ class CustomPropertyEditor : public Popup {
 	void _action_pressed(int p_which);
 	void _type_create_selected(int p_idx);
 	void _create_dialog_callback();
+	void _create_selected_property(const String &p_prop);
 
 
 	void _color_changed(const Color& p_color);

+ 609 - 0
tools/editor/property_selector.cpp

@@ -0,0 +1,609 @@
+#include "property_selector.h"
+#include "editor_scale.h"
+
+#include "os/keyboard.h"
+#include "editor_help.h"
+
+void PropertySelector::_text_changed(const String& p_newtext) {
+
+	_update_search();
+}
+
+void PropertySelector::_sbox_input(const InputEvent& p_ie) {
+
+	if (p_ie.type==InputEvent::KEY) {
+
+		switch(p_ie.key.scancode) {
+			case KEY_UP:
+			case KEY_DOWN:
+			case KEY_PAGEUP:
+			case KEY_PAGEDOWN: {
+
+				search_options->call("_input_event", p_ie);
+				search_box->accept_event();
+
+				TreeItem *root = search_options->get_root();
+				if (!root->get_children())
+					break;
+
+				TreeItem *current = search_options->get_selected();
+
+				TreeItem *item = search_options->get_next_selected(root);
+				while (item) {
+					item->deselect(0);
+					item = search_options->get_next_selected(item);
+				}
+
+				current->select(0);
+
+			} break;
+		}
+	}
+}
+
+
+void PropertySelector::_update_search() {
+
+
+	if (properties)
+		set_title(TTR("Select Property"));
+	else
+		set_title(TTR("Select Method"));
+
+	search_options->clear();
+	rich_text->clear();
+
+
+	TreeItem *root = search_options->create_item();
+
+
+	if (properties) {
+
+		List<PropertyInfo> props;
+
+		if (instance) {
+			instance->get_property_list(&props,true);
+		} else if (type!=Variant::NIL) {
+			Variant v;
+			if (type==Variant::INPUT_EVENT) {
+				InputEvent ie;
+				ie.type=event_type;
+				v=ie;
+			} else {
+				Variant::CallError ce;
+				v=Variant::construct(type,NULL,0,ce);
+			}
+
+			v.get_property_list(&props);
+		} else {
+
+
+			Object *obj = ObjectDB::get_instance(script);
+			if (obj && obj->cast_to<Script>()) {
+
+				props.push_back(PropertyInfo(Variant::NIL,"Script Variables",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_CATEGORY));
+				obj->cast_to<Script>()->get_script_property_list(&props);
+			}
+
+			StringName base=base_type;
+			while(base) {
+				props.push_back(PropertyInfo(Variant::NIL,base,PROPERTY_HINT_NONE,"",PROPERTY_USAGE_CATEGORY));
+				ObjectTypeDB::get_property_list(base,&props,true);
+				base=ObjectTypeDB::type_inherits_from(base);
+			}
+
+		}
+
+		TreeItem *category=NULL;
+
+		bool found=false;
+
+		Ref<Texture> type_icons[Variant::VARIANT_MAX]={
+			Control::get_icon("MiniVariant","EditorIcons"),
+			Control::get_icon("MiniBoolean","EditorIcons"),
+			Control::get_icon("MiniInteger","EditorIcons"),
+			Control::get_icon("MiniFloat","EditorIcons"),
+			Control::get_icon("MiniString","EditorIcons"),
+			Control::get_icon("MiniVector2","EditorIcons"),
+			Control::get_icon("MiniRect2","EditorIcons"),
+			Control::get_icon("MiniVector3","EditorIcons"),
+			Control::get_icon("MiniMatrix2","EditorIcons"),
+			Control::get_icon("MiniPlane","EditorIcons"),
+			Control::get_icon("MiniQuat","EditorIcons"),
+			Control::get_icon("MiniAabb","EditorIcons"),
+			Control::get_icon("MiniMatrix3","EditorIcons"),
+			Control::get_icon("MiniTransform","EditorIcons"),
+			Control::get_icon("MiniColor","EditorIcons"),
+			Control::get_icon("MiniImage","EditorIcons"),
+			Control::get_icon("MiniPath","EditorIcons"),
+			Control::get_icon("MiniRid","EditorIcons"),
+			Control::get_icon("MiniObject","EditorIcons"),
+			Control::get_icon("MiniInput","EditorIcons"),
+			Control::get_icon("MiniDictionary","EditorIcons"),
+			Control::get_icon("MiniArray","EditorIcons"),
+			Control::get_icon("MiniRawArray","EditorIcons"),
+			Control::get_icon("MiniIntArray","EditorIcons"),
+			Control::get_icon("MiniFloatArray","EditorIcons"),
+			Control::get_icon("MiniStringArray","EditorIcons"),
+			Control::get_icon("MiniVector2Array","EditorIcons"),
+			Control::get_icon("MiniVector3Array","EditorIcons"),
+			Control::get_icon("MiniColorArray","EditorIcons")
+		};
+
+
+		for (List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
+			if (E->get().usage==PROPERTY_USAGE_CATEGORY) {
+				if (category && category->get_children()==NULL) {
+					memdelete(category); //old category was unused
+				}
+				category = search_options->create_item(root);
+				category->set_text(0,E->get().name);
+				category->set_selectable(0,false);
+
+				Ref<Texture> icon;
+				if (E->get().name=="Script Variables") {
+					icon=get_icon("Script","EditorIcons");
+				} else if (has_icon(E->get().name,"EditorIcons")) {
+					icon=get_icon(E->get().name,"EditorIcons");
+				} else {
+					icon=get_icon("Object","EditorIcons");
+				}
+				category->set_icon(0,icon);
+				continue;
+			}
+
+			if (!(E->get().usage&PROPERTY_USAGE_EDITOR))
+				continue;
+
+			if (search_box->get_text()!=String() && E->get().name.find(search_box->get_text())==-1)
+				continue;
+			TreeItem *item = search_options->create_item(category?category:root);
+			item->set_text(0,E->get().name);
+			item->set_metadata(0,E->get().name);
+			item->set_icon(0,type_icons[E->get().type]);
+
+			if (!found && search_box->get_text()!=String() && E->get().name.find(search_box->get_text())!=-1) {
+				item->select(0);
+				found=true;
+			}
+
+			item->set_selectable(0,true);
+		}
+
+		if (category && category->get_children()==NULL) {
+			memdelete(category); //old category was unused
+		}
+	} else {
+
+		List<MethodInfo> methods;
+
+		if (type!=Variant::NIL) {
+			Variant v;
+			Variant::CallError ce;
+			v=Variant::construct(type,NULL,0,ce);
+			v.get_method_list(&methods);
+		} else {
+
+
+			Object *obj = ObjectDB::get_instance(script);
+			if (obj && obj->cast_to<Script>()) {
+
+				methods.push_back(MethodInfo("*Script Methods"));
+				obj->cast_to<Script>()->get_script_method_list(&methods);
+			}
+
+			StringName base=base_type;
+			while(base) {
+				methods.push_back(MethodInfo("*"+String(base)));
+				ObjectTypeDB::get_method_list(base,&methods,true);
+				base=ObjectTypeDB::type_inherits_from(base);
+			}
+
+		}
+
+		TreeItem *category=NULL;
+
+		bool found=false;
+		bool script_methods=false;
+
+		for (List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
+			if (E->get().name.begins_with("*")) {
+				if (category && category->get_children()==NULL) {
+					memdelete(category); //old category was unused
+				}
+				category = search_options->create_item(root);
+				category->set_text(0,E->get().name.replace_first("*",""));
+				category->set_selectable(0,false);
+
+				Ref<Texture> icon;
+				script_methods=false;
+				if (E->get().name=="*Script Methods") {
+					icon=get_icon("Script","EditorIcons");
+					script_methods=true;
+				} else if (has_icon(E->get().name,"EditorIcons")) {
+					icon=get_icon(E->get().name,"EditorIcons");
+				} else {
+					icon=get_icon("Object","EditorIcons");
+				}
+				category->set_icon(0,icon);
+
+				continue;
+			}
+
+			String name = E->get().name.get_slice(":",0);
+			if (!script_methods && name.begins_with("_") && !(E->get().flags&METHOD_FLAG_VIRTUAL))
+				continue;
+
+			if (search_box->get_text()!=String() && name.find(search_box->get_text())==-1)
+				continue;
+
+			TreeItem *item = search_options->create_item(category?category:root);
+
+			MethodInfo mi=E->get();
+
+			String desc;
+			if (mi.name.find(":")!=-1) {
+				desc=mi.name.get_slice(":",1)+" ";
+				mi.name=mi.name.get_slice(":",0);
+			} else if (mi.return_val.type!=Variant::NIL)
+				desc=Variant::get_type_name(mi.return_val.type);
+			else
+				desc="void ";
+
+
+
+			desc+=" "+mi.name+" ( ";
+
+			for(int i=0;i<mi.arguments.size();i++) {
+
+				if (i>0)
+					desc+=", ";
+
+				if (mi.arguments[i].type==Variant::NIL)
+					desc+="var ";
+				else if (mi.arguments[i].name.find(":")!=-1) {
+					desc+=mi.arguments[i].name.get_slice(":",1)+" ";
+					mi.arguments[i].name=mi.arguments[i].name.get_slice(":",0);
+				} else
+					desc+=Variant::get_type_name(mi.arguments[i].type)+" ";
+
+				desc+=mi.arguments[i].name;
+
+			}
+
+			desc+=" )";
+
+			item->set_text(0,desc);
+			item->set_metadata(0,name);
+			item->set_selectable(0,true);
+
+			if (!found && search_box->get_text()!=String() && name.find(search_box->get_text())!=-1) {
+				item->select(0);
+				found=true;
+			}
+
+		}
+
+		if (category && category->get_children()==NULL) {
+			memdelete(category); //old category was unused
+		}
+
+	}
+
+	get_ok()->set_disabled(root->get_children()==NULL);
+
+}
+
+
+
+void PropertySelector::_confirmed() {
+
+	TreeItem *ti = search_options->get_selected();
+	if (!ti)
+		return;
+	emit_signal("selected",ti->get_metadata(0));
+	hide();
+}
+
+void PropertySelector::_item_selected() {
+
+	rich_text->clear();
+
+	TreeItem *item=search_options->get_selected();
+	if (!item)
+		return;
+	String name = item->get_metadata(0);
+
+	print_line("NAME: "+name);
+	String class_type;
+	if (properties && type==Variant::INPUT_EVENT) {
+
+		switch(event_type) {
+			case InputEvent::NONE:  class_type="InputEvent"; break;
+			case InputEvent::KEY:  class_type="InputEventKey"; break;
+			case InputEvent::MOUSE_MOTION:  class_type="InputEventMouseMotion"; break;
+			case InputEvent::MOUSE_BUTTON:  class_type="InputEventMouseButton"; break;
+			case InputEvent::JOYSTICK_MOTION:  class_type="InputEventJoystickMotion"; break;
+			case InputEvent::JOYSTICK_BUTTON:  class_type="InputEventJoystickButton"; break;
+			case InputEvent::SCREEN_TOUCH:  class_type="InputEventScreenTouch"; break;
+			case InputEvent::SCREEN_DRAG:  class_type="InputEventScreenDrag"; break;
+			case InputEvent::ACTION:  class_type="InputEventAction"; break;
+			default: {}
+		}
+
+	} else if (type) {
+		class_type=Variant::get_type_name(type);
+
+	} else {
+		class_type=base_type;
+	}
+
+	DocData *dd=EditorHelp::get_doc_data();
+	String text;
+
+
+	if (properties) {
+
+		String at_class=class_type;
+
+
+
+		while(at_class!=String()) {
+
+			print_line("AT CLASS: "+at_class);
+			Map<String,DocData::ClassDoc>::Element *E=dd->class_list.find(at_class);
+			if (E) {
+				for(int i=0;i<E->get().properties.size();i++) {
+					if (E->get().properties[i].name==name) {
+						print_line("FOUND PROP");
+						text=E->get().properties[i].description;
+					}
+				}
+			}
+
+			at_class=ObjectTypeDB::type_inherits_from(at_class);
+		}
+
+		if (text==String()) {
+
+			StringName setter;
+			StringName type;
+			print_line("AT SETGET: ");
+			if (ObjectTypeDB::get_setter_and_type_for_property(class_type,name,type,setter)) {
+				print_line("GOT: "+String(type));
+				Map<String,DocData::ClassDoc>::Element *E=dd->class_list.find(type);
+				if (E) {
+					for(int i=0;i<E->get().methods.size();i++) {
+						if (E->get().methods[i].name==setter.operator String()) {
+							print_line("FOUND");
+							text=E->get().methods[i].description;
+						}
+					}
+				}
+
+
+			}
+		}
+
+	} else {
+
+
+		String at_class=class_type;
+
+		while(at_class!=String()) {
+
+			print_line("AT CLASS: "+at_class);
+			Map<String,DocData::ClassDoc>::Element *E=dd->class_list.find(at_class);
+			if (E) {
+				for(int i=0;i<E->get().methods.size();i++) {
+					if (E->get().methods[i].name==name) {
+						print_line("FOUND");
+						text=E->get().methods[i].description;
+					}
+				}
+			}
+
+			at_class=ObjectTypeDB::type_inherits_from(at_class);
+		}
+	}
+
+
+	if (text==String())
+		return;
+
+	rich_text->parse_bbcode(text);
+
+
+
+}
+
+
+void PropertySelector::_notification(int p_what) {
+
+	if (p_what==NOTIFICATION_ENTER_TREE) {
+
+		connect("confirmed",this,"_confirmed");
+		description->add_style_override("bg",get_stylebox("normal","TextEdit"));
+	}
+}
+
+
+
+void PropertySelector::select_method_from_base_type(const String& p_base,const String& p_current) {
+
+	base_type=p_base;
+	selected=p_current;
+	type=Variant::NIL;
+	script=0;
+	properties=false;
+	instance=NULL;
+
+	popup_centered_ratio(0.6);
+	search_box->set_text("");
+	search_box->grab_focus();
+	_update_search();
+}
+
+void PropertySelector::select_method_from_script(const Ref<Script>& p_script,const String& p_current){
+
+	ERR_FAIL_COND( p_script.is_null() );
+	base_type=p_script->get_instance_base_type();
+	selected=p_current;
+	type=Variant::NIL;
+	script=p_script->get_instance_ID();
+	properties=false;
+	instance=NULL;
+
+	popup_centered_ratio(0.6);
+	search_box->set_text("");
+	search_box->grab_focus();
+	_update_search();
+
+}
+void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const String &p_current){
+
+	ERR_FAIL_COND(p_type==Variant::NIL);
+	base_type="";
+	selected=p_current;
+	type=p_type;
+	script=0;
+	properties=false;
+	instance=NULL;
+
+	popup_centered_ratio(0.6);
+	search_box->set_text("");
+	search_box->grab_focus();
+	_update_search();
+
+}
+
+void PropertySelector::select_method_from_instance(Object* p_instance, const String &p_current){
+
+
+	base_type=p_instance->get_type();
+	selected=p_current;
+	type=Variant::NIL;
+	script=0;
+	{
+		Ref<Script> scr = p_instance->get_script();
+		if (scr.is_valid())
+			script=scr->get_instance_ID();
+	}
+	properties=false;
+	instance=NULL;
+
+	popup_centered_ratio(0.6);
+	search_box->set_text("");
+	search_box->grab_focus();
+	_update_search();
+
+}
+
+
+void PropertySelector::select_property_from_base_type(const String& p_base,const String& p_current) {
+
+	base_type=p_base;
+	selected=p_current;
+	type=Variant::NIL;
+	script=0;
+	properties=true;
+	instance=NULL;
+
+	popup_centered_ratio(0.6);
+	search_box->set_text("");
+	search_box->grab_focus();
+	_update_search();
+}
+
+void PropertySelector::select_property_from_script(const Ref<Script>& p_script,const String& p_current){
+
+	ERR_FAIL_COND( p_script.is_null() );
+	base_type=p_script->get_instance_base_type();
+	selected=p_current;
+	type=Variant::NIL;
+	script=p_script->get_instance_ID();
+	properties=true;
+	instance=NULL;
+
+	popup_centered_ratio(0.6);
+	search_box->set_text("");
+	search_box->grab_focus();
+	_update_search();
+
+}
+void PropertySelector::select_property_from_basic_type(Variant::Type p_type, InputEvent::Type p_event_type, const String &p_current){
+
+	ERR_FAIL_COND(p_type==Variant::NIL);
+	base_type="";
+	selected=p_current;
+	type=p_type;
+	event_type=p_event_type;
+	script=0;
+	properties=true;
+	instance=NULL;
+
+	popup_centered_ratio(0.6);
+	search_box->set_text("");
+	search_box->grab_focus();
+	_update_search();
+
+}
+
+void PropertySelector::select_property_from_instance(Object* p_instance, const String &p_current){
+
+
+	base_type="";
+	selected=p_current;
+	type=Variant::NIL;
+	script=0;
+	properties=true;
+	instance=p_instance;
+
+	popup_centered_ratio(0.6);
+	search_box->set_text("");
+	search_box->grab_focus();
+	_update_search();
+
+}
+
+void PropertySelector::_bind_methods() {
+
+	ObjectTypeDB::bind_method(_MD("_text_changed"),&PropertySelector::_text_changed);
+	ObjectTypeDB::bind_method(_MD("_confirmed"),&PropertySelector::_confirmed);
+	ObjectTypeDB::bind_method(_MD("_sbox_input"),&PropertySelector::_sbox_input);
+	ObjectTypeDB::bind_method(_MD("_item_selected"),&PropertySelector::_item_selected);
+
+	ADD_SIGNAL(MethodInfo("selected",PropertyInfo(Variant::STRING,"name")));
+
+}
+
+
+PropertySelector::PropertySelector() {
+
+
+	VBoxContainer *vbc = memnew( VBoxContainer );
+	add_child(vbc);
+	set_child_rect(vbc);
+	search_box = memnew( LineEdit );
+	vbc->add_margin_child(TTR("Search:"),search_box);
+	search_box->connect("text_changed",this,"_text_changed");
+	search_box->connect("input_event",this,"_sbox_input");
+	search_options = memnew( Tree );
+	vbc->add_margin_child(TTR("Matches:"),search_options,true);
+	get_ok()->set_text(TTR("Open"));
+	get_ok()->set_disabled(true);
+	register_text_enter(search_box);
+	set_hide_on_ok(false);
+	search_options->connect("item_activated",this,"_confirmed");
+	search_options->connect("cell_selected",this,"_item_selected");
+	search_options->set_hide_root(true);
+	search_options->set_hide_folding(true);
+
+	description = memnew( Panel );
+	description->set_custom_minimum_size(Size2(0,80*EDSCALE));
+	vbc->add_margin_child(TTR("Description:"),description);
+	rich_text = memnew( RichTextLabel );
+	description->add_child(rich_text);
+	rich_text->set_area_as_parent_rect(8*EDSCALE);
+
+}

+ 54 - 0
tools/editor/property_selector.h

@@ -0,0 +1,54 @@
+#ifndef PROPERTYSELECTOR_H
+#define PROPERTYSELECTOR_H
+
+#include "tools/editor/property_editor.h"
+#include "scene/gui/rich_text_label.h"
+class PropertySelector : public ConfirmationDialog {
+	OBJ_TYPE(PropertySelector,ConfirmationDialog )
+
+
+	LineEdit *search_box;
+	Tree *search_options;
+
+	void _update_search();
+
+	void _sbox_input(const InputEvent& p_ie);
+
+	void _confirmed();
+	void _text_changed(const String& p_newtext);
+
+	Panel *description;
+	RichTextLabel *rich_text;
+
+	bool properties;
+	String selected;
+	Variant::Type type;
+	InputEvent::Type event_type;
+	String base_type;
+	ObjectID script;
+	Object *instance;
+
+	void _item_selected();
+protected:
+	void _notification(int p_what);
+	static void _bind_methods();
+
+
+
+public:
+
+
+	void select_method_from_base_type(const String& p_base,const String& p_current="");
+	void select_method_from_script(const Ref<Script>& p_script,const String& p_current="");
+	void select_method_from_basic_type(Variant::Type p_type,const String& p_current="");
+	void select_method_from_instance(Object* p_instance, const String &p_current);
+
+	void select_property_from_base_type(const String& p_base,const String& p_current="");
+	void select_property_from_script(const Ref<Script>& p_script,const String& p_current="");
+	void select_property_from_basic_type(Variant::Type p_type,InputEvent::Type p_event_type,const String& p_current="");
+	void select_property_from_instance(Object* p_instance, const String &p_current);
+
+	PropertySelector();
+};
+
+#endif // PROPERTYSELECTOR_H