From 07bc4e2f96f8f47991339654ff4ab16acc19d44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 14:29:06 +0200 Subject: 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. --- modules/visual_script/visual_script_func_nodes.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'modules/visual_script/visual_script_func_nodes.cpp') 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