Update a VS custom node when its script changes

This commit is contained in:
George Marques 2017-07-21 23:45:57 -03:00
parent 3fdf8663f7
commit 19ca9e7810
No known key found for this signature in database
GPG Key ID: 046BD46A3201E43D
2 changed files with 9 additions and 0 deletions

View File

@ -2658,6 +2658,10 @@ VisualScriptNodeInstance *VisualScriptCustomNode::instance(VisualScriptInstance
return instance;
}
void VisualScriptCustomNode::_script_changed() {
ports_changed_notify();
}
void VisualScriptCustomNode::_bind_methods() {
BIND_VMETHOD(MethodInfo(Variant::INT, "_get_output_sequence_port_count"));
@ -2680,6 +2684,8 @@ void VisualScriptCustomNode::_bind_methods() {
BIND_VMETHOD(MethodInfo(Variant::INT, "_get_working_memory_size"));
BIND_VMETHOD(MethodInfo(Variant::NIL, "_step:Variant", PropertyInfo(Variant::ARRAY, "inputs"), PropertyInfo(Variant::ARRAY, "outputs"), PropertyInfo(Variant::INT, "start_mode"), PropertyInfo(Variant::ARRAY, "working_mem")));
ClassDB::bind_method(D_METHOD("_script_changed"), &VisualScriptCustomNode::_script_changed);
BIND_CONSTANT(START_MODE_BEGIN_SEQUENCE);
BIND_CONSTANT(START_MODE_CONTINUE_SEQUENCE);
BIND_CONSTANT(START_MODE_RESUME_YIELD);
@ -2692,6 +2698,7 @@ void VisualScriptCustomNode::_bind_methods() {
}
VisualScriptCustomNode::VisualScriptCustomNode() {
connect("script_changed", this, "_script_changed");
}
//////////////////////////////////////////

View File

@ -712,6 +712,8 @@ public:
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
void _script_changed();
VisualScriptCustomNode();
};