diff options
Diffstat (limited to 'modules/visual_script/visual_script_flow_control.cpp')
-rw-r--r-- | modules/visual_script/visual_script_flow_control.cpp | 71 |
1 files changed, 44 insertions, 27 deletions
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index 96616c281e..3ed20fab35 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -78,8 +78,9 @@ String VisualScriptReturn::get_text() const { } void VisualScriptReturn::set_return_type(Variant::Type p_type) { - if (type == p_type) + if (type == p_type) { return; + } type = p_type; ports_changed_notify(); } @@ -89,8 +90,9 @@ Variant::Type VisualScriptReturn::get_return_type() const { } void VisualScriptReturn::set_enable_return_value(bool p_enable) { - if (with_value == p_enable) + if (with_value == p_enable) { return; + } with_value = p_enable; ports_changed_notify(); @@ -178,12 +180,13 @@ int VisualScriptCondition::get_output_value_port_count() const { } String VisualScriptCondition::get_output_sequence_port_text(int p_port) const { - if (p_port == 0) + if (p_port == 0) { return "true"; - else if (p_port == 1) + } else if (p_port == 1) { return "false"; - else + } else { return "done"; + } } PropertyInfo VisualScriptCondition::get_input_value_port_info(int p_idx) const { @@ -218,12 +221,13 @@ public: //virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return true; } virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) { - if (p_start_mode == START_MODE_CONTINUE_SEQUENCE) + if (p_start_mode == START_MODE_CONTINUE_SEQUENCE) { return 2; - else if (p_inputs[0]->operator bool()) + } else if (p_inputs[0]->operator bool()) { return 0 | STEP_FLAG_PUSH_STACK_BIT; - else + } else { return 1 | STEP_FLAG_PUSH_STACK_BIT; + } } }; @@ -258,10 +262,11 @@ int VisualScriptWhile::get_output_value_port_count() const { } String VisualScriptWhile::get_output_sequence_port_text(int p_port) const { - if (p_port == 0) + if (p_port == 0) { return "repeat"; - else + } else { return "exit"; + } } PropertyInfo VisualScriptWhile::get_input_value_port_info(int p_idx) const { @@ -298,10 +303,11 @@ public: virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) { bool keep_going = p_inputs[0]->operator bool(); - if (keep_going) + if (keep_going) { return 0 | STEP_FLAG_PUSH_STACK_BIT; - else + } else { return 1; + } } }; @@ -336,10 +342,11 @@ int VisualScriptIterator::get_output_value_port_count() const { } String VisualScriptIterator::get_output_sequence_port_text(int p_port) const { - if (p_port == 0) + if (p_port == 0) { return "each"; - else + } else { return "exit"; + } } PropertyInfo VisualScriptIterator::get_input_value_port_info(int p_idx) const { @@ -388,8 +395,9 @@ public: return 0; } - if (!can_iter) + if (!can_iter) { return 1; //nothing to iterate + } *p_outputs[0] = p_working_mem[0].iter_get(p_working_mem[1], valid); @@ -410,8 +418,9 @@ public: return 0; } - if (!can_iter) + if (!can_iter) { return 1; //nothing to iterate + } *p_outputs[0] = p_working_mem[0].iter_get(p_working_mem[1], valid); @@ -478,8 +487,9 @@ String VisualScriptSequence::get_text() const { void VisualScriptSequence::set_steps(int p_steps) { ERR_FAIL_COND(p_steps < 1); - if (steps == p_steps) + if (steps == p_steps) { return; + } steps = p_steps; ports_changed_notify(); @@ -515,9 +525,9 @@ public: *p_outputs[0] = step; - if (step + 1 == steps) + if (step + 1 == steps) { return step; - else { + } else { p_working_mem[0] = step + 1; return step | STEP_FLAG_PUSH_STACK_BIT; } @@ -557,8 +567,9 @@ int VisualScriptSwitch::get_output_value_port_count() const { } String VisualScriptSwitch::get_output_sequence_port_text(int p_port) const { - if (p_port == case_values.size()) + if (p_port == case_values.size()) { return "done"; + } return String(); } @@ -566,8 +577,9 @@ String VisualScriptSwitch::get_output_sequence_port_text(int p_port) const { PropertyInfo VisualScriptSwitch::get_input_value_port_info(int p_idx) const { if (p_idx < case_values.size()) { return PropertyInfo(case_values[p_idx].type, " ="); - } else + } else { return PropertyInfo(Variant::NIL, "input"); + } } PropertyInfo VisualScriptSwitch::get_output_value_port_info(int p_idx) const { @@ -708,15 +720,17 @@ String VisualScriptTypeCast::get_caption() const { } String VisualScriptTypeCast::get_text() const { - if (script != String()) + if (script != String()) { return "Is " + script.get_file() + "?"; - else + } else { return "Is " + base_type + "?"; + } } void VisualScriptTypeCast::set_base_type(const StringName &p_type) { - if (base_type == p_type) + if (base_type == p_type) { return; + } base_type = p_type; _change_notify(); @@ -728,8 +742,9 @@ StringName VisualScriptTypeCast::get_base_type() const { } void VisualScriptTypeCast::set_base_script(const String &p_path) { - if (script == p_path) + if (script == p_path) { return; + } script = p_path; _change_notify(); @@ -806,8 +821,9 @@ public: if (ClassDB::is_parent_class(obj->get_class_name(), base_type)) { *p_outputs[0] = *p_inputs[0]; //copy return 0; - } else + } else { return 1; + } } }; @@ -833,8 +849,9 @@ void VisualScriptTypeCast::_bind_methods() { String script_ext_hint; for (List<String>::Element *E = script_extensions.front(); E; E = E->next()) { - if (script_ext_hint != String()) + if (script_ext_hint != String()) { script_ext_hint += ","; + } script_ext_hint += "*." + E->get(); } |