Some code changed with Clang-Tidy

This commit is contained in:
qarmin 2019-06-26 15:08:25 +02:00
parent 5c66771e3e
commit 4e5310cc60
175 changed files with 467 additions and 674 deletions

View file

@ -76,7 +76,7 @@ RES _ResourceLoader::load(const String &p_path, const String &p_type_hint, bool
if (err != OK) {
ERR_EXPLAIN("Error loading resource: '" + p_path + "'");
ERR_FAIL_COND_V(err != OK, ret);
ERR_FAIL_V(ret);
}
return ret;
}

View file

@ -552,7 +552,7 @@ void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherit
OBJTYPE_WLOCK;
StringName name = p_class;
const StringName &name = p_class;
ERR_FAIL_COND(classes.has(name));

View file

@ -195,7 +195,7 @@ struct Color {
static Color named(const String &p_name);
String to_html(bool p_alpha = true) const;
Color from_hsv(float p_h, float p_s, float p_v, float p_a) const;
static Color from_rgbe9995(uint32_t p_color);
static Color from_rgbe9995(uint32_t p_rgbe);
_FORCE_INLINE_ bool operator<(const Color &p_color) const; //used in set keys
operator String() const;

View file

@ -136,8 +136,8 @@ extern bool _err_error_exists;
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return; \
} else \
_err_error_exists = false; \
} \
_err_error_exists = false; \
} while (0); // (*)
/** An index has failed if m_index<0 or m_index >=m_size, the function exits.
@ -150,8 +150,8 @@ extern bool _err_error_exists;
if (unlikely((m_index) < 0 || (m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return m_retval; \
} else \
_err_error_exists = false; \
} \
_err_error_exists = false; \
} while (0); // (*)
/** An index has failed if m_index >=m_size, the function exits.
@ -164,8 +164,8 @@ extern bool _err_error_exists;
if (unlikely((m_index) >= (m_size))) { \
_err_print_index_error(FUNCTION_STR, __FILE__, __LINE__, m_index, m_size, _STR(m_index), _STR(m_size)); \
return m_retval; \
} else \
_err_error_exists = false; \
} \
_err_error_exists = false; \
} while (0); // (*)
/** Use this one if there is no sensible fallback, that is, the error is unrecoverable.
@ -188,8 +188,8 @@ extern bool _err_error_exists;
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter ' " _STR(m_param) " ' is null."); \
return; \
} else \
_err_error_exists = false; \
} \
_err_error_exists = false; \
}
#define ERR_FAIL_NULL_V(m_param, m_retval) \
@ -197,8 +197,8 @@ extern bool _err_error_exists;
if (unlikely(!m_param)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter ' " _STR(m_param) " ' is null."); \
return m_retval; \
} else \
_err_error_exists = false; \
} \
_err_error_exists = false; \
}
/** An error condition happened (m_cond tested true) (WARNING this is the opposite as assert().
@ -210,8 +210,8 @@ extern bool _err_error_exists;
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true."); \
return; \
} else \
_err_error_exists = false; \
} \
_err_error_exists = false; \
}
/** Use this one if there is no sensible fallback, that is, the error is unrecoverable.
@ -236,8 +236,8 @@ extern bool _err_error_exists;
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. returned: " _STR(m_retval)); \
return m_retval; \
} else \
_err_error_exists = false; \
} \
_err_error_exists = false; \
}
/** An error condition happened (m_cond tested true) (WARNING this is the opposite as assert().
@ -249,8 +249,8 @@ extern bool _err_error_exists;
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Continuing..:"); \
continue; \
} else \
_err_error_exists = false; \
} \
_err_error_exists = false; \
}
/** An error condition happened (m_cond tested true) (WARNING this is the opposite as assert().
@ -262,8 +262,8 @@ extern bool _err_error_exists;
if (unlikely(m_cond)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition ' " _STR(m_cond) " ' is true. Breaking..:"); \
break; \
} else \
_err_error_exists = false; \
} \
_err_error_exists = false; \
}
/** Print an error string and return

View file

@ -2402,7 +2402,7 @@ Color Image::get_pixel(int p_x, int p_y) const {
#ifdef DEBUG_ENABLED
if (!ptr) {
ERR_EXPLAIN("Image must be locked with 'lock()' before using get_pixel()");
ERR_FAIL_COND_V(!ptr, Color());
ERR_FAIL_V(Color());
}
ERR_FAIL_INDEX_V(p_x, width, Color());
@ -2541,7 +2541,7 @@ void Image::set_pixel(int p_x, int p_y, const Color &p_color) {
#ifdef DEBUG_ENABLED
if (!ptr) {
ERR_EXPLAIN("Image must be locked with 'lock()' before using set_pixel()");
ERR_FAIL_COND(!ptr);
ERR_FAIL();
}
ERR_FAIL_INDEX(p_x, width);

View file

@ -350,7 +350,7 @@ public:
Color get_pixelv(const Point2 &p_src) const;
Color get_pixel(int p_x, int p_y) const;
void set_pixelv(const Point2 &p_dest, const Color &p_color);
void set_pixelv(const Point2 &p_dst, const Color &p_color);
void set_pixel(int p_x, int p_y, const Color &p_color);
void copy_internals_from(const Ref<Image> &p_image) {

View file

@ -194,7 +194,7 @@ bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const Str
Map<StringName, Action>::Element *E = input_map.find(p_action);
if (!E) {
ERR_EXPLAIN("Request for nonexistent InputMap action: " + String(p_action));
ERR_FAIL_COND_V(!E, false);
ERR_FAIL_V(false);
}
Ref<InputEventAction> input_event_action = p_event;

View file

@ -435,7 +435,6 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const {
_queue_page(page + j);
}
buff = pages.write[page].buffer.ptrw();
//queue pages
buffer_mutex->unlock();
}

View file

@ -775,7 +775,7 @@ Dictionary HTTPClient::_get_response_headers_as_dictionary() {
get_response_headers(&rh);
Dictionary ret;
for (const List<String>::Element *E = rh.front(); E; E = E->next()) {
String s = E->get();
const String &s = E->get();
int sp = s.find(":");
if (sp == -1)
continue;

View file

@ -681,8 +681,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
if (r_len)
(*r_len) += adv;
len -= adv;
buf += adv;
}
r_variant = varray;
@ -719,8 +717,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
if (r_len)
(*r_len) += adv;
len -= adv;
buf += adv;
}
r_variant = varray;
@ -758,8 +754,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
if (r_len)
(*r_len) += adv;
len -= adv;
buf += adv;
}
r_variant = carray;
@ -1092,7 +1086,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
if (!obj) {
if (buf) {
encode_uint32(0, buf);
buf += 4;
}
r_len += 4;

View file

@ -77,7 +77,7 @@ protected:
void _process_raw(int p_from, const uint8_t *p_packet, int p_packet_len);
void _send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p_set, const StringName &p_name, const Variant **p_arg, int p_argcount);
bool _send_confirm_path(NodePath p_path, PathSentCache *psc, int p_from);
bool _send_confirm_path(NodePath p_path, PathSentCache *psc, int p_target);
public:
enum NetworkCommands {

View file

@ -109,10 +109,7 @@ Error PCKPacker::add_file(const String &p_file, const String &p_src) {
Error PCKPacker::flush(bool p_verbose) {
if (!file) {
ERR_FAIL_COND_V(!file, ERR_INVALID_PARAMETER);
return ERR_INVALID_PARAMETER;
};
ERR_FAIL_COND_V(!file, ERR_INVALID_PARAMETER);
// write the index

View file

@ -720,7 +720,7 @@ Error ResourceInteractiveLoaderBinary::poll() {
error = ERR_FILE_CORRUPT;
memdelete(obj); //bye
ERR_EXPLAIN(local_path + ":Resource type in resource field not a resource, type is: " + obj->get_class());
ERR_FAIL_COND_V(!r, ERR_FILE_CORRUPT);
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
RES res = RES(r);
@ -1694,7 +1694,7 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant
int len = varray.size();
for (int i = 0; i < len; i++) {
Variant v = varray.get(i);
const Variant &v = varray.get(i);
_find_resources(v);
}

View file

@ -352,7 +352,6 @@ void StreamPeerTCP::_bind_methods() {
StreamPeerTCP::StreamPeerTCP() :
_sock(Ref<NetSocket>(NetSocket::create())),
status(STATUS_NONE),
peer_host(IP_Address()),
peer_port(0) {
}

View file

@ -83,11 +83,7 @@ bool TCP_Server::is_connection_available() const {
return false;
Error err = _sock->poll(NetSocket::POLL_TYPE_IN, 0);
if (err != OK) {
return false;
}
return true;
return (err == OK);
}
Ref<StreamPeerTCP> TCP_Server::take_connection() {

View file

@ -1794,7 +1794,7 @@ Expression::ENode *Expression::_parse_expression() {
if (next_op == -1) {
_set_error("Yet another parser bug....");
ERR_FAIL_COND_V(next_op == -1, NULL);
ERR_FAIL_V(NULL);
}
// OK! create operator..

View file

@ -30,8 +30,7 @@
#include "random_number_generator.h"
RandomNumberGenerator::RandomNumberGenerator() :
randbase() {}
RandomNumberGenerator::RandomNumberGenerator() {}
void RandomNumberGenerator::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_seed", "seed"), &RandomNumberGenerator::set_seed);

View file

@ -97,7 +97,7 @@ public:
PoolVector<Triangle> get_triangles() const { return triangles; }
PoolVector<Vector3> get_vertices() const { return vertices; }
void get_indices(PoolVector<int> *p_triangles_indices) const;
void get_indices(PoolVector<int> *r_triangles_indices) const;
void create(const PoolVector<Vector3> &p_faces);
TriangleMesh();

View file

@ -357,7 +357,7 @@ NodePath::NodePath(const String &p_path) {
String path = p_path;
Vector<StringName> subpath;
int absolute = (path[0] == '/') ? 1 : 0;
bool absolute = (path[0] == '/');
bool last_is_slash = true;
bool has_slashes = false;
int slices = 0;
@ -387,7 +387,7 @@ NodePath::NodePath(const String &p_path) {
path = path.substr(0, subpath_pos);
}
for (int i = absolute; i < path.length(); i++) {
for (int i = (int)absolute; i < path.length(); i++) {
if (path[i] == '/') {
@ -407,7 +407,7 @@ NodePath::NodePath(const String &p_path) {
data = memnew(Data);
data->refcount.init();
data->absolute = absolute ? true : false;
data->absolute = absolute;
data->has_slashes = has_slashes;
data->subpath = subpath;
data->hash_cache_valid = false;
@ -416,10 +416,10 @@ NodePath::NodePath(const String &p_path) {
return;
data->path.resize(slices);
last_is_slash = true;
int from = absolute;
int from = (int)absolute;
int slice = 0;
for (int i = absolute; i < path.length() + 1; i++) {
for (int i = (int)absolute; i < path.length() + 1; i++) {
if (path[i] == '/' || path[i] == 0) {

View file

@ -474,7 +474,6 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid
if (r_valid)
*r_valid = false;
return;
}
Variant Object::get(const StringName &p_name, bool *r_valid) const {
@ -810,11 +809,7 @@ bool Object::has_method(const StringName &p_method) const {
MethodBind *method = ClassDB::get_method(get_class_name(), p_method);
if (method) {
return true;
}
return false;
return method != NULL;
}
Variant Object::getvar(const Variant &p_key, bool *r_valid) const {
@ -1485,7 +1480,7 @@ Error Object::connect(const StringName &p_signal, Object *p_to_object, const Str
return OK;
} else {
ERR_EXPLAIN("Signal '" + p_signal + "' is already connected to given method '" + p_to_method + "' in that object.");
ERR_FAIL_COND_V(s->slot_map.has(target), ERR_INVALID_PARAMETER);
ERR_FAIL_V(ERR_INVALID_PARAMETER);
}
}
@ -1542,11 +1537,11 @@ void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const
Signal *s = signal_map.getptr(p_signal);
if (!s) {
ERR_EXPLAIN("Nonexistent signal: " + p_signal);
ERR_FAIL_COND(!s);
ERR_FAIL();
}
if (s->lock > 0) {
ERR_EXPLAIN("Attempt to disconnect signal '" + p_signal + "' while emitting (locks: " + itos(s->lock) + ")");
ERR_FAIL_COND(s->lock > 0);
ERR_FAIL();
}
Signal::Target target(p_to_object->get_instance_id(), p_to_method);

View file

@ -373,7 +373,7 @@ Error DirAccess::_copy_dir(DirAccess *p_target_da, String p_to, int p_chmod_flag
if (current_is_dir())
dirs.push_back(n);
else {
String rel_path = n;
const String &rel_path = n;
if (!n.is_rel_path()) {
list_dir_end();
return ERR_BUG;

View file

@ -601,7 +601,8 @@ Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path, Error *r_err
if (r_error) { // if error requested, do not throw error
return Vector<uint8_t>();
}
ERR_FAIL_COND_V(!f, Vector<uint8_t>());
ERR_EXPLAIN("Can't open file from path: " + String(p_path));
ERR_FAIL_V(Vector<uint8_t>());
}
Vector<uint8_t> data;
data.resize(f->get_len());
@ -621,7 +622,8 @@ String FileAccess::get_file_as_string(const String &p_path, Error *r_error) {
if (r_error) {
return String();
}
ERR_FAIL_COND_V(err != OK, String());
ERR_EXPLAIN("Can't get file as string from path: " + String(p_path));
ERR_FAIL_V(String());
}
String ret;

View file

@ -314,7 +314,7 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool *p_pressed
if (p_pressed != NULL)
*p_pressed = key->is_pressed();
if (p_strength != NULL)
*p_strength = (*p_pressed) ? 1.0f : 0.0f;
*p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
}
return match;
}
@ -483,7 +483,7 @@ bool InputEventMouseButton::action_match(const Ref<InputEvent> &p_event, bool *p
if (p_pressed != NULL)
*p_pressed = mb->is_pressed();
if (p_strength != NULL)
*p_strength = (*p_pressed) ? 1.0f : 0.0f;
*p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
}
return match;
@ -795,7 +795,7 @@ bool InputEventJoypadButton::action_match(const Ref<InputEvent> &p_event, bool *
if (p_pressed != NULL)
*p_pressed = jb->is_pressed();
if (p_strength != NULL)
*p_strength = (*p_pressed) ? 1.0f : 0.0f;
*p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
}
return match;
@ -1041,7 +1041,7 @@ bool InputEventAction::action_match(const Ref<InputEvent> &p_event, bool *p_pres
if (p_pressed != NULL)
*p_pressed = act->pressed;
if (p_strength != NULL)
*p_strength = (*p_pressed) ? 1.0f : 0.0f;
*p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
}
return match;
}

View file

@ -239,7 +239,8 @@ void OS::print_all_resources(String p_to_file) {
_OSPRF = FileAccess::open(p_to_file, FileAccess::WRITE, &err);
if (err != OK) {
_OSPRF = NULL;
ERR_FAIL_COND(err != OK);
ERR_EXPLAIN("Can't print all resources to file: " + String(p_to_file));
ERR_FAIL();
}
}

View file

@ -206,8 +206,8 @@ PoolAllocator::ID PoolAllocator::alloc(int p_size) {
if (!find_hole(&new_entry_indices_pos, size_to_alloc)) {
mt_unlock();
ERR_PRINT("memory can't be compacted further");
return POOL_ALLOCATOR_INVALID_ID;
ERR_EXPLAIN("Memory can't be compacted further");
ERR_FAIL_V(POOL_ALLOCATOR_INVALID_ID);
}
}
@ -217,7 +217,8 @@ PoolAllocator::ID PoolAllocator::alloc(int p_size) {
if (!found_free_entry) {
mt_unlock();
ERR_FAIL_COND_V(!found_free_entry, POOL_ALLOCATOR_INVALID_ID);
ERR_EXPLAIN("No free entry found in PoolAllocator");
ERR_FAIL_V(POOL_ALLOCATOR_INVALID_ID);
}
/* move all entry indices up, make room for this one */

View file

@ -566,7 +566,7 @@ Error ProjectSettings::_load_settings_text(const String p_path) {
if (config_version > CONFIG_VERSION) {
memdelete(f);
ERR_EXPLAIN(vformat("Can't open project at '%s', its `config_version` (%d) is from a more recent and incompatible version of the engine. Expected config version: %d.", p_path, config_version, CONFIG_VERSION));
ERR_FAIL_COND_V(config_version > CONFIG_VERSION, ERR_FILE_CANT_OPEN);
ERR_FAIL_V(ERR_FILE_CANT_OPEN);
}
} else {
if (section == String()) {

View file

@ -189,11 +189,7 @@ public:
_ALWAYS_INLINE_ bool unref() { // true if must be disposed of
if (atomic_decrement(&count) == 0) {
return true;
}
return false;
return atomic_decrement(&count) == 0;
}
_ALWAYS_INLINE_ uint32_t get() const { // nothrow

View file

@ -3799,11 +3799,7 @@ bool String::is_valid_filename() const {
return false;
}
if (find(":") != -1 || find("/") != -1 || find("\\") != -1 || find("?") != -1 || find("*") != -1 || find("\"") != -1 || find("|") != -1 || find("%") != -1 || find("<") != -1 || find(">") != -1) {
return false;
} else {
return true;
}
return !(find(":") != -1 || find("/") != -1 || find("\\") != -1 || find("?") != -1 || find("*") != -1 || find("\"") != -1 || find("|") != -1 || find("%") != -1 || find("<") != -1 || find(">") != -1);
}
bool String::is_valid_ip_address() const {
@ -3941,7 +3937,6 @@ String String::percent_decode() const {
uint8_t a = LOWERCASE(cs[i + 1]);
uint8_t b = LOWERCASE(cs[i + 2]);
c = 0;
if (a >= '0' && a <= '9')
c = (a - '0') << 4;
else if (a >= 'a' && a <= 'f')

View file

@ -404,8 +404,6 @@ _FORCE_INLINE_ bool is_str_less(const L *l_ptr, const R *r_ptr) {
l_ptr++;
r_ptr++;
}
CRASH_COND(true); // unreachable
}
/* end of namespace */

View file

@ -709,7 +709,7 @@ bool Variant::is_zero() const {
// atomic types
case BOOL: {
return _data._bool == false;
return !(_data._bool);
} break;
case INT: {

View file

@ -248,8 +248,8 @@ public:
Variant(unsigned short p_short);
Variant(signed char p_char); // real one
Variant(unsigned char p_char);
Variant(int64_t p_char); // real one
Variant(uint64_t p_char);
Variant(int64_t p_int); // real one
Variant(uint64_t p_int);
Variant(float p_float);
Variant(double p_double);
Variant(const String &p_string);
@ -262,11 +262,11 @@ public:
Variant(const Plane &p_plane);
Variant(const ::AABB &p_aabb);
Variant(const Quat &p_quat);
Variant(const Basis &p_transform);
Variant(const Basis &p_matrix);
Variant(const Transform2D &p_transform);
Variant(const Transform &p_transform);
Variant(const Color &p_color);
Variant(const NodePath &p_path);
Variant(const NodePath &p_node_path);
Variant(const RefPtr &p_resource);
Variant(const RID &p_rid);
Variant(const Object *p_object);
@ -283,17 +283,17 @@ public:
Variant(const PoolVector<Face3> &p_face_array);
Variant(const Vector<Variant> &p_array);
Variant(const Vector<uint8_t> &p_raw_array);
Variant(const Vector<int> &p_int_array);
Variant(const Vector<real_t> &p_real_array);
Variant(const Vector<String> &p_string_array);
Variant(const Vector<StringName> &p_string_array);
Variant(const Vector<Vector3> &p_vector3_array);
Variant(const Vector<Color> &p_color_array);
Variant(const Vector<uint8_t> &p_array);
Variant(const Vector<int> &p_array);
Variant(const Vector<real_t> &p_array);
Variant(const Vector<String> &p_array);
Variant(const Vector<StringName> &p_array);
Variant(const Vector<Vector3> &p_array);
Variant(const Vector<Color> &p_array);
Variant(const Vector<Plane> &p_array); // helper
Variant(const Vector<RID> &p_array); // helper
Variant(const Vector<Vector2> &p_array); // helper
Variant(const PoolVector<Vector2> &p_array); // helper
Variant(const PoolVector<Vector2> &p_vector2_array); // helper
Variant(const IP_Address &p_address);

View file

@ -811,7 +811,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer)
data.resize(data_size);
Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1 ? true : false, real_format, data));
Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1, real_format, data));
return Ref<Image>(img);
#else

