summaryrefslogtreecommitdiffstats
path: root/modules/visual_script/visual_script_func_nodes.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 14:29:06 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit07bc4e2f96f8f47991339654ff4ab16acc19d44f (patch)
tree43cdc7cfe8239c23065616a931de3769d2db1e86 /modules/visual_script/visual_script_func_nodes.cpp
parent0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (diff)
downloadredot-engine-07bc4e2f96f8f47991339654ff4ab16acc19d44f.tar.gz
Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
Diffstat (limited to 'modules/visual_script/visual_script_func_nodes.cpp')
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 4ba0c27ec0..e7cb2f5473 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -134,6 +134,7 @@ int VisualScriptFunctionCall::get_input_value_port_count() const {
return method_cache.arguments.size() + (call_mode == CALL_MODE_INSTANCE ? 1 : 0) + (rpc_call_mode >= RPC_RELIABLE_TO_ID ? 1 : 0) - defaulted_args;
}
}
+
int VisualScriptFunctionCall::get_output_value_port_count() const {
if (call_mode == CALL_MODE_BASIC_TYPE) {
bool returns = false;
@@ -410,6 +411,7 @@ void VisualScriptFunctionCall::set_function(const StringName &p_type) {
_change_notify();
ports_changed_notify();
}
+
StringName VisualScriptFunctionCall::get_function() const {
return function;
}
@@ -435,6 +437,7 @@ void VisualScriptFunctionCall::set_call_mode(CallMode p_mode) {
_change_notify();
ports_changed_notify();
}
+
VisualScriptFunctionCall::CallMode VisualScriptFunctionCall::get_call_mode() const {
return call_mode;
}
@@ -927,6 +930,7 @@ int VisualScriptPropertySet::get_input_value_port_count() const {
return pc;
}
+
int VisualScriptPropertySet::get_output_value_port_count() const {
return (call_mode == CALL_MODE_BASIC_TYPE || call_mode == CALL_MODE_INSTANCE) ? 1 : 0;
}
@@ -1022,6 +1026,7 @@ void VisualScriptPropertySet::_update_base_type() {
}
}
}
+
void VisualScriptPropertySet::set_basic_type(Variant::Type p_type) {
if (basic_type == p_type)
return;
@@ -1149,6 +1154,7 @@ void VisualScriptPropertySet::set_property(const StringName &p_type) {
_change_notify();
ports_changed_notify();
}
+
StringName VisualScriptPropertySet::get_property() const {
return property;
}
@@ -1176,6 +1182,7 @@ void VisualScriptPropertySet::set_call_mode(CallMode p_mode) {
_change_notify();
ports_changed_notify();
}
+
VisualScriptPropertySet::CallMode VisualScriptPropertySet::get_call_mode() const {
return call_mode;
}
@@ -1550,6 +1557,7 @@ VisualScriptPropertySet::TypeGuess VisualScriptPropertySet::guess_output_type(Ty
return VisualScriptNode::guess_output_type(p_inputs, p_output);
}
+
VisualScriptPropertySet::VisualScriptPropertySet() {
assign_op = ASSIGN_OP_NONE;
call_mode = CALL_MODE_SELF;
@@ -1576,6 +1584,7 @@ int VisualScriptPropertyGet::get_output_sequence_port_count() const {
bool VisualScriptPropertyGet::has_input_sequence_port() const {
return false; //(call_mode==CALL_MODE_SELF || call_mode==CALL_MODE_NODE_PATH)?false:true;
}
+
void VisualScriptPropertyGet::_update_base_type() {
//cache it because this information may not be available on load
if (call_mode == CALL_MODE_NODE_PATH) {
@@ -1589,6 +1598,7 @@ void VisualScriptPropertyGet::_update_base_type() {
}
}
}
+
Node *VisualScriptPropertyGet::_get_base_node() const {
#ifdef TOOLS_ENABLED
Ref<Script> script = get_visual_script();
@@ -1639,6 +1649,7 @@ StringName VisualScriptPropertyGet::_get_base_type() const {
int VisualScriptPropertyGet::get_input_value_port_count() const {
return (call_mode == CALL_MODE_BASIC_TYPE || call_mode == CALL_MODE_INSTANCE) ? 1 : 0;
}
+
int VisualScriptPropertyGet::get_output_value_port_count() const {
return 1;
}
@@ -1806,6 +1817,7 @@ void VisualScriptPropertyGet::set_property(const StringName &p_type) {
_change_notify();
ports_changed_notify();
}
+
StringName VisualScriptPropertyGet::get_property() const {
return property;
}
@@ -1833,6 +1845,7 @@ void VisualScriptPropertyGet::set_call_mode(CallMode p_mode) {
_update_base_type();
ports_changed_notify();
}
+
VisualScriptPropertyGet::CallMode VisualScriptPropertyGet::get_call_mode() const {
return call_mode;
}
@@ -2144,6 +2157,7 @@ int VisualScriptEmitSignal::get_input_value_port_count() const {
return 0;
}
+
int VisualScriptEmitSignal::get_output_value_port_count() const {
return 0;
}
@@ -2181,6 +2195,7 @@ void VisualScriptEmitSignal::set_signal(const StringName &p_type) {
_change_notify();
ports_changed_notify();
}
+
StringName VisualScriptEmitSignal::get_signal() const {
return name;
}