summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/visual_script/visual_script.cpp17
-rw-r--r--modules/visual_script/visual_script.h3
-rw-r--r--modules/visual_script/visual_script_editor.cpp321
-rw-r--r--modules/visual_script/visual_script_editor.h27
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp23
-rw-r--r--modules/visual_script/visual_script_func_nodes.h4
-rw-r--r--modules/visual_script/visual_script_nodes.cpp90
-rw-r--r--modules/visual_script/visual_script_nodes.h9
-rw-r--r--scene/gui/graph_edit.cpp8
-rw-r--r--scene/gui/graph_edit.h1
10 files changed, 499 insertions, 4 deletions
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index aa09e7f005..e69e6ac278 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -574,6 +574,23 @@ bool VisualScript::is_input_value_port_connected(const StringName& p_func,int p_
return false;
}
+bool VisualScript::get_input_value_port_connection_source(const StringName& p_func,int p_node,int p_port,int *r_node,int *r_port) const {
+
+ ERR_FAIL_COND_V(!functions.has(p_func),false);
+ const Function &func = functions[p_func];
+
+ for (const Set<DataConnection>::Element *E=func.data_connections.front();E;E=E->next()) {
+ if (E->get().to_node==p_node && E->get().to_port==p_port) {
+ *r_node=E->get().from_node;
+ *r_port=E->get().from_port;
+ return true;
+ }
+ }
+
+ return false;
+
+}
+
void VisualScript::get_data_connection_list(const StringName& p_func,List<DataConnection> *r_connection) const {
ERR_FAIL_COND(!functions.has(p_func));
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index fe09e7af43..e59dd76313 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -65,7 +65,7 @@ public:
Variant::Type type;
InputEvent::Type ev_type;
StringName obj_type;
- String script_type;
+ Ref<Script> script;
TypeGuess() { type=Variant::NIL; ev_type=InputEvent::NONE; }
};
@@ -281,6 +281,7 @@ public:
bool has_data_connection(const StringName& p_func,int p_from_node,int p_from_port,int p_to_node,int p_to_port) const;
void get_data_connection_list(const StringName& p_func,List<DataConnection> *r_connection) const;
bool is_input_value_port_connected(const StringName& p_name,int p_node,int p_port) const;
+ bool get_input_value_port_connection_source(const StringName& p_name,int p_node,int p_port,int *r_node,int *r_port) const;
void add_variable(const StringName& p_name,const Variant& p_default_value=Variant(),bool p_export=false);
bool has_variable(const StringName& p_name) const;
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 9f8dfcabc4..d6b7479359 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -2578,11 +2578,319 @@ 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) {
+ Node* node = graph->get_node(p_from);
+ if (!node)
+ return;
+
+ GraphNode *gn = node->cast_to<GraphNode>();
+ if (!gn)
+ return;
+
+ Ref<VisualScriptNode> vsn = script->get_node(edited_func,p_from.to_int());
+ if (!vsn.is_valid())
+ return;
+
+ if (p_from_slot<vsn->get_output_sequence_port_count()) {
+ port_action_popup->clear();
+ port_action_popup->add_item(TTR("Condition"),CREATE_COND);
+ port_action_popup->add_item(TTR("Sequence"),CREATE_SEQUENCE);
+ port_action_popup->add_item(TTR("Switch"),CREATE_SWITCH);
+ port_action_popup->add_item(TTR("Iterator"),CREATE_ITERATOR);
+ port_action_popup->add_item(TTR("While"),CREATE_WHILE);
+ port_action_popup->add_item(TTR("Return"),CREATE_RETURN);
+
+ port_action_node=p_from.to_int();
+ port_action_output=p_from_slot;
+
+ } else {
+ port_action_popup->clear();
+ port_action_popup->add_item(TTR("Call"),CREATE_CALL);
+ port_action_popup->add_item(TTR("Get"),CREATE_GET);
+ port_action_popup->add_item(TTR("Set"),CREATE_SET);
+
+
+ port_action_output=p_from_slot-vsn->get_output_sequence_port_count();
+ port_action_node=p_from.to_int();
+
+
+ }
+
+ port_action_pos=p_release_pos;
+ port_action_popup->set_size(Size2(1,1));
+ port_action_popup->set_pos(graph->get_global_pos()+p_release_pos);
+ port_action_popup->popup();
}
+VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_node,int p_output,Set<int> &visited_nodes) {
+
+
+ VisualScriptNode::TypeGuess tg;
+ tg.type=Variant::NIL;
+
+ if (visited_nodes.has(p_node))
+ return tg; //no loop
+
+ visited_nodes.insert(p_node);
+
+ Ref<VisualScriptNode> node = script->get_node(edited_func,p_node);
+
+ if (!node.is_valid()) {
+
+ return tg;
+ }
+
+ Vector<VisualScriptNode::TypeGuess> in_guesses;
+
+ for(int i=0;i<node->get_input_value_port_count();i++) {
+ PropertyInfo pi = node->get_input_value_port_info(i);
+ VisualScriptNode::TypeGuess g;
+ g.type=pi.type;
+
+ if (g.type==Variant::NIL || g.type==Variant::OBJECT) {
+ //any or object input, must further guess what this is
+ int from_node;
+ int from_port;
+
+ if (script->get_input_value_port_connection_source(edited_func,p_node,i,&from_node,&from_port)) {
+
+ g = _guess_output_type(from_node,from_port,visited_nodes);
+ } else {
+ Variant defval = node->get_default_input_value(i);
+ if (defval.get_type()==Variant::OBJECT) {
+
+ Object *obj = defval;
+
+ if (obj) {
+
+ g.type=Variant::OBJECT;
+ g.obj_type=obj->get_type();
+ g.script=obj->get_script();
+ }
+ }
+ }
+
+ }
+
+ in_guesses.push_back(g);
+ }
+
+ return node->guess_output_type(in_guesses.ptr(),p_output);
+}
+
+void VisualScriptEditor::_port_action_menu(int p_option) {
+
+ Vector2 ofs = graph->get_scroll_ofs() + port_action_pos;
+ if (graph->is_using_snap()) {
+ int snap = graph->get_snap();
+ ofs = ofs.snapped(Vector2(snap,snap));
+ }
+ ofs/=EDSCALE;
+
+ bool seq_connect=false;
+
+ Ref<VisualScriptNode> vnode;
+ Set<int> vn;
+
+ switch(p_option) {
+
+ case CREATE_CALL: {
+
+ Ref<VisualScriptFunctionCall> n;
+ n.instance();
+ vnode=n;
+
+ VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node,port_action_output,vn);
+
+ if (tg.type==Variant::OBJECT) {
+ n->set_call_mode(VisualScriptFunctionCall::CALL_MODE_INSTANCE);
+
+ if (tg.obj_type!=StringName()) {
+ n->set_base_type(tg.obj_type);
+ } else {
+ n->set_base_type("Object");
+ }
+
+ if (tg.script.is_valid()) {
+ n->set_base_script(tg.script->get_path());
+ new_connect_node_select->select_method_from_script(tg.script);
+ } else {
+ new_connect_node_select->select_method_from_base_type(n->get_base_type());
+ }
+
+
+ } else {
+ n->set_call_mode(VisualScriptFunctionCall::CALL_MODE_BASIC_TYPE);
+ n->set_basic_type(tg.type);
+ new_connect_node_select->select_method_from_basic_type(tg.type);
+ }
+
+
+
+ } break;
+ case CREATE_SET: {
+
+ Ref<VisualScriptPropertySet> n;
+ n.instance();
+ vnode=n;
+
+
+ VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node,port_action_output,vn);
+
+ if (tg.type==Variant::OBJECT) {
+ n->set_call_mode(VisualScriptPropertySet::CALL_MODE_INSTANCE);
+
+ if (tg.obj_type!=StringName()) {
+ n->set_base_type(tg.obj_type);
+ } else {
+ n->set_base_type("Object");
+ }
+
+ if (tg.script.is_valid()) {
+ n->set_base_script(tg.script->get_path());
+ new_connect_node_select->select_property_from_script(tg.script);
+ } else {
+ new_connect_node_select->select_property_from_base_type(n->get_base_type());
+ }
+
+
+ } else {
+ n->set_call_mode(VisualScriptPropertySet::CALL_MODE_BASIC_TYPE);
+ n->set_basic_type(tg.type);
+ new_connect_node_select->select_property_from_basic_type(tg.type,tg.ev_type);
+ }
+ } break;
+ case CREATE_GET: {
+
+ Ref<VisualScriptPropertyGet> n;
+ n.instance();
+ vnode=n;
+
+ VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node,port_action_output,vn);
+
+ if (tg.type==Variant::OBJECT) {
+ n->set_call_mode(VisualScriptPropertyGet::CALL_MODE_INSTANCE);
+
+ if (tg.obj_type!=StringName()) {
+ n->set_base_type(tg.obj_type);
+ } else {
+ n->set_base_type("Object");
+ }
+
+ if (tg.script.is_valid()) {
+ n->set_base_script(tg.script->get_path());
+ new_connect_node_select->select_property_from_script(tg.script);
+ } else {
+ new_connect_node_select->select_property_from_base_type(n->get_base_type());
+ }
+
+
+ } else {
+ n->set_call_mode(VisualScriptPropertyGet::CALL_MODE_BASIC_TYPE);
+ n->set_basic_type(tg.type);
+ new_connect_node_select->select_property_from_basic_type(tg.type,tg.ev_type);
+ }
+
+ } break;
+ case CREATE_COND: {
+
+ Ref<VisualScriptCondition> n;
+ n.instance();
+ vnode=n;
+ seq_connect=true;
+
+ } break;
+ case CREATE_SEQUENCE: {
+
+ Ref<VisualScriptSequence> n;
+ n.instance();
+ vnode=n;
+ seq_connect=true;
+
+ } break;
+ case CREATE_SWITCH: {
+
+ Ref<VisualScriptSwitch> n;
+ n.instance();
+ vnode=n;
+ seq_connect=true;
+
+ } break;
+ case CREATE_ITERATOR: {
+
+ Ref<VisualScriptIterator> n;
+ n.instance();
+ vnode=n;
+ seq_connect=true;
+
+ } break;
+ case CREATE_WHILE: {
+
+ Ref<VisualScriptWhile> n;
+ n.instance();
+ vnode=n;
+ seq_connect=true;
+
+ } break;
+ case CREATE_RETURN: {
+
+ Ref<VisualScriptReturn> n;
+ n.instance();
+ vnode=n;
+ seq_connect=true;
+
+ } break;
+
+ }
+
+ int new_id = script->get_available_id();
+ undo_redo->create_action(TTR("Add Node"));
+ undo_redo->add_do_method(script.ptr(),"add_node",edited_func,new_id,vnode,ofs);
+ if (seq_connect) {
+ undo_redo->add_do_method(script.ptr(),"sequence_connect",edited_func,port_action_node,port_action_output,new_id);
+ }
+ undo_redo->add_undo_method(script.ptr(),"remove_node",edited_func,new_id);
+ undo_redo->add_do_method(this,"_update_graph",new_id);
+ undo_redo->add_undo_method(this,"_update_graph",new_id);
+ undo_redo->commit_action();
+
+ port_action_new_node=new_id;
+
+}
+
+void VisualScriptEditor::_selected_connect_node_method_or_setget(const String& p_text) {
+
+ Ref<VisualScriptNode> vsn = script->get_node(edited_func,port_action_new_node);
+
+ if (vsn->cast_to<VisualScriptFunctionCall>()) {
+
+ Ref<VisualScriptFunctionCall> vsfc = vsn;
+ vsfc->set_function(p_text);
+ script->data_connect(edited_func,port_action_node,port_action_output,port_action_new_node,0);
+ }
+
+ if (vsn->cast_to<VisualScriptPropertySet>()) {
+
+ Ref<VisualScriptPropertySet> vsp = vsn;
+ vsp->set_property(p_text);
+ script->data_connect(edited_func,port_action_node,port_action_output,port_action_new_node,0);
+ }
+
+ if (vsn->cast_to<VisualScriptPropertyGet>()) {
+
+ Ref<VisualScriptPropertyGet> vsp = vsn;
+ vsp->set_property(p_text);
+ script->data_connect(edited_func,port_action_node,port_action_output,port_action_new_node,0);
+ }
+
+ _update_graph_connections();
+
+}
+
+
void VisualScriptEditor::_default_value_changed() {
@@ -2909,6 +3217,8 @@ void VisualScriptEditor::_bind_methods() {
ObjectTypeDB::bind_method("_center_on_node",&VisualScriptEditor::_center_on_node);
ObjectTypeDB::bind_method("_comment_node_resized",&VisualScriptEditor::_comment_node_resized);
ObjectTypeDB::bind_method("_button_resource_previewed",&VisualScriptEditor::_button_resource_previewed);
+ ObjectTypeDB::bind_method("_port_action_menu",&VisualScriptEditor::_port_action_menu);
+ ObjectTypeDB::bind_method("_selected_connect_node_method_or_setget",&VisualScriptEditor::_selected_connect_node_method_or_setget);
@@ -2969,7 +3279,7 @@ VisualScriptEditor::VisualScriptEditor() {
VBoxContainer *left_vb = memnew( VBoxContainer );
left_vsplit->add_child(left_vb);
left_vb->set_v_size_flags(SIZE_EXPAND_FILL);
- left_vb->set_custom_minimum_size(Size2(180,1)*EDSCALE);
+ left_vb->set_custom_minimum_size(Size2(230,1)*EDSCALE);
base_type_select = memnew( Button );
left_vb->add_margin_child(TTR("Base Type:"),base_type_select);
@@ -3113,6 +3423,15 @@ VisualScriptEditor::VisualScriptEditor() {
method_select->connect("selected",this,"_selected_method");
error_line=-1;
+ new_connect_node_select = memnew( PropertySelector );
+ add_child(new_connect_node_select);
+ new_connect_node_select->connect("selected",this,"_selected_connect_node_method_or_setget");
+
+ port_action_popup = memnew( PopupMenu );
+ add_child(port_action_popup);
+ port_action_popup->connect("item_pressed",this,"_port_action_menu");
+
+
}
VisualScriptEditor::~VisualScriptEditor() {
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index 5a40822bfe..5191ed540a 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -33,6 +33,19 @@ class VisualScriptEditor : public ScriptEditorBase {
EDIT_PASTE_NODES,
};
+ enum PortAction {
+
+ CREATE_CALL,
+ CREATE_SET,
+ CREATE_GET,
+ CREATE_COND,
+ CREATE_SEQUENCE,
+ CREATE_SWITCH,
+ CREATE_ITERATOR,
+ CREATE_WHILE,
+ CREATE_RETURN,
+ };
+
MenuButton *edit_menu;
Ref<VisualScript> script;
@@ -53,6 +66,7 @@ class VisualScriptEditor : public ScriptEditorBase {
PropertyEditor *edit_signal_edit;
PropertySelector *method_select;
+ PropertySelector *new_connect_node_select;
VisualScriptEditorVariableEdit *variable_editor;
@@ -114,6 +128,16 @@ class VisualScriptEditor : public ScriptEditorBase {
static Clipboard *clipboard;
+ PopupMenu *port_action_popup;
+
+ PortAction port_action;
+ int port_action_node;
+ int port_action_output;
+ Vector2 port_action_pos;
+ int port_action_new_node;
+ void _port_action_menu(int p_option);
+ void _selected_connect_node_method_or_setget(const String& p_text);
+
int error_line;
@@ -145,6 +169,7 @@ class VisualScriptEditor : public ScriptEditorBase {
void _member_button(Object *p_item, int p_column, int p_button);
+
String revert_on_drag;
void _input(const InputEvent& p_event);
@@ -173,6 +198,8 @@ class VisualScriptEditor : public ScriptEditorBase {
void _draw_color_over_button(Object* obj,Color p_color);
void _button_resource_previewed(const String& p_path,const Ref<Texture>& p_preview,Variant p_ud);
+ VisualScriptNode::TypeGuess _guess_output_type(int p_port_action_node,int p_port_action_output,Set<int> &visited_nodes);
+
protected:
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index daddac155e..de99beacaf 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -920,6 +920,18 @@ VisualScriptNodeInstance* VisualScriptFunctionCall::instance(VisualScriptInstanc
instance->validate=validate;
return instance;
}
+
+
+VisualScriptFunctionCall::TypeGuess VisualScriptFunctionCall::guess_output_type(TypeGuess* p_inputs, int p_output) const {
+
+ if (p_output==0 && call_mode==CALL_MODE_INSTANCE) {
+ return p_inputs[0];
+ }
+
+ return VisualScriptNode::guess_output_type(p_inputs,p_output);
+
+}
+
VisualScriptFunctionCall::VisualScriptFunctionCall() {
validate=true;
@@ -1600,6 +1612,17 @@ VisualScriptNodeInstance* VisualScriptPropertySet::instance(VisualScriptInstance
return instance;
}
+
+
+VisualScriptPropertySet::TypeGuess VisualScriptPropertySet::guess_output_type(TypeGuess* p_inputs, int p_output) const {
+
+ if (p_output==0 && call_mode==CALL_MODE_INSTANCE) {
+ return p_inputs[0];
+ }
+
+ return VisualScriptNode::guess_output_type(p_inputs,p_output);
+
+}
VisualScriptPropertySet::VisualScriptPropertySet() {
call_mode=CALL_MODE_SELF;
diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h
index 5367deed7f..43ef276cf4 100644
--- a/modules/visual_script/visual_script_func_nodes.h
+++ b/modules/visual_script/visual_script_func_nodes.h
@@ -105,6 +105,9 @@ public:
virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+ virtual TypeGuess guess_output_type(TypeGuess* p_inputs, int p_output) const;
+
+
VisualScriptFunctionCall();
};
@@ -195,6 +198,7 @@ public:
virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+ virtual TypeGuess guess_output_type(TypeGuess* p_inputs, int p_output) const;
VisualScriptPropertySet();
};
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index e5436cc26c..03fd70b0a3 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1071,7 +1071,13 @@ PropertyInfo VisualScriptPreload::get_input_value_port_info(int p_idx) const{
PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const{
- return PropertyInfo(Variant::OBJECT,"res");
+ PropertyInfo pinfo=PropertyInfo(Variant::OBJECT,"res");
+ if (preload.is_valid()) {
+ pinfo.hint=PROPERTY_HINT_RESOURCE_TYPE;
+ pinfo.hint_string=preload->get_type();
+ }
+
+ return pinfo;
}
@@ -1927,6 +1933,19 @@ VisualScriptNodeInstance* VisualScriptEngineSingleton::instance(VisualScriptInst
return instance;
}
+VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output_type(TypeGuess* p_inputs, int p_output) const {
+
+ Object *obj=Globals::get_singleton()->get_singleton_object(singleton);
+ TypeGuess tg;
+ tg.type=Variant::OBJECT;
+ if (obj) {
+ tg.obj_type=obj->get_type();
+ tg.script=obj->get_script();
+ }
+
+ return tg;
+}
+
void VisualScriptEngineSingleton::_bind_methods() {
@@ -2064,6 +2083,8 @@ VisualScriptNodeInstance* VisualScriptSceneNode::instance(VisualScriptInstance*
}
+
+
#ifdef TOOLS_ENABLED
static Node* _find_script_node(Node* p_edited_scene,Node* p_current_node,const Ref<Script> &script) {
@@ -2087,6 +2108,49 @@ static Node* _find_script_node(Node* p_edited_scene,Node* p_current_node,const R
#endif
+VisualScriptSceneNode::TypeGuess VisualScriptSceneNode::guess_output_type(TypeGuess* p_inputs, int p_output) const {
+
+
+ VisualScriptSceneNode::TypeGuess tg;
+ tg.type=Variant::OBJECT;
+ tg.obj_type="Node";
+
+#ifdef TOOLS_ENABLED
+ Ref<Script> script = get_visual_script();
+ if (!script.is_valid())
+ return tg;
+
+ MainLoop * main_loop = OS::get_singleton()->get_main_loop();
+ if (!main_loop)
+ return tg;
+
+ SceneTree *scene_tree = main_loop->cast_to<SceneTree>();
+
+ if (!scene_tree)
+ return tg;
+
+ Node *edited_scene = scene_tree->get_edited_scene_root();
+
+ if (!edited_scene)
+ return tg;
+
+ Node* script_node = _find_script_node(edited_scene,edited_scene,script);
+
+ if (!script_node)
+ return tg;
+
+ Node* another = script_node->get_node(path);
+
+ if (another) {
+ tg.obj_type=another->get_type();
+ tg.script=another->get_script();
+ }
+#endif
+ return tg;
+
+}
+
+
void VisualScriptSceneNode::_validate_property(PropertyInfo& property) const {
#ifdef TOOLS_ENABLED
@@ -2224,6 +2288,13 @@ VisualScriptNodeInstance* VisualScriptSceneTree::instance(VisualScriptInstance*
return instance;
}
+VisualScriptSceneTree::TypeGuess VisualScriptSceneTree::guess_output_type(TypeGuess* p_inputs, int p_output) const {
+
+ TypeGuess tg;
+ tg.type=Variant::OBJECT;
+ tg.obj_type="SceneTree";
+ return tg;
+}
void VisualScriptSceneTree::_validate_property(PropertyInfo& property) const {
@@ -2415,6 +2486,23 @@ VisualScriptNodeInstance* VisualScriptSelf::instance(VisualScriptInstance* p_ins
return instance;
}
+VisualScriptSelf::TypeGuess VisualScriptSelf::guess_output_type(TypeGuess* p_inputs, int p_output) const {
+
+ VisualScriptSceneNode::TypeGuess tg;
+ tg.type=Variant::OBJECT;
+ tg.obj_type="Object";
+
+ Ref<Script> script = get_visual_script();
+ if (!script.is_valid())
+ return tg;
+
+ tg.obj_type=script->get_instance_base_type();
+ tg.script=script;
+
+ return tg;
+
+
+}
void VisualScriptSelf::_bind_methods() {
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index 885c73ca3d..94eeadca57 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -538,6 +538,9 @@ public:
virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+ virtual TypeGuess guess_output_type(TypeGuess* p_inputs, int p_output) const;
+
+
VisualScriptEngineSingleton();
};
@@ -577,6 +580,8 @@ public:
virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+ virtual TypeGuess guess_output_type(TypeGuess* p_inputs, int p_output) const;
+
VisualScriptSceneNode();
};
@@ -613,6 +618,8 @@ public:
virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+ virtual TypeGuess guess_output_type(TypeGuess* p_inputs, int p_output) const;
+
VisualScriptSceneTree();
};
@@ -686,6 +693,8 @@ public:
virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+ virtual TypeGuess guess_output_type(TypeGuess* p_inputs, int p_output) const;
+
VisualScriptSelf();
};
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 2307b33345..8b03dbbc2d 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -425,6 +425,7 @@ void GraphEdit::_top_layer_input(const InputEvent& p_ev) {
connecting_color=to->cast_to<GraphNode>()->get_connection_input_color(E->get().to_port);
connecting_target=false;
connecting_to=pos;
+ just_disconected=true;
emit_signal("disconnection_request",E->get().from,E->get().from_port,E->get().to,E->get().to_port);
to = get_node(String(connecting_from)); //maybe it was erased
@@ -446,6 +447,7 @@ void GraphEdit::_top_layer_input(const InputEvent& p_ev) {
connecting_color=gn->get_connection_output_color(j);
connecting_target=false;
connecting_to=pos;
+ just_disconected=false;
return;
}
@@ -474,6 +476,7 @@ void GraphEdit::_top_layer_input(const InputEvent& p_ev) {
connecting_color=fr->cast_to<GraphNode>()->get_connection_output_color(E->get().from_port);
connecting_target=false;
connecting_to=pos;
+ just_disconected=true;
emit_signal("disconnection_request",E->get().from,E->get().from_port,E->get().to,E->get().to_port);
fr = get_node(String(connecting_from)); //maybe it was erased
@@ -496,6 +499,8 @@ void GraphEdit::_top_layer_input(const InputEvent& p_ev) {
connecting_color=gn->get_connection_input_color(j);
connecting_target=false;
connecting_to=pos;
+ just_disconected=true;
+
return;
}
@@ -568,7 +573,7 @@ void GraphEdit::_top_layer_input(const InputEvent& p_ev) {
}
emit_signal("connection_request",from,from_slot,to,to_slot);
- } else {
+ } else if (!just_disconected) {
String from = connecting_from;
int from_slot = connecting_index;
Vector2 ofs = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);
@@ -1323,6 +1328,7 @@ GraphEdit::GraphEdit() {
zoom_hb->add_child(snap_amount);
setting_scroll_ofs=false;
+ just_disconected=false;
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index ed6e4ef6ac..c5174f6699 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -92,6 +92,7 @@ private:
Vector2 connecting_to;
String connecting_target_to;
int connecting_target_index;
+ bool just_disconected;
bool dragging;
bool just_selected;