Style: Apply clang-tidy's readability-braces-around-statements
This commit is contained in:
parent
9bbe51dc27
commit
d83761ba80
32 changed files with 308 additions and 165 deletions
|
|
@ -260,8 +260,9 @@ T EditorSceneImporterFBX::_interpolate_track(const Vector<float> &p_times, const
|
|||
//could use binary search, worth it?
|
||||
int idx = -1;
|
||||
for (int i = 0; i < p_times.size(); i++) {
|
||||
if (p_times[i] > p_time)
|
||||
if (p_times[i] > p_time) {
|
||||
break;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
|
|
@ -610,8 +611,9 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
|
|||
for (const FBXDocParser::Geometry *mesh : geometry) {
|
||||
print_verbose("[doc] [" + itos(mesh->ID()) + "] mesh: " + fbx_node->node_name);
|
||||
|
||||
if (mesh == nullptr)
|
||||
if (mesh == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const FBXDocParser::MeshGeometry *mesh_geometry = dynamic_cast<const FBXDocParser::MeshGeometry *>(mesh);
|
||||
if (mesh_geometry) {
|
||||
|
|
|
|||
|
|
@ -264,8 +264,9 @@ struct Getter {
|
|||
le = !le;
|
||||
if (le) {
|
||||
ByteSwapper<T, (sizeof(T) > 1 ? true : false)>()(inout);
|
||||
} else
|
||||
} else {
|
||||
ByteSwapper<T, false>()(inout);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -215,8 +215,9 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const {
|
|||
// Loop through all the lazy properties (which is all the properties)
|
||||
for (const LazyPropertyMap::value_type &element : lazyProps) {
|
||||
// Skip parsed properties
|
||||
if (props.end() != props.find(element.first))
|
||||
if (props.end() != props.find(element.first)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read the element's value.
|
||||
// Wrap the naked pointer (since the call site is required to acquire ownership)
|
||||
|
|
@ -224,8 +225,9 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const {
|
|||
Property *prop = ReadTypedProperty(element.second);
|
||||
|
||||
// Element could not be read. Skip it.
|
||||
if (!prop)
|
||||
if (!prop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add to result
|
||||
result[element.first] = prop;
|
||||
|
|
|
|||
|
|
@ -122,8 +122,9 @@ static const uint8_t base64DecodeTable[128] = {
|
|||
|
||||
uint8_t DecodeBase64(char ch) {
|
||||
const auto idx = static_cast<uint8_t>(ch);
|
||||
if (idx > 127)
|
||||
if (idx > 127) {
|
||||
return 255;
|
||||
}
|
||||
return base64DecodeTable[idx];
|
||||
}
|
||||
|
||||
|
|
@ -211,8 +212,9 @@ std::string EncodeBase64(const char *data, size_t length) {
|
|||
EncodeByteBlock(&finalBytes[0], encoded_string, iEncodedByte);
|
||||
|
||||
// add '=' at the end
|
||||
for (size_t i = 0; i < 4 * extraBytes / 3; i++)
|
||||
for (size_t i = 0; i < 4 * extraBytes / 3; i++) {
|
||||
encoded_string[encodedBytes - i - 1] = '=';
|
||||
}
|
||||
}
|
||||
return encoded_string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,8 +65,9 @@ protected:
|
|||
Error err;
|
||||
FileAccess *file = FileAccess::open(path, FileAccess::WRITE, &err);
|
||||
if (!file || err) {
|
||||
if (file)
|
||||
if (file) {
|
||||
memdelete(file);
|
||||
}
|
||||
print_error("ValidationTracker Error - failed to create file - path: %s\n" + path);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,64 +163,72 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator {
|
|||
}
|
||||
|
||||
int get_constant_pos(const Variant &p_constant) {
|
||||
if (constant_map.has(p_constant))
|
||||
if (constant_map.has(p_constant)) {
|
||||
return constant_map[p_constant];
|
||||
}
|
||||
int pos = constant_map.size();
|
||||
constant_map[p_constant] = pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int get_operation_pos(const Variant::ValidatedOperatorEvaluator p_operation) {
|
||||
if (operator_func_map.has(p_operation))
|
||||
if (operator_func_map.has(p_operation)) {
|
||||
return operator_func_map[p_operation];
|
||||
}
|
||||
int pos = operator_func_map.size();
|
||||
operator_func_map[p_operation] = pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int get_setter_pos(const Variant::ValidatedSetter p_setter) {
|
||||
if (setters_map.has(p_setter))
|
||||
if (setters_map.has(p_setter)) {
|
||||
return setters_map[p_setter];
|
||||
}
|
||||
int pos = setters_map.size();
|
||||
setters_map[p_setter] = pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int get_getter_pos(const Variant::ValidatedGetter p_getter) {
|
||||
if (getters_map.has(p_getter))
|
||||
if (getters_map.has(p_getter)) {
|
||||
return getters_map[p_getter];
|
||||
}
|
||||
int pos = getters_map.size();
|
||||
getters_map[p_getter] = pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int get_keyed_setter_pos(const Variant::ValidatedKeyedSetter p_keyed_setter) {
|
||||
if (keyed_setters_map.has(p_keyed_setter))
|
||||
if (keyed_setters_map.has(p_keyed_setter)) {
|
||||
return keyed_setters_map[p_keyed_setter];
|
||||
}
|
||||
int pos = keyed_setters_map.size();
|
||||
keyed_setters_map[p_keyed_setter] = pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int get_keyed_getter_pos(const Variant::ValidatedKeyedGetter p_keyed_getter) {
|
||||
if (keyed_getters_map.has(p_keyed_getter))
|
||||
if (keyed_getters_map.has(p_keyed_getter)) {
|
||||
return keyed_getters_map[p_keyed_getter];
|
||||
}
|
||||
int pos = keyed_getters_map.size();
|
||||
keyed_getters_map[p_keyed_getter] = pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int get_indexed_setter_pos(const Variant::ValidatedIndexedSetter p_indexed_setter) {
|
||||
if (indexed_setters_map.has(p_indexed_setter))
|
||||
if (indexed_setters_map.has(p_indexed_setter)) {
|
||||
return indexed_setters_map[p_indexed_setter];
|
||||
}
|
||||
int pos = indexed_setters_map.size();
|
||||
indexed_setters_map[p_indexed_setter] = pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int get_indexed_getter_pos(const Variant::ValidatedIndexedGetter p_indexed_getter) {
|
||||
if (indexed_getters_map.has(p_indexed_getter))
|
||||
if (indexed_getters_map.has(p_indexed_getter)) {
|
||||
return indexed_getters_map[p_indexed_getter];
|
||||
}
|
||||
int pos = indexed_getters_map.size();
|
||||
indexed_getters_map[p_indexed_getter] = pos;
|
||||
return pos;
|
||||
|
|
@ -272,8 +280,9 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator {
|
|||
}
|
||||
|
||||
void alloc_stack(int p_level) {
|
||||
if (p_level >= stack_max)
|
||||
if (p_level >= stack_max) {
|
||||
stack_max = p_level + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int increase_stack() {
|
||||
|
|
@ -283,8 +292,9 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator {
|
|||
}
|
||||
|
||||
void alloc_ptrcall(int p_params) {
|
||||
if (p_params >= ptrcall_max)
|
||||
if (p_params >= ptrcall_max) {
|
||||
ptrcall_max = p_params;
|
||||
}
|
||||
}
|
||||
|
||||
int address_of(const Address &p_address) {
|
||||
|
|
|
|||
|
|
@ -393,8 +393,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
|
||||
text += Variant::get_type_name(t) + "(";
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(i + 1);
|
||||
}
|
||||
text += ")";
|
||||
|
|
@ -410,8 +411,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
|
||||
text += "<unkown type>(";
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(i + 1);
|
||||
}
|
||||
text += ")";
|
||||
|
|
@ -425,8 +427,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += " = [";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
|
||||
|
|
@ -458,8 +461,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += " = [";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
|
||||
|
|
@ -474,8 +478,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += " = {";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i * 2 + 0);
|
||||
text += ": ";
|
||||
text += DADDR(1 + i * 2 + 1);
|
||||
|
|
@ -509,8 +514,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += "(";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
|
|
@ -539,8 +545,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += "(";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
|
|
@ -559,8 +566,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += "(";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
|
|
@ -636,8 +644,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += "(";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
|
|
@ -654,8 +663,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += "(";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
|
|
@ -672,8 +682,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += "(";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
|
|
@ -690,8 +701,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += "(";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
|
|
@ -708,8 +720,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
|||
text += "(";
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
|
|
|
|||
|
|
@ -940,22 +940,29 @@ String GLTFDocument::_get_accessor_type_name(const GLTFDocument::GLTFType p_type
|
|||
}
|
||||
|
||||
GLTFDocument::GLTFType GLTFDocument::_get_type_from_str(const String &p_string) {
|
||||
if (p_string == "SCALAR")
|
||||
if (p_string == "SCALAR") {
|
||||
return GLTFDocument::TYPE_SCALAR;
|
||||
}
|
||||
|
||||
if (p_string == "VEC2")
|
||||
if (p_string == "VEC2") {
|
||||
return GLTFDocument::TYPE_VEC2;
|
||||
if (p_string == "VEC3")
|
||||
}
|
||||
if (p_string == "VEC3") {
|
||||
return GLTFDocument::TYPE_VEC3;
|
||||
if (p_string == "VEC4")
|
||||
}
|
||||
if (p_string == "VEC4") {
|
||||
return GLTFDocument::TYPE_VEC4;
|
||||
}
|
||||
|
||||
if (p_string == "MAT2")
|
||||
if (p_string == "MAT2") {
|
||||
return GLTFDocument::TYPE_MAT2;
|
||||
if (p_string == "MAT3")
|
||||
}
|
||||
if (p_string == "MAT3") {
|
||||
return GLTFDocument::TYPE_MAT3;
|
||||
if (p_string == "MAT4")
|
||||
}
|
||||
if (p_string == "MAT4") {
|
||||
return GLTFDocument::TYPE_MAT4;
|
||||
}
|
||||
|
||||
ERR_FAIL_V(GLTFDocument::TYPE_SCALAR);
|
||||
}
|
||||
|
|
@ -1434,8 +1441,9 @@ Vector<double> GLTFDocument::_decode_accessor(Ref<GLTFState> state, const GLTFAc
|
|||
ERR_FAIL_INDEX_V(a->buffer_view, state->buffer_views.size(), Vector<double>());
|
||||
|
||||
const Error err = _decode_buffer_view(state, dst, a->buffer_view, skip_every, skip_bytes, element_size, a->count, a->type, component_count, a->component_type, component_size, a->normalized, a->byte_offset, p_for_vertex);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Vector<double>();
|
||||
}
|
||||
} else {
|
||||
//fill with zeros, as bufferview is not defined.
|
||||
for (int i = 0; i < (a->count * component_count); i++) {
|
||||
|
|
@ -1450,14 +1458,16 @@ Vector<double> GLTFDocument::_decode_accessor(Ref<GLTFState> state, const GLTFAc
|
|||
const int indices_component_size = _get_component_type_size(a->sparse_indices_component_type);
|
||||
|
||||
Error err = _decode_buffer_view(state, indices.ptrw(), a->sparse_indices_buffer_view, 0, 0, indices_component_size, a->sparse_count, TYPE_SCALAR, 1, a->sparse_indices_component_type, indices_component_size, false, a->sparse_indices_byte_offset, false);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Vector<double>();
|
||||
}
|
||||
|
||||
Vector<double> data;
|
||||
data.resize(component_count * a->sparse_count);
|
||||
err = _decode_buffer_view(state, data.ptrw(), a->sparse_values_buffer_view, skip_every, skip_bytes, element_size, a->sparse_count, a->type, component_count, a->component_type, component_size, a->normalized, a->sparse_values_byte_offset, p_for_vertex);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Vector<double>();
|
||||
}
|
||||
|
||||
for (int i = 0; i < indices.size(); i++) {
|
||||
const int write_offset = int(indices[i]) * component_count;
|
||||
|
|
@ -1528,8 +1538,9 @@ Vector<int> GLTFDocument::_decode_accessor_as_ints(Ref<GLTFState> state, const G
|
|||
const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex);
|
||||
Vector<int> ret;
|
||||
|
||||
if (attribs.size() == 0)
|
||||
if (attribs.size() == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
const double *attribs_ptr = attribs.ptr();
|
||||
const int ret_size = attribs.size();
|
||||
|
|
@ -1546,8 +1557,9 @@ Vector<float> GLTFDocument::_decode_accessor_as_floats(Ref<GLTFState> state, con
|
|||
const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex);
|
||||
Vector<float> ret;
|
||||
|
||||
if (attribs.size() == 0)
|
||||
if (attribs.size() == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
const double *attribs_ptr = attribs.ptr();
|
||||
const int ret_size = attribs.size();
|
||||
|
|
@ -1820,8 +1832,9 @@ Vector<Vector2> GLTFDocument::_decode_accessor_as_vec2(Ref<GLTFState> state, con
|
|||
const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex);
|
||||
Vector<Vector2> ret;
|
||||
|
||||
if (attribs.size() == 0)
|
||||
if (attribs.size() == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(attribs.size() % 2 != 0, ret);
|
||||
const double *attribs_ptr = attribs.ptr();
|
||||
|
|
@ -1998,8 +2011,9 @@ Vector<Vector3> GLTFDocument::_decode_accessor_as_vec3(Ref<GLTFState> state, con
|
|||
const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex);
|
||||
Vector<Vector3> ret;
|
||||
|
||||
if (attribs.size() == 0)
|
||||
if (attribs.size() == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(attribs.size() % 3 != 0, ret);
|
||||
const double *attribs_ptr = attribs.ptr();
|
||||
|
|
@ -2017,8 +2031,9 @@ Vector<Color> GLTFDocument::_decode_accessor_as_color(Ref<GLTFState> state, cons
|
|||
const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex);
|
||||
Vector<Color> ret;
|
||||
|
||||
if (attribs.size() == 0)
|
||||
if (attribs.size() == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
const int type = state->accessors[p_accessor]->type;
|
||||
ERR_FAIL_COND_V(!(type == TYPE_VEC3 || type == TYPE_VEC4), ret);
|
||||
|
|
@ -2042,8 +2057,9 @@ Vector<Quat> GLTFDocument::_decode_accessor_as_quat(Ref<GLTFState> state, const
|
|||
const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex);
|
||||
Vector<Quat> ret;
|
||||
|
||||
if (attribs.size() == 0)
|
||||
if (attribs.size() == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(attribs.size() % 4 != 0, ret);
|
||||
const double *attribs_ptr = attribs.ptr();
|
||||
|
|
@ -2060,8 +2076,9 @@ Vector<Transform2D> GLTFDocument::_decode_accessor_as_xform2d(Ref<GLTFState> sta
|
|||
const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex);
|
||||
Vector<Transform2D> ret;
|
||||
|
||||
if (attribs.size() == 0)
|
||||
if (attribs.size() == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(attribs.size() % 4 != 0, ret);
|
||||
ret.resize(attribs.size() / 4);
|
||||
|
|
@ -2076,8 +2093,9 @@ Vector<Basis> GLTFDocument::_decode_accessor_as_basis(Ref<GLTFState> state, cons
|
|||
const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex);
|
||||
Vector<Basis> ret;
|
||||
|
||||
if (attribs.size() == 0)
|
||||
if (attribs.size() == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(attribs.size() % 9 != 0, ret);
|
||||
ret.resize(attribs.size() / 9);
|
||||
|
|
@ -2093,8 +2111,9 @@ Vector<Transform> GLTFDocument::_decode_accessor_as_xform(Ref<GLTFState> state,
|
|||
const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex);
|
||||
Vector<Transform> ret;
|
||||
|
||||
if (attribs.size() == 0)
|
||||
if (attribs.size() == 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(attribs.size() % 16 != 0, ret);
|
||||
ret.resize(attribs.size() / 16);
|
||||
|
|
@ -3046,8 +3065,9 @@ Error GLTFDocument::_serialize_textures(Ref<GLTFState> state) {
|
|||
}
|
||||
|
||||
Error GLTFDocument::_parse_textures(Ref<GLTFState> state) {
|
||||
if (!state->json.has("textures"))
|
||||
if (!state->json.has("textures")) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
const Array &textures = state->json["textures"];
|
||||
for (GLTFTextureIndex i = 0; i < textures.size(); i++) {
|
||||
|
|
@ -3340,8 +3360,9 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> state) {
|
|||
}
|
||||
|
||||
Error GLTFDocument::_parse_materials(Ref<GLTFState> state) {
|
||||
if (!state->json.has("materials"))
|
||||
if (!state->json.has("materials")) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
const Array &materials = state->json["materials"];
|
||||
for (GLTFMaterialIndex i = 0; i < materials.size(); i++) {
|
||||
|
|
@ -3858,8 +3879,9 @@ Error GLTFDocument::_verify_skin(Ref<GLTFState> state, Ref<GLTFSkin> skin) {
|
|||
}
|
||||
|
||||
Error GLTFDocument::_parse_skins(Ref<GLTFState> state) {
|
||||
if (!state->json.has("skins"))
|
||||
if (!state->json.has("skins")) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
const Array &skins = state->json["skins"];
|
||||
|
||||
|
|
@ -4108,8 +4130,9 @@ Error GLTFDocument::_reparent_to_fake_joint(Ref<GLTFState> state, Ref<GLTFSkelet
|
|||
state->nodes.push_back(fake_joint);
|
||||
|
||||
// We better not be a joint, or we messed up in our logic
|
||||
if (node->joint)
|
||||
if (node->joint) {
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
fake_joint->translation = node->translation;
|
||||
fake_joint->rotation = node->rotation;
|
||||
|
|
@ -4528,8 +4551,9 @@ Error GLTFDocument::_parse_lights(Ref<GLTFState> state) {
|
|||
}
|
||||
|
||||
Error GLTFDocument::_parse_cameras(Ref<GLTFState> state) {
|
||||
if (!state->json.has("cameras"))
|
||||
if (!state->json.has("cameras")) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
const Array cameras = state->json["cameras"];
|
||||
|
||||
|
|
@ -4730,8 +4754,9 @@ Error GLTFDocument::_serialize_animations(Ref<GLTFState> state) {
|
|||
}
|
||||
|
||||
Error GLTFDocument::_parse_animations(Ref<GLTFState> state) {
|
||||
if (!state->json.has("animations"))
|
||||
if (!state->json.has("animations")) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
const Array &animations = state->json["animations"];
|
||||
|
||||
|
|
@ -4741,8 +4766,9 @@ Error GLTFDocument::_parse_animations(Ref<GLTFState> state) {
|
|||
Ref<GLTFAnimation> animation;
|
||||
animation.instance();
|
||||
|
||||
if (!d.has("channels") || !d.has("samplers"))
|
||||
if (!d.has("channels") || !d.has("samplers")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Array channels = d["channels"];
|
||||
Array samplers = d["samplers"];
|
||||
|
|
@ -4757,8 +4783,9 @@ Error GLTFDocument::_parse_animations(Ref<GLTFState> state) {
|
|||
|
||||
for (int j = 0; j < channels.size(); j++) {
|
||||
const Dictionary &c = channels[j];
|
||||
if (!c.has("target"))
|
||||
if (!c.has("target")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Dictionary &t = c["target"];
|
||||
if (!t.has("node") || !t.has("path")) {
|
||||
|
|
@ -4868,8 +4895,9 @@ void GLTFDocument::_assign_scene_names(Ref<GLTFState> state) {
|
|||
Ref<GLTFNode> n = state->nodes[i];
|
||||
|
||||
// Any joints get unique names generated when the skeleton is made, unique to the skeleton
|
||||
if (n->skeleton >= 0)
|
||||
if (n->skeleton >= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (n->get_name().is_empty()) {
|
||||
if (n->mesh >= 0) {
|
||||
|
|
@ -5515,8 +5543,9 @@ T GLTFDocument::_interpolate_track(const Vector<float> &p_times, const Vector<T>
|
|||
//could use binary search, worth it?
|
||||
int idx = -1;
|
||||
for (int i = 0; i < p_times.size(); i++) {
|
||||
if (p_times[i] > p_time)
|
||||
if (p_times[i] > p_time) {
|
||||
break;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
|
|
@ -6356,13 +6385,15 @@ Error GLTFDocument::parse(Ref<GLTFState> state, String p_path, bool p_read_binar
|
|||
//binary file
|
||||
//text file
|
||||
err = _parse_glb(p_path, state);
|
||||
if (err)
|
||||
if (err) {
|
||||
return FAILED;
|
||||
}
|
||||
} else {
|
||||
//text file
|
||||
err = _parse_json(p_path, state);
|
||||
if (err)
|
||||
if (err) {
|
||||
return FAILED;
|
||||
}
|
||||
}
|
||||
f->close();
|
||||
|
||||
|
|
@ -6382,68 +6413,81 @@ Error GLTFDocument::parse(Ref<GLTFState> state, String p_path, bool p_read_binar
|
|||
|
||||
/* STEP 0 PARSE SCENE */
|
||||
err = _parse_scenes(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 1 PARSE NODES */
|
||||
err = _parse_nodes(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 2 PARSE BUFFERS */
|
||||
err = _parse_buffers(state, p_path.get_base_dir());
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 3 PARSE BUFFER VIEWS */
|
||||
err = _parse_buffer_views(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 4 PARSE ACCESSORS */
|
||||
err = _parse_accessors(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 5 PARSE IMAGES */
|
||||
err = _parse_images(state, p_path.get_base_dir());
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 6 PARSE TEXTURES */
|
||||
err = _parse_textures(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 7 PARSE TEXTURES */
|
||||
err = _parse_materials(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 9 PARSE SKINS */
|
||||
err = _parse_skins(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 10 DETERMINE SKELETONS */
|
||||
err = _determine_skeletons(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 11 CREATE SKELETONS */
|
||||
err = _create_skeletons(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 12 CREATE SKINS */
|
||||
err = _create_skins(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 13 PARSE MESHES (we have enough info now) */
|
||||
err = _parse_meshes(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 14 PARSE LIGHTS */
|
||||
err = _parse_lights(state);
|
||||
|
|
@ -6453,13 +6497,15 @@ Error GLTFDocument::parse(Ref<GLTFState> state, String p_path, bool p_read_binar
|
|||
|
||||
/* STEP 15 PARSE CAMERAS */
|
||||
err = _parse_cameras(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 16 PARSE ANIMATIONS */
|
||||
err = _parse_animations(state);
|
||||
if (err != OK)
|
||||
if (err != OK) {
|
||||
return Error::FAILED;
|
||||
}
|
||||
|
||||
/* STEP 17 ASSIGN SCENE NAMES */
|
||||
_assign_scene_names(state);
|
||||
|
|
|
|||
|
|
@ -99,8 +99,9 @@ float AudioStreamPlaybackMP3::get_playback_position() const {
|
|||
}
|
||||
|
||||
void AudioStreamPlaybackMP3::seek(float p_time) {
|
||||
if (!active)
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_time >= mp3_stream->get_length()) {
|
||||
p_time = 0;
|
||||
|
|
|
|||
|
|
@ -75,10 +75,12 @@ ScriptIterator::ScriptIterator(const String &p_string, int p_start, int p_length
|
|||
while (paren_sp >= 0 && paren_stack[paren_sp].pair_index != paired_ch) {
|
||||
paren_sp -= 1;
|
||||
}
|
||||
if (paren_sp < start_sp)
|
||||
if (paren_sp < start_sp) {
|
||||
start_sp = paren_sp;
|
||||
if (paren_sp >= 0)
|
||||
}
|
||||
if (paren_sp >= 0) {
|
||||
sc = paren_stack[paren_sp].script_code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1832,8 +1832,9 @@ _FORCE_INLINE_ int _generate_kashida_justification_opportunies(const String &p_d
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!is_transparent(c))
|
||||
if (!is_transparent(c)) {
|
||||
pc = c;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -784,8 +784,9 @@ ScriptInstance *VisualScript::instance_create(Object *p_this) {
|
|||
variables.get_key_list(&keys);
|
||||
|
||||
for (const List<StringName>::Element *E = keys.front(); E; E = E->next()) {
|
||||
if (!variables[E->get()]._export)
|
||||
if (!variables[E->get()]._export) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PropertyInfo p = variables[E->get()].info;
|
||||
p.name = String(E->get());
|
||||
|
|
@ -2085,10 +2086,11 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
|
|||
|
||||
StringName var_name;
|
||||
|
||||
if (Object::cast_to<VisualScriptLocalVar>(*node))
|
||||
if (Object::cast_to<VisualScriptLocalVar>(*node)) {
|
||||
var_name = String(Object::cast_to<VisualScriptLocalVar>(*node)->get_var_name()).strip_edges();
|
||||
else
|
||||
} else {
|
||||
var_name = String(Object::cast_to<VisualScriptLocalVarSet>(*node)->get_var_name()).strip_edges();
|
||||
}
|
||||
|
||||
if (!local_var_indices.has(var_name)) {
|
||||
local_var_indices[var_name] = function.max_stack;
|
||||
|
|
|
|||
|
|
@ -3017,9 +3017,9 @@ void VisualScriptEditor::_graph_connect_to_empty(const String &p_from, int p_fro
|
|||
if (!vsn.is_valid()) {
|
||||
return;
|
||||
}
|
||||
if (vsn->get_output_value_port_count())
|
||||
|
||||
if (vsn->get_output_value_port_count()) {
|
||||
port_action_pos = p_release_pos;
|
||||
}
|
||||
|
||||
if (p_from_slot < vsn->get_output_sequence_port_count()) {
|
||||
port_action_node = p_from.to_int();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue