Merge pull request #93401 from Repiteo/style/clang-tidy-fixes

Style: Apply `clang-tidy` fixes
This commit is contained in:
Thaddeus Crews 2024-11-04 21:52:05 -06:00
commit 2450dee1bc
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
67 changed files with 166 additions and 149 deletions

View File

@ -1,14 +1,12 @@
---
Checks: >-
-*,
cppcoreguidelines-pro-type-member-init,
modernize-redundant-void-arg,
modernize-use-bool-literals,
modernize-use-default-member-init,
modernize-use-nullptr,
readability-braces-around-statements,
readability-redundant-member-init
WarningsAsErrors: ''
Checks:
- -*
- cppcoreguidelines-pro-type-member-init
- modernize-redundant-void-arg
- modernize-use-bool-literals
- modernize-use-default-member-init
- modernize-use-nullptr
- readability-braces-around-statements
- readability-redundant-member-init
HeaderFileExtensions: ['', h, hh, hpp, hxx, inc, glsl]
ImplementationFileExtensions: [c, cc, cpp, cxx, m, mm, java]
HeaderFilterRegex: (core|doc|drivers|editor|main|modules|platform|scene|servers|tests)/
@ -19,4 +17,3 @@ CheckOptions:
modernize-use-bool-literals.IgnoreMacros: false
modernize-use-default-member-init.IgnoreMacros: false
modernize-use-default-member-init.UseAssignment: true
...

View File

@ -60,3 +60,6 @@ b37fc1014abf7adda70dc30b0822d775b3a4433f
# Set clang-format `RemoveSemicolon` rule to `true`
0d350e71086fffce0553811739aae9f6ad66136c
# Style: Apply clang-tidy fixes (superficial)
bb5f390fb9b466be35a5df7651323d7e66afca31

View File

@ -1034,7 +1034,7 @@ void Input::action_release(const StringName &p_action) {
// Create or retrieve existing action.
ActionState &action_state = action_states[p_action];
action_state.cache.pressed = 0;
action_state.cache.pressed = false;
action_state.cache.strength = 0.0;
action_state.cache.raw_strength = 0.0;
// As input may come in part way through a physics tick, the earliest we can react to it is the next physics tick.

View File

@ -153,7 +153,7 @@ public:
bool is_flushing() const;
int get_max_buffer_usage() const;
CallQueue(Allocator *p_custom_allocator = 0, uint32_t p_max_pages = 8192, const String &p_error_text = String());
CallQueue(Allocator *p_custom_allocator = nullptr, uint32_t p_max_pages = 8192, const String &p_error_text = String());
virtual ~CallQueue();
};

View File

@ -315,6 +315,4 @@ struct BuildIndexSequence<0, Is...> : IndexSequence<Is...> {};
#define ___gd_is_defined(val) ____gd_is_defined(__GDARG_PLACEHOLDER_##val)
#define GD_IS_DEFINED(x) ___gd_is_defined(x)
#define FORCE_SEMICOLON ;
#endif // TYPEDEFS_H

View File

