| 620 | } |
| 621 | |
| 622 | String VisualShaderNodeCustom::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { |
| 623 | ERR_FAIL_COND_V(!GDVIRTUAL_IS_OVERRIDDEN(_get_code), ""); |
| 624 | TypedArray<String> input_vars; |
| 625 | for (int i = 0; i < get_input_port_count(); i++) { |
| 626 | input_vars.push_back(p_input_vars[i]); |
| 627 | } |
| 628 | TypedArray<String> output_vars; |
| 629 | for (int i = 0; i < get_output_port_count(); i++) { |
| 630 | output_vars.push_back(p_output_vars[i]); |
| 631 | } |
| 632 | |
| 633 | String _code; |
| 634 | GDVIRTUAL_CALL(_get_code, input_vars, output_vars, p_mode, p_type, _code); |
| 635 | if (_is_valid_code(_code)) { |
| 636 | String code = " {\n"; |
| 637 | bool nend = _code.ends_with("\n"); |
| 638 | _code = _code.insert(0, " "); |
| 639 | _code = _code.replace("\n", "\n "); |
| 640 | code += _code; |
| 641 | if (!nend) { |
| 642 | code += "\n }"; |
| 643 | } else { |
| 644 | code.remove_at(code.size() - 1); |
| 645 | code += "}"; |
| 646 | } |
| 647 | code += "\n"; |
| 648 | return code; |
| 649 | } |
| 650 | return String(); |
| 651 | } |
| 652 | |
| 653 | String VisualShaderNodeCustom::generate_global_per_node(Shader::Mode p_mode, int p_id) const { |
| 654 | String _code; |
no test coverage detected