Add -Wshadow=local to warnings and fix reported issues.

Fixes #25316.
This commit is contained in:
marxin 2019-02-12 21:10:08 +01:00 committed by Rémi Verschelde
parent 132e2f458d
commit 8d51618949
134 changed files with 1107 additions and 1110 deletions

View File

@ -336,12 +336,18 @@ if selected_platform in platform_list:
env.Append(CCFLAGS=['/WX'])
else: # Rest of the world
disable_nonessential_warnings = ['-Wno-sign-compare']
shadow_local_warning = []
if 'gcc' in os.path.basename(env["CC"]):
version = methods.get_compiler_version(env)
if version != None and version[0] >= '7':
shadow_local_warning = ['-Wshadow-local']
if (env["warnings"] == 'extra'):
env.Append(CCFLAGS=['-Wall', '-Wextra'])
env.Append(CCFLAGS=['-Wall', '-Wextra'] + shadow_local_warning)
elif (env["warnings"] == 'all'):
env.Append(CCFLAGS=['-Wall'] + disable_nonessential_warnings)
env.Append(CCFLAGS=['-Wall'] + shadow_local_warning + disable_nonessential_warnings)
elif (env["warnings"] == 'moderate'):
env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + disable_nonessential_warnings)
env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + shadow_local_warning + disable_nonessential_warnings)
else: # 'no'
env.Append(CCFLAGS=['-w'])
if (env["werror"]):

View File

@ -2901,15 +2901,15 @@ void Image::fix_alpha_edges() {
if (dist >= closest_dist)
continue;
const uint8_t *rp = &srcptr[(k * width + l) << 2];
const uint8_t *rp2 = &srcptr[(k * width + l) << 2];
if (rp[3] < alpha_threshold)
if (rp2[3] < alpha_threshold)
continue;
closest_dist = dist;
closest_color[0] = rp[0];
closest_color[1] = rp[1];
closest_color[2] = rp[2];
closest_color[0] = rp2[0];
closest_color[1] = rp2[1];
closest_color[2] = rp2[2];
}
}

View File