@ -2719,8 +2719,7 @@ Variant::Variant(const Vector<Plane> &p_array) :
}
}
Variant::Variant(const Vector<Face3> &p_face_array) :
type(NIL) {
Variant::Variant(const Vector<Face3> &p_face_array) {
PackedVector3Array vertices;
int face_count = p_face_array.size();
vertices.resize(face_count * 3);
@ -2739,8 +2738,7 @@ Variant::Variant(const Vector<Face3> &p_face_array) :
*this = vertices;
}
Variant::Variant(const Vector<Variant> &p_array) :
type(NIL) {
Variant::Variant(const Vector<Variant> &p_array) {
Array arr;
arr.resize(p_array.size());
for (int i = 0; i < p_array.size(); i++) {
@ -2749,8 +2747,7 @@ Variant::Variant(const Vector<Variant> &p_array) :
*this = arr;
}
Variant::Variant(const Vector<StringName> &p_array) :
type(NIL) {
Variant::Variant(const Vector<StringName> &p_array) {
PackedStringArray v;
int len = p_array.size();
v.resize(len);
@ -2908,8 +2905,7 @@ Variant::Variant(const IPAddress &p_address) :
memnew_placement(_data._mem, String(p_address));
}
Variant::Variant(const Variant &p_variant) :
type(NIL) {
Variant::Variant(const Variant &p_variant) {
reference(p_variant);
}

View File

@ -814,8 +814,7 @@ public:
static void unregister_types();
Variant(const Variant &p_variant);
_FORCE_INLINE_ Variant() :
type(NIL) {}
_FORCE_INLINE_ Variant() {}
_FORCE_INLINE_ ~Variant() {
clear();
}

View File

@ -396,7 +396,7 @@ public:
_FORCE_INLINE_ bool particles_has_collision(RID p_particles) {
Particles *particles = particles_owner.get_or_null(p_particles);
ERR_FAIL_NULL_V(particles, 0);
ERR_FAIL_NULL_V(particles, false);
return particles->has_collision_cache;
}

View File

@ -1519,7 +1519,7 @@ RDD::BufferID RenderingDeviceDriverVulkan::buffer_create(uint64_t p_size, BitFie
ERR_FAIL_COND_V_MSG(err, BufferID(), "Can't create buffer of size: " + itos(p_size) + ", error " + itos(err) + ".");
err = vmaAllocateMemoryForBuffer(allocator, vk_buffer, &alloc_create_info, &allocation, &alloc_info);
ERR_FAIL_COND_V_MSG(err, BufferID(), "Can't allocate memory for buffer of size: " + itos(p_size) + ", error " + itos(err) + ".");
err = vmaBindBufferMemory2(allocator, allocation, 0, vk_buffer, NULL);
err = vmaBindBufferMemory2(allocator, allocation, 0, vk_buffer, nullptr);
ERR_FAIL_COND_V_MSG(err, BufferID(), "Can't bind memory to buffer of size: " + itos(p_size) + ", error " + itos(err) + ".");
// Bookkeep.
@ -1745,7 +1745,7 @@ RDD::TextureID RenderingDeviceDriverVulkan::texture_create(const TextureFormat &
ERR_FAIL_COND_V_MSG(err, TextureID(), "vkCreateImage failed with error " + itos(err) + ".");
err = vmaAllocateMemoryForImage(allocator, vk_image, &alloc_create_info, &allocation, &alloc_info);
ERR_FAIL_COND_V_MSG(err, TextureID(), "Can't allocate memory for image, error: " + itos(err) + ".");
err = vmaBindImageMemory2(allocator, allocation, 0, vk_image, NULL);
err = vmaBindImageMemory2(allocator, allocation, 0, vk_image, nullptr);
ERR_FAIL_COND_V_MSG(err, TextureID(), "Can't bind memory to image, error: " + itos(err) + ".");
// Create view.
@ -4042,7 +4042,7 @@ RDD::UniformSetID RenderingDeviceDriverVulkan::uniform_set_create(VectorView<Bou
}
// Need a descriptor pool.
DescriptorSetPools::Iterator pool_sets_it = {};
DescriptorSetPools::Iterator pool_sets_it;
VkDescriptorPool vk_pool = _descriptor_set_pool_find_or_create(pool_key, &pool_sets_it);
DEV_ASSERT(vk_pool);
pool_sets_it->value[vk_pool]++;

View File

@ -489,7 +489,7 @@ private:
struct UniformSetInfo {
VkDescriptorSet vk_descriptor_set = VK_NULL_HANDLE;
VkDescriptorPool vk_descriptor_pool = VK_NULL_HANDLE;
DescriptorSetPools::Iterator pool_sets_it = {};
DescriptorSetPools::Iterator pool_sets_it;
};
public:

View File

@ -282,7 +282,7 @@ Error DirAccessWindows::rename(String p_path, String p_new_path) {
uint64_t id = OS::get_singleton()->get_ticks_usec();
while (true) {
tmpfile_utf16 = (path + itos(id++) + ".tmp").utf16();
HANDLE handle = CreateFileW((LPCWSTR)tmpfile_utf16.get_data(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
HANDLE handle = CreateFileW((LPCWSTR)tmpfile_utf16.get_data(), GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
if (handle != INVALID_HANDLE_VALUE) {
CloseHandle(handle);
break;

View File

@ -193,7 +193,7 @@ Error FileAccessWindows::open_internal(const String &p_path, int p_mode_flags) {
uint64_t id = OS::get_singleton()->get_ticks_usec();
while (true) {
tmpfile = path + itos(id++) + ".tmp";
HANDLE handle = CreateFileW((LPCWSTR)tmpfile.utf16().get_data(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
HANDLE handle = CreateFileW((LPCWSTR)tmpfile.utf16().get_data(), GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
if (handle != INVALID_HANDLE_VALUE) {
CloseHandle(handle);
break;

View File

@ -40,7 +40,7 @@ Error FileAccessWindowsPipe::open_existing(HANDLE p_rfd, HANDLE p_wfd, bool p_bl
_close();
path_src = String();
ERR_FAIL_COND_V_MSG(fd[0] != 0 || fd[1] != 0, ERR_ALREADY_IN_USE, "Pipe is already in use.");
ERR_FAIL_COND_V_MSG(fd[0] != nullptr || fd[1] != nullptr, ERR_ALREADY_IN_USE, "Pipe is already in use.");
fd[0] = p_rfd;
fd[1] = p_wfd;
@ -58,18 +58,18 @@ Error FileAccessWindowsPipe::open_internal(const String &p_path, int p_mode_flag
_close();
path_src = p_path;
ERR_FAIL_COND_V_MSG(fd[0] != 0 || fd[1] != 0, ERR_ALREADY_IN_USE, "Pipe is already in use.");
ERR_FAIL_COND_V_MSG(fd[0] != nullptr || fd[1] != nullptr, ERR_ALREADY_IN_USE, "Pipe is already in use.");
path = String("\\\\.\\pipe\\LOCAL\\") + p_path.replace("pipe://", "").replace("/", "_");
HANDLE h = CreateFileW((LPCWSTR)path.utf16().get_data(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
HANDLE h = CreateFileW((LPCWSTR)path.utf16().get_data(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (h == INVALID_HANDLE_VALUE) {
h = CreateNamedPipeW((LPCWSTR)path.utf16().get_data(), PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1, 4096, 4096, 0, nullptr);
if (h == INVALID_HANDLE_VALUE) {
last_error = ERR_FILE_CANT_OPEN;
return last_error;
}
ConnectNamedPipe(h, NULL);
ConnectNamedPipe(h, nullptr);
}
fd[0] = h;
fd[1] = h;
@ -79,19 +79,19 @@ Error FileAccessWindowsPipe::open_internal(const String &p_path, int p_mode_flag
}
void FileAccessWindowsPipe::_close() {
if (fd[0] == 0) {
if (fd[0] == nullptr) {
return;
}
if (fd[1] != fd[0]) {
CloseHandle(fd[1]);
}
CloseHandle(fd[0]);
fd[0] = 0;
fd[1] = 0;
fd[0] = nullptr;
fd[1] = nullptr;
}
bool FileAccessWindowsPipe::is_open() const {
return (fd[0] != 0 || fd[1] != 0);
return (fd[0] != nullptr || fd[1] != nullptr);
}
String FileAccessWindowsPipe::get_path() const {
@ -103,7 +103,7 @@ String FileAccessWindowsPipe::get_path_absolute() const {
}
uint64_t FileAccessWindowsPipe::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
ERR_FAIL_COND_V_MSG(fd[0] == 0, -1, "Pipe must be opened before use.");
ERR_FAIL_COND_V_MSG(fd[0] == nullptr, -1, "Pipe must be opened before use.");
ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
DWORD read = 0;
@ -120,7 +120,7 @@ Error FileAccessWindowsPipe::get_error() const {
}
void FileAccessWindowsPipe::store_buffer(const uint8_t *p_src, uint64_t p_length) {
ERR_FAIL_COND_MSG(fd[1] == 0, "Pipe must be opened before use.");
ERR_FAIL_COND_MSG(fd[1] == nullptr, "Pipe must be opened before use.");
ERR_FAIL_COND(!p_src && p_length > 0);
DWORD read = -1;

View File

@ -39,7 +39,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
class FileAccessWindowsPipe : public FileAccess {
HANDLE fd[2] = { 0, 0 };
HANDLE fd[2] = { nullptr, nullptr };
mutable Error last_error = OK;

View File

@ -6337,8 +6337,9 @@ bool AnimationTrackEditor::_is_track_compatible(int p_target_track_idx, Variant:
}
if (path_valid) {
if (is_source_bezier)
if (is_source_bezier) {
p_source_value_type = Variant::FLOAT;
}
return property_type == p_source_value_type;
} else {
if (animation->track_get_key_count(p_target_track_idx) > 0) {

View File

@ -789,7 +789,7 @@ public:
struct AdditiveNodeEntry {
Node *node = nullptr;
NodePath parent = NodePath();
NodePath parent;
Node *owner = nullptr;
int index = 0;
// Used if the original parent node is lost

View File

@ -649,10 +649,11 @@ QuickOpenDisplayMode QuickOpenResultContainer::get_adaptive_display_mode(const V
for (const StringName &type : grid_preferred_types) {
for (const StringName &base_type : p_base_types) {
if (base_type == type || ClassDB::is_parent_class(base_type, type))
if (base_type == type || ClassDB::is_parent_class(base_type, type)) {
return QuickOpenDisplayMode::GRID;
}
}
}
return QuickOpenDisplayMode::LIST;
}

View File

@ -859,7 +859,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
// 4-1. Guess Finger
int tips_index = -1;
bool thumb_tips_size = 0;
bool thumb_tips_size = false;
bool named_finger_is_found = false;
LocalVector<String> fingers;
fingers.push_back("thumb|pollex");
@ -994,7 +994,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
}
tips_index = -1;
thumb_tips_size = 0;
thumb_tips_size = false;
named_finger_is_found = false;
if (right_hand_or_palm != -1) {
LocalVector<LocalVector<String>> right_fingers_map;

View File

@ -470,7 +470,7 @@ void EditorPropertyOTVariation::update_property() {
Vector3i range = supported.get_value_at_index(i);
EditorPropertyInteger *prop = memnew(EditorPropertyInteger);
prop->setup(range.x, range.y, false, 1, false, false);
prop->setup(range.x, range.y, false, true, false, false);
prop->set_object_and_property(object.ptr(), "keys/" + itos(name_tag));
String name = TS->tag_to_name(name_tag);

View File

@ -1550,6 +1550,7 @@ int TileMapLayerEditorTilesPlugin::_get_transformed_alternative(int p_alternativ
case TRANSFORM_ROTATE_RIGHT: {
// A matrix with every possible flip/transpose combination, sorted by what comes next when you rotate.
const LocalVector<bool> rotation_matrix = {
// NOLINTBEGIN(modernize-use-bool-literals)
0, 0, 0,
0, 1, 1,
1, 1, 0,
@ -1558,6 +1559,7 @@ int TileMapLayerEditorTilesPlugin::_get_transformed_alternative(int p_alternativ
0, 0, 1,
0, 1, 0,
1, 1, 1
// NOLINTEND(modernize-use-bool-literals)
};
for (int i = 0; i < 8; i++) {

View File

@ -91,7 +91,7 @@ public:
TileSetAtlasSourceEditor *tiles_set_atlas_source_editor = nullptr;
Ref<TileSetAtlasSource> tile_set_atlas_source;
RBSet<TileSelection> tiles = RBSet<TileSelection>();
RBSet<TileSelection> tiles;
protected:
bool _set(const StringName &p_name, const Variant &p_value);

View File

@ -716,8 +716,9 @@ Vector<String> ProjectConverter3To4::check_for_files() {
directories_to_check.append(current_dir.path_join(file_name) + "/");
} else {
bool proper_extension = false;
if (file_name.ends_with(".gd") || file_name.ends_with(".shader") || file_name.ends_with(".gdshader") || file_name.ends_with(".tscn") || file_name.ends_with(".tres") || file_name.ends_with(".godot") || file_name.ends_with(".cs") || file_name.ends_with(".csproj") || file_name.ends_with(".import"))
if (file_name.ends_with(".gd") || file_name.ends_with(".shader") || file_name.ends_with(".gdshader") || file_name.ends_with(".tscn") || file_name.ends_with(".tres") || file_name.ends_with(".godot") || file_name.ends_with(".cs") || file_name.ends_with(".csproj") || file_name.ends_with(".import")) {
proper_extension = true;
}
if (proper_extension) {
collected_files.append(current_dir.path_join(file_name));
@ -1321,10 +1322,11 @@ Vector<String> ProjectConverter3To4::parse_arguments(const String &line) {
break;
};
case '"': {
if (previous_character != '\\')
if (previous_character != '\\') {
is_inside_string = !is_inside_string;
}
}
}
previous_character = character;
}

View File

@ -91,10 +91,10 @@ class BetsyCompressor : public Object {
RenderingDevice *compress_rd = nullptr;
RenderingContextDriver *compress_rcd = nullptr;
HashMap<String, BetsyShader> cached_shaders;
RID src_sampler = RID();
RID src_sampler;
// Format-specific resources.
RID dxt1_encoding_table_buffer = RID();
RID dxt1_encoding_table_buffer;
void _init();
void _assign_mt_ids(WorkerThreadPool::TaskID p_pump_task_id);

View File

@ -145,7 +145,7 @@ bool CameraFeedLinux::_request_buffers() {
}
buffers[i].length = buffer.length;
buffers[i].start = mmap(NULL, buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED, file_descriptor, buffer.m.offset);
buffers[i].start = mmap(nullptr, buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED, file_descriptor, buffer.m.offset);
if (buffers[i].start == MAP_FAILED) {
for (unsigned int b = 0; b < i; b++) {

View File

@ -369,21 +369,25 @@ Error FBXDocument::_parse_nodes(Ref<FBXState> p_state) {
// all skin clusters connected to the bone.
for (const ufbx_connection &child_conn : fbx_node->element.connections_src) {
ufbx_skin_cluster *child_cluster = ufbx_as_skin_cluster(child_conn.dst);
if (!child_cluster)
if (!child_cluster) {
continue;
}
ufbx_skin_deformer *child_deformer = _find_skin_deformer(child_cluster);
if (!child_deformer)
if (!child_deformer) {
continue;
}
// Found a skin cluster: Now iterate through all the skin clusters of the parent and
// try to find one that used by the same deformer.
for (const ufbx_connection &parent_conn : fbx_node->parent->element.connections_src) {
ufbx_skin_cluster *parent_cluster = ufbx_as_skin_cluster(parent_conn.dst);
if (!parent_cluster)
if (!parent_cluster) {
continue;
}
ufbx_skin_deformer *parent_deformer = _find_skin_deformer(parent_cluster);
if (parent_deformer != child_deformer)
if (parent_deformer != child_deformer) {
continue;
}
// Success: Found two skin clusters from the same deformer, now we can resolve the
// local bind pose from the difference between the two world-space bind poses.

View File

@ -790,8 +790,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
text += method->get_name();
text += "(";
for (int i = 0; i < argc; i++) {
if (i > 0)
if (i > 0) {
text += ", ";
}
text += DADDR(1 + i);
}
text += ")";
@ -833,8 +834,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
text += method->get_name();
text += "(";
for (int i = 0; i < argc; i++) {
if (i > 0)
if (i > 0) {
text += ", ";
}
text += DADDR(1 + i);
}
text += ")";

View File

@ -311,7 +311,7 @@ bool GodotPinJoint2D::get_flag(PhysicsServer2D::PinJointFlag p_flag) const {
return motor_enabled;
}
}
ERR_FAIL_V(0);
ERR_FAIL_V(false);
}
GodotPinJoint2D::GodotPinJoint2D(const Vector2 &p_pos, GodotBody2D *p_body_a, GodotBody2D *p_body_b) :

View File

@ -1169,8 +1169,8 @@ void GodotPhysicsServer2D::pin_joint_set_flag(RID p_joint, PinJointFlag p_flag,
bool GodotPhysicsServer2D::pin_joint_get_flag(RID p_joint, PinJointFlag p_flag) const {
GodotJoint2D *joint = joint_owner.get_or_null(p_joint);
ERR_FAIL_NULL_V(joint, 0);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_PIN, 0);
ERR_FAIL_NULL_V(joint, false);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_PIN, false);
GodotPinJoint2D *pin_joint = static_cast<GodotPinJoint2D *>(joint);
return pin_joint->get_flag(p_flag);

View File

@ -342,7 +342,7 @@ bool GodotPhysicsDirectSpaceState2D::collide_shape(const ShapeParameters &p_para
}
GodotShape2D *shape = GodotPhysicsServer2D::godot_singleton->shape_owner.get_or_null(p_parameters.shape_rid);
ERR_FAIL_NULL_V(shape, 0);
ERR_FAIL_NULL_V(shape, false);
Rect2 aabb = p_parameters.transform.xform(shape->get_aabb());
aabb = aabb.merge(Rect2(aabb.position + p_parameters.motion, aabb.size)); //motion
@ -439,7 +439,7 @@ static void _rest_cbk_result(const Vector2 &p_point_A, const Vector2 &p_point_B,
bool GodotPhysicsDirectSpaceState2D::rest_info(const ShapeParameters &p_parameters, ShapeRestInfo *r_info) {
GodotShape2D *shape = GodotPhysicsServer2D::godot_singleton->shape_owner.get_or_null(p_parameters.shape_rid);
ERR_FAIL_NULL_V(shape, 0);
ERR_FAIL_NULL_V(shape, false);
real_t margin = MAX(p_parameters.margin, TEST_MOTION_MARGIN_MIN_VALUE);

View File

@ -76,8 +76,9 @@ struct _CollectorCallback {
Vector3 *prev_axis = nullptr;
_FORCE_INLINE_ void call(const Vector3 &p_point_A, const Vector3 &p_point_B, Vector3 p_normal) {
if (p_normal.dot(p_point_B - p_point_A) < 0)
if (p_normal.dot(p_point_B - p_point_A) < 0) {
p_normal = -p_normal;
}
if (swap) {
callback(p_point_B, 0, p_point_A, 0, -p_normal, userdata);
} else {
@ -175,10 +176,11 @@ static void _generate_contacts_edge_edge(const Vector3 *p_points_A, int p_point_
// The normal should be perpendicular to both edges.
Vector3 normal = rel_A.cross(rel_B);
real_t normal_len = normal.length();
if (normal_len > 1e-3)
if (normal_len > 1e-3) {
normal /= normal_len;
else
} else {
normal = p_callback->normal;
}
p_callback->call(closest_A, closest_B, normal);
}
@ -784,8 +786,9 @@ static void analytic_sphere_collision(const Vector3 &p_origin_a, real_t p_radius
// Calculate the sphere overlap, and bail if not overlapping
real_t overlap = p_radius_a + p_radius_b - b_to_a_len;
if (overlap < 0)
if (overlap < 0) {
return;
}
// Report collision
p_collector->collided = true;

View File

@ -826,7 +826,7 @@ void GodotPhysicsServer3D::body_set_axis_lock(RID p_body, BodyAxis p_axis, bool
bool GodotPhysicsServer3D::body_is_axis_locked(RID p_body, BodyAxis p_axis) const {
const GodotBody3D *body = body_owner.get_or_null(p_body);
ERR_FAIL_NULL_V(body, 0);
ERR_FAIL_NULL_V(body, false);
return body->is_axis_locked(p_axis);
}

View File

@ -1133,12 +1133,13 @@ void GodotConvexPolygonShape3D::_setup(const Vector<Vector3> &p_vertices) {
max_support = s;
}
}
if (!extreme_vertices.has(best_vertex))
if (!extreme_vertices.has(best_vertex)) {
extreme_vertices.push_back(best_vertex);
}
}
}
}
}
// Record all the neighbors of each vertex. This is used in get_support().

View File

@ -385,7 +385,7 @@ bool GodotPhysicsDirectSpaceState3D::collide_shape(const ShapeParameters &p_para
}
GodotShape3D *shape = GodotPhysicsServer3D::godot_singleton->shape_owner.get_or_null(p_parameters.shape_rid);
ERR_FAIL_NULL_V(shape, 0);
ERR_FAIL_NULL_V(shape, false);
AABB aabb = p_parameters.transform.xform(shape->get_aabb());
aabb = aabb.grow(p_parameters.margin);
@ -511,7 +511,7 @@ static void _rest_cbk_result(const Vector3 &p_point_A, int p_index_A, const Vect
bool GodotPhysicsDirectSpaceState3D::rest_info(const ShapeParameters &p_parameters, ShapeRestInfo *r_info) {
GodotShape3D *shape = GodotPhysicsServer3D::godot_singleton->shape_owner.get_or_null(p_parameters.shape_rid);
ERR_FAIL_NULL_V(shape, 0);
ERR_FAIL_NULL_V(shape, false);
real_t margin = MAX(p_parameters.margin, TEST_MOTION_MARGIN_MIN_VALUE);

View File

@ -647,7 +647,7 @@ void GodotGeneric6DOFJoint3D::set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6
}
bool GodotGeneric6DOFJoint3D::get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const {
ERR_FAIL_INDEX_V(p_axis, 3, 0);
ERR_FAIL_INDEX_V(p_axis, 3, false);
switch (p_flag) {
case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT: {
return m_linearLimits.enable_limit[p_axis];

View File

@ -67,7 +67,7 @@ class NavAgent : public NavRid {
uint32_t avoidance_mask = 1;
real_t avoidance_priority = 1.0;
Callable avoidance_callback = Callable();
Callable avoidance_callback;
bool agent_dirty = true;

View File

@ -341,7 +341,7 @@ XrCompositionLayerBaseHeader *OpenXRViewportCompositionLayerProvider::get_compos
}
XrSwapchainSubImage subimage = {
0, // swapchain
0, // swapchain // NOLINT(modernize-use-nullptr) - 32-bit uses non-pointer uint64
{ { 0, 0 }, { 0, 0 } }, // imageRect
0, // imageArrayIndex
};

View File

@ -173,7 +173,7 @@ void OpenXRDebugUtilsExtension::begin_debug_label_region(const char *p_label_nam
const XrDebugUtilsLabelEXT session_active_region_label = {
XR_TYPE_DEBUG_UTILS_LABEL_EXT, // type
NULL, // next
nullptr, // next
p_label_name, // labelName
};
@ -199,7 +199,7 @@ void OpenXRDebugUtilsExtension::insert_debug_label(const char *p_label_name) {
const XrDebugUtilsLabelEXT session_active_region_label = {
XR_TYPE_DEBUG_UTILS_LABEL_EXT, // type
NULL, // next
nullptr, // next
p_label_name, // labelName
};

View File

@ -298,8 +298,7 @@ void OpenXRExtensionWrapperExtension::register_extension_wrapper() {
OpenXRAPI::register_extension_wrapper(this);
}
OpenXRExtensionWrapperExtension::OpenXRExtensionWrapperExtension() :
Object(), OpenXRExtensionWrapper() {
OpenXRExtensionWrapperExtension::OpenXRExtensionWrapperExtension() {
openxr_api.instantiate();
}

View File

@ -193,7 +193,7 @@ void *OpenXROpenGLExtension::set_session_create_and_get_next_pointer(void *p_nex
// spec says to use proper values but runtimes don't care
graphics_binding_gl.visualid = 0;
graphics_binding_gl.glxFBConfig = 0;
graphics_binding_gl.glxFBConfig = nullptr;
#endif
#endif

View File

@ -2752,8 +2752,9 @@ void OpenXRAPI::parse_velocities(const XrSpaceVelocity &p_velocity, Vector3 &r_l
}
bool OpenXRAPI::xr_result(XrResult result, const char *format, Array args) const {
if (XR_SUCCEEDED(result))
if (XR_SUCCEEDED(result)) {
return true;
}
char resultString[XR_MAX_RESULT_STRING_SIZE];
xrResultToString(instance, result, resultString);

View File

@ -115,7 +115,7 @@ void VideoStreamPlaybackTheora::video_write() {
format = Image::FORMAT_RGBA8;
}
Ref<Image> img = memnew(Image(size.x, size.y, 0, Image::FORMAT_RGBA8, frame_data)); //zero copy image creation
Ref<Image> img = memnew(Image(size.x, size.y, false, Image::FORMAT_RGBA8, frame_data)); //zero copy image creation
texture->update(img); //zero copy send to rendering server

View File

@ -149,7 +149,7 @@ Ref<Image> _webp_unpack(const Vector<uint8_t> &p_buffer) {
ERR_FAIL_COND_V_MSG(errdec, Ref<Image>(), "Failed decoding WebP image.");
Ref<Image> img = memnew(Image(features.width, features.height, 0, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image));
Ref<Image> img = memnew(Image(features.width, features.height, false, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image));
return img;
}

View File

@ -771,11 +771,11 @@ Vector<String> OS_LinuxBSD::get_system_font_path_for_text(const String &p_font_n
FcLangSetAdd(lang_set, reinterpret_cast<const FcChar8 *>(p_locale.utf8().get_data()));
FcPatternAddLangSet(pattern, FC_LANG, lang_set);
FcConfigSubstitute(0, pattern, FcMatchPattern);
FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
FcResult result;
FcPattern *match = FcFontMatch(0, pattern, &result);
FcPattern *match = FcFontMatch(nullptr, pattern, &result);
if (match) {
char *file_name = nullptr;
if (FcPatternGetString(match, FC_FILE, 0, reinterpret_cast<FcChar8 **>(&file_name)) == FcResultMatch) {
@ -816,11 +816,11 @@ String OS_LinuxBSD::get_system_font_path(const String &p_font_name, int p_weight
FcPatternAddInteger(pattern, FC_WIDTH, _stretch_to_fc(p_stretch));
FcPatternAddInteger(pattern, FC_SLANT, p_italic ? FC_SLANT_ITALIC : FC_SLANT_ROMAN);
FcConfigSubstitute(0, pattern, FcMatchPattern);
FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
FcResult result;
FcPattern *match = FcFontMatch(0, pattern, &result);
FcPattern *match = FcFontMatch(nullptr, pattern, &result);
if (match) {
if (!allow_substitutes) {
char *family_name = nullptr;

View File

@ -159,7 +159,7 @@ extern void CrashHandlerException(int signal) {
// Load process and image info to determine ASLR addresses offset.
MODULEINFO mi;
GetModuleInformation(GetCurrentProcess(), GetModuleHandle(NULL), &mi, sizeof(mi));
GetModuleInformation(GetCurrentProcess(), GetModuleHandle(nullptr), &mi, sizeof(mi));
int64_t image_mem_base = reinterpret_cast<int64_t>(mi.lpBaseOfDll);
int64_t image_file_base = get_image_base(_execpath);
data.offset = image_mem_base - image_file_base;

View File

@ -735,7 +735,7 @@ Error DisplayServerWindows::_file_dialog_with_options_show(const String &p_title
GetWindowRect(fd->hwnd_owner, &crect);
fd->wrect = Rect2i(crect.left, crect.top, crect.right - crect.left, crect.bottom - crect.top);
} else {
fd->hwnd_owner = 0;
fd->hwnd_owner = nullptr;
fd->wrect = Rect2i(CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT);
}
fd->appid = appname;

View File

@ -122,8 +122,9 @@ bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
memcmp(p_guid, &IID_XOneSWirelessGamepad, sizeof(*p_guid)) == 0 ||
memcmp(p_guid, &IID_XOneSBluetoothGamepad, sizeof(*p_guid)) == 0 ||
memcmp(p_guid, &IID_XOneEliteWirelessGamepad, sizeof(*p_guid)) == 0 ||
memcmp(p_guid, &IID_XOneElite2WirelessGamepad, sizeof(*p_guid)) == 0)
memcmp(p_guid, &IID_XOneElite2WirelessGamepad, sizeof(*p_guid)) == 0) {
return true;
}
PRAWINPUTDEVICELIST dev_list = nullptr;
unsigned int dev_list_count = 0;

View File

@ -158,7 +158,7 @@ Size2 NativeMenuWindows::get_size(const RID &p_rid) const {
int count = GetMenuItemCount(md->menu);
for (int i = 0; i < count; i++) {
RECT rect;
if (GetMenuItemRect(NULL, md->menu, i, &rect)) {
if (GetMenuItemRect(nullptr, md->menu, i, &rect)) {
size.x = MAX(size.x, rect.right - rect.left);
size.y += rect.bottom - rect.top;
}
@ -992,7 +992,7 @@ void NativeMenuWindows::set_item_submenu(const RID &p_rid, int p_idx, const RID
if (p_submenu_rid.is_valid()) {
item.hSubMenu = md_sub->menu;
} else {
item.hSubMenu = 0;
item.hSubMenu = nullptr;
}
SetMenuItemInfoW(md->menu, p_idx, true, &item);
}
@ -1095,7 +1095,7 @@ void NativeMenuWindows::set_item_icon(const RID &p_rid, int p_idx, const Ref<Tex
item_data->bmp = _make_bitmap(item_data->img);
} else {
item_data->img = Ref<Image>();
item_data->bmp = 0;
item_data->bmp = nullptr;
}
item.hbmpItem = item_data->bmp;
SetMenuItemInfoW(md->menu, p_idx, true, &item);

View File

@ -139,13 +139,13 @@ void RedirectIOToConsole() {
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
// Restore redirection (Note: if not redirected it's NULL handles not INVALID_HANDLE_VALUE).
if (h_stdin != 0) {
if (h_stdin != nullptr) {
SetStdHandle(STD_INPUT_HANDLE, h_stdin);
}
if (h_stdout != 0) {
if (h_stdout != nullptr) {
SetStdHandle(STD_OUTPUT_HANDLE, h_stdout);
}
if (h_stderr != 0) {
if (h_stderr != nullptr) {
SetStdHandle(STD_ERROR_HANDLE, h_stderr);
}
@ -908,9 +908,9 @@ Dictionary OS_Windows::execute_with_pipe(const String &p_path, const List<String
}
// Create pipes.
HANDLE pipe_in[2] = { 0, 0 };
HANDLE pipe_out[2] = { 0, 0 };
HANDLE pipe_err[2] = { 0, 0 };
HANDLE pipe_in[2] = { nullptr, nullptr };
HANDLE pipe_out[2] = { nullptr, nullptr };
HANDLE pipe_err[2] = { nullptr, nullptr };
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
@ -981,7 +981,7 @@ Dictionary OS_Windows::execute_with_pipe(const String &p_path, const List<String
Ref<FileAccessWindowsPipe> err_pipe;
err_pipe.instantiate();
err_pipe->open_existing(pipe_err[0], 0, p_blocking);
err_pipe->open_existing(pipe_err[0], nullptr, p_blocking);
ret["stdio"] = main_pipe;
ret["stderr"] = err_pipe;

View File

@ -67,11 +67,11 @@ Error WindowsUtils::copy_and_rename_pdb(const String &p_dll_path) {
{
// The custom LoadLibraryExW is used instead of open_dynamic_library
// to avoid loading the original PDB into the debugger.
HMODULE library_ptr = LoadLibraryExW((LPCWSTR)(p_dll_path.utf16().get_data()), NULL, LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE);
HMODULE library_ptr = LoadLibraryExW((LPCWSTR)(p_dll_path.utf16().get_data()), nullptr, LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE);
ERR_FAIL_NULL_V_MSG(library_ptr, ERR_FILE_CANT_OPEN, vformat("Failed to load library '%s'.", p_dll_path));
IMAGE_DEBUG_DIRECTORY *dbg_dir = (IMAGE_DEBUG_DIRECTORY *)ImageDirectoryEntryToDataEx(library_ptr, FALSE, IMAGE_DIRECTORY_ENTRY_DEBUG, &dbg_info_size, NULL);
IMAGE_DEBUG_DIRECTORY *dbg_dir = (IMAGE_DEBUG_DIRECTORY *)ImageDirectoryEntryToDataEx(library_ptr, FALSE, IMAGE_DIRECTORY_ENTRY_DEBUG, &dbg_info_size, nullptr);
bool has_debug = dbg_dir && dbg_dir->Type == IMAGE_DEBUG_TYPE_CODEVIEW;
if (has_debug) {

View File

@ -162,7 +162,7 @@ private:
Vector<int> parentless_bones;
AHashMap<String, int> name_to_bone_index;
mutable StringName concatenated_bone_names = StringName();
mutable StringName concatenated_bone_names;
void _update_bone_names() const;
void _make_dirty();

View File

@ -131,7 +131,7 @@ class SkeletonIK3D : public SkeletonModifier3D {
real_t min_distance = 0.01;
int max_iterations = 10;
Variant target_node_override_ref = Variant();
Variant target_node_override_ref;
FabrikInverseKinematic::Task *task = nullptr;
#ifndef DISABLE_DEPRECATED

View File

@ -251,13 +251,13 @@ private:
Ref<Texture2D> completion_color_bg;
Color breakpoint_color = Color(1, 1, 1);
Ref<Texture2D> breakpoint_icon = Ref<Texture2D>();
Ref<Texture2D> breakpoint_icon;
Color bookmark_color = Color(1, 1, 1);
Ref<Texture2D> bookmark_icon = Ref<Texture2D>();
Ref<Texture2D> bookmark_icon;
Color executing_line_color = Color(1, 1, 1);
Ref<Texture2D> executing_line_icon = Ref<Texture2D>();
Ref<Texture2D> executing_line_icon;
Color line_number_color = Color(1, 1, 1);

View File

@ -5069,7 +5069,7 @@ bool TextEdit::multicaret_edit_ignore_caret(int p_caret) const {
}
bool TextEdit::is_caret_visible(int p_caret) const {
ERR_FAIL_INDEX_V(p_caret, carets.size(), 0);
ERR_FAIL_INDEX_V(p_caret, carets.size(), false);
return carets[p_caret].visible;
}
@ -5736,7 +5736,7 @@ TextServer::AutowrapMode TextEdit::get_autowrap_mode() const {
}
bool TextEdit::is_line_wrapped(int p_line) const {
ERR_FAIL_INDEX_V(p_line, text.size(), 0);
ERR_FAIL_INDEX_V(p_line, text.size(), false);
if (get_line_wrapping_mode() == LineWrappingMode::LINE_WRAPPING_NONE) {
return false;
}

View File

@ -139,7 +139,7 @@ private:
Variant metadata;
bool clickable = false;
Ref<Texture2D> icon = Ref<Texture2D>();
Ref<Texture2D> icon;
String text = "";
Color color = Color(1, 1, 1);
};

View File

@ -64,7 +64,7 @@ public:
execution_mode_physics_process
};
Vector<Ref<SkeletonModification2D>> modifications = Vector<Ref<SkeletonModification2D>>();
Vector<Ref<SkeletonModification2D>> modifications;
void setup();
void execute(float p_delta, int p_execution_mode);

View File

@ -836,7 +836,7 @@ private:
bool flip_v = false;
bool transpose = false;
Vector2i texture_origin;
Ref<Material> material = Ref<Material>();
Ref<Material> material;
Color modulate = Color(1.0, 1.0, 1.0, 1.0);
int z_index = 0;
int y_sort_origin = 0;

View File

@ -647,13 +647,13 @@ void FontFile::_convert_packed_8bit(Ref<Image> &p_source, int p_page, int p_sz)
wa[ofs_dst + 1] = r[ofs_src + 3];
}
}
Ref<Image> img_r = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_r));
Ref<Image> img_r = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_r));
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 0, img_r);
Ref<Image> img_g = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_g));
Ref<Image> img_g = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_g));
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 1, img_g);
Ref<Image> img_b = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_b));
Ref<Image> img_b = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_b));
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 2, img_b);
Ref<Image> img_a = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_a));
Ref<Image> img_a = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_a));
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 3, img_a);
}
@ -738,22 +738,22 @@ void FontFile::_convert_packed_4bit(Ref<Image> &p_source, int p_page, int p_sz)
}
}
}
Ref<Image> img_r = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_r));
Ref<Image> img_r = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_r));
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 0, img_r);
Ref<Image> img_g = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_g));
Ref<Image> img_g = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_g));
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 1, img_g);
Ref<Image> img_b = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_b));
Ref<Image> img_b = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_b));
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 2, img_b);
Ref<Image> img_a = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_a));
Ref<Image> img_a = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_a));
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 3, img_a);
Ref<Image> img_ro = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_ro));
Ref<Image> img_ro = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_ro));
set_texture_image(0, Vector2i(p_sz, 1), p_page * 4 + 0, img_ro);
Ref<Image> img_go = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_go));
Ref<Image> img_go = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_go));
set_texture_image(0, Vector2i(p_sz, 1), p_page * 4 + 1, img_go);
Ref<Image> img_bo = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_bo));
Ref<Image> img_bo = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_bo));
set_texture_image(0, Vector2i(p_sz, 1), p_page * 4 + 2, img_bo);
Ref<Image> img_ao = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_ao));
Ref<Image> img_ao = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_ao));
set_texture_image(0, Vector2i(p_sz, 1), p_page * 4 + 3, img_ao);
}
@ -806,10 +806,10 @@ void FontFile::_convert_rgba_4bit(Ref<Image> &p_source, int p_page, int p_sz) {
}
}
}
Ref<Image> img_g = memnew(Image(w, h, 0, Image::FORMAT_RGBA8, imgdata_g));
Ref<Image> img_g = memnew(Image(w, h, false, Image::FORMAT_RGBA8, imgdata_g));
set_texture_image(0, Vector2i(p_sz, 0), p_page, img_g);
Ref<Image> img_o = memnew(Image(w, h, 0, Image::FORMAT_RGBA8, imgdata_o));
Ref<Image> img_o = memnew(Image(w, h, false, Image::FORMAT_RGBA8, imgdata_o));
set_texture_image(0, Vector2i(p_sz, 1), p_page, img_o);
}
@ -838,7 +838,7 @@ void FontFile::_convert_mono_8bit(Ref<Image> &p_source, int p_page, int p_ch, in
wg[ofs_dst + 1] = r[ofs_src + p_ch];
}
}
Ref<Image> img_g = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_g));
Ref<Image> img_g = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_g));
set_texture_image(0, Vector2i(p_sz, p_ol), p_page, img_g);
}
@ -878,10 +878,10 @@ void FontFile::_convert_mono_4bit(Ref<Image> &p_source, int p_page, int p_ch, in
}
}
}
Ref<Image> img_g = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_g));
Ref<Image> img_g = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_g));
set_texture_image(0, Vector2i(p_sz, 0), p_page, img_g);
Ref<Image> img_o = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_o));
Ref<Image> img_o = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_o));
set_texture_image(0, Vector2i(p_sz, p_ol), p_page, img_o);
}

View File

@ -281,7 +281,7 @@ double AudioStream::get_bpm() const {
}
bool AudioStream::has_loop() const {
bool ret = 0;
bool ret = false;
GDVIRTUAL_CALL(_has_loop, ret);
return ret;
}

View File

@ -612,8 +612,9 @@ void RendererCanvasCull::canvas_item_set_visibility_layer(RID p_item, uint32_t p
uint32_t RendererCanvasCull::canvas_item_get_visibility_layer(RID p_item) {
Item *canvas_item = canvas_item_owner.get_or_null(p_item);
if (!canvas_item)
if (!canvas_item) {
return 0;
}
return canvas_item->visibility_layer;
}

View File

@ -350,7 +350,7 @@ bool GI::voxel_gi_is_using_two_bounces(RID p_voxel_gi) const {
bool GI::voxel_gi_is_interior(RID p_voxel_gi) const {
VoxelGI *voxel_gi = voxel_gi_owner.get_or_null(p_voxel_gi);
ERR_FAIL_NULL_V(voxel_gi, 0);
ERR_FAIL_NULL_V(voxel_gi, false);
return voxel_gi->interior;
}

View File

@ -511,7 +511,7 @@ public:
_FORCE_INLINE_ bool particles_has_collision(RID p_particles) {
Particles *particles = particles_owner.get_or_null(p_particles);
ERR_FAIL_NULL_V(particles, 0);
ERR_FAIL_NULL_V(particles, false);
return particles->has_collision_cache;
}

View File

@ -102,9 +102,9 @@ private:
/* Canvas Texture API */
struct CanvasTextureCache {
RID diffuse = RID();
RID normal = RID();
RID specular = RID();
RID diffuse;
RID normal;
RID specular;
};
class CanvasTexture {

View File

@ -1213,7 +1213,7 @@ public:
struct ShaderCompileInfo {
HashMap<StringName, FunctionInfo> functions;
Vector<ModeInfo> render_modes;
VaryingFunctionNames varying_function_names = VaryingFunctionNames();
VaryingFunctionNames varying_function_names;
HashSet<String> shader_types;
GlobalShaderUniformGetTypeFunc global_shader_uniform_type_func = nullptr;
bool is_include = false;

View File

@ -309,7 +309,7 @@ RID RenderingServer::get_white_texture() {
w[i] = 255;
}
}
Ref<Image> white = memnew(Image(4, 4, 0, Image::FORMAT_RGB8, wt));
Ref<Image> white = memnew(Image(4, 4, false, Image::FORMAT_RGB8, wt));
white_texture = texture_2d_create(white);
return white_texture;
}

View File

@ -104,9 +104,10 @@ TEST_CASE("[SceneTree][Primitive][Capsule] Capsule Primitive") {
float dist_to_yaxis = 0.f;
for (Vector3 point : points) {
float new_dist_to_y = point.x * point.x + point.z * point.z;
if (new_dist_to_y > dist_to_yaxis)
if (new_dist_to_y > dist_to_yaxis) {
dist_to_yaxis = new_dist_to_y;
}
}
CHECK(dist_to_yaxis <= radius * radius);
@ -114,11 +115,13 @@ TEST_CASE("[SceneTree][Primitive][Capsule] Capsule Primitive") {
float max_y{ 0.f };
float min_y{ 0.f };
for (Vector3 point : points) {
if (point.y > max_y)
if (point.y > max_y) {
max_y = point.y;
if (point.y < min_y)
}
if (point.y < min_y) {
min_y = point.y;
}
}
CHECK(max_y - min_y <= height);
}
@ -196,13 +199,15 @@ TEST_CASE("[SceneTree][Primitive][Box] Box Primitive") {
for (const Vector3 &normal : normals) {
bool add_normal{ true };
for (const Vector3 &vec : distinct_normals) {
if (vec.is_equal_approx(normal))
if (vec.is_equal_approx(normal)) {
add_normal = false;
}
}
if (add_normal)
if (add_normal) {
distinct_normals.push_back(normal);
}
}
CHECK_MESSAGE(distinct_normals.size() == 6,
"There are exactly 6 distinct normals in the mesh data.");
@ -218,9 +223,10 @@ TEST_CASE("[SceneTree][Primitive][Box] Box Primitive") {
break;
}
}
if (!normal_correct_direction)
if (!normal_correct_direction) {
break;
}
}
CHECK_MESSAGE(normal_correct_direction,
"All normals are either orthogonal or colinear.");

View File

@ -49,7 +49,7 @@ public:
}
unsigned function1_calls{ 0 };
Variant function1_latest_arg0{};
Variant function1_latest_arg0;
};
static inline Array build_array() {

View File

@ -474,6 +474,6 @@ public:
for (int i = 0; i < string_list.size(); ++i) { \
CHECK(string_list[i] == m_slices[i]); \
} \
} while (0)
} while (false)
#endif // TEST_MACROS_H