diff options
Diffstat (limited to 'modules')
37 files changed, 316 insertions, 190 deletions
diff --git a/modules/enet/SCsub b/modules/enet/SCsub index 42a933a66d..4790c5099f 100644 --- a/modules/enet/SCsub +++ b/modules/enet/SCsub @@ -7,7 +7,7 @@ Import('env_modules') env_enet = env_modules.Clone() -if (env['builtin_enet'] != 'no'): +if env['builtin_enet']: thirdparty_dir = "#thirdparty/enet/" thirdparty_sources = [ "godot.cpp", diff --git a/modules/etc/config.py b/modules/etc/config.py index 4b0b01b78e..7dc2cb59c1 100644 --- a/modules/etc/config.py +++ b/modules/etc/config.py @@ -6,6 +6,6 @@ def can_build(platform): def configure(env): # Tools only, disabled for non-tools # TODO: Find a cleaner way to achieve that - if (env["tools"] == "no"): - env["module_etc_enabled"] = "no" + if not env['tools']: + env['module_etc_enabled'] = False env.disabled_modules.append("etc") diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index f22df4407c..19e384af73 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -6,7 +6,7 @@ from compat import isbasestring # Not building in a separate env as scene needs it # Thirdparty source files -if (env['builtin_freetype'] != 'no'): +if env['builtin_freetype']: thirdparty_dir = "#thirdparty/freetype/" thirdparty_sources = [ "src/autofit/autofit.c", @@ -65,7 +65,7 @@ if (env['builtin_freetype'] != 'no'): env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"]) # also requires libpng headers - if (env['builtin_libpng'] != 'no'): + if env['builtin_libpng']: env.Append(CPPPATH=["#thirdparty/libpng"]) lib = env.Library("freetype_builtin", thirdparty_sources) diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index f386f2b542..39f5ec5378 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -11,7 +11,7 @@ gdn_env.add_source_files(env.modules_sources, "nativescript/*.cpp") gdn_env.Append(CPPFLAGS=['-DGDAPI_BUILT_IN']) gdn_env.Append(CPPPATH=['#modules/gdnative/include/']) -if "platform" in env and env["platform"] == "x11": # there has to be a better solution? +if "platform" in env and env["platform"] in ["x11", "iphone"]: env.Append(LINKFLAGS=["-rdynamic"]) env.use_ptrcall = True diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 93a9bac11c..11856e4ffb 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -234,8 +234,11 @@ bool GDNative::initialize() { ERR_PRINT("No library set for this platform"); return false; } - +#ifdef IPHONE_ENABLED + String path = lib_path.replace("res://", "dylibs/"); +#else String path = ProjectSettings::get_singleton()->globalize_path(lib_path); +#endif Error err = OS::get_singleton()->open_dynamic_library(path, native_handle); if (err != OK) { return false; diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 18d51daeb3..19dd030637 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -49,8 +49,8 @@ extern "C" { #elif defined(__APPLE__) #include "TargetConditionals.h" #if TARGET_OS_IPHONE -#define GDCALLINGCONV -#define GDAPI +#define GDCALLINGCONV __attribute__((visibility("default"))) +#define GDAPI GDCALLINGCONV #elif TARGET_OS_MAC #define GDCALLINGCONV __attribute__((sysv_abi)) #define GDAPI GDCALLINGCONV diff --git a/modules/gdnative/include/nativescript/godot_nativescript.h b/modules/gdnative/include/nativescript/godot_nativescript.h index 96f213ead7..5095b7a83e 100644 --- a/modules/gdnative/include/nativescript/godot_nativescript.h +++ b/modules/gdnative/include/nativescript/godot_nativescript.h @@ -51,8 +51,8 @@ extern "C" { #elif defined(__APPLE__) #include "TargetConditionals.h" #if TARGET_OS_IPHONE -#define GDCALLINGCONV -#define GDAPI +#define GDCALLINGCONV __attribute__((visibility("default"))) +#define GDAPI GDCALLINGCONV #elif TARGET_OS_MAC #define GDCALLINGCONV __attribute__((sysv_abi)) #define GDAPI GDCALLINGCONV diff --git a/modules/gdnative/nativescript/SCsub b/modules/gdnative/nativescript/SCsub index e980e40e8e..178afec64a 100644 --- a/modules/gdnative/nativescript/SCsub +++ b/modules/gdnative/nativescript/SCsub @@ -7,4 +7,7 @@ mod_env.add_source_files(env.modules_sources, "*.cpp") mod_env.Append(CPPPATH='#modules/gdnative') mod_env.Append(CPPFLAGS=['-DGDAPI_BUILT_IN']) +if "platform" in env and env["platform"] in ["x11", "iphone"]: + env.Append(LINKFLAGS=["-rdynamic"]) + Export('mod_env') diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index aa39ad92c4..b0408917a4 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -1952,7 +1952,6 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N //make sure identifier exists... const GDParser::IdentifierNode *id = static_cast<const GDParser::IdentifierNode *>(op->arguments[1]); - if (op->arguments[0]->type == GDParser::Node::TYPE_SELF) { //self, look up @@ -2021,7 +2020,7 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N base = script->get_native(); } else if (nc.is_valid()) { - if (context.function && !context.function->_static) { + if (!(context.function && context.function->_static)) { GDCompletionIdentifier ci; ci.type = Variant::OBJECT; diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index 70340f0823..767ea29f3c 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -41,11 +41,12 @@ Variant *GDFunction::_get_variant(int p_address, GDInstance *p_instance, GDScrip switch ((p_address & ADDR_TYPE_MASK) >> ADDR_BITS) { case ADDR_TYPE_SELF: { - +#ifdef DEBUG_ENABLED if (unlikely(!p_instance)) { r_error = "Cannot access self without instance."; return NULL; } +#endif return &self; } break; case ADDR_TYPE_CLASS: { @@ -53,18 +54,22 @@ Variant *GDFunction::_get_variant(int p_address, GDInstance *p_instance, GDScrip return &p_script->_static_ref; } break; case ADDR_TYPE_MEMBER: { - //member indexing is O(1) +#ifdef DEBUG_ENABLED if (unlikely(!p_instance)) { r_error = "Cannot access member without instance."; return NULL; } +#endif + //member indexing is O(1) return &p_instance->members[address]; } break; case ADDR_TYPE_CLASS_CONSTANT: { //todo change to index! GDScript *o = p_script; +#ifdef DEBUG_ENABLED ERR_FAIL_INDEX_V(address, _global_names_count, NULL); +#endif const StringName *sn = &_global_names_ptr[address]; while (o) { @@ -84,18 +89,22 @@ Variant *GDFunction::_get_variant(int p_address, GDInstance *p_instance, GDScrip ERR_FAIL_V(NULL); } break; case ADDR_TYPE_LOCAL_CONSTANT: { +#ifdef DEBUG_ENABLED ERR_FAIL_INDEX_V(address, _constant_count, NULL); +#endif return &_constants_ptr[address]; } break; case ADDR_TYPE_STACK: case ADDR_TYPE_STACK_VARIABLE: { +#ifdef DEBUG_ENABLED ERR_FAIL_INDEX_V(address, _stack_size, NULL); +#endif return &p_stack[address]; } break; case ADDR_TYPE_GLOBAL: { - +#ifdef DEBUG_ENABLED ERR_FAIL_INDEX_V(address, GDScriptLanguage::get_singleton()->get_global_array_size(), NULL); - +#endif return &GDScriptLanguage::get_singleton()->get_global_array()[address]; } break; case ADDR_TYPE_NIL: { @@ -161,8 +170,71 @@ static String _get_var_type(const Variant *p_type) { return basestr; } +#if defined(__GNUC__) && !defined(__clang__) +#define OPCODES_TABLE \ + static const void *switch_table_ops[] = { \ + &&OPCODE_OPERATOR, \ + &&OPCODE_EXTENDS_TEST, \ + &&OPCODE_SET, \ + &&OPCODE_GET, \ + &&OPCODE_SET_NAMED, \ + &&OPCODE_GET_NAMED, \ + &&OPCODE_SET_MEMBER, \ + &&OPCODE_GET_MEMBER, \ + &&OPCODE_ASSIGN, \ + &&OPCODE_ASSIGN_TRUE, \ + &&OPCODE_ASSIGN_FALSE, \ + &&OPCODE_CONSTRUCT, \ + &&OPCODE_CONSTRUCT_ARRAY, \ + &&OPCODE_CONSTRUCT_DICTIONARY, \ + &&OPCODE_CALL, \ + &&OPCODE_CALL_RETURN, \ + &&OPCODE_CALL_BUILT_IN, \ + &&OPCODE_CALL_SELF, \ + &&OPCODE_CALL_SELF_BASE, \ + &&OPCODE_YIELD, \ + &&OPCODE_YIELD_SIGNAL, \ + &&OPCODE_YIELD_RESUME, \ + &&OPCODE_JUMP, \ + &&OPCODE_JUMP_IF, \ + &&OPCODE_JUMP_IF_NOT, \ + &&OPCODE_JUMP_TO_DEF_ARGUMENT, \ + &&OPCODE_RETURN, \ + &&OPCODE_ITERATE_BEGIN, \ + &&OPCODE_ITERATE, \ + &&OPCODE_ASSERT, \ + &&OPCODE_BREAKPOINT, \ + &&OPCODE_LINE, \ + &&OPCODE_END \ + }; + +#define OPCODE(m_op) \ + m_op: +#define OPCODE_WHILE(m_test) +#define OPCODES_END \ + OPSEXIT: +#define OPCODES_OUT \ + OPSOUT: +#define DISPATCH_OPCODE goto *switch_table_ops[_code_ptr[ip]] +#define OPCODE_SWITCH(m_test) DISPATCH_OPCODE; +#define OPCODE_BREAK goto OPSEXIT +#define OPCODE_OUT goto OPSOUT +#else +#define OPCODES_TABLE +#define OPCODE(m_op) case m_op: +#define OPCODE_WHILE(m_test) while (m_test) +#define OPCODES_END +#define OPCODES_OUT +#define DISPATCH_OPCODE continue +#define OPCODE_SWITCH(m_test) switch (m_test) +#define OPCODE_BREAK break +#define OPCODE_OUT break +#endif + Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state) { + OPCODES_TABLE; + if (!_code_ptr) { return Variant(); @@ -271,16 +343,23 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (ScriptDebugger::get_singleton()) GDScriptLanguage::get_singleton()->enter_function(p_instance, this, stack, &ip, &line); -#define GD_ERR_BREAK(m_cond) ERR_BREAK(m_cond) +#define GD_ERR_BREAK(m_cond) \ + { \ + if (unlikely(m_cond)) { \ + _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Breaking..:"); \ + OPCODE_BREAK; \ + } else \ + _err_error_exists = false; \ + } #define CHECK_SPACE(m_space) \ - ERR_BREAK((ip + m_space) > _code_size) + GD_ERR_BREAK((ip + m_space) > _code_size) #define GET_VARIANT_PTR(m_v, m_code_ofs) \ Variant *m_v; \ m_v = _get_variant(_code_ptr[ip + m_code_ofs], p_instance, _class, self, stack, err_text); \ if (unlikely(!m_v)) \ - break; + OPCODE_BREAK; #else #define GD_ERR_BREAK(m_cond) @@ -306,15 +385,15 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a bool exit_ok = false; #ifdef DEBUG_ENABLED - while (ip < _code_size) { + OPCODE_WHILE(ip < _code_size) { int last_opcode = _code_ptr[ip]; #else - while (true) { + OPCODE_WHILE(true) { #endif - switch (_code_ptr[ip]) { + OPCODE_SWITCH(_code_ptr[ip]) { - case OPCODE_OPERATOR: { + OPCODE(OPCODE_OPERATOR) { CHECK_SPACE(5); @@ -343,14 +422,14 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a } else { err_text = "Invalid operands '" + Variant::get_type_name(a->get_type()) + "' and '" + Variant::get_type_name(b->get_type()) + "' in operator '" + Variant::get_operator_name(op) + "'."; } - break; + OPCODE_BREAK; } *dst = ret; #endif ip += 5; - continue; + DISPATCH_OPCODE; } - case OPCODE_EXTENDS_TEST: { + OPCODE(OPCODE_EXTENDS_TEST) { CHECK_SPACE(4); @@ -362,12 +441,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (a->get_type() != Variant::OBJECT || a->operator Object *() == NULL) { err_text = "Left operand of 'is' is not an instance of anything."; - break; + OPCODE_BREAK; } if (b->get_type() != Variant::OBJECT || b->operator Object *() == NULL) { err_text = "Right operand of 'is' is not a class."; - break; + OPCODE_BREAK; } #endif Object *obj_A = *a; @@ -390,7 +469,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (cmp == scr_B) { //inherits from script, all ok extends_ok = true; - break; + OPCODE_BREAK; } cmp = cmp->_base; @@ -405,7 +484,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (!nc) { err_text = "Right operand of 'is' is not a class (type: '" + obj_B->get_class() + "')."; - break; + OPCODE_BREAK; } #endif extends_ok = ClassDB::is_parent_class(obj_A->get_class_name(), nc->get_name()); @@ -413,9 +492,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a *dst = extends_ok; ip += 4; - continue; + DISPATCH_OPCODE; } - case OPCODE_SET: { + OPCODE(OPCODE_SET) { CHECK_SPACE(3); @@ -435,13 +514,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a v = "of type '" + _get_var_type(index) + "'"; } err_text = "Invalid set index " + v + " (on base: '" + _get_var_type(dst) + "')."; - break; + OPCODE_BREAK; } #endif ip += 4; - continue; + DISPATCH_OPCODE; } - case OPCODE_GET: { + OPCODE(OPCODE_GET) { CHECK_SPACE(3); @@ -466,14 +545,14 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a v = "of type '" + _get_var_type(index) + "'"; } err_text = "Invalid get index " + v + " (on base: '" + _get_var_type(src) + "')."; - break; + OPCODE_BREAK; } *dst = ret; #endif ip += 4; - continue; + DISPATCH_OPCODE; } - case OPCODE_SET_NAMED: { + OPCODE(OPCODE_SET_NAMED) { CHECK_SPACE(3); @@ -492,13 +571,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (!valid) { String err_type; err_text = "Invalid set index '" + String(*index) + "' (on base: '" + _get_var_type(dst) + "')."; - break; + OPCODE_BREAK; } #endif ip += 4; - continue; + DISPATCH_OPCODE; } - case OPCODE_GET_NAMED: { + OPCODE(OPCODE_GET_NAMED) { CHECK_SPACE(4); @@ -525,14 +604,14 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a } else { err_text = "Invalid get index '" + index->operator String() + "' (on base: '" + _get_var_type(src) + "')."; } - break; + OPCODE_BREAK; } *dst = ret; #endif ip += 4; - continue; + DISPATCH_OPCODE; } - case OPCODE_SET_MEMBER: { + OPCODE(OPCODE_SET_MEMBER) { CHECK_SPACE(3); int indexname = _code_ptr[ip + 1]; @@ -545,16 +624,16 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a #ifdef DEBUG_ENABLED if (!ok) { err_text = "Internal error setting property: " + String(*index); - break; + OPCODE_BREAK; } else if (!valid) { err_text = "Error setting property '" + String(*index) + "' with value of type " + Variant::get_type_name(src->get_type()) + "."; - break; + OPCODE_BREAK; } #endif ip += 3; - continue; + DISPATCH_OPCODE; } - case OPCODE_GET_MEMBER: { + OPCODE(OPCODE_GET_MEMBER) { CHECK_SPACE(3); int indexname = _code_ptr[ip + 1]; @@ -566,13 +645,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a #ifdef DEBUG_ENABLED if (!ok) { err_text = "Internal error getting property: " + String(*index); - break; + OPCODE_BREAK; } #endif ip += 3; - continue; + DISPATCH_OPCODE; } - case OPCODE_ASSIGN: { + OPCODE(OPCODE_ASSIGN) { CHECK_SPACE(3); GET_VARIANT_PTR(dst, 1); @@ -581,9 +660,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a *dst = *src; ip += 3; - continue; + DISPATCH_OPCODE; } - case OPCODE_ASSIGN_TRUE: { + OPCODE(OPCODE_ASSIGN_TRUE) { CHECK_SPACE(2); GET_VARIANT_PTR(dst, 1); @@ -591,9 +670,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a *dst = true; ip += 2; - continue; + DISPATCH_OPCODE; } - case OPCODE_ASSIGN_FALSE: { + OPCODE(OPCODE_ASSIGN_FALSE) { CHECK_SPACE(2); GET_VARIANT_PTR(dst, 1); @@ -601,9 +680,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a *dst = false; ip += 2; - continue; + DISPATCH_OPCODE; } - case OPCODE_CONSTRUCT: { + OPCODE(OPCODE_CONSTRUCT) { CHECK_SPACE(2); Variant::Type t = Variant::Type(_code_ptr[ip + 1]); @@ -623,15 +702,15 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (err.error != Variant::CallError::CALL_OK) { err_text = _get_call_error(err, "'" + Variant::get_type_name(t) + "' constructor", (const Variant **)argptrs); - break; + OPCODE_BREAK; } #endif ip += 4 + argc; //construct a basic type - continue; + DISPATCH_OPCODE; } - case OPCODE_CONSTRUCT_ARRAY: { + OPCODE(OPCODE_CONSTRUCT_ARRAY) { CHECK_SPACE(1); int argc = _code_ptr[ip + 1]; @@ -649,9 +728,9 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a *dst = array; ip += 3 + argc; - continue; + DISPATCH_OPCODE; } - case OPCODE_CONSTRUCT_DICTIONARY: { + OPCODE(OPCODE_CONSTRUCT_DICTIONARY) { CHECK_SPACE(1); int argc = _code_ptr[ip + 1]; @@ -671,10 +750,10 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a *dst = dict; ip += 3 + argc * 2; - continue; + DISPATCH_OPCODE; } - case OPCODE_CALL_RETURN: - case OPCODE_CALL: { + OPCODE(OPCODE_CALL_RETURN) + OPCODE(OPCODE_CALL) { CHECK_SPACE(4); bool call_ret = _code_ptr[ip] == OPCODE_CALL_RETURN; @@ -736,24 +815,24 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (base->is_ref()) { err_text = "Attempted to free a reference."; - break; + OPCODE_BREAK; } else if (base->get_type() == Variant::OBJECT) { err_text = "Attempted to free a locked object (calling or emitting)."; - break; + OPCODE_BREAK; } } } err_text = _get_call_error(err, "function '" + methodstr + "' in base '" + basestr + "'", (const Variant **)argptrs); - break; + OPCODE_BREAK; } #endif //_call_func(NULL,base,*methodname,ip,argc,p_instance,stack); ip += argc + 1; - continue; + DISPATCH_OPCODE; } - case OPCODE_CALL_BUILT_IN: { + OPCODE(OPCODE_CALL_BUILT_IN) { CHECK_SPACE(4); @@ -786,17 +865,17 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a } else { err_text = _get_call_error(err, "built-in function '" + methodstr + "'", (const Variant **)argptrs); } - break; + OPCODE_BREAK; } #endif ip += argc + 1; - continue; + DISPATCH_OPCODE; } - case OPCODE_CALL_SELF: { + OPCODE(OPCODE_CALL_SELF) { - break; + OPCODE_BREAK; } - case OPCODE_CALL_SELF_BASE: { + OPCODE(OPCODE_CALL_SELF_BASE) { CHECK_SPACE(2); int self_fun = _code_ptr[ip + 1]; @@ -805,7 +884,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (self_fun < 0 || self_fun >= _global_names_count) { err_text = "compiler bug, function name not found"; - break; + OPCODE_BREAK; } #endif const StringName *methodname = &_global_names_ptr[self_fun]; @@ -865,14 +944,14 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a String methodstr = *methodname; err_text = _get_call_error(err, "function '" + methodstr + "'", (const Variant **)argptrs); - break; + OPCODE_BREAK; } ip += 4 + argc; - continue; + DISPATCH_OPCODE; } - case OPCODE_YIELD: - case OPCODE_YIELD_SIGNAL: { + OPCODE(OPCODE_YIELD) + OPCODE(OPCODE_YIELD_SIGNAL) { int ipofs = 1; if (_code_ptr[ip] == OPCODE_YIELD_SIGNAL) { @@ -913,11 +992,11 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a #ifdef DEBUG_ENABLED if (argobj->get_type() != Variant::OBJECT) { err_text = "First argument of yield() not of type object."; - break; + OPCODE_BREAK; } if (argname->get_type() != Variant::STRING) { err_text = "Second argument of yield() not a string (for signal name)."; - break; + OPCODE_BREAK; } #endif Object *obj = argobj->operator Object *(); @@ -926,18 +1005,18 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (!obj) { err_text = "First argument of yield() is null."; - break; + OPCODE_BREAK; } if (ScriptDebugger::get_singleton()) { if (!ObjectDB::instance_validate(obj)) { err_text = "First argument of yield() is a previously freed instance."; - break; + OPCODE_BREAK; } } if (signal.length() == 0) { err_text = "Second argument of yield() is an empty string (for signal name)."; - break; + OPCODE_BREAK; } #endif @@ -945,38 +1024,38 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a #ifdef DEBUG_ENABLED if (err != OK) { err_text = "Error connecting to signal: " + signal + " during yield()."; - break; + OPCODE_BREAK; } #endif } exit_ok = true; - break; + OPCODE_BREAK; } - case OPCODE_YIELD_RESUME: { + OPCODE(OPCODE_YIELD_RESUME) { CHECK_SPACE(2); #ifdef DEBUG_ENABLED if (!p_state) { err_text = ("Invalid Resume (bug?)"); - break; + OPCODE_BREAK; } #endif GET_VARIANT_PTR(result, 1); *result = p_state->result; ip += 2; - continue; + DISPATCH_OPCODE; } - case OPCODE_JUMP: { + OPCODE(OPCODE_JUMP) { CHECK_SPACE(2); int to = _code_ptr[ip + 1]; GD_ERR_BREAK(to < 0 || to > _code_size); ip = to; - continue; + DISPATCH_OPCODE; } - case OPCODE_JUMP_IF: { + OPCODE(OPCODE_JUMP_IF) { CHECK_SPACE(3); @@ -988,12 +1067,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a int to = _code_ptr[ip + 2]; GD_ERR_BREAK(to < 0 || to > _code_size); ip = to; - continue; + DISPATCH_OPCODE; } ip += 3; - continue; + DISPATCH_OPCODE; } - case OPCODE_JUMP_IF_NOT: { + OPCODE(OPCODE_JUMP_IF_NOT) { CHECK_SPACE(3); @@ -1005,26 +1084,26 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a int to = _code_ptr[ip + 2]; GD_ERR_BREAK(to < 0 || to > _code_size); ip = to; - continue; + DISPATCH_OPCODE; } ip += 3; - continue; + DISPATCH_OPCODE; } - case OPCODE_JUMP_TO_DEF_ARGUMENT: { + OPCODE(OPCODE_JUMP_TO_DEF_ARGUMENT) { CHECK_SPACE(2); ip = _default_arg_ptr[defarg]; - continue; + DISPATCH_OPCODE; } - case OPCODE_RETURN: { + OPCODE(OPCODE_RETURN) { CHECK_SPACE(2); GET_VARIANT_PTR(r, 1); retvalue = *r; exit_ok = true; - break; + OPCODE_BREAK; } - case OPCODE_ITERATE_BEGIN: { + OPCODE(OPCODE_ITERATE_BEGIN) { CHECK_SPACE(8); //space for this a regular iterate @@ -1036,13 +1115,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a #ifdef DEBUG_ENABLED if (!valid) { err_text = "Unable to iterate on object of type " + Variant::get_type_name(container->get_type()) + "'."; - break; + OPCODE_BREAK; } #endif int jumpto = _code_ptr[ip + 3]; GD_ERR_BREAK(jumpto < 0 || jumpto > _code_size); ip = jumpto; - continue; + DISPATCH_OPCODE; } GET_VARIANT_PTR(iterator, 4); @@ -1050,13 +1129,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a #ifdef DEBUG_ENABLED if (!valid) { err_text = "Unable to obtain iterator object of type " + Variant::get_type_name(container->get_type()) + "'."; - break; + OPCODE_BREAK; } #endif ip += 5; //skip regular iterate which is always next - continue; + DISPATCH_OPCODE; } - case OPCODE_ITERATE: { + OPCODE(OPCODE_ITERATE) { CHECK_SPACE(4); @@ -1068,13 +1147,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a #ifdef DEBUG_ENABLED if (!valid) { err_text = "Unable to iterate on object of type " + Variant::get_type_name(container->get_type()) + "' (type changed since first iteration?)."; - break; + OPCODE_BREAK; } #endif int jumpto = _code_ptr[ip + 3]; GD_ERR_BREAK(jumpto < 0 || jumpto > _code_size); ip = jumpto; - continue; + DISPATCH_OPCODE; } GET_VARIANT_PTR(iterator, 4); @@ -1082,13 +1161,13 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a #ifdef DEBUG_ENABLED if (!valid) { err_text = "Unable to obtain iterator object of type " + Variant::get_type_name(container->get_type()) + "' (but was obtained on first iteration?)."; - break; + OPCODE_BREAK; } #endif ip += 5; //loop again - continue; + DISPATCH_OPCODE; } - case OPCODE_ASSERT: { + OPCODE(OPCODE_ASSERT) { CHECK_SPACE(2); GET_VARIANT_PTR(test, 1); @@ -1098,23 +1177,23 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (!result) { err_text = "Assertion failed."; - break; + OPCODE_BREAK; } #endif ip += 2; - continue; + DISPATCH_OPCODE; } - case OPCODE_BREAKPOINT: { + OPCODE(OPCODE_BREAKPOINT) { #ifdef DEBUG_ENABLED if (ScriptDebugger::get_singleton()) { GDScriptLanguage::get_singleton()->debug_break("Breakpoint Statement", true); } #endif ip += 1; - continue; + DISPATCH_OPCODE; } - case OPCODE_LINE: { + OPCODE(OPCODE_LINE) { CHECK_SPACE(2); line = _code_ptr[ip + 1]; @@ -1141,23 +1220,26 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a ScriptDebugger::get_singleton()->line_poll(); } - continue; + DISPATCH_OPCODE; } - case OPCODE_END: { + OPCODE(OPCODE_END) { exit_ok = true; - break; + OPCODE_BREAK; } +#if 0 default: { err_text = "Illegal opcode " + itos(_code_ptr[ip]) + " at address " + itos(ip); - break; + OPCODE_BREAK; } +#endif } + OPCODES_END #ifdef DEBUG_ENABLED if (exit_ok) - break; + OPCODE_OUT; //error // function, file, line, error, explanation String err_file; @@ -1182,9 +1264,10 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a } #endif - break; + OPCODE_OUT; } + OPCODES_OUT #ifdef DEBUG_ENABLED if (GDScriptLanguage::get_singleton()->profiling) { uint64_t time_taken = OS::get_singleton()->get_ticks_usec() - function_start_time; diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub index 5eabaf6f2b..5e559bd4db 100644 --- a/modules/ogg/SCsub +++ b/modules/ogg/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_ogg = env_modules.Clone() # Thirdparty source files -if (env['builtin_libogg'] != 'no'): +if env['builtin_libogg']: thirdparty_dir = "#thirdparty/libogg/" thirdparty_sources = [ "bitwise.c", diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub index eb3c0e64d8..84c5e68439 100644 --- a/modules/openssl/SCsub +++ b/modules/openssl/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_openssl = env_modules.Clone() # Thirdparty source files -if (env['builtin_openssl'] != 'no'): +if env['builtin_openssl']: thirdparty_dir = "#thirdparty/openssl/" thirdparty_sources = [ diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp index d40bf73883..c19bdc4214 100644 --- a/modules/openssl/stream_peer_openssl.cpp +++ b/modules/openssl/stream_peer_openssl.cpp @@ -29,6 +29,17 @@ /*************************************************************************/ #include "stream_peer_openssl.h" +// Compatibility with OpenSSL 1.1.0. +#if OPENSSL_VERSION_NUMBER >= 0x10100000L +#define BIO_set_num(b, n) +#else +#define BIO_set_num(b, n) ((b)->num = (n)) + +#define BIO_set_init(b, i) ((b)->init = (i)) +#define BIO_set_data(b, p) ((b)->ptr = (p)) +#define BIO_get_data(b) ((b)->ptr) +#endif + //hostname matching code from curl bool StreamPeerOpenSSL::_match_host_name(const char *name, const char *hostname) { @@ -157,10 +168,10 @@ int StreamPeerOpenSSL::_cert_verify_callback(X509_STORE_CTX *x509_ctx, void *arg } int StreamPeerOpenSSL::_bio_create(BIO *b) { - b->init = 1; - b->num = 0; - b->ptr = NULL; - b->flags = 0; + BIO_set_init(b, 1); + BIO_set_num(b, 0); + BIO_set_data(b, NULL); + BIO_clear_flags(b, ~0); return 1; } @@ -168,9 +179,9 @@ int StreamPeerOpenSSL::_bio_destroy(BIO *b) { if (b == NULL) return 0; - b->ptr = NULL; /* sb_tls_remove() will free it */ - b->init = 0; - b->flags = 0; + BIO_set_data(b, NULL); /* sb_tls_remove() will free it */ + BIO_set_init(b, 0); + BIO_clear_flags(b, ~0); return 1; } @@ -178,7 +189,7 @@ int StreamPeerOpenSSL::_bio_read(BIO *b, char *buf, int len) { if (buf == NULL || len <= 0) return 0; - StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)b->ptr; + StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)BIO_get_data(b); ERR_FAIL_COND_V(sp == NULL, 0); @@ -212,7 +223,7 @@ int StreamPeerOpenSSL::_bio_write(BIO *b, const char *buf, int len) { if (buf == NULL || len <= 0) return 0; - StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)b->ptr; + StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)BIO_get_data(b); ERR_FAIL_COND_V(sp == NULL, 0); @@ -258,6 +269,26 @@ int StreamPeerOpenSSL::_bio_puts(BIO *b, const char *str) { return _bio_write(b, str, strlen(str)); } +#if OPENSSL_VERSION_NUMBER >= 0x10100000L +BIO_METHOD *StreamPeerOpenSSL::_bio_method = NULL; + +BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() { + if (_bio_method) // already initialized. + return _bio_method; + + /* it's a source/sink BIO */ + _bio_method = BIO_meth_new(100 | 0x400, "streampeer glue"); + BIO_meth_set_write(_bio_method, _bio_write); + BIO_meth_set_read(_bio_method, _bio_read); + BIO_meth_set_puts(_bio_method, _bio_puts); + BIO_meth_set_gets(_bio_method, _bio_gets); + BIO_meth_set_ctrl(_bio_method, _bio_ctrl); + BIO_meth_set_create(_bio_method, _bio_create); + BIO_meth_set_destroy(_bio_method, _bio_destroy); + + return _bio_method; +} +#else BIO_METHOD StreamPeerOpenSSL::_bio_method = { /* it's a source/sink BIO */ (100 | 0x400), @@ -271,6 +302,11 @@ BIO_METHOD StreamPeerOpenSSL::_bio_method = { _bio_destroy }; +BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() { + return &_bio_method; +} +#endif + Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String &p_for_hostname) { if (connected) @@ -330,8 +366,8 @@ Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_valida } ssl = SSL_new(ctx); - bio = BIO_new(&_bio_method); - bio->ptr = this; + bio = BIO_new(_get_bio_method()); + BIO_set_data(bio, this); SSL_set_bio(ssl, bio, bio); if (p_for_hostname != String()) { @@ -532,7 +568,9 @@ void StreamPeerOpenSSL::initialize_ssl() { load_certs_func = _load_certs; _create = _create_func; +#if OPENSSL_VERSION_NUMBER < 0x10100000L CRYPTO_malloc_init(); // Initialize malloc, free, etc for OpenSSL's use +#endif SSL_library_init(); // Initialize OpenSSL's SSL libraries SSL_load_error_strings(); // Load SSL error strings ERR_load_BIO_strings(); // Load BIO error strings diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h index 1e445ef681..535114058d 100644 --- a/modules/openssl/stream_peer_openssl.h +++ b/modules/openssl/stream_peer_openssl.h @@ -53,7 +53,12 @@ private: static int _bio_gets(BIO *b, char *buf, int len); static int _bio_puts(BIO *b, const char *str); +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + static BIO_METHOD *_bio_method; +#else static BIO_METHOD _bio_method; +#endif + static BIO_METHOD *_get_bio_method(); static bool _match_host_name(const char *name, const char *hostname); static Error _match_common_name(const char *hostname, const X509 *server_cert); diff --git a/modules/opus/SCsub b/modules/opus/SCsub index 4d3053c7ec..fee06bd267 100644 --- a/modules/opus/SCsub +++ b/modules/opus/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_opus = env_modules.Clone() # Thirdparty source files -if (env['builtin_opus'] != 'no'): +if env['builtin_opus']: thirdparty_dir = "#thirdparty/opus/" thirdparty_sources = [ @@ -209,7 +209,7 @@ if (env['builtin_opus'] != 'no'): env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths]) # also requires libogg - if (env['builtin_libogg'] != 'no'): + if env['builtin_libogg']: env_opus.Append(CPPPATH=["#thirdparty/libogg"]) # Module files diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp index 995f4ddcc6..c7748b9b21 100644 --- a/modules/opus/audio_stream_opus.cpp +++ b/modules/opus/audio_stream_opus.cpp @@ -247,7 +247,7 @@ void AudioStreamPlaybackOpus::play(float p_from) { frames_mixed = pre_skip; playing = true; if (p_from > 0) { - seek_pos(p_from); + seek(p_from); } } @@ -256,7 +256,7 @@ void AudioStreamPlaybackOpus::stop() { playing = false; } -void AudioStreamPlaybackOpus::seek_pos(float p_time) { +void AudioStreamPlaybackOpus::seek(float p_time) { if (!playing) return; ogg_int64_t pcm_offset = (ogg_int64_t)(p_time * osrate); bool ok = op_pcm_seek(opus_file, pcm_offset) == 0; @@ -340,7 +340,7 @@ float AudioStreamPlaybackOpus::get_length() const { return length; } -float AudioStreamPlaybackOpus::get_position() const { +float AudioStreamPlaybackOpus::get_playback_position() const { int32_t frames = int32_t(frames_mixed); if (frames < 0) diff --git a/modules/opus/audio_stream_opus.h b/modules/opus/audio_stream_opus.h index c7a053acd3..7b7740a804 100644 --- a/modules/opus/audio_stream_opus.h +++ b/modules/opus/audio_stream_opus.h @@ -99,8 +99,8 @@ public: virtual int get_loop_count() const { return repeats; } - virtual float get_position() const; - virtual void seek_pos(float p_time); + virtual float get_playback_position() const; + virtual void seek(float p_time); virtual int get_channels() const { return stream_channels; } virtual int get_mix_rate() const { return osrate; } diff --git a/modules/recast/SCsub b/modules/recast/SCsub index 349bd22efb..500c0ec055 100644 --- a/modules/recast/SCsub +++ b/modules/recast/SCsub @@ -5,7 +5,7 @@ Import('env') # Not building in a separate env as core needs it # Thirdparty source files -if (env['builtin_recast'] != 'no'): +if env['builtin_recast']: thirdparty_dir = "#thirdparty/recastnavigation/Recast/" thirdparty_sources = [ "Source/Recast.cpp", @@ -24,10 +24,6 @@ if (env['builtin_recast'] != 'no'): env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/Include"]) - # also requires recast headers - if (env['builtin_recast'] != 'no'): - env.Append(CPPPATH=["#thirdparty/recastnavigation/Recast"]) - lib = env.Library("recast_builtin", thirdparty_sources) env.Append(LIBS=[lib]) diff --git a/modules/regex/SCsub b/modules/regex/SCsub index 2dfc2739e9..2bab144a28 100644 --- a/modules/regex/SCsub +++ b/modules/regex/SCsub @@ -7,7 +7,7 @@ env_regex = env_modules.Clone() env_regex.Append(CPPFLAGS=["-DPCRE2_CODE_UNIT_WIDTH=0"]) env_regex.add_source_files(env.modules_sources, "*.cpp") -if (env['builtin_pcre2'] != 'no'): +if env['builtin_pcre2']: jit_blacklist = ['javascript'] thirdparty_dir = '#thirdparty/pcre2/src/' thirdparty_flags = ['-DPCRE2_STATIC', '-DHAVE_CONFIG_H'] diff --git a/modules/squish/SCsub b/modules/squish/SCsub index cca7c038f1..127f22d798 100644 --- a/modules/squish/SCsub +++ b/modules/squish/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_squish = env_modules.Clone() # Thirdparty source files -if (env['builtin_squish'] != 'no'): +if env['builtin_squish']: thirdparty_dir = "#thirdparty/squish/" thirdparty_sources = [ "alpha.cpp", diff --git a/modules/squish/config.py b/modules/squish/config.py index cc8f098010..9b7729bda4 100644 --- a/modules/squish/config.py +++ b/modules/squish/config.py @@ -6,6 +6,6 @@ def can_build(platform): def configure(env): # Tools only, disabled for non-tools # TODO: Find a cleaner way to achieve that - if (env["tools"] == "no"): - env["module_squish_enabled"] = "no" + if not env['tools']: + env['module_squish_enabled'] = False env.disabled_modules.append("squish") diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index a3206187c0..27ea310780 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -58,7 +58,7 @@ void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_fra //end of file! if (vorbis_stream->loop) { //loop - seek_pos(vorbis_stream->loop_offset); + seek(vorbis_stream->loop_offset); loops++; } else { for (int i = mixed; i < p_frames; i++) { @@ -78,7 +78,7 @@ float AudioStreamPlaybackOGGVorbis::get_stream_sampling_rate() { void AudioStreamPlaybackOGGVorbis::start(float p_from_pos) { active = true; - seek_pos(p_from_pos); + seek(p_from_pos); loops = 0; _begin_resample(); } @@ -97,11 +97,11 @@ int AudioStreamPlaybackOGGVorbis::get_loop_count() const { return loops; } -float AudioStreamPlaybackOGGVorbis::get_position() const { +float AudioStreamPlaybackOGGVorbis::get_playback_position() const { return float(frames_mixed) / vorbis_stream->sample_rate; } -void AudioStreamPlaybackOGGVorbis::seek_pos(float p_time) { +void AudioStreamPlaybackOGGVorbis::seek(float p_time) { if (!active) return; diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h index c38402fb3a..f4d381897b 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h @@ -67,8 +67,8 @@ public: virtual int get_loop_count() const; //times it looped - virtual float get_position() const; - virtual void seek_pos(float p_time); + virtual float get_playback_position() const; + virtual void seek(float p_time); virtual float get_length() const; //if supported, otherwise return 0 diff --git a/modules/theora/SCsub b/modules/theora/SCsub index 2de4d29640..9015c2c354 100644 --- a/modules/theora/SCsub +++ b/modules/theora/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_theora = env_modules.Clone() # Thirdparty source files -if (env['builtin_libtheora'] != 'no'): +if env['builtin_libtheora']: thirdparty_dir = "#thirdparty/libtheora/" thirdparty_sources = [ #"analyze.c", @@ -74,9 +74,9 @@ if (env['builtin_libtheora'] != 'no'): env_theora.Append(CPPPATH=[thirdparty_dir]) # also requires libogg and libvorbis - if (env['builtin_libogg'] != 'no'): + if env['builtin_libogg']: env_theora.Append(CPPPATH=["#thirdparty/libogg"]) - if (env['builtin_libvorbis'] != 'no'): + if env['builtin_libvorbis']: env_theora.Append(CPPPATH=["#thirdparty/libvorbis"]) # Godot source files diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index 603c31195d..c75bec31df 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -634,12 +634,12 @@ int VideoStreamPlaybackTheora::get_loop_count() const { return 0; }; -float VideoStreamPlaybackTheora::get_position() const { +float VideoStreamPlaybackTheora::get_playback_position() const { return get_time(); }; -void VideoStreamPlaybackTheora::seek_pos(float p_time){ +void VideoStreamPlaybackTheora::seek(float p_time){ // no }; diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index aeb5fa3511..484a1a7fb9 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -140,8 +140,8 @@ public: virtual int get_loop_count() const; - virtual float get_position() const; - virtual void seek_pos(float p_time); + virtual float get_playback_position() const; + virtual void seek(float p_time); void set_file(const String &p_file); diff --git a/modules/tinyexr/config.py b/modules/tinyexr/config.py index 2e4b96a6b0..3e16fd725e 100644 --- a/modules/tinyexr/config.py +++ b/modules/tinyexr/config.py @@ -6,6 +6,6 @@ def can_build(platform): def configure(env): # Tools only, disabled for non-tools # TODO: Find a cleaner way to achieve that - if (env["tools"] == "no"): - env["module_tinyexr_enabled"] = "no" + if not env['tools']: + env['module_tinyexr_enabled'] = False env.disabled_modules.append("tinyexr") diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index d0ab29f184..985f8a8d0e 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -3267,8 +3267,7 @@ VisualScriptEditor::VisualScriptEditor() { graph = memnew(GraphEdit); add_child(graph); - graph->set_area_as_parent_rect(); - graph->set_h_size_flags(SIZE_EXPAND_FILL); + graph->set_anchors_and_margins_preset(Control::PRESET_WIDE); graph->connect("node_selected", this, "_node_selected"); graph->connect("_begin_node_move", this, "_begin_node_move"); graph->connect("_end_node_move", this, "_end_node_move"); diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index f02e797fe6..c17265d275 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -42,7 +42,7 @@ int VisualScriptFunctionCall::get_output_sequence_port_count() const { - if (method_cache.flags & METHOD_FLAG_CONST || call_mode == CALL_MODE_BASIC_TYPE) + if (method_cache.flags & METHOD_FLAG_CONST || (call_mode == CALL_MODE_BASIC_TYPE && Variant::is_method_const(basic_type, function))) return 0; else return 1; @@ -50,7 +50,7 @@ int VisualScriptFunctionCall::get_output_sequence_port_count() const { bool VisualScriptFunctionCall::has_input_sequence_port() const { - if (method_cache.flags & METHOD_FLAG_CONST || call_mode == CALL_MODE_BASIC_TYPE) + if (method_cache.flags & METHOD_FLAG_CONST || (call_mode == CALL_MODE_BASIC_TYPE && Variant::is_method_const(basic_type, function))) return false; else return true; diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub index d3e4f7e15a..9d2d0feb92 100644 --- a/modules/vorbis/SCsub +++ b/modules/vorbis/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_vorbis = env_modules.Clone() # Thirdparty source files -if (env['builtin_libvorbis'] != 'no'): +if env['builtin_libvorbis']: thirdparty_dir = "#thirdparty/libvorbis/" thirdparty_sources = [ #"analysis.c", @@ -42,7 +42,7 @@ if (env['builtin_libvorbis'] != 'no'): env_vorbis.Append(CPPPATH=[thirdparty_dir]) # also requires libogg - if (env['builtin_libogg'] != 'no'): + if env['builtin_libogg']: env_vorbis.Append(CPPPATH=["#thirdparty/libogg"]) # Godot source files diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp index 52aa2c5ee0..0afb889199 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp @@ -180,7 +180,7 @@ void AudioStreamPlaybackOGGVorbis::play(float p_from) { frames_mixed = 0; playing = true; if (p_from > 0) { - seek_pos(p_from); + seek(p_from); } } @@ -203,7 +203,7 @@ void AudioStreamPlaybackOGGVorbis::stop() { //_clear(); } -float AudioStreamPlaybackOGGVorbis::get_position() const { +float AudioStreamPlaybackOGGVorbis::get_playback_position() const { int32_t frames = int32_t(frames_mixed); if (frames < 0) @@ -211,7 +211,7 @@ float AudioStreamPlaybackOGGVorbis::get_position() const { return double(frames) / stream_srate; } -void AudioStreamPlaybackOGGVorbis::seek_pos(float p_time) { +void AudioStreamPlaybackOGGVorbis::seek(float p_time) { if (!playing) return; diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h index 9f1d78850d..929b2651e9 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.h +++ b/modules/vorbis/audio_stream_ogg_vorbis.h @@ -96,8 +96,8 @@ public: virtual int get_loop_count() const; - virtual float get_position() const; - virtual void seek_pos(float p_time); + virtual float get_playback_position() const; + virtual void seek(float p_time); virtual int get_channels() const { return stream_channels; } virtual int get_mix_rate() const { return stream_srate; } diff --git a/modules/webm/SCsub b/modules/webm/SCsub index 889f5e83aa..2f1a28a54c 100644 --- a/modules/webm/SCsub +++ b/modules/webm/SCsub @@ -19,14 +19,14 @@ env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources) env_webm.Append(CPPPATH=[thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"]) # also requires libogg, libvorbis and libopus -if (env['builtin_libogg'] != 'no'): +if env['builtin_libogg']: env_webm.Append(CPPPATH=["#thirdparty/libogg"]) -if (env['builtin_libvorbis'] != 'no'): +if env['builtin_libvorbis']: env_webm.Append(CPPPATH=["#thirdparty/libvorbis"]) -if (env['builtin_opus'] != 'no'): +if env['builtin_opus']: env_webm.Append(CPPPATH=["#thirdparty/opus"]) -if (env['builtin_libvpx'] != 'no'): +if env['builtin_libvpx']: Export('env_webm') SConscript("libvpx/SCsub") diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub index 0ee2ed45b8..fd8d762a5e 100644 --- a/modules/webm/libvpx/SCsub +++ b/modules/webm/libvpx/SCsub @@ -265,7 +265,7 @@ if env["platform"] == 'uwp': else: import platform is_x11_or_server_arm = ((env["platform"] == 'x11' or env["platform"] == 'server') and platform.machine().startswith('arm')) - is_ios_x86 = (env["platform"] == 'iphone' and env["ios_sim"] == "yes") + is_ios_x86 = (env["platform"] == 'iphone' and env["ios_sim"]) is_android_x86 = (env["platform"] == 'android' and env["android_arch"] == 'x86') if is_android_x86: cpu_bits = '32' diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index 0b33ab6a70..2ec6b27471 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -204,11 +204,11 @@ float VideoStreamPlaybackWebm::get_length() const { return 0.0f; } -float VideoStreamPlaybackWebm::get_position() const { +float VideoStreamPlaybackWebm::get_playback_position() const { return video_pos; } -void VideoStreamPlaybackWebm::seek_pos(float p_time) { +void VideoStreamPlaybackWebm::seek(float p_time) { //Not implemented } diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h index 36b0f02c5c..fc0720967a 100644 --- a/modules/webm/video_stream_webm.h +++ b/modules/webm/video_stream_webm.h @@ -81,8 +81,8 @@ public: virtual float get_length() const; - virtual float get_position() const; - virtual void seek_pos(float p_time); + virtual float get_playback_position() const; + virtual void seek(float p_time); virtual void set_audio_track(int p_idx); diff --git a/modules/webp/SCsub b/modules/webp/SCsub index aa3486a2c5..f9295fed47 100644 --- a/modules/webp/SCsub +++ b/modules/webp/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_webp = env_modules.Clone() # Thirdparty source files -if (env['builtin_libwebp'] != 'no'): +if env['builtin_libwebp']: thirdparty_dir = "#thirdparty/libwebp/" thirdparty_sources = [ "dec/alpha_dec.c", |