@ -168,10 +168,10 @@ bool ZipArchive::try_open_pack(const String &p_path) {
zlib_filefunc_def io;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
if (!f)
FileAccess *fa = FileAccess::open(p_path, FileAccess::READ);
if (!fa)
return false;
io.opaque = f;
io.opaque = fa;
io.zopen_file = godot_open;
io.zread_file = godot_read;
io.zwrite_file = godot_write;

View File

@ -889,11 +889,11 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
if (buf) {
encode_uint32(uint32_t(np.get_name_count()) | 0x80000000, buf); //for compatibility with the old format
encode_uint32(np.get_subname_count(), buf + 4);
uint32_t flags = 0;
uint32_t np_flags = 0;
if (np.is_absolute())
flags |= 1;
np_flags |= 1;
encode_uint32(flags, buf + 8);
encode_uint32(np_flags, buf + 8);
buf += 12;
}

View File

@ -296,9 +296,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
} break;
case VARIANT_OBJECT: {
uint32_t type = f->get_32();
uint32_t objtype = f->get_32();
switch (type) {
switch (objtype) {
case OBJECT_EMPTY: {
//do none
@ -317,7 +317,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
case OBJECT_EXTERNAL_RESOURCE: {
//old file format, still around for compatibility
String type = get_unicode_string();
String exttype = get_unicode_string();
String path = get_unicode_string();
if (path.find("://") == -1 && path.is_rel_path()) {
@ -329,7 +329,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
path = remaps[path];
}
RES res = ResourceLoader::load(path, type);
RES res = ResourceLoader::load(path, exttype);
if (res.is_null()) {
WARN_PRINT(String("Couldn't load resource: " + path).utf8().get_data());
@ -346,7 +346,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
r_v = Variant();
} else {
String type = external_resources[erindex].type;
String exttype = external_resources[erindex].type;
String path = external_resources[erindex].path;
if (path.find("://") == -1 && path.is_rel_path()) {
@ -354,7 +354,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
path = ProjectSettings::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path));
}
RES res = ResourceLoader::load(path, type);
RES res = ResourceLoader::load(path, exttype);
if (res.is_null()) {
WARN_PRINT(String("Couldn't load resource: " + path).utf8().get_data());
@ -1314,8 +1314,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia
} else {
f->store_32(VARIANT_INT);
int val = p_property;
f->store_32(int32_t(val));
f->store_32(int32_t(p_property));
}
} break;

View File

@ -905,9 +905,9 @@ bool ResourceLoader::add_custom_resource_format_loader(String script_path) {
void ResourceLoader::remove_custom_resource_format_loader(String script_path) {
Ref<ResourceFormatLoader> loader = _find_custom_resource_format_loader(script_path);
if (loader.is_valid())
remove_resource_format_loader(loader);
Ref<ResourceFormatLoader> custom_loader = _find_custom_resource_format_loader(script_path);
if (custom_loader.is_valid())
remove_resource_format_loader(custom_loader);
}
void ResourceLoader::add_custom_loaders() {

View File

@ -233,9 +233,9 @@ bool ResourceSaver::add_custom_resource_format_saver(String script_path) {
void ResourceSaver::remove_custom_resource_format_saver(String script_path) {
Ref<ResourceFormatSaver> saver = _find_custom_resource_format_saver(script_path);
if (saver.is_valid())
remove_resource_format_saver(saver);
Ref<ResourceFormatSaver> custom_saver = _find_custom_resource_format_saver(script_path);
if (custom_saver.is_valid())
remove_resource_format_saver(custom_saver);
}
void ResourceSaver::add_custom_savers() {

View File

@ -374,14 +374,14 @@ PoolVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) {
{
PoolVector<Vector3>::Write w = path.write();
Point *p = end_point;
Point *p2 = end_point;
int idx = pc - 1;
while (p != begin_point) {
w[idx--] = p->pos;
p = p->prev_point;
while (p2 != begin_point) {
w[idx--] = p2->pos;
p2 = p2->prev_point;
}
w[0] = p->pos; // Assign first
w[0] = p2->pos; // Assign first
}
return path;

View File

@ -1264,10 +1264,10 @@ Expression::ENode *Expression::_parse_expression() {
}
str_ofs = cofs; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *subexpr = _parse_expression();
if (!subexpr)
return NULL;
dn->dict.push_back(expr);
dn->dict.push_back(subexpr);
_get_token(tk);
if (tk.type != TK_COLON) {
@ -1275,11 +1275,11 @@ Expression::ENode *Expression::_parse_expression() {
return NULL;
}
expr = _parse_expression();
if (!expr)
subexpr = _parse_expression();
if (!subexpr)
return NULL;
dn->dict.push_back(expr);
dn->dict.push_back(subexpr);
cofs = str_ofs;
_get_token(tk);
@ -1308,10 +1308,10 @@ Expression::ENode *Expression::_parse_expression() {
}
str_ofs = cofs; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *subexpr = _parse_expression();
if (!subexpr)
return NULL;
an->array.push_back(expr);
an->array.push_back(subexpr);
cofs = str_ofs;
_get_token(tk);
@ -1355,25 +1355,25 @@ Expression::ENode *Expression::_parse_expression() {
while (true) {
int cofs = str_ofs;
int cofs2 = str_ofs;
_get_token(tk);
if (tk.type == TK_PARENTHESIS_CLOSE) {
break;
}
str_ofs = cofs; //revert
str_ofs = cofs2; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *subexpr = _parse_expression();
if (!subexpr)
return NULL;
func_call->arguments.push_back(expr);
func_call->arguments.push_back(subexpr);
cofs = str_ofs;
cofs2 = str_ofs;
_get_token(tk);
if (tk.type == TK_COMMA) {
//all good
} else if (tk.type == TK_PARENTHESIS_CLOSE) {
str_ofs = cofs;
str_ofs = cofs2;
} else {
_set_error("Expected ',' or ')'");
}
@ -1444,11 +1444,11 @@ Expression::ENode *Expression::_parse_expression() {
}
str_ofs = cofs; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *subexpr = _parse_expression();
if (!subexpr)
return NULL;
constructor->arguments.push_back(expr);
constructor->arguments.push_back(subexpr);
cofs = str_ofs;
_get_token(tk);
@ -1485,11 +1485,11 @@ Expression::ENode *Expression::_parse_expression() {
}
str_ofs = cofs; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *subexpr = _parse_expression();
if (!subexpr)
return NULL;
bifunc->arguments.push_back(expr);
bifunc->arguments.push_back(subexpr);
cofs = str_ofs;
_get_token(tk);
@ -1584,25 +1584,25 @@ Expression::ENode *Expression::_parse_expression() {
while (true) {
int cofs = str_ofs;
int cofs3 = str_ofs;
_get_token(tk);
if (tk.type == TK_PARENTHESIS_CLOSE) {
break;
}
str_ofs = cofs; //revert
str_ofs = cofs3; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *subexpr = _parse_expression();
if (!subexpr)
return NULL;
func_call->arguments.push_back(expr);
func_call->arguments.push_back(subexpr);
cofs = str_ofs;
cofs3 = str_ofs;
_get_token(tk);
if (tk.type == TK_COMMA) {
//all good
} else if (tk.type == TK_PARENTHESIS_CLOSE) {
str_ofs = cofs;
str_ofs = cofs3;
} else {
_set_error("Expected ',' or ')'");
}
@ -1902,7 +1902,7 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression:
Variant b;
if (op->nodes[1]) {
bool ret = _execute(p_inputs, p_instance, op->nodes[1], b, r_error_str);
ret = _execute(p_inputs, p_instance, op->nodes[1], b, r_error_str);
if (ret)
return true;
}
@ -2070,7 +2070,7 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression:
for (int i = 0; i < call->arguments.size(); i++) {
Variant value;
bool ret = _execute(p_inputs, p_instance, call->arguments[i], value, r_error_str);
ret = _execute(p_inputs, p_instance, call->arguments[i], value, r_error_str);
if (ret)
return true;

View File

@ -241,13 +241,13 @@ bool Face3::intersects_aabb2(const AABB &p_aabb) const {
real_t minT = 1e20, maxT = -1e20;
for (int k = 0; k < 3; k++) {
real_t d = axis.dot(vertex[k]);
real_t vert_d = axis.dot(vertex[k]);
if (d > maxT)
maxT = d;
if (vert_d > maxT)
maxT = vert_d;
if (d < minT)
minT = d;
if (vert_d < minT)
minT = vert_d;
}
if (maxB < minT || maxT < minB)

View File

@ -916,34 +916,34 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) {
pass++;
for (typename List<typename Element::OctantOwner, AL>::Element *E = owners.front(); E;) {
for (typename List<typename Element::OctantOwner, AL>::Element *F = owners.front(); F;) {
Octant *o = E->get().octant;
typename List<typename Element::OctantOwner, AL>::Element *N = E->next();
Octant *o = F->get().octant;
typename List<typename Element::OctantOwner, AL>::Element *N = F->next();
/*
if (!use_pairs)
o->elements.erase( E->get().E );
o->elements.erase( F->get().E );
*/
if (use_pairs && e.pairable)
o->pairable_elements.erase(E->get().E);
o->pairable_elements.erase(F->get().E);
else
o->elements.erase(E->get().E);
o->elements.erase(F->get().E);
if (_remove_element_from_octant(&e, o, common_parent->parent)) {
owners.erase(E);
owners.erase(F);
}
E = N;
F = N;
}
if (use_pairs) {
//unpair child elements in anything that survived
for (typename List<typename Element::OctantOwner, AL>::Element *E = owners.front(); E; E = E->next()) {
for (typename List<typename Element::OctantOwner, AL>::Element *F = owners.front(); F; F = F->next()) {
Octant *o = E->get().octant;
Octant *o = F->get().octant;
// erase children pairs, unref ONCE
pass++;

View File

@ -438,12 +438,12 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
}
// remove all edge connections to this face
for (Map<Edge, RetFaceConnect>::Element *E = ret_edges.front(); E; E = E->next()) {
if (E->get().left == O)
E->get().left = NULL;
for (Map<Edge, RetFaceConnect>::Element *G = ret_edges.front(); G; G = G->next()) {
if (G->get().left == O)
G->get().left = NULL;
if (E->get().right == O)
E->get().right = NULL;
if (G->get().right == O)
G->get().right = NULL;
}
ret_edges.erase(F); //remove the edge

View File

@ -501,7 +501,7 @@ Error ProjectSettings::_load_settings_binary(const String p_path) {
d.resize(vlen);
f->get_buffer(d.ptrw(), vlen);
Variant value;
Error err = decode_variant(value, d.ptr(), d.size());
err = decode_variant(value, d.ptr(), d.size());
ERR_EXPLAIN("Error decoding property: " + key);
ERR_CONTINUE(err != OK);
set(key, value);
@ -656,7 +656,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
file->store_string(key);
int len;
Error err = encode_variant(p_custom_features, NULL, len);
err = encode_variant(p_custom_features, NULL, len);
if (err != OK) {
memdelete(file);
ERR_FAIL_V(err);
@ -694,7 +694,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
file->store_string(key);
int len;
Error err = encode_variant(value, NULL, len);
err = encode_variant(value, NULL, len);
if (err != OK)
memdelete(file);
ERR_FAIL_COND_V(err != OK, ERR_INVALID_DATA);

View File

@ -527,8 +527,8 @@ void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name,
}
bool found = false;
for (const List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
if (E->get().name == p_name) {
for (const List<PropertyInfo>::Element *F = properties.front(); F; F = F->next()) {
if (F->get().name == p_name) {
found = true;
break;
}

View File

@ -1052,7 +1052,7 @@ StringName TranslationServer::translate(const StringName &p_message) const {
if (fallback.length() >= 2) {
const CharType *fptr = &fallback[0];
bool near_match = false;
near_match = false;
for (const Set<Ref<Translation> >::Element *E = translations.front(); E; E = E->next()) {
const Ref<Translation> &t = E->get();

View File

@ -603,13 +603,13 @@ String String::camelcase_to_underscore(bool lowercase) const {
is_next_number = cstr[i + 1] >= '0' && cstr[i + 1] <= '9';
}
const bool a = is_upper && !was_precedent_upper && !was_precedent_number;
const bool b = was_precedent_upper && is_upper && are_next_2_lower;
const bool c = is_number && !was_precedent_number;
const bool cond_a = is_upper && !was_precedent_upper && !was_precedent_number;
const bool cond_b = was_precedent_upper && is_upper && are_next_2_lower;
const bool cond_c = is_number && !was_precedent_number;
const bool can_break_number_letter = is_number && !was_precedent_number && is_next_lower;
const bool can_break_letter_number = !is_number && was_precedent_number && (is_next_lower || is_next_number);
bool should_split = a || b || c || can_break_number_letter || can_break_letter_number;
bool should_split = cond_a || cond_b || cond_c || can_break_number_letter || can_break_letter_number;
if (should_split) {
new_string += this->substr(start_index, i - start_index) + "_";
start_index = i;

View File

@ -1227,15 +1227,15 @@ bool Variant::has_method(const StringName &p_method) const {
#endif
}
const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[type];
return fd.functions.has(p_method);
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[type];
return tf.functions.has(p_method);
}
Vector<Variant::Type> Variant::get_method_argument_types(Variant::Type p_type, const StringName &p_method) {
const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type];
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = fd.functions.find(p_method);
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
if (!E)
return Vector<Variant::Type>();
@ -1244,9 +1244,9 @@ Vector<Variant::Type> Variant::get_method_argument_types(Variant::Type p_type, c
bool Variant::is_method_const(Variant::Type p_type, const StringName &p_method) {
const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type];
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = fd.functions.find(p_method);
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
if (!E)
return false;
@ -1255,9 +1255,9 @@ bool Variant::is_method_const(Variant::Type p_type, const StringName &p_method)
Vector<StringName> Variant::get_method_argument_names(Variant::Type p_type, const StringName &p_method) {
const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type];
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = fd.functions.find(p_method);
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
if (!E)
return Vector<StringName>();
@ -1266,9 +1266,9 @@ Vector<StringName> Variant::get_method_argument_names(Variant::Type p_type, cons
Variant::Type Variant::get_method_return_type(Variant::Type p_type, const StringName &p_method, bool *r_has_return) {
const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type];
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = fd.functions.find(p_method);
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
if (!E)
return Variant::NIL;
@ -1280,9 +1280,9 @@ Variant::Type Variant::get_method_return_type(Variant::Type p_type, const String
Vector<Variant> Variant::get_method_default_arguments(Variant::Type p_type, const StringName &p_method) {
const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[p_type];
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[p_type];
const Map<StringName, _VariantCall::FuncData>::Element *E = fd.functions.find(p_method);
const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.find(p_method);
if (!E)
return Vector<Variant>();
@ -1291,9 +1291,9 @@ Vector<Variant> Variant::get_method_default_arguments(Variant::Type p_type, cons
void Variant::get_method_list(List<MethodInfo> *p_list) const {
const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[type];
const _VariantCall::TypeFunc &tf = _VariantCall::type_funcs[type];
for (const Map<StringName, _VariantCall::FuncData>::Element *E = fd.functions.front(); E; E = E->next()) {
for (const Map<StringName, _VariantCall::FuncData>::Element *E = tf.functions.front(); E; E = E->next()) {
const _VariantCall::FuncData &fd = E->get();
@ -1405,11 +1405,11 @@ Variant Variant::get_constant_value(Variant::Type p_type, const StringName &p_va
Map<StringName, int>::Element *E = cd.value.find(p_value);
if (!E) {
Map<StringName, Variant>::Element *E = cd.variant_value.find(p_value);
if (E) {
Map<StringName, Variant>::Element *F = cd.variant_value.find(p_value);
if (F) {
if (r_valid)
*r_valid = true;
return E->get();
return F->get();
} else {
return -1;
}

View File

@ -3496,15 +3496,15 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst)
case COLOR: {
const Color *ca = reinterpret_cast<const Color *>(a._data._mem);
const Color *cb = reinterpret_cast<const Color *>(b._data._mem);
float r = ca->r + cb->r * c;
float g = ca->g + cb->g * c;
float b = ca->b + cb->b * c;
float a = ca->a + cb->a * c;
r = r > 1.0 ? 1.0 : r;
g = g > 1.0 ? 1.0 : g;
b = b > 1.0 ? 1.0 : b;
a = a > 1.0 ? 1.0 : a;
r_dst = Color(r, g, b, a);
float new_r = ca->r + cb->r * c;
float new_g = ca->g + cb->g * c;
float new_b = ca->b + cb->b * c;
float new_a = ca->a + cb->a * c;
new_r = new_r > 1.0 ? 1.0 : new_r;
new_g = new_g > 1.0 ? 1.0 : new_g;
new_b = new_b > 1.0 ? 1.0 : new_b;
new_a = new_a > 1.0 ? 1.0 : new_a;
r_dst = Color(new_r, new_g, new_b, new_a);
}
return;
default: {

View File

@ -728,7 +728,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
bool at_key = true;
String key;
Token token;
Token token2;
bool need_comma = false;
while (true) {
@ -740,11 +740,11 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
if (at_key) {
Error err = get_token(p_stream, token, line, r_err_str);
Error err = get_token(p_stream, token2, line, r_err_str);
if (err != OK)
return err;
if (token.type == TK_PARENTHESIS_CLOSE) {
if (token2.type == TK_PARENTHESIS_CLOSE) {
Reference *reference = Object::cast_to<Reference>(obj);
if (reference) {
value = REF(reference);
@ -756,7 +756,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
if (need_comma) {
if (token.type != TK_COMMA) {
if (token2.type != TK_COMMA) {
r_err_str = "Expected '}' or ','";
return ERR_PARSE_ERROR;
@ -766,18 +766,18 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
}
if (token.type != TK_STRING) {
if (token2.type != TK_STRING) {
r_err_str = "Expected property name as string";
return ERR_PARSE_ERROR;
}
key = token.value;
key = token2.value;
err = get_token(p_stream, token, line, r_err_str);
err = get_token(p_stream, token2, line, r_err_str);
if (err != OK)
return err;
if (token.type != TK_COLON) {
if (token2.type != TK_COLON) {
r_err_str = "Expected ':'";
return ERR_PARSE_ERROR;
@ -785,12 +785,12 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
at_key = false;
} else {
Error err = get_token(p_stream, token, line, r_err_str);
Error err = get_token(p_stream, token2, line, r_err_str);
if (err != OK)
return err;
Variant v;
err = parse_value(token, v, p_stream, line, r_err_str, p_res_parser);
err = parse_value(token2, v, p_stream, line, r_err_str, p_res_parser);
if (err)
return err;
obj->set(key, v);
@ -882,11 +882,11 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
String id = token.value;
String id2 = token.value;
Ref<InputEvent> ie;
if (id == "NONE") {
if (id2 == "NONE") {
get_token(p_stream, token, line, r_err_str);
@ -895,7 +895,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
} else if (id == "KEY") {
} else if (id2 == "KEY") {
Ref<InputEventKey> key;
key.instance();
@ -954,7 +954,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
} else if (id == "MBUTTON") {
} else if (id2 == "MBUTTON") {
Ref<InputEventMouseButton> mb;
mb.instance();
@ -980,7 +980,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
} else if (id == "JBUTTON") {
} else if (id2 == "JBUTTON") {
Ref<InputEventJoypadButton> jb;
jb.instance();
@ -1006,7 +1006,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
} else if (id == "JAXIS") {
} else if (id2 == "JAXIS") {
Ref<InputEventJoypadMotion> jm;
jm.instance();

View File

@ -851,11 +851,11 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
int indices[num_points * 3];
for (int i = 0; i < num_points; i++) {
points[i] = circle->pos + Vector2(Math::sin(i * Math_PI * 2.0 / num_points), Math::cos(i * Math_PI * 2.0 / num_points)) * circle->radius;
indices[i * 3 + 0] = i;
indices[i * 3 + 1] = (i + 1) % num_points;
indices[i * 3 + 2] = num_points;
for (int j = 0; j < num_points; j++) {
points[j] = circle->pos + Vector2(Math::sin(j * Math_PI * 2.0 / num_points), Math::cos(j * Math_PI * 2.0 / num_points)) * circle->radius;
indices[j * 3 + 0] = j;
indices[j * 3 + 1] = (j + 1) % num_points;
indices[j * 3 + 2] = num_points;
}
_bind_canvas_texture(RID(), RID());
@ -913,13 +913,13 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
}
for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
if (s->attribs[i].enabled) {
glEnableVertexAttribArray(i);
glVertexAttribPointer(s->attribs[i].index, s->attribs[i].size, s->attribs[i].type, s->attribs[i].normalized, s->attribs[i].stride, (uint8_t *)0 + s->attribs[i].offset);
for (int k = 0; k < VS::ARRAY_MAX - 1; k++) {
if (s->attribs[k].enabled) {
glEnableVertexAttribArray(k);
glVertexAttribPointer(s->attribs[k].index, s->attribs[k].size, s->attribs[k].type, s->attribs[k].normalized, s->attribs[k].stride, (uint8_t *)0 + s->attribs[k].offset);
} else {
glDisableVertexAttribArray(i);
switch (i) {
glDisableVertexAttribArray(k);
switch (k) {
case VS::ARRAY_NORMAL: {
glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
} break;
@ -939,8 +939,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
}
}
for (int i = 1; i < VS::ARRAY_MAX - 1; i++) {
glDisableVertexAttribArray(i);
for (int j = 1; j < VS::ARRAY_MAX - 1; j++) {
glDisableVertexAttribArray(j);
}
}
@ -1002,13 +1002,13 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
}
for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
if (s->attribs[i].enabled) {
glEnableVertexAttribArray(i);
glVertexAttribPointer(s->attribs[i].index, s->attribs[i].size, s->attribs[i].type, s->attribs[i].normalized, s->attribs[i].stride, (uint8_t *)0 + s->attribs[i].offset);
for (int k = 0; k < VS::ARRAY_MAX - 1; k++) {
if (s->attribs[k].enabled) {
glEnableVertexAttribArray(k);
glVertexAttribPointer(s->attribs[k].index, s->attribs[k].size, s->attribs[k].type, s->attribs[k].normalized, s->attribs[k].stride, (uint8_t *)0 + s->attribs[k].offset);
} else {
glDisableVertexAttribArray(i);
switch (i) {
glDisableVertexAttribArray(k);
switch (k) {
case VS::ARRAY_NORMAL: {
glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
} break;
@ -1021,8 +1021,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
}
}
for (int i = 0; i < amount; i++) {
const float *buffer = base_buffer + i * stride;
for (int k = 0; k < amount; k++) {
const float *buffer = base_buffer + k * stride;
{

View File

@ -1120,10 +1120,10 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
int num_surfaces = mesh->surfaces.size();
for (int i = 0; i < num_surfaces; i++) {
int material_index = instance->materials[i].is_valid() ? i : -1;
for (int j = 0; j < num_surfaces; j++) {
int material_index = instance->materials[j].is_valid() ? j : -1;
RasterizerStorageGLES2::Surface *surface = mesh->surfaces[i];
RasterizerStorageGLES2::Surface *surface = mesh->surfaces[j];
_add_geometry(surface, instance, NULL, material_index, p_depth_pass, p_shadow_pass);
}
@ -1143,8 +1143,8 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
int ssize = mesh->surfaces.size();
for (int i = 0; i < ssize; i++) {
RasterizerStorageGLES2::Surface *s = mesh->surfaces[i];
for (int j = 0; j < ssize; j++) {
RasterizerStorageGLES2::Surface *s = mesh->surfaces[j];
_add_geometry(s, instance, multi_mesh, -1, p_depth_pass, p_shadow_pass);
}
} break;

View File

@ -4283,7 +4283,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
_render_target_clear(rt);
ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);

View File

@ -581,10 +581,10 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
#ifdef GLES_OVER_GL
if (line->antialiased) {
glEnable(GL_LINE_SMOOTH);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
Vector2 vertsl[2] = {
verts[i],
verts[(i + 1) % 4],
verts[j],
verts[(j + 1) % 4],
};
_draw_gui_primitive(2, vertsl, NULL, NULL);
}
@ -782,8 +782,8 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
}
if (primitive->colors.size() == 1 && primitive->points.size() > 1) {
Color c = primitive->colors[0];
glVertexAttrib4f(VS::ARRAY_COLOR, c.r, c.g, c.b, c.a);
Color col = primitive->colors[0];
glVertexAttrib4f(VS::ARRAY_COLOR, col.r, col.g, col.b, col.a);
} else if (primitive->colors.empty()) {
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
@ -1035,8 +1035,6 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, 4, amount);
} else {
//split
int stride = sizeof(float) * 4 * 6;
int split = int(Math::ceil(particles->phase * particles->amount));
if (amount - split > 0) {
@ -1099,12 +1097,12 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
points[numpoints] = circle->pos;
int indices[numpoints * 3];
for (int i = 0; i < numpoints; i++) {
for (int j = 0; j < numpoints; j++) {
points[i] = circle->pos + Vector2(Math::sin(i * Math_PI * 2.0 / numpoints), Math::cos(i * Math_PI * 2.0 / numpoints)) * circle->radius;
indices[i * 3 + 0] = i;
indices[i * 3 + 1] = (i + 1) % numpoints;
indices[i * 3 + 2] = numpoints;
points[j] = circle->pos + Vector2(Math::sin(j * Math_PI * 2.0 / numpoints), Math::cos(j * Math_PI * 2.0 / numpoints)) * circle->radius;
indices[j * 3 + 0] = j;
indices[j * 3 + 1] = (j + 1) % numpoints;
indices[j * 3 + 2] = numpoints;
}
_bind_canvas_texture(RID(), RID());

View File

@ -3178,10 +3178,10 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
int ssize = mesh->surfaces.size();
for (int i = 0; i < ssize; i++) {
for (int j = 0; j < ssize; j++) {
int mat_idx = inst->materials[i].is_valid() ? i : -1;
RasterizerStorageGLES3::Surface *s = mesh->surfaces[i];
int mat_idx = inst->materials[j].is_valid() ? j : -1;
RasterizerStorageGLES3::Surface *s = mesh->surfaces[j];
_add_geometry(s, inst, NULL, mat_idx, p_depth_pass, p_shadow_pass);
}
@ -3202,9 +3202,9 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
int ssize = mesh->surfaces.size();
for (int i = 0; i < ssize; i++) {
for (int j = 0; j < ssize; j++) {
RasterizerStorageGLES3::Surface *s = mesh->surfaces[i];
RasterizerStorageGLES3::Surface *s = mesh->surfaces[j];
_add_geometry(s, inst, multi_mesh, -1, p_depth_pass, p_shadow_pass);
}
@ -3222,9 +3222,9 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
RasterizerStorageGLES3::Particles *particles = storage->particles_owner.getptr(inst->base);
ERR_CONTINUE(!particles);
for (int i = 0; i < particles->draw_passes.size(); i++) {
for (int j = 0; j < particles->draw_passes.size(); j++) {
RID pmesh = particles->draw_passes[i];
RID pmesh = particles->draw_passes[j];
if (!pmesh.is_valid())
continue;
RasterizerStorageGLES3::Mesh *mesh = storage->mesh_owner.get(pmesh);
@ -3233,9 +3233,9 @@ void RasterizerSceneGLES3::_fill_render_list(InstanceBase **p_cull_result, int p
int ssize = mesh->surfaces.size();
for (int j = 0; j < ssize; j++) {
for (int k = 0; k < ssize; k++) {
RasterizerStorageGLES3::Surface *s = mesh->surfaces[j];
RasterizerStorageGLES3::Surface *s = mesh->surfaces[k];
_add_geometry(s, inst, particles, -1, p_depth_pass, p_shadow_pass);
}
}
@ -5059,7 +5059,7 @@ void RasterizerSceneGLES3::initialize() {
{ //reflection cubemaps
int max_reflection_cubemap_sampler_size = 512;
int cube_size = max_reflection_cubemap_sampler_size;
int rcube_size = max_reflection_cubemap_sampler_size;
glActiveTexture(GL_TEXTURE0);
@ -5069,10 +5069,10 @@ void RasterizerSceneGLES3::initialize() {
GLenum format = GL_RGBA;
GLenum type = use_float ? GL_HALF_FLOAT : GL_UNSIGNED_INT_2_10_10_10_REV;
while (cube_size >= 32) {
while (rcube_size >= 32) {
ReflectionCubeMap cube;
cube.size = cube_size;
cube.size = rcube_size;
glGenTextures(1, &cube.depth);
glBindTexture(GL_TEXTURE_2D, cube.depth);
@ -5111,7 +5111,7 @@ void RasterizerSceneGLES3::initialize() {
reflection_cubemaps.push_back(cube);
cube_size >>= 1;
rcube_size >>= 1;
}
}

View File

@ -6049,9 +6049,9 @@ void RasterizerStorageGLES3::particles_set_amount(RID p_particles, int p_amount)
glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[i]);
glBufferData(GL_ARRAY_BUFFER, floats * sizeof(float), data, GL_STATIC_DRAW);
for (int i = 0; i < 6; i++) {
glEnableVertexAttribArray(i);
glVertexAttribPointer(i, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4 * 6, ((uint8_t *)0) + (i * 16));
for (int j = 0; j < 6; j++) {
glEnableVertexAttribArray(j);
glVertexAttribPointer(j, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4 * 6, ((uint8_t *)0) + (j * 16));
}
}

View File

@ -420,7 +420,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
pa_operation *pa_op = pa_context_get_server_info(ad->pa_ctx, &AudioDriverPulseAudio::pa_server_info_cb, (void *)ad);
if (pa_op) {
while (ad->pa_status == 0) {
int ret = pa_mainloop_iterate(ad->pa_ml, 1, NULL);
ret = pa_mainloop_iterate(ad->pa_ml, 1, NULL);
if (ret < 0) {
ERR_PRINT("pa_mainloop_iterate error");
}

View File

@ -132,7 +132,7 @@ public:
if (existing != -1) {
Variant v = animation->track_get_key_value(track, existing);
float trans = animation->track_get_key_transition(track, existing);
trans = animation->track_get_key_transition(track, existing);
undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track, new_time, v, trans);
}
@ -384,12 +384,12 @@ public:
if (name == "animation") {
StringName name = p_value;
StringName anim_name = p_value;
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
StringName prev = animation->animation_track_get_key_animation(track, key);
undo_redo->add_do_method(animation.ptr(), "animation_track_set_key_animation", track, key, name);
undo_redo->add_do_method(animation.ptr(), "animation_track_set_key_animation", track, key, anim_name);
undo_redo->add_undo_method(animation.ptr(), "animation_track_set_key_animation", track, key, prev);
undo_redo->add_do_method(this, "_update_obj", animation);
undo_redo->add_undo_method(this, "_update_obj", animation);
@ -2833,9 +2833,9 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p
if (animation->track_get_path(i) == np) {
value = p_value; //all good
} else {
String path = animation->track_get_path(i);
if (NodePath(path.get_basename()) == np) {
String subindex = path.get_extension();
String tpath = animation->track_get_path(i);
if (NodePath(tpath.get_basename()) == np) {
String subindex = tpath.get_extension();
value = p_value.get(subindex);
} else {
continue;
@ -2928,9 +2928,9 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari
if (animation->track_get_path(i) == np) {
value = p_value; //all good
} else {
String path = animation->track_get_path(i);
if (NodePath(path.get_basename()) == np) {
String subindex = path.get_extension();
String tpath = animation->track_get_path(i);
if (NodePath(tpath.get_basename()) == np) {
String subindex = tpath.get_extension();
value = p_value.get(subindex);
} else {
continue;
@ -4329,9 +4329,9 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
text = node->get_name();
Vector<StringName> sn = path.get_subnames();
for (int i = 0; i < sn.size(); i++) {
for (int j = 0; j < sn.size(); j++) {
text += ".";
text += sn[i];
text += sn[j];
}
path = NodePath(node->get_path().get_names(), path.get_subnames(), true); //store full path instead for copying

View File

@ -29,6 +29,7 @@
/*************************************************************************/
#include "animation_track_editor_plugins.h"
#include "editor/audio_stream_preview.h"
#include "editor_resource_preview.h"
#include "editor_scale.h"
@ -37,6 +38,7 @@
#include "scene/3d/sprite_3d.h"
#include "scene/animation/animation_player.h"
#include "servers/audio/audio_stream.h"
/// BOOL ///
int AnimationTrackEditBool::get_key_height() const {
@ -247,9 +249,6 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x,
return;
}
Ref<Font> font = get_font("font", "Label");
float fh = int(font->get_height() * 1.5);
bool play = get_animation()->track_get_key_value(get_track(), p_index);
if (play) {
float len = stream->get_length();
@ -285,8 +284,9 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x,
if (to_x <= from_x)
return;
int h = get_size().height;
Rect2 rect = Rect2(from_x, (h - fh) / 2, to_x - from_x, fh);
Ref<Font> font = get_font("font", "Label");
float fh = int(font->get_height() * 1.5);
Rect2 rect = Rect2(from_x, (get_size().height - fh) / 2, to_x - from_x, fh);
draw_rect(rect, Color(0.25, 0.25, 0.25));
Vector<Vector2> lines;
@ -439,13 +439,13 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in
return;
}
int frame = get_animation()->track_get_key_value(get_track(), p_index);
Ref<Texture> texture;
Rect2 region;
if (Object::cast_to<Sprite>(object) || Object::cast_to<Sprite3D>(object)) {
int frame = get_animation()->track_get_key_value(get_track(), p_index);
texture = object->call("get_texture");
if (!texture.is_valid()) {
AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);

View File

@ -2071,17 +2071,17 @@ void Collada::_parse_library(XMLParser &parser) {
} else if (name == "geometry") {
String id = parser.get_attribute_value("id");
String name = parser.get_attribute_value_safe("name");
String name2 = parser.get_attribute_value_safe("name");
while (parser.read() == OK) {
if (parser.get_node_type() == XMLParser::NODE_ELEMENT) {
if (parser.get_node_name() == "mesh") {
state.mesh_name_map[id] = (name != "") ? name : id;
_parse_mesh_geometry(parser, id, name);
state.mesh_name_map[id] = (name2 != "") ? name2 : id;
_parse_mesh_geometry(parser, id, name2);
} else if (parser.get_node_name() == "spline") {
state.mesh_name_map[id] = (name != "") ? name : id;
_parse_curve_geometry(parser, id, name);
state.mesh_name_map[id] = (name2 != "") ? name2 : id;
_parse_curve_geometry(parser, id, name2);
} else if (!parser.is_empty())
parser.skip_section();
} else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END && parser.get_node_name() == "geometry")

View File

@ -766,7 +766,7 @@ void ConnectionsDock::update_tree() {
while (base) {
List<MethodInfo> node_signals;
List<MethodInfo> node_signals2;
Ref<Texture> icon;
String name;
@ -774,7 +774,7 @@ void ConnectionsDock::update_tree() {
Ref<Script> scr = selectedNode->get_script();
if (scr.is_valid()) {
scr->get_script_signal_list(&node_signals);
scr->get_script_signal_list(&node_signals2);
if (scr->get_path().is_resource_file())
name = scr->get_path().get_file();
else
@ -787,7 +787,7 @@ void ConnectionsDock::update_tree() {
} else {
ClassDB::get_signal_list(base, &node_signals, true);
ClassDB::get_signal_list(base, &node_signals2, true);
if (has_icon(base, "EditorIcons")) {
icon = get_icon(base, "EditorIcons");
}
@ -796,17 +796,17 @@ void ConnectionsDock::update_tree() {
TreeItem *pitem = NULL;
if (node_signals.size()) {
if (node_signals2.size()) {
pitem = tree->create_item(root);
pitem->set_text(0, name);
pitem->set_icon(0, icon);
pitem->set_selectable(0, false);
pitem->set_editable(0, false);
pitem->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
node_signals.sort();
node_signals2.sort();
}
for (List<MethodInfo>::Element *E = node_signals.front(); E; E = E->next()) {
for (List<MethodInfo>::Element *E = node_signals2.front(); E; E = E->next()) {
MethodInfo &mi = E->get();

View File

@ -299,15 +299,15 @@ void CreateDialog::_update_search() {
} else {
bool found = false;
String type = I->get();
while (type != "" && (cpp_type ? ClassDB::is_parent_class(type, base_type) : ed.script_class_is_parent(type, base_type)) && type != base_type) {
if (search_box->get_text().is_subsequence_ofi(type)) {
String type2 = I->get();
while (type2 != "" && (cpp_type ? ClassDB::is_parent_class(type2, base_type) : ed.script_class_is_parent(type2, base_type)) && type2 != base_type) {
if (search_box->get_text().is_subsequence_ofi(type2)) {
found = true;
break;
}
type = cpp_type ? ClassDB::get_parent_class(type) : ed.script_class_get_base(type);
type2 = cpp_type ? ClassDB::get_parent_class(type2) : ed.script_class_get_base(type2);
}
if (found)

View File

@ -497,9 +497,9 @@ void DocData::generate(bool p_basic_types) {
method.name = mi.name;
for (int i = 0; i < mi.arguments.size(); i++) {
for (int j = 0; j < mi.arguments.size(); j++) {
PropertyInfo arginfo = mi.arguments[i];
PropertyInfo arginfo = mi.arguments[j];
ArgumentDoc ad;
ad.name = arginfo.name;
@ -509,7 +509,7 @@ void DocData::generate(bool p_basic_types) {
else
ad.type = Variant::get_type_name(arginfo.type);
int defarg = mi.default_arguments.size() - mi.arguments.size() + i;
int defarg = mi.default_arguments.size() - mi.arguments.size() + j;
if (defarg >= 0)
ad.default_value = mi.default_arguments[defarg];
@ -620,12 +620,12 @@ void DocData::generate(bool p_basic_types) {
return_doc_from_retinfo(md, mi.return_val);
for (int i = 0; i < mi.arguments.size(); i++) {
for (int j = 0; j < mi.arguments.size(); j++) {
ArgumentDoc ad;
argument_doc_from_arginfo(ad, mi.arguments[i]);
argument_doc_from_arginfo(ad, mi.arguments[j]);
int darg_idx = i - (mi.arguments.size() - mi.default_arguments.size());
int darg_idx = j - (mi.arguments.size() - mi.default_arguments.size());
if (darg_idx >= 0) {
Variant default_arg = E->get().default_arguments[darg_idx];
@ -734,9 +734,9 @@ Error DocData::load_classes(const String &p_dir) {
while (path != String()) {
if (!isdir && path.ends_with("xml")) {
Ref<XMLParser> parser = memnew(XMLParser);
Error err = parser->open(p_dir.plus_file(path));
if (err)
return err;
Error err2 = parser->open(p_dir.plus_file(path));
if (err2)
return err2;
_load(parser);
}
@ -806,78 +806,78 @@ Error DocData::_load(Ref<XMLParser> parser) {
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
String name = parser->get_node_name();
String name2 = parser->get_node_name();
if (name == "brief_description") {
if (name2 == "brief_description") {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
c.brief_description = parser->get_node_data();
} else if (name == "description") {
} else if (name2 == "description") {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
c.description = parser->get_node_data();
} else if (name == "tutorials") {
} else if (name2 == "tutorials") {
while (parser->read() == OK) {
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
String name = parser->get_node_name();
String name3 = parser->get_node_name();
if (name == "link") {
if (name3 == "link") {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
c.tutorials.push_back(parser->get_node_data().strip_edges());
} else {
ERR_EXPLAIN("Invalid tag in doc file: " + name);
ERR_EXPLAIN("Invalid tag in doc file: " + name3);
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "tutorials")
break; //end of <tutorials>
}
} else if (name == "demos") {
} else if (name2 == "demos") {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
c.demos = parser->get_node_data();
} else if (name == "methods") {
} else if (name2 == "methods") {
Error err = _parse_methods(parser, c.methods);
ERR_FAIL_COND_V(err, err);
Error err2 = _parse_methods(parser, c.methods);
ERR_FAIL_COND_V(err2, err2);
} else if (name == "signals") {
} else if (name2 == "signals") {
Error err = _parse_methods(parser, c.signals);
ERR_FAIL_COND_V(err, err);
} else if (name == "members") {
Error err2 = _parse_methods(parser, c.signals);
ERR_FAIL_COND_V(err2, err2);
} else if (name2 == "members") {
while (parser->read() == OK) {
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
String name = parser->get_node_name();
String name3 = parser->get_node_name();
if (name == "member") {
if (name3 == "member") {
PropertyDoc prop;
PropertyDoc prop2;
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
prop.name = parser->get_attribute_value("name");
prop2.name = parser->get_attribute_value("name");
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
prop.type = parser->get_attribute_value("type");
prop2.type = parser->get_attribute_value("type");
if (parser->has_attribute("setter"))
prop.setter = parser->get_attribute_value("setter");
prop2.setter = parser->get_attribute_value("setter");
if (parser->has_attribute("getter"))
prop.getter = parser->get_attribute_value("getter");
prop2.getter = parser->get_attribute_value("getter");
if (parser->has_attribute("enum"))
prop.enumeration = parser->get_attribute_value("enum");
prop2.enumeration = parser->get_attribute_value("enum");
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
prop.description = parser->get_node_data();
c.properties.push_back(prop);
prop2.description = parser->get_node_data();
c.properties.push_back(prop2);
} else {
ERR_EXPLAIN("Invalid tag in doc file: " + name);
ERR_EXPLAIN("Invalid tag in doc file: " + name3);
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
@ -885,28 +885,28 @@ Error DocData::_load(Ref<XMLParser> parser) {
break; //end of <constants>
}
} else if (name == "theme_items") {
} else if (name2 == "theme_items") {
while (parser->read() == OK) {
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
String name = parser->get_node_name();
String name3 = parser->get_node_name();
if (name == "theme_item") {
if (name3 == "theme_item") {
PropertyDoc prop;
PropertyDoc prop2;
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
prop.name = parser->get_attribute_value("name");
prop2.name = parser->get_attribute_value("name");
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
prop.type = parser->get_attribute_value("type");
prop2.type = parser->get_attribute_value("type");
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
prop.description = parser->get_node_data();
c.theme_properties.push_back(prop);
prop2.description = parser->get_node_data();
c.theme_properties.push_back(prop2);
} else {
ERR_EXPLAIN("Invalid tag in doc file: " + name);
ERR_EXPLAIN("Invalid tag in doc file: " + name3);
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
@ -914,30 +914,30 @@ Error DocData::_load(Ref<XMLParser> parser) {
break; //end of <constants>
}
} else if (name == "constants") {
} else if (name2 == "constants") {
while (parser->read() == OK) {
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
String name = parser->get_node_name();
String name3 = parser->get_node_name();
if (name == "constant") {
if (name3 == "constant") {
ConstantDoc constant;
ConstantDoc constant2;
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
constant.name = parser->get_attribute_value("name");
constant2.name = parser->get_attribute_value("name");
ERR_FAIL_COND_V(!parser->has_attribute("value"), ERR_FILE_CORRUPT);
constant.value = parser->get_attribute_value("value");
constant2.value = parser->get_attribute_value("value");
if (parser->has_attribute("enum")) {
constant.enumeration = parser->get_attribute_value("enum");
constant2.enumeration = parser->get_attribute_value("enum");
}
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
constant.description = parser->get_node_data();
c.constants.push_back(constant);
constant2.description = parser->get_node_data();
c.constants.push_back(constant2);
} else {
ERR_EXPLAIN("Invalid tag in doc file: " + name);
ERR_EXPLAIN("Invalid tag in doc file: " + name3);
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
@ -947,7 +947,7 @@ Error DocData::_load(Ref<XMLParser> parser) {
} else {
ERR_EXPLAIN("Invalid tag in doc file: " + name);
ERR_EXPLAIN("Invalid tag in doc file: " + name2);
ERR_FAIL_V(ERR_FILE_CORRUPT);
}

View File

@ -385,9 +385,9 @@ void EditorAudioBus::_effect_selected() {
if (effect->get_metadata(0) != Variant()) {
int index = effect->get_metadata(0);
Ref<AudioEffect> effect = AudioServer::get_singleton()->get_bus_effect(get_index(), index);
if (effect.is_valid()) {
EditorNode::get_singleton()->push_item(effect.ptr());
Ref<AudioEffect> effect2 = AudioServer::get_singleton()->get_bus_effect(get_index(), index);
if (effect2.is_valid()) {
EditorNode::get_singleton()->push_item(effect2.ptr());
}
}

View File

@ -598,8 +598,8 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &
int i = 0;
for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
orders.write[i++] = E->get().order;
for (List<AutoLoadInfo>::Element *F = autoload_cache.front(); F; F = F->next()) {
orders.write[i++] = F->get().order;
}
orders.sort();
@ -610,9 +610,9 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &
i = 0;
for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + E->get().name, orders[i++]);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + E->get().name, E->get().order);
for (List<AutoLoadInfo>::Element *F = autoload_cache.front(); F; F = F->next()) {
undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + F->get().name, orders[i++]);
undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", "autoload/" + F->get().name, F->get().order);
}
orders.clear();

View File

@ -260,12 +260,12 @@ void EditorFileSystem::_scan_filesystem() {
if (FileAccess::exists(update_cache)) {
{
FileAccessRef f = FileAccess::open(update_cache, FileAccess::READ);
String l = f->get_line().strip_edges();
FileAccessRef f2 = FileAccess::open(update_cache, FileAccess::READ);
String l = f2->get_line().strip_edges();
while (l != String()) {
file_cache.erase(l); //erase cache for this, so it gets updated
l = f->get_line().strip_edges();
l = f2->get_line().strip_edges();
}
}
@ -686,17 +686,17 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess
_scan_new_dir(efd, da, p_progress.get_sub(idx, total));
int idx = 0;
int idx2 = 0;
for (int i = 0; i < p_dir->subdirs.size(); i++) {
if (efd->name < p_dir->subdirs[i]->name)
break;
idx++;
idx2++;
}
if (idx == p_dir->subdirs.size()) {
if (idx2 == p_dir->subdirs.size()) {
p_dir->subdirs.push_back(efd);
} else {
p_dir->subdirs.insert(idx, efd);
p_dir->subdirs.insert(idx2, efd);
}
da->change_dir("..");

View File

@ -171,9 +171,9 @@ void EditorFolding::load_scene_folding(Node *p_scene, const String &p_path) {
ERR_FAIL_COND(res_unfolds.size() & 1);
for (int i = 0; i < unfolds.size(); i += 2) {
NodePath path = unfolds[i];
NodePath path2 = unfolds[i];
PoolVector<String> un = unfolds[i + 1];
Node *node = p_scene->get_node_or_null(path);
Node *node = p_scene->get_node_or_null(path2);
if (!node) {
continue;
}
@ -181,17 +181,17 @@ void EditorFolding::load_scene_folding(Node *p_scene, const String &p_path) {
}
for (int i = 0; i < res_unfolds.size(); i += 2) {
String path = res_unfolds[i];
String path2 = res_unfolds[i];
RES res;
if (ResourceCache::has(path)) {
res = RES(ResourceCache::get(path));
if (ResourceCache::has(path2)) {
res = RES(ResourceCache::get(path2));
}
if (res.is_null()) {
continue;
}
PoolVector<String> unfolds = res_unfolds[i + 1];
_set_unfolds(res.ptr(), unfolds);
PoolVector<String> unfolds2 = res_unfolds[i + 1];
_set_unfolds(res.ptr(), unfolds2);
}
}

View File

@ -215,14 +215,14 @@ void EditorProperty::_notification(int p_what) {
else
checkbox = get_icon("unchecked", "CheckBox");
Color color(1, 1, 1);
Color color2(1, 1, 1);
if (check_hover) {
color.r *= 1.2;
color.g *= 1.2;
color.b *= 1.2;
color2.r *= 1.2;
color2.g *= 1.2;
color2.b *= 1.2;
}
check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height());
draw_texture(checkbox, check_rect.position, color);
draw_texture(checkbox, check_rect.position, color2);
ofs += get_constant("hseparator", "Tree");
ofs += checkbox->get_width();
} else {
@ -236,14 +236,14 @@ void EditorProperty::_notification(int p_what) {
text_limit -= reload_icon->get_width() + get_constant("hseparator", "Tree") * 2;
revert_rect = Rect2(text_limit + get_constant("hseparator", "Tree"), (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height());
Color color(1, 1, 1);
Color color2(1, 1, 1);
if (revert_hover) {
color.r *= 1.2;
color.g *= 1.2;
color.b *= 1.2;
color2.r *= 1.2;
color2.g *= 1.2;
color2.b *= 1.2;
}
draw_texture(reload_icon, revert_rect.position, color);
draw_texture(reload_icon, revert_rect.position, color2);
} else {
revert_rect = Rect2();
}
@ -262,14 +262,14 @@ void EditorProperty::_notification(int p_what) {
ofs = size.width - key->get_width() - get_constant("hseparator", "Tree");
Color color(1, 1, 1);
Color color2(1, 1, 1);
if (keying_hover) {
color.r *= 1.2;
color.g *= 1.2;
color.b *= 1.2;
color2.r *= 1.2;
color2.g *= 1.2;
color2.b *= 1.2;
}
keying_rect = Rect2(ofs, ((size.height - key->get_height()) / 2), key->get_width(), key->get_height());
draw_texture(key, keying_rect.position, color);
draw_texture(key, keying_rect.position, color2);
} else {
keying_rect = Rect2();
}
@ -1482,19 +1482,19 @@ void EditorInspector::update_tree() {
category->bg_color = get_color("prop_category", "Editor");
if (use_doc_hints) {
StringName type = p.name;
if (!class_descr_cache.has(type)) {
StringName type2 = p.name;
if (!class_descr_cache.has(type2)) {
String descr;
DocData *dd = EditorHelp::get_doc_data();
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(type);
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(type2);
if (E) {
descr = E->get().brief_description;
}
class_descr_cache[type] = descr.word_wrap(80);
class_descr_cache[type2] = descr.word_wrap(80);
}
category->set_tooltip(p.name + "::" + (class_descr_cache[type] == "" ? "" : class_descr_cache[type]));
category->set_tooltip(p.name + "::" + (class_descr_cache[type2] == "" ? "" : class_descr_cache[type2]));
}
for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
@ -1639,16 +1639,16 @@ void EditorInspector::update_tree() {
if (!found) {
DocData *dd = EditorHelp::get_doc_data();
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(classname);
while (E && descr == String()) {
for (int i = 0; i < E->get().properties.size(); i++) {
if (E->get().properties[i].name == propname.operator String()) {
descr = E->get().properties[i].description.strip_edges().word_wrap(80);
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(classname);
while (F && descr == String()) {
for (int i = 0; i < F->get().properties.size(); i++) {
if (F->get().properties[i].name == propname.operator String()) {
descr = F->get().properties[i].description.strip_edges().word_wrap(80);
break;
}
}
if (!E->get().inherits.empty()) {
E = dd->class_list.find(E->get().inherits);
if (!F->get().inherits.empty()) {
F = dd->class_list.find(F->get().inherits);
} else {
break;
}

View File

@ -880,9 +880,9 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool>
Dictionary d = obj->get(E->get().name);
List<Variant> keys;
d.get_key_list(&keys);
for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
for (List<Variant>::Element *F = keys.front(); F; F = F->next()) {
Variant v = d[E->get()];
Variant v = d[F->get()];
RES res = v;
if (_find_and_save_resource(res, processed, flags))
ret_changed = true;
@ -4900,9 +4900,9 @@ EditorNode::EditorNode() {
import_collada.instance();
import_scene->add_importer(import_collada);
Ref<EditorOBJImporter> import_obj;
import_obj.instance();
import_scene->add_importer(import_obj);
Ref<EditorOBJImporter> import_obj2;
import_obj2.instance();
import_scene->add_importer(import_obj2);
Ref<EditorSceneImporterGLTF> import_gltf;
import_gltf.instance();

View File

@ -92,9 +92,9 @@ void EditorPluginSettings::update_plugins() {
cf.instance();
String path = "res://addons/" + plugins[i] + "/plugin.cfg";
Error err = cf->load(path);
Error err2 = cf->load(path);
if (err != OK) {
if (err2 != OK) {
WARN_PRINTS("Can't load plugin config: " + path);
} else if (!cf->has_section_key("plugin", "name")) {
WARN_PRINTS("Plugin misses plugin/name: " + path);
@ -108,7 +108,7 @@ void EditorPluginSettings::update_plugins() {
WARN_PRINTS("Plugin misses plugin/script: " + path);
} else {
String d = plugins[i];
String d2 = plugins[i];
String name = cf->get_value("plugin", "name");
String author = cf->get_value("plugin", "author");
String version = cf->get_value("plugin", "version");
@ -118,7 +118,7 @@ void EditorPluginSettings::update_plugins() {
TreeItem *item = plugin_list->create_item(root);
item->set_text(0, name);
item->set_tooltip(0, "Name: " + name + "\nPath: " + path + "\nMain Script: " + script + "\nDescription: " + description);
item->set_metadata(0, d);
item->set_metadata(0, d2);
item->set_text(1, version);
item->set_metadata(1, script);
item->set_text(2, author);
@ -129,7 +129,7 @@ void EditorPluginSettings::update_plugins() {
item->set_editable(3, true);
item->add_button(4, get_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin"));
if (EditorNode::get_singleton()->is_addon_plugin_enabled(d)) {
if (EditorNode::get_singleton()->is_addon_plugin_enabled(d2)) {
item->set_custom_color(3, get_color("success_color", "Editor"));
item->set_range(3, 1);
} else {

View File

@ -665,10 +665,10 @@ public:
uint32_t idx = i * 10 + j;
bool on = value & (1 << idx);
Rect2 rect = Rect2(o, Size2(bsize, bsize));
Rect2 rect2 = Rect2(o, Size2(bsize, bsize));
color.a = on ? 0.6 : 0.2;
draw_rect(rect, color);
flag_rects.push_back(rect);
draw_rect(rect2, color);
flag_rects.push_back(rect2);
}
}
}
@ -2277,8 +2277,8 @@ void EditorPropertyResource::_update_menu_items() {
List<StringName> inheritors;
ClassDB::get_inheriters_from_class(base.strip_edges(), &inheritors);
for (int i = 0; i < custom_resources.size(); i++) {
inheritors.push_back(custom_resources[i].name);
for (int j = 0; j < custom_resources.size(); j++) {
inheritors.push_back(custom_resources[j].name);
}
List<StringName>::Element *E = inheritors.front();
@ -2287,17 +2287,17 @@ void EditorPropertyResource::_update_menu_items() {
E = E->next();
}
for (Set<String>::Element *E = valid_inheritors.front(); E; E = E->next()) {
String t = E->get();
for (Set<String>::Element *F = valid_inheritors.front(); F; F = F->next()) {
String t = F->get();
bool is_custom_resource = false;
Ref<Texture> icon;
if (!custom_resources.empty()) {
for (int i = 0; i < custom_resources.size(); i++) {
if (custom_resources[i].name == t) {
for (int j = 0; j < custom_resources.size(); j++) {
if (custom_resources[j].name == t) {
is_custom_resource = true;
if (custom_resources[i].icon.is_valid())
icon = custom_resources[i].icon;
if (custom_resources[j].icon.is_valid())
icon = custom_resources[j].icon;
break;
}
}

View File

@ -213,14 +213,14 @@ void EditorSpinSlider::_notification(int p_what) {
draw_string(font, Vector2(sb->get_offset().x + string_width + sep, vofs), numstr, fc, number_width);
if (get_step() == 1) {
Ref<Texture> updown = get_icon("updown", "SpinBox");
int updown_vofs = (get_size().height - updown->get_height()) / 2;
updown_offset = get_size().width - sb->get_margin(MARGIN_RIGHT) - updown->get_width();
Ref<Texture> updown2 = get_icon("updown", "SpinBox");
int updown_vofs = (get_size().height - updown2->get_height()) / 2;
updown_offset = get_size().width - sb->get_margin(MARGIN_RIGHT) - updown2->get_width();
Color c(1, 1, 1);
if (hover_updown) {
c *= Color(1.2, 1.2, 1.2);
}
draw_texture(updown, Vector2(updown_offset, updown_vofs), c);
draw_texture(updown2, Vector2(updown_offset, updown_vofs), c);
if (grabber->is_visible()) {
grabber->hide();
}

View File

@ -187,8 +187,8 @@ void EditorSubScene::move(Node *p_new_parent, Node *p_new_owner) {
}
p_new_parent->add_child(selnode);
for (List<Node *>::Element *E = to_reown.front(); E; E = E->next()) {
E->get()->set_owner(p_new_owner);
for (List<Node *>::Element *F = to_reown.front(); F; F = F->next()) {
F->get()->set_owner(p_new_owner);
}
}
if (!is_root) {

View File

@ -80,9 +80,9 @@ void EditorFileServer::_subthread_start(void *s) {
ERR_FAIL_COND(err != OK);
}
passutf8.write[passlen] = 0;
String s;
s.parse_utf8(passutf8.ptr());
if (s != cd->efs->password) {
String s2;
s2.parse_utf8(passutf8.ptr());
if (s2 != cd->efs->password) {
encode_uint32(ERR_INVALID_DATA, buf4);
cd->connection->put_data(buf4, 4);
OS::get_singleton()->delay_usec(1000000);
@ -146,23 +146,23 @@ void EditorFileServer::_subthread_start(void *s) {
ERR_FAIL_COND(err != OK);
}
fileutf8.write[namelen] = 0;
String s;
s.parse_utf8(fileutf8.ptr());
String s2;
s2.parse_utf8(fileutf8.ptr());
if (cmd == FileAccessNetwork::COMMAND_FILE_EXISTS) {
print_verbose("FILE EXISTS: " + s);
print_verbose("FILE EXISTS: " + s2);
}
if (cmd == FileAccessNetwork::COMMAND_GET_MODTIME) {
print_verbose("MOD TIME: " + s);
print_verbose("MOD TIME: " + s2);
}
if (cmd == FileAccessNetwork::COMMAND_OPEN_FILE) {
print_verbose("OPEN: " + s);
print_verbose("OPEN: " + s2);
}
if (!s.begins_with("res://")) {
if (!s2.begins_with("res://")) {
_close_client(cd);
ERR_FAIL_COND(!s.begins_with("res://"));
ERR_FAIL_COND(!s2.begins_with("res://"));
}
ERR_CONTINUE(cd->files.has(id));
@ -172,7 +172,7 @@ void EditorFileServer::_subthread_start(void *s) {
cd->connection->put_data(buf4, 4);
encode_uint32(FileAccessNetwork::RESPONSE_FILE_EXISTS, buf4);
cd->connection->put_data(buf4, 4);
encode_uint32(FileAccess::exists(s), buf4);
encode_uint32(FileAccess::exists(s2), buf4);
cd->connection->put_data(buf4, 4);
DEBUG_TIME("open_file_end")
break;
@ -184,13 +184,13 @@ void EditorFileServer::_subthread_start(void *s) {
cd->connection->put_data(buf4, 4);
encode_uint32(FileAccessNetwork::RESPONSE_GET_MODTIME, buf4);
cd->connection->put_data(buf4, 4);
encode_uint64(FileAccess::get_modified_time(s), buf4);
encode_uint64(FileAccess::get_modified_time(s2), buf4);
cd->connection->put_data(buf4, 8);
DEBUG_TIME("open_file_end")
break;
}
FileAccess *fa = FileAccess::open(s, FileAccess::READ);
FileAccess *fa = FileAccess::open(s2, FileAccess::READ);
if (!fa) {
//not found, continue
encode_uint32(id, buf4);

View File

@ -766,9 +766,9 @@ void FindInFilesPanel::_on_replace_all_clicked() {
if (!item->is_checked(0))
continue;
Map<TreeItem *, Result>::Element *E = _result_items.find(item);
ERR_FAIL_COND(E == NULL);
locations.push_back(E->value());
Map<TreeItem *, Result>::Element *F = _result_items.find(item);
ERR_FAIL_COND(F == NULL);
locations.push_back(F->value());
}
if (locations.size() != 0) {

View File

@ -724,13 +724,13 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
int _prim_ofs = 0;
int vertidx = 0;
for (int p_i = 0; p_i < p.count; p_i++) {
for (int p_j = 0; p_j < p.count; p_j++) {
int amount;
if (p.polygons.size()) {
ERR_FAIL_INDEX_V(p_i, p.polygons.size(), ERR_INVALID_DATA);
amount = p.polygons[p_i];
ERR_FAIL_INDEX_V(p_j, p.polygons.size(), ERR_INVALID_DATA);
amount = p.polygons[p_j];
} else {
amount = 3; //triangles;
}
@ -1100,7 +1100,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
if (Object::cast_to<MeshInstance>(node)) {
Collada::NodeGeometry *ng = static_cast<Collada::NodeGeometry *>(p_node);
Collada::NodeGeometry *ng2 = static_cast<Collada::NodeGeometry *>(p_node);
MeshInstance *mi = Object::cast_to<MeshInstance>(node);
@ -1113,16 +1113,16 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
Vector<int> bone_remap;
Vector<Ref<ArrayMesh> > morphs;
if (ng->controller) {
if (ng2->controller) {
String ngsource = ng->source;
String ngsource = ng2->source;
if (collada.state.skin_controller_data_map.has(ngsource)) {
ERR_FAIL_COND_V(!collada.state.skin_controller_data_map.has(ngsource), ERR_INVALID_DATA);
skin = &collada.state.skin_controller_data_map[ngsource];
Vector<String> skeletons = ng->skeletons;
Vector<String> skeletons = ng2->skeletons;
ERR_FAIL_COND_V(skeletons.empty(), ERR_INVALID_DATA);
@ -1185,12 +1185,12 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
Vector<String> names = morph->sources[target].sarray;
for (int i = 0; i < names.size(); i++) {
String meshid = names[i];
if (collada.state.mesh_data_map.has(meshid)) {
String meshid2 = names[i];
if (collada.state.mesh_data_map.has(meshid2)) {
Ref<ArrayMesh> mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid];
const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid2];
mesh->set_name(meshdata.name);
Error err = _create_mesh_surfaces(false, mesh, ng->material_map, meshdata, apply_xform, bone_remap, skin, NULL, Vector<Ref<ArrayMesh> >(), false);
Error err = _create_mesh_surfaces(false, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, NULL, Vector<Ref<ArrayMesh> >(), false);
ERR_FAIL_COND_V(err, err);
morphs.push_back(mesh);
@ -1212,7 +1212,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
}
} else {
meshid = ng->source;
meshid = ng2->source;
}
Ref<ArrayMesh> mesh;
@ -1226,7 +1226,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid];
mesh->set_name(meshdata.name);
Error err = _create_mesh_surfaces(morphs.size() == 0, mesh, ng->material_map, meshdata, apply_xform, bone_remap, skin, morph, morphs, p_use_compression, use_mesh_builtin_materials);
Error err = _create_mesh_surfaces(morphs.size() == 0, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, morph, morphs, p_use_compression, use_mesh_builtin_materials);
ERR_FAIL_COND_V(err, err);
mesh_cache[meshid] = mesh;
@ -1246,8 +1246,8 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
String matname = meshdata.primitives[i].material;
if (ng->material_map.has(matname)) {
String target = ng->material_map[matname].target;
if (ng2->material_map.has(matname)) {
String target = ng2->material_map[matname].target;
Ref<Material> material;
if (!material_cache.has(target)) {
@ -1296,26 +1296,26 @@ Error ColladaImport::load(const String &p_path, int p_flags, bool p_force_make_t
for (int i = 0; i < vs.root_nodes.size(); i++) {
Error err = _create_scene_skeletons(vs.root_nodes[i]);
if (err != OK) {
Error err2 = _create_scene_skeletons(vs.root_nodes[i]);
if (err2 != OK) {
memdelete(scene);
ERR_FAIL_COND_V(err, err);
ERR_FAIL_COND_V(err2, err2);
}
}
for (int i = 0; i < vs.root_nodes.size(); i++) {
Error err = _create_scene(vs.root_nodes[i], scene);
if (err != OK) {
memdelete(scene);
ERR_FAIL_COND_V(err, err);
}
Error err2 = _create_resources(vs.root_nodes[i], p_use_compression);
Error err2 = _create_scene(vs.root_nodes[i], scene);
if (err2 != OK) {
memdelete(scene);
ERR_FAIL_COND_V(err2, err2);
}
Error err3 = _create_resources(vs.root_nodes[i], p_use_compression);
if (err3 != OK) {
memdelete(scene);
ERR_FAIL_COND_V(err3, err3);
}
}
//optatively, set unit scale in the root
@ -1627,10 +1627,10 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
ERR_CONTINUE(xf.data.size() < 4);
xf.data.write[3] = data[0];
} else if (at.component == "X" || at.component == "Y" || at.component == "Z") {
int cn = at.component[0] - 'X';
ERR_CONTINUE(cn >= xf.data.size());
int cn2 = at.component[0] - 'X';
ERR_CONTINUE(cn2 >= xf.data.size());
ERR_CONTINUE(data.size() > 1);
xf.data.write[cn] = data[0];
xf.data.write[cn2] = data[0];
} else if (data.size() == xf.data.size()) {
xf.data = data;
} else {
@ -1747,11 +1747,11 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
animation->track_set_path(track, path);
animation->track_set_imported(track, true); //helps merging later
for (int i = 0; i < at.keys.size(); i++) {
for (int j = 0; j < at.keys.size(); j++) {
float time = at.keys[i].time;
float time = at.keys[j].time;
Variant value;
Vector<float> data = at.keys[i].data;
Vector<float> data = at.keys[j].data;
if (data.size() == 1) {
//push a float
value = data[0];

View File

@ -244,8 +244,8 @@ Error EditorSceneImporterGLTF::_parse_nodes(GLTFState &state) {
if (n.has("children")) {
Array children = n["children"];
for (int i = 0; i < children.size(); i++) {
node->children.push_back(children[i]);
for (int j = 0; j < children.size(); j++) {
node->children.push_back(children[j]);
}
}
@ -879,7 +879,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
if (p.has("mode")) {
int mode = p["mode"];
ERR_FAIL_INDEX_V(mode, 7, ERR_FILE_CORRUPT);
static const Mesh::PrimitiveType primitives[7] = {
static const Mesh::PrimitiveType primitives2[7] = {
Mesh::PRIMITIVE_POINTS,
Mesh::PRIMITIVE_LINES,
Mesh::PRIMITIVE_LINE_LOOP,
@ -889,7 +889,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
Mesh::PRIMITIVE_TRIANGLE_FAN,
};
primitive = primitives[mode];
primitive = primitives2[mode];
}
if (a.has("POSITION")) {
@ -922,17 +922,17 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
//PoolVector<int> v = array[Mesh::ARRAY_BONES];
//PoolVector<int>::Read r = v.read();
for (int j = 0; j < wc; j += 4) {
for (int k = 0; k < wc; k += 4) {
float total = 0.0;
total += w[j + 0];
total += w[j + 1];
total += w[j + 2];
total += w[j + 3];
total += w[k + 0];
total += w[k + 1];
total += w[k + 2];
total += w[k + 3];
if (total > 0.0) {
w[j + 0] /= total;
w[j + 1] /= total;
w[j + 2] /= total;
w[j + 3] /= total;
w[k + 0] /= total;
w[k + 1] /= total;
w[k + 2] /= total;
w[k + 3] /= total;
}
//print_verbose(itos(j / 4) + ": " + itos(r[j + 0]) + ":" + rtos(w[j + 0]) + ", " + itos(r[j + 1]) + ":" + rtos(w[j + 1]) + ", " + itos(r[j + 2]) + ":" + rtos(w[j + 2]) + ", " + itos(r[j + 3]) + ":" + rtos(w[j + 3]));
@ -950,8 +950,8 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
int is = indices.size();
PoolVector<int>::Write w = indices.write();
for (int i = 0; i < is; i += 3) {
SWAP(w[i + 1], w[i + 2]);
for (int k = 0; k < is; k += 3) {
SWAP(w[k + 1], w[k + 2]);
}
}
array[Mesh::ARRAY_INDEX] = indices;
@ -964,10 +964,10 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
indices.resize(vs);
{
PoolVector<int>::Write w = indices.write();
for (int i = 0; i < vs; i += 3) {
w[i] = i;
w[i + 1] = i + 2;
w[i + 2] = i + 1;
for (int k = 0; k < vs; k += 3) {
w[k] = k;
w[k + 1] = k + 2;
w[k + 2] = k + 1;
}
}
array[Mesh::ARRAY_INDEX] = indices;

View File

@ -132,9 +132,9 @@ void ResourceImporterLayeredTexture::_save_tex(const Vector<Ref<Image> > &p_imag
int mmc = image->get_mipmap_count() + 1;
f->store_32(mmc);
for (int i = 0; i < mmc; i++) {
for (int j = 0; j < mmc; j++) {
if (i > 0) {
if (j > 0) {
image->shrink_x2();
}

View File

@ -1314,9 +1314,9 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
if (bool(p_options["external_files/store_in_subdir"])) {
String subdir_name = p_source_file.get_file().get_basename();
DirAccess *da = DirAccess::open(base_path);
Error err = da->make_dir(subdir_name);
Error err2 = da->make_dir(subdir_name);
memdelete(da);
ERR_FAIL_COND_V(err != OK && err != ERR_ALREADY_EXISTS, err);
ERR_FAIL_COND_V(err2 != OK && err2 != ERR_ALREADY_EXISTS, err2);
base_path = base_path.plus_file(subdir_name);
}
}
@ -1331,7 +1331,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
float texel_size = p_options["meshes/lightmap_texel_size"];
texel_size = MAX(0.001, texel_size);
EditorProgress progress("gen_lightmaps", TTR("Generating Lightmaps"), meshes.size());
EditorProgress progress2("gen_lightmaps", TTR("Generating Lightmaps"), meshes.size());
int step = 0;
for (Map<Ref<ArrayMesh>, Transform>::Element *E = meshes.front(); E; E = E->next()) {
@ -1341,10 +1341,10 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
name = "Mesh " + itos(step);
}
progress.step(TTR("Generating for Mesh: ") + name + " (" + itos(step) + "/" + itos(meshes.size()) + ")", step);
progress2.step(TTR("Generating for Mesh: ") + name + " (" + itos(step) + "/" + itos(meshes.size()) + ")", step);
Error err = mesh->lightmap_unwrap(E->get(), texel_size);
if (err != OK) {
Error err2 = mesh->lightmap_unwrap(E->get(), texel_size);
if (err2 != OK) {
EditorNode::add_io_error("Mesh '" + name + "' failed lightmap generation. Please fix geometry.");
}
step++;

View File

@ -347,16 +347,16 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
return true;
} else {
Vector<Vector2> vertices = _get_polygon(insert.polygon);
pre_move_edit = vertices;
Vector<Vector2> vertices2 = _get_polygon(insert.polygon);
pre_move_edit = vertices2;
printf("setting pre_move_edit\n");
edited_point = PosVertex(insert.polygon, insert.vertex + 1, xform.affine_inverse().xform(insert.pos));
vertices.insert(edited_point.vertex, edited_point.pos);
vertices2.insert(edited_point.vertex, edited_point.pos);
selected_point = edited_point;
edge_point = PosVertex();
undo_redo->create_action(TTR("Insert Point"));
_action_set_polygon(insert.polygon, vertices);
_action_set_polygon(insert.polygon, vertices2);
_commit_action();
return true;
}

View File

@ -785,8 +785,8 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
for (int i = 0; i < visible_properties.size(); i++) {
String pname = visible_properties[i]->get_edited_property().operator String();
if (pname.begins_with(base_path + prev_name)) {
String new_name = pname.replace_first(base_path + prev_name, base_path + name);
visible_properties[i]->set_object_and_property(visible_properties[i]->get_edited_object(), new_name);
String new_name2 = pname.replace_first(base_path + prev_name, base_path + name);
visible_properties[i]->set_object_and_property(visible_properties[i]->get_edited_object(), new_name2);
}
}

View File

@ -1160,22 +1160,22 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
return;
}
String current = animation->get_item_text(animation->get_selected());
Ref<Animation> anim = player->get_animation(current);
//editor->edit_resource(anim);
EditorSettings::get_singleton()->set_resource_clipboard(anim);
String current2 = animation->get_item_text(animation->get_selected());
Ref<Animation> anim2 = player->get_animation(current2);
//editor->edit_resource(anim2);
EditorSettings::get_singleton()->set_resource_clipboard(anim2);
} break;
case TOOL_PASTE_ANIM: {
Ref<Animation> anim = EditorSettings::get_singleton()->get_resource_clipboard();
if (!anim.is_valid()) {
Ref<Animation> anim2 = EditorSettings::get_singleton()->get_resource_clipboard();
if (!anim2.is_valid()) {
error_dialog->set_text(TTR("No animation resource on clipboard!"));
error_dialog->popup_centered_minsize();
return;
}
String name = anim->get_name();
String name = anim2->get_name();
if (name == "") {
name = TTR("Pasted Animation");
}
@ -1189,7 +1189,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
}
undo_redo->create_action(TTR("Paste Animation"));
undo_redo->add_do_method(player, "add_animation", name, anim);
undo_redo->add_do_method(player, "add_animation", name, anim2);
undo_redo->add_undo_method(player, "remove_animation", name);
undo_redo->add_do_method(this, "_animation_player_changed", player);
undo_redo->add_undo_method(this, "_animation_player_changed", player);
@ -1206,9 +1206,9 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
return;
}
String current = animation->get_item_text(animation->get_selected());
Ref<Animation> anim = player->get_animation(current);
editor->edit_resource(anim);
String current2 = animation->get_item_text(animation->get_selected());
Ref<Animation> anim2 = player->get_animation(current2);
editor->edit_resource(anim2);
} break;
}

View File

@ -714,12 +714,12 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
tl.to += offset;
}
for (int i = 0; i < node_rects.size(); i++) {
if (node_rects[i].node_name == tl.from_node) {
_clip_src_line_to_rect(tl.from, tl.to, node_rects[i].node);
for (int j = 0; j < node_rects.size(); j++) {
if (node_rects[j].node_name == tl.from_node) {
_clip_src_line_to_rect(tl.from, tl.to, node_rects[j].node);
}
if (node_rects[i].node_name == tl.to_node) {
_clip_dst_line_to_rect(tl.from, tl.to, node_rects[i].node);
if (node_rects[j].node_name == tl.to_node) {
_clip_dst_line_to_rect(tl.from, tl.to, node_rects[j].node);
}
}

View File

@ -398,10 +398,10 @@ Rect2 CanvasItemEditor::_get_encompassing_rect_from_list(List<CanvasItem *> p_li
// Expand with the other ones
for (List<CanvasItem *>::Element *E = p_list.front(); E; E = E->next()) {
CanvasItem *canvas_item = E->get();
Transform2D xform = canvas_item->get_global_transform_with_canvas();
CanvasItem *canvas_item2 = E->get();
Transform2D xform = canvas_item2->get_global_transform_with_canvas();
Rect2 current_rect = canvas_item->_edit_get_rect();
Rect2 current_rect = canvas_item2->_edit_get_rect();
rect.expand_to(xform.xform(current_rect.position));
rect.expand_to(xform.xform(current_rect.position + Vector2(current_rect.size.x, 0)));
rect.expand_to(xform.xform(current_rect.position + current_rect.size));
@ -816,10 +816,10 @@ void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_ite
undo_redo->add_do_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state());
undo_redo->add_undo_method(canvas_item, "_edit_set_state", se->undo_state);
if (commit_bones) {
for (List<Dictionary>::Element *E = se->pre_drag_bones_undo_state.front(); E; E = E->next()) {
for (List<Dictionary>::Element *F = se->pre_drag_bones_undo_state.front(); F; F = F->next()) {
canvas_item = Object::cast_to<CanvasItem>(canvas_item->get_parent());
undo_redo->add_do_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state());
undo_redo->add_undo_method(canvas_item, "_edit_set_state", E->get());
undo_redo->add_undo_method(canvas_item, "_edit_set_state", F->get());
}
}
}
@ -1921,9 +1921,9 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
if (drag_selection.size() == 1) {
Node2D *node_2d = Object::cast_to<Node2D>(drag_selection[0]);
if (node_2d && move_local_base_rotated) {
Transform2D m;
m.rotate(node_2d->get_rotation());
new_pos += m.xform(drag_to);
Transform2D m2;
m2.rotate(node_2d->get_rotation());
new_pos += m2.xform(drag_to);
} else if (move_local_base) {
new_pos += drag_to;
} else {
@ -2065,18 +2065,18 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
// Start dragging
if (still_selected) {
// Drag the node(s) if requested
List<CanvasItem *> selection = _get_edited_canvas_items();
List<CanvasItem *> selection2 = _get_edited_canvas_items();
// Remove not movable nodes
for (int i = 0; i < selection.size(); i++) {
if (!_is_node_movable(selection[i], true)) {
selection.erase(selection[i]);
for (int i = 0; i < selection2.size(); i++) {
if (!_is_node_movable(selection2[i], true)) {
selection2.erase(selection2[i]);
}
}
if (selection.size() > 0) {
if (selection2.size() > 0) {
drag_type = DRAG_MOVE;
drag_selection = selection;
drag_selection = selection2;
drag_from = click;
_save_canvas_item_state(drag_selection);
}

View File

@ -198,14 +198,14 @@ void MeshInstanceEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_CREATE_UV2: {
Ref<ArrayMesh> mesh = node->get_mesh();
if (!mesh.is_valid()) {
Ref<ArrayMesh> mesh2 = node->get_mesh();
if (!mesh2.is_valid()) {
err_dialog->set_text(TTR("Contained Mesh is not of type ArrayMesh."));
err_dialog->popup_centered_minsize();
return;
}
Error err = mesh->lightmap_unwrap(node->get_global_transform());
Error err = mesh2->lightmap_unwrap(node->get_global_transform());
if (err != OK) {
err_dialog->set_text(TTR("UV Unwrap failed, mesh may not be manifold?"));
err_dialog->popup_centered_minsize();
@ -214,8 +214,8 @@ void MeshInstanceEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_DEBUG_UV1: {
Ref<Mesh> mesh = node->get_mesh();
if (!mesh.is_valid()) {
Ref<Mesh> mesh2 = node->get_mesh();
if (!mesh2.is_valid()) {
err_dialog->set_text(TTR("No mesh to debug."));
err_dialog->popup_centered_minsize();
return;
@ -223,8 +223,8 @@ void MeshInstanceEditor::_menu_option(int p_option) {
_create_uv_lines(0);
} break;
case MENU_OPTION_DEBUG_UV2: {
Ref<Mesh> mesh = node->get_mesh();
if (!mesh.is_valid()) {
Ref<Mesh> mesh2 = node->get_mesh();
if (!mesh2.is_valid()) {
err_dialog->set_text(TTR("No mesh to debug."));
err_dialog->popup_centered_minsize();
return;

View File

@ -180,11 +180,11 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
// Check for segment split.
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && mode == MODE_EDIT && on_edge == true) {
Vector2 gpoint = mb->get_position();
Vector2 gpoint2 = mb->get_position();
Ref<Curve2D> curve = node->get_curve();
int insertion_point = -1;
float mbLength = curve->get_closest_offset(xform.affine_inverse().xform(gpoint));
float mbLength = curve->get_closest_offset(xform.affine_inverse().xform(gpoint2));
int len = curve->get_point_count();
for (int i = 0; i < len - 1; i++) {
float compareLength = curve->get_closest_offset(curve->get_point_position(i + 1));
@ -195,7 +195,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
insertion_point = curve->get_point_count() - 2;
undo_redo->create_action(TTR("Split Curve"));
undo_redo->add_do_method(curve.ptr(), "add_point", xform.affine_inverse().xform(gpoint), Vector2(0, 0), Vector2(0, 0), insertion_point + 1);
undo_redo->add_do_method(curve.ptr(), "add_point", xform.affine_inverse().xform(gpoint2), Vector2(0, 0), Vector2(0, 0), insertion_point + 1);
undo_redo->add_undo_method(curve.ptr(), "remove_point", insertion_point + 1);
undo_redo->add_do_method(canvas_item_editor, "update_viewport");
undo_redo->add_undo_method(canvas_item_editor, "update_viewport");
@ -204,7 +204,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
action = ACTION_MOVING_POINT;
action_point = insertion_point + 1;
moving_from = curve->get_point_position(action_point);
moving_screen_from = gpoint;
moving_screen_from = gpoint2;
canvas_item_editor->update_viewport();

View File

@ -1092,10 +1092,10 @@ void Polygon2DEditor::_uv_draw() {
PoolVector<int> points = polygons[i];
Vector<Vector2> polypoints;
for (int i = 0; i < points.size(); i++) {
int next = (i + 1) % points.size();
for (int j = 0; j < points.size(); j++) {
int next = (j + 1) % points.size();
int idx = points[i];
int idx = points[j];
int idx_next = points[next];
if (idx < 0 || idx >= uvs.size())
continue;

View File

@ -4695,10 +4695,10 @@ void SpatialEditor::_init_indicators() {
plane_mat->set_on_top_of_alpha();
plane_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
plane_mat->set_cull_mode(SpatialMaterial::CULL_DISABLED);
Color col;
col[i] = 1.0;
col.a = gizmo_alph;
plane_mat->set_albedo(col);
Color col2;
col2[i] = 1.0;
col2.a = gizmo_alph;
plane_mat->set_albedo(col2);
plane_gizmo_color[i] = plane_mat; // needed, so we can draw planes from both sides
surftool->set_material(plane_mat);
surftool->commit(move_plane_gizmo[i]);
@ -4824,10 +4824,10 @@ void SpatialEditor::_init_indicators() {
plane_mat->set_on_top_of_alpha();
plane_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
plane_mat->set_cull_mode(SpatialMaterial::CULL_DISABLED);
Color col;
col[i] = 1.0;
col.a = gizmo_alph;
plane_mat->set_albedo(col);
Color col2;
col2[i] = 1.0;
col2.a = gizmo_alph;
plane_mat->set_albedo(col2);
plane_gizmo_color[i] = plane_mat; // needed, so we can draw planes from both sides
surftool->set_material(plane_mat);
surftool->commit(scale_plane_gizmo[i]);

View File

@ -477,17 +477,17 @@ void TileMapEditor::_update_palette() {
if (sel_tile != TileMap::INVALID_CELL) {
if ((manual_autotile && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) || tileset->tile_get_tile_mode(sel_tile) == TileSet::ATLAS_TILE) {
const Map<Vector2, uint16_t> &tiles = tileset->autotile_get_bitmask_map(sel_tile);
const Map<Vector2, uint16_t> &tiles2 = tileset->autotile_get_bitmask_map(sel_tile);
Vector<Vector2> entries;
for (const Map<Vector2, uint16_t>::Element *E = tiles.front(); E; E = E->next()) {
entries.push_back(E->key());
Vector<Vector2> entries2;
for (const Map<Vector2, uint16_t>::Element *E = tiles2.front(); E; E = E->next()) {
entries2.push_back(E->key());
}
entries.sort();
entries2.sort();
Ref<Texture> tex = tileset->tile_get_texture(sel_tile);
for (int i = 0; i < entries.size(); i++) {
for (int i = 0; i < entries2.size(); i++) {
manual_palette->add_item(String());
@ -496,7 +496,7 @@ void TileMapEditor::_update_palette() {
Rect2 region = tileset->tile_get_region(sel_tile);
int spacing = tileset->autotile_get_spacing(sel_tile);
region.size = tileset->autotile_get_size(sel_tile); // !!
region.position += (region.size + Vector2(spacing, spacing)) * entries[i];
region.position += (region.size + Vector2(spacing, spacing)) * entries2[i];
if (!region.has_no_area())
manual_palette->set_item_icon_region(manual_palette->get_item_count() - 1, region);
@ -504,16 +504,16 @@ void TileMapEditor::_update_palette() {
manual_palette->set_item_icon(manual_palette->get_item_count() - 1, tex);
}
manual_palette->set_item_metadata(manual_palette->get_item_count() - 1, entries[i]);
manual_palette->set_item_metadata(manual_palette->get_item_count() - 1, entries2[i]);
}
}
}
if (manual_palette->get_item_count() > 0) {
// Only show the manual palette if at least tile exists in it
int selected = manual_palette->get_current();
if (selected == -1) selected = 0;
manual_palette->set_current(selected);
int selected2 = manual_palette->get_current();
if (selected2 == -1) selected2 = 0;
manual_palette->set_current(selected2);
manual_palette->show();
}

View File

@ -2573,20 +2573,20 @@ bool TilesetEditorContext::_set(const StringName &p_name, const Variant &p_value
tileset_editor->_set_snap_sep(snap);
return true;
} else if (p_name.operator String().left(5) == "tile_") {
String name = p_name.operator String().right(5);
String name2 = p_name.operator String().right(5);
bool v = false;
if (tileset_editor->get_current_tile() < 0 || tileset.is_null())
return false;
if (name == "autotile_bitmask_mode") {
if (name2 == "autotile_bitmask_mode") {
tileset->set(String::num(tileset_editor->get_current_tile(), 0) + "/autotile/bitmask_mode", p_value, &v);
} else if (name == "subtile_size") {
} else if (name2 == "subtile_size") {
tileset->set(String::num(tileset_editor->get_current_tile(), 0) + "/autotile/tile_size", p_value, &v);
} else if (name == "subtile_spacing") {
} else if (name2 == "subtile_spacing") {
tileset->set(String::num(tileset_editor->get_current_tile(), 0) + "/autotile/spacing", p_value, &v);
} else {
tileset->set(String::num(tileset_editor->get_current_tile(), 0) + "/" + name, p_value, &v);
tileset->set(String::num(tileset_editor->get_current_tile(), 0) + "/" + name2, p_value, &v);
}
if (v) {
tileset->_change_notify("");

View File

@ -1116,8 +1116,8 @@ void EditorPropertyShaderMode::_option_selected(int p_which) {
VisualShader::Type type = VisualShader::Type(i);
Vector<int> nodes = visual_shader->get_node_list(type);
for (int i = 0; i < nodes.size(); i++) {
Ref<VisualShaderNodeInput> input = visual_shader->get_node(type, nodes[i]);
for (int j = 0; j < nodes.size(); j++) {
Ref<VisualShaderNodeInput> input = visual_shader->get_node(type, nodes[j]);
if (!input.is_valid()) {
continue;
}

View File

@ -434,22 +434,22 @@ private:
if (mode == MODE_RENAME) {
String dir = _test_path();
if (dir == "") {
String dir2 = _test_path();
if (dir2 == "") {
set_message(TTR("Invalid project path (changed anything?)."), MESSAGE_ERROR);
return;
}
ProjectSettings *current = memnew(ProjectSettings);
int err = current->setup(dir, "");
int err = current->setup(dir2, "");
if (err != OK) {
set_message(vformat(TTR("Couldn't load project.godot in project path (error %d). It may be missing or corrupted."), err), MESSAGE_ERROR);
} else {
ProjectSettings::CustomMap edited_settings;
edited_settings["application/config/name"] = project_name->get_text();
if (current->save_custom(dir.plus_file("project.godot"), edited_settings, Vector<String>(), true) != OK) {
if (current->save_custom(dir2.plus_file("project.godot"), edited_settings, Vector<String>(), true) != OK) {
set_message(TTR("Couldn't edit project.godot in project path."), MESSAGE_ERROR);
}
}

View File

@ -712,7 +712,7 @@ void ProjectSettingsEditor::_update_actions() {
if (event.is_null())
continue;
TreeItem *action = input_editor->create_item(item);
TreeItem *action2 = input_editor->create_item(item);
Ref<InputEventKey> k = event;
if (k.is_valid()) {
@ -727,8 +727,8 @@ void ProjectSettingsEditor::_update_actions() {
if (k->get_control())
str = TTR("Control+") + str;
action->set_text(0, str);
action->set_icon(0, get_icon("Keyboard", "EditorIcons"));
action2->set_text(0, str);
action2->set_icon(0, get_icon("Keyboard", "EditorIcons"));
}
Ref<InputEventJoypadButton> jb = event;
@ -741,8 +741,8 @@ void ProjectSettingsEditor::_update_actions() {
else
str += ".";
action->set_text(0, str);
action->set_icon(0, get_icon("JoyButton", "EditorIcons"));
action2->set_text(0, str);
action2->set_icon(0, get_icon("JoyButton", "EditorIcons"));
}
Ref<InputEventMouseButton> mb = event;
@ -758,8 +758,8 @@ void ProjectSettingsEditor::_update_actions() {
default: str += TTR("Button") + " " + itos(mb->get_button_index()) + ".";
}
action->set_text(0, str);
action->set_icon(0, get_icon("Mouse", "EditorIcons"));
action2->set_text(0, str);
action2->set_icon(0, get_icon("Mouse", "EditorIcons"));
}
Ref<InputEventJoypadMotion> jm = event;
@ -770,14 +770,14 @@ void ProjectSettingsEditor::_update_actions() {
int n = 2 * ax + (jm->get_axis_value() < 0 ? 0 : 1);
String desc = _axis_names[n];
String str = _get_device_string(jm->get_device()) + ", " + TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") + desc + ".";
action->set_text(0, str);
action->set_icon(0, get_icon("JoyAxis", "EditorIcons"));
action2->set_text(0, str);
action2->set_icon(0, get_icon("JoyAxis", "EditorIcons"));
}
action->set_metadata(0, i);
action->set_meta("__input", event);
action2->set_metadata(0, i);
action2->set_meta("__input", event);
action->add_button(2, get_icon("Edit", "EditorIcons"), 3, false, TTR("Edit"));
action->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove"));
action2->add_button(2, get_icon("Edit", "EditorIcons"), 3, false, TTR("Edit"));
action2->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove"));
}
}
@ -1034,8 +1034,8 @@ void ProjectSettingsEditor::_copy_to_platform_about_to_show() {
String custom = EditorExport::get_singleton()->get_export_preset(i)->get_custom_features();
Vector<String> custom_list = custom.split(",");
for (int i = 0; i < custom_list.size(); i++) {
String f = custom_list[i].strip_edges();
for (int j = 0; j < custom_list.size(); j++) {
String f = custom_list[j].strip_edges();
if (f != String()) {
presets.insert(f);
}
@ -1543,10 +1543,10 @@ void ProjectSettingsEditor::_update_translations() {
PoolStringArray selected = remaps[keys[i]];
for (int j = 0; j < selected.size(); j++) {
String s = selected[j];
int qp = s.find_last(":");
String path = s.substr(0, qp);
String locale = s.substr(qp + 1, s.length());
String s2 = selected[j];
int qp = s2.find_last(":");
String path = s2.substr(0, qp);
String locale = s2.substr(qp + 1, s2.length());
TreeItem *t2 = translation_remap_options->create_item(root2);
t2->set_editable(0, false);

View File

@ -905,8 +905,8 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
List<StringName> inheritors;
ClassDB::get_inheriters_from_class(base.strip_edges(), &inheritors);
for (int i = 0; i < custom_resources.size(); i++) {
inheritors.push_back(custom_resources[i].name);
for (int j = 0; j < custom_resources.size(); j++) {
inheritors.push_back(custom_resources[j].name);
}
List<StringName>::Element *E = inheritors.front();
@ -915,17 +915,17 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
E = E->next();
}
for (Set<String>::Element *E = valid_inheritors.front(); E; E = E->next()) {
String t = E->get();
for (Set<String>::Element *j = valid_inheritors.front(); j; j = j->next()) {
String t = j->get();
bool is_custom_resource = false;
Ref<Texture> icon;
if (!custom_resources.empty()) {
for (int i = 0; i < custom_resources.size(); i++) {
if (custom_resources[i].name == t) {
for (int k = 0; k < custom_resources.size(); k++) {
if (custom_resources[k].name == t) {
is_custom_resource = true;
if (custom_resources[i].icon.is_valid())
icon = custom_resources[i].icon;
if (custom_resources[k].icon.is_valid())
icon = custom_resources[k].icon;
break;
}
}

View File

@ -1152,17 +1152,17 @@ void SceneTreeDock::perform_node_renames(Node *p_base, List<Pair<NodePath, NodeP
if (p.get_type() == Variant::NODE_PATH) {
// Goes through all paths to check if its matching
for (List<Pair<NodePath, NodePath> >::Element *E = p_renames->front(); E; E = E->next()) {
for (List<Pair<NodePath, NodePath> >::Element *F = p_renames->front(); F; F = F->next()) {
NodePath root_path = p_base->get_path();
NodePath rel_path_old = root_path.rel_path_to(E->get().first);
NodePath rel_path_old = root_path.rel_path_to(F->get().first);
NodePath rel_path_new = E->get().second;
NodePath rel_path_new = F->get().second;
// if not empty, get new relative path
if (E->get().second != NodePath()) {
rel_path_new = root_path.rel_path_to(E->get().second);
if (F->get().second != NodePath()) {
rel_path_new = root_path.rel_path_to(F->get().second);
}
// if old path detected, then it needs to be replaced with the new one
@ -1233,11 +1233,11 @@ void SceneTreeDock::perform_node_renames(Node *p_base, List<Pair<NodePath, NodeP
if (!ran.has(i))
continue; //channel was removed
for (List<Pair<NodePath, NodePath> >::Element *E = p_renames->front(); E; E = E->next()) {
for (List<Pair<NodePath, NodePath> >::Element *F = p_renames->front(); F; F = F->next()) {
if (E->get().first == old_np) {
if (F->get().first == old_np) {
if (E->get().second == NodePath()) {
if (F->get().second == NodePath()) {
//will be erased
int idx = 0;
@ -1262,7 +1262,7 @@ void SceneTreeDock::perform_node_renames(Node *p_base, List<Pair<NodePath, NodeP
} else {
//will be renamed
NodePath rel_path = new_root_path.rel_path_to(E->get().second);
NodePath rel_path = new_root_path.rel_path_to(F->get().second);
NodePath new_path = NodePath(rel_path.get_names(), track_np.get_subnames(), false);
if (new_path == track_np)
@ -1602,9 +1602,9 @@ void SceneTreeDock::_delete_confirm() {
List<Node *> owned;
n->get_owned_by(n->get_owner(), &owned);
Array owners;
for (List<Node *>::Element *E = owned.front(); E; E = E->next()) {
for (List<Node *>::Element *F = owned.front(); F; F = F->next()) {
owners.push_back(E->get());
owners.push_back(F->get());
}
editor_data->get_undo_redo().add_do_method(n->get_parent(), "remove_child", n);

View File

@ -255,8 +255,8 @@ void ScriptCreateDialog::_lang_changed(int l) {
// change extension by selected language
List<String> extensions;
// get all possible extensions for script
for (int l = 0; l < language_menu->get_item_count(); l++) {
ScriptServer::get_language(l)->get_recognized_extensions(&extensions);
for (int m = 0; m < language_menu->get_item_count(); m++) {
ScriptServer::get_language(m)->get_recognized_extensions(&extensions);
}
for (List<String>::Element *E = extensions.front(); E; E = E->next()) {

View File

@ -777,7 +777,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
for (int i = 0; i < scc; i += 3) {
String script = p_data[2 + i];
String method = p_data[3 + i];
String method2 = p_data[3 + i];
int line = p_data[4 + i];
TreeItem *stack_trace = error_tree->create_item(error);
@ -791,7 +791,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
stack_trace->set_text_align(0, TreeItem::ALIGN_LEFT);
error->set_metadata(0, meta);
}
stack_trace->set_text(1, script.get_file() + ":" + itos(line) + " @ " + method + "()");
stack_trace->set_text(1, script.get_file() + ":" + itos(line) + " @ " + method2 + "()");
}
if (warning)
@ -859,18 +859,18 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
c.items.resize(values.size() / 2);
c.total_time = 0;
c.signature = "categ::" + name;
for (int i = 0; i < values.size(); i += 2) {
for (int j = 0; j < values.size(); j += 2) {
EditorProfiler::Metric::Category::Item item;
item.calls = 1;
item.line = 0;
item.name = values[i];
item.self = values[i + 1];
item.name = values[j];
item.self = values[j + 1];
item.total = item.self;
item.signature = "categ::" + name + "::" + item.name;
item.name = item.name.capitalize();
c.total_time += item.total;
c.items.write[i / 2] = item;
c.items.write[j / 2] = item;
}
metric.categories.push_back(c);
}
@ -1002,13 +1002,13 @@ void ScriptEditorDebugger::_performance_draw() {
float m = perf_max[pi];
if (m == 0)
m = 0.00001;
float h = E->get()[pi] / m;
h = (1.0 - h) * r.size.y;
float h2 = E->get()[pi] / m;
h2 = (1.0 - h2) * r.size.y;
c.a = 0.7;
if (E != perf_history.front())
perf_draw->draw_line(r.position + Point2(from, h), r.position + Point2(from + spacing, prev), c, 2.0);
prev = h;
perf_draw->draw_line(r.position + Point2(from, h2), r.position + Point2(from + spacing, prev), c, 2.0);
prev = h2;
E = E->next();
from -= spacing;
}
@ -1536,14 +1536,14 @@ void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p
int pathid = _get_res_path_cache(respath);
if (p_value.is_ref()) {
Ref<Resource> res = p_value;
if (res.is_valid() && res->get_path() != String()) {
Ref<Resource> res2 = p_value;
if (res2.is_valid() && res2->get_path() != String()) {
Array msg;
msg.push_back("live_res_prop_res");
msg.push_back(pathid);
msg.push_back(p_property);
msg.push_back(res->get_path());
msg.push_back(res2->get_path());
ppeer->put_var(msg);
}
} else {

View File

@ -1235,8 +1235,8 @@ void CameraSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx
Vector3 s[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 4096) };
if (camera->get_projection() == Camera::PROJECTION_PERSPECTIVE) {
Transform gt = camera->get_global_transform();
float a = _find_closest_angle_to_half_pi_arc(s[0], s[1], 1.0, gt);
Transform gt2 = camera->get_global_transform();
float a = _find_closest_angle_to_half_pi_arc(s[0], s[1], 1.0, gt2);
camera->set("fov", a * 2.0);
} else {
@ -3019,20 +3019,20 @@ Variant CollisionShapeSpatialGizmoPlugin::get_handle_value(EditorSpatialGizmo *p
if (Object::cast_to<CapsuleShape>(*s)) {
Ref<CapsuleShape> cs = s;
return p_idx == 0 ? cs->get_radius() : cs->get_height();
Ref<CapsuleShape> cs2 = s;
return p_idx == 0 ? cs2->get_radius() : cs2->get_height();
}
if (Object::cast_to<CylinderShape>(*s)) {
Ref<CylinderShape> cs = s;
return p_idx == 0 ? cs->get_radius() : cs->get_height();
Ref<CylinderShape> cs2 = s;
return p_idx == 0 ? cs2->get_radius() : cs2->get_height();
}
if (Object::cast_to<RayShape>(*s)) {
Ref<RayShape> cs = s;
return cs->get_length();
Ref<RayShape> cs2 = s;
return cs2->get_length();
}
return Variant();
@ -3098,26 +3098,26 @@ void CollisionShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, i
Vector3 axis;
axis[p_idx == 0 ? 0 : 2] = 1.0;
Ref<CapsuleShape> cs = s;
Ref<CapsuleShape> cs2 = s;
Vector3 ra, rb;
Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
float d = axis.dot(ra);
if (p_idx == 1)
d -= cs->get_radius();
d -= cs2->get_radius();
if (d < 0.001)
d = 0.001;
if (p_idx == 0)
cs->set_radius(d);
cs2->set_radius(d);
else if (p_idx == 1)
cs->set_height(d * 2.0);
cs2->set_height(d * 2.0);
}
if (Object::cast_to<CylinderShape>(*s)) {
Vector3 axis;
axis[p_idx == 0 ? 0 : 1] = 1.0;
Ref<CylinderShape> cs = s;
Ref<CylinderShape> cs2 = s;
Vector3 ra, rb;
Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
float d = axis.dot(ra);
@ -3126,9 +3126,9 @@ void CollisionShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, i
d = 0.001;
if (p_idx == 0)
cs->set_radius(d);
cs2->set_radius(d);
else if (p_idx == 1)
cs->set_height(d * 2.0);
cs2->set_height(d * 2.0);
}
}
void CollisionShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) {
@ -3328,9 +3328,9 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
if (Object::cast_to<CapsuleShape>(*s)) {
Ref<CapsuleShape> cs = s;
float radius = cs->get_radius();
float height = cs->get_height();
Ref<CapsuleShape> cs2 = s;
float radius = cs2->get_radius();
float height = cs2->get_height();
Vector<Vector3> points;
@ -3396,16 +3396,16 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_collision_segments(collision_segments);
Vector<Vector3> handles;
handles.push_back(Vector3(cs->get_radius(), 0, 0));
handles.push_back(Vector3(0, 0, cs->get_height() * 0.5 + cs->get_radius()));
handles.push_back(Vector3(cs2->get_radius(), 0, 0));
handles.push_back(Vector3(0, 0, cs2->get_height() * 0.5 + cs2->get_radius()));
p_gizmo->add_handles(handles, handles_material);
}
if (Object::cast_to<CylinderShape>(*s)) {
Ref<CylinderShape> cs = s;
float radius = cs->get_radius();
float height = cs->get_height();
Ref<CylinderShape> cs2 = s;
float radius = cs2->get_radius();
float height = cs2->get_height();
Vector<Vector3> points;
@ -3457,8 +3457,8 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_collision_segments(collision_segments);
Vector<Vector3> handles;
handles.push_back(Vector3(cs->get_radius(), 0, 0));
handles.push_back(Vector3(0, cs->get_height() * 0.5, 0));
handles.push_back(Vector3(cs2->get_radius(), 0, 0));
handles.push_back(Vector3(0, cs2->get_height() * 0.5, 0));
p_gizmo->add_handles(handles, handles_material);
}
@ -3503,23 +3503,23 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
Geometry::MeshData md;
Error err = QuickHull::build(varr, md);
if (err == OK) {
Vector<Vector3> points;
points.resize(md.edges.size() * 2);
Vector<Vector3> points2;
points2.resize(md.edges.size() * 2);
for (int i = 0; i < md.edges.size(); i++) {
points.write[i * 2 + 0] = md.vertices[md.edges[i].a];
points.write[i * 2 + 1] = md.vertices[md.edges[i].b];
points2.write[i * 2 + 0] = md.vertices[md.edges[i].a];
points2.write[i * 2 + 1] = md.vertices[md.edges[i].b];
}
p_gizmo->add_lines(points, material);
p_gizmo->add_collision_segments(points);
p_gizmo->add_lines(points2, material);
p_gizmo->add_collision_segments(points2);
}
}
}
if (Object::cast_to<ConcavePolygonShape>(*s)) {
Ref<ConcavePolygonShape> cs = s;
Ref<ArrayMesh> mesh = cs->get_debug_mesh()->duplicate();
Ref<ConcavePolygonShape> cs2 = s;
Ref<ArrayMesh> mesh = cs2->get_debug_mesh()->duplicate();
mesh->surface_set_material(0, material);
p_gizmo->add_mesh(mesh);
}
@ -3652,11 +3652,11 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
if (ek.from < ek.to)
SWAP(ek.from, ek.to);
Map<_EdgeKey, bool>::Element *E = edge_map.find(ek);
Map<_EdgeKey, bool>::Element *F = edge_map.find(ek);
if (E) {
if (F) {
E->get() = false;
F->get() = false;
} else {

View File

@ -1147,8 +1147,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
if (boot_logo_path != String()) {
boot_logo.instance();
Error err = ImageLoader::load_image(boot_logo_path, boot_logo);
if (err)
Error load_err = ImageLoader::load_image(boot_logo_path, boot_logo);
if (load_err)
ERR_PRINTS("Non-existing or invalid boot splash at: " + boot_logo_path + ". Loading default splash.");
}
@ -1548,8 +1548,8 @@ bool Main::start() {
Ref<PackedScene> ps = res;
n = ps->instance();
} else if (res->is_class("Script")) {
Ref<Script> s = res;
StringName ibt = s->get_instance_base_type();
Ref<Script> script_res = res;
StringName ibt = script_res->get_instance_base_type();
bool valid_type = ClassDB::is_parent_class(ibt, "Node");
ERR_EXPLAIN("Script does not inherit a Node: " + path);
ERR_CONTINUE(!valid_type);
@ -1560,7 +1560,7 @@ bool Main::start() {
ERR_CONTINUE(obj == NULL);
n = Object::cast_to<Node>(obj);
n->set_script(s.get_ref_ptr());
n->set_script(script_res.get_ref_ptr());
}
ERR_EXPLAIN("Path in autoload not a node or script: " + path);

View File

@ -1041,10 +1041,10 @@ MainLoop *test(TestType p_type) {
} else if (p_type == TEST_BYTECODE) {
Vector<uint8_t> buf = GDScriptTokenizerBuffer::parse_code_string(code);
Vector<uint8_t> buf2 = GDScriptTokenizerBuffer::parse_code_string(code);
String dst = test.get_basename() + ".gdc";
FileAccess *fw = FileAccess::open(dst, FileAccess::WRITE);
fw->store_buffer(buf.ptr(), buf.size());
fw->store_buffer(buf2.ptr(), buf2.size());
memdelete(fw);
}

View File

@ -149,11 +149,11 @@ static String dump_node_code(SL::Node *p_node, int p_level) {
String header;
header = _typestr(fnode->return_type) + " " + fnode->name + "(";
for (int i = 0; i < fnode->arguments.size(); i++) {
for (int j = 0; j < fnode->arguments.size(); j++) {
if (i > 0)
if (j > 0)
header += ", ";
header += _prestr(fnode->arguments[i].precision) + _typestr(fnode->arguments[i].type) + " " + fnode->arguments[i].name;
header += _prestr(fnode->arguments[j].precision) + _typestr(fnode->arguments[j].type) + " " + fnode->arguments[j].name;
}
header += ")\n";
@ -336,9 +336,9 @@ MainLoop *test() {
print_line("Error at line: " + rtos(sl.get_error_line()) + ": " + sl.get_error_text());
return NULL;
} else {
String code;
recreate_code(&code, sl.get_shader());
print_line("code:\n\n" + code);
String code2;
recreate_code(&code2, sl.get_shader());
print_line("code:\n\n" + code2);
}
return NULL;

View File

@ -660,3 +660,10 @@ def detect_darwin_sdk_path(platform, env):
print("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name))
raise
def get_compiler_version(env):
version = decode_utf8(subprocess.check_output([env['CXX'], '--version']).strip())
match = re.search('[0-9][0-9.]*', version)
if match is not None:
return match.group().split('.')
else:
return None

View File

@ -666,14 +666,14 @@ void CSGBrushOperation::_add_poly_points(const BuildPoly &p_poly, int p_edge, in
if (opposite_point == prev_point)
continue; //not going back
EdgeSort e;
EdgeSort e2;
Vector2 local_vec = t2d.xform(p_poly.points[opposite_point].point);
e.angle = -local_vec.angle(); //negate so we can sort by minimum angle
e.edge = edge;
e.edge_point = opposite_point;
e.prev_point = to_point;
e2.angle = -local_vec.angle(); //negate so we can sort by minimum angle
e2.edge = edge;
e2.edge_point = opposite_point;
e2.prev_point = to_point;
next_edges.push_back(e);
next_edges.push_back(e2);
}
//finally, sort by minimum angle

View File

@ -263,14 +263,14 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
colsize = 4;
}
int w = width;
int h = height;
int w2 = width;
int h2 = height;
for (uint32_t i = 1; i < mipmaps; i++) {
w = (w + 1) >> 1;
h = (h + 1) >> 1;
size += w * h * info.block_size;
w2 = (w2 + 1) >> 1;
h2 = (h2 + 1) >> 1;
size += w2 * h2 * info.block_size;
}
src_data.resize(size + 256 * colsize);

View File

@ -125,8 +125,8 @@ static void actual_discoverer_handler() {
// Check for removed files
if (!changed) {
for (int i = 0; i < current_files.size(); i++) {
if (!file_paths.has(current_files[i])) {
for (int j = 0; j < current_files.size(); j++) {
if (!file_paths.has(current_files[j])) {
changed = true;
break;
}

View File

@ -1108,12 +1108,12 @@ void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const
//instance a fake script for editing the values
Vector<_GDScriptMemberSort> msort;
for (Map<StringName, PropertyInfo>::Element *E = sptr->member_info.front(); E; E = E->next()) {
for (Map<StringName, PropertyInfo>::Element *F = sptr->member_info.front(); F; F = F->next()) {
_GDScriptMemberSort ms;
ERR_CONTINUE(!sptr->member_indices.has(E->key()));
ms.index = sptr->member_indices[E->key()].index;
ms.name = E->key();
ERR_CONTINUE(!sptr->member_indices.has(F->key()));
ms.index = sptr->member_indices[F->key()].index;
ms.name = F->key();
msort.push_back(ms);
}

View File

@ -1360,15 +1360,15 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
// jump unconditionally
// continue address
// compile the condition
int ret = _parse_expression(codegen, branch.compiled_pattern, p_stack_level);
if (ret < 0) {
int ret2 = _parse_expression(codegen, branch.compiled_pattern, p_stack_level);
if (ret2 < 0) {
memdelete(id);
memdelete(op);
return ERR_PARSE_ERROR;
}
codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF);
codegen.opcodes.push_back(ret);
codegen.opcodes.push_back(ret2);
codegen.opcodes.push_back(codegen.opcodes.size() + 3);
int continue_addr = codegen.opcodes.size();
codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP);
@ -1401,12 +1401,12 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
codegen.opcodes.push_back(cf->line);
codegen.current_line = cf->line;
#endif
int ret = _parse_expression(codegen, cf->arguments[0], p_stack_level, false);
if (ret < 0)
int ret2 = _parse_expression(codegen, cf->arguments[0], p_stack_level, false);
if (ret2 < 0)
return ERR_PARSE_ERROR;
codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF_NOT);
codegen.opcodes.push_back(ret);
codegen.opcodes.push_back(ret2);
int else_addr = codegen.opcodes.size();
codegen.opcodes.push_back(0); //temporary
@ -1421,9 +1421,9 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
codegen.opcodes.push_back(0);
codegen.opcodes.write[else_addr] = codegen.opcodes.size();
Error err = _parse_block(codegen, cf->body_else, p_stack_level, p_break_addr, p_continue_addr);
if (err)
return err;
Error err2 = _parse_block(codegen, cf->body_else, p_stack_level, p_break_addr, p_continue_addr);
if (err2)
return err2;
codegen.opcodes.write[end_addr] = codegen.opcodes.size();
} else {
@ -1444,14 +1444,14 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
codegen.push_stack_identifiers();
codegen.add_stack_identifier(static_cast<const GDScriptParser::IdentifierNode *>(cf->arguments[0])->name, iter_stack_pos);
int ret = _parse_expression(codegen, cf->arguments[1], slevel, false);
if (ret < 0)
int ret2 = _parse_expression(codegen, cf->arguments[1], slevel, false);
if (ret2 < 0)
return ERR_COMPILATION_FAILED;
//assign container
codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSIGN);
codegen.opcodes.push_back(container_pos);
codegen.opcodes.push_back(ret);
codegen.opcodes.push_back(ret2);
//begin loop
codegen.opcodes.push_back(GDScriptFunction::OPCODE_ITERATE_BEGIN);
@ -1493,11 +1493,11 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
codegen.opcodes.push_back(0);
int continue_addr = codegen.opcodes.size();
int ret = _parse_expression(codegen, cf->arguments[0], p_stack_level, false);
if (ret < 0)
int ret2 = _parse_expression(codegen, cf->arguments[0], p_stack_level, false);
if (ret2 < 0)
return ERR_PARSE_ERROR;
codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF_NOT);
codegen.opcodes.push_back(ret);
codegen.opcodes.push_back(ret2);
codegen.opcodes.push_back(break_addr);
Error err = _parse_block(codegen, cf->body, p_stack_level, break_addr, continue_addr);
if (err)
@ -1533,21 +1533,21 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
} break;
case GDScriptParser::ControlFlowNode::CF_RETURN: {
int ret;
int ret2;
if (cf->arguments.size()) {
ret = _parse_expression(codegen, cf->arguments[0], p_stack_level, false);
if (ret < 0)
ret2 = _parse_expression(codegen, cf->arguments[0], p_stack_level, false);
if (ret2 < 0)
return ERR_PARSE_ERROR;
} else {
ret = GDScriptFunction::ADDR_TYPE_NIL << GDScriptFunction::ADDR_BITS;
ret2 = GDScriptFunction::ADDR_TYPE_NIL << GDScriptFunction::ADDR_BITS;
}
codegen.opcodes.push_back(GDScriptFunction::OPCODE_RETURN);
codegen.opcodes.push_back(ret);
codegen.opcodes.push_back(ret2);
} break;
}
@ -1558,12 +1558,12 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
const GDScriptParser::AssertNode *as = static_cast<const GDScriptParser::AssertNode *>(s);
int ret = _parse_expression(codegen, as->condition, p_stack_level, false);
if (ret < 0)
int ret2 = _parse_expression(codegen, as->condition, p_stack_level, false);
if (ret2 < 0)
return ERR_PARSE_ERROR;
codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSERT);
codegen.opcodes.push_back(ret);
codegen.opcodes.push_back(ret2);
#endif
} break;
case GDScriptParser::Node::TYPE_BREAKPOINT: {
@ -1590,8 +1590,8 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Blo
} break;
default: {
//expression
int ret = _parse_expression(codegen, s, p_stack_level, true);
if (ret < 0)
int ret2 = _parse_expression(codegen, s, p_stack_level, true);
if (ret2 < 0)
return ERR_PARSE_ERROR;
} break;
}
@ -2116,8 +2116,8 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa
instance->owner = E->get();
//needed for hot reloading
for (Map<StringName, GDScript::MemberInfo>::Element *E = p_script->member_indices.front(); E; E = E->next()) {
instance->member_indices_cache[E->key()] = E->get().index;
for (Map<StringName, GDScript::MemberInfo>::Element *F = p_script->member_indices.front(); F; F = F->next()) {
instance->member_indices_cache[F->key()] = F->get().index;
}
instance->owner->set_script_instance(instance);

View File

@ -785,12 +785,12 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
if (mb && mb->is_const()) {
bool all_is_const = true;
Vector<Variant> args;
GDScriptCompletionContext c = p_context;
c.line = op->line;
GDScriptCompletionContext c2 = p_context;
c2.line = op->line;
for (int i = 2; all_is_const && i < op->arguments.size(); i++) {
GDScriptCompletionIdentifier arg;
if (_guess_expression_type(c, op->arguments[i], arg)) {
if (_guess_expression_type(c2, op->arguments[i], arg)) {
if (arg.type.has_type && arg.type.is_constant && arg.value.get_type() != Variant::OBJECT) {
args.push_back(arg.value);
} else {
@ -1282,9 +1282,9 @@ static bool _guess_identifier_type(GDScriptCompletionContext &p_context, const S
for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) {
if (E->get().name == p_context.function->name) {
MethodInfo &mi = E->get();
for (List<PropertyInfo>::Element *E = mi.arguments.front(); E; E = E->next()) {
if (E->get().name == p_identifier) {
r_type = _type_from_property(E->get());
for (List<PropertyInfo>::Element *F = mi.arguments.front(); F; F = F->next()) {
if (F->get().name == p_identifier) {
r_type = _type_from_property(F->get());
return true;
}
}
@ -2237,8 +2237,8 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
if (obj) {
List<String> options;
obj->get_argument_options(p_method, p_argidx, &options);
for (List<String>::Element *E = options.front(); E; E = E->next()) {
r_result.insert(E->get());
for (List<String>::Element *F = options.front(); F; F = F->next()) {
r_result.insert(F->get());
}
}
}
@ -2806,12 +2806,12 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
if (base_type.class_type) {
for (Map<StringName, GDScriptParser::ClassNode::Constant>::Element *E = base_type.class_type->constant_expressions.front(); E; E = E->next()) {
GDScriptCompletionIdentifier constant;
GDScriptCompletionContext c = context;
c._class = base_type.class_type;
c.function = NULL;
c.block = NULL;
c.line = E->value().expression->line;
if (_guess_expression_type(c, E->value().expression, constant)) {
GDScriptCompletionContext c2 = context;
c2._class = base_type.class_type;
c2.function = NULL;
c2.block = NULL;
c2.line = E->value().expression->line;
if (_guess_expression_type(c2, E->value().expression, constant)) {
if (constant.type.has_type && constant.type.is_meta_type) {
options.insert(E->key().operator String());
}

View File

@ -2640,14 +2640,14 @@ void GDScriptParser::_transform_match_statment(MatchNode *p_match_statement) {
local_var->assign = e->value();
local_var->set_datatype(local_var->assign->get_datatype());
IdentifierNode *id = alloc_node<IdentifierNode>();
id->name = local_var->name;
id->declared_block = branch->body;
id->set_datatype(local_var->assign->get_datatype());
IdentifierNode *id2 = alloc_node<IdentifierNode>();
id2->name = local_var->name;
id2->declared_block = branch->body;
id2->set_datatype(local_var->assign->get_datatype());
OperatorNode *op = alloc_node<OperatorNode>();
op->op = OperatorNode::OP_ASSIGN;
op->arguments.push_back(id);
op->arguments.push_back(id2);
op->arguments.push_back(local_var->assign);
branch->body->statements.push_front(op);
@ -2694,9 +2694,9 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
if (pending_newline != -1) {
NewLineNode *nl = alloc_node<NewLineNode>();
nl->line = pending_newline;
p_block->statements.push_back(nl);
NewLineNode *nl2 = alloc_node<NewLineNode>();
nl2->line = pending_newline;
p_block->statements.push_back(nl2);
pending_newline = -1;
}
@ -2735,9 +2735,9 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
return;
}
NewLineNode *nl = alloc_node<NewLineNode>();
nl->line = tokenizer->get_token_line();
p_block->statements.push_back(nl);
NewLineNode *nl2 = alloc_node<NewLineNode>();
nl2->line = tokenizer->get_token_line();
p_block->statements.push_back(nl2);
} break;
case GDScriptTokenizer::TK_CF_PASS: {
@ -2922,14 +2922,14 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
cf_else->cf_type = ControlFlowNode::CF_IF;
//condition
Node *condition = _parse_and_reduce_expression(p_block, p_static);
if (!condition) {
Node *condition2 = _parse_and_reduce_expression(p_block, p_static);
if (!condition2) {
if (_recover_from_completion()) {
break;
}
return;
}
cf_else->arguments.push_back(condition);
cf_else->arguments.push_back(condition2);
cf_else->cf_type = ControlFlowNode::CF_IF;
cf_if->body_else->statements.push_back(cf_else);
@ -2992,8 +2992,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
case GDScriptTokenizer::TK_CF_WHILE: {
tokenizer->advance();
Node *condition = _parse_and_reduce_expression(p_block, p_static);
if (!condition) {
Node *condition2 = _parse_and_reduce_expression(p_block, p_static);
if (!condition2) {
if (_recover_from_completion()) {
break;
}
@ -3003,7 +3003,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
ControlFlowNode *cf_while = alloc_node<ControlFlowNode>();
cf_while->cf_type = ControlFlowNode::CF_WHILE;
cf_while->arguments.push_back(condition);
cf_while->arguments.push_back(condition2);
cf_while->body = alloc_node<BlockNode>();
cf_while->body->parent_block = p_block;
@ -4705,12 +4705,12 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
op->arguments.push_back(subexpr);
#ifdef DEBUG_ENABLED
NewLineNode *nl = alloc_node<NewLineNode>();
nl->line = line;
NewLineNode *nl2 = alloc_node<NewLineNode>();
nl2->line = line;
if (onready)
p_class->ready->statements.push_back(nl);
p_class->ready->statements.push_back(nl2);
else
p_class->initializer->statements.push_back(nl);
p_class->initializer->statements.push_back(nl2);
#endif
if (onready)
p_class->ready->statements.push_back(op);
@ -4732,8 +4732,8 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
ConstantNode *cn = alloc_node<ConstantNode>();
Variant::CallError ce;
cn->value = Variant::construct(member._export.type, NULL, 0, ce);
Variant::CallError ce2;
cn->value = Variant::construct(member._export.type, NULL, 0, ce2);
OperatorNode *op = alloc_node<OperatorNode>();
op->op = OperatorNode::OP_INIT_ASSIGN;
@ -5523,10 +5523,10 @@ GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source,
result.script_type = gds;
found = true;
} else {
Ref<Script> scr = constants[id];
if (scr.is_valid()) {
Ref<Script> scr2 = constants[id];
if (scr2.is_valid()) {
result.kind = DataType::SCRIPT;
result.script_type = scr;
result.script_type = scr2;
found = true;
}
}
@ -6646,7 +6646,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
bool match = false;
List<MethodInfo> constructors;
Variant::get_constructor_list(tn->vtype, &constructors);
PropertyInfo return_type;
PropertyInfo return_type2;
for (List<MethodInfo>::Element *E = constructors.front(); E; E = E->next()) {
MethodInfo &mi = E->get();
@ -6685,13 +6685,13 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
if (types_match) {
match = true;
return_type = mi.return_val;
return_type2 = mi.return_val;
break;
}
}
if (match) {
return _type_from_property(return_type, false);
return _type_from_property(return_type2, false);
} else if (check_types) {
String err = "No constructor of '";
err += Variant::get_type_name(tn->vtype);
@ -7603,7 +7603,7 @@ void GDScriptParser::_check_function_types(FunctionNode *p_function) {
}
parent_signature += " " + p_function->name + "(";
if (arg_types.size()) {
int i = 0;
int j = 0;
for (List<DataType>::Element *E = arg_types.front(); E; E = E->next()) {
if (E != arg_types.front()) {
parent_signature += ", ";
@ -7613,11 +7613,11 @@ void GDScriptParser::_check_function_types(FunctionNode *p_function) {
arg = "Variant";
}
parent_signature += arg;
if (i == arg_types.size() - default_arg_count) {
if (j == arg_types.size() - default_arg_count) {
parent_signature += "=default";
}
i++;
j++;
}
}
parent_signature += ")";

View File

@ -989,11 +989,11 @@ void GDScriptTokenizerText::_advance() {
//built in func?
for (int i = 0; i < GDScriptFunctions::FUNC_MAX; i++) {
for (int j = 0; j < GDScriptFunctions::FUNC_MAX; j++) {
if (str == GDScriptFunctions::get_func_name(GDScriptFunctions::Function(i))) {
if (str == GDScriptFunctions::get_func_name(GDScriptFunctions::Function(j))) {
_make_built_in_func(GDScriptFunctions::Function(i));
_make_built_in_func(GDScriptFunctions::Function(j));
found = true;
break;
}

View File

@ -289,11 +289,11 @@ void GridMapEditor::_update_selection_transform() {
scale *= node->get_cell_size();
pos *= node->get_cell_size();
Transform xf;
xf.basis.scale(scale);
xf.origin = pos;
Transform xf2;
xf2.basis.scale(scale);
xf2.origin = pos;
VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf);
VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf2);
}
}
}

View File

@ -719,13 +719,13 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
// Script::instances are deleted during managed object disposal, which happens on domain finalize.
// Only placeholders are kept. Therefore we need to keep a copy before that happens.
for (Set<Object *>::Element *E = script->instances.front(); E; E = E->next()) {
script->pending_reload_instances.insert(E->get()->get_instance_id());
for (Set<Object *>::Element *F = script->instances.front(); F; F = F->next()) {
script->pending_reload_instances.insert(F->get()->get_instance_id());
}
#ifdef TOOLS_ENABLED
for (Set<PlaceHolderScriptInstance *>::Element *E = script->placeholders.front(); E; E = E->next()) {
script->pending_reload_instances.insert(E->get()->get_owner()->get_instance_id());
for (Set<PlaceHolderScriptInstance *>::Element *F = script->placeholders.front(); F; F = F->next()) {
script->pending_reload_instances.insert(F->get()->get_owner()->get_instance_id());
}
#endif

View File

@ -365,8 +365,8 @@ void BindingsGenerator::_generate_global_constants(List<String> &p_output) {
p_output.push_back(enum_proxy_name);
p_output.push_back("\n" INDENT1 OPEN_BLOCK);
for (const List<ConstantInterface>::Element *E = ienum.constants.front(); E; E = E->next()) {
const ConstantInterface &iconstant = E->get();
for (const List<ConstantInterface>::Element *F = ienum.constants.front(); F; F = F->next()) {
const ConstantInterface &iconstant = F->get();
if (iconstant.const_doc && iconstant.const_doc->description.size()) {
p_output.push_back(INDENT2 "/// <summary>\n");
@ -389,7 +389,7 @@ void BindingsGenerator::_generate_global_constants(List<String> &p_output) {
p_output.push_back(iconstant.proxy_name);
p_output.push_back(" = ");
p_output.push_back(itos(iconstant.value));
p_output.push_back(E != ienum.constants.back() ? ",\n" : "\n");
p_output.push_back(F != ienum.constants.back() ? ",\n" : "\n");
}
p_output.push_back(INDENT1 CLOSE_BLOCK);
@ -472,8 +472,6 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_solution_dir,
String output_dir = output_file.get_base_dir();
if (!DirAccess::exists(output_dir)) {
DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
ERR_FAIL_COND_V(!da, ERR_CANT_CREATE);
Error err = da->make_dir_recursive(ProjectSettings::get_singleton()->globalize_path(output_dir));
ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
}
@ -806,8 +804,8 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.push_back(ienum.cname.operator String());
output.push_back(MEMBER_BEGIN OPEN_BLOCK);
for (const List<ConstantInterface>::Element *E = ienum.constants.front(); E; E = E->next()) {
const ConstantInterface &iconstant = E->get();
for (const List<ConstantInterface>::Element *F = ienum.constants.front(); F; F = F->next()) {
const ConstantInterface &iconstant = F->get();
if (iconstant.const_doc && iconstant.const_doc->description.size()) {
output.push_back(INDENT3 "/// <summary>\n");
@ -830,7 +828,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.push_back(iconstant.proxy_name);
output.push_back(" = ");
output.push_back(itos(iconstant.value));
output.push_back(E != ienum.constants.back() ? ",\n" : "\n");
output.push_back(F != ienum.constants.back() ? ",\n" : "\n");
}
output.push_back(INDENT2 CLOSE_BLOCK);
@ -1889,8 +1887,8 @@ void BindingsGenerator::_populate_object_type_interfaces() {
}
if (!imethod.is_virtual && imethod.name[0] == '_') {
for (const List<PropertyInterface>::Element *E = itype.properties.front(); E; E = E->next()) {
const PropertyInterface &iprop = E->get();
for (const List<PropertyInterface>::Element *F = itype.properties.front(); F; F = F->next()) {
const PropertyInterface &iprop = F->get();
if (iprop.setter == imethod.name || iprop.getter == imethod.name) {
imethod.is_internal = true;
@ -2352,9 +2350,9 @@ void BindingsGenerator::_populate_global_constants() {
if (enum_name != StringName()) {
EnumInterface ienum(enum_name);
List<EnumInterface>::Element *match = global_enums.find(ienum);
if (match) {
match->get().constants.push_back(iconstant);
List<EnumInterface>::Element *enum_match = global_enums.find(ienum);
if (enum_match) {
enum_match->get().constants.push_back(iconstant);
} else {
ienum.constants.push_back(iconstant);
global_enums.push_back(ienum);

View File

@ -194,8 +194,8 @@ Error GodotSharpExport::_get_assembly_dependencies(GDMonoAssembly *p_assembly, c
String path;
bool has_extension = ref_name.ends_with(".dll") || ref_name.ends_with(".exe");
for (int i = 0; i < p_search_dirs.size(); i++) {
const String &search_dir = p_search_dirs[i];
for (int j = 0; j < p_search_dirs.size(); j++) {
const String &search_dir = p_search_dirs[j];
if (has_extension) {
path = search_dir.plus_file(ref_name);

View File

@ -346,7 +346,7 @@ Error ScriptClassParser::_parse_class_base(Vector<String> &r_base) {
bool generic = false;
if (tk == TK_OP_LESS) {
Error err = _skip_generic_type_params();
err = _skip_generic_type_params();
if (err)
return err;
// We don't add it to the base list if it's generic
@ -355,11 +355,11 @@ Error ScriptClassParser::_parse_class_base(Vector<String> &r_base) {
}
if (tk == TK_COMMA) {
Error err = _parse_class_base(r_base);
err = _parse_class_base(r_base);
if (err)
return err;
} else if (tk == TK_IDENTIFIER && String(value) == "where") {
Error err = _parse_type_constraints();
err = _parse_type_constraints();
if (err) {
return err;
}

View File

@ -75,14 +75,14 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
script_binding.wrapper_class = klass;
script_binding.gchandle = MonoGCHandle::create_strong(managed);
Reference *ref = Object::cast_to<Reference>(unmanaged);
if (ref) {
Reference *kref = Object::cast_to<Reference>(unmanaged);
if (kref) {
// Unsafe refcount increment. The managed instance also counts as a reference.
// This way if the unmanaged world has no references to our owner
// but the managed instance is alive, the refcount will be 1 instead of 0.
// See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr)
ref->reference();
kref->reference();
}
// The object was just created, no script instance binding should have been attached
@ -96,8 +96,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
return;
}
Ref<MonoGCHandle> gchandle = ref ? MonoGCHandle::create_weak(managed) :
MonoGCHandle::create_strong(managed);
Ref<MonoGCHandle> gchandle = ref ? MonoGCHandle::create_weak(managed) : MonoGCHandle::create_strong(managed);
Ref<CSharpScript> script = CSharpScript::create_for_managed_type(klass, native);

View File

@ -68,39 +68,39 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) {
} break;
case MONO_TYPE_VALUETYPE: {
GDMonoClass *tclass = p_type.type_class;
GDMonoClass *vtclass = p_type.type_class;
if (tclass == CACHED_CLASS(Vector2))
if (vtclass == CACHED_CLASS(Vector2))
return Variant::VECTOR2;
if (tclass == CACHED_CLASS(Rect2))
if (vtclass == CACHED_CLASS(Rect2))
return Variant::RECT2;
if (tclass == CACHED_CLASS(Transform2D))
if (vtclass == CACHED_CLASS(Transform2D))
return Variant::TRANSFORM2D;
if (tclass == CACHED_CLASS(Vector3))
if (vtclass == CACHED_CLASS(Vector3))
return Variant::VECTOR3;
if (tclass == CACHED_CLASS(Basis))
if (vtclass == CACHED_CLASS(Basis))
return Variant::BASIS;
if (tclass == CACHED_CLASS(Quat))
if (vtclass == CACHED_CLASS(Quat))
return Variant::QUAT;
if (tclass == CACHED_CLASS(Transform))
if (vtclass == CACHED_CLASS(Transform))
return Variant::TRANSFORM;
if (tclass == CACHED_CLASS(AABB))
if (vtclass == CACHED_CLASS(AABB))
return Variant::AABB;
if (tclass == CACHED_CLASS(Color))
if (vtclass == CACHED_CLASS(Color))
return Variant::COLOR;
if (tclass == CACHED_CLASS(Plane))
if (vtclass == CACHED_CLASS(Plane))
return Variant::PLANE;
if (mono_class_is_enum(tclass->get_mono_ptr()))
if (mono_class_is_enum(vtclass->get_mono_ptr()))
return Variant::INT;
} break;
@ -294,60 +294,60 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
} break;
case MONO_TYPE_VALUETYPE: {
GDMonoClass *tclass = p_type.type_class;
GDMonoClass *vtclass = p_type.type_class;
if (tclass == CACHED_CLASS(Vector2)) {
if (vtclass == CACHED_CLASS(Vector2)) {
GDMonoMarshal::M_Vector2 from = MARSHALLED_OUT(Vector2, p_var->operator ::Vector2());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Vector2), &from);
}
if (tclass == CACHED_CLASS(Rect2)) {
if (vtclass == CACHED_CLASS(Rect2)) {
GDMonoMarshal::M_Rect2 from = MARSHALLED_OUT(Rect2, p_var->operator ::Rect2());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Rect2), &from);
}
if (tclass == CACHED_CLASS(Transform2D)) {
if (vtclass == CACHED_CLASS(Transform2D)) {
GDMonoMarshal::M_Transform2D from = MARSHALLED_OUT(Transform2D, p_var->operator ::Transform2D());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Transform2D), &from);
}
if (tclass == CACHED_CLASS(Vector3)) {
if (vtclass == CACHED_CLASS(Vector3)) {
GDMonoMarshal::M_Vector3 from = MARSHALLED_OUT(Vector3, p_var->operator ::Vector3());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Vector3), &from);
}
if (tclass == CACHED_CLASS(Basis)) {
if (vtclass == CACHED_CLASS(Basis)) {
GDMonoMarshal::M_Basis from = MARSHALLED_OUT(Basis, p_var->operator ::Basis());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Basis), &from);
}
if (tclass == CACHED_CLASS(Quat)) {
if (vtclass == CACHED_CLASS(Quat)) {
GDMonoMarshal::M_Quat from = MARSHALLED_OUT(Quat, p_var->operator ::Quat());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Quat), &from);
}
if (tclass == CACHED_CLASS(Transform)) {
if (vtclass == CACHED_CLASS(Transform)) {
GDMonoMarshal::M_Transform from = MARSHALLED_OUT(Transform, p_var->operator ::Transform());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Transform), &from);
}
if (tclass == CACHED_CLASS(AABB)) {
if (vtclass == CACHED_CLASS(AABB)) {
GDMonoMarshal::M_AABB from = MARSHALLED_OUT(AABB, p_var->operator ::AABB());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(AABB), &from);
}
if (tclass == CACHED_CLASS(Color)) {
if (vtclass == CACHED_CLASS(Color)) {
GDMonoMarshal::M_Color from = MARSHALLED_OUT(Color, p_var->operator ::Color());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Color), &from);
}
if (tclass == CACHED_CLASS(Plane)) {
if (vtclass == CACHED_CLASS(Plane)) {
GDMonoMarshal::M_Plane from = MARSHALLED_OUT(Plane, p_var->operator ::Plane());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Plane), &from);
}
if (mono_class_is_enum(tclass->get_mono_ptr())) {
MonoType *enum_basetype = mono_class_enum_basetype(tclass->get_mono_ptr());
if (mono_class_is_enum(vtclass->get_mono_ptr())) {
MonoType *enum_basetype = mono_class_enum_basetype(vtclass->get_mono_ptr());
MonoClass *enum_baseclass = mono_class_from_mono_type(enum_basetype);
switch (mono_type_get_type(enum_basetype)) {
case MONO_TYPE_BOOLEAN: {
@ -624,39 +624,39 @@ Variant mono_object_to_variant(MonoObject *p_obj) {
} break;
case MONO_TYPE_VALUETYPE: {
GDMonoClass *tclass = type.type_class;
GDMonoClass *vtclass = type.type_class;
if (tclass == CACHED_CLASS(Vector2))
if (vtclass == CACHED_CLASS(Vector2))
return MARSHALLED_IN(Vector2, (GDMonoMarshal::M_Vector2 *)mono_object_unbox(p_obj));
if (tclass == CACHED_CLASS(Rect2))
if (vtclass == CACHED_CLASS(Rect2))
return MARSHALLED_IN(Rect2, (GDMonoMarshal::M_Rect2 *)mono_object_unbox(p_obj));
if (tclass == CACHED_CLASS(Transform2D))
if (vtclass == CACHED_CLASS(Transform2D))
return MARSHALLED_IN(Transform2D, (GDMonoMarshal::M_Transform2D *)mono_object_unbox(p_obj));
if (tclass == CACHED_CLASS(Vector3))
if (vtclass == CACHED_CLASS(Vector3))
return MARSHALLED_IN(Vector3, (GDMonoMarshal::M_Vector3 *)mono_object_unbox(p_obj));
if (tclass == CACHED_CLASS(Basis))
if (vtclass == CACHED_CLASS(Basis))
return MARSHALLED_IN(Basis, (GDMonoMarshal::M_Basis *)mono_object_unbox(p_obj));
if (tclass == CACHED_CLASS(Quat))
if (vtclass == CACHED_CLASS(Quat))
return MARSHALLED_IN(Quat, (GDMonoMarshal::M_Quat *)mono_object_unbox(p_obj));
if (tclass == CACHED_CLASS(Transform))
if (vtclass == CACHED_CLASS(Transform))
return MARSHALLED_IN(Transform, (GDMonoMarshal::M_Transform *)mono_object_unbox(p_obj));
if (tclass == CACHED_CLASS(AABB))
if (vtclass == CACHED_CLASS(AABB))
return MARSHALLED_IN(AABB, (GDMonoMarshal::M_AABB *)mono_object_unbox(p_obj));
if (tclass == CACHED_CLASS(Color))
if (vtclass == CACHED_CLASS(Color))
return MARSHALLED_IN(Color, (GDMonoMarshal::M_Color *)mono_object_unbox(p_obj));
if (tclass == CACHED_CLASS(Plane))
if (vtclass == CACHED_CLASS(Plane))
return MARSHALLED_IN(Plane, (GDMonoMarshal::M_Plane *)mono_object_unbox(p_obj));
if (mono_class_is_enum(tclass->get_mono_ptr()))
if (mono_class_is_enum(vtclass->get_mono_ptr()))
return unbox<int32_t>(p_obj);
} break;
@ -740,7 +740,7 @@ Variant mono_object_to_variant(MonoObject *p_obj) {
UNLIKELY_UNHANDLED_EXCEPTION(exc);
if (is_dict) {
MonoException *exc = NULL;
exc = NULL;
MonoObject *ret = type.type_class->get_method("GetPtr")->invoke(p_obj, &exc);
UNLIKELY_UNHANDLED_EXCEPTION(exc);
return *unbox<Dictionary *>(ret);
@ -753,7 +753,7 @@ Variant mono_object_to_variant(MonoObject *p_obj) {
UNLIKELY_UNHANDLED_EXCEPTION(exc);
if (is_array) {
MonoException *exc = NULL;
exc = NULL;
MonoObject *ret = type.type_class->get_method("GetPtr")->invoke(p_obj, &exc);
UNLIKELY_UNHANDLED_EXCEPTION(exc);
return *unbox<Array *>(ret);

View File

@ -66,26 +66,26 @@ void NavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform
PoolVector<int> mesh_indices = a[Mesh::ARRAY_INDEX];
PoolVector<int>::Read ir = mesh_indices.read();
for (int i = 0; i < mesh_vertices.size(); i++) {
_add_vertex(p_xform.xform(vr[i]), p_verticies);
for (int j = 0; j < mesh_vertices.size(); j++) {
_add_vertex(p_xform.xform(vr[j]), p_verticies);
}
for (int i = 0; i < face_count; i++) {
for (int j = 0; j < face_count; j++) {
// CCW
p_indices.push_back(current_vertex_count + (ir[i * 3 + 0]));
p_indices.push_back(current_vertex_count + (ir[i * 3 + 2]));
p_indices.push_back(current_vertex_count + (ir[i * 3 + 1]));
p_indices.push_back(current_vertex_count + (ir[j * 3 + 0]));
p_indices.push_back(current_vertex_count + (ir[j * 3 + 2]));
p_indices.push_back(current_vertex_count + (ir[j * 3 + 1]));
}
} else {
face_count = mesh_vertices.size() / 3;
for (int i = 0; i < face_count; i++) {
_add_vertex(p_xform.xform(vr[i * 3 + 0]), p_verticies);
_add_vertex(p_xform.xform(vr[i * 3 + 2]), p_verticies);
_add_vertex(p_xform.xform(vr[i * 3 + 1]), p_verticies);
for (int j = 0; j < face_count; j++) {
_add_vertex(p_xform.xform(vr[j * 3 + 0]), p_verticies);
_add_vertex(p_xform.xform(vr[j * 3 + 2]), p_verticies);
_add_vertex(p_xform.xform(vr[j * 3 + 1]), p_verticies);
p_indices.push_back(current_vertex_count + (i * 3 + 0));
p_indices.push_back(current_vertex_count + (i * 3 + 1));
p_indices.push_back(current_vertex_count + (i * 3 + 2));
p_indices.push_back(current_vertex_count + (j * 3 + 0));
p_indices.push_back(current_vertex_count + (j * 3 + 1));
p_indices.push_back(current_vertex_count + (j * 3 + 2));
}
}
}

View File

@ -296,8 +296,8 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
if (ogg_sync_pageout(&oy, &og) > 0) {
queue_page(&og); /* demux into the appropriate stream */
} else {
int ret = buffer_data(); /* someone needs more data */
if (ret == 0) {
int ret2 = buffer_data(); /* someone needs more data */
if (ret2 == 0) {
fprintf(stderr, "End of file while searching for codec headers.\n");
clear();
return;

View File

@ -1165,9 +1165,9 @@ void VisualScript::_set_data(const Dictionary &p_data) {
Array nodes = func["nodes"];
for (int i = 0; i < nodes.size(); i += 3) {
for (int j = 0; j < nodes.size(); j += 3) {
add_node(name, nodes[i], nodes[i + 2], nodes[i + 1]);
add_node(name, nodes[j], nodes[j + 2], nodes[j + 1]);
}
Array sequence_connections = func["sequence_connections"];

View File

@ -679,10 +679,10 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
}
str_ofs = cofs; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *expr2 = _parse_expression();
if (!expr2)
return NULL;
dn->dict.push_back(expr);
dn->dict.push_back(expr2);
_get_token(tk);
if (tk.type != TK_COLON) {
@ -690,11 +690,11 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
return NULL;
}
expr = _parse_expression();
if (!expr)
expr2 = _parse_expression();
if (!expr2)
return NULL;
dn->dict.push_back(expr);
dn->dict.push_back(expr2);
cofs = str_ofs;
_get_token(tk);
@ -723,10 +723,10 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
}
str_ofs = cofs; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *expr2 = _parse_expression();
if (!expr2)
return NULL;
an->array.push_back(expr);
an->array.push_back(expr2);
cofs = str_ofs;
_get_token(tk);
@ -807,11 +807,11 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
}
str_ofs = cofs; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *expr2 = _parse_expression();
if (!expr2)
return NULL;
constructor->arguments.push_back(expr);
constructor->arguments.push_back(expr2);
cofs = str_ofs;
_get_token(tk);
@ -848,11 +848,11 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
}
str_ofs = cofs; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *expr2 = _parse_expression();
if (!expr2)
return NULL;
bifunc->arguments.push_back(expr);
bifunc->arguments.push_back(expr2);
cofs = str_ofs;
_get_token(tk);
@ -947,25 +947,25 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
while (true) {
int cofs = str_ofs;
int cofs3 = str_ofs;
_get_token(tk);
if (tk.type == TK_PARENTHESIS_CLOSE) {
break;
}
str_ofs = cofs; //revert
str_ofs = cofs3; //revert
//parse an expression
ENode *expr = _parse_expression();
if (!expr)
ENode *expr2 = _parse_expression();
if (!expr2)
return NULL;
func_call->arguments.push_back(expr);
func_call->arguments.push_back(expr2);
cofs = str_ofs;
cofs3 = str_ofs;
_get_token(tk);
if (tk.type == TK_COMMA) {
//all good
} else if (tk.type == TK_PARENTHESIS_CLOSE) {
str_ofs = cofs;
str_ofs = cofs3;
} else {
_set_error("Expected ',' or ')'");
}
@ -1426,8 +1426,8 @@ public:
for (int i = 0; i < call->arguments.size(); i++) {
Variant value;
bool ret = _execute(p_inputs, call->arguments[i], value, r_error_str, ce);
if (ret)
bool ret2 = _execute(p_inputs, call->arguments[i], value, r_error_str, ce);
if (ret2)
return true;
arr.write[i] = value;
argp.write[i] = &arr[i];

View File

@ -514,26 +514,26 @@ void VisualScriptPropertySelector::_item_selected() {
if (names->find(name) != NULL) {
Ref<VisualScriptOperator> operator_node = VisualScriptLanguage::singleton->create_node_from_name(name);
if (operator_node.is_valid()) {
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(operator_node->get_class_name());
if (E) {
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(operator_node->get_class_name());
if (F) {
text = Variant::get_operator_name(operator_node->get_operator());
}
}
Ref<VisualScriptTypeCast> typecast_node = VisualScriptLanguage::singleton->create_node_from_name(name);
if (typecast_node.is_valid()) {
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(typecast_node->get_class_name());
if (E) {
text = E->get().description;
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(typecast_node->get_class_name());
if (F) {
text = F->get().description;
}
}
Ref<VisualScriptBuiltinFunc> builtin_node = VisualScriptLanguage::singleton->create_node_from_name(name);
if (builtin_node.is_valid()) {
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(builtin_node->get_class_name());
if (E) {
for (int i = 0; i < E->get().constants.size(); i++) {
if (E->get().constants[i].value.to_int() == int(builtin_node->get_func())) {
text = E->get().constants[i].description;
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(builtin_node->get_class_name());
if (F) {
for (int i = 0; i < F->get().constants.size(); i++) {
if (F->get().constants[i].value.to_int() == int(builtin_node->get_func())) {
text = F->get().constants[i].description;
}
}
}

View File

@ -144,9 +144,9 @@ int LWSClient::_handle_cb(struct lws *wsi, enum lws_callback_reasons reason, voi
case LWS_CALLBACK_WS_PEER_INITIATED_CLOSE: {
int code;
String reason = peer->get_close_reason(in, len, code);
String reason2 = peer->get_close_reason(in, len, code);
peer_data->clean_close = true;
_on_close_request(code, reason);
_on_close_request(code, reason2);
return 0;
}

View File

@ -109,9 +109,9 @@ int LWSServer::_handle_cb(struct lws *wsi, enum lws_callback_reasons reason, voi
if (_peer_map.has(id)) {
int code;
Ref<LWSPeer> peer = _peer_map[id];
String reason = peer->get_close_reason(in, len, code);
String reason2 = peer->get_close_reason(in, len, code);
peer_data->clean_close = true;
_on_close_request(id, code, reason);
_on_close_request(id, code, reason2);
}
return 0;
}

View File

@ -301,10 +301,10 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
args.push_back(d.id);
args.push_back("shell");
args.push_back("getprop");
int ec;
int ec2;
String dp;
OS::get_singleton()->execute(adb, args, true, NULL, &dp, &ec);
OS::get_singleton()->execute(adb, args, true, NULL, &dp, &ec2);
Vector<String> props = dp.split("\n");
String vendor;

View File

@ -2,7 +2,7 @@ import os
import platform
import sys
from compat import decode_utf8
from methods import get_compiler_version
def is_active():
return True
@ -161,18 +161,11 @@ def configure(env):
env.Append(CCFLAGS=['-pipe'])
env.Append(LINKFLAGS=['-pipe'])
# Check for gcc version > 5 before adding -no-pie
import re
import subprocess
proc = subprocess.Popen([env['CXX'], '--version'], stdout=subprocess.PIPE)
(stdout, _) = proc.communicate()
stdout = decode_utf8(stdout)
match = re.search('[0-9][0-9.]*', stdout)
if match is not None:
version = match.group().split('.')
if (version[0] > '5'):
env.Append(CCFLAGS=['-fpie'])
env.Append(LINKFLAGS=['-no-pie'])
# Check for gcc version >= 6 before adding -no-pie
version = get_compiler_version(env)
if version != None and version[0] > '6':
env.Append(CCFLAGS=['-fpie'])
env.Append(LINKFLAGS=['-no-pie'])
## Dependencies

View File

@ -276,9 +276,9 @@ void SpriteFrames::_set_animations(const Array &p_animations) {
anim.speed = d["speed"];
anim.loop = d["loop"];
Array frames = d["frames"];
for (int i = 0; i < frames.size(); i++) {
for (int j = 0; j < frames.size(); j++) {
RES res = frames[i];
RES res = frames[j];
anim.frames.push_back(res);
}

View File

@ -75,15 +75,15 @@ void TileMap::_notification(int p_what) {
Quadrant &q = E->get();
if (navigation) {
for (Map<PosKey, Quadrant::NavPoly>::Element *E = q.navpoly_ids.front(); E; E = E->next()) {
for (Map<PosKey, Quadrant::NavPoly>::Element *F = q.navpoly_ids.front(); F; F = F->next()) {
navigation->navpoly_remove(E->get().id);
navigation->navpoly_remove(F->get().id);
}
q.navpoly_ids.clear();
}
for (Map<PosKey, Quadrant::Occluder>::Element *E = q.occluder_instances.front(); E; E = E->next()) {
VS::get_singleton()->free(E->get().id);
for (Map<PosKey, Quadrant::Occluder>::Element *F = q.occluder_instances.front(); F; F = F->next()) {
VS::get_singleton()->free(F->get().id);
}
q.occluder_instances.clear();
}
@ -129,14 +129,14 @@ void TileMap::_update_quadrant_transform() {
Physics2DServer::get_singleton()->body_set_state(q.body, Physics2DServer::BODY_STATE_TRANSFORM, xform);
if (navigation) {
for (Map<PosKey, Quadrant::NavPoly>::Element *E = q.navpoly_ids.front(); E; E = E->next()) {
for (Map<PosKey, Quadrant::NavPoly>::Element *F = q.navpoly_ids.front(); F; F = F->next()) {
navigation->navpoly_set_transform(E->get().id, nav_rel * E->get().xform);
navigation->navpoly_set_transform(F->get().id, nav_rel * F->get().xform);
}
}
for (Map<PosKey, Quadrant::Occluder>::Element *E = q.occluder_instances.front(); E; E = E->next()) {
VS::get_singleton()->canvas_light_occluder_set_transform(E->get().id, global_transform * E->get().xform);
for (Map<PosKey, Quadrant::Occluder>::Element *F = q.occluder_instances.front(); F; F = F->next()) {
VS::get_singleton()->canvas_light_occluder_set_transform(F->get().id, global_transform * F->get().xform);
}
}
}
@ -462,18 +462,18 @@ void TileMap::update_dirty_quadrants() {
Vector<TileSet::ShapeData> shapes = tile_set->tile_get_shapes(c.id);
for (int i = 0; i < shapes.size(); i++) {
Ref<Shape2D> shape = shapes[i].shape;
for (int j = 0; j < shapes.size(); j++) {
Ref<Shape2D> shape = shapes[j].shape;
if (shape.is_valid()) {
if (tile_set->tile_get_tile_mode(c.id) == TileSet::SINGLE_TILE || (shapes[i].autotile_coord.x == c.autotile_coord_x && shapes[i].autotile_coord.y == c.autotile_coord_y)) {
if (tile_set->tile_get_tile_mode(c.id) == TileSet::SINGLE_TILE || (shapes[j].autotile_coord.x == c.autotile_coord_x && shapes[j].autotile_coord.y == c.autotile_coord_y)) {
Transform2D xform;
xform.set_origin(offset.floor());
Vector2 shape_ofs = shapes[i].shape_transform.get_origin();
Vector2 shape_ofs = shapes[j].shape_transform.get_origin();
_fix_cell_transform(xform, c, shape_ofs + center_ofs, s);
xform *= shapes[i].shape_transform.untranslated();
xform *= shapes[j].shape_transform.untranslated();
if (debug_canvas_item.is_valid()) {
vs->canvas_item_add_set_transform(debug_canvas_item, xform);
@ -481,7 +481,7 @@ void TileMap::update_dirty_quadrants() {
}
ps->body_add_shape(q.body, shape->get_rid(), xform);
ps->body_set_shape_metadata(q.body, shape_idx, Vector2(E->key().x, E->key().y));
ps->body_set_shape_as_one_way_collision(q.body, shape_idx, shapes[i].one_way_collision, shapes[i].one_way_collision_margin);
ps->body_set_shape_as_one_way_collision(q.body, shape_idx, shapes[j].one_way_collision, shapes[j].one_way_collision_margin);
shape_idx++;
}
}
@ -531,23 +531,23 @@ void TileMap::update_dirty_quadrants() {
colors.resize(vsize);
{
PoolVector<Vector2>::Read vr = navigation_polygon_vertices.read();
for (int i = 0; i < vsize; i++) {
vertices.write[i] = vr[i];
colors.write[i] = debug_navigation_color;
for (int j = 0; j < vsize; j++) {
vertices.write[j] = vr[j];
colors.write[j] = debug_navigation_color;
}
}
Vector<int> indices;
for (int i = 0; i < navpoly->get_polygon_count(); i++) {
Vector<int> polygon = navpoly->get_polygon(i);
for (int j = 0; j < navpoly->get_polygon_count(); j++) {
Vector<int> polygon = navpoly->get_polygon(j);
for (int j = 2; j < polygon.size(); j++) {
for (int k = 2; k < polygon.size(); k++) {
int kofs[3] = { 0, j - 1, j };
for (int k = 0; k < 3; k++) {
int kofs[3] = { 0, k - 1, k };
for (int l = 0; l < 3; l++) {
int idx = polygon[kofs[k]];
int idx = polygon[kofs[l]];
ERR_FAIL_INDEX(idx, vsize);
indices.push_back(idx);
}
@ -601,9 +601,9 @@ void TileMap::update_dirty_quadrants() {
for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
Quadrant &q = E->get();
for (List<RID>::Element *E = q.canvas_items.front(); E; E = E->next()) {
for (List<RID>::Element *F = q.canvas_items.front(); F; F = F->next()) {
VS::get_singleton()->canvas_item_set_draw_index(E->get(), index++);
VS::get_singleton()->canvas_item_set_draw_index(F->get(), index++);
}
}
@ -1053,9 +1053,9 @@ void TileMap::_update_all_items_material_state() {
for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) {
Quadrant &q = E->get();
for (List<RID>::Element *E = q.canvas_items.front(); E; E = E->next()) {
for (List<RID>::Element *F = q.canvas_items.front(); F; F = F->next()) {
_update_item_material_state(E->get());
_update_item_material_state(F->get());
}
}
}

View File

@ -422,20 +422,20 @@ void AudioStreamPlayer3D::_notification(int p_what) {
if (cc >= 3) {
// Side pair
float sl = Math::abs(1.0 - Math::abs(-0.4 - av));
float sr = Math::abs(1.0 - Math::abs(0.4 - av));
float sleft = Math::abs(1.0 - Math::abs(-0.4 - av));
float sright = Math::abs(1.0 - Math::abs(0.4 - av));
output.vol[2].l = sl;
output.vol[2].r = sr;
output.vol[2].l = sleft;
output.vol[2].r = sright;
}
if (cc >= 4) {
// Rear pair
float rl = Math::abs(1.0 - Math::abs(-0.2 - av));
float rr = Math::abs(1.0 - Math::abs(0.2 - av));
float rleft = Math::abs(1.0 - Math::abs(-0.2 - av));
float rright = Math::abs(1.0 - Math::abs(0.2 - av));
output.vol[3].l = rl;
output.vol[3].r = rr;
output.vol[3].l = rleft;
output.vol[3].r = rright;
}
}

View File

@ -292,11 +292,11 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
if (ek.from < ek.to)
SWAP(ek.from, ek.to);
Map<_EdgeKey, bool>::Element *E = edge_map.find(ek);
Map<_EdgeKey, bool>::Element *F = edge_map.find(ek);
if (E) {
if (F) {
E->get() = false;
F->get() = false;
} else {

View File

@ -126,7 +126,6 @@ void PathFollow::_update_transform() {
if (rotation_mode == ROTATION_ORIENTED) {
Vector3 pos = c->interpolate_baked(o, cubic);
Vector3 forward = c->interpolate_baked(o_next, cubic) - pos;
if (forward.length_squared() < CMP_EPSILON2)

Some files were not shown because too many files have changed in this diff Show More