diff options
282 files changed, 2505 insertions, 1659 deletions
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index e18d663d85..61c80aaba3 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -458,7 +458,7 @@ protected: public: Error open(const String &p_path); - Error list_dir_begin(bool p_skip_internal = false, bool p_skip_hidden = false); ///< This starts dir listing + Error list_dir_begin(bool p_skip_navigational = false, bool p_skip_hidden = false); ///< This starts dir listing String get_next(); bool current_is_dir() const; diff --git a/core/class_db.h b/core/class_db.h index f73e082c52..4287c5990f 100644 --- a/core/class_db.h +++ b/core/class_db.h @@ -45,7 +45,7 @@ struct ParamHint { String hint_text; Variant default_val; - ParamHint(const String &p_name = "", PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "", Variant p_default_val = Variant()) + ParamHint(const String &p_name = "", PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "", const Variant &p_default_val = Variant()) : name(p_name), hint(p_hint), hint_text(p_hint_text), diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp index 81adbbbaf7..126ec7575e 100644 --- a/core/io/file_access_buffered.cpp +++ b/core/io/file_access_buffered.cpp @@ -106,11 +106,11 @@ uint8_t FileAccessBuffered::get_8() const { return byte; }; -int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const { +int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_length) const { ERR_FAIL_COND_V(!file.open, -1); - if (p_elements > cache_size) { + if (p_length > cache_size) { int total_read = 0; @@ -122,12 +122,12 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const { //memcpy(p_dest, read.ptr() + (file.offset - cache.offset), size); memcpy(p_dest, cache.buffer.ptr() + (file.offset - cache.offset), size); p_dest += size; - p_elements -= size; + p_length -= size; file.offset += size; total_read += size; }; - int err = read_data_block(file.offset, p_elements, p_dest); + int err = read_data_block(file.offset, p_length, p_dest); if (err >= 0) { total_read += err; file.offset += err; @@ -136,7 +136,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const { return total_read; }; - int to_read = p_elements; + int to_read = p_length; int total_read = 0; while (to_read > 0) { @@ -161,7 +161,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_elements) const { to_read -= r; }; - return p_elements; + return p_length; }; bool FileAccessBuffered::is_open() const { diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h index c5bf120890..0ad2d0e929 100644 --- a/core/io/file_access_buffered.h +++ b/core/io/file_access_buffered.h @@ -81,7 +81,7 @@ public: virtual bool eof_reached() const; virtual uint8_t get_8() const; - virtual int get_buffer(uint8_t *p_dst, int p_length) const; ///< get an array of bytes + virtual int get_buffer(uint8_t *p_dest, int p_length) const; ///< get an array of bytes virtual bool is_open() const; diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h index 8b6abe7e81..ea858c547e 100644 --- a/core/io/file_access_memory.h +++ b/core/io/file_access_memory.h @@ -62,7 +62,7 @@ public: virtual Error get_error() const; ///< get last error - virtual void store_8(uint8_t p_dest); ///< store a byte + virtual void store_8(uint8_t p_byte); ///< store a byte virtual void store_buffer(const uint8_t *p_src, int p_length); ///< store an array of bytes virtual bool file_exists(const String &p_name); ///< return true if a file exists diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index a92014000d..d748d5c773 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -159,15 +159,15 @@ unzFile ZipArchive::get_file_handle(String p_file) const { return pkg; }; -bool ZipArchive::try_open_pack(const String &p_name) { +bool ZipArchive::try_open_pack(const String &p_path) { //printf("opening zip pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz")); - if (p_name.get_extension().nocasecmp_to("zip") != 0 && p_name.get_extension().nocasecmp_to("pcz") != 0) + if (p_path.get_extension().nocasecmp_to("zip") != 0 && p_path.get_extension().nocasecmp_to("pcz") != 0) return false; zlib_filefunc_def io; - FileAccess *f = FileAccess::open(p_name, FileAccess::READ); + FileAccess *f = FileAccess::open(p_path, FileAccess::READ); if (!f) return false; io.opaque = f; @@ -180,7 +180,7 @@ bool ZipArchive::try_open_pack(const String &p_name) { io.zclose_file = godot_close; io.zerror_file = godot_testerror; - unzFile zfile = unzOpen2(p_name.utf8().get_data(), &io); + unzFile zfile = unzOpen2(p_path.utf8().get_data(), &io); ERR_FAIL_COND_V(!zfile, false); unz_global_info64 gi; @@ -188,7 +188,7 @@ bool ZipArchive::try_open_pack(const String &p_name) { ERR_FAIL_COND_V(err != UNZ_OK, false); Package pkg; - pkg.filename = p_name; + pkg.filename = p_path; pkg.zfile = zfile; packages.push_back(pkg); int pkg_num = packages.size() - 1; @@ -209,7 +209,7 @@ bool ZipArchive::try_open_pack(const String &p_name) { files[fname] = f; uint8_t md5[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - PackedData::get_singleton()->add_path(p_name, fname, 1, 0, md5, this); + PackedData::get_singleton()->add_path(p_path, fname, 1, 0, md5, this); //printf("packed data add path %ls, %ls\n", p_name.c_str(), fname.c_str()); if ((i + 1) < gi.number_entry) { diff --git a/core/io/ip_address.h b/core/io/ip_address.h index ac58283605..da16622a9b 100644 --- a/core/io/ip_address.h +++ b/core/io/ip_address.h @@ -75,7 +75,7 @@ public: void set_ipv4(const uint8_t *p_ip); const uint8_t *get_ipv6() const; - void set_ipv6(const uint8_t *buf); + void set_ipv6(const uint8_t *p_buf); operator String() const; IP_Address(const String &p_string); diff --git a/core/io/json.cpp b/core/io/json.cpp index 10fd60abf7..d537061c5b 100644 --- a/core/io/json.cpp +++ b/core/io/json.cpp @@ -94,15 +94,15 @@ String JSON::print(const Variant &p_var) { return _print_var(p_var); } -Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_token, int &line, String &r_err_str) { +Error JSON::_get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str) { while (p_len > 0) { - switch (p_str[idx]) { + switch (p_str[index]) { case '\n': { line++; - idx++; + index++; break; }; case 0: { @@ -112,54 +112,54 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke case '{': { r_token.type = TK_CURLY_BRACKET_OPEN; - idx++; + index++; return OK; }; case '}': { r_token.type = TK_CURLY_BRACKET_CLOSE; - idx++; + index++; return OK; }; case '[': { r_token.type = TK_BRACKET_OPEN; - idx++; + index++; return OK; }; case ']': { r_token.type = TK_BRACKET_CLOSE; - idx++; + index++; return OK; }; case ':': { r_token.type = TK_COLON; - idx++; + index++; return OK; }; case ',': { r_token.type = TK_COMMA; - idx++; + index++; return OK; }; case '"': { - idx++; + index++; String str; while (true) { - if (p_str[idx] == 0) { + if (p_str[index] == 0) { r_err_str = "Unterminated String"; return ERR_PARSE_ERROR; - } else if (p_str[idx] == '"') { - idx++; + } else if (p_str[index] == '"') { + index++; break; - } else if (p_str[idx] == '\\') { + } else if (p_str[index] == '\\') { //escaped characters... - idx++; - CharType next = p_str[idx]; + index++; + CharType next = p_str[index]; if (next == 0) { r_err_str = "Unterminated String"; return ERR_PARSE_ERROR; @@ -177,7 +177,7 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke //hexnumbarh - oct is deprecated for (int j = 0; j < 4; j++) { - CharType c = p_str[idx + j + 1]; + CharType c = p_str[index + j + 1]; if (c == 0) { r_err_str = "Unterminated String"; return ERR_PARSE_ERROR; @@ -204,7 +204,7 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke res <<= 4; res |= v; } - idx += 4; //will add at the end anyway + index += 4; //will add at the end anyway } break; //case '\"': res='\"'; break; @@ -220,11 +220,11 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke str += res; } else { - if (p_str[idx] == '\n') + if (p_str[index] == '\n') line++; - str += p_str[idx]; + str += p_str[index]; } - idx++; + index++; } r_token.type = TK_STRING; @@ -234,28 +234,28 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_toke } break; default: { - if (p_str[idx] <= 32) { - idx++; + if (p_str[index] <= 32) { + index++; break; } - if (p_str[idx] == '-' || (p_str[idx] >= '0' && p_str[idx] <= '9')) { + if (p_str[index] == '-' || (p_str[index] >= '0' && p_str[index] <= '9')) { //a number const CharType *rptr; - double number = String::to_double(&p_str[idx], &rptr); - idx += (rptr - &p_str[idx]); + double number = String::to_double(&p_str[index], &rptr); + index += (rptr - &p_str[index]); r_token.type = TK_NUMBER; r_token.value = number; return OK; - } else if ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) { + } else if ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) { String id; - while ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) { + while ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) { - id += p_str[idx]; - idx++; + id += p_str[index]; + index++; } r_token.type = TK_IDENTIFIER; diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h index a39eb6bcfd..007b810b67 100644 --- a/core/io/packet_peer_udp.h +++ b/core/io/packet_peer_udp.h @@ -49,7 +49,7 @@ protected: public: void set_blocking_mode(bool p_enable); - virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536) = 0; + virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536) = 0; virtual void close() = 0; virtual Error wait() = 0; virtual bool is_listening() const = 0; diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp index 61da4f3350..7033dbe5fb 100644 --- a/core/io/resource_import.cpp +++ b/core/io/resource_import.cpp @@ -199,6 +199,52 @@ String ResourceFormatImporter::get_internal_resource_path(const String &p_path) return pat.path; } +void ResourceFormatImporter::get_internal_resource_path_list(const String &p_path, List<String> *r_paths) { + + Error err; + FileAccess *f = FileAccess::open(p_path + ".import", FileAccess::READ, &err); + + if (!f) + return; + + VariantParser::StreamFile stream; + stream.f = f; + + String assign; + Variant value; + VariantParser::Tag next_tag; + + int lines = 0; + String error_text; + while (true) { + + assign = Variant(); + next_tag.fields.clear(); + next_tag.name = String(); + + err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true); + if (err == ERR_FILE_EOF) { + memdelete(f); + return; + } else if (err != OK) { + ERR_PRINTS("ResourceFormatImporter::get_internal_resource_path_list - " + p_path + ".import:" + itos(lines) + " error: " + error_text); + memdelete(f); + return; + } + + if (assign != String()) { + if (assign.begins_with("path.")) { + r_paths->push_back(value); + } else if (assign == "path") { + r_paths->push_back(value); + } + } else if (next_tag.name != "remap") { + break; + } + } + memdelete(f); +} + String ResourceFormatImporter::get_resource_type(const String &p_path) const { PathAndType pat; diff --git a/core/io/resource_import.h b/core/io/resource_import.h index d3f98cbc07..67fd870178 100644 --- a/core/io/resource_import.h +++ b/core/io/resource_import.h @@ -59,6 +59,7 @@ public: virtual bool can_be_imported(const String &p_path) const; String get_internal_resource_path(const String &p_path) const; + void get_internal_resource_path_list(const String &p_path, List<String> *r_paths); void add_importer(const Ref<ResourceImporter> &p_importer) { importers.insert(p_importer); } void remove_importer(const Ref<ResourceImporter> &p_importer) { importers.erase(p_importer); } diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index faf0700edf..7042700d92 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -210,7 +210,7 @@ void StreamPeer::put_double(double p_val) { void StreamPeer::put_utf8_string(const String &p_string) { CharString cs = p_string.utf8(); - put_u32(p_string.length()); + put_u32(cs.length()); put_data((const uint8_t *)cs.get_data(), cs.length()); } void StreamPeer::put_var(const Variant &p_variant) { diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h index 4e7fa7cf3e..b4ff3246ad 100644 --- a/core/io/tcp_server.h +++ b/core/io/tcp_server.h @@ -45,7 +45,7 @@ protected: static void _bind_methods(); public: - virtual Error listen(uint16_t p_port, const IP_Address p_bind_address = IP_Address("*")) = 0; + virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*")) = 0; virtual bool is_connection_available() const = 0; virtual Ref<StreamPeerTCP> take_connection() = 0; diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp index 52e240ed47..956cfe5258 100644 --- a/core/math/math_2d.cpp +++ b/core/math/math_2d.cpp @@ -281,22 +281,22 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c } // slide returns the component of the vector along the given plane, specified by its normal vector. -Vector2 Vector2::slide(const Vector2 &p_n) const { +Vector2 Vector2::slide(const Vector2 &p_normal) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector2()); + ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector2()); #endif - return *this - p_n * this->dot(p_n); + return *this - p_normal * this->dot(p_normal); } -Vector2 Vector2::bounce(const Vector2 &p_n) const { - return -reflect(p_n); +Vector2 Vector2::bounce(const Vector2 &p_normal) const { + return -reflect(p_normal); } -Vector2 Vector2::reflect(const Vector2 &p_n) const { +Vector2 Vector2::reflect(const Vector2 &p_normal) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector2()); + ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector2()); #endif - return 2.0 * p_n * this->dot(p_n) - *this; + return 2.0 * p_normal * this->dot(p_normal) - *this; } bool Rect2::intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos, Point2 *r_normal) const { diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 601ab91b9f..6fea6c8adb 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -115,9 +115,9 @@ struct Vector2 { Vector2 cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const; Vector2 cubic_interpolate_soft(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const; - Vector2 slide(const Vector2 &p_vec) const; - Vector2 bounce(const Vector2 &p_vec) const; - Vector2 reflect(const Vector2 &p_vec) const; + Vector2 slide(const Vector2 &p_normal) const; + Vector2 bounce(const Vector2 &p_normal) const; + Vector2 reflect(const Vector2 &p_normal) const; Vector2 operator+(const Vector2 &p_v) const; void operator+=(const Vector2 &p_v); @@ -629,9 +629,9 @@ struct Transform2D { void affine_invert(); Transform2D affine_inverse() const; - void set_rotation(real_t p_phi); + void set_rotation(real_t p_rot); real_t get_rotation() const; - _FORCE_INLINE_ void set_rotation_and_scale(real_t p_phi, const Size2 &p_scale); + _FORCE_INLINE_ void set_rotation_and_scale(real_t p_rot, const Size2 &p_scale); void rotate(real_t p_phi); void scale(const Size2 &p_scale); @@ -668,8 +668,8 @@ struct Transform2D { _FORCE_INLINE_ Vector2 basis_xform_inv(const Vector2 &p_vec) const; _FORCE_INLINE_ Vector2 xform(const Vector2 &p_vec) const; _FORCE_INLINE_ Vector2 xform_inv(const Vector2 &p_vec) const; - _FORCE_INLINE_ Rect2 xform(const Rect2 &p_vec) const; - _FORCE_INLINE_ Rect2 xform_inv(const Rect2 &p_vec) const; + _FORCE_INLINE_ Rect2 xform(const Rect2 &p_rect) const; + _FORCE_INLINE_ Rect2 xform_inv(const Rect2 &p_rect) const; operator String() const; @@ -841,25 +841,25 @@ next4: return true; } -Vector2 Transform2D::basis_xform(const Vector2 &v) const { +Vector2 Transform2D::basis_xform(const Vector2 &p_vec) const { return Vector2( - tdotx(v), - tdoty(v)); + tdotx(p_vec), + tdoty(p_vec)); } -Vector2 Transform2D::basis_xform_inv(const Vector2 &v) const { +Vector2 Transform2D::basis_xform_inv(const Vector2 &p_vec) const { return Vector2( - elements[0].dot(v), - elements[1].dot(v)); + elements[0].dot(p_vec), + elements[1].dot(p_vec)); } -Vector2 Transform2D::xform(const Vector2 &v) const { +Vector2 Transform2D::xform(const Vector2 &p_vec) const { return Vector2( - tdotx(v), - tdoty(v)) + + tdotx(p_vec), + tdoty(p_vec)) + elements[2]; } Vector2 Transform2D::xform_inv(const Vector2 &p_vec) const { diff --git a/core/math/octree.h b/core/math/octree.h index 010c1b18f7..2e37056030 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -351,7 +351,7 @@ private: }; void _cull_convex(Octant *p_octant, _CullConvexData *p_cull); - void _cull_AABB(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask); + void _cull_aabb(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask); void _cull_segment(Octant *p_octant, const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask); void _cull_point(Octant *p_octant, const Vector3 &p_point, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask); @@ -380,7 +380,7 @@ public: int get_subindex(OctreeElementID p_id) const; int cull_convex(const Vector<Plane> &p_convex, T **p_result_array, int p_result_max, uint32_t p_mask = 0xFFFFFFFF); - int cull_AABB(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF); + int cull_aabb(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF); int cull_segment(const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF); int cull_point(const Vector3 &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF); @@ -1095,7 +1095,7 @@ void Octree<T, use_pairs, AL>::_cull_convex(Octant *p_octant, _CullConvexData *p } template <class T, bool use_pairs, class AL> -void Octree<T, use_pairs, AL>::_cull_AABB(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask) { +void Octree<T, use_pairs, AL>::_cull_aabb(Octant *p_octant, const Rect3 &p_aabb, T **p_result_array, int *p_result_idx, int p_result_max, int *p_subindex_array, uint32_t p_mask) { if (*p_result_idx == p_result_max) return; //pointless @@ -1160,7 +1160,7 @@ void Octree<T, use_pairs, AL>::_cull_AABB(Octant *p_octant, const Rect3 &p_aabb, for (int i = 0; i < 8; i++) { if (p_octant->children[i] && p_octant->children[i]->aabb.intersects_inclusive(p_aabb)) { - _cull_AABB(p_octant->children[i], p_aabb, p_result_array, p_result_idx, p_result_max, p_subindex_array, p_mask); + _cull_aabb(p_octant->children[i], p_aabb, p_result_array, p_result_idx, p_result_max, p_subindex_array, p_mask); } } } @@ -1336,14 +1336,14 @@ int Octree<T, use_pairs, AL>::cull_convex(const Vector<Plane> &p_convex, T **p_r } template <class T, bool use_pairs, class AL> -int Octree<T, use_pairs, AL>::cull_AABB(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array, uint32_t p_mask) { +int Octree<T, use_pairs, AL>::cull_aabb(const Rect3 &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array, uint32_t p_mask) { if (!root) return 0; int result_count = 0; pass++; - _cull_AABB(root, p_aabb, p_result_array, &result_count, p_result_max, p_subindex_array, p_mask); + _cull_aabb(root, p_aabb, p_result_array, &result_count, p_result_max, p_subindex_array, p_mask); return result_count; } diff --git a/core/math/plane.cpp b/core/math/plane.cpp index f5e92866c4..17928d07c3 100644 --- a/core/math/plane.cpp +++ b/core/math/plane.cpp @@ -103,7 +103,7 @@ bool Plane::intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r return true; } -bool Plane::intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersection) const { +bool Plane::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection) const { Vector3 segment = p_dir; real_t den = normal.dot(segment); @@ -128,7 +128,7 @@ bool Plane::intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersectio return true; } -bool Plane::intersects_segment(Vector3 p_begin, Vector3 p_end, Vector3 *p_intersection) const { +bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 *p_intersection) const { Vector3 segment = p_begin - p_end; real_t den = normal.dot(segment); diff --git a/core/math/plane.h b/core/math/plane.h index 92ebcd8024..73d584e553 100644 --- a/core/math/plane.h +++ b/core/math/plane.h @@ -56,8 +56,8 @@ public: /* intersections */ bool intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r_result = 0) const; - bool intersects_ray(Vector3 p_from, Vector3 p_dir, Vector3 *p_intersection) const; - bool intersects_segment(Vector3 p_begin, Vector3 p_end, Vector3 *p_intersection) const; + bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection) const; + bool intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 *p_intersection) const; _FORCE_INLINE_ Vector3 project(const Vector3 &p_point) const { diff --git a/core/math/rect3.h b/core/math/rect3.h index e5d7462009..7c971f5ac7 100644 --- a/core/math/rect3.h +++ b/core/math/rect3.h @@ -72,9 +72,9 @@ public: Rect3 intersection(const Rect3 &p_aabb) const; ///get box where two intersect, empty if no intersection occurs bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const; bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const; - _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &from, const Vector3 &p_dir, real_t t0, real_t t1) const; + _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const; - _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_plane, int p_plane_count) const; + _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count) const; bool intersects_plane(const Plane &p_plane) const; _FORCE_INLINE_ bool has_point(const Vector3 &p_point) const; @@ -326,27 +326,27 @@ inline real_t Rect3::get_shortest_axis_size() const { return max_size; } -bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t t0, real_t t1) const { +bool Rect3::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const { - real_t divx = 1.0 / dir.x; - real_t divy = 1.0 / dir.y; - real_t divz = 1.0 / dir.z; + real_t divx = 1.0 / p_dir.x; + real_t divy = 1.0 / p_dir.y; + real_t divz = 1.0 / p_dir.z; Vector3 upbound = position + size; real_t tmin, tmax, tymin, tymax, tzmin, tzmax; - if (dir.x >= 0) { - tmin = (position.x - from.x) * divx; - tmax = (upbound.x - from.x) * divx; + if (p_dir.x >= 0) { + tmin = (position.x - p_from.x) * divx; + tmax = (upbound.x - p_from.x) * divx; } else { - tmin = (upbound.x - from.x) * divx; - tmax = (position.x - from.x) * divx; + tmin = (upbound.x - p_from.x) * divx; + tmax = (position.x - p_from.x) * divx; } - if (dir.y >= 0) { - tymin = (position.y - from.y) * divy; - tymax = (upbound.y - from.y) * divy; + if (p_dir.y >= 0) { + tymin = (position.y - p_from.y) * divy; + tymax = (upbound.y - p_from.y) * divy; } else { - tymin = (upbound.y - from.y) * divy; - tymax = (position.y - from.y) * divy; + tymin = (upbound.y - p_from.y) * divy; + tymax = (position.y - p_from.y) * divy; } if ((tmin > tymax) || (tymin > tmax)) return false; @@ -354,12 +354,12 @@ bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t tmin = tymin; if (tymax < tmax) tmax = tymax; - if (dir.z >= 0) { - tzmin = (position.z - from.z) * divz; - tzmax = (upbound.z - from.z) * divz; + if (p_dir.z >= 0) { + tzmin = (position.z - p_from.z) * divz; + tzmax = (upbound.z - p_from.z) * divz; } else { - tzmin = (upbound.z - from.z) * divz; - tzmax = (position.z - from.z) * divz; + tzmin = (upbound.z - p_from.z) * divz; + tzmax = (position.z - p_from.z) * divz; } if ((tmin > tzmax) || (tzmin > tmax)) return false; diff --git a/core/math/vector3.h b/core/math/vector3.h index 6a7974681e..c58a86fbdb 100644 --- a/core/math/vector3.h +++ b/core/math/vector3.h @@ -108,9 +108,9 @@ struct Vector3 { _FORCE_INLINE_ real_t angle_to(const Vector3 &p_b) const; - _FORCE_INLINE_ Vector3 slide(const Vector3 &p_vec) const; - _FORCE_INLINE_ Vector3 bounce(const Vector3 &p_vec) const; - _FORCE_INLINE_ Vector3 reflect(const Vector3 &p_vec) const; + _FORCE_INLINE_ Vector3 slide(const Vector3 &p_normal) const; + _FORCE_INLINE_ Vector3 bounce(const Vector3 &p_normal) const; + _FORCE_INLINE_ Vector3 reflect(const Vector3 &p_normal) const; /* Operators */ @@ -410,22 +410,22 @@ void Vector3::zero() { } // slide returns the component of the vector along the given plane, specified by its normal vector. -Vector3 Vector3::slide(const Vector3 &p_n) const { +Vector3 Vector3::slide(const Vector3 &p_normal) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector3()); + ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector3()); #endif - return *this - p_n * this->dot(p_n); + return *this - p_normal * this->dot(p_normal); } -Vector3 Vector3::bounce(const Vector3 &p_n) const { - return -reflect(p_n); +Vector3 Vector3::bounce(const Vector3 &p_normal) const { + return -reflect(p_normal); } -Vector3 Vector3::reflect(const Vector3 &p_n) const { +Vector3 Vector3::reflect(const Vector3 &p_normal) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector3()); + ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector3()); #endif - return 2.0 * p_n * this->dot(p_n) - *this; + return 2.0 * p_normal * this->dot(p_normal) - *this; } #endif diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h index ead58c23c8..d8755fd98b 100644 --- a/core/method_ptrcall.h +++ b/core/method_ptrcall.h @@ -80,6 +80,26 @@ struct PtrToArg { } \ } +#define MAKE_PTRARG_BY_REFERENCE(m_type) \ + template <> \ + struct PtrToArg<m_type> { \ + _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ + return *reinterpret_cast<const m_type *>(p_ptr); \ + } \ + _FORCE_INLINE_ static void encode(const m_type &p_val, void *p_ptr) { \ + *((m_type *)p_ptr) = p_val; \ + } \ + }; \ + template <> \ + struct PtrToArg<const m_type &> { \ + _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ + return *reinterpret_cast<const m_type *>(p_ptr); \ + } \ + _FORCE_INLINE_ static void encode(const m_type &p_val, void *p_ptr) { \ + *((m_type *)p_ptr) = p_val; \ + } \ + } + MAKE_PTRARG(bool); MAKE_PTRARGCONV(uint8_t, int64_t); MAKE_PTRARGCONV(int8_t, int64_t); @@ -95,14 +115,14 @@ MAKE_PTRARG(double); MAKE_PTRARG(String); MAKE_PTRARG(Vector2); MAKE_PTRARG(Rect2); -MAKE_PTRARG(Vector3); +MAKE_PTRARG_BY_REFERENCE(Vector3); MAKE_PTRARG(Transform2D); -MAKE_PTRARG(Plane); +MAKE_PTRARG_BY_REFERENCE(Plane); MAKE_PTRARG(Quat); -MAKE_PTRARG(Rect3); -MAKE_PTRARG(Basis); -MAKE_PTRARG(Transform); -MAKE_PTRARG(Color); +MAKE_PTRARG_BY_REFERENCE(Rect3); +MAKE_PTRARG_BY_REFERENCE(Basis); +MAKE_PTRARG_BY_REFERENCE(Transform); +MAKE_PTRARG_BY_REFERENCE(Color); MAKE_PTRARG(NodePath); MAKE_PTRARG(RID); MAKE_PTRARG(Dictionary); @@ -114,7 +134,7 @@ MAKE_PTRARG(PoolStringArray); MAKE_PTRARG(PoolVector2Array); MAKE_PTRARG(PoolVector3Array); MAKE_PTRARG(PoolColorArray); -MAKE_PTRARG(Variant); +MAKE_PTRARG_BY_REFERENCE(Variant); //this is for Object @@ -311,8 +331,29 @@ MAKE_DVECARR(Plane); } \ } +#define MAKE_STRINGCONV_BY_REFERENCE(m_type) \ + template <> \ + struct PtrToArg<m_type> { \ + _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ + m_type s = *reinterpret_cast<const String *>(p_ptr); \ + return s; \ + } \ + _FORCE_INLINE_ static void encode(const m_type &p_vec, void *p_ptr) { \ + String *arr = reinterpret_cast<String *>(p_ptr); \ + *arr = p_vec; \ + } \ + }; \ + \ + template <> \ + struct PtrToArg<const m_type &> { \ + _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ + m_type s = *reinterpret_cast<const String *>(p_ptr); \ + return s; \ + } \ + } + MAKE_STRINGCONV(StringName); -MAKE_STRINGCONV(IP_Address); +MAKE_STRINGCONV_BY_REFERENCE(IP_Address); template <> struct PtrToArg<PoolVector<Face3> > { diff --git a/core/object.h b/core/object.h index 551c3c31b9..4648d9d90e 100644 --- a/core/object.h +++ b/core/object.h @@ -443,7 +443,7 @@ private: mutable StringName _class_name; mutable const StringName *_class_ptr; - void _add_user_signal(const String &p_name, const Array &p_pargs = Array()); + void _add_user_signal(const String &p_name, const Array &p_args = Array()); bool _has_user_signal(const StringName &p_name) const; Variant _emit_signal(const Variant **p_args, int p_argcount, Variant::CallError &r_error); Array _get_signal_list() const; diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 3bd5ac3f41..9d1fefc925 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -475,9 +475,9 @@ void FileAccess::store_buffer(const uint8_t *p_src, int p_length) { store_8(p_src[i]); } -Vector<uint8_t> FileAccess::get_file_as_array(const String &p_file) { +Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path) { - FileAccess *f = FileAccess::open(p_file, READ); + FileAccess *f = FileAccess::open(p_path, READ); ERR_FAIL_COND_V(!f, Vector<uint8_t>()); Vector<uint8_t> data; data.resize(f->get_len()); diff --git a/core/os/file_access.h b/core/os/file_access.h index 6d3e491167..beed7551fb 100644 --- a/core/os/file_access.h +++ b/core/os/file_access.h @@ -129,7 +129,7 @@ public: virtual void store_real(real_t p_real); virtual void store_string(const String &p_string); - virtual void store_line(const String &p_string); + virtual void store_line(const String &p_line); virtual void store_pascal_string(const String &p_string); virtual String get_pascal_string(); diff --git a/core/os/keyboard.h b/core/os/keyboard.h index 1ed93e3540..1ef26de183 100644 --- a/core/os/keyboard.h +++ b/core/os/keyboard.h @@ -324,7 +324,7 @@ enum KeyModifierMask { }; String keycode_get_string(uint32_t p_code); -bool keycode_has_unicode(uint32_t p_unicode); +bool keycode_has_unicode(uint32_t p_keycode); int find_keycode(const String &p_code); int keycode_get_count(); int keycode_get_value_by_index(int p_index); diff --git a/core/pair.h b/core/pair.h index d4b1897537..d517339ddf 100644 --- a/core/pair.h +++ b/core/pair.h @@ -37,7 +37,7 @@ struct Pair { S second; Pair() {} - Pair(F p_first, S p_second) + Pair(F p_first, const S &p_second) : first(p_first), second(p_second) { } diff --git a/core/project_settings.h b/core/project_settings.h index c64bb393d1..cee3b3b5f3 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -158,7 +158,7 @@ public: bool is_using_datapack() const; - void set_registering_order(bool p_registering); + void set_registering_order(bool p_enable); ProjectSettings(); ~ProjectSettings(); diff --git a/core/resource.h b/core/resource.h index 5a4e45da36..bbf233d53e 100644 --- a/core/resource.h +++ b/core/resource.h @@ -107,7 +107,7 @@ public: int get_subindex() const; virtual Ref<Resource> duplicate(bool p_subresources = false) const; - Ref<Resource> duplicate_for_local_scene(Node *p_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache); + Ref<Resource> duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache); void set_local_to_scene(bool p_enable); bool is_local_to_scene() const; diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 3628f2ecaf..44e86bca6a 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -429,9 +429,9 @@ void ScriptDebuggerRemote::_err_handler(void *ud, const char *p_func, const char sdr->mutex->unlock(); } -bool ScriptDebuggerRemote::_parse_live_edit(const Array &cmd) { +bool ScriptDebuggerRemote::_parse_live_edit(const Array &p_command) { - String cmdstr = cmd[0]; + String cmdstr = p_command[0]; if (!live_edit_funcs || !cmdstr.begins_with("live_")) return false; @@ -441,7 +441,7 @@ bool ScriptDebuggerRemote::_parse_live_edit(const Array &cmd) { if (!live_edit_funcs->root_func) return true; //print_line("root: "+Variant(cmd).get_construct_string()); - live_edit_funcs->root_func(live_edit_funcs->udata, cmd[1], cmd[2]); + live_edit_funcs->root_func(live_edit_funcs->udata, p_command[1], p_command[2]); } else if (cmdstr == "live_node_path") { @@ -449,75 +449,75 @@ bool ScriptDebuggerRemote::_parse_live_edit(const Array &cmd) { return true; //print_line("path: "+Variant(cmd).get_construct_string()); - live_edit_funcs->node_path_func(live_edit_funcs->udata, cmd[1], cmd[2]); + live_edit_funcs->node_path_func(live_edit_funcs->udata, p_command[1], p_command[2]); } else if (cmdstr == "live_res_path") { if (!live_edit_funcs->res_path_func) return true; - live_edit_funcs->res_path_func(live_edit_funcs->udata, cmd[1], cmd[2]); + live_edit_funcs->res_path_func(live_edit_funcs->udata, p_command[1], p_command[2]); } else if (cmdstr == "live_node_prop_res") { if (!live_edit_funcs->node_set_res_func) return true; - live_edit_funcs->node_set_res_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]); + live_edit_funcs->node_set_res_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]); } else if (cmdstr == "live_node_prop") { if (!live_edit_funcs->node_set_func) return true; - live_edit_funcs->node_set_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]); + live_edit_funcs->node_set_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]); } else if (cmdstr == "live_res_prop_res") { if (!live_edit_funcs->res_set_res_func) return true; - live_edit_funcs->res_set_res_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]); + live_edit_funcs->res_set_res_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]); } else if (cmdstr == "live_res_prop") { if (!live_edit_funcs->res_set_func) return true; - live_edit_funcs->res_set_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]); + live_edit_funcs->res_set_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]); } else if (cmdstr == "live_node_call") { if (!live_edit_funcs->node_call_func) return true; - live_edit_funcs->node_call_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]); + live_edit_funcs->node_call_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3], p_command[4], p_command[5], p_command[6], p_command[7]); } else if (cmdstr == "live_res_call") { if (!live_edit_funcs->res_call_func) return true; - live_edit_funcs->res_call_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]); + live_edit_funcs->res_call_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3], p_command[4], p_command[5], p_command[6], p_command[7]); } else if (cmdstr == "live_create_node") { - live_edit_funcs->tree_create_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]); + live_edit_funcs->tree_create_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]); } else if (cmdstr == "live_instance_node") { - live_edit_funcs->tree_instance_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]); + live_edit_funcs->tree_instance_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]); } else if (cmdstr == "live_remove_node") { - live_edit_funcs->tree_remove_node_func(live_edit_funcs->udata, cmd[1]); + live_edit_funcs->tree_remove_node_func(live_edit_funcs->udata, p_command[1]); } else if (cmdstr == "live_remove_and_keep_node") { - live_edit_funcs->tree_remove_and_keep_node_func(live_edit_funcs->udata, cmd[1], cmd[2]); + live_edit_funcs->tree_remove_and_keep_node_func(live_edit_funcs->udata, p_command[1], p_command[2]); } else if (cmdstr == "live_restore_node") { - live_edit_funcs->tree_restore_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3]); + live_edit_funcs->tree_restore_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3]); } else if (cmdstr == "live_duplicate_node") { - live_edit_funcs->tree_duplicate_node_func(live_edit_funcs->udata, cmd[1], cmd[2]); + live_edit_funcs->tree_duplicate_node_func(live_edit_funcs->udata, p_command[1], p_command[2]); } else if (cmdstr == "live_reparent_node") { - live_edit_funcs->tree_reparent_node_func(live_edit_funcs->udata, cmd[1], cmd[2], cmd[3], cmd[4]); + live_edit_funcs->tree_reparent_node_func(live_edit_funcs->udata, p_command[1], p_command[2], p_command[3], p_command[4]); } else { diff --git a/core/ustring.cpp b/core/ustring.cpp index ab4528e495..0521966943 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -279,16 +279,16 @@ void String::operator=(const CharType *p_str) { copy_from(p_str); } -bool String::operator==(const StrRange &p_range) const { +bool String::operator==(const StrRange &p_str_range) const { - int len = p_range.len; + int len = p_str_range.len; if (length() != len) return false; if (empty()) return true; - const CharType *c_str = p_range.c_str; + const CharType *c_str = p_str_range.c_str; const CharType *dst = &operator[](0); /* Compare char by char */ diff --git a/core/ustring.h b/core/ustring.h index d00bfa59b5..1c61e12e85 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -78,7 +78,7 @@ public: //String operator+(CharType p_char) const; String &operator+=(const String &); - String &operator+=(CharType p_str); + String &operator+=(CharType p_char); String &operator+=(const char *p_str); String &operator+=(const CharType *p_str); @@ -156,7 +156,7 @@ public: int get_slice_count(String p_splitter) const; String get_slice(String p_splitter, int p_slice) const; - String get_slicec(CharType splitter, int p_slice) const; + String get_slicec(CharType p_splitter, int p_slice) const; Vector<String> split(const String &p_splitter, bool p_allow_empty = true) const; Vector<String> split_spaces() const; @@ -186,8 +186,8 @@ public: bool parse_utf8(const char *p_utf8, int p_len = -1); //return true on error static String utf8(const char *p_utf8, int p_len = -1); - static uint32_t hash(const CharType *p_str, int p_len); /* hash the string */ - static uint32_t hash(const CharType *p_str); /* hash the string */ + static uint32_t hash(const CharType *p_cstr, int p_len); /* hash the string */ + static uint32_t hash(const CharType *p_cstr); /* hash the string */ static uint32_t hash(const char *p_cstr, int p_len); /* hash the string */ static uint32_t hash(const char *p_cstr); /* hash the string */ uint32_t hash() const; /* hash the string */ diff --git a/core/variant_construct_string.cpp b/core/variant_construct_string.cpp index 45fe367ce6..fa8a393d08 100644 --- a/core/variant_construct_string.cpp +++ b/core/variant_construct_string.cpp @@ -66,7 +66,7 @@ class VariantConstruct { static Error _get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str); static Error _parse_value(Variant &value, Token &token, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud); static Error _parse_array(Array &array, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud); - static Error _parse_dict(Dictionary &object, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud); + static Error _parse_dict(Dictionary &dict, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str, Variant::ObjectConstruct *p_construct, void *p_ud); public: static Error parse(const String &p_string, Variant &r_ret, String &r_err_str, int &r_err_line, Variant::ObjectConstruct *p_construct, void *p_ud); @@ -85,15 +85,15 @@ const char *VariantConstruct::tk_name[TK_MAX] = { "EOF", }; -Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, Token &r_token, int &line, String &r_err_str) { +Error VariantConstruct::_get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str) { while (true) { - switch (p_str[idx]) { + switch (p_str[index]) { case '\n': { line++; - idx++; + index++; break; }; case 0: { @@ -103,54 +103,54 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T case '{': { r_token.type = TK_CURLY_BRACKET_OPEN; - idx++; + index++; return OK; }; case '}': { r_token.type = TK_CURLY_BRACKET_CLOSE; - idx++; + index++; return OK; }; case '[': { r_token.type = TK_BRACKET_OPEN; - idx++; + index++; return OK; }; case ']': { r_token.type = TK_BRACKET_CLOSE; - idx++; + index++; return OK; }; case ':': { r_token.type = TK_COLON; - idx++; + index++; return OK; }; case ',': { r_token.type = TK_COMMA; - idx++; + index++; return OK; }; case '"': { - idx++; + index++; String str; while (true) { - if (p_str[idx] == 0) { + if (p_str[index] == 0) { r_err_str = "Unterminated String"; return ERR_PARSE_ERROR; - } else if (p_str[idx] == '"') { - idx++; + } else if (p_str[index] == '"') { + index++; break; - } else if (p_str[idx] == '\\') { + } else if (p_str[index] == '\\') { //escaped characters... - idx++; - CharType next = p_str[idx]; + index++; + CharType next = p_str[index]; if (next == 0) { r_err_str = "Unterminated String"; return ERR_PARSE_ERROR; @@ -171,7 +171,7 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T //hexnumbarh - oct is deprecated for (int j = 0; j < 4; j++) { - CharType c = p_str[idx + j + 1]; + CharType c = p_str[index + j + 1]; if (c == 0) { r_err_str = "Unterminated String"; return ERR_PARSE_ERROR; @@ -198,7 +198,7 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T res <<= 4; res |= v; } - idx += 4; //will add at the end anyway + index += 4; //will add at the end anyway } break; default: { @@ -211,11 +211,11 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T str += res; } else { - if (p_str[idx] == '\n') + if (p_str[index] == '\n') line++; - str += p_str[idx]; + str += p_str[index]; } - idx++; + index++; } r_token.type = TK_STRING; @@ -225,28 +225,28 @@ Error VariantConstruct::_get_token(const CharType *p_str, int &idx, int p_len, T } break; default: { - if (p_str[idx] <= 32) { - idx++; + if (p_str[index] <= 32) { + index++; break; } - if (p_str[idx] == '-' || (p_str[idx] >= '0' && p_str[idx] <= '9')) { + if (p_str[index] == '-' || (p_str[index] >= '0' && p_str[index] <= '9')) { //a number const CharType *rptr; - double number = String::to_double(&p_str[idx], &rptr); - idx += (rptr - &p_str[idx]); + double number = String::to_double(&p_str[index], &rptr); + index += (rptr - &p_str[index]); r_token.type = TK_NUMBER; r_token.value = number; return OK; - } else if ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) { + } else if ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) { String id; - while ((p_str[idx] >= 'A' && p_str[idx] <= 'Z') || (p_str[idx] >= 'a' && p_str[idx] <= 'z')) { + while ((p_str[index] >= 'A' && p_str[index] <= 'Z') || (p_str[index] >= 'a' && p_str[index] <= 'z')) { - id += p_str[idx]; - idx++; + id += p_str[index]; + index++; } r_token.type = TK_IDENTIFIER; diff --git a/core/vector.h b/core/vector.h index 5eed8dce96..9f523c567c 100644 --- a/core/vector.h +++ b/core/vector.h @@ -117,7 +117,7 @@ public: } _FORCE_INLINE_ bool empty() const { return _ptr == 0; } Error resize(int p_size); - bool push_back(T p_elem); + bool push_back(const T &p_elem); void remove(int p_index); void erase(const T &p_val) { @@ -129,7 +129,7 @@ public: template <class T_val> int find(const T_val &p_val, int p_from = 0) const; - void set(int p_index, T p_elem); + void set(int p_index, const T &p_elem); T get(int p_index) const; inline T &operator[](int p_index) { @@ -336,7 +336,7 @@ void Vector<T>::invert() { } template <class T> -void Vector<T>::set(int p_index, T p_elem) { +void Vector<T>::set(int p_index, const T &p_elem) { operator[](p_index) = p_elem; } @@ -348,7 +348,7 @@ T Vector<T>::get(int p_index) const { } template <class T> -bool Vector<T>::push_back(T p_elem) { +bool Vector<T>::push_back(const T &p_elem) { Error err = resize(size() + 1); ERR_FAIL_COND_V(err, true) diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 2abdbe9d0a..7ad08ed7d5 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -1600,9 +1600,9 @@ RID RasterizerGLES2::material_create() { return material; } -void RasterizerGLES2::material_set_shader(RID p_material, RID p_shader) { +void RasterizerGLES2::material_set_shader(RID p_shader_material, RID p_shader) { - Material *material = material_owner.get(p_material); + Material *material = material_owner.get(p_shader_material); ERR_FAIL_COND(!material); if (material->shader == p_shader) return; @@ -1610,9 +1610,9 @@ void RasterizerGLES2::material_set_shader(RID p_material, RID p_shader) { material->shader_version = 0; } -RID RasterizerGLES2::material_get_shader(RID p_material) const { +RID RasterizerGLES2::material_get_shader(RID p_shader_material) const { - Material *material = material_owner.get(p_material); + Material *material = material_owner.get(p_shader_material); ERR_FAIL_COND_V(!material, RID()); return material->shader; } @@ -7891,7 +7891,7 @@ void RasterizerGLES2::canvas_draw_rect(const Rect2 &p_rect, int p_flags, const R _rinfo.ci_draw_commands++; } -void RasterizerGLES2::canvas_draw_style_box(const Rect2 &p_rect, const Rect2 &p_src_region, RID p_texture, const float *p_margin, bool p_draw_center, const Color &p_modulate) { +void RasterizerGLES2::canvas_draw_style_box(const Rect2 &p_rect, const Rect2 &p_src_region, RID p_texture, const float *p_margins, bool p_draw_center, const Color &p_modulate) { Color m = p_modulate; m.a *= canvas_opacity; @@ -7907,47 +7907,47 @@ void RasterizerGLES2::canvas_draw_style_box(const Rect2 &p_rect, const Rect2 &p_ region.size.height = texture->height; /* CORNERS */ _draw_textured_quad( // top left - Rect2(p_rect.pos, Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP])), - Rect2(region.pos, Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP])), + Rect2(p_rect.pos, Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_TOP])), + Rect2(region.pos, Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_TOP])), Size2(texture->width, texture->height)); _draw_textured_quad( // top right - Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margin[MARGIN_RIGHT], p_rect.pos.y), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_TOP])), - Rect2(Point2(region.pos.x + region.size.width - p_margin[MARGIN_RIGHT], region.pos.y), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_TOP])), + Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margins[MARGIN_RIGHT], p_rect.pos.y), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_TOP])), + Rect2(Point2(region.pos.x + region.size.width - p_margins[MARGIN_RIGHT], region.pos.y), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_TOP])), Size2(texture->width, texture->height)); _draw_textured_quad( // bottom left - Rect2(Point2(p_rect.pos.x, p_rect.pos.y + p_rect.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_BOTTOM])), - Rect2(Point2(region.pos.x, region.pos.y + region.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_BOTTOM])), + Rect2(Point2(p_rect.pos.x, p_rect.pos.y + p_rect.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_BOTTOM])), + Rect2(Point2(region.pos.x, region.pos.y + region.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_BOTTOM])), Size2(texture->width, texture->height)); _draw_textured_quad( // bottom right - Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margin[MARGIN_RIGHT], p_rect.pos.y + p_rect.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_BOTTOM])), - Rect2(Point2(region.pos.x + region.size.width - p_margin[MARGIN_RIGHT], region.pos.y + region.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_BOTTOM])), + Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margins[MARGIN_RIGHT], p_rect.pos.y + p_rect.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_BOTTOM])), + Rect2(Point2(region.pos.x + region.size.width - p_margins[MARGIN_RIGHT], region.pos.y + region.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_BOTTOM])), Size2(texture->width, texture->height)); - Rect2 rect_center(p_rect.pos + Point2(p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP]), Size2(p_rect.size.width - p_margin[MARGIN_LEFT] - p_margin[MARGIN_RIGHT], p_rect.size.height - p_margin[MARGIN_TOP] - p_margin[MARGIN_BOTTOM])); + Rect2 rect_center(p_rect.pos + Point2(p_margins[MARGIN_LEFT], p_margins[MARGIN_TOP]), Size2(p_rect.size.width - p_margins[MARGIN_LEFT] - p_margins[MARGIN_RIGHT], p_rect.size.height - p_margins[MARGIN_TOP] - p_margins[MARGIN_BOTTOM])); - Rect2 src_center(Point2(region.pos.x + p_margin[MARGIN_LEFT], region.pos.y + p_margin[MARGIN_TOP]), Size2(region.size.width - p_margin[MARGIN_LEFT] - p_margin[MARGIN_RIGHT], region.size.height - p_margin[MARGIN_TOP] - p_margin[MARGIN_BOTTOM])); + Rect2 src_center(Point2(region.pos.x + p_margins[MARGIN_LEFT], region.pos.y + p_margins[MARGIN_TOP]), Size2(region.size.width - p_margins[MARGIN_LEFT] - p_margins[MARGIN_RIGHT], region.size.height - p_margins[MARGIN_TOP] - p_margins[MARGIN_BOTTOM])); _draw_textured_quad( // top - Rect2(Point2(rect_center.pos.x, p_rect.pos.y), Size2(rect_center.size.width, p_margin[MARGIN_TOP])), - Rect2(Point2(src_center.pos.x, region.pos.y), Size2(src_center.size.width, p_margin[MARGIN_TOP])), + Rect2(Point2(rect_center.pos.x, p_rect.pos.y), Size2(rect_center.size.width, p_margins[MARGIN_TOP])), + Rect2(Point2(src_center.pos.x, region.pos.y), Size2(src_center.size.width, p_margins[MARGIN_TOP])), Size2(texture->width, texture->height)); _draw_textured_quad( // bottom - Rect2(Point2(rect_center.pos.x, rect_center.pos.y + rect_center.size.height), Size2(rect_center.size.width, p_margin[MARGIN_BOTTOM])), - Rect2(Point2(src_center.pos.x, src_center.pos.y + src_center.size.height), Size2(src_center.size.width, p_margin[MARGIN_BOTTOM])), + Rect2(Point2(rect_center.pos.x, rect_center.pos.y + rect_center.size.height), Size2(rect_center.size.width, p_margins[MARGIN_BOTTOM])), + Rect2(Point2(src_center.pos.x, src_center.pos.y + src_center.size.height), Size2(src_center.size.width, p_margins[MARGIN_BOTTOM])), Size2(texture->width, texture->height)); _draw_textured_quad( // left - Rect2(Point2(p_rect.pos.x, rect_center.pos.y), Size2(p_margin[MARGIN_LEFT], rect_center.size.height)), - Rect2(Point2(region.pos.x, region.pos.y + p_margin[MARGIN_TOP]), Size2(p_margin[MARGIN_LEFT], src_center.size.height)), + Rect2(Point2(p_rect.pos.x, rect_center.pos.y), Size2(p_margins[MARGIN_LEFT], rect_center.size.height)), + Rect2(Point2(region.pos.x, region.pos.y + p_margins[MARGIN_TOP]), Size2(p_margins[MARGIN_LEFT], src_center.size.height)), Size2(texture->width, texture->height)); _draw_textured_quad( // right - Rect2(Point2(rect_center.pos.x + rect_center.size.width, rect_center.pos.y), Size2(p_margin[MARGIN_RIGHT], rect_center.size.height)), - Rect2(Point2(src_center.pos.x + src_center.size.width, region.pos.y + p_margin[MARGIN_TOP]), Size2(p_margin[MARGIN_RIGHT], src_center.size.height)), + Rect2(Point2(rect_center.pos.x + rect_center.size.width, rect_center.pos.y), Size2(p_margins[MARGIN_RIGHT], rect_center.size.height)), + Rect2(Point2(src_center.pos.x + src_center.size.width, region.pos.y + p_margins[MARGIN_TOP]), Size2(p_margins[MARGIN_RIGHT], src_center.size.height)), Size2(texture->width, texture->height)); if (p_draw_center) { @@ -8700,17 +8700,17 @@ void RasterizerGLES2::_canvas_item_render_commands(CanvasItem *p_item, CanvasIte } } -void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material, Shader *shader) { +void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material, Shader *p_shader) { if (canvas_shader.bind()) rebind_texpixel_size = true; - if (material->shader_version != shader->version) { + if (material->shader_version != p_shader->version) { //todo optimize uniforms - material->shader_version = shader->version; + material->shader_version = p_shader->version; } - if (shader->has_texscreen && framebuffer.active) { + if (p_shader->has_texscreen && framebuffer.active) { int x = viewport.x; int y = window_size.height - (viewport.height + viewport.y); @@ -8742,19 +8742,19 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material, glActiveTexture(GL_TEXTURE0); } - if (shader->has_screen_uv) { + if (p_shader->has_screen_uv) { canvas_shader.set_uniform(CanvasShaderGLES2::SCREEN_UV_MULT, Vector2(1.0 / viewport.width, 1.0 / viewport.height)); } - uses_texpixel_size = shader->uses_texpixel_size; + uses_texpixel_size = p_shader->uses_texpixel_size; } -void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *material, Shader *shader) { +void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *material, Shader *p_shader) { //this can be optimized.. int tex_id = 1; int idx = 0; - for (Map<StringName, ShaderLanguage::Uniform>::Element *E = shader->uniforms.front(); E; E = E->next()) { + for (Map<StringName, ShaderLanguage::Uniform>::Element *E = p_shader->uniforms.front(); E; E = E->next()) { Map<StringName, Variant>::Element *F = material->shader_param.find(E->key()); @@ -8767,7 +8767,7 @@ void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *materia if (!rid.is_valid()) { - Map<StringName, RID>::Element *DT = shader->default_textures.find(E->key()); + Map<StringName, RID>::Element *DT = p_shader->default_textures.find(E->key()); if (DT) { rid = DT->get(); } @@ -8799,7 +8799,7 @@ void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *materia glActiveTexture(GL_TEXTURE0); } - if (shader->uses_time) { + if (p_shader->uses_time) { canvas_shader.set_uniform(CanvasShaderGLES2::TIME, Math::fmod(last_time, shader_time_rollback)); draw_next_frame = true; } diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h index e86d3ba298..ca6a0fce26 100644 --- a/drivers/gles2/rasterizer_gles2.h +++ b/drivers/gles2/rasterizer_gles2.h @@ -1524,7 +1524,7 @@ public: virtual void light_directional_set_shadow_param(RID p_light, VS::LightDirectionalShadowParam p_param, float p_value); virtual float light_directional_get_shadow_param(RID p_light, VS::LightDirectionalShadowParam p_param) const; - virtual AABB light_get_aabb(RID p_poly) const; + virtual AABB light_get_aabb(RID p_light) const; virtual RID light_instance_create(RID p_light); virtual void light_instance_set_transform(RID p_light_instance, const Transform &p_transform); diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp index 961bf27a72..8764ae3895 100644 --- a/drivers/gles2/shader_gles2.cpp +++ b/drivers/gles2/shader_gles2.cpp @@ -103,11 +103,11 @@ void ShaderGLES2::bind_uniforms() { uniforms_dirty = false; }; -GLint ShaderGLES2::get_uniform_location(int p_idx) const { +GLint ShaderGLES2::get_uniform_location(int p_index) const { ERR_FAIL_COND_V(!version, -1); - return version->uniform_location[p_idx]; + return version->uniform_location[p_index]; }; bool ShaderGLES2::bind() { diff --git a/drivers/gles2/shader_gles2.h b/drivers/gles2/shader_gles2.h index 69a66b8ab7..32b979807d 100644 --- a/drivers/gles2/shader_gles2.h +++ b/drivers/gles2/shader_gles2.h @@ -281,7 +281,7 @@ public: }; GLint get_uniform_location(const String &p_name) const; - GLint get_uniform_location(int p_uniform) const; + GLint get_uniform_location(int p_index) const; static _FORCE_INLINE_ ShaderGLES2 *get_active() { return active; }; bool bind(); @@ -293,9 +293,9 @@ public: void clear_caches(); uint32_t create_custom_shader(); - void set_custom_shader_code(uint32_t p_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_p_light, const String &p_fragment_globals, const Vector<StringName> &p_uniforms, const Vector<const char *> &p_custom_defines); - void set_custom_shader(uint32_t p_id); - void free_custom_shader(uint32_t p_id); + void set_custom_shader_code(uint32_t p_code_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_light, const String &p_fragment_globals, const Vector<StringName> &p_uniforms, const Vector<const char *> &p_custom_defines); + void set_custom_shader(uint32_t p_code_id); + void free_custom_shader(uint32_t p_code_id); void set_uniform_default(int p_idx, const Variant &p_value) { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 30a77c4b39..30c0d65ff3 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2180,38 +2180,38 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo } } -void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *m, bool p_shadow) { +void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_shadow) { - bool has_base_alpha = (m->shader->spatial.uses_alpha && !m->shader->spatial.uses_alpha_scissor) || m->shader->spatial.uses_screen_texture || m->shader->spatial.unshaded; - bool has_blend_alpha = m->shader->spatial.blend_mode != RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX || m->shader->spatial.ontop; + bool has_base_alpha = (p_material->shader->spatial.uses_alpha && !p_material->shader->spatial.uses_alpha_scissor) || p_material->shader->spatial.uses_screen_texture || p_material->shader->spatial.unshaded; + bool has_blend_alpha = p_material->shader->spatial.blend_mode != RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX || p_material->shader->spatial.ontop; bool has_alpha = has_base_alpha || has_blend_alpha; bool shadow = false; bool mirror = p_instance->mirror; - if (m->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) { + if (p_material->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) { mirror = !mirror; } - if (m->shader->spatial.uses_sss) { + if (p_material->shader->spatial.uses_sss) { state.used_sss = true; } - if (m->shader->spatial.uses_screen_texture) { + if (p_material->shader->spatial.uses_screen_texture) { state.used_screen_texture = true; } if (p_shadow) { - if (has_blend_alpha || (has_base_alpha && m->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS)) + if (has_blend_alpha || (has_base_alpha && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS)) return; //bye - if (!m->shader->spatial.uses_alpha_scissor && !m->shader->spatial.writes_modelview_or_projection && !m->shader->spatial.uses_vertex && !m->shader->spatial.uses_discard && m->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { + if (!p_material->shader->spatial.uses_alpha_scissor && !p_material->shader->spatial.writes_modelview_or_projection && !p_material->shader->spatial.uses_vertex && !p_material->shader->spatial.uses_discard && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { //shader does not use discard and does not write a vertex position, use generic material if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) - m = storage->material_owner.getptr(default_material_twosided); + p_material = storage->material_owner.getptr(default_material_twosided); else - m = storage->material_owner.getptr(default_material); + p_material = storage->material_owner.getptr(default_material); } has_alpha = false; @@ -2223,7 +2223,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G return; e->geometry = p_geometry; - e->material = m; + e->material = p_material; e->instance = p_instance; e->owner = p_owner; e->sort_key = 0; @@ -2250,7 +2250,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G e->sort_key |= uint64_t(e->material->index) << RenderList::SORT_KEY_MATERIAL_INDEX_SHIFT; e->sort_key |= uint64_t(e->instance->depth_layer) << RenderList::SORT_KEY_DEPTH_LAYER_SHIFT; - if (!has_blend_alpha && has_alpha && m->shader->spatial.depth_draw_mode == RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { + if (!has_blend_alpha && has_alpha && p_material->shader->spatial.depth_draw_mode == RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { //if nothing exists, add this element as opaque too RenderList::Element *oe = render_list.add_element(); @@ -2277,12 +2277,12 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G //e->light_type=0xFF; // no lights! - if (shadow || m->shader->spatial.unshaded || state.debug_draw == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) { + if (shadow || p_material->shader->spatial.unshaded || state.debug_draw == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) { e->sort_key |= SORT_KEY_UNSHADED_FLAG; } - if (!shadow && (m->shader->spatial.uses_vertex_lighting || storage->config.force_vertex_shading)) { + if (!shadow && (p_material->shader->spatial.uses_vertex_lighting || storage->config.force_vertex_shading)) { e->sort_key |= SORT_KEY_VERTEX_LIT_FLAG; } diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 0cdaef44a9..e1d96f23dd 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -523,8 +523,8 @@ public: virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer); virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0); - virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality); - virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality); + virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality); + virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality); virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, bool p_bicubic_upscale); virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture); @@ -795,7 +795,7 @@ public: void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale, float p_energy); void _setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform); - void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transformm, bool p_use_shadows); + void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transform, bool p_use_shadows); void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_shadow_atlas); void _setup_reflections(RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_reflection_atlas, Environment *p_env); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index a8e4bc0d4b..ea6ac569f0 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -5468,58 +5468,58 @@ RID RasterizerStorageGLES3::particles_get_draw_pass_mesh(RID p_particles, int p_ return particles->draw_passes[p_pass]; } -void RasterizerStorageGLES3::_particles_process(Particles *particles, float p_delta) { +void RasterizerStorageGLES3::_particles_process(Particles *p_particles, float p_delta) { - float new_phase = Math::fmod((float)particles->phase + (p_delta / particles->lifetime) * particles->speed_scale, (float)1.0); + float new_phase = Math::fmod((float)p_particles->phase + (p_delta / p_particles->lifetime) * p_particles->speed_scale, (float)1.0); - if (particles->clear) { - particles->cycle_number = 0; - particles->random_seed = Math::rand(); - } else if (new_phase < particles->phase) { - if (particles->one_shot) { - particles->emitting = false; + if (p_particles->clear) { + p_particles->cycle_number = 0; + p_particles->random_seed = Math::rand(); + } else if (new_phase < p_particles->phase) { + if (p_particles->one_shot) { + p_particles->emitting = false; shaders.particles.set_uniform(ParticlesShaderGLES3::EMITTING, false); } - particles->cycle_number++; + p_particles->cycle_number++; } shaders.particles.set_uniform(ParticlesShaderGLES3::SYSTEM_PHASE, new_phase); - shaders.particles.set_uniform(ParticlesShaderGLES3::PREV_SYSTEM_PHASE, particles->phase); - particles->phase = new_phase; + shaders.particles.set_uniform(ParticlesShaderGLES3::PREV_SYSTEM_PHASE, p_particles->phase); + p_particles->phase = new_phase; - shaders.particles.set_uniform(ParticlesShaderGLES3::DELTA, p_delta * particles->speed_scale); - shaders.particles.set_uniform(ParticlesShaderGLES3::CLEAR, particles->clear); - glUniform1ui(shaders.particles.get_uniform_location(ParticlesShaderGLES3::RANDOM_SEED), particles->random_seed); + shaders.particles.set_uniform(ParticlesShaderGLES3::DELTA, p_delta * p_particles->speed_scale); + shaders.particles.set_uniform(ParticlesShaderGLES3::CLEAR, p_particles->clear); + glUniform1ui(shaders.particles.get_uniform_location(ParticlesShaderGLES3::RANDOM_SEED), p_particles->random_seed); - if (particles->use_local_coords) + if (p_particles->use_local_coords) shaders.particles.set_uniform(ParticlesShaderGLES3::EMISSION_TRANSFORM, Transform()); else - shaders.particles.set_uniform(ParticlesShaderGLES3::EMISSION_TRANSFORM, particles->emission_transform); + shaders.particles.set_uniform(ParticlesShaderGLES3::EMISSION_TRANSFORM, p_particles->emission_transform); - glUniform1ui(shaders.particles.get_uniform(ParticlesShaderGLES3::CYCLE), particles->cycle_number); + glUniform1ui(shaders.particles.get_uniform(ParticlesShaderGLES3::CYCLE), p_particles->cycle_number); - particles->clear = false; + p_particles->clear = false; - glBindVertexArray(particles->particle_vaos[0]); + glBindVertexArray(p_particles->particle_vaos[0]); - glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, particles->particle_buffers[1]); + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, p_particles->particle_buffers[1]); // GLint size = 0; // glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size); glBeginTransformFeedback(GL_POINTS); - glDrawArrays(GL_POINTS, 0, particles->amount); + glDrawArrays(GL_POINTS, 0, p_particles->amount); glEndTransformFeedback(); - SWAP(particles->particle_buffers[0], particles->particle_buffers[1]); - SWAP(particles->particle_vaos[0], particles->particle_vaos[1]); + SWAP(p_particles->particle_buffers[0], p_particles->particle_buffers[1]); + SWAP(p_particles->particle_vaos[0], p_particles->particle_vaos[1]); glBindVertexArray(0); /* //debug particles :D - glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[0]); + glBindBuffer(GL_ARRAY_BUFFER, p_particles->particle_buffers[0]); - float *data = (float *)glMapBufferRange(GL_ARRAY_BUFFER, 0, particles->amount * 16 * 6, GL_MAP_READ_BIT); - for (int i = 0; i < particles->amount; i++) { + float *data = (float *)glMapBufferRange(GL_ARRAY_BUFFER, 0, p_particles->amount * 16 * 6, GL_MAP_READ_BIT); + for (int i = 0; i < p_particles->amount; i++) { int ofs = i * 24; print_line(itos(i) + ":"); print_line("\tColor: " + Color(data[ofs + 0], data[ofs + 1], data[ofs + 2], data[ofs + 3])); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 5a272f43fb..3c7ea000ba 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -314,7 +314,7 @@ public: mutable RID_Owner<Texture> texture_owner; - Ref<Image> _get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_type, bool &r_compressed, bool &srgb); + Ref<Image> _get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type, bool &r_compressed, bool &srgb); virtual RID texture_create(); virtual void texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT); @@ -528,8 +528,8 @@ public: mutable SelfList<Material>::List _material_dirty_list; void _material_make_dirty(Material *p_material) const; - void _material_add_geometry(RID p_material, Geometry *p_instantiable); - void _material_remove_geometry(RID p_material, Geometry *p_instantiable); + void _material_add_geometry(RID p_material, Geometry *p_geometry); + void _material_remove_geometry(RID p_material, Geometry *p_geometry); mutable RID_Owner<Material> material_owner; @@ -1168,7 +1168,7 @@ public: virtual void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order); - virtual void particles_set_draw_passes(RID p_particles, int p_count); + virtual void particles_set_draw_passes(RID p_particles, int p_passes); virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh); virtual void particles_request_process(RID p_particles); diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 77e257dfc8..20956ad644 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -102,11 +102,11 @@ void ShaderGLES3::bind_uniforms() { uniforms_dirty = false; } -GLint ShaderGLES3::get_uniform_location(int p_idx) const { +GLint ShaderGLES3::get_uniform_location(int p_index) const { ERR_FAIL_COND_V(!version, -1); - return version->uniform_location[p_idx]; + return version->uniform_location[p_index]; } bool ShaderGLES3::bind() { @@ -273,9 +273,11 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() { //vertex precision is high strings.push_back("precision highp float;\n"); strings.push_back("precision highp int;\n"); +#ifndef GLES_OVER_GL strings.push_back("precision highp sampler2D;\n"); strings.push_back("precision highp samplerCube;\n"); strings.push_back("precision highp sampler2DArray;\n"); +#endif #if 0 if (cc) { @@ -374,9 +376,11 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() { //fragment precision is medium strings.push_back("precision highp float;\n"); strings.push_back("precision highp int;\n"); +#ifndef GLES_OVER_GL strings.push_back("precision highp sampler2D;\n"); strings.push_back("precision highp samplerCube;\n"); strings.push_back("precision highp sampler2DArray;\n"); +#endif #if 0 if (cc) { diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h index 5a34010a98..6a399a74cc 100644 --- a/drivers/gles3/shader_gles3.h +++ b/drivers/gles3/shader_gles3.h @@ -306,7 +306,7 @@ public: }; GLint get_uniform_location(const String &p_name) const; - GLint get_uniform_location(int p_uniform) const; + GLint get_uniform_location(int p_index) const; static _FORCE_INLINE_ ShaderGLES3 *get_active() { return active; }; bool bind(); @@ -318,9 +318,9 @@ public: void clear_caches(); uint32_t create_custom_shader(); - void set_custom_shader_code(uint32_t p_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_p_light, const String &p_fragment_globals, const String &p_uniforms, const Vector<StringName> &p_texture_uniforms, const Vector<CharString> &p_custom_defines); - void set_custom_shader(uint32_t p_id); - void free_custom_shader(uint32_t p_id); + void set_custom_shader_code(uint32_t p_code_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_light, const String &p_fragment_globals, const String &p_uniforms, const Vector<StringName> &p_texture_uniforms, const Vector<CharString> &p_custom_defines); + void set_custom_shader(uint32_t p_code_id); + void free_custom_shader(uint32_t p_code_id); void set_uniform_default(int p_idx, const Variant &p_value) { diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h index 5a35cdf2e9..e4b294a802 100644 --- a/drivers/unix/dir_access_unix.h +++ b/drivers/unix/dir_access_unix.h @@ -75,8 +75,8 @@ public: virtual uint64_t get_modified_time(String p_file); - virtual Error rename(String p_from, String p_to); - virtual Error remove(String p_name); + virtual Error rename(String p_path, String p_new_path); + virtual Error remove(String p_path); virtual size_t get_space_left(); diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 6cd0016bb0..115bdc2d65 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -69,7 +69,7 @@ public: virtual void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type = ERR_ERROR); virtual void print(const char *p_format, ...); - virtual void vprint(const char *p_format, va_list p_list, bool p_stderr = false); + virtual void vprint(const char *p_format, va_list p_list, bool p_stder = false); virtual void alert(const String &p_alert, const String &p_title = "ALERT!"); virtual String get_stdin_string(bool p_block); diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp index 74ceb3946a..b21990a866 100644 --- a/drivers/unix/packet_peer_udp_posix.cpp +++ b/drivers/unix/packet_peer_udp_posix.cpp @@ -127,7 +127,7 @@ int PacketPeerUDPPosix::get_max_packet_size() const { return 512; // uhm maybe not } -Error PacketPeerUDPPosix::listen(int p_port, IP_Address p_bind_address, int p_recv_buffer_size) { +Error PacketPeerUDPPosix::listen(int p_port, const IP_Address &p_bind_address, int p_recv_buffer_size) { ERR_FAIL_COND_V(sockfd != -1, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); @@ -172,13 +172,13 @@ Error PacketPeerUDPPosix::wait() { return _poll(true); } -Error PacketPeerUDPPosix::_poll(bool p_wait) { +Error PacketPeerUDPPosix::_poll(bool p_block) { if (sockfd == -1) { return FAILED; } - _set_sock_blocking(p_wait); + _set_sock_blocking(p_block); struct sockaddr_storage from = { 0 }; socklen_t len = sizeof(struct sockaddr_storage); @@ -216,7 +216,7 @@ Error PacketPeerUDPPosix::_poll(bool p_wait) { len = sizeof(struct sockaddr_storage); ++queue_count; - if (p_wait) + if (p_block) break; }; diff --git a/drivers/unix/packet_peer_udp_posix.h b/drivers/unix/packet_peer_udp_posix.h index a52b8b8e95..d8b08818b0 100644 --- a/drivers/unix/packet_peer_udp_posix.h +++ b/drivers/unix/packet_peer_udp_posix.h @@ -67,7 +67,7 @@ public: virtual int get_max_packet_size() const; - virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536); + virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536); virtual void close(); virtual Error wait(); virtual bool is_listening() const; diff --git a/drivers/unix/tcp_server_posix.cpp b/drivers/unix/tcp_server_posix.cpp index 865e9aa1d6..a8554d07a3 100644 --- a/drivers/unix/tcp_server_posix.cpp +++ b/drivers/unix/tcp_server_posix.cpp @@ -69,7 +69,7 @@ void TCPServerPosix::make_default() { TCP_Server::_create = TCPServerPosix::_create; }; -Error TCPServerPosix::listen(uint16_t p_port, const IP_Address p_bind_address) { +Error TCPServerPosix::listen(uint16_t p_port, const IP_Address &p_bind_address) { ERR_FAIL_COND_V(listen_sockfd != -1, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); diff --git a/drivers/unix/tcp_server_posix.h b/drivers/unix/tcp_server_posix.h index 659b389fe2..947050ab8a 100644 --- a/drivers/unix/tcp_server_posix.h +++ b/drivers/unix/tcp_server_posix.h @@ -41,7 +41,7 @@ class TCPServerPosix : public TCP_Server { static TCP_Server *_create(); public: - virtual Error listen(uint16_t p_port, IP_Address p_bind_address = IP_Address("*")); + virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*")); virtual bool is_connection_available() const; virtual Ref<StreamPeerTCP> take_connection(); diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h index f7553f50c2..a352415fd6 100644 --- a/drivers/windows/dir_access_windows.h +++ b/drivers/windows/dir_access_windows.h @@ -75,8 +75,8 @@ public: virtual Error make_dir(String p_dir); - virtual Error rename(String p_from, String p_to); - virtual Error remove(String p_name); + virtual Error rename(String p_path, String p_new_path); + virtual Error remove(String p_path); //virtual FileType get_file_type() const; size_t get_space_left(); diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index c66da2da29..bb133b9899 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -53,9 +53,9 @@ void FileAccessWindows::check_errors() const { } } -Error FileAccessWindows::_open(const String &p_filename, int p_mode_flags) { +Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) { - String filename = fix_path(p_filename); + String filename = fix_path(p_path); if (f) close(); diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index 3675948b1d..1571131aee 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -1299,7 +1299,7 @@ void AnimationKeyEditor::_track_editor_draw() { Object *obj = NULL; RES res; - Node *node = root->get_node_and_resource(animation->track_get_path(idx), res); + Node *node = root ? root->get_node_and_resource(animation->track_get_path(idx), res) : (Node *)NULL; if (res.is_valid()) { obj = res.ptr(); @@ -1324,7 +1324,7 @@ void AnimationKeyEditor::_track_editor_draw() { te->draw_texture(type_icon[animation->track_get_type(idx)], ofs + Point2(0, y + (h - type_icon[0]->get_height()) / 2).floor()); NodePath np = animation->track_get_path(idx); - Node *n = root->get_node(np); + Node *n = root ? root->get_node(np) : (Node *)NULL; Color ncol = color; if (n && editor_selection->is_selected(n)) ncol = track_select_color; diff --git a/editor/animation_editor.h b/editor/animation_editor.h index 88cc446853..9eacafb021 100644 --- a/editor/animation_editor.h +++ b/editor/animation_editor.h @@ -278,7 +278,7 @@ class AnimationKeyEditor : public VBoxContainer { void _track_name_changed(const String &p_name); void _track_menu_selected(int p_idx); void _confirm_insert_list(); - int _confirm_insert(InsertData p_id, int p_at_track = -1); + int _confirm_insert(InsertData p_id, int p_last_track = -1); void _query_insert(const InsertData &p_id); void _update_menu(); bool insert_queue; diff --git a/editor/asset_library_editor_plugin.cpp b/editor/asset_library_editor_plugin.cpp index 2a22cde2fb..0a2799c51f 100644 --- a/editor/asset_library_editor_plugin.cpp +++ b/editor/asset_library_editor_plugin.cpp @@ -189,7 +189,14 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const } break; } } - +void EditorAssetLibraryItemDescription::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit")); + desc_bg->add_style_override("panel", get_stylebox("normal", "TextEdit")); + } break; + } +} void EditorAssetLibraryItemDescription::_bind_methods() { ClassDB::bind_method(D_METHOD("set_image"), &EditorAssetLibraryItemDescription::set_image); ClassDB::bind_method(D_METHOD("_link_click"), &EditorAssetLibraryItemDescription::_link_click); @@ -274,23 +281,21 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { desc_vbox->add_child(item); desc_vbox->set_custom_minimum_size(Size2(300, 0)); - PanelContainer *desc_bg = memnew(PanelContainer); + desc_bg = memnew(PanelContainer); desc_vbox->add_child(desc_bg); desc_bg->set_v_size_flags(SIZE_EXPAND_FILL); description = memnew(RichTextLabel); description->connect("meta_clicked", this, "_link_click"); desc_bg->add_child(description); - desc_bg->add_style_override("panel", get_stylebox("normal", "TextEdit")); preview = memnew(TextureRect); preview->set_custom_minimum_size(Size2(640, 345)); hbox->add_child(preview); - PanelContainer *previews_bg = memnew(PanelContainer); + previews_bg = memnew(PanelContainer); vbox->add_child(previews_bg); previews_bg->set_custom_minimum_size(Size2(0, 85)); - previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit")); previews = memnew(ScrollContainer); previews_bg->add_child(previews); @@ -525,53 +530,62 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { //////////////////////////////////////////////////////////////////////////////// void EditorAssetLibrary::_notification(int p_what) { - if (p_what == NOTIFICATION_READY) { - TextureRect *tf = memnew(TextureRect); - tf->set_texture(get_icon("Error", "EditorIcons")); - reverse->set_icon(get_icon("Updown", "EditorIcons")); + switch (p_what) { + case NOTIFICATION_READY: { - error_hb->add_child(tf); - error_label->raise(); - } + TextureRect *tf = memnew(TextureRect); + tf->set_texture(get_icon("Error", "EditorIcons")); + reverse->set_icon(get_icon("Updown", "EditorIcons")); - if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - if (is_visible()) { - _repository_changed(0); // Update when shown for the first time - } - } + error_hb->add_child(tf); + error_label->raise(); + } break; - if (p_what == NOTIFICATION_PROCESS) { + case NOTIFICATION_VISIBILITY_CHANGED: { - HTTPClient::Status s = request->get_http_client_status(); - bool visible = s != HTTPClient::STATUS_DISCONNECTED; + if (is_visible()) { + _repository_changed(0); // Update when shown for the first time + } + } break; - if (visible != load_status->is_visible()) { - load_status->set_visible(visible); - } + case NOTIFICATION_PROCESS: { - if (visible) { - switch (s) { + HTTPClient::Status s = request->get_http_client_status(); + bool visible = s != HTTPClient::STATUS_DISCONNECTED; - case HTTPClient::STATUS_RESOLVING: { - load_status->set_value(0.1); - } break; - case HTTPClient::STATUS_CONNECTING: { - load_status->set_value(0.2); - } break; - case HTTPClient::STATUS_REQUESTING: { - load_status->set_value(0.3); - } break; - case HTTPClient::STATUS_BODY: { - load_status->set_value(0.4); - } break; - default: {} + if (visible != load_status->is_visible()) { + load_status->set_visible(visible); } - } - bool no_downloads = downloads_hb->get_child_count() == 0; - if (no_downloads == downloads_scroll->is_visible()) { - downloads_scroll->set_visible(!no_downloads); - } + if (visible) { + switch (s) { + + case HTTPClient::STATUS_RESOLVING: { + load_status->set_value(0.1); + } break; + case HTTPClient::STATUS_CONNECTING: { + load_status->set_value(0.2); + } break; + case HTTPClient::STATUS_REQUESTING: { + load_status->set_value(0.3); + } break; + case HTTPClient::STATUS_BODY: { + load_status->set_value(0.4); + } break; + default: {} + } + } + + bool no_downloads = downloads_hb->get_child_count() == 0; + if (no_downloads == downloads_scroll->is_visible()) { + downloads_scroll->set_visible(!no_downloads); + } + + } break; + case NOTIFICATION_THEME_CHANGED: { + + library_scroll_bg->add_style_override("panel", get_stylebox("bg", "Tree")); + } break; } } @@ -1360,9 +1374,8 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { ///////// - PanelContainer *library_scroll_bg = memnew(PanelContainer); + library_scroll_bg = memnew(PanelContainer); library_main->add_child(library_scroll_bg); - library_scroll_bg->add_style_override("panel", get_stylebox("normal", "TextEdit")); library_scroll_bg->set_v_size_flags(SIZE_EXPAND_FILL); library_scroll = memnew(ScrollContainer); diff --git a/editor/asset_library_editor_plugin.h b/editor/asset_library_editor_plugin.h index 9e4a240101..fa768ec96a 100644 --- a/editor/asset_library_editor_plugin.h +++ b/editor/asset_library_editor_plugin.h @@ -89,6 +89,8 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog { RichTextLabel *description; ScrollContainer *previews; HBoxContainer *preview_hb; + PanelContainer *previews_bg; + PanelContainer *desc_bg; struct Preview { int id; @@ -110,9 +112,10 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog { Ref<Texture> icon; void _link_click(const String &p_url); - void _preview_click(int p_index); + void _preview_click(int p_id); protected: + void _notification(int p_what); static void _bind_methods(); public: @@ -179,6 +182,7 @@ class EditorAssetLibrary : public PanelContainer { void _asset_open(); void _asset_file_selected(const String &p_file); + PanelContainer *library_scroll_bg; ScrollContainer *library_scroll; VBoxContainer *library_vb; LineEdit *filter; diff --git a/editor/call_dialog.cpp b/editor/call_dialog.cpp index 8cf9ed6ef4..32b9fc1254 100644 --- a/editor/call_dialog.cpp +++ b/editor/call_dialog.cpp @@ -253,8 +253,8 @@ CallDialog::CallDialog() { call->set_anchor( MARGIN_TOP, ANCHOR_END ); call->set_anchor( MARGIN_RIGHT, ANCHOR_END ); call->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - call->set_begin( Point2( 70, 29 ) ); - call->set_end( Point2( 15, 15 ) ); + call->set_begin( Point2( -70, -29 ) ); + call->set_end( Point2( -15, -15 ) ); call->set_text(TTR("Call")); add_child(call); @@ -262,8 +262,8 @@ CallDialog::CallDialog() { cancel = memnew( Button ); cancel->set_anchor( MARGIN_TOP, ANCHOR_END ); cancel->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - cancel->set_begin( Point2( 15, 29 ) ); - cancel->set_end( Point2( 70, 15 ) ); + cancel->set_begin( Point2( -15, 29 ) ); + cancel->set_end( Point2( 70, -15 ) ); cancel->set_text(TTR("Close")); add_child(cancel); @@ -272,7 +272,7 @@ CallDialog::CallDialog() { tree->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); tree->set_begin( Point2( 20,50 ) ); - tree->set_margin(MARGIN_BOTTOM, 44 ); + tree->set_margin(MARGIN_BOTTOM, -44 ); tree->set_margin(MARGIN_RIGHT, 0.5 ); tree->set_select_mode( Tree::SELECT_ROW ); add_child(tree); @@ -282,10 +282,10 @@ CallDialog::CallDialog() { property_editor = memnew( PropertyEditor ); - property_editor->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, 15 ); + property_editor->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, -15 ); property_editor->set_anchor_and_margin( MARGIN_TOP, ANCHOR_BEGIN, 50 ); //property_editor->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 ); - property_editor->set_anchor_and_margin( MARGIN_BOTTOM, ANCHOR_END, 90 ); + property_editor->set_anchor_and_margin( MARGIN_BOTTOM, ANCHOR_END, -90 ); property_editor->get_scene_tree()->set_hide_root( true ); property_editor->hide_top_label(); @@ -305,15 +305,15 @@ CallDialog::CallDialog() { return_label = memnew( Label ); //return_label->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.53 ); - return_label->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, 85 ); + return_label->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, -85 ); return_label->set_text(TTR("Return:")); add_child(return_label); return_value = memnew( LineEdit ); //return_value->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 ); - return_value->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, 15 ); - return_value->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, 65 ); + return_value->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, -15 ); + return_value->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, -65 ); add_child(return_value); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 2e406fb23d..07c0945114 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -70,7 +70,7 @@ GotoLineDialog::GotoLineDialog() { line = memnew(LineEdit); line->set_anchor(MARGIN_RIGHT, ANCHOR_END); line->set_begin(Point2(15, 22)); - line->set_end(Point2(15, 35)); + line->set_end(Point2(-15, 35)); add_child(line); register_text_enter(line); text_editor = NULL; @@ -887,7 +887,7 @@ FindReplaceDialog::FindReplaceDialog() { replace_text = memnew(LineEdit); replace_text->set_anchor(MARGIN_RIGHT, ANCHOR_END); replace_text->set_begin(Point2(15, 132)); - replace_text->set_end(Point2(15, 135)); + replace_text->set_end(Point2(-15, 135)); //replace_text->set_self_opacity(0.7); replace_mc->add_child(replace_text); @@ -937,8 +937,8 @@ FindReplaceDialog::FindReplaceDialog() { skip->set_anchor(MARGIN_TOP, ANCHOR_END); skip->set_anchor(MARGIN_RIGHT, ANCHOR_END); skip->set_anchor(MARGIN_BOTTOM, ANCHOR_END); - skip->set_begin(Point2(70, button_margin)); - skip->set_end(Point2(10, margin)); + skip->set_begin(Point2(-70, -button_margin)); + skip->set_end(Point2(-10, -margin)); skip->set_text(TTR("Skip")); add_child(skip); skip->connect("pressed", this, "_skip_pressed"); diff --git a/editor/collada/collada.h b/editor/collada/collada.h index 8945e14cce..f94f9ed197 100644 --- a/editor/collada/collada.h +++ b/editor/collada/collada.h @@ -613,7 +613,7 @@ private: // private stuff void _parse_curve_geometry(XMLParser &parser, String p_id, String p_name); void _parse_skin_controller(XMLParser &parser, String p_id); - void _parse_morph_controller(XMLParser &parser, String id); + void _parse_morph_controller(XMLParser &parser, String p_id); void _parse_controller(XMLParser &parser); Node *_parse_visual_instance_geometry(XMLParser &parser); diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h index e7344bbf13..5fdd2b72a8 100644 --- a/editor/dependency_editor.h +++ b/editor/dependency_editor.h @@ -106,7 +106,7 @@ class DependencyErrorDialog : public ConfirmationDialog { void custom_action(const String &); public: - void show(const String &p_for, const Vector<String> &report); + void show(const String &p_for_file, const Vector<String> &report); DependencyErrorDialog(); }; diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h index 4a2e5b48e2..9f8e3526b4 100644 --- a/editor/editor_autoload_settings.h +++ b/editor/editor_autoload_settings.h @@ -66,7 +66,7 @@ class EditorAutoloadSettings : public VBoxContainer { EditorLineEditFileChooser *autoload_add_path; LineEdit *autoload_add_name; - bool _autoload_name_is_valid(const String &p_string, String *r_error = NULL); + bool _autoload_name_is_valid(const String &p_name, String *r_error = NULL); void _autoload_add(); void _autoload_selected(); @@ -74,9 +74,9 @@ class EditorAutoloadSettings : public VBoxContainer { void _autoload_button_pressed(Object *p_item, int p_column, int p_button); void _autoload_file_callback(const String &p_path); - Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); - 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); + Variant get_drag_data_fw(const Point2 &p_point, Control *p_control); + bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control) const; + void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control); protected: void _notification(int p_what); diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index e788fe2c13..51fb1554c1 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -633,13 +633,13 @@ Vector<EditorData::EditedScene> EditorData::get_edited_scenes() const { return out_edited_scenes_list; } -void EditorData::set_edited_scene_version(uint64_t version, int scene_idx) { +void EditorData::set_edited_scene_version(uint64_t version, int p_scene_idx) { ERR_FAIL_INDEX(current_edited_scene, edited_scene.size()); - if (scene_idx < 0) { + if (p_scene_idx < 0) { edited_scene[current_edited_scene].version = version; } else { - ERR_FAIL_INDEX(scene_idx, edited_scene.size()); - edited_scene[scene_idx].version = version; + ERR_FAIL_INDEX(p_scene_idx, edited_scene.size()); + edited_scene[p_scene_idx].version = version; } } diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp index 9f8331febd..b64f5f1c69 100644 --- a/editor/editor_dir_dialog.cpp +++ b/editor/editor_dir_dialog.cpp @@ -112,19 +112,19 @@ void EditorDirDialog::_notification(int p_what) { } } -void EditorDirDialog::_item_collapsed(Object *_p_item) { +void EditorDirDialog::_item_collapsed(Object *p_item) { - TreeItem *p_item = _p_item->cast_to<TreeItem>(); + TreeItem *item = p_item->cast_to<TreeItem>(); - if (updating || p_item->is_collapsed()) + if (updating || item->is_collapsed()) return; - TreeItem *ci = p_item->get_children(); + TreeItem *ci = item->get_children(); while (ci) { String p = ci->get_metadata(0); if (p == "") { - String pp = p_item->get_metadata(0); + String pp = item->get_metadata(0); ci->set_metadata(0, pp.plus_file(ci->get_text(0))); _update_dir(ci); } diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 36fd86d88f..fe1dfa281c 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -37,7 +37,6 @@ #include "io/resource_loader.h" #include "io/resource_saver.h" #include "io/zip_io.h" -#include "os/dir_access.h" #include "os/file_access.h" #include "project_settings.h" #include "script_language.h" @@ -420,6 +419,63 @@ void EditorExportPlatform::_export_find_dependencies(const String &p_path, Set<S } } +void EditorExportPlatform::_edit_files_with_filter(DirAccess *da, const Vector<String> &p_filters, Set<String> &r_list, bool exclude) { + + da->list_dir_begin(); + String cur_dir = da->get_current_dir().replace("\\", "/"); + if (!cur_dir.ends_with("/")) + cur_dir += "/"; + + Vector<String> dirs; + String f; + while ((f = da->get_next()) != "") { + if (da->current_is_dir()) + dirs.push_back(f); + else { + String fullpath = cur_dir + f; + for (int i = 0; i < p_filters.size(); ++i) { + if (fullpath.matchn(p_filters[i])) { + if (!exclude) { + r_list.insert(fullpath); + } else { + r_list.erase(fullpath); + } + } + } + } + } + + da->list_dir_end(); + + for (int i = 0; i < dirs.size(); ++i) { + String dir = dirs[i]; + if (dir.begins_with(".")) + continue; + da->change_dir(dir); + _edit_files_with_filter(da, p_filters, r_list, exclude); + da->change_dir(".."); + } +} + +void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String &p_filter, bool exclude) { + + if (p_filter == "") + return; + Vector<String> split = p_filter.split(","); + Vector<String> filters; + for (int i = 0; i < split.size(); i++) { + String f = split[i].strip_edges(); + if (f.empty()) + continue; + filters.push_back(f); + } + + DirAccess *da = DirAccess::open("res://"); + ERR_FAIL_NULL(da); + _edit_files_with_filter(da, filters, r_list, exclude); + memdelete(da); +} + Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata) { Ref<EditorExportPlatform> platform = p_preset->get_platform(); @@ -449,6 +505,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & } } + _edit_filter_list(paths, p_preset->get_include_filter(), false); + _edit_filter_list(paths, p_preset->get_exclude_filter(), true); + //store everything in the export medium int idx = 0; int total = paths.size(); diff --git a/editor/editor_export.h b/editor/editor_export.h index dc4b198575..df42b0d95d 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -30,6 +30,7 @@ #ifndef EDITOR_EXPORT_H #define EDITOR_EXPORT_H +#include "os/dir_access.h" #include "resource.h" #include "scene/main/node.h" #include "scene/main/timer.h" @@ -157,6 +158,9 @@ private: static Error _save_pack_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total); static Error _save_zip_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total); + void _edit_files_with_filter(DirAccess *da, const Vector<String> &p_filters, Set<String> &r_list, bool exclude); + void _edit_filter_list(Set<String> &r_list, const String &p_filter, bool exclude); + protected: bool exists_export_template(String template_file_name, String *err) const; String find_export_template(String template_file_name, String *err = NULL) const; @@ -290,7 +294,7 @@ public: void set_name(const String &p_name); void set_os_name(const String &p_name); - void set_logo(const Ref<Texture> &p_loco); + void set_logo(const Ref<Texture> &p_logo); void set_release_64(const String &p_file); void set_release_32(const String &p_file); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index eeb2f5ae8a..2f4ac02703 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -339,6 +339,7 @@ bool EditorFileSystem::_update_scan_actions() { int idx = ia.dir->find_file_index(ia.file); ERR_CONTINUE(idx == -1); + _delete_internal_files(ia.dir->files[idx]->file); memdelete(ia.dir->files[idx]); ia.dir->files.remove(idx); @@ -598,6 +599,10 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess fi->type = fc->type; fi->modified_time = fc->modification_time; fi->import_modified_time = fc->import_modification_time; + if (fc->type == String()) { + fi->type = ResourceLoader::get_resource_type(path); + //there is also the chance that file type changed due to reimport, must probably check this somehow here (or kind of note it for next time in another file?) + } } else { @@ -615,6 +620,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess } fi->type = ResourceFormatImporter::get_singleton()->get_resource_type(path); + print_line("import extension tried resource type for " + path + " and its " + fi->type); fi->modified_time = 0; fi->import_modified_time = 0; @@ -633,6 +639,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess fi->import_modified_time = 0; } else { fi->type = ResourceLoader::get_resource_type(path); + print_line("regular import tried resource type for " + path + " and its " + fi->type); fi->modified_time = mt; fi->import_modified_time = 0; } @@ -832,6 +839,19 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const } } +void EditorFileSystem::_delete_internal_files(String p_file) { + if (FileAccess::exists(p_file + ".import")) { + List<String> paths; + ResourceFormatImporter::get_singleton()->get_internal_resource_path_list(p_file, &paths); + DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + for (List<String>::Element *E = paths.front(); E; E = E->next()) { + da->remove(E->get()); + } + da->remove(p_file + ".import"); + memdelete(da); + } +} + void EditorFileSystem::_thread_func_sources(void *_userdata) { EditorFileSystem *efs = (EditorFileSystem *)_userdata; @@ -1186,6 +1206,7 @@ void EditorFileSystem::update_file(const String &p_file) { if (!FileAccess::exists(p_file)) { //was removed + _delete_internal_files(p_file); memdelete(fs->files[cpos]); fs->files.remove(cpos); call_deferred("emit_signal", "filesystem_changed"); //update later diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index 3522a1ab1d..f98758fd03 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -168,6 +168,8 @@ class EditorFileSystem : public Node { void _scan_fs_changes(EditorFileSystemDirectory *p_dir, const ScanProgress &p_progress); + void _delete_internal_files(String p_file); + Set<String> valid_extensions; Set<String> import_extensions; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index f80c4ee0e2..8b1f558c0a 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1788,7 +1788,7 @@ void EditorHelpBit::_bind_methods() { void EditorHelpBit::_notification(int p_what) { if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles")); + add_style_override("panel", get_stylebox("ScriptPanel", "EditorStyles")); } } diff --git a/editor/editor_help.h b/editor/editor_help.h index de30b543fc..e0d68605ab 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -137,7 +137,7 @@ class EditorHelp : public VBoxContainer { void _help_callback(const String &p_topic); - void _add_text(const String &p_text); + void _add_text(const String &p_bbcode); bool scroll_locked; //void _button_pressed(int p_idx); @@ -189,7 +189,7 @@ class EditorHelpBit : public Panel { RichTextLabel *rich_text; void _go_to_help(String p_what); - void _meta_clicked(String p_what); + void _meta_clicked(String p_select); protected: static void _bind_methods(); diff --git a/editor/editor_name_dialog.cpp b/editor/editor_name_dialog.cpp index 6ebfcbf313..74bb526ccc 100644 --- a/editor/editor_name_dialog.cpp +++ b/editor/editor_name_dialog.cpp @@ -87,6 +87,6 @@ EditorNameDialog::EditorNameDialog() { makevb->add_child(name); name->set_margin(MARGIN_TOP, 5); name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5); - name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 5); + name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5); name->connect("gui_input", this, "_line_gui_input"); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index b2e21fa168..242648d4a9 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -364,10 +364,28 @@ void EditorNode::_fs_changed() { E->get()->invalidate(); } - if (export_defer.platform != "") { + if (export_defer.preset != "") { + Ref<EditorExportPreset> preset; + for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) { + preset = EditorExport::get_singleton()->get_export_preset(i); + if (preset->get_name() == export_defer.preset) { + break; + } + } + if (preset.is_null()) { + String err = "Unknown export preset: " + export_defer.preset; + ERR_PRINT(err.utf8().get_data()); + } else { + Ref<EditorExportPlatform> platform = preset->get_platform(); + if (platform.is_null()) { + String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform."; + ERR_PRINT(err.utf8().get_data()); + } else { + platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0); + } + } - //project_export_settings->export_platform(export_defer.platform,export_defer.path,export_defer.debug,export_defer.password,true); - export_defer.platform = ""; + export_defer.preset = ""; } { @@ -701,34 +719,34 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) { ERR_FAIL_COND(err != OK); } -bool EditorNode::_find_and_save_resource(RES res, Map<RES, bool> &processed, int32_t flags) { +bool EditorNode::_find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags) { - if (res.is_null()) + if (p_res.is_null()) return false; - if (processed.has(res)) { + if (processed.has(p_res)) { - return processed[res]; + return processed[p_res]; } - bool changed = res->is_edited(); - res->set_edited(false); + bool changed = p_res->is_edited(); + p_res->set_edited(false); - bool subchanged = _find_and_save_edited_subresources(res.ptr(), processed, flags); + bool subchanged = _find_and_save_edited_subresources(p_res.ptr(), processed, flags); - //print_line("checking if edited: "+res->get_type()+" :: "+res->get_name()+" :: "+res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged)); + //print_line("checking if edited: "+p_res->get_type()+" :: "+p_res->get_name()+" :: "+p_res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged)); - if (res->get_path().is_resource_file()) { + if (p_res->get_path().is_resource_file()) { if (changed || subchanged) { //save - print_line("Also saving modified external resource: " + res->get_path()); - ResourceSaver::save(res->get_path(), res, flags); + print_line("Also saving modified external resource: " + p_res->get_path()); + ResourceSaver::save(p_res->get_path(), p_res, flags); } - processed[res] = false; //because it's a file + processed[p_res] = false; //because it's a file return false; } else { - processed[res] = changed; + processed[p_res] = changed; return changed; } } @@ -1246,7 +1264,7 @@ void EditorNode::_dialog_action(String p_file) { } } else { - ml.instance(); + ml = Ref<TileSet>(memnew(TileSet)); } TileSetEditor::update_library_file(editor_data.get_edited_scene_root(), ml, true); @@ -1285,7 +1303,7 @@ void EditorNode::_dialog_action(String p_file) { Ref<ConfigFile> config; config.instance(); - Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg")); + Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); if (err == ERR_CANT_OPEN) { config.instance(); // new config @@ -1296,7 +1314,7 @@ void EditorNode::_dialog_action(String p_file) { _save_docks_to_config(config, p_file); - config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg")); + config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); layout_dialog->hide(); _update_layouts_menu(); @@ -1313,7 +1331,7 @@ void EditorNode::_dialog_action(String p_file) { Ref<ConfigFile> config; config.instance(); - Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg")); + Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); if (err != OK || !config->has_section(p_file)) { show_warning(TTR("Layout name not found!")); @@ -1327,7 +1345,7 @@ void EditorNode::_dialog_action(String p_file) { config->set_value(p_file, E->get(), Variant()); } - config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg")); + config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); layout_dialog->hide(); _update_layouts_menu(); @@ -3774,9 +3792,9 @@ void EditorNode::progress_add_task(const String &p_task, const String &p_label, singleton->progress_dialog->add_task(p_task, p_label, p_steps); } -void EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_redraw) { +void EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) { - singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_redraw); + singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_refresh); } void EditorNode::progress_end_task(const String &p_task) { @@ -3844,9 +3862,9 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) { Vector<EditorNodeInitCallback> EditorNode::_init_callbacks; -Error EditorNode::export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) { +Error EditorNode::export_preset(const String &preset, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) { - export_defer.platform = p_platform; + export_defer.preset = preset; export_defer.path = p_path; export_defer.debug = p_debug; export_defer.password = p_password; @@ -4313,7 +4331,7 @@ void EditorNode::_update_layouts_menu() { Ref<ConfigFile> config; config.instance(); - Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg")); + Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); if (err != OK) { return; //no config } @@ -4361,7 +4379,7 @@ void EditorNode::_layout_menu_option(int p_id) { Ref<ConfigFile> config; config.instance(); - Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg")); + Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg")); if (err != OK) { return; //no config } @@ -4907,13 +4925,19 @@ void EditorNode::dim_editor(bool p_dimming) { static int dim_count = 0; bool dim_ui = EditorSettings::get_singleton()->get("interface/dim_editor_on_dialog_popup"); if (p_dimming) { - if (dim_ui && dim_count == 0) - _start_dimming(true); - dim_count++; + if (dim_ui) { + if (dim_count == 0) { + _start_dimming(true); + } + dim_count++; + } } else { - dim_count--; - if (dim_count < 1) + if (dim_count == 1) { _start_dimming(false); + dim_count = 0; + } else if (dim_ui && dim_count > 0) { + dim_count--; + } } } diff --git a/editor/editor_node.h b/editor/editor_node.h index a440aaa1e6..cf6ef33325 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -539,7 +539,7 @@ private: } struct ExportDefer { - String platform; + String preset; String path; bool debug; String password; @@ -581,7 +581,7 @@ private: void _update_top_menu_visibility(); void _update_layouts_menu(); - void _layout_menu_option(int p_idx); + void _layout_menu_option(int p_id); void _toggle_search_bar(bool p_pressed); void _clear_search_box(); @@ -742,7 +742,7 @@ public: void show_warning(const String &p_text, const String &p_title = "Warning!"); - Error export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false); + Error export_preset(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false); static void register_editor_types(); static void unregister_editor_types(); diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 0baa373b42..77c5501b25 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -134,7 +134,7 @@ public: virtual void make_visible(bool p_visible); virtual void selected_notify() {} //notify that it was raised by the user, not the editor virtual void edit(Object *p_object); - virtual bool handles(Object *p_node) const; + virtual bool handles(Object *p_object) const; virtual Dictionary get_state() const; //save editor state so it can't be reloaded when reloading scene virtual void set_state(const Dictionary &p_state); //restore editor state (likely was saved with the scene) virtual void clear(); // clear any temporary data in te editor, reset it (likely new scene or load another scene) diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h index 1bfa094a38..cedd571194 100644 --- a/editor/editor_resource_preview.h +++ b/editor/editor_resource_preview.h @@ -115,8 +115,8 @@ public: static EditorResourcePreview *get_singleton(); //callback function is callback(String p_path,Ref<Texture> preview,Variant udata) preview null if could not load - void queue_resource_preview(const String &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata); - void queue_edited_resource_preview(const Ref<Resource> &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata); + void queue_resource_preview(const String &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata); + void queue_edited_resource_preview(const Ref<Resource> &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata); void add_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator); void remove_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 07af60d634..70367f1e07 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -843,9 +843,9 @@ void EditorSettings::add_property_hint(const PropertyInfo &p_hint) { hints[p_hint.name] = p_hint; } -void EditorSettings::set_favorite_dirs(const Vector<String> &p_favorites) { +void EditorSettings::set_favorite_dirs(const Vector<String> &p_favorites_dirs) { - favorite_dirs = p_favorites; + favorite_dirs = p_favorites_dirs; FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("favorite_dirs"), FileAccess::WRITE); if (f) { for (int i = 0; i < favorite_dirs.size(); i++) @@ -859,9 +859,9 @@ Vector<String> EditorSettings::get_favorite_dirs() const { return favorite_dirs; } -void EditorSettings::set_recent_dirs(const Vector<String> &p_recent) { +void EditorSettings::set_recent_dirs(const Vector<String> &p_recent_dirs) { - recent_dirs = p_recent; + recent_dirs = p_recent_dirs; FileAccess *f = FileAccess::open(get_project_settings_path().plus_file("recent_dirs"), FileAccess::WRITE); if (f) { for (int i = 0; i < recent_dirs.size(); i++) diff --git a/editor/editor_settings.h b/editor/editor_settings.h index d5adb84b63..a99d7e0ad5 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -145,7 +145,7 @@ public: void add_property_hint(const PropertyInfo &p_hint); - void set_favorite_dirs(const Vector<String> &p_favorite_dirs); + void set_favorite_dirs(const Vector<String> &p_favorites_dirs); Vector<String> get_favorite_dirs() const; void set_recent_dirs(const Vector<String> &p_recent_dirs); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 93abe219f3..11150371d2 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -447,6 +447,7 @@ Ref<Theme> create_editor_theme() { theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0)); theme->set_stylebox("grabber", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabber", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2)); theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberHl", "EditorIcons"), 5, 5, 5, 5, 2, 2, 2, 2)); + theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberPressed", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2)); theme->set_icon("increment", "HScrollBar", empty_icon); theme->set_icon("increment_highlight", "HScrollBar", empty_icon); @@ -458,6 +459,7 @@ Ref<Theme> create_editor_theme() { theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0)); theme->set_stylebox("grabber", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabber", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2)); theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberHl", "EditorIcons"), 5, 5, 5, 5, 2, 2, 2, 2)); + theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(theme->get_icon("GuiScrollGrabberPressed", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2)); theme->set_icon("increment", "VScrollBar", empty_icon); theme->set_icon("increment_highlight", "VScrollBar", empty_icon); diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index 77898aa6c2..2ec0c38815 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -158,7 +158,7 @@ private: void _favorites_pressed(); void _open_pressed(); - void _dir_rmb_pressed(const Vector2 &local_mouse_pos); + void _dir_rmb_pressed(const Vector2 &p_pos); void _search_changed(const String &p_text); void _files_list_rmb_select(int p_item, const Vector2 &p_pos); diff --git a/editor/icons/2x/icon_editor_control_anchor.png b/editor/icons/2x/icon_editor_control_anchor.png Binary files differnew file mode 100644 index 0000000000..838f85b763 --- /dev/null +++ b/editor/icons/2x/icon_editor_control_anchor.png diff --git a/editor/icons/icon_GUI_scroll_grabber_pressed.png b/editor/icons/icon_GUI_scroll_grabber_pressed.png Binary files differnew file mode 100644 index 0000000000..a46d242ddd --- /dev/null +++ b/editor/icons/icon_GUI_scroll_grabber_pressed.png diff --git a/editor/icons/icon_editor_control_anchor.png b/editor/icons/icon_editor_control_anchor.png Binary files differnew file mode 100644 index 0000000000..158dd62a7b --- /dev/null +++ b/editor/icons/icon_editor_control_anchor.png diff --git a/editor/icons/source/icon_GUI_scroll_grabber_pressed.svg b/editor/icons/source/icon_GUI_scroll_grabber_pressed.svg new file mode 100644 index 0000000000..852e985c4c --- /dev/null +++ b/editor/icons/source/icon_GUI_scroll_grabber_pressed.svg @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="12" + height="12" + viewBox="0 0 12 11.999999" + id="svg2" + version="1.1" + inkscape:version="0.48.4 r9939" + sodipodi:docname="icon_GUI_scroll_grabber_pressed.svg" + inkscape:export-filename="D:\HDD Documents\Other Projects\godot\editor\icons\icon_GUI_scroll_grabber_pressed.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="69.166667" + inkscape:cx="3.7445783" + inkscape:cy="6" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:object-paths="true" + inkscape:snap-intersection-paths="true" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:window-width="1920" + inkscape:window-height="1017" + inkscape:window-x="-8" + inkscape:window-y="-8" + inkscape:window-maximized="1" + inkscape:snap-nodes="false"> + <inkscape:grid + type="xygrid" + id="grid4136" + empspacing="4" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1040.3623)"> + <circle + style="opacity:1;fill:#afafaf;fill-opacity:0.72941178;stroke:none;stroke-width:2.24999642000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path4239" + cx="6" + cy="1046.3623" + r="2.9999952" + inkscape:export-filename="/mnt/2TB/Development/godot_dev/editor/icons/icon_scroll_grabber_hl.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96" + d="m 8.9999952,1046.3623 c 0,1.6569 -1.3431436,3 -2.9999952,3 -1.6568516,0 -2.9999952,-1.3431 -2.9999952,-3 0,-1.6568 1.3431436,-3 2.9999952,-3 1.6568516,0 2.9999952,1.3432 2.9999952,3 z" /> + </g> +</svg> diff --git a/editor/icons/source/icon_editor_control_anchor.svg b/editor/icons/source/icon_editor_control_anchor.svg new file mode 100644 index 0000000000..473b69d060 --- /dev/null +++ b/editor/icons/source/icon_editor_control_anchor.svg @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + viewBox="0 0 16 16" + id="svg2" + version="1.1" + inkscape:version="0.92.1 r" + inkscape:export-filename="/home/gilles/godot/editor/icons/icon_editor_control_anchor.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96" + sodipodi:docname="icon_editor_control_anchor.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="22.627416" + inkscape:cx="0.71312079" + inkscape:cy="11.175116" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1356" + inkscape:window-height="742" + inkscape:window-x="4" + inkscape:window-y="20" + inkscape:window-maximized="0" + inkscape:pagecheckerboard="true" + showguides="false"> + <inkscape:grid + type="xygrid" + id="grid3336" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1036.3622)"> + <path + style="fill:#a5efac;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" + d="M 8.8320312 6.1445312 A 4 4.0000234 0 0 1 6.140625 8.8300781 L 16 16 L 8.8320312 6.1445312 z " + transform="translate(0,1036.3622)" + id="path7188" /> + <ellipse + r="2" + style="opacity:1;fill:#6e6e6e;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="ellipse4152" + cx="3" + cy="1039.3622" /> + <ellipse + style="fill:#a5efac;fill-opacity:1;stroke:none;stroke-width:0.53333384;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:fill markers stroke" + id="path31" + cx="4" + cy="1040.3622" + rx="4" + ry="4.0000091" /> + <circle + style="fill:#a5efac;fill-opacity:1;stroke:none;stroke-width:0.5333333;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;paint-order:fill markers stroke" + id="path31-3" + cx="5" + cy="1041.3622" + r="0" /> + </g> +</svg> diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 83b94dbf9b..a75147a3a9 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -87,8 +87,8 @@ struct ColladaImport { Error _create_scene_skeletons(Collada::Node *p_node); Error _create_scene(Collada::Node *p_node, Spatial *p_parent); Error _create_resources(Collada::Node *p_node); - Error _create_material(const String &p_material); - Error _create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes = Vector<Ref<ArrayMesh> >(), bool p_for_morph = false, bool p_use_mesh_material = false); + Error _create_material(const String &p_target); + Error _create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes = Vector<Ref<ArrayMesh> >(), bool p_for_morph = false, bool p_use_mesh_material = false); Error load(const String &p_path, int p_flags, bool p_force_make_tangents = false); void _fix_param_animation_tracks(); void create_animation(int p_clip, bool p_make_tracks_in_all_bones, bool p_import_value_tracks); @@ -591,7 +591,7 @@ static void _generate_tangents_and_binormals(const PoolVector<int> &p_indices, c } } -Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes, bool p_for_morph, bool p_use_mesh_material) { +Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<ArrayMesh> > p_morph_meshes, bool p_for_morph, bool p_use_mesh_material) { bool local_xform_mirror = p_local_xform.basis.determinant() < 0; @@ -714,35 +714,35 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me bool has_weights = false; - if (skin_controller) { + if (p_skin_controller) { const Collada::SkinControllerData::Source *weight_src = NULL; int weight_ofs = 0; - if (skin_controller->weights.sources.has("WEIGHT")) { + if (p_skin_controller->weights.sources.has("WEIGHT")) { - String weight_id = skin_controller->weights.sources["WEIGHT"].source; - weight_ofs = skin_controller->weights.sources["WEIGHT"].offset; - if (skin_controller->sources.has(weight_id)) { + String weight_id = p_skin_controller->weights.sources["WEIGHT"].source; + weight_ofs = p_skin_controller->weights.sources["WEIGHT"].offset; + if (p_skin_controller->sources.has(weight_id)) { - weight_src = &skin_controller->sources[weight_id]; + weight_src = &p_skin_controller->sources[weight_id]; } } int joint_ofs = 0; - if (skin_controller->weights.sources.has("JOINT")) { + if (p_skin_controller->weights.sources.has("JOINT")) { - joint_ofs = skin_controller->weights.sources["JOINT"].offset; + joint_ofs = p_skin_controller->weights.sources["JOINT"].offset; } //should be OK, given this was pre-checked. int index_ofs = 0; - int wstride = skin_controller->weights.sources.size(); - for (int w_i = 0; w_i < skin_controller->weights.sets.size(); w_i++) { + int wstride = p_skin_controller->weights.sources.size(); + for (int w_i = 0; w_i < p_skin_controller->weights.sets.size(); w_i++) { - int amount = skin_controller->weights.sets[w_i]; + int amount = p_skin_controller->weights.sets[w_i]; Vector<Collada::Vertex::Weight> weights; @@ -751,13 +751,13 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me Collada::Vertex::Weight w; int read_from = index_ofs + a_i * wstride; - ERR_FAIL_INDEX_V(read_from + wstride - 1, skin_controller->weights.indices.size(), ERR_INVALID_DATA); - int weight_index = skin_controller->weights.indices[read_from + weight_ofs]; + ERR_FAIL_INDEX_V(read_from + wstride - 1, p_skin_controller->weights.indices.size(), ERR_INVALID_DATA); + int weight_index = p_skin_controller->weights.indices[read_from + weight_ofs]; ERR_FAIL_INDEX_V(weight_index, weight_src->array.size(), ERR_INVALID_DATA); w.weight = weight_src->array[weight_index]; - int bone_index = skin_controller->weights.indices[read_from + joint_ofs]; + int bone_index = p_skin_controller->weights.indices[read_from + joint_ofs]; if (bone_index == -1) continue; //ignore this weight (refers to bind shape) ERR_FAIL_INDEX_V(bone_index, bone_remap.size(), ERR_INVALID_DATA); diff --git a/editor/io_plugins/editor_scene_import_plugin.cpp b/editor/io_plugins/editor_scene_import_plugin.cpp index aa96f731ce..1890ca906a 100644 --- a/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/editor/io_plugins/editor_scene_import_plugin.cpp @@ -1307,7 +1307,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce //confirm_import->set_child_rect(cvb); PanelContainer *pc = memnew( PanelContainer ); - pc->add_style_override("panel",get_stylebox("normal","TextEdit")); + pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal","TextEdit")); //ec->add_child(pc); missing_files = memnew( RichTextLabel ); cvb->add_margin_child(TTR("The Following Files are Missing:"),pc,true); diff --git a/editor/output_strings.cpp b/editor/output_strings.cpp index eb2fc62f03..8c9f8386ef 100644 --- a/editor/output_strings.cpp +++ b/editor/output_strings.cpp @@ -38,15 +38,15 @@ void OutputStrings::update_scrollbars() { v_scroll->set_anchor(MARGIN_RIGHT, ANCHOR_END); v_scroll->set_anchor(MARGIN_BOTTOM, ANCHOR_END); - v_scroll->set_begin(Point2(vmin.width, 0)); + v_scroll->set_begin(Point2(-vmin.width, 0)); v_scroll->set_end(Point2(0, 0)); h_scroll->set_anchor(MARGIN_RIGHT, ANCHOR_END); h_scroll->set_anchor(MARGIN_TOP, ANCHOR_END); h_scroll->set_anchor(MARGIN_BOTTOM, ANCHOR_END); - h_scroll->set_begin(Point2(0, hmin.y)); - h_scroll->set_end(Point2(vmin.x, 0)); + h_scroll->set_begin(Point2(0, -hmin.y)); + h_scroll->set_end(Point2(-vmin.x, 0)); margin.y = hmin.y; margin.x = vmin.x; diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index c4e79bf263..ecae272b6d 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -1246,7 +1246,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { set_focus_mode(FOCUS_ALL); player = NULL; - add_style_override("panel", get_stylebox("panel", "Panel")); + add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); Label *l; diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h index ceaa73569a..bcf40f52d3 100644 --- a/editor/plugins/animation_player_editor_plugin.h +++ b/editor/plugins/animation_player_editor_plugin.h @@ -155,7 +155,7 @@ class AnimationPlayerEditor : public VBoxContainer { void _animation_player_changed(Object *p_pl); void _animation_key_editor_seek(float p_pos, bool p_drag); - void _animation_key_editor_anim_len_changed(float p_new); + void _animation_key_editor_anim_len_changed(float p_len); void _animation_key_editor_anim_step_changed(float p_len); void _unhandled_key_input(const Ref<InputEvent> &p_ev); @@ -198,8 +198,8 @@ public: virtual String get_name() const { return "Anim"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); AnimationPlayerEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 156a74144c..6e24d4d2cb 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -676,16 +676,16 @@ AnimationTreeEditor::ClickType AnimationTreeEditor::_locate_click(const Point2 & return CLICK_NONE; } -Point2 AnimationTreeEditor::_get_slot_pos(const StringName &p_node, bool p_input, int p_slot) { +Point2 AnimationTreeEditor::_get_slot_pos(const StringName &p_node_id, bool p_input, int p_slot) { Ref<StyleBox> style = get_stylebox("panel", "PopupMenu"); Ref<Font> font = get_font("font", "PopupMenu"); Ref<Texture> slot_icon = get_icon("NodeRealSlot", "EditorIcons"); - Size2 size = get_node_size(p_node); - Point2 pos = anim_tree->node_get_pos(p_node); + Size2 size = get_node_size(p_node_id); + Point2 pos = anim_tree->node_get_pos(p_node_id); - if (click_type == CLICK_NODE && click_node == p_node) { + if (click_type == CLICK_NODE && click_node == p_node_id) { pos += click_motion - click_pos; if (pos.x < 5) @@ -1371,7 +1371,7 @@ AnimationTreeEditor::AnimationTreeEditor() { edit_option = memnew(OptionButton); edit_option->set_anchor(MARGIN_RIGHT, ANCHOR_END); - edit_option->set_margin(MARGIN_RIGHT, 10); + edit_option->set_margin(MARGIN_RIGHT, -10); edit_dialog->add_child(edit_option); edit_option->connect("item_selected", this, "_edit_dialog_changedf"); edit_option->hide(); @@ -1379,7 +1379,7 @@ AnimationTreeEditor::AnimationTreeEditor() { for (int i = 0; i < 2; i++) { edit_scroll[i] = memnew(HSlider); edit_scroll[i]->set_anchor(MARGIN_RIGHT, ANCHOR_END); - edit_scroll[i]->set_margin(MARGIN_RIGHT, 10); + edit_scroll[i]->set_margin(MARGIN_RIGHT, -10); edit_dialog->add_child(edit_scroll[i]); edit_scroll[i]->hide(); edit_scroll[i]->connect("value_changed", this, "_edit_dialog_changedf"); @@ -1387,7 +1387,7 @@ AnimationTreeEditor::AnimationTreeEditor() { for (int i = 0; i < 4; i++) { edit_line[i] = memnew(LineEdit); edit_line[i]->set_anchor(MARGIN_RIGHT, ANCHOR_END); - edit_line[i]->set_margin(MARGIN_RIGHT, 10); + edit_line[i]->set_margin(MARGIN_RIGHT, -10); edit_dialog->add_child(edit_line[i]); edit_line[i]->hide(); edit_line[i]->connect("text_changed", this, "_edit_dialog_changeds"); @@ -1399,14 +1399,14 @@ AnimationTreeEditor::AnimationTreeEditor() { edit_button = memnew(Button); edit_button->set_anchor(MARGIN_RIGHT, ANCHOR_END); - edit_button->set_margin(MARGIN_RIGHT, 10); + edit_button->set_margin(MARGIN_RIGHT, -10); edit_dialog->add_child(edit_button); edit_button->hide(); edit_button->connect("pressed", this, "_edit_oneshot_start"); edit_check = memnew(CheckButton); edit_check->set_anchor(MARGIN_RIGHT, ANCHOR_END); - edit_check->set_margin(MARGIN_RIGHT, 10); + edit_check->set_margin(MARGIN_RIGHT, -10); edit_dialog->add_child(edit_check); edit_check->hide(); edit_check->connect("pressed", this, "_edit_dialog_changed"); @@ -1428,7 +1428,7 @@ AnimationTreeEditor::AnimationTreeEditor() { filter_button = memnew(Button); filter_button->set_anchor(MARGIN_RIGHT, ANCHOR_END); - filter_button->set_margin(MARGIN_RIGHT, 10); + filter_button->set_margin(MARGIN_RIGHT, -10); edit_dialog->add_child(filter_button); filter_button->hide(); filter_button->set_text(TTR("Filters..")); diff --git a/editor/plugins/animation_tree_editor_plugin.h b/editor/plugins/animation_tree_editor_plugin.h index 785f042dd9..972c6c9b47 100644 --- a/editor/plugins/animation_tree_editor_plugin.h +++ b/editor/plugins/animation_tree_editor_plugin.h @@ -160,7 +160,7 @@ protected: public: virtual Size2 get_minimum_size() const; - void edit(AnimationTreePlayer *p_player); + void edit(AnimationTreePlayer *p_anim_tree); AnimationTreeEditor(); }; @@ -175,8 +175,8 @@ class AnimationTreeEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "AnimTree"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); AnimationTreeEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/camera_editor_plugin.cpp b/editor/plugins/camera_editor_plugin.cpp index b8f8464bae..8e625c4a73 100644 --- a/editor/plugins/camera_editor_plugin.cpp +++ b/editor/plugins/camera_editor_plugin.cpp @@ -88,7 +88,7 @@ CameraEditor::CameraEditor() { preview->set_toggle_mode(true); preview->set_anchor(MARGIN_LEFT, Control::ANCHOR_END); preview->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END); - preview->set_margin(MARGIN_LEFT, 60); + preview->set_margin(MARGIN_LEFT, -60); preview->set_margin(MARGIN_RIGHT, 0); preview->set_margin(MARGIN_TOP, 0); preview->set_margin(MARGIN_BOTTOM, 10); diff --git a/editor/plugins/camera_editor_plugin.h b/editor/plugins/camera_editor_plugin.h index f4b26fcdac..a0f98687cb 100644 --- a/editor/plugins/camera_editor_plugin.h +++ b/editor/plugins/camera_editor_plugin.h @@ -68,8 +68,8 @@ class CameraEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "Camera"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); CameraEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index a35d7a9a50..9e57e53a24 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -709,8 +709,8 @@ CanvasItem *CanvasItemEditor::get_single_item() { return single_item; } -CanvasItemEditor::DragType CanvasItemEditor::_find_drag_type(const Point2 &p_click, Vector2 &r_point) { - +CanvasItemEditor::DragType CanvasItemEditor::_get_resize_handle_drag_type(const Point2 &p_click, Vector2 &r_point) { + // Returns a drag type if a resize handle is clicked CanvasItem *canvas_item = get_single_item(); ERR_FAIL_COND_V(!canvas_item, DRAG_NONE); @@ -775,6 +775,90 @@ CanvasItemEditor::DragType CanvasItemEditor::_find_drag_type(const Point2 &p_cli return DRAG_NONE; } +float CanvasItemEditor::_anchor_snap(float p_anchor, bool *p_snapped, float p_opposite_anchor) { + bool snapped = false; + float dist, dist_min = 0.0; + float radius = 0.05 / zoom; + float basic_anchors[3] = { 0.0, 0.5, 1.0 }; + for (int i = 0; i < 3; i++) { + if ((dist = fabs(p_anchor - basic_anchors[i])) < radius) { + if (!snapped || dist <= dist_min) { + p_anchor = basic_anchors[i]; + dist_min = dist; + snapped = true; + } + } + } + if (p_opposite_anchor >= 0 && (dist = fabs(p_anchor - p_opposite_anchor)) < radius) { + if (!snapped || dist <= dist_min) { + p_anchor = p_opposite_anchor; + dist_min = dist; + snapped = true; + } + } + if (p_snapped) + *p_snapped = snapped; + return p_anchor; +} + +Vector2 CanvasItemEditor::_anchor_to_position(Control *p_control, Vector2 anchor) { + ERR_FAIL_COND_V(!p_control, Vector2()); + + Transform2D parent_transform = p_control->get_transform().affine_inverse(); + Size2 parent_size = p_control->get_parent_area_size(); + + return parent_transform.xform(Vector2(parent_size.x * anchor.x, parent_size.y * anchor.y)); +} + +Vector2 CanvasItemEditor::_position_to_anchor(Control *p_control, Vector2 position) { + ERR_FAIL_COND_V(!p_control, Vector2()); + Size2 parent_size = p_control->get_parent_area_size(); + + return p_control->get_transform().xform(position) / parent_size; +} + +CanvasItemEditor::DragType CanvasItemEditor::_get_anchor_handle_drag_type(const Point2 &p_click, Vector2 &r_point) { + // Returns a drag type if an anchor handle is clicked + CanvasItem *canvas_item = get_single_item(); + ERR_FAIL_COND_V(!canvas_item, DRAG_NONE); + + Control *control = canvas_item->cast_to<Control>(); + ERR_FAIL_COND_V(!control, DRAG_NONE); + + Vector2 anchor_pos[4]; + anchor_pos[0] = Vector2(control->get_anchor(MARGIN_LEFT), control->get_anchor(MARGIN_TOP)); + anchor_pos[1] = Vector2(control->get_anchor(MARGIN_RIGHT), control->get_anchor(MARGIN_TOP)); + anchor_pos[2] = Vector2(control->get_anchor(MARGIN_RIGHT), control->get_anchor(MARGIN_BOTTOM)); + anchor_pos[3] = Vector2(control->get_anchor(MARGIN_LEFT), control->get_anchor(MARGIN_BOTTOM)); + + Rect2 anchor_rects[4]; + for (int i = 0; i < 4; i++) { + anchor_pos[i] = (transform * control->get_global_transform_with_canvas()).xform(_anchor_to_position(control, anchor_pos[i])); + anchor_rects[i] = Rect2(anchor_pos[i], anchor_handle->get_size()); + anchor_rects[i].position -= anchor_handle->get_size() * Vector2(i == 0 || i == 3, i <= 1); + } + + DragType dragger[] = { + DRAG_ANCHOR_TOP_LEFT, + DRAG_ANCHOR_TOP_RIGHT, + DRAG_ANCHOR_BOTTOM_RIGHT, + DRAG_ANCHOR_BOTTOM_LEFT, + }; + + for (int i = 0; i < 4; i++) { + if (anchor_rects[i].has_point(p_click)) { + r_point = transform.affine_inverse().xform(anchor_pos[i]); + if ((anchor_pos[0] == anchor_pos[2]) && (anchor_pos[0].distance_to(p_click) < anchor_handle->get_size().length() / 3.0)) { + return DRAG_ANCHOR_ALL; + } else { + return dragger[i]; + } + } + } + + return DRAG_NONE; +} + void CanvasItemEditor::_prepare_drag(const Point2 &p_click_pos) { List<Node *> &selection = editor_selection->get_selected_node_list(); @@ -863,9 +947,9 @@ void CanvasItemEditor::incend(float &beg, float &end, float inc, float minsize, } } -void CanvasItemEditor::_append_canvas_item(CanvasItem *c) { +void CanvasItemEditor::_append_canvas_item(CanvasItem *p_item) { - editor_selection->add_node(c); + editor_selection->add_node(p_item); } void CanvasItemEditor::_snap_changed() { @@ -1265,6 +1349,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { if (b) { bool ik_found = false; + bool first = true; while (b) { @@ -1336,8 +1421,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { } } - // Drag - drag = _find_drag_type(click, drag_point_from); + // Drag resize handles + drag = _get_resize_handle_drag_type(click, drag_point_from); if (drag != DRAG_NONE) { drag_from = transform.affine_inverse().xform(click); se->undo_state = canvas_item->edit_get_state(); @@ -1347,6 +1432,16 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { se->undo_pivot = canvas_item->cast_to<Control>()->get_pivot_offset(); return; } + + // Drag anchor handles + if (canvas_item->cast_to<Control>()) { + drag = _get_anchor_handle_drag_type(click, drag_point_from); + if (drag != DRAG_NONE) { + drag_from = transform.affine_inverse().xform(click); + se->undo_state = canvas_item->edit_get_state(); + return; + } + } } } @@ -1423,9 +1518,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { } if (drag == DRAG_NONE) { - if ((m->get_button_mask() & BUTTON_MASK_LEFT && tool == TOOL_PAN) || m->get_button_mask() & BUTTON_MASK_MIDDLE || (m->get_button_mask() & BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE))) { - + // Pan the viewport Point2i relative; if (bool(EditorSettings::get_singleton()->get("editors/2d/warped_mouse_panning"))) { relative = Input::get_singleton()->warp_mouse_motion(m, viewport->get_global_rect()); @@ -1441,7 +1535,6 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { } List<Node *> &selection = editor_selection->get_selected_node_list(); - for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>(); @@ -1470,7 +1563,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { continue; if (drag == DRAG_ROTATE) { - + // Rotate the node Vector2 center = canvas_item->get_global_transform_with_canvas().get_origin(); { Node2D *node = canvas_item->cast_to<Node2D>(); @@ -1499,10 +1592,47 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { continue; } + Control *control = canvas_item->cast_to<Control>(); + if (control) { + // Drag and snap the anchor + Vector2 anchor = _position_to_anchor(control, canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dto - drag_from + drag_point_from)); + + switch (drag) { + case DRAG_ANCHOR_TOP_LEFT: + control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_RIGHT)), false, false); + control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_BOTTOM)), false, false); + continue; + break; + case DRAG_ANCHOR_TOP_RIGHT: + control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_LEFT)), false, false); + control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_BOTTOM)), false, false); + continue; + break; + case DRAG_ANCHOR_BOTTOM_RIGHT: + control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_LEFT)), false, false); + control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_TOP)), false, false); + continue; + break; + case DRAG_ANCHOR_BOTTOM_LEFT: + control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x, NULL, control->get_anchor(MARGIN_RIGHT)), false, false); + control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y, NULL, control->get_anchor(MARGIN_TOP)), false, false); + continue; + break; + case DRAG_ANCHOR_ALL: + control->set_anchor(MARGIN_LEFT, _anchor_snap(anchor.x)); + control->set_anchor(MARGIN_RIGHT, _anchor_snap(anchor.x)); + control->set_anchor(MARGIN_TOP, _anchor_snap(anchor.y)); + control->set_anchor(MARGIN_BOTTOM, _anchor_snap(anchor.y)); + continue; + break; + } + } + bool uniform = m->get_shift(); bool symmetric = m->get_alt(); - dto = dto - (drag == DRAG_ALL || drag == DRAG_NODE_2D ? drag_from - drag_point_from : Vector2(0, 0)); + if (drag == DRAG_ALL || drag == DRAG_NODE_2D) + dto -= drag_from - drag_point_from; if (uniform && (drag == DRAG_ALL || drag == DRAG_NODE_2D)) { if (ABS(dto.x - drag_point_from.x) > ABS(dto.y - drag_point_from.y)) { @@ -1528,76 +1658,75 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { // Keep the height/width ratio of the item float aspect = local_rect.size.aspect(); switch (drag) { - case DRAG_LEFT: { + case DRAG_LEFT: drag_vector.y = -drag_vector.x / aspect; - } break; - case DRAG_RIGHT: { + break; + case DRAG_RIGHT: drag_vector.y = drag_vector.x / aspect; - } break; - case DRAG_TOP: { + break; + case DRAG_TOP: drag_vector.x = -drag_vector.y * aspect; - } break; - case DRAG_BOTTOM: { + break; + case DRAG_BOTTOM: drag_vector.x = drag_vector.y * aspect; - } break; + break; case DRAG_BOTTOM_LEFT: - case DRAG_TOP_RIGHT: { + case DRAG_TOP_RIGHT: if (aspect > 1.0) { // width > height, take x as reference drag_vector.y = -drag_vector.x / aspect; } else { // height > width, take y as reference drag_vector.x = -drag_vector.y * aspect; } - } break; + break; case DRAG_BOTTOM_RIGHT: - case DRAG_TOP_LEFT: { + case DRAG_TOP_LEFT: if (aspect > 1.0) { // width > height, take x as reference drag_vector.y = drag_vector.x / aspect; } else { // height > width, take y as reference drag_vector.x = drag_vector.y * aspect; } - } break; + break; } } else { switch (drag) { case DRAG_RIGHT: - case DRAG_LEFT: { + case DRAG_LEFT: drag_vector.y = 0; - } break; + break; case DRAG_TOP: - case DRAG_BOTTOM: { + case DRAG_BOTTOM: drag_vector.x = 0; - } break; + break; } } switch (drag) { - case DRAG_ALL: { + case DRAG_ALL: begin += drag_vector; end += drag_vector; - } break; + break; case DRAG_RIGHT: case DRAG_BOTTOM: - case DRAG_BOTTOM_RIGHT: { + case DRAG_BOTTOM_RIGHT: incend(begin.x, end.x, drag_vector.x, minsize.x, symmetric); incend(begin.y, end.y, drag_vector.y, minsize.y, symmetric); - } break; - - case DRAG_TOP_LEFT: { + break; + case DRAG_TOP_LEFT: incbeg(begin.x, end.x, drag_vector.x, minsize.x, symmetric); incbeg(begin.y, end.y, drag_vector.y, minsize.y, symmetric); - } break; - + break; case DRAG_TOP: - case DRAG_TOP_RIGHT: { + case DRAG_TOP_RIGHT: incbeg(begin.y, end.y, drag_vector.y, minsize.y, symmetric); incend(begin.x, end.x, drag_vector.x, minsize.x, symmetric); - } break; + break; case DRAG_LEFT: - case DRAG_BOTTOM_LEFT: { + case DRAG_BOTTOM_LEFT: incbeg(begin.x, end.x, drag_vector.x, minsize.x, symmetric); incend(begin.y, end.y, drag_vector.y, minsize.y, symmetric); - } break; - case DRAG_PIVOT: { + break; + + case DRAG_PIVOT: if (canvas_item->cast_to<Node2D>()) { Node2D *n2d = canvas_item->cast_to<Node2D>(); @@ -1607,15 +1736,13 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { canvas_item->cast_to<Control>()->set_pivot_offset(se->undo_pivot + drag_vector); } continue; - } break; - case DRAG_NODE_2D: { + break; + case DRAG_NODE_2D: ERR_FAIL_COND(!canvas_item->cast_to<Node2D>()); canvas_item->cast_to<Node2D>()->set_global_position(dto); continue; - } break; - - default: {} + break; } if (!dragging_bone) { @@ -1768,6 +1895,30 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) { } } +void CanvasItemEditor::_draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side) { + if (p_value != 0) { + Color color = Color(0.8, 0.8, 0.8, 0.5); + Ref<Font> font = get_font("font", "Label"); + String str = vformat("%.1f %%", p_value * 100.0); + Size2 text_size = font->get_string_size(str); + switch (p_side) { + case MARGIN_LEFT: + p_position += Vector2(-text_size.x - 5, text_size.y / 2); + break; + case MARGIN_TOP: + p_position += Vector2(-text_size.x / 2, -5); + break; + case MARGIN_RIGHT: + p_position += Vector2(5, text_size.y / 2); + break; + case MARGIN_BOTTOM: + p_position += Vector2(-text_size.x / 2, text_size.y + 5); + break; + } + viewport->draw_string(font, p_position, str, color); + } +} + void CanvasItemEditor::_viewport_draw() { // TODO fetch the viewport? @@ -1870,13 +2021,99 @@ void CanvasItemEditor::_viewport_draw() { pivot_found = true; } } - if (canvas_item->cast_to<Control>()) { - Vector2 pivot_ofs = canvas_item->cast_to<Control>()->get_pivot_offset(); + + Control *control = canvas_item->cast_to<Control>(); + if (control) { + Vector2 pivot_ofs = control->get_pivot_offset(); if (pivot_ofs != Vector2()) { viewport->draw_texture(pivot, xform.xform(pivot_ofs) + (-pivot->get_size() / 2).floor()); } can_move_pivot = true; pivot_found = true; + + if (tool == TOOL_SELECT) { + float anchors_values[4]; + anchors_values[0] = control->get_anchor(MARGIN_LEFT); + anchors_values[1] = control->get_anchor(MARGIN_TOP); + anchors_values[2] = control->get_anchor(MARGIN_RIGHT); + anchors_values[3] = control->get_anchor(MARGIN_BOTTOM); + + // Draw the anchors + Vector2 anchors[4]; + Vector2 anchors_pos[4]; + for (int i = 0; i < 4; i++) { + anchors[i] = Vector2((i % 2 == 0) ? anchors_values[i] : anchors_values[(i + 1) % 4], (i % 2 == 1) ? anchors_values[i] : anchors_values[(i + 1) % 4]); + anchors_pos[i] = xform.xform(_anchor_to_position(control, anchors[i])); + } + + // Get which anchor is dragged + int dragged_anchor = -1; + switch (drag) { + case DRAG_ANCHOR_ALL: + case DRAG_ANCHOR_TOP_LEFT: + dragged_anchor = 0; + break; + case DRAG_ANCHOR_TOP_RIGHT: + dragged_anchor = 1; + break; + case DRAG_ANCHOR_BOTTOM_RIGHT: + dragged_anchor = 2; + break; + case DRAG_ANCHOR_BOTTOM_LEFT: + dragged_anchor = 3; + break; + } + + if (dragged_anchor >= 0) { + // Draw the 4 lines when dragged + bool snapped; + Color color_snapped = Color(0.64, 0.93, 0.67, 0.5); + Color color_base = Color(0.8, 0.8, 0.8, 0.5); + + Vector2 corners_pos[4]; + for (int i = 0; i < 4; i++) { + corners_pos[i] = xform.xform(_anchor_to_position(control, Vector2((i == 0 || i == 3) ? ANCHOR_BEGIN : ANCHOR_END, (i <= 1) ? ANCHOR_BEGIN : ANCHOR_END))); + } + + Vector2 line_starts[4]; + Vector2 line_ends[4]; + for (int i = 0; i < 4; i++) { + float anchor_val = (i >= 2) ? ANCHOR_END - anchors_values[i] : anchors_values[i]; + line_starts[i] = Vector2::linear_interpolate(corners_pos[i], corners_pos[(i + 1) % 4], anchor_val); + line_ends[i] = Vector2::linear_interpolate(corners_pos[(i + 3) % 4], corners_pos[(i + 2) % 4], anchor_val); + _anchor_snap(anchors_values[i], &snapped); + viewport->draw_line(line_starts[i], line_ends[i], snapped ? color_snapped : color_base, (i == dragged_anchor || (i + 3) % 4 == dragged_anchor) ? 2 : 1); + } + + // Display the percentages next to the lines + float percent_val; + percent_val = anchors_values[(dragged_anchor + 2) % 4] - anchors_values[dragged_anchor]; + percent_val = (dragged_anchor >= 2) ? -percent_val : percent_val; + _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 1) % 4]) / 2, (Margin)((dragged_anchor + 1) % 4)); + + percent_val = anchors_values[(dragged_anchor + 3) % 4] - anchors_values[(dragged_anchor + 1) % 4]; + percent_val = ((dragged_anchor + 1) % 4 >= 2) ? -percent_val : percent_val; + _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 3) % 4]) / 2, (Margin)(dragged_anchor)); + + percent_val = anchors_values[(dragged_anchor + 1) % 4]; + percent_val = ((dragged_anchor + 1) % 4 >= 2) ? ANCHOR_END - percent_val : percent_val; + _draw_percentage_at_position(percent_val, (line_starts[dragged_anchor] + anchors_pos[dragged_anchor]) / 2, (Margin)(dragged_anchor)); + + percent_val = anchors_values[dragged_anchor]; + percent_val = (dragged_anchor >= 2) ? ANCHOR_END - percent_val : percent_val; + _draw_percentage_at_position(percent_val, (line_ends[(dragged_anchor + 1) % 4] + anchors_pos[dragged_anchor]) / 2, (Margin)((dragged_anchor + 1) % 4)); + } + + Rect2 anchor_rects[4]; + anchor_rects[0] = Rect2(anchors_pos[0] - anchor_handle->get_size(), anchor_handle->get_size()); + anchor_rects[1] = Rect2(anchors_pos[1] - Vector2(0.0, anchor_handle->get_size().y), Point2(-anchor_handle->get_size().x, anchor_handle->get_size().y)); + anchor_rects[2] = Rect2(anchors_pos[2], -anchor_handle->get_size()); + anchor_rects[3] = Rect2(anchors_pos[3] - Vector2(anchor_handle->get_size().x, 0.0), Point2(anchor_handle->get_size().x, -anchor_handle->get_size().y)); + + for (int i = 0; i < 4; i++) { + anchor_handle->draw_rect(ci, anchor_rects[i]); + } + } } if (tool == TOOL_SELECT) { @@ -2063,29 +2300,34 @@ void CanvasItemEditor::_notification(int p_what) { continue; Rect2 r = canvas_item->get_item_rect(); - Transform2D xform = canvas_item->get_transform(); + float anchors[4]; Vector2 pivot; if (canvas_item->cast_to<Control>()) { pivot = canvas_item->cast_to<Control>()->get_pivot_offset(); + anchors[MARGIN_LEFT] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_LEFT); + anchors[MARGIN_RIGHT] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_RIGHT); + anchors[MARGIN_TOP] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_TOP); + anchors[MARGIN_BOTTOM] = canvas_item->cast_to<Control>()->get_anchor(MARGIN_BOTTOM); } - if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot) { + if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot || anchors[MARGIN_LEFT] != se->prev_anchors[MARGIN_LEFT] || anchors[MARGIN_RIGHT] != se->prev_anchors[MARGIN_RIGHT] || anchors[MARGIN_TOP] != se->prev_anchors[MARGIN_TOP] || anchors[MARGIN_BOTTOM] != se->prev_anchors[MARGIN_BOTTOM]) { viewport->update(); se->prev_rect = r; se->prev_xform = xform; se->prev_pivot = pivot; + se->prev_anchors[MARGIN_LEFT] = anchors[MARGIN_LEFT]; + se->prev_anchors[MARGIN_RIGHT] = anchors[MARGIN_RIGHT]; + se->prev_anchors[MARGIN_TOP] = anchors[MARGIN_TOP]; + se->prev_anchors[MARGIN_BOTTOM] = anchors[MARGIN_BOTTOM]; } } - bool show_anchor = all_control && has_control; - if (show_anchor != anchor_menu->is_visible()) { - if (show_anchor) - anchor_menu->show(); - else - anchor_menu->hide(); - } + if (all_control && has_control) + anchor_menu->show(); + else + anchor_menu->hide(); for (Map<ObjectID, BoneList>::Element *E = bone_list.front(); E; E = E->next()) { @@ -2124,6 +2366,7 @@ void CanvasItemEditor::_notification(int p_what) { pan_button->set_icon(get_icon("ToolPan", "EditorIcons")); pivot_button->set_icon(get_icon("EditPivot", "EditorIcons")); select_handle = get_icon("EditorHandle", "EditorIcons"); + anchor_handle = get_icon("EditorControlAnchor", "EditorIcons"); lock_button->set_icon(get_icon("Lock", "EditorIcons")); unlock_button->set_icon(get_icon("Unlock", "EditorIcons")); group_button->set_icon(get_icon("Group", "EditorIcons")); @@ -2338,7 +2581,7 @@ void CanvasItemEditor::_update_scroll(float) { viewport->update(); } -void CanvasItemEditor::_set_anchor(Control::AnchorType p_left, Control::AnchorType p_top, Control::AnchorType p_right, Control::AnchorType p_bottom) { +void CanvasItemEditor::_set_anchors_preset(Control::LayoutPreset p_preset) { List<Node *> &selection = editor_selection->get_selected_node_list(); undo_redo->create_action(TTR("Change Anchors")); @@ -2346,10 +2589,7 @@ void CanvasItemEditor::_set_anchor(Control::AnchorType p_left, Control::AnchorTy Control *c = E->get()->cast_to<Control>(); - undo_redo->add_do_method(c, "set_anchor", MARGIN_LEFT, p_left); - undo_redo->add_do_method(c, "set_anchor", MARGIN_TOP, p_top); - undo_redo->add_do_method(c, "set_anchor", MARGIN_RIGHT, p_right); - undo_redo->add_do_method(c, "set_anchor", MARGIN_BOTTOM, p_bottom); + undo_redo->add_do_method(c, "set_anchors_preset", p_preset); undo_redo->add_undo_method(c, "set_anchor", MARGIN_LEFT, c->get_anchor(MARGIN_LEFT)); undo_redo->add_undo_method(c, "set_anchor", MARGIN_TOP, c->get_anchor(MARGIN_TOP)); undo_redo->add_undo_method(c, "set_anchor", MARGIN_RIGHT, c->get_anchor(MARGIN_RIGHT)); @@ -2367,10 +2607,7 @@ void CanvasItemEditor::_set_full_rect() { Control *c = E->get()->cast_to<Control>(); - undo_redo->add_do_method(c, "set_anchor", MARGIN_LEFT, ANCHOR_BEGIN); - undo_redo->add_do_method(c, "set_anchor", MARGIN_TOP, ANCHOR_BEGIN); - undo_redo->add_do_method(c, "set_anchor", MARGIN_RIGHT, ANCHOR_END); - undo_redo->add_do_method(c, "set_anchor", MARGIN_BOTTOM, ANCHOR_END); + undo_redo->add_do_method(c, "set_anchors_preset", PRESET_WIDE); undo_redo->add_do_method(c, "set_margin", MARGIN_LEFT, 0); undo_redo->add_do_method(c, "set_margin", MARGIN_TOP, 0); undo_redo->add_do_method(c, "set_margin", MARGIN_RIGHT, 0); @@ -2591,53 +2828,52 @@ void CanvasItemEditor::_popup_callback(int p_op) { //space_selected_items< proj_vector2_y, compare_items_y >(); } break; case ANCHOR_ALIGN_TOP_LEFT: { - _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_BEGIN); + _set_anchors_preset(PRESET_TOP_LEFT); } break; case ANCHOR_ALIGN_TOP_RIGHT: { - _set_anchor(ANCHOR_END, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_BEGIN); + _set_anchors_preset(PRESET_TOP_RIGHT); } break; case ANCHOR_ALIGN_BOTTOM_LEFT: { - _set_anchor(ANCHOR_BEGIN, ANCHOR_END, ANCHOR_BEGIN, ANCHOR_END); + _set_anchors_preset(PRESET_BOTTOM_LEFT); } break; case ANCHOR_ALIGN_BOTTOM_RIGHT: { - _set_anchor(ANCHOR_END, ANCHOR_END, ANCHOR_END, ANCHOR_END); + _set_anchors_preset(PRESET_BOTTOM_RIGHT); } break; case ANCHOR_ALIGN_CENTER_LEFT: { - _set_anchor(ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_BEGIN, ANCHOR_CENTER); + _set_anchors_preset(PRESET_CENTER_LEFT); } break; case ANCHOR_ALIGN_CENTER_RIGHT: { - - _set_anchor(ANCHOR_END, ANCHOR_CENTER, ANCHOR_END, ANCHOR_CENTER); + _set_anchors_preset(PRESET_CENTER_RIGHT); } break; case ANCHOR_ALIGN_CENTER_TOP: { - _set_anchor(ANCHOR_CENTER, ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_BEGIN); + _set_anchors_preset(PRESET_CENTER_TOP); } break; case ANCHOR_ALIGN_CENTER_BOTTOM: { - _set_anchor(ANCHOR_CENTER, ANCHOR_END, ANCHOR_CENTER, ANCHOR_END); + _set_anchors_preset(PRESET_CENTER_BOTTOM); } break; case ANCHOR_ALIGN_CENTER: { - _set_anchor(ANCHOR_CENTER, ANCHOR_CENTER, ANCHOR_CENTER, ANCHOR_CENTER); + _set_anchors_preset(PRESET_CENTER); } break; case ANCHOR_ALIGN_TOP_WIDE: { - _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_BEGIN); + _set_anchors_preset(PRESET_TOP_WIDE); } break; case ANCHOR_ALIGN_LEFT_WIDE: { - _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_END); + _set_anchors_preset(PRESET_LEFT_WIDE); } break; case ANCHOR_ALIGN_RIGHT_WIDE: { - _set_anchor(ANCHOR_END, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_END); + _set_anchors_preset(PRESET_RIGHT_WIDE); } break; case ANCHOR_ALIGN_BOTTOM_WIDE: { - _set_anchor(ANCHOR_BEGIN, ANCHOR_END, ANCHOR_END, ANCHOR_END); + _set_anchors_preset(PRESET_BOTTOM_WIDE); } break; case ANCHOR_ALIGN_VCENTER_WIDE: { - _set_anchor(ANCHOR_CENTER, ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_END); + _set_anchors_preset(PRESET_VCENTER_WIDE); } break; case ANCHOR_ALIGN_HCENTER_WIDE: { - _set_anchor(ANCHOR_BEGIN, ANCHOR_CENTER, ANCHOR_END, ANCHOR_CENTER); + _set_anchors_preset(PRESET_HCENTER_WIDE); } break; case ANCHOR_ALIGN_WIDE: { - _set_anchor(ANCHOR_BEGIN, ANCHOR_BEGIN, ANCHOR_END, ANCHOR_END); + _set_anchors_preset(PRESET_WIDE); } break; case ANCHOR_ALIGN_WIDE_FIT: { _set_full_rect(); @@ -3372,7 +3608,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { dialog_val = memnew(SpinBox); dialog_val->set_anchor(MARGIN_RIGHT, ANCHOR_END); dialog_val->set_begin(Point2(15, 25)); - dialog_val->set_end(Point2(10, 25)); + dialog_val->set_end(Point2(-10, 25)); value_dialog->add_child(dialog_val); dialog_val->connect("value_changed", this, "_dialog_value_changed"); select_sb = Ref<StyleBoxTexture>(memnew(StyleBoxTexture)); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 4383be251c..9b027fda60 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -57,6 +57,7 @@ public: float prev_rot; Rect2 prev_rect; Vector2 prev_pivot; + float prev_anchors[4]; CanvasItemEditorSelectedItem() { prev_rot = 0; } }; @@ -143,11 +144,15 @@ class CanvasItemEditor : public VBoxContainer { DRAG_BOTTOM_RIGHT, DRAG_BOTTOM, DRAG_BOTTOM_LEFT, + DRAG_ANCHOR_TOP_LEFT, + DRAG_ANCHOR_TOP_RIGHT, + DRAG_ANCHOR_BOTTOM_RIGHT, + DRAG_ANCHOR_BOTTOM_LEFT, + DRAG_ANCHOR_ALL, DRAG_ALL, DRAG_ROTATE, DRAG_PIVOT, DRAG_NODE_2D, - }; enum KeyMoveMODE { @@ -300,6 +305,7 @@ class CanvasItemEditor : public VBoxContainer { #endif Ref<StyleBoxTexture> select_sb; Ref<Texture> select_handle; + Ref<Texture> anchor_handle; int handle_len; bool _is_part_of_subscene(CanvasItem *p_item); @@ -325,8 +331,13 @@ class CanvasItemEditor : public VBoxContainer { void _key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE p_move_mode); void _list_select(const Ref<InputEventMouseButton> &b); - DragType _find_drag_type(const Point2 &p_click, Vector2 &r_point); + DragType _get_resize_handle_drag_type(const Point2 &p_click, Vector2 &r_point); void _prepare_drag(const Point2 &p_click_pos); + DragType _get_anchor_handle_drag_type(const Point2 &p_click, Vector2 &r_point); + + float _anchor_snap(float anchor, bool *snapped = NULL, float p_opposite_anchor = -1); + Vector2 _anchor_to_position(Control *p_control, Vector2 anchor); + Vector2 _position_to_anchor(Control *p_control, Vector2 position); void _popup_callback(int p_op); bool updating_scroll; @@ -355,12 +366,14 @@ class CanvasItemEditor : public VBoxContainer { void _unhandled_key_input(const Ref<InputEvent> &p_ev); + void _draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side); + void _viewport_gui_input(const Ref<InputEvent> &p_event); void _viewport_draw(); void _focus_selection(int p_op); - void _set_anchor(Control::AnchorType p_left, Control::AnchorType p_top, Control::AnchorType p_right, Control::AnchorType p_bottom); + void _set_anchors_preset(Control::LayoutPreset p_preset); void _set_full_rect(); HSplitContainer *palette_split; diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.h b/editor/plugins/collision_polygon_2d_editor_plugin.h index 382c0d6c37..b2f32d8491 100644 --- a/editor/plugins/collision_polygon_2d_editor_plugin.h +++ b/editor/plugins/collision_polygon_2d_editor_plugin.h @@ -97,8 +97,8 @@ public: virtual String get_name() const { return "CollisionPolygon2D"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); CollisionPolygon2DEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/collision_polygon_editor_plugin.h b/editor/plugins/collision_polygon_editor_plugin.h index 3a8428fc62..9f8b52d7f2 100644 --- a/editor/plugins/collision_polygon_editor_plugin.h +++ b/editor/plugins/collision_polygon_editor_plugin.h @@ -109,8 +109,8 @@ public: virtual String get_name() const { return "CollisionPolygon"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); CollisionPolygonEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 9a6ee8153e..fb2aa16383 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -585,12 +585,12 @@ void CollisionShape2DEditorPlugin::make_visible(bool visible) { } } -CollisionShape2DEditorPlugin::CollisionShape2DEditorPlugin(EditorNode *p_node) { +CollisionShape2DEditorPlugin::CollisionShape2DEditorPlugin(EditorNode *p_editor) { - editor = p_node; + editor = p_editor; - collision_shape_2d_editor = memnew(CollisionShape2DEditor(p_node)); - p_node->get_gui_base()->add_child(collision_shape_2d_editor); + collision_shape_2d_editor = memnew(CollisionShape2DEditor(p_editor)); + p_editor->get_gui_base()->add_child(collision_shape_2d_editor); } CollisionShape2DEditorPlugin::~CollisionShape2DEditorPlugin() { diff --git a/editor/plugins/gi_probe_editor_plugin.h b/editor/plugins/gi_probe_editor_plugin.h index b8f63e0b2e..e4151d4b8c 100644 --- a/editor/plugins/gi_probe_editor_plugin.h +++ b/editor/plugins/gi_probe_editor_plugin.h @@ -52,8 +52,8 @@ protected: public: virtual String get_name() const { return "GIProbe"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); GIProbeEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/gradient_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h index c319a13a01..1acf5f7e57 100644 --- a/editor/plugins/gradient_editor_plugin.h +++ b/editor/plugins/gradient_editor_plugin.h @@ -50,8 +50,8 @@ protected: public: virtual String get_name() const { return "ColorRamp"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); GradientEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/item_list_editor_plugin.h b/editor/plugins/item_list_editor_plugin.h index bc009b3d7a..3bfe2c88e0 100644 --- a/editor/plugins/item_list_editor_plugin.h +++ b/editor/plugins/item_list_editor_plugin.h @@ -243,8 +243,8 @@ class ItemListEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "ItemList"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); ItemListEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/light_occluder_2d_editor_plugin.h b/editor/plugins/light_occluder_2d_editor_plugin.h index d6579fc94c..435d650a69 100644 --- a/editor/plugins/light_occluder_2d_editor_plugin.h +++ b/editor/plugins/light_occluder_2d_editor_plugin.h @@ -101,8 +101,8 @@ public: virtual String get_name() const { return "LightOccluder2D"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); LightOccluder2DEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp index 4a7ad74fbe..41327fb07e 100644 --- a/editor/plugins/line_2d_editor_plugin.cpp +++ b/editor/plugins/line_2d_editor_plugin.cpp @@ -54,9 +54,9 @@ void Line2DEditor::_notification(int p_what) { } } -Vector2 Line2DEditor::mouse_to_local_pos(Vector2 gpoint, bool alt) { +Vector2 Line2DEditor::mouse_to_local_pos(Vector2 gpos, bool alt) { Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); - return !alt ? canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) : node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint))); + return !alt ? canvas_item_editor->snap_point(xform.affine_inverse().xform(gpos)) : node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpos))); } int Line2DEditor::get_point_index_at(Vector2 gpos) { diff --git a/editor/plugins/line_2d_editor_plugin.h b/editor/plugins/line_2d_editor_plugin.h index 3a1f841556..f2979e4330 100644 --- a/editor/plugins/line_2d_editor_plugin.h +++ b/editor/plugins/line_2d_editor_plugin.h @@ -101,8 +101,8 @@ public: virtual String get_name() const { return "Line2D"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); Line2DEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h index 72d93c4126..305d24ba07 100644 --- a/editor/plugins/mesh_editor_plugin.h +++ b/editor/plugins/mesh_editor_plugin.h @@ -81,8 +81,8 @@ class MeshEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "Mesh"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); MeshEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/mesh_instance_editor_plugin.h b/editor/plugins/mesh_instance_editor_plugin.h index d80ffa071d..614dcac0b9 100644 --- a/editor/plugins/mesh_instance_editor_plugin.h +++ b/editor/plugins/mesh_instance_editor_plugin.h @@ -82,8 +82,8 @@ class MeshInstanceEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "MeshInstance"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); MeshInstanceEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index 9520cc5297..a9689cce56 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -381,7 +381,7 @@ MultiMeshEditor::MultiMeshEditor() { populate_amount = memnew(SpinBox); populate_amount->set_anchor(MARGIN_RIGHT, ANCHOR_END); populate_amount->set_begin(Point2(20, 232)); - populate_amount->set_end(Point2(5, 237)); + populate_amount->set_end(Point2(-5, 237)); populate_amount->set_min(1); populate_amount->set_max(65536); populate_amount->set_value(128); diff --git a/editor/plugins/multimesh_editor_plugin.h b/editor/plugins/multimesh_editor_plugin.h index 0c633a4f60..a93fa73a2e 100644 --- a/editor/plugins/multimesh_editor_plugin.h +++ b/editor/plugins/multimesh_editor_plugin.h @@ -95,8 +95,8 @@ class MultiMeshEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "MultiMesh"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); MultiMeshEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h index 62a83983fd..6ec9b14cc1 100644 --- a/editor/plugins/navigation_polygon_editor_plugin.h +++ b/editor/plugins/navigation_polygon_editor_plugin.h @@ -102,8 +102,8 @@ public: virtual String get_name() const { return "NavigationPolygonInstance"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); NavigationPolygonEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/particles_2d_editor_plugin.h b/editor/plugins/particles_2d_editor_plugin.h index cea60fbeaf..ccfec1a25f 100644 --- a/editor/plugins/particles_2d_editor_plugin.h +++ b/editor/plugins/particles_2d_editor_plugin.h @@ -87,8 +87,8 @@ protected: public: virtual String get_name() const { return "Particles2D"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); Particles2DEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h index e9f9f43468..a6e14266c7 100644 --- a/editor/plugins/particles_editor_plugin.h +++ b/editor/plugins/particles_editor_plugin.h @@ -102,8 +102,8 @@ class ParticlesEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "Particles"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); ParticlesEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/path_2d_editor_plugin.h b/editor/plugins/path_2d_editor_plugin.h index 70911444ad..61ff700118 100644 --- a/editor/plugins/path_2d_editor_plugin.h +++ b/editor/plugins/path_2d_editor_plugin.h @@ -112,8 +112,8 @@ public: virtual String get_name() const { return "Path2D"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); Path2DEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/path_editor_plugin.h b/editor/plugins/path_editor_plugin.h index 651dcdaa78..43df9d460f 100644 --- a/editor/plugins/path_editor_plugin.h +++ b/editor/plugins/path_editor_plugin.h @@ -83,8 +83,8 @@ public: virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial); virtual String get_name() const { return "Path"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); PathEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h index 0901cc9082..4fcb1d81c2 100644 --- a/editor/plugins/polygon_2d_editor_plugin.h +++ b/editor/plugins/polygon_2d_editor_plugin.h @@ -152,8 +152,8 @@ public: virtual String get_name() const { return "Polygon2D"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); Polygon2DEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 2703da12fe..ccefbc1843 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -362,7 +362,7 @@ void ResourcePreloaderEditor::_bind_methods() { ResourcePreloaderEditor::ResourcePreloaderEditor() { - //add_style_override("panel", get_stylebox("panel","Panel")); + //add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel")); VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); diff --git a/editor/plugins/resource_preloader_editor_plugin.h b/editor/plugins/resource_preloader_editor_plugin.h index 1f54620ba4..6e4726748d 100644 --- a/editor/plugins/resource_preloader_editor_plugin.h +++ b/editor/plugins/resource_preloader_editor_plugin.h @@ -91,8 +91,8 @@ class ResourcePreloaderEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "ResourcePreloader"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); ResourcePreloaderEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/rich_text_editor_plugin.h b/editor/plugins/rich_text_editor_plugin.h index 8d42adc236..2665db2993 100644 --- a/editor/plugins/rich_text_editor_plugin.h +++ b/editor/plugins/rich_text_editor_plugin.h @@ -79,8 +79,8 @@ class RichTextEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "RichText"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); RichTextEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/sample_editor_plugin.cpp b/editor/plugins/sample_editor_plugin.cpp index 739a8abb53..1d6417e2d5 100644 --- a/editor/plugins/sample_editor_plugin.cpp +++ b/editor/plugins/sample_editor_plugin.cpp @@ -360,20 +360,20 @@ SampleEditor::SampleEditor() { player = memnew(SamplePlayer); add_child(player); - add_style_override("panel", get_stylebox("panel","Panel")); + add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel")); library = Ref<SampleLibrary>(memnew(SampleLibrary)); player->set_sample_library(library); sample_texframe = memnew( TextureRect ); add_child(sample_texframe); sample_texframe->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5); - sample_texframe->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5); + sample_texframe->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,-5); sample_texframe->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,30); - sample_texframe->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,5); + sample_texframe->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,-5); info_label = memnew( Label ); sample_texframe->add_child(info_label); info_label->set_area_as_parent_rect(); - info_label->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,15); + info_label->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,-15); info_label->set_margin(MARGIN_BOTTOM,4); info_label->set_margin(MARGIN_RIGHT,4); info_label->set_align(Label::ALIGN_RIGHT); diff --git a/editor/plugins/sample_library_editor_plugin.cpp b/editor/plugins/sample_library_editor_plugin.cpp index 5ccfde15ff..3deb634491 100644 --- a/editor/plugins/sample_library_editor_plugin.cpp +++ b/editor/plugins/sample_library_editor_plugin.cpp @@ -432,7 +432,7 @@ SampleLibraryEditor::SampleLibraryEditor() { player = memnew(SamplePlayer); add_child(player); - add_style_override("panel", get_stylebox("panel","Panel")); + add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel")); load = memnew( Button ); @@ -452,9 +452,9 @@ SampleLibraryEditor::SampleLibraryEditor() { tree->set_columns(6); add_child(tree); tree->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5); - tree->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5); + tree->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,-5); tree->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,30); - tree->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,5); + tree->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END,-5); tree->set_column_titles_visible(true); tree->set_column_title(0,TTR("Name")); tree->set_column_title(1,TTR("Preview")); diff --git a/editor/plugins/sample_player_editor_plugin.cpp b/editor/plugins/sample_player_editor_plugin.cpp index 25f1fe9e17..ea9b646a9b 100644 --- a/editor/plugins/sample_player_editor_plugin.cpp +++ b/editor/plugins/sample_player_editor_plugin.cpp @@ -120,8 +120,8 @@ SamplePlayerEditor::SamplePlayerEditor() { play->set_position(Point2( 5, 5 )); play->set_toggle_mode(true); - play->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,250); - play->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,230); + play->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,-250); + play->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,-230); play->set_anchor_and_margin(MARGIN_TOP,Control::ANCHOR_BEGIN,0); play->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_BEGIN,0); @@ -131,15 +131,15 @@ SamplePlayerEditor::SamplePlayerEditor() { stop->set_position(Point2( 35, 5 )); stop->set_toggle_mode(true); - stop->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,220); - stop->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,200); + stop->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,-220); + stop->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,-200); stop->set_anchor_and_margin(MARGIN_TOP,Control::ANCHOR_BEGIN,0); stop->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_BEGIN,0); add_child(stop); samples = memnew( OptionButton ); - samples->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,190); - samples->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,5); + samples->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,-190); + samples->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,-5); samples->set_anchor_and_margin(MARGIN_TOP,Control::ANCHOR_BEGIN,0); samples->set_anchor_and_margin(MARGIN_BOTTOM,Control::ANCHOR_BEGIN,0); add_child(samples); @@ -182,7 +182,7 @@ SamplePlayerEditorPlugin::SamplePlayerEditorPlugin(EditorNode *p_node) { sample_player_editor->set_anchor(MARGIN_LEFT,Control::ANCHOR_END); sample_player_editor->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END); - sample_player_editor->set_margin(MARGIN_LEFT,250); + sample_player_editor->set_margin(MARGIN_LEFT,-250); sample_player_editor->set_margin(MARGIN_RIGHT,0); sample_player_editor->set_margin(MARGIN_TOP,0); sample_player_editor->set_margin(MARGIN_BOTTOM,10); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index d8a9415df1..4614a41605 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -65,7 +65,7 @@ protected: static void _bind_methods(); public: - void popup(const Vector<String> &p_base, bool p_dontclear = false); + void popup(const Vector<String> &p_functions, bool p_dontclear = false); ScriptEditorQuickOpen(); }; @@ -223,14 +223,14 @@ class ScriptEditor : public PanelContainer { EditorHelpIndex *help_index; void _tab_changed(int p_which); - void _menu_option(int p_optin); + void _menu_option(int p_option); Tree *disk_changed_list; ConfirmationDialog *disk_changed; bool restoring_layout; - String _get_debug_tooltip(const String &p_text, Node *_ste); + String _get_debug_tooltip(const String &p_text, Node *_se); void _resave_scripts(const String &p_str); void _reload_scripts(); @@ -392,8 +392,8 @@ class ScriptEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "Script"; } bool has_main_screen() const { return true; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); virtual void selected_notify(); diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h index 38d5c3e3a6..8625267a63 100644 --- a/editor/plugins/shader_editor_plugin.h +++ b/editor/plugins/shader_editor_plugin.h @@ -92,7 +92,7 @@ class ShaderEditor : public VBoxContainer { ShaderTextEditor *shader_editor; - void _menu_option(int p_optin); + void _menu_option(int p_option); void _params_changed(); mutable Ref<Shader> shader; @@ -130,8 +130,8 @@ class ShaderEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "Shader"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); virtual void selected_notify(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 13fdb7ac9d..5faacf7a67 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -267,6 +267,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, int selected_handle = -1; Vector<Spatial *> subscenes = Vector<Spatial *>(); + Vector<Vector3> subscenes_positions = Vector<Vector3>(); for (int i = 0; i < instances.size(); i++) { @@ -284,13 +285,16 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, if ((!seg.is_valid()) || found_gizmos.has(seg)) { Node *subscene_candidate = spat; + Vector3 source_click_spatial_pos = spat->get_global_transform().origin; while ((subscene_candidate->get_owner() != NULL) && (subscene_candidate->get_owner() != editor->get_edited_scene())) subscene_candidate = subscene_candidate->get_owner(); spat = subscene_candidate->cast_to<Spatial>(); - if (spat && (spat->get_filename() != "") && (subscene_candidate->get_owner() != NULL)) + if (spat && (spat->get_filename() != "") && (subscene_candidate->get_owner() != NULL)) { subscenes.push_back(spat); + subscenes_positions.push_back(source_click_spatial_pos); + } continue; } @@ -324,7 +328,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, for (int idx_subscene = 0; idx_subscene < subscenes.size(); idx_subscene++) { Spatial *subscene = subscenes.get(idx_subscene); - float dist = ray.cross(subscene->get_global_transform().origin - pos).length(); + float dist = ray.cross(subscenes_positions.get(idx_subscene) - pos).length(); if ((dist < 0) || (dist > 1.2)) continue; @@ -410,7 +414,7 @@ void SpatialEditorViewport::_find_items_at_pos(const Point2 &p_pos, bool &r_incl results.sort(); } -Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_pos) { +Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_vector3) { CameraMatrix cm; cm.set_perspective(get_fov(), get_size().aspect(), get_znear(), get_zfar()); @@ -423,7 +427,7 @@ Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_pos) { camera_transform.basis.rotate(Vector3(0, 1, 0), -cursor.y_rot); camera_transform.translate(0, 0, cursor.distance); - return camera_transform.xform(Vector3(((p_pos.x / get_size().width) * 2.0 - 1.0) * screen_w, ((1.0 - (p_pos.y / get_size().height)) * 2.0 - 1.0) * screen_h, -get_znear())); + return camera_transform.xform(Vector3(((p_vector3.x / get_size().width) * 2.0 - 1.0) * screen_w, ((1.0 - (p_vector3.y / get_size().height)) * 2.0 - 1.0) * screen_h, -get_znear())); } void SpatialEditorViewport::_select_region() { @@ -2485,7 +2489,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed preview_camera = memnew(Button); preview_camera->set_toggle_mode(true); - preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, 90 * EDSCALE); + preview_camera->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE); preview_camera->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE); preview_camera->set_text("preview"); surface->add_child(preview_camera); diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h index e9857f8b0c..2fd72739df 100644 --- a/editor/plugins/spatial_editor_plugin.h +++ b/editor/plugins/spatial_editor_plugin.h @@ -245,7 +245,7 @@ private: void _draw(); void _smouseenter(); - void _sinput(const Ref<InputEvent> &p_ie); + void _sinput(const Ref<InputEvent> &p_event); void _update_freelook(real_t delta); SpatialEditor *spatial_editor; diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 6a010062f2..0f008552d0 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -714,7 +714,7 @@ void SpriteFramesEditor::_bind_methods() { SpriteFramesEditor::SpriteFramesEditor() { - //add_style_override("panel", get_stylebox("panel","Panel")); + //add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel")); split = memnew(HSplitContainer); add_child(split); diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h index c9081c599a..c0eb1ec3d0 100644 --- a/editor/plugins/sprite_frames_editor_plugin.h +++ b/editor/plugins/sprite_frames_editor_plugin.h @@ -121,8 +121,8 @@ class SpriteFramesEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "SpriteFrames"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); SpriteFramesEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h index 13f8dd7fbd..2b5e7ed629 100644 --- a/editor/plugins/texture_editor_plugin.h +++ b/editor/plugins/texture_editor_plugin.h @@ -61,8 +61,8 @@ class TextureEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "Texture"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); TextureEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 4cd18b090a..d878bba427 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -898,12 +898,12 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) { edit_draw->set_clip_contents(true); } -void TextureRegionEditorPlugin::edit(Object *p_node) { - region_editor->edit(p_node); +void TextureRegionEditorPlugin::edit(Object *p_object) { + region_editor->edit(p_object); } -bool TextureRegionEditorPlugin::handles(Object *p_obj) const { - return p_obj->is_class("Sprite") || p_obj->is_class("Patch9Rect") || p_obj->is_class("StyleBoxTexture") || p_obj->is_class("AtlasTexture"); +bool TextureRegionEditorPlugin::handles(Object *p_object) const { + return p_object->is_class("Sprite") || p_object->is_class("Patch9Rect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture"); } void TextureRegionEditorPlugin::make_visible(bool p_visible) { diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h index cb0b9fc372..265d46cb08 100644 --- a/editor/plugins/texture_region_editor_plugin.h +++ b/editor/plugins/texture_region_editor_plugin.h @@ -139,8 +139,8 @@ class TextureRegionEditorPlugin : public EditorPlugin { public: virtual String get_name() const { return "TextureRegion"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); void set_state(const Dictionary &p_state); Dictionary get_state() const; diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index 981d5c66a1..a12c56814a 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -197,8 +197,8 @@ public: virtual String get_name() const { return "TileMap"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); TileMapEditorPlugin(EditorNode *p_node); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 3563f70d0b..bed4727bb9 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -147,12 +147,12 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) { } } -void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_merge) { +void TileSetEditor::_import_scene(Node *p_scene, Ref<TileSet> p_library, bool p_merge) { if (!p_merge) p_library->clear(); - _import_node(scene, p_library); + _import_node(p_scene, p_library); } void TileSetEditor::_menu_confirm() { diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 53d94cdb18..d6c1407b62 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -434,13 +434,13 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: } else if (hint == PROPERTY_HINT_EXP_EASING) { easing_draw->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5 * EDSCALE); - easing_draw->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 5 * EDSCALE); + easing_draw->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5 * EDSCALE); easing_draw->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 5 * EDSCALE); - easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 30 * EDSCALE); + easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -30 * EDSCALE); type_button->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 3 * EDSCALE); - type_button->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 3 * EDSCALE); - type_button->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, 25 * EDSCALE); - type_button->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 7 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -3 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -25 * EDSCALE); + type_button->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -7 * EDSCALE); type_button->set_text(TTR("Preset..")); type_button->get_popup()->clear(); type_button->get_popup()->add_item(TTR("Linear"), EASING_LINEAR); @@ -523,8 +523,8 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: action_buttons[0]->set_anchor(MARGIN_TOP, ANCHOR_END); action_buttons[0]->set_anchor(MARGIN_RIGHT, ANCHOR_END); action_buttons[0]->set_anchor(MARGIN_BOTTOM, ANCHOR_END); - action_buttons[0]->set_begin(Point2(70 * EDSCALE, button_margin - 5 * EDSCALE)); - action_buttons[0]->set_end(Point2(margin, margin)); + action_buttons[0]->set_begin(Point2(-70 * EDSCALE, -button_margin + 5 * EDSCALE)); + action_buttons[0]->set_end(Point2(-margin, -margin)); action_buttons[0]->set_text(TTR("Close")); action_buttons[0]->show(); @@ -2474,11 +2474,14 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction String allowed_type = d["hint_text"]; + print_line("allowed type " + allowed_type); + Dictionary drag_data = p_drag_data; if (drag_data.has("type") && String(drag_data["type"]) == "resource") { Ref<Resource> res = drag_data["resource"]; for (int i = 0; i < allowed_type.get_slice_count(","); i++) { String at = allowed_type.get_slice(",", i).strip_edges(); + print_line("RES vs " + at); if (res.is_valid() && ClassDB::is_parent_class(res->get_class(), at)) { return true; } @@ -2489,13 +2492,18 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction Vector<String> files = drag_data["files"]; + print_line("fileS: " + String(Variant(files))); if (files.size() == 1) { String file = files[0]; String ftype = EditorFileSystem::get_singleton()->get_file_type(file); + + print_line("file: " + file); + print_line("type: " + ftype); if (ftype != "") { for (int i = 0; i < allowed_type.get_slice_count(","); i++) { String at = allowed_type.get_slice(",", i).strip_edges(); + print_line("FILE vs " + at); if (ClassDB::is_parent_class(ftype, at)) { return true; } @@ -4183,9 +4191,9 @@ void PropertyEditor::set_keying(bool p_active) { update_tree(); } -void PropertyEditor::_draw_flags(Object *t, const Rect2 &p_rect) { +void PropertyEditor::_draw_flags(Object *p_object, const Rect2 &p_rect) { - TreeItem *ti = t->cast_to<TreeItem>(); + TreeItem *ti = p_object->cast_to<TreeItem>(); if (!ti) return; @@ -4766,12 +4774,11 @@ double PropertyValueEvaluator::eval(const String &p_text) { return _default_eval(p_text); } - ScriptInstance *script_instance = script->instance_create(this); + ScriptInstance *script_instance = script->instance_create(obj); if (!script_instance) return _default_eval(p_text); Variant::CallError call_err; - script_instance->call("set_this", obj); double result = script_instance->call("e", NULL, 0, call_err); if (call_err.error == Variant::CallError::CALL_OK) { return result; @@ -4788,7 +4795,7 @@ void PropertyValueEvaluator::edit(Object *p_obj) { } String PropertyValueEvaluator::_build_script(const String &p_text) { - String script_text = "tool\nvar this\nfunc set_this(p_this):\n\tthis=p_this\nfunc e():\n\treturn "; + String script_text = "tool\nextends Object\nfunc e():\n\treturn "; script_text += p_text.strip_edges(); script_text += "\n"; return script_text; diff --git a/editor/property_editor.h b/editor/property_editor.h index cc507d248f..3dd09268ec 100644 --- a/editor/property_editor.h +++ b/editor/property_editor.h @@ -217,8 +217,8 @@ class PropertyEditor : public Control { TreeItem *find_item(TreeItem *p_item, const String &p_name); - virtual void _changed_callback(Object *p_changed, const char *p_what); - virtual void _changed_callbacks(Object *p_changed, const String &p_callback); + virtual void _changed_callback(Object *p_changed, const char *p_prop); + virtual void _changed_callbacks(Object *p_changed, const String &p_prop); void _check_reload_status(const String &p_name, TreeItem *item); @@ -228,7 +228,7 @@ class PropertyEditor : public Control { friend class ProjectExportDialog; void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all = false, const String &p_changed_field = ""); - void _draw_flags(Object *ti, const Rect2 &p_rect); + void _draw_flags(Object *p_object, const Rect2 &p_rect); bool _might_be_in_instance(); bool _get_instanced_node_original_property(const StringName &p_prop, Variant &value); diff --git a/editor/resources_dock.h b/editor/resources_dock.h index f58f8e4c54..e5470b1a3c 100644 --- a/editor/resources_dock.h +++ b/editor/resources_dock.h @@ -73,7 +73,7 @@ class ResourcesDock : public VBoxContainer { bool block_add; int current_action; - void _file_action(const String &p_action); + void _file_action(const String &p_path); void _delete(Object *p_item, int p_column, int p_id); void _resource_selected(); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index 5872c5a25d..5a6bc94125 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -189,7 +189,7 @@ public: void import_subscene(); void set_edited_scene(Node *p_scene); - void instance(const String &p_path); + void instance(const String &p_file); void instance_scenes(const Vector<String> &p_files, Node *p_parent = NULL); void set_selected(Node *p_node, bool p_emit_selected = false); void fill_path_renames(Node *p_node, Node *p_new_parent, List<Pair<NodePath, NodePath> > *p_renames); diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h index c6283af7b5..c666b6a8d5 100644 --- a/editor/scene_tree_editor.h +++ b/editor/scene_tree_editor.h @@ -101,7 +101,7 @@ class SceneTreeEditor : public Control { static void _bind_methods(); void _cell_button_pressed(Object *p_item, int p_column, int p_id); - void _cell_multi_selected(Object *p_object, int p_cel, bool p_selected); + void _cell_multi_selected(Object *p_object, int p_cell, bool p_selected); void _update_selection(TreeItem *item); void _node_script_changed(Node *p_node); void _node_visibility_changed(Node *p_node); diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index f503b878f5..c8f199b53a 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -74,7 +74,7 @@ class ScriptCreateDialog : public ConfirmationDialog { void _path_changed(const String &p_path = String()); void _lang_changed(int l = 0); void _built_in_pressed(); - bool _validate(const String &p_strin); + bool _validate(const String &p_string); void _class_name_changed(const String &p_name); void _parent_name_changed(const String &p_parent); void _template_changed(int p_template = 0); diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h index 469a2d594a..28feee3fcc 100644 --- a/editor/spatial_editor_gizmos.h +++ b/editor/spatial_editor_gizmos.h @@ -278,7 +278,7 @@ public: virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false); void redraw(); - ReflectionProbeGizmo(ReflectionProbe *p_notifier = NULL); + ReflectionProbeGizmo(ReflectionProbe *p_probe = NULL); }; class GIProbeGizmo : public EditorSpatialGizmo { @@ -294,7 +294,7 @@ public: virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false); void redraw(); - GIProbeGizmo(GIProbe *p_notifier = NULL); + GIProbeGizmo(GIProbe *p_probe = NULL); }; class CollisionShapeSpatialGizmo : public EditorSpatialGizmo { diff --git a/main/input_default.h b/main/input_default.h index 35e841a488..92ef67c7b5 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -214,7 +214,7 @@ public: virtual void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration = 0); virtual void stop_joy_vibration(int p_device); - void set_main_loop(MainLoop *main_loop); + void set_main_loop(MainLoop *p_main_loop); void set_mouse_position(const Point2 &p_posf); void action_press(const StringName &p_action); diff --git a/main/main.cpp b/main/main.cpp index 561201ab8a..e00a482bde 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1048,7 +1048,7 @@ bool Main::start() { String script; String test; String screen; - String _export_platform; + String _export_preset; String _import; String _import_script; bool noquit = false; @@ -1083,10 +1083,10 @@ bool Main::start() { test = args[i + 1]; } else if (args[i] == "-export") { editor = true; //needs editor - _export_platform = args[i + 1]; + _export_preset = args[i + 1]; } else if (args[i] == "-export_debug") { editor = true; //needs editor - _export_platform = args[i + 1]; + _export_preset = args[i + 1]; export_debug = true; } else if (args[i] == "-import") { editor = true; //needs editor @@ -1136,7 +1136,7 @@ bool Main::start() { #endif - if (_export_platform != "") { + if (_export_preset != "") { if (game_path == "") { String err = "Command line param "; err += export_debug ? "-export_debug" : "-export"; @@ -1243,9 +1243,9 @@ bool Main::start() { //root_node->set_editor(editor); //startup editor - if (_export_platform != "") { + if (_export_preset != "") { - editor_node->export_platform(_export_platform, game_path, export_debug, "", true); + editor_node->export_preset(_export_preset, game_path, export_debug, "", true); game_path = ""; //no load anything } } diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index 95147d8467..0607360d88 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -911,7 +911,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String } } -MainLoop *test(TestType p_test) { +MainLoop *test(TestType p_type) { List<String> cmdlargs = OS::get_singleton()->get_cmdline_args(); @@ -950,7 +950,7 @@ MainLoop *test(TestType p_test) { } } - if (p_test == TEST_TOKENIZER) { + if (p_type == TEST_TOKENIZER) { GDTokenizerText tk; tk.set_code(code); @@ -993,7 +993,7 @@ MainLoop *test(TestType p_test) { } } - if (p_test == TEST_PARSER) { + if (p_type == TEST_PARSER) { GDParser parser; Error err = parser.parse(code); @@ -1010,7 +1010,7 @@ MainLoop *test(TestType p_test) { _parser_show_class(cnode, 0, lines); } - if (p_test == TEST_COMPILER) { + if (p_type == TEST_COMPILER) { GDParser parser; @@ -1044,7 +1044,7 @@ MainLoop *test(TestType p_test) { current = current->get_base(); } - } else if (p_test == TEST_BYTECODE) { + } else if (p_type == TEST_BYTECODE) { Vector<uint8_t> buf = GDTokenizerBuffer::parse_code_string(code); String dst = test.get_basename() + ".gdc"; @@ -1073,7 +1073,7 @@ MainLoop *test(TestType p_test) { namespace TestGDScript { -MainLoop *test(TestType p_test) { +MainLoop *test(TestType p_type) { return NULL; } diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp index 3c6a708cd8..44d4464aac 100644 --- a/main/tests/test_gui.cpp +++ b/main/tests/test_gui.cpp @@ -278,7 +278,7 @@ public: richtext->set_position(Point2(600, 210)); richtext->set_size(Point2(180, 250)); - richtext->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, 20); + richtext->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -20); frame->add_child(richtext); @@ -319,8 +319,6 @@ public: ///richtext->add_text("Hello!\n"); //richtext->pop(); - richtext->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END); - TabContainer *tabc = memnew(TabContainer); Control *ctl = memnew(Control); diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h index 8b971adf55..f2c3b838e4 100644 --- a/modules/enet/networked_multiplayer_enet.h +++ b/modules/enet/networked_multiplayer_enet.h @@ -113,7 +113,7 @@ public: virtual int get_packet_peer() const; - Error create_server(int p_port, int p_max_peers = 32, int p_in_bandwidth = 0, int p_out_bandwidth = 0); + Error create_server(int p_port, int p_max_clients = 32, int p_in_bandwidth = 0, int p_out_bandwidth = 0); Error create_client(const IP_Address &p_ip, int p_port, int p_in_bandwidth = 0, int p_out_bandwidth = 0); void close_connection(); diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index b03866f432..003ec46a25 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -137,7 +137,7 @@ public: bool initialize(); bool terminate(); - Variant call_native(StringName p_call_type, StringName p_procedure_name, Array p_arguments = Array()); + Variant call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments = Array()); void call_native_raw(StringName p_raw_call_type, StringName p_procedure_name, void *data, int num_args, void **args, void *r_return); }; diff --git a/modules/gdnative/godot/dictionary.cpp b/modules/gdnative/godot/dictionary.cpp index b92c8125bb..c538456432 100644 --- a/modules/gdnative/godot/dictionary.cpp +++ b/modules/gdnative/godot/dictionary.cpp @@ -30,7 +30,7 @@ #include <godot/dictionary.h> #include "core/variant.h" - +// core/variant.h before to avoid compile errors with MSVC #include "core/dictionary.h" #include "core/io/json.h" diff --git a/modules/gdnative/godot/string.cpp b/modules/gdnative/godot/string.cpp index 76cf1fba12..2235c12a2d 100644 --- a/modules/gdnative/godot/string.cpp +++ b/modules/gdnative/godot/string.cpp @@ -63,13 +63,13 @@ void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_ memnew_placement(dest, String(p_contents, p_size)); } -void GDAPI godot_string_get_data(const godot_string *p_self, char *r_dest, int *p_size) { +void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *p_size) { String *self = (String *)p_self; if (p_size != NULL) { *p_size = self->utf8().length(); } - if (r_dest != NULL) { - memcpy(r_dest, self->utf8().get_data(), *p_size); + if (p_dest != NULL) { + memcpy(p_dest, self->utf8().get_data(), *p_size); } } @@ -277,11 +277,11 @@ godot_int GDAPI godot_string_hex_to_int_without_prefix(const godot_string *p_sel return self->hex_to_int(true); } -godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int at_pos, godot_string p_content) { +godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int p_at_pos, godot_string p_string) { const String *self = (const String *)p_self; - String *content = (String *)&p_content; + String *content = (String *)&p_string; godot_string result; - memnew_placement(&result, String(self->insert(at_pos, *content))); + memnew_placement(&result, String(self->insert(p_at_pos, *content))); return result; } diff --git a/modules/gdnative/godot/string.h b/modules/gdnative/godot/string.h index bfe66aa5ec..c901ce36e6 100644 --- a/modules/gdnative/godot/string.h +++ b/modules/gdnative/godot/string.h @@ -83,8 +83,8 @@ godot_int GDAPI godot_string_findmk_from_in_place(const godot_string *p_self, co godot_int GDAPI godot_string_findn(const godot_string *p_self, godot_string p_what); godot_int GDAPI godot_string_findn_from(const godot_string *p_self, godot_string p_what, godot_int p_from); godot_int GDAPI find_last(const godot_string *p_self, godot_string p_what); -godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *values); -godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *values, const char *placeholder); +godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *p_values); +godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder); godot_string GDAPI godot_string_hex_encode_buffer(const uint8_t *p_buffer, godot_int p_len); godot_int GDAPI godot_string_hex_to_int(const godot_string *p_self); godot_int GDAPI godot_string_hex_to_int_without_prefix(const godot_string *p_self); diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index cafcc1e965..13a7480a36 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -1233,10 +1233,10 @@ int GDFunction::get_default_argument_count() const { return default_arguments.size(); } -int GDFunction::get_default_argument_addr(int p_arg) const { +int GDFunction::get_default_argument_addr(int p_idx) const { - ERR_FAIL_INDEX_V(p_arg, default_arguments.size(), -1); - return default_arguments[p_arg]; + ERR_FAIL_INDEX_V(p_idx, default_arguments.size(), -1); + return default_arguments[p_idx]; } StringName GDFunction::get_name() const { diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 9d304c6d34..2d06c0f5d2 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -615,7 +615,7 @@ Error GDScript::reload(bool p_keep_state) { if (basedir != "") basedir = basedir.get_base_dir(); - if (basedir.find("res://") == -1 && basedir.find("user://") == -1) { + if (basedir != "" && basedir.find("res://") == -1 && basedir.find("user://") == -1) { //loading a template, don't parse return OK; } diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index f241a96e58..1205776882 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -1049,21 +1049,21 @@ void GridMap::_update_area_instances() { } } -Error GridMap::create_area(int p_id, const Rect3 &p_bounds) { +Error GridMap::create_area(int p_id, const Rect3 &p_area) { ERR_FAIL_COND_V(area_map.has(p_id), ERR_ALREADY_EXISTS); ERR_EXPLAIN("ID 0 is taken as global area, start from 1"); ERR_FAIL_COND_V(p_id == 0, ERR_INVALID_PARAMETER); - ERR_FAIL_COND_V(p_bounds.has_no_area(), ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(p_area.has_no_area(), ERR_INVALID_PARAMETER); // FIRST VALIDATE AREA IndexKey from, to; - from.x = p_bounds.position.x; - from.y = p_bounds.position.y; - from.z = p_bounds.position.z; - to.x = p_bounds.position.x + p_bounds.size.x; - to.y = p_bounds.position.y + p_bounds.size.y; - to.z = p_bounds.position.z + p_bounds.size.z; + from.x = p_area.position.x; + from.y = p_area.position.y; + from.z = p_area.position.z; + to.x = p_area.position.x + p_area.size.x; + to.y = p_area.position.y + p_area.size.y; + to.z = p_area.position.z + p_area.size.z; for (Map<int, Area *>::Element *E = area_map.front(); E; E = E->next()) { //this should somehow be faster... diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index c386e4f66b..106bf82dc2 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -242,7 +242,7 @@ public: void set_center_z(bool p_enable); bool get_center_z() const; - void set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_orientation = 0); + void set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot = 0); int get_cell_item(int p_x, int p_y, int p_z) const; int get_cell_item_orientation(int p_x, int p_y, int p_z) const; diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 954e865bcd..38f58799df 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -1203,7 +1203,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { edit_mode = memnew(OptionButton); edit_mode->set_area_as_parent_rect(); edit_mode->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 24); - edit_mode->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 14); + edit_mode->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -14); edit_mode->add_item("Tiles"); edit_mode->add_item("Areas"); hb->add_child(edit_mode); diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h index 1572f4fbe5..a1b2c96ccd 100644 --- a/modules/gridmap/grid_map_editor_plugin.h +++ b/modules/gridmap/grid_map_editor_plugin.h @@ -239,8 +239,8 @@ public: virtual bool forward_spatial_input_event(Camera *p_camera, const Ref<InputEvent> &p_event) { return gridmap_editor->forward_spatial_input_event(p_camera, p_event); } virtual String get_name() const { return "GridMap"; } bool has_main_screen() const { return false; } - virtual void edit(Object *p_node); - virtual bool handles(Object *p_node) const; + virtual void edit(Object *p_object); + virtual bool handles(Object *p_object) const; virtual void make_visible(bool p_visible); GridMapEditorPlugin(EditorNode *p_node); diff --git a/modules/nativescript/nativescript.h b/modules/nativescript/nativescript.h index c60effd0c1..b62fefec40 100644 --- a/modules/nativescript/nativescript.h +++ b/modules/nativescript/nativescript.h @@ -120,7 +120,7 @@ public: void set_class_name(String p_class_name); String get_class_name() const; - void set_library(Ref<GDNativeLibrary> library); + void set_library(Ref<GDNativeLibrary> p_library); Ref<GDNativeLibrary> get_library() const; virtual bool can_instance() const; diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index 63ac5769c6..b61b67a890 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -291,8 +291,8 @@ public: void data_disconnect(const StringName &p_func, int p_from_node, int p_from_port, int p_to_node, int p_to_port); bool has_data_connection(const StringName &p_func, int p_from_node, int p_from_port, int p_to_node, int p_to_port) const; void get_data_connection_list(const StringName &p_func, List<DataConnection> *r_connection) const; - bool is_input_value_port_connected(const StringName &p_name, int p_node, int p_port) const; - bool get_input_value_port_connection_source(const StringName &p_name, int p_node, int p_port, int *r_node, int *r_port) const; + bool is_input_value_port_connected(const StringName &p_func, int p_node, int p_port) const; + bool get_input_value_port_connection_source(const StringName &p_func, int p_node, int p_port, int *r_node, int *r_port) const; void add_variable(const StringName &p_name, const Variant &p_default_value = Variant(), bool p_export = false); bool has_variable(const StringName &p_name) const; diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 8912227692..0f6b47c56d 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -2450,17 +2450,17 @@ void VisualScriptEditor::_graph_connect_to_empty(const String &p_from, int p_fro port_action_popup->popup(); } -VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_node, int p_output, Set<int> &visited_nodes) { +VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_port_action_node, int p_port_action_output, Set<int> &visited_nodes) { VisualScriptNode::TypeGuess tg; tg.type = Variant::NIL; - if (visited_nodes.has(p_node)) + if (visited_nodes.has(p_port_action_node)) return tg; //no loop - visited_nodes.insert(p_node); + visited_nodes.insert(p_port_action_node); - Ref<VisualScriptNode> node = script->get_node(edited_func, p_node); + Ref<VisualScriptNode> node = script->get_node(edited_func, p_port_action_node); if (!node.is_valid()) { @@ -2479,7 +2479,7 @@ VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_node, i int from_node; int from_port; - if (script->get_input_value_port_connection_source(edited_func, p_node, i, &from_node, &from_port)) { + if (script->get_input_value_port_connection_source(edited_func, p_port_action_node, i, &from_node, &from_port)) { g = _guess_output_type(from_node, from_port, visited_nodes); } else { @@ -2501,7 +2501,7 @@ VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_node, i in_guesses.push_back(g); } - return node->guess_output_type(in_guesses.ptr(), p_output); + return node->guess_output_type(in_guesses.ptr(), p_port_action_output); } void VisualScriptEditor::_port_action_menu(int p_option) { @@ -3271,7 +3271,7 @@ VisualScriptEditor::VisualScriptEditor() { graph->set_area_as_parent_rect(); hint_text = memnew(Label); - hint_text->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, 100); + hint_text->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -100); hint_text->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); hint_text->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); hint_text->set_align(Label::ALIGN_CENTER); diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 3c057cdbd5..afdf50027e 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -341,12 +341,12 @@ String VisualScriptFunctionCall::get_base_script() const { return base_script; } -void VisualScriptFunctionCall::set_singleton(const StringName &p_path) { +void VisualScriptFunctionCall::set_singleton(const StringName &p_type) { - if (singleton == p_path) + if (singleton == p_type) return; - singleton = p_path; + singleton = p_type; Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); if (obj) { base_type = obj->get_class(); diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h index 7839748661..3b38d0d08f 100644 --- a/modules/visual_script/visual_script_func_nodes.h +++ b/modules/visual_script/visual_script_func_nodes.h @@ -70,7 +70,7 @@ private: MethodInfo method_cache; void _update_method_cache(); - void _set_argument_cache(const Dictionary &p_args); + void _set_argument_cache(const Dictionary &p_cache); Dictionary _get_argument_cache() const; protected: diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 923e425997..4f9cd4a33b 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -1208,6 +1208,7 @@ void VisualScriptPreload::set_preload(const Ref<Resource> &p_preload) { preload = p_preload; ports_changed_notify(); } + Ref<Resource> VisualScriptPreload::get_preload() const { return preload; diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h index ff49417114..6ce906efe0 100644 --- a/modules/visual_script/visual_script_nodes.h +++ b/modules/visual_script/visual_script_nodes.h @@ -196,7 +196,7 @@ public: virtual String get_text() const; virtual String get_category() const { return "data"; } - void set_variable(StringName p_var); + void set_variable(StringName p_variable); StringName get_variable() const; virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance); @@ -230,7 +230,7 @@ public: virtual String get_text() const; virtual String get_category() const { return "data"; } - void set_variable(StringName p_var); + void set_variable(StringName p_variable); StringName get_variable() const; virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance); @@ -301,7 +301,7 @@ public: virtual String get_text() const; virtual String get_category() const { return "data"; } - void set_preload(const Ref<Resource> &p_value); + void set_preload(const Ref<Resource> &p_preload); Ref<Resource> get_preload() const; virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance); diff --git a/platform/android/audio_driver_jandroid.h b/platform/android/audio_driver_jandroid.h index e2bb5ede86..3697ca6f21 100644 --- a/platform/android/audio_driver_jandroid.h +++ b/platform/android/audio_driver_jandroid.h @@ -71,7 +71,7 @@ public: virtual void set_pause(bool p_pause); - static void setup(jobject act); + static void setup(jobject p_io); static void thread_func(JNIEnv *env); AudioDriverAndroid(); diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h index 0175595543..21d1f697b7 100644 --- a/platform/android/dir_access_jandroid.h +++ b/platform/android/dir_access_jandroid.h @@ -79,7 +79,7 @@ public: //virtual FileType get_file_type() const; size_t get_space_left(); - static void setup(jobject io); + static void setup(jobject p_io); DirAccessJAndroid(); ~DirAccessJAndroid(); diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h index 9bb471246a..a04f28d0d7 100644 --- a/platform/android/file_access_jandroid.h +++ b/platform/android/file_access_jandroid.h @@ -71,7 +71,7 @@ public: virtual bool file_exists(const String &p_path); ///< return true if a file exists - static void setup(jobject io); + static void setup(jobject p_io); virtual uint64_t _get_modified_time(const String &p_file) { return 0; } diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 71db03049a..6fbd42d7b3 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -739,21 +739,21 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) { } } -void android_main(struct android_app *state) { +void android_main(struct android_app *app) { struct engine engine; // Make sure glue isn't stripped. app_dummy(); memset(&engine, 0, sizeof(engine)); - state->userData = &engine; - state->onAppCmd = engine_handle_cmd; - state->onInputEvent = engine_handle_input; - engine.app = state; + app->userData = &engine; + app->onAppCmd = engine_handle_cmd; + app->onInputEvent = engine_handle_input; + engine.app = app; engine.requested_quit = false; engine.os = NULL; engine.display_active = false; - FileAccessAndroid::asset_manager = state->activity->assetManager; + FileAccessAndroid::asset_manager = app->activity->assetManager; // Prepare to monitor sensors engine.sensorManager = ASensorManager_getInstance(); @@ -764,11 +764,11 @@ void android_main(struct android_app *state) { engine.gyroscopeSensor = ASensorManager_getDefaultSensor(engine.sensorManager, ASENSOR_TYPE_GYROSCOPE); engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager, - state->looper, LOOPER_ID_USER, NULL, NULL); + app->looper, LOOPER_ID_USER, NULL, NULL); - ANativeActivity_setWindowFlags(state->activity, AWINDOW_FLAG_FULLSCREEN | AWINDOW_FLAG_KEEP_SCREEN_ON, 0); + ANativeActivity_setWindowFlags(app->activity, AWINDOW_FLAG_FULLSCREEN | AWINDOW_FLAG_KEEP_SCREEN_ON, 0); - state->activity->vm->AttachCurrentThread(&engine.jni, NULL); + app->activity->vm->AttachCurrentThread(&engine.jni, NULL); // loop waiting for stuff to do. @@ -790,7 +790,7 @@ void android_main(struct android_app *state) { if (source != NULL) { // LOGI("process\n"); - source->process(state, source); + source->process(app, source); } else { nullmax--; if (nullmax < 0) @@ -824,11 +824,11 @@ void android_main(struct android_app *state) { } // Check if we are exiting. - if (state->destroyRequested != 0) { + if (app->destroyRequested != 0) { if (engine.os) { engine.os->main_loop_request_quit(); } - state->destroyRequested = 0; + app->destroyRequested = 0; } if (engine.requested_quit) { diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h index f400f41e28..bcb3304c3e 100644 --- a/platform/android/java_glue.h +++ b/platform/android/java_glue.h @@ -56,8 +56,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv *env, JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv *env, jobject obj, jstring name, jobject p_object); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_method(JNIEnv *env, jobject obj, jstring sname, jstring name, jstring ret, jobjectArray args); JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jobject obj, jstring path); -JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jobject obj, jint ID, jstring method, jobjectArray params); -JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jobject obj, jint ID, jstring method, jobjectArray params); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *env, jobject p_obj, jint ID, jstring method, jobjectArray params); +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jobject p_obj, jint ID, jstring method, jobjectArray params); } #endif diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index a1aa58a5e7..39717196aa 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -171,7 +171,7 @@ class AppxPackager { } Vector<uint8_t> make_file_header(FileMeta p_file_meta); - void store_central_dir_header(const FileMeta p_file, bool p_do_hash = true); + void store_central_dir_header(const FileMeta &p_file, bool p_do_hash = true); Vector<uint8_t> make_end_of_central_record(); String content_type(String p_extension); @@ -329,7 +329,7 @@ Vector<uint8_t> AppxPackager::make_file_header(FileMeta p_file_meta) { return buf; } -void AppxPackager::store_central_dir_header(const FileMeta p_file, bool p_do_hash) { +void AppxPackager::store_central_dir_header(const FileMeta &p_file, bool p_do_hash) { Vector<uint8_t> &buf = central_dir_data; int offs = buf.size(); diff --git a/platform/windows/joypad.cpp b/platform/windows/joypad.cpp index 7263e89c1a..e8a5084daf 100644 --- a/platform/windows/joypad.cpp +++ b/platform/windows/joypad.cpp @@ -235,13 +235,13 @@ void JoypadWindows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_ } } -BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE *instance, void *pContext) { +BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE *p_instance, void *p_context) { - JoypadWindows *self = (JoypadWindows *)pContext; - if (self->is_xinput_device(&instance->guidProduct)) { + JoypadWindows *self = (JoypadWindows *)p_context; + if (self->is_xinput_device(&p_instance->guidProduct)) { return DIENUM_CONTINUE; } - self->setup_dinput_joypad(instance); + self->setup_dinput_joypad(p_instance); return DIENUM_CONTINUE; } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index f72e5ef595..779f909a15 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -889,23 +889,6 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau return (dpiX + dpiY) / 2; } -BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { - OS_Windows *self = (OS_Windows *)OS::get_singleton(); - MonitorInfo minfo; - minfo.hMonitor = hMonitor; - minfo.hdcMonitor = hdcMonitor; - minfo.rect.position.x = lprcMonitor->left; - minfo.rect.position.y = lprcMonitor->top; - minfo.rect.size.x = lprcMonitor->right - lprcMonitor->left; - minfo.rect.size.y = lprcMonitor->bottom - lprcMonitor->top; - - minfo.dpi = QueryDpiForMonitor(hMonitor); - - self->monitor_info.push_back(minfo); - - return TRUE; -} - void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { main_loop = NULL; @@ -941,9 +924,6 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int return; // Return } - EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, 0); - - print_line("DETECTED MONITORS: " + itos(monitor_info.size())); pre_fs_valid = true; if (video_mode.fullscreen) { @@ -1217,8 +1197,6 @@ void OS_Windows::finalize() { physics_2d_server->finish(); memdelete(physics_2d_server); - - monitor_info.clear(); } void OS_Windows::finalize_core() { @@ -1344,51 +1322,131 @@ OS::VideoMode OS_Windows::get_video_mode(int p_screen) const { void OS_Windows::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const { } +static BOOL CALLBACK _MonitorEnumProcCount(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { + + int *data = (int *)dwData; + (*data)++; + return TRUE; +} + int OS_Windows::get_screen_count() const { - return monitor_info.size(); + int data = 0; + EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcCount, (LPARAM)&data); + return data; } -int OS_Windows::get_current_screen() const { - HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST); - for (int i = 0; i < monitor_info.size(); i++) { - if (monitor_info[i].hMonitor == monitor) - return i; +typedef struct { + int count; + int screen; + HMONITOR monitor; +} EnumScreenData; + +static BOOL CALLBACK _MonitorEnumProcScreen(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { + + EnumScreenData *data = (EnumScreenData *)dwData; + if (data->monitor == hMonitor) { + data->screen = data->count; } - return 0; + data->count++; + return TRUE; } -void OS_Windows::set_current_screen(int p_screen) { - ERR_FAIL_INDEX(p_screen, monitor_info.size()); +int OS_Windows::get_current_screen() const { + + EnumScreenData data = { 0, 0, MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST) }; + EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcScreen, (LPARAM)&data); + return data.screen; +} + +void OS_Windows::set_current_screen(int p_screen) { Vector2 ofs = get_window_position() - get_screen_position(get_current_screen()); set_window_position(ofs + get_screen_position(p_screen)); } +typedef struct { + int count; + int screen; + Point2 pos; +} EnumPosData; + +static BOOL CALLBACK _MonitorEnumProcPos(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { + + EnumPosData *data = (EnumPosData *)dwData; + if (data->count == data->screen) { + data->pos.x = lprcMonitor->left; + data->pos.y = lprcMonitor->top; + } + + data->count++; + return TRUE; +} + Point2 OS_Windows::get_screen_position(int p_screen) const { - ERR_FAIL_INDEX_V(p_screen, monitor_info.size(), Point2()); - return Vector2(monitor_info[p_screen].rect.position); + EnumPosData data = { 0, p_screen, Point2() }; + EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcPos, (LPARAM)&data); + return data.pos; } + +typedef struct { + int count; + int screen; + Size2 size; +} EnumSizeData; + +static BOOL CALLBACK _MonitorEnumProcSize(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { + + EnumSizeData *data = (EnumSizeData *)dwData; + if (data->count == data->screen) { + data->size.x = lprcMonitor->right - lprcMonitor->left; + data->size.y = lprcMonitor->bottom - lprcMonitor->top; + } + + data->count++; + return TRUE; +} + Size2 OS_Windows::get_screen_size(int p_screen) const { - ERR_FAIL_INDEX_V(p_screen, monitor_info.size(), Point2()); - return Vector2(monitor_info[p_screen].rect.size); + EnumSizeData data = { 0, p_screen, Size2() }; + EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcSize, (LPARAM)&data); + return data.size; +} + +typedef struct { + int count; + int screen; + int dpi; +} EnumDpiData; + +static BOOL CALLBACK _MonitorEnumProcDpi(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { + + EnumDpiData *data = (EnumDpiData *)dwData; + if (data->count == data->screen) { + data->dpi = QueryDpiForMonitor(hMonitor); + } + + data->count++; + return TRUE; } int OS_Windows::get_screen_dpi(int p_screen) const { - ERR_FAIL_INDEX_V(p_screen, monitor_info.size(), 72); - UINT dpix, dpiy; - return monitor_info[p_screen].dpi; + EnumDpiData data = { 0, p_screen, 72 }; + EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcDpi, (LPARAM)&data); + return data.dpi; } + Point2 OS_Windows::get_window_position() const { RECT r; GetWindowRect(hWnd, &r); return Point2(r.left, r.top); } + void OS_Windows::set_window_position(const Point2 &p_position) { if (video_mode.fullscreen) return; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index beaf5d5e35..e9af14f11c 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -164,22 +164,12 @@ protected: }; Map<ProcessID, ProcessInfo> *process_map; - struct MonitorInfo { - HMONITOR hMonitor; - HDC hdcMonitor; - Rect2 rect; - int dpi; - }; - bool pre_fs_valid; RECT pre_fs_rect; - Vector<MonitorInfo> monitor_info; bool maximized; bool minimized; bool borderless; - static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData); - public: LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/platform/windows/packet_peer_udp_winsock.cpp b/platform/windows/packet_peer_udp_winsock.cpp index f3b91c1b56..3991a90423 100644 --- a/platform/windows/packet_peer_udp_winsock.cpp +++ b/platform/windows/packet_peer_udp_winsock.cpp @@ -118,7 +118,7 @@ void PacketPeerUDPWinsock::_set_sock_blocking(bool p_blocking) { }; } -Error PacketPeerUDPWinsock::listen(int p_port, IP_Address p_bind_address, int p_recv_buffer_size) { +Error PacketPeerUDPWinsock::listen(int p_port, const IP_Address &p_bind_address, int p_recv_buffer_size) { ERR_FAIL_COND_V(sockfd != -1, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); diff --git a/platform/windows/packet_peer_udp_winsock.h b/platform/windows/packet_peer_udp_winsock.h index ceb6df71aa..01f2e5113f 100644 --- a/platform/windows/packet_peer_udp_winsock.h +++ b/platform/windows/packet_peer_udp_winsock.h @@ -67,7 +67,7 @@ public: virtual int get_max_packet_size() const; - virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536); + virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536); virtual void close(); virtual Error wait(); virtual bool is_listening() const; diff --git a/platform/windows/tcp_server_winsock.cpp b/platform/windows/tcp_server_winsock.cpp index 3292813d4e..cc17c8a631 100644 --- a/platform/windows/tcp_server_winsock.cpp +++ b/platform/windows/tcp_server_winsock.cpp @@ -63,7 +63,7 @@ void TCPServerWinsock::cleanup() { }; }; -Error TCPServerWinsock::listen(uint16_t p_port, const IP_Address p_bind_address) { +Error TCPServerWinsock::listen(uint16_t p_port, const IP_Address &p_bind_address) { ERR_FAIL_COND_V(listen_sockfd != -1, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); diff --git a/platform/windows/tcp_server_winsock.h b/platform/windows/tcp_server_winsock.h index 7e5d1e750e..077acb94d7 100644 --- a/platform/windows/tcp_server_winsock.h +++ b/platform/windows/tcp_server_winsock.h @@ -40,7 +40,7 @@ class TCPServerWinsock : public TCP_Server { static TCP_Server *_create(); public: - virtual Error listen(uint16_t p_port, const IP_Address p_bind_address = IP_Address("*")); + virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*")); virtual bool is_connection_available() const; virtual Ref<StreamPeerTCP> take_connection(); diff --git a/platform/x11/joypad_linux.h b/platform/x11/joypad_linux.h index a0ac559b1c..55383885a0 100644 --- a/platform/x11/joypad_linux.h +++ b/platform/x11/joypad_linux.h @@ -80,22 +80,22 @@ private: static void joy_thread_func(void *p_user); - int get_joy_from_path(String path) const; + int get_joy_from_path(String p_path) const; void setup_joypad_properties(int p_id); void close_joypad(int p_id = -1); #ifdef UDEV_ENABLED - void enumerate_joypads(struct udev *_udev); - void monitor_joypads(struct udev *_udev); + void enumerate_joypads(struct udev *p_udev); + void monitor_joypads(struct udev *p_udev); #endif void monitor_joypads(); void run_joypad_thread(); - void open_joypad(const char *path); + void open_joypad(const char *p_path); void joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp); void joypad_vibration_stop(int p_id, uint64_t p_timestamp); - InputDefault::JoyAxis axis_correct(const input_absinfo *abs, int value) const; + InputDefault::JoyAxis axis_correct(const input_absinfo *p_abs, int p_value) const; }; #endif diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index b11c1dd642..20571abdb9 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -552,11 +552,11 @@ float Camera2D::get_h_offset() const { return h_ofs; } -void Camera2D::_set_old_smoothing(float p_val) { +void Camera2D::_set_old_smoothing(float p_enable) { //compatibility - if (p_val > 0) { + if (p_enable > 0) { smoothing_enabled = true; - set_follow_smoothing(p_val); + set_follow_smoothing(p_enable); } } diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 27842727ac..660ddcf930 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -297,7 +297,7 @@ public: void set_use_parent_material(bool p_use_parent_material); bool get_use_parent_material() const; - Ref<InputEvent> make_input_local(const Ref<InputEvent> &pevent) const; + Ref<InputEvent> make_input_local(const Ref<InputEvent> &p_event) const; Vector2 make_canvas_pos_local(const Vector2 &screen_point) const; Vector2 get_global_mouse_position() const; diff --git a/scene/2d/joints_2d.h b/scene/2d/joints_2d.h index b52b0f4670..f854ce51ee 100644 --- a/scene/2d/joints_2d.h +++ b/scene/2d/joints_2d.h @@ -81,7 +81,7 @@ protected: static void _bind_methods(); public: - void set_softness(real_t p_stiffness); + void set_softness(real_t p_softness); real_t get_softness() const; PinJoint2D(); diff --git a/scene/2d/navigation2d.cpp b/scene/2d/navigation2d.cpp index e579838903..383236b4ca 100644 --- a/scene/2d/navigation2d.cpp +++ b/scene/2d/navigation2d.cpp @@ -646,7 +646,8 @@ debug path break; } - path.push_back(begin_point); + if (path[path.size() - 1].distance_to(begin_point) > CMP_EPSILON) + path.push_back(begin_point); path.invert(); } diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index df9a05ff79..a6009851c7 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -49,7 +49,7 @@ class Node2D : public CanvasItem { void _update_transform(); // Deprecated, should be removed in a future version. - void _set_rotd(float p_angle); + void _set_rotd(float p_degrees); float _get_rotd() const; void _update_xform_values(); diff --git a/scene/2d/parallax_background.h b/scene/2d/parallax_background.h index 99d8dd3811..fce1bbd928 100644 --- a/scene/2d/parallax_background.h +++ b/scene/2d/parallax_background.h @@ -60,7 +60,7 @@ public: void set_scroll_offset(const Point2 &p_ofs); Point2 get_scroll_offset() const; - void set_scroll_scale(float p_ofs); + void set_scroll_scale(float p_scale); float get_scroll_scale() const; void set_scroll_base_offset(const Point2 &p_ofs); diff --git a/scene/2d/parallax_layer.h b/scene/2d/parallax_layer.h index 85e70b0a51..f2d0053342 100644 --- a/scene/2d/parallax_layer.h +++ b/scene/2d/parallax_layer.h @@ -48,7 +48,7 @@ protected: static void _bind_methods(); public: - void set_motion_offset(const Size2 &p_scale); + void set_motion_offset(const Size2 &p_offset); Size2 get_motion_offset() const; void set_motion_scale(const Size2 &p_scale); @@ -57,7 +57,7 @@ public: void set_mirroring(const Size2 &p_mirroring); Size2 get_mirroring() const; - void set_base_offset_and_scale(const Point2 &p_offsetf, float p_scale); + void set_base_offset_and_scale(const Point2 &p_offset, float p_scale); virtual String get_configuration_warning() const; ParallaxLayer(); diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index 23278ce746..a6ac0c37d3 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -80,7 +80,7 @@ public: void set_emitting(bool p_emitting); void set_amount(int p_amount); void set_lifetime(float p_lifetime); - void set_one_shot(bool p_enabled); + void set_one_shot(bool p_enable); void set_pre_process_time(float p_time); void set_explosiveness_ratio(float p_ratio); void set_randomness_ratio(float p_ratio); diff --git a/scene/2d/path_2d.h b/scene/2d/path_2d.h index b2dae17735..e80817cd3c 100644 --- a/scene/2d/path_2d.h +++ b/scene/2d/path_2d.h @@ -96,7 +96,7 @@ public: void set_loop(bool p_loop); bool has_loop() const; - void set_rotate(bool p_enabled); + void set_rotate(bool p_rotate); bool is_rotating() const; void set_cubic_interpolation(bool p_enable); diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index f2cc9452b9..3cc9db28b6 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -84,10 +84,10 @@ public: void set_texture_scale(const Size2 &p_scale); Size2 get_texture_scale() const; - void set_invert(bool p_rot); + void set_invert(bool p_invert); bool get_invert() const; - void set_invert_border(float p_border); + void set_invert_border(float p_invert_border); float get_invert_border() const; void set_offset(const Vector2 &p_offset); diff --git a/scene/2d/screen_button.h b/scene/2d/screen_button.h index 8923da2ae4..2a5935aaf1 100644 --- a/scene/2d/screen_button.h +++ b/scene/2d/screen_button.h @@ -61,7 +61,7 @@ private: VisibilityMode visibility; - void _input(const Ref<InputEvent> &p_Event); + void _input(const Ref<InputEvent> &p_event); bool _is_point_inside(const Point2 &p_point); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index e4494742a1..68b026b1b3 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1068,20 +1068,20 @@ Transform2D TileMap::get_custom_transform() const { return custom_transform; } -Vector2 TileMap::_map_to_world(int x, int y, bool p_ignore_ofs) const { +Vector2 TileMap::_map_to_world(int p_x, int p_y, bool p_ignore_ofs) const { - Vector2 ret = get_cell_transform().xform(Vector2(x, y)); + Vector2 ret = get_cell_transform().xform(Vector2(p_x, p_y)); if (!p_ignore_ofs) { switch (half_offset) { case HALF_OFFSET_X: { - if (ABS(y) & 1) { + if (ABS(p_y) & 1) { ret += get_cell_transform()[0] * 0.5; } } break; case HALF_OFFSET_Y: { - if (ABS(x) & 1) { + if (ABS(p_x) & 1) { ret += get_cell_transform()[1] * 0.5; } } break; diff --git a/scene/3d/camera.h b/scene/3d/camera.h index 43975892b4..70849791e5 100644 --- a/scene/3d/camera.h +++ b/scene/3d/camera.h @@ -126,9 +126,9 @@ public: virtual Transform get_camera_transform() const; - Vector3 project_ray_normal(const Point2 &p_point) const; - Vector3 project_ray_origin(const Point2 &p_point) const; - Vector3 project_local_ray_normal(const Point2 &p_point) const; + Vector3 project_ray_normal(const Point2 &p_pos) const; + Vector3 project_ray_origin(const Point2 &p_pos) const; + Vector3 project_local_ray_normal(const Point2 &p_pos) const; Point2 unproject_position(const Vector3 &p_pos) const; bool is_position_behind(const Vector3 &p_pos) const; Vector3 project_position(const Point2 &p_point) const; diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index 4fd215bd1a..2aa6a95718 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -89,13 +89,6 @@ void CollisionShape::_notification(int p_what) { parent->shape_owner_set_transform(owner_id, get_transform()); } } break; - case NOTIFICATION_EXIT_TREE: { - if (parent) { - parent->remove_shape_owner(owner_id); - } - owner_id = 0; - parent = NULL; - } break; case NOTIFICATION_UNPARENTED: { if (parent) { parent->remove_shape_owner(owner_id); diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index 2eb4bf1e6b..bc8452c7e0 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -52,8 +52,8 @@ public: void set_normal(const Vector3 &p_normal); void set_tangent(const Plane &p_tangent); void set_color(const Color &p_color); - void set_uv(const Vector2 &tex_uv); - void set_uv2(const Vector2 &tex_uv); + void set_uv(const Vector2 &p_uv); + void set_uv2(const Vector2 &p_uv2); void add_vertex(const Vector3 &p_vertex); diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 4c93bcfb5e..5d4568f5d3 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -208,6 +208,8 @@ void NavigationMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("get_polygon", "idx"), &NavigationMesh::get_polygon); ClassDB::bind_method(D_METHOD("clear_polygons"), &NavigationMesh::clear_polygons); + ClassDB::bind_method(D_METHOD("create_from_mesh", "mesh"), &NavigationMesh::create_from_mesh); + ClassDB::bind_method(D_METHOD("_set_polygons", "polygons"), &NavigationMesh::_set_polygons); ClassDB::bind_method(D_METHOD("_get_polygons"), &NavigationMesh::_get_polygons); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index d83469da62..e88a52c76a 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -408,7 +408,7 @@ void ParticlesMaterial::init_shaders() { shader_names->anim_speed = "anim_speed"; shader_names->anim_offset = "anim_offset"; - shader_names->initial_linear_velocity = "initial_linear_velocity_random"; + shader_names->initial_linear_velocity_random = "initial_linear_velocity_random"; shader_names->initial_angle_random = "initial_angle_random"; shader_names->angular_velocity_random = "angular_velocity_random"; shader_names->orbit_velocity_random = "orbit_velocity_random"; @@ -755,18 +755,20 @@ void ParticlesMaterial::_update_shader() { code += " pos.z=0.0; \n"; } code += " //apply linear acceleration\n"; - code += " force+=normalize(VELOCITY) * (linear_accel+tex_linear_accel)*mix(1.0,rand_from_seed(alt_seed),linear_accel_random);\n"; + code += " force+= length(VELOCITY) > 0.0 ? normalize(VELOCITY) * (linear_accel+tex_linear_accel)*mix(1.0,rand_from_seed(alt_seed),linear_accel_random) : vec3(0.0);\n"; code += " //apply radial acceleration\n"; code += " vec3 org = vec3(0.0);\n"; - code += " // if (!p_system->local_coordinates)\n"; - code += " //org=p_transform.origin;\n"; - code += " force+=normalize(pos-org) * (radial_accel+tex_radial_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random);\n"; + code += " // if (!p_system->local_coordinates)\n"; + code += " //org=p_transform.origin;\n"; + code += " vec3 diff = pos-org;\n"; + code += " force+=length(diff) > 0.0 ? normalize(diff) * (radial_accel+tex_radial_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random) : vec3(0.0);\n"; code += " //apply tangential acceleration;\n"; if (flags[FLAG_DISABLE_Z]) { - code += " force+=vec3(normalize((pos-org).yx * vec2(-1.0,1.0)),0.0) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n"; + code += " force+=length(diff.yx) > 0.0 ? vec3(normalize(diff.yx * vec2(-1.0,1.0)),0.0) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random)) : vec3(0.0);\n"; } else { - code += " force+=normalize(cross(normalize(pos-org),normalize(gravity))) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n"; + code += " vec3 crossDiff = cross(normalize(diff),normalize(gravity));\n"; + code += " force+=length(crossDiff) > 0.0 ? normalize(crossDiff) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random)) : vec3(0.0);\n"; } code += " //apply attractor forces\n"; code += " VELOCITY+=force * DELTA;\n"; @@ -1266,9 +1268,8 @@ int ParticlesMaterial::get_emission_point_count() const { void ParticlesMaterial::set_trail_divisor(int p_divisor) { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor); trail_divisor = p_divisor; - _change_notify(); + VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor); } int ParticlesMaterial::get_trail_divisor() const { diff --git a/scene/3d/particles.h b/scene/3d/particles.h index 31ca85a59a..9c1436a47b 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -88,7 +88,7 @@ public: void set_emitting(bool p_emitting); void set_amount(int p_amount); void set_lifetime(float p_lifetime); - void set_one_shot(bool p_enabled); + void set_one_shot(bool p_one_shot); void set_pre_process_time(float p_time); void set_explosiveness_ratio(float p_ratio); void set_randomness_ratio(float p_ratio); diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp index 5441904d81..d0410f2c55 100644 --- a/scene/3d/proximity_group.cpp +++ b/scene/3d/proximity_group.cpp @@ -116,9 +116,9 @@ void ProximityGroup::set_group_name(String p_group_name) { group_name = p_group_name; }; -void ProximityGroup::_notification(int what) { +void ProximityGroup::_notification(int p_what) { - switch (what) { + switch (p_what) { case NOTIFICATION_EXIT_TREE: ++group_version; diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index 0d91014314..cee97af244 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -82,9 +82,9 @@ bool Skeleton::_set(const StringName &p_path, const Variant &p_value) { return true; } -bool Skeleton::_get(const StringName &p_name, Variant &r_ret) const { +bool Skeleton::_get(const StringName &p_path, Variant &r_ret) const { - String path = p_name; + String path = p_path; if (!path.begins_with("bones/")) return false; diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h index dc0adbb337..a6546af64e 100644 --- a/scene/3d/skeleton.h +++ b/scene/3d/skeleton.h @@ -91,8 +91,8 @@ class Skeleton : public Spatial { } protected: - bool _get(const StringName &p_name, Variant &r_ret) const; - bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_path, Variant &r_ret) const; + bool _set(const StringName &p_path, const Variant &p_value); void _get_property_list(List<PropertyInfo> *p_list) const; void _notification(int p_what); static void _bind_methods(); @@ -113,7 +113,7 @@ public: void set_bone_parent(int p_bone, int p_parent); int get_bone_parent(int p_bone) const; - void unparent_bone_and_rest(int p_idx); + void unparent_bone_and_rest(int p_bone); void set_bone_disable_rest(int p_bone, bool p_disable); bool is_bone_rest_disabled(int p_bone) const; diff --git a/scene/3d/spatial_velocity_tracker.h b/scene/3d/spatial_velocity_tracker.h index 65f3eaca93..b8237613a7 100644 --- a/scene/3d/spatial_velocity_tracker.h +++ b/scene/3d/spatial_velocity_tracker.h @@ -20,7 +20,7 @@ protected: public: void reset(const Vector3 &p_new_pos); - void set_track_fixed_step(bool p_use_fixed_step); + void set_track_fixed_step(bool p_track_fixed_step); bool is_tracking_fixed_step() const; void update_position(const Vector3 &p_position); Vector3 get_tracked_linear_velocity() const; diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index b4600c00b8..7dc4cd4ffb 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -119,7 +119,7 @@ public: void set_pixel_size(float p_amount); float get_pixel_size() const; - void set_axis(Vector3::Axis p_amount); + void set_axis(Vector3::Axis p_axis); Vector3::Axis get_axis() const; void set_draw_flag(DrawFlags p_flag, bool p_enable); diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 8d927e529e..adf235c525 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -893,9 +893,9 @@ real_t VehicleBody::get_friction() const { return friction; } -void VehicleBody::set_engine_force(float p_force) { +void VehicleBody::set_engine_force(float p_engine_force) { - engine_force = p_force; + engine_force = p_engine_force; } float VehicleBody::get_engine_force() const { diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h index 7ed9bce730..d778800814 100644 --- a/scene/3d/vehicle_body.h +++ b/scene/3d/vehicle_body.h @@ -196,7 +196,7 @@ public: void set_engine_force(float p_engine_force); float get_engine_force() const; - void set_brake(float p_force); + void set_brake(float p_brake); float get_brake() const; void set_steering(float p_steering); diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 96fc70a3ad..01b709205a 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -271,7 +271,7 @@ public: void set_speed_scale(float p_speed); float get_speed_scale() const; - void set_autoplay(const String &pname); + void set_autoplay(const String &p_name); String get_autoplay() const; void set_animation_process_mode(AnimationProcessMode p_mode); diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h index 062b4e1eeb..47f18795bd 100644 --- a/scene/animation/animation_tree_player.h +++ b/scene/animation/animation_tree_player.h @@ -312,7 +312,7 @@ private: Map<StringName, NodeBase *> node_map; // return time left to finish animation - float _process_node(const StringName &p_node, AnimationNode **r_prev_anim, float p_step, bool p_seek = false, float p_fallback_weight = 1.0, HashMap<NodePath, float> *p_weights = NULL); + float _process_node(const StringName &p_node, AnimationNode **r_prev_anim, float p_time, bool p_seek = false, float p_fallback_weight = 1.0, HashMap<NodePath, float> *p_weights = NULL); void _process_animation(float p_delta); bool reset_request; @@ -367,7 +367,7 @@ public: float oneshot_node_get_autorestart_delay(const StringName &p_node) const; float oneshot_node_get_autorestart_random_delay(const StringName &p_node) const; - void oneshot_node_set_mix_mode(const StringName &p_node, bool p_enabled); + void oneshot_node_set_mix_mode(const StringName &p_node, bool p_mix); bool oneshot_node_get_mix_mode(const StringName &p_node) const; void oneshot_node_start(const StringName &p_node); @@ -428,8 +428,8 @@ public: void remove_node(const StringName &p_node); Error connect_nodes(const StringName &p_src_node, const StringName &p_dst_node, int p_dst_input); - bool are_nodes_connected(const StringName &p_src_node, const StringName &p_dst_node, int p_input) const; - void disconnect_nodes(const StringName &p_src_node, int p_input); + bool are_nodes_connected(const StringName &p_src_node, const StringName &p_dst_node, int p_dst_input) const; + void disconnect_nodes(const StringName &p_node, int p_input); void set_base_path(const NodePath &p_path); NodePath get_base_path() const; diff --git a/scene/animation/tween.h b/scene/animation/tween.h index f89f3bdc44..43234fab86 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -132,7 +132,7 @@ private: void _tween_process(float p_delta); void _set_process(bool p_process, bool p_force = false); - void _remove(Object *p_node, String p_key, bool first_only); + void _remove(Object *p_object, String p_key, bool first_only); protected: bool _set(const StringName &p_name, const Variant &p_value); @@ -156,34 +156,34 @@ public: float get_speed_scale() const; bool start(); - bool reset(Object *p_node, String p_key); + bool reset(Object *p_object, String p_key); bool reset_all(); - bool stop(Object *p_node, String p_key); + bool stop(Object *p_object, String p_key); bool stop_all(); - bool resume(Object *p_node, String p_key); + bool resume(Object *p_object, String p_key); bool resume_all(); - bool remove(Object *p_node, String p_key); + bool remove(Object *p_object, String p_key); bool remove_all(); bool seek(real_t p_time); real_t tell() const; real_t get_runtime() const; - bool interpolate_property(Object *p_node, String p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); + bool interpolate_property(Object *p_object, String p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); - bool interpolate_method(Object *p_node, String p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); + bool interpolate_method(Object *p_object, String p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); bool interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE); bool interpolate_deferred_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE); - bool follow_property(Object *p_node, String p_property, Variant p_initial_val, Object *p_target, String p_target_property, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); + bool follow_property(Object *p_object, String p_property, Variant p_initial_val, Object *p_target, String p_target_property, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); - bool follow_method(Object *p_node, String p_method, Variant p_initial_val, Object *p_target, String p_target_method, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); + bool follow_method(Object *p_object, String p_method, Variant p_initial_val, Object *p_target, String p_target_method, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); - bool targeting_property(Object *p_node, String p_property, Object *p_initial, String p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); + bool targeting_property(Object *p_object, String p_property, Object *p_initial, String p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); - bool targeting_method(Object *p_node, String p_method, Object *p_initial, String p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); + bool targeting_method(Object *p_object, String p_method, Object *p_initial, String p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0); Tween(); ~Tween(); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index dddd53dd95..5e110362c8 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -314,9 +314,9 @@ void ColorPicker::_hsv_draw(int p_which, Control *c) { } } -void ColorPicker::_uv_input(const Ref<InputEvent> &ev) { +void ColorPicker::_uv_input(const Ref<InputEvent> &p_event) { - Ref<InputEventMouseButton> bev = ev; + Ref<InputEventMouseButton> bev = p_event; if (bev.is_valid()) { if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) { @@ -335,7 +335,7 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &ev) { } } - Ref<InputEventMouseMotion> mev = ev; + Ref<InputEventMouseMotion> mev = p_event; if (mev.is_valid()) { if (!changing_color) @@ -352,9 +352,9 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &ev) { } } -void ColorPicker::_w_input(const Ref<InputEvent> &ev) { +void ColorPicker::_w_input(const Ref<InputEvent> &p_event) { - Ref<InputEventMouseButton> bev = ev; + Ref<InputEventMouseButton> bev = p_event; if (bev.is_valid()) { @@ -372,7 +372,7 @@ void ColorPicker::_w_input(const Ref<InputEvent> &ev) { emit_signal("color_changed", color); } - Ref<InputEventMouseMotion> mev = ev; + Ref<InputEventMouseMotion> mev = p_event; if (mev.is_valid()) { @@ -388,9 +388,9 @@ void ColorPicker::_w_input(const Ref<InputEvent> &ev) { } } -void ColorPicker::_preset_input(const Ref<InputEvent> &ev) { +void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) { - Ref<InputEventMouseButton> bev = ev; + Ref<InputEventMouseButton> bev = p_event; if (bev.is_valid()) { @@ -407,7 +407,7 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &ev) { emit_signal("color_changed", color); } - Ref<InputEventMouseMotion> mev = ev; + Ref<InputEventMouseMotion> mev = p_event; if (mev.is_valid()) { @@ -423,9 +423,9 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &ev) { } } -void ColorPicker::_screen_input(const Ref<InputEvent> &ev) { +void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) { - Ref<InputEventMouseButton> bev = ev; + Ref<InputEventMouseButton> bev = p_event; if (bev.is_valid()) { @@ -435,7 +435,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &ev) { } } - Ref<InputEventMouseMotion> mev = ev; + Ref<InputEventMouseMotion> mev = p_event; if (mev.is_valid()) { Viewport *r = get_tree()->get_root(); diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h index 1a79266409..d35182e062 100644 --- a/scene/gui/color_picker.h +++ b/scene/gui/color_picker.h @@ -81,10 +81,10 @@ private: void _sample_draw(); void _hsv_draw(int p_which, Control *c); - void _uv_input(const Ref<InputEvent> &p_input); - void _w_input(const Ref<InputEvent> &p_input); - void _preset_input(const Ref<InputEvent> &p_input); - void _screen_input(const Ref<InputEvent> &p_input); + void _uv_input(const Ref<InputEvent> &p_event); + void _w_input(const Ref<InputEvent> &p_event); + void _preset_input(const Ref<InputEvent> &p_event); + void _screen_input(const Ref<InputEvent> &p_event); void _add_preset_pressed(); void _screen_pick_pressed(); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 01570e28c4..c97426ad42 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -51,6 +51,12 @@ Variant Control::edit_get_state() const { s["rect"] = get_rect(); s["rot"] = get_rotation(); s["scale"] = get_scale(); + Array anchors; + anchors.push_back(get_anchor(MARGIN_LEFT)); + anchors.push_back(get_anchor(MARGIN_TOP)); + anchors.push_back(get_anchor(MARGIN_RIGHT)); + anchors.push_back(get_anchor(MARGIN_BOTTOM)); + s["anchors"] = anchors; return s; } void Control::edit_set_state(const Variant &p_state) { @@ -62,6 +68,11 @@ void Control::edit_set_state(const Variant &p_state) { set_size(state.size); set_rotation(s["rot"]); set_scale(s["scale"]); + Array anchors = s["anchors"]; + set_anchor(MARGIN_LEFT, anchors[0]); + set_anchor(MARGIN_TOP, anchors[1]); + set_anchor(MARGIN_RIGHT, anchors[2]); + set_anchor(MARGIN_BOTTOM, anchors[3]); } void Control::set_custom_minimum_size(const Size2 &p_custom) { @@ -1212,21 +1223,7 @@ void Control::_size_changed() { for (int i = 0; i < 4; i++) { float area = parent_size[i & 1]; - switch (data.anchor[i]) { - - case ANCHOR_BEGIN: { - - margin_pos[i] = data.margin[i]; - } break; - case ANCHOR_END: { - - margin_pos[i] = area - data.margin[i]; - } break; - case ANCHOR_CENTER: { - - margin_pos[i] = (area / 2) - data.margin[i]; - } break; - } + margin_pos[i] = data.margin[i] + (data.anchor[i] * area); } Point2 new_pos_cache = Point2(margin_pos[0], margin_pos[1]); @@ -1299,59 +1296,38 @@ float Control::_get_range(int p_idx) const { return to - from; } -float Control::_s2a(float p_val, AnchorType p_anchor, float p_range) const { - - switch (p_anchor) { - - case ANCHOR_BEGIN: { - return p_val; - } break; - case ANCHOR_END: { - return p_range - p_val; - } break; - case ANCHOR_CENTER: { - return (p_range / 2) - p_val; - } break; - } - - return 0; +float Control::_s2a(float p_val, float p_anchor, float p_range) const { + return p_val - (p_anchor * p_range); } -float Control::_a2s(float p_val, AnchorType p_anchor, float p_range) const { - - switch (p_anchor) { - - case ANCHOR_BEGIN: { - return Math::floor(p_val); - } break; - case ANCHOR_END: { - return Math::floor(p_range - p_val); - } break; - case ANCHOR_CENTER: { - return Math::floor((p_range / 2) - p_val); - } break; - } - return 0; +float Control::_a2s(float p_val, float p_anchor, float p_range) const { + return Math::floor(p_val + (p_anchor * p_range)); } -void Control::set_anchor(Margin p_margin, AnchorType p_anchor, bool p_keep_margin) { +void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bool p_push_opposite_anchor) { + bool pushed = false; + data.anchor[p_margin] = CLAMP(p_anchor, 0.0, 1.0); - if (!is_inside_tree()) { + if (((p_margin == MARGIN_LEFT || p_margin == MARGIN_TOP) && data.anchor[p_margin] > data.anchor[(p_margin + 2) % 4]) || + ((p_margin == MARGIN_RIGHT || p_margin == MARGIN_BOTTOM) && data.anchor[p_margin] < data.anchor[(p_margin + 2) % 4])) { + if (p_push_opposite_anchor) { + data.anchor[(p_margin + 2) % 4] = data.anchor[p_margin]; + pushed = true; + } else { + data.anchor[p_margin] = data.anchor[(p_margin + 2) % 4]; + } + } - data.anchor[p_margin] = p_anchor; - } else if (!p_keep_margin) { - float pr = _get_parent_range(p_margin); - float s = _a2s(data.margin[p_margin], data.anchor[p_margin], pr); - data.anchor[p_margin] = p_anchor; - data.margin[p_margin] = _s2a(s, p_anchor, pr); - } else { - data.anchor[p_margin] = p_anchor; - _size_changed(); + if (is_inside_tree()) { + if (p_keep_margin) { + _size_changed(); + } } + update(); _change_notify(); } -void Control::_set_anchor(Margin p_margin, AnchorType p_anchor) { +void Control::_set_anchor(Margin p_margin, float p_anchor) { #ifdef TOOLS_ENABLED if (is_inside_tree() && get_tree()->is_editor_hint()) { set_anchor(p_margin, p_anchor, EDITOR_DEF("editors/2d/keep_margins_when_changing_anchors", false)); @@ -1363,13 +1339,127 @@ void Control::_set_anchor(Margin p_margin, AnchorType p_anchor) { #endif } -void Control::set_anchor_and_margin(Margin p_margin, AnchorType p_anchor, float p_pos) { +void Control::set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor) { - set_anchor(p_margin, p_anchor); + set_anchor(p_margin, p_anchor, false, p_push_opposite_anchor); set_margin(p_margin, p_pos); } -Control::AnchorType Control::get_anchor(Margin p_margin) const { +void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) { + //Left + switch (p_preset) { + case PRESET_TOP_LEFT: + case PRESET_BOTTOM_LEFT: + case PRESET_CENTER_LEFT: + case PRESET_TOP_WIDE: + case PRESET_BOTTOM_WIDE: + case PRESET_LEFT_WIDE: + case PRESET_HCENTER_WIDE: + case PRESET_WIDE: + set_anchor(MARGIN_LEFT, ANCHOR_BEGIN, p_keep_margin); + break; + + case PRESET_CENTER_TOP: + case PRESET_CENTER_BOTTOM: + case PRESET_CENTER: + case PRESET_VCENTER_WIDE: + set_anchor(MARGIN_LEFT, 0.5, p_keep_margin); + break; + + case PRESET_TOP_RIGHT: + case PRESET_BOTTOM_RIGHT: + case PRESET_CENTER_RIGHT: + case PRESET_RIGHT_WIDE: + set_anchor(MARGIN_LEFT, ANCHOR_END, p_keep_margin); + break; + } + + // Top + switch (p_preset) { + case PRESET_TOP_LEFT: + case PRESET_TOP_RIGHT: + case PRESET_CENTER_TOP: + case PRESET_LEFT_WIDE: + case PRESET_RIGHT_WIDE: + case PRESET_TOP_WIDE: + case PRESET_VCENTER_WIDE: + case PRESET_WIDE: + set_anchor(MARGIN_TOP, ANCHOR_BEGIN, p_keep_margin); + break; + + case PRESET_CENTER_LEFT: + case PRESET_CENTER_RIGHT: + case PRESET_CENTER: + case PRESET_HCENTER_WIDE: + set_anchor(MARGIN_TOP, 0.5, p_keep_margin); + break; + + case PRESET_BOTTOM_LEFT: + case PRESET_BOTTOM_RIGHT: + case PRESET_CENTER_BOTTOM: + case PRESET_BOTTOM_WIDE: + set_anchor(MARGIN_TOP, ANCHOR_END, p_keep_margin); + break; + } + + // Right + switch (p_preset) { + case PRESET_TOP_LEFT: + case PRESET_BOTTOM_LEFT: + case PRESET_CENTER_LEFT: + case PRESET_LEFT_WIDE: + set_anchor(MARGIN_RIGHT, ANCHOR_BEGIN, p_keep_margin); + break; + + case PRESET_CENTER_TOP: + case PRESET_CENTER_BOTTOM: + case PRESET_CENTER: + case PRESET_VCENTER_WIDE: + set_anchor(MARGIN_RIGHT, 0.5, p_keep_margin); + break; + + case PRESET_TOP_RIGHT: + case PRESET_BOTTOM_RIGHT: + case PRESET_CENTER_RIGHT: + case PRESET_TOP_WIDE: + case PRESET_RIGHT_WIDE: + case PRESET_BOTTOM_WIDE: + case PRESET_HCENTER_WIDE: + case PRESET_WIDE: + set_anchor(MARGIN_RIGHT, ANCHOR_END, p_keep_margin); + break; + } + + // Bottom + switch (p_preset) { + case PRESET_TOP_LEFT: + case PRESET_TOP_RIGHT: + case PRESET_CENTER_TOP: + case PRESET_TOP_WIDE: + set_anchor(MARGIN_BOTTOM, ANCHOR_BEGIN, p_keep_margin); + break; + + case PRESET_CENTER_LEFT: + case PRESET_CENTER_RIGHT: + case PRESET_CENTER: + case PRESET_HCENTER_WIDE: + set_anchor(MARGIN_BOTTOM, 0.5, p_keep_margin); + break; + + case PRESET_BOTTOM_LEFT: + case PRESET_BOTTOM_RIGHT: + case PRESET_CENTER_BOTTOM: + case PRESET_LEFT_WIDE: + case PRESET_RIGHT_WIDE: + case PRESET_BOTTOM_WIDE: + case PRESET_VCENTER_WIDE: + case PRESET_WIDE: + set_anchor(MARGIN_BOTTOM, ANCHOR_END, p_keep_margin); + break; + } +} + +float Control::get_anchor(Margin p_margin) const { return data.anchor[p_margin]; } @@ -1523,11 +1613,13 @@ Rect2 Control::get_item_rect() const { void Control::set_area_as_parent_rect(int p_margin) { data.anchor[MARGIN_LEFT] = ANCHOR_BEGIN; + data.margin[MARGIN_LEFT] = p_margin; data.anchor[MARGIN_TOP] = ANCHOR_BEGIN; + data.margin[MARGIN_TOP] = p_margin; data.anchor[MARGIN_RIGHT] = ANCHOR_END; + data.margin[MARGIN_RIGHT] = -p_margin; data.anchor[MARGIN_BOTTOM] = ANCHOR_END; - for (int i = 0; i < 4; i++) - data.margin[i] = p_margin; + data.margin[MARGIN_BOTTOM] = -p_margin; _size_changed(); } @@ -2371,11 +2463,12 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("accept_event"), &Control::accept_event); ClassDB::bind_method(D_METHOD("get_minimum_size"), &Control::get_minimum_size); ClassDB::bind_method(D_METHOD("get_combined_minimum_size"), &Control::get_combined_minimum_size); - ClassDB::bind_method(D_METHOD("set_anchor", "margin", "anchor_mode", "keep_margin"), &Control::set_anchor, DEFVAL(false)); - ClassDB::bind_method(D_METHOD("_set_anchor", "margin", "anchor_mode"), &Control::_set_anchor); + ClassDB::bind_method(D_METHOD("set_anchor", "margin", "anchor", "keep_margin", "push_opposite_anchor"), &Control::set_anchor, DEFVAL(false), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("_set_anchor", "margin", "anchor"), &Control::_set_anchor); + ClassDB::bind_method(D_METHOD("set_anchors_preset", "preset", "keep_margin"), &Control::set_anchors_preset, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_anchor", "margin"), &Control::get_anchor); ClassDB::bind_method(D_METHOD("set_margin", "margin", "offset"), &Control::set_margin); - ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor_mode", "offset"), &Control::set_anchor_and_margin); + ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor", "offset", "push_opposite_anchor"), &Control::set_anchor_and_margin, DEFVAL(false)); ClassDB::bind_method(D_METHOD("set_begin", "pos"), &Control::set_begin); ClassDB::bind_method(D_METHOD("set_end", "pos"), &Control::set_end); ClassDB::bind_method(D_METHOD("set_position", "pos"), &Control::set_position); @@ -2497,10 +2590,10 @@ void Control::_bind_methods() { BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data"))); ADD_GROUP("Anchor", "anchor_"); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_left", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_LEFT); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_top", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_TOP); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_right", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_RIGHT); - ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_bottom", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_BOTTOM); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_left", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_LEFT); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_top", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_TOP); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_right", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_RIGHT); + ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_bottom", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_BOTTOM); ADD_GROUP("Margin", "margin_"); ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "margin_left", PROPERTY_HINT_RANGE, "-4096,4096"), "set_margin", "get_margin", MARGIN_LEFT); @@ -2541,9 +2634,6 @@ void Control::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme"); ADD_GROUP("", ""); - BIND_CONSTANT(ANCHOR_BEGIN); - BIND_CONSTANT(ANCHOR_END); - BIND_CONSTANT(ANCHOR_CENTER); BIND_CONSTANT(FOCUS_NONE); BIND_CONSTANT(FOCUS_CLICK); BIND_CONSTANT(FOCUS_ALL); @@ -2574,6 +2664,23 @@ void Control::_bind_methods() { BIND_CONSTANT(CURSOR_HSPLIT); BIND_CONSTANT(CURSOR_HELP); + BIND_CONSTANT(PRESET_TOP_LEFT); + BIND_CONSTANT(PRESET_TOP_RIGHT); + BIND_CONSTANT(PRESET_BOTTOM_LEFT); + BIND_CONSTANT(PRESET_BOTTOM_RIGHT); + BIND_CONSTANT(PRESET_CENTER_LEFT); + BIND_CONSTANT(PRESET_CENTER_TOP); + BIND_CONSTANT(PRESET_CENTER_RIGHT); + BIND_CONSTANT(PRESET_CENTER_BOTTOM); + BIND_CONSTANT(PRESET_CENTER); + BIND_CONSTANT(PRESET_LEFT_WIDE); + BIND_CONSTANT(PRESET_TOP_WIDE); + BIND_CONSTANT(PRESET_RIGHT_WIDE); + BIND_CONSTANT(PRESET_BOTTOM_WIDE); + BIND_CONSTANT(PRESET_VCENTER_WIDE); + BIND_CONSTANT(PRESET_HCENTER_WIDE); + BIND_CONSTANT(PRESET_WIDE); + BIND_CONSTANT(SIZE_EXPAND); BIND_CONSTANT(SIZE_FILL); BIND_CONSTANT(SIZE_EXPAND_FILL); @@ -2587,6 +2694,9 @@ void Control::_bind_methods() { BIND_CONSTANT(GROW_DIRECTION_BEGIN); BIND_CONSTANT(GROW_DIRECTION_END); + BIND_CONSTANT(ANCHOR_BEGIN); + BIND_CONSTANT(ANCHOR_END); + ADD_SIGNAL(MethodInfo("resized")); ADD_SIGNAL(MethodInfo("gui_input", PropertyInfo(Variant::OBJECT, "ev", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); ADD_SIGNAL(MethodInfo("mouse_entered")); diff --git a/scene/gui/control.h b/scene/gui/control.h index 86cf8f6dbd..d73ca3f7c9 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -51,10 +51,10 @@ class Control : public CanvasItem { OBJ_CATEGORY("GUI Nodes"); public: - enum AnchorType { - ANCHOR_BEGIN, - ANCHOR_END, - ANCHOR_CENTER, + enum Anchor { + + ANCHOR_BEGIN = 0, + ANCHOR_END = 1 }; enum GrowDirection { @@ -105,6 +105,25 @@ public: CURSOR_MAX }; + enum LayoutPreset { + PRESET_TOP_LEFT, + PRESET_TOP_RIGHT, + PRESET_BOTTOM_LEFT, + PRESET_BOTTOM_RIGHT, + PRESET_CENTER_LEFT, + PRESET_CENTER_TOP, + PRESET_CENTER_RIGHT, + PRESET_CENTER_BOTTOM, + PRESET_CENTER, + PRESET_LEFT_WIDE, + PRESET_TOP_WIDE, + PRESET_RIGHT_WIDE, + PRESET_BOTTOM_WIDE, + PRESET_VCENTER_WIDE, + PRESET_HCENTER_WIDE, + PRESET_WIDE + }; + private: struct CComparator { @@ -122,7 +141,7 @@ private: Size2 size_cache; float margin[4]; - AnchorType anchor[4]; + float anchor[4]; FocusMode focus_mode; GrowDirection h_grow; GrowDirection v_grow; @@ -182,12 +201,12 @@ private: void _window_find_focus_neighbour(const Vector2 &p_dir, Node *p_at, const Point2 *p_points, float p_min, float &r_closest_dist, Control **r_closest); Control *_get_focus_neighbour(Margin p_margin, int p_count = 0); - void _set_anchor(Margin p_margin, AnchorType p_anchor); + void _set_anchor(Margin p_margin, float p_anchor); float _get_parent_range(int p_idx) const; float _get_range(int p_idx) const; - float _s2a(float p_val, AnchorType p_anchor, float p_range) const; - float _a2s(float p_val, AnchorType p_anchor, float p_range) const; + float _s2a(float p_val, float p_anchor, float p_range) const; + float _a2s(float p_val, float p_anchor, float p_range) const; void _propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool p_assign = true); void _theme_changed(); @@ -275,10 +294,11 @@ public: /* POSITIONING */ - void set_anchor(Margin p_margin, AnchorType p_anchor, bool p_keep_margin = false); - void set_anchor_and_margin(Margin p_margin, AnchorType p_anchor, float p_pos); + void set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin = false, bool p_push_opposite_anchor = true); + void set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor = true); + void set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin = false); - AnchorType get_anchor(Margin p_margin) const; + float get_anchor(Margin p_margin) const; void set_margin(Margin p_margin, float p_value); @@ -425,11 +445,12 @@ public: ~Control(); }; -VARIANT_ENUM_CAST(Control::AnchorType); VARIANT_ENUM_CAST(Control::FocusMode); VARIANT_ENUM_CAST(Control::SizeFlags); VARIANT_ENUM_CAST(Control::CursorShape); +VARIANT_ENUM_CAST(Control::LayoutPreset); VARIANT_ENUM_CAST(Control::MouseFilter); VARIANT_ENUM_CAST(Control::GrowDirection); +VARIANT_ENUM_CAST(Control::Anchor); #endif diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index c1e0be97ee..8232a7a466 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -215,7 +215,7 @@ void WindowDialog::_notification(int p_what) { close_button->set_pressed_texture(get_icon("close", "WindowDialog")); close_button->set_hover_texture(get_icon("close_highlight", "WindowDialog")); close_button->set_anchor(MARGIN_LEFT, ANCHOR_END); - close_button->set_begin(Point2(get_constant("close_h_ofs", "WindowDialog"), -get_constant("close_v_ofs", "WindowDialog"))); + close_button->set_begin(Point2(-get_constant("close_h_ofs", "WindowDialog"), -get_constant("close_v_ofs", "WindowDialog"))); } break; case NOTIFICATION_MOUSE_EXIT: { @@ -546,7 +546,7 @@ AcceptDialog::AcceptDialog() { label->set_anchor(MARGIN_RIGHT, ANCHOR_END); label->set_anchor(MARGIN_BOTTOM, ANCHOR_END); label->set_begin(Point2(margin, margin)); - label->set_end(Point2(margin, button_margin + 10)); + label->set_end(Point2(-margin, -button_margin - 10)); //label->set_autowrap(true); add_child(label); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index e85ef73f4e..ec1932ed5a 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -269,14 +269,14 @@ void GraphEdit::_notification(int p_what) { Size2 hmin = h_scroll->get_combined_minimum_size(); Size2 vmin = v_scroll->get_combined_minimum_size(); - v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, vmin.width); + v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -vmin.width); v_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); v_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0); v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); h_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0); h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); - h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, hmin.height); + h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height); h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); zoom_minus->set_icon(get_icon("minus")); diff --git a/scene/gui/input_action.h b/scene/gui/input_action.h index 6d13d8bd40..5c91d2be28 100644 --- a/scene/gui/input_action.h +++ b/scene/gui/input_action.h @@ -45,7 +45,7 @@ protected: public: void set_shortcut(const Ref<InputEvent> &p_shortcut); Ref<InputEvent> get_shortcut() const; - bool is_shortcut(const Ref<InputEvent> &p_Event) const; + bool is_shortcut(const Ref<InputEvent> &p_event) const; bool is_valid() const; String get_as_text() const; diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 484051f546..d90f0c7898 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -736,10 +736,10 @@ void ItemList::_notification(int p_what) { Ref<StyleBox> bg = get_stylebox("bg"); int mw = scroll_bar->get_minimum_size().x; - scroll_bar->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, mw + bg->get_margin(MARGIN_RIGHT)); - scroll_bar->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, bg->get_margin(MARGIN_RIGHT)); + scroll_bar->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -mw + bg->get_margin(MARGIN_RIGHT)); + scroll_bar->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -bg->get_margin(MARGIN_RIGHT)); scroll_bar->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, bg->get_margin(MARGIN_TOP)); - scroll_bar->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, bg->get_margin(MARGIN_BOTTOM)); + scroll_bar->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -bg->get_margin(MARGIN_BOTTOM)); Size2 size = get_size(); diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index 137eff8885..5bf343daa5 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -171,7 +171,7 @@ public: void set_same_column_width(bool p_enable); int is_same_column_width() const; - void set_max_text_lines(int p_amount); + void set_max_text_lines(int p_lines); int get_max_text_lines() const; void set_max_columns(int p_amount); diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index 73c5a46937..fb0eaa9446 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -177,7 +177,7 @@ public: virtual Size2 get_minimum_size() const; - void set_expand_to_text_length(bool p_len); + void set_expand_to_text_length(bool p_enabled); bool get_expand_to_text_length() const; virtual bool is_text_field() const; diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 25ac8d5259..00df266a09 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -185,21 +185,21 @@ void OptionButton::clear() { current = -1; } -void OptionButton::_select(int p_idx, bool p_emit) { +void OptionButton::_select(int p_which, bool p_emit) { - if (p_idx < 0) + if (p_which < 0) return; - if (p_idx == current) + if (p_which == current) return; - ERR_FAIL_INDEX(p_idx, popup->get_item_count()); + ERR_FAIL_INDEX(p_which, popup->get_item_count()); for (int i = 0; i < popup->get_item_count(); i++) { - popup->set_item_checked(i, i == p_idx); + popup->set_item_checked(i, i == p_which); } - current = p_idx; + current = p_which; set_text(popup->get_item_text(current)); set_icon(popup->get_item_icon(current)); diff --git a/scene/gui/patch_9_rect.h b/scene/gui/patch_9_rect.h index 602a6d22bf..636b9127e7 100644 --- a/scene/gui/patch_9_rect.h +++ b/scene/gui/patch_9_rect.h @@ -67,7 +67,7 @@ public: void set_region_rect(const Rect2 &p_region_rect); Rect2 get_region_rect() const; - void set_draw_center(bool p_enable); + void set_draw_center(bool p_draw); bool get_draw_center() const; void set_h_axis_stretch_mode(AxisStretchMode p_mode); diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 8979e0f111..f2ba6bfbc4 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -108,13 +108,10 @@ void Popup::set_as_minsize() { float margin_begin = c->get_margin(m_beg); float margin_end = c->get_margin(m_end); - AnchorType anchor_begin = c->get_anchor(m_beg); - AnchorType anchor_end = c->get_anchor(m_end); + float anchor_begin = c->get_anchor(m_beg); + float anchor_end = c->get_anchor(m_end); - if (anchor_begin == ANCHOR_BEGIN) - minsize[j] += margin_begin; - if (anchor_end == ANCHOR_END) - minsize[j] += margin_end; + minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end; } total_minsize.width = MAX(total_minsize.width, minsize.width); @@ -145,13 +142,10 @@ void Popup::popup_centered_minsize(const Size2 &p_minsize) { float margin_begin = c->get_margin(m_beg); float margin_end = c->get_margin(m_end); - AnchorType anchor_begin = c->get_anchor(m_beg); - AnchorType anchor_end = c->get_anchor(m_end); + float anchor_begin = c->get_anchor(m_beg); + float anchor_end = c->get_anchor(m_end); - if (anchor_begin == ANCHOR_BEGIN) - minsize[j] += margin_begin; - if (anchor_end == ANCHOR_END) - minsize[j] += margin_end; + minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end; } total_minsize.width = MAX(total_minsize.width, minsize.width); @@ -209,15 +203,15 @@ void Popup::popup_centered_ratio(float p_screen_ratio) { popped_up = true; } -void Popup::popup(const Rect2 &bounds) { +void Popup::popup(const Rect2 &p_bounds) { emit_signal("about_to_show"); show_modal(exclusive); // Fit the popup into the optionally provided bounds. - if (!bounds.has_no_area()) { - set_position(bounds.position); - set_size(bounds.size); + if (!p_bounds.has_no_area()) { + set_position(p_bounds.position); + set_size(p_bounds.size); } _fix_size(); diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index cbfe7873e6..37714ee989 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -140,7 +140,7 @@ public: uint32_t get_item_accelerator(int p_idx) const; Variant get_item_metadata(int p_idx) const; bool is_item_disabled(int p_idx) const; - String get_item_submenu(int p_ID) const; + String get_item_submenu(int p_idx) const; bool is_item_separator(int p_idx) const; bool is_item_checkable(int p_idx) const; String get_item_tooltip(int p_idx) const; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 0e4004c27b..42084ade25 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -594,7 +594,7 @@ void RichTextLabel::_update_scroll() { main->first_invalid_line = 0; scroll_w = vscroll->get_combined_minimum_size().width; vscroll->show(); - vscroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, scroll_w); + vscroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -scroll_w); _validate_line_caches(main); } else { diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index 409a8f6b3f..71fa766958 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -296,7 +296,7 @@ public: void push_align(Align p_align); void push_indent(int p_level); void push_list(ListType p_list); - void push_meta(const Variant &p_data); + void push_meta(const Variant &p_meta); void push_table(int p_columns); void set_table_column_expand(int p_column, bool p_expand, int p_ratio = 1); int get_current_table_column() const; diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index bd66cd2745..2ccdbb05a9 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -233,7 +233,14 @@ void ScrollBar::_notification(int p_what) { Ref<Texture> decr = highlight == HIGHLIGHT_DECR ? get_icon("decrement_highlight") : get_icon("decrement"); Ref<Texture> incr = highlight == HIGHLIGHT_INCR ? get_icon("increment_highlight") : get_icon("increment"); Ref<StyleBox> bg = has_focus() ? get_stylebox("scroll_focus") : get_stylebox("scroll"); - Ref<StyleBox> grabber = (drag.active || highlight == HIGHLIGHT_RANGE) ? get_stylebox("grabber_highlight") : get_stylebox("grabber"); + + Ref<StyleBox> grabber; + if (drag.active) + grabber = get_stylebox("grabber_pressed"); + else if (highlight == HIGHLIGHT_RANGE) + grabber = get_stylebox("grabber_highlight"); + else + grabber = get_stylebox("grabber"); Point2 ofs; diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index cc1a637d2b..939bdd8d0c 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -187,14 +187,14 @@ void ScrollContainer::_update_scrollbar_pos() { Size2 hmin = h_scroll->get_combined_minimum_size(); Size2 vmin = v_scroll->get_combined_minimum_size(); - v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, vmin.width); + v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -vmin.width); v_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); v_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0); v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); h_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0); h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); - h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, hmin.height); + h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height); h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0); h_scroll->raise(); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 4b8b180b0e..1352569f33 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -371,8 +371,10 @@ void TabContainer::add_child_notify(Node *p_child) { if (tabs_visible) c->set_margin(MARGIN_TOP, _get_top_margin()); Ref<StyleBox> sb = get_stylebox("panel"); - for (int i = 0; i < 4; i++) - c->set_margin(Margin(i), c->get_margin(Margin(i)) + sb->get_margin(Margin(i))); + c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP))); + c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT))); + c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT))); + c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM))); update(); p_child->connect("renamed", this, "_child_renamed_callback"); @@ -402,8 +404,10 @@ void TabContainer::set_current_tab(int p_current) { c->set_area_as_parent_rect(); if (tabs_visible) c->set_margin(MARGIN_TOP, _get_top_margin()); - for (int i = 0; i < 4; i++) - c->set_margin(Margin(i), c->get_margin(Margin(i)) + sb->get_margin(Margin(i))); + c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP))); + c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT))); + c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT))); + c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM))); } else c->hide(); @@ -544,11 +548,11 @@ Ref<Texture> TabContainer::get_tab_icon(int p_tab) const { return Ref<Texture>(); } -void TabContainer::set_tab_disabled(int p_tab, bool p_enabled) { +void TabContainer::set_tab_disabled(int p_tab, bool p_disabled) { Control *child = _get_tab(p_tab); ERR_FAIL_COND(!child); - child->set_meta("_tab_disabled", p_enabled); + child->set_meta("_tab_disabled", p_disabled); update(); } diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h index 1105c6b298..3e1a2c1598 100644 --- a/scene/gui/tab_container.h +++ b/scene/gui/tab_container.h @@ -54,7 +54,7 @@ private: bool tabs_visible; bool buttons_visible_cache; TabAlign align; - Control *_get_tab(int idx) const; + Control *_get_tab(int p_idx) const; int _get_top_margin() const; Popup *popup; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 7b0d14c1a9..2b47539c42 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2933,7 +2933,7 @@ void TextEdit::_base_remove_text(int p_from_line, int p_from_column, int p_to_li } } -void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r_end_line, int *r_end_column) { +void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r_end_line, int *r_end_char) { if (!setting_text) idle_detect->start(); @@ -2946,8 +2946,8 @@ void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r _base_insert_text(p_line, p_char, p_text, retline, retchar); if (r_end_line) *r_end_line = retline; - if (r_end_column) - *r_end_column = retchar; + if (r_end_char) + *r_end_char = retchar; if (!undo_enabled) return; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index afb4b1c547..4c17347a5d 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -152,7 +152,7 @@ class TextEdit : public Control { int get_line_width(int p_line) const; int get_max_width() const; const Map<int, ColorRegionInfo> &get_color_region_info(int p_line); - void set(int p_line, const String &p_string); + void set(int p_line, const String &p_text); void set_marked(int p_line, bool p_marked) { text[p_line].marked = p_marked; } bool is_marked(int p_line) const { return text[p_line].marked; } void set_breakpoint(int p_line, bool p_breakpoint) { text[p_line].breakpoint = p_breakpoint; } @@ -288,8 +288,8 @@ class TextEdit : public Control { int get_char_count(); - int get_char_pos_for(int p_px, String p_pos) const; - int get_column_x_offset(int p_column, String p_pos); + int get_char_pos_for(int p_px, String p_str) const; + int get_column_x_offset(int p_char, String p_str); void adjust_viewport_to_cursor(); void _scroll_moved(double); @@ -320,7 +320,7 @@ class TextEdit : public Control { /* super internal api, undo/redo builds on it */ - void _base_insert_text(int p_line, int p_column, const String &p_text, int &r_end_line, int &r_end_column); + void _base_insert_text(int p_line, int p_char, const String &p_text, int &r_end_line, int &r_end_column); String _base_get_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column) const; void _base_remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column); @@ -339,10 +339,10 @@ class TextEdit : public Control { protected: virtual String get_tooltip(const Point2 &p_pos) const; - void _insert_text(int p_line, int p_column, const String &p_text, int *r_end_line = NULL, int *r_end_char = NULL); + void _insert_text(int p_line, int p_char, const String &p_text, int *r_end_line = NULL, int *r_end_char = NULL); void _remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column); void _insert_text_at_cursor(const String &p_text); - void _gui_input(const Ref<InputEvent> &p_input); + void _gui_input(const Ref<InputEvent> &p_gui_input); void _notification(int p_what); void _consume_pair_symbol(CharType ch); diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index 00849c4e5a..7abf8380ce 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -286,8 +286,8 @@ void TextureButton::set_expand(bool p_expand) { update(); } -void TextureButton::set_stretch_mode(StretchMode p_mode) { - stretch_mode = p_mode; +void TextureButton::set_stretch_mode(StretchMode p_stretch_mode) { + stretch_mode = p_stretch_mode; update(); } diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h index 9c31912a32..8df30cd35a 100644 --- a/scene/gui/texture_button.h +++ b/scene/gui/texture_button.h @@ -69,7 +69,7 @@ public: void set_hover_texture(const Ref<Texture> &p_hover); void set_disabled_texture(const Ref<Texture> &p_disabled); void set_focused_texture(const Ref<Texture> &p_focused); - void set_click_mask(const Ref<BitMap> &p_image); + void set_click_mask(const Ref<BitMap> &p_click_mask); Ref<Texture> get_normal_texture() const; Ref<Texture> get_pressed_texture() const; @@ -81,7 +81,7 @@ public: bool get_expand() const; void set_expand(bool p_expand); - void set_stretch_mode(StretchMode stretch_mode); + void set_stretch_mode(StretchMode p_stretch_mode); StretchMode get_stretch_mode() const; TextureButton(); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index d3715c3c43..81880122a9 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -471,7 +471,7 @@ private: TreeItem *_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards = false); - TreeItem *_find_item_at_pos(TreeItem *p_current, const Point2 &p_pos, int &r_column, int &h, int §ion) const; + TreeItem *_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_column, int &h, int §ion) const; /* float drag_speed; float drag_accum; @@ -524,7 +524,7 @@ public: void set_column_expand(int p_column, bool p_expand); int get_column_width(int p_column) const; - void set_hide_root(bool p_eanbled); + void set_hide_root(bool p_enabled); TreeItem *get_next_selected(TreeItem *p_item); TreeItem *get_selected() const; int get_selected_column() const; diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h index 1d70718a6a..87c452509b 100644 --- a/scene/gui/video_player.h +++ b/scene/gui/video_player.h @@ -105,7 +105,7 @@ public: String get_stream_name() const; float get_stream_pos() const; - void set_autoplay(bool p_vol); + void set_autoplay(bool p_enable); bool has_autoplay() const; void set_audio_track(int p_track); diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h index 1be6f8be24..b14a915fe8 100644 --- a/scene/main/canvas_layer.h +++ b/scene/main/canvas_layer.h @@ -55,7 +55,7 @@ class CanvasLayer : public Node { int sort_index; // Deprecated, should be removed in a future version. - void _set_rotationd(real_t p_rotation); + void _set_rotationd(real_t p_degrees); real_t _get_rotationd() const; void _update_xform(); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 0d872d906e..0474c6fd26 100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1301,8 +1301,9 @@ String Node::_generate_serial_child_name(Node *p_child) { } } + int num_places = nums.length(); for (;;) { - String attempt = (name + (num > 0 || explicit_zero ? nnsep + itos(num) : "")).strip_edges(); + String attempt = (name + (num > 0 || explicit_zero ? nnsep + itos(num).pad_zeros(num_places) : "")).strip_edges(); bool found = false; for (int i = 0; i < data.children.size(); i++) { if (data.children[i] == p_child) diff --git a/scene/main/node.h b/scene/main/node.h index 0447deccc1..bb8d80a0c8 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -32,8 +32,8 @@ #include "class_db.h" #include "map.h" -#include "object.h" #include "node_path.h" +#include "object.h" #include "project_settings.h" #include "scene/main/scene_tree.h" #include "script_language.h" @@ -303,14 +303,14 @@ public: float get_fixed_process_delta_time() const; bool is_fixed_processing() const; - void set_process(bool p_process); + void set_process(bool p_idle_process); float get_process_delta_time() const; bool is_processing() const; - void set_fixed_process_internal(bool p_process); + void set_fixed_process_internal(bool p_process_internal); bool is_fixed_processing_internal() const; - void set_process_internal(bool p_process); + void set_process_internal(bool p_idle_process_internal); bool is_processing_internal() const; void set_process_input(bool p_enable); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 067bcbff3e..66eafa1070 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -801,11 +801,11 @@ Ref<Material> SceneTree::get_debug_navigation_material() { return navigation_material; Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial)); - /* line_material->set_flag(Material::FLAG_UNSHADED, true); - line_material->set_line_width(3.0); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_color());*/ + line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true); + line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); + line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + line_material->set_albedo(get_debug_navigation_color()); navigation_material = line_material; @@ -818,11 +818,11 @@ Ref<Material> SceneTree::get_debug_navigation_disabled_material() { return navigation_disabled_material; Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial)); - /* line_material->set_flag(Material::FLAG_UNSHADED, true); - line_material->set_line_width(3.0); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color());*/ + line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true); + line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); + line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + line_material->set_albedo(get_debug_navigation_disabled_color()); navigation_disabled_material = line_material; @@ -834,11 +834,11 @@ Ref<Material> SceneTree::get_debug_collision_material() { return collision_material; Ref<SpatialMaterial> line_material = Ref<SpatialMaterial>(memnew(SpatialMaterial)); - /*line_material->set_flag(Material::FLAG_UNSHADED, true); - line_material->set_line_width(3.0); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA, true); - line_material->set_fixed_flag(SpatialMaterial::FLAG_USE_COLOR_ARRAY, true); - line_material->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_collisions_color());*/ + line_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true); + line_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); + line_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + line_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + line_material->set_albedo(get_debug_collisions_color()); collision_material = line_material; @@ -852,11 +852,12 @@ Ref<ArrayMesh> SceneTree::get_debug_contact_mesh() { debug_contact_mesh = Ref<ArrayMesh>(memnew(ArrayMesh)); - Ref<SpatialMaterial> mat = memnew(SpatialMaterial); - /*mat->set_flag(Material::FLAG_UNSHADED,true); - mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); - mat->set_fixed_flag(SpatialMaterial::FLAG_USE_ALPHA,true); - mat->set_parameter(SpatialMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color());*/ + Ref<SpatialMaterial> mat = Ref<SpatialMaterial>(memnew(SpatialMaterial)); + mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true); + mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); + mat->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true); + mat->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true); + mat->set_albedo(get_debug_collision_contact_color()); Vector3 diamond[6] = { Vector3(-1, 0, 0), diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 4f27231050..a22d897669 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1473,8 +1473,8 @@ void Viewport::_gui_show_tooltip() { gui.tooltip_label->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_LEFT)); gui.tooltip_label->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_TOP)); - gui.tooltip_label->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, ttp->get_margin(MARGIN_RIGHT)); - gui.tooltip_label->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, ttp->get_margin(MARGIN_BOTTOM)); + gui.tooltip_label->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -ttp->get_margin(MARGIN_RIGHT)); + gui.tooltip_label->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -ttp->get_margin(MARGIN_BOTTOM)); gui.tooltip_label->set_text(tooltip); Rect2 r(gui.tooltip_pos + Point2(10, 10), gui.tooltip_label->get_combined_minimum_size() + ttp->get_minimum_size()); Rect2 vr = gui.tooltip_label->get_viewport_rect(); diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 459d3ffe41..a2ff45c623 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -733,7 +733,7 @@ int Animation::track_find_key(int p_track, float p_time, bool p_exact) const { return -1; } -void Animation::track_insert_key(int p_track, float p_time, const Variant &p_value, float p_transition) { +void Animation::track_insert_key(int p_track, float p_time, const Variant &p_key, float p_transition) { ERR_FAIL_INDEX(p_track, tracks.size()); Track *t = tracks[p_track]; @@ -742,7 +742,7 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_val case TYPE_TRANSFORM: { - Dictionary d = p_value; + Dictionary d = p_key; Vector3 loc; if (d.has("loc")) loc = d["loc"]; @@ -766,7 +766,7 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_val TKey<Variant> k; k.time = p_time; k.transition = p_transition; - k.value = p_value; + k.value = p_key; _insert(p_time, vt->values, k); } break; @@ -774,9 +774,9 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_val MethodTrack *mt = static_cast<MethodTrack *>(t); - ERR_FAIL_COND(p_value.get_type() != Variant::DICTIONARY); + ERR_FAIL_COND(p_key.get_type() != Variant::DICTIONARY); - Dictionary d = p_value; + Dictionary d = p_key; ERR_FAIL_COND(!d.has("method") || d["method"].get_type() != Variant::STRING); ERR_FAIL_COND(!d.has("args") || !d["args"].is_array()); @@ -1871,7 +1871,7 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, cons return erase; } -void Animation::_transform_track_optimize(int p_idx, float p_alowed_linear_err, float p_alowed_angular_err, float p_max_optimizable_angle) { +void Animation::_transform_track_optimize(int p_idx, float p_allowed_linear_err, float p_allowed_angular_err, float p_max_optimizable_angle) { ERR_FAIL_INDEX(p_idx, tracks.size()); ERR_FAIL_COND(tracks[p_idx]->type != TYPE_TRANSFORM); @@ -1887,12 +1887,12 @@ void Animation::_transform_track_optimize(int p_idx, float p_alowed_linear_err, TKey<TransformKey> &t1 = tt->transforms[i]; TKey<TransformKey> &t2 = tt->transforms[i + 1]; - bool erase = _transform_track_optimize_key(t0, t1, t2, p_alowed_linear_err, p_alowed_angular_err, p_max_optimizable_angle, norm); + bool erase = _transform_track_optimize_key(t0, t1, t2, p_allowed_linear_err, p_allowed_angular_err, p_max_optimizable_angle, norm); if (erase && !prev_erased) { norm = (t2.value.loc - t1.value.loc).normalized(); } - if (prev_erased && !_transform_track_optimize_key(t0, first_erased, t2, p_alowed_linear_err, p_alowed_angular_err, p_max_optimizable_angle, norm)) { + if (prev_erased && !_transform_track_optimize_key(t0, first_erased, t2, p_allowed_linear_err, p_allowed_angular_err, p_max_optimizable_angle, norm)) { //avoid error to go beyond first erased key erase = false; } @@ -1914,12 +1914,12 @@ void Animation::_transform_track_optimize(int p_idx, float p_alowed_linear_err, } } -void Animation::optimize(float p_allowed_linear_err, float p_allowed_angular_err, float p_angle_max) { +void Animation::optimize(float p_allowed_linear_err, float p_allowed_angular_err, float p_max_optimizable_angle) { for (int i = 0; i < tracks.size(); i++) { if (tracks[i]->type == TYPE_TRANSFORM) - _transform_track_optimize(i, p_allowed_linear_err, p_allowed_angular_err, p_angle_max); + _transform_track_optimize(i, p_allowed_linear_err, p_allowed_angular_err, p_max_optimizable_angle); } } diff --git a/scene/resources/animation.h b/scene/resources/animation.h index b363f2b666..27c58aba8c 100644 --- a/scene/resources/animation.h +++ b/scene/resources/animation.h @@ -212,7 +212,7 @@ private: } bool _transform_track_optimize_key(const TKey<TransformKey> &t0, const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, float p_alowed_linear_err, float p_alowed_angular_err, float p_max_optimizable_angle, const Vector3 &p_norm); - void _transform_track_optimize(int p_idx, float p_allowed_err = 0.05, float p_alowed_angular_err = 0.01, float p_max_optimizable_angle = Math_PI * 0.125); + void _transform_track_optimize(int p_idx, float p_allowed_linear_err = 0.05, float p_allowed_angular_err = 0.01, float p_max_optimizable_angle = Math_PI * 0.125); protected: bool _set(const StringName &p_name, const Variant &p_value); diff --git a/scene/resources/color_ramp.h b/scene/resources/color_ramp.h index d7ec20b324..d9f14205bb 100644 --- a/scene/resources/color_ramp.h +++ b/scene/resources/color_ramp.h @@ -60,7 +60,7 @@ public: void add_point(float p_offset, const Color &p_color); void remove_point(int p_index); - void set_points(Vector<Point> &points); + void set_points(Vector<Point> &p_points); Vector<Point> &get_points(); void set_offset(int pos, const float offset); @@ -69,10 +69,10 @@ public: void set_color(int pos, const Color &color); Color get_color(int pos) const; - void set_offsets(const Vector<float> &offsets); + void set_offsets(const Vector<float> &p_offsets); Vector<float> get_offsets() const; - void set_colors(const Vector<Color> &colors); + void set_colors(const Vector<Color> &p_colors); Vector<Color> get_colors() const; _FORCE_INLINE_ Color get_color_at_offset(float p_offset) { diff --git a/scene/resources/curve.h b/scene/resources/curve.h index 2815c12c4b..e302f1e0af 100644 --- a/scene/resources/curve.h +++ b/scene/resources/curve.h @@ -174,7 +174,7 @@ public: void bake(); int get_bake_resolution() const { return _bake_resolution; } - void set_bake_resolution(int p_interval); + void set_bake_resolution(int p_resolution); real_t interpolate_baked(real_t offset); protected: @@ -242,7 +242,7 @@ public: Vector2 interpolate(int p_index, float p_offset) const; Vector2 interpolatef(real_t p_findex) const; - void set_bake_interval(float p_distance); + void set_bake_interval(float p_tolerance); float get_bake_interval() const; float get_baked_length() const; @@ -309,7 +309,7 @@ public: Vector3 interpolate(int p_index, float p_offset) const; Vector3 interpolatef(real_t p_findex) const; - void set_bake_interval(float p_distance); + void set_bake_interval(float p_tolerance); float get_bake_interval() const; float get_baked_length() const; diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 3e612c745f..03288e45bf 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -203,7 +203,7 @@ static Ref<StyleBox> make_empty_stylebox(float p_margin_left = -1, float p_margi return style; } -void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<Font> &large_font, Ref<Texture> &default_icon, Ref<StyleBox> &default_style, float p_scale) { +void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const Ref<Font> &large_font, Ref<Texture> &default_icon, Ref<StyleBox> &default_style, float p_scale) { scale = p_scale; @@ -223,7 +223,7 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< // Panel - t->set_stylebox("panel", "Panel", make_stylebox(panel_bg_png, 0, 0, 0, 0)); + theme->set_stylebox("panel", "Panel", make_stylebox(panel_bg_png, 0, 0, 0, 0)); // Focus @@ -240,63 +240,63 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< Ref<StyleBox> sb_button_disabled = sb_expand(make_stylebox(button_disabled_png, 4, 4, 4, 4, 6, 2, 6, 2), 2, 2, 2, 2); Ref<StyleBox> sb_button_focus = sb_expand(make_stylebox(button_focus_png, 4, 4, 4, 4, 6, 2, 6, 2), 2, 2, 2, 2); - t->set_stylebox("normal", "Button", sb_button_normal); - t->set_stylebox("pressed", "Button", sb_button_pressed); - t->set_stylebox("hover", "Button", sb_button_hover); - t->set_stylebox("disabled", "Button", sb_button_disabled); - t->set_stylebox("focus", "Button", sb_button_focus); + theme->set_stylebox("normal", "Button", sb_button_normal); + theme->set_stylebox("pressed", "Button", sb_button_pressed); + theme->set_stylebox("hover", "Button", sb_button_hover); + theme->set_stylebox("disabled", "Button", sb_button_disabled); + theme->set_stylebox("focus", "Button", sb_button_focus); - t->set_font("font", "Button", default_font); + theme->set_font("font", "Button", default_font); - t->set_color("font_color", "Button", control_font_color); - t->set_color("font_color_pressed", "Button", control_font_color_pressed); - t->set_color("font_color_hover", "Button", control_font_color_hover); - t->set_color("font_color_disabled", "Button", control_font_color_disabled); + theme->set_color("font_color", "Button", control_font_color); + theme->set_color("font_color_pressed", "Button", control_font_color_pressed); + theme->set_color("font_color_hover", "Button", control_font_color_hover); + theme->set_color("font_color_disabled", "Button", control_font_color_disabled); - t->set_constant("hseparation", "Button", 2 * scale); + theme->set_constant("hseparation", "Button", 2 * scale); // LinkButton - t->set_font("font", "LinkButton", default_font); + theme->set_font("font", "LinkButton", default_font); - t->set_color("font_color", "LinkButton", control_font_color); - t->set_color("font_color_pressed", "LinkButton", control_font_color_pressed); - t->set_color("font_color_hover", "LinkButton", control_font_color_hover); + theme->set_color("font_color", "LinkButton", control_font_color); + theme->set_color("font_color_pressed", "LinkButton", control_font_color_pressed); + theme->set_color("font_color_hover", "LinkButton", control_font_color_hover); - t->set_constant("underline_spacing", "LinkButton", 2 * scale); + theme->set_constant("underline_spacing", "LinkButton", 2 * scale); // ColorPickerButton - t->set_stylebox("normal", "ColorPickerButton", sb_button_normal); - t->set_stylebox("pressed", "ColorPickerButton", sb_button_pressed); - t->set_stylebox("hover", "ColorPickerButton", sb_button_hover); - t->set_stylebox("disabled", "ColorPickerButton", sb_button_disabled); - t->set_stylebox("focus", "ColorPickerButton", sb_button_focus); + theme->set_stylebox("normal", "ColorPickerButton", sb_button_normal); + theme->set_stylebox("pressed", "ColorPickerButton", sb_button_pressed); + theme->set_stylebox("hover", "ColorPickerButton", sb_button_hover); + theme->set_stylebox("disabled", "ColorPickerButton", sb_button_disabled); + theme->set_stylebox("focus", "ColorPickerButton", sb_button_focus); - t->set_font("font", "ColorPickerButton", default_font); + theme->set_font("font", "ColorPickerButton", default_font); - t->set_color("font_color", "ColorPickerButton", Color(1, 1, 1, 1)); - t->set_color("font_color_pressed", "ColorPickerButton", Color(0.8, 0.8, 0.8, 1)); - t->set_color("font_color_hover", "ColorPickerButton", Color(1, 1, 1, 1)); - t->set_color("font_color_disabled", "ColorPickerButton", Color(0.9, 0.9, 0.9, 0.3)); + theme->set_color("font_color", "ColorPickerButton", Color(1, 1, 1, 1)); + theme->set_color("font_color_pressed", "ColorPickerButton", Color(0.8, 0.8, 0.8, 1)); + theme->set_color("font_color_hover", "ColorPickerButton", Color(1, 1, 1, 1)); + theme->set_color("font_color_disabled", "ColorPickerButton", Color(0.9, 0.9, 0.9, 0.3)); - t->set_constant("hseparation", "ColorPickerButton", 2 * scale); + theme->set_constant("hseparation", "ColorPickerButton", 2 * scale); // ToolButton - t->set_stylebox("normal", "ToolButton", make_empty_stylebox(6, 4, 6, 4)); - t->set_stylebox("pressed", "ToolButton", make_stylebox(button_pressed_png, 4, 4, 4, 4, 6, 4, 6, 4)); - t->set_stylebox("hover", "ToolButton", make_stylebox(button_normal_png, 4, 4, 4, 4, 6, 4, 6, 4)); - t->set_stylebox("disabled", "ToolButton", make_empty_stylebox(6, 4, 6, 4)); - t->set_stylebox("focus", "ToolButton", focus); - t->set_font("font", "ToolButton", default_font); + theme->set_stylebox("normal", "ToolButton", make_empty_stylebox(6, 4, 6, 4)); + theme->set_stylebox("pressed", "ToolButton", make_stylebox(button_pressed_png, 4, 4, 4, 4, 6, 4, 6, 4)); + theme->set_stylebox("hover", "ToolButton", make_stylebox(button_normal_png, 4, 4, 4, 4, 6, 4, 6, 4)); + theme->set_stylebox("disabled", "ToolButton", make_empty_stylebox(6, 4, 6, 4)); + theme->set_stylebox("focus", "ToolButton", focus); + theme->set_font("font", "ToolButton", default_font); - t->set_color("font_color", "ToolButton", control_font_color); - t->set_color("font_color_pressed", "ToolButton", control_font_color_pressed); - t->set_color("font_color_hover", "ToolButton", control_font_color_hover); - t->set_color("font_color_disabled", "ToolButton", Color(0.9, 0.95, 1, 0.3)); + theme->set_color("font_color", "ToolButton", control_font_color); + theme->set_color("font_color_pressed", "ToolButton", control_font_color_pressed); + theme->set_color("font_color_hover", "ToolButton", control_font_color_hover); + theme->set_color("font_color_disabled", "ToolButton", Color(0.9, 0.95, 1, 0.3)); - t->set_constant("hseparation", "ToolButton", 3); + theme->set_constant("hseparation", "ToolButton", 3); // OptionButton @@ -306,44 +306,44 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< Ref<StyleBox> sb_optbutton_disabled = sb_expand(make_stylebox(option_button_disabled_png, 4, 4, 21, 4, 6, 2, 21, 2), 2, 2, 2, 2); Ref<StyleBox> sb_optbutton_focus = sb_expand(make_stylebox(button_focus_png, 4, 4, 4, 4, 6, 2, 6, 2), 2, 2, 2, 2); - t->set_stylebox("normal", "OptionButton", sb_optbutton_normal); - t->set_stylebox("pressed", "OptionButton", sb_optbutton_pressed); - t->set_stylebox("hover", "OptionButton", sb_optbutton_hover); - t->set_stylebox("disabled", "OptionButton", sb_optbutton_disabled); - t->set_stylebox("focus", "OptionButton", sb_button_focus); + theme->set_stylebox("normal", "OptionButton", sb_optbutton_normal); + theme->set_stylebox("pressed", "OptionButton", sb_optbutton_pressed); + theme->set_stylebox("hover", "OptionButton", sb_optbutton_hover); + theme->set_stylebox("disabled", "OptionButton", sb_optbutton_disabled); + theme->set_stylebox("focus", "OptionButton", sb_button_focus); - t->set_icon("arrow", "OptionButton", make_icon(option_arrow_png)); + theme->set_icon("arrow", "OptionButton", make_icon(option_arrow_png)); - t->set_font("font", "OptionButton", default_font); + theme->set_font("font", "OptionButton", default_font); - t->set_color("font_color", "OptionButton", control_font_color); - t->set_color("font_color_pressed", "OptionButton", control_font_color_pressed); - t->set_color("font_color_hover", "OptionButton", control_font_color_hover); - t->set_color("font_color_disabled", "OptionButton", control_font_color_disabled); + theme->set_color("font_color", "OptionButton", control_font_color); + theme->set_color("font_color_pressed", "OptionButton", control_font_color_pressed); + theme->set_color("font_color_hover", "OptionButton", control_font_color_hover); + theme->set_color("font_color_disabled", "OptionButton", control_font_color_disabled); - t->set_constant("hseparation", "OptionButton", 2 * scale); - t->set_constant("arrow_margin", "OptionButton", 2 * scale); + theme->set_constant("hseparation", "OptionButton", 2 * scale); + theme->set_constant("arrow_margin", "OptionButton", 2 * scale); // MenuButton - t->set_stylebox("normal", "MenuButton", sb_button_normal); - t->set_stylebox("pressed", "MenuButton", sb_button_pressed); - t->set_stylebox("hover", "MenuButton", sb_button_pressed); - t->set_stylebox("disabled", "MenuButton", make_empty_stylebox(0, 0, 0, 0)); - t->set_stylebox("focus", "MenuButton", sb_button_focus); + theme->set_stylebox("normal", "MenuButton", sb_button_normal); + theme->set_stylebox("pressed", "MenuButton", sb_button_pressed); + theme->set_stylebox("hover", "MenuButton", sb_button_pressed); + theme->set_stylebox("disabled", "MenuButton", make_empty_stylebox(0, 0, 0, 0)); + theme->set_stylebox("focus", "MenuButton", sb_button_focus); - t->set_font("font", "MenuButton", default_font); + theme->set_font("font", "MenuButton", default_font); - t->set_color("font_color", "MenuButton", control_font_color); - t->set_color("font_color_pressed", "MenuButton", control_font_color_pressed); - t->set_color("font_color_hover", "MenuButton", control_font_color_hover); - t->set_color("font_color_disabled", "MenuButton", Color(1, 1, 1, 0.3)); + theme->set_color("font_color", "MenuButton", control_font_color); + theme->set_color("font_color_pressed", "MenuButton", control_font_color_pressed); + theme->set_color("font_color_hover", "MenuButton", control_font_color_hover); + theme->set_color("font_color_disabled", "MenuButton", Color(1, 1, 1, 0.3)); - t->set_constant("hseparation", "MenuButton", 3 * scale); + theme->set_constant("hseparation", "MenuButton", 3 * scale); // ButtonGroup - t->set_stylebox("panel", "ButtonGroup", memnew(StyleBoxEmpty)); + theme->set_stylebox("panel", "ButtonGroup", memnew(StyleBoxEmpty)); // CheckBox @@ -358,26 +358,26 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< cbx_focus->set_default_margin(MARGIN_TOP, 4 * scale); cbx_focus->set_default_margin(MARGIN_BOTTOM, 5 * scale); - t->set_stylebox("normal", "CheckBox", cbx_empty); - t->set_stylebox("pressed", "CheckBox", cbx_empty); - t->set_stylebox("disabled", "CheckBox", cbx_empty); - t->set_stylebox("hover", "CheckBox", cbx_empty); - t->set_stylebox("focus", "CheckBox", cbx_focus); + theme->set_stylebox("normal", "CheckBox", cbx_empty); + theme->set_stylebox("pressed", "CheckBox", cbx_empty); + theme->set_stylebox("disabled", "CheckBox", cbx_empty); + theme->set_stylebox("hover", "CheckBox", cbx_empty); + theme->set_stylebox("focus", "CheckBox", cbx_focus); - t->set_icon("checked", "CheckBox", make_icon(checked_png)); - t->set_icon("unchecked", "CheckBox", make_icon(unchecked_png)); - t->set_icon("radio_checked", "CheckBox", make_icon(radio_checked_png)); - t->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png)); + theme->set_icon("checked", "CheckBox", make_icon(checked_png)); + theme->set_icon("unchecked", "CheckBox", make_icon(unchecked_png)); + theme->set_icon("radio_checked", "CheckBox", make_icon(radio_checked_png)); + theme->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png)); - t->set_font("font", "CheckBox", default_font); + theme->set_font("font", "CheckBox", default_font); - t->set_color("font_color", "CheckBox", control_font_color); - t->set_color("font_color_pressed", "CheckBox", control_font_color_pressed); - t->set_color("font_color_hover", "CheckBox", control_font_color_hover); - t->set_color("font_color_disabled", "CheckBox", control_font_color_disabled); + theme->set_color("font_color", "CheckBox", control_font_color); + theme->set_color("font_color_pressed", "CheckBox", control_font_color_pressed); + theme->set_color("font_color_hover", "CheckBox", control_font_color_hover); + theme->set_color("font_color_disabled", "CheckBox", control_font_color_disabled); - t->set_constant("hseparation", "CheckBox", 4 * scale); - t->set_constant("check_vadjust", "CheckBox", 0 * scale); + theme->set_constant("hseparation", "CheckBox", 4 * scale); + theme->set_constant("check_vadjust", "CheckBox", 0 * scale); // CheckButton @@ -387,170 +387,172 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< cb_empty->set_default_margin(MARGIN_TOP, 4 * scale); cb_empty->set_default_margin(MARGIN_BOTTOM, 4 * scale); - t->set_stylebox("normal", "CheckButton", cb_empty); - t->set_stylebox("pressed", "CheckButton", cb_empty); - t->set_stylebox("disabled", "CheckButton", cb_empty); - t->set_stylebox("hover", "CheckButton", cb_empty); - t->set_stylebox("focus", "CheckButton", focus); + theme->set_stylebox("normal", "CheckButton", cb_empty); + theme->set_stylebox("pressed", "CheckButton", cb_empty); + theme->set_stylebox("disabled", "CheckButton", cb_empty); + theme->set_stylebox("hover", "CheckButton", cb_empty); + theme->set_stylebox("focus", "CheckButton", focus); - t->set_icon("on", "CheckButton", make_icon(toggle_on_png)); - t->set_icon("off", "CheckButton", make_icon(toggle_off_png)); + theme->set_icon("on", "CheckButton", make_icon(toggle_on_png)); + theme->set_icon("off", "CheckButton", make_icon(toggle_off_png)); - t->set_font("font", "CheckButton", default_font); + theme->set_font("font", "CheckButton", default_font); - t->set_color("font_color", "CheckButton", control_font_color); - t->set_color("font_color_pressed", "CheckButton", control_font_color_pressed); - t->set_color("font_color_hover", "CheckButton", control_font_color_hover); - t->set_color("font_color_disabled", "CheckButton", control_font_color_disabled); + theme->set_color("font_color", "CheckButton", control_font_color); + theme->set_color("font_color_pressed", "CheckButton", control_font_color_pressed); + theme->set_color("font_color_hover", "CheckButton", control_font_color_hover); + theme->set_color("font_color_disabled", "CheckButton", control_font_color_disabled); - t->set_constant("hseparation", "CheckButton", 4 * scale); - t->set_constant("check_vadjust", "CheckButton", 0 * scale); + theme->set_constant("hseparation", "CheckButton", 4 * scale); + theme->set_constant("check_vadjust", "CheckButton", 0 * scale); // Label - t->set_font("font", "Label", default_font); + theme->set_font("font", "Label", default_font); - t->set_color("font_color", "Label", Color(1, 1, 1)); - t->set_color("font_color_shadow", "Label", Color(0, 0, 0, 0)); + theme->set_color("font_color", "Label", Color(1, 1, 1)); + theme->set_color("font_color_shadow", "Label", Color(0, 0, 0, 0)); - t->set_constant("shadow_offset_x", "Label", 1 * scale); - t->set_constant("shadow_offset_y", "Label", 1 * scale); - t->set_constant("shadow_as_outline", "Label", 0 * scale); - t->set_constant("line_spacing", "Label", 3 * scale); + theme->set_constant("shadow_offset_x", "Label", 1 * scale); + theme->set_constant("shadow_offset_y", "Label", 1 * scale); + theme->set_constant("shadow_as_outline", "Label", 0 * scale); + theme->set_constant("line_spacing", "Label", 3 * scale); // LineEdit - t->set_stylebox("normal", "LineEdit", make_stylebox(line_edit_png, 5, 5, 5, 5)); - t->set_stylebox("focus", "LineEdit", focus); - t->set_stylebox("read_only", "LineEdit", make_stylebox(line_edit_disabled_png, 6, 6, 6, 6)); + theme->set_stylebox("normal", "LineEdit", make_stylebox(line_edit_png, 5, 5, 5, 5)); + theme->set_stylebox("focus", "LineEdit", focus); + theme->set_stylebox("read_only", "LineEdit", make_stylebox(line_edit_disabled_png, 6, 6, 6, 6)); - t->set_font("font", "LineEdit", default_font); + theme->set_font("font", "LineEdit", default_font); - t->set_color("font_color", "LineEdit", control_font_color); - t->set_color("font_color_selected", "LineEdit", Color(0, 0, 0)); - t->set_color("cursor_color", "LineEdit", control_font_color_hover); - t->set_color("selection_color", "LineEdit", font_color_selection); + theme->set_color("font_color", "LineEdit", control_font_color); + theme->set_color("font_color_selected", "LineEdit", Color(0, 0, 0)); + theme->set_color("cursor_color", "LineEdit", control_font_color_hover); + theme->set_color("selection_color", "LineEdit", font_color_selection); - t->set_constant("minimum_spaces", "LineEdit", 12 * scale); + theme->set_constant("minimum_spaces", "LineEdit", 12 * scale); // ProgressBar - t->set_stylebox("bg", "ProgressBar", make_stylebox(progress_bar_png, 4, 4, 4, 4, 0, 0, 0, 0)); - t->set_stylebox("fg", "ProgressBar", make_stylebox(progress_fill_png, 6, 6, 6, 6, 2, 1, 2, 1)); + theme->set_stylebox("bg", "ProgressBar", make_stylebox(progress_bar_png, 4, 4, 4, 4, 0, 0, 0, 0)); + theme->set_stylebox("fg", "ProgressBar", make_stylebox(progress_fill_png, 6, 6, 6, 6, 2, 1, 2, 1)); - t->set_font("font", "ProgressBar", default_font); + theme->set_font("font", "ProgressBar", default_font); - t->set_color("font_color", "ProgressBar", control_font_color_hover); - t->set_color("font_color_shadow", "ProgressBar", Color(0, 0, 0)); + theme->set_color("font_color", "ProgressBar", control_font_color_hover); + theme->set_color("font_color_shadow", "ProgressBar", Color(0, 0, 0)); // TextEdit - t->set_stylebox("normal", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3)); - t->set_stylebox("focus", "TextEdit", focus); - t->set_stylebox("completion", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3)); - - t->set_icon("tab", "TextEdit", make_icon(tab_png)); - - t->set_font("font", "TextEdit", default_font); - - t->set_color("background_color", "TextEdit", Color(0, 0, 0, 0)); - t->set_color("completion_background_color", "TextEdit", Color::html("2C2A32")); - t->set_color("completion_selected_color", "TextEdit", Color::html("434244")); - t->set_color("completion_existing_color", "TextEdit", Color::html("21dfdfdf")); - t->set_color("completion_scroll_color", "TextEdit", control_font_color_pressed); - t->set_color("completion_font_color", "TextEdit", Color::html("aaaaaa")); - t->set_color("font_color", "TextEdit", control_font_color); - t->set_color("font_color_selected", "TextEdit", Color(0, 0, 0)); - t->set_color("selection_color", "TextEdit", font_color_selection); - t->set_color("mark_color", "TextEdit", Color(1.0, 0.4, 0.4, 0.4)); - t->set_color("breakpoint_color", "TextEdit", Color(0.8, 0.8, 0.4, 0.2)); - t->set_color("current_line_color", "TextEdit", Color(0.25, 0.25, 0.26, 0.8)); - t->set_color("caret_color", "TextEdit", control_font_color); - t->set_color("caret_background_color", "TextEdit", Color::html("000000")); - t->set_color("symbol_color", "TextEdit", control_font_color_hover); - t->set_color("brace_mismatch_color", "TextEdit", Color(1, 0.2, 0.2)); - t->set_color("line_number_color", "TextEdit", Color::html("66aaaaaa")); - t->set_color("function_color", "TextEdit", Color::html("66a2ce")); - t->set_color("member_variable_color", "TextEdit", Color::html("e64e59")); - t->set_color("number_color", "TextEdit", Color::html("EB9532")); - t->set_color("word_highlighted_color", "TextEdit", Color(0.8, 0.9, 0.9, 0.15)); - - t->set_constant("completion_lines", "TextEdit", 7); - t->set_constant("completion_max_width", "TextEdit", 50); - t->set_constant("completion_scroll_width", "TextEdit", 3); - t->set_constant("line_spacing", "TextEdit", 4 * scale); + theme->set_stylebox("normal", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3)); + theme->set_stylebox("focus", "TextEdit", focus); + theme->set_stylebox("completion", "TextEdit", make_stylebox(tree_bg_png, 3, 3, 3, 3)); + + theme->set_icon("tab", "TextEdit", make_icon(tab_png)); + + theme->set_font("font", "TextEdit", default_font); + + theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0)); + theme->set_color("completion_background_color", "TextEdit", Color::html("2C2A32")); + theme->set_color("completion_selected_color", "TextEdit", Color::html("434244")); + theme->set_color("completion_existing_color", "TextEdit", Color::html("21dfdfdf")); + theme->set_color("completion_scroll_color", "TextEdit", control_font_color_pressed); + theme->set_color("completion_font_color", "TextEdit", Color::html("aaaaaa")); + theme->set_color("font_color", "TextEdit", control_font_color); + theme->set_color("font_color_selected", "TextEdit", Color(0, 0, 0)); + theme->set_color("selection_color", "TextEdit", font_color_selection); + theme->set_color("mark_color", "TextEdit", Color(1.0, 0.4, 0.4, 0.4)); + theme->set_color("breakpoint_color", "TextEdit", Color(0.8, 0.8, 0.4, 0.2)); + theme->set_color("current_line_color", "TextEdit", Color(0.25, 0.25, 0.26, 0.8)); + theme->set_color("caret_color", "TextEdit", control_font_color); + theme->set_color("caret_background_color", "TextEdit", Color::html("000000")); + theme->set_color("symbol_color", "TextEdit", control_font_color_hover); + theme->set_color("brace_mismatch_color", "TextEdit", Color(1, 0.2, 0.2)); + theme->set_color("line_number_color", "TextEdit", Color::html("66aaaaaa")); + theme->set_color("function_color", "TextEdit", Color::html("66a2ce")); + theme->set_color("member_variable_color", "TextEdit", Color::html("e64e59")); + theme->set_color("number_color", "TextEdit", Color::html("EB9532")); + theme->set_color("word_highlighted_color", "TextEdit", Color(0.8, 0.9, 0.9, 0.15)); + + theme->set_constant("completion_lines", "TextEdit", 7); + theme->set_constant("completion_max_width", "TextEdit", 50); + theme->set_constant("completion_scroll_width", "TextEdit", 3); + theme->set_constant("line_spacing", "TextEdit", 4 * scale); Ref<Texture> empty_icon = memnew(ImageTexture); // HScrollBar - t->set_stylebox("scroll", "HScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0)); - t->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0)); - t->set_stylebox("grabber", "HScrollBar", make_stylebox(scroll_grabber_png, 5, 5, 5, 5, 2, 2, 2, 2)); - t->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(scroll_grabber_hl_png, 5, 5, 5, 5, 2, 2, 2, 2)); + theme->set_stylebox("scroll", "HScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0)); + theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0)); + theme->set_stylebox("grabber", "HScrollBar", make_stylebox(scroll_grabber_png, 5, 5, 5, 5, 2, 2, 2, 2)); + theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(scroll_grabber_hl_png, 5, 5, 5, 5, 2, 2, 2, 2)); + theme->set_stylebox("grabber_pressed", "HScrollBar", make_stylebox(scroll_grabber_pressed_png, 5, 5, 5, 5, 2, 2, 2, 2)); - t->set_icon("increment", "HScrollBar", empty_icon); - t->set_icon("increment_highlight", "HScrollBar", empty_icon); - t->set_icon("decrement", "HScrollBar", empty_icon); - t->set_icon("decrement_highlight", "HScrollBar", empty_icon); + theme->set_icon("increment", "HScrollBar", empty_icon); + theme->set_icon("increment_highlight", "HScrollBar", empty_icon); + theme->set_icon("decrement", "HScrollBar", empty_icon); + theme->set_icon("decrement_highlight", "HScrollBar", empty_icon); // VScrollBar - t->set_stylebox("scroll", "VScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0)); - t->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0)); - t->set_stylebox("grabber", "VScrollBar", make_stylebox(scroll_grabber_png, 5, 5, 5, 5, 2, 2, 2, 2)); - t->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(scroll_grabber_hl_png, 5, 5, 5, 5, 2, 2, 2, 2)); + theme->set_stylebox("scroll", "VScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0)); + theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(scroll_bg_png, 5, 5, 5, 5, 0, 0, 0, 0)); + theme->set_stylebox("grabber", "VScrollBar", make_stylebox(scroll_grabber_png, 5, 5, 5, 5, 2, 2, 2, 2)); + theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(scroll_grabber_hl_png, 5, 5, 5, 5, 2, 2, 2, 2)); + theme->set_stylebox("grabber_pressed", "VScrollBar", make_stylebox(scroll_grabber_pressed_png, 5, 5, 5, 5, 2, 2, 2, 2)); - t->set_icon("increment", "VScrollBar", empty_icon); - t->set_icon("increment_highlight", "VScrollBar", empty_icon); - t->set_icon("decrement", "VScrollBar", empty_icon); - t->set_icon("decrement_highlight", "VScrollBar", empty_icon); + theme->set_icon("increment", "VScrollBar", empty_icon); + theme->set_icon("increment_highlight", "VScrollBar", empty_icon); + theme->set_icon("decrement", "VScrollBar", empty_icon); + theme->set_icon("decrement_highlight", "VScrollBar", empty_icon); // HSlider - t->set_stylebox("slider", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4)); - t->set_stylebox("grabber_highlight", "HSlider", make_stylebox(hslider_grabber_hl_png, 6, 6, 6, 6)); - t->set_stylebox("grabber_disabled", "HSlider", make_stylebox(hslider_grabber_disabled_png, 6, 6, 6, 6)); - t->set_stylebox("focus", "HSlider", focus); + theme->set_stylebox("slider", "HSlider", make_stylebox(hslider_bg_png, 4, 4, 4, 4)); + theme->set_stylebox("grabber_highlight", "HSlider", make_stylebox(hslider_grabber_hl_png, 6, 6, 6, 6)); + theme->set_stylebox("grabber_disabled", "HSlider", make_stylebox(hslider_grabber_disabled_png, 6, 6, 6, 6)); + theme->set_stylebox("focus", "HSlider", focus); - t->set_icon("grabber", "HSlider", make_icon(hslider_grabber_png)); - t->set_icon("grabber_highlight", "HSlider", make_icon(hslider_grabber_hl_png)); - t->set_icon("grabber_disabled", "HSlider", make_icon(hslider_grabber_disabled_png)); - t->set_icon("tick", "HSlider", make_icon(hslider_tick_png)); + theme->set_icon("grabber", "HSlider", make_icon(hslider_grabber_png)); + theme->set_icon("grabber_highlight", "HSlider", make_icon(hslider_grabber_hl_png)); + theme->set_icon("grabber_disabled", "HSlider", make_icon(hslider_grabber_disabled_png)); + theme->set_icon("tick", "HSlider", make_icon(hslider_tick_png)); // VSlider - t->set_stylebox("slider", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4)); - t->set_stylebox("grabber_highlight", "VSlider", make_stylebox(vslider_grabber_hl_png, 6, 6, 6, 6)); - t->set_stylebox("grabber_disabled", "VSlider", make_stylebox(vslider_grabber_disabled_png, 6, 6, 6, 6)); - t->set_stylebox("focus", "HSlider", focus); + theme->set_stylebox("slider", "VSlider", make_stylebox(vslider_bg_png, 4, 4, 4, 4)); + theme->set_stylebox("grabber_highlight", "VSlider", make_stylebox(vslider_grabber_hl_png, 6, 6, 6, 6)); + theme->set_stylebox("grabber_disabled", "VSlider", make_stylebox(vslider_grabber_disabled_png, 6, 6, 6, 6)); + theme->set_stylebox("focus", "HSlider", focus); - t->set_icon("grabber", "VSlider", make_icon(vslider_grabber_png)); - t->set_icon("grabber_highlight", "VSlider", make_icon(vslider_grabber_hl_png)); - t->set_icon("grabber_disabled", "VSlider", make_icon(vslider_grabber_disabled_png)); - t->set_icon("tick", "VSlider", make_icon(vslider_tick_png)); + theme->set_icon("grabber", "VSlider", make_icon(vslider_grabber_png)); + theme->set_icon("grabber_highlight", "VSlider", make_icon(vslider_grabber_hl_png)); + theme->set_icon("grabber_disabled", "VSlider", make_icon(vslider_grabber_disabled_png)); + theme->set_icon("tick", "VSlider", make_icon(vslider_tick_png)); // SpinBox - t->set_icon("updown", "SpinBox", make_icon(spinbox_updown_png)); + theme->set_icon("updown", "SpinBox", make_icon(spinbox_updown_png)); // WindowDialog - t->set_stylebox("panel", "WindowDialog", sb_expand(make_stylebox(popup_window_png, 10, 26, 10, 8), 8, 24, 8, 6)); - t->set_constant("scaleborder_size", "WindowDialog", 4 * scale); + theme->set_stylebox("panel", "WindowDialog", sb_expand(make_stylebox(popup_window_png, 10, 26, 10, 8), 8, 24, 8, 6)); + theme->set_constant("scaleborder_size", "WindowDialog", 4 * scale); - t->set_font("title_font", "WindowDialog", large_font); - t->set_color("title_color", "WindowDialog", Color(0, 0, 0)); - t->set_constant("title_height", "WindowDialog", 20 * scale); + theme->set_font("title_font", "WindowDialog", large_font); + theme->set_color("title_color", "WindowDialog", Color(0, 0, 0)); + theme->set_constant("title_height", "WindowDialog", 20 * scale); - t->set_icon("close", "WindowDialog", make_icon(close_png)); - t->set_icon("close_highlight", "WindowDialog", make_icon(close_hl_png)); - t->set_constant("close_h_ofs", "WindowDialog", 18 * scale); - t->set_constant("close_v_ofs", "WindowDialog", 18 * scale); + theme->set_icon("close", "WindowDialog", make_icon(close_png)); + theme->set_icon("close_highlight", "WindowDialog", make_icon(close_hl_png)); + theme->set_constant("close_h_ofs", "WindowDialog", 18 * scale); + theme->set_constant("close_v_ofs", "WindowDialog", 18 * scale); // File Dialog - t->set_icon("reload", "FileDialog", make_icon(icon_reload_png)); + theme->set_icon("reload", "FileDialog", make_icon(icon_reload_png)); // Popup @@ -561,28 +563,28 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< selected->set_expand_margin_size(Margin(i), 2 * scale); } - t->set_stylebox("panel", "PopupPanel", style_pp); + theme->set_stylebox("panel", "PopupPanel", style_pp); // PopupMenu - t->set_stylebox("panel", "PopupMenu", make_stylebox(popup_bg_png, 4, 4, 4, 4, 10, 10, 10, 10)); - t->set_stylebox("panel_disabled", "PopupMenu", make_stylebox(popup_bg_disabled_png, 4, 4, 4, 4)); - t->set_stylebox("hover", "PopupMenu", selected); - t->set_stylebox("separator", "PopupMenu", make_stylebox(vseparator_png, 3, 3, 3, 3)); + theme->set_stylebox("panel", "PopupMenu", make_stylebox(popup_bg_png, 4, 4, 4, 4, 10, 10, 10, 10)); + theme->set_stylebox("panel_disabled", "PopupMenu", make_stylebox(popup_bg_disabled_png, 4, 4, 4, 4)); + theme->set_stylebox("hover", "PopupMenu", selected); + theme->set_stylebox("separator", "PopupMenu", make_stylebox(vseparator_png, 3, 3, 3, 3)); - t->set_icon("checked", "PopupMenu", make_icon(checked_png)); - t->set_icon("unchecked", "PopupMenu", make_icon(unchecked_png)); - t->set_icon("submenu", "PopupMenu", make_icon(submenu_png)); + theme->set_icon("checked", "PopupMenu", make_icon(checked_png)); + theme->set_icon("unchecked", "PopupMenu", make_icon(unchecked_png)); + theme->set_icon("submenu", "PopupMenu", make_icon(submenu_png)); - t->set_font("font", "PopupMenu", default_font); + theme->set_font("font", "PopupMenu", default_font); - t->set_color("font_color", "PopupMenu", control_font_color); - t->set_color("font_color_accel", "PopupMenu", Color(0.7, 0.7, 0.7, 0.8)); - t->set_color("font_color_disabled", "PopupMenu", Color(0.4, 0.4, 0.4, 0.8)); - t->set_color("font_color_hover", "PopupMenu", control_font_color); + theme->set_color("font_color", "PopupMenu", control_font_color); + theme->set_color("font_color_accel", "PopupMenu", Color(0.7, 0.7, 0.7, 0.8)); + theme->set_color("font_color_disabled", "PopupMenu", Color(0.4, 0.4, 0.4, 0.8)); + theme->set_color("font_color_hover", "PopupMenu", control_font_color); - t->set_constant("hseparation", "PopupMenu", 4 * scale); - t->set_constant("vseparation", "PopupMenu", 4 * scale); + theme->set_constant("hseparation", "PopupMenu", 4 * scale); + theme->set_constant("vseparation", "PopupMenu", 4 * scale); // GraphNode @@ -597,90 +599,90 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< //graphsb->set_expand_margin_size(MARGIN_LEFT,10); //graphsb->set_expand_margin_size(MARGIN_RIGHT,10); - t->set_stylebox("frame", "GraphNode", graphsb); - t->set_stylebox("selectedframe", "GraphNode", graphsbselected); - t->set_stylebox("defaultframe", "GraphNode", graphsbdefault); - t->set_stylebox("defaultfocus", "GraphNode", graphsbdeffocus); - t->set_stylebox("comment", "GraphNode", graphsbcomment); - t->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected); - t->set_stylebox("breakpoint", "GraphNode", graph_bpoint); - t->set_stylebox("position", "GraphNode", graph_position); - t->set_constant("separation", "GraphNode", 1 * scale); - t->set_icon("port", "GraphNode", make_icon(graph_port_png)); - t->set_icon("close", "GraphNode", make_icon(graph_node_close_png)); - t->set_icon("resizer", "GraphNode", make_icon(window_resizer_png)); - t->set_font("title_font", "GraphNode", default_font); - t->set_color("title_color", "GraphNode", Color(0, 0, 0, 1)); - t->set_constant("title_offset", "GraphNode", 20 * scale); - t->set_constant("close_offset", "GraphNode", 18 * scale); - t->set_constant("port_offset", "GraphNode", 3 * scale); + theme->set_stylebox("frame", "GraphNode", graphsb); + theme->set_stylebox("selectedframe", "GraphNode", graphsbselected); + theme->set_stylebox("defaultframe", "GraphNode", graphsbdefault); + theme->set_stylebox("defaultfocus", "GraphNode", graphsbdeffocus); + theme->set_stylebox("comment", "GraphNode", graphsbcomment); + theme->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected); + theme->set_stylebox("breakpoint", "GraphNode", graph_bpoint); + theme->set_stylebox("position", "GraphNode", graph_position); + theme->set_constant("separation", "GraphNode", 1 * scale); + theme->set_icon("port", "GraphNode", make_icon(graph_port_png)); + theme->set_icon("close", "GraphNode", make_icon(graph_node_close_png)); + theme->set_icon("resizer", "GraphNode", make_icon(window_resizer_png)); + theme->set_font("title_font", "GraphNode", default_font); + theme->set_color("title_color", "GraphNode", Color(0, 0, 0, 1)); + theme->set_constant("title_offset", "GraphNode", 20 * scale); + theme->set_constant("close_offset", "GraphNode", 18 * scale); + theme->set_constant("port_offset", "GraphNode", 3 * scale); // Tree Ref<StyleBoxTexture> tree_selected = make_stylebox(selection_png, 4, 4, 4, 4, 8, 0, 8, 0); Ref<StyleBoxTexture> tree_selected_oof = make_stylebox(selection_oof_png, 4, 4, 4, 4, 8, 0, 8, 0); - t->set_stylebox("bg", "Tree", make_stylebox(tree_bg_png, 4, 4, 4, 5)); - t->set_stylebox("bg_focus", "Tree", focus); - t->set_stylebox("selected", "Tree", tree_selected_oof); - t->set_stylebox("selected_focus", "Tree", tree_selected); - t->set_stylebox("cursor", "Tree", focus); - t->set_stylebox("cursor_unfocused", "Tree", focus); - t->set_stylebox("button_pressed", "Tree", make_stylebox(button_pressed_png, 4, 4, 4, 4)); - t->set_stylebox("title_button_normal", "Tree", make_stylebox(tree_title_png, 4, 4, 4, 4)); - t->set_stylebox("title_button_pressed", "Tree", make_stylebox(tree_title_pressed_png, 4, 4, 4, 4)); - t->set_stylebox("title_button_hover", "Tree", make_stylebox(tree_title_png, 4, 4, 4, 4)); - t->set_stylebox("custom_button", "Tree", sb_button_normal); - t->set_stylebox("custom_button_pressed", "Tree", sb_button_pressed); - t->set_stylebox("custom_button_hover", "Tree", sb_button_hover); - - t->set_icon("checked", "Tree", make_icon(checked_png)); - t->set_icon("unchecked", "Tree", make_icon(unchecked_png)); - t->set_icon("updown", "Tree", make_icon(updown_png)); - t->set_icon("select_arrow", "Tree", make_icon(dropdown_png)); - t->set_icon("arrow", "Tree", make_icon(arrow_down_png)); - t->set_icon("arrow_collapsed", "Tree", make_icon(arrow_right_png)); - - t->set_font("title_button_font", "Tree", default_font); - t->set_font("font", "Tree", default_font); - - t->set_color("title_button_color", "Tree", control_font_color); - t->set_color("font_color", "Tree", control_font_color_low); - t->set_color("font_color_selected", "Tree", control_font_color_pressed); - t->set_color("selection_color", "Tree", Color(0.1, 0.1, 1, 0.8)); - t->set_color("cursor_color", "Tree", Color(0, 0, 0)); - t->set_color("guide_color", "Tree", Color(0, 0, 0, 0.1)); - t->set_color("drop_position_color", "Tree", Color(1, 0.3, 0.2)); - t->set_color("relationship_line_color", "Tree", Color::html("464646")); - t->set_color("custom_button_font_highlight", "Tree", control_font_color_hover); - - t->set_constant("hseparation", "Tree", 4 * scale); - t->set_constant("vseparation", "Tree", 4 * scale); - t->set_constant("guide_width", "Tree", 2 * scale); - t->set_constant("item_margin", "Tree", 12 * scale); - t->set_constant("button_margin", "Tree", 4 * scale); - t->set_constant("draw_relationship_lines", "Tree", 0); - t->set_constant("scroll_border", "Tree", 4); - t->set_constant("scroll_speed", "Tree", 12); + theme->set_stylebox("bg", "Tree", make_stylebox(tree_bg_png, 4, 4, 4, 5)); + theme->set_stylebox("bg_focus", "Tree", focus); + theme->set_stylebox("selected", "Tree", tree_selected_oof); + theme->set_stylebox("selected_focus", "Tree", tree_selected); + theme->set_stylebox("cursor", "Tree", focus); + theme->set_stylebox("cursor_unfocused", "Tree", focus); + theme->set_stylebox("button_pressed", "Tree", make_stylebox(button_pressed_png, 4, 4, 4, 4)); + theme->set_stylebox("title_button_normal", "Tree", make_stylebox(tree_title_png, 4, 4, 4, 4)); + theme->set_stylebox("title_button_pressed", "Tree", make_stylebox(tree_title_pressed_png, 4, 4, 4, 4)); + theme->set_stylebox("title_button_hover", "Tree", make_stylebox(tree_title_png, 4, 4, 4, 4)); + theme->set_stylebox("custom_button", "Tree", sb_button_normal); + theme->set_stylebox("custom_button_pressed", "Tree", sb_button_pressed); + theme->set_stylebox("custom_button_hover", "Tree", sb_button_hover); + + theme->set_icon("checked", "Tree", make_icon(checked_png)); + theme->set_icon("unchecked", "Tree", make_icon(unchecked_png)); + theme->set_icon("updown", "Tree", make_icon(updown_png)); + theme->set_icon("select_arrow", "Tree", make_icon(dropdown_png)); + theme->set_icon("arrow", "Tree", make_icon(arrow_down_png)); + theme->set_icon("arrow_collapsed", "Tree", make_icon(arrow_right_png)); + + theme->set_font("title_button_font", "Tree", default_font); + theme->set_font("font", "Tree", default_font); + + theme->set_color("title_button_color", "Tree", control_font_color); + theme->set_color("font_color", "Tree", control_font_color_low); + theme->set_color("font_color_selected", "Tree", control_font_color_pressed); + theme->set_color("selection_color", "Tree", Color(0.1, 0.1, 1, 0.8)); + theme->set_color("cursor_color", "Tree", Color(0, 0, 0)); + theme->set_color("guide_color", "Tree", Color(0, 0, 0, 0.1)); + theme->set_color("drop_position_color", "Tree", Color(1, 0.3, 0.2)); + theme->set_color("relationship_line_color", "Tree", Color::html("464646")); + theme->set_color("custom_button_font_highlight", "Tree", control_font_color_hover); + + theme->set_constant("hseparation", "Tree", 4 * scale); + theme->set_constant("vseparation", "Tree", 4 * scale); + theme->set_constant("guide_width", "Tree", 2 * scale); + theme->set_constant("item_margin", "Tree", 12 * scale); + theme->set_constant("button_margin", "Tree", 4 * scale); + theme->set_constant("draw_relationship_lines", "Tree", 0); + theme->set_constant("scroll_border", "Tree", 4); + theme->set_constant("scroll_speed", "Tree", 12); // ItemList Ref<StyleBoxTexture> item_selected = make_stylebox(selection_png, 4, 4, 4, 4, 8, 2, 8, 2); Ref<StyleBoxTexture> item_selected_oof = make_stylebox(selection_oof_png, 4, 4, 4, 4, 8, 2, 8, 2); - t->set_stylebox("bg", "ItemList", make_stylebox(tree_bg_png, 4, 4, 4, 5)); - t->set_stylebox("bg_focus", "ItemList", focus); - t->set_constant("hseparation", "ItemList", 4); - t->set_constant("vseparation", "ItemList", 2); - t->set_constant("icon_margin", "ItemList", 4); - t->set_constant("line_separation", "ItemList", 2 * scale); - t->set_font("font", "ItemList", default_font); - t->set_color("font_color", "ItemList", control_font_color_lower); - t->set_color("font_color_selected", "ItemList", control_font_color_pressed); - t->set_color("guide_color", "ItemList", Color(0, 0, 0, 0.1)); - t->set_stylebox("selected", "ItemList", item_selected_oof); - t->set_stylebox("selected_focus", "ItemList", item_selected); - t->set_stylebox("cursor", "ItemList", focus); - t->set_stylebox("cursor_unfocused", "ItemList", focus); + theme->set_stylebox("bg", "ItemList", make_stylebox(tree_bg_png, 4, 4, 4, 5)); + theme->set_stylebox("bg_focus", "ItemList", focus); + theme->set_constant("hseparation", "ItemList", 4); + theme->set_constant("vseparation", "ItemList", 2); + theme->set_constant("icon_margin", "ItemList", 4); + theme->set_constant("line_separation", "ItemList", 2 * scale); + theme->set_font("font", "ItemList", default_font); + theme->set_color("font_color", "ItemList", control_font_color_lower); + theme->set_color("font_color_selected", "ItemList", control_font_color_pressed); + theme->set_color("guide_color", "ItemList", Color(0, 0, 0, 0.1)); + theme->set_stylebox("selected", "ItemList", item_selected_oof); + theme->set_stylebox("selected_focus", "ItemList", item_selected); + theme->set_stylebox("cursor", "ItemList", focus); + theme->set_stylebox("cursor_unfocused", "ItemList", focus); // TabContainer @@ -689,88 +691,88 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< tc_sb->set_expand_margin_size(MARGIN_TOP, 2 * scale); tc_sb->set_default_margin(MARGIN_TOP, 8 * scale); - t->set_stylebox("tab_fg", "TabContainer", sb_expand(make_stylebox(tab_current_png, 4, 4, 4, 1, 16, 4, 16, 4), 2, 2, 2, 2)); - t->set_stylebox("tab_bg", "TabContainer", sb_expand(make_stylebox(tab_behind_png, 5, 5, 5, 1, 16, 6, 16, 4), 3, 0, 3, 3)); - t->set_stylebox("panel", "TabContainer", tc_sb); + theme->set_stylebox("tab_fg", "TabContainer", sb_expand(make_stylebox(tab_current_png, 4, 4, 4, 1, 16, 4, 16, 4), 2, 2, 2, 2)); + theme->set_stylebox("tab_bg", "TabContainer", sb_expand(make_stylebox(tab_behind_png, 5, 5, 5, 1, 16, 6, 16, 4), 3, 0, 3, 3)); + theme->set_stylebox("panel", "TabContainer", tc_sb); - t->set_icon("increment", "TabContainer", make_icon(scroll_button_right_png)); - t->set_icon("increment_highlight", "TabContainer", make_icon(scroll_button_right_hl_png)); - t->set_icon("decrement", "TabContainer", make_icon(scroll_button_left_png)); - t->set_icon("decrement_highlight", "TabContainer", make_icon(scroll_button_left_hl_png)); - t->set_icon("menu", "TabContainer", make_icon(tab_menu_png)); - t->set_icon("menu_highlight", "TabContainer", make_icon(tab_menu_hl_png)); + theme->set_icon("increment", "TabContainer", make_icon(scroll_button_right_png)); + theme->set_icon("increment_highlight", "TabContainer", make_icon(scroll_button_right_hl_png)); + theme->set_icon("decrement", "TabContainer", make_icon(scroll_button_left_png)); + theme->set_icon("decrement_highlight", "TabContainer", make_icon(scroll_button_left_hl_png)); + theme->set_icon("menu", "TabContainer", make_icon(tab_menu_png)); + theme->set_icon("menu_highlight", "TabContainer", make_icon(tab_menu_hl_png)); - t->set_font("font", "TabContainer", default_font); + theme->set_font("font", "TabContainer", default_font); - t->set_color("font_color_fg", "TabContainer", control_font_color_hover); - t->set_color("font_color_bg", "TabContainer", control_font_color_low); - t->set_color("font_color_disabled", "TabContainer", control_font_color_disabled); + theme->set_color("font_color_fg", "TabContainer", control_font_color_hover); + theme->set_color("font_color_bg", "TabContainer", control_font_color_low); + theme->set_color("font_color_disabled", "TabContainer", control_font_color_disabled); - t->set_constant("side_margin", "TabContainer", 8 * scale); - t->set_constant("top_margin", "TabContainer", 24 * scale); - t->set_constant("label_valign_fg", "TabContainer", 0 * scale); - t->set_constant("label_valign_bg", "TabContainer", 2 * scale); - t->set_constant("hseparation", "TabContainer", 4 * scale); + theme->set_constant("side_margin", "TabContainer", 8 * scale); + theme->set_constant("top_margin", "TabContainer", 24 * scale); + theme->set_constant("label_valign_fg", "TabContainer", 0 * scale); + theme->set_constant("label_valign_bg", "TabContainer", 2 * scale); + theme->set_constant("hseparation", "TabContainer", 4 * scale); // Tabs - t->set_stylebox("tab_fg", "Tabs", sb_expand(make_stylebox(tab_current_png, 4, 3, 4, 1, 16, 3, 16, 2), 2, 2, 2, 2)); - t->set_stylebox("tab_bg", "Tabs", sb_expand(make_stylebox(tab_behind_png, 5, 4, 5, 1, 16, 5, 16, 2), 3, 3, 3, 3)); - t->set_stylebox("panel", "Tabs", tc_sb); - t->set_stylebox("button_pressed", "Tabs", make_stylebox(button_pressed_png, 4, 4, 4, 4)); - t->set_stylebox("button", "Tabs", make_stylebox(button_normal_png, 4, 4, 4, 4)); + theme->set_stylebox("tab_fg", "Tabs", sb_expand(make_stylebox(tab_current_png, 4, 3, 4, 1, 16, 3, 16, 2), 2, 2, 2, 2)); + theme->set_stylebox("tab_bg", "Tabs", sb_expand(make_stylebox(tab_behind_png, 5, 4, 5, 1, 16, 5, 16, 2), 3, 3, 3, 3)); + theme->set_stylebox("panel", "Tabs", tc_sb); + theme->set_stylebox("button_pressed", "Tabs", make_stylebox(button_pressed_png, 4, 4, 4, 4)); + theme->set_stylebox("button", "Tabs", make_stylebox(button_normal_png, 4, 4, 4, 4)); - t->set_icon("increment", "Tabs", make_icon(scroll_button_right_png)); - t->set_icon("increment_highlight", "Tabs", make_icon(scroll_button_right_hl_png)); - t->set_icon("decrement", "Tabs", make_icon(scroll_button_left_png)); - t->set_icon("decrement_highlight", "Tabs", make_icon(scroll_button_left_hl_png)); - t->set_icon("close", "Tabs", make_icon(tab_close_png)); + theme->set_icon("increment", "Tabs", make_icon(scroll_button_right_png)); + theme->set_icon("increment_highlight", "Tabs", make_icon(scroll_button_right_hl_png)); + theme->set_icon("decrement", "Tabs", make_icon(scroll_button_left_png)); + theme->set_icon("decrement_highlight", "Tabs", make_icon(scroll_button_left_hl_png)); + theme->set_icon("close", "Tabs", make_icon(tab_close_png)); - t->set_font("font", "Tabs", default_font); + theme->set_font("font", "Tabs", default_font); - t->set_color("font_color_fg", "Tabs", control_font_color_hover); - t->set_color("font_color_bg", "Tabs", control_font_color_low); - t->set_color("font_color_disabled", "Tabs", control_font_color_disabled); + theme->set_color("font_color_fg", "Tabs", control_font_color_hover); + theme->set_color("font_color_bg", "Tabs", control_font_color_low); + theme->set_color("font_color_disabled", "Tabs", control_font_color_disabled); - t->set_constant("top_margin", "Tabs", 24 * scale); - t->set_constant("label_valign_fg", "Tabs", 0 * scale); - t->set_constant("label_valign_bg", "Tabs", 2 * scale); - t->set_constant("hseparation", "Tabs", 4 * scale); + theme->set_constant("top_margin", "Tabs", 24 * scale); + theme->set_constant("label_valign_fg", "Tabs", 0 * scale); + theme->set_constant("label_valign_bg", "Tabs", 2 * scale); + theme->set_constant("hseparation", "Tabs", 4 * scale); // Separators - t->set_stylebox("separator", "HSeparator", make_stylebox(vseparator_png, 3, 3, 3, 3)); - t->set_stylebox("separator", "VSeparator", make_stylebox(hseparator_png, 3, 3, 3, 3)); + theme->set_stylebox("separator", "HSeparator", make_stylebox(vseparator_png, 3, 3, 3, 3)); + theme->set_stylebox("separator", "VSeparator", make_stylebox(hseparator_png, 3, 3, 3, 3)); - t->set_icon("close", "Icons", make_icon(icon_close_png)); - t->set_font("normal", "Fonts", default_font); - t->set_font("large", "Fonts", large_font); + theme->set_icon("close", "Icons", make_icon(icon_close_png)); + theme->set_font("normal", "Fonts", default_font); + theme->set_font("large", "Fonts", large_font); - t->set_constant("separation", "HSeparator", 4 * scale); - t->set_constant("separation", "VSeparator", 4 * scale); + theme->set_constant("separation", "HSeparator", 4 * scale); + theme->set_constant("separation", "VSeparator", 4 * scale); // Dialogs - t->set_constant("margin", "Dialogs", 8 * scale); - t->set_constant("button_margin", "Dialogs", 32 * scale); + theme->set_constant("margin", "Dialogs", 8 * scale); + theme->set_constant("button_margin", "Dialogs", 32 * scale); // FileDialog - t->set_icon("folder", "FileDialog", make_icon(icon_folder_png)); - t->set_color("files_disabled", "FileDialog", Color(0, 0, 0, 0.7)); + theme->set_icon("folder", "FileDialog", make_icon(icon_folder_png)); + theme->set_color("files_disabled", "FileDialog", Color(0, 0, 0, 0.7)); // colorPicker - t->set_constant("margin", "ColorPicker", 4 * scale); - t->set_constant("sv_width", "ColorPicker", 256 * scale); - t->set_constant("sv_height", "ColorPicker", 256 * scale); - t->set_constant("h_width", "ColorPicker", 30 * scale); - t->set_constant("label_width", "ColorPicker", 10 * scale); + theme->set_constant("margin", "ColorPicker", 4 * scale); + theme->set_constant("sv_width", "ColorPicker", 256 * scale); + theme->set_constant("sv_height", "ColorPicker", 256 * scale); + theme->set_constant("h_width", "ColorPicker", 30 * scale); + theme->set_constant("label_width", "ColorPicker", 10 * scale); - t->set_icon("screen_picker", "ColorPicker", make_icon(icon_color_pick_png)); - t->set_icon("add_preset", "ColorPicker", make_icon(icon_add_png)); - t->set_icon("color_hue", "ColorPicker", make_icon(color_picker_hue_png)); - t->set_icon("color_sample", "ColorPicker", make_icon(color_picker_sample_png)); + theme->set_icon("screen_picker", "ColorPicker", make_icon(icon_color_pick_png)); + theme->set_icon("add_preset", "ColorPicker", make_icon(icon_add_png)); + theme->set_icon("color_hue", "ColorPicker", make_icon(color_picker_hue_png)); + theme->set_icon("color_sample", "ColorPicker", make_icon(color_picker_sample_png)); // TooltipPanel @@ -778,111 +780,111 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< for (int i = 0; i < 4; i++) style_tt->set_expand_margin_size((Margin)i, 4 * scale); - t->set_stylebox("panel", "TooltipPanel", style_tt); + theme->set_stylebox("panel", "TooltipPanel", style_tt); - t->set_font("font", "TooltipLabel", default_font); + theme->set_font("font", "TooltipLabel", default_font); - t->set_color("font_color", "TooltipLabel", Color(0, 0, 0)); - t->set_color("font_color_shadow", "TooltipLabel", Color(0, 0, 0, 0.1)); + theme->set_color("font_color", "TooltipLabel", Color(0, 0, 0)); + theme->set_color("font_color_shadow", "TooltipLabel", Color(0, 0, 0, 0.1)); - t->set_constant("shadow_offset_x", "TooltipLabel", 1); - t->set_constant("shadow_offset_y", "TooltipLabel", 1); + theme->set_constant("shadow_offset_x", "TooltipLabel", 1); + theme->set_constant("shadow_offset_y", "TooltipLabel", 1); // RichTextLabel - t->set_stylebox("focus", "RichTextLabel", focus); + theme->set_stylebox("focus", "RichTextLabel", focus); - t->set_font("normal_font", "RichTextLabel", default_font); - t->set_font("bold_font", "RichTextLabel", default_font); - t->set_font("italics_font", "RichTextLabel", default_font); - t->set_font("bold_italics_font", "RichTextLabel", default_font); - t->set_font("mono_font", "RichTextLabel", default_font); + theme->set_font("normal_font", "RichTextLabel", default_font); + theme->set_font("bold_font", "RichTextLabel", default_font); + theme->set_font("italics_font", "RichTextLabel", default_font); + theme->set_font("bold_italics_font", "RichTextLabel", default_font); + theme->set_font("mono_font", "RichTextLabel", default_font); - t->set_color("default_color", "RichTextLabel", control_font_color); - t->set_color("font_color_selected", "RichTextLabel", font_color_selection); - t->set_color("selection_color", "RichTextLabel", Color(0.1, 0.1, 1, 0.8)); + theme->set_color("default_color", "RichTextLabel", control_font_color); + theme->set_color("font_color_selected", "RichTextLabel", font_color_selection); + theme->set_color("selection_color", "RichTextLabel", Color(0.1, 0.1, 1, 0.8)); - t->set_constant("line_separation", "RichTextLabel", 1 * scale); - t->set_constant("table_hseparation", "RichTextLabel", 3 * scale); - t->set_constant("table_vseparation", "RichTextLabel", 3 * scale); + theme->set_constant("line_separation", "RichTextLabel", 1 * scale); + theme->set_constant("table_hseparation", "RichTextLabel", 3 * scale); + theme->set_constant("table_vseparation", "RichTextLabel", 3 * scale); // Containers - t->set_stylebox("bg", "VSplitContainer", make_stylebox(vsplit_bg_png, 1, 1, 1, 1)); - t->set_stylebox("bg", "HSplitContainer", make_stylebox(hsplit_bg_png, 1, 1, 1, 1)); - - t->set_icon("grabber", "VSplitContainer", make_icon(vsplitter_png)); - t->set_icon("grabber", "HSplitContainer", make_icon(hsplitter_png)); - - t->set_constant("separation", "HBoxContainer", 4 * scale); - t->set_constant("separation", "VBoxContainer", 4 * scale); - t->set_constant("margin_left", "MarginContainer", 8 * scale); - t->set_constant("margin_top", "MarginContainer", 0 * scale); - t->set_constant("margin_right", "MarginContainer", 0 * scale); - t->set_constant("margin_bottom", "MarginContainer", 0 * scale); - t->set_constant("hseparation", "GridContainer", 4 * scale); - t->set_constant("vseparation", "GridContainer", 4 * scale); - t->set_constant("separation", "HSplitContainer", 12 * scale); - t->set_constant("separation", "VSplitContainer", 12 * scale); - t->set_constant("autohide", "HSplitContainer", 1 * scale); - t->set_constant("autohide", "VSplitContainer", 1 * scale); + theme->set_stylebox("bg", "VSplitContainer", make_stylebox(vsplit_bg_png, 1, 1, 1, 1)); + theme->set_stylebox("bg", "HSplitContainer", make_stylebox(hsplit_bg_png, 1, 1, 1, 1)); + + theme->set_icon("grabber", "VSplitContainer", make_icon(vsplitter_png)); + theme->set_icon("grabber", "HSplitContainer", make_icon(hsplitter_png)); + + theme->set_constant("separation", "HBoxContainer", 4 * scale); + theme->set_constant("separation", "VBoxContainer", 4 * scale); + theme->set_constant("margin_left", "MarginContainer", 8 * scale); + theme->set_constant("margin_top", "MarginContainer", 0 * scale); + theme->set_constant("margin_right", "MarginContainer", 0 * scale); + theme->set_constant("margin_bottom", "MarginContainer", 0 * scale); + theme->set_constant("hseparation", "GridContainer", 4 * scale); + theme->set_constant("vseparation", "GridContainer", 4 * scale); + theme->set_constant("separation", "HSplitContainer", 12 * scale); + theme->set_constant("separation", "VSplitContainer", 12 * scale); + theme->set_constant("autohide", "HSplitContainer", 1 * scale); + theme->set_constant("autohide", "VSplitContainer", 1 * scale); // HButtonArray - t->set_stylebox("normal", "HButtonArray", sb_button_normal); - t->set_stylebox("selected", "HButtonArray", sb_button_pressed); - t->set_stylebox("hover", "HButtonArray", sb_button_hover); + theme->set_stylebox("normal", "HButtonArray", sb_button_normal); + theme->set_stylebox("selected", "HButtonArray", sb_button_pressed); + theme->set_stylebox("hover", "HButtonArray", sb_button_hover); - t->set_font("font", "HButtonArray", default_font); - t->set_font("font_selected", "HButtonArray", default_font); + theme->set_font("font", "HButtonArray", default_font); + theme->set_font("font_selected", "HButtonArray", default_font); - t->set_color("font_color", "HButtonArray", control_font_color_low); - t->set_color("font_color_selected", "HButtonArray", control_font_color_hover); + theme->set_color("font_color", "HButtonArray", control_font_color_low); + theme->set_color("font_color_selected", "HButtonArray", control_font_color_hover); - t->set_constant("icon_separator", "HButtonArray", 2 * scale); - t->set_constant("button_separator", "HButtonArray", 4 * scale); + theme->set_constant("icon_separator", "HButtonArray", 2 * scale); + theme->set_constant("button_separator", "HButtonArray", 4 * scale); - t->set_stylebox("focus", "HButtonArray", focus); + theme->set_stylebox("focus", "HButtonArray", focus); // VButtonArray - t->set_stylebox("normal", "VButtonArray", sb_button_normal); - t->set_stylebox("selected", "VButtonArray", sb_button_pressed); - t->set_stylebox("hover", "VButtonArray", sb_button_hover); + theme->set_stylebox("normal", "VButtonArray", sb_button_normal); + theme->set_stylebox("selected", "VButtonArray", sb_button_pressed); + theme->set_stylebox("hover", "VButtonArray", sb_button_hover); - t->set_font("font", "VButtonArray", default_font); - t->set_font("font_selected", "VButtonArray", default_font); + theme->set_font("font", "VButtonArray", default_font); + theme->set_font("font_selected", "VButtonArray", default_font); - t->set_color("font_color", "VButtonArray", control_font_color_low); - t->set_color("font_color_selected", "VButtonArray", control_font_color_hover); + theme->set_color("font_color", "VButtonArray", control_font_color_low); + theme->set_color("font_color_selected", "VButtonArray", control_font_color_hover); - t->set_constant("icon_separator", "VButtonArray", 2 * scale); - t->set_constant("button_separator", "VButtonArray", 4 * scale); + theme->set_constant("icon_separator", "VButtonArray", 2 * scale); + theme->set_constant("button_separator", "VButtonArray", 4 * scale); - t->set_stylebox("focus", "VButtonArray", focus); + theme->set_stylebox("focus", "VButtonArray", focus); // ReferenceRect Ref<StyleBoxTexture> ttnc = make_stylebox(full_panel_bg_png, 8, 8, 8, 8); ttnc->set_draw_center(false); - t->set_stylebox("border", "ReferenceRect", make_stylebox(reference_border_png, 4, 4, 4, 4)); - t->set_stylebox("panelnc", "Panel", ttnc); - t->set_stylebox("panelf", "Panel", tc_sb); + theme->set_stylebox("border", "ReferenceRect", make_stylebox(reference_border_png, 4, 4, 4, 4)); + theme->set_stylebox("panelnc", "Panel", ttnc); + theme->set_stylebox("panelf", "Panel", tc_sb); Ref<StyleBoxTexture> sb_pc = make_stylebox(tab_container_bg_png, 4, 4, 4, 4, 7, 7, 7, 7); - t->set_stylebox("panel", "PanelContainer", sb_pc); - - t->set_icon("minus", "GraphEdit", make_icon(icon_zoom_less_png)); - t->set_icon("reset", "GraphEdit", make_icon(icon_zoom_reset_png)); - t->set_icon("more", "GraphEdit", make_icon(icon_zoom_more_png)); - t->set_icon("snap", "GraphEdit", make_icon(icon_snap_png)); - t->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5)); - t->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05)); - t->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2)); - t->set_constant("bezier_len_pos", "GraphEdit", 80 * scale); - t->set_constant("bezier_len_neg", "GraphEdit", 160 * scale); - - t->set_icon("logo", "Icons", make_icon(logo_png)); + theme->set_stylebox("panel", "PanelContainer", sb_pc); + + theme->set_icon("minus", "GraphEdit", make_icon(icon_zoom_less_png)); + theme->set_icon("reset", "GraphEdit", make_icon(icon_zoom_reset_png)); + theme->set_icon("more", "GraphEdit", make_icon(icon_zoom_more_png)); + theme->set_icon("snap", "GraphEdit", make_icon(icon_snap_png)); + theme->set_stylebox("bg", "GraphEdit", make_stylebox(tree_bg_png, 4, 4, 4, 5)); + theme->set_color("grid_minor", "GraphEdit", Color(1, 1, 1, 0.05)); + theme->set_color("grid_major", "GraphEdit", Color(1, 1, 1, 0.2)); + theme->set_constant("bezier_len_pos", "GraphEdit", 80 * scale); + theme->set_constant("bezier_len_neg", "GraphEdit", 160 * scale); + + theme->set_icon("logo", "Icons", make_icon(logo_png)); // Theme diff --git a/scene/resources/default_theme/scroll_grabber_pressed.png b/scene/resources/default_theme/scroll_grabber_pressed.png Binary files differnew file mode 100644 index 0000000000..a46d242ddd --- /dev/null +++ b/scene/resources/default_theme/scroll_grabber_pressed.png diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h index 70a8ad12cb..bed4bdb760 100644 --- a/scene/resources/default_theme/theme_data.h +++ b/scene/resources/default_theme/theme_data.h @@ -334,6 +334,10 @@ static const unsigned char scroll_grabber_hl_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0xc, 0x8, 0x3, 0x0, 0x0, 0x0, 0x61, 0xab, 0xac, 0xd5, 0x0, 0x0, 0x0, 0x4, 0x67, 0x41, 0x4d, 0x41, 0x0, 0x0, 0xb1, 0x8f, 0xb, 0xfc, 0x61, 0x5, 0x0, 0x0, 0x0, 0x20, 0x63, 0x48, 0x52, 0x4d, 0x0, 0x0, 0x7a, 0x26, 0x0, 0x0, 0x80, 0x84, 0x0, 0x0, 0xfa, 0x0, 0x0, 0x0, 0x80, 0xe8, 0x0, 0x0, 0x75, 0x30, 0x0, 0x0, 0xea, 0x60, 0x0, 0x0, 0x3a, 0x98, 0x0, 0x0, 0x17, 0x70, 0x9c, 0xba, 0x51, 0x3c, 0x0, 0x0, 0x0, 0x6c, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x97, 0xd0, 0xdf, 0x92, 0xcb, 0xdc, 0x84, 0xbb, 0xd4, 0x92, 0xca, 0xdc, 0x95, 0xd0, 0xdd, 0x83, 0xbb, 0xd3, 0x8b, 0xc8, 0xd7, 0x79, 0xb5, 0xcb, 0x78, 0xb4, 0xca, 0x73, 0xb0, 0xc7, 0x73, 0xb0, 0xc7, 0x7b, 0xc0, 0xcf, 0x79, 0xc5, 0xd1, 0x6b, 0xae, 0xc1, 0x75, 0xc6, 0xcf, 0x70, 0xbc, 0xca, 0x64, 0xa6, 0xbc, 0x71, 0xbc, 0xc9, 0x82, 0xba, 0xd4, 0x6a, 0xa2, 0xc6, 0x62, 0x9a, 0xc2, 0x61, 0x9a, 0xc1, 0x68, 0x9f, 0xc2, 0x5d, 0x92, 0xbb, 0x5c, 0x92, 0xb8, 0x58, 0x8d, 0xb6, 0x59, 0x8e, 0xb3, 0x56, 0x89, 0xb0, 0x5c, 0x91, 0xb2, 0x53, 0x84, 0xa9, 0x58, 0x8f, 0xae, 0x54, 0x83, 0xa4, 0x57, 0x8e, 0xad, 0x64, 0xa5, 0xba, 0xff, 0xff, 0xff, 0xbb, 0x65, 0x65, 0x27, 0x0, 0x0, 0x0, 0x13, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x25, 0xad, 0xf1, 0xad, 0x27, 0xef, 0xad, 0xf1, 0xf3, 0xf1, 0xf3, 0xad, 0x28, 0xef, 0x27, 0xad, 0xf2, 0xad, 0xcd, 0x8a, 0x27, 0xfe, 0x0, 0x0, 0x0, 0x1, 0x62, 0x4b, 0x47, 0x44, 0x23, 0x2a, 0x62, 0x6c, 0x3a, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xb, 0x13, 0x0, 0x0, 0xb, 0x13, 0x1, 0x0, 0x9a, 0x9c, 0x18, 0x0, 0x0, 0x0, 0x7, 0x74, 0x49, 0x4d, 0x45, 0x7, 0xe0, 0x6, 0x16, 0x12, 0x2b, 0x5, 0x39, 0x1a, 0x32, 0x39, 0x0, 0x0, 0x0, 0x50, 0x49, 0x44, 0x41, 0x54, 0x8, 0xd7, 0x63, 0x60, 0xc0, 0x7, 0x18, 0x99, 0x98, 0x85, 0x59, 0x18, 0x21, 0x6c, 0x56, 0x36, 0x11, 0x51, 0x31, 0x11, 0x36, 0x56, 0x30, 0x87, 0x5d, 0x5c, 0x2, 0x8, 0xc4, 0xd9, 0xc1, 0x1c, 0xe, 0x49, 0x29, 0x20, 0x90, 0xe4, 0x4, 0x73, 0xb8, 0xa4, 0x65, 0x80, 0x40, 0x9a, 0x1b, 0xcc, 0xe1, 0x91, 0x95, 0x3, 0x2, 0x59, 0x1e, 0x30, 0x87, 0x97, 0x4f, 0x5e, 0x41, 0x41, 0x91, 0x8f, 0x17, 0x62, 0x1c, 0xbf, 0x80, 0xa0, 0x92, 0x10, 0x3f, 0x5e, 0xdb, 0x1, 0x41, 0x87, 0x4, 0x7d, 0x15, 0xc4, 0xfd, 0x6a, 0x0, 0x0, 0x0, 0x19, 0x74, 0x45, 0x58, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x0, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x47, 0x49, 0x4d, 0x50, 0x57, 0x81, 0xe, 0x17, 0x0, 0x0, 0x0, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x0, 0x32, 0x30, 0x31, 0x36, 0x2d, 0x30, 0x36, 0x2d, 0x32, 0x32, 0x54, 0x32, 0x30, 0x3a, 0x33, 0x39, 0x3a, 0x32, 0x36, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0xc9, 0xad, 0xc8, 0x52, 0x0, 0x0, 0x0, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0, 0x32, 0x30, 0x31, 0x36, 0x2d, 0x30, 0x36, 0x2d, 0x32, 0x32, 0x54, 0x32, 0x30, 0x3a, 0x33, 0x39, 0x3a, 0x32, 0x36, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0xb8, 0xf0, 0x70, 0xee, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; +static const unsigned char scroll_grabber_pressed_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0xc, 0x8, 0x6, 0x0, 0x0, 0x0, 0x56, 0x75, 0x5c, 0xe7, 0x0, 0x0, 0x0, 0x4, 0x73, 0x42, 0x49, 0x54, 0x8, 0x8, 0x8, 0x8, 0x7c, 0x8, 0x64, 0x88, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xd, 0xd7, 0x0, 0x0, 0xd, 0xd7, 0x1, 0x42, 0x28, 0x9b, 0x78, 0x0, 0x0, 0x0, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x0, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63, 0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x0, 0x0, 0x0, 0x66, 0x49, 0x44, 0x41, 0x54, 0x28, 0x91, 0xcd, 0x91, 0xb1, 0xa, 0xc0, 0x20, 0x10, 0x43, 0x63, 0x71, 0xbf, 0x5f, 0x12, 0x9c, 0xfd, 0x1a, 0x3f, 0xcd, 0xa9, 0x83, 0xe0, 0x2f, 0x65, 0x2f, 0x9c, 0x8b, 0x83, 0x47, 0xed, 0x60, 0xbb, 0x34, 0xdb, 0x3d, 0x12, 0x48, 0x38, 0xa7, 0xaa, 0xd8, 0xd1, 0xb1, 0xe5, 0x7e, 0x13, 0xf0, 0xf3, 0xd1, 0x5a, 0xf3, 0x24, 0x23, 0x80, 0x34, 0x50, 0x11, 0x91, 0x1a, 0x42, 0xb8, 0x96, 0x1, 0x92, 0x51, 0x55, 0xf3, 0x84, 0x32, 0x49, 0x0, 0x38, 0x9f, 0x2a, 0x25, 0xdc, 0x65, 0xd8, 0xe7, 0xd1, 0x65, 0xe1, 0x31, 0xcc, 0x6c, 0x10, 0x91, 0x3a, 0x3a, 0x9b, 0xd1, 0xb3, 0xc7, 0xfd, 0xef, 0x71, 0x1d, 0x42, 0xe6, 0x21, 0x43, 0xf5, 0x2b, 0xd8, 0x6c, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; + static const unsigned char selection_png[] = { 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x4, 0x3, 0x0, 0x0, 0x0, 0xed, 0xdd, 0xe2, 0x52, 0x0, 0x0, 0x0, 0x4, 0x67, 0x41, 0x4d, 0x41, 0x0, 0x0, 0xb1, 0x8f, 0xb, 0xfc, 0x61, 0x5, 0x0, 0x0, 0x0, 0x20, 0x63, 0x48, 0x52, 0x4d, 0x0, 0x0, 0x7a, 0x26, 0x0, 0x0, 0x80, 0x84, 0x0, 0x0, 0xfa, 0x0, 0x0, 0x0, 0x80, 0xe8, 0x0, 0x0, 0x75, 0x30, 0x0, 0x0, 0xea, 0x60, 0x0, 0x0, 0x3a, 0x98, 0x0, 0x0, 0x17, 0x70, 0x9c, 0xba, 0x51, 0x3c, 0x0, 0x0, 0x0, 0x2d, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfd, 0xfb, 0xff, 0xfd, 0xf7, 0xff, 0xfd, 0xf7, 0xff, 0xfd, 0xf7, 0xff, 0xfd, 0xf6, 0xff, 0xf6, 0xf4, 0xff, 0x15, 0x15, 0x17, 0xff, 0x70, 0xc0, 0x21, 0x0, 0x0, 0x0, 0xe, 0x74, 0x52, 0x4e, 0x53, 0x6, 0xf, 0x16, 0x18, 0x2a, 0x3b, 0x40, 0x3c, 0x6, 0x3d, 0x44, 0x3e, 0x31, 0x25, 0x8, 0x3d, 0x16, 0xb4, 0x0, 0x0, 0x0, 0x1, 0x62, 0x4b, 0x47, 0x44, 0xe, 0x6f, 0xbd, 0x30, 0x4f, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xb, 0x13, 0x0, 0x0, 0xb, 0x13, 0x1, 0x0, 0x9a, 0x9c, 0x18, 0x0, 0x0, 0x0, 0x7, 0x74, 0x49, 0x4d, 0x45, 0x7, 0xe0, 0x6, 0x16, 0x12, 0x2b, 0x5, 0x39, 0x1a, 0x32, 0x39, 0x0, 0x0, 0x0, 0x37, 0x49, 0x44, 0x41, 0x54, 0x8, 0xd7, 0x63, 0x60, 0x54, 0x36, 0x6, 0x2, 0x23, 0x1, 0x6, 0x91, 0xb0, 0x34, 0x20, 0x48, 0x75, 0x64, 0x50, 0xef, 0x5c, 0x5, 0x4, 0x33, 0x8a, 0x18, 0xcc, 0xf6, 0xdc, 0x5, 0x82, 0xd3, 0xc9, 0xc, 0x66, 0x6b, 0x41, 0x8c, 0x5b, 0x94, 0x33, 0x60, 0x6, 0xc2, 0xad, 0x80, 0x5b, 0xa, 0x73, 0x6, 0x0, 0x45, 0x34, 0x48, 0x41, 0xa3, 0xc5, 0x91, 0x23, 0x0, 0x0, 0x0, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x0, 0x32, 0x30, 0x31, 0x36, 0x2d, 0x30, 0x36, 0x2d, 0x32, 0x32, 0x54, 0x32, 0x30, 0x3a, 0x33, 0x39, 0x3a, 0x32, 0x36, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0xc9, 0xad, 0xc8, 0x52, 0x0, 0x0, 0x0, 0x25, 0x74, 0x45, 0x58, 0x74, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0, 0x32, 0x30, 0x31, 0x36, 0x2d, 0x30, 0x36, 0x2d, 0x32, 0x32, 0x54, 0x32, 0x30, 0x3a, 0x33, 0x39, 0x3a, 0x32, 0x36, 0x2b, 0x30, 0x32, 0x3a, 0x30, 0x30, 0xb8, 0xf0, 0x70, 0xee, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 23bf6be68c..fc0d80a9b7 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -43,10 +43,10 @@ bool DynamicFontData::CacheID::operator<(CacheID right) const { return false; } -Ref<DynamicFontAtSize> DynamicFontData::_get_dynamic_font_at_size(CacheID p_id) { +Ref<DynamicFontAtSize> DynamicFontData::_get_dynamic_font_at_size(CacheID p_cache_id) { - if (size_cache.has(p_id)) { - return Ref<DynamicFontAtSize>(size_cache[p_id]); + if (size_cache.has(p_cache_id)) { + return Ref<DynamicFontAtSize>(size_cache[p_cache_id]); } Ref<DynamicFontAtSize> dfas; @@ -55,8 +55,8 @@ Ref<DynamicFontAtSize> DynamicFontData::_get_dynamic_font_at_size(CacheID p_id) dfas->font = Ref<DynamicFontData>(this); - size_cache[p_id] = dfas.ptr(); - dfas->id = p_id; + size_cache[p_cache_id] = dfas.ptr(); + dfas->id = p_cache_id; dfas->_load(); return dfas; diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 7c94def5aa..9024761b96 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -72,7 +72,7 @@ private: friend class DynamicFont; - Ref<DynamicFontAtSize> _get_dynamic_font_at_size(CacheID p_cache); + Ref<DynamicFontAtSize> _get_dynamic_font_at_size(CacheID p_cache_id); protected: static void _bind_methods(); diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index c121dae1f1..0bf6a50d93 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -1135,6 +1135,8 @@ void Environment::_bind_methods() { Environment::Environment() { + environment = VS::get_singleton()->environment_create(); + bg_mode = BG_CLEAR_COLOR; bg_sky_scale = 1.0; bg_energy = 1.0; @@ -1160,8 +1162,6 @@ Environment::Environment() { set_adjustment_enable(adjustment_enabled); //update - environment = VS::get_singleton()->environment_create(); - ssr_enabled = false; ssr_max_steps = 64; ssr_fade_in = 0.15; diff --git a/scene/resources/environment.h b/scene/resources/environment.h index a7c0e2a03d..3a6906aa27 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -224,10 +224,10 @@ public: void set_ssr_max_steps(int p_steps); int get_ssr_max_steps() const; - void set_ssr_fade_in(float p_transition); + void set_ssr_fade_in(float p_fade_in); float get_ssr_fade_in() const; - void set_ssr_fade_out(float p_transition); + void set_ssr_fade_out(float p_fade_out); float get_ssr_fade_out() const; void set_ssr_depth_tolerance(float p_depth_tolerance); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index d1431176d6..035e514eac 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -179,14 +179,14 @@ Vector<Variant> BitmapFont::_get_textures() const { return rtextures; } -Error BitmapFont::create_from_fnt(const String &p_string) { +Error BitmapFont::create_from_fnt(const String &p_file) { //fnt format used by angelcode bmfont //http://www.angelcode.com/products/bmfont/ - FileAccess *f = FileAccess::open(p_string, FileAccess::READ); + FileAccess *f = FileAccess::open(p_file, FileAccess::READ); if (!f) { - ERR_EXPLAIN("Can't open font: " + p_string); + ERR_EXPLAIN("Can't open font: " + p_file); ERR_FAIL_V(ERR_FILE_NOT_FOUND); } @@ -255,7 +255,7 @@ Error BitmapFont::create_from_fnt(const String &p_string) { if (keys.has("file")) { String file = keys["file"]; - file = p_string.get_base_dir() + "/" + file; + file = p_file.get_base_dir() + "/" + file; Ref<Texture> tex = ResourceLoader::load(file); if (tex.is_null()) { ERR_PRINT("Can't load font texture!"); diff --git a/scene/resources/material.h b/scene/resources/material.h index 25628e272a..140b2142c9 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -431,7 +431,7 @@ public: void set_depth_deep_parallax_max_layers(int p_layer); int get_depth_deep_parallax_max_layers() const; - void set_subsurface_scattering_strength(float p_strength); + void set_subsurface_scattering_strength(float p_subsurface_scattering_strength); float get_subsurface_scattering_strength() const; void set_refraction(float p_refraction); diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index e40ef99237..ad3c10b6bc 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -187,7 +187,7 @@ public: int get_surface_count() const; void surface_remove(int p_idx); - void surface_set_custom_aabb(int p_surface, const Rect3 &p_aabb); //only recognized by driver + void surface_set_custom_aabb(int p_idx, const Rect3 &p_aabb); //only recognized by driver int surface_get_array_len(int p_idx) const; int surface_get_array_index_len(int p_idx) const; diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index ce1d6f311f..169c956546 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1127,26 +1127,26 @@ bool SceneState::is_connection(int p_node, const StringName &p_signal, int p_to_ return false; } -void SceneState::set_bundled_scene(const Dictionary &d) { +void SceneState::set_bundled_scene(const Dictionary &p_dictionary) { - ERR_FAIL_COND(!d.has("names")); - ERR_FAIL_COND(!d.has("variants")); - ERR_FAIL_COND(!d.has("node_count")); - ERR_FAIL_COND(!d.has("nodes")); - ERR_FAIL_COND(!d.has("conn_count")); - ERR_FAIL_COND(!d.has("conns")); - //ERR_FAIL_COND( !d.has("path")); + ERR_FAIL_COND(!p_dictionary.has("names")); + ERR_FAIL_COND(!p_dictionary.has("variants")); + ERR_FAIL_COND(!p_dictionary.has("node_count")); + ERR_FAIL_COND(!p_dictionary.has("nodes")); + ERR_FAIL_COND(!p_dictionary.has("conn_count")); + ERR_FAIL_COND(!p_dictionary.has("conns")); + //ERR_FAIL_COND( !p_dictionary.has("path")); int version = 1; - if (d.has("version")) - version = d["version"]; + if (p_dictionary.has("version")) + version = p_dictionary["version"]; if (version > PACK_VERSION) { ERR_EXPLAIN("Save format version too new!"); ERR_FAIL(); } - PoolVector<String> snames = d["names"]; + PoolVector<String> snames = p_dictionary["names"]; if (snames.size()) { int namecount = snames.size(); @@ -1156,7 +1156,7 @@ void SceneState::set_bundled_scene(const Dictionary &d) { names[i] = r[i]; } - Array svariants = d["variants"]; + Array svariants = p_dictionary["variants"]; if (svariants.size()) { int varcount = svariants.size(); @@ -1170,10 +1170,10 @@ void SceneState::set_bundled_scene(const Dictionary &d) { variants.clear(); } - nodes.resize(d["node_count"]); + nodes.resize(p_dictionary["node_count"]); int nc = nodes.size(); if (nc) { - PoolVector<int> snodes = d["nodes"]; + PoolVector<int> snodes = p_dictionary["nodes"]; PoolVector<int>::Read r = snodes.read(); int idx = 0; for (int i = 0; i < nc; i++) { @@ -1197,12 +1197,12 @@ void SceneState::set_bundled_scene(const Dictionary &d) { } } - connections.resize(d["conn_count"]); + connections.resize(p_dictionary["conn_count"]); int cc = connections.size(); if (cc) { - PoolVector<int> sconns = d["conns"]; + PoolVector<int> sconns = p_dictionary["conns"]; PoolVector<int>::Read r = sconns.read(); int idx = 0; for (int i = 0; i < cc; i++) { @@ -1222,8 +1222,8 @@ void SceneState::set_bundled_scene(const Dictionary &d) { } Array np; - if (d.has("node_paths")) { - np = d["node_paths"]; + if (p_dictionary.has("node_paths")) { + np = p_dictionary["node_paths"]; } node_paths.resize(np.size()); for (int i = 0; i < np.size(); i++) { @@ -1231,12 +1231,12 @@ void SceneState::set_bundled_scene(const Dictionary &d) { } Array ei; - if (d.has("editable_instances")) { - ei = d["editable_instances"]; + if (p_dictionary.has("editable_instances")) { + ei = p_dictionary["editable_instances"]; } - if (d.has("base_scene")) { - base_scene_idx = d["base_scene"]; + if (p_dictionary.has("base_scene")) { + base_scene_idx = p_dictionary["base_scene"]; } editable_instances.resize(ei.size()); @@ -1244,7 +1244,7 @@ void SceneState::set_bundled_scene(const Dictionary &d) { editable_instances[i] = ei[i]; } - //path=d["path"]; + //path=p_dictionary["path"]; } Dictionary SceneState::get_bundled_scene() const { @@ -1696,9 +1696,9 @@ SceneState::SceneState() { //////////////// -void PackedScene::_set_bundled_scene(const Dictionary &d) { +void PackedScene::_set_bundled_scene(const Dictionary &p_scene) { - state->set_bundled_scene(d); + state->set_bundled_scene(p_scene); } Dictionary PackedScene::_get_bundled_scene() const { diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 065e7a84dd..6a3ddde02a 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -618,8 +618,8 @@ Vector3 CubeMesh::get_size() const { return size; } -void CubeMesh::set_subdivide_width(const int p_subdivide) { - subdivide_w = p_subdivide > 0 ? p_subdivide : 0; +void CubeMesh::set_subdivide_width(const int p_divisions) { + subdivide_w = p_divisions > 0 ? p_divisions : 0; _request_update(); } @@ -627,8 +627,8 @@ int CubeMesh::get_subdivide_width() const { return subdivide_w; } -void CubeMesh::set_subdivide_height(const int p_subdivide) { - subdivide_h = p_subdivide > 0 ? p_subdivide : 0; +void CubeMesh::set_subdivide_height(const int p_divisions) { + subdivide_h = p_divisions > 0 ? p_divisions : 0; _request_update(); } @@ -636,8 +636,8 @@ int CubeMesh::get_subdivide_height() const { return subdivide_h; } -void CubeMesh::set_subdivide_depth(const int p_subdivide) { - subdivide_d = p_subdivide > 0 ? p_subdivide : 0; +void CubeMesh::set_subdivide_depth(const int p_divisions) { + subdivide_d = p_divisions > 0 ? p_divisions : 0; _request_update(); } @@ -957,8 +957,8 @@ Size2 PlaneMesh::get_size() const { return size; } -void PlaneMesh::set_subdivide_width(const int p_subdivide) { - subdivide_w = p_subdivide > 0 ? p_subdivide : 0; +void PlaneMesh::set_subdivide_width(const int p_divisions) { + subdivide_w = p_divisions > 0 ? p_divisions : 0; _request_update(); } @@ -966,8 +966,8 @@ int PlaneMesh::get_subdivide_width() const { return subdivide_w; } -void PlaneMesh::set_subdivide_depth(const int p_subdivide) { - subdivide_d = p_subdivide > 0 ? p_subdivide : 0; +void PlaneMesh::set_subdivide_depth(const int p_divisions) { + subdivide_d = p_divisions > 0 ? p_divisions : 0; _request_update(); } diff --git a/scene/resources/room.h b/scene/resources/room.h index 1bcdec5eb0..ba5c0eee1c 100644 --- a/scene/resources/room.h +++ b/scene/resources/room.h @@ -50,7 +50,7 @@ protected: public: virtual RID get_rid() const; - void set_geometry_hint(const PoolVector<Face3> &geometry_hint); + void set_geometry_hint(const PoolVector<Face3> &p_geometry_hint); PoolVector<Face3> get_geometry_hint() const; RoomBounds(); diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index 03a862b744..49cd030a9a 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -621,9 +621,9 @@ ResourceInteractiveLoaderText::~ResourceInteractiveLoaderText() { memdelete(f); } -void ResourceInteractiveLoaderText::get_dependencies(FileAccess *f, List<String> *p_dependencies, bool p_add_types) { +void ResourceInteractiveLoaderText::get_dependencies(FileAccess *p_f, List<String> *p_dependencies, bool p_add_types) { - open(f); + open(p_f); ignore_resource_parsing = true; ERR_FAIL_COND(error != OK); diff --git a/scene/resources/shape_2d.h b/scene/resources/shape_2d.h index a752b8dbe2..c020fb9141 100644 --- a/scene/resources/shape_2d.h +++ b/scene/resources/shape_2d.h @@ -47,10 +47,10 @@ public: void set_custom_solver_bias(real_t p_bias); real_t get_custom_solver_bias() const; - bool collide_with_motion(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_p_shape_motion); + bool collide_with_motion(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_shape_motion); bool collide(const Transform2D &p_local_xform, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform); - Variant collide_with_motion_and_get_contacts(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_p_shape_motion); + Variant collide_with_motion_and_get_contacts(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_shape_motion); Variant collide_and_get_contacts(const Transform2D &p_local_xform, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform); virtual void draw(const RID &p_to_rid, const Color &p_color) {} diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index a3c683f857..9320676016 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -33,36 +33,36 @@ #define _VERTEX_SNAP 0.0001 #define EQ_VERTEX_DIST 0.00001 -bool SurfaceTool::Vertex::operator==(const Vertex &p_b) const { +bool SurfaceTool::Vertex::operator==(const Vertex &p_vertex) const { - if (vertex != p_b.vertex) + if (vertex != p_vertex.vertex) return false; - if (uv != p_b.uv) + if (uv != p_vertex.uv) return false; - if (uv2 != p_b.uv2) + if (uv2 != p_vertex.uv2) return false; - if (normal != p_b.normal) + if (normal != p_vertex.normal) return false; - if (binormal != p_b.binormal) + if (binormal != p_vertex.binormal) return false; - if (color != p_b.color) + if (color != p_vertex.color) return false; - if (bones.size() != p_b.bones.size()) + if (bones.size() != p_vertex.bones.size()) return false; for (int i = 0; i < bones.size(); i++) { - if (bones[i] != p_b.bones[i]) + if (bones[i] != p_vertex.bones[i]) return false; } for (int i = 0; i < weights.size(); i++) { - if (weights[i] != p_b.weights[i]) + if (weights[i] != p_vertex.weights[i]) return false; } diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h index d02e170b02..fcc94753ca 100644 --- a/scene/resources/surface_tool.h +++ b/scene/resources/surface_tool.h @@ -102,8 +102,8 @@ public: void add_normal(const Vector3 &p_normal); void add_tangent(const Plane &p_tangent); void add_uv(const Vector2 &p_uv); - void add_uv2(const Vector2 &p_uv); - void add_bones(const Vector<int> &p_indices); + void add_uv2(const Vector2 &p_uv2); + void add_bones(const Vector<int> &p_bones); void add_weights(const Vector<float> &p_weights); void add_smooth_group(bool p_smooth); diff --git a/scene/resources/theme.h b/scene/resources/theme.h index 1dfea7f421..5744c142d4 100644 --- a/scene/resources/theme.h +++ b/scene/resources/theme.h @@ -143,8 +143,8 @@ public: static void set_default(const Ref<Theme> &p_default); static void set_default_icon(const Ref<Texture> &p_icon); - static void set_default_style(const Ref<StyleBox> &p_default_style); - static void set_default_font(const Ref<Font> &p_default_font); + static void set_default_style(const Ref<StyleBox> &p_style); + static void set_default_font(const Ref<Font> &p_font); void set_default_theme_font(const Ref<Font> &p_default_font); Ref<Font> get_default_theme_font() const; @@ -159,7 +159,7 @@ public: Ref<Shader> get_shader(const StringName &p_name, const StringName &p_type) const; bool has_shader(const StringName &p_name, const StringName &p_type) const; void clear_shader(const StringName &p_name, const StringName &p_type); - void get_shader_list(const StringName &p_name, List<StringName> *p_list) const; + void get_shader_list(const StringName &p_type, List<StringName> *p_list) const; void set_stylebox(const StringName &p_name, const StringName &p_type, const Ref<StyleBox> &p_style); Ref<StyleBox> get_stylebox(const StringName &p_name, const StringName &p_type) const; diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 99c506390c..7d7855811f 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -105,7 +105,7 @@ public: void tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape); Ref<Shape2D> tile_get_shape(int p_id, int p_shape_id) const; - void tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_transform); + void tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset); Transform2D tile_get_shape_transform(int p_id, int p_shape_id) const; void tile_set_shape_one_way(int p_id, int p_shape_id, bool p_one_way); @@ -121,7 +121,7 @@ public: void tile_set_material(int p_id, const Ref<ShaderMaterial> &p_material); Ref<ShaderMaterial> tile_get_material(int p_id) const; - void tile_set_modulate(int p_id, const Color &p_color); + void tile_set_modulate(int p_id, const Color &p_modulate); Color tile_get_modulate(int p_id) const; void tile_set_occluder_offset(int p_id, const Vector2 &p_offset); diff --git a/servers/arvr_server.h b/servers/arvr_server.h index fd7c5470c3..06e0a4561c 100644 --- a/servers/arvr_server.h +++ b/servers/arvr_server.h @@ -88,7 +88,7 @@ protected: public: static ARVRServer *get_singleton(); - /* + /* World scale allows you to specify a scale factor that is applied to all positioning vectors in our VR world in essence scaling up, or scaling down the world. For stereoscopic rendering specifically this is very important to give an accurate sense of scale. Add controllers into the mix and an accurate mapping of real world movement to percieved virtual movement becomes very important. @@ -107,18 +107,18 @@ public: actions be it straffing, teleporting, etc. Movement of the player by moving through the physical space is always tracked in relation to this point. - Note that the ARVROrigin spatial node in your scene automatically updates this property and it should be used instead of + Note that the ARVROrigin spatial node in your scene automatically updates this property and it should be used instead of direct access to this property and it therefor is not available in GDScript Note: this should not be used in AR and should be ignored by an AR based interface as it would throw what you're looking at in the real world and in the virtual world out of sync */ Transform get_world_origin() const; - void set_world_origin(const Transform p_origin); + void set_world_origin(const Transform p_world_origin); /* Requesting a reference frame results in a matrix being calculated that ensures the HMD is positioned to 0,0,0 facing 0,0,-1 (need to verify this direction) - in the virtual world. + in the virtual world. Note: this should not be used in AR and should be ignored by an AR based interface as it would throw what you're looking at in the real world and in the virtual world out of sync @@ -127,7 +127,7 @@ public: void request_reference_frame(bool p_ignore_tilt, bool p_keep_height); /* - Interfaces are objects that 'glue' Godot to an AR or VR SDK such as the Oculus SDK, OpenVR, OpenHMD, etc. + Interfaces are objects that 'glue' Godot to an AR or VR SDK such as the Oculus SDK, OpenVR, OpenHMD, etc. */ void add_interface(const Ref<ARVRInterface> &p_interface); void remove_interface(const Ref<ARVRInterface> &p_interface); @@ -144,10 +144,10 @@ public: void clear_primary_interface_if(const Ref<ARVRInterface> &p_primary_interface); /* this is automatically called if an interface destructs */ /* - Our trackers are objects that expose the orientation and position of physical devices such as controller, anchor points, etc. + Our trackers are objects that expose the orientation and position of physical devices such as controller, anchor points, etc. They are created and managed by our active AR/VR interfaces. - Note that for trackers that + Note that for trackers that */ int get_free_tracker_id_for_type(TrackerType p_tracker_type); void add_tracker(ARVRPositionalTracker *p_tracker); diff --git a/servers/audio/audio_filter_sw.h b/servers/audio/audio_filter_sw.h index f5a07c4c8f..caf735436a 100644 --- a/servers/audio/audio_filter_sw.h +++ b/servers/audio/audio_filter_sw.h @@ -97,24 +97,24 @@ public: /* inline methods */ -void AudioFilterSW::Processor::process_one(float &p_val) { +void AudioFilterSW::Processor::process_one(float &p_sample) { - float pre = p_val; - p_val = (p_val * coeffs.b0 + hb1 * coeffs.b1 + hb2 * coeffs.b2 + ha1 * coeffs.a1 + ha2 * coeffs.a2); + float pre = p_sample; + p_sample = (p_sample * coeffs.b0 + hb1 * coeffs.b1 + hb2 * coeffs.b2 + ha1 * coeffs.a1 + ha2 * coeffs.a2); ha2 = ha1; hb2 = hb1; hb1 = pre; - ha1 = p_val; + ha1 = p_sample; } -void AudioFilterSW::Processor::process_one_interp(float &p_val) { +void AudioFilterSW::Processor::process_one_interp(float &p_sample) { - float pre = p_val; - p_val = (p_val * coeffs.b0 + hb1 * coeffs.b1 + hb2 * coeffs.b2 + ha1 * coeffs.a1 + ha2 * coeffs.a2); + float pre = p_sample; + p_sample = (p_sample * coeffs.b0 + hb1 * coeffs.b1 + hb2 * coeffs.b2 + ha1 * coeffs.a1 + ha2 * coeffs.a2); ha2 = ha1; hb2 = hb1; hb1 = pre; - ha1 = p_val; + ha1 = p_sample; coeffs.b0 += incr_coeffs.b0; coeffs.b1 += incr_coeffs.b1; diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h index a35826be21..0d63e7af82 100644 --- a/servers/audio/audio_stream.h +++ b/servers/audio/audio_stream.h @@ -74,7 +74,7 @@ protected: virtual float get_stream_sampling_rate() = 0; public: - virtual void mix(AudioFrame *p_bufer, float p_rate_scale, int p_frames); + virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames); AudioStreamPlaybackResampled() { mix_offset = 0; } }; @@ -104,7 +104,7 @@ protected: static void _bind_methods(); public: - void set_audio_stream(const Ref<AudioStream> &audio_stream); + void set_audio_stream(const Ref<AudioStream> &p_audio_stream); Ref<AudioStream> get_audio_stream() const; void set_random_pitch(float p_pitch); diff --git a/servers/audio/effects/audio_effect_distortion.h b/servers/audio/effects/audio_effect_distortion.h index 2f84bd4dc7..afeb6ac7ec 100644 --- a/servers/audio/effects/audio_effect_distortion.h +++ b/servers/audio/effects/audio_effect_distortion.h @@ -71,16 +71,16 @@ public: void set_mode(Mode p_mode); Mode get_mode() const; - void set_pre_gain(float pre_gain); + void set_pre_gain(float p_pre_gain); float get_pre_gain() const; - void set_keep_hf_hz(float keep_hf_hz); + void set_keep_hf_hz(float p_keep_hf_hz); float get_keep_hf_hz() const; - void set_drive(float drive); + void set_drive(float p_drive); float get_drive() const; - void set_post_gain(float post_gain); + void set_post_gain(float p_post_gain); float get_post_gain() const; AudioEffectDistortion(); diff --git a/servers/audio/effects/audio_effect_panner.h b/servers/audio/effects/audio_effect_panner.h index 4b41fecc45..8c3edfbde0 100644 --- a/servers/audio/effects/audio_effect_panner.h +++ b/servers/audio/effects/audio_effect_panner.h @@ -54,7 +54,7 @@ protected: public: Ref<AudioEffectInstance> instance(); - void set_pan(float p_volume); + void set_pan(float p_cpanume); float get_pan() const; AudioEffectPanner(); diff --git a/servers/physics/broad_phase_basic.cpp b/servers/physics/broad_phase_basic.cpp index 679b9a31fc..05a2e1fdf8 100644 --- a/servers/physics/broad_phase_basic.cpp +++ b/servers/physics/broad_phase_basic.cpp @@ -169,10 +169,10 @@ void BroadPhaseBasic::set_pair_callback(PairCallback p_pair_callback, void *p_us pair_userdata = p_userdata; pair_callback = p_pair_callback; } -void BroadPhaseBasic::set_unpair_callback(UnpairCallback p_pair_callback, void *p_userdata) { +void BroadPhaseBasic::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) { unpair_userdata = p_userdata; - unpair_callback = p_pair_callback; + unpair_callback = p_unpair_callback; } void BroadPhaseBasic::update() { diff --git a/servers/physics/broad_phase_octree.cpp b/servers/physics/broad_phase_octree.cpp index 2439fbeae9..e1aaf4e31a 100644 --- a/servers/physics/broad_phase_octree.cpp +++ b/servers/physics/broad_phase_octree.cpp @@ -78,7 +78,7 @@ int BroadPhaseOctree::cull_segment(const Vector3 &p_from, const Vector3 &p_to, C int BroadPhaseOctree::cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) { - return octree.cull_AABB(p_aabb, p_results, p_max_results, p_result_indices); + return octree.cull_aabb(p_aabb, p_results, p_max_results, p_result_indices); } void *BroadPhaseOctree::_pair_callback(void *self, OctreeElementID p_A, CollisionObjectSW *p_object_A, int subindex_A, OctreeElementID p_B, CollisionObjectSW *p_object_B, int subindex_B) { diff --git a/servers/physics/broad_phase_octree.h b/servers/physics/broad_phase_octree.h index 88d72a2bd8..bd3ba6677a 100644 --- a/servers/physics/broad_phase_octree.h +++ b/servers/physics/broad_phase_octree.h @@ -47,7 +47,7 @@ class BroadPhaseOctree : public BroadPhaseSW { public: // 0 is an invalid ID - virtual ID create(CollisionObjectSW *p_object_, int p_subindex = 0); + virtual ID create(CollisionObjectSW *p_object, int p_subindex = 0); virtual void move(ID p_id, const Rect3 &p_aabb); virtual void set_static(ID p_id, bool p_static); virtual void remove(ID p_id); diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h index a56253e33d..44786829af 100644 --- a/servers/physics/collision_object_sw.h +++ b/servers/physics/collision_object_sw.h @@ -98,7 +98,7 @@ protected: void _set_static(bool p_static); virtual void _shapes_changed() = 0; - void _set_space(SpaceSW *space); + void _set_space(SpaceSW *p_space); bool ray_pickable; diff --git a/servers/physics/joints/cone_twist_joint_sw.cpp b/servers/physics/joints/cone_twist_joint_sw.cpp index 51bc27ea7d..d00eab53d3 100644 --- a/servers/physics/joints/cone_twist_joint_sw.cpp +++ b/servers/physics/joints/cone_twist_joint_sw.cpp @@ -110,7 +110,7 @@ ConeTwistJointSW::ConeTwistJointSW(BodySW *rbA, BodySW *rbB, const Transform &rb m_appliedImpulse = 0; } -bool ConeTwistJointSW::setup(real_t p_step) { +bool ConeTwistJointSW::setup(real_t p_timestep) { m_appliedImpulse = real_t(0.); //set bias, sign, clear accumulator @@ -237,7 +237,7 @@ bool ConeTwistJointSW::setup(real_t p_step) { return true; } -void ConeTwistJointSW::solve(real_t timeStep) { +void ConeTwistJointSW::solve(real_t p_timestep) { Vector3 pivotAInW = A->get_transform().xform(m_rbAFrame.origin); Vector3 pivotBInW = B->get_transform().xform(m_rbBFrame.origin); @@ -261,7 +261,7 @@ void ConeTwistJointSW::solve(real_t timeStep) { rel_vel = normal.dot(vel); //positional error (zeroth order error) real_t depth = -(pivotAInW - pivotBInW).dot(normal); //this is the error projected on the normal - real_t impulse = depth * tau / timeStep * jacDiagABInv - rel_vel * jacDiagABInv; + real_t impulse = depth * tau / p_timestep * jacDiagABInv - rel_vel * jacDiagABInv; m_appliedImpulse += impulse; Vector3 impulse_vector = normal * impulse; A->apply_impulse(pivotAInW - A->get_transform().origin, impulse_vector); @@ -276,7 +276,7 @@ void ConeTwistJointSW::solve(real_t timeStep) { // solve swing limit if (m_solveSwingLimit) { - real_t amplitude = ((angVelB - angVelA).dot(m_swingAxis) * m_relaxationFactor * m_relaxationFactor + m_swingCorrection * (real_t(1.) / timeStep) * m_biasFactor); + real_t amplitude = ((angVelB - angVelA).dot(m_swingAxis) * m_relaxationFactor * m_relaxationFactor + m_swingCorrection * (real_t(1.) / p_timestep) * m_biasFactor); real_t impulseMag = amplitude * m_kSwing; // Clamp the accumulated impulse @@ -292,7 +292,7 @@ void ConeTwistJointSW::solve(real_t timeStep) { // solve twist limit if (m_solveTwistLimit) { - real_t amplitude = ((angVelB - angVelA).dot(m_twistAxis) * m_relaxationFactor * m_relaxationFactor + m_twistCorrection * (real_t(1.) / timeStep) * m_biasFactor); + real_t amplitude = ((angVelB - angVelA).dot(m_twistAxis) * m_relaxationFactor * m_relaxationFactor + m_twistCorrection * (real_t(1.) / p_timestep) * m_biasFactor); real_t impulseMag = amplitude * m_kTwist; // Clamp the accumulated impulse diff --git a/servers/physics/joints/cone_twist_joint_sw.h b/servers/physics/joints/cone_twist_joint_sw.h index 65d26d0ca7..f0e029712c 100644 --- a/servers/physics/joints/cone_twist_joint_sw.h +++ b/servers/physics/joints/cone_twist_joint_sw.h @@ -104,8 +104,8 @@ public: public: virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_CONE_TWIST; } - virtual bool setup(real_t p_step); - virtual void solve(real_t p_step); + virtual bool setup(real_t p_timestep); + virtual void solve(real_t p_timestep); ConeTwistJointSW(BodySW *rbA, BodySW *rbB, const Transform &rbAFrame, const Transform &rbBFrame); diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index e4349bda9a..e1cd6ee7e5 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -298,7 +298,7 @@ bool Generic6DOFJointSW::testAngularLimitMotor(int axis_index) { return m_angularLimits[axis_index].needApplyTorques(); } -bool Generic6DOFJointSW::setup(real_t p_step) { +bool Generic6DOFJointSW::setup(real_t p_timestep) { // Clear accumulated impulses for the next simulation step m_linearLimits.m_accumulatedImpulse = Vector3(real_t(0.), real_t(0.), real_t(0.)); @@ -347,8 +347,8 @@ bool Generic6DOFJointSW::setup(real_t p_step) { return true; } -void Generic6DOFJointSW::solve(real_t timeStep) { - m_timeStep = timeStep; +void Generic6DOFJointSW::solve(real_t p_timestep) { + m_timeStep = p_timestep; //calculateTransforms(); diff --git a/servers/physics/joints/generic_6dof_joint_sw.h b/servers/physics/joints/generic_6dof_joint_sw.h index 4af0c93876..587a5850df 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.h +++ b/servers/physics/joints/generic_6dof_joint_sw.h @@ -264,8 +264,8 @@ public: virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_6DOF; } - virtual bool setup(real_t p_step); - virtual void solve(real_t p_step); + virtual bool setup(real_t p_timestep); + virtual void solve(real_t p_timestep); //! Calcs global transform of the offsets /*! diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h index bae2839b71..818922a989 100644 --- a/servers/physics/physics_server_sw.h +++ b/servers/physics/physics_server_sw.h @@ -127,7 +127,7 @@ public: virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value); virtual void area_set_transform(RID p_area, const Transform &p_transform); - virtual Variant area_get_param(RID p_parea, AreaParameter p_param) const; + virtual Variant area_get_param(RID p_area, AreaParameter p_param) const; virtual Transform area_get_transform(RID p_area) const; virtual void area_set_ray_pickable(RID p_area, bool p_enable); diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h index aa1975b655..52623c019d 100644 --- a/servers/physics/shape_sw.h +++ b/servers/physics/shape_sw.h @@ -385,7 +385,7 @@ public: virtual void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const; virtual Vector3 get_support(const Vector3 &p_normal) const; - virtual bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const; + virtual bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal) const; virtual bool intersect_point(const Vector3 &p_point) const; virtual Vector3 get_closest_point_to(const Vector3 &p_point) const; diff --git a/servers/physics_2d/broad_phase_2d_basic.cpp b/servers/physics_2d/broad_phase_2d_basic.cpp index a0bcd37fbc..76094ad98c 100644 --- a/servers/physics_2d/broad_phase_2d_basic.cpp +++ b/servers/physics_2d/broad_phase_2d_basic.cpp @@ -124,10 +124,10 @@ void BroadPhase2DBasic::set_pair_callback(PairCallback p_pair_callback, void *p_ pair_userdata = p_userdata; pair_callback = p_pair_callback; } -void BroadPhase2DBasic::set_unpair_callback(UnpairCallback p_pair_callback, void *p_userdata) { +void BroadPhase2DBasic::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) { unpair_userdata = p_userdata; - unpair_callback = p_pair_callback; + unpair_callback = p_unpair_callback; } void BroadPhase2DBasic::update() { diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.h b/servers/physics_2d/broad_phase_2d_hash_grid.h index 2234557857..0cb3edb94f 100644 --- a/servers/physics_2d/broad_phase_2d_hash_grid.h +++ b/servers/physics_2d/broad_phase_2d_hash_grid.h @@ -167,7 +167,7 @@ class BroadPhase2DHashGrid : public BroadPhase2DSW { void _check_motion(Element *p_elem); public: - virtual ID create(CollisionObject2DSW *p_object_, int p_subindex = 0); + virtual ID create(CollisionObject2DSW *p_object, int p_subindex = 0); virtual void move(ID p_id, const Rect2 &p_aabb); virtual void set_static(ID p_id, bool p_static); virtual void remove(ID p_id); diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h index 5e29132e8d..ad8edb0b3d 100644 --- a/servers/physics_2d/collision_object_2d_sw.h +++ b/servers/physics_2d/collision_object_2d_sw.h @@ -90,7 +90,7 @@ protected: void _set_static(bool p_static); virtual void _shapes_changed() = 0; - void _set_space(Space2DSW *space); + void _set_space(Space2DSW *p_space); CollisionObject2DSW(Type p_type); diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index c698d614b8..3805075ac3 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -722,11 +722,11 @@ uint32_t Physics2DServerSW::body_get_object_instance_id(RID p_body) const { return body->get_instance_id(); }; -void Physics2DServerSW::body_set_collision_layer(RID p_body, uint32_t p_flags) { +void Physics2DServerSW::body_set_collision_layer(RID p_body, uint32_t p_layer) { Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); - body->set_collision_layer(p_flags); + body->set_collision_layer(p_layer); }; uint32_t Physics2DServerSW::body_get_collision_layer(RID p_body) const { @@ -737,11 +737,11 @@ uint32_t Physics2DServerSW::body_get_collision_layer(RID p_body) const { return body->get_collision_layer(); }; -void Physics2DServerSW::body_set_collision_mask(RID p_body, uint32_t p_flags) { +void Physics2DServerSW::body_set_collision_mask(RID p_body, uint32_t p_mask) { Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); - body->set_collision_mask(p_flags); + body->set_collision_mask(p_mask); }; uint32_t Physics2DServerSW::body_get_collision_mask(RID p_body) const { diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h index 830ba91c98..e767aad1da 100644 --- a/servers/physics_2d/physics_2d_server_sw.h +++ b/servers/physics_2d/physics_2d_server_sw.h @@ -134,7 +134,7 @@ public: virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value); virtual void area_set_transform(RID p_area, const Transform2D &p_transform); - virtual Variant area_get_param(RID p_parea, AreaParameter p_param) const; + virtual Variant area_get_param(RID p_area, AreaParameter p_param) const; virtual Transform2D area_get_transform(RID p_area) const; virtual void area_set_monitorable(RID p_area, bool p_monitorable); virtual void area_set_collision_mask(RID p_area, uint32_t p_mask); @@ -169,8 +169,8 @@ public: virtual void body_remove_shape(RID p_body, int p_shape_idx); virtual void body_clear_shapes(RID p_body); - virtual void body_set_shape_disabled(RID p_body, int p_shape, bool p_disabled); - virtual void body_set_shape_as_one_way_collision(RID p_body, int p_shape, bool p_enabled); + virtual void body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled); + virtual void body_set_shape_as_one_way_collision(RID p_body, int p_shape_idx, bool p_enable); virtual void body_attach_object_instance_id(RID p_body, uint32_t p_ID); virtual uint32_t body_get_object_instance_id(RID p_body) const; @@ -182,7 +182,7 @@ public: virtual uint32_t body_get_collision_layer(RID p_body) const; virtual void body_set_collision_mask(RID p_body, uint32_t p_mask); - virtual uint32_t body_get_collision_mask(RID p_) const; + virtual uint32_t body_get_collision_mask(RID p_body) const; virtual void body_set_param(RID p_body, BodyParameter p_param, real_t p_value); virtual real_t body_get_param(RID p_body, BodyParameter p_param) const; diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index a17d1f6a12..29f879d8e9 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -678,25 +678,21 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co } } - if (col_obj->get_type() == CollisionObject2DSW::TYPE_BODY) { + if (col_obj->is_shape_set_as_one_way_collision(j)) { - const Body2DSW *body = static_cast<const Body2DSW *>(col_obj); - if (col_obj->is_shape_set_as_one_way_collision(j)) { + Vector2 cd[2]; + Physics2DServerSW::CollCbkData cbk; + cbk.max = 1; + cbk.amount = 0; + cbk.ptr = cd; + cbk.valid_dir = body_shape_xform.get_axis(1).normalized(); + ; + cbk.valid_depth = 10e20; - Vector2 cd[2]; - Physics2DServerSW::CollCbkData cbk; - cbk.max = 1; - cbk.amount = 0; - cbk.ptr = cd; - cbk.valid_dir = body_shape_xform.get_axis(1).normalized(); - ; - cbk.valid_depth = 10e20; - - Vector2 sep = mnormal; //important optimization for this to work fast enough - bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * (hi + contact_max_allowed_penetration), col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), Physics2DServerSW::_shape_col_cbk, &cbk, &sep, 0); - if (!collided || cbk.amount == 0) { - continue; - } + Vector2 sep = mnormal; //important optimization for this to work fast enough + bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * (hi + contact_max_allowed_penetration), col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), Physics2DServerSW::_shape_col_cbk, &cbk, &sep, 0); + if (!collided || cbk.amount == 0) { + continue; } } diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index 7b0e5ab445..27732b9c29 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -245,11 +245,11 @@ Dictionary Physics2DDirectSpaceState::_intersect_ray(const Vector2 &p_from, cons return d; } -Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryParameters> &psq, int p_max_results) { +Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results) { Vector<ShapeResult> sr; sr.resize(p_max_results); - int rc = intersect_shape(psq->shape, psq->transform, psq->motion, psq->margin, sr.ptr(), sr.size(), psq->exclude, psq->collision_layer, psq->object_type_mask); + int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, sr.ptr(), sr.size(), p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask); Array ret; ret.resize(rc); for (int i = 0; i < rc; i++) { @@ -266,10 +266,10 @@ Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryP return ret; } -Array Physics2DDirectSpaceState::_cast_motion(const Ref<Physics2DShapeQueryParameters> &psq) { +Array Physics2DDirectSpaceState::_cast_motion(const Ref<Physics2DShapeQueryParameters> &p_shape_query) { float closest_safe, closest_unsafe; - bool res = cast_motion(psq->shape, psq->transform, psq->motion, psq->margin, closest_safe, closest_unsafe, psq->exclude, psq->collision_layer, psq->object_type_mask); + bool res = cast_motion(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, closest_safe, closest_unsafe, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask); if (!res) return Array(); Array ret; @@ -307,12 +307,12 @@ Array Physics2DDirectSpaceState::_intersect_point(const Vector2 &p_point, int p_ return r; } -Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryParameters> &psq, int p_max_results) { +Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results) { Vector<Vector2> ret; ret.resize(p_max_results * 2); int rc = 0; - bool res = collide_shape(psq->shape, psq->transform, psq->motion, psq->margin, ret.ptr(), p_max_results, rc, psq->exclude, psq->collision_layer, psq->object_type_mask); + bool res = collide_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, ret.ptr(), p_max_results, rc, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask); if (!res) return Array(); Array r; @@ -321,11 +321,11 @@ Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryPar r[i] = ret[i]; return r; } -Dictionary Physics2DDirectSpaceState::_get_rest_info(const Ref<Physics2DShapeQueryParameters> &psq) { +Dictionary Physics2DDirectSpaceState::_get_rest_info(const Ref<Physics2DShapeQueryParameters> &p_shape_query) { ShapeRestInfo sri; - bool res = rest_info(psq->shape, psq->transform, psq->motion, psq->margin, &sri, psq->exclude, psq->collision_layer, psq->object_type_mask); + bool res = rest_info(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, &sri, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask); Dictionary r; if (!res) return r; diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index fbf104c6ac..86bf6253ee 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -270,11 +270,11 @@ Dictionary PhysicsDirectSpaceState::_intersect_ray(const Vector3 &p_from, const return d; } -Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParameters> &psq, int p_max_results) { +Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results) { Vector<ShapeResult> sr; sr.resize(p_max_results); - int rc = intersect_shape(psq->shape, psq->transform, psq->margin, sr.ptr(), sr.size(), psq->exclude, psq->collision_layer, psq->object_type_mask); + int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, sr.ptr(), sr.size(), p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask); Array ret; ret.resize(rc); for (int i = 0; i < rc; i++) { @@ -290,10 +290,10 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam return ret; } -Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameters> &psq, const Vector3 &p_motion) { +Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameters> &p_shape_query, const Vector3 &p_motion) { float closest_safe, closest_unsafe; - bool res = cast_motion(psq->shape, psq->transform, p_motion, psq->margin, closest_safe, closest_unsafe, psq->exclude, psq->collision_layer, psq->object_type_mask); + bool res = cast_motion(p_shape_query->shape, p_shape_query->transform, p_motion, p_shape_query->margin, closest_safe, closest_unsafe, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask); if (!res) return Array(); Array ret; @@ -302,12 +302,12 @@ Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameter ret[1] = closest_unsafe; return ret; } -Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParameters> &psq, int p_max_results) { +Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results) { Vector<Vector3> ret; ret.resize(p_max_results * 2); int rc = 0; - bool res = collide_shape(psq->shape, psq->transform, psq->margin, ret.ptr(), p_max_results, rc, psq->exclude, psq->collision_layer, psq->object_type_mask); + bool res = collide_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, ret.ptr(), p_max_results, rc, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask); if (!res) return Array(); Array r; @@ -316,11 +316,11 @@ Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParamet r[i] = ret[i]; return r; } -Dictionary PhysicsDirectSpaceState::_get_rest_info(const Ref<PhysicsShapeQueryParameters> &psq) { +Dictionary PhysicsDirectSpaceState::_get_rest_info(const Ref<PhysicsShapeQueryParameters> &p_shape_query) { ShapeRestInfo sri; - bool res = rest_info(psq->shape, psq->transform, psq->margin, &sri, psq->exclude, psq->collision_layer, psq->object_type_mask); + bool res = rest_info(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, &sri, p_shape_query->exclude, p_shape_query->collision_layer, p_shape_query->object_type_mask); Dictionary r; if (!res) return r; diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index 584f45412e..dcc16794e7 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -392,14 +392,14 @@ void VisualServerCanvas::canvas_item_set_draw_behind_parent(RID p_item, bool p_e canvas_item->behind = p_enable; } -void VisualServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_colors, float p_width, bool p_antialiased) { +void VisualServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width, bool p_antialiased) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); Item::CommandLine *line = memnew(Item::CommandLine); ERR_FAIL_COND(!line); - line->color = p_colors; + line->color = p_color; line->from = p_from; line->to = p_to; line->width = p_width; diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h index 48e3186ece..25d4973cb7 100644 --- a/servers/visual/visual_server_canvas.h +++ b/servers/visual/visual_server_canvas.h @@ -171,7 +171,7 @@ public: void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable); void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = 1.0, bool p_antialiased = false); - void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_line, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false); + void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false); void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color); void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color); void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID()); diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index cc4fe0809d..4f16ae4125 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -2902,7 +2902,7 @@ Vector<RID> VisualServerRaster::instances_cull_aabb(const AABB& p_aabb, RID p_sc int culled=0; Instance *cull[1024]; - culled=scenario->octree.cull_AABB(p_aabb,cull,1024); + culled=scenario->octree.cull_aabb(p_aabb,cull,1024); for (int i=0;i<culled;i++) { diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 11a9c8c9c1..5faf0e67ca 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -910,7 +910,7 @@ Vector<ObjectID> VisualServerScene::instances_cull_aabb(const Rect3 &p_aabb, RID int culled = 0; Instance *cull[1024]; - culled = scenario->octree.cull_AABB(p_aabb, cull, 1024); + culled = scenario->octree.cull_aabb(p_aabb, cull, 1024); for (int i = 0; i < culled; i++) { @@ -2645,11 +2645,11 @@ static float _get_normal_advance(const Vector3 &p_normal) { return 1.0 / normal.dot(unorm); } -void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, const GIProbeDataCell *cells, InstanceGIProbeData::LocalData *local_data, const uint32_t *leaves, int leaf_count, const InstanceGIProbeData::LightCache &light_cache, int sign) { +void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, const GIProbeDataCell *cells, InstanceGIProbeData::LocalData *local_data, const uint32_t *leaves, int p_leaf_count, const InstanceGIProbeData::LightCache &light_cache, int p_sign) { - int light_r = int(light_cache.color.r * light_cache.energy * 1024.0) * sign; - int light_g = int(light_cache.color.g * light_cache.energy * 1024.0) * sign; - int light_b = int(light_cache.color.b * light_cache.energy * 1024.0) * sign; + int light_r = int(light_cache.color.r * light_cache.energy * 1024.0) * p_sign; + int light_g = int(light_cache.color.g * light_cache.energy * 1024.0) * p_sign; + int light_b = int(light_cache.color.b * light_cache.energy * 1024.0) * p_sign; float limits[3] = { float(header->width), float(header->height), float(header->depth) }; Plane clip[3]; @@ -2685,7 +2685,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co uint64_t us = OS::get_singleton()->get_ticks_usec(); - for (int i = 0; i < leaf_count; i++) { + for (int i = 0; i < p_leaf_count; i++) { uint32_t idx = leaves[i]; @@ -2750,7 +2750,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co float local_radius = light_cache.radius * light_cache.transform.basis.get_axis(2).length(); - for (int i = 0; i < leaf_count; i++) { + for (int i = 0; i < p_leaf_count; i++) { uint32_t idx = leaves[i]; diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index a4895382a4..910e75c3e3 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -567,7 +567,7 @@ public: _FORCE_INLINE_ uint32_t _gi_bake_find_cell(const GIProbeDataCell *cells, int x, int y, int z, int p_cell_subdiv); void _bake_gi_downscale_light(int p_idx, int p_level, const GIProbeDataCell *p_cells, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data, float p_propagate); void _bake_gi_probe_light(const GIProbeDataHeader *header, const GIProbeDataCell *cells, InstanceGIProbeData::LocalData *local_data, const uint32_t *leaves, int p_leaf_count, const InstanceGIProbeData::LightCache &light_cache, int p_sign); - void _bake_gi_probe(Instance *p_probe); + void _bake_gi_probe(Instance *p_gi_probe); bool _check_gi_probe(Instance *p_gi_probe); void _setup_gi_probe(Instance *p_instance); |