Style: Apply clang-tidy's `readability-braces-around-statements`
This commit is contained in:
parent
9bbe51dc27
commit
d83761ba80
|
@ -157,8 +157,9 @@ RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_origi
|
|||
return key;
|
||||
} else if (el == "pub") {
|
||||
CryptoKey *key = CryptoKey::create();
|
||||
if (key)
|
||||
if (key) {
|
||||
key->load(p_path, true);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
@ -113,8 +113,9 @@ DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) {
|
|||
prev->volume = prev->childs[0]->volume.merge(prev->childs[1]->volume);
|
||||
if (pb.is_not_equal_to(prev->volume)) {
|
||||
prev = prev->parent;
|
||||
} else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (prev ? prev : bvh_root);
|
||||
} else {
|
||||
|
@ -262,10 +263,11 @@ DynamicBVH::Node *DynamicBVH::_node_sort(Node *n, Node *&r) {
|
|||
Node *s = p->childs[j];
|
||||
Node *q = p->parent;
|
||||
ERR_FAIL_COND_V(n != p->childs[i], nullptr);
|
||||
if (q)
|
||||
if (q) {
|
||||
q->childs[p->get_index_in_parent()] = n;
|
||||
else
|
||||
} else {
|
||||
r = n;
|
||||
}
|
||||
s->parent = n;
|
||||
p->parent = n;
|
||||
n->parent = q;
|
||||
|
@ -307,8 +309,9 @@ void DynamicBVH::optimize_top_down(int bu_threshold) {
|
|||
}
|
||||
|
||||
void DynamicBVH::optimize_incremental(int passes) {
|
||||
if (passes < 0)
|
||||
if (passes < 0) {
|
||||
passes = total_leaves;
|
||||
}
|
||||
if (bvh_root && (passes > 0)) {
|
||||
do {
|
||||
Node *node = bvh_root;
|
||||
|
@ -345,8 +348,9 @@ void DynamicBVH::_update(Node *leaf, int lookahead) {
|
|||
for (int i = 0; (i < lookahead) && root->parent; ++i) {
|
||||
root = root->parent;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
root = bvh_root;
|
||||
}
|
||||
}
|
||||
_insert_leaf(root, leaf);
|
||||
}
|
||||
|
@ -370,8 +374,9 @@ bool DynamicBVH::update(const ID &p_id, const AABB &p_box) {
|
|||
for (int i = 0; (i < lkhd) && base->parent; ++i) {
|
||||
base = base->parent;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
base = bvh_root;
|
||||
}
|
||||
}
|
||||
leaf->volume = volume;
|
||||
_insert_leaf(base, leaf);
|
||||
|
|
|
@ -87,14 +87,16 @@ private:
|
|||
_FORCE_INLINE_ Volume merge(const Volume &b) const {
|
||||
Volume r;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (min[i] < b.min[i])
|
||||
if (min[i] < b.min[i]) {
|
||||
r.min[i] = min[i];
|
||||
else
|
||||
} else {
|
||||
r.min[i] = b.min[i];
|
||||
if (max[i] > b.max[i])
|
||||
}
|
||||
if (max[i] > b.max[i]) {
|
||||
r.max[i] = max[i];
|
||||
else
|
||||
} else {
|
||||
r.max[i] = b.max[i];
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -202,10 +204,11 @@ private:
|
|||
|
||||
//
|
||||
int count_leaves() const {
|
||||
if (is_internal())
|
||||
if (is_internal()) {
|
||||
return childs[0]->count_leaves() + childs[1]->count_leaves();
|
||||
else
|
||||
} else {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
bool is_left_of_axis(const Vector3 &org, const Vector3 &axis) const {
|
||||
|
@ -254,24 +257,30 @@ private:
|
|||
tymin = (bounds[raySign[1]].y - rayFrom.y) * rayInvDirection.y;
|
||||
tymax = (bounds[1 - raySign[1]].y - rayFrom.y) * rayInvDirection.y;
|
||||
|
||||
if ((tmin > tymax) || (tymin > tmax))
|
||||
if ((tmin > tymax) || (tymin > tmax)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tymin > tmin)
|
||||
if (tymin > tmin) {
|
||||
tmin = tymin;
|
||||
}
|
||||
|
||||
if (tymax < tmax)
|
||||
if (tymax < tmax) {
|
||||
tmax = tymax;
|
||||
}
|
||||
|
||||
tzmin = (bounds[raySign[2]].z - rayFrom.z) * rayInvDirection.z;
|
||||
tzmax = (bounds[1 - raySign[2]].z - rayFrom.z) * rayInvDirection.z;
|
||||
|
||||
if ((tmin > tzmax) || (tzmin > tmax))
|
||||
if ((tmin > tzmax) || (tzmin > tmax)) {
|
||||
return false;
|
||||
if (tzmin > tmin)
|
||||
}
|
||||
if (tzmin > tmin) {
|
||||
tmin = tzmin;
|
||||
if (tzmax < tmax)
|
||||
}
|
||||
if (tzmax < tmax) {
|
||||
tmax = tzmax;
|
||||
}
|
||||
return ((tmin < lambda_max) && (tmax > lambda_min));
|
||||
}
|
||||
|
||||
|
|
|
@ -891,8 +891,9 @@ struct VariantIndexedSetGet_Array {
|
|||
static void ptr_get(const void *base, int64_t index, void *member) {
|
||||
/* avoid ptrconvert for performance*/
|
||||
const Array &v = *reinterpret_cast<const Array *>(base);
|
||||
if (index < 0)
|
||||
if (index < 0) {
|
||||
index += v.size();
|
||||
}
|
||||
OOB_TEST(index, v.size());
|
||||
PtrToArg<Variant>::encode(v[index], member);
|
||||
}
|
||||
|
@ -925,8 +926,9 @@ struct VariantIndexedSetGet_Array {
|
|||
static void ptr_set(void *base, int64_t index, const void *member) {
|
||||
/* avoid ptrconvert for performance*/
|
||||
Array &v = *reinterpret_cast<Array *>(base);
|
||||
if (index < 0)
|
||||
if (index < 0) {
|
||||
index += v.size();
|
||||
}
|
||||
OOB_TEST(index, v.size());
|
||||
v.set(index, PtrToArg<Variant>::convert(member));
|
||||
}
|
||||
|
|
|
@ -649,14 +649,16 @@ public:
|
|||
Color color = get_theme_color("highlight_color", "Editor");
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Point2 ofs(4, vofs);
|
||||
if (i == 1)
|
||||
if (i == 1) {
|
||||
ofs.y += bsize + 1;
|
||||
}
|
||||
|
||||
ofs += rect.position;
|
||||
for (int j = 0; j < 10; j++) {
|
||||
Point2 o = ofs + Point2(j * (bsize + 1), 0);
|
||||
if (j >= 5)
|
||||
if (j >= 5) {
|
||||
o.x += 1;
|
||||
}
|
||||
|
||||
const int idx = i * 10 + j;
|
||||
const bool on = value & (1 << idx);
|
||||
|
|
|
@ -38,8 +38,9 @@
|
|||
EditorTranslationParser *EditorTranslationParser::singleton = nullptr;
|
||||
|
||||
Error EditorTranslationParserPlugin::parse_file(const String &p_path, Vector<String> *r_ids, Vector<Vector<String>> *r_ids_ctx_plural) {
|
||||
if (!get_script_instance())
|
||||
if (!get_script_instance()) {
|
||||
return ERR_UNAVAILABLE;
|
||||
}
|
||||
|
||||
if (get_script_instance()->has_method("parse_file")) {
|
||||
Array ids;
|
||||
|
@ -70,8 +71,9 @@ Error EditorTranslationParserPlugin::parse_file(const String &p_path, Vector<Str
|
|||
}
|
||||
|
||||
void EditorTranslationParserPlugin::get_recognized_extensions(List<String> *r_extensions) const {
|
||||
if (!get_script_instance())
|
||||
if (!get_script_instance()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_script_instance()->has_method("get_recognized_extensions")) {
|
||||
Array extensions = get_script_instance()->call("get_recognized_extensions");
|
||||
|
|
|
@ -2621,8 +2621,9 @@ void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &f
|
|||
}
|
||||
|
||||
void FileSystemDock::_update_import_dock() {
|
||||
if (!import_dock_needs_update)
|
||||
if (!import_dock_needs_update) {
|
||||
return;
|
||||
}
|
||||
|
||||
// List selected.
|
||||
Vector<String> selected;
|
||||
|
@ -2633,8 +2634,9 @@ void FileSystemDock::_update_import_dock() {
|
|||
} else {
|
||||
// Use the file list.
|
||||
for (int i = 0; i < files->get_item_count(); i++) {
|
||||
if (!files->is_selected(i))
|
||||
if (!files->is_selected(i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
selected.push_back(files->get_item_metadata(i));
|
||||
}
|
||||
|
|
|
@ -167,16 +167,18 @@ void BoneTransformEditor::_notification(int p_what) {
|
|||
}
|
||||
|
||||
void BoneTransformEditor::_value_changed(const double p_value) {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
Transform tform = compute_transform_from_vector3s();
|
||||
_change_transform(tform);
|
||||
}
|
||||
|
||||
void BoneTransformEditor::_value_changed_vector3(const String p_property_name, const Vector3 p_vector, const StringName p_edited_property_name, const bool p_boolean) {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
Transform tform = compute_transform_from_vector3s();
|
||||
_change_transform(tform);
|
||||
}
|
||||
|
@ -194,8 +196,9 @@ Transform BoneTransformEditor::compute_transform_from_vector3s() const {
|
|||
}
|
||||
|
||||
void BoneTransformEditor::_value_changed_transform(const String p_property_name, const Transform p_transform, const StringName p_edited_property_name, const bool p_boolean) {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
_change_transform(p_transform);
|
||||
}
|
||||
|
||||
|
@ -222,11 +225,13 @@ void BoneTransformEditor::update_enabled_checkbox() {
|
|||
}
|
||||
|
||||
void BoneTransformEditor::_update_properties() {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (skeleton == nullptr)
|
||||
if (skeleton == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
updating = true;
|
||||
|
||||
|
@ -235,11 +240,13 @@ void BoneTransformEditor::_update_properties() {
|
|||
}
|
||||
|
||||
void BoneTransformEditor::_update_custom_pose_properties() {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (skeleton == nullptr)
|
||||
if (skeleton == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
updating = true;
|
||||
|
||||
|
@ -287,14 +294,16 @@ void BoneTransformEditor::set_toggle_enabled(const bool p_enabled) {
|
|||
}
|
||||
|
||||
void BoneTransformEditor::_key_button_pressed() {
|
||||
if (skeleton == nullptr)
|
||||
if (skeleton == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const BoneId bone_id = property.get_slicec('/', 1).to_int();
|
||||
const String name = skeleton->get_bone_name(bone_id);
|
||||
|
||||
if (name.is_empty())
|
||||
if (name.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Need to normalize the basis before you key it
|
||||
Transform tform = compute_transform_from_vector3s();
|
||||
|
@ -405,8 +414,9 @@ PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_chi
|
|||
Variant Skeleton3DEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
||||
TreeItem *selected = joint_tree->get_selected();
|
||||
|
||||
if (!selected)
|
||||
if (!selected) {
|
||||
return Variant();
|
||||
}
|
||||
|
||||
Ref<Texture> icon = selected->get_icon(0);
|
||||
|
||||
|
@ -431,27 +441,32 @@ Variant Skeleton3DEditor::get_drag_data_fw(const Point2 &p_point, Control *p_fro
|
|||
|
||||
bool Skeleton3DEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
|
||||
TreeItem *target = joint_tree->get_item_at_position(p_point);
|
||||
if (!target)
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const String path = target->get_metadata(0);
|
||||
if (!path.begins_with("bones/"))
|
||||
if (!path.begins_with("bones/")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TreeItem *selected = Object::cast_to<TreeItem>(Dictionary(p_data)["node"]);
|
||||
if (target == selected)
|
||||
if (target == selected) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const String path2 = target->get_metadata(0);
|
||||
if (!path2.begins_with("bones/"))
|
||||
if (!path2.begins_with("bones/")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Skeleton3DEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
|
||||
if (!can_drop_data_fw(p_point, p_data, p_from))
|
||||
if (!can_drop_data_fw(p_point, p_data, p_from)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TreeItem *target = joint_tree->get_item_at_position(p_point);
|
||||
TreeItem *selected = Object::cast_to<TreeItem>(Dictionary(p_data)["node"]);
|
||||
|
@ -510,19 +525,23 @@ void Skeleton3DEditor::_joint_tree_rmb_select(const Vector2 &p_pos) {
|
|||
}
|
||||
|
||||
void Skeleton3DEditor::_update_properties() {
|
||||
if (rest_editor)
|
||||
if (rest_editor) {
|
||||
rest_editor->_update_properties();
|
||||
if (pose_editor)
|
||||
}
|
||||
if (pose_editor) {
|
||||
pose_editor->_update_properties();
|
||||
if (custom_pose_editor)
|
||||
}
|
||||
if (custom_pose_editor) {
|
||||
custom_pose_editor->_update_custom_pose_properties();
|
||||
}
|
||||
}
|
||||
|
||||
void Skeleton3DEditor::update_joint_tree() {
|
||||
joint_tree->clear();
|
||||
|
||||
if (skeleton == nullptr)
|
||||
if (skeleton == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
TreeItem *root = joint_tree->create_item();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -2262,8 +2262,9 @@ public:
|
|||
CharString command_line_argument = command_line_strings[i].utf8();
|
||||
int base = r_command_line_flags.size();
|
||||
int length = command_line_argument.length();
|
||||
if (length == 0)
|
||||
if (length == 0) {
|
||||
continue;
|
||||
}
|
||||
r_command_line_flags.resize(base + 4 + length);
|
||||
encode_uint32(length, &r_command_line_flags.write[base]);
|
||||
copymem(&r_command_line_flags.write[base + 4], command_line_argument.ptr(), length);
|
||||
|
@ -2615,10 +2616,11 @@ public:
|
|||
}
|
||||
// This is the start of the Legacy build system
|
||||
print_verbose("Starting legacy build system..");
|
||||
if (p_debug)
|
||||
if (p_debug) {
|
||||
src_apk = p_preset->get("custom_template/debug");
|
||||
else
|
||||
} else {
|
||||
src_apk = p_preset->get("custom_template/release");
|
||||
}
|
||||
src_apk = src_apk.strip_edges();
|
||||
if (src_apk == "") {
|
||||
if (p_debug) {
|
||||
|
|
|
@ -47,20 +47,21 @@ const String godot_project_name_xml_string = R"(<?xml version="1.0" encoding="ut
|
|||
DisplayServer::ScreenOrientation _get_screen_orientation() {
|
||||
String orientation_settings = ProjectSettings::get_singleton()->get("display/window/handheld/orientation");
|
||||
DisplayServer::ScreenOrientation screen_orientation;
|
||||
if (orientation_settings == "portrait")
|
||||
if (orientation_settings == "portrait") {
|
||||
screen_orientation = DisplayServer::SCREEN_PORTRAIT;
|
||||
else if (orientation_settings == "reverse_landscape")
|
||||
} else if (orientation_settings == "reverse_landscape") {
|
||||
screen_orientation = DisplayServer::SCREEN_REVERSE_LANDSCAPE;
|
||||
else if (orientation_settings == "reverse_portrait")
|
||||
} else if (orientation_settings == "reverse_portrait") {
|
||||
screen_orientation = DisplayServer::SCREEN_REVERSE_PORTRAIT;
|
||||
else if (orientation_settings == "sensor_landscape")
|
||||
} else if (orientation_settings == "sensor_landscape") {
|
||||
screen_orientation = DisplayServer::SCREEN_SENSOR_LANDSCAPE;
|
||||
else if (orientation_settings == "sensor_portrait")
|
||||
} else if (orientation_settings == "sensor_portrait") {
|
||||
screen_orientation = DisplayServer::SCREEN_SENSOR_PORTRAIT;
|
||||
else if (orientation_settings == "sensor")
|
||||
} else if (orientation_settings == "sensor") {
|
||||
screen_orientation = DisplayServer::SCREEN_SENSOR;
|
||||
else
|
||||
} else {
|
||||
screen_orientation = DisplayServer::SCREEN_LANDSCAPE;
|
||||
}
|
||||
|
||||
return screen_orientation;
|
||||
}
|
||||
|
|
|
@ -185,10 +185,11 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
|
|||
if (devnode) {
|
||||
String devnode_str = devnode;
|
||||
if (devnode_str.find(ignore_str) == -1) {
|
||||
if (action == "add")
|
||||
if (action == "add") {
|
||||
open_joypad(devnode);
|
||||
else if (String(action) == "remove")
|
||||
} else if (String(action) == "remove") {
|
||||
close_joypad(get_joy_from_path(devnode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1968,8 +1968,9 @@ Node *Node::get_deepest_editable_node(Node *p_start_node) const {
|
|||
Node *node = p_start_node;
|
||||
|
||||
while (iterated_item->get_owner() && iterated_item->get_owner() != this) {
|
||||
if (!is_editable_instance(iterated_item->get_owner()))
|
||||
if (!is_editable_instance(iterated_item->get_owner())) {
|
||||
node = iterated_item->get_owner();
|
||||
}
|
||||
|
||||
iterated_item = iterated_item->get_owner();
|
||||
}
|
||||
|
|
|
@ -3228,8 +3228,9 @@ Viewport::ScreenSpaceAA Viewport::get_screen_space_aa() const {
|
|||
}
|
||||
|
||||
void Viewport::set_use_debanding(bool p_use_debanding) {
|
||||
if (use_debanding == p_use_debanding)
|
||||
if (use_debanding == p_use_debanding) {
|
||||
return;
|
||||
}
|
||||
use_debanding = p_use_debanding;
|
||||
RS::get_singleton()->viewport_set_use_debanding(viewport, p_use_debanding);
|
||||
}
|
||||
|
|
|
@ -620,11 +620,13 @@ int TextParagraph::hit_test(const Point2 &p_coords) const {
|
|||
const_cast<TextParagraph *>(this)->_shape_lines();
|
||||
Vector2 ofs;
|
||||
if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) {
|
||||
if (ofs.y < 0)
|
||||
if (ofs.y < 0) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (ofs.x < 0)
|
||||
if (ofs.x < 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) {
|
||||
|
|
|
@ -4660,16 +4660,18 @@ String VisualShaderNodeTexture2DArrayUniform::generate_global(Shader::Mode p_mod
|
|||
|
||||
switch (texture_type) {
|
||||
case TYPE_DATA:
|
||||
if (color_default == COLOR_DEFAULT_BLACK)
|
||||
if (color_default == COLOR_DEFAULT_BLACK) {
|
||||
code += " : hint_black;\n";
|
||||
else
|
||||
} else {
|
||||
code += ";\n";
|
||||
}
|
||||
break;
|
||||
case TYPE_COLOR:
|
||||
if (color_default == COLOR_DEFAULT_BLACK)
|
||||
if (color_default == COLOR_DEFAULT_BLACK) {
|
||||
code += " : hint_black_albedo;\n";
|
||||
else
|
||||
} else {
|
||||
code += " : hint_albedo;\n";
|
||||
}
|
||||
break;
|
||||
case TYPE_NORMAL_MAP:
|
||||
code += " : hint_normal;\n";
|
||||
|
@ -4728,16 +4730,18 @@ String VisualShaderNodeTexture3DUniform::generate_global(Shader::Mode p_mode, Vi
|
|||
|
||||
switch (texture_type) {
|
||||
case TYPE_DATA:
|
||||
if (color_default == COLOR_DEFAULT_BLACK)
|
||||
if (color_default == COLOR_DEFAULT_BLACK) {
|
||||
code += " : hint_black;\n";
|
||||
else
|
||||
} else {
|
||||
code += ";\n";
|
||||
}
|
||||
break;
|
||||
case TYPE_COLOR:
|
||||
if (color_default == COLOR_DEFAULT_BLACK)
|
||||
if (color_default == COLOR_DEFAULT_BLACK) {
|
||||
code += " : hint_black_albedo;\n";
|
||||
else
|
||||
} else {
|
||||
code += " : hint_albedo;\n";
|
||||
}
|
||||
break;
|
||||
case TYPE_NORMAL_MAP:
|
||||
code += " : hint_normal;\n";
|
||||
|
|
|
@ -229,8 +229,9 @@ void Step3DSW::step(Space3DSW *p_space, real_t p_delta, int p_iterations) {
|
|||
while (sb) {
|
||||
for (const Set<Constraint3DSW *>::Element *E = sb->self()->get_constraints().front(); E; E = E->next()) {
|
||||
Constraint3DSW *c = E->get();
|
||||
if (c->get_island_step() == _step)
|
||||
if (c->get_island_step() == _step) {
|
||||
continue;
|
||||
}
|
||||
c->set_island_step(_step);
|
||||
c->set_island_next(nullptr);
|
||||
c->set_island_list_next(constraint_island_list);
|
||||
|
|
|
@ -3022,8 +3022,9 @@ void RendererSceneRenderForwardClustered::_geometry_instance_update(GeometryInst
|
|||
|
||||
for (int j = 0; j < draw_passes; j++) {
|
||||
RID mesh = storage->particles_get_draw_pass_mesh(ginstance->data->base, j);
|
||||
if (!mesh.is_valid())
|
||||
if (!mesh.is_valid()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const RID *materials = nullptr;
|
||||
uint32_t surface_count;
|
||||
|
|
|
@ -4692,10 +4692,11 @@ void RendererStorageRD::update_particles() {
|
|||
|
||||
if (particles->clear && particles->pre_process_time > 0.0) {
|
||||
float frame_time;
|
||||
if (particles->fixed_fps > 0)
|
||||
if (particles->fixed_fps > 0) {
|
||||
frame_time = 1.0 / particles->fixed_fps;
|
||||
else
|
||||
} else {
|
||||
frame_time = 1.0 / 30.0;
|
||||
}
|
||||
|
||||
float todo = particles->pre_process_time;
|
||||
|
||||
|
@ -4731,10 +4732,11 @@ void RendererStorageRD::update_particles() {
|
|||
particles->frame_remainder = todo;
|
||||
|
||||
} else {
|
||||
if (zero_time_scale)
|
||||
if (zero_time_scale) {
|
||||
_particles_process(particles, 0.0);
|
||||
else
|
||||
} else {
|
||||
_particles_process(particles, RendererCompositorRD::singleton->get_frame_delta_time());
|
||||
}
|
||||
}
|
||||
|
||||
//copy particles to instance buffer
|
||||
|
|
|
@ -6932,10 +6932,11 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
|
|||
decl.initializer.push_back(n);
|
||||
break;
|
||||
} else {
|
||||
if (curly)
|
||||
if (curly) {
|
||||
_set_error("Expected '}' or ','");
|
||||
else
|
||||
} else {
|
||||
_set_error("Expected ')' or ','");
|
||||
}
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -6962,8 +6963,9 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
|
|||
} else {
|
||||
//variable created with assignment! must parse an expression
|
||||
Node *expr = _parse_and_reduce_expression(nullptr, FunctionInfo());
|
||||
if (!expr)
|
||||
if (!expr) {
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
if (expr->type == Node::TYPE_OPERATOR && ((OperatorNode *)expr)->op == OP_CALL) {
|
||||
_set_error("Expected constant expression after '='");
|
||||
return ERR_PARSE_ERROR;
|
||||
|
|
Loading…
Reference in New Issue