View file

@ -182,14 +182,11 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
#endif
int define_line_ofs = 1;
for (int j = 0; j < conditional_count; j++) {
bool enable = (conditional_version.version & (1 << j)) > 0;
if (enable) {
strings.push_back(conditional_defines[j]);
define_line_ofs++;
DEBUG_PRINT(conditional_defines[j]);
}
}
@ -206,7 +203,6 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
ERR_FAIL_COND_V(!cc, NULL);
v.code_version = cc->version;
define_line_ofs += 2;
}
// program

View file

@ -691,7 +691,7 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
state.canvas_shader.set_uniform(CanvasShaderGLES3::DST_RECT, Color(dst_rect.position.x, dst_rect.position.y, dst_rect.size.x, dst_rect.size.y));
state.canvas_shader.set_uniform(CanvasShaderGLES3::SRC_RECT, Color(src_rect.position.x, src_rect.position.y, src_rect.size.x, src_rect.size.y));
state.canvas_shader.set_uniform(CanvasShaderGLES3::CLIP_RECT_UV, (rect->flags & CANVAS_RECT_CLIP_UV) ? true : false);
state.canvas_shader.set_uniform(CanvasShaderGLES3::CLIP_RECT_UV, rect->flags & CANVAS_RECT_CLIP_UV);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
@ -1932,7 +1932,7 @@ void RasterizerCanvasGLES3::draw_window_margins(int *black_margin, RID *black_im
int window_h = window_size.height;
int window_w = window_size.width;
glBindFramebuffer(GL_FRAMEBUFFER, storage->system_fbo);
glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
glViewport(0, 0, window_size.width, window_size.height);
canvas_begin();

View file

@ -2426,7 +2426,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G
e->sort_key |= SORT_KEY_LIGHTMAP_CAPTURE_FLAG;
}
e->sort_key |= uint64_t(p_material->render_priority + 128) << RenderList::SORT_KEY_PRIORITY_SHIFT;
e->sort_key |= (uint64_t(p_material->render_priority) + 128) << RenderList::SORT_KEY_PRIORITY_SHIFT;
}
/*

View file

@ -1252,7 +1252,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer)
data.resize(data_size);
Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1 ? true : false, img_format, data));
Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, texture->mipmaps > 1, img_format, data));
return Ref<Image>(img);
#else

View file

@ -816,7 +816,7 @@ public:
virtual void multimesh_instance_set_transform(RID p_multimesh, int p_index, const Transform &p_transform);
virtual void multimesh_instance_set_transform_2d(RID p_multimesh, int p_index, const Transform2D &p_transform);
virtual void multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color);
virtual void multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_color);
virtual void multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_custom_data);
virtual RID multimesh_get_mesh(RID p_multimesh) const;

View file

@ -478,7 +478,7 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() {
glDeleteShader(v.vert_id);
glDeleteProgram(v.id);
v.id = 0;
ERR_FAIL_COND_V(iloglen <= 0, NULL);
ERR_FAIL_COND_V(iloglen < 0, NULL);
}
if (iloglen == 0) {

View file

@ -100,10 +100,7 @@ bool DirAccessUnix::dir_exists(String p_dir) {
struct stat flags;
bool success = (stat(p_dir.utf8().get_data(), &flags) == 0);
if (success && S_ISDIR(flags.st_mode))
return true;
return false;
return (success && S_ISDIR(flags.st_mode));
}
uint64_t DirAccessUnix::get_modified_time(String p_file) {

View file

@ -221,10 +221,7 @@ bool NetSocketPosix::_can_use_ip(const IP_Address p_ip, const bool p_for_bind) c
}
// Check if socket support this IP type.
IP::Type type = p_ip.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
if (_ip_type != IP::TYPE_ANY && !p_ip.is_wildcard() && _ip_type != type) {
return false;
}
return true;
return !(_ip_type != IP::TYPE_ANY && !p_ip.is_wildcard() && _ip_type != type);
}
void NetSocketPosix::_set_socket(SOCKET_TYPE p_sock, IP::Type p_ip_type, bool p_is_stream) {

View file

@ -76,7 +76,7 @@ public:
virtual void close();
virtual Error bind(IP_Address p_addr, uint16_t p_port);
virtual Error listen(int p_max_pending);
virtual Error connect_to_host(IP_Address p_addr, uint16_t p_port);
virtual Error connect_to_host(IP_Address p_host, uint16_t p_port);
virtual Error poll(PollType p_type, int timeout) const;
virtual Error recv(uint8_t *p_buffer, int p_len, int &r_read);
virtual Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port);

View file

@ -286,7 +286,7 @@ public:
if (name == "value") {
Variant value = p_value;
const Variant &value = p_value;
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
@ -302,7 +302,7 @@ public:
}
if (name == "in_handle") {
Variant value = p_value;
const Variant &value = p_value;
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
@ -318,7 +318,7 @@ public:
}
if (name == "out_handle") {
Variant value = p_value;
const Variant &value = p_value;
setting = true;
undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
@ -4887,7 +4887,7 @@ void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) {
continue;
}
if (!prop_exists || p_animation->track_get_type(i) != Animation::TYPE_VALUE || cleanup_keys->is_pressed() == false)
if (!prop_exists || p_animation->track_get_type(i) != Animation::TYPE_VALUE || !cleanup_keys->is_pressed())
continue;
for (int j = 0; j < p_animation->track_get_key_count(i); j++) {

View file

@ -332,7 +332,7 @@ class AnimationTrackEditor : public VBoxContainer {
void _update_scroll(double);
void _update_step(double p_new_step);
void _update_length(double p_new_step);
void _update_length(double p_new_len);
void _dropped_track(int p_from_track, int p_to_track);
void _add_track(int p_type);

View file

@ -93,7 +93,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
if (newsize == size)
return true;
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Resize Array"));
ur->add_do_method(this, "_set_size", newsize);
ur->add_undo_method(this, "_set_size", size);
@ -141,7 +141,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
if (value.get_type() != type && type >= 0 && type < Variant::VARIANT_MAX) {
Variant::CallError ce;
Variant new_value = Variant::construct(Variant::Type(type), NULL, 0, ce);
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Array Value Type"));
ur->add_do_method(this, "_set_value", idx, new_value);
@ -157,7 +157,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
Variant arr = get_array();
Variant value = arr.get(idx);
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Array Value"));
ur->add_do_method(this, "_set_value", idx, p_value);

View file

@ -78,7 +78,7 @@ protected:
public:
static AudioStreamPreviewGenerator *get_singleton() { return singleton; }
Ref<AudioStreamPreview> generate_preview(const Ref<AudioStream> &p_preview);
Ref<AudioStreamPreview> generate_preview(const Ref<AudioStream> &p_stream);
AudioStreamPreviewGenerator();
};

View file

@ -48,7 +48,7 @@
String Collada::Effect::get_texture_path(const String &p_source, Collada &state) const {
String image = p_source;
const String &image = p_source;
ERR_FAIL_COND_V(!state.state.image_map.has(image), "");
return state.state.image_map[image].path;
}
@ -1101,6 +1101,7 @@ void Collada::_parse_mesh_geometry(XMLParser &parser, String p_id, String p_name
Vector<float> values = _read_float_array(parser);
if (polygons) {
ERR_CONTINUE(prim.vertex_size == 0);
prim.polygons.push_back(values.size() / prim.vertex_size);
int from = prim.indices.size();
prim.indices.resize(from + values.size());
@ -2522,7 +2523,6 @@ Error Collada::load(const String &p_path, int p_flags) {
state.local_path = ProjectSettings::get_singleton()->localize_path(p_path);
state.import_flags = p_flags;
/* Skip headers */
err = OK;
while ((err = parser.read()) == OK) {
if (parser.get_node_type() == XMLParser::NODE_ELEMENT) {

View file

@ -649,7 +649,7 @@ Open connection dialog with TreeItem data to CREATE a brand-new connection.
void ConnectionsDock::_open_connection_dialog(TreeItem &item) {
String signal = item.get_metadata(0).operator Dictionary()["name"];
String signalname = signal;
const String &signalname = signal;
String midname = selectedNode->get_name();
for (int i = 0; i < midname.length(); i++) { //TODO: Regex filter may be cleaner.
CharType c = midname[i];

View file

@ -42,7 +42,6 @@ void DictionaryPropertyEdit::_notif_changev(const String &p_v) {
void DictionaryPropertyEdit::_set_key(const Variant &p_old_key, const Variant &p_new_key) {
// TODO: Set key of a dictionary is not allowed yet
return;
}
void DictionaryPropertyEdit::_set_value(const Variant &p_key, const Variant &p_value) {
@ -129,7 +128,7 @@ bool DictionaryPropertyEdit::_set(const StringName &p_name, const Variant &p_val
if (type == "key" && index < keys.size()) {
const Variant &key = keys[index];
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Dictionary Key"));
ur->add_do_method(this, "_set_key", key, p_value);
@ -144,7 +143,7 @@ bool DictionaryPropertyEdit::_set(const StringName &p_name, const Variant &p_val
if (dict.has(key)) {
Variant value = dict[key];
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Dictionary Value"));
ur->add_do_method(this, "_set_value", key, p_value);

View file

@ -288,7 +288,7 @@ void EditorAudioBus::_name_changed(const String &p_new_name) {
}
updating_bus = true;
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
StringName current = AudioServer::get_singleton()->get_bus_name(get_index());
ur->create_action(TTR("Rename Audio Bus"));
@ -323,7 +323,7 @@ void EditorAudioBus::_volume_changed(float p_normalized) {
float p_db = this->_normalized_volume_to_scaled_db(p_normalized);
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Audio Bus Volume"), UndoRedo::MERGE_ENDS);
ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), p_db);
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", get_index(), AudioServer::get_singleton()->get_bus_volume_db(get_index()));
@ -400,7 +400,7 @@ void EditorAudioBus::_solo_toggled() {
updating_bus = true;
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Toggle Audio Bus Solo"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_solo", get_index(), solo->is_pressed());
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_solo", get_index(), AudioServer::get_singleton()->is_bus_solo(get_index()));
@ -414,7 +414,7 @@ void EditorAudioBus::_mute_toggled() {
updating_bus = true;
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Toggle Audio Bus Mute"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_mute", get_index(), mute->is_pressed());
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_mute", get_index(), AudioServer::get_singleton()->is_bus_mute(get_index()));
@ -428,7 +428,7 @@ void EditorAudioBus::_bypass_toggled() {
updating_bus = true;
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Toggle Audio Bus Bypass Effects"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_bypass_effects", get_index(), bypass->is_pressed());
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_bypass_effects", get_index(), AudioServer::get_singleton()->is_bus_bypassing_effects(get_index()));
@ -443,7 +443,7 @@ void EditorAudioBus::_send_selected(int p_which) {
updating_bus = true;
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Select Audio Bus Send"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_send", get_index(), send->get_item_text(p_which));
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_send", get_index(), AudioServer::get_singleton()->get_bus_send(get_index()));
@ -492,7 +492,7 @@ void EditorAudioBus::_effect_edited() {
int index = effect->get_metadata(0);
updating_bus = true;
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Select Audio Bus Send"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, effect->is_checked(0));
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_effect_enabled", get_index(), index, AudioServer::get_singleton()->is_bus_effect_enabled(get_index(), index));
@ -519,7 +519,7 @@ void EditorAudioBus::_effect_add(int p_which) {
afxr->set_name(effect_options->get_item_text(p_which));
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Add Audio Bus Effect"));
ur->add_do_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), afxr, -1);
ur->add_undo_method(AudioServer::get_singleton(), "remove_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect_count(get_index()));
@ -671,7 +671,7 @@ void EditorAudioBus::drop_data_fw(const Point2 &p_point, const Variant &p_data,
bool enabled = AudioServer::get_singleton()->is_bus_effect_enabled(bus, effect);
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Move Bus Effect"));
ur->add_do_method(AudioServer::get_singleton(), "remove_bus_effect", bus, effect);
ur->add_do_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect(bus, effect), paste_at);
@ -712,7 +712,7 @@ void EditorAudioBus::_delete_effect_pressed(int p_option) {
int index = item->get_metadata(0);
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Delete Bus Effect"));
ur->add_do_method(AudioServer::get_singleton(), "remove_bus_effect", get_index(), index);
ur->add_undo_method(AudioServer::get_singleton(), "add_bus_effect", get_index(), AudioServer::get_singleton()->get_bus_effect(get_index(), index), index);
@ -980,11 +980,7 @@ void EditorAudioBusDrop::_notification(int p_what) {
bool EditorAudioBusDrop::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
Dictionary d = p_data;
if (d.has("type") && String(d["type"]) == "move_audio_bus") {
return true;
}
return false;
return (d.has("type") && String(d["type"]) == "move_audio_bus");
}
void EditorAudioBusDrop::drop_data(const Point2 &p_point, const Variant &p_data) {
@ -1013,7 +1009,7 @@ void EditorAudioBuses::_update_buses() {
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
bool is_master = i == 0 ? true : false;
bool is_master = (i == 0);
EditorAudioBus *audio_bus = memnew(EditorAudioBus(this, is_master));
bus_hb->add_child(audio_bus);
audio_bus->connect("delete_request", this, "_delete_bus", varray(audio_bus), CONNECT_DEFERRED);
@ -1075,7 +1071,7 @@ void EditorAudioBuses::_notification(int p_what) {
void EditorAudioBuses::_add_bus() {
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Add Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_count", AudioServer::get_singleton()->get_bus_count() + 1);
@ -1109,7 +1105,7 @@ void EditorAudioBuses::_delete_bus(Object *p_which) {
return;
}
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Delete Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "remove_bus", index);
@ -1133,7 +1129,7 @@ void EditorAudioBuses::_delete_bus(Object *p_which) {
void EditorAudioBuses::_duplicate_bus(int p_which) {
int add_at_pos = p_which + 1;
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Duplicate Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "add_bus", add_at_pos);
ur->add_do_method(AudioServer::get_singleton(), "set_bus_name", add_at_pos, AudioServer::get_singleton()->get_bus_name(p_which) + " Copy");
@ -1158,7 +1154,7 @@ void EditorAudioBuses::_reset_bus_volume(Object *p_which) {
EditorAudioBus *bus = Object::cast_to<EditorAudioBus>(p_which);
int index = bus->get_index();
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Reset Bus Volume"));
ur->add_do_method(AudioServer::get_singleton(), "set_bus_volume_db", index, 0.f);
ur->add_undo_method(AudioServer::get_singleton(), "set_bus_volume_db", index, AudioServer::get_singleton()->get_bus_volume_db(index));
@ -1180,7 +1176,7 @@ void EditorAudioBuses::_request_drop_end() {
void EditorAudioBuses::_drop_at_index(int p_bus, int p_index) {
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Move Audio Bus"));
ur->add_do_method(AudioServer::get_singleton(), "move_bus", p_bus, p_index);

View file

@ -545,10 +545,7 @@ bool EditorAutoloadSettings::can_drop_data_fw(const Point2 &p_point, const Varia
int section = tree->get_drop_section_at_position(p_point);
if (section < -1)
return false;
return true;
return section >= -1;
}
return false;
@ -650,7 +647,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
return false;
}
String path = p_path;
const String &path = p_path;
if (!FileAccess::exists(path)) {
EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("File does not exist."));
return false;
@ -663,7 +660,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
name = "autoload/" + name;
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add AutoLoad"));
// Singleton autoloads are represented with a leading "*" in their path.
@ -690,7 +687,7 @@ void EditorAutoloadSettings::autoload_remove(const String &p_name) {
String name = "autoload/" + p_name;
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *undo_redo = EditorNode::get_undo_redo();
int order = ProjectSettings::get_singleton()->get_order(name);

View file

@ -186,7 +186,7 @@ EditorDirDialog::EditorDirDialog() {
tree->connect("item_activated", this, "_ok");
makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel() ? true : false, "makedir");
makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel(), "makedir");
makedir->connect("pressed", this, "_make_dir");
makedialog = memnew(ConfirmationDialog);

View file

@ -977,7 +977,8 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c
ftmp = FileAccess::open(tmppath, FileAccess::READ);
if (!ftmp) {
memdelete(f);
ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE);
ERR_EXPLAIN("Can't open file to read from path: " + String(tmppath));
ERR_FAIL_V(ERR_CANT_CREATE);
}
const int bufsize = 16384;
@ -1455,10 +1456,7 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset,
err += TTR("Custom release template not found.") + "\n";
}
if (dvalid || rvalid)
valid = true;
else
valid = false;
valid = dvalid || rvalid;
if (!err.empty())
r_error = err;

View file

@ -1290,13 +1290,7 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector
r_file_pos = cpos;
*r_d = fs;
if (cpos != -1) {
return true;
} else {
return false;
}
return cpos != -1;
}
String EditorFileSystem::get_file_type(const String &p_file) const {
@ -1604,7 +1598,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
//all went well, overwrite config files with proper remaps and md5s
for (Map<String, Map<StringName, Variant> >::Element *E = source_file_options.front(); E; E = E->next()) {
String file = E->key();
const String &file = E->key();
String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(file);
FileAccessRef f = FileAccess::open(file + ".import", FileAccess::WRITE);
ERR_FAIL_COND_V(!f, ERR_FILE_CANT_OPEN);
@ -1939,7 +1933,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
if (err) {
memdelete(da);
ERR_EXPLAIN("Failed to create 'res://.import' folder.");
ERR_FAIL_COND(err != OK);
ERR_FAIL();
}
}
memdelete(da);

View file

@ -389,7 +389,6 @@ void EditorHelp::_update_doc() {
if (prev) {
class_desc->add_text(" , ");
prev = false;
}
_add_type(E->get().name);
@ -540,7 +539,6 @@ void EditorHelp::_update_doc() {
class_desc->pop(); //cell
class_desc->push_cell();
class_desc->pop(); //cell
any_previous = false;
}
String group_prefix;

View file

@ -139,7 +139,7 @@ public:
bool is_selected() const;
void set_label_reference(Control *p_control);
void set_bottom_editor(Control *p_editor);
void set_bottom_editor(Control *p_control);
void set_use_folding(bool p_use_folding);
bool is_using_folding() const;
@ -317,7 +317,7 @@ class EditorInspector : public ScrollContainer {
void _node_removed(Node *p_node);
void _changed_callback(Object *p_changed, const char *p_prop);
void _edit_request_change(Object *p_changed, const String &p_prop);
void _edit_request_change(Object *p_object, const String &p_prop);
void _filter_changed(const String &p_text);
void _parse_added_editors(VBoxContainer *current_vbox, Ref<EditorInspectorPlugin> ped);

View file

@ -184,7 +184,7 @@ Node *EditorInterface::get_edited_scene_root() {
Array EditorInterface::get_open_scenes() const {
Array ret;
Vector<EditorData::EditedScene> scenes = EditorNode::get_singleton()->get_editor_data().get_edited_scenes();
Vector<EditorData::EditedScene> scenes = EditorNode::get_editor_data().get_edited_scenes();
int scns_amount = scenes.size();
for (int idx_scn = 0; idx_scn < scns_amount; idx_scn++) {

View file

@ -101,7 +101,7 @@ public:
Error save_scene();
void save_scene_as(const String &p_scene, bool p_with_preview = true);
Vector<Ref<Texture> > make_mesh_previews(const Vector<Ref<Mesh> > &p_meshes, Vector<Transform> *p_trnasforms, int p_preview_size);
Vector<Ref<Texture> > make_mesh_previews(const Vector<Ref<Mesh> > &p_meshes, Vector<Transform> *p_transforms, int p_preview_size);
EditorInterface();
};

View file

@ -227,8 +227,6 @@ void EditorProfiler::_update_plot() {
Map<StringName, int> plot_prev;
//Map<StringName,int> plot_max;
uint64_t time = OS::get_singleton()->get_ticks_usec();
for (int i = 0; i < w; i++) {
for (int j = 0; j < h * 4; j++) {
@ -340,8 +338,6 @@ void EditorProfiler::_update_plot() {
wr[widx + 3] = 255;
}
}
time = OS::get_singleton()->get_ticks_usec() - time;
}
wr = PoolVector<uint8_t>::Write();

View file

@ -2303,7 +2303,7 @@ void EditorPropertyResource::_update_menu_items() {
}
for (Set<String>::Element *F = valid_inheritors.front(); F; F = F->next()) {
String t = F->get();
const String &t = F->get();
bool is_custom_resource = false;
Ref<Texture> icon;
@ -2469,8 +2469,8 @@ void EditorPropertyResource::_fold_other_editors(Object *p_self) {
if (!res.is_valid())
return;
bool use_editor = false;
for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count(); i++) {
EditorPlugin *ep = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i);
for (int i = 0; i < EditorNode::get_editor_data().get_editor_plugin_count(); i++) {
EditorPlugin *ep = EditorNode::get_editor_data().get_editor_plugin(i);
if (ep->handles(res.ptr())) {
use_editor = true;
}
@ -2516,7 +2516,7 @@ void EditorPropertyResource::update_property() {
sub_inspector->set_keying(is_keying());
sub_inspector->set_read_only(is_read_only());
sub_inspector->set_use_folding(is_using_folding());
sub_inspector->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
sub_inspector->set_undo_redo(EditorNode::get_undo_redo());
sub_inspector_vbox = memnew(VBoxContainer);
add_child(sub_inspector_vbox);
@ -2526,8 +2526,8 @@ void EditorPropertyResource::update_property() {
assign->set_pressed(true);
bool use_editor = false;
for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count(); i++) {
EditorPlugin *ep = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i);
for (int i = 0; i < EditorNode::get_editor_data().get_editor_plugin_count(); i++) {
EditorPlugin *ep = EditorNode::get_editor_data().get_editor_plugin(i);
if (ep->handles(res.ptr())) {
use_editor = true;
}

View file

@ -791,7 +791,7 @@ void EditorPropertyDictionary::update_property() {
} break;
case Variant::_RID: {
prop = memnew(EditorPropertyNil);
prop = memnew(EditorPropertyRID);
} break;
case Variant::OBJECT: {

View file

@ -50,10 +50,8 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
args.push_back(resource_path.replace(" ", "%20"));
}
if (true) {
args.push_back("--remote-debug");
args.push_back(remote_host + ":" + String::num(remote_port));
}
args.push_back("--remote-debug");
args.push_back(remote_host + ":" + String::num(remote_port));
args.push_back("--allow_focus_steal_pid");
args.push_back(itos(OS::get_singleton()->get_process_id()));

View file

@ -36,7 +36,7 @@
class EditorRunNative : public HBoxContainer {
GDCLASS(EditorRunNative, BoxContainer);
GDCLASS(EditorRunNative, HBoxContainer);
Map<int, MenuButton *> menus;
bool first;

View file

@ -107,7 +107,7 @@ bool EditorSettings::_set_only(const StringName &p_name, const Variant &p_value)
}
if (save_changed_setting) {
if (props[p_name].save != true) {
if (!props[p_name].save) {
props[p_name].save = true;
changed = true;
}
@ -690,7 +690,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
keys.sort();
for (const List<String>::Element *E = keys.front(); E; E = E->next()) {
String key = E->get();
const String &key = E->get();
if (key.begins_with("text_editor/highlighting/") && key.find("color") >= 0) {
cf->set_value(theme_section, key.replace("text_editor/highlighting/", ""), ((Color)props[key].variant).to_html());
}
@ -698,10 +698,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
Error err = cf->save(p_file);
if (err == OK) {
return true;
}
return false;
return err == OK;
}
bool EditorSettings::_is_default_text_editor_theme(String p_theme_name) {

View file

@ -73,8 +73,6 @@ private:
bool restart_if_changed;
VariantContainer() :
order(0),
variant(Variant()),
initial(Variant()),
has_default_value(false),
hide_from_editor(false),
save(false),
@ -83,7 +81,6 @@ private:
VariantContainer(const Variant &p_variant, int p_order) :
order(p_order),
variant(p_variant),
initial(Variant()),
has_default_value(false),
hide_from_editor(false),
save(false),
@ -123,7 +120,7 @@ private:
void _load_defaults(Ref<ConfigFile> p_extra_config = NULL);
void _load_default_text_editor_theme();
bool _save_text_editor_theme(String p_file);
bool _is_default_text_editor_theme(String p_file);
bool _is_default_text_editor_theme(String p_theme_name);
protected:
static void _bind_methods();

View file

@ -314,7 +314,8 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
if (!f) {
ret = unzGoToNextFile(pkg);
fc++;
ERR_CONTINUE(!f);
ERR_EXPLAIN("Can't open file from path: " + String(to_write));
ERR_CONTINUE(true);
}
f->store_buffer(data.ptr(), data.size());
@ -406,9 +407,7 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int
} break;
case HTTPRequest::RESULT_BODY_SIZE_LIMIT_EXCEEDED:
case HTTPRequest::RESULT_CONNECTION_ERROR:
case HTTPRequest::RESULT_CHUNKED_BODY_SIZE_MISMATCH: {
template_list_state->set_text(TTR("Can't connect."));
} break;
case HTTPRequest::RESULT_CHUNKED_BODY_SIZE_MISMATCH:
case HTTPRequest::RESULT_SSL_HANDSHAKE_ERROR:
case HTTPRequest::RESULT_CANT_CONNECT: {
template_list_state->set_text(TTR("Can't connect."));

View file

@ -244,7 +244,7 @@ void FileSystemDock::set_display_mode(DisplayMode p_display_mode) {
void FileSystemDock::_update_display_mode(bool p_force) {
// Compute the new display mode
if (p_force || old_display_mode != display_mode) {
button_toggle_display_mode->set_pressed(display_mode == DISPLAY_MODE_SPLIT ? true : false);
button_toggle_display_mode->set_pressed(display_mode == DISPLAY_MODE_SPLIT);
switch (display_mode) {
case DISPLAY_MODE_TREE_ONLY:
tree->show();
@ -2063,8 +2063,6 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
}
}
}
return;
}
void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options) {

View file

@ -204,7 +204,7 @@ private:
void _update_resource_paths_after_move(const Map<String, String> &p_renames) const;
void _save_scenes_after_move(const Map<String, String> &p_renames) const;
void _update_favorites_list_after_move(const Map<String, String> &p_files_renames, const Map<String, String> &p_folders_renames) const;
void _update_project_settings_after_move(const Map<String, String> &p_folders_renames) const;
void _update_project_settings_after_move(const Map<String, String> &p_renames) const;
void _file_deleted(String p_file);
void _folder_deleted(String p_folder);

View file

@ -34,7 +34,7 @@
#include "core/io/resource_importer.h"
class EditorImportPlugin : public ResourceImporter {
GDCLASS(EditorImportPlugin, Reference);
GDCLASS(EditorImportPlugin, ResourceImporter);
protected:
static void _bind_methods();

View file

@ -1135,7 +1135,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "nodes/storage", PROPERTY_HINT_ENUM, "Single Scene,Instanced Sub-Scenes"), scenes_out ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/location", PROPERTY_HINT_ENUM, "Node,Mesh"), (meshes_out || materials_out) ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), materials_out ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/compress"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "meshes/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? 1 : 0));
@ -1145,8 +1145,8 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 15));
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "animation/filter_script", PROPERTY_HINT_MULTILINE_TEXT), ""));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "animation/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), animations_out ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/keep_custom_tracks"), animations_out ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "animation/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), animations_out));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/keep_custom_tracks"), animations_out));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/optimizer/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/optimizer/max_linear_error"), 0.05));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/optimizer/max_angular_error"), 0.01));
@ -1237,7 +1237,7 @@ Ref<Animation> ResourceImporterScene::import_animation_from_other_importer(Edito
Error ResourceImporterScene::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
String src_path = p_source_file;
const String &src_path = p_source_file;
Ref<EditorSceneImporter> importer;
String ext = src_path.get_extension().to_lower();

View file

@ -85,7 +85,7 @@ public:
String get_source_folder() const;
String get_source_file() const;
virtual Node *post_import(Node *p_scene);
virtual void init(const String &p_scene_folder, const String &p_scene_path);
virtual void init(const String &p_source_folder, const String &p_source_file);
EditorScenePostImport();
};

View file

@ -205,11 +205,11 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options,
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/bptc_ldr", PROPERTY_HINT_ENUM, "Enabled,RGBA Only"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/normal_map", PROPERTY_HINT_ENUM, "Detect,Enable,Disabled"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "flags/repeat", PROPERTY_HINT_ENUM, "Disabled,Enabled,Mirrored"), p_preset == PRESET_3D ? 1 : 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/filter"), p_preset == PRESET_2D_PIXEL ? false : true));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/mipmaps"), p_preset == PRESET_3D ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/filter"), p_preset != PRESET_2D_PIXEL));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/mipmaps"), p_preset == PRESET_3D));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "flags/anisotropic"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "flags/srgb", PROPERTY_HINT_ENUM, "Disable,Enable,Detect"), 2));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/fix_alpha_border"), p_preset != PRESET_3D ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/fix_alpha_border"), p_preset != PRESET_3D));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/premult_alpha"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/HDR_as_SRGB"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "process/invert_color"), false));

View file

@ -205,7 +205,7 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file
for (const Map<String, Map<StringName, Variant> >::Element *E = p_source_file_options.front(); E; E = E->next(), idx++) {
PackData &pack_data = pack_data_files.write[idx];
String source = E->key();
const String &source = E->key();
const Map<StringName, Variant> &options = E->get();
Ref<Image> image;

View file

@ -210,12 +210,6 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
print_line("bits: "+itos(format_bits));
*/
int len = frames;
if (format_channels == 2)
len *= 2;
if (format_bits > 8)
len *= 2;
data.resize(frames * format_channels);
if (format_bits == 8) {

View file

@ -50,7 +50,7 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
name = "script";
}
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("MultiNode Set") + " " + String(name), UndoRedo::MERGE_ENDS);
for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) {

View file

@ -119,13 +119,13 @@ NodeDock::NodeDock() {
groups_button->connect("pressed", this, "show_groups");
connections = memnew(ConnectionsDock(EditorNode::get_singleton()));
connections->set_undoredo(EditorNode::get_singleton()->get_undo_redo());
connections->set_undoredo(EditorNode::get_undo_redo());
add_child(connections);
connections->set_v_size_flags(SIZE_EXPAND_FILL);
connections->hide();
groups = memnew(GroupsEditor);
groups->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
groups->set_undo_redo(EditorNode::get_undo_redo());
add_child(groups);
groups->set_v_size_flags(SIZE_EXPAND_FILL);
groups->hide();

View file

@ -62,7 +62,7 @@ protected:
static void _bind_methods();
public:
void config(const String &p_plugin_dir_name);
void config(const String &p_config_path);
PluginConfigDialog();
~PluginConfigDialog();

View file

@ -807,7 +807,7 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wi
canvas_item_editor = NULL;
editor = p_editor;
undo_redo = editor->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
wip_active = false;
edited_point = PosVertex();

View file

@ -735,7 +735,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
error_panel->add_child(error_label);
error_label->set_text("hmmm");
undo_redo = EditorNode::get_singleton()->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
menu = memnew(PopupMenu);
add_child(menu);
@ -751,7 +751,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
undo_redo = EditorNode::get_singleton()->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
selected_point = -1;
dragging_selected = false;

View file

@ -1043,7 +1043,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
error_panel->add_child(error_label);
error_label->set_text("eh");
undo_redo = EditorNode::get_singleton()->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
set_custom_minimum_size(Size2(0, 300 * EDSCALE));
@ -1061,7 +1061,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
undo_redo = EditorNode::get_singleton()->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
selected_point = -1;
selected_triangle = -1;

View file

@ -598,7 +598,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
Skeleton *skeleton = Object::cast_to<Skeleton>(node);
if (skeleton && skeleton->find_bone(concat) != -1) {
//path in skeleton
String bone = concat;
const String &bone = concat;
int idx = skeleton->find_bone(bone);
List<String> bone_path;
while (idx != -1) {
@ -796,7 +796,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(prev_name));
ERR_FAIL_COND(!gn);
String new_name = p_text;
const String &new_name = p_text;
ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1);
@ -804,7 +804,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
return; //nothing to do
}
String base_name = new_name;
const String &base_name = new_name;
int base = 1;
String name = base_name;
while (blend_tree->has_node(name)) {
@ -964,5 +964,5 @@ AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
undo_redo = EditorNode::get_singleton()->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
}

View file

@ -1868,7 +1868,7 @@ AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin(EditorNode *p_node) {
editor = p_node;
anim_editor = memnew(AnimationPlayerEditor(editor, this));
anim_editor->set_undo_redo(editor->get_undo_redo());
anim_editor->set_undo_redo(EditorNode::get_undo_redo());
editor->add_bottom_panel_item(TTR("Animation"), anim_editor);
}

View file

@ -1094,7 +1094,7 @@ void AnimationNodeStateMachineEditor::_removed_from_graph() {
void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
String new_name = p_text;
const String &new_name = p_text;
ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1);
@ -1102,7 +1102,7 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
return; // Nothing to do.
}
String base_name = new_name;
const String &base_name = new_name;
int base = 1;
String name = base_name;
while (state_machine->has_node(name)) {
@ -1365,7 +1365,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
error_panel->add_child(error_label);
error_panel->hide();
undo_redo = EditorNode::get_singleton()->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
set_custom_minimum_size(Size2(0, 300 * EDSCALE));
@ -1390,7 +1390,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
open_file->connect("file_selected", this, "_file_opened");
undo_redo = EditorNode::get_singleton()->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
over_text = false;

View file

@ -511,9 +511,7 @@ void AnimationTreePlayerEditor::_draw_node(const StringName &p_node) {
font->draw_halign(ci, ofs + ascofs, HALIGN_CENTER, w, p_node, font_color);
ofs.y += h;
int count = 2; // title and name
int inputs = anim_tree->node_get_input_count(p_node);
count += inputs ? inputs : 1;
float icon_h_ofs = Math::floor((font->get_height() - slot_icon->get_height()) / 2.0) + 1;
@ -618,7 +616,7 @@ AnimationTreePlayerEditor::ClickType AnimationTreePlayerEditor::_locate_click(co
for (const List<StringName>::Element *E = order.back(); E; E = E->prev()) {
StringName node = E->get();
const StringName &node = E->get();
AnimationTreePlayer::NodeType type = anim_tree->node_get_type(node);

View file

@ -71,8 +71,7 @@ class SnapDialog : public ConfirmationDialog {
SpinBox *rotation_step;
public:
SnapDialog() :
ConfirmationDialog() {
SnapDialog() {
const int SPIN_BOX_GRID_RANGE = 256;
const int SPIN_BOX_ROTATION_RANGE = 360;
Label *label;
@ -490,8 +489,6 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no
r_items.push_back(res);
}
}
return;
}
void CanvasItemEditor::_get_canvas_items_at_pos(const Point2 &p_pos, Vector<_SelectResult> &r_items) {
@ -1999,11 +1996,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
return true;
}
if (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)) {
// Accept the key event in any case
return true;
}
return false;
return (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)); // Accept the key event in any case
}
bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
@ -4340,7 +4333,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
continue;
if (!n2d->get_parent_item())
continue;
if (n2d->has_meta("_edit_bone_") && (bool)n2d->get_meta("_edit_bone_") == true)
if (n2d->has_meta("_edit_bone_") && n2d->get_meta("_edit_bone_"))
continue;
undo_redo->add_do_method(n2d, "set_meta", "_edit_bone_", true);
@ -4390,7 +4383,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
continue;
if (canvas_item->get_viewport() != EditorNode::get_singleton()->get_scene_root())
continue;
if (canvas_item->has_meta("_edit_ik_") && (bool)canvas_item->get_meta("_edit_ik_") == true)
if (canvas_item->has_meta("_edit_ik_") && canvas_item->get_meta("_edit_ik_"))
continue;
undo_redo->add_do_method(canvas_item, "set_meta", "_edit_ik_", true);

View file

@ -425,7 +425,7 @@ private:
List<CanvasItem *> _get_edited_canvas_items(bool retreive_locked = false, bool remove_canvas_item_if_parent_in_selection = true);
Rect2 _get_encompassing_rect_from_list(List<CanvasItem *> p_list);
void _expand_encompassing_rect_using_children(Rect2 &p_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D(), bool include_locked_nodes = true);
void _expand_encompassing_rect_using_children(Rect2 &r_rect, const Node *p_node, bool &r_first, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D(), bool include_locked_nodes = true);
Rect2 _get_encompassing_rect(const Node *p_node);
Object *_get_editor_data(Object *p_what);

View file

@ -527,7 +527,7 @@ Polygon3DEditor::Polygon3DEditor(EditorNode *p_editor) {
node = NULL;
editor = p_editor;
undo_redo = editor->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
add_child(memnew(VSeparator));
button_create = memnew(ToolButton);

View file

@ -179,7 +179,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
}
// Check for segment split.
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && mode == MODE_EDIT && on_edge == true) {
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && mode == MODE_EDIT && on_edge) {
Vector2 gpoint2 = mb->get_position();
Ref<Curve2D> curve = node->get_curve();

View file

@ -293,10 +293,7 @@ bool ResourcePreloaderEditor::can_drop_data_fw(const Point2 &p_point, const Vari
Vector<String> files = d["files"];
if (files.size() == 0)
return false;
return true;
return files.size() != 0;
}
return false;
}

View file

@ -131,7 +131,7 @@ void EditorPropertyRootMotion::_node_assign() {
Skeleton *skeleton = Object::cast_to<Skeleton>(node);
if (skeleton && skeleton->find_bone(concat) != -1) {
//path in skeleton
String bone = concat;
const String &bone = concat;
int idx = skeleton->find_bone(bone);
List<String> bone_path;
while (idx != -1) {

View file

@ -69,7 +69,7 @@ protected:
PhysicalBone *create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos);
public:
void edit(Skeleton *p_mesh);
void edit(Skeleton *p_node);
SkeletonEditor();
~SkeletonEditor();

View file

@ -133,7 +133,7 @@ public:
virtual bool is_editable() const;
void set_hidden(bool p_hidden);
void set_plugin(EditorSpatialGizmoPlugin *p_gizmo);
void set_plugin(EditorSpatialGizmoPlugin *p_plugin);
EditorSpatialGizmo();
~EditorSpatialGizmo();

View file

@ -1848,7 +1848,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
manual_position = Vector2(0, 0);
canvas_item_editor_viewport = NULL;
editor = p_editor;
undo_redo = editor->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
tool = TOOL_NONE;
selection_active = false;

View file

@ -263,7 +263,7 @@ void TileSetEditor::_notification(int p_what) {
TileSetEditor::TileSetEditor(EditorNode *p_editor) {
editor = p_editor;
undo_redo = editor->get_undo_redo();
undo_redo = EditorNode::get_undo_redo();
current_tile = -1;
VBoxContainer *left_container = memnew(VBoxContainer);
@ -829,8 +829,8 @@ void TileSetEditor::_on_workspace_draw() {
case EDITMODE_BITMASK: {
Color c(1, 0, 0, 0.5);
Color ci(0.3, 0.6, 1, 0.5);
for (float x = 0; x < region.size.x / (spacing + size.x); x++) {
for (float y = 0; y < region.size.y / (spacing + size.y); y++) {
for (int x = 0; x < region.size.x / (spacing + size.x); x++) {
for (int y = 0; y < region.size.y / (spacing + size.y); y++) {
Vector2 coord(x, y);
Point2 anchor(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
anchor += WORKSPACE_MARGIN;
@ -2009,11 +2009,7 @@ bool TileSetEditor::_sort_tiles(Variant p_a, Variant p_b) {
return true;
} else if (pos_a.y == pos_b.y) {
if (pos_a.x < pos_b.x) {
return true;
} else {
return false;
}
return (pos_a.x < pos_b.x);
} else {
return false;
}

View file

@ -158,10 +158,7 @@ bool VisualShaderEditor::_is_available(int p_mode) {
p_mode = temp_mode;
}
if (p_mode != -1 && ((p_mode & current_mode) == 0)) {
return false;
}
return true;
return (p_mode == -1 || (p_mode & current_mode) != 0);
}
void VisualShaderEditor::_update_options_menu() {

View file

@ -176,12 +176,12 @@ class VisualShaderEditor : public VBoxContainer {
void _input_select_item(Ref<VisualShaderNodeInput> input, String name);
void _add_input_port(int p_node, int p_port, int p_type, const String &p_name);
void _add_input_port(int p_node, int p_port, int p_port_type, const String &p_name);
void _remove_input_port(int p_node, int p_port);
void _change_input_port_type(int p_type, int p_node, int p_port);
void _change_input_port_name(const String &p_text, Object *line_edit, int p_node, int p_port);
void _add_output_port(int p_node, int p_port, int p_type, const String &p_name);
void _add_output_port(int p_node, int p_port, int p_port_type, const String &p_name);
void _remove_output_port(int p_node, int p_port);
void _change_output_port_type(int p_type, int p_node, int p_port);
void _change_output_port_name(const String &p_text, Object *line_edit, int p_node, int p_port);
@ -204,7 +204,7 @@ class VisualShaderEditor : public VBoxContainer {
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
bool _is_available(int p_flags);
bool _is_available(int p_mode);
void _update_created_node(GraphNode *node);
protected:

View file

@ -166,7 +166,7 @@ void ProjectExportDialog::_update_presets() {
void ProjectExportDialog::_update_export_all() {
bool can_export = EditorExport::get_singleton()->get_export_preset_count() > 0 ? true : false;
bool can_export = EditorExport::get_singleton()->get_export_preset_count() > 0;
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_preset(i);
@ -986,7 +986,7 @@ void ProjectExportDialog::_export_all_dialog_action(const String &p_str) {
export_all_dialog->hide();
_export_all(p_str == "release" ? false : true);
_export_all(p_str != "release");
}
void ProjectExportDialog::_export_all(bool p_debug) {

View file

@ -808,7 +808,7 @@ void ProjectSettingsEditor::update_plugins() {
void ProjectSettingsEditor::_item_selected(const String &p_path) {
String selected_path = p_path;
const String &selected_path = p_path;
if (selected_path == String())
return;
category->set_text(globals_editor->get_current_section());

View file

@ -917,7 +917,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
}
for (Set<String>::Element *j = valid_inheritors.front(); j; j = j->next()) {
String t = j->get();
const String &t = j->get();
bool is_custom_resource = false;
Ref<Texture> icon;

View file

@ -475,17 +475,17 @@ String RenameDialog::_substitute(const String &subject, const Node *node, int co
if (root_node) {
result = result.replace("${ROOT}", root_node->get_name());
}
Node *parent_node = node->get_parent();
if (parent_node) {
if (node == root_node) {
// Can not substitute parent of root.
result = result.replace("${PARENT}", "");
} else {
result = result.replace("${PARENT}", parent_node->get_name());
if (node) {
Node *parent_node = node->get_parent();
if (parent_node) {
if (node == root_node) {
// Can not substitute parent of root.
result = result.replace("${PARENT}", "");
} else {
result = result.replace("${PARENT}", parent_node->get_name());
}
}
}
return result;
}

View file

@ -981,11 +981,7 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
return true;
}
if (String(d["type"]) == "nodes") {
return true;
}
return false;
return String(d["type"]) == "nodes";
}
void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {

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