mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Merge pull request #104375 from YYF233333/is_empty
Replace `size() == 0` with `is_empty()`
This commit is contained in:
commit
9f222d500d
153 changed files with 316 additions and 316 deletions
|
|
@ -242,7 +242,7 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
|
|||
} else if (line.begins_with("br") || line.begins_with("break")) {
|
||||
if (line.get_slice_count(" ") <= 1) {
|
||||
const HashMap<int, HashSet<StringName>> &breakpoints = script_debugger->get_breakpoints();
|
||||
if (breakpoints.size() == 0) {
|
||||
if (breakpoints.is_empty()) {
|
||||
print_line("No Breakpoints.");
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -533,7 +533,7 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
|
|||
ERR_FAIL_COND(data.is_empty());
|
||||
script_debugger->set_skip_breakpoints(data[0]);
|
||||
} else if (command == "set_ignore_error_breaks") {
|
||||
ERR_FAIL_COND(data.size() < 1);
|
||||
ERR_FAIL_COND(data.is_empty());
|
||||
script_debugger->set_ignore_error_breaks(data[0]);
|
||||
} else if (command == "evaluate") {
|
||||
String expression_str = data[0];
|
||||
|
|
@ -675,7 +675,7 @@ Error RemoteDebugger::_core_capture(const String &p_cmd, const Array &p_data, bo
|
|||
ERR_FAIL_COND_V(p_data.is_empty(), ERR_INVALID_DATA);
|
||||
script_debugger->set_skip_breakpoints(p_data[0]);
|
||||
} else if (p_cmd == "set_ignore_error_breaks") {
|
||||
ERR_FAIL_COND_V(p_data.size() < 1, ERR_INVALID_DATA);
|
||||
ERR_FAIL_COND_V(p_data.is_empty(), ERR_INVALID_DATA);
|
||||
script_debugger->set_ignore_error_breaks(p_data[0]);
|
||||
} else if (p_cmd == "break") {
|
||||
script_debugger->debug(script_debugger->get_break_language());
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ void RemoteDebuggerPeerTCP::_write_out() {
|
|||
while (tcp_client->get_status() == StreamPeerTCP::STATUS_CONNECTED && tcp_client->wait(NetSocket::POLL_TYPE_OUT) == OK) {
|
||||
uint8_t *buf = out_buf.ptrw();
|
||||
if (out_left <= 0) {
|
||||
if (out_queue.size() == 0) {
|
||||
if (out_queue.is_empty()) {
|
||||
break; // Nothing left to send
|
||||
}
|
||||
mutex.lock();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ void ScriptDebugger::remove_breakpoint(int p_line, const StringName &p_source) {
|
|||
}
|
||||
|
||||
breakpoints[p_line].erase(p_source);
|
||||
if (breakpoints[p_line].size() == 0) {
|
||||
if (breakpoints[p_line].is_empty()) {
|
||||
breakpoints.erase(p_line);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public:
|
|||
// Must be an operator or a constructor since there is no other overloading
|
||||
if (name.left(8) == "operator") {
|
||||
if (arguments.size() == p_method.arguments.size()) {
|
||||
if (arguments.size() == 0) {
|
||||
if (arguments.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
return arguments[0].type < p_method.arguments[0].type;
|
||||
|
|
@ -126,7 +126,7 @@ public:
|
|||
// - 1. Default constructor: Foo()
|
||||
// - 2. Copy constructor: Foo(Foo)
|
||||
// - 3+. Other constructors Foo(Bar, ...) based on first argument's name
|
||||
if (arguments.size() == 0 || p_method.arguments.size() == 0) { // 1.
|
||||
if (arguments.is_empty() || p_method.arguments.is_empty()) { // 1.
|
||||
return arguments.size() < p_method.arguments.size();
|
||||
}
|
||||
if (arguments[0].type == return_type || p_method.arguments[0].type == p_method.return_type) { // 2.
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ static bool _are_formats_compatible(Image::Format p_format0, Image::Format p_for
|
|||
void Image::convert(Format p_new_format) {
|
||||
ERR_FAIL_INDEX_MSG(p_new_format, FORMAT_MAX, vformat("The Image format specified (%d) is out of range. See Image's Format enum.", p_new_format));
|
||||
|
||||
if (data.size() == 0 || p_new_format == format) {
|
||||
if (data.is_empty() || p_new_format == format) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2177,7 +2177,7 @@ void Image::clear_mipmaps() {
|
|||
}
|
||||
|
||||
bool Image::is_empty() const {
|
||||
return (data.size() == 0);
|
||||
return (data.is_empty());
|
||||
}
|
||||
|
||||
Vector<uint8_t> Image::get_data() const {
|
||||
|
|
@ -3096,7 +3096,7 @@ void Image::_repeat_pixel_over_subsequent_memory(uint8_t *p_pixel, int p_pixel_s
|
|||
}
|
||||
|
||||
void Image::fill(const Color &p_color) {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot fill in compressed image formats.");
|
||||
|
|
@ -3112,7 +3112,7 @@ void Image::fill(const Color &p_color) {
|
|||
}
|
||||
|
||||
void Image::fill_rect(const Rect2i &p_rect, const Color &p_color) {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot fill rect in compressed image formats.");
|
||||
|
|
@ -3734,7 +3734,7 @@ void Image::normal_map_to_xy() {
|
|||
}
|
||||
|
||||
Ref<Image> Image::rgbe_to_srgb() {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return Ref<Image>();
|
||||
}
|
||||
|
||||
|
|
@ -3856,7 +3856,7 @@ bool Image::detect_signed(bool p_include_mips) const {
|
|||
}
|
||||
|
||||
void Image::srgb_to_linear() {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3887,7 +3887,7 @@ void Image::srgb_to_linear() {
|
|||
}
|
||||
|
||||
void Image::linear_to_srgb() {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3918,7 +3918,7 @@ void Image::linear_to_srgb() {
|
|||
}
|
||||
|
||||
void Image::premultiply_alpha() {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3940,7 +3940,7 @@ void Image::premultiply_alpha() {
|
|||
}
|
||||
|
||||
void Image::fix_alpha_edges() {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ public:
|
|||
}
|
||||
|
||||
Vector<Vector3> convex_points = Geometry3D::compute_convex_mesh_points(&p_convex[0], p_convex.size());
|
||||
if (convex_points.size() == 0) {
|
||||
if (convex_points.is_empty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2237,7 +2237,7 @@ real_t ConvexHullComputer::compute(const Vector3 *p_coords, int32_t p_count, rea
|
|||
Error ConvexHullComputer::convex_hull(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_mesh) {
|
||||
r_mesh = Geometry3D::MeshData(); // clear
|
||||
|
||||
if (p_points.size() == 0) {
|
||||
if (p_points.is_empty()) {
|
||||
return FAILED; // matches QuickHull
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ public:
|
|||
LOC_OUTSIDE = -1
|
||||
};
|
||||
|
||||
if (polygon.size() == 0) {
|
||||
if (polygon.is_empty()) {
|
||||
return polygon;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
|
|||
|
||||
for (List<Face>::Element *&E : new_faces) {
|
||||
Face &f2 = E->get();
|
||||
if (f2.points_over.size() == 0) {
|
||||
if (f2.points_over.is_empty()) {
|
||||
faces.move_to_front(E);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ void CallQueue::_call_function(const Callable &p_callable, const Variant *p_args
|
|||
Error CallQueue::flush() {
|
||||
LOCK_MUTEX;
|
||||
|
||||
if (pages.size() == 0) {
|
||||
if (pages.is_empty()) {
|
||||
// Never allocated
|
||||
UNLOCK_MUTEX;
|
||||
return OK; // Do nothing.
|
||||
|
|
@ -308,7 +308,7 @@ Error CallQueue::flush() {
|
|||
void CallQueue::clear() {
|
||||
LOCK_MUTEX;
|
||||
|
||||
if (pages.size() == 0) {
|
||||
if (pages.is_empty()) {
|
||||
UNLOCK_MUTEX;
|
||||
return; // Nothing to clear.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1900,7 +1900,7 @@ Variant::Type Object::get_static_property_type(const StringName &p_property, boo
|
|||
}
|
||||
|
||||
Variant::Type Object::get_static_property_type_indexed(const Vector<StringName> &p_path, bool *r_valid) const {
|
||||
if (p_path.size() == 0) {
|
||||
if (p_path.is_empty()) {
|
||||
if (r_valid) {
|
||||
*r_valid = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -513,7 +513,7 @@ public:
|
|||
virtual void debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1) override {
|
||||
Dictionary ret;
|
||||
GDVIRTUAL_CALL(_debug_get_stack_level_locals, p_level, p_max_subitems, p_max_depth, ret);
|
||||
if (ret.size() == 0) {
|
||||
if (ret.is_empty()) {
|
||||
return;
|
||||
}
|
||||
if (p_locals != nullptr && ret.has("locals")) {
|
||||
|
|
@ -533,7 +533,7 @@ public:
|
|||
virtual void debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1) override {
|
||||
Dictionary ret;
|
||||
GDVIRTUAL_CALL(_debug_get_stack_level_members, p_level, p_max_subitems, p_max_depth, ret);
|
||||
if (ret.size() == 0) {
|
||||
if (ret.is_empty()) {
|
||||
return;
|
||||
}
|
||||
if (p_members != nullptr && ret.has("members")) {
|
||||
|
|
@ -560,7 +560,7 @@ public:
|
|||
virtual void debug_get_globals(List<String> *p_globals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1) override {
|
||||
Dictionary ret;
|
||||
GDVIRTUAL_CALL(_debug_get_globals, p_max_subitems, p_max_depth, ret);
|
||||
if (ret.size() == 0) {
|
||||
if (ret.is_empty()) {
|
||||
return;
|
||||
}
|
||||
if (p_globals != nullptr && ret.has("globals")) {
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ void WorkerThreadPool::_post_tasks(Task **p_tasks, uint32_t p_count, bool p_high
|
|||
// Fall back to processing on the calling thread if there are no worker threads.
|
||||
// Separated into its own variable to make it easier to extend this logic
|
||||
// in custom builds.
|
||||
bool process_on_calling_thread = threads.size() == 0;
|
||||
bool process_on_calling_thread = threads.is_empty();
|
||||
if (process_on_calling_thread) {
|
||||
p_lock.temp_unlock();
|
||||
for (uint32_t i = 0; i < p_count; i++) {
|
||||
|
|
@ -789,7 +789,7 @@ void WorkerThreadPool::init(int p_thread_count, float p_low_priority_task_ratio)
|
|||
}
|
||||
|
||||
void WorkerThreadPool::exit_languages_threads() {
|
||||
if (threads.size() == 0) {
|
||||
if (threads.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -809,7 +809,7 @@ void WorkerThreadPool::exit_languages_threads() {
|
|||
}
|
||||
|
||||
void WorkerThreadPool::finish() {
|
||||
if (threads.size() == 0) {
|
||||
if (threads.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ String keycode_get_string(Key p_code) {
|
|||
Key find_keycode(const String &p_codestr) {
|
||||
Key keycode = Key::NONE;
|
||||
Vector<String> code_parts = p_codestr.split("+");
|
||||
if (code_parts.size() < 1) {
|
||||
if (code_parts.is_empty()) {
|
||||
return keycode;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ void NodePath::simplify() {
|
|||
data->path.remove_at(i - 1);
|
||||
data->path.remove_at(i - 1);
|
||||
i -= 2;
|
||||
if (data->path.size() == 0) {
|
||||
if (data->path.is_empty()) {
|
||||
data->path.push_back(".");
|
||||
break;
|
||||
}
|
||||
|
|
@ -366,7 +366,7 @@ NodePath NodePath::simplified() const {
|
|||
}
|
||||
|
||||
NodePath::NodePath(const Vector<StringName> &p_path, bool p_absolute) {
|
||||
if (p_path.size() == 0 && !p_absolute) {
|
||||
if (p_path.is_empty() && !p_absolute) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -378,7 +378,7 @@ NodePath::NodePath(const Vector<StringName> &p_path, bool p_absolute) {
|
|||
}
|
||||
|
||||
NodePath::NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p_subpath, bool p_absolute) {
|
||||
if (p_path.size() == 0 && p_subpath.size() == 0 && !p_absolute) {
|
||||
if (p_path.is_empty() && p_subpath.is_empty() && !p_absolute) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void OptimizedTranslation::generate(const Ref<Translation> &p_from) {
|
|||
const Vector<Pair<int, CharString>> &b = buckets[i];
|
||||
HashMap<uint32_t, int> &t = table.write[i];
|
||||
|
||||
if (b.size() == 0) {
|
||||
if (b.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ void OptimizedTranslation::generate(const Ref<Translation> &p_from) {
|
|||
|
||||
for (int i = 0; i < size; i++) {
|
||||
const HashMap<uint32_t, int> &t = table[i];
|
||||
if (t.size() == 0) {
|
||||
if (t.is_empty()) {
|
||||
htw[i] = 0xFFFFFFFF; //nothing
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3298,7 +3298,7 @@ int String::findmk(const Vector<String> &p_keys, int p_from, int *r_key) const {
|
|||
if (p_from < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (p_keys.size() == 0) {
|
||||
if (p_keys.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ Variant Array::pick_random() const {
|
|||
}
|
||||
|
||||
int Array::find(const Variant &p_value, int p_from) const {
|
||||
if (_p->array.size() == 0) {
|
||||
if (_p->array.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
Variant value = p_value;
|
||||
|
|
@ -396,7 +396,7 @@ int Array::find_custom(const Callable &p_callable, int p_from) const {
|
|||
}
|
||||
|
||||
int Array::rfind(const Variant &p_value, int p_from) const {
|
||||
if (_p->array.size() == 0) {
|
||||
if (_p->array.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
Variant value = p_value;
|
||||
|
|
@ -421,7 +421,7 @@ int Array::rfind(const Variant &p_value, int p_from) const {
|
|||
}
|
||||
|
||||
int Array::rfind_custom(const Callable &p_callable, int p_from) const {
|
||||
if (_p->array.size() == 0) {
|
||||
if (_p->array.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ int Array::rfind_custom(const Callable &p_callable, int p_from) const {
|
|||
int Array::count(const Variant &p_value) const {
|
||||
Variant value = p_value;
|
||||
ERR_FAIL_COND_V(!_p->typed.validate(value, "count"), 0);
|
||||
if (_p->array.size() == 0) {
|
||||
if (_p->array.is_empty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -984,34 +984,34 @@ bool Variant::is_zero() const {
|
|||
|
||||
// Arrays.
|
||||
case PACKED_BYTE_ARRAY: {
|
||||
return PackedArrayRef<uint8_t>::get_array(_data.packed_array).size() == 0;
|
||||
return PackedArrayRef<uint8_t>::get_array(_data.packed_array).is_empty();
|
||||
}
|
||||
case PACKED_INT32_ARRAY: {
|
||||
return PackedArrayRef<int32_t>::get_array(_data.packed_array).size() == 0;
|
||||
return PackedArrayRef<int32_t>::get_array(_data.packed_array).is_empty();
|
||||
}
|
||||
case PACKED_INT64_ARRAY: {
|
||||
return PackedArrayRef<int64_t>::get_array(_data.packed_array).size() == 0;
|
||||
return PackedArrayRef<int64_t>::get_array(_data.packed_array).is_empty();
|
||||
}
|
||||
case PACKED_FLOAT32_ARRAY: {
|
||||
return PackedArrayRef<float>::get_array(_data.packed_array).size() == 0;
|
||||
return PackedArrayRef<float>::get_array(_data.packed_array).is_empty();
|
||||
}
|
||||
case PACKED_FLOAT64_ARRAY: {
|
||||
return PackedArrayRef<double>::get_array(_data.packed_array).size() == 0;
|
||||
return PackedArrayRef<double>::get_array(_data.packed_array).is_empty();
|
||||
}
|
||||
case PACKED_STRING_ARRAY: {
|
||||
return PackedArrayRef<String>::get_array(_data.packed_array).size() == 0;
|
||||
return PackedArrayRef<String>::get_array(_data.packed_array).is_empty();
|
||||
}
|
||||
case PACKED_VECTOR2_ARRAY: {
|
||||
return PackedArrayRef<Vector2>::get_array(_data.packed_array).size() == 0;
|
||||
return PackedArrayRef<Vector2>::get_array(_data.packed_array).is_empty();
|
||||
}
|
||||
case PACKED_VECTOR3_ARRAY: {
|
||||
return PackedArrayRef<Vector3>::get_array(_data.packed_array).size() == 0;
|
||||
return PackedArrayRef<Vector3>::get_array(_data.packed_array).is_empty();
|
||||
}
|
||||
case PACKED_COLOR_ARRAY: {
|
||||
return PackedArrayRef<Color>::get_array(_data.packed_array).size() == 0;
|
||||
return PackedArrayRef<Color>::get_array(_data.packed_array).is_empty();
|
||||
}
|
||||
case PACKED_VECTOR4_ARRAY: {
|
||||
return PackedArrayRef<Vector4>::get_array(_data.packed_array).size() == 0;
|
||||
return PackedArrayRef<Vector4>::get_array(_data.packed_array).is_empty();
|
||||
}
|
||||
default: {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1572,7 +1572,7 @@ void RasterizerCanvasGLES3::_add_to_batch(uint32_t &r_index, bool &r_batch_broke
|
|||
}
|
||||
|
||||
void RasterizerCanvasGLES3::_new_batch(bool &r_batch_broken) {
|
||||
if (state.canvas_instance_batches.size() == 0) {
|
||||
if (state.canvas_instance_batches.is_empty()) {
|
||||
Batch new_batch;
|
||||
new_batch.instance_buffer_index = state.current_instance_buffer_index;
|
||||
state.canvas_instance_batches.push_back(new_batch);
|
||||
|
|
|
|||
|
|
@ -3218,11 +3218,11 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
|
|||
spec_constants |= SceneShaderGLES3::DISABLE_LIGHT_DIRECTIONAL;
|
||||
spec_constants |= SceneShaderGLES3::DISABLE_LIGHTMAP;
|
||||
} else {
|
||||
if (inst->omni_light_gl_cache.size() == 0) {
|
||||
if (inst->omni_light_gl_cache.is_empty()) {
|
||||
spec_constants |= SceneShaderGLES3::DISABLE_LIGHT_OMNI;
|
||||
}
|
||||
|
||||
if (inst->spot_light_gl_cache.size() == 0) {
|
||||
if (inst->spot_light_gl_cache.is_empty()) {
|
||||
spec_constants |= SceneShaderGLES3::DISABLE_LIGHT_SPOT;
|
||||
}
|
||||
|
||||
|
|
@ -3230,7 +3230,7 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
|
|||
spec_constants |= SceneShaderGLES3::DISABLE_LIGHT_DIRECTIONAL;
|
||||
}
|
||||
|
||||
if (inst->reflection_probe_rid_cache.size() == 0) {
|
||||
if (inst->reflection_probe_rid_cache.is_empty()) {
|
||||
// We don't have any probes.
|
||||
spec_constants |= SceneShaderGLES3::DISABLE_REFLECTION_PROBE;
|
||||
} else if (inst->reflection_probe_rid_cache.size() > 1) {
|
||||
|
|
|
|||
|
|
@ -690,7 +690,7 @@ void ShaderGLES3::_save_to_cache(Version *p_version) {
|
|||
|
||||
void ShaderGLES3::_clear_version(Version *p_version) {
|
||||
// Variants not compiled yet, just return
|
||||
if (p_version->variants.size() == 0) {
|
||||
if (p_version->variants.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ protected:
|
|||
Version *version = version_owner.get_or_null(p_version);
|
||||
ERR_FAIL_NULL_V(version, false);
|
||||
|
||||
if (version->variants.size() == 0) {
|
||||
if (version->variants.is_empty()) {
|
||||
_initialize_version(version); //may lack initialization
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2042,7 +2042,7 @@ void AnimationBezierTrackEdit::_menu_selected(int p_index) {
|
|||
}
|
||||
|
||||
void AnimationBezierTrackEdit::duplicate_selected_keys(real_t p_ofs, bool p_ofs_valid) {
|
||||
if (selection.size() == 0) {
|
||||
if (selection.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6623,7 +6623,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
|
|||
}
|
||||
} break;
|
||||
case EDIT_PASTE_TRACKS: {
|
||||
if (track_clipboard.size() == 0) {
|
||||
if (track_clipboard.is_empty()) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Clipboard is empty!"));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1730,7 +1730,7 @@ void CodeTextEditor::toggle_bookmark() {
|
|||
|
||||
void CodeTextEditor::goto_next_bookmark() {
|
||||
PackedInt32Array bmarks = text_editor->get_bookmarked_lines();
|
||||
if (bmarks.size() <= 0) {
|
||||
if (bmarks.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1746,7 +1746,7 @@ void CodeTextEditor::goto_next_bookmark() {
|
|||
|
||||
void CodeTextEditor::goto_prev_bookmark() {
|
||||
PackedInt32Array bmarks = text_editor->get_bookmarked_lines();
|
||||
if (bmarks.size() <= 0) {
|
||||
if (bmarks.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ void ScriptEditorDebugger::_msg_debug_exit(uint64_t p_thread_id, const Array &p_
|
|||
threads_debugged.erase(p_thread_id);
|
||||
if (p_thread_id == debugging_thread_id) {
|
||||
_clear_execution();
|
||||
if (threads_debugged.size() == 0) {
|
||||
if (threads_debugged.is_empty()) {
|
||||
debugging_thread_id = Thread::UNASSIGNED_ID;
|
||||
} else {
|
||||
// Find next thread to debug.
|
||||
|
|
@ -1667,7 +1667,7 @@ void ScriptEditorDebugger::_error_selected() {
|
|||
}
|
||||
|
||||
Array meta = selected->get_metadata(0);
|
||||
if (meta.size() == 0) {
|
||||
if (meta.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -613,7 +613,7 @@ void DependencyRemoveDialog::ok_pressed() {
|
|||
ProjectSettings::get_singleton()->save();
|
||||
}
|
||||
|
||||
if (dirs_to_delete.size() == 0) {
|
||||
if (dirs_to_delete.is_empty()) {
|
||||
// If we only deleted files we should only need to tell the file system about the files we touched.
|
||||
for (int i = 0; i < files_to_delete.size(); ++i) {
|
||||
EditorFileSystem::get_singleton()->update_file(files_to_delete[i]);
|
||||
|
|
|
|||
|
|
@ -628,7 +628,7 @@ void DocTools::generate(BitField<GenerateFlags> p_flags) {
|
|||
// Don't skip parametric setters and getters, i.e. method which require
|
||||
// one or more parameters to define what property should be set or retrieved.
|
||||
// E.g. CPUParticles3D::set_param(Parameter param, float value).
|
||||
if (E.arguments.size() == 0 /* getter */ || (E.arguments.size() == 1 && E.return_val.type == Variant::NIL /* setter */)) {
|
||||
if (E.arguments.is_empty() /* getter */ || (E.arguments.size() == 1 && E.return_val.type == Variant::NIL /* setter */)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -621,7 +621,7 @@ Variant EditorAutoloadSettings::get_drag_data_fw(const Point2 &p_point, Control
|
|||
next = tree->get_next_selected(next);
|
||||
}
|
||||
|
||||
if (autoloads.size() == 0 || autoloads.size() == autoload_cache.size()) {
|
||||
if (autoloads.is_empty() || autoloads.size() == autoload_cache.size()) {
|
||||
return Variant();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -802,7 +802,7 @@ Vector<String> EditorFileSystem::_get_import_dest_paths(const String &p_path) {
|
|||
}
|
||||
|
||||
bool EditorFileSystem::_scan_import_support(const Vector<String> &reimports) {
|
||||
if (import_support_queries.size() == 0) {
|
||||
if (import_support_queries.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
HashMap<String, int> import_support_test;
|
||||
|
|
@ -818,7 +818,7 @@ bool EditorFileSystem::_scan_import_support(const Vector<String> &reimports) {
|
|||
}
|
||||
}
|
||||
|
||||
if (import_support_test.size() == 0) {
|
||||
if (import_support_test.is_empty()) {
|
||||
return false; //well nothing to do
|
||||
}
|
||||
|
||||
|
|
@ -1858,7 +1858,7 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector
|
|||
|
||||
Vector<String> path = f.split("/");
|
||||
|
||||
if (path.size() == 0) {
|
||||
if (path.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
String file = path[path.size() - 1];
|
||||
|
|
@ -1991,7 +1991,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p
|
|||
|
||||
Vector<String> path = f.split("/");
|
||||
|
||||
if (path.size() == 0) {
|
||||
if (path.is_empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3816,7 +3816,7 @@ void EditorNode::_update_addon_config() {
|
|||
enabled_addons.push_back(E.key);
|
||||
}
|
||||
|
||||
if (enabled_addons.size() == 0) {
|
||||
if (enabled_addons.is_empty()) {
|
||||
ProjectSettings::get_singleton()->set("editor_plugins/enabled", Variant());
|
||||
} else {
|
||||
enabled_addons.sort();
|
||||
|
|
@ -6342,7 +6342,7 @@ void EditorNode::preload_reimporting_with_path_in_edited_scenes(const List<Strin
|
|||
}
|
||||
|
||||
void EditorNode::reload_instances_with_path_in_edited_scenes() {
|
||||
if (scenes_modification_table.size() == 0) {
|
||||
if (scenes_modification_table.is_empty()) {
|
||||
return;
|
||||
}
|
||||
EditorProgress progress("reloading_scene", TTR("Scenes reloading"), editor_data.get_edited_scene_count());
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ void EditorPropertyPath::_drop_data_fw(const Point2 &p_point, const Variant &p_d
|
|||
return;
|
||||
}
|
||||
const Vector<String> filesPaths = drag_data["files"];
|
||||
if (filesPaths.size() == 0) {
|
||||
if (filesPaths.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -589,7 +589,7 @@ bool EditorPropertyPath::_can_drop_data_fw(const Point2 &p_point, const Variant
|
|||
return false;
|
||||
}
|
||||
const Vector<String> filesPaths = drag_data["files"];
|
||||
if (filesPaths.size() == 0) {
|
||||
if (filesPaths.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ const Dictionary EditorResourcePreview::get_preview_metadata(const String &p_pat
|
|||
void EditorResourcePreview::_iterate() {
|
||||
preview_mutex.lock();
|
||||
|
||||
if (queue.size() == 0) {
|
||||
if (queue.is_empty()) {
|
||||
preview_mutex.unlock();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1572,7 +1572,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
|
|||
Vector<uint8_t> array;
|
||||
if (GDExtension::get_extension_list_config_file() == forced_export[i]) {
|
||||
array = _filter_extension_list_config_file(forced_export[i], paths);
|
||||
if (array.size() == 0) {
|
||||
if (array.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3840,7 +3840,7 @@ void FileSystemDock::_update_import_dock() {
|
|||
imports.push_back(fpath);
|
||||
}
|
||||
|
||||
if (imports.size() == 0) {
|
||||
if (imports.is_empty()) {
|
||||
ImportDock::get_singleton()->clear();
|
||||
} else if (imports.size() == 1) {
|
||||
ImportDock::get_singleton()->set_edit_path(imports[0]);
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ void FindInFiles::start() {
|
|||
emit_signal(SceneStringName(finished));
|
||||
return;
|
||||
}
|
||||
if (_extension_filter.size() == 0) {
|
||||
if (_extension_filter.is_empty()) {
|
||||
print_verbose("Nothing to search, filter matches no files");
|
||||
emit_signal(SceneStringName(finished));
|
||||
return;
|
||||
|
|
@ -183,7 +183,7 @@ void FindInFiles::_iterate() {
|
|||
pop_back(_folders_stack);
|
||||
_current_dir = _current_dir.get_base_dir();
|
||||
|
||||
if (_folders_stack.size() == 0) {
|
||||
if (_folders_stack.is_empty()) {
|
||||
// All folders scanned.
|
||||
_initial_files_count = _files_to_scan.size();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -770,7 +770,7 @@ void EditorFileDialog::_items_clear_selection(const Vector2 &p_pos, MouseButton
|
|||
void EditorFileDialog::_push_history() {
|
||||
local_history.resize(local_history_pos + 1);
|
||||
String new_path = dir_access->get_current_dir();
|
||||
if (local_history.size() == 0 || new_path != local_history[local_history_pos]) {
|
||||
if (local_history.is_empty() || new_path != local_history[local_history_pos]) {
|
||||
local_history.push_back(new_path);
|
||||
local_history_pos++;
|
||||
dir_prev->set_disabled(local_history_pos == 0);
|
||||
|
|
@ -940,7 +940,7 @@ bool EditorFileDialog::_is_open_should_be_disabled() {
|
|||
}
|
||||
|
||||
Vector<int> items = item_list->get_selected_items();
|
||||
if (items.size() == 0) {
|
||||
if (items.is_empty()) {
|
||||
return mode != FILE_MODE_OPEN_DIR; // In "Open folder" mode, having nothing selected picks the current folder.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ void SceneTreeEditor::_update_node(Node *p_node, TreeItem *p_item, bool p_part_o
|
|||
_set_item_custom_color(p_item, accent);
|
||||
}
|
||||
} else if (p_part_of_subscene) {
|
||||
if (valid_types.size() == 0) {
|
||||
if (valid_types.is_empty()) {
|
||||
_set_item_custom_color(p_item, get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
|
||||
}
|
||||
} else if (marked.has(p_node)) {
|
||||
|
|
@ -1865,7 +1865,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
|
|||
if (String(d["type"]) == "files") {
|
||||
Vector<String> files = d["files"];
|
||||
|
||||
if (files.size() == 0) {
|
||||
if (files.is_empty()) {
|
||||
return false; // TODO Weird?
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -706,7 +706,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ImporterMesh> &p
|
|||
}
|
||||
}
|
||||
|
||||
if (weights.size() == 0 || total == 0) { //if nothing, add a weight to bone 0
|
||||
if (weights.is_empty() || total == 0) { //if nothing, add a weight to bone 0
|
||||
//no weights assigned
|
||||
Collada::Vertex::Weight w;
|
||||
w.bone_idx = 0;
|
||||
|
|
@ -1278,7 +1278,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
|
|||
mesh_unique_names.insert(name);
|
||||
|
||||
mesh->set_name(name);
|
||||
Error err = _create_mesh_surfaces(morphs.size() == 0, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, morph, morphs, p_use_compression, use_mesh_builtin_materials);
|
||||
Error err = _create_mesh_surfaces(morphs.is_empty(), mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, morph, morphs, p_use_compression, use_mesh_builtin_materials);
|
||||
ERR_FAIL_COND_V_MSG(err, err, "Cannot create mesh surface.");
|
||||
|
||||
mesh_cache[meshid] = mesh;
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ static Error _parse_obj(const String &p_path, List<Ref<ImporterMesh>> &r_meshes,
|
|||
//groups are too annoying
|
||||
if (surf_tool->get_vertex_array().size()) {
|
||||
//another group going on, commit it
|
||||
if (normals.size() == 0) {
|
||||
if (normals.is_empty()) {
|
||||
surf_tool->generate_normals();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -665,7 +665,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
|
|||
search_path.push_back(bone_idx);
|
||||
bone_idx = skeleton->get_bone_parent(bone_idx);
|
||||
}
|
||||
if (search_path.size() == 0) {
|
||||
if (search_path.is_empty()) {
|
||||
bone_idx = -1;
|
||||
} else if (search_path.size() == 1) {
|
||||
bone_idx = search_path[0]; // It is only one bone which can be root.
|
||||
|
|
@ -1329,7 +1329,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
|
|||
bone_idx = skeleton->get_bone_parent(bone_idx);
|
||||
}
|
||||
search_path.reverse();
|
||||
if (search_path.size() == 0) {
|
||||
if (search_path.is_empty()) {
|
||||
p_bone_map->_set_skeleton_bone_name("Spine", skeleton->get_bone_name(chest_or_upper_chest)); // Maybe chibi model...?
|
||||
} else if (search_path.size() == 1) {
|
||||
p_bone_map->_set_skeleton_bone_name("Spine", skeleton->get_bone_name(search_path[0]));
|
||||
|
|
|
|||
|
|
@ -6063,7 +6063,7 @@ bool CanvasItemEditorViewport::_create_instance(Node *p_parent, const String &p_
|
|||
}
|
||||
|
||||
void CanvasItemEditorViewport::_perform_drop_data() {
|
||||
ERR_FAIL_COND(selected_files.size() <= 0);
|
||||
ERR_FAIL_COND(selected_files.is_empty());
|
||||
|
||||
_remove_preview();
|
||||
|
||||
|
|
@ -6273,7 +6273,7 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p
|
|||
if (d.has("type") && String(d["type"]) == "files") {
|
||||
selected_files = d["files"];
|
||||
}
|
||||
if (selected_files.size() == 0) {
|
||||
if (selected_files.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ void EditorPropertySizeFlags::update_property() {
|
|||
void EditorPropertySizeFlags::setup(const Vector<String> &p_options, bool p_vertical) {
|
||||
vertical = p_vertical;
|
||||
|
||||
if (p_options.size() == 0) {
|
||||
if (p_options.is_empty()) {
|
||||
flag_presets->clear();
|
||||
flag_presets->add_item(TTR("Container Default"));
|
||||
flag_presets->set_disabled(true);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ void LightmapGIGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
HashSet<Vector2i> lines_found;
|
||||
|
||||
Vector<Vector3> points = data->get_capture_points();
|
||||
if (points.size() == 0) {
|
||||
if (points.is_empty()) {
|
||||
return;
|
||||
}
|
||||
Vector<Color> sh = data->get_capture_sh();
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) {
|
|||
Array a = mesh->surface_get_arrays(i);
|
||||
|
||||
Vector<Vector2> uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2];
|
||||
if (uv.size() == 0) {
|
||||
if (uv.is_empty()) {
|
||||
err_dialog->set_text(vformat(TTR("Mesh has no UV in layer %d."), p_layer + 1));
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
|
|
@ -440,7 +440,7 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) {
|
|||
}
|
||||
|
||||
void MeshInstance3DEditor::_debug_uv_draw() {
|
||||
if (uv_lines.size() == 0) {
|
||||
if (uv_lines.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ void MultiMeshEditor::_populate() {
|
|||
|
||||
Vector<Face3> geometry = ss_instance->get_mesh()->get_faces();
|
||||
|
||||
if (geometry.size() == 0) {
|
||||
if (geometry.is_empty()) {
|
||||
err_dialog->set_text(TTR("Surface source is invalid (no faces)."));
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ void Particles3DEditorPlugin::_node_selected(const NodePath &p_path) {
|
|||
}
|
||||
|
||||
geometry = mi->get_mesh()->get_faces();
|
||||
if (geometry.size() == 0) {
|
||||
if (geometry.is_empty()) {
|
||||
EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't contain face geometry."), sel->get_name()));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ void Polygon2DEditor::_sync_bones() {
|
|||
}
|
||||
}
|
||||
|
||||
if (weights.size() == 0) { //create them
|
||||
if (weights.is_empty()) { //create them
|
||||
weights.resize(wc);
|
||||
float *w = weights.ptrw();
|
||||
for (int j = 0; j < wc; j++) {
|
||||
|
|
@ -311,7 +311,7 @@ void Polygon2DEditor::_edit_menu_option(int p_option) {
|
|||
switch (p_option) {
|
||||
case MENU_POLYGON_TO_UV: {
|
||||
Vector<Vector2> points = node->get_polygon();
|
||||
if (points.size() == 0) {
|
||||
if (points.is_empty()) {
|
||||
break;
|
||||
}
|
||||
Vector<Vector2> uvs = node->get_uv();
|
||||
|
|
@ -323,7 +323,7 @@ void Polygon2DEditor::_edit_menu_option(int p_option) {
|
|||
case MENU_UV_TO_POLYGON: {
|
||||
Vector<Vector2> points = node->get_polygon();
|
||||
Vector<Vector2> uvs = node->get_uv();
|
||||
if (uvs.size() == 0) {
|
||||
if (uvs.is_empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -334,7 +334,7 @@ void Polygon2DEditor::_edit_menu_option(int p_option) {
|
|||
} break;
|
||||
case MENU_UV_CLEAR: {
|
||||
Vector<Vector2> uvs = node->get_uv();
|
||||
if (uvs.size() == 0) {
|
||||
if (uvs.is_empty()) {
|
||||
break;
|
||||
}
|
||||
undo_redo->create_action(TTR("Create UV Map"));
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ void Polygon3DEditor::_polygon_draw() {
|
|||
|
||||
imesh->surface_end();
|
||||
|
||||
if (poly.size() == 0) {
|
||||
if (poly.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3206,7 +3206,7 @@ bool ScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data
|
|||
|
||||
if (String(d["type"]) == "nodes") {
|
||||
Array nodes = d["nodes"];
|
||||
if (nodes.size() == 0) {
|
||||
if (nodes.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
Node *node = get_node((nodes[0]));
|
||||
|
|
@ -3224,7 +3224,7 @@ bool ScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data
|
|||
if (String(d["type"]) == "files") {
|
||||
Vector<String> files = d["files"];
|
||||
|
||||
if (files.size() == 0) {
|
||||
if (files.is_empty()) {
|
||||
return false; //weird
|
||||
}
|
||||
|
||||
|
|
@ -3282,7 +3282,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
|
|||
|
||||
if (String(d["type"]) == "nodes") {
|
||||
Array nodes = d["nodes"];
|
||||
if (nodes.size() == 0) {
|
||||
if (nodes.is_empty()) {
|
||||
return;
|
||||
}
|
||||
Node *node = get_node(nodes[0]);
|
||||
|
|
|
|||
|
|
@ -760,7 +760,7 @@ void ScriptTextEditor::_update_bookmark_list() {
|
|||
bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV);
|
||||
|
||||
PackedInt32Array bookmark_list = code_editor->get_text_editor()->get_bookmarked_lines();
|
||||
if (bookmark_list.size() == 0) {
|
||||
if (bookmark_list.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -915,7 +915,7 @@ void ScriptTextEditor::_update_breakpoint_list() {
|
|||
breakpoints_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_breakpoint"), DEBUG_GOTO_PREV_BREAKPOINT);
|
||||
|
||||
PackedInt32Array breakpoint_list = code_editor->get_text_editor()->get_breakpointed_lines();
|
||||
if (breakpoint_list.size() == 0) {
|
||||
if (breakpoint_list.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1696,7 +1696,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
} break;
|
||||
case DEBUG_GOTO_NEXT_BREAKPOINT: {
|
||||
PackedInt32Array bpoints = tx->get_breakpointed_lines();
|
||||
if (bpoints.size() <= 0) {
|
||||
if (bpoints.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1711,7 +1711,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
|
|||
} break;
|
||||
case DEBUG_GOTO_PREV_BREAKPOINT: {
|
||||
PackedInt32Array bpoints = tx->get_breakpointed_lines();
|
||||
if (bpoints.size() <= 0) {
|
||||
if (bpoints.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -646,7 +646,7 @@ bool ShaderEditorPlugin::can_drop_data_fw(const Point2 &p_point, const Variant &
|
|||
if (String(d["type"]) == "files") {
|
||||
Vector<String> files = d["files"];
|
||||
|
||||
if (files.size() == 0) {
|
||||
if (files.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ void ShaderFileEditor::_update_options() {
|
|||
}
|
||||
}
|
||||
|
||||
if (version_list.size() == 0) {
|
||||
if (version_list.is_empty()) {
|
||||
for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) {
|
||||
stages[i]->set_disabled(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ void SpriteFramesEditor::_sheet_preview_draw() {
|
|||
}
|
||||
_draw_shadowed_line(split_sheet_preview, draw_offset + Vector2(0, draw_size.y), Vector2(draw_size.x, 0), Vector2(0, 1), line_color, shadow_color);
|
||||
|
||||
if (frames_selected.size() == 0) {
|
||||
if (frames_selected.is_empty()) {
|
||||
split_sheet_dialog->get_ok_button()->set_disabled(true);
|
||||
split_sheet_dialog->set_ok_button_text(TTR("No Frames Selected"));
|
||||
return;
|
||||
|
|
@ -1699,7 +1699,7 @@ bool SpriteFramesEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
|
|||
if (String(d["type"]) == "files") {
|
||||
Vector<String> files = d["files"];
|
||||
|
||||
if (files.size() == 0) {
|
||||
if (files.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ void TextEditor::_update_bookmark_list() {
|
|||
bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV);
|
||||
|
||||
PackedInt32Array bookmark_list = code_editor->get_text_editor()->get_bookmarked_lines();
|
||||
if (bookmark_list.size() == 0) {
|
||||
if (bookmark_list.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1062,7 +1062,7 @@ void TextShaderEditor::_update_bookmark_list() {
|
|||
bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV);
|
||||
|
||||
PackedInt32Array bookmark_list = code_editor->get_text_editor()->get_bookmarked_lines();
|
||||
if (bookmark_list.size() == 0) {
|
||||
if (bookmark_list.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ void ThemeItemImportTree::_update_items_tree() {
|
|||
filtered_names.push_back(F);
|
||||
}
|
||||
|
||||
if (filtered_names.size() == 0) {
|
||||
if (filtered_names.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -734,7 +734,7 @@ void ThemeItemImportTree::_deselect_all_data_type_pressed(int p_data_type) {
|
|||
}
|
||||
|
||||
void ThemeItemImportTree::_import_selected() {
|
||||
if (selected_items.size() == 0) {
|
||||
if (selected_items.is_empty()) {
|
||||
EditorNode::get_singleton()->show_accept(TTR("Nothing was selected for the import."), TTR("OK"));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -836,7 +836,7 @@ void GenericTilePolygonEditor::remove_polygon(int p_index) {
|
|||
ERR_FAIL_INDEX(p_index, (int)polygons.size());
|
||||
polygons.remove_at(p_index);
|
||||
|
||||
if (polygons.size() == 0) {
|
||||
if (polygons.is_empty()) {
|
||||
button_create->set_pressed(true);
|
||||
}
|
||||
base_control->queue_redraw();
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ bool TileSetEditor::_can_drop_data_fw(const Point2 &p_point, const Variant &p_da
|
|||
if (String(d["type"]) == "files") {
|
||||
Vector<String> files = d["files"];
|
||||
|
||||
if (files.size() == 0) {
|
||||
if (files.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ void TileSetScenesCollectionSourceEditor::_update_tile_inspector() {
|
|||
|
||||
void TileSetScenesCollectionSourceEditor::_update_action_buttons() {
|
||||
Vector<int> selected_indices = scene_tiles_list->get_selected_items();
|
||||
scene_tile_delete_button->set_disabled(selected_indices.size() <= 0 || read_only);
|
||||
scene_tile_delete_button->set_disabled(selected_indices.is_empty() || read_only);
|
||||
}
|
||||
|
||||
void TileSetScenesCollectionSourceEditor::_update_scenes_list() {
|
||||
|
|
@ -483,7 +483,7 @@ bool TileSetScenesCollectionSourceEditor::_can_drop_data_fw(const Point2 &p_poin
|
|||
if (String(d["type"]) == "files") {
|
||||
Vector<String> files = d["files"];
|
||||
|
||||
if (files.size() == 0) {
|
||||
if (files.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void TilesEditorUtils::_thread() {
|
|||
pattern_preview_sem.wait();
|
||||
|
||||
pattern_preview_mutex.lock();
|
||||
if (pattern_preview_queue.size() == 0) {
|
||||
if (pattern_preview_queue.is_empty()) {
|
||||
pattern_preview_mutex.unlock();
|
||||
} else {
|
||||
QueueItem item = pattern_preview_queue.front()->get();
|
||||
|
|
|
|||
|
|
@ -7979,7 +7979,7 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par
|
|||
}
|
||||
|
||||
Vector<StringName> properties = p_node->get_editable_properties();
|
||||
if (properties.size() == 0) {
|
||||
if (properties.is_empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -7996,7 +7996,7 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par
|
|||
}
|
||||
}
|
||||
|
||||
if (pinfo.size() == 0) {
|
||||
if (pinfo.is_empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2226,7 +2226,7 @@ void ProjectConverter3To4::process_gdscript_line(String &line, const RegExContai
|
|||
int end = get_end_parenthesis(line.substr(start)) + 1;
|
||||
if (end > -1) {
|
||||
Vector<String> parts = parse_arguments(line.substr(start, end));
|
||||
if (parts.size() == 0) {
|
||||
if (parts.is_empty()) {
|
||||
line = line.substr(0, start) + "DisplayServer.get_display_safe_area()" + line.substr(end + start);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -673,7 +673,7 @@ void ProjectManager::_new_project() {
|
|||
void ProjectManager::_rename_project() {
|
||||
const Vector<ProjectList::Item> &selected_list = project_list->get_selected_projects();
|
||||
|
||||
if (selected_list.size() == 0) {
|
||||
if (selected_list.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -688,7 +688,7 @@ void ProjectManager::_rename_project() {
|
|||
void ProjectManager::_erase_project() {
|
||||
const HashSet<String> &selected_list = project_list->get_selected_project_keys();
|
||||
|
||||
if (selected_list.size() == 0) {
|
||||
if (selected_list.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1046,7 +1046,7 @@ void ProjectList::select_first_visible_project() {
|
|||
|
||||
Vector<ProjectList::Item> ProjectList::get_selected_projects() const {
|
||||
Vector<Item> items;
|
||||
if (_selected_project_paths.size() == 0) {
|
||||
if (_selected_project_paths.is_empty()) {
|
||||
return items;
|
||||
}
|
||||
items.resize(_selected_project_paths.size());
|
||||
|
|
@ -1067,7 +1067,7 @@ const HashSet<String> &ProjectList::get_selected_project_keys() const {
|
|||
}
|
||||
|
||||
int ProjectList::get_single_selected_index() const {
|
||||
if (_selected_project_paths.size() == 0) {
|
||||
if (_selected_project_paths.is_empty()) {
|
||||
// Default selection
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1088,7 +1088,7 @@ int ProjectList::get_single_selected_index() const {
|
|||
}
|
||||
|
||||
void ProjectList::erase_selected_projects(bool p_delete_project_contents) {
|
||||
if (_selected_project_paths.size() == 0) {
|
||||
if (_selected_project_paths.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
if (selection.size() == 0) {
|
||||
if (selection.is_empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -887,7 +887,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
if (selection.size() == 0) {
|
||||
if (selection.is_empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -2333,7 +2333,7 @@ void SceneTreeDock::_node_reparent(NodePath p_path, bool p_keep_global_xform) {
|
|||
void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, Vector<Node *> p_nodes, bool p_keep_global_xform) {
|
||||
ERR_FAIL_NULL(p_new_parent);
|
||||
|
||||
if (p_nodes.size() == 0) {
|
||||
if (p_nodes.is_empty()) {
|
||||
return; // Nothing to reparent.
|
||||
}
|
||||
|
||||
|
|
@ -3748,7 +3748,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
|||
List<Node *> selection = editor_selection->get_top_selected_node_list();
|
||||
List<Node *> full_selection = editor_selection->get_full_selected_node_list(); // Above method only returns nodes with common parent.
|
||||
|
||||
if (selection.size() == 0) {
|
||||
if (selection.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2106,7 +2106,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||
OS::get_singleton()->add_logger(memnew(RotatedFileLogger(base_path, max_files)));
|
||||
}
|
||||
|
||||
if (main_args.size() == 0 && String(GLOBAL_GET("application/run/main_scene")) == "") {
|
||||
if (main_args.is_empty() && String(GLOBAL_GET("application/run/main_scene")) == "") {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (!editor && !project_manager) {
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1135,13 +1135,13 @@ CSGBrush *CSGMesh3D::_build_brush() {
|
|||
|
||||
Array arrays = mesh->surface_get_arrays(i);
|
||||
|
||||
if (arrays.size() == 0) {
|
||||
if (arrays.is_empty()) {
|
||||
_make_dirty();
|
||||
ERR_FAIL_COND_V(arrays.is_empty(), memnew(CSGBrush));
|
||||
}
|
||||
|
||||
Vector<Vector3> avertices = arrays[Mesh::ARRAY_VERTEX];
|
||||
if (avertices.size() == 0) {
|
||||
if (avertices.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1257,7 +1257,7 @@ CSGBrush *CSGMesh3D::_build_brush() {
|
|||
}
|
||||
}
|
||||
|
||||
if (vertices.size() == 0) {
|
||||
if (vertices.is_empty()) {
|
||||
return memnew(CSGBrush);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ void CSGShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
|
||||
Vector<Vector3> faces = cs->get_brush_faces();
|
||||
|
||||
if (faces.size() == 0) {
|
||||
if (faces.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1080,7 +1080,7 @@ Error FBXDocument::_parse_images(Ref<FBXState> p_state, const String &p_base_pat
|
|||
}
|
||||
// Fallback to loading as byte array.
|
||||
data = FileAccess::get_file_as_bytes(path);
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
WARN_PRINT(vformat("FBX: Image index '%d' couldn't be loaded from path: %s because there was no data to load. Skipping it.", texture_i, path));
|
||||
p_state->images.push_back(Ref<Texture2D>()); // Placeholder to keep count.
|
||||
p_state->source_images.push_back(Ref<Image>());
|
||||
|
|
|
|||
|
|
@ -2846,7 +2846,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
|
|||
while (subclass) {
|
||||
if (subclass->extends_used) {
|
||||
if (!subclass->extends_path.is_empty()) {
|
||||
if (subclass->extends.size() == 0) {
|
||||
if (subclass->extends.is_empty()) {
|
||||
get_global_class_name(subclass->extends_path, r_base_type);
|
||||
subclass = nullptr;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -2157,7 +2157,7 @@ void GDScriptAnalyzer::resolve_for(GDScriptParser::ForNode *p_for) {
|
|||
GDScriptParser::IdentifierNode *callee = static_cast<GDScriptParser::IdentifierNode *>(call->callee);
|
||||
if (callee->name == "range") {
|
||||
list_resolved = true;
|
||||
if (call->arguments.size() < 1) {
|
||||
if (call->arguments.is_empty()) {
|
||||
push_error(R"*(Invalid call for "range()" function. Expected at least 1 argument, none given.)*", call->callee);
|
||||
} else if (call->arguments.size() > 3) {
|
||||
push_error(vformat(R"*(Invalid call for "range()" function. Expected at most 3 arguments, %d given.)*", call->arguments.size()), call->callee);
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ Error GLTFDocument::_encode_buffer_glb(Ref<GLTFState> p_state, const String &p_p
|
|||
if (file.is_null()) {
|
||||
return err;
|
||||
}
|
||||
if (buffer_data.size() == 0) {
|
||||
if (buffer_data.is_empty()) {
|
||||
return OK;
|
||||
}
|
||||
file->create(FileAccess::ACCESS_RESOURCES);
|
||||
|
|
@ -773,7 +773,7 @@ Error GLTFDocument::_encode_buffer_bins(Ref<GLTFState> p_state, const String &p_
|
|||
if (file.is_null()) {
|
||||
return err;
|
||||
}
|
||||
if (buffer_data.size() == 0) {
|
||||
if (buffer_data.is_empty()) {
|
||||
return OK;
|
||||
}
|
||||
file->create(FileAccess::ACCESS_RESOURCES);
|
||||
|
|
@ -1647,7 +1647,7 @@ Vector<double> GLTFDocument::_decode_accessor(Ref<GLTFState> p_state, const GLTF
|
|||
}
|
||||
|
||||
GLTFAccessorIndex GLTFDocument::_encode_accessor_as_ints(Ref<GLTFState> p_state, const Vector<int32_t> p_attribs, const bool p_for_vertex, const bool p_for_vertex_indices) {
|
||||
if (p_attribs.size() == 0) {
|
||||
if (p_attribs.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
const int element_count = 1;
|
||||
|
|
@ -1712,7 +1712,7 @@ Vector<int> GLTFDocument::_decode_accessor_as_ints(Ref<GLTFState> p_state, const
|
|||
const Vector<double> attribs = _decode_accessor(p_state, p_accessor, p_for_vertex);
|
||||
Vector<int> ret;
|
||||
|
||||
if (attribs.size() == 0) {
|
||||
if (attribs.is_empty()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1737,7 +1737,7 @@ Vector<float> GLTFDocument::_decode_accessor_as_floats(Ref<GLTFState> p_state, c
|
|||
const Vector<double> attribs = _decode_accessor(p_state, p_accessor, p_for_vertex);
|
||||
Vector<float> ret;
|
||||
|
||||
if (attribs.size() == 0) {
|
||||
if (attribs.is_empty()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1768,7 +1768,7 @@ void GLTFDocument::_round_min_max_components(Vector<double> &r_type_min, Vector<
|
|||
}
|
||||
|
||||
GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec2(Ref<GLTFState> p_state, const Vector<Vector2> p_attribs, const bool p_for_vertex) {
|
||||
if (p_attribs.size() == 0) {
|
||||
if (p_attribs.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
const int element_count = 2;
|
||||
|
|
@ -1818,7 +1818,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec2(Ref<GLTFState> p_state,
|
|||
}
|
||||
|
||||
GLTFAccessorIndex GLTFDocument::_encode_accessor_as_color(Ref<GLTFState> p_state, const Vector<Color> p_attribs, const bool p_for_vertex) {
|
||||
if (p_attribs.size() == 0) {
|
||||
if (p_attribs.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1884,7 +1884,7 @@ void GLTFDocument::_calc_accessor_min_max(int p_i, const int p_element_count, Ve
|
|||
}
|
||||
|
||||
GLTFAccessorIndex GLTFDocument::_encode_accessor_as_weights(Ref<GLTFState> p_state, const Vector<Color> p_attribs, const bool p_for_vertex) {
|
||||
if (p_attribs.size() == 0) {
|
||||
if (p_attribs.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1938,7 +1938,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_weights(Ref<GLTFState> p_sta
|
|||
}
|
||||
|
||||
GLTFAccessorIndex GLTFDocument::_encode_accessor_as_joints(Ref<GLTFState> p_state, const Vector<Color> p_attribs, const bool p_for_vertex) {
|
||||
if (p_attribs.size() == 0) {
|
||||
if (p_attribs.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1989,7 +1989,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_joints(Ref<GLTFState> p_stat
|
|||
}
|
||||
|
||||
GLTFAccessorIndex GLTFDocument::_encode_accessor_as_quaternions(Ref<GLTFState> p_state, const Vector<Quaternion> p_attribs, const bool p_for_vertex) {
|
||||
if (p_attribs.size() == 0) {
|
||||
if (p_attribs.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
const int element_count = 4;
|
||||
|
|
@ -2045,7 +2045,7 @@ Vector<Vector2> GLTFDocument::_decode_accessor_as_vec2(Ref<GLTFState> p_state, c
|
|||
const Vector<double> attribs = _decode_accessor(p_state, p_accessor, p_for_vertex);
|
||||
Vector<Vector2> ret;
|
||||
|
||||
if (attribs.size() == 0) {
|
||||
if (attribs.is_empty()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2068,7 +2068,7 @@ Vector<Vector2> GLTFDocument::_decode_accessor_as_vec2(Ref<GLTFState> p_state, c
|
|||
}
|
||||
|
||||
GLTFAccessorIndex GLTFDocument::_encode_accessor_as_floats(Ref<GLTFState> p_state, const Vector<double> p_attribs, const bool p_for_vertex) {
|
||||
if (p_attribs.size() == 0) {
|
||||
if (p_attribs.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
const int element_count = 1;
|
||||
|
|
@ -2117,7 +2117,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_floats(Ref<GLTFState> p_stat
|
|||
}
|
||||
|
||||
GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec3(Ref<GLTFState> p_state, const Vector<Vector3> p_attribs, const bool p_for_vertex) {
|
||||
if (p_attribs.size() == 0) {
|
||||
if (p_attribs.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
const int element_count = 3;
|
||||
|
|
@ -2167,7 +2167,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec3(Ref<GLTFState> p_state,
|
|||
}
|
||||
|
||||
GLTFAccessorIndex GLTFDocument::_encode_sparse_accessor_as_vec3(Ref<GLTFState> p_state, const Vector<Vector3> p_attribs, const Vector<Vector3> p_reference_attribs, const float p_reference_multiplier, const bool p_for_vertex, const GLTFAccessorIndex p_reference_accessor) {
|
||||
if (p_attribs.size() == 0) {
|
||||
if (p_attribs.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -2276,7 +2276,7 @@ GLTFAccessorIndex GLTFDocument::_encode_sparse_accessor_as_vec3(Ref<GLTFState> p
|
|||
}
|
||||
|
||||
GLTFAccessorIndex GLTFDocument::_encode_accessor_as_xform(Ref<GLTFState> p_state, const Vector<Transform3D> p_attribs, const bool p_for_vertex) {
|
||||
if (p_attribs.size() == 0) {
|
||||
if (p_attribs.is_empty()) {
|
||||
return -1;
|
||||
}
|
||||
const int element_count = 16;
|
||||
|
|
@ -2351,7 +2351,7 @@ Vector<Vector3> GLTFDocument::_decode_accessor_as_vec3(Ref<GLTFState> p_state, c
|
|||
const Vector<double> attribs = _decode_accessor(p_state, p_accessor, p_for_vertex);
|
||||
Vector<Vector3> ret;
|
||||
|
||||
if (attribs.size() == 0) {
|
||||
if (attribs.is_empty()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2377,7 +2377,7 @@ Vector<Color> GLTFDocument::_decode_accessor_as_color(Ref<GLTFState> p_state, co
|
|||
const Vector<double> attribs = _decode_accessor(p_state, p_accessor, p_for_vertex);
|
||||
Vector<Color> ret;
|
||||
|
||||
if (attribs.size() == 0) {
|
||||
if (attribs.is_empty()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2409,7 +2409,7 @@ Vector<Quaternion> GLTFDocument::_decode_accessor_as_quaternion(Ref<GLTFState> p
|
|||
const Vector<double> attribs = _decode_accessor(p_state, p_accessor, p_for_vertex);
|
||||
Vector<Quaternion> ret;
|
||||
|
||||
if (attribs.size() == 0) {
|
||||
if (attribs.is_empty()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2428,7 +2428,7 @@ Vector<Transform2D> GLTFDocument::_decode_accessor_as_xform2d(Ref<GLTFState> p_s
|
|||
const Vector<double> attribs = _decode_accessor(p_state, p_accessor, p_for_vertex);
|
||||
Vector<Transform2D> ret;
|
||||
|
||||
if (attribs.size() == 0) {
|
||||
if (attribs.is_empty()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2445,7 +2445,7 @@ Vector<Basis> GLTFDocument::_decode_accessor_as_basis(Ref<GLTFState> p_state, co
|
|||
const Vector<double> attribs = _decode_accessor(p_state, p_accessor, p_for_vertex);
|
||||
Vector<Basis> ret;
|
||||
|
||||
if (attribs.size() == 0) {
|
||||
if (attribs.is_empty()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2463,7 +2463,7 @@ Vector<Transform3D> GLTFDocument::_decode_accessor_as_xform(Ref<GLTFState> p_sta
|
|||
const Vector<double> attribs = _decode_accessor(p_state, p_accessor, p_for_vertex);
|
||||
Vector<Transform3D> ret;
|
||||
|
||||
if (attribs.size() == 0) {
|
||||
if (attribs.is_empty()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -4148,7 +4148,7 @@ Error GLTFDocument::_parse_images(Ref<GLTFState> p_state, const String &p_base_p
|
|||
// Fallback to loading as byte array. This enables us to support the
|
||||
// spec's requirement that we honor mimetype regardless of file URI.
|
||||
data = FileAccess::get_file_as_bytes(resource_uri);
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
WARN_PRINT(vformat("glTF: Image index '%d' couldn't be loaded as a buffer of MIME type '%s' from URI: %s because there was no data to load. Skipping it.", i, mime_type, resource_uri));
|
||||
p_state->images.push_back(Ref<Texture2D>()); // Placeholder to keep count.
|
||||
p_state->source_images.push_back(Ref<Image>());
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ Error SkinTool::_determine_skeleton_roots(
|
|||
|
||||
skeleton->roots = roots;
|
||||
|
||||
if (roots.size() == 0) {
|
||||
if (roots.is_empty()) {
|
||||
return FAILED;
|
||||
} else if (roots.size() == 1) {
|
||||
return OK;
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ void GodotBody2D::integrate_velocities(real_t p_step) {
|
|||
if (mode == PhysicsServer2D::BODY_MODE_KINEMATIC) {
|
||||
_set_transform(new_transform, false);
|
||||
_set_inv_transform(new_transform.affine_inverse());
|
||||
if (contacts.size() == 0 && linear_velocity == Vector2() && angular_velocity == 0) {
|
||||
if (contacts.is_empty() && linear_velocity == Vector2() && angular_velocity == 0) {
|
||||
set_active(false); //stopped moving, deactivate
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -665,7 +665,7 @@ bool GodotConcavePolygonShape2D::contains_point(const Vector2 &p_point) const {
|
|||
}
|
||||
|
||||
bool GodotConcavePolygonShape2D::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const {
|
||||
if (segments.size() == 0 || points.size() == 0) {
|
||||
if (segments.is_empty() || points.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -919,7 +919,7 @@ void GodotConcavePolygonShape2D::cull(const Rect2 &p_local_aabb, QueryCallback p
|
|||
stack[i]=0;
|
||||
*/
|
||||
|
||||
if (segments.size() == 0 || points.size() == 0 || bvh.size() == 0) {
|
||||
if (segments.is_empty() || points.is_empty() || bvh.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -701,7 +701,7 @@ void GodotBody3D::integrate_velocities(real_t p_step) {
|
|||
if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC) {
|
||||
_set_transform(new_transform, false);
|
||||
_set_inv_transform(new_transform.affine_inverse());
|
||||
if (contacts.size() == 0 && linear_velocity == Vector3() && angular_velocity == Vector3()) {
|
||||
if (contacts.is_empty() && linear_velocity == Vector3() && angular_velocity == Vector3()) {
|
||||
set_active(false); //stopped moving, deactivate
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -838,7 +838,7 @@ void GodotConvexPolygonShape3D::project_range(const Vector3 &p_normal, const Tra
|
|||
|
||||
Vector3 GodotConvexPolygonShape3D::get_support(const Vector3 &p_normal) const {
|
||||
// Skip if there are no vertices in the mesh
|
||||
if (mesh.vertices.size() == 0) {
|
||||
if (mesh.vertices.is_empty()) {
|
||||
return Vector3();
|
||||
}
|
||||
|
||||
|
|
@ -1369,7 +1369,7 @@ void GodotConcavePolygonShape3D::_cull_segment(int p_idx, _SegmentCullParams *p_
|
|||
}
|
||||
|
||||
bool GodotConcavePolygonShape3D::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal, int &r_face_index, bool p_hit_back_faces) const {
|
||||
if (faces.size() == 0) {
|
||||
if (faces.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1449,7 +1449,7 @@ bool GodotConcavePolygonShape3D::_cull(int p_idx, _CullParams *p_params) const {
|
|||
|
||||
void GodotConcavePolygonShape3D::cull(const AABB &p_local_aabb, QueryCallback p_callback, void *p_userdata, bool p_invert_backface_collision) const {
|
||||
// make matrix local to concave
|
||||
if (faces.size() == 0) {
|
||||
if (faces.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
}
|
||||
g.multimesh_instances.clear();
|
||||
|
||||
if (g.cells.size() == 0) {
|
||||
if (g.cells.is_empty()) {
|
||||
//octant no longer needed
|
||||
_octant_clean_up(p_key);
|
||||
return true;
|
||||
|
|
@ -637,7 +637,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
xform.basis = _ortho_bases[c.rot];
|
||||
xform.set_origin(cellpos * cell_size + ofs);
|
||||
xform.basis.scale(Vector3(cell_scale, cell_scale, cell_scale));
|
||||
if (baked_meshes.size() == 0) {
|
||||
if (baked_meshes.is_empty()) {
|
||||
if (mesh_library->get_item_mesh(c.item).is_valid()) {
|
||||
if (!multimesh_items.has(c.item)) {
|
||||
multimesh_items[c.item] = List<Pair<Transform3D, IndexKey>>();
|
||||
|
|
@ -716,7 +716,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
#endif // defined(DEBUG_ENABLED) && !defined(NAVIGATION_3D_DISABLED)
|
||||
|
||||
//update multimeshes, only if not baked
|
||||
if (baked_meshes.size() == 0) {
|
||||
if (baked_meshes.is_empty()) {
|
||||
for (const KeyValue<int, List<Pair<Transform3D, IndexKey>>> &E : multimesh_items) {
|
||||
Octant::MultimeshInstance mmi;
|
||||
|
||||
|
|
@ -1642,7 +1642,7 @@ void GridMap::_update_octant_navigation_debug_edge_connections_mesh(const Octant
|
|||
}
|
||||
}
|
||||
|
||||
if (vertex_array.size() == 0) {
|
||||
if (vertex_array.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ void AudioStreamInteractiveTransitionEditor::_update_selection() {
|
|||
filler_clip->set_disabled(selected.is_empty());
|
||||
hold_previous->set_disabled(selected.is_empty());
|
||||
|
||||
if (selected.size() == 0) {
|
||||
if (selected.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -645,19 +645,19 @@ void LightmapperRD::_create_acceleration_structures(RenderingDevice *rd, Size2i
|
|||
r_cluster_aabbs_buffer = rd->storage_buffer_create(cab.size(), cab);
|
||||
|
||||
Vector<uint8_t> lb = lights.to_byte_array();
|
||||
if (lb.size() == 0) {
|
||||
if (lb.is_empty()) {
|
||||
lb.resize(sizeof(Light)); //even if no lights, the buffer must exist
|
||||
}
|
||||
lights_buffer = rd->storage_buffer_create(lb.size(), lb);
|
||||
|
||||
Vector<uint8_t> sb = seam_buffer_vec.to_byte_array();
|
||||
if (sb.size() == 0) {
|
||||
if (sb.is_empty()) {
|
||||
sb.resize(sizeof(Vector2i) * 2); //even if no seams, the buffer must exist
|
||||
}
|
||||
seams_buffer = rd->storage_buffer_create(sb.size(), sb);
|
||||
|
||||
Vector<uint8_t> pb = p_probe_positions.to_byte_array();
|
||||
if (pb.size() == 0) {
|
||||
if (pb.is_empty()) {
|
||||
pb.resize(sizeof(Probe));
|
||||
}
|
||||
probe_positions_buffer = rd->storage_buffer_create(pb.size(), pb);
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
|
|||
|
||||
for (SelfList<CSharpScript> *elem = script_list.first(); elem; elem = elem->next()) {
|
||||
// Do not reload scripts with only non-collectible instances to avoid disrupting event subscriptions and such.
|
||||
bool is_reloadable = elem->self()->instances.size() == 0;
|
||||
bool is_reloadable = elem->self()->instances.is_empty();
|
||||
for (Object *obj : elem->self()->instances) {
|
||||
ERR_CONTINUE(!obj->get_script_instance());
|
||||
CSharpInstance *csi = static_cast<CSharpInstance *>(obj->get_script_instance());
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
|||
|
||||
const Vector<String> link_target_parts = link_target.split(".");
|
||||
|
||||
if (link_target_parts.size() <= 0 || link_target_parts.size() > 2) {
|
||||
if (link_target_parts.is_empty() || link_target_parts.size() > 2) {
|
||||
ERR_PRINT("Invalid reference format: '" + tag + "'.");
|
||||
|
||||
output.append(tag);
|
||||
|
|
@ -561,7 +561,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
|
||||
const Vector<String> link_target_parts = link_target.split(".");
|
||||
|
||||
if (link_target_parts.size() <= 0 || link_target_parts.size() > 2) {
|
||||
if (link_target_parts.is_empty() || link_target_parts.size() > 2) {
|
||||
ERR_PRINT("Invalid reference format: '" + tag + "'.");
|
||||
|
||||
xml_output.append("<c>");
|
||||
|
|
@ -3200,7 +3200,7 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
|
|||
|
||||
// Generate signal
|
||||
{
|
||||
bool is_parameterless = p_isignal.arguments.size() == 0;
|
||||
bool is_parameterless = p_isignal.arguments.is_empty();
|
||||
|
||||
// Delegate name is [SignalName]EventHandler
|
||||
String delegate_name = is_parameterless ? "Action" : p_isignal.proxy_name + "EventHandler";
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ Error MultiplayerSynchronizer::_watch_changes(uint64_t p_usec) {
|
|||
if (props.size() != watchers.size()) {
|
||||
watchers.resize(props.size());
|
||||
}
|
||||
if (props.size() == 0) {
|
||||
if (props.is_empty()) {
|
||||
return OK;
|
||||
}
|
||||
Node *node = get_root_node();
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ NavMeshGenerator2D::~NavMeshGenerator2D() {
|
|||
}
|
||||
|
||||
void NavMeshGenerator2D::sync() {
|
||||
if (generator_tasks.size() == 0) {
|
||||
if (generator_tasks.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ NavMeshGenerator3D::~NavMeshGenerator3D() {
|
|||
}
|
||||
|
||||
void NavMeshGenerator3D::sync() {
|
||||
if (generator_tasks.size() == 0) {
|
||||
if (generator_tasks.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ Vector<Ref<Image>> Noise::_get_seamless_image(int p_width, int p_height, int p_d
|
|||
|
||||
Ref<Image> Noise::get_seamless_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space, real_t p_blend_skirt, bool p_normalize) const {
|
||||
Vector<Ref<Image>> images = _get_seamless_image(p_width, p_height, 1, p_invert, p_in_3d_space, p_blend_skirt, p_normalize);
|
||||
if (images.size() == 0) {
|
||||
if (images.is_empty()) {
|
||||
return Ref<Image>();
|
||||
}
|
||||
return images[0];
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ int OpenXRActionSet::get_action_count() const {
|
|||
|
||||
void OpenXRActionSet::clear_actions() {
|
||||
// Actions held within our action set should be released and destroyed but just in case they are still used some where else
|
||||
if (actions.size() == 0) {
|
||||
if (actions.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ String RegExMatch::get_subject() const {
|
|||
}
|
||||
|
||||
int RegExMatch::get_group_count() const {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return 0;
|
||||
}
|
||||
return data.size() - 1;
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ Vector<uint8_t> save_exr_buffer(const Ref<Image> &p_img, bool p_grayscale) {
|
|||
|
||||
Error save_exr(const String &p_path, const Ref<Image> &p_img, bool p_grayscale) {
|
||||
const Vector<uint8_t> buffer = save_exr_buffer(p_img, p_grayscale);
|
||||
if (buffer.size() == 0) {
|
||||
if (buffer.is_empty()) {
|
||||
print_error(String("Saving EXR failed."));
|
||||
return ERR_FILE_CANT_WRITE;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ bool WebRTCMultiplayerPeer::is_server() const {
|
|||
}
|
||||
|
||||
void WebRTCMultiplayerPeer::poll() {
|
||||
if (peer_map.size() == 0) {
|
||||
if (peer_map.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ bool WSLPeer::_verify_server_response() {
|
|||
WSL_CHECK_NC("sec-websocket-accept", _compute_key_response(session_key));
|
||||
#undef WSL_CHECK_NC
|
||||
#undef WSL_CHECK
|
||||
if (supported_protocols.size() == 0) {
|
||||
if (supported_protocols.is_empty()) {
|
||||
// We didn't request a custom protocol
|
||||
ERR_FAIL_COND_V_MSG(headers.has("sec-websocket-protocol"), false, "Received unrequested sub-protocol -> " + headers["sec-websocket-protocol"]);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ bool WebXRInterfaceJS::initialize() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (requested_reference_space_types.size() == 0) {
|
||||
if (requested_reference_space_types.is_empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2092,7 +2092,7 @@ void DisplayServerX11::_update_window_mouse_passthrough(WindowID p_window) {
|
|||
Region region = XCreateRegion();
|
||||
XShapeCombineRegion(x11_display, windows[p_window].x11_window, ShapeInput, 0, 0, region, ShapeSet);
|
||||
XDestroyRegion(region);
|
||||
} else if (region_path.size() == 0) {
|
||||
} else if (region_path.is_empty()) {
|
||||
XShapeCombineMask(x11_display, windows[p_window].x11_window, ShapeInput, 0, 0, None, ShapeSet);
|
||||
} else {
|
||||
XPoint *points = (XPoint *)memalloc(sizeof(XPoint) * region_path.size());
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ void AudioDriverWeb::_audio_driver_process(int p_from, int p_samples) {
|
|||
}
|
||||
|
||||
void AudioDriverWeb::_audio_driver_capture(int p_from, int p_samples) {
|
||||
if (get_input_buffer().size() == 0) {
|
||||
if (get_input_buffer().is_empty()) {
|
||||
return; // Input capture stopped.
|
||||
}
|
||||
const int max_samples = memarr_len(input_rb);
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ public:
|
|||
int gid = ctl_id++;
|
||||
int cid = ctl_id++;
|
||||
|
||||
if (p_options.size() == 0) {
|
||||
if (p_options.is_empty()) {
|
||||
// Add check box.
|
||||
p_pfdc->StartVisualGroup(gid, L"");
|
||||
p_pfdc->AddCheckButton(cid, (LPCWSTR)p_name.utf16().get_data(), p_default);
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ void AnimatedSprite2D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) {
|
|||
|
||||
List<StringName> al;
|
||||
frames->get_animation_list(&al);
|
||||
if (al.size() == 0) {
|
||||
if (al.is_empty()) {
|
||||
set_animation(StringName());
|
||||
autoplay = String();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -675,7 +675,7 @@ static real_t rand_from_seed(uint32_t &seed) {
|
|||
}
|
||||
|
||||
void CPUParticles2D::_update_internal() {
|
||||
if (particles.size() == 0 || !is_visible_in_tree()) {
|
||||
if (particles.is_empty() || !is_visible_in_tree()) {
|
||||
_set_do_redraw(false);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue