mirror of
https://github.com/godotengine/godot.git
synced 2025-10-25 18:54:43 +00:00
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
This commit is contained in:
parent
b8d198eeed
commit
140350d767
694 changed files with 23283 additions and 12499 deletions
|
|
@ -146,8 +146,9 @@ VisualScriptNodeInstance *VisualScriptYield::instance(VisualScriptInstance *p_in
|
|||
}
|
||||
|
||||
void VisualScriptYield::set_yield_mode(YieldMode p_mode) {
|
||||
if (yield_mode == p_mode)
|
||||
if (yield_mode == p_mode) {
|
||||
return;
|
||||
}
|
||||
yield_mode = p_mode;
|
||||
ports_changed_notify();
|
||||
_change_notify();
|
||||
|
|
@ -158,8 +159,9 @@ VisualScriptYield::YieldMode VisualScriptYield::get_yield_mode() {
|
|||
}
|
||||
|
||||
void VisualScriptYield::set_wait_time(float p_time) {
|
||||
if (wait_time == p_time)
|
||||
if (wait_time == p_time) {
|
||||
return;
|
||||
}
|
||||
wait_time = p_time;
|
||||
ports_changed_notify();
|
||||
}
|
||||
|
|
@ -218,18 +220,21 @@ bool VisualScriptYieldSignal::has_input_sequence_port() const {
|
|||
#ifdef TOOLS_ENABLED
|
||||
|
||||
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
|
||||
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene)
|
||||
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Ref<Script> scr = p_current_node->get_script();
|
||||
|
||||
if (scr.is_valid() && scr == script)
|
||||
if (scr.is_valid() && scr == script) {
|
||||
return p_current_node;
|
||||
}
|
||||
|
||||
for (int i = 0; i < p_current_node->get_child_count(); i++) {
|
||||
Node *n = _find_script_node(p_edited_scene, p_current_node->get_child(i), script);
|
||||
if (n)
|
||||
if (n) {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
@ -239,27 +244,32 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
|
|||
Node *VisualScriptYieldSignal::_get_base_node() const {
|
||||
#ifdef TOOLS_ENABLED
|
||||
Ref<Script> script = get_visual_script();
|
||||
if (!script.is_valid())
|
||||
if (!script.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MainLoop *main_loop = OS::get_singleton()->get_main_loop();
|
||||
SceneTree *scene_tree = Object::cast_to<SceneTree>(main_loop);
|
||||
|
||||
if (!scene_tree)
|
||||
if (!scene_tree) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *edited_scene = scene_tree->get_edited_scene_root();
|
||||
|
||||
if (!edited_scene)
|
||||
if (!edited_scene) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
|
||||
|
||||
if (!script_node)
|
||||
if (!script_node) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!script_node->has_node(base_path))
|
||||
if (!script_node->has_node(base_path)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *path_to = script_node->get_node(base_path);
|
||||
|
||||
|
|
@ -271,28 +281,31 @@ Node *VisualScriptYieldSignal::_get_base_node() const {
|
|||
}
|
||||
|
||||
StringName VisualScriptYieldSignal::_get_base_type() const {
|
||||
if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid())
|
||||
if (call_mode == CALL_MODE_SELF && get_visual_script().is_valid()) {
|
||||
return get_visual_script()->get_instance_base_type();
|
||||
else if (call_mode == CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
|
||||
} else if (call_mode == CALL_MODE_NODE_PATH && get_visual_script().is_valid()) {
|
||||
Node *path = _get_base_node();
|
||||
if (path)
|
||||
if (path) {
|
||||
return path->get_class();
|
||||
}
|
||||
}
|
||||
|
||||
return base_type;
|
||||
}
|
||||
|
||||
int VisualScriptYieldSignal::get_input_value_port_count() const {
|
||||
if (call_mode == CALL_MODE_INSTANCE)
|
||||
if (call_mode == CALL_MODE_INSTANCE) {
|
||||
return 1;
|
||||
else
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
int VisualScriptYieldSignal::get_output_value_port_count() const {
|
||||
MethodInfo sr;
|
||||
|
||||
if (!ClassDB::get_signal(_get_base_type(), signal, &sr))
|
||||
if (!ClassDB::get_signal(_get_base_type(), signal, &sr)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sr.arguments.size();
|
||||
}
|
||||
|
|
@ -302,17 +315,19 @@ String VisualScriptYieldSignal::get_output_sequence_port_text(int p_port) const
|
|||
}
|
||||
|
||||
PropertyInfo VisualScriptYieldSignal::get_input_value_port_info(int p_idx) const {
|
||||
if (call_mode == CALL_MODE_INSTANCE)
|
||||
if (call_mode == CALL_MODE_INSTANCE) {
|
||||
return PropertyInfo(Variant::OBJECT, "instance");
|
||||
else
|
||||
} else {
|
||||
return PropertyInfo();
|
||||
}
|
||||
}
|
||||
|
||||
PropertyInfo VisualScriptYieldSignal::get_output_value_port_info(int p_idx) const {
|
||||
MethodInfo sr;
|
||||
|
||||
if (!ClassDB::get_signal(_get_base_type(), signal, &sr))
|
||||
if (!ClassDB::get_signal(_get_base_type(), signal, &sr)) {
|
||||
return PropertyInfo(); //no signal
|
||||
}
|
||||
ERR_FAIL_INDEX_V(p_idx, sr.arguments.size(), PropertyInfo());
|
||||
return sr.arguments[p_idx];
|
||||
}
|
||||
|
|
@ -328,15 +343,17 @@ String VisualScriptYieldSignal::get_caption() const {
|
|||
}
|
||||
|
||||
String VisualScriptYieldSignal::get_text() const {
|
||||
if (call_mode == CALL_MODE_SELF)
|
||||
if (call_mode == CALL_MODE_SELF) {
|
||||
return " " + String(signal) + "()";
|
||||
else
|
||||
} else {
|
||||
return " " + _get_base_type() + "." + String(signal) + "()";
|
||||
}
|
||||
}
|
||||
|
||||
void VisualScriptYieldSignal::set_base_type(const StringName &p_type) {
|
||||
if (base_type == p_type)
|
||||
if (base_type == p_type) {
|
||||
return;
|
||||
}
|
||||
|
||||
base_type = p_type;
|
||||
|
||||
|
|
@ -349,8 +366,9 @@ StringName VisualScriptYieldSignal::get_base_type() const {
|
|||
}
|
||||
|
||||
void VisualScriptYieldSignal::set_signal(const StringName &p_type) {
|
||||
if (signal == p_type)
|
||||
if (signal == p_type) {
|
||||
return;
|
||||
}
|
||||
|
||||
signal = p_type;
|
||||
|
||||
|
|
@ -362,8 +380,9 @@ StringName VisualScriptYieldSignal::get_signal() const {
|
|||
}
|
||||
|
||||
void VisualScriptYieldSignal::set_base_path(const NodePath &p_type) {
|
||||
if (base_path == p_type)
|
||||
if (base_path == p_type) {
|
||||
return;
|
||||
}
|
||||
|
||||
base_path = p_type;
|
||||
|
||||
|
|
@ -376,8 +395,9 @@ NodePath VisualScriptYieldSignal::get_base_path() const {
|
|||
}
|
||||
|
||||
void VisualScriptYieldSignal::set_call_mode(CallMode p_mode) {
|
||||
if (call_mode == p_mode)
|
||||
if (call_mode == p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
call_mode = p_mode;
|
||||
|
||||
|
|
@ -416,8 +436,9 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const {
|
|||
|
||||
List<String> mstring;
|
||||
for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) {
|
||||
if (E->get().name.begins_with("_"))
|
||||
if (E->get().name.begins_with("_")) {
|
||||
continue;
|
||||
}
|
||||
mstring.push_back(E->get().name.get_slice(":", 0));
|
||||
}
|
||||
|
||||
|
|
@ -425,8 +446,9 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const {
|
|||
|
||||
String ml;
|
||||
for (List<String>::Element *E = mstring.front(); E; E = E->next()) {
|
||||
if (ml != String())
|
||||
if (ml != String()) {
|
||||
ml += ",";
|
||||
}
|
||||
ml += E->get();
|
||||
}
|
||||
|
||||
|
|
@ -449,8 +471,9 @@ void VisualScriptYieldSignal::_bind_methods() {
|
|||
|
||||
String bt;
|
||||
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
bt += ",";
|
||||
}
|
||||
|
||||
bt += Variant::get_type_name(Variant::Type(i));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue