diff options
821 files changed, 6988 insertions, 5702 deletions
diff --git a/.gitignore b/.gitignore index b347b348a5..0de1e682a0 100644 --- a/.gitignore +++ b/.gitignore @@ -88,6 +88,9 @@ bld/ [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* +# Hints for improving IntelliSense, created together with VS project +cpp.hint + #NUNIT *.VisualState.xml TestResult.xml diff --git a/SConstruct b/SConstruct index 7a28a1a64c..856994ef15 100644 --- a/SConstruct +++ b/SConstruct @@ -22,6 +22,7 @@ platform_flags = {} # flags for each platform active_platforms = [] active_platform_ids = [] platform_exporters = [] +platform_apis = [] global_defaults = [] for x in glob.glob("platform/*"): @@ -34,6 +35,8 @@ for x in glob.glob("platform/*"): if (os.path.exists(x + "/export/export.cpp")): platform_exporters.append(x[9:]) + if (os.path.exists(x + "/api/api.cpp")): + platform_apis.append(x[9:]) if (os.path.exists(x + "/globals/global_defaults.cpp")): global_defaults.append(x[9:]) if (detect.is_active()): @@ -215,6 +218,7 @@ env_base.Append(CPPPATH=['#core', '#core/math', '#editor', '#drivers', '#']) # configure ENV for platform env_base.platform_exporters = platform_exporters +env_base.platform_apis = platform_apis """ sys.path.append("./platform/"+env_base["platform"]) @@ -270,9 +274,12 @@ if selected_platform in platform_list: if len(pieces) > 0: basename = pieces[0] basename = basename.replace('\\\\', '/') - env.vs_srcs = env.vs_srcs + [basename + ".cpp"] - env.vs_incs = env.vs_incs + [basename + ".h"] - # print basename + if os.path.isfile(basename + ".h"): + env.vs_incs = env.vs_incs + [basename + ".h"] + if os.path.isfile(basename + ".c"): + env.vs_srcs = env.vs_srcs + [basename + ".c"] + elif os.path.isfile(basename + ".cpp"): + env.vs_srcs = env.vs_srcs + [basename + ".cpp"] env.AddToVSProject = AddToVSProject env.extra_suffix = "" @@ -366,7 +373,7 @@ if selected_platform in platform_list: sys.modules.pop('detect') env.module_list = [] - env.doc_class_path={} + env.doc_class_path = {} for x in module_list: if not env['module_' + x + '_enabled']: @@ -382,11 +389,10 @@ if selected_platform in platform_list: doc_classes = config.get_doc_classes() doc_path = config.get_doc_path() for c in doc_classes: - env.doc_class_path[c]="modules/"+x+"/"+doc_path + env.doc_class_path[c] = "modules/" + x + "/" + doc_path except: pass - sys.path.remove(tmppath) sys.modules.pop('config') @@ -436,6 +442,7 @@ if selected_platform in platform_list: SConscript("editor/SCsub") SConscript("drivers/SCsub") + SConscript("platform/SCsub") SConscript("modules/SCsub") SConscript("main/SCsub") @@ -445,6 +452,7 @@ if selected_platform in platform_list: if env['vsproj']: env['CPPPATH'] = [Dir(path) for path in env['CPPPATH']] methods.generate_vs_project(env, GetOption("num_jobs")) + methods.generate_cpp_hint_file("cpp.hint") # Check for the existence of headers conf = Configure(env) diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index c369f4bffe..e1adb250e7 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -2592,6 +2592,16 @@ bool _Engine::is_in_physics_frame() const { return Engine::get_singleton()->is_in_physics_frame(); } +bool _Engine::has_singleton(const String &p_name) const { + + return Engine::get_singleton()->has_singleton(p_name); +} + +Object *_Engine::get_singleton_object(const String &p_name) const { + + return Engine::get_singleton()->get_singleton_object(p_name); +} + void _Engine::set_editor_hint(bool p_enabled) { Engine::get_singleton()->set_editor_hint(p_enabled); @@ -2621,6 +2631,9 @@ void _Engine::_bind_methods() { ClassDB::bind_method(D_METHOD("is_in_physics_frame"), &_Engine::is_in_physics_frame); + ClassDB::bind_method(D_METHOD("has_singleton", "name"), &_Engine::has_singleton); + ClassDB::bind_method(D_METHOD("get_singleton", "name"), &_Engine::get_singleton_object); + ClassDB::bind_method(D_METHOD("set_editor_hint", "enabled"), &_Engine::set_editor_hint); ClassDB::bind_method(D_METHOD("is_editor_hint"), &_Engine::is_editor_hint); } diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index bbbb40d926..9be8895443 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -670,6 +670,9 @@ public: bool is_in_physics_frame() const; + bool has_singleton(const String &p_name) const; + Object *get_singleton_object(const String &p_name) const; + void set_editor_hint(bool p_enabled); bool is_editor_hint() const; diff --git a/core/engine.cpp b/core/engine.cpp index c609ae9520..31abcd62ef 100644 --- a/core/engine.cpp +++ b/core/engine.cpp @@ -100,6 +100,31 @@ Dictionary Engine::get_version_info() const { return dict; } +void Engine::add_singleton(const Singleton &p_singleton) { + + singletons.push_back(p_singleton); + singleton_ptrs[p_singleton.name] = p_singleton.ptr; +} + +Object *Engine::get_singleton_object(const String &p_name) const { + + const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name); + ERR_EXPLAIN("Failed to retrieve non-existent singleton '" + p_name + "'"); + ERR_FAIL_COND_V(!E, NULL); + return E->get(); +}; + +bool Engine::has_singleton(const String &p_name) const { + + return singleton_ptrs.has(p_name); +}; + +void Engine::get_singletons(List<Singleton> *p_singletons) { + + for (List<Singleton>::Element *E = singletons.front(); E; E = E->next()) + p_singletons->push_back(E->get()); +} + Engine *Engine::singleton = NULL; Engine *Engine::get_singleton() { diff --git a/core/engine.h b/core/engine.h index 3b4979582f..4a573c1539 100644 --- a/core/engine.h +++ b/core/engine.h @@ -37,6 +37,17 @@ class Engine { +public: + struct Singleton { + StringName name; + Object *ptr; + Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL) + : name(p_name), + ptr(p_ptr) { + } + }; + +private: friend class Main; uint64_t frames_drawn; @@ -54,6 +65,9 @@ class Engine { uint64_t _idle_frames; bool _in_physics; + List<Singleton> singletons; + Map<StringName, Object *> singleton_ptrs; + bool editor_hint; static Engine *singleton; @@ -83,6 +97,11 @@ public: void set_frame_delay(uint32_t p_msec); uint32_t get_frame_delay() const; + void add_singleton(const Singleton &p_singleton); + void get_singletons(List<Singleton> *p_singletons); + bool has_singleton(const String &p_name) const; + Object *get_singleton_object(const String &p_name) const; + _FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; } #ifdef TOOLS_ENABLED diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 7854f342b0..48101c8cf1 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -557,7 +557,7 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_PLANE", Variant::PLANE); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_QUAT", Variant::QUAT); // 10 - BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_RECT3", Variant::RECT3); + BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM", Variant::TRANSFORM); BIND_GLOBAL_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR); diff --git a/core/helper/math_fieldwise.cpp b/core/helper/math_fieldwise.cpp index 228611f8b3..2cd8a4f392 100644 --- a/core/helper/math_fieldwise.cpp +++ b/core/helper/math_fieldwise.cpp @@ -46,8 +46,8 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const switch (p_source.get_type()) { - /* clang-format makes a mess of this macro usage */ - /* clang-format off */ + /* clang-format makes a mess of this macro usage */ + /* clang-format off */ case Variant::VECTOR2: { @@ -106,9 +106,9 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const return target; } - case Variant::RECT3: { + case Variant::AABB: { - SETUP_TYPE(Rect3) + SETUP_TYPE(AABB) /**/ TRY_TRANSFER_FIELD("px", position.x) else TRY_TRANSFER_FIELD("py", position.y) diff --git a/core/image.cpp b/core/image.cpp index 42684e7ea7..422c0e407b 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -757,22 +757,24 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { _copy_internals_from(dst); } -void Image::crop(int p_width, int p_height) { +void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) { if (!_can_modify(format)) { ERR_EXPLAIN("Cannot crop in indexed, compressed or custom image formats."); ERR_FAIL(); } + ERR_FAIL_COND(p_x < 0); + ERR_FAIL_COND(p_y < 0); ERR_FAIL_COND(p_width <= 0); ERR_FAIL_COND(p_height <= 0); - ERR_FAIL_COND(p_width > MAX_WIDTH); - ERR_FAIL_COND(p_height > MAX_HEIGHT); + ERR_FAIL_COND(p_x + p_width > MAX_WIDTH); + ERR_FAIL_COND(p_y + p_height > MAX_HEIGHT); /* to save memory, cropping should be done in-place, however, since this function will most likely either not be used much, or in critical areas, for now it wont, because it's a waste of time. */ - if (p_width == width && p_height == height) + if (p_width == width && p_height == height && p_x == 0 && p_y == 0) return; uint8_t pdata[16]; //largest is 16 @@ -784,9 +786,11 @@ void Image::crop(int p_width, int p_height) { PoolVector<uint8_t>::Read r = data.read(); PoolVector<uint8_t>::Write w = dst.data.write(); - for (int y = 0; y < p_height; y++) { + int m_h = p_y + p_height; + int m_w = p_x + p_width; + for (int y = p_y; y < m_h; y++) { - for (int x = 0; x < p_width; x++) { + for (int x = p_x; x < m_w; x++) { if ((x >= width || y >= height)) { for (uint32_t i = 0; i < pixel_size; i++) @@ -795,7 +799,7 @@ void Image::crop(int p_width, int p_height) { _get_pixelb(x, y, pixel_size, r.ptr(), pdata); } - dst._put_pixelb(x, y, pixel_size, w.ptr(), pdata); + dst._put_pixelb(x - p_x, y - p_y, pixel_size, w.ptr(), pdata); } } } @@ -805,6 +809,11 @@ void Image::crop(int p_width, int p_height) { _copy_internals_from(dst); } +void Image::crop(int p_width, int p_height) { + + crop_from_point(0, 0, p_width, p_height); +} + void Image::flip_y() { if (!_can_modify(format)) { diff --git a/core/image.h b/core/image.h index 27df65a898..24693aa706 100644 --- a/core/image.h +++ b/core/image.h @@ -207,6 +207,7 @@ public: /** * Crop the image to a specific size, if larger, then the image is filled by black */ + void crop_from_point(int p_x, int p_y, int p_width, int p_height); void crop(int p_width, int p_height); void flip_x(); diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index d388a622de..1d9d2dd959 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -159,7 +159,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int r_variant = str; } break; - // math types + // math types case Variant::VECTOR2: { @@ -245,10 +245,10 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int (*r_len) += 4 * 4; } break; - case Variant::RECT3: { + case Variant::AABB: { ERR_FAIL_COND_V(len < (int)4 * 6, ERR_INVALID_DATA); - Rect3 val; + AABB val; val.position.x = decode_float(&buf[0]); val.position.y = decode_float(&buf[4]); val.position.z = decode_float(&buf[8]); @@ -967,7 +967,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo _encode_string(p_variant, buf, r_len); } break; - // math types + // math types case Variant::VECTOR2: { @@ -1045,10 +1045,10 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 4 * 4; } break; - case Variant::RECT3: { + case Variant::AABB: { if (buf) { - Rect3 aabb = p_variant; + AABB aabb = p_variant; encode_float(aabb.position.x, &buf[0]); encode_float(aabb.position.y, &buf[4]); encode_float(aabb.position.z, &buf[8]); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 03c3c5f615..8dc396c362 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -52,7 +52,7 @@ enum { VARIANT_VECTOR3 = 12, VARIANT_PLANE = 13, VARIANT_QUAT = 14, - VARIANT_RECT3 = 15, + VARIANT_AABB = 15, VARIANT_MATRIX3 = 16, VARIANT_TRANSFORM = 17, VARIANT_MATRIX32 = 18, @@ -196,9 +196,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { r_v = v; } break; - case VARIANT_RECT3: { + case VARIANT_AABB: { - Rect3 v; + AABB v; v.position.x = f->get_real(); v.position.y = f->get_real(); v.position.z = f->get_real(); @@ -1374,10 +1374,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant &p_property, f->store_real(val.w); } break; - case Variant::RECT3: { + case Variant::AABB: { - f->store_32(VARIANT_RECT3); - Rect3 val = p_property; + f->store_32(VARIANT_AABB); + AABB val = p_property; f->store_real(val.position.x); f->store_real(val.position.y); f->store_real(val.position.z); diff --git a/core/math/rect3.cpp b/core/math/aabb.cpp index 6f01000f61..737a42b337 100644 --- a/core/math/rect3.cpp +++ b/core/math/aabb.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* rect3.cpp */ +/* aabb.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,25 +27,25 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "rect3.h" +#include "aabb.h" #include "print_string.h" -real_t Rect3::get_area() const { +real_t AABB::get_area() const { return size.x * size.y * size.z; } -bool Rect3::operator==(const Rect3 &p_rval) const { +bool AABB::operator==(const AABB &p_rval) const { return ((position == p_rval.position) && (size == p_rval.size)); } -bool Rect3::operator!=(const Rect3 &p_rval) const { +bool AABB::operator!=(const AABB &p_rval) const { return ((position != p_rval.position) || (size != p_rval.size)); } -void Rect3::merge_with(const Rect3 &p_aabb) { +void AABB::merge_with(const AABB &p_aabb) { Vector3 beg_1, beg_2; Vector3 end_1, end_2; @@ -68,7 +68,7 @@ void Rect3::merge_with(const Rect3 &p_aabb) { size = max - min; } -Rect3 Rect3::intersection(const Rect3 &p_aabb) const { +AABB AABB::intersection(const AABB &p_aabb) const { Vector3 src_min = position; Vector3 src_max = position + size; @@ -78,7 +78,7 @@ Rect3 Rect3::intersection(const Rect3 &p_aabb) const { Vector3 min, max; if (src_min.x > dst_max.x || src_max.x < dst_min.x) - return Rect3(); + return AABB(); else { min.x = (src_min.x > dst_min.x) ? src_min.x : dst_min.x; @@ -86,7 +86,7 @@ Rect3 Rect3::intersection(const Rect3 &p_aabb) const { } if (src_min.y > dst_max.y || src_max.y < dst_min.y) - return Rect3(); + return AABB(); else { min.y = (src_min.y > dst_min.y) ? src_min.y : dst_min.y; @@ -94,17 +94,17 @@ Rect3 Rect3::intersection(const Rect3 &p_aabb) const { } if (src_min.z > dst_max.z || src_max.z < dst_min.z) - return Rect3(); + return AABB(); else { min.z = (src_min.z > dst_min.z) ? src_min.z : dst_min.z; max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z; } - return Rect3(min, max - min); + return AABB(min, max - min); } -bool Rect3::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip, Vector3 *r_normal) const { +bool AABB::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip, Vector3 *r_normal) const { Vector3 c1, c2; Vector3 end = position + size; @@ -147,7 +147,7 @@ bool Rect3::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 return true; } -bool Rect3::intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip, Vector3 *r_normal) const { +bool AABB::intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip, Vector3 *r_normal) const { real_t min = 0, max = 1; int axis = 0; @@ -205,7 +205,7 @@ bool Rect3::intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vecto return true; } -bool Rect3::intersects_plane(const Plane &p_plane) const { +bool AABB::intersects_plane(const Plane &p_plane) const { Vector3 points[8] = { Vector3(position.x, position.y, position.z), @@ -232,7 +232,7 @@ bool Rect3::intersects_plane(const Plane &p_plane) const { return under && over; } -Vector3 Rect3::get_longest_axis() const { +Vector3 AABB::get_longest_axis() const { Vector3 axis(1, 0, 0); real_t max_size = size.x; @@ -249,7 +249,7 @@ Vector3 Rect3::get_longest_axis() const { return axis; } -int Rect3::get_longest_axis_index() const { +int AABB::get_longest_axis_index() const { int axis = 0; real_t max_size = size.x; @@ -267,7 +267,7 @@ int Rect3::get_longest_axis_index() const { return axis; } -Vector3 Rect3::get_shortest_axis() const { +Vector3 AABB::get_shortest_axis() const { Vector3 axis(1, 0, 0); real_t max_size = size.x; @@ -284,7 +284,7 @@ Vector3 Rect3::get_shortest_axis() const { return axis; } -int Rect3::get_shortest_axis_index() const { +int AABB::get_shortest_axis_index() const { int axis = 0; real_t max_size = size.x; @@ -302,25 +302,25 @@ int Rect3::get_shortest_axis_index() const { return axis; } -Rect3 Rect3::merge(const Rect3 &p_with) const { +AABB AABB::merge(const AABB &p_with) const { - Rect3 aabb = *this; + AABB aabb = *this; aabb.merge_with(p_with); return aabb; } -Rect3 Rect3::expand(const Vector3 &p_vector) const { - Rect3 aabb = *this; +AABB AABB::expand(const Vector3 &p_vector) const { + AABB aabb = *this; aabb.expand_to(p_vector); return aabb; } -Rect3 Rect3::grow(real_t p_by) const { +AABB AABB::grow(real_t p_by) const { - Rect3 aabb = *this; + AABB aabb = *this; aabb.grow_by(p_by); return aabb; } -void Rect3::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const { +void AABB::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const { ERR_FAIL_INDEX(p_edge, 12); switch (p_edge) { @@ -394,7 +394,7 @@ void Rect3::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const { } } -Rect3::operator String() const { +AABB::operator String() const { return String() + position + " - " + size; } diff --git a/core/math/rect3.h b/core/math/aabb.h index c3a2f5fbfb..c60213496a 100644 --- a/core/math/rect3.h +++ b/core/math/aabb.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* rect3.h */ +/* aabb.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -39,7 +39,7 @@ * This is implemented by a point (position) and the box size */ -class Rect3 { +class AABB { public: Vector3 position; Vector3 size; @@ -60,16 +60,16 @@ public: const Vector3 &get_size() const { return size; } void set_size(const Vector3 &p_size) { size = p_size; } - bool operator==(const Rect3 &p_rval) const; - bool operator!=(const Rect3 &p_rval) const; + bool operator==(const AABB &p_rval) const; + bool operator!=(const AABB &p_rval) const; - _FORCE_INLINE_ bool intersects(const Rect3 &p_aabb) const; /// Both AABBs overlap - _FORCE_INLINE_ bool intersects_inclusive(const Rect3 &p_aabb) const; /// Both AABBs (or their faces) overlap - _FORCE_INLINE_ bool encloses(const Rect3 &p_aabb) const; /// p_aabb is completely inside this + _FORCE_INLINE_ bool intersects(const AABB &p_aabb) const; /// Both AABBs overlap + _FORCE_INLINE_ bool intersects_inclusive(const AABB &p_aabb) const; /// Both AABBs (or their faces) overlap + _FORCE_INLINE_ bool encloses(const AABB &p_aabb) const; /// p_aabb is completely inside this - Rect3 merge(const Rect3 &p_with) const; - void merge_with(const Rect3 &p_aabb); ///merge with another AABB - Rect3 intersection(const Rect3 &p_aabb) const; ///get box where two intersect, empty if no intersection occurs + AABB merge(const AABB &p_with) const; + void merge_with(const AABB &p_aabb); ///merge with another AABB + AABB intersection(const AABB &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 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const; @@ -88,26 +88,26 @@ public: int get_shortest_axis_index() const; _FORCE_INLINE_ real_t get_shortest_axis_size() const; - Rect3 grow(real_t p_by) const; + AABB grow(real_t p_by) const; _FORCE_INLINE_ void grow_by(real_t p_amount); void get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const; _FORCE_INLINE_ Vector3 get_endpoint(int p_point) const; - Rect3 expand(const Vector3 &p_vector) const; + AABB expand(const Vector3 &p_vector) const; _FORCE_INLINE_ void project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &r_max) const; _FORCE_INLINE_ void expand_to(const Vector3 &p_vector); /** expand to contain a point if necessary */ operator String() const; - _FORCE_INLINE_ Rect3() {} - inline Rect3(const Vector3 &p_pos, const Vector3 &p_size) + _FORCE_INLINE_ AABB() {} + inline AABB(const Vector3 &p_pos, const Vector3 &p_size) : position(p_pos), size(p_size) { } }; -inline bool Rect3::intersects(const Rect3 &p_aabb) const { +inline bool AABB::intersects(const AABB &p_aabb) const { if (position.x >= (p_aabb.position.x + p_aabb.size.x)) return false; @@ -125,7 +125,7 @@ inline bool Rect3::intersects(const Rect3 &p_aabb) const { return true; } -inline bool Rect3::intersects_inclusive(const Rect3 &p_aabb) const { +inline bool AABB::intersects_inclusive(const AABB &p_aabb) const { if (position.x > (p_aabb.position.x + p_aabb.size.x)) return false; @@ -143,7 +143,7 @@ inline bool Rect3::intersects_inclusive(const Rect3 &p_aabb) const { return true; } -inline bool Rect3::encloses(const Rect3 &p_aabb) const { +inline bool AABB::encloses(const AABB &p_aabb) const { Vector3 src_min = position; Vector3 src_max = position + size; @@ -159,7 +159,7 @@ inline bool Rect3::encloses(const Rect3 &p_aabb) const { (src_max.z > dst_max.z)); } -Vector3 Rect3::get_support(const Vector3 &p_normal) const { +Vector3 AABB::get_support(const Vector3 &p_normal) const { Vector3 half_extents = size * 0.5; Vector3 ofs = position + half_extents; @@ -171,7 +171,7 @@ Vector3 Rect3::get_support(const Vector3 &p_normal) const { ofs; } -Vector3 Rect3::get_endpoint(int p_point) const { +Vector3 AABB::get_endpoint(int p_point) const { switch (p_point) { case 0: return Vector3(position.x, position.y, position.z); @@ -187,7 +187,7 @@ Vector3 Rect3::get_endpoint(int p_point) const { ERR_FAIL_V(Vector3()); } -bool Rect3::intersects_convex_shape(const Plane *p_planes, int p_plane_count) const { +bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count) const { Vector3 half_extents = size * 0.5; Vector3 ofs = position + half_extents; @@ -206,7 +206,7 @@ bool Rect3::intersects_convex_shape(const Plane *p_planes, int p_plane_count) co return true; } -bool Rect3::has_point(const Vector3 &p_point) const { +bool AABB::has_point(const Vector3 &p_point) const { if (p_point.x < position.x) return false; @@ -224,7 +224,7 @@ bool Rect3::has_point(const Vector3 &p_point) const { return true; } -inline void Rect3::expand_to(const Vector3 &p_vector) { +inline void AABB::expand_to(const Vector3 &p_vector) { Vector3 begin = position; Vector3 end = position + size; @@ -247,7 +247,7 @@ inline void Rect3::expand_to(const Vector3 &p_vector) { size = end - begin; } -void Rect3::project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &r_max) const { +void AABB::project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &r_max) const { Vector3 half_extents(size.x * 0.5, size.y * 0.5, size.z * 0.5); Vector3 center(position.x + half_extents.x, position.y + half_extents.y, position.z + half_extents.z); @@ -258,7 +258,7 @@ void Rect3::project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t & r_max = distance + length; } -inline real_t Rect3::get_longest_axis_size() const { +inline real_t AABB::get_longest_axis_size() const { real_t max_size = size.x; @@ -273,7 +273,7 @@ inline real_t Rect3::get_longest_axis_size() const { return max_size; } -inline real_t Rect3::get_shortest_axis_size() const { +inline real_t AABB::get_shortest_axis_size() const { real_t max_size = size.x; @@ -288,7 +288,7 @@ inline real_t Rect3::get_shortest_axis_size() const { return max_size; } -bool Rect3::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const { +bool AABB::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const { real_t divx = 1.0 / p_dir.x; real_t divy = 1.0 / p_dir.y; @@ -332,7 +332,7 @@ bool Rect3::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, rea return ((tmin < t1) && (tmax > t0)); } -void Rect3::grow_by(real_t p_amount) { +void AABB::grow_by(real_t p_amount) { position.x -= p_amount; position.y -= p_amount; diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp index be950568cf..bdc040160f 100644 --- a/core/math/bsp_tree.cpp +++ b/core/math/bsp_tree.cpp @@ -31,7 +31,7 @@ #include "error_macros.h" #include "print_string.h" -void BSP_Tree::from_aabb(const Rect3 &p_aabb) { +void BSP_Tree::from_aabb(const AABB &p_aabb) { planes.clear(); @@ -67,7 +67,7 @@ Vector<Plane> BSP_Tree::get_planes() const { return planes; } -Rect3 BSP_Tree::get_aabb() const { +AABB BSP_Tree::get_aabb() const { return aabb; } @@ -577,7 +577,7 @@ BSP_Tree::BSP_Tree(const PoolVector<Face3> &p_faces, real_t p_error_radius) { error_radius = p_error_radius; } -BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const Rect3 &p_aabb, real_t p_error_radius) +BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB &p_aabb, real_t p_error_radius) : nodes(p_nodes), planes(p_planes), aabb(p_aabb), diff --git a/core/math/bsp_tree.h b/core/math/bsp_tree.h index 2e762ba4de..f64a13ce39 100644 --- a/core/math/bsp_tree.h +++ b/core/math/bsp_tree.h @@ -30,11 +30,11 @@ #ifndef BSP_TREE_H #define BSP_TREE_H +#include "aabb.h" #include "dvector.h" #include "face3.h" #include "method_ptrcall.h" #include "plane.h" -#include "rect3.h" #include "variant.h" #include "vector.h" /** @@ -64,7 +64,7 @@ private: Vector<Node> nodes; Vector<Plane> planes; - Rect3 aabb; + AABB aabb; real_t error_radius; int _get_points_inside(int p_node, const Vector3 *p_points, int *p_indices, const Vector3 &p_center, const Vector3 &p_half_extents, int p_indices_count) const; @@ -76,7 +76,7 @@ public: bool is_empty() const { return nodes.size() == 0; } Vector<Node> get_nodes() const; Vector<Plane> get_planes() const; - Rect3 get_aabb() const; + AABB get_aabb() const; bool point_is_inside(const Vector3 &p_point) const; int get_points_inside(const Vector3 *p_points, int p_point_count) const; @@ -85,12 +85,12 @@ public: operator Variant() const; - void from_aabb(const Rect3 &p_aabb); + void from_aabb(const AABB &p_aabb); BSP_Tree(); BSP_Tree(const Variant &p_variant); BSP_Tree(const PoolVector<Face3> &p_faces, real_t p_error_radius = 0); - BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const Rect3 &p_aabb, real_t p_error_radius = 0); + BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB &p_aabb, real_t p_error_radius = 0); ~BSP_Tree(); }; diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 2c587762e8..c5f1d57441 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -596,7 +596,7 @@ void CameraMatrix::make_scale(const Vector3 &p_scale) { matrix[2][2] = p_scale.z; } -void CameraMatrix::scale_translate_to_fit(const Rect3 &p_aabb) { +void CameraMatrix::scale_translate_to_fit(const AABB &p_aabb) { Vector3 min = p_aabb.position; Vector3 max = p_aabb.position + p_aabb.size; diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index 3145d73356..15d6b8128e 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -86,7 +86,7 @@ struct CameraMatrix { operator String() const; - void scale_translate_to_fit(const Rect3 &p_aabb); + void scale_translate_to_fit(const AABB &p_aabb); void make_scale(const Vector3 &p_scale); int get_pixels_per_meter(int p_for_pixel_width) const; operator Transform() const; diff --git a/core/math/face3.cpp b/core/math/face3.cpp index e1b172e491..070ce77db4 100644 --- a/core/math/face3.cpp +++ b/core/math/face3.cpp @@ -189,13 +189,13 @@ ClockDirection Face3::get_clock_dir() const { return (normal.dot(vertex[0]) >= 0) ? CLOCKWISE : COUNTERCLOCKWISE; } -bool Face3::intersects_aabb(const Rect3 &p_aabb) const { +bool Face3::intersects_aabb(const AABB &p_aabb) const { /** TEST PLANE **/ if (!p_aabb.intersects_plane(get_plane())) return false; -/** TEST FACE AXIS */ + /** TEST FACE AXIS */ #define TEST_AXIS(m_ax) \ { \ diff --git a/core/math/face3.h b/core/math/face3.h index 8e4a25fb7a..561fa31238 100644 --- a/core/math/face3.h +++ b/core/math/face3.h @@ -30,8 +30,8 @@ #ifndef FACE3_H #define FACE3_H +#include "aabb.h" #include "plane.h" -#include "rect3.h" #include "transform.h" #include "vector3.h" @@ -76,16 +76,16 @@ public: void get_support(const Vector3 &p_normal, const Transform &p_transform, Vector3 *p_vertices, int *p_count, int p_max) const; void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const; - Rect3 get_aabb() const { + AABB get_aabb() const { - Rect3 aabb(vertex[0], Vector3()); + AABB aabb(vertex[0], Vector3()); aabb.expand_to(vertex[1]); aabb.expand_to(vertex[2]); return aabb; } - bool intersects_aabb(const Rect3 &p_aabb) const; - _FORCE_INLINE_ bool intersects_aabb2(const Rect3 &p_aabb) const; + bool intersects_aabb(const AABB &p_aabb) const; + _FORCE_INLINE_ bool intersects_aabb2(const AABB &p_aabb) const; operator String() const; inline Face3() {} @@ -96,7 +96,7 @@ public: } }; -bool Face3::intersects_aabb2(const Rect3 &p_aabb) const { +bool Face3::intersects_aabb2(const AABB &p_aabb) const { Vector3 perp = (vertex[0] - vertex[2]).cross(vertex[0] - vertex[1]); @@ -256,6 +256,6 @@ bool Face3::intersects_aabb2(const Rect3 &p_aabb) const { return true; } -//this sucks... + //this sucks... #endif // FACE3_H diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index 7c8fb6f17d..39bd34f03c 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -300,7 +300,7 @@ enum _CellFlags { static inline void _plot_face(uint8_t ***p_cell_status, int x, int y, int z, int len_x, int len_y, int len_z, const Vector3 &voxelsize, const Face3 &p_face) { - Rect3 aabb(Vector3(x, y, z), Vector3(len_x, len_y, len_z)); + AABB aabb(Vector3(x, y, z), Vector3(len_x, len_y, len_z)); aabb.position = aabb.position * voxelsize; aabb.size = aabb.size * voxelsize; @@ -575,7 +575,7 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e PoolVector<Face3>::Read facesr = p_array.read(); const Face3 *faces = facesr.ptr(); - Rect3 global_aabb; + AABB global_aabb; for (int i = 0; i < face_count; i++) { diff --git a/core/math/octree.h b/core/math/octree.h index 95a67943fd..6acd4c5f75 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -30,10 +30,10 @@ #ifndef OCTREE_H #define OCTREE_H +#include "aabb.h" #include "list.h" #include "map.h" #include "print_string.h" -#include "rect3.h" #include "variant.h" #include "vector3.h" @@ -106,7 +106,7 @@ private: struct Octant { // cached for FAST plane check - Rect3 aabb; + AABB aabb; uint64_t last_pass; Octant *parent; @@ -152,8 +152,8 @@ private: OctreeElementID _id; Octant *common_parent; - Rect3 aabb; - Rect3 container_aabb; + AABB aabb; + AABB container_aabb; List<PairData *, AL> pair_list; @@ -334,7 +334,7 @@ private: } void _insert_element(Element *p_element, Octant *p_octant); - void _ensure_valid_root(const Rect3 &p_aabb); + void _ensure_valid_root(const AABB &p_aabb); bool _remove_element_from_octant(Element *p_element, Octant *p_octant, Octant *p_limit = NULL); void _remove_element(Element *p_element); void _pair_element(Element *p_element, Octant *p_octant); @@ -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 AABB &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); @@ -370,8 +370,8 @@ private: } public: - OctreeElementID create(T *p_userdata, const Rect3 &p_aabb = Rect3(), int p_subindex = 0, bool p_pairable = false, uint32_t p_pairable_type = 0, uint32_t pairable_mask = 1); - void move(OctreeElementID p_id, const Rect3 &p_aabb); + OctreeElementID create(T *p_userdata, const AABB &p_aabb = AABB(), int p_subindex = 0, bool p_pairable = false, uint32_t p_pairable_type = 0, uint32_t pairable_mask = 1); + void move(OctreeElementID p_id, const AABB &p_aabb); void set_pairable(OctreeElementID p_id, bool p_pairable = false, uint32_t p_pairable_type = 0, uint32_t pairable_mask = 1); void erase(OctreeElementID p_id); @@ -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 AABB &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); @@ -479,7 +479,7 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct } else { /* check againt AABB where child should be */ - Rect3 aabb = p_octant->aabb; + AABB aabb = p_octant->aabb; aabb.size *= 0.5; if (i & 1) @@ -535,12 +535,12 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct } template <class T, bool use_pairs, class AL> -void Octree<T, use_pairs, AL>::_ensure_valid_root(const Rect3 &p_aabb) { +void Octree<T, use_pairs, AL>::_ensure_valid_root(const AABB &p_aabb) { if (!root) { // octre is empty - Rect3 base(Vector3(), Vector3(1.0, 1.0, 1.0) * unit_size); + AABB base(Vector3(), Vector3(1.0, 1.0, 1.0) * unit_size); while (!base.encloses(p_aabb)) { @@ -563,7 +563,7 @@ void Octree<T, use_pairs, AL>::_ensure_valid_root(const Rect3 &p_aabb) { } else { - Rect3 base = root->aabb; + AABB base = root->aabb; while (!base.encloses(p_aabb)) { @@ -793,7 +793,7 @@ void Octree<T, use_pairs, AL>::_remove_element(Element *p_element) { } template <class T, bool use_pairs, class AL> -OctreeElementID Octree<T, use_pairs, AL>::create(T *p_userdata, const Rect3 &p_aabb, int p_subindex, bool p_pairable, uint32_t p_pairable_type, uint32_t p_pairable_mask) { +OctreeElementID Octree<T, use_pairs, AL>::create(T *p_userdata, const AABB &p_aabb, int p_subindex, bool p_pairable, uint32_t p_pairable_type, uint32_t p_pairable_mask) { // check for AABB validity #ifdef DEBUG_ENABLED @@ -833,7 +833,7 @@ OctreeElementID Octree<T, use_pairs, AL>::create(T *p_userdata, const Rect3 &p_a } template <class T, bool use_pairs, class AL> -void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const Rect3 &p_aabb) { +void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) { #ifdef DEBUG_ENABLED // check for AABB validity @@ -859,7 +859,7 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const Rect3 &p_aabb) { if (old_has_surf) { _remove_element(&e); // removing e.common_parent = NULL; - e.aabb = Rect3(); + e.aabb = AABB(); _optimize(); } else { _ensure_valid_root(p_aabb); // inserting @@ -886,7 +886,7 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const Rect3 &p_aabb) { return; } - Rect3 combined = e.aabb; + AABB combined = e.aabb; combined.merge_with(p_aabb); _ensure_valid_root(combined); @@ -1072,7 +1072,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 AABB &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 @@ -1313,7 +1313,7 @@ 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 AABB &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array, uint32_t p_mask) { if (!root) return 0; diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index e0137b6921..946d9f6b79 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -38,7 +38,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me /* CREATE AABB VOLUME */ - Rect3 aabb; + AABB aabb; for (int i = 0; i < p_points.size(); i++) { if (i == 0) { diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h index 47ed22615b..f014d0decc 100644 --- a/core/math/quick_hull.h +++ b/core/math/quick_hull.h @@ -30,9 +30,9 @@ #ifndef QUICK_HULL_H #define QUICK_HULL_H +#include "aabb.h" #include "geometry.h" #include "list.h" -#include "rect3.h" #include "set.h" class QuickHull { diff --git a/core/math/transform.h b/core/math/transform.h index 566bf482a9..4d91869121 100644 --- a/core/math/transform.h +++ b/core/math/transform.h @@ -30,9 +30,9 @@ #ifndef TRANSFORM_H #define TRANSFORM_H +#include "aabb.h" #include "matrix3.h" #include "plane.h" -#include "rect3.h" /** @author Juan Linietsky <reduzio@gmail.com> */ @@ -80,8 +80,8 @@ public: _FORCE_INLINE_ Plane xform(const Plane &p_plane) const; _FORCE_INLINE_ Plane xform_inv(const Plane &p_plane) const; - _FORCE_INLINE_ Rect3 xform(const Rect3 &p_aabb) const; - _FORCE_INLINE_ Rect3 xform_inv(const Rect3 &p_aabb) const; + _FORCE_INLINE_ AABB xform(const AABB &p_aabb) const; + _FORCE_INLINE_ AABB xform_inv(const AABB &p_aabb) const; void operator*=(const Transform &p_transform); Transform operator*(const Transform &p_transform) const; @@ -153,14 +153,14 @@ _FORCE_INLINE_ Plane Transform::xform_inv(const Plane &p_plane) const { return Plane(normal, d); } -_FORCE_INLINE_ Rect3 Transform::xform(const Rect3 &p_aabb) const { +_FORCE_INLINE_ AABB Transform::xform(const AABB &p_aabb) const { /* define vertices */ Vector3 x = basis.get_axis(0) * p_aabb.size.x; Vector3 y = basis.get_axis(1) * p_aabb.size.y; Vector3 z = basis.get_axis(2) * p_aabb.size.z; Vector3 pos = xform(p_aabb.position); //could be even further optimized - Rect3 new_aabb; + AABB new_aabb; new_aabb.position = pos; new_aabb.expand_to(pos + x); new_aabb.expand_to(pos + y); @@ -172,7 +172,7 @@ _FORCE_INLINE_ Rect3 Transform::xform(const Rect3 &p_aabb) const { return new_aabb; } -_FORCE_INLINE_ Rect3 Transform::xform_inv(const Rect3 &p_aabb) const { +_FORCE_INLINE_ AABB Transform::xform_inv(const AABB &p_aabb) const { /* define vertices */ Vector3 vertices[8] = { @@ -186,7 +186,7 @@ _FORCE_INLINE_ Rect3 Transform::xform_inv(const Rect3 &p_aabb) const { Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z) }; - Rect3 ret; + AABB ret; ret.position = xform_inv(vertices[0]); diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index 3b246cb183..5f57c7c26a 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -44,7 +44,7 @@ int TriangleMesh::_create_bvh(BVH *p_bvh, BVH **p_bb, int p_from, int p_size, in return -1; } - Rect3 aabb; + AABB aabb; aabb = p_bb[p_from]->aabb; for (int i = 1; i < p_size; i++) { @@ -166,7 +166,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) { valid = true; } -Vector3 TriangleMesh::get_area_normal(const Rect3 &p_aabb) const { +Vector3 TriangleMesh::get_area_normal(const AABB &p_aabb) const { uint32_t *stack = (uint32_t *)alloca(sizeof(int) * max_depth); diff --git a/core/math/triangle_mesh.h b/core/math/triangle_mesh.h index 2bf67fffcb..4bd9fecf37 100644 --- a/core/math/triangle_mesh.h +++ b/core/math/triangle_mesh.h @@ -47,7 +47,7 @@ class TriangleMesh : public Reference { struct BVH { - Rect3 aabb; + AABB aabb; Vector3 center; //used for sorting int left; int right; @@ -88,7 +88,7 @@ public: bool is_valid() const; bool intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal) const; bool intersect_ray(const Vector3 &p_begin, const Vector3 &p_dir, Vector3 &r_point, Vector3 &r_normal) const; - Vector3 get_area_normal(const Rect3 &p_aabb) const; + Vector3 get_area_normal(const AABB &p_aabb) const; PoolVector<Face3> get_faces() const; void create(const PoolVector<Vector3> &p_faces); diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h index 2875eb912f..d819dfbc27 100644 --- a/core/method_ptrcall.h +++ b/core/method_ptrcall.h @@ -119,7 +119,7 @@ MAKE_PTRARG_BY_REFERENCE(Vector3); MAKE_PTRARG(Transform2D); MAKE_PTRARG_BY_REFERENCE(Plane); MAKE_PTRARG(Quat); -MAKE_PTRARG_BY_REFERENCE(Rect3); +MAKE_PTRARG_BY_REFERENCE(AABB); MAKE_PTRARG_BY_REFERENCE(Basis); MAKE_PTRARG_BY_REFERENCE(Transform); MAKE_PTRARG_BY_REFERENCE(Color); diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index ad8438e416..3748df12f7 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -234,7 +234,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd case Variant::TRANSFORM2D: case Variant::PLANE: case Variant::QUAT: - case Variant::RECT3: + case Variant::AABB: case Variant::BASIS: case Variant::TRANSFORM: case Variant::POOL_BYTE_ARRAY: diff --git a/core/print_string.cpp b/core/print_string.cpp index 92a04cbf0b..520fb3daec 100644 --- a/core/print_string.cpp +++ b/core/print_string.cpp @@ -82,7 +82,25 @@ void print_line(String p_string) { PrintHandlerList *l = print_handler_list; while (l) { - l->printfunc(l->userdata, p_string); + l->printfunc(l->userdata, p_string, false); + l = l->next; + } + + _global_unlock(); +} + +void print_error(String p_string) { + + if (!_print_error_enabled) + return; + + OS::get_singleton()->printerr("%s\n", p_string.utf8().get_data()); + + _global_lock(); + PrintHandlerList *l = print_handler_list; + while (l) { + + l->printfunc(l->userdata, p_string, true); l = l->next; } diff --git a/core/print_string.h b/core/print_string.h index 9f8420c31a..6b68380b9d 100644 --- a/core/print_string.h +++ b/core/print_string.h @@ -34,7 +34,7 @@ extern void (*_print_func)(String); -typedef void (*PrintHandlerFunc)(void *, const String &p_string); +typedef void (*PrintHandlerFunc)(void *, const String &p_string, bool p_error); struct PrintHandlerList { @@ -56,5 +56,6 @@ void remove_print_handler(PrintHandlerList *p_handler); extern bool _print_line_enabled; extern bool _print_error_enabled; extern void print_line(String p_string); +extern void print_error(String p_string); #endif diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 2e4fc26784..65a6f2b83c 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -776,32 +776,6 @@ Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) { return ret; } -void ProjectSettings::add_singleton(const Singleton &p_singleton) { - - singletons.push_back(p_singleton); - singleton_ptrs[p_singleton.name] = p_singleton.ptr; -} - -Object *ProjectSettings::get_singleton_object(const String &p_name) const { - - const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name); - if (!E) - return NULL; - else - return E->get(); -}; - -bool ProjectSettings::has_singleton(const String &p_name) const { - - return get_singleton_object(p_name) != NULL; -}; - -void ProjectSettings::get_singletons(List<Singleton> *p_singletons) { - - for (List<Singleton>::Element *E = singletons.front(); E; E = E->next()) - p_singletons->push_back(E->get()); -} - Vector<String> ProjectSettings::get_optimizer_presets() const { List<PropertyInfo> pi; @@ -893,8 +867,6 @@ void ProjectSettings::_bind_methods() { ClassDB::bind_method(D_METHOD("localize_path", "path"), &ProjectSettings::localize_path); ClassDB::bind_method(D_METHOD("globalize_path", "path"), &ProjectSettings::globalize_path); ClassDB::bind_method(D_METHOD("save"), &ProjectSettings::save); - ClassDB::bind_method(D_METHOD("has_singleton", "name"), &ProjectSettings::has_singleton); - ClassDB::bind_method(D_METHOD("get_singleton", "name"), &ProjectSettings::get_singleton_object); ClassDB::bind_method(D_METHOD("load_resource_pack", "pack"), &ProjectSettings::_load_resource_pack); ClassDB::bind_method(D_METHOD("property_can_revert", "name"), &ProjectSettings::property_can_revert); ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &ProjectSettings::property_get_revert); diff --git a/core/project_settings.h b/core/project_settings.h index f75cad815f..1c4078cebb 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -45,14 +45,6 @@ class ProjectSettings : public Object { public: typedef Map<String, Variant> CustomMap; - struct Singleton { - StringName name; - Object *ptr; - Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL) - : name(p_name), - ptr(p_ptr) { - } - }; enum { //properties that are not for built in values begin from this value, so builtin ones are displayed first NO_BUILTIN_ORDER_BASE = 1 << 16 @@ -106,9 +98,6 @@ protected: Error _save_settings_text(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String()); Error _save_settings_binary(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String()); - List<Singleton> singletons; - Map<StringName, Object *> singleton_ptrs; - Error _save_custom_bnd(const String &p_file); bool _load_resource_pack(const String &p_pack); @@ -145,17 +134,11 @@ public: Error save(); void set_custom_property_info(const String &p_prop, const PropertyInfo &p_info); - void add_singleton(const Singleton &p_singleton); - void get_singletons(List<Singleton> *p_singletons); - - bool has_singleton(const String &p_name) const; - Vector<String> get_optimizer_presets() const; List<String> get_input_presets() const { return input_presets; } void set_disable_feature_overrides(bool p_disable); - Object *get_singleton_object(const String &p_name) const; void register_global_defaults(); diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index c6d7cd44e8..baaf738b42 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -34,6 +34,7 @@ #include "compressed_translation.h" #include "core/io/xml_parser.h" #include "core_string_names.h" +#include "engine.h" #include "func_ref.h" #include "geometry.h" #include "input_map.h" @@ -203,19 +204,19 @@ void register_core_singletons() { ClassDB::register_class<InputMap>(); ClassDB::register_class<_JSON>(); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ProjectSettings", ProjectSettings::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("IP", IP::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Geometry", _Geometry::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ResourceLoader", _ResourceLoader::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ResourceSaver", _ResourceSaver::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("OS", _OS::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Engine", _Engine::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ClassDB", _classdb)); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Marshalls", _Marshalls::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("TranslationServer", TranslationServer::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Input", Input::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("InputMap", InputMap::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JSON", _JSON::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("ProjectSettings", ProjectSettings::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("IP", IP::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("Geometry", _Geometry::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceLoader", _ResourceLoader::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceSaver", _ResourceSaver::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("OS", _OS::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("Engine", _Engine::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("ClassDB", _classdb)); + Engine::get_singleton()->add_singleton(Engine::Singleton("Marshalls", _Marshalls::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("TranslationServer", TranslationServer::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("Input", Input::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("InputMap", InputMap::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("JSON", _JSON::get_singleton())); } void unregister_core_types() { diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 2feb068ecb..5655a4d5e4 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "script_debugger_remote.h" +#include "engine.h" #include "io/ip.h" #include "io/marshalls.h" #include "os/input.h" @@ -831,7 +832,7 @@ void ScriptDebuggerRemote::send_message(const String &p_message, const Array &p_ mutex->unlock(); } -void ScriptDebuggerRemote::_print_handler(void *p_this, const String &p_string) { +void ScriptDebuggerRemote::_print_handler(void *p_this, const String &p_string, bool p_error) { ScriptDebuggerRemote *sdr = (ScriptDebuggerRemote *)p_this; @@ -939,7 +940,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() tcp_client(StreamPeerTCP::create_ref()), packet_peer_stream(Ref<PacketPeerStream>(memnew(PacketPeerStream))), last_perf_time(0), - performance(ProjectSettings::get_singleton()->get_singleton_object("Performance")), + performance(Engine::get_singleton()->get_singleton_object("Performance")), requested_quit(false), mutex(Mutex::create()), max_cps(GLOBAL_GET("network/limits/debugger_stdout/max_chars_per_second")), diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h index 22137d1350..90d2daf1f8 100644 --- a/core/script_debugger_remote.h +++ b/core/script_debugger_remote.h @@ -94,7 +94,7 @@ class ScriptDebuggerRemote : public ScriptDebugger { uint64_t msec_count; bool locking; //hack to avoid a deadloop - static void _print_handler(void *p_this, const String &p_string); + static void _print_handler(void *p_this, const String &p_string, bool p_error); PrintHandlerList phl; diff --git a/core/type_info.h b/core/type_info.h index 9fb80af0eb..24d96c51e8 100644 --- a/core/type_info.h +++ b/core/type_info.h @@ -82,7 +82,7 @@ MAKE_TYPE_INFO(Vector3, Variant::VECTOR3) MAKE_TYPE_INFO(Transform2D, Variant::TRANSFORM2D) MAKE_TYPE_INFO(Plane, Variant::PLANE) MAKE_TYPE_INFO(Quat, Variant::QUAT) -MAKE_TYPE_INFO(Rect3, Variant::RECT3) +MAKE_TYPE_INFO(AABB, Variant::AABB) MAKE_TYPE_INFO(Basis, Variant::BASIS) MAKE_TYPE_INFO(Transform, Variant::TRANSFORM) MAKE_TYPE_INFO(Color, Variant::COLOR) diff --git a/core/ustring.cpp b/core/ustring.cpp index 415494ddc8..7c3a784c5b 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -564,7 +564,7 @@ void String::erase(int p_pos, int p_chars) { String String::capitalize() const { - String aux = this->replace("_", " ").to_lower(); + String aux = this->camelcase_to_underscore(true).replace("_", " ").strip_edges(); String cap; for (int i = 0; i < aux.get_slice_count(" "); i++) { diff --git a/core/variant.cpp b/core/variant.cpp index f70e4a5218..1dca494492 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -66,7 +66,7 @@ String Variant::get_type_name(Variant::Type p_type) { return "String"; } break; - // math types + // math types case VECTOR2: { @@ -94,9 +94,9 @@ String Variant::get_type_name(Variant::Type p_type) { } break;*/ - case RECT3: { + case AABB: { - return "Rect3"; + return "AABB"; } break; case QUAT: { @@ -722,7 +722,7 @@ bool Variant::is_zero() const { } break; - // math types + // math types case VECTOR2: { @@ -754,9 +754,9 @@ bool Variant::is_zero() const { } break;*/ - case RECT3: { + case AABB: { - return *_data._rect3 == Rect3(); + return *_data._aabb == ::AABB(); } break; case QUAT: { @@ -931,7 +931,7 @@ void Variant::reference(const Variant &p_variant) { memnew_placement(_data._mem, String(*reinterpret_cast<const String *>(p_variant._data._mem))); } break; - // math types + // math types case VECTOR2: { @@ -954,9 +954,9 @@ void Variant::reference(const Variant &p_variant) { memnew_placement(_data._mem, Plane(*reinterpret_cast<const Plane *>(p_variant._data._mem))); } break; - case RECT3: { + case AABB: { - _data._rect3 = memnew(Rect3(*p_variant._data._rect3)); + _data._aabb = memnew(::AABB(*p_variant._data._aabb)); } break; case QUAT: { @@ -1079,9 +1079,9 @@ void Variant::clear() { memdelete(_data._transform2d); } break; - case RECT3: { + case AABB: { - memdelete(_data._rect3); + memdelete(_data._aabb); } break; case BASIS: { @@ -1426,7 +1426,7 @@ Variant::operator String() const { case PLANE: return operator Plane(); //case QUAT: - case RECT3: return operator Rect3(); + case AABB: return operator ::AABB(); case QUAT: return "(" + operator Quat() + ")"; case BASIS: { @@ -1617,12 +1617,12 @@ Variant::operator Plane() const { else return Plane(); } -Variant::operator Rect3() const { +Variant::operator ::AABB() const { - if (type == RECT3) - return *_data._rect3; + if (type == AABB) + return *_data._aabb; else - return Rect3(); + return ::AABB(); } Variant::operator Basis() const { @@ -2188,10 +2188,10 @@ Variant::Variant(const Plane &p_plane) { type = PLANE; memnew_placement(_data._mem, Plane(p_plane)); } -Variant::Variant(const Rect3 &p_aabb) { +Variant::Variant(const ::AABB &p_aabb) { - type = RECT3; - _data._rect3 = memnew(Rect3(p_aabb)); + type = AABB; + _data._aabb = memnew(::AABB(p_aabb)); } Variant::Variant(const Basis &p_matrix) { @@ -2501,7 +2501,7 @@ void Variant::operator=(const Variant &p_variant) { *reinterpret_cast<String *>(_data._mem) = *reinterpret_cast<const String *>(p_variant._data._mem); } break; - // math types + // math types case VECTOR2: { @@ -2524,9 +2524,9 @@ void Variant::operator=(const Variant &p_variant) { *reinterpret_cast<Plane *>(_data._mem) = *reinterpret_cast<const Plane *>(p_variant._data._mem); } break; - case RECT3: { + case AABB: { - *_data._rect3 = *(p_variant._data._rect3); + *_data._aabb = *(p_variant._data._aabb); } break; case QUAT: { @@ -2641,7 +2641,7 @@ uint32_t Variant::hash() const { return reinterpret_cast<const String *>(_data._mem)->hash(); } break; - // math types + // math types case VECTOR2: { @@ -2686,13 +2686,13 @@ uint32_t Variant::hash() const { } break;*/ - case RECT3: { + case AABB: { uint32_t hash = 5831; for (int i = 0; i < 3; i++) { - hash = hash_djb2_one_float(_data._rect3->position[i], hash); - hash = hash_djb2_one_float(_data._rect3->size[i], hash); + hash = hash_djb2_one_float(_data._aabb->position[i], hash); + hash = hash_djb2_one_float(_data._aabb->size[i], hash); } return hash; @@ -2952,9 +2952,9 @@ bool Variant::hash_compare(const Variant &p_variant) const { (hash_compare_scalar(l->d, r->d)); } break; - case RECT3: { - const Rect3 *l = _data._rect3; - const Rect3 *r = p_variant._data._rect3; + case AABB: { + const ::AABB *l = _data._aabb; + const ::AABB *r = p_variant._data._aabb; return (hash_compare_vector3(l->position, r->position) && (hash_compare_vector3(l->size, r->size))); diff --git a/core/variant.h b/core/variant.h index 45066af401..8ba4d576cf 100644 --- a/core/variant.h +++ b/core/variant.h @@ -34,6 +34,7 @@ @author Juan Linietsky <reduzio@gmail.com> */ +#include "aabb.h" #include "array.h" #include "color.h" #include "dictionary.h" @@ -45,7 +46,6 @@ #include "node_path.h" #include "plane.h" #include "quat.h" -#include "rect3.h" #include "ref_ptr.h" #include "rid.h" #include "transform.h" @@ -89,7 +89,7 @@ public: TRANSFORM2D, PLANE, QUAT, // 10 - RECT3, + AABB, BASIS, TRANSFORM, @@ -136,7 +136,7 @@ private: int64_t _int; double _real; Transform2D *_transform2d; - Rect3 *_rect3; + ::AABB *_aabb; Basis *_basis; Transform *_transform; RefPtr *_resource; @@ -184,7 +184,7 @@ public: operator Rect2() const; operator Vector3() const; operator Plane() const; - operator Rect3() const; + operator ::AABB() const; operator Quat() const; operator Basis() const; operator Transform() const; @@ -253,7 +253,7 @@ public: Variant(const Rect2 &p_rect2); Variant(const Vector3 &p_vector3); Variant(const Plane &p_plane); - Variant(const Rect3 &p_aabb); + Variant(const ::AABB &p_aabb); Variant(const Quat &p_quat); Variant(const Basis &p_transform); Variant(const Transform2D &p_transform); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 05f0478003..9e6aaeb911 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -655,26 +655,26 @@ struct _VariantCall { #define VCALL_PTR5R(m_type, m_method) \ static void _call_##m_type##_##m_method(Variant &r_ret, Variant &p_self, const Variant **p_args) { r_ret = reinterpret_cast<m_type *>(p_self._data._ptr)->m_method(*p_args[0], *p_args[1], *p_args[2], *p_args[3], *p_args[4]); } - VCALL_PTR0R(Rect3, get_area); - VCALL_PTR0R(Rect3, has_no_area); - VCALL_PTR0R(Rect3, has_no_surface); - VCALL_PTR1R(Rect3, intersects); - VCALL_PTR1R(Rect3, encloses); - VCALL_PTR1R(Rect3, merge); - VCALL_PTR1R(Rect3, intersection); - VCALL_PTR1R(Rect3, intersects_plane); - VCALL_PTR2R(Rect3, intersects_segment); - VCALL_PTR1R(Rect3, has_point); - VCALL_PTR1R(Rect3, get_support); - VCALL_PTR0R(Rect3, get_longest_axis); - VCALL_PTR0R(Rect3, get_longest_axis_index); - VCALL_PTR0R(Rect3, get_longest_axis_size); - VCALL_PTR0R(Rect3, get_shortest_axis); - VCALL_PTR0R(Rect3, get_shortest_axis_index); - VCALL_PTR0R(Rect3, get_shortest_axis_size); - VCALL_PTR1R(Rect3, expand); - VCALL_PTR1R(Rect3, grow); - VCALL_PTR1R(Rect3, get_endpoint); + VCALL_PTR0R(AABB, get_area); + VCALL_PTR0R(AABB, has_no_area); + VCALL_PTR0R(AABB, has_no_surface); + VCALL_PTR1R(AABB, intersects); + VCALL_PTR1R(AABB, encloses); + VCALL_PTR1R(AABB, merge); + VCALL_PTR1R(AABB, intersection); + VCALL_PTR1R(AABB, intersects_plane); + VCALL_PTR2R(AABB, intersects_segment); + VCALL_PTR1R(AABB, has_point); + VCALL_PTR1R(AABB, get_support); + VCALL_PTR0R(AABB, get_longest_axis); + VCALL_PTR0R(AABB, get_longest_axis_index); + VCALL_PTR0R(AABB, get_longest_axis_size); + VCALL_PTR0R(AABB, get_shortest_axis); + VCALL_PTR0R(AABB, get_shortest_axis_index); + VCALL_PTR0R(AABB, get_shortest_axis_size); + VCALL_PTR1R(AABB, expand); + VCALL_PTR1R(AABB, grow); + VCALL_PTR1R(AABB, get_endpoint); VCALL_PTR0R(Transform2D, inverse); VCALL_PTR0R(Transform2D, affine_inverse); @@ -755,7 +755,7 @@ struct _VariantCall { case Variant::VECTOR3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Vector3()); return; case Variant::PLANE: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Plane()); return; - case Variant::RECT3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator Rect3()); return; + case Variant::AABB: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform(p_args[0]->operator ::AABB()); return; default: r_ret = Variant(); } } @@ -766,7 +766,7 @@ struct _VariantCall { case Variant::VECTOR3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Vector3()); return; case Variant::PLANE: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Plane()); return; - case Variant::RECT3: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator Rect3()); return; + case Variant::AABB: r_ret = reinterpret_cast<Transform *>(p_self._data._ptr)->xform_inv(p_args[0]->operator ::AABB()); return; default: r_ret = Variant(); } } @@ -878,9 +878,9 @@ struct _VariantCall { r_ret = Color::hex(*p_args[0]); } - static void Rect3_init1(Variant &r_ret, const Variant **p_args) { + static void AABB_init1(Variant &r_ret, const Variant **p_args) { - r_ret = Rect3(*p_args[0], *p_args[1]); + r_ret = ::AABB(*p_args[0], *p_args[1]); } static void Basis_init1(Variant &r_ret, const Variant **p_args) { @@ -1058,8 +1058,8 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i case TRANSFORM2D: return Transform2D(); case PLANE: return Plane(); case QUAT: return Quat(); - case RECT3: - return Rect3(); // 10 + case AABB: + return ::AABB(); // 10 case BASIS: return Basis(); case TRANSFORM: return Transform(); @@ -1138,8 +1138,8 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i case VECTOR3: return (Vector3(*p_args[0])); case PLANE: return (Plane(*p_args[0])); case QUAT: return (Quat(*p_args[0])); - case RECT3: - return (Rect3(*p_args[0])); // 10 + case AABB: + return (::AABB(*p_args[0])); // 10 case BASIS: return (Basis(p_args[0]->operator Basis())); case TRANSFORM: return (Transform(p_args[0]->operator Transform())); @@ -1707,26 +1707,26 @@ void register_variant_methods() { //pointerbased - ADDFUNC0R(RECT3, REAL, Rect3, get_area, varray()); - ADDFUNC0R(RECT3, BOOL, Rect3, has_no_area, varray()); - ADDFUNC0R(RECT3, BOOL, Rect3, has_no_surface, varray()); - ADDFUNC1R(RECT3, BOOL, Rect3, intersects, RECT3, "with", varray()); - ADDFUNC1R(RECT3, BOOL, Rect3, encloses, RECT3, "with", varray()); - ADDFUNC1R(RECT3, RECT3, Rect3, merge, RECT3, "with", varray()); - ADDFUNC1R(RECT3, RECT3, Rect3, intersection, RECT3, "with", varray()); - ADDFUNC1R(RECT3, BOOL, Rect3, intersects_plane, PLANE, "plane", varray()); - ADDFUNC2R(RECT3, BOOL, Rect3, intersects_segment, VECTOR3, "from", VECTOR3, "to", varray()); - ADDFUNC1R(RECT3, BOOL, Rect3, has_point, VECTOR3, "point", varray()); - ADDFUNC1R(RECT3, VECTOR3, Rect3, get_support, VECTOR3, "dir", varray()); - ADDFUNC0R(RECT3, VECTOR3, Rect3, get_longest_axis, varray()); - ADDFUNC0R(RECT3, INT, Rect3, get_longest_axis_index, varray()); - ADDFUNC0R(RECT3, REAL, Rect3, get_longest_axis_size, varray()); - ADDFUNC0R(RECT3, VECTOR3, Rect3, get_shortest_axis, varray()); - ADDFUNC0R(RECT3, INT, Rect3, get_shortest_axis_index, varray()); - ADDFUNC0R(RECT3, REAL, Rect3, get_shortest_axis_size, varray()); - ADDFUNC1R(RECT3, RECT3, Rect3, expand, VECTOR3, "to_point", varray()); - ADDFUNC1R(RECT3, RECT3, Rect3, grow, REAL, "by", varray()); - ADDFUNC1R(RECT3, VECTOR3, Rect3, get_endpoint, INT, "idx", varray()); + ADDFUNC0R(AABB, REAL, AABB, get_area, varray()); + ADDFUNC0R(AABB, BOOL, AABB, has_no_area, varray()); + ADDFUNC0R(AABB, BOOL, AABB, has_no_surface, varray()); + ADDFUNC1R(AABB, BOOL, AABB, intersects, AABB, "with", varray()); + ADDFUNC1R(AABB, BOOL, AABB, encloses, AABB, "with", varray()); + ADDFUNC1R(AABB, AABB, AABB, merge, AABB, "with", varray()); + ADDFUNC1R(AABB, AABB, AABB, intersection, AABB, "with", varray()); + ADDFUNC1R(AABB, BOOL, AABB, intersects_plane, PLANE, "plane", varray()); + ADDFUNC2R(AABB, BOOL, AABB, intersects_segment, VECTOR3, "from", VECTOR3, "to", varray()); + ADDFUNC1R(AABB, BOOL, AABB, has_point, VECTOR3, "point", varray()); + ADDFUNC1R(AABB, VECTOR3, AABB, get_support, VECTOR3, "dir", varray()); + ADDFUNC0R(AABB, VECTOR3, AABB, get_longest_axis, varray()); + ADDFUNC0R(AABB, INT, AABB, get_longest_axis_index, varray()); + ADDFUNC0R(AABB, REAL, AABB, get_longest_axis_size, varray()); + ADDFUNC0R(AABB, VECTOR3, AABB, get_shortest_axis, varray()); + ADDFUNC0R(AABB, INT, AABB, get_shortest_axis_index, varray()); + ADDFUNC0R(AABB, REAL, AABB, get_shortest_axis_size, varray()); + ADDFUNC1R(AABB, AABB, AABB, expand, VECTOR3, "to_point", varray()); + ADDFUNC1R(AABB, AABB, AABB, grow, REAL, "by", varray()); + ADDFUNC1R(AABB, VECTOR3, AABB, get_endpoint, INT, "idx", varray()); ADDFUNC0R(TRANSFORM2D, TRANSFORM2D, Transform2D, inverse, varray()); ADDFUNC0R(TRANSFORM2D, TRANSFORM2D, Transform2D, affine_inverse, varray()); @@ -1791,7 +1791,7 @@ void register_variant_methods() { _VariantCall::add_constructor(_VariantCall::Color_init1, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL, "a", Variant::REAL); _VariantCall::add_constructor(_VariantCall::Color_init2, Variant::COLOR, "r", Variant::REAL, "g", Variant::REAL, "b", Variant::REAL); - _VariantCall::add_constructor(_VariantCall::Rect3_init1, Variant::RECT3, "position", Variant::VECTOR3, "size", Variant::VECTOR3); + _VariantCall::add_constructor(_VariantCall::AABB_init1, Variant::AABB, "position", Variant::VECTOR3, "size", Variant::VECTOR3); _VariantCall::add_constructor(_VariantCall::Basis_init1, Variant::BASIS, "x_axis", Variant::VECTOR3, "y_axis", Variant::VECTOR3, "z_axis", Variant::VECTOR3); _VariantCall::add_constructor(_VariantCall::Basis_init2, Variant::BASIS, "axis", Variant::VECTOR3, "phi", Variant::REAL); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 6362090902..c793d70ed8 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -48,7 +48,7 @@ CASE_TYPE(PREFIX, OP, TRANSFORM2D) \ CASE_TYPE(PREFIX, OP, PLANE) \ CASE_TYPE(PREFIX, OP, QUAT) \ - CASE_TYPE(PREFIX, OP, RECT3) \ + CASE_TYPE(PREFIX, OP, AABB) \ CASE_TYPE(PREFIX, OP, BASIS) \ CASE_TYPE(PREFIX, OP, TRANSFORM) \ CASE_TYPE(PREFIX, OP, COLOR) \ @@ -81,7 +81,7 @@ TYPE(PREFIX, OP, TRANSFORM2D), \ TYPE(PREFIX, OP, PLANE), \ TYPE(PREFIX, OP, QUAT), \ - TYPE(PREFIX, OP, RECT3), \ + TYPE(PREFIX, OP, AABB), \ TYPE(PREFIX, OP, BASIS), \ TYPE(PREFIX, OP, TRANSFORM), \ TYPE(PREFIX, OP, COLOR), \ @@ -465,7 +465,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, VECTOR3, ==, Vector3); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, PLANE, ==, Plane); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, QUAT, ==, Quat); - DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, RECT3, ==, _rect3); + DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, AABB, ==, _aabb); DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, BASIS, ==, _basis); DEFAULT_OP_PTRREF_NULL(math, OP_EQUAL, TRANSFORM, ==, _transform); DEFAULT_OP_LOCALMEM_NULL(math, OP_EQUAL, COLOR, ==, Color); @@ -555,7 +555,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, VECTOR3, !=, Vector3); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, PLANE, !=, Plane); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, QUAT, !=, Quat); - DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, RECT3, !=, _rect3); + DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, AABB, !=, _aabb); DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, BASIS, !=, _basis); DEFAULT_OP_PTRREF_NULL(math, OP_NOT_EQUAL, TRANSFORM, !=, _transform); DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, COLOR, !=, Color); @@ -629,7 +629,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_LESS, TRANSFORM2D) CASE_TYPE(math, OP_LESS, PLANE) CASE_TYPE(math, OP_LESS, QUAT) - CASE_TYPE(math, OP_LESS, RECT3) + CASE_TYPE(math, OP_LESS, AABB) CASE_TYPE(math, OP_LESS, BASIS) CASE_TYPE(math, OP_LESS, TRANSFORM) CASE_TYPE(math, OP_LESS, COLOR) @@ -658,7 +658,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM2D) CASE_TYPE(math, OP_LESS_EQUAL, PLANE) CASE_TYPE(math, OP_LESS_EQUAL, QUAT) - CASE_TYPE(math, OP_LESS_EQUAL, RECT3) + CASE_TYPE(math, OP_LESS_EQUAL, AABB) CASE_TYPE(math, OP_LESS_EQUAL, BASIS) CASE_TYPE(math, OP_LESS_EQUAL, TRANSFORM) CASE_TYPE(math, OP_LESS_EQUAL, COLOR) @@ -733,7 +733,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_GREATER, TRANSFORM2D) CASE_TYPE(math, OP_GREATER, PLANE) CASE_TYPE(math, OP_GREATER, QUAT) - CASE_TYPE(math, OP_GREATER, RECT3) + CASE_TYPE(math, OP_GREATER, AABB) CASE_TYPE(math, OP_GREATER, BASIS) CASE_TYPE(math, OP_GREATER, TRANSFORM) CASE_TYPE(math, OP_GREATER, COLOR) @@ -762,7 +762,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM2D) CASE_TYPE(math, OP_GREATER_EQUAL, PLANE) CASE_TYPE(math, OP_GREATER_EQUAL, QUAT) - CASE_TYPE(math, OP_GREATER_EQUAL, RECT3) + CASE_TYPE(math, OP_GREATER_EQUAL, AABB) CASE_TYPE(math, OP_GREATER_EQUAL, BASIS) CASE_TYPE(math, OP_GREATER_EQUAL, TRANSFORM) CASE_TYPE(math, OP_GREATER_EQUAL, COLOR) @@ -818,7 +818,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_ADD, RECT2) CASE_TYPE(math, OP_ADD, TRANSFORM2D) CASE_TYPE(math, OP_ADD, PLANE) - CASE_TYPE(math, OP_ADD, RECT3) + CASE_TYPE(math, OP_ADD, AABB) CASE_TYPE(math, OP_ADD, BASIS) CASE_TYPE(math, OP_ADD, TRANSFORM) CASE_TYPE(math, OP_ADD, NODE_PATH) @@ -842,7 +842,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_SUBTRACT, RECT2) CASE_TYPE(math, OP_SUBTRACT, TRANSFORM2D) CASE_TYPE(math, OP_SUBTRACT, PLANE) - CASE_TYPE(math, OP_SUBTRACT, RECT3) + CASE_TYPE(math, OP_SUBTRACT, AABB) CASE_TYPE(math, OP_SUBTRACT, BASIS) CASE_TYPE(math, OP_SUBTRACT, TRANSFORM) CASE_TYPE(math, OP_SUBTRACT, NODE_PATH) @@ -923,7 +923,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_MULTIPLY, STRING) CASE_TYPE(math, OP_MULTIPLY, RECT2) CASE_TYPE(math, OP_MULTIPLY, PLANE) - CASE_TYPE(math, OP_MULTIPLY, RECT3) + CASE_TYPE(math, OP_MULTIPLY, AABB) CASE_TYPE(math, OP_MULTIPLY, NODE_PATH) CASE_TYPE(math, OP_MULTIPLY, _RID) CASE_TYPE(math, OP_MULTIPLY, OBJECT) @@ -964,7 +964,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_DIVIDE, RECT2) CASE_TYPE(math, OP_DIVIDE, TRANSFORM2D) CASE_TYPE(math, OP_DIVIDE, PLANE) - CASE_TYPE(math, OP_DIVIDE, RECT3) + CASE_TYPE(math, OP_DIVIDE, AABB) CASE_TYPE(math, OP_DIVIDE, BASIS) CASE_TYPE(math, OP_DIVIDE, TRANSFORM) CASE_TYPE(math, OP_DIVIDE, NODE_PATH) @@ -995,7 +995,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_POSITIVE, STRING) CASE_TYPE(math, OP_POSITIVE, RECT2) CASE_TYPE(math, OP_POSITIVE, TRANSFORM2D) - CASE_TYPE(math, OP_POSITIVE, RECT3) + CASE_TYPE(math, OP_POSITIVE, AABB) CASE_TYPE(math, OP_POSITIVE, BASIS) CASE_TYPE(math, OP_POSITIVE, TRANSFORM) CASE_TYPE(math, OP_POSITIVE, COLOR) @@ -1029,7 +1029,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_NEGATE, STRING) CASE_TYPE(math, OP_NEGATE, RECT2) CASE_TYPE(math, OP_NEGATE, TRANSFORM2D) - CASE_TYPE(math, OP_NEGATE, RECT3) + CASE_TYPE(math, OP_NEGATE, AABB) CASE_TYPE(math, OP_NEGATE, BASIS) CASE_TYPE(math, OP_NEGATE, TRANSFORM) CASE_TYPE(math, OP_NEGATE, NODE_PATH) @@ -1088,7 +1088,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a, CASE_TYPE(math, OP_MODULE, TRANSFORM2D) CASE_TYPE(math, OP_MODULE, PLANE) CASE_TYPE(math, OP_MODULE, QUAT) - CASE_TYPE(math, OP_MODULE, RECT3) + CASE_TYPE(math, OP_MODULE, AABB) CASE_TYPE(math, OP_MODULE, BASIS) CASE_TYPE(math, OP_MODULE, TRANSFORM) CASE_TYPE(math, OP_MODULE, COLOR) @@ -1384,10 +1384,10 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool } } break; // 10 - case RECT3: { + case AABB: { if (p_value.type == Variant::VECTOR3) { - Rect3 *v = _data._rect3; + ::AABB *v = _data._aabb; //scalar name if (p_index == CoreStringNames::singleton->position) { v->position = *reinterpret_cast<const Vector3 *>(p_value._data._mem); @@ -1609,9 +1609,9 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const { } } break; // 10 - case RECT3: { + case AABB: { - const Rect3 *v = _data._rect3; + const ::AABB *v = _data._aabb; //scalar name if (p_index == CoreStringNames::singleton->position) { return v->position; @@ -1982,7 +1982,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) } } break; // 10 - case RECT3: { + case AABB: { if (p_value.type != Variant::VECTOR3) return; @@ -1991,7 +1991,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) //scalar name const String *str = reinterpret_cast<const String *>(p_index._data._mem); - Rect3 *v = _data._rect3; + ::AABB *v = _data._aabb; if (*str == "position") { valid = true; v->position = p_value; @@ -2400,13 +2400,13 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const { } } break; // 10 - case RECT3: { + case AABB: { if (p_index.get_type() == Variant::STRING) { //scalar name const String *str = reinterpret_cast<const String *>(p_index._data._mem); - const Rect3 *v = _data._rect3; + const ::AABB *v = _data._aabb; if (*str == "position") { valid = true; return v->position; @@ -2835,7 +2835,7 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::REAL, "w")); } break; // 10 - case RECT3: { + case AABB: { p_list->push_back(PropertyInfo(Variant::VECTOR3, "position")); p_list->push_back(PropertyInfo(Variant::VECTOR3, "size")); p_list->push_back(PropertyInfo(Variant::VECTOR3, "end")); @@ -3457,10 +3457,10 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst) r_dst = *reinterpret_cast<const Vector3 *>(a._data._mem) + *reinterpret_cast<const Vector3 *>(b._data._mem) * c; } return; - case RECT3: { - const Rect3 *ra = reinterpret_cast<const Rect3 *>(a._data._mem); - const Rect3 *rb = reinterpret_cast<const Rect3 *>(b._data._mem); - r_dst = Rect3(ra->position + rb->position * c, ra->size + rb->size * c); + case AABB: { + const ::AABB *ra = reinterpret_cast<const ::AABB *>(a._data._mem); + const ::AABB *rb = reinterpret_cast<const ::AABB *>(b._data._mem); + r_dst = ::AABB(ra->position + rb->position * c, ra->size + rb->size * c); } return; case QUAT: { @@ -3591,8 +3591,8 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & r_dst = reinterpret_cast<const Quat *>(a._data._mem)->slerp(*reinterpret_cast<const Quat *>(b._data._mem), c); } return; - case RECT3: { - r_dst = Rect3(a._data._rect3->position.linear_interpolate(b._data._rect3->position, c), a._data._rect3->size.linear_interpolate(b._data._rect3->size, c)); + case AABB: { + r_dst = ::AABB(a._data._aabb->position.linear_interpolate(b._data._aabb->position, c), a._data._aabb->size.linear_interpolate(b._data._aabb->size, c)); } return; case BASIS: { diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index d60d10cd3a..1552b62c64 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -595,7 +595,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, value = Quat(args[0], args[1], args[2], args[3]); return OK; - } else if (id == "Rect3" || id == "AABB") { + } else if (id == "AABB") { Vector<float> args; Error err = _parse_construct<float>(p_stream, args, line, r_err_str); @@ -606,7 +606,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, r_err_str = "Expected 6 arguments for constructor"; } - value = Rect3(Vector3(args[0], args[1], args[2]), Vector3(args[3], args[4], args[5])); + value = AABB(Vector3(args[0], args[1], args[2]), Vector3(args[3], args[4], args[5])); return OK; } else if (id == "Basis" || id == "Matrix3") { //compatibility @@ -1634,10 +1634,10 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, "Plane( " + rtosfix(p.normal.x) + ", " + rtosfix(p.normal.y) + ", " + rtosfix(p.normal.z) + ", " + rtosfix(p.d) + " )"); } break; - case Variant::RECT3: { + case Variant::AABB: { - Rect3 aabb = p_variant; - p_store_string_func(p_store_string_ud, "Rect3( " + rtosfix(aabb.position.x) + ", " + rtosfix(aabb.position.y) + ", " + rtosfix(aabb.position.z) + ", " + rtosfix(aabb.size.x) + ", " + rtosfix(aabb.size.y) + ", " + rtosfix(aabb.size.z) + " )"); + AABB aabb = p_variant; + p_store_string_func(p_store_string_ud, "AABB( " + rtosfix(aabb.position.x) + ", " + rtosfix(aabb.position.y) + ", " + rtosfix(aabb.position.z) + ", " + rtosfix(aabb.size.x) + ", " + rtosfix(aabb.size.y) + ", " + rtosfix(aabb.size.z) + " )"); } break; case Variant::QUAT: { diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml index 47003d08e0..49ec412ba0 100644 --- a/doc/classes/@GDScript.xml +++ b/doc/classes/@GDScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="@GDScript" category="Core" version="3.0.alpha.custom_build"> +<class name="@GDScript" category="Core" version="3.0-alpha"> <brief_description> Built-in GDScript functions. </brief_description> @@ -196,7 +196,7 @@ <argument index="1" name="type" type="int"> </argument> <description> - Converts from a type to another in the best way possible. The [code]type[/code] parameter uses the enum TYPE_* in [@Global Scope]. + Converts from a type to another in the best way possible. The [code]type[/code] parameter uses the enum TYPE_* in [@GlobalScope]. [codeblock] a = Vector2(1, 0) # prints 1 @@ -984,7 +984,7 @@ <argument index="0" name="what" type="Variant"> </argument> <description> - Returns the internal type of the given Variant object, using the TYPE_* enum in [@Global Scope]. + Returns the internal type of the given Variant object, using the TYPE_* enum in [@GlobalScope]. [codeblock] p = parse_json('["a", "b", "c"]') if typeof(p) == TYPE_ARRAY: @@ -1103,14 +1103,14 @@ </description> </method> <method name="yield"> - <return type="GDFunctionState"> + <return type="GDScriptFunctionState"> </return> <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="signal" type="String"> </argument> <description> - Stops the function execution and returns the current state. Call [method GDFunctionState.resume] on the state to resume execution. This invalidates the state. + Stops the function execution and returns the current state. Call [method GDScriptFunctionState.resume] on the state to resume execution. This invalidates the state. Returns anything that was passed to the resume function call. If passed an object and a signal, the execution is resumed when the object's signal is emitted. </description> </method> diff --git a/doc/classes/@Global Scope.xml b/doc/classes/@GlobalScope.xml index 5e571e0284..d9bdf0e3cf 100644 --- a/doc/classes/@Global Scope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="@Global Scope" category="Core" version="3.0.alpha.custom_build"> +<class name="@GlobalScope" category="Core" version="3.0-alpha"> <brief_description> Global scope constants and variables. </brief_description> @@ -44,6 +44,8 @@ <member name="JSON" type="JSON" setter="" getter=""> [JSON] singleton </member> + <member name="JavaScript" type="JavaScript" setter="" getter=""> + </member> <member name="Marshalls" type="Reference" setter="" getter=""> [Marshalls] singleton </member> @@ -1332,8 +1334,8 @@ <constant name="TYPE_QUAT" value="10"> Variable is of type [Quat]. </constant> - <constant name="TYPE_RECT3" value="11"> - Variable is of type [Rect3]. + <constant name="TYPE_AABB" value="11"> + Variable is of type [AABB]. </constant> <constant name="TYPE_BASIS" value="12"> Variable is of type [Basis]. diff --git a/doc/classes/@NativeScript.xml b/doc/classes/@NativeScript.xml index 03e6416b19..a9dfc4538a 100644 --- a/doc/classes/@NativeScript.xml +++ b/doc/classes/@NativeScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="@NativeScript" category="Core" version="3.0.alpha.custom_build"> +<class name="@NativeScript" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/@VisualScript.xml b/doc/classes/@VisualScript.xml index fe40bc45e9..0e6205c040 100644 --- a/doc/classes/@VisualScript.xml +++ b/doc/classes/@VisualScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="@VisualScript" category="Core" version="3.0.alpha.custom_build"> +<class name="@VisualScript" category="Core" version="3.0-alpha"> <brief_description> Built-in visual script functions. </brief_description> diff --git a/doc/classes/Rect3.xml b/doc/classes/AABB.xml index a56dac57c7..494dcb8fce 100644 --- a/doc/classes/Rect3.xml +++ b/doc/classes/AABB.xml @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Rect3" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="AABB" category="Built-In Types" version="3.0-alpha"> <brief_description> Axis-Aligned Bounding Box. </brief_description> <description> - Rect3 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. + AABB consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. </description> <tutorials> </tutorials> <demos> </demos> <methods> - <method name="Rect3"> - <return type="Rect3"> + <method name="AABB"> + <return type="AABB"> </return> <argument index="0" name="position" type="Vector3"> </argument> @@ -25,26 +25,26 @@ <method name="encloses"> <return type="bool"> </return> - <argument index="0" name="with" type="Rect3"> + <argument index="0" name="with" type="AABB"> </argument> <description> - Returns [code]true[/code] if this [code]Rect3[/code] completely encloses another one. + Returns [code]true[/code] if this [code]AABB[/code] completely encloses another one. </description> </method> <method name="expand"> - <return type="Rect3"> + <return type="AABB"> </return> <argument index="0" name="to_point" type="Vector3"> </argument> <description> - Returns this [code]Rect3[/code] expanded to include a given point. + Returns this [code]AABB[/code] expanded to include a given point. </description> </method> <method name="get_area"> <return type="float"> </return> <description> - Gets the area of the [code]Rect3[/code]. + Gets the area of the [code]AABB[/code]. </description> </method> <method name="get_endpoint"> @@ -53,49 +53,49 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Gets the position of the 8 endpoints of the [code]Rect3[/code] in space. + Gets the position of the 8 endpoints of the [code]AABB[/code] in space. </description> </method> <method name="get_longest_axis"> <return type="Vector3"> </return> <description> - Returns the normalized longest axis of the [code]Rect3[/code]. + Returns the normalized longest axis of the [code]AABB[/code]. </description> </method> <method name="get_longest_axis_index"> <return type="int"> </return> <description> - Returns the index of the longest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum). + Returns the index of the longest axis of the [code]AABB[/code] (according to [Vector3]::AXIS* enum). </description> </method> <method name="get_longest_axis_size"> <return type="float"> </return> <description> - Returns the scalar length of the longest axis of the [code]Rect3[/code]. + Returns the scalar length of the longest axis of the [code]AABB[/code]. </description> </method> <method name="get_shortest_axis"> <return type="Vector3"> </return> <description> - Returns the normalized shortest axis of the [code]Rect3[/code]. + Returns the normalized shortest axis of the [code]AABB[/code]. </description> </method> <method name="get_shortest_axis_index"> <return type="int"> </return> <description> - Returns the index of the shortest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum). + Returns the index of the shortest axis of the [code]AABB[/code] (according to [Vector3]::AXIS* enum). </description> </method> <method name="get_shortest_axis_size"> <return type="float"> </return> <description> - Returns the scalar length of the shortest axis of the [code]Rect3[/code]. + Returns the scalar length of the shortest axis of the [code]AABB[/code]. </description> </method> <method name="get_support"> @@ -108,26 +108,26 @@ </description> </method> <method name="grow"> - <return type="Rect3"> + <return type="AABB"> </return> <argument index="0" name="by" type="float"> </argument> <description> - Returns a copy of the [code]Rect3[/code] grown a given amount of units towards all the sides. + Returns a copy of the [code]AABB[/code] grown a given amount of units towards all the sides. </description> </method> <method name="has_no_area"> <return type="bool"> </return> <description> - Returns [code]true[/code] if the [code]Rect3[/code] is flat or empty. + Returns [code]true[/code] if the [code]AABB[/code] is flat or empty. </description> </method> <method name="has_no_surface"> <return type="bool"> </return> <description> - Returns [code]true[/code] if the [code]Rect3[/code] is empty. + Returns [code]true[/code] if the [code]AABB[/code] is empty. </description> </method> <method name="has_point"> @@ -136,25 +136,25 @@ <argument index="0" name="point" type="Vector3"> </argument> <description> - Returns [code]true[/code] if the [code]Rect3[/code] contains a point. + Returns [code]true[/code] if the [code]AABB[/code] contains a point. </description> </method> <method name="intersection"> - <return type="Rect3"> + <return type="AABB"> </return> - <argument index="0" name="with" type="Rect3"> + <argument index="0" name="with" type="AABB"> </argument> <description> - Returns the intersection between two [code]Rect3[/code]. An empty Rect3 (size 0,0,0) is returned on failure. + Returns the intersection between two [code]AABB[/code]. An empty AABB (size 0,0,0) is returned on failure. </description> </method> <method name="intersects"> <return type="bool"> </return> - <argument index="0" name="with" type="Rect3"> + <argument index="0" name="with" type="AABB"> </argument> <description> - Returns [code]true[/code] if the [code]Rect3[/code] overlaps with another. + Returns [code]true[/code] if the [code]AABB[/code] overlaps with another. </description> </method> <method name="intersects_plane"> @@ -163,7 +163,7 @@ <argument index="0" name="plane" type="Plane"> </argument> <description> - Returns [code]true[/code] if the [code]Rect3[/code] is on both sides of a plane. + Returns [code]true[/code] if the [code]AABB[/code] is on both sides of a plane. </description> </method> <method name="intersects_segment"> @@ -174,16 +174,16 @@ <argument index="1" name="to" type="Vector3"> </argument> <description> - Returns [code]true[/code] if the [code]Rect3[/code] intersects the line segment between [code]from[/code] and [code]to[/code]. + Returns [code]true[/code] if the [code]AABB[/code] intersects the line segment between [code]from[/code] and [code]to[/code]. </description> </method> <method name="merge"> - <return type="Rect3"> + <return type="AABB"> </return> - <argument index="0" name="with" type="Rect3"> + <argument index="0" name="with" type="AABB"> </argument> <description> - Returns a larger Rect3 that contains this Rect3 and [code]with[/code]. + Returns a larger AABB that contains this AABB and [code]with[/code]. </description> </method> </methods> diff --git a/doc/classes/ARVRAnchor.xml b/doc/classes/ARVRAnchor.xml index ecd882cdb0..8bb12609b0 100644 --- a/doc/classes/ARVRAnchor.xml +++ b/doc/classes/ARVRAnchor.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRAnchor" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="ARVRAnchor" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Anchor point in AR Space </brief_description> diff --git a/doc/classes/ARVRCamera.xml b/doc/classes/ARVRCamera.xml index e6817d3417..0d9886618d 100644 --- a/doc/classes/ARVRCamera.xml +++ b/doc/classes/ARVRCamera.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRCamera" inherits="Camera" category="Core" version="3.0.alpha.custom_build"> +<class name="ARVRCamera" inherits="Camera" category="Core" version="3.0-alpha"> <brief_description> A camera node with a few overrules for AR/VR applied such as location tracking. </brief_description> diff --git a/doc/classes/ARVRController.xml b/doc/classes/ARVRController.xml index 2e6afe47cf..8af483132b 100644 --- a/doc/classes/ARVRController.xml +++ b/doc/classes/ARVRController.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRController" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="ARVRController" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> A spatial node representing a spatially tracked controller. </brief_description> diff --git a/doc/classes/ARVRInterface.xml b/doc/classes/ARVRInterface.xml index d7962ae5c3..e9f8857ec8 100644 --- a/doc/classes/ARVRInterface.xml +++ b/doc/classes/ARVRInterface.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRInterface" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="ARVRInterface" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Base class for ARVR interface implementation. </brief_description> diff --git a/doc/classes/ARVROrigin.xml b/doc/classes/ARVROrigin.xml index 226a69dea4..8ad3793c80 100644 --- a/doc/classes/ARVROrigin.xml +++ b/doc/classes/ARVROrigin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVROrigin" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="ARVROrigin" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Our origin point in AR/VR. </brief_description> diff --git a/doc/classes/ARVRPositionalTracker.xml b/doc/classes/ARVRPositionalTracker.xml index dbb676f88c..2a2c6aa843 100644 --- a/doc/classes/ARVRPositionalTracker.xml +++ b/doc/classes/ARVRPositionalTracker.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRPositionalTracker" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="ARVRPositionalTracker" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> A tracked object </brief_description> diff --git a/doc/classes/ARVRServer.xml b/doc/classes/ARVRServer.xml index 705abf2e94..bee95ea072 100644 --- a/doc/classes/ARVRServer.xml +++ b/doc/classes/ARVRServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRServer" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="ARVRServer" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> This is our AR/VR Server. </brief_description> diff --git a/doc/classes/AStar.xml b/doc/classes/AStar.xml index a2199c8f01..ceb3c907a6 100644 --- a/doc/classes/AStar.xml +++ b/doc/classes/AStar.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AStar" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="AStar" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> AStar class representation that uses vectors as edges. </brief_description> diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml index f87a40b8aa..2292d54756 100644 --- a/doc/classes/AcceptDialog.xml +++ b/doc/classes/AcceptDialog.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AcceptDialog" inherits="WindowDialog" category="Core" version="3.0.alpha.custom_build"> +<class name="AcceptDialog" inherits="WindowDialog" category="Core" version="3.0-alpha"> <brief_description> Base dialog for user notification. </brief_description> diff --git a/doc/classes/AnimatedSprite.xml b/doc/classes/AnimatedSprite.xml index dce7bf283a..984eb47f12 100644 --- a/doc/classes/AnimatedSprite.xml +++ b/doc/classes/AnimatedSprite.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AnimatedSprite" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="AnimatedSprite" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Sprite node that can use multiple textures for animation. </brief_description> diff --git a/doc/classes/AnimatedSprite3D.xml b/doc/classes/AnimatedSprite3D.xml index b0bb7bb6ab..0d8e2fc433 100644 --- a/doc/classes/AnimatedSprite3D.xml +++ b/doc/classes/AnimatedSprite3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AnimatedSprite3D" inherits="SpriteBase3D" category="Core" version="3.0.alpha.custom_build"> +<class name="AnimatedSprite3D" inherits="SpriteBase3D" category="Core" version="3.0-alpha"> <brief_description> 2D sprite node in 3D world, that can use multiple 2D textures for animation. </brief_description> diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml index d853345268..677976f1d3 100644 --- a/doc/classes/Animation.xml +++ b/doc/classes/Animation.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Animation" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Animation" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Contains data used to animate everything in the engine. </brief_description> diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml index 82eb291f27..f0a1f7f634 100644 --- a/doc/classes/AnimationPlayer.xml +++ b/doc/classes/AnimationPlayer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AnimationPlayer" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="AnimationPlayer" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Container and player of [Animation] resources. </brief_description> diff --git a/doc/classes/AnimationTreePlayer.xml b/doc/classes/AnimationTreePlayer.xml index b92e59b902..413606dbaa 100644 --- a/doc/classes/AnimationTreePlayer.xml +++ b/doc/classes/AnimationTreePlayer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AnimationTreePlayer" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="AnimationTreePlayer" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Animation Player that uses a node graph for the blending. </brief_description> diff --git a/doc/classes/Area.xml b/doc/classes/Area.xml index febced0a8e..85afa24214 100644 --- a/doc/classes/Area.xml +++ b/doc/classes/Area.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Area" inherits="CollisionObject" category="Core" version="3.0.alpha.custom_build"> +<class name="Area" inherits="CollisionObject" category="Core" version="3.0-alpha"> <brief_description> General purpose area node for detection and 3D physics influence. </brief_description> diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml index 6bc6e36dfc..5869e2238e 100644 --- a/doc/classes/Area2D.xml +++ b/doc/classes/Area2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Area2D" inherits="CollisionObject2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Area2D" inherits="CollisionObject2D" category="Core" version="3.0-alpha"> <brief_description> 2D area for detection and 2D physics influence. </brief_description> diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 05a571fb5e..203c60e644 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Array" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Array" category="Built-In Types" version="3.0-alpha"> <brief_description> Generic array datatype. </brief_description> diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml index c9996c1a0f..6c9b191371 100644 --- a/doc/classes/ArrayMesh.xml +++ b/doc/classes/ArrayMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ArrayMesh" inherits="Mesh" category="Core" version="3.0.alpha.custom_build"> +<class name="ArrayMesh" inherits="Mesh" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> @@ -66,7 +66,7 @@ </description> </method> <method name="get_custom_aabb" qualifiers="const"> - <return type="Rect3"> + <return type="AABB"> </return> <description> </description> @@ -95,7 +95,7 @@ <method name="set_custom_aabb"> <return type="void"> </return> - <argument index="0" name="aabb" type="Rect3"> + <argument index="0" name="aabb" type="AABB"> </argument> <description> </description> @@ -199,6 +199,18 @@ Set a [Material] for a given surface. Surface will be rendered using this material. </description> </method> + <method name="surface_update_region"> + <return type="void"> + </return> + <argument index="0" name="surf_idx" type="int"> + </argument> + <argument index="1" name="offset" type="int"> + </argument> + <argument index="2" name="data" type="PoolByteArray"> + </argument> + <description> + </description> + </method> </methods> <constants> <constant name="NO_INDEX_ARRAY" value="-1" enum=""> diff --git a/doc/classes/AtlasTexture.xml b/doc/classes/AtlasTexture.xml index 924dae8495..7cb934889e 100644 --- a/doc/classes/AtlasTexture.xml +++ b/doc/classes/AtlasTexture.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AtlasTexture" inherits="Texture" category="Core" version="3.0.alpha.custom_build"> +<class name="AtlasTexture" inherits="Texture" category="Core" version="3.0-alpha"> <brief_description> Packs multiple small textures in a single, bigger one. Helps to optimize video memory costs and render calls. </brief_description> diff --git a/doc/classes/AudioBusLayout.xml b/doc/classes/AudioBusLayout.xml index 045c6c2bf9..c539c7500b 100644 --- a/doc/classes/AudioBusLayout.xml +++ b/doc/classes/AudioBusLayout.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioBusLayout" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioBusLayout" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Stores information about the audiobusses. </brief_description> diff --git a/doc/classes/AudioEffect.xml b/doc/classes/AudioEffect.xml index 627d243f25..804cba82fe 100644 --- a/doc/classes/AudioEffect.xml +++ b/doc/classes/AudioEffect.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffect" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffect" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Audio Effect For Audio. </brief_description> diff --git a/doc/classes/AudioEffectAmplify.xml b/doc/classes/AudioEffectAmplify.xml index 35d7991833..0149e03de4 100644 --- a/doc/classes/AudioEffectAmplify.xml +++ b/doc/classes/AudioEffectAmplify.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectAmplify" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectAmplify" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a Amplify audio effect to an Audio bus. Increases or decreases the volume of the selected audio bus. diff --git a/doc/classes/AudioEffectBandLimitFilter.xml b/doc/classes/AudioEffectBandLimitFilter.xml index d4b251fc8e..f83cf8ba72 100644 --- a/doc/classes/AudioEffectBandLimitFilter.xml +++ b/doc/classes/AudioEffectBandLimitFilter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectBandLimitFilter" inherits="AudioEffectFilter" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectBandLimitFilter" inherits="AudioEffectFilter" category="Core" version="3.0-alpha"> <brief_description> Adds a band limit filter to the Audio Bus. </brief_description> diff --git a/doc/classes/AudioEffectBandPassFilter.xml b/doc/classes/AudioEffectBandPassFilter.xml index b5c6ae3c20..e922d3e821 100644 --- a/doc/classes/AudioEffectBandPassFilter.xml +++ b/doc/classes/AudioEffectBandPassFilter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectBandPassFilter" inherits="AudioEffectFilter" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectBandPassFilter" inherits="AudioEffectFilter" category="Core" version="3.0-alpha"> <brief_description> Adds a band pass filter to the Audio Bus. </brief_description> diff --git a/doc/classes/AudioEffectChorus.xml b/doc/classes/AudioEffectChorus.xml index b9f27678ec..40bac419d6 100644 --- a/doc/classes/AudioEffectChorus.xml +++ b/doc/classes/AudioEffectChorus.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectChorus" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectChorus" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a chorus audio effect. </brief_description> diff --git a/doc/classes/AudioEffectCompressor.xml b/doc/classes/AudioEffectCompressor.xml index 9d7e25dbf2..ae877f145a 100644 --- a/doc/classes/AudioEffectCompressor.xml +++ b/doc/classes/AudioEffectCompressor.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectCompressor" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectCompressor" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a Compressor audio effect to an Audio bus. Reduces sounds that exceed a certain threshold level, smooths out the dynamics and increases the overall volume. diff --git a/doc/classes/AudioEffectDelay.xml b/doc/classes/AudioEffectDelay.xml index 9dc61883ab..a9251b6cf0 100644 --- a/doc/classes/AudioEffectDelay.xml +++ b/doc/classes/AudioEffectDelay.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectDelay" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectDelay" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a Delay audio effect to an Audio bus. Plays input signal back after a period of time. Two tap delay and feedback options. diff --git a/doc/classes/AudioEffectDistortion.xml b/doc/classes/AudioEffectDistortion.xml index 8b970e675e..25df71d5f5 100644 --- a/doc/classes/AudioEffectDistortion.xml +++ b/doc/classes/AudioEffectDistortion.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectDistortion" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectDistortion" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a Distortion audio effect to an Audio bus. Modify the sound to make it dirty. diff --git a/doc/classes/AudioEffectEQ.xml b/doc/classes/AudioEffectEQ.xml index 246f6b882e..f8b4d426f4 100644 --- a/doc/classes/AudioEffectEQ.xml +++ b/doc/classes/AudioEffectEQ.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectEQ" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectEQ" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Base class for audio equalizers. Gives you control over frequencies. Use it to create a custom equalizer if [AudioEffectEQ6], [AudioEffectEQ10] or [AudioEffectEQ21] don't fit your needs. diff --git a/doc/classes/AudioEffectEQ10.xml b/doc/classes/AudioEffectEQ10.xml index 7a29f4cc0b..95801ef40c 100644 --- a/doc/classes/AudioEffectEQ10.xml +++ b/doc/classes/AudioEffectEQ10.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectEQ10" inherits="AudioEffectEQ" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectEQ10" inherits="AudioEffectEQ" category="Core" version="3.0-alpha"> <brief_description> Adds a 10-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 31 Hz to 16000 Hz. Each frequency can be modulated between -60/+24 dB. diff --git a/doc/classes/AudioEffectEQ21.xml b/doc/classes/AudioEffectEQ21.xml index 327f5a291a..b62e0458f7 100644 --- a/doc/classes/AudioEffectEQ21.xml +++ b/doc/classes/AudioEffectEQ21.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectEQ21" inherits="AudioEffectEQ" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectEQ21" inherits="AudioEffectEQ" category="Core" version="3.0-alpha"> <brief_description> Adds a 21-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 22 Hz to 22000 Hz. Each frequency can be modulated between -60/+24 dB. diff --git a/doc/classes/AudioEffectEQ6.xml b/doc/classes/AudioEffectEQ6.xml index bc05535041..f679ccede4 100644 --- a/doc/classes/AudioEffectEQ6.xml +++ b/doc/classes/AudioEffectEQ6.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectEQ6" inherits="AudioEffectEQ" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectEQ6" inherits="AudioEffectEQ" category="Core" version="3.0-alpha"> <brief_description> Adds a 6-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 32 Hz to 10000 Hz. Each frequency can be modulated between -60/+24 dB. diff --git a/doc/classes/AudioEffectFilter.xml b/doc/classes/AudioEffectFilter.xml index 82d572b81b..244c07a6da 100644 --- a/doc/classes/AudioEffectFilter.xml +++ b/doc/classes/AudioEffectFilter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectFilter" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectFilter" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a filter to the Audio Bus. </brief_description> diff --git a/doc/classes/AudioEffectHighPassFilter.xml b/doc/classes/AudioEffectHighPassFilter.xml index c5e24af510..4718d4d4a5 100644 --- a/doc/classes/AudioEffectHighPassFilter.xml +++ b/doc/classes/AudioEffectHighPassFilter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectHighPassFilter" inherits="AudioEffectFilter" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectHighPassFilter" inherits="AudioEffectFilter" category="Core" version="3.0-alpha"> <brief_description> Adds a high pass filter to the Audio Bus. </brief_description> diff --git a/doc/classes/AudioEffectHighShelfFilter.xml b/doc/classes/AudioEffectHighShelfFilter.xml index a2504d6808..62ff3d9366 100644 --- a/doc/classes/AudioEffectHighShelfFilter.xml +++ b/doc/classes/AudioEffectHighShelfFilter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectHighShelfFilter" inherits="AudioEffectFilter" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectHighShelfFilter" inherits="AudioEffectFilter" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/AudioEffectLimiter.xml b/doc/classes/AudioEffectLimiter.xml index 5209f290b1..ebed589829 100644 --- a/doc/classes/AudioEffectLimiter.xml +++ b/doc/classes/AudioEffectLimiter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectLimiter" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectLimiter" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a soft clip Limiter audio effect to an Audio bus. </brief_description> diff --git a/doc/classes/AudioEffectLowPassFilter.xml b/doc/classes/AudioEffectLowPassFilter.xml index f102dda03e..9f9ecc98b1 100644 --- a/doc/classes/AudioEffectLowPassFilter.xml +++ b/doc/classes/AudioEffectLowPassFilter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectLowPassFilter" inherits="AudioEffectFilter" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectLowPassFilter" inherits="AudioEffectFilter" category="Core" version="3.0-alpha"> <brief_description> Adds a low pass filter to the Audio Bus. </brief_description> diff --git a/doc/classes/AudioEffectLowShelfFilter.xml b/doc/classes/AudioEffectLowShelfFilter.xml index 8cf1a63c81..c74d1bc479 100644 --- a/doc/classes/AudioEffectLowShelfFilter.xml +++ b/doc/classes/AudioEffectLowShelfFilter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectLowShelfFilter" inherits="AudioEffectFilter" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectLowShelfFilter" inherits="AudioEffectFilter" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/AudioEffectNotchFilter.xml b/doc/classes/AudioEffectNotchFilter.xml index 8ec9a4bc7c..6407fc8431 100644 --- a/doc/classes/AudioEffectNotchFilter.xml +++ b/doc/classes/AudioEffectNotchFilter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectNotchFilter" inherits="AudioEffectFilter" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectNotchFilter" inherits="AudioEffectFilter" category="Core" version="3.0-alpha"> <brief_description> Adds a notch filter to the Audio Bus. </brief_description> diff --git a/doc/classes/AudioEffectPanner.xml b/doc/classes/AudioEffectPanner.xml index 56b39a36c6..46be7c1696 100644 --- a/doc/classes/AudioEffectPanner.xml +++ b/doc/classes/AudioEffectPanner.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectPanner" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectPanner" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a Panner audio effect to an Audio bus. Pans sound left or right. </brief_description> diff --git a/doc/classes/AudioEffectPhaser.xml b/doc/classes/AudioEffectPhaser.xml index bd9067471b..f413366fc7 100644 --- a/doc/classes/AudioEffectPhaser.xml +++ b/doc/classes/AudioEffectPhaser.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectPhaser" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectPhaser" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a Phaser audio effect to an Audio bus. Combines the original signal with a copy that is slightly out of phase with the original. diff --git a/doc/classes/AudioEffectPitchShift.xml b/doc/classes/AudioEffectPitchShift.xml index edcb54e09e..490aacbc8e 100644 --- a/doc/classes/AudioEffectPitchShift.xml +++ b/doc/classes/AudioEffectPitchShift.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectPitchShift" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectPitchShift" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a Pitch shift audio effect to an Audio bus. Raises or lowers the pitch of original sound. diff --git a/doc/classes/AudioEffectReverb.xml b/doc/classes/AudioEffectReverb.xml index f399f9f07a..e0567a48c7 100644 --- a/doc/classes/AudioEffectReverb.xml +++ b/doc/classes/AudioEffectReverb.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectReverb" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectReverb" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> Adds a Reverb audio effect to an Audio bus. Simulates the sound of acoustic environments such as rooms, concert halls, caverns, or an open spaces. diff --git a/doc/classes/AudioEffectStereoEnhance.xml b/doc/classes/AudioEffectStereoEnhance.xml index 345d019d85..eb17056813 100644 --- a/doc/classes/AudioEffectStereoEnhance.xml +++ b/doc/classes/AudioEffectStereoEnhance.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioEffectStereoEnhance" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioEffectStereoEnhance" inherits="AudioEffect" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/AudioServer.xml b/doc/classes/AudioServer.xml index f8320c23af..83a06bcd4d 100644 --- a/doc/classes/AudioServer.xml +++ b/doc/classes/AudioServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioServer" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioServer" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Server interface for low level audio access. </brief_description> @@ -287,7 +287,7 @@ <argument index="1" name="send" type="String"> </argument> <description> - Connects the output of the bus at [code]bus_idx[/code] to the bus named [code]send[/send]. + Connects the output of the bus at [code]bus_idx[/code] to the bus named [code]send[/code]. </description> </method> <method name="set_bus_solo"> diff --git a/doc/classes/AudioStream.xml b/doc/classes/AudioStream.xml index b4a98b2d8c..67323c59c5 100644 --- a/doc/classes/AudioStream.xml +++ b/doc/classes/AudioStream.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioStream" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioStream" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Base class for audio streams. </brief_description> diff --git a/doc/classes/AudioStreamPlayback.xml b/doc/classes/AudioStreamPlayback.xml index f45beec42c..61393fbe29 100644 --- a/doc/classes/AudioStreamPlayback.xml +++ b/doc/classes/AudioStreamPlayback.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioStreamPlayback" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioStreamPlayback" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Meta class for playing back audio. </brief_description> diff --git a/doc/classes/AudioStreamPlayer.xml b/doc/classes/AudioStreamPlayer.xml index 1a9ad85565..55edbfb438 100644 --- a/doc/classes/AudioStreamPlayer.xml +++ b/doc/classes/AudioStreamPlayer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioStreamPlayer" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioStreamPlayer" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Plays back audio. </brief_description> diff --git a/doc/classes/AudioStreamPlayer2D.xml b/doc/classes/AudioStreamPlayer2D.xml index c6fd8ff54f..98ebeacc5f 100644 --- a/doc/classes/AudioStreamPlayer2D.xml +++ b/doc/classes/AudioStreamPlayer2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioStreamPlayer2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioStreamPlayer2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Plays audio in 2D. </brief_description> diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml index 84f6792ef0..9c016a0173 100644 --- a/doc/classes/AudioStreamPlayer3D.xml +++ b/doc/classes/AudioStreamPlayer3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioStreamPlayer3D" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioStreamPlayer3D" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Plays 3D sound in 3D space </brief_description> diff --git a/doc/classes/AudioStreamRandomPitch.xml b/doc/classes/AudioStreamRandomPitch.xml index 1573a78d1f..56c7ee1998 100644 --- a/doc/classes/AudioStreamRandomPitch.xml +++ b/doc/classes/AudioStreamRandomPitch.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioStreamRandomPitch" inherits="AudioStream" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioStreamRandomPitch" inherits="AudioStream" category="Core" version="3.0-alpha"> <brief_description> Plays audio with random pitch tweaking. </brief_description> diff --git a/doc/classes/AudioStreamSample.xml b/doc/classes/AudioStreamSample.xml index 7f7414e4d3..3a0a171480 100644 --- a/doc/classes/AudioStreamSample.xml +++ b/doc/classes/AudioStreamSample.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioStreamSample" inherits="AudioStream" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioStreamSample" inherits="AudioStream" category="Core" version="3.0-alpha"> <brief_description> Plays audio. </brief_description> diff --git a/doc/classes/BackBufferCopy.xml b/doc/classes/BackBufferCopy.xml index 6c44430949..2b5a9aac20 100644 --- a/doc/classes/BackBufferCopy.xml +++ b/doc/classes/BackBufferCopy.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BackBufferCopy" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="BackBufferCopy" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Copies a region of the screen (or the whole screen) to a buffer so it can be accessed with the texscreen() shader instruction. </brief_description> diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml index 1b6583a834..26939143b6 100644 --- a/doc/classes/BaseButton.xml +++ b/doc/classes/BaseButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BaseButton" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="BaseButton" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Base class for different kinds of buttons. </brief_description> diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml index 7731647648..c8a28621ea 100644 --- a/doc/classes/Basis.xml +++ b/doc/classes/Basis.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Basis" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Basis" category="Built-In Types" version="3.0-alpha"> <brief_description> 3x3 matrix datatype. </brief_description> diff --git a/doc/classes/BitMap.xml b/doc/classes/BitMap.xml index 63e6a5f682..4de059d908 100644 --- a/doc/classes/BitMap.xml +++ b/doc/classes/BitMap.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BitMap" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="BitMap" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Boolean matrix. </brief_description> diff --git a/doc/classes/BitmapFont.xml b/doc/classes/BitmapFont.xml index 43ce40562f..c013a474b2 100644 --- a/doc/classes/BitmapFont.xml +++ b/doc/classes/BitmapFont.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BitmapFont" inherits="Font" category="Core" version="3.0.alpha.custom_build"> +<class name="BitmapFont" inherits="Font" category="Core" version="3.0-alpha"> <brief_description> Renders text using [code]*.fnt[/code] fonts. </brief_description> diff --git a/doc/classes/BoneAttachment.xml b/doc/classes/BoneAttachment.xml index 9297c0e1b1..8f33d7a73c 100644 --- a/doc/classes/BoneAttachment.xml +++ b/doc/classes/BoneAttachment.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BoneAttachment" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="BoneAttachment" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> A node that will attach to a bone. </brief_description> diff --git a/doc/classes/BoxContainer.xml b/doc/classes/BoxContainer.xml index 0c70d919f3..a7465a959a 100644 --- a/doc/classes/BoxContainer.xml +++ b/doc/classes/BoxContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BoxContainer" inherits="Container" category="Core" version="3.0.alpha.custom_build"> +<class name="BoxContainer" inherits="Container" category="Core" version="3.0-alpha"> <brief_description> Base class for box containers. </brief_description> diff --git a/doc/classes/BoxShape.xml b/doc/classes/BoxShape.xml index 4e8eb0ba6f..0f46442550 100644 --- a/doc/classes/BoxShape.xml +++ b/doc/classes/BoxShape.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BoxShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build"> +<class name="BoxShape" inherits="Shape" category="Core" version="3.0-alpha"> <brief_description> Box shape resource. </brief_description> diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml index bb02e4266b..2964cc9efc 100644 --- a/doc/classes/Button.xml +++ b/doc/classes/Button.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Button" inherits="BaseButton" category="Core" version="3.0.alpha.custom_build"> +<class name="Button" inherits="BaseButton" category="Core" version="3.0-alpha"> <brief_description> Standard themed Button. </brief_description> diff --git a/doc/classes/ButtonGroup.xml b/doc/classes/ButtonGroup.xml index c2c999f9d8..ccc457f9e6 100644 --- a/doc/classes/ButtonGroup.xml +++ b/doc/classes/ButtonGroup.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ButtonGroup" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="ButtonGroup" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Group of Buttons. </brief_description> diff --git a/doc/classes/Camera.xml b/doc/classes/Camera.xml index aeebcf9c87..c840da9266 100644 --- a/doc/classes/Camera.xml +++ b/doc/classes/Camera.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Camera" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="Camera" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Camera node, displays from a point of view. </brief_description> diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml index 352e270e77..8704624b2d 100644 --- a/doc/classes/Camera2D.xml +++ b/doc/classes/Camera2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Camera2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Camera2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Camera node for 2D scenes. </brief_description> diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 3682cc6d8f..bb3a9b3845 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CanvasItem" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="CanvasItem" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Base class of anything 2D. </brief_description> @@ -346,14 +346,14 @@ Get the global transform matrix of this item in relation to the canvas. </description> </method> - <method name="get_item_and_children_rect" qualifiers="const"> + <method name="edit_get_item_and_children_rect" qualifiers="const"> <return type="Rect2"> </return> <description> Get a [Rect2] with the boundaries of this item and its children. </description> </method> - <method name="get_item_rect" qualifiers="const"> + <method name="edit_get_rect" qualifiers="const"> <return type="Rect2"> </return> <description> diff --git a/doc/classes/CanvasItemMaterial.xml b/doc/classes/CanvasItemMaterial.xml index 2a6553bb6a..b9d2653a2f 100644 --- a/doc/classes/CanvasItemMaterial.xml +++ b/doc/classes/CanvasItemMaterial.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CanvasItemMaterial" inherits="Material" category="Core" version="3.0.alpha.custom_build"> +<class name="CanvasItemMaterial" inherits="Material" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/CanvasLayer.xml b/doc/classes/CanvasLayer.xml index f89c4ea754..139624bb1d 100644 --- a/doc/classes/CanvasLayer.xml +++ b/doc/classes/CanvasLayer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CanvasLayer" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="CanvasLayer" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Canvas drawing layer. </brief_description> diff --git a/doc/classes/CanvasModulate.xml b/doc/classes/CanvasModulate.xml index b4b20e29f9..3872d80236 100644 --- a/doc/classes/CanvasModulate.xml +++ b/doc/classes/CanvasModulate.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CanvasModulate" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="CanvasModulate" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Tint the entire canvas. </brief_description> diff --git a/doc/classes/CapsuleMesh.xml b/doc/classes/CapsuleMesh.xml index 13cdfa057d..497e795253 100644 --- a/doc/classes/CapsuleMesh.xml +++ b/doc/classes/CapsuleMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CapsuleMesh" inherits="PrimitiveMesh" category="Core" version="3.0.alpha.custom_build"> +<class name="CapsuleMesh" inherits="PrimitiveMesh" category="Core" version="3.0-alpha"> <brief_description> Class representing a capsule-shaped [PrimitiveMesh]. </brief_description> diff --git a/doc/classes/CapsuleShape.xml b/doc/classes/CapsuleShape.xml index db075a504c..f2d3528e4f 100644 --- a/doc/classes/CapsuleShape.xml +++ b/doc/classes/CapsuleShape.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CapsuleShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build"> +<class name="CapsuleShape" inherits="Shape" category="Core" version="3.0-alpha"> <brief_description> Capsule shape for collisions. </brief_description> diff --git a/doc/classes/CapsuleShape2D.xml b/doc/classes/CapsuleShape2D.xml index 4fb5579436..b700388303 100644 --- a/doc/classes/CapsuleShape2D.xml +++ b/doc/classes/CapsuleShape2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CapsuleShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build"> +<class name="CapsuleShape2D" inherits="Shape2D" category="Core" version="3.0-alpha"> <brief_description> Capsule shape for 2D collisions. </brief_description> diff --git a/doc/classes/CenterContainer.xml b/doc/classes/CenterContainer.xml index 2f81e7739f..9e88448e32 100644 --- a/doc/classes/CenterContainer.xml +++ b/doc/classes/CenterContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CenterContainer" inherits="Container" category="Core" version="3.0.alpha.custom_build"> +<class name="CenterContainer" inherits="Container" category="Core" version="3.0-alpha"> <brief_description> Keeps children controls centered. </brief_description> diff --git a/doc/classes/CheckBox.xml b/doc/classes/CheckBox.xml index 50b431e00c..fb9a67323b 100644 --- a/doc/classes/CheckBox.xml +++ b/doc/classes/CheckBox.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CheckBox" inherits="Button" category="Core" version="3.0.alpha.custom_build"> +<class name="CheckBox" inherits="Button" category="Core" version="3.0-alpha"> <brief_description> Binary choice user interface widget </brief_description> diff --git a/doc/classes/CheckButton.xml b/doc/classes/CheckButton.xml index bb4e6fc0cb..996b4238a1 100644 --- a/doc/classes/CheckButton.xml +++ b/doc/classes/CheckButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CheckButton" inherits="Button" category="Core" version="3.0.alpha.custom_build"> +<class name="CheckButton" inherits="Button" category="Core" version="3.0-alpha"> <brief_description> Checkable button. </brief_description> diff --git a/doc/classes/CircleShape2D.xml b/doc/classes/CircleShape2D.xml index 1ed54f0705..e5158755fe 100644 --- a/doc/classes/CircleShape2D.xml +++ b/doc/classes/CircleShape2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CircleShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build"> +<class name="CircleShape2D" inherits="Shape2D" category="Core" version="3.0-alpha"> <brief_description> Circular shape for 2D collisions. </brief_description> diff --git a/doc/classes/ClassDB.xml b/doc/classes/ClassDB.xml index 35cf819959..2fed2f8676 100644 --- a/doc/classes/ClassDB.xml +++ b/doc/classes/ClassDB.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ClassDB" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="ClassDB" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Class information repository. </brief_description> diff --git a/doc/classes/CollisionObject.xml b/doc/classes/CollisionObject.xml index 71b0c5fa7c..be047ad699 100644 --- a/doc/classes/CollisionObject.xml +++ b/doc/classes/CollisionObject.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CollisionObject" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="CollisionObject" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Base node for collision objects. </brief_description> diff --git a/doc/classes/CollisionObject2D.xml b/doc/classes/CollisionObject2D.xml index ec0554d51f..d10368229c 100644 --- a/doc/classes/CollisionObject2D.xml +++ b/doc/classes/CollisionObject2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CollisionObject2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="CollisionObject2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Base node for 2D collision objects. </brief_description> diff --git a/doc/classes/CollisionPolygon.xml b/doc/classes/CollisionPolygon.xml index c2496424d6..13a993e9f4 100644 --- a/doc/classes/CollisionPolygon.xml +++ b/doc/classes/CollisionPolygon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CollisionPolygon" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="CollisionPolygon" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Editor-only class for defining a collision polygon in 3D space. </brief_description> diff --git a/doc/classes/CollisionPolygon2D.xml b/doc/classes/CollisionPolygon2D.xml index 7f30e8e83e..bc4d2a5b16 100644 --- a/doc/classes/CollisionPolygon2D.xml +++ b/doc/classes/CollisionPolygon2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CollisionPolygon2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="CollisionPolygon2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Defines a 2D collision polygon. </brief_description> diff --git a/doc/classes/CollisionShape.xml b/doc/classes/CollisionShape.xml index 6e98d2f979..3c9e252788 100644 --- a/doc/classes/CollisionShape.xml +++ b/doc/classes/CollisionShape.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CollisionShape" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="CollisionShape" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Node that represents collision shape data in 3D space. </brief_description> diff --git a/doc/classes/CollisionShape2D.xml b/doc/classes/CollisionShape2D.xml index cefa0c1c81..caf3f8d8be 100644 --- a/doc/classes/CollisionShape2D.xml +++ b/doc/classes/CollisionShape2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CollisionShape2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="CollisionShape2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Node that represents collision shape data in 2D space. </brief_description> diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index 4547771b63..479eb719d4 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Color" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Color" category="Built-In Types" version="3.0-alpha"> <brief_description> Color in RGBA format with some support for ARGB format. </brief_description> diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml index 74c12cb9b2..b6aeb8d0e3 100644 --- a/doc/classes/ColorPicker.xml +++ b/doc/classes/ColorPicker.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ColorPicker" inherits="BoxContainer" category="Core" version="3.0.alpha.custom_build"> +<class name="ColorPicker" inherits="BoxContainer" category="Core" version="3.0-alpha"> <brief_description> Color picker control. </brief_description> diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml index 7b54be36c9..24b37580d6 100644 --- a/doc/classes/ColorPickerButton.xml +++ b/doc/classes/ColorPickerButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ColorPickerButton" inherits="Button" category="Core" version="3.0.alpha.custom_build"> +<class name="ColorPickerButton" inherits="Button" category="Core" version="3.0-alpha"> <brief_description> Button that pops out a [ColorPicker] </brief_description> diff --git a/doc/classes/ColorRect.xml b/doc/classes/ColorRect.xml index 6e70a1e8b7..4dbc4f010c 100644 --- a/doc/classes/ColorRect.xml +++ b/doc/classes/ColorRect.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ColorRect" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="ColorRect" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Colored rect for canvas. </brief_description> diff --git a/doc/classes/ConcavePolygonShape.xml b/doc/classes/ConcavePolygonShape.xml index 0b1cbf9c21..e586eb11c5 100644 --- a/doc/classes/ConcavePolygonShape.xml +++ b/doc/classes/ConcavePolygonShape.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConcavePolygonShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build"> +<class name="ConcavePolygonShape" inherits="Shape" category="Core" version="3.0-alpha"> <brief_description> Concave polygon shape. </brief_description> diff --git a/doc/classes/ConcavePolygonShape2D.xml b/doc/classes/ConcavePolygonShape2D.xml index be884fd08d..5d2dbb4596 100644 --- a/doc/classes/ConcavePolygonShape2D.xml +++ b/doc/classes/ConcavePolygonShape2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConcavePolygonShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build"> +<class name="ConcavePolygonShape2D" inherits="Shape2D" category="Core" version="3.0-alpha"> <brief_description> Concave polygon 2D shape resource for physics. </brief_description> diff --git a/doc/classes/ConeTwistJoint.xml b/doc/classes/ConeTwistJoint.xml index baf28c5a74..2f72b451f3 100644 --- a/doc/classes/ConeTwistJoint.xml +++ b/doc/classes/ConeTwistJoint.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConeTwistJoint" inherits="Joint" category="Core" version="3.0.alpha.custom_build"> +<class name="ConeTwistJoint" inherits="Joint" category="Core" version="3.0-alpha"> <brief_description> A twist joint between two 3D bodies </brief_description> diff --git a/doc/classes/ConfigFile.xml b/doc/classes/ConfigFile.xml index 846a100f3c..ef668ca994 100644 --- a/doc/classes/ConfigFile.xml +++ b/doc/classes/ConfigFile.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConfigFile" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="ConfigFile" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Helper class to handle INI-style files. </brief_description> @@ -95,7 +95,7 @@ <argument index="0" name="path" type="String"> </argument> <description> - Loads the config file specified as a parameter. The file's contents are parsed and loaded in the ConfigFile object which the method was called on. Returns one of the [code]OK[/code], [code]FAILED[/code] or [code]ERR_*[/code] constants listed in [@Global Scope]. If the load was successful, the return value is [code]OK[/code]. + Loads the config file specified as a parameter. The file's contents are parsed and loaded in the ConfigFile object which the method was called on. Returns one of the [code]OK[/code], [code]FAILED[/code] or [code]ERR_*[/code] constants listed in [@GlobalScope]. If the load was successful, the return value is [code]OK[/code]. </description> </method> <method name="save"> @@ -104,7 +104,7 @@ <argument index="0" name="path" type="String"> </argument> <description> - Saves the contents of the ConfigFile object to the file specified as a parameter. The output file uses an INI-style structure. Returns one of the [code]OK[/code], [code]FAILED[/code] or [code]ERR_*[/code] constants listed in [@Global Scope]. If the load was successful, the return value is [code]OK[/code]. + Saves the contents of the ConfigFile object to the file specified as a parameter. The output file uses an INI-style structure. Returns one of the [code]OK[/code], [code]FAILED[/code] or [code]ERR_*[/code] constants listed in [@GlobalScope]. If the load was successful, the return value is [code]OK[/code]. </description> </method> <method name="set_value"> diff --git a/doc/classes/ConfirmationDialog.xml b/doc/classes/ConfirmationDialog.xml index 84de287519..1bbb338c07 100644 --- a/doc/classes/ConfirmationDialog.xml +++ b/doc/classes/ConfirmationDialog.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConfirmationDialog" inherits="AcceptDialog" category="Core" version="3.0.alpha.custom_build"> +<class name="ConfirmationDialog" inherits="AcceptDialog" category="Core" version="3.0-alpha"> <brief_description> Dialog for confirmation of actions. </brief_description> diff --git a/doc/classes/Container.xml b/doc/classes/Container.xml index f8555def37..5490c84bae 100644 --- a/doc/classes/Container.xml +++ b/doc/classes/Container.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Container" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="Container" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Base node for containers. </brief_description> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index b5765ac948..57966fb74e 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Control" inherits="CanvasItem" category="Core" version="3.0.alpha.custom_build"> +<class name="Control" inherits="CanvasItem" category="Core" version="3.0-alpha"> <brief_description> All User Interface nodes inherit from Control. Features anchors and margins to adapt its position and size to its parent. </brief_description> @@ -60,7 +60,7 @@ <argument index="1" name="constant" type="int"> </argument> <description> - Overrides an integer constant in the [theme] resource the node uses. If the [code]constant[code] is invalid, Godot clears the override. See [member Theme.INVALID_CONSTANT] for more information. + Overrides an integer constant in the [Theme] resource the node uses. If the [code]constant[/code] is invalid, Godot clears the override. See [member Theme.INVALID_CONSTANT] for more information. </description> </method> <method name="add_font_override"> @@ -228,7 +228,14 @@ <argument index="0" name="margin" type="int" enum="Margin"> </argument> <description> - Return the forced neighbour for moving the input focus to. When pressing TAB or directional/joypad directions focus is moved to the next control in that direction. However, the neighbour to move to can be forced with this function. + Return the forced neighbour for moving the input focus to. When pressing directional/joypad directions, focus is moved to the next control in that direction. However, the neighbour to move to can be forced with this function. + </description> + </method> + <method name="get_focus_next" qualifiers="const"> + <return type="NodePath"> + </return> + <description> + Return the 'focus_next' for moving input focus to. When pressing TAB, focus is moved to the next control in the tree. However, the control to move to can be forced with this function. </description> </method> <method name="get_focus_owner" qualifiers="const"> @@ -238,6 +245,13 @@ Return which control is owning the keyboard focus, or null if no one. </description> </method> + <method name="get_focus_previous" qualifiers="const"> + <return type="NodePath"> + </return> + <description> + Return the 'focus_previous' for moving input focus to. When pressing Shift+TAB focus is moved to the previous control in the tree. However, the control to move to can be forced with this function. + </description> + </method> <method name="get_font" qualifiers="const"> <return type="Font"> </return> @@ -676,7 +690,25 @@ <argument index="1" name="neighbour" type="NodePath"> </argument> <description> - Force a neighbour for moving the input focus to. When pressing TAB or directional/joypad directions focus is moved to the next control in that direction. However, the neighbour to move to can be forced with this function. + Force a neighbour for moving the input focus to. When pressing directional/joypad directions, focus is moved to the next control in that direction. However, the neighbour to move to can be forced with this function. + </description> + </method> + <method name="set_focus_next"> + <return type="void"> + </return> + <argument index="0" name="next" type="NodePath"> + </argument> + <description> + Force the 'focus_next' for moving input focus to. When pressing TAB, focus is moved to the next control in the tree. However, the control to move to can be forced with this function. + </description> + </method> + <method name="set_focus_previous"> + <return type="void"> + </return> + <argument index="0" name="previous" type="NodePath"> + </argument> + <description> + Force the 'focus_previous' for moving input focus to. When pressing Shift+TAB, focus is moved to the previous control in the tree. However, the control to move to can be forced with this function. </description> </method> <method name="set_global_position"> diff --git a/doc/classes/ConvexPolygonShape.xml b/doc/classes/ConvexPolygonShape.xml index 822b99547e..0ea140148c 100644 --- a/doc/classes/ConvexPolygonShape.xml +++ b/doc/classes/ConvexPolygonShape.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConvexPolygonShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build"> +<class name="ConvexPolygonShape" inherits="Shape" category="Core" version="3.0-alpha"> <brief_description> Convex polygon shape for 3D physics. </brief_description> diff --git a/doc/classes/ConvexPolygonShape2D.xml b/doc/classes/ConvexPolygonShape2D.xml index cf1fdccc26..40507c6a6b 100644 --- a/doc/classes/ConvexPolygonShape2D.xml +++ b/doc/classes/ConvexPolygonShape2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ConvexPolygonShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build"> +<class name="ConvexPolygonShape2D" inherits="Shape2D" category="Core" version="3.0-alpha"> <brief_description> Convex Polygon Shape for 2D physics. </brief_description> diff --git a/doc/classes/CubeMap.xml b/doc/classes/CubeMap.xml index b173bba3c6..9b0837306e 100644 --- a/doc/classes/CubeMap.xml +++ b/doc/classes/CubeMap.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CubeMap" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="CubeMap" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> A CubeMap is a 6 sided 3D texture. </brief_description> diff --git a/doc/classes/CubeMesh.xml b/doc/classes/CubeMesh.xml index 642f37c393..4a8ad104b7 100644 --- a/doc/classes/CubeMesh.xml +++ b/doc/classes/CubeMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CubeMesh" inherits="PrimitiveMesh" category="Core" version="3.0.alpha.custom_build"> +<class name="CubeMesh" inherits="PrimitiveMesh" category="Core" version="3.0-alpha"> <brief_description> Generate an axis-aligned cuboid [PrimitiveMesh]. </brief_description> diff --git a/doc/classes/Curve.xml b/doc/classes/Curve.xml index c89ab6fb9b..3741f51fad 100644 --- a/doc/classes/Curve.xml +++ b/doc/classes/Curve.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Curve" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Curve" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Curve2D.xml b/doc/classes/Curve2D.xml index 99ec2b7d94..0d9dfad643 100644 --- a/doc/classes/Curve2D.xml +++ b/doc/classes/Curve2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Curve2D" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Curve2D" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Describes a Bezier curve in 2D space. </brief_description> diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml index 02299753cf..35f8db0177 100644 --- a/doc/classes/Curve3D.xml +++ b/doc/classes/Curve3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Curve3D" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Curve3D" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Describes a Bezier curve in 3D space. </brief_description> diff --git a/doc/classes/CurveTexture.xml b/doc/classes/CurveTexture.xml index 8f8f60968a..61a6a2486f 100644 --- a/doc/classes/CurveTexture.xml +++ b/doc/classes/CurveTexture.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CurveTexture" inherits="Texture" category="Core" version="3.0.alpha.custom_build"> +<class name="CurveTexture" inherits="Texture" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/CylinderMesh.xml b/doc/classes/CylinderMesh.xml index 8399312dac..8398b52ee0 100644 --- a/doc/classes/CylinderMesh.xml +++ b/doc/classes/CylinderMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CylinderMesh" inherits="PrimitiveMesh" category="Core" version="3.0.alpha.custom_build"> +<class name="CylinderMesh" inherits="PrimitiveMesh" category="Core" version="3.0-alpha"> <brief_description> Class representing a cylindrical [PrimitiveMesh]. </brief_description> diff --git a/doc/classes/DampedSpringJoint2D.xml b/doc/classes/DampedSpringJoint2D.xml index 36c5564513..da7147933d 100644 --- a/doc/classes/DampedSpringJoint2D.xml +++ b/doc/classes/DampedSpringJoint2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="DampedSpringJoint2D" inherits="Joint2D" category="Core" version="3.0.alpha.custom_build"> +<class name="DampedSpringJoint2D" inherits="Joint2D" category="Core" version="3.0-alpha"> <brief_description> Damped spring constraint for 2D physics. </brief_description> diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index 4b37061af2..5664b2079b 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Dictionary" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Dictionary" category="Built-In Types" version="3.0-alpha"> <brief_description> Dictionary type. </brief_description> diff --git a/doc/classes/DirectionalLight.xml b/doc/classes/DirectionalLight.xml index 7de1791519..f0cc007339 100644 --- a/doc/classes/DirectionalLight.xml +++ b/doc/classes/DirectionalLight.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="DirectionalLight" inherits="Light" category="Core" version="3.0.alpha.custom_build"> +<class name="DirectionalLight" inherits="Light" category="Core" version="3.0-alpha"> <brief_description> Directional Light, such as the Sun or the Moon. </brief_description> diff --git a/doc/classes/Directory.xml b/doc/classes/Directory.xml index c3c4c7a8ac..b11e0629cd 100644 --- a/doc/classes/Directory.xml +++ b/doc/classes/Directory.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Directory" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="Directory" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Type used to handle the filesystem. </brief_description> @@ -34,7 +34,7 @@ </argument> <description> Change the currently opened directory to the one passed as an argument. The argument can be relative to the current directory (e.g. [code]newdir[/code] or [code]../newdir[/code]), or an absolute path (e.g. [code]/tmp/newdir[/code] or [code]res://somedir/newdir[/code]). - The method returns one of the error code constants defined in [@Global Scope] (OK or ERR_*). + The method returns one of the error code constants defined in [@GlobalScope] (OK or ERR_*). </description> </method> <method name="copy"> @@ -46,7 +46,7 @@ </argument> <description> Copy the [i]from[/i] file to the [i]to[/i] destination. Both arguments should be paths to files, either relative or absolute. If the destination file exists and is not access-protected, it will be overwritten. - Returns one of the error code constants defined in [@Global Scope] (OK, FAILED or ERR_*). + Returns one of the error code constants defined in [@GlobalScope] (OK, FAILED or ERR_*). </description> </method> <method name="current_is_dir" qualifiers="const"> @@ -146,7 +146,7 @@ </argument> <description> Create a directory. The argument can be relative to the current directory, or an absolute path. The target directory should be placed in an already existing directory (to create the full path recursively, see [method make_dir_recursive]). - The method returns one of the error code constants defined in [@Global Scope] (OK, FAILED or ERR_*). + The method returns one of the error code constants defined in [@GlobalScope] (OK, FAILED or ERR_*). </description> </method> <method name="make_dir_recursive"> @@ -156,7 +156,7 @@ </argument> <description> Create a target directory and all necessary intermediate directories in its path, by calling [method make_dir] recursively. The argument can be relative to the current directory, or an absolute path. - Return one of the error code constants defined in [@Global Scope] (OK, FAILED or ERR_*). + Return one of the error code constants defined in [@GlobalScope] (OK, FAILED or ERR_*). </description> </method> <method name="open"> @@ -166,7 +166,7 @@ </argument> <description> Open an existing directory of the filesystem. The [i]path[/i] argument can be within the project tree ([code]res://folder[/code]), the user directory ([code]user://folder[/code]) or an absolute path of the user filesystem (e.g. [code]/tmp/folder[/code] or [code]C:\tmp\folder[/code]). - The method returns one of the error code constants defined in [@Global Scope] (OK or ERR_*). + The method returns one of the error code constants defined in [@GlobalScope] (OK or ERR_*). </description> </method> <method name="remove"> @@ -176,7 +176,7 @@ </argument> <description> Delete the target file or an empty directory. The argument can be relative to the current directory, or an absolute path. If the target directory is not empty, the operation will fail. - Return one of the error code constants defined in [@Global Scope] (OK or FAILED). + Return one of the error code constants defined in [@GlobalScope] (OK or FAILED). </description> </method> <method name="rename"> @@ -188,7 +188,7 @@ </argument> <description> Rename (move) the [i]from[/i] file to the [i]to[/i] destination. Both arguments should be paths to files, either relative or absolute. If the destination file exists and is not access-protected, it will be overwritten. - Return one of the error code constants defined in [@Global Scope] (OK or FAILED). + Return one of the error code constants defined in [@GlobalScope] (OK or FAILED). </description> </method> </methods> diff --git a/doc/classes/DynamicFont.xml b/doc/classes/DynamicFont.xml index d7f08c85a1..9149e14a62 100644 --- a/doc/classes/DynamicFont.xml +++ b/doc/classes/DynamicFont.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="DynamicFont" inherits="Font" category="Core" version="3.0.alpha.custom_build"> +<class name="DynamicFont" inherits="Font" category="Core" version="3.0-alpha"> <brief_description> DynamicFont renders vector font files at runtime. </brief_description> diff --git a/doc/classes/DynamicFontData.xml b/doc/classes/DynamicFontData.xml index 9012b46e08..26529006cb 100644 --- a/doc/classes/DynamicFontData.xml +++ b/doc/classes/DynamicFontData.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="DynamicFontData" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="DynamicFontData" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Used with [DynamicFont] to describe the location of a font file. </brief_description> diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml index b0ed24b767..a3bab32476 100644 --- a/doc/classes/EditorExportPlugin.xml +++ b/doc/classes/EditorExportPlugin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorExportPlugin" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorExportPlugin" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/EditorFileDialog.xml b/doc/classes/EditorFileDialog.xml index 6ae893f189..f29d9fd4dd 100644 --- a/doc/classes/EditorFileDialog.xml +++ b/doc/classes/EditorFileDialog.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorFileDialog" inherits="ConfirmationDialog" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorFileDialog" inherits="ConfirmationDialog" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/EditorFileSystem.xml b/doc/classes/EditorFileSystem.xml index 6a2f811425..afec85184c 100644 --- a/doc/classes/EditorFileSystem.xml +++ b/doc/classes/EditorFileSystem.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorFileSystem" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorFileSystem" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Resource filesystem, as the editor sees it. </brief_description> diff --git a/doc/classes/EditorFileSystemDirectory.xml b/doc/classes/EditorFileSystemDirectory.xml index 7d284f864e..99bca09eb6 100644 --- a/doc/classes/EditorFileSystemDirectory.xml +++ b/doc/classes/EditorFileSystemDirectory.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorFileSystemDirectory" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorFileSystemDirectory" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> A diretory for the resource filesystem. </brief_description> diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index c276a8f661..9836fb2527 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorImportPlugin" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorImportPlugin" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Registers a custom resource importer in the editor. Use the class to parse any file and import it as a new resource type. </brief_description> diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index 3a3fd43b15..0059804c00 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorInterface" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorInterface" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Editor interface and main components. </brief_description> @@ -127,7 +127,7 @@ <return type="int" enum="Error"> </return> <description> - Saves the scene. Returns either OK or ERR_CANT_CREATE. See [@Global Scope] constants. + Saves the scene. Returns either OK or ERR_CANT_CREATE. See [@GlobalScope] constants. </description> </method> <method name="save_scene_as"> diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index de79c3c85c..f9bdf1dcd5 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorPlugin" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorPlugin" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Used by the editor to extend its functionality. </brief_description> diff --git a/doc/classes/EditorResourceConversionPlugin.xml b/doc/classes/EditorResourceConversionPlugin.xml index e165ae376b..6fbb60ddf6 100644 --- a/doc/classes/EditorResourceConversionPlugin.xml +++ b/doc/classes/EditorResourceConversionPlugin.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorResourceConversionPlugin" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorResourceConversionPlugin" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/EditorResourcePreview.xml b/doc/classes/EditorResourcePreview.xml index 5174d9243b..44f60d4d2c 100644 --- a/doc/classes/EditorResourcePreview.xml +++ b/doc/classes/EditorResourcePreview.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorResourcePreview" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorResourcePreview" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Helper to generate previews of resources or files. </brief_description> diff --git a/doc/classes/EditorResourcePreviewGenerator.xml b/doc/classes/EditorResourcePreviewGenerator.xml index 231198516e..3de0dbc708 100644 --- a/doc/classes/EditorResourcePreviewGenerator.xml +++ b/doc/classes/EditorResourcePreviewGenerator.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorResourcePreviewGenerator" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorResourcePreviewGenerator" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Custom generator of previews. </brief_description> diff --git a/doc/classes/EditorScript.xml b/doc/classes/EditorScript.xml index 245dbc078d..1e46164fc6 100644 --- a/doc/classes/EditorScript.xml +++ b/doc/classes/EditorScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorScript" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorScript" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Base script that can be used to add extension functions to the editor. </brief_description> diff --git a/doc/classes/EditorSelection.xml b/doc/classes/EditorSelection.xml index a6dc60ee7b..999cb5e505 100644 --- a/doc/classes/EditorSelection.xml +++ b/doc/classes/EditorSelection.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorSelection" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorSelection" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Manages the SceneTree selection in the editor. </brief_description> diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 17a4d2fe4b..a0e4fdb8e0 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorSettings" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorSettings" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Object that holds the project-independent editor settings. </brief_description> @@ -23,7 +23,7 @@ <argument index="0" name="info" type="Dictionary"> </argument> <description> - Add a custom property info to a property. The dictionary must contain: name:[String](the name of the property) and type:[int](see TYPE_* in [@Global Scope]), and optionally hint:[int](see PROPERTY_HINT_* in [@Global Scope]), hint_string:[String]. + Add a custom property info to a property. The dictionary must contain: name:[String](the name of the property) and type:[int](see TYPE_* in [@GlobalScope]), and optionally hint:[int](see PROPERTY_HINT_* in [@GlobalScope]), hint_string:[String]. Example: [codeblock] editor_settings.set("category/property_name", 0) diff --git a/doc/classes/EditorSpatialGizmo.xml b/doc/classes/EditorSpatialGizmo.xml index 545eadeed2..758024c99b 100644 --- a/doc/classes/EditorSpatialGizmo.xml +++ b/doc/classes/EditorSpatialGizmo.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EditorSpatialGizmo" inherits="SpatialGizmo" category="Core" version="3.0.alpha.custom_build"> +<class name="EditorSpatialGizmo" inherits="SpatialGizmo" category="Core" version="3.0-alpha"> <brief_description> Custom gizmo for editing Spatial objects. </brief_description> @@ -24,7 +24,7 @@ </return> <argument index="0" name="triangles" type="TriangleMesh"> </argument> - <argument index="1" name="bounds" type="Rect3"> + <argument index="1" name="bounds" type="AABB"> </argument> <description> Add collision triangles to the gizmo for picking. A [TriangleMesh] can be generated from a regular [Mesh] too. Call this function during [method redraw]. diff --git a/doc/classes/EncodedObjectAsID.xml b/doc/classes/EncodedObjectAsID.xml index 412e60bf99..41839e3d01 100644 --- a/doc/classes/EncodedObjectAsID.xml +++ b/doc/classes/EncodedObjectAsID.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="EncodedObjectAsID" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="EncodedObjectAsID" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index 083688b416..f43bbc2e9d 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Engine" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="Engine" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Access to basic engine properties. </brief_description> @@ -39,6 +39,14 @@ Returns the main loop object (see [MainLoop] and [SceneTree]). </description> </method> + <method name="get_singleton" qualifiers="const"> + <return type="Object"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> <method name="get_target_fps" qualifiers="const"> <return type="float"> </return> @@ -67,6 +75,14 @@ "string" - major + minor + patch + status + revision in a single String </description> </method> + <method name="has_singleton" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <description> + </description> + </method> <method name="is_editor_hint" qualifiers="const"> <return type="bool"> </return> diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml index 4d40d5af9a..285caa8d0a 100644 --- a/doc/classes/Environment.xml +++ b/doc/classes/Environment.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Environment" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Environment" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Resource for environment nodes (like [WorldEnvironment]) that define multiple rendering options. </brief_description> diff --git a/doc/classes/File.xml b/doc/classes/File.xml index 6272d4105c..8ec56e9c48 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="File" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="File" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Type to handle file reading and writing operations. </brief_description> @@ -120,7 +120,7 @@ <return type="int" enum="Error"> </return> <description> - Returns the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [@Global Scope]. + Returns the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [@GlobalScope]. </description> </method> <method name="get_float" qualifiers="const"> diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml index b3d131ca40..7dda486ac9 100644 --- a/doc/classes/FileDialog.xml +++ b/doc/classes/FileDialog.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="FileDialog" inherits="ConfirmationDialog" category="Core" version="3.0.alpha.custom_build"> +<class name="FileDialog" inherits="ConfirmationDialog" category="Core" version="3.0-alpha"> <brief_description> Dialog for selecting files or directories in the filesystem. </brief_description> diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml index 2e2124cbd6..b83d66830f 100644 --- a/doc/classes/Font.xml +++ b/doc/classes/Font.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Font" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Font" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Internationalized font and text drawing support. </brief_description> diff --git a/doc/classes/FuncRef.xml b/doc/classes/FuncRef.xml index 987d750ced..65da5dd98f 100644 --- a/doc/classes/FuncRef.xml +++ b/doc/classes/FuncRef.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="FuncRef" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="FuncRef" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Reference to a function in an object. </brief_description> diff --git a/doc/classes/GIProbe.xml b/doc/classes/GIProbe.xml index 3f3d24aaaa..e445d94835 100644 --- a/doc/classes/GIProbe.xml +++ b/doc/classes/GIProbe.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GIProbe" inherits="VisualInstance" category="Core" version="3.0.alpha.custom_build"> +<class name="GIProbe" inherits="VisualInstance" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/GIProbeData.xml b/doc/classes/GIProbeData.xml index 6d47daf985..5d118be776 100644 --- a/doc/classes/GIProbeData.xml +++ b/doc/classes/GIProbeData.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GIProbeData" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="GIProbeData" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> @@ -16,7 +16,7 @@ </description> </method> <method name="get_bounds" qualifiers="const"> - <return type="Rect3"> + <return type="AABB"> </return> <description> </description> @@ -86,7 +86,7 @@ <method name="set_bounds"> <return type="void"> </return> - <argument index="0" name="bounds" type="Rect3"> + <argument index="0" name="bounds" type="AABB"> </argument> <description> </description> @@ -167,7 +167,7 @@ <members> <member name="bias" type="float" setter="set_bias" getter="get_bias"> </member> - <member name="bounds" type="Rect3" setter="set_bounds" getter="get_bounds"> + <member name="bounds" type="AABB" setter="set_bounds" getter="get_bounds"> </member> <member name="cell_size" type="float" setter="set_cell_size" getter="get_cell_size"> </member> diff --git a/doc/classes/Generic6DOFJoint.xml b/doc/classes/Generic6DOFJoint.xml index 89ec1fd836..202e461652 100644 --- a/doc/classes/Generic6DOFJoint.xml +++ b/doc/classes/Generic6DOFJoint.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Generic6DOFJoint" inherits="Joint" category="Core" version="3.0.alpha.custom_build"> +<class name="Generic6DOFJoint" inherits="Joint" category="Core" version="3.0-alpha"> <brief_description> The generic 6 degrees of freedom joint can implement a variety of joint-types by locking certain axes' rotation or translation. </brief_description> diff --git a/doc/classes/Geometry.xml b/doc/classes/Geometry.xml index 283d77c954..5da3ca0059 100644 --- a/doc/classes/Geometry.xml +++ b/doc/classes/Geometry.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Geometry" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="Geometry" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/GeometryInstance.xml b/doc/classes/GeometryInstance.xml index 57aec8be41..f21dbecd04 100644 --- a/doc/classes/GeometryInstance.xml +++ b/doc/classes/GeometryInstance.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GeometryInstance" inherits="VisualInstance" category="Core" version="3.0.alpha.custom_build"> +<class name="GeometryInstance" inherits="VisualInstance" category="Core" version="3.0-alpha"> <brief_description> Base node for geometry based visual instances. </brief_description> diff --git a/doc/classes/Gradient.xml b/doc/classes/Gradient.xml index e086ae86b1..d557ec11c5 100644 --- a/doc/classes/Gradient.xml +++ b/doc/classes/Gradient.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Gradient" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Gradient" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Color interpolator node. </brief_description> diff --git a/doc/classes/GradientTexture.xml b/doc/classes/GradientTexture.xml index eab8ea77af..88a776cb6a 100644 --- a/doc/classes/GradientTexture.xml +++ b/doc/classes/GradientTexture.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GradientTexture" inherits="Texture" category="Core" version="3.0.alpha.custom_build"> +<class name="GradientTexture" inherits="Texture" category="Core" version="3.0-alpha"> <brief_description> Gradient filled texture. </brief_description> diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml index 01d578be5e..a07809ce95 100644 --- a/doc/classes/GraphEdit.xml +++ b/doc/classes/GraphEdit.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GraphEdit" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="GraphEdit" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> GraphEdit is an area capable of showing various GraphNodes. It manages connection events between them. </brief_description> diff --git a/doc/classes/GraphNode.xml b/doc/classes/GraphNode.xml index e230390882..2ad0cc1182 100644 --- a/doc/classes/GraphNode.xml +++ b/doc/classes/GraphNode.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GraphNode" inherits="Container" category="Core" version="3.0.alpha.custom_build"> +<class name="GraphNode" inherits="Container" category="Core" version="3.0-alpha"> <brief_description> A GraphNode is a container with several input and output slots allowing connections between GraphNodes. Slots can have different, incompatible types. </brief_description> diff --git a/doc/classes/GridContainer.xml b/doc/classes/GridContainer.xml index 30976eff99..01bbed6ea7 100644 --- a/doc/classes/GridContainer.xml +++ b/doc/classes/GridContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GridContainer" inherits="Container" category="Core" version="3.0.alpha.custom_build"> +<class name="GridContainer" inherits="Container" category="Core" version="3.0-alpha"> <brief_description> Grid container used to arrange elements in a grid like layout </brief_description> diff --git a/doc/classes/GrooveJoint2D.xml b/doc/classes/GrooveJoint2D.xml index 412a4504c3..182bf5e8f1 100644 --- a/doc/classes/GrooveJoint2D.xml +++ b/doc/classes/GrooveJoint2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GrooveJoint2D" inherits="Joint2D" category="Core" version="3.0.alpha.custom_build"> +<class name="GrooveJoint2D" inherits="Joint2D" category="Core" version="3.0-alpha"> <brief_description> Groove constraint for 2D physics. </brief_description> diff --git a/doc/classes/HBoxContainer.xml b/doc/classes/HBoxContainer.xml index 2ffc2a8c57..6ee9a2c1f4 100644 --- a/doc/classes/HBoxContainer.xml +++ b/doc/classes/HBoxContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HBoxContainer" inherits="BoxContainer" category="Core" version="3.0.alpha.custom_build"> +<class name="HBoxContainer" inherits="BoxContainer" category="Core" version="3.0-alpha"> <brief_description> Horizontal box container. </brief_description> diff --git a/doc/classes/HScrollBar.xml b/doc/classes/HScrollBar.xml index 188995527c..7fe26ec863 100644 --- a/doc/classes/HScrollBar.xml +++ b/doc/classes/HScrollBar.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HScrollBar" inherits="ScrollBar" category="Core" version="3.0.alpha.custom_build"> +<class name="HScrollBar" inherits="ScrollBar" category="Core" version="3.0-alpha"> <brief_description> Horizontal scroll bar. </brief_description> diff --git a/doc/classes/HSeparator.xml b/doc/classes/HSeparator.xml index 351eee7ee6..487f83ec1d 100644 --- a/doc/classes/HSeparator.xml +++ b/doc/classes/HSeparator.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HSeparator" inherits="Separator" category="Core" version="3.0.alpha.custom_build"> +<class name="HSeparator" inherits="Separator" category="Core" version="3.0-alpha"> <brief_description> Horizontal separator. </brief_description> diff --git a/doc/classes/HSlider.xml b/doc/classes/HSlider.xml index 25e62b90e3..b4a97425f3 100644 --- a/doc/classes/HSlider.xml +++ b/doc/classes/HSlider.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HSlider" inherits="Slider" category="Core" version="3.0.alpha.custom_build"> +<class name="HSlider" inherits="Slider" category="Core" version="3.0-alpha"> <brief_description> Horizontal slider. </brief_description> diff --git a/doc/classes/HSplitContainer.xml b/doc/classes/HSplitContainer.xml index d7dc79a783..a107d30be7 100644 --- a/doc/classes/HSplitContainer.xml +++ b/doc/classes/HSplitContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HSplitContainer" inherits="SplitContainer" category="Core" version="3.0.alpha.custom_build"> +<class name="HSplitContainer" inherits="SplitContainer" category="Core" version="3.0-alpha"> <brief_description> Horizontal split container. </brief_description> diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml index f148545848..569c76ae0c 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HTTPClient" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="HTTPClient" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Hyper-text transfer protocol client. </brief_description> diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index b780d29d0e..a1a84d2211 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HTTPRequest" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="HTTPRequest" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> A Node with the ability to send HTTP requests. </brief_description> diff --git a/doc/classes/HingeJoint.xml b/doc/classes/HingeJoint.xml index d18e63f8a3..2d91549a66 100644 --- a/doc/classes/HingeJoint.xml +++ b/doc/classes/HingeJoint.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="HingeJoint" inherits="Joint" category="Core" version="3.0.alpha.custom_build"> +<class name="HingeJoint" inherits="Joint" category="Core" version="3.0-alpha"> <brief_description> A hinge between two 3D bodies. </brief_description> diff --git a/doc/classes/IP.xml b/doc/classes/IP.xml index fed7000df6..721cf07441 100644 --- a/doc/classes/IP.xml +++ b/doc/classes/IP.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="IP" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="IP" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> IP Protocol support functions. </brief_description> diff --git a/doc/classes/IP_Unix.xml b/doc/classes/IP_Unix.xml index d30ad795a8..bac7e374bb 100644 --- a/doc/classes/IP_Unix.xml +++ b/doc/classes/IP_Unix.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="IP_Unix" inherits="IP" category="Core" version="3.0.alpha.custom_build"> +<class name="IP_Unix" inherits="IP" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index 905a844094..b6eb26ce8c 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Image" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Image" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Image datatype. </brief_description> @@ -377,13 +377,13 @@ </argument> <description> Sets the [Color] of the pixel at [code](x, y)[/code] if the image is unlocked. Example: - [code] + [codeblock] var img = Image.new() img.lock() img.set_pixel(x, y, color) # Does not have an effect img.unlock() img.set_pixel(x, y, color) # Works - [/code]. + [/codeblock] </description> </method> <method name="shrink_x2"> diff --git a/doc/classes/ImageTexture.xml b/doc/classes/ImageTexture.xml index b392252399..d179794c1f 100644 --- a/doc/classes/ImageTexture.xml +++ b/doc/classes/ImageTexture.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ImageTexture" inherits="Texture" category="Core" version="3.0.alpha.custom_build"> +<class name="ImageTexture" inherits="Texture" category="Core" version="3.0-alpha"> <brief_description> A [Texture] based on an [Image]. </brief_description> diff --git a/doc/classes/ImmediateGeometry.xml b/doc/classes/ImmediateGeometry.xml index cd7074aeaf..7ad09c3fe9 100644 --- a/doc/classes/ImmediateGeometry.xml +++ b/doc/classes/ImmediateGeometry.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ImmediateGeometry" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build"> +<class name="ImmediateGeometry" inherits="GeometryInstance" category="Core" version="3.0-alpha"> <brief_description> Draws simple geometry from code. </brief_description> diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index d2d01dacb4..114c8d2c59 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Input" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="Input" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> A Singleton that deals with inputs. </brief_description> @@ -75,7 +75,7 @@ <argument index="1" name="axis" type="int"> </argument> <description> - Returns the current value of the joypad axis at given index (see [code]JOY_*[/code] constants in [@Global Scope]) + Returns the current value of the joypad axis at given index (see [code]JOY_*[/code] constants in [@GlobalScope]) </description> </method> <method name="get_joy_axis_index_from_string"> @@ -209,7 +209,7 @@ <argument index="1" name="button" type="int"> </argument> <description> - Returns [code]true[/code] if you are pressing the joypad button. (see [code]JOY_*[/code] constants in [@Global Scope]) + Returns [code]true[/code] if you are pressing the joypad button. (see [code]JOY_*[/code] constants in [@GlobalScope]) </description> </method> <method name="is_joy_known"> @@ -218,7 +218,7 @@ <argument index="0" name="device" type="int"> </argument> <description> - Returns [code]true[/code] if the system knows the specified device. This means that it sets all button and axis indices exactly as defined in the [code]JOY_*[/code] constants (see [@Global Scope]). Unknown joypads are not expected to match these constants, but you can still retrieve events from them. + Returns [code]true[/code] if the system knows the specified device. This means that it sets all button and axis indices exactly as defined in the [code]JOY_*[/code] constants (see [@GlobalScope]). Unknown joypads are not expected to match these constants, but you can still retrieve events from them. </description> </method> <method name="is_key_pressed" qualifiers="const"> @@ -227,7 +227,7 @@ <argument index="0" name="scancode" type="int"> </argument> <description> - Returns [code]true[/code] if you are pressing the key. You can pass [code]KEY_*[/code], which are pre-defined constants listed in [@Global Scope]. + Returns [code]true[/code] if you are pressing the key. You can pass [code]KEY_*[/code], which are pre-defined constants listed in [@GlobalScope]. </description> </method> <method name="is_mouse_button_pressed" qualifiers="const"> @@ -236,7 +236,7 @@ <argument index="0" name="button" type="int"> </argument> <description> - Returns [code]true[/code] if you are pressing the mouse button. You can pass [code]BUTTON_*[/code], which are pre-defined constants listed in [@Global Scope]. + Returns [code]true[/code] if you are pressing the mouse button. You can pass [code]BUTTON_*[/code], which are pre-defined constants listed in [@GlobalScope]. </description> </method> <method name="joy_connection_changed"> diff --git a/doc/classes/InputDefault.xml b/doc/classes/InputDefault.xml index cb8ad6b823..9cbc993af1 100644 --- a/doc/classes/InputDefault.xml +++ b/doc/classes/InputDefault.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputDefault" inherits="Input" category="Core" version="3.0.alpha.custom_build"> +<class name="InputDefault" inherits="Input" category="Core" version="3.0-alpha"> <brief_description> Default implementation of the [Input] class. </brief_description> diff --git a/doc/classes/InputEvent.xml b/doc/classes/InputEvent.xml index c6abf2fee5..e4404fc258 100644 --- a/doc/classes/InputEvent.xml +++ b/doc/classes/InputEvent.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEvent" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEvent" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Generic input event </brief_description> @@ -18,7 +18,7 @@ <argument index="0" name="event" type="InputEvent"> </argument> <description> - Returns [code]true[/code] if this event matches [code]event[event]. + Returns [code]true[/code] if this event matches [code]event[/code]. </description> </method> <method name="as_text" qualifiers="const"> diff --git a/doc/classes/InputEventAction.xml b/doc/classes/InputEventAction.xml index d97f1d4a2e..383f8360fb 100644 --- a/doc/classes/InputEventAction.xml +++ b/doc/classes/InputEventAction.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventAction" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEventAction" inherits="InputEvent" category="Core" version="3.0-alpha"> <brief_description> Input event type for actions. </brief_description> <description> - Contains a generic action which can be targeted from several type of inputs. Actions can be created from the project settings menu [code]Project > Project Settings > Input Map[/Code]. See [method Node._input]. + Contains a generic action which can be targeted from several type of inputs. Actions can be created from the project settings menu [code]Project > Project Settings > Input Map[/code]. See [method Node._input]. </description> <tutorials> http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html#actions diff --git a/doc/classes/InputEventJoypadButton.xml b/doc/classes/InputEventJoypadButton.xml index f13a1102b7..fecd65e6a2 100644 --- a/doc/classes/InputEventJoypadButton.xml +++ b/doc/classes/InputEventJoypadButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventJoypadButton" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEventJoypadButton" inherits="InputEvent" category="Core" version="3.0-alpha"> <brief_description> Input event for gamepad buttons. </brief_description> diff --git a/doc/classes/InputEventJoypadMotion.xml b/doc/classes/InputEventJoypadMotion.xml index a7c585a55d..a89c91fbe6 100644 --- a/doc/classes/InputEventJoypadMotion.xml +++ b/doc/classes/InputEventJoypadMotion.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventJoypadMotion" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEventJoypadMotion" inherits="InputEvent" category="Core" version="3.0-alpha"> <brief_description> Input event type for gamepad joysticks and other motions. For buttons see [code]InputEventJoypadMotion[/code]. </brief_description> diff --git a/doc/classes/InputEventKey.xml b/doc/classes/InputEventKey.xml index 9565584a4f..440e1347f8 100644 --- a/doc/classes/InputEventKey.xml +++ b/doc/classes/InputEventKey.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventKey" inherits="InputEventWithModifiers" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEventKey" inherits="InputEventWithModifiers" category="Core" version="3.0-alpha"> <brief_description> Input event type for keyboard events. </brief_description> diff --git a/doc/classes/InputEventMouse.xml b/doc/classes/InputEventMouse.xml index 38eec74ffa..24a771cef3 100644 --- a/doc/classes/InputEventMouse.xml +++ b/doc/classes/InputEventMouse.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventMouse" inherits="InputEventWithModifiers" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEventMouse" inherits="InputEventWithModifiers" category="Core" version="3.0-alpha"> <brief_description> Base input event type for mouse events. </brief_description> @@ -57,7 +57,7 @@ </methods> <members> <member name="button_mask" type="int" setter="set_button_mask" getter="get_button_mask"> - Mouse button mask identifier, one of or a bitwise combination of the BUTTON_MASK_* constants in [@Global Scope]. + Mouse button mask identifier, one of or a bitwise combination of the BUTTON_MASK_* constants in [@GlobalScope]. </member> <member name="global_position" type="Vector2" setter="set_global_position" getter="get_global_position"> Mouse position relative to the current [Viewport] when used in [method Control._gui_input], otherwise is at 0,0. diff --git a/doc/classes/InputEventMouseButton.xml b/doc/classes/InputEventMouseButton.xml index afc0c331c8..ff7c1da34e 100644 --- a/doc/classes/InputEventMouseButton.xml +++ b/doc/classes/InputEventMouseButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventMouseButton" inherits="InputEventMouse" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEventMouseButton" inherits="InputEventMouse" category="Core" version="3.0-alpha"> <brief_description> Input event type for mouse button events. </brief_description> @@ -65,7 +65,7 @@ </methods> <members> <member name="button_index" type="int" setter="set_button_index" getter="get_button_index"> - Mouse button identifier, one of the BUTTON_* or BUTTON_WHEEL_* constants in [@Global Scope]. + Mouse button identifier, one of the BUTTON_* or BUTTON_WHEEL_* constants in [@GlobalScope]. </member> <member name="doubleclick" type="bool" setter="set_doubleclick" getter="is_doubleclick"> If [code]true[/code] the mouse button's state is a double-click. If [code]false[/code] the mouse button's state is released. diff --git a/doc/classes/InputEventMouseMotion.xml b/doc/classes/InputEventMouseMotion.xml index 5be82e1ffa..6c9165fea8 100644 --- a/doc/classes/InputEventMouseMotion.xml +++ b/doc/classes/InputEventMouseMotion.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventMouseMotion" inherits="InputEventMouse" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEventMouseMotion" inherits="InputEventMouse" category="Core" version="3.0-alpha"> <brief_description> Input event type for mouse motion events. </brief_description> diff --git a/doc/classes/InputEventScreenDrag.xml b/doc/classes/InputEventScreenDrag.xml index 0c92ad5f70..a68f444a7c 100644 --- a/doc/classes/InputEventScreenDrag.xml +++ b/doc/classes/InputEventScreenDrag.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventScreenDrag" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEventScreenDrag" inherits="InputEvent" category="Core" version="3.0-alpha"> <brief_description> Input event type for screen drag events. (only available on mobile devices) diff --git a/doc/classes/InputEventScreenTouch.xml b/doc/classes/InputEventScreenTouch.xml index 01ba9f1285..d0c7181e84 100644 --- a/doc/classes/InputEventScreenTouch.xml +++ b/doc/classes/InputEventScreenTouch.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventScreenTouch" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEventScreenTouch" inherits="InputEvent" category="Core" version="3.0-alpha"> <brief_description> Input event type for screen touch events. (only available on mobile devices) diff --git a/doc/classes/InputEventWithModifiers.xml b/doc/classes/InputEventWithModifiers.xml index 46107a4ab8..8e5ffed149 100644 --- a/doc/classes/InputEventWithModifiers.xml +++ b/doc/classes/InputEventWithModifiers.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputEventWithModifiers" inherits="InputEvent" category="Core" version="3.0.alpha.custom_build"> +<class name="InputEventWithModifiers" inherits="InputEvent" category="Core" version="3.0-alpha"> <brief_description> Base class for keys events with modifiers. </brief_description> diff --git a/doc/classes/InputMap.xml b/doc/classes/InputMap.xml index 99b77dab36..d5a1d85def 100644 --- a/doc/classes/InputMap.xml +++ b/doc/classes/InputMap.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InputMap" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="InputMap" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Singleton that manages [InputEventAction]. </brief_description> <description> - Manages all [InputEventAction] which can be created/modified from the project settings menu [code]Project > Project Settings > Input Map[/Code] or in code with [method add_action] and [method action_add_event]. See [method Node._input]. + Manages all [InputEventAction] which can be created/modified from the project settings menu [code]Project > Project Settings > Input Map[/code] or in code with [method add_action] and [method action_add_event]. See [method Node._input]. </description> <tutorials> http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html#inputmap diff --git a/doc/classes/InstancePlaceholder.xml b/doc/classes/InstancePlaceholder.xml index e962192f81..4105065cb6 100644 --- a/doc/classes/InstancePlaceholder.xml +++ b/doc/classes/InstancePlaceholder.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InstancePlaceholder" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="InstancePlaceholder" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Placeholder for the root [Node] of a [PackedScene]. </brief_description> diff --git a/doc/classes/InterpolatedCamera.xml b/doc/classes/InterpolatedCamera.xml index 5e5ce59a8b..bd532bec85 100644 --- a/doc/classes/InterpolatedCamera.xml +++ b/doc/classes/InterpolatedCamera.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="InterpolatedCamera" inherits="Camera" category="Core" version="3.0.alpha.custom_build"> +<class name="InterpolatedCamera" inherits="Camera" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml index 37c1db51f5..950b43417b 100644 --- a/doc/classes/ItemList.xml +++ b/doc/classes/ItemList.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ItemList" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="ItemList" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Control that provides a list of selectable items (and/or icons) in a single column, or optionally in multiple columns. </brief_description> diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml index 8bff140bb4..e945a580db 100644 --- a/doc/classes/JSON.xml +++ b/doc/classes/JSON.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="JSON" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="JSON" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Helper class for parsing JSON data. </brief_description> diff --git a/doc/classes/JSONParseResult.xml b/doc/classes/JSONParseResult.xml index 2d163c4a80..5bf9298f7a 100644 --- a/doc/classes/JSONParseResult.xml +++ b/doc/classes/JSONParseResult.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="JSONParseResult" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="JSONParseResult" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Data class wrapper for decoded JSON. </brief_description> @@ -70,13 +70,13 @@ </methods> <members> <member name="error" type="int" setter="set_error" getter="get_error" enum="Error"> - The error type if JSON source was not successfully parsed. See [@Global Scope]ERR_* constants. + The error type if JSON source was not successfully parsed. See [@GlobalScope]ERR_* constants. </member> <member name="error_line" type="int" setter="set_error_line" getter="get_error_line"> The line number where the error occurred if JSON source was not successfully parsed. </member> <member name="error_string" type="String" setter="set_error_string" getter="get_error_string"> - The error message if JSON source was not successfully parsed. See [@Global Scope]ERR_* constants. + The error message if JSON source was not successfully parsed. See [@GlobalScope]ERR_* constants. </member> <member name="result" type="Variant" setter="set_result" getter="get_result"> A [Variant] containing the parsed JSON. Use typeof() to check if it is what you expect. For example, if JSON source starts with braces [code]{}[/code] a [Dictionary] will be returned, if JSON source starts with array braces [code][][/code] an [Array] will be returned. diff --git a/doc/classes/JavaScript.xml b/doc/classes/JavaScript.xml new file mode 100644 index 0000000000..9dd386f08e --- /dev/null +++ b/doc/classes/JavaScript.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="JavaScript" inherits="Object" category="Core" version="3.0-alpha"> + <brief_description> + Singleton that connects the engine with the browser's JavaScript context in HTML5 export. + </brief_description> + <description> + The JavaScript singleton is implemented only in HTML5 export. It's used to access the browser's JavaScript context. This allows interaction with embedding pages or calling third-party JavaScript APIs. + </description> + <tutorials> + http://docs.godotengine.org/en/stable/learning/workflow/export/exporting_for_web.html#calling-javascript-from-script + </tutorials> + <demos> + </demos> + <methods> + <method name="eval"> + <return type="Variant"> + </return> + <argument index="0" name="code" type="String"> + </argument> + <argument index="1" name="use_global_execution_context" type="bool" default="false"> + </argument> + <description> + Execute the string [code]code[/code] as JavaScript code within the browser window. This is a call to the actual global JavaScript function [code]eval()[/code]. + If [code]use_global_execution_context[/code] is [code]true[/code], the code will be evaluated in the global execution context. Otherwise, it is evaluated in the execution context of a function within the engine's runtime environment. + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/Joint.xml b/doc/classes/Joint.xml index 901f84fe5e..30ece8df1f 100644 --- a/doc/classes/Joint.xml +++ b/doc/classes/Joint.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Joint" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="Joint" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Base class for all 3D joints </brief_description> diff --git a/doc/classes/Joint2D.xml b/doc/classes/Joint2D.xml index b9caa7ef4b..df70a04f10 100644 --- a/doc/classes/Joint2D.xml +++ b/doc/classes/Joint2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Joint2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Joint2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Base node for all joint constraints in 2D physics. </brief_description> diff --git a/doc/classes/KinematicBody.xml b/doc/classes/KinematicBody.xml index f80c00ed6d..a423974753 100644 --- a/doc/classes/KinematicBody.xml +++ b/doc/classes/KinematicBody.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="KinematicBody" inherits="PhysicsBody" category="Core" version="3.0.alpha.custom_build"> +<class name="KinematicBody" inherits="PhysicsBody" category="Core" version="3.0-alpha"> <brief_description> Kinematic body 3D node. </brief_description> @@ -32,7 +32,7 @@ <argument index="0" name="slide_idx" type="int"> </argument> <description> - Returns a [KinematicCollision], which contains information about a collision that occured during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count]()-1). + Returns a [KinematicCollision], which contains information about a collision that occured during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count] - 1). </description> </method> <method name="get_slide_count" qualifiers="const"> diff --git a/doc/classes/KinematicBody2D.xml b/doc/classes/KinematicBody2D.xml index 798fc4153c..7285c780e5 100644 --- a/doc/classes/KinematicBody2D.xml +++ b/doc/classes/KinematicBody2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="KinematicBody2D" inherits="PhysicsBody2D" category="Core" version="3.0.alpha.custom_build"> +<class name="KinematicBody2D" inherits="PhysicsBody2D" category="Core" version="3.0-alpha"> <brief_description> Kinematic body 2D node. </brief_description> @@ -32,7 +32,7 @@ <argument index="0" name="slide_idx" type="int"> </argument> <description> - Returns a [KinematicCollision2D], which contains information about a collision that occured during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count]()-1). + Returns a [KinematicCollision2D], which contains information about a collision that occured during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count] - 1). </description> </method> <method name="get_slide_count" qualifiers="const"> diff --git a/doc/classes/KinematicCollision.xml b/doc/classes/KinematicCollision.xml index b7269a646e..ce82004839 100644 --- a/doc/classes/KinematicCollision.xml +++ b/doc/classes/KinematicCollision.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="KinematicCollision" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="KinematicCollision" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Collision data for KinematicBody2D collisions. </brief_description> diff --git a/doc/classes/KinematicCollision2D.xml b/doc/classes/KinematicCollision2D.xml index 7a40a39292..e498dea7a5 100644 --- a/doc/classes/KinematicCollision2D.xml +++ b/doc/classes/KinematicCollision2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="KinematicCollision2D" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="KinematicCollision2D" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Collision data for KinematicBody2D collisions. </brief_description> diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml index 1d1ce63a58..93d7b20491 100644 --- a/doc/classes/Label.xml +++ b/doc/classes/Label.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Label" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="Label" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Displays plain text in a line or wrapped inside a rectangle. For formatted text, use [RichTextLabel]. </brief_description> diff --git a/doc/classes/LargeTexture.xml b/doc/classes/LargeTexture.xml index f5416488f6..6ec3c80bca 100644 --- a/doc/classes/LargeTexture.xml +++ b/doc/classes/LargeTexture.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="LargeTexture" inherits="Texture" category="Core" version="3.0.alpha.custom_build"> +<class name="LargeTexture" inherits="Texture" category="Core" version="3.0-alpha"> <brief_description> A Texture capable of storing many smaller Textures with offsets. </brief_description> diff --git a/doc/classes/Light.xml b/doc/classes/Light.xml index fd3ecc7365..1c625d59e1 100644 --- a/doc/classes/Light.xml +++ b/doc/classes/Light.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Light" inherits="VisualInstance" category="Core" version="3.0.alpha.custom_build"> +<class name="Light" inherits="VisualInstance" category="Core" version="3.0-alpha"> <brief_description> Provides a base class for different kinds of light nodes. </brief_description> diff --git a/doc/classes/Light2D.xml b/doc/classes/Light2D.xml index 05054e06fd..285d302ba7 100644 --- a/doc/classes/Light2D.xml +++ b/doc/classes/Light2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Light2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Light2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Casts light in a 2D environment. </brief_description> diff --git a/doc/classes/LightOccluder2D.xml b/doc/classes/LightOccluder2D.xml index babcf31c08..9a1b84158b 100644 --- a/doc/classes/LightOccluder2D.xml +++ b/doc/classes/LightOccluder2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="LightOccluder2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="LightOccluder2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Occludes light cast by a Light2D, casting shadows. </brief_description> diff --git a/doc/classes/Line2D.xml b/doc/classes/Line2D.xml index 3cca256a5d..7b76d94c95 100644 --- a/doc/classes/Line2D.xml +++ b/doc/classes/Line2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Line2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Line2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> A 2D line. </brief_description> @@ -63,7 +63,7 @@ <argument index="0" name="i" type="int"> </argument> <description> - Returns point [code]i[code]'s position. + Returns point [code]i[/code]'s position. </description> </method> <method name="get_points" qualifiers="const"> diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index a9626d945c..432f583566 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="LineEdit" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="LineEdit" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Control that provides single line string editing. </brief_description> diff --git a/doc/classes/LineShape2D.xml b/doc/classes/LineShape2D.xml index 5596c48162..6ae6fad6f4 100644 --- a/doc/classes/LineShape2D.xml +++ b/doc/classes/LineShape2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="LineShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build"> +<class name="LineShape2D" inherits="Shape2D" category="Core" version="3.0-alpha"> <brief_description> Line shape for 2D collisions. </brief_description> diff --git a/doc/classes/LinkButton.xml b/doc/classes/LinkButton.xml index 5e7f467684..d13a0d7be6 100644 --- a/doc/classes/LinkButton.xml +++ b/doc/classes/LinkButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="LinkButton" inherits="BaseButton" category="Core" version="3.0.alpha.custom_build"> +<class name="LinkButton" inherits="BaseButton" category="Core" version="3.0-alpha"> <brief_description> Simple button used to represent a link to some resource </brief_description> diff --git a/doc/classes/Listener.xml b/doc/classes/Listener.xml index 176369cccb..742198acd0 100644 --- a/doc/classes/Listener.xml +++ b/doc/classes/Listener.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Listener" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="Listener" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/MainLoop.xml b/doc/classes/MainLoop.xml index f8343467af..048b13a7ca 100644 --- a/doc/classes/MainLoop.xml +++ b/doc/classes/MainLoop.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MainLoop" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="MainLoop" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Main loop is the abstract main loop base class. </brief_description> diff --git a/doc/classes/MarginContainer.xml b/doc/classes/MarginContainer.xml index d4b9b01f63..1c748de229 100644 --- a/doc/classes/MarginContainer.xml +++ b/doc/classes/MarginContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MarginContainer" inherits="Container" category="Core" version="3.0.alpha.custom_build"> +<class name="MarginContainer" inherits="Container" category="Core" version="3.0-alpha"> <brief_description> Simple margin container. </brief_description> diff --git a/doc/classes/Marshalls.xml b/doc/classes/Marshalls.xml index b443d03108..0e561ab374 100644 --- a/doc/classes/Marshalls.xml +++ b/doc/classes/Marshalls.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Marshalls" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="Marshalls" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Data transformation (marshalling) and encoding helpers. </brief_description> diff --git a/doc/classes/Material.xml b/doc/classes/Material.xml index 88b35ac6b5..87c2e51003 100644 --- a/doc/classes/Material.xml +++ b/doc/classes/Material.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Material" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Material" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Abstract base [Resource] for coloring and shading geometry. </brief_description> diff --git a/doc/classes/MenuButton.xml b/doc/classes/MenuButton.xml index f1ab74d00e..54be44d3d8 100644 --- a/doc/classes/MenuButton.xml +++ b/doc/classes/MenuButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MenuButton" inherits="Button" category="Core" version="3.0.alpha.custom_build"> +<class name="MenuButton" inherits="Button" category="Core" version="3.0-alpha"> <brief_description> Special button that brings up a [PopupMenu] when clicked. </brief_description> diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml index 658265d242..733f76728c 100644 --- a/doc/classes/Mesh.xml +++ b/doc/classes/Mesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Mesh" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Mesh" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> A [Resource] that contains vertex-array based geometry. </brief_description> diff --git a/doc/classes/MeshDataTool.xml b/doc/classes/MeshDataTool.xml index 6088d30013..f433d7a753 100644 --- a/doc/classes/MeshDataTool.xml +++ b/doc/classes/MeshDataTool.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MeshDataTool" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="MeshDataTool" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/MeshInstance.xml b/doc/classes/MeshInstance.xml index 56b446cac1..5bd6bedf7e 100644 --- a/doc/classes/MeshInstance.xml +++ b/doc/classes/MeshInstance.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MeshInstance" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build"> +<class name="MeshInstance" inherits="GeometryInstance" category="Core" version="3.0-alpha"> <brief_description> Node that instances meshes into a scenario. </brief_description> diff --git a/doc/classes/MeshLibrary.xml b/doc/classes/MeshLibrary.xml index 5636db23b5..54a8228d02 100644 --- a/doc/classes/MeshLibrary.xml +++ b/doc/classes/MeshLibrary.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MeshLibrary" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="MeshLibrary" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Library of meshes. </brief_description> diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml index 6df9689ada..b6a89d09f4 100644 --- a/doc/classes/MultiMesh.xml +++ b/doc/classes/MultiMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MultiMesh" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="MultiMesh" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Provides high performance mesh instancing. </brief_description> @@ -7,7 +7,7 @@ MultiMesh provides low level mesh instancing. If the amount of [Mesh] instances needed goes from hundreds to thousands (and most need to be visible at close proximity) creating such a large amount of [MeshInstance] nodes may affect performance by using too much CPU or video memory. For this case a MultiMesh becomes very useful, as it can draw thousands of instances with little API overhead. As a drawback, if the instances are too far away of each other, performance may be reduced as every single instance will always rendered (they are spatially indexed as one, for the whole object). - Since instances may have any behavior, the Rect3 used for visibility must be provided by the user. + Since instances may have any behavior, the AABB used for visibility must be provided by the user. </description> <tutorials> </tutorials> @@ -15,10 +15,10 @@ </demos> <methods> <method name="get_aabb" qualifiers="const"> - <return type="Rect3"> + <return type="AABB"> </return> <description> - Return the visibility Rect3. + Return the visibility AABB. </description> </method> <method name="get_color_format" qualifiers="const"> diff --git a/doc/classes/MultiMeshInstance.xml b/doc/classes/MultiMeshInstance.xml index 06454e3cdc..11e22c2581 100644 --- a/doc/classes/MultiMeshInstance.xml +++ b/doc/classes/MultiMeshInstance.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MultiMeshInstance" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build"> +<class name="MultiMeshInstance" inherits="GeometryInstance" category="Core" version="3.0-alpha"> <brief_description> Node that instances a [MultiMesh]. </brief_description> diff --git a/doc/classes/Mutex.xml b/doc/classes/Mutex.xml index 3d0c8eb1df..d36dbb64c1 100644 --- a/doc/classes/Mutex.xml +++ b/doc/classes/Mutex.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Mutex" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="Mutex" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> A synchronization Mutex. </brief_description> diff --git a/doc/classes/Navigation.xml b/doc/classes/Navigation.xml index 3e063f6a82..c83e81b197 100644 --- a/doc/classes/Navigation.xml +++ b/doc/classes/Navigation.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Navigation" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="Navigation" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Navigation2D.xml b/doc/classes/Navigation2D.xml index ab10463a5d..ac2e0d88d8 100644 --- a/doc/classes/Navigation2D.xml +++ b/doc/classes/Navigation2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Navigation2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Navigation2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/NavigationMesh.xml b/doc/classes/NavigationMesh.xml index 788fadfd77..dd49b0a593 100644 --- a/doc/classes/NavigationMesh.xml +++ b/doc/classes/NavigationMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NavigationMesh" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="NavigationMesh" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/NavigationMeshInstance.xml b/doc/classes/NavigationMeshInstance.xml index 6d3a81a939..1e8998009e 100644 --- a/doc/classes/NavigationMeshInstance.xml +++ b/doc/classes/NavigationMeshInstance.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NavigationMeshInstance" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="NavigationMeshInstance" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/NavigationPolygon.xml b/doc/classes/NavigationPolygon.xml index 07eb4afb8d..fd7238114e 100644 --- a/doc/classes/NavigationPolygon.xml +++ b/doc/classes/NavigationPolygon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NavigationPolygon" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="NavigationPolygon" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/NavigationPolygonInstance.xml b/doc/classes/NavigationPolygonInstance.xml index a6d70d5b4b..ac56b03002 100644 --- a/doc/classes/NavigationPolygonInstance.xml +++ b/doc/classes/NavigationPolygonInstance.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NavigationPolygonInstance" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="NavigationPolygonInstance" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/NetworkedMultiplayerPeer.xml b/doc/classes/NetworkedMultiplayerPeer.xml index 3ac3895df2..4333c3d28a 100644 --- a/doc/classes/NetworkedMultiplayerPeer.xml +++ b/doc/classes/NetworkedMultiplayerPeer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NetworkedMultiplayerPeer" inherits="PacketPeer" category="Core" version="3.0.alpha.custom_build"> +<class name="NetworkedMultiplayerPeer" inherits="PacketPeer" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Nil.xml b/doc/classes/Nil.xml index de12ad1261..a4bd60d53e 100644 --- a/doc/classes/Nil.xml +++ b/doc/classes/Nil.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Nil" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Nil" category="Built-In Types" version="3.0-alpha"> <brief_description> </brief_description> <description> @@ -100,7 +100,7 @@ </description> </method> <method name="Nil"> - <argument index="0" name="from" type="Rect3"> + <argument index="0" name="from" type="AABB"> </argument> <description> </description> diff --git a/doc/classes/NinePatchRect.xml b/doc/classes/NinePatchRect.xml index c74f3c5a68..2c8bce52a0 100644 --- a/doc/classes/NinePatchRect.xml +++ b/doc/classes/NinePatchRect.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NinePatchRect" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="NinePatchRect" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Scalable texture-based frame that tiles the texture's centers and sides, but keeps the corners' original size. Perfect for panels and dialog boxes. </brief_description> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 7ec4bbb8b5..a103d0eba0 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Node" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="Node" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Base class for all the [i]scene[/i] elements. </brief_description> diff --git a/doc/classes/Node2D.xml b/doc/classes/Node2D.xml index 2fdc6bf440..195dd9265f 100644 --- a/doc/classes/Node2D.xml +++ b/doc/classes/Node2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Node2D" inherits="CanvasItem" category="Core" version="3.0.alpha.custom_build"> +<class name="Node2D" inherits="CanvasItem" category="Core" version="3.0-alpha"> <brief_description> A 2D game object, parent of all 2D related nodes. Has a position, rotation, scale and Z-index. </brief_description> diff --git a/doc/classes/NodePath.xml b/doc/classes/NodePath.xml index ba2145482f..c706864379 100644 --- a/doc/classes/NodePath.xml +++ b/doc/classes/NodePath.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NodePath" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="NodePath" category="Built-In Types" version="3.0-alpha"> <brief_description> Pre-parsed scene tree path. </brief_description> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 9fd4328402..db70b99de4 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="OS" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="OS" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Operating System functions. </brief_description> diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 5ba5299a77..bea4c14a3c 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="Object" category="Core" version="3.0-alpha"> <brief_description> Base class for all non built-in types. </brief_description> @@ -28,7 +28,7 @@ <return type="Array"> </return> <description> - Returns the object's property list as an [Array] of dictionaries. Dictionaries must contain: name:String, type:int (see TYPE_* enum in [@Global Scope]) and optionally: hint:int (see PROPERTY_HINT_* in [@Global Scope]), hint_string:String, usage:int (see PROPERTY_USAGE_* in [@Global Scope]). + Returns the object's property list as an [Array] of dictionaries. Dictionaries must contain: name:String, type:int (see TYPE_* enum in [@GlobalScope]) and optionally: hint:int (see PROPERTY_HINT_* in [@GlobalScope]), hint_string:String, usage:int (see PROPERTY_USAGE_* in [@GlobalScope]). </description> </method> <method name="_init" qualifiers="virtual"> @@ -66,7 +66,7 @@ <argument index="1" name="arguments" type="Array" default="[ ]"> </argument> <description> - Adds a user-defined [code]signal[/code]. Arguments are optional, but can be added as an [Array] of dictionaries, each containing "name" and "type" (from [@Global Scope] TYPE_*). + Adds a user-defined [code]signal[/code]. Arguments are optional, but can be added as an [Array] of dictionaries, each containing "name" and "type" (from [@GlobalScope] TYPE_*). </description> </method> <method name="call" qualifiers="vararg"> @@ -212,7 +212,7 @@ <return type="Array"> </return> <description> - Returns the list of properties as an [Array] of dictionaries. Dictionaries contain: name:String, type:int (see TYPE_* enum in [@Global Scope]) and optionally: hint:int (see PROPERTY_HINT_* in [@Global Scope]), hint_string:String, usage:int (see PROPERTY_USAGE_* in [@Global Scope]). + Returns the list of properties as an [Array] of dictionaries. Dictionaries contain: name:String, type:int (see TYPE_* enum in [@GlobalScope]) and optionally: hint:int (see PROPERTY_HINT_* in [@GlobalScope]), hint_string:String, usage:int (see PROPERTY_USAGE_* in [@GlobalScope]). </description> </method> <method name="get_script" qualifiers="const"> diff --git a/doc/classes/OccluderPolygon2D.xml b/doc/classes/OccluderPolygon2D.xml index 7bc1f74762..e86aa999ad 100644 --- a/doc/classes/OccluderPolygon2D.xml +++ b/doc/classes/OccluderPolygon2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="OccluderPolygon2D" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="OccluderPolygon2D" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Defines a 2D polygon for LightOccluder2D. </brief_description> diff --git a/doc/classes/OmniLight.xml b/doc/classes/OmniLight.xml index cb8e756a4c..7c8b1d4756 100644 --- a/doc/classes/OmniLight.xml +++ b/doc/classes/OmniLight.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="OmniLight" inherits="Light" category="Core" version="3.0.alpha.custom_build"> +<class name="OmniLight" inherits="Light" category="Core" version="3.0-alpha"> <brief_description> OmniDirectional Light, such as a light bulb or a candle. </brief_description> diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml index 08ea23f05a..e08b5cac16 100644 --- a/doc/classes/OptionButton.xml +++ b/doc/classes/OptionButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="OptionButton" inherits="Button" category="Core" version="3.0.alpha.custom_build"> +<class name="OptionButton" inherits="Button" category="Core" version="3.0-alpha"> <brief_description> Button control that provides selectable options when pressed. </brief_description> diff --git a/doc/classes/PCKPacker.xml b/doc/classes/PCKPacker.xml index cf8efdf6be..4677c15b7b 100644 --- a/doc/classes/PCKPacker.xml +++ b/doc/classes/PCKPacker.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PCKPacker" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="PCKPacker" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PHashTranslation.xml b/doc/classes/PHashTranslation.xml index b25ddcbf22..c74cc8793f 100644 --- a/doc/classes/PHashTranslation.xml +++ b/doc/classes/PHashTranslation.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PHashTranslation" inherits="Translation" category="Core" version="3.0.alpha.custom_build"> +<class name="PHashTranslation" inherits="Translation" category="Core" version="3.0-alpha"> <brief_description> Optimized translation. </brief_description> diff --git a/doc/classes/PackedDataContainer.xml b/doc/classes/PackedDataContainer.xml index 660a39f210..6e660b983a 100644 --- a/doc/classes/PackedDataContainer.xml +++ b/doc/classes/PackedDataContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PackedDataContainer" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="PackedDataContainer" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PackedDataContainerRef.xml b/doc/classes/PackedDataContainerRef.xml index 413cd4468b..9d44307afe 100644 --- a/doc/classes/PackedDataContainerRef.xml +++ b/doc/classes/PackedDataContainerRef.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PackedDataContainerRef" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="PackedDataContainerRef" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PackedScene.xml b/doc/classes/PackedScene.xml index b40207229c..a226a2bc28 100644 --- a/doc/classes/PackedScene.xml +++ b/doc/classes/PackedScene.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PackedScene" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="PackedScene" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PacketPeer.xml b/doc/classes/PacketPeer.xml index bc15e5fc0c..b99d5dc5e9 100644 --- a/doc/classes/PacketPeer.xml +++ b/doc/classes/PacketPeer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PacketPeer" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="PacketPeer" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Abstraction and base class for packet-based protocols. </brief_description> diff --git a/doc/classes/PacketPeerStream.xml b/doc/classes/PacketPeerStream.xml index 531046a4ba..38e2d9c1a1 100644 --- a/doc/classes/PacketPeerStream.xml +++ b/doc/classes/PacketPeerStream.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PacketPeerStream" inherits="PacketPeer" category="Core" version="3.0.alpha.custom_build"> +<class name="PacketPeerStream" inherits="PacketPeer" category="Core" version="3.0-alpha"> <brief_description> Wrapper to use a PacketPeer over a StreamPeer. </brief_description> diff --git a/doc/classes/PacketPeerUDP.xml b/doc/classes/PacketPeerUDP.xml index 1d2241b580..758ad35365 100644 --- a/doc/classes/PacketPeerUDP.xml +++ b/doc/classes/PacketPeerUDP.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PacketPeerUDP" inherits="PacketPeer" category="Core" version="3.0.alpha.custom_build"> +<class name="PacketPeerUDP" inherits="PacketPeer" category="Core" version="3.0-alpha"> <brief_description> UDP packet peer. </brief_description> diff --git a/doc/classes/Panel.xml b/doc/classes/Panel.xml index 8a57659c0c..28a1e304aa 100644 --- a/doc/classes/Panel.xml +++ b/doc/classes/Panel.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Panel" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="Panel" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Provides an opaque background for [Control] children. </brief_description> diff --git a/doc/classes/PanelContainer.xml b/doc/classes/PanelContainer.xml index 29d5169b9e..415d71c8e7 100644 --- a/doc/classes/PanelContainer.xml +++ b/doc/classes/PanelContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PanelContainer" inherits="Container" category="Core" version="3.0.alpha.custom_build"> +<class name="PanelContainer" inherits="Container" category="Core" version="3.0-alpha"> <brief_description> Panel container type. </brief_description> diff --git a/doc/classes/PanoramaSky.xml b/doc/classes/PanoramaSky.xml index 81f358461e..7f24bb294b 100644 --- a/doc/classes/PanoramaSky.xml +++ b/doc/classes/PanoramaSky.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PanoramaSky" inherits="Sky" category="Core" version="3.0.alpha.custom_build"> +<class name="PanoramaSky" inherits="Sky" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/ParallaxBackground.xml b/doc/classes/ParallaxBackground.xml index 21b6150900..3186f6b972 100644 --- a/doc/classes/ParallaxBackground.xml +++ b/doc/classes/ParallaxBackground.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ParallaxBackground" inherits="CanvasLayer" category="Core" version="3.0.alpha.custom_build"> +<class name="ParallaxBackground" inherits="CanvasLayer" category="Core" version="3.0-alpha"> <brief_description> A node used to create a parallax scrolling background. </brief_description> diff --git a/doc/classes/ParallaxLayer.xml b/doc/classes/ParallaxLayer.xml index f1e6f9e046..784395b1ec 100644 --- a/doc/classes/ParallaxLayer.xml +++ b/doc/classes/ParallaxLayer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ParallaxLayer" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="ParallaxLayer" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> A parallax scrolling layer to be used with [ParallaxBackground]. </brief_description> diff --git a/doc/classes/Particles.xml b/doc/classes/Particles.xml index 1e89d2194c..9a9279b0a7 100644 --- a/doc/classes/Particles.xml +++ b/doc/classes/Particles.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Particles" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build"> +<class name="Particles" inherits="GeometryInstance" category="Core" version="3.0-alpha"> <brief_description> 3D particle emitter. </brief_description> @@ -13,7 +13,7 @@ </demos> <methods> <method name="capture_aabb" qualifiers="const"> - <return type="Rect3"> + <return type="AABB"> </return> <description> </description> @@ -105,7 +105,7 @@ </description> </method> <method name="get_visibility_aabb" qualifiers="const"> - <return type="Rect3"> + <return type="AABB"> </return> <description> </description> @@ -247,7 +247,7 @@ <method name="set_visibility_aabb"> <return type="void"> </return> - <argument index="0" name="aabb" type="Rect3"> + <argument index="0" name="aabb" type="AABB"> </argument> <description> </description> @@ -300,7 +300,7 @@ <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale"> Speed scaling ratio. Default value: [code]1[/code]. </member> - <member name="visibility_aabb" type="Rect3" setter="set_visibility_aabb" getter="get_visibility_aabb"> + <member name="visibility_aabb" type="AABB" setter="set_visibility_aabb" getter="get_visibility_aabb"> </member> </members> <constants> diff --git a/doc/classes/Particles2D.xml b/doc/classes/Particles2D.xml index cfc907b727..be69e03d56 100644 --- a/doc/classes/Particles2D.xml +++ b/doc/classes/Particles2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Particles2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Particles2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> 2D particle emitter. </brief_description> diff --git a/doc/classes/ParticlesMaterial.xml b/doc/classes/ParticlesMaterial.xml index bebdc44b69..2428d1880d 100644 --- a/doc/classes/ParticlesMaterial.xml +++ b/doc/classes/ParticlesMaterial.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ParticlesMaterial" inherits="Material" category="Core" version="3.0.alpha.custom_build"> +<class name="ParticlesMaterial" inherits="Material" category="Core" version="3.0-alpha"> <brief_description> Particle properties for [Particles] and [Particles2D] nodes. </brief_description> diff --git a/doc/classes/Path.xml b/doc/classes/Path.xml index 97543418b9..8138a92dcc 100644 --- a/doc/classes/Path.xml +++ b/doc/classes/Path.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Path" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="Path" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Container for a [Curve3D]. </brief_description> diff --git a/doc/classes/Path2D.xml b/doc/classes/Path2D.xml index 722e0c1240..8172fc2c4b 100644 --- a/doc/classes/Path2D.xml +++ b/doc/classes/Path2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Path2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Path2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Contains a [Curve2D] path for [PathFollow2D] nodes to follow. </brief_description> diff --git a/doc/classes/PathFollow.xml b/doc/classes/PathFollow.xml index 86f55a2aaf..bdf2a082e0 100644 --- a/doc/classes/PathFollow.xml +++ b/doc/classes/PathFollow.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PathFollow" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="PathFollow" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Point sampler for a [Path]. </brief_description> diff --git a/doc/classes/PathFollow2D.xml b/doc/classes/PathFollow2D.xml index 850b81c046..01137d01d0 100644 --- a/doc/classes/PathFollow2D.xml +++ b/doc/classes/PathFollow2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PathFollow2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="PathFollow2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Point sampler for a [Path2D]. </brief_description> diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml index 82ee3531f1..daf1bd62ed 100644 --- a/doc/classes/Performance.xml +++ b/doc/classes/Performance.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Performance" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="Performance" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Exposes performance related data. </brief_description> diff --git a/doc/classes/Physics2DDirectBodyState.xml b/doc/classes/Physics2DDirectBodyState.xml index cc68aaab1f..40666d8330 100644 --- a/doc/classes/Physics2DDirectBodyState.xml +++ b/doc/classes/Physics2DDirectBodyState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DDirectBodyState" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="Physics2DDirectBodyState" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Direct access object to a physics body in the [Physics2DServer]. </brief_description> diff --git a/doc/classes/Physics2DDirectBodyStateSW.xml b/doc/classes/Physics2DDirectBodyStateSW.xml index c2444d4795..865fb6a347 100644 --- a/doc/classes/Physics2DDirectBodyStateSW.xml +++ b/doc/classes/Physics2DDirectBodyStateSW.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DDirectBodyStateSW" inherits="Physics2DDirectBodyState" category="Core" version="3.0.alpha.custom_build"> +<class name="Physics2DDirectBodyStateSW" inherits="Physics2DDirectBodyState" category="Core" version="3.0-alpha"> <brief_description> Software implementation of [Physics2DDirectBodyState]. </brief_description> diff --git a/doc/classes/Physics2DDirectSpaceState.xml b/doc/classes/Physics2DDirectSpaceState.xml index b15d4dfd54..ca7dbab8b8 100644 --- a/doc/classes/Physics2DDirectSpaceState.xml +++ b/doc/classes/Physics2DDirectSpaceState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DDirectSpaceState" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="Physics2DDirectSpaceState" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Direct access object to a space in the [Physics2DServer]. </brief_description> diff --git a/doc/classes/Physics2DServer.xml b/doc/classes/Physics2DServer.xml index 764f18c427..f3115144fa 100644 --- a/doc/classes/Physics2DServer.xml +++ b/doc/classes/Physics2DServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DServer" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="Physics2DServer" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Physics 2D Server. </brief_description> diff --git a/doc/classes/Physics2DServerSW.xml b/doc/classes/Physics2DServerSW.xml index 67fd7a21d8..6764f1a4f6 100644 --- a/doc/classes/Physics2DServerSW.xml +++ b/doc/classes/Physics2DServerSW.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DServerSW" inherits="Physics2DServer" category="Core" version="3.0.alpha.custom_build"> +<class name="Physics2DServerSW" inherits="Physics2DServer" category="Core" version="3.0-alpha"> <brief_description> Software implementation of [Physics2DServer]. </brief_description> diff --git a/doc/classes/Physics2DShapeQueryParameters.xml b/doc/classes/Physics2DShapeQueryParameters.xml index 04fe12cc07..829aec7a25 100644 --- a/doc/classes/Physics2DShapeQueryParameters.xml +++ b/doc/classes/Physics2DShapeQueryParameters.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DShapeQueryParameters" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="Physics2DShapeQueryParameters" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Parameters to be sent to a 2D shape physics query. </brief_description> diff --git a/doc/classes/Physics2DShapeQueryResult.xml b/doc/classes/Physics2DShapeQueryResult.xml index 9786a6aa75..d5a29e79fa 100644 --- a/doc/classes/Physics2DShapeQueryResult.xml +++ b/doc/classes/Physics2DShapeQueryResult.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DShapeQueryResult" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="Physics2DShapeQueryResult" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Physics2DTestMotionResult.xml b/doc/classes/Physics2DTestMotionResult.xml index a71d58faa7..6bc4849184 100644 --- a/doc/classes/Physics2DTestMotionResult.xml +++ b/doc/classes/Physics2DTestMotionResult.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Physics2DTestMotionResult" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="Physics2DTestMotionResult" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PhysicsBody.xml b/doc/classes/PhysicsBody.xml index e75fbb8e2d..579a074731 100644 --- a/doc/classes/PhysicsBody.xml +++ b/doc/classes/PhysicsBody.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsBody" inherits="CollisionObject" category="Core" version="3.0.alpha.custom_build"> +<class name="PhysicsBody" inherits="CollisionObject" category="Core" version="3.0-alpha"> <brief_description> Base class for all objects affected by physics in 3D space. </brief_description> diff --git a/doc/classes/PhysicsBody2D.xml b/doc/classes/PhysicsBody2D.xml index 748506baa9..bf341692bf 100644 --- a/doc/classes/PhysicsBody2D.xml +++ b/doc/classes/PhysicsBody2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsBody2D" inherits="CollisionObject2D" category="Core" version="3.0.alpha.custom_build"> +<class name="PhysicsBody2D" inherits="CollisionObject2D" category="Core" version="3.0-alpha"> <brief_description> Base class for all objects affected by physics in 2D space. </brief_description> diff --git a/doc/classes/PhysicsDirectBodyState.xml b/doc/classes/PhysicsDirectBodyState.xml index 349b7e7c3f..33dafa29f6 100644 --- a/doc/classes/PhysicsDirectBodyState.xml +++ b/doc/classes/PhysicsDirectBodyState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsDirectBodyState" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="PhysicsDirectBodyState" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PhysicsDirectSpaceState.xml b/doc/classes/PhysicsDirectSpaceState.xml index 01307b92c7..b5765b6421 100644 --- a/doc/classes/PhysicsDirectSpaceState.xml +++ b/doc/classes/PhysicsDirectSpaceState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsDirectSpaceState" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="PhysicsDirectSpaceState" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PhysicsServer.xml b/doc/classes/PhysicsServer.xml index c165ee3c1e..76dabd12ba 100644 --- a/doc/classes/PhysicsServer.xml +++ b/doc/classes/PhysicsServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsServer" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="PhysicsServer" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Server interface for low level physics access. </brief_description> diff --git a/doc/classes/PhysicsShapeQueryParameters.xml b/doc/classes/PhysicsShapeQueryParameters.xml index f2e8b1986a..b9023194d7 100644 --- a/doc/classes/PhysicsShapeQueryParameters.xml +++ b/doc/classes/PhysicsShapeQueryParameters.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsShapeQueryParameters" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="PhysicsShapeQueryParameters" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PhysicsShapeQueryResult.xml b/doc/classes/PhysicsShapeQueryResult.xml index 4c4a283688..2e723e96df 100644 --- a/doc/classes/PhysicsShapeQueryResult.xml +++ b/doc/classes/PhysicsShapeQueryResult.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PhysicsShapeQueryResult" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="PhysicsShapeQueryResult" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Result of a shape query in Physics2DServer. </brief_description> diff --git a/doc/classes/PinJoint.xml b/doc/classes/PinJoint.xml index 1cc381b1b3..bcf69df816 100644 --- a/doc/classes/PinJoint.xml +++ b/doc/classes/PinJoint.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PinJoint" inherits="Joint" category="Core" version="3.0.alpha.custom_build"> +<class name="PinJoint" inherits="Joint" category="Core" version="3.0-alpha"> <brief_description> Pin Joint for 3D Shapes. </brief_description> diff --git a/doc/classes/PinJoint2D.xml b/doc/classes/PinJoint2D.xml index 009b0ec2f2..7f92567ae4 100644 --- a/doc/classes/PinJoint2D.xml +++ b/doc/classes/PinJoint2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PinJoint2D" inherits="Joint2D" category="Core" version="3.0.alpha.custom_build"> +<class name="PinJoint2D" inherits="Joint2D" category="Core" version="3.0-alpha"> <brief_description> Pin Joint for 2D Shapes. </brief_description> diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml index 5c4eb984db..2fd02a56c6 100644 --- a/doc/classes/Plane.xml +++ b/doc/classes/Plane.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Plane" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Plane" category="Built-In Types" version="3.0-alpha"> <brief_description> Plane in hessian form. </brief_description> diff --git a/doc/classes/PlaneMesh.xml b/doc/classes/PlaneMesh.xml index 034bc391a6..93bc191e45 100644 --- a/doc/classes/PlaneMesh.xml +++ b/doc/classes/PlaneMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PlaneMesh" inherits="PrimitiveMesh" category="Core" version="3.0.alpha.custom_build"> +<class name="PlaneMesh" inherits="PrimitiveMesh" category="Core" version="3.0-alpha"> <brief_description> Class representing a planar [PrimitiveMesh]. </brief_description> diff --git a/doc/classes/PlaneShape.xml b/doc/classes/PlaneShape.xml index 7e7bde4db3..d394f781e3 100644 --- a/doc/classes/PlaneShape.xml +++ b/doc/classes/PlaneShape.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PlaneShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build"> +<class name="PlaneShape" inherits="Shape" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Polygon2D.xml b/doc/classes/Polygon2D.xml index 57494fe6d6..ccf60e4d49 100644 --- a/doc/classes/Polygon2D.xml +++ b/doc/classes/Polygon2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Polygon2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Polygon2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> A 2D polygon. </brief_description> diff --git a/doc/classes/PolygonPathFinder.xml b/doc/classes/PolygonPathFinder.xml index a0d1284a85..213d7c0981 100644 --- a/doc/classes/PolygonPathFinder.xml +++ b/doc/classes/PolygonPathFinder.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PolygonPathFinder" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="PolygonPathFinder" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PoolByteArray.xml b/doc/classes/PoolByteArray.xml index 9ef5390c5e..54efc24725 100644 --- a/doc/classes/PoolByteArray.xml +++ b/doc/classes/PoolByteArray.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PoolByteArray" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="PoolByteArray" category="Built-In Types" version="3.0-alpha"> <brief_description> Raw byte array. </brief_description> diff --git a/doc/classes/PoolColorArray.xml b/doc/classes/PoolColorArray.xml index 70503a67b9..f7cf389577 100644 --- a/doc/classes/PoolColorArray.xml +++ b/doc/classes/PoolColorArray.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PoolColorArray" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="PoolColorArray" category="Built-In Types" version="3.0-alpha"> <brief_description> Array of Colors </brief_description> diff --git a/doc/classes/PoolIntArray.xml b/doc/classes/PoolIntArray.xml index 5caa8add1e..53b2258c58 100644 --- a/doc/classes/PoolIntArray.xml +++ b/doc/classes/PoolIntArray.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PoolIntArray" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="PoolIntArray" category="Built-In Types" version="3.0-alpha"> <brief_description> Integer Array. </brief_description> diff --git a/doc/classes/PoolRealArray.xml b/doc/classes/PoolRealArray.xml index ee2740e92a..cc22c256e7 100644 --- a/doc/classes/PoolRealArray.xml +++ b/doc/classes/PoolRealArray.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PoolRealArray" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="PoolRealArray" category="Built-In Types" version="3.0-alpha"> <brief_description> Real Array. </brief_description> diff --git a/doc/classes/PoolStringArray.xml b/doc/classes/PoolStringArray.xml index ace4f732da..47928281cf 100644 --- a/doc/classes/PoolStringArray.xml +++ b/doc/classes/PoolStringArray.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PoolStringArray" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="PoolStringArray" category="Built-In Types" version="3.0-alpha"> <brief_description> String Array. </brief_description> diff --git a/doc/classes/PoolVector2Array.xml b/doc/classes/PoolVector2Array.xml index fbfdb11825..2ece5a6486 100644 --- a/doc/classes/PoolVector2Array.xml +++ b/doc/classes/PoolVector2Array.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PoolVector2Array" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="PoolVector2Array" category="Built-In Types" version="3.0-alpha"> <brief_description> An Array of Vector2. </brief_description> diff --git a/doc/classes/PoolVector3Array.xml b/doc/classes/PoolVector3Array.xml index e5e2924273..59f1c36a9e 100644 --- a/doc/classes/PoolVector3Array.xml +++ b/doc/classes/PoolVector3Array.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PoolVector3Array" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="PoolVector3Array" category="Built-In Types" version="3.0-alpha"> <brief_description> An Array of Vector3. </brief_description> diff --git a/doc/classes/Popup.xml b/doc/classes/Popup.xml index 7e87c9fcc0..7a93c32ea8 100644 --- a/doc/classes/Popup.xml +++ b/doc/classes/Popup.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Popup" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="Popup" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Base container control for popups and dialogs. </brief_description> diff --git a/doc/classes/PopupDialog.xml b/doc/classes/PopupDialog.xml index c51c5b6d21..82439e9d74 100644 --- a/doc/classes/PopupDialog.xml +++ b/doc/classes/PopupDialog.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PopupDialog" inherits="Popup" category="Core" version="3.0.alpha.custom_build"> +<class name="PopupDialog" inherits="Popup" category="Core" version="3.0-alpha"> <brief_description> Base class for Popup Dialogs. </brief_description> diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml index 086eb8e34d..f3cd7df796 100644 --- a/doc/classes/PopupMenu.xml +++ b/doc/classes/PopupMenu.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PopupMenu" inherits="Popup" category="Core" version="3.0.alpha.custom_build"> +<class name="PopupMenu" inherits="Popup" category="Core" version="3.0-alpha"> <brief_description> PopupMenu displays a list of options. </brief_description> diff --git a/doc/classes/PopupPanel.xml b/doc/classes/PopupPanel.xml index f8060ab4f6..3878e345c9 100644 --- a/doc/classes/PopupPanel.xml +++ b/doc/classes/PopupPanel.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PopupPanel" inherits="Popup" category="Core" version="3.0.alpha.custom_build"> +<class name="PopupPanel" inherits="Popup" category="Core" version="3.0-alpha"> <brief_description> Class for displaying popups with a panel background. </brief_description> diff --git a/doc/classes/Position2D.xml b/doc/classes/Position2D.xml index ffb1c62d0f..6d282370d4 100644 --- a/doc/classes/Position2D.xml +++ b/doc/classes/Position2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Position2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Position2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Generic 2D Position hint for editing. </brief_description> diff --git a/doc/classes/Position3D.xml b/doc/classes/Position3D.xml index a544e59ddc..cd4c1293ca 100644 --- a/doc/classes/Position3D.xml +++ b/doc/classes/Position3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Position3D" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="Position3D" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Generic 3D Position hint for editing </brief_description> diff --git a/doc/classes/PrimitiveMesh.xml b/doc/classes/PrimitiveMesh.xml index 34141edbe7..5c8d467927 100644 --- a/doc/classes/PrimitiveMesh.xml +++ b/doc/classes/PrimitiveMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PrimitiveMesh" inherits="Mesh" category="Core" version="3.0.alpha.custom_build"> +<class name="PrimitiveMesh" inherits="Mesh" category="Core" version="3.0-alpha"> <brief_description> Base class for all primitive meshes. Handles applying a [Material] to a primitive mesh. </brief_description> diff --git a/doc/classes/PrismMesh.xml b/doc/classes/PrismMesh.xml index 21fa67bc82..fa53717111 100644 --- a/doc/classes/PrismMesh.xml +++ b/doc/classes/PrismMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PrismMesh" inherits="PrimitiveMesh" category="Core" version="3.0.alpha.custom_build"> +<class name="PrismMesh" inherits="PrimitiveMesh" category="Core" version="3.0-alpha"> <brief_description> Class representing a prism-shaped [PrimitiveMesh]. </brief_description> diff --git a/doc/classes/ProceduralSky.xml b/doc/classes/ProceduralSky.xml index 032ce9def2..70e9388058 100644 --- a/doc/classes/ProceduralSky.xml +++ b/doc/classes/ProceduralSky.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ProceduralSky" inherits="Sky" category="Core" version="3.0.alpha.custom_build"> +<class name="ProceduralSky" inherits="Sky" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/ProgressBar.xml b/doc/classes/ProgressBar.xml index f6be04cc19..d72b28efc5 100644 --- a/doc/classes/ProgressBar.xml +++ b/doc/classes/ProgressBar.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ProgressBar" inherits="Range" category="Core" version="3.0.alpha.custom_build"> +<class name="ProgressBar" inherits="Range" category="Core" version="3.0-alpha"> <brief_description> General purpose progress bar. </brief_description> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index bdf2cc0062..6f670ded64 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ProjectSettings" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="ProjectSettings" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Contains global variables accessible from everywhere. </brief_description> @@ -17,7 +17,7 @@ <argument index="0" name="hint" type="Dictionary"> </argument> <description> - Add a custom property info to a property. The dictionary must contain: name:[String](the name of the property) and type:[int](see TYPE_* in [@Global Scope]), and optionally hint:[int](see PROPERTY_HINT_* in [@Global Scope]), hint_string:[String]. + Add a custom property info to a property. The dictionary must contain: name:[String](the name of the property) and type:[int](see TYPE_* in [@GlobalScope]), and optionally hint:[int](see PROPERTY_HINT_* in [@GlobalScope]), hint_string:[String]. Example: [codeblock] ProjectSettings.set("category/property_name", 0) @@ -59,14 +59,6 @@ <description> </description> </method> - <method name="get_singleton" qualifiers="const"> - <return type="Object"> - </return> - <argument index="0" name="name" type="String"> - </argument> - <description> - </description> - </method> <method name="globalize_path" qualifiers="const"> <return type="String"> </return> @@ -85,14 +77,6 @@ Return true if a configuration value is present. </description> </method> - <method name="has_singleton" qualifiers="const"> - <return type="bool"> - </return> - <argument index="0" name="name" type="String"> - </argument> - <description> - </description> - </method> <method name="load_resource_pack"> <return type="bool"> </return> diff --git a/doc/classes/ProximityGroup.xml b/doc/classes/ProximityGroup.xml index 9b4b564900..b05d5b95dd 100644 --- a/doc/classes/ProximityGroup.xml +++ b/doc/classes/ProximityGroup.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ProximityGroup" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="ProximityGroup" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> General purpose proximity-detection node. </brief_description> diff --git a/doc/classes/QuadMesh.xml b/doc/classes/QuadMesh.xml index b7c66b04de..807141a284 100644 --- a/doc/classes/QuadMesh.xml +++ b/doc/classes/QuadMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="QuadMesh" inherits="PrimitiveMesh" category="Core" version="3.0.alpha.custom_build"> +<class name="QuadMesh" inherits="PrimitiveMesh" category="Core" version="3.0-alpha"> <brief_description> Class representing a square mesh. </brief_description> @@ -11,7 +11,25 @@ <demos> </demos> <methods> + <method name="get_size" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="set_size"> + <return type="void"> + </return> + <argument index="0" name="size" type="Vector2"> + </argument> + <description> + </description> + </method> </methods> + <members> + <member name="size" type="Vector2" setter="set_size" getter="get_size"> + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/Quat.xml b/doc/classes/Quat.xml index 056d7d10fa..1aa30075e4 100644 --- a/doc/classes/Quat.xml +++ b/doc/classes/Quat.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Quat" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Quat" category="Built-In Types" version="3.0-alpha"> <brief_description> Quaternion. </brief_description> diff --git a/doc/classes/RID.xml b/doc/classes/RID.xml index 89005b0d3b..831a4665c4 100644 --- a/doc/classes/RID.xml +++ b/doc/classes/RID.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RID" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="RID" category="Built-In Types" version="3.0-alpha"> <brief_description> Handle for a [Resource]'s unique ID. </brief_description> diff --git a/doc/classes/Range.xml b/doc/classes/Range.xml index cd75c2b658..d2ea59cbeb 100644 --- a/doc/classes/Range.xml +++ b/doc/classes/Range.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Range" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="Range" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Abstract base class for range-based controls. </brief_description> diff --git a/doc/classes/RayCast.xml b/doc/classes/RayCast.xml index 3f999f7fe2..d5f57c43c8 100644 --- a/doc/classes/RayCast.xml +++ b/doc/classes/RayCast.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RayCast" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="RayCast" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Query the closest object intersecting a ray. </brief_description> diff --git a/doc/classes/RayCast2D.xml b/doc/classes/RayCast2D.xml index 45a83f7ded..f5828da796 100644 --- a/doc/classes/RayCast2D.xml +++ b/doc/classes/RayCast2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RayCast2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="RayCast2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Query the closest object intersecting a ray. </brief_description> diff --git a/doc/classes/RayShape.xml b/doc/classes/RayShape.xml index d5d367a335..d4826141e8 100644 --- a/doc/classes/RayShape.xml +++ b/doc/classes/RayShape.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RayShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build"> +<class name="RayShape" inherits="Shape" category="Core" version="3.0-alpha"> <brief_description> Ray shape for 3D collisions. </brief_description> diff --git a/doc/classes/RayShape2D.xml b/doc/classes/RayShape2D.xml index 4f6313a1d2..c9779a4307 100644 --- a/doc/classes/RayShape2D.xml +++ b/doc/classes/RayShape2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RayShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build"> +<class name="RayShape2D" inherits="Shape2D" category="Core" version="3.0-alpha"> <brief_description> Ray shape for 2D collisions. </brief_description> diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml index 5af8c82a7b..e0b8b6ec75 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Rect2" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Rect2" category="Built-In Types" version="3.0-alpha"> <brief_description> 2D Axis-aligned bounding box. </brief_description> diff --git a/doc/classes/RectangleShape2D.xml b/doc/classes/RectangleShape2D.xml index 7a1aec2021..b61344d86f 100644 --- a/doc/classes/RectangleShape2D.xml +++ b/doc/classes/RectangleShape2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RectangleShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build"> +<class name="RectangleShape2D" inherits="Shape2D" category="Core" version="3.0-alpha"> <brief_description> Rectangle shape for 2D collisions. </brief_description> diff --git a/doc/classes/Reference.xml b/doc/classes/Reference.xml index 2531ea88ad..18bd51f675 100644 --- a/doc/classes/Reference.xml +++ b/doc/classes/Reference.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Reference" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="Reference" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Base class for anything that keeps a reference count. </brief_description> diff --git a/doc/classes/ReferenceRect.xml b/doc/classes/ReferenceRect.xml index e8de910cc8..75b513a147 100644 --- a/doc/classes/ReferenceRect.xml +++ b/doc/classes/ReferenceRect.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ReferenceRect" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="ReferenceRect" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Reference frame for GUI. </brief_description> diff --git a/doc/classes/ReflectionProbe.xml b/doc/classes/ReflectionProbe.xml index c3d95e5a62..1508323207 100644 --- a/doc/classes/ReflectionProbe.xml +++ b/doc/classes/ReflectionProbe.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ReflectionProbe" inherits="VisualInstance" category="Core" version="3.0.alpha.custom_build"> +<class name="ReflectionProbe" inherits="VisualInstance" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/RegEx.xml b/doc/classes/RegEx.xml deleted file mode 100644 index 4577672c72..0000000000 --- a/doc/classes/RegEx.xml +++ /dev/null @@ -1,114 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="RegEx" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> - <brief_description> - Simple regular expression matcher. - </brief_description> - <description> - Class for finding text patterns in a string using regular expressions. It can not perform replacements. Regular expressions are a way to define patterns of text to be searched. Details on writing patterns are too long to explain here but the Internet is full of tutorials and detailed explanations. - Once created, the RegEx object needs to be compiled with the search pattern before it can be used. The search pattern must be escaped first for gdscript before it is escaped for the expression. For example: - [code]var exp = RegEx.new()[/code] - [code]exp.compile("\\d+")[/code] - would be read by RegEx as [code]\d+[/code] - Similarly: - [code]exp.compile("\"(?:\\\\.|[^\"])*\"")[/code] - would be read as [code]"(?:\\.|[^"])*"[/code] - Currently supported features: - * Capturing [code]()[/code] and non-capturing [code](?:)[/code] groups - * Named capturing groups [code](?P<name>)[/code] - * Any character [code].[/code] - * Shorthand character classes [code]\w \W \s \S \d \D[/code] - * User-defined character classes such as [code][A-Za-z][/code] - * Simple quantifiers [code]?[/code], [code]*[/code] and [code]+[/code] - * Range quantifiers [code]{x,y}[/code] - * Lazy (non-greedy) quantifiers [code]*?[/code] - * Beginning [code]^[/code] and end [code]$[/code] anchors - * Alternation [code]|[/code] - * Backreferences [code]\1[/code], [code]\g{1}[/code], and [code]\g<name>[/code] - * POSIX character classes [code][[:alnum:]][/code] - * Lookahead [code](?=)[/code], [code](?!)[/code] and lookbehind [code](?<=)[/code], [code](?<!)[/code] - * ASCII [code]\xFF[/code] and Unicode [code]\uFFFF[/code] code points (in a style similar to Python) - * Word boundaries [code]\b[/code], [code]\B[/code] - </description> - <tutorials> - </tutorials> - <demos> - </demos> - <methods> - <method name="clear"> - <return type="void"> - </return> - <description> - This method resets the state of the object, as it was freshly created. Namely, it unassigns the regular expression of this object. - </description> - </method> - <method name="compile"> - <return type="int" enum="Error"> - </return> - <argument index="0" name="pattern" type="String"> - </argument> - <description> - Compiles and assign the search pattern to use. - </description> - </method> - <method name="get_group_count" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the number of numeric capturing groups. - </description> - </method> - <method name="get_names" qualifiers="const"> - <return type="Array"> - </return> - <description> - Returns an array of names of named capturing groups. - </description> - </method> - <method name="get_pattern" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the search pattern used to compile the code. - </description> - </method> - <method name="is_valid" qualifiers="const"> - <return type="bool"> - </return> - <description> - Returns whether this object has a valid search pattern assigned. - </description> - </method> - <method name="search" qualifiers="const"> - <return type="RegExMatch"> - </return> - <argument index="0" name="subject" type="String"> - </argument> - <argument index="1" name="offset" type="int" default="0"> - </argument> - <argument index="2" name="end" type="int" default="-1"> - </argument> - <description> - Searches the text for the compiled pattern. Returns a [RegExMatch] container of the first matching result if found, otherwise null. The region to search within can be specified without modifying where the start and end anchor would be. - </description> - </method> - <method name="sub" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="subject" type="String"> - </argument> - <argument index="1" name="replacement" type="String"> - </argument> - <argument index="2" name="all" type="bool" default="false"> - </argument> - <argument index="3" name="offset" type="int" default="0"> - </argument> - <argument index="4" name="end" type="int" default="-1"> - </argument> - <description> - Searches the text for the compiled pattern and replaces it with the specified string. Escapes and backreferences such as [code]\1[/code] and [code]\g<name>[/code] expanded and resolved. By default only the first instance is replaced but it can be changed for all instances (global replacement). The region to search within can be specified without modifying where the start and end anchor would be. - </description> - </method> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/RegExMatch.xml b/doc/classes/RegExMatch.xml deleted file mode 100644 index abf2e383d5..0000000000 --- a/doc/classes/RegExMatch.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="RegExMatch" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> - <brief_description> - Contains the results of a regex search. - </brief_description> - <description> - Contains the results of a regex search. [method RegEx.search] returns an instance of [code]RegExMatch[/code] if it finds the search pattern in the [source] string. - </description> - <tutorials> - </tutorials> - <demos> - </demos> - <methods> - <method name="get_end" qualifiers="const"> - <return type="int"> - </return> - <argument index="0" name="name" type="Variant" default="0"> - </argument> - <description> - Returns the end position of the match in the [source] string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern). - </description> - </method> - <method name="get_group_count" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the number of numeric capturing groups. - </description> - </method> - <method name="get_names" qualifiers="const"> - <return type="Dictionary"> - </return> - <description> - Returns an array of names of named capturing groups. - </description> - </method> - <method name="get_start" qualifiers="const"> - <return type="int"> - </return> - <argument index="0" name="name" type="Variant" default="0"> - </argument> - <description> - Returns the starting position of the match in the [source] string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern). - </description> - </method> - <method name="get_string" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="name" type="Variant" default="0"> - </argument> - <description> - Returns the result of the match in the [source] string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern). - </description> - </method> - <method name="get_strings" qualifiers="const"> - <return type="Array"> - </return> - <description> - Returns an [Array] of the matches in the [source] string. - </description> - </method> - <method name="get_subject" qualifiers="const"> - <return type="String"> - </return> - <description> - Returns the [source] string used with the search pattern to find this matching result. - </description> - </method> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/RemoteTransform.xml b/doc/classes/RemoteTransform.xml index 67679bc9df..76caea1a94 100644 --- a/doc/classes/RemoteTransform.xml +++ b/doc/classes/RemoteTransform.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RemoteTransform" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="RemoteTransform" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> RemoteTransform mirrors the [Transform] of another [Spatial] derived Node in the scene. </brief_description> diff --git a/doc/classes/RemoteTransform2D.xml b/doc/classes/RemoteTransform2D.xml index eac7427f9f..d6dcde5742 100644 --- a/doc/classes/RemoteTransform2D.xml +++ b/doc/classes/RemoteTransform2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RemoteTransform2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="RemoteTransform2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> RemoteTransform2D mirrors the [Transform2D] of another [CanvasItem] derived Node in the scene. </brief_description> diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml index 7767b26988..0044756003 100644 --- a/doc/classes/Resource.xml +++ b/doc/classes/Resource.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Resource" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="Resource" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Base class for all resources. </brief_description> diff --git a/doc/classes/ResourceImporter.xml b/doc/classes/ResourceImporter.xml index 419c4a84fb..b627438c89 100644 --- a/doc/classes/ResourceImporter.xml +++ b/doc/classes/ResourceImporter.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceImporter" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="ResourceImporter" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/ResourceInteractiveLoader.xml b/doc/classes/ResourceInteractiveLoader.xml index d508b0a532..866347c0bb 100644 --- a/doc/classes/ResourceInteractiveLoader.xml +++ b/doc/classes/ResourceInteractiveLoader.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceInteractiveLoader" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="ResourceInteractiveLoader" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Interactive Resource Loader. </brief_description> diff --git a/doc/classes/ResourceLoader.xml b/doc/classes/ResourceLoader.xml index 9fb3c71a5b..5940031a76 100644 --- a/doc/classes/ResourceLoader.xml +++ b/doc/classes/ResourceLoader.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceLoader" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="ResourceLoader" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Resource Loader. </brief_description> diff --git a/doc/classes/ResourcePreloader.xml b/doc/classes/ResourcePreloader.xml index 35ebeb1760..f4c3334107 100644 --- a/doc/classes/ResourcePreloader.xml +++ b/doc/classes/ResourcePreloader.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourcePreloader" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="ResourcePreloader" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Resource Preloader Node. </brief_description> diff --git a/doc/classes/ResourceSaver.xml b/doc/classes/ResourceSaver.xml index de296776ad..af9c592ded 100644 --- a/doc/classes/ResourceSaver.xml +++ b/doc/classes/ResourceSaver.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceSaver" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="ResourceSaver" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Resource Saving Interface. </brief_description> diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index cc644f34cb..693bd5cf2f 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RichTextLabel" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="RichTextLabel" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Label that displays rich text. </brief_description> <description> - Label that displays rich text. Rich text can contain custom text, fonts, images and some basic formatting. It also adapts itself to given width/heights. + Rich text can contain custom text, fonts, images and some basic formatting. The label manages these as an internal tag stack. It also adapts itself to given width/heights. + Note that assignments to [member bbcode_text] clear the tag stack and reconstruct it from the property's contents. Any edits made to [member bbcode_text] will erase previous edits made from other manual sources such as [method append_bbcode] and the [code]push_*[/code] / [method pop] methods. </description> <tutorials> </tutorials> @@ -17,6 +18,7 @@ <argument index="0" name="image" type="Texture"> </argument> <description> + Adds an image's opening and closing tags to the tag stack. </description> </method> <method name="add_text"> @@ -25,6 +27,7 @@ <argument index="0" name="text" type="String"> </argument> <description> + Adds raw non-bbcode-parsed text to the tag stack. </description> </method> <method name="append_bbcode"> @@ -33,27 +36,28 @@ <argument index="0" name="bbcode" type="String"> </argument> <description> + Parses [code]bbcode[/code] and adds tags to the tag stack as needed. Returns the result of the parsing, [code]OK[/code] if successful. </description> </method> <method name="clear"> <return type="void"> </return> <description> - Clears the label's text. + Clears the tag stack and sets [member bbcode_text] to an empty string. </description> </method> <method name="get_bbcode" qualifiers="const"> <return type="String"> </return> <description> - Returns label's BBCode. + Returns the bbcode-parsed [member bbcode_text]. </description> </method> <method name="get_line_count" qualifiers="const"> <return type="int"> </return> <description> - Returns the number of lines in the text. + Returns the total number of newlines in the tag stack's text tags. Considers wrapped text as one line. </description> </method> <method name="get_percent_visible" qualifiers="const"> @@ -67,26 +71,28 @@ <return type="int"> </return> <description> + Returns the number of spaces associated with a single tab length. Does not affect "\t" in text tags, only indent tags. </description> </method> <method name="get_text"> <return type="String"> </return> <description> - Returns the label's text with the formatting removed. + Returns the raw content of [member bbcode_text]. </description> </method> <method name="get_total_character_count" qualifiers="const"> <return type="int"> </return> <description> - Returns the total number of characters. + Returns the total number of characters from text tags. Does not include bbcodes. </description> </method> <method name="get_v_scroll"> <return type="VScrollBar"> </return> <description> + Returns the vertical scrollbar. </description> </method> <method name="get_visible_characters" qualifiers="const"> @@ -106,6 +112,7 @@ <return type="bool"> </return> <description> + Returns [code]true[/code] if the label underlines meta tags such as [url]{text}[/url]. </description> </method> <method name="is_overriding_selected_font_color" qualifiers="const"> @@ -118,34 +125,34 @@ <return type="bool"> </return> <description> - Returns [code]true[/code] if active scrolling is enabled. + Returns [code]true[/code] if the scrollbar is visible. Does not block scrolling completely. See [method scroll_to_line]. </description> </method> <method name="is_scroll_following" qualifiers="const"> <return type="bool"> </return> <description> + Returns [code]true[/code] if the window scrolls down to display new content automatically. </description> </method> <method name="is_selection_enabled" qualifiers="const"> <return type="bool"> </return> <description> - Returns [code]true[/code] if the label's text can be selected. + Returns [code]true[/code] if the label allows text selection. </description> </method> <method name="is_using_bbcode" qualifiers="const"> <return type="bool"> </return> <description> - Returns [code]true[/code] if the label has BBCode. </description> </method> <method name="newline"> <return type="void"> </return> <description> - Adds a newline to the end of the rich text. + Adds a newline tag to the tag stack. </description> </method> <method name="parse_bbcode"> @@ -154,12 +161,14 @@ <argument index="0" name="bbcode" type="String"> </argument> <description> + The assignment version of [method append_bbcode]. Clears the tag stack and inserts the new content. Returns [code]OK[/code] if parses [code]bbcode[/code] successfully. </description> </method> <method name="pop"> <return type="void"> </return> <description> + Terminates the current tag. Use after [code]push_*[/code] methods to close bbcodes manually. Does not need to follow [code]add_*[/code] methods. </description> </method> <method name="push_align"> @@ -168,12 +177,14 @@ <argument index="0" name="align" type="int" enum="RichTextLabel.Align"> </argument> <description> + Adds a [code][right][/code] tag to the tag stack. </description> </method> <method name="push_cell"> <return type="void"> </return> <description> + Adds a [code][cell][/code] tag to the tag stack. Must be inside a [table] tag. See [method push_table] for details. </description> </method> <method name="push_color"> @@ -182,6 +193,7 @@ <argument index="0" name="color" type="Color"> </argument> <description> + Adds a [code][color][/code] tag to the tag stack. </description> </method> <method name="push_font"> @@ -190,6 +202,7 @@ <argument index="0" name="font" type="Font"> </argument> <description> + Adds a [code][font][/code] tag to the tag stack. Overrides default fonts for its duration. </description> </method> <method name="push_indent"> @@ -198,6 +211,7 @@ <argument index="0" name="level" type="int"> </argument> <description> + Adds an [code][indent][/code] tag to the tag stack. Multiplies "level" by current tab_size to determine new margin length. </description> </method> <method name="push_list"> @@ -206,6 +220,7 @@ <argument index="0" name="type" type="int" enum="RichTextLabel.ListType"> </argument> <description> + Adds a list tag to the tag stack. Similar to the bbcodes [code][ol][/code] or [code][ul][/code], but supports more list types. Not fully implemented! </description> </method> <method name="push_meta"> @@ -214,6 +229,7 @@ <argument index="0" name="data" type="Variant"> </argument> <description> + Adds a meta tag to the tag stack. Similar to the bbcode [code][url=something]{text}[/url][/code], but supports non-[String] metadata types. </description> </method> <method name="push_table"> @@ -222,12 +238,14 @@ <argument index="0" name="columns" type="int"> </argument> <description> + Adds a [code][table=columns][/code] tag to the tag stack. </description> </method> <method name="push_underline"> <return type="void"> </return> <description> + Adds a [code][u][/code] tag to the tag stack. </description> </method> <method name="remove_line"> @@ -236,6 +254,7 @@ <argument index="0" name="line" type="int"> </argument> <description> + Removes a line of content from the label. Returns [code]true[/code] if the line exists. </description> </method> <method name="scroll_to_line"> @@ -244,6 +263,7 @@ <argument index="0" name="line" type="int"> </argument> <description> + Scrolls the window's top line to match [code]line[/code]. </description> </method> <method name="set_bbcode"> @@ -261,6 +281,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> + If [code]true[/code] will underline meta tags such as the [url] bbcode. Default value: [code]true[/code]. </description> </method> <method name="set_override_selected_font_color"> @@ -286,6 +307,7 @@ <argument index="0" name="active" type="bool"> </argument> <description> + If [code]false[/code] the vertical scrollbar is hidden. Default value: [code]true[/code]. </description> </method> <method name="set_scroll_follow"> @@ -294,6 +316,7 @@ <argument index="0" name="follow" type="bool"> </argument> <description> + If [code]true[/code] the window scrolls to reveal new content. Default value: [code]false[/code]. </description> </method> <method name="set_selection_enabled"> @@ -311,6 +334,7 @@ <argument index="0" name="spaces" type="int"> </argument> <description> + Sets the current tab length in spaces. Use with [method push_indent] to redefine indent length. </description> </method> <method name="set_table_column_expand"> @@ -323,6 +347,9 @@ <argument index="2" name="ratio" type="int"> </argument> <description> + Edits the selected columns expansion options. If [code]expand[/code] is [code]true[/code], the column expands in proportion to its expansion ratio versus the other columns' ratios. + For example, 2 columns with ratios 3 and 4 plus 70 pixels in available width would expand 30 and 40 pixels, respectively. + Columns with a [code]false[/code] expand will not contribute to the total ratio. </description> </method> <method name="set_text"> @@ -331,6 +358,7 @@ <argument index="0" name="text" type="String"> </argument> <description> + Clears the tag stack and adds a raw text tag to the top of it. Does not parse bbcodes. Does not modify [member bbcode_text]. </description> </method> <method name="set_use_bbcode"> @@ -355,7 +383,7 @@ If [code]true[/code] the label uses BBCode formatting. Default value: [code]false[/code]. </member> <member name="bbcode_text" type="String" setter="set_bbcode" getter="get_bbcode"> - The label's text in BBCode format. + The label's text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited. </member> <member name="override_selected_font_color" type="bool" setter="set_override_selected_font_color" getter="is_overriding_selected_font_color"> If [code]true[/code] the label uses the custom font color. Default value: [code]false[/code]. @@ -372,6 +400,7 @@ <argument index="0" name="meta" type="Nil"> </argument> <description> + Triggered when the user clicks on content between [url] tags. If the meta is defined in text, e.g. [code][url={"data"="hi"}]hi[/url][/code], then the parameter for this signal will be a [String] type. If a particular type or an object is desired, the [method push_meta] method must be used to manually insert the data into the tag stack. </description> </signal> </signals> diff --git a/doc/classes/RigidBody.xml b/doc/classes/RigidBody.xml index f9488d2f7f..d40f7b4429 100644 --- a/doc/classes/RigidBody.xml +++ b/doc/classes/RigidBody.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RigidBody" inherits="PhysicsBody" category="Core" version="3.0.alpha.custom_build"> +<class name="RigidBody" inherits="PhysicsBody" category="Core" version="3.0-alpha"> <brief_description> Physics Body whose position is determined through physics simulation in 3D space. </brief_description> diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml index e0ca6084e6..af8e59c83b 100644 --- a/doc/classes/RigidBody2D.xml +++ b/doc/classes/RigidBody2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="RigidBody2D" inherits="PhysicsBody2D" category="Core" version="3.0.alpha.custom_build"> +<class name="RigidBody2D" inherits="PhysicsBody2D" category="Core" version="3.0-alpha"> <brief_description> A body that is controlled by the 2D physics engine. </brief_description> diff --git a/doc/classes/SceneState.xml b/doc/classes/SceneState.xml index 967c3fbad6..61e08336db 100644 --- a/doc/classes/SceneState.xml +++ b/doc/classes/SceneState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SceneState" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="SceneState" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index f6a6ce36e3..7cfacc737d 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SceneTree" inherits="MainLoop" category="Core" version="3.0.alpha.custom_build"> +<class name="SceneTree" inherits="MainLoop" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/SceneTreeTimer.xml b/doc/classes/SceneTreeTimer.xml index 276c6857ae..6c540396e5 100644 --- a/doc/classes/SceneTreeTimer.xml +++ b/doc/classes/SceneTreeTimer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SceneTreeTimer" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="SceneTreeTimer" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Script.xml b/doc/classes/Script.xml index c13e009976..83e33c4764 100644 --- a/doc/classes/Script.xml +++ b/doc/classes/Script.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Script" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Script" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> A class stored as a resource. </brief_description> diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml index e93a0eda0c..7a95f1276e 100644 --- a/doc/classes/ScriptEditor.xml +++ b/doc/classes/ScriptEditor.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ScriptEditor" inherits="PanelContainer" category="Core" version="3.0.alpha.custom_build"> +<class name="ScriptEditor" inherits="PanelContainer" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> @@ -9,6 +9,30 @@ <demos> </demos> <methods> + <method name="can_drop_data_fw" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="arg0" type="Vector2"> + </argument> + <argument index="1" name="arg1" type="Variant"> + </argument> + <argument index="2" name="arg2" type="Control"> + </argument> + <description> + </description> + </method> + <method name="drop_data_fw"> + <return type="void"> + </return> + <argument index="0" name="arg0" type="Vector2"> + </argument> + <argument index="1" name="arg1" type="Variant"> + </argument> + <argument index="2" name="arg2" type="Control"> + </argument> + <description> + </description> + </method> <method name="get_current_script"> <return type="Script"> </return> @@ -16,6 +40,16 @@ Returns a [Script] that is currently active in editor. </description> </method> + <method name="get_drag_data_fw"> + <return type="Variant"> + </return> + <argument index="0" name="arg0" type="Vector2"> + </argument> + <argument index="1" name="arg1" type="Control"> + </argument> + <description> + </description> + </method> <method name="get_open_scripts" qualifiers="const"> <return type="Array"> </return> diff --git a/doc/classes/ScrollBar.xml b/doc/classes/ScrollBar.xml index 7a10d3679e..312baf3bb6 100644 --- a/doc/classes/ScrollBar.xml +++ b/doc/classes/ScrollBar.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ScrollBar" inherits="Range" category="Core" version="3.0.alpha.custom_build"> +<class name="ScrollBar" inherits="Range" category="Core" version="3.0-alpha"> <brief_description> Base class for scroll bars. </brief_description> diff --git a/doc/classes/ScrollContainer.xml b/doc/classes/ScrollContainer.xml index 1ae06bde70..51bd950cd9 100644 --- a/doc/classes/ScrollContainer.xml +++ b/doc/classes/ScrollContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ScrollContainer" inherits="Container" category="Core" version="3.0.alpha.custom_build"> +<class name="ScrollContainer" inherits="Container" category="Core" version="3.0-alpha"> <brief_description> A helper node for displaying scrollable elements (e.g. lists). </brief_description> diff --git a/doc/classes/SegmentShape2D.xml b/doc/classes/SegmentShape2D.xml index 3b7a747bcb..c59370018d 100644 --- a/doc/classes/SegmentShape2D.xml +++ b/doc/classes/SegmentShape2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SegmentShape2D" inherits="Shape2D" category="Core" version="3.0.alpha.custom_build"> +<class name="SegmentShape2D" inherits="Shape2D" category="Core" version="3.0-alpha"> <brief_description> Segment shape for 2D collisions. </brief_description> diff --git a/doc/classes/Semaphore.xml b/doc/classes/Semaphore.xml index c9c8ac0298..0f70ec1bd2 100644 --- a/doc/classes/Semaphore.xml +++ b/doc/classes/Semaphore.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Semaphore" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="Semaphore" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> A synchronization Semaphore. </brief_description> diff --git a/doc/classes/Separator.xml b/doc/classes/Separator.xml index 4bbabe58aa..8754eb566d 100644 --- a/doc/classes/Separator.xml +++ b/doc/classes/Separator.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Separator" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="Separator" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Base class for separators. </brief_description> diff --git a/doc/classes/Shader.xml b/doc/classes/Shader.xml index 75644c31ab..53b67c9d38 100644 --- a/doc/classes/Shader.xml +++ b/doc/classes/Shader.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Shader" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Shader" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> To be changed, ignore. </brief_description> diff --git a/doc/classes/ShaderMaterial.xml b/doc/classes/ShaderMaterial.xml index 8bd9f1039e..81dec0cc14 100644 --- a/doc/classes/ShaderMaterial.xml +++ b/doc/classes/ShaderMaterial.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ShaderMaterial" inherits="Material" category="Core" version="3.0.alpha.custom_build"> +<class name="ShaderMaterial" inherits="Material" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Shape.xml b/doc/classes/Shape.xml index 4d822a1705..df39988a35 100644 --- a/doc/classes/Shape.xml +++ b/doc/classes/Shape.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Shape" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Shape" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Base class for all 3D shape resources. </brief_description> diff --git a/doc/classes/Shape2D.xml b/doc/classes/Shape2D.xml index d5e2984ba0..fcc1ded4f7 100644 --- a/doc/classes/Shape2D.xml +++ b/doc/classes/Shape2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Shape2D" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Shape2D" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Base class for all 2D Shapes. </brief_description> diff --git a/doc/classes/ShortCut.xml b/doc/classes/ShortCut.xml index e8b3b962d3..b89c3a65bd 100644 --- a/doc/classes/ShortCut.xml +++ b/doc/classes/ShortCut.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ShortCut" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="ShortCut" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Skeleton.xml b/doc/classes/Skeleton.xml index b5be340b77..b32f8bf7f0 100644 --- a/doc/classes/Skeleton.xml +++ b/doc/classes/Skeleton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Skeleton" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="Skeleton" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Skeleton for characters and animated objects. </brief_description> diff --git a/doc/classes/Sky.xml b/doc/classes/Sky.xml index 3045167346..a2259df42a 100644 --- a/doc/classes/Sky.xml +++ b/doc/classes/Sky.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Sky" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Sky" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Slider.xml b/doc/classes/Slider.xml index b9b2b98549..649752a8a2 100644 --- a/doc/classes/Slider.xml +++ b/doc/classes/Slider.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Slider" inherits="Range" category="Core" version="3.0.alpha.custom_build"> +<class name="Slider" inherits="Range" category="Core" version="3.0-alpha"> <brief_description> Base class for GUI Sliders. </brief_description> diff --git a/doc/classes/SliderJoint.xml b/doc/classes/SliderJoint.xml index adea8658d1..69cdf79c53 100644 --- a/doc/classes/SliderJoint.xml +++ b/doc/classes/SliderJoint.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SliderJoint" inherits="Joint" category="Core" version="3.0.alpha.custom_build"> +<class name="SliderJoint" inherits="Joint" category="Core" version="3.0-alpha"> <brief_description> Piston kind of slider between two bodies in 3D. </brief_description> diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml index 07f5ea5301..726654f91f 100644 --- a/doc/classes/Spatial.xml +++ b/doc/classes/Spatial.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Spatial" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="Spatial" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Most basic 3D game object, parent of all 3D related nodes. </brief_description> diff --git a/doc/classes/SpatialGizmo.xml b/doc/classes/SpatialGizmo.xml index 1612e80500..eaac74fe10 100644 --- a/doc/classes/SpatialGizmo.xml +++ b/doc/classes/SpatialGizmo.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpatialGizmo" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="SpatialGizmo" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/SpatialMaterial.xml b/doc/classes/SpatialMaterial.xml index db47875050..9f8b563373 100644 --- a/doc/classes/SpatialMaterial.xml +++ b/doc/classes/SpatialMaterial.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpatialMaterial" inherits="Material" category="Core" version="3.0.alpha.custom_build"> +<class name="SpatialMaterial" inherits="Material" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> @@ -135,6 +135,12 @@ <description> </description> </method> + <method name="get_emission_operator" qualifiers="const"> + <return type="int" enum="SpatialMaterial.EmissionOperator"> + </return> + <description> + </description> + </method> <method name="get_feature" qualifiers="const"> <return type="bool"> </return> @@ -523,6 +529,14 @@ <description> </description> </method> + <method name="set_emission_operator"> + <return type="void"> + </return> + <argument index="0" name="operator" type="int" enum="SpatialMaterial.EmissionOperator"> + </argument> + <description> + </description> + </method> <method name="set_feature"> <return type="void"> </return> @@ -843,6 +857,8 @@ </member> <member name="emission_energy" type="float" setter="set_emission_energy" getter="get_emission_energy"> </member> + <member name="emission_operator" type="int" setter="set_emission_operator" getter="get_emission_operator" enum="SpatialMaterial.EmissionOperator"> + </member> <member name="emission_texture" type="Texture" setter="set_texture" getter="get_texture"> </member> <member name="flags_fixed_size" type="bool" setter="set_flag" getter="get_flag"> @@ -1113,5 +1129,9 @@ </constant> <constant name="TEXTURE_CHANNEL_GRAYSCALE" value="4"> </constant> + <constant name="EMISSION_OP_ADD" value="0"> + </constant> + <constant name="EMISSION_OP_MULTIPLY" value="1"> + </constant> </constants> </class> diff --git a/doc/classes/SpatialVelocityTracker.xml b/doc/classes/SpatialVelocityTracker.xml index 95871c8cdc..62d3f02c89 100644 --- a/doc/classes/SpatialVelocityTracker.xml +++ b/doc/classes/SpatialVelocityTracker.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpatialVelocityTracker" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="SpatialVelocityTracker" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/SphereMesh.xml b/doc/classes/SphereMesh.xml index 0ae48cb7d7..42af9cd6b8 100644 --- a/doc/classes/SphereMesh.xml +++ b/doc/classes/SphereMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SphereMesh" inherits="PrimitiveMesh" category="Core" version="3.0.alpha.custom_build"> +<class name="SphereMesh" inherits="PrimitiveMesh" category="Core" version="3.0-alpha"> <brief_description> Class representing a spherical [PrimitiveMesh]. </brief_description> diff --git a/doc/classes/SphereShape.xml b/doc/classes/SphereShape.xml index 7c6174f4e4..28f96b0028 100644 --- a/doc/classes/SphereShape.xml +++ b/doc/classes/SphereShape.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SphereShape" inherits="Shape" category="Core" version="3.0.alpha.custom_build"> +<class name="SphereShape" inherits="Shape" category="Core" version="3.0-alpha"> <brief_description> Sphere shape for 3D collisions. </brief_description> diff --git a/doc/classes/SpinBox.xml b/doc/classes/SpinBox.xml index 31ef1865e9..e0c0a88148 100644 --- a/doc/classes/SpinBox.xml +++ b/doc/classes/SpinBox.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpinBox" inherits="Range" category="Core" version="3.0.alpha.custom_build"> +<class name="SpinBox" inherits="Range" category="Core" version="3.0-alpha"> <brief_description> Numerical input text field. </brief_description> diff --git a/doc/classes/SplitContainer.xml b/doc/classes/SplitContainer.xml index 861a483f6d..50ed6a5f64 100644 --- a/doc/classes/SplitContainer.xml +++ b/doc/classes/SplitContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SplitContainer" inherits="Container" category="Core" version="3.0.alpha.custom_build"> +<class name="SplitContainer" inherits="Container" category="Core" version="3.0-alpha"> <brief_description> Container for splitting and adjusting. </brief_description> diff --git a/doc/classes/SpotLight.xml b/doc/classes/SpotLight.xml index 430e7c4a26..ce58791171 100644 --- a/doc/classes/SpotLight.xml +++ b/doc/classes/SpotLight.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpotLight" inherits="Light" category="Core" version="3.0.alpha.custom_build"> +<class name="SpotLight" inherits="Light" category="Core" version="3.0-alpha"> <brief_description> Spotlight [Light], such as a reflector spotlight or a lantern. </brief_description> diff --git a/doc/classes/Sprite.xml b/doc/classes/Sprite.xml index 0cdc8f7099..7996adab51 100644 --- a/doc/classes/Sprite.xml +++ b/doc/classes/Sprite.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Sprite" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="Sprite" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> General purpose Sprite node. </brief_description> diff --git a/doc/classes/Sprite3D.xml b/doc/classes/Sprite3D.xml index e51616a071..5354d8c819 100644 --- a/doc/classes/Sprite3D.xml +++ b/doc/classes/Sprite3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Sprite3D" inherits="SpriteBase3D" category="Core" version="3.0.alpha.custom_build"> +<class name="Sprite3D" inherits="SpriteBase3D" category="Core" version="3.0-alpha"> <brief_description> 2D Sprite node in 3D world. </brief_description> diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml index f6c3367704..69537cd884 100644 --- a/doc/classes/SpriteBase3D.xml +++ b/doc/classes/SpriteBase3D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpriteBase3D" inherits="GeometryInstance" category="Core" version="3.0.alpha.custom_build"> +<class name="SpriteBase3D" inherits="GeometryInstance" category="Core" version="3.0-alpha"> <brief_description> 2D Sprite node in 3D environment. </brief_description> diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml index e46fdc80e0..336b155689 100644 --- a/doc/classes/SpriteFrames.xml +++ b/doc/classes/SpriteFrames.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SpriteFrames" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="SpriteFrames" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Sprite frame library for AnimatedSprite. </brief_description> diff --git a/doc/classes/StaticBody.xml b/doc/classes/StaticBody.xml index 6b5b007310..a008f0b99c 100644 --- a/doc/classes/StaticBody.xml +++ b/doc/classes/StaticBody.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StaticBody" inherits="PhysicsBody" category="Core" version="3.0.alpha.custom_build"> +<class name="StaticBody" inherits="PhysicsBody" category="Core" version="3.0-alpha"> <brief_description> Static body for 3D Physics. </brief_description> diff --git a/doc/classes/StaticBody2D.xml b/doc/classes/StaticBody2D.xml index cff41074b8..9f1f79ad59 100644 --- a/doc/classes/StaticBody2D.xml +++ b/doc/classes/StaticBody2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StaticBody2D" inherits="PhysicsBody2D" category="Core" version="3.0.alpha.custom_build"> +<class name="StaticBody2D" inherits="PhysicsBody2D" category="Core" version="3.0-alpha"> <brief_description> Static body for 2D Physics. </brief_description> diff --git a/doc/classes/StreamPeer.xml b/doc/classes/StreamPeer.xml index 077de3dc3c..4f92a524b1 100644 --- a/doc/classes/StreamPeer.xml +++ b/doc/classes/StreamPeer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StreamPeer" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="StreamPeer" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Abstraction and base class for stream-based protocols. </brief_description> diff --git a/doc/classes/StreamPeerBuffer.xml b/doc/classes/StreamPeerBuffer.xml index 141d46564c..5c67598285 100644 --- a/doc/classes/StreamPeerBuffer.xml +++ b/doc/classes/StreamPeerBuffer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StreamPeerBuffer" inherits="StreamPeer" category="Core" version="3.0.alpha.custom_build"> +<class name="StreamPeerBuffer" inherits="StreamPeer" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/StreamPeerSSL.xml b/doc/classes/StreamPeerSSL.xml index 5eb3f551f4..59d0e492e4 100644 --- a/doc/classes/StreamPeerSSL.xml +++ b/doc/classes/StreamPeerSSL.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StreamPeerSSL" inherits="StreamPeer" category="Core" version="3.0.alpha.custom_build"> +<class name="StreamPeerSSL" inherits="StreamPeer" category="Core" version="3.0-alpha"> <brief_description> SSL Stream peer. </brief_description> diff --git a/doc/classes/StreamPeerTCP.xml b/doc/classes/StreamPeerTCP.xml index 9b7cd91ea5..3df68d0926 100644 --- a/doc/classes/StreamPeerTCP.xml +++ b/doc/classes/StreamPeerTCP.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StreamPeerTCP" inherits="StreamPeer" category="Core" version="3.0.alpha.custom_build"> +<class name="StreamPeerTCP" inherits="StreamPeer" category="Core" version="3.0-alpha"> <brief_description> TCP Stream peer. </brief_description> diff --git a/doc/classes/StreamTexture.xml b/doc/classes/StreamTexture.xml index 6e6f2e8056..2a5ad36b25 100644 --- a/doc/classes/StreamTexture.xml +++ b/doc/classes/StreamTexture.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StreamTexture" inherits="Texture" category="Core" version="3.0.alpha.custom_build"> +<class name="StreamTexture" inherits="Texture" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 8c8fbc620c..60c5e75dec 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="String" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="String" category="Built-In Types" version="3.0-alpha"> <brief_description> Built-in string class. </brief_description> @@ -95,10 +95,10 @@ <method name="String"> <return type="String"> </return> - <argument index="0" name="from" type="Rect3"> + <argument index="0" name="from" type="AABB"> </argument> <description> - Constructs a new String from the given [Rect3]. + Constructs a new String from the given [AABB]. </description> </method> <method name="String"> diff --git a/doc/classes/StyleBox.xml b/doc/classes/StyleBox.xml index ab1ec1f997..c904522c7f 100644 --- a/doc/classes/StyleBox.xml +++ b/doc/classes/StyleBox.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StyleBox" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="StyleBox" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Base class for drawing stylized boxes for the UI. </brief_description> diff --git a/doc/classes/StyleBoxEmpty.xml b/doc/classes/StyleBoxEmpty.xml index f11959c41d..fd0e256e36 100644 --- a/doc/classes/StyleBoxEmpty.xml +++ b/doc/classes/StyleBoxEmpty.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StyleBoxEmpty" inherits="StyleBox" category="Core" version="3.0.alpha.custom_build"> +<class name="StyleBoxEmpty" inherits="StyleBox" category="Core" version="3.0-alpha"> <brief_description> Empty stylebox (does not display anything). </brief_description> diff --git a/doc/classes/StyleBoxFlat.xml b/doc/classes/StyleBoxFlat.xml index eb9f82af6c..ab1f733c5c 100644 --- a/doc/classes/StyleBoxFlat.xml +++ b/doc/classes/StyleBoxFlat.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StyleBoxFlat" inherits="StyleBox" category="Core" version="3.0.alpha.custom_build"> +<class name="StyleBoxFlat" inherits="StyleBox" category="Core" version="3.0-alpha"> <brief_description> Customizable Stylebox with a given set of parameters. (no texture required) </brief_description> diff --git a/doc/classes/StyleBoxLine.xml b/doc/classes/StyleBoxLine.xml index 83d87176f2..669d74416f 100644 --- a/doc/classes/StyleBoxLine.xml +++ b/doc/classes/StyleBoxLine.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StyleBoxLine" inherits="StyleBox" category="Core" version="3.0.alpha.custom_build"> +<class name="StyleBoxLine" inherits="StyleBox" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/StyleBoxTexture.xml b/doc/classes/StyleBoxTexture.xml index 458fdad99e..2b64b5d6bf 100644 --- a/doc/classes/StyleBoxTexture.xml +++ b/doc/classes/StyleBoxTexture.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="StyleBoxTexture" inherits="StyleBox" category="Core" version="3.0.alpha.custom_build"> +<class name="StyleBoxTexture" inherits="StyleBox" category="Core" version="3.0-alpha"> <brief_description> Texture Based 3x3 scale style. </brief_description> diff --git a/doc/classes/SurfaceTool.xml b/doc/classes/SurfaceTool.xml index 987a725977..93090d9d2e 100644 --- a/doc/classes/SurfaceTool.xml +++ b/doc/classes/SurfaceTool.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="SurfaceTool" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="SurfaceTool" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Helper tool to create geometry. </brief_description> diff --git a/doc/classes/TCP_Server.xml b/doc/classes/TCP_Server.xml index 97115619ad..20cdbe4231 100644 --- a/doc/classes/TCP_Server.xml +++ b/doc/classes/TCP_Server.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TCP_Server" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="TCP_Server" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> TCP Server. </brief_description> diff --git a/doc/classes/TabContainer.xml b/doc/classes/TabContainer.xml index a7dd86a459..4921690074 100644 --- a/doc/classes/TabContainer.xml +++ b/doc/classes/TabContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TabContainer" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="TabContainer" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Tabbed Container. </brief_description> diff --git a/doc/classes/Tabs.xml b/doc/classes/Tabs.xml index d3893ab9a7..e007decf47 100644 --- a/doc/classes/Tabs.xml +++ b/doc/classes/Tabs.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Tabs" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="Tabs" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Tabs Control. </brief_description> diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index 43c7e02fbf..0e862a7903 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TextEdit" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="TextEdit" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Multiline text editing control. </brief_description> diff --git a/doc/classes/Texture.xml b/doc/classes/Texture.xml index 93cba29d09..a856eb64ad 100644 --- a/doc/classes/Texture.xml +++ b/doc/classes/Texture.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Texture" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Texture" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Texture for 2D and 3D. </brief_description> diff --git a/doc/classes/TextureButton.xml b/doc/classes/TextureButton.xml index 8e51548c10..a6d935376a 100644 --- a/doc/classes/TextureButton.xml +++ b/doc/classes/TextureButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TextureButton" inherits="BaseButton" category="Core" version="3.0.alpha.custom_build"> +<class name="TextureButton" inherits="BaseButton" category="Core" version="3.0-alpha"> <brief_description> Texture-based button. Supports Pressed, Hover, Disabled and Focused states. </brief_description> diff --git a/doc/classes/TextureProgress.xml b/doc/classes/TextureProgress.xml index f8165753c6..550c38920a 100644 --- a/doc/classes/TextureProgress.xml +++ b/doc/classes/TextureProgress.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TextureProgress" inherits="Range" category="Core" version="3.0.alpha.custom_build"> +<class name="TextureProgress" inherits="Range" category="Core" version="3.0-alpha"> <brief_description> Texture-based progress bar. Useful for loading screens and life or stamina bars. </brief_description> diff --git a/doc/classes/TextureRect.xml b/doc/classes/TextureRect.xml index af5626ae84..cef102e8ae 100644 --- a/doc/classes/TextureRect.xml +++ b/doc/classes/TextureRect.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TextureRect" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="TextureRect" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Draws a sprite or a texture inside a User Interface. The texture can tile or not. </brief_description> diff --git a/doc/classes/Theme.xml b/doc/classes/Theme.xml index 4dd45ac821..0a95a52e4f 100644 --- a/doc/classes/Theme.xml +++ b/doc/classes/Theme.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Theme" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Theme" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Theme for controls. </brief_description> diff --git a/doc/classes/Thread.xml b/doc/classes/Thread.xml index e2326ffe98..24bc4bb985 100644 --- a/doc/classes/Thread.xml +++ b/doc/classes/Thread.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Thread" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="Thread" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> A unit of execution in a process. </brief_description> diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 49eaf5bc31..c48f58f123 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TileMap" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="TileMap" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Node for 2D tile-based maps. </brief_description> diff --git a/doc/classes/TileSet.xml b/doc/classes/TileSet.xml index a858138144..a1063567f8 100644 --- a/doc/classes/TileSet.xml +++ b/doc/classes/TileSet.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TileSet" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="TileSet" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Tile library for tilemaps. </brief_description> diff --git a/doc/classes/Timer.xml b/doc/classes/Timer.xml index 035dec7980..8d834537a7 100644 --- a/doc/classes/Timer.xml +++ b/doc/classes/Timer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Timer" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="Timer" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> A countdown timer. </brief_description> diff --git a/doc/classes/ToolButton.xml b/doc/classes/ToolButton.xml index 7723dadb83..b541d00d2f 100644 --- a/doc/classes/ToolButton.xml +++ b/doc/classes/ToolButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ToolButton" inherits="Button" category="Core" version="3.0.alpha.custom_build"> +<class name="ToolButton" inherits="Button" category="Core" version="3.0-alpha"> <brief_description> Flat button helper class. </brief_description> diff --git a/doc/classes/TouchScreenButton.xml b/doc/classes/TouchScreenButton.xml index 51cb7f86f2..283ead1b1b 100644 --- a/doc/classes/TouchScreenButton.xml +++ b/doc/classes/TouchScreenButton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TouchScreenButton" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="TouchScreenButton" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Button for touch screen devices. </brief_description> diff --git a/doc/classes/Transform.xml b/doc/classes/Transform.xml index cd80d568e7..9e1672e6f5 100644 --- a/doc/classes/Transform.xml +++ b/doc/classes/Transform.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Transform" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Transform" category="Built-In Types" version="3.0-alpha"> <brief_description> 3D Transformation. 3x4 matrix. </brief_description> diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml index a9d71d7093..d17063b550 100644 --- a/doc/classes/Transform2D.xml +++ b/doc/classes/Transform2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Transform2D" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Transform2D" category="Built-In Types" version="3.0-alpha"> <brief_description> 2D Transformation. 3x2 matrix. </brief_description> diff --git a/doc/classes/Translation.xml b/doc/classes/Translation.xml index c0707d26b8..dc2609b3e1 100644 --- a/doc/classes/Translation.xml +++ b/doc/classes/Translation.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Translation" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="Translation" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Language Translation. </brief_description> diff --git a/doc/classes/TranslationServer.xml b/doc/classes/TranslationServer.xml index 1657541c19..8b50bf027b 100644 --- a/doc/classes/TranslationServer.xml +++ b/doc/classes/TranslationServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TranslationServer" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="TranslationServer" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Server that manages all translations. Translations can be set to it and removed from it. </brief_description> diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index bf9245d23a..508a0ec194 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Tree" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="Tree" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Control to show a tree of items. </brief_description> diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml index f0eb23b636..b463ef7bbb 100644 --- a/doc/classes/TreeItem.xml +++ b/doc/classes/TreeItem.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TreeItem" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="TreeItem" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Control for a single item inside a [Tree]. </brief_description> diff --git a/doc/classes/TriangleMesh.xml b/doc/classes/TriangleMesh.xml index 21b85c1d05..21a37913c8 100644 --- a/doc/classes/TriangleMesh.xml +++ b/doc/classes/TriangleMesh.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="TriangleMesh" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="TriangleMesh" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index b11498083b..822eee5838 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Tween" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="Tween" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Node useful for animations with unknown start and end points. </brief_description> diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml index d450a8812e..718522aa57 100644 --- a/doc/classes/UndoRedo.xml +++ b/doc/classes/UndoRedo.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="UndoRedo" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="UndoRedo" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Helper to manage UndoRedo in the editor or custom tools. </brief_description> diff --git a/doc/classes/VBoxContainer.xml b/doc/classes/VBoxContainer.xml index de544ed031..b64b04437a 100644 --- a/doc/classes/VBoxContainer.xml +++ b/doc/classes/VBoxContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VBoxContainer" inherits="BoxContainer" category="Core" version="3.0.alpha.custom_build"> +<class name="VBoxContainer" inherits="BoxContainer" category="Core" version="3.0-alpha"> <brief_description> Vertical box container. </brief_description> diff --git a/doc/classes/VScrollBar.xml b/doc/classes/VScrollBar.xml index 4510ac1e2e..5e5ed6f211 100644 --- a/doc/classes/VScrollBar.xml +++ b/doc/classes/VScrollBar.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VScrollBar" inherits="ScrollBar" category="Core" version="3.0.alpha.custom_build"> +<class name="VScrollBar" inherits="ScrollBar" category="Core" version="3.0-alpha"> <brief_description> Vertical version of [ScrollBar], which goes from left (min) to right (max). </brief_description> diff --git a/doc/classes/VSeparator.xml b/doc/classes/VSeparator.xml index f98473a148..88c043f9ca 100644 --- a/doc/classes/VSeparator.xml +++ b/doc/classes/VSeparator.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VSeparator" inherits="Separator" category="Core" version="3.0.alpha.custom_build"> +<class name="VSeparator" inherits="Separator" category="Core" version="3.0-alpha"> <brief_description> Vertical version of [Separator]. </brief_description> diff --git a/doc/classes/VSlider.xml b/doc/classes/VSlider.xml index fa4fa34d54..bc0a3a25b6 100644 --- a/doc/classes/VSlider.xml +++ b/doc/classes/VSlider.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VSlider" inherits="Slider" category="Core" version="3.0.alpha.custom_build"> +<class name="VSlider" inherits="Slider" category="Core" version="3.0-alpha"> <brief_description> Vertical slider. </brief_description> diff --git a/doc/classes/VSplitContainer.xml b/doc/classes/VSplitContainer.xml index aac10841c3..e5a8981aaf 100644 --- a/doc/classes/VSplitContainer.xml +++ b/doc/classes/VSplitContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VSplitContainer" inherits="SplitContainer" category="Core" version="3.0.alpha.custom_build"> +<class name="VSplitContainer" inherits="SplitContainer" category="Core" version="3.0-alpha"> <brief_description> Vertical split container. </brief_description> diff --git a/doc/classes/Variant.xml b/doc/classes/Variant.xml index 914ef10036..14df6f050f 100644 --- a/doc/classes/Variant.xml +++ b/doc/classes/Variant.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Variant" category="Core" version="3.0.alpha.custom_build"> +<class name="Variant" category="Core" version="3.0-alpha"> <brief_description> The most important data type in Godot. </brief_description> diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 510559327f..3afad1d6fa 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Vector2" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Vector2" category="Built-In Types" version="3.0-alpha"> <brief_description> Vector used for 2D Math. </brief_description> diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index a05bc5db9a..cec5970f06 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Vector3" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="Vector3" category="Built-In Types" version="3.0-alpha"> <brief_description> Vector class, which performs basic 3D vector math operations. </brief_description> diff --git a/doc/classes/VehicleBody.xml b/doc/classes/VehicleBody.xml index 48202665fb..f9f3590385 100644 --- a/doc/classes/VehicleBody.xml +++ b/doc/classes/VehicleBody.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VehicleBody" inherits="PhysicsBody" category="Core" version="3.0.alpha.custom_build"> +<class name="VehicleBody" inherits="PhysicsBody" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VehicleWheel.xml b/doc/classes/VehicleWheel.xml index b2e54e25bc..f04c33cc5a 100644 --- a/doc/classes/VehicleWheel.xml +++ b/doc/classes/VehicleWheel.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VehicleWheel" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="VehicleWheel" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VideoPlayer.xml b/doc/classes/VideoPlayer.xml index 5387ec30b3..340b162727 100644 --- a/doc/classes/VideoPlayer.xml +++ b/doc/classes/VideoPlayer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VideoPlayer" inherits="Control" category="Core" version="3.0.alpha.custom_build"> +<class name="VideoPlayer" inherits="Control" category="Core" version="3.0-alpha"> <brief_description> Control to play video files. </brief_description> @@ -25,6 +25,12 @@ Get the amount of milliseconds to store in buffer while playing. </description> </method> + <method name="get_bus" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> <method name="get_stream" qualifiers="const"> <return type="VideoStream"> </return> @@ -129,6 +135,14 @@ Set the amount of milliseconds to buffer during playback. </description> </method> + <method name="set_bus"> + <return type="void"> + </return> + <argument index="0" name="bus" type="String"> + </argument> + <description> + </description> + </method> <method name="set_expand"> <return type="void"> </return> @@ -196,6 +210,8 @@ </member> <member name="autoplay" type="bool" setter="set_autoplay" getter="has_autoplay"> </member> + <member name="bus" type="String" setter="set_bus" getter="get_bus"> + </member> <member name="expand" type="bool" setter="set_expand" getter="has_expand"> </member> <member name="paused" type="bool" setter="set_paused" getter="is_paused"> diff --git a/doc/classes/VideoStream.xml b/doc/classes/VideoStream.xml index c282cdfbd0..00607b0f0a 100644 --- a/doc/classes/VideoStream.xml +++ b/doc/classes/VideoStream.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VideoStream" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="VideoStream" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 28a7cb7c8e..9bd229ef26 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Viewport" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="Viewport" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Creates a sub-view into the screen. </brief_description> diff --git a/doc/classes/ViewportContainer.xml b/doc/classes/ViewportContainer.xml index 8d5feaec68..5a4c3af1f6 100644 --- a/doc/classes/ViewportContainer.xml +++ b/doc/classes/ViewportContainer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ViewportContainer" inherits="Container" category="Core" version="3.0.alpha.custom_build"> +<class name="ViewportContainer" inherits="Container" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/ViewportTexture.xml b/doc/classes/ViewportTexture.xml index f2515cbcc7..1eace840a8 100644 --- a/doc/classes/ViewportTexture.xml +++ b/doc/classes/ViewportTexture.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ViewportTexture" inherits="Texture" category="Core" version="3.0.alpha.custom_build"> +<class name="ViewportTexture" inherits="Texture" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisibilityEnabler.xml b/doc/classes/VisibilityEnabler.xml index 881ba91fad..95bcbd6816 100644 --- a/doc/classes/VisibilityEnabler.xml +++ b/doc/classes/VisibilityEnabler.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisibilityEnabler" inherits="VisibilityNotifier" category="Core" version="3.0.alpha.custom_build"> +<class name="VisibilityEnabler" inherits="VisibilityNotifier" category="Core" version="3.0-alpha"> <brief_description> Enable certain nodes only when visible. </brief_description> diff --git a/doc/classes/VisibilityEnabler2D.xml b/doc/classes/VisibilityEnabler2D.xml index b881de4f91..f23d54a544 100644 --- a/doc/classes/VisibilityEnabler2D.xml +++ b/doc/classes/VisibilityEnabler2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisibilityEnabler2D" inherits="VisibilityNotifier2D" category="Core" version="3.0.alpha.custom_build"> +<class name="VisibilityEnabler2D" inherits="VisibilityNotifier2D" category="Core" version="3.0-alpha"> <brief_description> Enable certain nodes only when visible. </brief_description> diff --git a/doc/classes/VisibilityNotifier.xml b/doc/classes/VisibilityNotifier.xml index 816523fc27..90f1974697 100644 --- a/doc/classes/VisibilityNotifier.xml +++ b/doc/classes/VisibilityNotifier.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisibilityNotifier" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="VisibilityNotifier" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Detects when the node is visible on screen. </brief_description> @@ -12,7 +12,7 @@ </demos> <methods> <method name="get_aabb" qualifiers="const"> - <return type="Rect3"> + <return type="AABB"> </return> <description> Returns the bounding box of the VisibilityNotifier. @@ -28,7 +28,7 @@ <method name="set_aabb"> <return type="void"> </return> - <argument index="0" name="rect" type="Rect3"> + <argument index="0" name="rect" type="AABB"> </argument> <description> Set the visibility bounding box of the VisibilityNotifier. @@ -36,7 +36,7 @@ </method> </methods> <members> - <member name="aabb" type="Rect3" setter="set_aabb" getter="get_aabb"> + <member name="aabb" type="AABB" setter="set_aabb" getter="get_aabb"> The VisibilityNotifier's bounding box. </member> </members> diff --git a/doc/classes/VisibilityNotifier2D.xml b/doc/classes/VisibilityNotifier2D.xml index 86227a0277..b8db14e583 100644 --- a/doc/classes/VisibilityNotifier2D.xml +++ b/doc/classes/VisibilityNotifier2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisibilityNotifier2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="VisibilityNotifier2D" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Detects when the node is visible on screen. </brief_description> diff --git a/doc/classes/VisualInstance.xml b/doc/classes/VisualInstance.xml index ed317882a8..7108eb13c5 100644 --- a/doc/classes/VisualInstance.xml +++ b/doc/classes/VisualInstance.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualInstance" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualInstance" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> @@ -10,7 +10,7 @@ </demos> <methods> <method name="get_aabb" qualifiers="const"> - <return type="Rect3"> + <return type="AABB"> </return> <description> </description> @@ -22,7 +22,7 @@ </description> </method> <method name="get_transformed_aabb" qualifiers="const"> - <return type="Rect3"> + <return type="AABB"> </return> <description> </description> diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml index 8e3cb8ee50..d716d99e5d 100644 --- a/doc/classes/VisualServer.xml +++ b/doc/classes/VisualServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualServer" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualServer" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> Server for anything visible. </brief_description> @@ -1035,7 +1035,7 @@ </description> </method> <method name="mesh_get_custom_aabb" qualifiers="const"> - <return type="Rect3"> + <return type="AABB"> </return> <argument index="0" name="mesh" type="RID"> </argument> @@ -1085,13 +1085,13 @@ </return> <argument index="0" name="mesh" type="RID"> </argument> - <argument index="1" name="aabb" type="Rect3"> + <argument index="1" name="aabb" type="AABB"> </argument> <description> </description> </method> <method name="mesh_surface_get_aabb" qualifiers="const"> - <return type="Rect3"> + <return type="AABB"> </return> <argument index="0" name="mesh" type="RID"> </argument> @@ -1791,6 +1791,12 @@ </description> </method> </methods> + <signals> + <signal name="frame_drawn_in_thread"> + <description> + </description> + </signal> + </signals> <constants> <constant name="NO_INDEX_ARRAY" value="-1" enum=""> </constant> diff --git a/doc/classes/WeakRef.xml b/doc/classes/WeakRef.xml index 23629881d3..00e5bdfd2c 100644 --- a/doc/classes/WeakRef.xml +++ b/doc/classes/WeakRef.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="WeakRef" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="WeakRef" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Holds an [Object], but does not contribute to the reference count if the object is a reference. </brief_description> diff --git a/doc/classes/WindowDialog.xml b/doc/classes/WindowDialog.xml index e57983c367..a6ebd45a76 100644 --- a/doc/classes/WindowDialog.xml +++ b/doc/classes/WindowDialog.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="WindowDialog" inherits="Popup" category="Core" version="3.0.alpha.custom_build"> +<class name="WindowDialog" inherits="Popup" category="Core" version="3.0-alpha"> <brief_description> Base class for window dialogs. </brief_description> diff --git a/doc/classes/World.xml b/doc/classes/World.xml index f4f5f5b756..6d243f26a5 100644 --- a/doc/classes/World.xml +++ b/doc/classes/World.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="World" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="World" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Class that has everything pertaining to a world. </brief_description> diff --git a/doc/classes/World2D.xml b/doc/classes/World2D.xml index d57117fef0..bf3cc9f24b 100644 --- a/doc/classes/World2D.xml +++ b/doc/classes/World2D.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="World2D" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="World2D" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> Class that has everything pertaining to a 2D world. </brief_description> diff --git a/doc/classes/WorldEnvironment.xml b/doc/classes/WorldEnvironment.xml index 561cd09f43..13922b4987 100644 --- a/doc/classes/WorldEnvironment.xml +++ b/doc/classes/WorldEnvironment.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="WorldEnvironment" inherits="Node" category="Core" version="3.0.alpha.custom_build"> +<class name="WorldEnvironment" inherits="Node" category="Core" version="3.0-alpha"> <brief_description> Sets environment properties for the entire scene </brief_description> diff --git a/doc/classes/XMLParser.xml b/doc/classes/XMLParser.xml index bb9599e273..5e7ba3b4bf 100644 --- a/doc/classes/XMLParser.xml +++ b/doc/classes/XMLParser.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="XMLParser" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="XMLParser" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> Low-level class for creating parsers for XML files. </brief_description> diff --git a/doc/classes/YSort.xml b/doc/classes/YSort.xml index 3c0c8b3d06..de4c8be11a 100644 --- a/doc/classes/YSort.xml +++ b/doc/classes/YSort.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="YSort" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> +<class name="YSort" inherits="Node2D" category="Core" version="3.0-alpha"> <brief_description> Sort all child nodes based on their Y positions. </brief_description> diff --git a/doc/classes/bool.xml b/doc/classes/bool.xml index 1d662ba946..f596180bcf 100644 --- a/doc/classes/bool.xml +++ b/doc/classes/bool.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="bool" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="bool" category="Built-In Types" version="3.0-alpha"> <brief_description> Boolean built-in type </brief_description> diff --git a/doc/classes/float.xml b/doc/classes/float.xml index 942aa4d55a..703ca55be8 100644 --- a/doc/classes/float.xml +++ b/doc/classes/float.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="float" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="float" category="Built-In Types" version="3.0-alpha"> <brief_description> Float built-in type </brief_description> diff --git a/doc/classes/int.xml b/doc/classes/int.xml index 7c2267ac9a..79a198b198 100644 --- a/doc/classes/int.xml +++ b/doc/classes/int.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="int" category="Built-In Types" version="3.0.alpha.custom_build"> +<class name="int" category="Built-In Types" version="3.0-alpha"> <brief_description> Integer built-in type. </brief_description> diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index dc015d781b..cd0108019b 100644 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -7,6 +7,7 @@ import os import xml.etree.ElementTree as ET input_list = [] +cur_file = "" for arg in sys.argv[1:]: if arg.endswith(os.sep): @@ -206,6 +207,7 @@ def rstize_text(text, cclass): elif cmd == '/code': tag_text = '``' inside_code = False + escape_post = True elif inside_code: tag_text = '[' + tag_text + ']' elif cmd.find('html') == 0: @@ -217,7 +219,10 @@ def rstize_text(text, cclass): param = tag_text[space_pos + 1:] if param.find('.') != -1: - (class_param, method_param) = param.split('.') + ss = param.split('.') + if len(ss) > 2: + sys.exit("Bad reference: '" + param + "' in file: " + cur_file) + (class_param, method_param) = ss tag_text = ':ref:`' + class_param + '.' + method_param + '<class_' + class_param + '_' + method_param + '>`' else: tag_text = ':ref:`' + param + '<class_' + cclass + "_" + param + '>`' @@ -519,8 +524,8 @@ for path in input_list: elif os.path.isfile(path) and path.endswith('.xml'): file_list.append(path) -for file in file_list: - tree = ET.parse(file) +for cur_file in file_list: + tree = ET.parse(cur_file) doc = tree.getroot() if 'version' not in doc.attrib: diff --git a/drivers/SCsub b/drivers/SCsub index 34d6254578..938927f3a9 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -34,7 +34,12 @@ if env['tools']: SConscript("convex_decomp/SCsub") if env['vsproj']: + import os + path = os.getcwd() + # Change directory so the path resolves correctly in the function call. + os.chdir("..") env.AddToVSProject(env.drivers_sources) + os.chdir(path) if env.split_drivers: env.split_lib("drivers") diff --git a/drivers/gl_context/context_gl.cpp b/drivers/gl_context/context_gl.cpp index a453eef227..1581512369 100644 --- a/drivers/gl_context/context_gl.cpp +++ b/drivers/gl_context/context_gl.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "context_gl.h" -#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) +#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED) ContextGL *ContextGL::singleton = NULL; diff --git a/drivers/gl_context/context_gl.h b/drivers/gl_context/context_gl.h index 399657eb52..3496f2948c 100644 --- a/drivers/gl_context/context_gl.h +++ b/drivers/gl_context/context_gl.h @@ -30,7 +30,7 @@ #ifndef CONTEXT_GL_H #define CONTEXT_GL_H -#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) +#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED) #include "typedefs.h" diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 5d62d2f5a0..308a18aa9d 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -149,13 +149,6 @@ void RasterizerCanvasGLES3::canvas_begin() { storage->frame.clear_request = false; } - /*canvas_shader.unbind(); - canvas_shader.set_custom_shader(0); - canvas_shader.set_conditional(CanvasShaderGLES2::USE_MODULATE,false); - canvas_shader.bind(); - canvas_shader.set_uniform(CanvasShaderGLES2::TEXTURE, 0); - canvas_use_modulate=false;*/ - reset_canvas(); state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_TEXTURE_RECT, true); @@ -911,61 +904,6 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur } } -#if 0 -void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material,Shader* shader) { - - if (canvas_shader.bind()) - rebind_texpixel_size=true; - - if (material->shader_version!=shader->version) { - //todo optimize uniforms - material->shader_version=shader->version; - } - - if (shader->has_texscreen && framebuffer.active) { - - int x = viewport.x; - int y = window_size.height-(viewport.height+viewport.y); - - canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_MULT,Vector2(float(viewport.width)/framebuffer.width,float(viewport.height)/framebuffer.height)); - canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_CLAMP,Color(float(x)/framebuffer.width,float(y)/framebuffer.height,float(x+viewport.width)/framebuffer.width,float(y+viewport.height)/framebuffer.height)); - canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_TEX,max_texture_units-1); - glActiveTexture(GL_TEXTURE0+max_texture_units-1); - glBindTexture(GL_TEXTURE_2D,framebuffer.sample_color); - if (framebuffer.scale==1 && !canvas_texscreen_used) { -#ifdef GLEW_ENABLED - if (current_rt) { - glReadBuffer(GL_COLOR_ATTACHMENT0); - } else { - glReadBuffer(GL_BACK); - } -#endif - if (current_rt) { - glCopyTexSubImage2D(GL_TEXTURE_2D,0,viewport.x,viewport.y,viewport.x,viewport.y,viewport.width,viewport.height); - canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_CLAMP,Color(float(x)/framebuffer.width,float(viewport.y)/framebuffer.height,float(x+viewport.width)/framebuffer.width,float(y+viewport.height)/framebuffer.height)); - //window_size.height-(viewport.height+viewport.y) - } else { - glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); - } - - canvas_texscreen_used=true; - } - - glActiveTexture(GL_TEXTURE0); - - } - - if (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; - -} - -#endif - void RasterizerCanvasGLES3::_copy_texscreen(const Rect2 &p_rect) { glDisable(GL_BLEND); @@ -1570,6 +1508,7 @@ void RasterizerCanvasGLES3::reset_canvas() { glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); + glDisable(GL_DITHER); glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 220a3533b7..ee61481a86 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -141,28 +141,22 @@ void RasterizerGLES3::initialize() { print_line("Using GLES3 video driver"); } -#ifdef GLEW_ENABLED - GLuint res = glewInit(); - ERR_FAIL_COND(res != GLEW_OK); - if (OS::get_singleton()->is_stdout_verbose()) { - print_line(String("GLES2: Using GLEW ") + (const char *)glewGetString(GLEW_VERSION)); +#ifdef GLAD_ENABLED + if (!gladLoadGL()) { + ERR_PRINT("Error initializing GLAD"); } - // Check for GL 2.1 compatibility, if not bail out - if (!glewIsSupported("GL_VERSION_3_0")) { - ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 3.0+ / GLES 3.0, sorry :(\n" +// GLVersion seems to be used for both GL and GL ES, so we need different version checks for them +#ifdef OPENGL_ENABLED // OpenGL 3.3 Core Profile required + if (GLVersion.major < 3 && GLVersion.minor < 3) { +#else // OpenGL ES 3.0 + if (GLVersion.major < 3) { +#endif + ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.0, sorry :(\n" "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault."); - OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 3.0+ / GLES 3.0, sorry :(\n" + OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.0, sorry :(\n" "Godot Engine will self-destruct as soon as you acknowledge this error message.", - "Fatal error: Insufficient OpenGL / GLES drivers"); - // TODO: If it's even possible, we should stop the execution without segfault and memory leaks :) - } -#endif - -#ifdef GLAD_ENABLED - - if (!gladLoadGL()) { - ERR_PRINT("Error initializing GLAD"); + "Fatal error: Insufficient OpenGL / GLES driver support"); } #ifdef __APPLE__ @@ -175,21 +169,20 @@ void RasterizerGLES3::initialize() { } #endif -#endif +#endif // GLAD_ENABLED - /* glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_ERROR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); + /* // For debugging + glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_ERROR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_PORTABILITY_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_PERFORMANCE_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); glDebugMessageControlARB(GL_DEBUG_SOURCE_API_ARB,GL_DEBUG_TYPE_OTHER_ARB,GL_DEBUG_SEVERITY_HIGH_ARB,0,NULL,GL_TRUE); glDebugMessageInsertARB( - GL_DEBUG_SOURCE_API_ARB, GL_DEBUG_TYPE_OTHER_ARB, 1, GL_DEBUG_SEVERITY_HIGH_ARB,5, "hello"); - -*/ + */ const GLubyte *renderer = glGetString(GL_RENDERER); print_line("OpenGL ES 3.0 Renderer: " + String((const char *)renderer)); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 296d945cda..004c628252 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2600,7 +2600,7 @@ RID RasterizerStorageGLES3::mesh_create() { return mesh_owner.make_rid(mesh); } -void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<Rect3> &p_bone_aabbs) { +void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<AABB> &p_bone_aabbs) { PoolVector<uint8_t> array = p_array; @@ -2866,7 +2866,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh, uint32_t p_format, VS: glGenBuffers(1, &surface->vertex_id); glBindBuffer(GL_ARRAY_BUFFER, surface->vertex_id); - glBufferData(GL_ARRAY_BUFFER, array_size, vr.ptr(), GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, array_size, vr.ptr(), p_format & VS::ARRAY_FLAG_USE_DYNAMIC_UPDATE ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind if (p_format & VS::ARRAY_FORMAT_INDEX) { @@ -3104,6 +3104,22 @@ VS::BlendShapeMode RasterizerStorageGLES3::mesh_get_blend_shape_mode(RID p_mesh) return mesh->blend_shape_mode; } +void RasterizerStorageGLES3::mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) { + + Mesh *mesh = mesh_owner.getornull(p_mesh); + ERR_FAIL_COND(!mesh); + ERR_FAIL_INDEX(p_surface, mesh->surfaces.size()); + + int total_size = p_data.size(); + ERR_FAIL_COND(p_offset + total_size > mesh->surfaces[p_surface]->array_byte_size); + + PoolVector<uint8_t>::Read r = p_data.read(); + + glBindBuffer(GL_ARRAY_BUFFER, mesh->surfaces[p_surface]->array_id); + glBufferSubData(GL_ARRAY_BUFFER, p_offset, total_size, r.ptr()); + glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind +} + void RasterizerStorageGLES3::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) { Mesh *mesh = mesh_owner.getornull(p_mesh); @@ -3224,11 +3240,11 @@ VS::PrimitiveType RasterizerStorageGLES3::mesh_surface_get_primitive_type(RID p_ return mesh->surfaces[p_surface]->primitive; } -Rect3 RasterizerStorageGLES3::mesh_surface_get_aabb(RID p_mesh, int p_surface) const { +AABB RasterizerStorageGLES3::mesh_surface_get_aabb(RID p_mesh, int p_surface) const { const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh, Rect3()); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Rect3()); + ERR_FAIL_COND_V(!mesh, AABB()); + ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), AABB()); return mesh->surfaces[p_surface]->aabb; } @@ -3263,11 +3279,11 @@ Vector<PoolVector<uint8_t> > RasterizerStorageGLES3::mesh_surface_get_blend_shap return bsarr; } -Vector<Rect3> RasterizerStorageGLES3::mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const { +Vector<AABB> RasterizerStorageGLES3::mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const { const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh, Vector<Rect3>()); - ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Vector<Rect3>()); + ERR_FAIL_COND_V(!mesh, Vector<AABB>()); + ERR_FAIL_INDEX_V(p_surface, mesh->surfaces.size(), Vector<AABB>()); return mesh->surfaces[p_surface]->skeleton_bone_aabb; } @@ -3321,7 +3337,7 @@ int RasterizerStorageGLES3::mesh_get_surface_count(RID p_mesh) const { return mesh->surfaces.size(); } -void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh, const Rect3 &p_aabb) { +void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); @@ -3329,37 +3345,37 @@ void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh, const Rect3 &p_aab mesh->custom_aabb = p_aabb; } -Rect3 RasterizerStorageGLES3::mesh_get_custom_aabb(RID p_mesh) const { +AABB RasterizerStorageGLES3::mesh_get_custom_aabb(RID p_mesh) const { const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh, Rect3()); + ERR_FAIL_COND_V(!mesh, AABB()); return mesh->custom_aabb; } -Rect3 RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const { +AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const { Mesh *mesh = mesh_owner.get(p_mesh); - ERR_FAIL_COND_V(!mesh, Rect3()); + ERR_FAIL_COND_V(!mesh, AABB()); - if (mesh->custom_aabb != Rect3()) + if (mesh->custom_aabb != AABB()) return mesh->custom_aabb; Skeleton *sk = NULL; if (p_skeleton.is_valid()) sk = skeleton_owner.get(p_skeleton); - Rect3 aabb; + AABB aabb; if (sk && sk->size != 0) { for (int i = 0; i < mesh->surfaces.size(); i++) { - Rect3 laabb; + AABB laabb; if ((mesh->surfaces[i]->format & VS::ARRAY_FORMAT_BONES) && mesh->surfaces[i]->skeleton_bone_aabb.size()) { int bs = mesh->surfaces[i]->skeleton_bone_aabb.size(); - const Rect3 *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr(); + const AABB *skbones = mesh->surfaces[i]->skeleton_bone_aabb.ptr(); const bool *skused = mesh->surfaces[i]->skeleton_bone_used.ptr(); int sbs = sk->size; @@ -3385,7 +3401,7 @@ Rect3 RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const { mtx.basis[1].y = texture[base_ofs + 1]; mtx.origin.y = texture[base_ofs + 3]; - Rect3 baabb = mtx.xform(skbones[j]); + AABB baabb = mtx.xform(skbones[j]); if (first) { laabb = baabb; first = false; @@ -3418,7 +3434,7 @@ Rect3 RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const { mtx.basis[2].z = texture[base_ofs + 2]; mtx.origin.z = texture[base_ofs + 3]; - Rect3 baabb = mtx.xform(skbones[j]); + AABB baabb = mtx.xform(skbones[j]); if (first) { laabb = baabb; first = false; @@ -4012,10 +4028,10 @@ int RasterizerStorageGLES3::multimesh_get_visible_instances(RID p_multimesh) con return multimesh->visible_instances; } -Rect3 RasterizerStorageGLES3::multimesh_get_aabb(RID p_multimesh) const { +AABB RasterizerStorageGLES3::multimesh_get_aabb(RID p_multimesh) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); - ERR_FAIL_COND_V(!multimesh, Rect3()); + ERR_FAIL_COND_V(!multimesh, AABB()); const_cast<RasterizerStorageGLES3 *>(this)->update_dirty_multimeshes(); //update pending AABBs @@ -4037,7 +4053,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() { if (multimesh->size && multimesh->dirty_aabb) { - Rect3 mesh_aabb; + AABB mesh_aabb; if (multimesh->mesh.is_valid()) { mesh_aabb = mesh_get_aabb(multimesh->mesh, RID()); @@ -4049,7 +4065,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() { int count = multimesh->data.size(); float *data = multimesh->data.ptr(); - Rect3 aabb; + AABB aabb; if (multimesh->transform_format == VS::MULTIMESH_TRANSFORM_2D) { @@ -4064,7 +4080,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() { xform.basis[1][1] = dataptr[5]; xform.origin[1] = dataptr[7]; - Rect3 laabb = xform.xform(mesh_aabb); + AABB laabb = xform.xform(mesh_aabb); if (i == 0) aabb = laabb; else @@ -4090,7 +4106,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() { xform.basis.elements[2][2] = dataptr[10]; xform.origin.z = dataptr[11]; - Rect3 laabb = xform.xform(mesh_aabb); + AABB laabb = xform.xform(mesh_aabb); if (i == 0) aabb = laabb; else @@ -4226,10 +4242,10 @@ void RasterizerStorageGLES3::immediate_clear(RID p_immediate) { im->instance_change_notify(); } -Rect3 RasterizerStorageGLES3::immediate_get_aabb(RID p_immediate) const { +AABB RasterizerStorageGLES3::immediate_get_aabb(RID p_immediate) const { Immediate *im = immediate_owner.get(p_immediate); - ERR_FAIL_COND_V(!im, Rect3()); + ERR_FAIL_COND_V(!im, AABB()); return im->aabb; } @@ -4678,10 +4694,10 @@ uint64_t RasterizerStorageGLES3::light_get_version(RID p_light) const { return light->version; } -Rect3 RasterizerStorageGLES3::light_get_aabb(RID p_light) const { +AABB RasterizerStorageGLES3::light_get_aabb(RID p_light) const { const Light *light = light_owner.getornull(p_light); - ERR_FAIL_COND_V(!light, Rect3()); + ERR_FAIL_COND_V(!light, AABB()); switch (light->type) { @@ -4689,22 +4705,22 @@ Rect3 RasterizerStorageGLES3::light_get_aabb(RID p_light) const { float len = light->param[VS::LIGHT_PARAM_RANGE]; float size = Math::tan(Math::deg2rad(light->param[VS::LIGHT_PARAM_SPOT_ANGLE])) * len; - return Rect3(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len)); + return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len)); } break; case VS::LIGHT_OMNI: { float r = light->param[VS::LIGHT_PARAM_RANGE]; - return Rect3(-Vector3(r, r, r), Vector3(r, r, r) * 2); + return AABB(-Vector3(r, r, r), Vector3(r, r, r) * 2); } break; case VS::LIGHT_DIRECTIONAL: { - return Rect3(); + return AABB(); } break; default: {} } - ERR_FAIL_V(Rect3()); - return Rect3(); + ERR_FAIL_V(AABB()); + return AABB(); } /* PROBE API */ @@ -4826,11 +4842,11 @@ void RasterizerStorageGLES3::reflection_probe_set_cull_mask(RID p_probe, uint32_ reflection_probe->instance_change_notify(); } -Rect3 RasterizerStorageGLES3::reflection_probe_get_aabb(RID p_probe) const { +AABB RasterizerStorageGLES3::reflection_probe_get_aabb(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); - ERR_FAIL_COND_V(!reflection_probe, Rect3()); + ERR_FAIL_COND_V(!reflection_probe, AABB()); - Rect3 aabb; + AABB aabb; aabb.position = -reflection_probe->extents; aabb.size = reflection_probe->extents * 2.0; @@ -4887,7 +4903,7 @@ RID RasterizerStorageGLES3::gi_probe_create() { GIProbe *gip = memnew(GIProbe); - gip->bounds = Rect3(Vector3(), Vector3(1, 1, 1)); + gip->bounds = AABB(Vector3(), Vector3(1, 1, 1)); gip->dynamic_range = 1.0; gip->energy = 1.0; gip->propagation = 1.0; @@ -4901,7 +4917,7 @@ RID RasterizerStorageGLES3::gi_probe_create() { return gi_probe_owner.make_rid(gip); } -void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe, const Rect3 &p_bounds) { +void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) { GIProbe *gip = gi_probe_owner.getornull(p_probe); ERR_FAIL_COND(!gip); @@ -4910,10 +4926,10 @@ void RasterizerStorageGLES3::gi_probe_set_bounds(RID p_probe, const Rect3 &p_bou gip->version++; gip->instance_change_notify(); } -Rect3 RasterizerStorageGLES3::gi_probe_get_bounds(RID p_probe) const { +AABB RasterizerStorageGLES3::gi_probe_get_bounds(RID p_probe) const { const GIProbe *gip = gi_probe_owner.getornull(p_probe); - ERR_FAIL_COND_V(!gip, Rect3()); + ERR_FAIL_COND_V(!gip, AABB()); return gip->bounds; } @@ -5322,7 +5338,7 @@ void RasterizerStorageGLES3::_particles_update_histories(Particles *particles) { particles->clear = true; } -void RasterizerStorageGLES3::particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb) { +void RasterizerStorageGLES3::particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) { Particles *particles = particles_owner.getornull(p_particles); ERR_FAIL_COND(!particles); @@ -5413,15 +5429,15 @@ void RasterizerStorageGLES3::particles_request_process(RID p_particles) { } } -Rect3 RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { +AABB RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { const Particles *particles = particles_owner.getornull(p_particles); - ERR_FAIL_COND_V(!particles, Rect3()); + ERR_FAIL_COND_V(!particles, AABB()); glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[0]); float *data = (float *)glMapBufferRange(GL_ARRAY_BUFFER, 0, particles->amount * 16 * 6, GL_MAP_READ_BIT); - Rect3 aabb; + AABB aabb; Transform inv = particles->emission_transform.affine_inverse(); @@ -5443,7 +5459,7 @@ Rect3 RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { float longest_axis = 0; for (int i = 0; i < particles->draw_passes.size(); i++) { if (particles->draw_passes[i].is_valid()) { - Rect3 maabb = mesh_get_aabb(particles->draw_passes[i], RID()); + AABB maabb = mesh_get_aabb(particles->draw_passes[i], RID()); longest_axis = MAX(maabb.get_longest_axis_size(), longest_axis); } } @@ -5453,10 +5469,10 @@ Rect3 RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { return aabb; } -Rect3 RasterizerStorageGLES3::particles_get_aabb(RID p_particles) const { +AABB RasterizerStorageGLES3::particles_get_aabb(RID p_particles) const { const Particles *particles = particles_owner.getornull(p_particles); - ERR_FAIL_COND_V(!particles, Rect3()); + ERR_FAIL_COND_V(!particles, AABB()); return particles->custom_aabb; } @@ -7011,14 +7027,22 @@ void RasterizerStorageGLES3::initialize() { glBindBuffer(GL_ARRAY_BUFFER, resources.quadie); { const float qv[16] = { - -1, -1, - 0, 0, - -1, 1, - 0, 1, - 1, 1, - 1, 1, - 1, -1, - 1, 0, + -1, + -1, + 0, + 0, + -1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + -1, + 1, + 0, }; glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 16, qv, GL_STATIC_DRAW); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 6abc22b643..8aa8235b42 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -592,7 +592,7 @@ public: GLuint instancing_array_wireframe_id; int index_wireframe_len; - Vector<Rect3> skeleton_bone_aabb; + Vector<AABB> skeleton_bone_aabb; Vector<bool> skeleton_bone_used; //bool packed; @@ -604,7 +604,7 @@ public: Vector<BlendShape> blend_shapes; - Rect3 aabb; + AABB aabb; int array_len; int index_array_len; @@ -659,7 +659,7 @@ public: Vector<Surface *> surfaces; int blend_shape_count; VS::BlendShapeMode blend_shape_mode; - Rect3 custom_aabb; + AABB custom_aabb; mutable uint64_t last_pass; SelfList<MultiMesh>::List multimeshes; @@ -684,7 +684,7 @@ public: virtual RID mesh_create(); - virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<Rect3> &p_bone_aabbs = Vector<Rect3>()); + virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()); virtual void mesh_set_blend_shape_count(RID p_mesh, int p_amount); virtual int mesh_get_blend_shape_count(RID p_mesh) const; @@ -692,6 +692,8 @@ public: virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode); virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const; + virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data); + virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material); virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; @@ -704,17 +706,17 @@ public: virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const; virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const; - virtual Rect3 mesh_surface_get_aabb(RID p_mesh, int p_surface) const; + virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const; virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const; - virtual Vector<Rect3> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const; + virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const; virtual void mesh_remove_surface(RID p_mesh, int p_surface); virtual int mesh_get_surface_count(RID p_mesh) const; - virtual void mesh_set_custom_aabb(RID p_mesh, const Rect3 &p_aabb); - virtual Rect3 mesh_get_custom_aabb(RID p_mesh) const; + virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb); + virtual AABB mesh_get_custom_aabb(RID p_mesh) const; - virtual Rect3 mesh_get_aabb(RID p_mesh, RID p_skeleton) const; + virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const; virtual void mesh_clear(RID p_mesh); void mesh_render_blend_shapes(Surface *s, float *p_weights); @@ -727,7 +729,7 @@ public: VS::MultimeshTransformFormat transform_format; VS::MultimeshColorFormat color_format; Vector<float> data; - Rect3 aabb; + AABB aabb; SelfList<MultiMesh> update_list; SelfList<MultiMesh> mesh_list; GLuint buffer; @@ -778,7 +780,7 @@ public: virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible); virtual int multimesh_get_visible_instances(RID p_multimesh) const; - virtual Rect3 multimesh_get_aabb(RID p_multimesh) const; + virtual AABB multimesh_get_aabb(RID p_multimesh) const; /* IMMEDIATE API */ @@ -799,7 +801,7 @@ public: List<Chunk> chunks; bool building; int mask; - Rect3 aabb; + AABB aabb; Immediate() { type = GEOMETRY_IMMEDIATE; @@ -828,7 +830,7 @@ public: virtual void immediate_clear(RID p_immediate); virtual void immediate_set_material(RID p_immediate, RID p_material); virtual RID immediate_get_material(RID p_immediate) const; - virtual Rect3 immediate_get_aabb(RID p_immediate) const; + virtual AABB immediate_get_aabb(RID p_immediate) const; /* SKELETON API */ @@ -916,7 +918,7 @@ public: virtual float light_get_param(RID p_light, VS::LightParam p_param); virtual Color light_get_color(RID p_light); - virtual Rect3 light_get_aabb(RID p_light) const; + virtual AABB light_get_aabb(RID p_light) const; virtual uint64_t light_get_version(RID p_light) const; /* PROBE API */ @@ -954,7 +956,7 @@ public: virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable); virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers); - virtual Rect3 reflection_probe_get_aabb(RID p_probe) const; + virtual AABB reflection_probe_get_aabb(RID p_probe) const; virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const; virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const; @@ -967,7 +969,7 @@ public: struct GIProbe : public Instantiable { - Rect3 bounds; + AABB bounds; Transform to_cell; float cell_size; @@ -988,8 +990,8 @@ public: virtual RID gi_probe_create(); - virtual void gi_probe_set_bounds(RID p_probe, const Rect3 &p_bounds); - virtual Rect3 gi_probe_get_bounds(RID p_probe) const; + virtual void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds); + virtual AABB gi_probe_get_bounds(RID p_probe) const; virtual void gi_probe_set_cell_size(RID p_probe, float p_size); virtual float gi_probe_get_cell_size(RID p_probe) const; @@ -1056,7 +1058,7 @@ public: float explosiveness; float randomness; bool restart_request; - Rect3 custom_aabb; + AABB custom_aabb; bool use_local_coords; RID process_material; @@ -1111,7 +1113,7 @@ public: restart_request = false; - custom_aabb = Rect3(Vector3(-4, -4, -4), Vector3(8, 8, 8)); + custom_aabb = AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8)); draw_order = VS::PARTICLES_DRAW_ORDER_INDEX; particle_buffers[0] = 0; @@ -1153,7 +1155,7 @@ public: virtual void particles_set_pre_process_time(RID p_particles, float p_time); virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio); virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio); - virtual void particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb); + virtual void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb); virtual void particles_set_speed_scale(RID p_particles, float p_scale); virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable); virtual void particles_set_process_material(RID p_particles, RID p_material); @@ -1167,8 +1169,8 @@ public: virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh); virtual void particles_request_process(RID p_particles); - virtual Rect3 particles_get_current_aabb(RID p_particles); - virtual Rect3 particles_get_aabb(RID p_particles) const; + virtual AABB particles_get_current_aabb(RID p_particles); + virtual AABB particles_get_aabb(RID p_particles) const; virtual void _particles_update_histories(Particles *particles); diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index ad08c59de8..325df8e4f1 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -741,6 +741,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMAL"] = "#define NORMAL_USED\n"; actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMALMAP"] = "#define NORMALMAP_USED\n"; actions[VS::SHADER_CANVAS_ITEM].usage_defines["SHADOW_COLOR"] = "#define SHADOW_COLOR_USED\n"; + actions[VS::SHADER_CANVAS_ITEM].usage_defines["LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n"; actions[VS::SHADER_CANVAS_ITEM].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n"; @@ -828,6 +829,9 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() { actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n"; actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n"; + actions[VS::SHADER_SPATIAL].usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n"; + actions[VS::SHADER_SPATIAL].usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n"; + actions[VS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength"; actions[VS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n"; diff --git a/editor/SCsub b/editor/SCsub index c531d2c7a6..75ec422bd5 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -21,11 +21,11 @@ def make_certs_header(target, source, env): g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef _CERTS_RAW_H\n") g.write("#define _CERTS_RAW_H\n") - g.write("static const int _certs_compressed_size=" + str(len(buf)) + ";\n") - g.write("static const int _certs_uncompressed_size=" + str(decomp_size) + ";\n") - g.write("static const unsigned char _certs_compressed[]={\n") + g.write("static const int _certs_compressed_size = " + str(len(buf)) + ";\n") + g.write("static const int _certs_uncompressed_size = " + str(decomp_size) + ";\n") + g.write("static const unsigned char _certs_compressed[] = {\n") for i in range(len(buf)): - g.write(byte_to_str(buf[i]) + ",\n") + g.write("\t" + byte_to_str(buf[i]) + ",\n") g.write("};\n") g.write("#endif") @@ -43,7 +43,7 @@ def make_doc_header(target, source, env): continue f = open_utf8(src, "r") content = f.read() - buf+=content + buf += content buf = encode_utf8(docbegin + buf + docend) decomp_size = len(buf) @@ -53,11 +53,11 @@ def make_doc_header(target, source, env): g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef _DOC_DATA_RAW_H\n") g.write("#define _DOC_DATA_RAW_H\n") - g.write("static const int _doc_data_compressed_size=" + str(len(buf)) + ";\n") - g.write("static const int _doc_data_uncompressed_size=" + str(decomp_size) + ";\n") - g.write("static const unsigned char _doc_data_compressed[]={\n") + g.write("static const int _doc_data_compressed_size = " + str(len(buf)) + ";\n") + g.write("static const int _doc_data_uncompressed_size = " + str(decomp_size) + ";\n") + g.write("static const unsigned char _doc_data_compressed[] = {\n") for i in range(len(buf)): - g.write(byte_to_str(buf[i]) + ",\n") + g.write("\t" + byte_to_str(buf[i]) + ",\n") g.write("};\n") g.write("#endif") @@ -82,10 +82,10 @@ def make_fonts_header(target, source, env): name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0] - g.write("static const int _font_" + name + "_size=" + str(len(buf)) + ";\n") - g.write("static const unsigned char _font_" + name + "[]={\n") + g.write("static const int _font_" + name + "_size = " + str(len(buf)) + ";\n") + g.write("static const unsigned char _font_" + name + "[] = {\n") for i in range(len(buf)): - g.write(byte_to_str(buf[i]) + ",\n") + g.write("\t" + byte_to_str(buf[i]) + ",\n") g.write("};\n") @@ -116,11 +116,9 @@ def make_translations_header(target, source, env): buf = zlib.compress(buf) name = os.path.splitext(os.path.basename(sorted_paths[i]))[0] - #g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n") - #g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n") - g.write("static const unsigned char _translation_" + name + "_compressed[]={\n") + g.write("static const unsigned char _translation_" + name + "_compressed[] = {\n") for i in range(len(buf)): - g.write(byte_to_str(buf[i]) + ",\n") + g.write("\t" + byte_to_str(buf[i]) + ",\n") g.write("};\n") @@ -132,10 +130,10 @@ def make_translations_header(target, source, env): g.write("\tint uncomp_size;\n") g.write("\tconst unsigned char* data;\n") g.write("};\n\n") - g.write("static EditorTranslationList _editor_translations[]={\n") + g.write("static EditorTranslationList _editor_translations[] = {\n") for x in xl_names: - g.write("\t{ \"" + x[0] + "\", " + str(x[1]) + ", " + str(x[2]) + ",_translation_" + x[0] + "_compressed},\n") - g.write("\t{NULL,0,0,NULL}\n") + g.write("\t{ \"" + x[0] + "\", " + str(x[1]) + ", " + str(x[2]) + ", _translation_" + x[0] + "_compressed},\n") + g.write("\t{NULL, 0, 0, NULL}\n") g.write("};\n") g.write("#endif") @@ -392,13 +390,13 @@ def make_license_header(target, source, env): def _make_doc_data_class_path(to_path): g = open_utf8(os.path.join(to_path,"doc_data_class_path.gen.h"), "w") - g.write("static const int _doc_data_class_path_count="+str(len(env.doc_class_path))+";\n") + g.write("static const int _doc_data_class_path_count = " + str(len(env.doc_class_path)) + ";\n") g.write("struct _DocDataClassPath { const char* name; const char* path; };\n") - g.write("static const _DocDataClassPath _doc_data_class_paths["+str(len(env.doc_class_path)+1)+"]={\n"); - for c in env.doc_class_path: - g.write("{\""+c+"\",\""+env.doc_class_path[c]+"\"},\n") - g.write("{NULL,NULL}\n") + g.write("static const _DocDataClassPath _doc_data_class_paths[" + str(len(env.doc_class_path) + 1) + "] = {\n"); + for c in sorted(env.doc_class_path): + g.write("\t{\"" + c + "\", \"" + env.doc_class_path[c] + "\"},\n") + g.write("\t{NULL, NULL}\n") g.write("};\n") @@ -418,11 +416,22 @@ if env['tools']: # API documentation docs = [] - for f in os.listdir(os.path.join(env.Dir('#').abspath, "doc/classes")): - docs.append("#doc/classes/" + f) + doc_dirs = ["doc/classes"] + + for p in env.doc_class_path.values(): + if p not in doc_dirs: + doc_dirs.append(p) + + for d in doc_dirs: + try: + for f in os.listdir(os.path.join(env.Dir('#').abspath, d)): + docs.append("#" + os.path.join(d, f)) + except OSError: + pass _make_doc_data_class_path(os.path.join(env.Dir('#').abspath, "editor/doc")) + docs = sorted(docs) env.Depends("#editor/doc_data_compressed.gen.h", docs) env.Command("#editor/doc_data_compressed.gen.h", docs, make_doc_header) # Certificates diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index 54eb695178..7d877bdb8c 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -1368,7 +1368,7 @@ void AnimationKeyEditor::_track_editor_draw() { icon_ofs.x-=hsep; */ - track_ofs[0] = size.width - icon_ofs.x; + track_ofs[0] = size.width - icon_ofs.x + ofs.x; icon_ofs.x -= down_icon->get_width(); te->draw_texture(down_icon, icon_ofs - Size2(0, 4 * EDSCALE)); @@ -1380,7 +1380,7 @@ void AnimationKeyEditor::_track_editor_draw() { icon_ofs.x -= hsep; te->draw_line(Point2(icon_ofs.x, ofs.y + y), Point2(icon_ofs.x, ofs.y + y + h), sepcolor); - track_ofs[1] = size.width - icon_ofs.x; + track_ofs[1] = size.width - icon_ofs.x + ofs.x; icon_ofs.x -= down_icon->get_width(); te->draw_texture(down_icon, icon_ofs - Size2(0, 4 * EDSCALE)); @@ -1394,7 +1394,7 @@ void AnimationKeyEditor::_track_editor_draw() { icon_ofs.x -= hsep; te->draw_line(Point2(icon_ofs.x, ofs.y + y), Point2(icon_ofs.x, ofs.y + y + h), sepcolor); - track_ofs[2] = size.width - icon_ofs.x; + track_ofs[2] = size.width - icon_ofs.x + ofs.x; if (animation->track_get_type(idx) == Animation::TYPE_VALUE) { @@ -1415,13 +1415,12 @@ void AnimationKeyEditor::_track_editor_draw() { icon_ofs.x -= hsep; te->draw_line(Point2(icon_ofs.x, ofs.y + y), Point2(icon_ofs.x, ofs.y + y + h), sepcolor); - track_ofs[3] = size.width - icon_ofs.x; + track_ofs[3] = size.width - icon_ofs.x + ofs.x; icon_ofs.x -= hsep; icon_ofs.x -= add_key_icon->get_width(); te->draw_texture((mouse_over.over == MouseOver::OVER_ADD_KEY && mouse_over.track == idx) ? add_key_icon_hl : add_key_icon, icon_ofs); - - track_ofs[4] = size.width - icon_ofs.x; + track_ofs[4] = size.width - icon_ofs.x + ofs.x; //draw the keys; int tt = animation->track_get_type(idx); @@ -2080,7 +2079,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input) return; } - if (mpos.x < name_limit) { + if (mpos.x < name_limit - (type_icon[0]->get_width() / 2.0)) { //name column // area @@ -3330,7 +3329,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id, int p_last_track) { h.type == Variant::VECTOR2 || h.type == Variant::RECT2 || h.type == Variant::VECTOR3 || - h.type == Variant::RECT3 || + h.type == Variant::AABB || h.type == Variant::QUAT || h.type == Variant::COLOR || h.type == Variant::TRANSFORM) { diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 0100c221c4..c7012a0c14 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -56,6 +56,7 @@ void GotoLineDialog::ok_pressed() { if (get_line() < 1 || get_line() > text_editor->get_line_count()) return; + text_editor->unfold_line(get_line() - 1); text_editor->cursor_set_line(get_line() - 1); hide(); } @@ -139,6 +140,7 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) if (found) { if (!preserve_cursor) { + text_edit->unfold_line(line); text_edit->cursor_set_line(line, false); text_edit->cursor_set_column(col + text.length(), false); text_edit->center_viewport_to_cursor(); @@ -167,6 +169,7 @@ void FindReplaceBar::_replace() { if (result_line != -1 && result_col != -1) { text_edit->begin_complex_operation(); + text_edit->unfold_line(result_line); text_edit->select(result_line, result_col, result_line, result_col + get_search_text().length()); text_edit->insert_text_at_cursor(get_replace_text()); @@ -214,6 +217,7 @@ void FindReplaceBar::_replace_all() { prev_match = Point2i(result_line, result_col + replace_text.length()); + text_edit->unfold_line(result_line); text_edit->select(result_line, result_col, result_line, match_to.y); if (selection_enabled && is_selection_only()) { @@ -751,6 +755,7 @@ bool FindReplaceDialog::_search() { if (found) { // print_line("found"); + text_edit->unfold_line(line); text_edit->cursor_set_line(line); if (is_backwards()) text_edit->cursor_set_column(col); @@ -1093,6 +1098,8 @@ void CodeTextEditor::update_editor_settings() { text_editor->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink")); text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed")); text_editor->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_breakpoint_gutter")); + text_editor->set_hiding_enabled(EditorSettings::get_singleton()->get("text_editor/line_numbers/code_folding")); + text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/code_folding")); text_editor->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret")); text_editor->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/open_scripts/smooth_scrolling")); text_editor->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/open_scripts/v_scroll_speed")); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index b4c2ac95cc..cd60455f4f 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -209,7 +209,7 @@ void ConnectDialog::_add_bind() { case Variant::VECTOR3: value = Vector3(); break; case Variant::PLANE: value = Plane(); break; case Variant::QUAT: value = Quat(); break; - case Variant::RECT3: value = Rect3(); break; + case Variant::AABB: value = AABB(); break; case Variant::BASIS: value = Basis(); break; case Variant::TRANSFORM: value = Transform(); break; case Variant::COLOR: value = Color(); break; @@ -295,7 +295,7 @@ ConnectDialog::ConnectDialog() { type_list->add_item("Vector3", Variant::VECTOR3); type_list->add_item("Plane", Variant::PLANE); type_list->add_item("Quat", Variant::QUAT); - type_list->add_item("Rect3", Variant::RECT3); + type_list->add_item("AABB", Variant::AABB); type_list->add_item("Basis", Variant::BASIS); type_list->add_item("Transform", Variant::TRANSFORM); //type_list->add_separator(); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 95b4f7e982..02af304dc6 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -97,6 +97,15 @@ void CreateDialog::popup_create(bool p_dontclear) { search_box->grab_focus(); _update_search(); + + bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines"); + Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color"); + + if (enable_rl) { + search_options->add_constant_override("draw_relationship_lines", 1); + search_options->add_color_override("relationship_line_color", rl_color); + } else + search_options->add_constant_override("draw_relationship_lines", 0); } void CreateDialog::_text_changed(const String &p_newtext) { diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index 533ed48d15..f7f823c945 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "doc_data.h" +#include "engine.h" #include "global_constants.h" #include "io/compression.h" #include "io/marshalls.h" @@ -529,7 +530,7 @@ void DocData::generate(bool p_basic_types) { { - String cname = "@Global Scope"; + String cname = "@GlobalScope"; class_list[cname] = ClassDoc(); ClassDoc &c = class_list[cname]; c.name = cname; @@ -543,14 +544,14 @@ void DocData::generate(bool p_basic_types) { c.constants.push_back(cd); } - List<ProjectSettings::Singleton> singletons; - ProjectSettings::get_singleton()->get_singletons(&singletons); + List<Engine::Singleton> singletons; + Engine::get_singleton()->get_singletons(&singletons); //servers (this is kind of hackish) - for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) { + for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) { PropertyDoc pd; - ProjectSettings::Singleton &s = E->get(); + Engine::Singleton &s = E->get(); pd.name = s.name; pd.type = s.ptr->get_class(); while (String(ClassDB::get_parent_class(pd.type)) != "Object") @@ -950,7 +951,7 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri if (c.category == "") category = "Core"; header += " category=\"" + category + "\""; - header += " version=\"" + String(VERSION_MKSTRING) + "\""; + header += String(" version=\"") + _MKSTR(VERSION_MAJOR) + "." + _MKSTR(VERSION_MINOR) + "-" + _MKSTR(VERSION_STATUS) + "\""; header += ">"; _write_string(f, 0, header); _write_string(f, 1, "<brief_description>"); diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp index 2ba7e3c779..45b7613659 100644 --- a/editor/doc/doc_dump.cpp +++ b/editor/doc/doc_dump.cpp @@ -82,8 +82,8 @@ void DocDump::dump(const String &p_file) { FileAccess *f = FileAccess::open(p_file, FileAccess::WRITE); _write_string(f, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); + _write_string(f, 0, String("<doc version=\"") + _MKSTR(VERSION_MAJOR) + "." + _MKSTR(VERSION_MINOR) + "-" + _MKSTR(VERSION_STATUS) + "\" name=\"Engine Types\">"); - _write_string(f, 0, "<doc version=\"" + String(VERSION_MKSTRING) + "\" name=\"Engine Types\">"); while (class_list.size()) { String name = class_list.front()->get(); @@ -182,7 +182,7 @@ void DocDump::dump(const String &p_file) { case Variant::VECTOR3: case Variant::PLANE: case Variant::QUAT: - case Variant::RECT3: + case Variant::AABB: case Variant::BASIS: case Variant::COLOR: case Variant::POOL_BYTE_ARRAY: diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index efe32b99ab..a458a10cd2 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -982,7 +982,7 @@ void EditorExport::remove_export_preset(int p_idx) { void EditorExport::add_export_plugin(const Ref<EditorExportPlugin> &p_plugin) { - if (export_plugins.find(p_plugin) == 1) { + if (export_plugins.find(p_plugin) == -1) { export_plugins.push_back(p_plugin); } } diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 9e002bc73d..9db3bcba00 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -913,7 +913,8 @@ void EditorFileSystem::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - scan(); + call_deferred("scan"); //this should happen after every editor node entered the tree + } break; case NOTIFICATION_EXIT_TREE: { if (use_threads && thread) { diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index bdb621a258..cc7f1cac43 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -555,7 +555,7 @@ void EditorHelp::_class_desc_select(const String &p_select) { if (select.find(".") != -1) { class_name = select.get_slice(".", 0); } else { - class_name = "@Global Scope"; + class_name = "@GlobalScope"; } emit_signal("go_to_help", "class_enum:" + class_name + ":" + select); return; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index e0cae7de57..a9423019dd 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -906,23 +906,29 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { int preview_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); preview_size *= EDSCALE; - int width, height; - if (img->get_width() > preview_size && img->get_width() >= img->get_height()) { - width = preview_size; - height = img->get_height() * preview_size / img->get_width(); - } else if (img->get_height() > preview_size && img->get_height() >= img->get_width()) { + // consider a square region + int vp_size = MIN(img->get_width(), img->get_height()); + int x = (img->get_width() - vp_size) / 2; + int y = (img->get_height() - vp_size) / 2; - height = preview_size; - width = img->get_width() * preview_size / img->get_height(); + img->convert(Image::FORMAT_RGB8); + + if (vp_size < preview_size) { + // just square it. + img->crop_from_point(x, y, vp_size, vp_size); } else { + int ratio = vp_size / preview_size; + int size = preview_size * (ratio / 2); - width = img->get_width(); - height = img->get_height(); + x = (img->get_width() - size) / 2; + y = (img->get_height() - size) / 2; + + img->crop_from_point(x, y, size, size); + // We could get better pictures with better filters + img->resize(preview_size, preview_size, Image::INTERPOLATE_CUBIC); } - img->convert(Image::FORMAT_RGB8); - img->resize(width, height); img->flip_y(); //save thumbnail directly, as thumbnailer may not update due to actual scene not changing md5 @@ -1109,7 +1115,7 @@ void EditorNode::_dialog_action(String p_file) { _save_default_environment(); _save_scene_with_preview(p_file); - _run(true); + _run(false, p_file); } } break; @@ -3273,7 +3279,7 @@ void EditorNode::register_editor_types() { ClassDB::register_class<EditorResourceConversionPlugin>(); // FIXME: Is this stuff obsolete, or should it be ported to new APIs? - //ClassDB::register_class<EditorScenePostImport>(); + ClassDB::register_class<EditorScenePostImport>(); //ClassDB::register_type<EditorImportExport>(); } @@ -4276,12 +4282,19 @@ Variant EditorNode::drag_files_and_dirs(const Vector<String> &p_paths, Control * void EditorNode::_dropped_files(const Vector<String> &p_files, int p_screen) { - /* - String cur_path = filesystem_dock->get_current_path(); - for(int i=0;i<EditorImportExport::get_singleton()->get_import_plugin_count();i++) { - EditorImportExport::get_singleton()->get_import_plugin(i)->import_from_drop(p_files,cur_path); + String to_path = ProjectSettings::get_singleton()->globalize_path(get_filesystem_dock()->get_current_path()); + DirAccessRef dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + + for (int i = 0; i < p_files.size(); i++) { + + String from = p_files[i]; + if (!ResourceFormatImporter::get_singleton()->can_be_imported(from)) { + continue; + } + String to = to_path.plus_file(from.get_file()); + dir->copy(from, to); } - */ + EditorFileSystem::get_singleton()->scan_changes(); } void EditorNode::_file_access_close_error_notify(const String &p_str) { @@ -4552,6 +4565,11 @@ static Node *_resource_get_edited_scene() { return EditorNode::get_singleton()->get_edited_scene(); } +void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_error) { + EditorNode *en = (EditorNode *)p_this; + en->log->add_message(p_string, p_error); +} + EditorNode::EditorNode() { Resource::_get_local_scene_func = _resource_get_edited_scene; @@ -4788,7 +4806,12 @@ EditorNode::EditorNode() { dock_tab_move_left->set_focus_mode(Control::FOCUS_NONE); dock_tab_move_left->connect("pressed", this, "_dock_move_left"); dock_hb->add_child(dock_tab_move_left); - dock_hb->add_spacer(); + + Label *dock_label = memnew(Label); + dock_label->set_text(TTR("Dock Position")); + dock_label->set_h_size_flags(Control::SIZE_EXPAND_FILL); + dock_hb->add_child(dock_label); + dock_tab_move_right = memnew(ToolButton); dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons")); dock_tab_move_right->set_focus_mode(Control::FOCUS_NONE); @@ -5533,6 +5556,10 @@ EditorNode::EditorNode() { spatial_mat_convert.instance(); resource_conversion_plugins.push_back(spatial_mat_convert); + Ref<CanvasItemMaterialConversionPlugin> canvas_item_mat_convert; + canvas_item_mat_convert.instance(); + resource_conversion_plugins.push_back(canvas_item_mat_convert); + Ref<ParticlesMaterialConversionPlugin> particles_mat_convert; particles_mat_convert.instance(); resource_conversion_plugins.push_back(particles_mat_convert); @@ -5648,6 +5675,10 @@ EditorNode::EditorNode() { _dim_timer->connect("timeout", this, "_dim_timeout"); add_child(_dim_timer); + print_handler.printfunc = _print_handler; + print_handler.userdata = this; + add_print_handler(&print_handler); + ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_F1); ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_F2); ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_F3); //hack neded for script editor F3 search to work :) Assign like this or don't use F3 @@ -5659,6 +5690,7 @@ EditorNode::EditorNode() { EditorNode::~EditorNode() { + remove_print_handler(&print_handler); memdelete(EditorHelp::get_doc_data()); memdelete(editor_selection); memdelete(editor_plugins_over); diff --git a/editor/editor_node.h b/editor/editor_node.h index 81ff886228..54cb414835 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -30,6 +30,7 @@ #ifndef EDITOR_NODE_H #define EDITOR_NODE_H +#include "core/print_string.h" #include "editor/connections_dialog.h" #include "editor/create_dialog.h" #include "editor/editor_about.h" @@ -610,6 +611,9 @@ private: Vector<Ref<EditorResourceConversionPlugin> > resource_conversion_plugins; + PrintHandlerList print_handler; + static void _print_handler(void *p_this, const String &p_string, bool p_error); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 0bd677ca1b..38e8b301b7 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -102,14 +102,14 @@ Vector<Ref<Texture> > EditorInterface::make_mesh_previews(const Vector<Ref<Mesh> textures.push_back(Ref<Texture>()); continue; } - Rect3 aabb = mesh->get_aabb(); + AABB aabb = mesh->get_aabb(); print_line("aabb: " + aabb); Vector3 ofs = aabb.position + aabb.size * 0.5; aabb.position -= ofs; Transform xform; xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI * 0.25); xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI * 0.25) * xform.basis; - Rect3 rot_aabb = xform.xform(aabb); + AABB rot_aabb = xform.xform(aabb); print_line("rot_aabb: " + rot_aabb); float m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5; if (m == 0) { @@ -455,7 +455,11 @@ void EditorPlugin::make_visible(bool p_visible) { void EditorPlugin::edit(Object *p_object) { if (get_script_instance() && get_script_instance()->has_method("edit")) { - get_script_instance()->call("edit", p_object); + if (p_object->is_class("Resource")) { + get_script_instance()->call("edit", Ref<Resource>(Object::cast_to<Resource>(p_object))); + } else { + get_script_instance()->call("edit", p_object); + } } } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index bf4ef3ae39..96e0aef0e1 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -334,6 +334,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("text_editor/line_numbers/show_line_numbers", true); _initial_set("text_editor/line_numbers/line_numbers_zero_padded", false); _initial_set("text_editor/line_numbers/show_breakpoint_gutter", true); + _initial_set("text_editor/line_numbers/code_folding", true); _initial_set("text_editor/line_numbers/show_line_length_guideline", false); _initial_set("text_editor/line_numbers/line_length_guideline_column", 80); hints["text_editor/line_numbers/line_length_guideline_column"] = PropertyInfo(Variant::INT, "text_editor/line_numbers/line_length_guideline_column", PROPERTY_HINT_RANGE, "20, 160, 10"); @@ -922,7 +923,8 @@ void EditorSettings::raise_order(const String &p_setting) { void EditorSettings::set_initial_value(const StringName &p_setting, const Variant &p_value) { - ERR_FAIL_COND(!props.has(p_setting)); + if (!props.has(p_setting)) + return; props[p_setting].initial = p_value; props[p_setting].initial_set = true; } diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 7abddb9f67..533401b317 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1454,11 +1454,21 @@ void FileSystemDock::select_file(const String &p_file) { void FileSystemDock::_file_multi_selected(int p_index, bool p_selected) { - _file_selected(); + import_dock_needs_update = true; + call_deferred("_update_import_dock"); } void FileSystemDock::_file_selected() { + import_dock_needs_update = true; + _update_import_dock(); +} + +void FileSystemDock::_update_import_dock() { + + if (!import_dock_needs_update) + return; + //check import Vector<String> imports; String import_type; @@ -1498,6 +1508,8 @@ void FileSystemDock::_file_selected() { } else { EditorNode::get_singleton()->get_import_dock()->set_edit_multiple_paths(imports); } + + import_dock_needs_update = false; } void FileSystemDock::_bind_methods() { @@ -1534,6 +1546,7 @@ void FileSystemDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_preview_invalidated"), &FileSystemDock::_preview_invalidated); ClassDB::bind_method(D_METHOD("_file_selected"), &FileSystemDock::_file_selected); ClassDB::bind_method(D_METHOD("_file_multi_selected"), &FileSystemDock::_file_multi_selected); + ClassDB::bind_method(D_METHOD("_update_import_dock"), &FileSystemDock::_update_import_dock); ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files"))); ADD_SIGNAL(MethodInfo("open")); @@ -1705,6 +1718,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { updating_tree = false; initialized = false; + import_dock_needs_update = false; history_pos = 0; history_max_size = 20; diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index 249621564d..d100de8b72 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -147,6 +147,7 @@ private: bool updating_tree; Tree *tree; //directories ItemList *files; + bool import_dock_needs_update; bool _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths); void _update_tree(bool keep_collapse_state); @@ -161,6 +162,7 @@ private: void _select_file(int p_idx); void _file_multi_selected(int p_index, bool p_selected); + void _update_import_dock(); void _file_selected(); void _dir_selected(); diff --git a/editor/icons/icon_texture_button.svg b/editor/icons/icon_texture_button.svg index 17f87ab861..19f5e8d5c9 100644 --- a/editor/icons/icon_texture_button.svg +++ b/editor/icons/icon_texture_button.svg @@ -1,7 +1,5 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m1 3v8h14v-8h-1-12-1zm8 2h1v1h1v2h1v2h-2-2-2-2v-1h1v-1h1v-1h2v-1h1v-1z" fill="#a5efac"/> -<rect transform="scale(1,-1)" x="1" y="-1049.4" width="14" height="2.0001" fill="#a5efac"/> -<rect transform="scale(1,-1)" x="1" y="-1049.4" width="14" height="2.0001" fill-opacity=".078431"/> +<path transform="translate(0 1036.4)" d="m8 1v2h6v10h-4v2h6v-14h-8zm-5 1v3.1328l-1.4453-0.96484-1.1094 1.6641 3 2c0.3359 0.2239 0.77347 0.2239 1.1094 0l3-2-1.1094-1.6641-1.4453 0.96484v-3.1328h-2zm7 4v1h-1v1h-1v1h1v2h2 2v-2h-1v-2h-1v-1h-1zm-7.5 4c-0.831 0-1.5 0.669-1.5 1.5v0.5 1h-1v2h8v-2h-1v-1-0.5c0-0.831-0.669-1.5-1.5-1.5h-3z" fill="#a5efac"/> </g> </svg> diff --git a/editor/icons/icon_texture_rect.svg b/editor/icons/icon_texture_rect.svg index 86d24ac223..2dbbe7f247 100644 --- a/editor/icons/icon_texture_rect.svg +++ b/editor/icons/icon_texture_rect.svg @@ -1,6 +1,5 @@ <svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0 -1036.4)"> -<rect x="2" y="1038.4" width="12" height="12" fill="none" stroke="#a5efac" stroke-linecap="round" stroke-width="2"/> -<path d="m9 1042.4v1h-1v1h-2v1h-1v1h-1v1h2 2 2 2v-2h-1v-2h-1v-1h-1z" fill="#a5efac"/> +<path transform="translate(0 1036.4)" d="m1 1v14h14v-14h-14zm2 2h10v10h-10v-10zm6 3v1h-1v1h-2v1h-1v1h-1v1h2 2 2 2v-2h-1v-2h-1v-1h-1z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#a5efac" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> </g> </svg> diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index 4541c77085..bd24aac99b 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -413,6 +413,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in for (List<Ref<Mesh> >::Element *E = meshes.front(); E; E = E->next()) { MeshInstance *mi = memnew(MeshInstance); + mi->set_mesh(E->get()); mi->set_name(E->get()->get_name()); scene->add_child(mi); mi->set_owner(scene); diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 660db9ac27..cbc21c9536 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -232,16 +232,26 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array } } - if (_teststr(name, "colonly")) { + if (_teststr(name, "colonly") || _teststr(name, "convcolonly")) { if (isroot) return p_node; MeshInstance *mi = Object::cast_to<MeshInstance>(p_node); if (mi) { - Node *col = mi->create_trimesh_collision_node(); - ERR_FAIL_COND_V(!col, NULL); + Node *col; + + if (_teststr(name, "colonly")) { + col = mi->create_trimesh_collision_node(); + ERR_FAIL_COND_V(!col, NULL); + + col->set_name(_fixstr(name, "colonly")); + } else { + col = mi->create_convex_collision_node(); + ERR_FAIL_COND_V(!col, NULL); + + col->set_name(_fixstr(name, "convcolonly")); + } - col->set_name(_fixstr(name, "colonly")); Object::cast_to<Spatial>(col)->set_transform(mi->get_transform()); p_node->replace_by(col); memdelete(p_node); @@ -292,7 +302,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array // get mesh instance and bounding box MeshInstance *mi = Object::cast_to<MeshInstance>(p_node); - Rect3 aabb = mi->get_aabb(); + AABB aabb = mi->get_aabb(); // create a new rigid body collision node RigidBody *rigid_body = memnew(RigidBody); @@ -328,15 +338,25 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array rb->add_child(colshape); colshape->set_owner(p_node->get_owner()); - } else if (_teststr(name, "col") && Object::cast_to<MeshInstance>(p_node)) { + } else if ((_teststr(name, "col") || (_teststr(name, "convcol"))) && Object::cast_to<MeshInstance>(p_node)) { MeshInstance *mi = Object::cast_to<MeshInstance>(p_node); + Node *col; - mi->set_name(_fixstr(name, "col")); - Node *col = mi->create_trimesh_collision_node(); - ERR_FAIL_COND_V(!col, NULL); + if (_teststr(name, "col")) { + mi->set_name(_fixstr(name, "col")); + col = mi->create_trimesh_collision_node(); + ERR_FAIL_COND_V(!col, NULL); + + col->set_name("col"); + } else { + mi->set_name(_fixstr(name, "convcol")); + col = mi->create_convex_collision_node(); + ERR_FAIL_COND_V(!col, NULL); + + col->set_name("convcol"); + } - col->set_name("col"); p_node->add_child(col); StaticBody *sb = Object::cast_to<StaticBody>(col); @@ -527,26 +547,55 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array #endif } else if (Object::cast_to<MeshInstance>(p_node)) { - //last attempt, maybe collision insde the mesh data + //last attempt, maybe collision inside the mesh data MeshInstance *mi = Object::cast_to<MeshInstance>(p_node); Ref<ArrayMesh> mesh = mi->get_mesh(); if (!mesh.is_null()) { - if (_teststr(mesh->get_name(), "col")) { - - mesh->set_name(_fixstr(mesh->get_name(), "col")); + if (_teststr(mesh->get_name(), "col") || _teststr(mesh->get_name(), "convcol")) { Ref<Shape> shape; + if (_teststr(mesh->get_name(), "col")) { + mesh->set_name(_fixstr(mesh->get_name(), "col")); + + if (collision_map.has(mesh)) { + shape = collision_map[mesh]; + + } else { + + shape = mesh->create_trimesh_shape(); + if (!shape.is_null()) + collision_map[mesh] = shape; + } + } else if (_teststr(mesh->get_name(), "convcol")) { + mesh->set_name(_fixstr(mesh->get_name(), "convcol")); + + if (collision_map.has(mesh)) { + shape = collision_map[mesh]; + + } else { + + shape = mesh->create_convex_shape(); + if (!shape.is_null()) + collision_map[mesh] = shape; + } + } - if (collision_map.has(mesh)) { - shape = collision_map[mesh]; + if (!shape.is_null()) { + StaticBody *col = memnew(StaticBody); + CollisionShape *cshape = memnew(CollisionShape); + cshape->set_shape(shape); + col->add_child(cshape); - } else { + col->set_transform(mi->get_transform()); + col->set_name(mi->get_name()); + p_node->replace_by(col); + memdelete(p_node); + p_node = col; - shape = mesh->create_trimesh_shape(); - if (!shape.is_null()) - collision_map[mesh] = shape; + cshape->set_name("shape"); + cshape->set_owner(p_node->get_owner()); } } } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 38467369db..b6ba09fb58 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -176,9 +176,9 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2 &mouse_pos) { for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { Node2D *n2d = Object::cast_to<Node2D>(E->get()); - if (n2d && n2d->edit_has_pivot()) { + if (n2d && n2d->_edit_use_pivot()) { - Vector2 offset = n2d->edit_get_pivot(); + Vector2 offset = n2d->_edit_get_pivot(); Vector2 gpos = n2d->get_global_position(); Vector2 local_mouse_pos = n2d->get_canvas_transform().affine_inverse().xform(mouse_pos); @@ -186,9 +186,9 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2 &mouse_pos) { Vector2 motion_ofs = gpos - local_mouse_pos; undo_redo->add_do_method(n2d, "set_global_position", local_mouse_pos); - undo_redo->add_do_method(n2d, "edit_set_pivot", offset + n2d->get_global_transform().affine_inverse().basis_xform(motion_ofs)); + undo_redo->add_do_method(n2d, "_edit_set_pivot", offset + n2d->get_global_transform().affine_inverse().basis_xform(motion_ofs)); undo_redo->add_undo_method(n2d, "set_global_position", gpos); - undo_redo->add_undo_method(n2d, "edit_set_pivot", offset); + undo_redo->add_undo_method(n2d, "_edit_set_pivot", offset); for (int i = 0; i < n2d->get_child_count(); i++) { Node2D *n2dc = Object::cast_to<Node2D>(n2d->get_child(i)); if (!n2dc) @@ -249,8 +249,8 @@ void CanvasItemEditor::_snap_other_nodes(Point2 p_value, Point2 &r_current_snap, Transform2D ci_transform = canvas_item->get_global_transform_with_canvas(); Transform2D to_snap_transform = p_to_snap ? p_to_snap->get_global_transform_with_canvas() : Transform2D(); if (fmod(ci_transform.get_rotation() - to_snap_transform.get_rotation(), (real_t)360.0) == 0.0) { - Point2 begin = ci_transform.xform(canvas_item->get_item_rect().get_position()); - Point2 end = ci_transform.xform(canvas_item->get_item_rect().get_position() + canvas_item->get_item_rect().get_size()); + Point2 begin = ci_transform.xform(canvas_item->_edit_get_rect().get_position()); + Point2 end = ci_transform.xform(canvas_item->_edit_get_rect().get_position() + canvas_item->_edit_get_rect().get_size()); _snap_if_closer_point(p_value, begin, r_current_snap, r_snapped, ci_transform.get_rotation()); _snap_if_closer_point(p_value, end, r_current_snap, r_snapped, ci_transform.get_rotation()); @@ -282,8 +282,8 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, const end = p_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(1, 1))); can_snap = true; } else if (const CanvasItem *parent_ci = Object::cast_to<CanvasItem>(p_canvas_item->get_parent())) { - begin = p_canvas_item->get_transform().affine_inverse().xform(parent_ci->get_item_rect().get_position()); - end = p_canvas_item->get_transform().affine_inverse().xform(parent_ci->get_item_rect().get_position() + parent_ci->get_item_rect().get_size()); + begin = p_canvas_item->get_transform().affine_inverse().xform(parent_ci->_edit_get_rect().get_position()); + end = p_canvas_item->get_transform().affine_inverse().xform(parent_ci->_edit_get_rect().get_position() + parent_ci->_edit_get_rect().get_size()); can_snap = true; } @@ -306,8 +306,8 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, const // Self sides (for anchors) if ((snap_active && snap_node_sides && (p_modes & SNAP_NODE_SIDES)) || (p_forced_modes & SNAP_NODE_SIDES)) { - begin = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->get_item_rect().get_position()); - end = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->get_item_rect().get_position() + p_canvas_item->get_item_rect().get_size()); + begin = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->_edit_get_rect().get_position()); + end = p_canvas_item->get_global_transform_with_canvas().xform(p_canvas_item->_edit_get_rect().get_position() + p_canvas_item->_edit_get_rect().get_size()); _snap_if_closer_point(p_target, begin, output, snapped, rotation); _snap_if_closer_point(p_target, end, output, snapped, rotation); } @@ -629,7 +629,7 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no if (c && c->is_visible_in_tree() && !c->has_meta("_edit_lock_") && !Object::cast_to<CanvasLayer>(c)) { - Rect2 rect = c->get_item_rect(); + Rect2 rect = c->_edit_get_rect(); Point2 local_pos = (p_parent_xform * p_canvas_xform * c->get_transform()).affine_inverse().xform(p_pos); if (rect.has_point(local_pos)) { @@ -675,7 +675,7 @@ void CanvasItemEditor::_find_canvas_items_at_rect(const Rect2 &p_rect, Node *p_n if (c && c->is_visible_in_tree() && !c->has_meta("_edit_lock_") && !Object::cast_to<CanvasLayer>(c)) { - Rect2 rect = c->get_item_rect(); + Rect2 rect = c->_edit_get_rect(); Transform2D xform = p_parent_xform * p_canvas_xform * c->get_transform(); if (p_rect.has_point(xform.xform(rect.position)) && @@ -767,15 +767,15 @@ void CanvasItemEditor::_key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE if (p_snap) drag *= grid_step * Math::pow(2.0, grid_step_multiplier); - undo_redo->add_undo_method(canvas_item, "edit_set_state", canvas_item->edit_get_state()); + undo_redo->add_undo_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state()); if (p_move_mode == MOVE_VIEW_BASE) { // drag = transform.affine_inverse().basis_xform(p_dir); // zoom sensitive drag = canvas_item->get_global_transform_with_canvas().affine_inverse().basis_xform(drag); - Rect2 local_rect = canvas_item->get_item_rect(); + Rect2 local_rect = canvas_item->_edit_get_rect(); local_rect.position += drag; - undo_redo->add_do_method(canvas_item, "edit_set_rect", local_rect); + undo_redo->add_do_method(canvas_item, "_edit_set_rect", local_rect); } else { // p_move_mode==MOVE_LOCAL_BASE || p_move_mode==MOVE_LOCAL_WITH_ROT @@ -816,7 +816,7 @@ Point2 CanvasItemEditor::_find_topleftmost_point() { if (canvas_item->get_viewport() != EditorNode::get_singleton()->get_scene_root()) continue; - Rect2 rect = canvas_item->get_item_rect(); + Rect2 rect = canvas_item->_edit_get_rect(); Transform2D xform = canvas_item->get_global_transform_with_canvas(); r2.expand_to(xform.xform(rect.position)); @@ -877,7 +877,7 @@ CanvasItemEditor::DragType CanvasItemEditor::_get_resize_handle_drag_type(const ERR_FAIL_COND_V(!canvas_item, DRAG_NONE); - Rect2 rect = canvas_item->get_item_rect(); + Rect2 rect = canvas_item->_edit_get_rect(); Transform2D xforml = canvas_item->get_global_transform_with_canvas(); Transform2D xform = transform * xforml; @@ -1011,14 +1011,14 @@ void CanvasItemEditor::_prepare_drag(const Point2 &p_click_pos) { if (!se) continue; - se->undo_state = canvas_item->edit_get_state(); + se->undo_state = canvas_item->_edit_get_state(); if (Object::cast_to<Node2D>(canvas_item)) - se->undo_pivot = Object::cast_to<Node2D>(canvas_item)->edit_get_pivot(); + se->undo_pivot = Object::cast_to<Node2D>(canvas_item)->_edit_get_pivot(); if (Object::cast_to<Control>(canvas_item)) se->undo_pivot = Object::cast_to<Control>(canvas_item)->get_pivot_offset(); se->pre_drag_xform = canvas_item->get_global_transform_with_canvas(); - se->pre_drag_rect = canvas_item->get_item_rect(); + se->pre_drag_rect = canvas_item->_edit_get_rect(); } if (selection.size() == 1 && Object::cast_to<Node2D>(selection[0]) && bone_ik_list.size() == 0) { @@ -1500,7 +1500,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { // Cancel a drag if (bone_ik_list.size()) { for (List<BoneIK>::Element *E = bone_ik_list.back(); E; E = E->prev()) { - E->get().node->edit_set_state(E->get().orig_state); + E->get().node->_edit_set_state(E->get().orig_state); } bone_ik_list.clear(); @@ -1519,9 +1519,9 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { if (!se) continue; - canvas_item->edit_set_state(se->undo_state); + canvas_item->_edit_set_state(se->undo_state); if (Object::cast_to<Node2D>(canvas_item)) - Object::cast_to<Node2D>(canvas_item)->edit_set_pivot(se->undo_pivot); + Object::cast_to<Node2D>(canvas_item)->_edit_set_pivot(se->undo_pivot); if (Object::cast_to<Control>(canvas_item)) Object::cast_to<Control>(canvas_item)->set_pivot_offset(se->undo_pivot); } @@ -1574,8 +1574,8 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { for (List<BoneIK>::Element *E = bone_ik_list.back(); E; E = E->prev()) { - undo_redo->add_do_method(E->get().node, "edit_set_state", E->get().node->edit_get_state()); - undo_redo->add_undo_method(E->get().node, "edit_set_state", E->get().orig_state); + undo_redo->add_do_method(E->get().node, "_edit_set_state", E->get().node->_edit_get_state()); + undo_redo->add_undo_method(E->get().node, "_edit_set_state", E->get().orig_state); } undo_redo->add_do_method(viewport, "update"); @@ -1601,14 +1601,14 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { if (!se) continue; - Variant state = canvas_item->edit_get_state(); - undo_redo->add_do_method(canvas_item, "edit_set_state", state); - undo_redo->add_undo_method(canvas_item, "edit_set_state", se->undo_state); + Variant state = canvas_item->_edit_get_state(); + undo_redo->add_do_method(canvas_item, "_edit_set_state", state); + undo_redo->add_undo_method(canvas_item, "_edit_set_state", se->undo_state); { Node2D *pvt = Object::cast_to<Node2D>(canvas_item); - if (pvt && pvt->edit_has_pivot()) { - undo_redo->add_do_method(canvas_item, "edit_set_pivot", pvt->edit_get_pivot()); - undo_redo->add_undo_method(canvas_item, "edit_set_pivot", se->undo_pivot); + if (pvt && pvt->_edit_use_pivot()) { + undo_redo->add_do_method(canvas_item, "_edit_set_pivot", pvt->_edit_get_pivot()); + undo_redo->add_undo_method(canvas_item, "_edit_set_pivot", se->undo_pivot); } Control *cnt = Object::cast_to<Control>(canvas_item); @@ -1709,7 +1709,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { BoneIK bik; bik.node = b; bik.len = len; - bik.orig_state = b->edit_get_state(); + bik.orig_state = b->_edit_get_state(); bone_ik_list.push_back(bik); @@ -1741,13 +1741,13 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { if ((b->get_control() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) { drag = DRAG_ROTATE; drag_from = transform.affine_inverse().xform(click); - se->undo_state = canvas_item->edit_get_state(); + se->undo_state = canvas_item->_edit_get_state(); if (Object::cast_to<Node2D>(canvas_item)) - se->undo_pivot = Object::cast_to<Node2D>(canvas_item)->edit_get_pivot(); + se->undo_pivot = Object::cast_to<Node2D>(canvas_item)->_edit_get_pivot(); if (Object::cast_to<Control>(canvas_item)) se->undo_pivot = Object::cast_to<Control>(canvas_item)->get_pivot_offset(); se->pre_drag_xform = canvas_item->get_global_transform_with_canvas(); - se->pre_drag_rect = canvas_item->get_item_rect(); + se->pre_drag_rect = canvas_item->_edit_get_rect(); return; } @@ -1764,13 +1764,13 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { 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(); + se->undo_state = canvas_item->_edit_get_state(); if (Object::cast_to<Node2D>(canvas_item)) - se->undo_pivot = Object::cast_to<Node2D>(canvas_item)->edit_get_pivot(); + se->undo_pivot = Object::cast_to<Node2D>(canvas_item)->_edit_get_pivot(); if (Object::cast_to<Control>(canvas_item)) se->undo_pivot = Object::cast_to<Control>(canvas_item)->get_pivot_offset(); se->pre_drag_xform = canvas_item->get_global_transform_with_canvas(); - se->pre_drag_rect = canvas_item->get_item_rect(); + se->pre_drag_rect = canvas_item->_edit_get_rect(); return; } @@ -1780,9 +1780,9 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { 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(); + se->undo_state = canvas_item->_edit_get_state(); se->pre_drag_xform = canvas_item->get_global_transform_with_canvas(); - se->pre_drag_rect = canvas_item->get_item_rect(); + se->pre_drag_rect = canvas_item->_edit_get_rect(); return; } } @@ -1890,9 +1890,9 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { bool dragging_bone = drag == DRAG_ALL && selection.size() == 1 && bone_ik_list.size(); if (!dragging_bone) { - canvas_item->edit_set_state(se->undo_state); //reset state and reapply + canvas_item->_edit_set_state(se->undo_state); //reset state and reapply if (Object::cast_to<Node2D>(canvas_item)) - Object::cast_to<Node2D>(canvas_item)->edit_set_pivot(se->undo_pivot); + Object::cast_to<Node2D>(canvas_item)->_edit_set_pivot(se->undo_pivot); if (Object::cast_to<Control>(canvas_item)) Object::cast_to<Control>(canvas_item)->set_pivot_offset(se->undo_pivot); } @@ -2003,10 +2003,10 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dto) - canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dfrom); - Rect2 local_rect = canvas_item->get_item_rect(); + Rect2 local_rect = canvas_item->_edit_get_rect(); Vector2 begin = local_rect.position; Vector2 end = local_rect.position + local_rect.size; - Vector2 minsize = canvas_item->edit_get_minimum_size(); + Vector2 minsize = canvas_item->_edit_get_minimum_size(); if (uniform) { // Keep the height/width ratio of the item @@ -2084,7 +2084,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { if (Object::cast_to<Node2D>(canvas_item)) { Node2D *n2d = Object::cast_to<Node2D>(canvas_item); - n2d->edit_set_pivot(se->undo_pivot + drag_vector); + n2d->_edit_set_pivot(se->undo_pivot + drag_vector); } if (Object::cast_to<Control>(canvas_item)) { Object::cast_to<Control>(canvas_item)->set_pivot_offset(se->undo_pivot + drag_vector); @@ -2103,7 +2103,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { local_rect.position = begin; local_rect.size = end - begin; - canvas_item->edit_set_rect(local_rect); + canvas_item->_edit_set_rect(local_rect); } else { //ok, all that had to be done was done, now solve IK @@ -2454,7 +2454,7 @@ void CanvasItemEditor::_draw_selection() { if (!se) continue; - Rect2 rect = canvas_item->get_item_rect(); + Rect2 rect = canvas_item->_edit_get_rect(); if (show_helpers && drag != DRAG_NONE && drag != DRAG_PIVOT) { const Transform2D pre_drag_xform = transform * se->pre_drag_xform; @@ -2496,7 +2496,7 @@ void CanvasItemEditor::_draw_selection() { Node2D *node2d = Object::cast_to<Node2D>(canvas_item); if (node2d) { - if (node2d->edit_has_pivot()) { + if (node2d->_edit_use_pivot()) { viewport->draw_texture(pivot_icon, xform.get_origin() + (-pivot_icon->get_size() / 2).floor()); can_move_pivot = true; pivot_found = true; @@ -2868,7 +2868,7 @@ void CanvasItemEditor::_get_encompassing_rect(Node *p_node, Rect2 &r_rect, const CanvasItem *c = Object::cast_to<CanvasItem>(p_node); if (c && c->is_visible_in_tree()) { - Rect2 rect = c->get_item_rect(); + Rect2 rect = c->_edit_get_rect(); Transform2D xform = p_xform * c->get_transform(); r_rect.expand_to(xform.xform(rect.position)); r_rect.expand_to(xform.xform(rect.position + Point2(rect.size.x, 0))); @@ -2963,7 +2963,7 @@ void CanvasItemEditor::_notification(int p_what) { if (!se) continue; - Rect2 r = canvas_item->get_item_rect(); + Rect2 r = canvas_item->_edit_get_rect(); Transform2D xform = canvas_item->get_transform(); if (r != se->prev_rect || xform != se->prev_xform) { @@ -3899,7 +3899,7 @@ void CanvasItemEditor::_focus_selection(int p_op) { //if (!canvas_item->is_visible_in_tree()) continue; ++count; - Rect2 item_rect = canvas_item->get_item_rect(); + Rect2 item_rect = canvas_item->_edit_get_rect(); Vector2 pos = canvas_item->get_global_transform().get_origin(); Vector2 scale = canvas_item->get_global_transform().get_scale(); diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp index 24c4813771..0818c8975e 100644 --- a/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_editor_plugin.cpp @@ -389,7 +389,7 @@ void CollisionPolygonEditor::_polygon_draw() { rect = rect.grow(1); - Rect3 r; + AABB r; r.position.x = rect.position.x; r.position.y = rect.position.y; r.position.z = depth; diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 5f73d0b465..dd49bae51d 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -790,13 +790,13 @@ Ref<Texture> EditorMeshPreviewPlugin::generate(const RES &p_from) { VS::get_singleton()->instance_set_base(mesh_instance, mesh->get_rid()); - Rect3 aabb = mesh->get_aabb(); + AABB aabb = mesh->get_aabb(); Vector3 ofs = aabb.position + aabb.size * 0.5; aabb.position -= ofs; Transform xform; xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI * 0.125); xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI * 0.125) * xform.basis; - Rect3 rot_aabb = xform.xform(aabb); + AABB rot_aabb = xform.xform(aabb); float m = MAX(rot_aabb.size.x, rot_aabb.size.y) * 0.5; if (m == 0) return Ref<Texture>(); diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index bd4891ccb7..1fc112896d 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -503,3 +503,41 @@ Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_ smat->set_render_priority(mat->get_render_priority()); return smat; } + +String CanvasItemMaterialConversionPlugin::converts_to() const { + + return "ShaderMaterial"; +} +bool CanvasItemMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const { + + Ref<CanvasItemMaterial> mat = p_resource; + return mat.is_valid(); +} +Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) { + + Ref<CanvasItemMaterial> mat = p_resource; + ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>()); + + Ref<ShaderMaterial> smat; + smat.instance(); + + Ref<Shader> shader; + shader.instance(); + + String code = VS::get_singleton()->shader_get_code(mat->get_shader_rid()); + + shader->set_code(code); + + smat->set_shader(shader); + + List<PropertyInfo> params; + VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms); + + for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) { + Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name); + smat->set_shader_param(E->get().name, value); + } + + smat->set_render_priority(mat->get_render_priority()); + return smat; +} diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h index 52c73cb7d8..2cc24be33a 100644 --- a/editor/plugins/material_editor_plugin.h +++ b/editor/plugins/material_editor_plugin.h @@ -119,4 +119,12 @@ public: virtual Ref<Resource> convert(const Ref<Resource> &p_resource); }; +class CanvasItemMaterialConversionPlugin : public EditorResourceConversionPlugin { + GDCLASS(CanvasItemMaterialConversionPlugin, EditorResourceConversionPlugin) +public: + virtual String converts_to() const; + virtual bool handles(const Ref<Resource> &p_resource) const; + virtual Ref<Resource> convert(const Ref<Resource> &p_resource); +}; + #endif // MATERIAL_EDITOR_PLUGIN_H diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index 74618aecc2..60e8858b2d 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -95,7 +95,7 @@ void MeshEditor::edit(Ref<Mesh> p_mesh) { rot_y = 0; _update_rotation(); - Rect3 aabb = mesh->get_aabb(); + AABB aabb = mesh->get_aabb(); print_line("aabb: " + aabb); Vector3 ofs = aabb.position + aabb.size * 0.5; float m = aabb.get_longest_axis_size(); diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 10834b74ff..f4a9960087 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -153,15 +153,15 @@ void ParticlesEditor::_generate_aabb() { EditorProgress ep("gen_aabb", TTR("Generating AABB"), int(time)); - Rect3 rect; + AABB rect; while (running < time) { uint64_t ticks = OS::get_singleton()->get_ticks_usec(); ep.step("Generating..", int(running), true); OS::get_singleton()->delay_usec(1000); - Rect3 capture = node->capture_aabb(); - if (rect == Rect3()) + AABB capture = node->capture_aabb(); + if (rect == AABB()) rect = capture; else rect.merge_with(capture); @@ -247,7 +247,7 @@ void ParticlesEditor::_generate_emission_points() { PoolVector<Face3>::Read r = geometry.read(); - Rect3 aabb; + AABB aabb; for (int i = 0; i < gcount; i++) { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 607ccaa4e7..85416a5700 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1583,7 +1583,7 @@ void ScriptEditor::_update_script_names() { } } - if (_sort_list_on_update) { + if (_sort_list_on_update && !sedata.empty()) { sedata.sort(); // change actual order of tab_container so that the order can be rearranged by user diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 6b945157e8..214f24b386 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -201,7 +201,7 @@ void ScriptTextEditor::_set_theme_for_script() { text_edit->add_keyword_color("Rect2", basetype_color); text_edit->add_keyword_color("Transform2D", basetype_color); text_edit->add_keyword_color("Vector3", basetype_color); - text_edit->add_keyword_color("Rect3", basetype_color); + text_edit->add_keyword_color("AABB", basetype_color); text_edit->add_keyword_color("Basis", basetype_color); text_edit->add_keyword_color("Plane", basetype_color); text_edit->add_keyword_color("Transform", basetype_color); @@ -518,7 +518,9 @@ void ScriptTextEditor::tag_saved_version() { } void ScriptTextEditor::goto_line(int p_line, bool p_with_error) { - code_editor->get_text_edit()->call_deferred("cursor_set_line", p_line); + TextEdit *tx = code_editor->get_text_edit(); + tx->unfold_line(p_line); + tx->call_deferred("cursor_set_line", p_line); } void ScriptTextEditor::ensure_focus() { @@ -712,15 +714,6 @@ void ScriptTextEditor::_breakpoint_toggled(int p_row) { ScriptEditor::get_singleton()->get_debugger()->set_breakpoint(script->get_path(), p_row + 1, code_editor->get_text_edit()->is_line_set_as_breakpoint(p_row)); } -static void swap_lines(TextEdit *tx, int line1, int line2) { - String tmp = tx->get_line(line1); - String tmp2 = tx->get_line(line2); - tx->set_line(line2, tmp); - tx->set_line(line1, tmp2); - - tx->cursor_set_line(line2); -} - void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_column) { Node *base = get_tree()->get_edited_scene_root(); @@ -799,39 +792,41 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c void ScriptTextEditor::_edit_option(int p_op) { + TextEdit *tx = code_editor->get_text_edit(); + switch (p_op) { case EDIT_UNDO: { - code_editor->get_text_edit()->undo(); - code_editor->get_text_edit()->call_deferred("grab_focus"); + + tx->undo(); + tx->call_deferred("grab_focus"); } break; case EDIT_REDO: { - code_editor->get_text_edit()->redo(); - code_editor->get_text_edit()->call_deferred("grab_focus"); + + tx->redo(); + tx->call_deferred("grab_focus"); } break; case EDIT_CUT: { - code_editor->get_text_edit()->cut(); - code_editor->get_text_edit()->call_deferred("grab_focus"); + tx->cut(); + tx->call_deferred("grab_focus"); } break; case EDIT_COPY: { - code_editor->get_text_edit()->copy(); - code_editor->get_text_edit()->call_deferred("grab_focus"); + tx->copy(); + tx->call_deferred("grab_focus"); } break; case EDIT_PASTE: { - code_editor->get_text_edit()->paste(); - code_editor->get_text_edit()->call_deferred("grab_focus"); + tx->paste(); + tx->call_deferred("grab_focus"); } break; case EDIT_SELECT_ALL: { - code_editor->get_text_edit()->select_all(); - code_editor->get_text_edit()->call_deferred("grab_focus"); - + tx->select_all(); + tx->call_deferred("grab_focus"); } break; case EDIT_MOVE_LINE_UP: { - TextEdit *tx = code_editor->get_text_edit(); Ref<Script> scr = script; if (scr.is_null()) return; @@ -850,6 +845,9 @@ void ScriptTextEditor::_edit_option(int p_op) { if (line_id == 0 || next_id < 0) return; + tx->unfold_line(line_id); + tx->unfold_line(next_id); + tx->swap_lines(line_id, next_id); tx->cursor_set_line(next_id); } @@ -863,16 +861,17 @@ void ScriptTextEditor::_edit_option(int p_op) { if (line_id == 0 || next_id < 0) return; + tx->unfold_line(line_id); + tx->unfold_line(next_id); + tx->swap_lines(line_id, next_id); tx->cursor_set_line(next_id); } tx->end_complex_operation(); tx->update(); - } break; case EDIT_MOVE_LINE_DOWN: { - TextEdit *tx = code_editor->get_text_edit(); Ref<Script> scr = get_edited_script(); if (scr.is_null()) return; @@ -891,6 +890,9 @@ void ScriptTextEditor::_edit_option(int p_op) { if (line_id == tx->get_line_count() - 1 || next_id > tx->get_line_count()) return; + tx->unfold_line(line_id); + tx->unfold_line(next_id); + tx->swap_lines(line_id, next_id); tx->cursor_set_line(next_id); } @@ -904,6 +906,9 @@ void ScriptTextEditor::_edit_option(int p_op) { if (line_id == tx->get_line_count() - 1 || next_id > tx->get_line_count()) return; + tx->unfold_line(line_id); + tx->unfold_line(next_id); + tx->swap_lines(line_id, next_id); tx->cursor_set_line(next_id); } @@ -913,7 +918,6 @@ void ScriptTextEditor::_edit_option(int p_op) { } break; case EDIT_INDENT_LEFT: { - TextEdit *tx = code_editor->get_text_edit(); Ref<Script> scr = get_edited_script(); if (scr.is_null()) return; @@ -938,11 +942,9 @@ void ScriptTextEditor::_edit_option(int p_op) { tx->end_complex_operation(); tx->update(); //tx->deselect(); - } break; case EDIT_INDENT_RIGHT: { - TextEdit *tx = code_editor->get_text_edit(); Ref<Script> scr = get_edited_script(); if (scr.is_null()) return; @@ -959,11 +961,9 @@ void ScriptTextEditor::_edit_option(int p_op) { tx->end_complex_operation(); tx->update(); //tx->deselect(); - } break; case EDIT_DELETE_LINE: { - TextEdit *tx = code_editor->get_text_edit(); Ref<Script> scr = get_edited_script(); if (scr.is_null()) return; @@ -972,13 +972,12 @@ void ScriptTextEditor::_edit_option(int p_op) { int line = tx->cursor_get_line(); tx->set_line(tx->cursor_get_line(), ""); tx->backspace_at_cursor(); + tx->unfold_line(line); tx->cursor_set_line(line); tx->end_complex_operation(); - } break; case EDIT_CLONE_DOWN: { - TextEdit *tx = code_editor->get_text_edit(); Ref<Script> scr = get_edited_script(); if (scr.is_null()) return; @@ -997,6 +996,7 @@ void ScriptTextEditor::_edit_option(int p_op) { tx->begin_complex_operation(); for (int i = from_line; i <= to_line; i++) { + tx->unfold_line(i); if (i >= tx->get_line_count() - 1) { tx->set_line(i, tx->get_line(i) + "\n"); } @@ -1012,11 +1012,29 @@ void ScriptTextEditor::_edit_option(int p_op) { tx->end_complex_operation(); tx->update(); + } break; + case EDIT_FOLD_LINE: { + + tx->fold_line(tx->cursor_get_line()); + tx->update(); + } break; + case EDIT_UNFOLD_LINE: { + + tx->unfold_line(tx->cursor_get_line()); + tx->update(); + } break; + case EDIT_FOLD_ALL_LINES: { + + tx->fold_all_lines(); + tx->update(); + } break; + case EDIT_UNFOLD_ALL_LINES: { + tx->unhide_all_lines(); + tx->update(); } break; case EDIT_TOGGLE_COMMENT: { - TextEdit *tx = code_editor->get_text_edit(); Ref<Script> scr = get_edited_script(); if (scr.is_null()) return; @@ -1065,62 +1083,65 @@ void ScriptTextEditor::_edit_option(int p_op) { tx->end_complex_operation(); tx->update(); //tx->deselect(); - } break; case EDIT_COMPLETE: { - code_editor->get_text_edit()->query_code_comple(); - + tx->query_code_comple(); } break; case EDIT_AUTO_INDENT: { - TextEdit *te = code_editor->get_text_edit(); - String text = te->get_text(); + String text = tx->get_text(); Ref<Script> scr = get_edited_script(); if (scr.is_null()) return; - te->begin_complex_operation(); + tx->begin_complex_operation(); int begin, end; - if (te->is_selection_active()) { - begin = te->get_selection_from_line(); - end = te->get_selection_to_line(); + if (tx->is_selection_active()) { + begin = tx->get_selection_from_line(); + end = tx->get_selection_to_line(); // ignore if the cursor is not past the first column - if (te->get_selection_to_column() == 0) { + if (tx->get_selection_to_column() == 0) { end--; } } else { begin = 0; - end = te->get_line_count() - 1; + end = tx->get_line_count() - 1; } scr->get_language()->auto_indent_code(text, begin, end); Vector<String> lines = text.split("\n"); for (int i = begin; i <= end; ++i) { - te->set_line(i, lines[i]); + tx->set_line(i, lines[i]); } - te->end_complex_operation(); - + tx->end_complex_operation(); } break; case EDIT_TRIM_TRAILING_WHITESAPCE: { + trim_trailing_whitespace(); } break; case EDIT_CONVERT_INDENT_TO_SPACES: { + convert_indent_to_spaces(); } break; case EDIT_CONVERT_INDENT_TO_TABS: { + convert_indent_to_tabs(); } break; case EDIT_PICK_COLOR: { + color_panel->popup(); } break; case EDIT_TO_UPPERCASE: { + _convert_case(UPPER); } break; case EDIT_TO_LOWERCASE: { + _convert_case(LOWER); } break; case EDIT_CAPITALIZE: { + _convert_case(CAPITALIZE); } break; case SEARCH_FIND: { @@ -1145,41 +1166,47 @@ void ScriptTextEditor::_edit_option(int p_op) { } break; case SEARCH_GOTO_LINE: { - goto_line_dialog->popup_find_line(code_editor->get_text_edit()); + goto_line_dialog->popup_find_line(tx); } break; case DEBUG_TOGGLE_BREAKPOINT: { - int line = code_editor->get_text_edit()->cursor_get_line(); - bool dobreak = !code_editor->get_text_edit()->is_line_set_as_breakpoint(line); - code_editor->get_text_edit()->set_line_as_breakpoint(line, dobreak); + + int line = tx->cursor_get_line(); + bool dobreak = !tx->is_line_set_as_breakpoint(line); + tx->set_line_as_breakpoint(line, dobreak); ScriptEditor::get_singleton()->get_debugger()->set_breakpoint(get_edited_script()->get_path(), line + 1, dobreak); } break; case DEBUG_REMOVE_ALL_BREAKPOINTS: { + List<int> bpoints; - code_editor->get_text_edit()->get_breakpoints(&bpoints); + tx->get_breakpoints(&bpoints); for (List<int>::Element *E = bpoints.front(); E; E = E->next()) { int line = E->get(); - bool dobreak = !code_editor->get_text_edit()->is_line_set_as_breakpoint(line); - code_editor->get_text_edit()->set_line_as_breakpoint(line, dobreak); + bool dobreak = !tx->is_line_set_as_breakpoint(line); + tx->set_line_as_breakpoint(line, dobreak); ScriptEditor::get_singleton()->get_debugger()->set_breakpoint(get_edited_script()->get_path(), line + 1, dobreak); } } case DEBUG_GOTO_NEXT_BREAKPOINT: { + List<int> bpoints; - code_editor->get_text_edit()->get_breakpoints(&bpoints); + tx->get_breakpoints(&bpoints); if (bpoints.size() <= 0) { return; } - int line = code_editor->get_text_edit()->cursor_get_line(); + int line = tx->cursor_get_line(); + // wrap around if (line >= bpoints[bpoints.size() - 1]) { - code_editor->get_text_edit()->cursor_set_line(bpoints[0]); + tx->unfold_line(bpoints[0]); + tx->cursor_set_line(bpoints[0]); } else { for (List<int>::Element *E = bpoints.front(); E; E = E->next()) { int bline = E->get(); if (bline > line) { - code_editor->get_text_edit()->cursor_set_line(bline); + tx->unfold_line(bline); + tx->cursor_set_line(bline); return; } } @@ -1187,21 +1214,24 @@ void ScriptTextEditor::_edit_option(int p_op) { } break; case DEBUG_GOTO_PREV_BREAKPOINT: { + List<int> bpoints; - code_editor->get_text_edit()->get_breakpoints(&bpoints); + tx->get_breakpoints(&bpoints); if (bpoints.size() <= 0) { return; } - int line = code_editor->get_text_edit()->cursor_get_line(); + int line = tx->cursor_get_line(); // wrap around if (line <= bpoints[0]) { - code_editor->get_text_edit()->cursor_set_line(bpoints[bpoints.size() - 1]); + tx->unfold_line(bpoints[bpoints.size() - 1]); + tx->cursor_set_line(bpoints[bpoints.size() - 1]); } else { for (List<int>::Element *E = bpoints.back(); E; E = E->prev()) { int bline = E->get(); if (bline < line) { - code_editor->get_text_edit()->cursor_set_line(bline); + tx->unfold_line(bline); + tx->cursor_set_line(bline); return; } } @@ -1210,9 +1240,10 @@ void ScriptTextEditor::_edit_option(int p_op) { } break; case HELP_CONTEXTUAL: { - String text = code_editor->get_text_edit()->get_selection_text(); + + String text = tx->get_selection_text(); if (text == "") - text = code_editor->get_text_edit()->get_word_under_cursor(); + text = tx->get_word_under_cursor(); if (text != "") { emit_signal("request_help_search", text); } @@ -1398,6 +1429,9 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { Vector2 mpos = mb->get_global_position() - tx->get_global_position(); bool have_selection = (tx->get_selection_text().length() > 0); bool have_color = (tx->get_word_at_pos(mpos) == "Color"); + int fold_state = 0; + bool can_fold = tx->can_fold(row); + bool is_folded = tx->is_folded(row); if (have_color) { String line = tx->get_line(row); @@ -1428,7 +1462,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { have_color = false; } } - _make_context_menu(have_selection, have_color); + _make_context_menu(have_selection, have_color, can_fold, is_folded); } } } @@ -1447,7 +1481,7 @@ void ScriptTextEditor::_color_changed(const Color &p_color) { code_editor->get_text_edit()->set_line(color_line, new_line); } -void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color) { +void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p_can_fold, bool p_is_folded) { context_menu->clear(); if (p_selection) { @@ -1467,6 +1501,13 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color) { context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT); context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT); } + if (p_can_fold) { + // can fold + context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/fold_line"), EDIT_FOLD_LINE); + } else if (p_is_folded) { + // can unfold + context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unfold_line"), EDIT_UNFOLD_LINE); + } if (p_color) { context_menu->add_separator(); context_menu->add_item(TTR("Pick Color"), EDIT_PICK_COLOR); @@ -1530,6 +1571,10 @@ ScriptTextEditor::ScriptTextEditor() { edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN); + edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/fold_line"), EDIT_FOLD_LINE); + edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/fold_all_lines"), EDIT_FOLD_ALL_LINES); + edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unfold_line"), EDIT_UNFOLD_LINE); + edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unfold_all_lines"), EDIT_UNFOLD_ALL_LINES); edit_menu->get_popup()->add_separator(); #ifdef OSX_ENABLED edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/complete_symbol"), EDIT_COMPLETE); @@ -1607,6 +1652,10 @@ void ScriptTextEditor::register_editor() { ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), 0); ED_SHORTCUT("script_text_editor/toggle_comment", TTR("Toggle Comment"), KEY_MASK_CMD | KEY_K); ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD | KEY_B); + ED_SHORTCUT("script_text_editor/fold_line", TTR("Fold Line"), KEY_MASK_ALT | KEY_LEFT); + ED_SHORTCUT("script_text_editor/unfold_line", TTR("Unfold Line"), KEY_MASK_ALT | KEY_RIGHT); + ED_SHORTCUT("script_text_editor/fold_all_lines", TTR("Fold All Lines"), 0); + ED_SHORTCUT("script_text_editor/unfold_all_lines", TTR("Unfold All Lines"), 0); #ifdef OSX_ENABLED ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CTRL | KEY_SPACE); #else diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 83f3ea57c0..722015ef3e 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -91,6 +91,10 @@ class ScriptTextEditor : public ScriptEditorBase { EDIT_TO_UPPERCASE, EDIT_TO_LOWERCASE, EDIT_CAPITALIZE, + EDIT_FOLD_LINE, + EDIT_UNFOLD_LINE, + EDIT_FOLD_ALL_LINES, + EDIT_UNFOLD_ALL_LINES, SEARCH_FIND, SEARCH_FIND_NEXT, SEARCH_FIND_PREV, @@ -118,7 +122,7 @@ protected: static void _bind_methods(); void _edit_option(int p_op); - void _make_context_menu(bool p_selection, bool p_color); + void _make_context_menu(bool p_selection, bool p_color, bool p_can_fold, bool p_is_folded); void _text_edit_gui_input(const Ref<InputEvent> &ev); void _color_changed(const Color &p_color); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 1ca942a466..b3d3d5e13a 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -1866,6 +1866,11 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { if (!k->is_pressed()) emit_signal("toggle_maximize_view", this); } } + + // freelook uses most of the useful shortcuts, like save, so its ok + // to consider freelook active as end of the line for future events. + if (freelook_active) + accept_event(); } void SpatialEditorViewport::set_freelook_active(bool active_now) { @@ -2064,7 +2069,7 @@ void SpatialEditorViewport::_notification(int p_what) { if (se->aabb.has_no_surface()) { - se->aabb = vi ? vi->get_aabb() : Rect3(Vector3(-0.2, -0.2, -0.2), Vector3(0.4, 0.4, 0.4)); + se->aabb = vi ? vi->get_aabb() : AABB(Vector3(-0.2, -0.2, -0.2), Vector3(0.4, 0.4, 0.4)); } Transform t = sp->get_global_transform(); @@ -2152,6 +2157,29 @@ void SpatialEditorViewport::_notification(int p_what) { } } + // FPS Counter. + bool show_fps = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_FPS)); + if (show_fps != fps->is_visible()) { + if (show_fps) + fps->show(); + else + fps->hide(); + } + + if (show_fps) { + String text; + const float temp_fps = Engine::get_singleton()->get_frames_per_second(); + text += TTR("FPS") + ": " + itos(temp_fps) + " (" + String::num(1000.0f / temp_fps, 2) + " ms)"; + + if (fps_label->get_text() != text || surface->get_size() != prev_size) { + fps_label->set_text(text); + Size2 ms = fps->get_size(); + Size2 size = surface->get_size(); + size.y = ms.y + 20; + fps->set_position(size - ms - Vector2(20, 0) * EDSCALE); + } + } + prev_size = surface->get_size(); } @@ -2162,6 +2190,7 @@ void SpatialEditorViewport::_notification(int p_what) { surface->connect("mouse_entered", this, "_smouseenter"); surface->connect("mouse_exited", this, "_smouseexit"); info->add_style_override("panel", get_stylebox("panel", "Panel")); + fps->add_style_override("panel", get_stylebox("panel", "Panel")); preview_camera->set_icon(get_icon("Camera", "EditorIcons")); _init_gizmo_instance(index); } @@ -2484,6 +2513,13 @@ void SpatialEditorViewport::_menu_option(int p_option) { view_menu->get_popup()->set_item_checked(idx, !current); } break; + case VIEW_FPS: { + + int idx = view_menu->get_popup()->get_item_index(VIEW_FPS); + bool current = view_menu->get_popup()->is_item_checked(idx); + view_menu->get_popup()->set_item_checked(idx, !current); + + } break; case VIEW_DISPLAY_NORMAL: { viewport->set_debug_draw(Viewport::DEBUG_DRAW_DISABLED); @@ -2820,7 +2856,7 @@ void SpatialEditorViewport::focus_selection() { cursor.pos = center; } -void SpatialEditorViewport::assign_pending_data_pointers(Spatial *p_preview_node, Rect3 *p_preview_bounds, AcceptDialog *p_accept) { +void SpatialEditorViewport::assign_pending_data_pointers(Spatial *p_preview_node, AABB *p_preview_bounds, AcceptDialog *p_accept) { preview_node = p_preview_node; preview_bounds = p_preview_bounds; accept = p_accept; @@ -2883,14 +2919,14 @@ Vector3 SpatialEditorViewport::_get_instance_position(const Point2 &p_pos) const return point + offset; } -Rect3 SpatialEditorViewport::_calculate_spatial_bounds(const Spatial *p_parent, const Rect3 p_bounds) { - Rect3 bounds = p_bounds; +AABB SpatialEditorViewport::_calculate_spatial_bounds(const Spatial *p_parent, const AABB p_bounds) { + AABB bounds = p_bounds; for (int i = 0; i < p_parent->get_child_count(); i++) { Spatial *child = Object::cast_to<Spatial>(p_parent->get_child(i)); if (child) { MeshInstance *mesh_instance = Object::cast_to<MeshInstance>(child); if (mesh_instance) { - Rect3 mesh_instance_bounds = mesh_instance->get_aabb(); + AABB mesh_instance_bounds = mesh_instance->get_aabb(); mesh_instance_bounds.position += mesh_instance->get_global_transform().origin - p_parent->get_global_transform().origin; bounds.merge_with(mesh_instance_bounds); } @@ -2922,7 +2958,7 @@ void SpatialEditorViewport::_create_preview(const Vector<String> &files) const { editor->get_scene_root()->add_child(preview_node); } } - *preview_bounds = _calculate_spatial_bounds(preview_node, Rect3()); + *preview_bounds = _calculate_spatial_bounds(preview_node, AABB()); } void SpatialEditorViewport::_remove_preview() { @@ -3213,6 +3249,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_environment", TTR("View Environment")), VIEW_ENVIRONMENT); view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_gizmos", TTR("View Gizmos")), VIEW_GIZMOS); view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_information", TTR("View Information")), VIEW_INFORMATION); + view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_fps", TTR("View FPS")), VIEW_FPS); view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_ENVIRONMENT), true); view_menu->get_popup()->add_separator(); view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_half_resolution", TTR("Half Resolution")), VIEW_HALF_RESOLUTION); @@ -3255,6 +3292,14 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed info->add_child(info_label); info->hide(); + // FPS Counter. + fps = memnew(PanelContainer); + fps->set_self_modulate(Color(1, 1, 1, 0.4)); + surface->add_child(fps); + fps_label = memnew(Label); + fps->add_child(fps_label); + fps->hide(); + accept = NULL; freelook_active = false; @@ -3599,7 +3644,7 @@ void SpatialEditor::select_gizmo_highlight_axis(int p_axis) { void SpatialEditor::update_transform_gizmo() { List<Node *> &selection = editor_selection->get_selected_node_list(); - Rect3 center; + AABB center; bool first = true; Basis gizmo_basis; @@ -3660,7 +3705,7 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) { void SpatialEditor::_generate_selection_box() { - Rect3 aabb(Vector3(), Vector3(1, 1, 1)); + AABB aabb(Vector3(), Vector3(1, 1, 1)); aabb.grow_by(aabb.get_longest_axis_size() / 20.0); Ref<SurfaceTool> st = memnew(SurfaceTool); @@ -4731,7 +4776,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { // Drag and drop support; preview_node = memnew(Spatial); - preview_bounds = Rect3(); + preview_bounds = AABB(); ED_SHORTCUT("spatial_editor/bottom_view", TTR("Bottom View"), KEY_MASK_ALT + KEY_KP_7); ED_SHORTCUT("spatial_editor/top_view", TTR("Top View"), KEY_KP_7); diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h index b74ba00b3e..c986e45f43 100644 --- a/editor/plugins/spatial_editor_plugin.h +++ b/editor/plugins/spatial_editor_plugin.h @@ -88,6 +88,7 @@ class SpatialEditorViewport : public Control { VIEW_AUDIO_DOPPLER, VIEW_GIZMOS, VIEW_INFORMATION, + VIEW_FPS, VIEW_DISPLAY_NORMAL, VIEW_DISPLAY_WIREFRAME, VIEW_DISPLAY_OVERDRAW, @@ -108,7 +109,7 @@ private: Size2 prev_size; Spatial *preview_node; - Rect3 *preview_bounds; + AABB *preview_bounds; Vector<String> selected_files; AcceptDialog *accept; @@ -138,6 +139,9 @@ private: PanelContainer *info; Label *info_label; + PanelContainer *fps; + Label *fps_label; + struct _RayResult { Spatial *item; @@ -287,7 +291,7 @@ private: Point2i _get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const; Vector3 _get_instance_position(const Point2 &p_pos) const; - static Rect3 _calculate_spatial_bounds(const Spatial *p_parent, const Rect3 p_bounds); + static AABB _calculate_spatial_bounds(const Spatial *p_parent, const AABB p_bounds); void _create_preview(const Vector<String> &files) const; void _remove_preview(); bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node); @@ -314,7 +318,7 @@ public: void assign_pending_data_pointers( Spatial *p_preview_node, - Rect3 *p_preview_bounds, + AABB *p_preview_bounds, AcceptDialog *p_accept); Viewport *get_viewport_node() { return viewport; } @@ -327,7 +331,7 @@ class SpatialEditorSelectedItem : public Object { GDCLASS(SpatialEditorSelectedItem, Object); public: - Rect3 aabb; + AABB aabb; Transform original; // original location when moving Transform original_local; Transform last_xform; // last transform @@ -435,7 +439,7 @@ private: // Scene drag and drop support Spatial *preview_node; - Rect3 preview_bounds; + AABB preview_bounds; /* struct Selected { diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 0ee0eed3a2..ffddd8a3a9 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -363,7 +363,7 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era return PoolVector<Vector2>(); } - Rect2i r = node->get_item_rect(); + Rect2i r = node->_edit_get_rect(); r.position = r.position / node->get_cell_size(); r.size = r.size / node->get_cell_size(); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 5bfdd73aad..cc9de3e44d 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -284,7 +284,6 @@ private: } ProjectSettings *current = memnew(ProjectSettings); - current->add_singleton(ProjectSettings::Singleton("Current")); if (current->setup(dir, "")) { set_message(TTR("Couldn't get project.godot in project path."), MESSAGE_ERROR); @@ -503,7 +502,6 @@ public: name_container->show(); ProjectSettings *current = memnew(ProjectSettings); - current->add_singleton(ProjectSettings::Singleton("Current")); if (current->setup(project_path->get_text(), "")) { set_message(TTR("Couldn't get project.godot in the project path."), MESSAGE_ERROR); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 002ae568ff..5136c96cbf 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -755,7 +755,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: value_editor[3]->set_text(String::num(q.w)); } break; - case Variant::RECT3: { + case Variant::AABB: { field_names.push_back("px"); field_names.push_back("py"); @@ -765,7 +765,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: field_names.push_back("sz"); config_value_editors(6, 3, 16, field_names); - Rect3 aabb = v; + AABB aabb = v; value_editor[0]->set_text(String::num(aabb.position.x)); value_editor[1]->set_text(String::num(aabb.position.y)); value_editor[2]->set_text(String::num(aabb.position.z)); @@ -1585,7 +1585,7 @@ void CustomPropertyEditor::_modified(String p_string) { _emit_changed_whole_or_field(); } break; - case Variant::RECT3: { + case Variant::AABB: { Vector3 pos; Vector3 size; @@ -1605,7 +1605,7 @@ void CustomPropertyEditor::_modified(String p_string) { size.y = value_editor[4]->get_text().to_double(); size.z = value_editor[5]->get_text().to_double(); } - v = Rect3(pos, size); + v = AABB(pos, size); _emit_changed_whole_or_field(); } break; @@ -1727,7 +1727,7 @@ void CustomPropertyEditor::_focus_enter() { case Variant::VECTOR3: case Variant::PLANE: case Variant::QUAT: - case Variant::RECT3: + case Variant::AABB: case Variant::TRANSFORM2D: case Variant::BASIS: case Variant::TRANSFORM: { @@ -1752,7 +1752,7 @@ void CustomPropertyEditor::_focus_exit() { case Variant::VECTOR3: case Variant::PLANE: case Variant::QUAT: - case Variant::RECT3: + case Variant::AABB: case Variant::TRANSFORM2D: case Variant::BASIS: case Variant::TRANSFORM: { @@ -2238,7 +2238,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p case Variant::VECTOR3: case Variant::QUAT: case Variant::VECTOR2: - case Variant::RECT3: + case Variant::AABB: case Variant::RECT2: case Variant::TRANSFORM2D: case Variant::BASIS: @@ -3367,13 +3367,13 @@ void PropertyEditor::update_tree() { item->set_icon(0, get_icon("Plane", "EditorIcons")); } break; - case Variant::RECT3: { + case Variant::AABB: { item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM); item->set_editable(1, true); - item->set_text(1, "Rect3"); + item->set_text(1, "AABB"); if (show_type_icons) - item->set_icon(0, get_icon("Rect3", "EditorIcons")); + item->set_icon(0, get_icon("AABB", "EditorIcons")); } break; case Variant::QUAT: { @@ -3714,7 +3714,7 @@ void PropertyEditor::_item_edited() { _edit_set(name, item->get_text(1), refresh_all); } } break; - // math types + // math types case Variant::VECTOR3: { @@ -3725,7 +3725,7 @@ void PropertyEditor::_item_edited() { case Variant::QUAT: { } break; - case Variant::RECT3: { + case Variant::AABB: { } break; case Variant::BASIS: { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 7ada335007..21ac27dc4e 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1423,6 +1423,7 @@ void SceneTreeDock::_create() { } else { editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", child); + editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree"); editor_data->get_undo_redo().add_do_reference(child); editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)NULL); } @@ -1458,6 +1459,8 @@ void SceneTreeDock::_create() { for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) continue; + if (E->get().name == "__meta__") + continue; newnode->set(E->get().name, n->get(E->get().name)); } @@ -1887,6 +1890,43 @@ void SceneTreeDock::open_script_dialog(Node *p_for_node) { _tool_selected(TOOL_ATTACH_SCRIPT); } +void SceneTreeDock::add_remote_tree_editor(Control *p_remote) { + ERR_FAIL_COND(remote_tree != NULL); + add_child(p_remote); + remote_tree = p_remote; + remote_tree->hide(); +} + +void SceneTreeDock::show_remote_tree() { + + button_hb->show(); + _remote_tree_selected(); +} + +void SceneTreeDock::hide_remote_tree() { + + button_hb->hide(); + _local_tree_selected(); +} + +void SceneTreeDock::_remote_tree_selected() { + + scene_tree->hide(); + if (remote_tree) + remote_tree->show(); + edit_remote->set_pressed(true); + edit_local->set_pressed(false); +} + +void SceneTreeDock::_local_tree_selected() { + + scene_tree->show(); + if (remote_tree) + remote_tree->hide(); + edit_remote->set_pressed(false); + edit_local->set_pressed(true); +} + void SceneTreeDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_tool_selected"), &SceneTreeDock::_tool_selected, DEFVAL(false)); @@ -1912,6 +1952,8 @@ void SceneTreeDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_tree_rmb"), &SceneTreeDock::_tree_rmb); ClassDB::bind_method(D_METHOD("_filter_changed"), &SceneTreeDock::_filter_changed); ClassDB::bind_method(D_METHOD("_focus_node"), &SceneTreeDock::_focus_node); + ClassDB::bind_method(D_METHOD("_remote_tree_selected"), &SceneTreeDock::_remote_tree_selected); + ClassDB::bind_method(D_METHOD("_local_tree_selected"), &SceneTreeDock::_local_tree_selected); ClassDB::bind_method(D_METHOD("instance"), &SceneTreeDock::instance); } @@ -1982,7 +2024,28 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel button_clear_script = tb; tb->hide(); + button_hb = memnew(HBoxContainer); + vbc->add_child(button_hb); + + edit_remote = memnew(ToolButton); + button_hb->add_child(edit_remote); + edit_remote->set_h_size_flags(SIZE_EXPAND_FILL); + edit_remote->set_text(TTR("Remote")); + edit_remote->set_toggle_mode(true); + edit_remote->connect("pressed", this, "_remote_tree_selected"); + + edit_local = memnew(ToolButton); + button_hb->add_child(edit_local); + edit_local->set_h_size_flags(SIZE_EXPAND_FILL); + edit_local->set_text(TTR("Local")); + edit_local->set_toggle_mode(true); + edit_local->connect("pressed", this, "_local_tree_selected"); + + remote_tree = NULL; + button_hb->hide(); + scene_tree = memnew(SceneTreeEditor(false, true, true)); + vbc->add_child(scene_tree); scene_tree->set_v_size_flags(SIZE_EXPAND | SIZE_FILL); scene_tree->connect("rmb_pressed", this, "_tree_rmb"); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index f61c67bb13..97d3c4748a 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -95,7 +95,10 @@ class SceneTreeDock : public VBoxContainer { ToolButton *button_create_script; ToolButton *button_clear_script; + HBoxContainer *button_hb; + ToolButton *edit_local, *edit_remote; SceneTreeEditor *scene_tree; + Control *remote_tree; HBoxContainer *tool_hbc; void _tool_selected(int p_tool, bool p_confirm_override = false); @@ -174,6 +177,9 @@ class SceneTreeDock : public VBoxContainer { void _file_selected(String p_file); + void _remote_tree_selected(); + void _local_tree_selected(); + protected: void _notification(int p_what); static void _bind_methods(); @@ -194,6 +200,10 @@ public: SceneTreeEditor *get_tree_editor() { return scene_tree; } EditorData *get_editor_data() { return editor_data; } + void add_remote_tree_editor(Control *p_remote); + void show_remote_tree(); + void hide_remote_tree(); + void open_script_dialog(Node *p_for_node); SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSelection *p_editor_selection, EditorData &p_editor_data); }; diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index a6e0af05b2..c4b86c6b2b 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -354,7 +354,11 @@ void SceneTreeEditor::_update_visibility_color(Node *p_node, TreeItem *p_item) { void SceneTreeEditor::_node_script_changed(Node *p_node) { - _update_tree(); + if (tree_dirty) + return; + + MessageQueue::get_singleton()->push_call(this, "_update_tree"); + tree_dirty = true; /* changes the order :| TreeItem* item=p_node?_find(tree->get_root(),p_node->get_path()):NULL; diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 3f8d93d976..3ffc61cb45 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -149,7 +149,7 @@ void EditorSpatialGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Mat md = MAX(0, p_lines[i].length()); } if (md) { - mesh->set_custom_aabb(Rect3(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0)); + mesh->set_custom_aabb(AABB(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0)); } } @@ -196,7 +196,7 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material> &p_material, md = MAX(0, vs[i].length()); } if (md) { - mesh->set_custom_aabb(Rect3(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0)); + mesh->set_custom_aabb(AABB(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0)); } } @@ -211,7 +211,7 @@ void EditorSpatialGizmo::add_unscaled_billboard(const Ref<Material> &p_material, instances.push_back(ins); } -void EditorSpatialGizmo::add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const Rect3 &p_bounds) { +void EditorSpatialGizmo::add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const AABB &p_bounds) { collision_mesh = p_tmesh; collision_mesh_bounds = p_bounds; @@ -270,7 +270,7 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, bool p_bi md = MAX(0, p_handles[i].length()); } if (md) { - mesh->set_custom_aabb(Rect3(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0)); + mesh->set_custom_aabb(AABB(Vector3(-md, -md, -md), Vector3(md, md, md) * 2.0)); } } @@ -1274,7 +1274,7 @@ void MeshInstanceSpatialGizmo::redraw() { Ref<TriangleMesh> tm = m->generate_triangle_mesh(); if (tm.is_valid()) { - Rect3 aabb; + AABB aabb; add_collision_triangles(tm, aabb); } } @@ -1336,7 +1336,7 @@ void SkeletonSpatialGizmo::redraw() { weights[0] = 1; - Rect3 aabb; + AABB aabb; Color bonecolor = Color(1.0, 0.4, 0.4, 0.3); Color rootcolor = Color(0.4, 1.0, 0.4, 0.1); @@ -1961,7 +1961,7 @@ void CollisionShapeSpatialGizmo::redraw() { Ref<BoxShape> bs = s; Vector<Vector3> lines; - Rect3 aabb; + AABB aabb; aabb.position = -bs->get_extents(); aabb.size = aabb.position * -2; @@ -2191,7 +2191,7 @@ void VisibilityNotifierGizmo::set_handle(int p_idx, Camera *p_camera, const Poin //gt.orthonormalize(); Transform gi = gt.affine_inverse(); - Rect3 aabb = notifier->get_aabb(); + AABB aabb = notifier->get_aabb(); Vector3 ray_from = p_camera->project_ray_origin(p_point); Vector3 ray_dir = p_camera->project_ray_normal(p_point); @@ -2234,7 +2234,7 @@ void VisibilityNotifierGizmo::redraw() { clear(); Vector<Vector3> lines; - Rect3 aabb = notifier->get_aabb(); + AABB aabb = notifier->get_aabb(); for (int i = 0; i < 12; i++) { Vector3 a, b; @@ -2293,7 +2293,7 @@ void ParticlesGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_poi bool move = p_idx >= 3; p_idx = p_idx % 3; - Rect3 aabb = particles->get_visibility_aabb(); + AABB aabb = particles->get_visibility_aabb(); Vector3 ray_from = p_camera->project_ray_origin(p_point); Vector3 ray_dir = p_camera->project_ray_normal(p_point); @@ -2347,7 +2347,7 @@ void ParticlesGizmo::redraw() { clear(); Vector<Vector3> lines; - Rect3 aabb = particles->get_visibility_aabb(); + AABB aabb = particles->get_visibility_aabb(); for (int i = 0; i < 12; i++) { Vector3 a, b; @@ -2420,7 +2420,7 @@ String ReflectionProbeGizmo::get_handle_name(int p_idx) const { } Variant ReflectionProbeGizmo::get_handle_value(int p_idx) const { - return Rect3(probe->get_extents(), probe->get_origin_offset()); + return AABB(probe->get_extents(), probe->get_origin_offset()); } void ReflectionProbeGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_point) { @@ -2474,7 +2474,7 @@ void ReflectionProbeGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 void ReflectionProbeGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) { - Rect3 restore = p_restore; + AABB restore = p_restore; if (p_cancel) { probe->set_extents(restore.position); @@ -2499,7 +2499,7 @@ void ReflectionProbeGizmo::redraw() { Vector<Vector3> internal_lines; Vector3 extents = probe->get_extents(); - Rect3 aabb; + AABB aabb; aabb.position = -extents; aabb.size = extents * 2; @@ -2641,7 +2641,7 @@ void GIProbeGizmo::redraw() { static const int subdivs[GIProbe::SUBDIV_MAX] = { 64, 128, 256, 512 }; - Rect3 aabb = Rect3(-extents, extents * 2); + AABB aabb = AABB(-extents, extents * 2); int subdiv = subdivs[probe->get_subdiv()]; float cell_size = aabb.get_longest_axis_size() / subdiv; diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h index afe64c723c..751bad2b13 100644 --- a/editor/spatial_editor_gizmos.h +++ b/editor/spatial_editor_gizmos.h @@ -78,7 +78,7 @@ class EditorSpatialGizmo : public SpatialEditorGizmo { Vector<Vector3> collision_segments; Ref<TriangleMesh> collision_mesh; - Rect3 collision_mesh_bounds; + AABB collision_mesh_bounds; struct Handle { Vector3 pos; @@ -100,7 +100,7 @@ protected: void add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard = false); void add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard = false, const RID &p_skeleton = RID()); void add_collision_segments(const Vector<Vector3> &p_lines); - void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const Rect3 &p_bounds = Rect3()); + void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh, const AABB &p_bounds = AABB()); void add_unscaled_billboard(const Ref<Material> &p_material, float p_scale = 1); void add_handles(const Vector<Vector3> &p_handles, bool p_billboard = false, bool p_secondary = false); void add_solid_box(Ref<Material> &p_material, Vector3 size); diff --git a/main/main.cpp b/main/main.cpp index aa4dce93a6..f6b11bc3ca 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -35,6 +35,7 @@ #include "message_queue.h" #include "modules/register_module_types.h" #include "os/os.h" +#include "platform/register_platform_apis.h" #include "project_settings.h" #include "scene/register_scene_types.h" #include "script_debugger_local.h" @@ -294,7 +295,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph translation_server = memnew(TranslationServer); performance = memnew(Performance); ClassDB::register_class<Performance>(); - globals->add_singleton(ProjectSettings::Singleton("Performance", performance)); + engine->add_singleton(Engine::Singleton("Performance", performance)); GLOBAL_DEF("debug/settings/crash_handler/message", String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues")); @@ -1108,6 +1109,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { MAIN_PRINT("Main: Load Modules, Physics, Drivers, Scripts"); + register_platform_apis(); register_module_types(); initialize_physics(); @@ -1825,6 +1827,7 @@ void Main::cleanup() { unregister_driver_types(); unregister_module_types(); + unregister_platform_apis(); unregister_scene_types(); unregister_server_types(); diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index bcf4278bde..b41b5f6452 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -35,10 +35,10 @@ #ifdef GDSCRIPT_ENABLED -#include "modules/gdscript/gd_compiler.h" -#include "modules/gdscript/gd_parser.h" -#include "modules/gdscript/gd_script.h" -#include "modules/gdscript/gd_tokenizer.h" +#include "modules/gdscript/gdscript.h" +#include "modules/gdscript/gdscript_compiler.h" +#include "modules/gdscript/gdscript_parser.h" +#include "modules/gdscript/gdscript_tokenizer.h" namespace TestGDScript { @@ -52,7 +52,7 @@ static void _print_indent(int p_ident, const String &p_text) { print_line(txt + p_text); } -static String _parser_extends(const GDParser::ClassNode *p_class) { +static String _parser_extends(const GDScriptParser::ClassNode *p_class) { String txt = "extends "; if (String(p_class->extends_file) != "") { @@ -72,29 +72,29 @@ static String _parser_extends(const GDParser::ClassNode *p_class) { return txt; } -static String _parser_expr(const GDParser::Node *p_expr) { +static String _parser_expr(const GDScriptParser::Node *p_expr) { String txt; switch (p_expr->type) { - case GDParser::Node::TYPE_IDENTIFIER: { + case GDScriptParser::Node::TYPE_IDENTIFIER: { - const GDParser::IdentifierNode *id_node = static_cast<const GDParser::IdentifierNode *>(p_expr); + const GDScriptParser::IdentifierNode *id_node = static_cast<const GDScriptParser::IdentifierNode *>(p_expr); txt = id_node->name; } break; - case GDParser::Node::TYPE_CONSTANT: { - const GDParser::ConstantNode *c_node = static_cast<const GDParser::ConstantNode *>(p_expr); + case GDScriptParser::Node::TYPE_CONSTANT: { + const GDScriptParser::ConstantNode *c_node = static_cast<const GDScriptParser::ConstantNode *>(p_expr); if (c_node->value.get_type() == Variant::STRING) txt = "\"" + String(c_node->value) + "\""; else txt = c_node->value; } break; - case GDParser::Node::TYPE_SELF: { + case GDScriptParser::Node::TYPE_SELF: { txt = "self"; } break; - case GDParser::Node::TYPE_ARRAY: { - const GDParser::ArrayNode *arr_node = static_cast<const GDParser::ArrayNode *>(p_expr); + case GDScriptParser::Node::TYPE_ARRAY: { + const GDScriptParser::ArrayNode *arr_node = static_cast<const GDScriptParser::ArrayNode *>(p_expr); txt += "["; for (int i = 0; i < arr_node->elements.size(); i++) { @@ -104,51 +104,51 @@ static String _parser_expr(const GDParser::Node *p_expr) { } txt += "]"; } break; - case GDParser::Node::TYPE_DICTIONARY: { - const GDParser::DictionaryNode *dict_node = static_cast<const GDParser::DictionaryNode *>(p_expr); + case GDScriptParser::Node::TYPE_DICTIONARY: { + const GDScriptParser::DictionaryNode *dict_node = static_cast<const GDScriptParser::DictionaryNode *>(p_expr); txt += "{"; for (int i = 0; i < dict_node->elements.size(); i++) { if (i > 0) txt += ", "; - const GDParser::DictionaryNode::Pair &p = dict_node->elements[i]; + const GDScriptParser::DictionaryNode::Pair &p = dict_node->elements[i]; txt += _parser_expr(p.key); txt += ":"; txt += _parser_expr(p.value); } txt += "}"; } break; - case GDParser::Node::TYPE_OPERATOR: { + case GDScriptParser::Node::TYPE_OPERATOR: { - const GDParser::OperatorNode *c_node = static_cast<const GDParser::OperatorNode *>(p_expr); + const GDScriptParser::OperatorNode *c_node = static_cast<const GDScriptParser::OperatorNode *>(p_expr); switch (c_node->op) { - case GDParser::OperatorNode::OP_PARENT_CALL: + case GDScriptParser::OperatorNode::OP_PARENT_CALL: txt += "."; - case GDParser::OperatorNode::OP_CALL: { + case GDScriptParser::OperatorNode::OP_CALL: { ERR_FAIL_COND_V(c_node->arguments.size() < 1, ""); String func_name; - const GDParser::Node *nfunc = c_node->arguments[0]; + const GDScriptParser::Node *nfunc = c_node->arguments[0]; int arg_ofs = 0; - if (nfunc->type == GDParser::Node::TYPE_BUILT_IN_FUNCTION) { + if (nfunc->type == GDScriptParser::Node::TYPE_BUILT_IN_FUNCTION) { - const GDParser::BuiltInFunctionNode *bif_node = static_cast<const GDParser::BuiltInFunctionNode *>(nfunc); - func_name = GDFunctions::get_func_name(bif_node->function); + const GDScriptParser::BuiltInFunctionNode *bif_node = static_cast<const GDScriptParser::BuiltInFunctionNode *>(nfunc); + func_name = GDScriptFunctions::get_func_name(bif_node->function); arg_ofs = 1; - } else if (nfunc->type == GDParser::Node::TYPE_TYPE) { + } else if (nfunc->type == GDScriptParser::Node::TYPE_TYPE) { - const GDParser::TypeNode *t_node = static_cast<const GDParser::TypeNode *>(nfunc); + const GDScriptParser::TypeNode *t_node = static_cast<const GDScriptParser::TypeNode *>(nfunc); func_name = Variant::get_type_name(t_node->vtype); arg_ofs = 1; } else { ERR_FAIL_COND_V(c_node->arguments.size() < 2, ""); nfunc = c_node->arguments[1]; - ERR_FAIL_COND_V(nfunc->type != GDParser::Node::TYPE_IDENTIFIER, ""); + ERR_FAIL_COND_V(nfunc->type != GDScriptParser::Node::TYPE_IDENTIFIER, ""); - if (c_node->arguments[0]->type != GDParser::Node::TYPE_SELF) + if (c_node->arguments[0]->type != GDScriptParser::Node::TYPE_SELF) func_name = _parser_expr(c_node->arguments[0]) + "."; func_name += _parser_expr(nfunc); @@ -159,7 +159,7 @@ static String _parser_expr(const GDParser::Node *p_expr) { for (int i = arg_ofs; i < c_node->arguments.size(); i++) { - const GDParser::Node *arg = c_node->arguments[i]; + const GDScriptParser::Node *arg = c_node->arguments[i]; if (i > arg_ofs) txt += ", "; txt += _parser_expr(arg); @@ -168,7 +168,7 @@ static String _parser_expr(const GDParser::Node *p_expr) { txt += ")"; } break; - case GDParser::OperatorNode::OP_INDEX: { + case GDScriptParser::OperatorNode::OP_INDEX: { ERR_FAIL_COND_V(c_node->arguments.size() != 2, ""); @@ -176,125 +176,125 @@ static String _parser_expr(const GDParser::Node *p_expr) { txt = _parser_expr(c_node->arguments[0]) + "[" + _parser_expr(c_node->arguments[1]) + "]"; } break; - case GDParser::OperatorNode::OP_INDEX_NAMED: { + case GDScriptParser::OperatorNode::OP_INDEX_NAMED: { ERR_FAIL_COND_V(c_node->arguments.size() != 2, ""); txt = _parser_expr(c_node->arguments[0]) + "." + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_NEG: { + case GDScriptParser::OperatorNode::OP_NEG: { txt = "-" + _parser_expr(c_node->arguments[0]); } break; - case GDParser::OperatorNode::OP_NOT: { + case GDScriptParser::OperatorNode::OP_NOT: { txt = "not " + _parser_expr(c_node->arguments[0]); } break; - case GDParser::OperatorNode::OP_BIT_INVERT: { + case GDScriptParser::OperatorNode::OP_BIT_INVERT: { txt = "~" + _parser_expr(c_node->arguments[0]); } break; - case GDParser::OperatorNode::OP_PREINC: { + case GDScriptParser::OperatorNode::OP_PREINC: { } break; - case GDParser::OperatorNode::OP_PREDEC: { + case GDScriptParser::OperatorNode::OP_PREDEC: { } break; - case GDParser::OperatorNode::OP_INC: { + case GDScriptParser::OperatorNode::OP_INC: { } break; - case GDParser::OperatorNode::OP_DEC: { + case GDScriptParser::OperatorNode::OP_DEC: { } break; - case GDParser::OperatorNode::OP_IN: { + case GDScriptParser::OperatorNode::OP_IN: { txt = _parser_expr(c_node->arguments[0]) + " in " + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_EQUAL: { + case GDScriptParser::OperatorNode::OP_EQUAL: { txt = _parser_expr(c_node->arguments[0]) + "==" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_NOT_EQUAL: { + case GDScriptParser::OperatorNode::OP_NOT_EQUAL: { txt = _parser_expr(c_node->arguments[0]) + "!=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_LESS: { + case GDScriptParser::OperatorNode::OP_LESS: { txt = _parser_expr(c_node->arguments[0]) + "<" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_LESS_EQUAL: { + case GDScriptParser::OperatorNode::OP_LESS_EQUAL: { txt = _parser_expr(c_node->arguments[0]) + "<=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_GREATER: { + case GDScriptParser::OperatorNode::OP_GREATER: { txt = _parser_expr(c_node->arguments[0]) + ">" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_GREATER_EQUAL: { + case GDScriptParser::OperatorNode::OP_GREATER_EQUAL: { txt = _parser_expr(c_node->arguments[0]) + ">=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_AND: { + case GDScriptParser::OperatorNode::OP_AND: { txt = _parser_expr(c_node->arguments[0]) + " and " + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_OR: { + case GDScriptParser::OperatorNode::OP_OR: { txt = _parser_expr(c_node->arguments[0]) + " or " + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ADD: { + case GDScriptParser::OperatorNode::OP_ADD: { txt = _parser_expr(c_node->arguments[0]) + "+" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_SUB: { + case GDScriptParser::OperatorNode::OP_SUB: { txt = _parser_expr(c_node->arguments[0]) + "-" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_MUL: { + case GDScriptParser::OperatorNode::OP_MUL: { txt = _parser_expr(c_node->arguments[0]) + "*" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_DIV: { + case GDScriptParser::OperatorNode::OP_DIV: { txt = _parser_expr(c_node->arguments[0]) + "/" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_MOD: { + case GDScriptParser::OperatorNode::OP_MOD: { txt = _parser_expr(c_node->arguments[0]) + "%" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_SHIFT_LEFT: { + case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: { txt = _parser_expr(c_node->arguments[0]) + "<<" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_SHIFT_RIGHT: { + case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: { txt = _parser_expr(c_node->arguments[0]) + ">>" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN: { + case GDScriptParser::OperatorNode::OP_ASSIGN: { txt = _parser_expr(c_node->arguments[0]) + "=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN_ADD: { + case GDScriptParser::OperatorNode::OP_ASSIGN_ADD: { txt = _parser_expr(c_node->arguments[0]) + "+=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN_SUB: { + case GDScriptParser::OperatorNode::OP_ASSIGN_SUB: { txt = _parser_expr(c_node->arguments[0]) + "-=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN_MUL: { + case GDScriptParser::OperatorNode::OP_ASSIGN_MUL: { txt = _parser_expr(c_node->arguments[0]) + "*=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN_DIV: { + case GDScriptParser::OperatorNode::OP_ASSIGN_DIV: { txt = _parser_expr(c_node->arguments[0]) + "/=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN_MOD: { + case GDScriptParser::OperatorNode::OP_ASSIGN_MOD: { txt = _parser_expr(c_node->arguments[0]) + "%=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN_SHIFT_LEFT: { + case GDScriptParser::OperatorNode::OP_ASSIGN_SHIFT_LEFT: { txt = _parser_expr(c_node->arguments[0]) + "<<=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN_SHIFT_RIGHT: { + case GDScriptParser::OperatorNode::OP_ASSIGN_SHIFT_RIGHT: { txt = _parser_expr(c_node->arguments[0]) + ">>=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN_BIT_AND: { + case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_AND: { txt = _parser_expr(c_node->arguments[0]) + "&=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN_BIT_OR: { + case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_OR: { txt = _parser_expr(c_node->arguments[0]) + "|=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_ASSIGN_BIT_XOR: { + case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_XOR: { txt = _parser_expr(c_node->arguments[0]) + "^=" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_BIT_AND: { + case GDScriptParser::OperatorNode::OP_BIT_AND: { txt = _parser_expr(c_node->arguments[0]) + "&" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_BIT_OR: { + case GDScriptParser::OperatorNode::OP_BIT_OR: { txt = _parser_expr(c_node->arguments[0]) + "|" + _parser_expr(c_node->arguments[1]); } break; - case GDParser::OperatorNode::OP_BIT_XOR: { + case GDScriptParser::OperatorNode::OP_BIT_XOR: { txt = _parser_expr(c_node->arguments[0]) + "^" + _parser_expr(c_node->arguments[1]); } break; default: {} } } break; - case GDParser::Node::TYPE_NEWLINE: { + case GDScriptParser::Node::TYPE_NEWLINE: { //skippie } break; @@ -310,20 +310,20 @@ static String _parser_expr(const GDParser::Node *p_expr) { //return "("+txt+")"; } -static void _parser_show_block(const GDParser::BlockNode *p_block, int p_indent) { +static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_indent) { for (int i = 0; i < p_block->statements.size(); i++) { - const GDParser::Node *statement = p_block->statements[i]; + const GDScriptParser::Node *statement = p_block->statements[i]; switch (statement->type) { - case GDParser::Node::TYPE_CONTROL_FLOW: { + case GDScriptParser::Node::TYPE_CONTROL_FLOW: { - const GDParser::ControlFlowNode *cf_node = static_cast<const GDParser::ControlFlowNode *>(statement); + const GDScriptParser::ControlFlowNode *cf_node = static_cast<const GDScriptParser::ControlFlowNode *>(statement); switch (cf_node->cf_type) { - case GDParser::ControlFlowNode::CF_IF: { + case GDScriptParser::ControlFlowNode::CF_IF: { ERR_FAIL_COND(cf_node->arguments.size() != 1); String txt; @@ -339,7 +339,7 @@ static void _parser_show_block(const GDParser::BlockNode *p_block, int p_indent) } } break; - case GDParser::ControlFlowNode::CF_FOR: { + case GDScriptParser::ControlFlowNode::CF_FOR: { ERR_FAIL_COND(cf_node->arguments.size() != 2); String txt; txt += "for "; @@ -352,7 +352,7 @@ static void _parser_show_block(const GDParser::BlockNode *p_block, int p_indent) _parser_show_block(cf_node->body, p_indent + 1); } break; - case GDParser::ControlFlowNode::CF_WHILE: { + case GDScriptParser::ControlFlowNode::CF_WHILE: { ERR_FAIL_COND(cf_node->arguments.size() != 1); String txt; @@ -364,18 +364,18 @@ static void _parser_show_block(const GDParser::BlockNode *p_block, int p_indent) _parser_show_block(cf_node->body, p_indent + 1); } break; - case GDParser::ControlFlowNode::CF_SWITCH: { + case GDScriptParser::ControlFlowNode::CF_SWITCH: { } break; - case GDParser::ControlFlowNode::CF_CONTINUE: { + case GDScriptParser::ControlFlowNode::CF_CONTINUE: { _print_indent(p_indent, "continue"); } break; - case GDParser::ControlFlowNode::CF_BREAK: { + case GDScriptParser::ControlFlowNode::CF_BREAK: { _print_indent(p_indent, "break"); } break; - case GDParser::ControlFlowNode::CF_RETURN: { + case GDScriptParser::ControlFlowNode::CF_RETURN: { if (cf_node->arguments.size()) _print_indent(p_indent, "return " + _parser_expr(cf_node->arguments[0])); @@ -385,9 +385,9 @@ static void _parser_show_block(const GDParser::BlockNode *p_block, int p_indent) } } break; - case GDParser::Node::TYPE_LOCAL_VAR: { + case GDScriptParser::Node::TYPE_LOCAL_VAR: { - const GDParser::LocalVarNode *lv_node = static_cast<const GDParser::LocalVarNode *>(statement); + const GDScriptParser::LocalVarNode *lv_node = static_cast<const GDScriptParser::LocalVarNode *>(statement); _print_indent(p_indent, "var " + String(lv_node->name)); } break; default: { @@ -398,7 +398,7 @@ static void _parser_show_block(const GDParser::BlockNode *p_block, int p_indent) } } -static void _parser_show_function(const GDParser::FunctionNode *p_func, int p_indent, GDParser::BlockNode *p_initializer = NULL) { +static void _parser_show_function(const GDScriptParser::FunctionNode *p_func, int p_indent, GDScriptParser::BlockNode *p_initializer = NULL) { String txt; if (p_func->_static) @@ -434,7 +434,7 @@ static void _parser_show_function(const GDParser::FunctionNode *p_func, int p_in _parser_show_block(p_func->body, p_indent + 1); } -static void _parser_show_class(const GDParser::ClassNode *p_class, int p_indent, const Vector<String> &p_code) { +static void _parser_show_class(const GDScriptParser::ClassNode *p_class, int p_indent, const Vector<String> &p_code) { if (p_indent == 0 && (String(p_class->extends_file) != "" || p_class->extends_class.size())) { @@ -444,7 +444,7 @@ static void _parser_show_class(const GDParser::ClassNode *p_class, int p_indent, for (int i = 0; i < p_class->subclasses.size(); i++) { - const GDParser::ClassNode *subclass = p_class->subclasses[i]; + const GDScriptParser::ClassNode *subclass = p_class->subclasses[i]; String line = "class " + subclass->name; if (String(subclass->extends_file) != "" || subclass->extends_class.size()) line += " " + _parser_extends(subclass); @@ -456,13 +456,13 @@ static void _parser_show_class(const GDParser::ClassNode *p_class, int p_indent, for (int i = 0; i < p_class->constant_expressions.size(); i++) { - const GDParser::ClassNode::Constant &constant = p_class->constant_expressions[i]; + const GDScriptParser::ClassNode::Constant &constant = p_class->constant_expressions[i]; _print_indent(p_indent, "const " + String(constant.identifier) + "=" + _parser_expr(constant.expression)); } for (int i = 0; i < p_class->variables.size(); i++) { - const GDParser::ClassNode::Member &m = p_class->variables[i]; + const GDScriptParser::ClassNode::Member &m = p_class->variables[i]; _print_indent(p_indent, "var " + String(m.identifier)); } @@ -487,27 +487,27 @@ static void _parser_show_class(const GDParser::ClassNode *p_class, int p_indent, print_line("\n"); } -static String _disassemble_addr(const Ref<GDScript> &p_script, const GDFunction &func, int p_addr) { +static String _disassemble_addr(const Ref<GDScript> &p_script, const GDScriptFunction &func, int p_addr) { - int addr = p_addr & GDFunction::ADDR_MASK; + int addr = p_addr & GDScriptFunction::ADDR_MASK; - switch (p_addr >> GDFunction::ADDR_BITS) { + switch (p_addr >> GDScriptFunction::ADDR_BITS) { - case GDFunction::ADDR_TYPE_SELF: { + case GDScriptFunction::ADDR_TYPE_SELF: { return "self"; } break; - case GDFunction::ADDR_TYPE_CLASS: { + case GDScriptFunction::ADDR_TYPE_CLASS: { return "class"; } break; - case GDFunction::ADDR_TYPE_MEMBER: { + case GDScriptFunction::ADDR_TYPE_MEMBER: { return "member(" + p_script->debug_get_member_by_index(addr) + ")"; } break; - case GDFunction::ADDR_TYPE_CLASS_CONSTANT: { + case GDScriptFunction::ADDR_TYPE_CLASS_CONSTANT: { return "class_const(" + func.get_global_name(addr) + ")"; } break; - case GDFunction::ADDR_TYPE_LOCAL_CONSTANT: { + case GDScriptFunction::ADDR_TYPE_LOCAL_CONSTANT: { Variant v = func.get_constant(addr); String txt; @@ -517,19 +517,19 @@ static String _disassemble_addr(const Ref<GDScript> &p_script, const GDFunction txt = v; return "const(" + txt + ")"; } break; - case GDFunction::ADDR_TYPE_STACK: { + case GDScriptFunction::ADDR_TYPE_STACK: { return "stack(" + itos(addr) + ")"; } break; - case GDFunction::ADDR_TYPE_STACK_VARIABLE: { + case GDScriptFunction::ADDR_TYPE_STACK_VARIABLE: { return "var_stack(" + itos(addr) + ")"; } break; - case GDFunction::ADDR_TYPE_GLOBAL: { + case GDScriptFunction::ADDR_TYPE_GLOBAL: { return "global(" + func.get_global_name(addr) + ")"; } break; - case GDFunction::ADDR_TYPE_NIL: { + case GDScriptFunction::ADDR_TYPE_NIL: { return "nil"; } break; } @@ -539,11 +539,11 @@ static String _disassemble_addr(const Ref<GDScript> &p_script, const GDFunction static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String> &p_code) { - const Map<StringName, GDFunction *> &mf = p_class->debug_get_member_functions(); + const Map<StringName, GDScriptFunction *> &mf = p_class->debug_get_member_functions(); - for (const Map<StringName, GDFunction *>::Element *E = mf.front(); E; E = E->next()) { + for (const Map<StringName, GDScriptFunction *>::Element *E = mf.front(); E; E = E->next()) { - const GDFunction &func = *E->get(); + const GDScriptFunction &func = *E->get(); const int *code = func.get_code(); int codelen = func.get_code_size(); String defargs; @@ -568,7 +568,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String switch (code[ip]) { - case GDFunction::OPCODE_OPERATOR: { + case GDScriptFunction::OPCODE_OPERATOR: { int op = code[ip + 1]; txt += "op "; @@ -583,7 +583,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 5; } break; - case GDFunction::OPCODE_SET: { + case GDScriptFunction::OPCODE_SET: { txt += "set "; txt += DADDR(1); @@ -594,7 +594,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 4; } break; - case GDFunction::OPCODE_GET: { + case GDScriptFunction::OPCODE_GET: { txt += " get "; txt += DADDR(3); @@ -606,7 +606,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 4; } break; - case GDFunction::OPCODE_SET_NAMED: { + case GDScriptFunction::OPCODE_SET_NAMED: { txt += " set_named "; txt += DADDR(1); @@ -617,7 +617,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 4; } break; - case GDFunction::OPCODE_GET_NAMED: { + case GDScriptFunction::OPCODE_GET_NAMED: { txt += " get_named "; txt += DADDR(3); @@ -629,7 +629,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 4; } break; - case GDFunction::OPCODE_SET_MEMBER: { + case GDScriptFunction::OPCODE_SET_MEMBER: { txt += " set_member "; txt += "[\""; @@ -639,7 +639,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 3; } break; - case GDFunction::OPCODE_GET_MEMBER: { + case GDScriptFunction::OPCODE_GET_MEMBER: { txt += " get_member "; txt += DADDR(2); @@ -650,7 +650,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 3; } break; - case GDFunction::OPCODE_ASSIGN: { + case GDScriptFunction::OPCODE_ASSIGN: { txt += " assign "; txt += DADDR(1); @@ -659,7 +659,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 3; } break; - case GDFunction::OPCODE_ASSIGN_TRUE: { + case GDScriptFunction::OPCODE_ASSIGN_TRUE: { txt += " assign "; txt += DADDR(1); @@ -667,7 +667,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 2; } break; - case GDFunction::OPCODE_ASSIGN_FALSE: { + case GDScriptFunction::OPCODE_ASSIGN_FALSE: { txt += " assign "; txt += DADDR(1); @@ -675,7 +675,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 2; } break; - case GDFunction::OPCODE_CONSTRUCT: { + case GDScriptFunction::OPCODE_CONSTRUCT: { Variant::Type t = Variant::Type(code[ip + 1]); int argc = code[ip + 2]; @@ -696,7 +696,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr = 4 + argc; } break; - case GDFunction::OPCODE_CONSTRUCT_ARRAY: { + case GDScriptFunction::OPCODE_CONSTRUCT_ARRAY: { int argc = code[ip + 1]; txt += " make_array "; @@ -714,7 +714,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 3 + argc; } break; - case GDFunction::OPCODE_CONSTRUCT_DICTIONARY: { + case GDScriptFunction::OPCODE_CONSTRUCT_DICTIONARY: { int argc = code[ip + 1]; txt += " make_dict "; @@ -735,10 +735,10 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String } break; - case GDFunction::OPCODE_CALL: - case GDFunction::OPCODE_CALL_RETURN: { + case GDScriptFunction::OPCODE_CALL: + case GDScriptFunction::OPCODE_CALL_RETURN: { - bool ret = code[ip] == GDFunction::OPCODE_CALL_RETURN; + bool ret = code[ip] == GDScriptFunction::OPCODE_CALL_RETURN; if (ret) txt += " call-ret "; @@ -764,14 +764,14 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr = 5 + argc; } break; - case GDFunction::OPCODE_CALL_BUILT_IN: { + case GDScriptFunction::OPCODE_CALL_BUILT_IN: { txt += " call-built-in "; int argc = code[ip + 2]; txt += DADDR(3 + argc) + "="; - txt += GDFunctions::get_func_name(GDFunctions::Function(code[ip + 1])); + txt += GDScriptFunctions::get_func_name(GDScriptFunctions::Function(code[ip + 1])); txt += "("; for (int i = 0; i < argc; i++) { @@ -784,7 +784,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr = 4 + argc; } break; - case GDFunction::OPCODE_CALL_SELF_BASE: { + case GDScriptFunction::OPCODE_CALL_SELF_BASE: { txt += " call-self-base "; @@ -804,13 +804,13 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr = 4 + argc; } break; - case GDFunction::OPCODE_YIELD: { + case GDScriptFunction::OPCODE_YIELD: { txt += " yield "; incr = 1; } break; - case GDFunction::OPCODE_YIELD_SIGNAL: { + case GDScriptFunction::OPCODE_YIELD_SIGNAL: { txt += " yield_signal "; txt += DADDR(1); @@ -818,13 +818,13 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String txt += DADDR(2); incr = 3; } break; - case GDFunction::OPCODE_YIELD_RESUME: { + case GDScriptFunction::OPCODE_YIELD_RESUME: { txt += " yield resume: "; txt += DADDR(1); incr = 2; } break; - case GDFunction::OPCODE_JUMP: { + case GDScriptFunction::OPCODE_JUMP: { txt += " jump "; txt += itos(code[ip + 1]); @@ -832,7 +832,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr = 2; } break; - case GDFunction::OPCODE_JUMP_IF: { + case GDScriptFunction::OPCODE_JUMP_IF: { txt += " jump-if "; txt += DADDR(1); @@ -841,7 +841,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr = 3; } break; - case GDFunction::OPCODE_JUMP_IF_NOT: { + case GDScriptFunction::OPCODE_JUMP_IF_NOT: { txt += " jump-if-not "; txt += DADDR(1); @@ -850,12 +850,12 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr = 3; } break; - case GDFunction::OPCODE_JUMP_TO_DEF_ARGUMENT: { + case GDScriptFunction::OPCODE_JUMP_TO_DEF_ARGUMENT: { txt += " jump-to-default-argument "; incr = 1; } break; - case GDFunction::OPCODE_RETURN: { + case GDScriptFunction::OPCODE_RETURN: { txt += " return "; txt += DADDR(1); @@ -863,19 +863,19 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr = 2; } break; - case GDFunction::OPCODE_ITERATE_BEGIN: { + case GDScriptFunction::OPCODE_ITERATE_BEGIN: { txt += " for-init " + DADDR(4) + " in " + DADDR(2) + " counter " + DADDR(1) + " end " + itos(code[ip + 3]); incr += 5; } break; - case GDFunction::OPCODE_ITERATE: { + case GDScriptFunction::OPCODE_ITERATE: { txt += " for-loop " + DADDR(4) + " in " + DADDR(2) + " counter " + DADDR(1) + " end " + itos(code[ip + 3]); incr += 5; } break; - case GDFunction::OPCODE_LINE: { + case GDScriptFunction::OPCODE_LINE: { int line = code[ip + 1] - 1; if (line >= 0 && line < p_code.size()) @@ -884,12 +884,12 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String txt = ""; incr += 2; } break; - case GDFunction::OPCODE_END: { + case GDScriptFunction::OPCODE_END: { txt += " end"; incr += 1; } break; - case GDFunction::OPCODE_ASSERT: { + case GDScriptFunction::OPCODE_ASSERT: { txt += " assert "; txt += DADDR(1); @@ -952,15 +952,15 @@ MainLoop *test(TestType p_type) { if (p_type == TEST_TOKENIZER) { - GDTokenizerText tk; + GDScriptTokenizerText tk; tk.set_code(code); int line = -1; - while (tk.get_token() != GDTokenizer::TK_EOF) { + while (tk.get_token() != GDScriptTokenizer::TK_EOF) { String text; - if (tk.get_token() == GDTokenizer::TK_IDENTIFIER) + if (tk.get_token() == GDScriptTokenizer::TK_IDENTIFIER) text = "'" + tk.get_token_identifier() + "' (identifier)"; - else if (tk.get_token() == GDTokenizer::TK_CONSTANT) { + else if (tk.get_token() == GDScriptTokenizer::TK_CONSTANT) { Variant c = tk.get_token_constant(); if (c.get_type() == Variant::STRING) text = "\"" + String(c) + "\""; @@ -968,12 +968,12 @@ MainLoop *test(TestType p_type) { text = c; text = text + " (" + Variant::get_type_name(c.get_type()) + " constant)"; - } else if (tk.get_token() == GDTokenizer::TK_ERROR) + } else if (tk.get_token() == GDScriptTokenizer::TK_ERROR) text = "ERROR: " + tk.get_token_error(); - else if (tk.get_token() == GDTokenizer::TK_NEWLINE) + else if (tk.get_token() == GDScriptTokenizer::TK_NEWLINE) text = "newline (" + itos(tk.get_token_line()) + ") + indent: " + itos(tk.get_token_line_indent()); - else if (tk.get_token() == GDTokenizer::TK_BUILT_IN_FUNC) - text = "'" + String(GDFunctions::get_func_name(tk.get_token_built_in_func())) + "' (built-in function)"; + else if (tk.get_token() == GDScriptTokenizer::TK_BUILT_IN_FUNC) + text = "'" + String(GDScriptFunctions::get_func_name(tk.get_token_built_in_func())) + "' (built-in function)"; else text = tk.get_token_name(tk.get_token()); @@ -995,7 +995,7 @@ MainLoop *test(TestType p_type) { if (p_type == TEST_PARSER) { - GDParser parser; + GDScriptParser parser; Error err = parser.parse(code); if (err) { print_line("Parse Error:\n" + itos(parser.get_error_line()) + ":" + itos(parser.get_error_column()) + ":" + parser.get_error()); @@ -1003,16 +1003,16 @@ MainLoop *test(TestType p_type) { return NULL; } - const GDParser::Node *root = parser.get_parse_tree(); - ERR_FAIL_COND_V(root->type != GDParser::Node::TYPE_CLASS, NULL); - const GDParser::ClassNode *cnode = static_cast<const GDParser::ClassNode *>(root); + const GDScriptParser::Node *root = parser.get_parse_tree(); + ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, NULL); + const GDScriptParser::ClassNode *cnode = static_cast<const GDScriptParser::ClassNode *>(root); _parser_show_class(cnode, 0, lines); } if (p_type == TEST_COMPILER) { - GDParser parser; + GDScriptParser parser; Error err = parser.parse(code); if (err) { @@ -1023,7 +1023,7 @@ MainLoop *test(TestType p_type) { GDScript *script = memnew(GDScript); - GDCompiler gdc; + GDScriptCompiler gdc; err = gdc.compile(&parser, script); if (err) { @@ -1046,7 +1046,7 @@ MainLoop *test(TestType p_type) { } else if (p_type == TEST_BYTECODE) { - Vector<uint8_t> buf = GDTokenizerBuffer::parse_code_string(code); + Vector<uint8_t> buf = GDScriptTokenizerBuffer::parse_code_string(code); String dst = test.get_basename() + ".gdc"; FileAccess *fw = FileAccess::open(dst, FileAccess::WRITE); fw->store_buffer(buf.ptr(), buf.size()); diff --git a/methods.py b/methods.py index 2f3dac7e42..c8cc84eb4c 100644 --- a/methods.py +++ b/methods.py @@ -1293,21 +1293,15 @@ def detect_modules(): // modules.cpp - THIS FILE IS GENERATED, DO NOT EDIT!!!!!!! #include "register_module_types.h" - """ + includes_cpp + """ void register_module_types() { - """ + register_cpp + """ - } void unregister_module_types() { - """ + unregister_cpp + """ - } - """ f = open("modules/register_module_types.gen.cpp", "w") @@ -1692,6 +1686,17 @@ def find_visual_c_batch_file(env): (host_platform, target_platform,req_target_platform) = get_host_target(env) return find_batch_file(env, version, host_platform, target_platform)[0] +def generate_cpp_hint_file(filename): + import os.path + if os.path.isfile(filename): + # Don't overwrite an existing hint file since the user may have customized it. + pass + else: + try: + fd = open(filename, "w") + fd.write("#define GDCLASS(m_class, m_inherits)\n") + except IOError: + print("Could not write cpp.hint file.") def generate_vs_project(env, num_jobs): batch_file = find_visual_c_batch_file(env) @@ -1718,9 +1723,9 @@ def generate_vs_project(env, num_jobs): # to double quote off the directory. However, the path ends # in a backslash, so we need to remove this, lest it escape the # last double quote off, confusing MSBuild - env['MSVSBUILDCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" platform=windows target=$(Configuration) tools=!tools! -j' + str(num_jobs)) - env['MSVSREBUILDCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" platform=windows target=$(Configuration) tools=!tools! vsproj=yes -j' + str(num_jobs)) - env['MSVSCLEANCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" --clean platform=windows target=$(Configuration) tools=!tools! -j' + str(num_jobs)) + env['MSVSBUILDCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" platform=windows progress=no target=$(Configuration) tools=!tools! -j' + str(num_jobs)) + env['MSVSREBUILDCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" platform=windows progress=no target=$(Configuration) tools=!tools! vsproj=yes -j' + str(num_jobs)) + env['MSVSCLEANCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" --clean platform=windows progress=no target=$(Configuration) tools=!tools! -j' + str(num_jobs)) # This version information (Win32, x64, Debug, Release, Release_Debug seems to be # required for Visual Studio to understand that it needs to generate an NMAKE diff --git a/misc/dist/html/default.html b/misc/dist/html/default.html index 9fae34f97e..0f78fc640e 100644 --- a/misc/dist/html/default.html +++ b/misc/dist/html/default.html @@ -225,12 +225,11 @@ $GODOT_HEAD_INCLUDE <script type="text/javascript" src="$GODOT_BASENAME.js"></script> <script type="text/javascript">//<![CDATA[ - var game = new Engine; + var engine = new Engine; (function() { const BASENAME = '$GODOT_BASENAME'; - const MEMORY_SIZE = $GODOT_TOTAL_MEMORY; const DEBUG_ENABLED = $GODOT_DEBUG_ENABLED; const INDETERMINATE_STATUS_STEP_MS = 100; @@ -246,8 +245,7 @@ $GODOT_HEAD_INCLUDE var indeterminiateStatusAnimationId = 0; setStatusMode('indeterminate'); - game.setCanvas(canvas); - game.setAsmjsMemorySize(MEMORY_SIZE); + engine.setCanvas(canvas); function setStatusMode(mode) { @@ -302,7 +300,7 @@ $GODOT_HEAD_INCLUDE }); }; - game.setProgressFunc((current, total) => { + engine.setProgressFunc((current, total) => { if (total > 0) { statusProgressInner.style.width = current/total * 100 + '%'; @@ -332,10 +330,6 @@ $GODOT_HEAD_INCLUDE outputRoot.style.display = 'block'; function print(text) { - if (arguments.length > 1) { - text = Array.prototype.slice.call(arguments).join(" "); - } - if (text.length <= 0) return; while (outputScroll.childElementCount >= OUTPUT_MSG_COUNT_MAX) { outputScroll.firstChild.remove(); } @@ -356,26 +350,31 @@ $GODOT_HEAD_INCLUDE }; function printError(text) { - print('**ERROR**' + ":", text); + if (!text.startsWith('**ERROR**: ')) { + text = '**ERROR**: ' + text; + } + print(text); } - game.setStdoutFunc(text => { + engine.setStdoutFunc(text => { print(text); console.log(text); }); - game.setStderrFunc(text => { + engine.setStderrFunc(text => { printError(text); console.warn(text); }); } - game.start(BASENAME + '.pck').then(() => { + engine.startGame(BASENAME + '.pck').then(() => { setStatusMode('hidden'); initializing = false; }, err => { - if (DEBUG_ENABLED) + if (DEBUG_ENABLED) { printError(err.message); + console.warn(err); + } setStatusNotice(err.message); setStatusMode('notice'); initializing = false; diff --git a/modules/SCsub b/modules/SCsub index d1c0cdc05c..c1cf5a6c1a 100644 --- a/modules/SCsub +++ b/modules/SCsub @@ -9,7 +9,6 @@ Export('env_modules') env.modules_sources = [ "register_module_types.gen.cpp", ] -# env.add_source_files(env.modules_sources,"*.cpp") Export('env') for x in env.module_list: diff --git a/modules/bullet/config.py b/modules/bullet/config.py index b00ea18328..0a31c2e503 100644 --- a/modules/bullet/config.py +++ b/modules/bullet/config.py @@ -3,4 +3,12 @@ def can_build(platform): def configure(env): pass - + +def get_doc_classes(): + return [ + "BulletPhysicsDirectBodyState", + "BulletPhysicsServer", + ] + +def get_doc_path(): + return "doc_classes" diff --git a/doc/classes/BulletPhysicsDirectBodyState.xml b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml index 3d7be54e19..831b346942 100644 --- a/doc/classes/BulletPhysicsDirectBodyState.xml +++ b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BulletPhysicsDirectBodyState" inherits="PhysicsDirectBodyState" category="Core" version="3.0.alpha.custom_build"> +<class name="BulletPhysicsDirectBodyState" inherits="PhysicsDirectBodyState" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/BulletPhysicsServer.xml b/modules/bullet/doc_classes/BulletPhysicsServer.xml index ac5d510486..4b5c2e6d83 100644 --- a/doc/classes/BulletPhysicsServer.xml +++ b/modules/bullet/doc_classes/BulletPhysicsServer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="BulletPhysicsServer" inherits="PhysicsServer" category="Core" version="3.0.alpha.custom_build"> +<class name="BulletPhysicsServer" inherits="PhysicsServer" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp index bc60c9cb6b..cbf30c8a2e 100644 --- a/modules/bullet/godot_result_callbacks.cpp +++ b/modules/bullet/godot_result_callbacks.cpp @@ -77,7 +77,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo PhysicsDirectSpaceState::ShapeResult &result = m_results[count]; - result.shape = convexResult.m_localShapeInfo->m_shapePart; + result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID result.rid = gObj->get_self(); result.collider_id = gObj->get_instance_id(); result.collider = 0 == result.collider_id ? NULL : ObjectDB::get_instance(result.collider_id); @@ -122,7 +122,7 @@ bool GodotClosestConvexResultCallback::needsCollision(btBroadphaseProxy *proxy0) btScalar GodotClosestConvexResultCallback::addSingleResult(btCollisionWorld::LocalConvexResult &convexResult, bool normalInWorldSpace) { btScalar res = btCollisionWorld::ClosestConvexResultCallback::addSingleResult(convexResult, normalInWorldSpace); - m_shapePart = convexResult.m_localShapeInfo->m_shapePart; + m_shapeId = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID return res; } @@ -242,3 +242,21 @@ btScalar GodotRestInfoContactResultCallback::addSingleResult(btManifoldPoint &cp return cp.getDistance(); } + +void GodotDeepPenetrationContactResultCallback::addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorldOnB, btScalar depth) { + + if (depth < 0) { + // Has penetration + if (m_most_penetrated_distance > depth) { + + bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject(); + + m_most_penetrated_distance = depth; + m_pointCollisionObject = (isSwapped ? m_body0Wrap : m_body1Wrap)->getCollisionObject(); + m_other_compound_shape_index = isSwapped ? m_index1 : m_index0; + m_pointNormalWorld = isSwapped ? normalOnBInWorld * -1 : normalOnBInWorld; + m_pointWorld = isSwapped ? (pointInWorldOnB + normalOnBInWorld * depth) : pointInWorldOnB; + m_penetration_distance = depth; + } + } +} diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h index 68dff5b12a..ba5142676b 100644 --- a/modules/bullet/godot_result_callbacks.h +++ b/modules/bullet/godot_result_callbacks.h @@ -88,7 +88,7 @@ public: struct GodotClosestConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback { public: const Set<RID> *m_exclude; - int m_shapePart; + int m_shapeId; GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude) : btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), m_exclude(p_exclude) {} @@ -149,4 +149,31 @@ public: virtual btScalar addSingleResult(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1); }; +struct GodotDeepPenetrationContactResultCallback : public btManifoldResult { + btVector3 m_pointNormalWorld; + btVector3 m_pointWorld; + btScalar m_penetration_distance; + int m_other_compound_shape_index; + const btCollisionObject *m_pointCollisionObject; + + btScalar m_most_penetrated_distance; + + GodotDeepPenetrationContactResultCallback(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap) + : btManifoldResult(body0Wrap, body1Wrap), + m_pointCollisionObject(NULL), + m_penetration_distance(0), + m_other_compound_shape_index(0), + m_most_penetrated_distance(1e20) {} + + void reset() { + m_pointCollisionObject = NULL; + m_most_penetrated_distance = 1e20; + } + + bool hasHit() { + return m_pointCollisionObject; + } + + virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth); +}; #endif // GODOT_RESULT_CALLBACKS_H diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index 9df01aee3e..e4d049b00d 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -115,12 +115,13 @@ int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Tra ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape); - btConvexShape *btConvex = dynamic_cast<btConvexShape *>(shape->create_bt_shape()); - if (!btConvex) { - bulletdelete(btConvex); + btCollisionShape *btShape = shape->create_bt_shape(); + if (!btShape->isConvex()) { + bulletdelete(btShape); ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type())); return 0; } + btConvexShape *btConvex = static_cast<btConvexShape *>(btShape); btVector3 scale_with_margin; G_TO_B(p_xform.basis.get_scale(), scale_with_margin); @@ -147,12 +148,13 @@ int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Tra bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask, ShapeRestInfo *r_info) { ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape); - btConvexShape *bt_convex_shape = dynamic_cast<btConvexShape *>(shape->create_bt_shape()); - if (!bt_convex_shape) { - bulletdelete(bt_convex_shape); + btCollisionShape *btShape = shape->create_bt_shape(); + if (!btShape->isConvex()) { + bulletdelete(btShape); ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type())); return 0; } + btConvexShape *bt_convex_shape = static_cast<btConvexShape *>(btShape); btVector3 bt_motion; G_TO_B(p_motion, bt_motion); @@ -173,17 +175,19 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf space->dynamicsWorld->convexSweepTest(bt_convex_shape, bt_xform_from, bt_xform_to, btResult, 0.002); - if (btResult.hasHit()) { - if (btCollisionObject::CO_RIGID_BODY == btResult.m_hitCollisionObject->getInternalType()) { - B_TO_G(static_cast<const btRigidBody *>(btResult.m_hitCollisionObject)->getVelocityInLocalPoint(btResult.m_hitPointWorld), r_info->linear_velocity); + if (r_info) { + if (btResult.hasHit()) { + if (btCollisionObject::CO_RIGID_BODY == btResult.m_hitCollisionObject->getInternalType()) { + B_TO_G(static_cast<const btRigidBody *>(btResult.m_hitCollisionObject)->getVelocityInLocalPoint(btResult.m_hitPointWorld), r_info->linear_velocity); + } + CollisionObjectBullet *collision_object = static_cast<CollisionObjectBullet *>(btResult.m_hitCollisionObject->getUserPointer()); + p_closest_safe = p_closest_unsafe = btResult.m_closestHitFraction; + B_TO_G(btResult.m_hitPointWorld, r_info->point); + B_TO_G(btResult.m_hitNormalWorld, r_info->normal); + r_info->rid = collision_object->get_self(); + r_info->collider_id = collision_object->get_instance_id(); + r_info->shape = btResult.m_shapeId; } - CollisionObjectBullet *collision_object = static_cast<CollisionObjectBullet *>(btResult.m_hitCollisionObject->getUserPointer()); - p_closest_safe = p_closest_unsafe = btResult.m_closestHitFraction; - B_TO_G(btResult.m_hitPointWorld, r_info->point); - B_TO_G(btResult.m_hitNormalWorld, r_info->normal); - r_info->rid = collision_object->get_self(); - r_info->collider_id = collision_object->get_instance_id(); - r_info->shape = btResult.m_shapePart; } bulletdelete(bt_convex_shape); @@ -197,12 +201,13 @@ bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform & ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape); - btConvexShape *btConvex = dynamic_cast<btConvexShape *>(shape->create_bt_shape()); - if (!btConvex) { - bulletdelete(btConvex); + btCollisionShape *btShape = shape->create_bt_shape(); + if (!btShape->isConvex()) { + bulletdelete(btShape); ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type())); return 0; } + btConvexShape *btConvex = static_cast<btConvexShape *>(btShape); btVector3 scale_with_margin; G_TO_B(p_shape_xform.basis.get_scale(), scale_with_margin); @@ -231,12 +236,13 @@ bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform &p_sh ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape); - btConvexShape *btConvex = dynamic_cast<btConvexShape *>(shape->create_bt_shape()); - if (!btConvex) { - bulletdelete(btConvex); + btCollisionShape *btShape = shape->create_bt_shape(); + if (!btShape->isConvex()) { + bulletdelete(btShape); ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type())); return 0; } + btConvexShape *btConvex = static_cast<btConvexShape *>(btShape); btVector3 scale_with_margin; G_TO_B(p_shape_xform.basis.get_scale() + Vector3(p_margin, p_margin, p_margin), scale_with_margin); @@ -777,7 +783,8 @@ void SpaceBullet::check_body_collision() { void SpaceBullet::update_gravity() { btVector3 btGravity; G_TO_B(gravityDirection * gravityMagnitude, btGravity); - dynamicsWorld->setGravity(btGravity); + //dynamicsWorld->setGravity(btGravity); + dynamicsWorld->setGravity(btVector3(0, 0, 0)); if (soft_body_world_info) { soft_body_world_info->m_gravity = btGravity; } @@ -877,11 +884,11 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f continue; } - btConvexShape *convex_shape_test(dynamic_cast<btConvexShape *>(p_body->get_bt_shape(shIndex))); - if (!convex_shape_test) { + if (!p_body->get_bt_shape(shIndex)->isConvex()) { // Skip no convex shape continue; } + btConvexShape *convex_shape_test(static_cast<btConvexShape *>(p_body->get_bt_shape(shIndex))); btTransform shape_world_from; G_TO_B(p_body->get_shape_transform(shIndex), shape_world_from); @@ -910,26 +917,26 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f { /// Phase three - Recover + contact test with margin - RecoverResult recover_result; + RecoverResult r_recover_result; - hasPenetration = recover_from_penetration(p_body, body_safe_position, recovered_motion, &recover_result); + hasPenetration = recover_from_penetration(p_body, body_safe_position, recovered_motion, &r_recover_result); if (r_result) { B_TO_G(recovered_motion + recover_initial_position, r_result->motion); if (hasPenetration) { - const btRigidBody *btRigid = static_cast<const btRigidBody *>(recover_result.other_collision_object); + const btRigidBody *btRigid = static_cast<const btRigidBody *>(r_recover_result.other_collision_object); CollisionObjectBullet *collisionObject = static_cast<CollisionObjectBullet *>(btRigid->getUserPointer()); r_result->remainder = p_motion - r_result->motion; // is the remaining movements - B_TO_G(recover_result.pointWorld, r_result->collision_point); - B_TO_G(recover_result.pointNormalWorld, r_result->collision_normal); - B_TO_G(btRigid->getVelocityInLocalPoint(recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity); // It calculates velocity at point and assign it using special function Bullet_to_Godot + B_TO_G(r_recover_result.pointWorld, r_result->collision_point); + B_TO_G(r_recover_result.pointNormalWorld, r_result->collision_normal); + B_TO_G(btRigid->getVelocityInLocalPoint(r_recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity); // It calculates velocity at point and assign it using special function Bullet_to_Godot r_result->collider = collisionObject->get_self(); r_result->collider_id = collisionObject->get_instance_id(); - r_result->collider_shape = recover_result.other_compound_shape_index; - r_result->collision_local_shape = recover_result.local_shape_most_recovered; + r_result->collider_shape = r_recover_result.other_compound_shape_index; + r_result->collision_local_shape = r_recover_result.local_shape_most_recovered; //{ /// Add manifold point to manage collisions // btPersistentManifold* manifold = dynamicsWorld->getDispatcher()->getNewManifold(p_body->getBtBody(), btRigid); @@ -995,7 +1002,7 @@ public: } }; -bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btVector3 &out_recover_position, RecoverResult *recover_result) { +bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btVector3 &r_recover_position, RecoverResult *r_recover_result) { RecoverPenetrationBroadPhaseCallback recover_broad_result(p_body->get_bt_collision_object(), p_body->get_collision_layer(), p_body->get_collision_mask()); @@ -1005,9 +1012,6 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran // Broad phase support btVector3 minAabb, maxAabb; - // GJK support - btGjkPairDetector::ClosestPointInput gjk_input; - bool penetration = false; // For each shape @@ -1022,7 +1026,7 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran body_shape_position = p_body_position * kin_shape.transform; body_shape_position_recovered = body_shape_position; - body_shape_position_recovered.getOrigin() += out_recover_position; + body_shape_position_recovered.getOrigin() += r_recover_position; kin_shape.shape->getAabb(body_shape_position_recovered, minAabb, maxAabb); dynamicsWorld->getBroadphase()->aabbTest(minAabb, maxAabb, recover_broad_result); @@ -1032,66 +1036,33 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran if (!p_body->get_bt_collision_object()->checkCollideWith(otherObject) || !otherObject->checkCollideWith(p_body->get_bt_collision_object())) continue; - if (otherObject->getCollisionShape()->isCompound()) { /// Execute GJK test against all shapes + if (otherObject->getCollisionShape()->isCompound()) { // Each convex shape btCompoundShape *cs = static_cast<btCompoundShape *>(otherObject->getCollisionShape()); for (int x = cs->getNumChildShapes() - 1; 0 <= x; --x) { - if (!cs->getChildShape(x)->isConvex()) - continue; + if (cs->getChildShape(x)->isConvex()) { + if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(cs->getChildShape(x)), otherObject, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), r_recover_position, r_recover_result)) { - // Initialize GJK input - gjk_input.m_transformA = body_shape_position; - gjk_input.m_transformA.getOrigin() += out_recover_position; - gjk_input.m_transformB = otherObject->getWorldTransform() * cs->getChildTransform(x); + penetration = true; + } + } else { + if (RFP_convex_world_test(kin_shape.shape, cs->getChildShape(x), p_body->get_bt_collision_object(), otherObject, kinIndex, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), r_recover_position, r_recover_result)) { - // Perform GJK test - btPointCollector result; - btGjkPairDetector gjk_pair_detector(kin_shape.shape, static_cast<const btConvexShape *>(cs->getChildShape(x)), gjk_simplex_solver, gjk_epa_pen_solver); - gjk_pair_detector.getClosestPoints(gjk_input, result, 0); - if (0 > result.m_distance) { - // Has penetration - out_recover_position += result.m_normalOnBInWorld * (result.m_distance * -1); - penetration = true; - - if (recover_result) { - - recover_result->hasPenetration = true; - recover_result->other_collision_object = otherObject; - recover_result->other_compound_shape_index = x; - recover_result->penetration_distance = result.m_distance; - recover_result->pointNormalWorld = result.m_normalOnBInWorld; - recover_result->pointWorld = result.m_pointInWorld; + penetration = true; } } } - } else if (otherObject->getCollisionShape()->isConvex()) { /// Execute GJK test against object shape + if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(otherObject->getCollisionShape()), otherObject, 0, body_shape_position, otherObject->getWorldTransform(), r_recover_position, r_recover_result)) { - // Initialize GJK input - gjk_input.m_transformA = body_shape_position; - gjk_input.m_transformA.getOrigin() += out_recover_position; - gjk_input.m_transformB = otherObject->getWorldTransform(); - - // Perform GJK test - btPointCollector result; - btGjkPairDetector gjk_pair_detector(kin_shape.shape, static_cast<const btConvexShape *>(otherObject->getCollisionShape()), gjk_simplex_solver, gjk_epa_pen_solver); - gjk_pair_detector.getClosestPoints(gjk_input, result, 0); - if (0 > result.m_distance) { - // Has penetration - out_recover_position += result.m_normalOnBInWorld * (result.m_distance * -1); penetration = true; + } + } else { + if (RFP_convex_world_test(kin_shape.shape, otherObject->getCollisionShape(), p_body->get_bt_collision_object(), otherObject, kinIndex, 0, body_shape_position, otherObject->getWorldTransform(), r_recover_position, r_recover_result)) { - if (recover_result) { - - recover_result->hasPenetration = true; - recover_result->other_collision_object = otherObject; - recover_result->other_compound_shape_index = 0; - recover_result->penetration_distance = result.m_distance; - recover_result->pointNormalWorld = result.m_normalOnBInWorld; - recover_result->pointWorld = result.m_pointInWorld; - } + penetration = true; } } } @@ -1099,3 +1070,70 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran return penetration; } + +bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result) { + + // Initialize GJK input + btGjkPairDetector::ClosestPointInput gjk_input; + gjk_input.m_transformA = p_transformA; + gjk_input.m_transformA.getOrigin() += r_recover_position; + gjk_input.m_transformB = p_transformB; + + // Perform GJK test + btPointCollector result; + btGjkPairDetector gjk_pair_detector(p_shapeA, p_shapeB, gjk_simplex_solver, gjk_epa_pen_solver); + gjk_pair_detector.getClosestPoints(gjk_input, result, 0); + if (0 > result.m_distance) { + // Has penetration + r_recover_position += result.m_normalOnBInWorld * (result.m_distance * -1); + + if (r_recover_result) { + + r_recover_result->hasPenetration = true; + r_recover_result->other_collision_object = p_objectB; + r_recover_result->other_compound_shape_index = p_shapeId_B; + r_recover_result->penetration_distance = result.m_distance; + r_recover_result->pointNormalWorld = result.m_normalOnBInWorld; + r_recover_result->pointWorld = result.m_pointInWorld; + } + return true; + } + return false; +} + +bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result) { + + /// Contact test + + btTransform p_recovered_transformA(p_transformA); + p_recovered_transformA.getOrigin() += r_recover_position; + + btCollisionObjectWrapper obA(NULL, p_shapeA, p_objectA, p_recovered_transformA, -1, p_shapeId_A); + btCollisionObjectWrapper obB(NULL, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B); + + btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CLOSEST_POINT_ALGORITHMS); + if (algorithm) { + GodotDeepPenetrationContactResultCallback contactPointResult(&obA, &obB); + //discrete collision detection query + algorithm->processCollision(&obA, &obB, dynamicsWorld->getDispatchInfo(), &contactPointResult); + + algorithm->~btCollisionAlgorithm(); + dispatcher->freeCollisionAlgorithm(algorithm); + + if (contactPointResult.hasHit()) { + r_recover_position += contactPointResult.m_pointNormalWorld * (contactPointResult.m_penetration_distance * -1); + + if (r_recover_result) { + + r_recover_result->hasPenetration = true; + r_recover_result->other_collision_object = p_objectB; + r_recover_result->other_compound_shape_index = p_shapeId_B; + r_recover_result->penetration_distance = contactPointResult.m_penetration_distance; + r_recover_result->pointNormalWorld = contactPointResult.m_pointNormalWorld; + r_recover_result->pointWorld = contactPointResult.m_pointWorld; + } + return true; + } + } + return false; +} diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h index d9206f8046..9acac9a7d6 100644 --- a/modules/bullet/space_bullet.h +++ b/modules/bullet/space_bullet.h @@ -189,6 +189,12 @@ private: : hasPenetration(false) {} }; - bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_from, btVector3 &out_recover_position, RecoverResult *recover_result = NULL); + bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_from, btVector3 &r_recover_position, RecoverResult *r_recover_result = NULL); + /// This is an API that recover a kinematic object from penetration + /// This allow only Convex Convex test and it always use GJK algorithm, With this API we don't benefit of Bullet special accelerated functions + bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result); + /// This is an API that recover a kinematic object from penetration + /// Using this we leave Bullet to select the best algorithm, For example GJK in case we have Convex Convex, or a Bullet accelerated algorithm + bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result); }; #endif diff --git a/modules/dds/config.py b/modules/dds/config.py index fb920482f5..5f133eba90 100644 --- a/modules/dds/config.py +++ b/modules/dds/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/enet/config.py b/modules/enet/config.py index fb920482f5..8031fbb4b6 100644 --- a/modules/enet/config.py +++ b/modules/enet/config.py @@ -1,7 +1,13 @@ - def can_build(platform): return True - def configure(env): pass + +def get_doc_classes(): + return [ + "NetworkedMultiplayerENet", + ] + +def get_doc_path(): + return "doc_classes" diff --git a/doc/classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml index 02c919bd83..70ef6aef20 100644 --- a/doc/classes/NetworkedMultiplayerENet.xml +++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core" version="3.0.alpha.custom_build"> +<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" category="Core" version="3.0-alpha"> <brief_description> PacketPeer implementation using the ENet library. </brief_description> diff --git a/modules/etc/config.py b/modules/etc/config.py index 7dc2cb59c1..395fc1bb02 100644 --- a/modules/etc/config.py +++ b/modules/etc/config.py @@ -1,8 +1,6 @@ - def can_build(platform): return True - def configure(env): # Tools only, disabled for non-tools # TODO: Find a cleaner way to achieve that diff --git a/modules/freetype/config.py b/modules/freetype/config.py index fb920482f5..5f133eba90 100644 --- a/modules/freetype/config.py +++ b/modules/freetype/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index 2755930a55..66b8d5cbdd 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -19,6 +19,20 @@ def _spaced(e): return e if e[-1] == '*' else e + ' ' def _build_gdnative_api_struct_header(api): + ext_wrappers = '' + + for name in api['extensions']: + ext_wrappers += ' extern const godot_gdnative_ext_' + name + '_api_struct *_gdnative_wrapper_' + name + '_api_struct;' + + ext_init = 'for (int i = 0; i < _gdnative_wrapper_api_struct->num_extensions; i++) { ' + ext_init += 'switch (_gdnative_wrapper_api_struct->extensions[i]->type) {' + + for name in api['extensions']: + ext_init += 'case GDNATIVE_EXT_' + api['extensions'][name]['type'] + ': ' + ext_init += '_gdnative_wrapper_' + name + '_api_struct = (' + 'godot_gdnative_ext_' + name + '_api_struct *) _gdnative_wrapper_api_struct->extensions[i]; break;' + + ext_init += '}' + out = [ '/* THIS FILE IS GENERATED DO NOT EDIT */', '#ifndef GODOT_GDNATIVE_API_STRUCT_H', @@ -29,7 +43,7 @@ def _build_gdnative_api_struct_header(api): '#include <nativescript/godot_nativescript.h>', '#include <pluginscript/godot_pluginscript.h>', '', - '#define GDNATIVE_API_INIT(options) do { extern const godot_gdnative_api_struct *_gdnative_wrapper_api_struct; _gdnative_wrapper_api_struct = options->api_struct; } while (0)', + '#define GDNATIVE_API_INIT(options) do { extern const godot_gdnative_api_struct *_gdnative_wrapper_api_struct;' + ext_wrappers + ' _gdnative_wrapper_api_struct = options->api_struct; ' + ext_init + ' } while (0)', '', '#ifdef __cplusplus', 'extern "C" {', @@ -166,18 +180,23 @@ def _build_gdnative_wrapper_code(api): '#include <gdnative/gdnative.h>', '#include <nativescript/godot_nativescript.h>', '#include <pluginscript/godot_pluginscript.h>', + '#include <arvr/godot_arvr.h>', '', '#include <gdnative_api_struct.gen.h>', '', - 'godot_gdnative_api_struct *_gdnative_wrapper_api_struct = 0;', - '', '#ifdef __cplusplus', 'extern "C" {', '#endif', - '' + '', + 'godot_gdnative_core_api_struct *_gdnative_wrapper_api_struct = 0;', ] - for funcdef in api['api']: + for name in api['extensions']: + out.append('godot_gdnative_ext_' + name + '_api_struct *_gdnative_wrapper_' + name + '_api_struct;') + + out += [''] + + for funcdef in api['core']['api']: args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']]) out.append('%s%s(%s) {' % (_spaced(funcdef['return_type']), funcdef['name'], args)) @@ -190,6 +209,20 @@ def _build_gdnative_wrapper_code(api): out.append('}') out.append('') + for name in api['extensions']: + for funcdef in api['extensions'][name]['api']: + args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']]) + out.append('%s%s(%s) {' % (_spaced(funcdef['return_type']), funcdef['name'], args)) + + args = ', '.join(['%s' % n for t, n in funcdef['arguments']]) + + return_line = '\treturn ' if funcdef['return_type'] != 'void' else '\t' + return_line += '_gdnative_wrapper_' + name + '_api_struct->' + funcdef['name'] + '(' + args + ');' + + out.append(return_line) + out.append('}') + out.append('') + out += [ '#ifdef __cplusplus', '}', diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py index df3556249d..68148c4d87 100644 --- a/modules/gdnative/config.py +++ b/modules/gdnative/config.py @@ -1,4 +1,3 @@ - def can_build(platform): return True @@ -6,7 +5,13 @@ def configure(env): env.use_ptrcall = True def get_doc_classes(): - return ["GDNative", "GDNativeLibrary", "NativeScript", "ARVRInterfaceGDNative"] + return [ + "ARVRInterfaceGDNative", + "GDNative", + "GDNativeLibrary", + "NativeScript", + "PluginScript", + ] def get_doc_path(): - return "doc_classes" + return "doc_classes" diff --git a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml index 308a7d5946..10957a3394 100644 --- a/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml +++ b/modules/gdnative/doc_classes/ARVRInterfaceGDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.0.alpha.custom_build"> +<class name="ARVRInterfaceGDNative" inherits="ARVRInterface" category="Core" version="3.0-alpha"> <brief_description> GDNative wrapper for an ARVR interface </brief_description> diff --git a/modules/gdnative/doc_classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml index 83a1cf06f0..7a36d09aec 100644 --- a/modules/gdnative/doc_classes/GDNative.xml +++ b/modules/gdnative/doc_classes/GDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDNative" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="GDNative" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/doc_classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml index 361c89e6b3..e271665fd4 100644 --- a/modules/gdnative/doc_classes/GDNativeLibrary.xml +++ b/modules/gdnative/doc_classes/GDNativeLibrary.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDNativeLibrary" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="GDNativeLibrary" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> @@ -9,37 +9,51 @@ <demos> </demos> <methods> - <method name="get_active_library_path" qualifiers="const"> + <method name="get_config_file"> + <return type="ConfigFile"> + </return> + <description> + </description> + </method> + <method name="get_current_dependencies" qualifiers="const"> + <return type="PoolStringArray"> + </return> + <description> + </description> + </method> + <method name="get_current_library_path" qualifiers="const"> <return type="String"> </return> <description> </description> </method> - <method name="get_library_path" qualifiers="const"> + <method name="get_symbol_prefix" qualifiers="const"> <return type="String"> </return> - <argument index="0" name="platform" type="String"> - </argument> <description> </description> </method> - <method name="is_singleton_gdnative" qualifiers="const"> + <method name="is_current_library_statically_linked" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="is_singleton" qualifiers="const"> <return type="bool"> </return> <description> </description> </method> - <method name="set_library_path"> + <method name="set_load_once"> <return type="void"> </return> - <argument index="0" name="platform" type="String"> - </argument> - <argument index="1" name="path" type="String"> + <argument index="0" name="load_once" type="bool"> </argument> <description> </description> </method> - <method name="set_singleton_gdnative"> + <method name="set_singleton"> <return type="void"> </return> <argument index="0" name="singleton" type="bool"> @@ -47,9 +61,27 @@ <description> </description> </method> + <method name="set_symbol_prefix"> + <return type="void"> + </return> + <argument index="0" name="symbol_prefix" type="String"> + </argument> + <description> + </description> + </method> + <method name="should_load_once" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> </methods> <members> - <member name="singleton_gdnative" type="bool" setter="set_singleton_gdnative" getter="is_singleton_gdnative"> + <member name="load_once" type="bool" setter="set_load_once" getter="should_load_once"> + </member> + <member name="singleton" type="bool" setter="set_singleton" getter="is_singleton"> + </member> + <member name="symbol_prefix" type="String" setter="set_symbol_prefix" getter="get_symbol_prefix"> </member> </members> <constants> diff --git a/modules/gdnative/doc_classes/NativeScript.xml b/modules/gdnative/doc_classes/NativeScript.xml index b040cfd966..eb4e13f748 100644 --- a/modules/gdnative/doc_classes/NativeScript.xml +++ b/modules/gdnative/doc_classes/NativeScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="NativeScript" inherits="Script" category="Core" version="3.0.alpha.custom_build"> +<class name="NativeScript" inherits="Script" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/PluginScript.xml b/modules/gdnative/doc_classes/PluginScript.xml index 334921016b..a5ab422d3c 100644 --- a/doc/classes/PluginScript.xml +++ b/modules/gdnative/doc_classes/PluginScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="PluginScript" inherits="Script" category="Core" version="3.0.alpha.custom_build"> +<class name="PluginScript" inherits="Script" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/gd_native_library_editor.cpp b/modules/gdnative/gd_native_library_editor.cpp index c37b7f473d..fda5dcdcad 100644 --- a/modules/gdnative/gd_native_library_editor.cpp +++ b/modules/gdnative/gd_native_library_editor.cpp @@ -44,7 +44,7 @@ void GDNativeLibraryEditor::_find_gdnative_singletons(EditorFileSystemDirectory } Ref<GDNativeLibrary> lib = ResourceLoader::load(p_dir->get_file_path(i)); - if (lib.is_valid() && lib->is_singleton_gdnative()) { + if (lib.is_valid() && lib->is_singleton()) { String path = p_dir->get_file_path(i); TreeItem *ti = libraries->create_item(libraries->get_root()); ti->set_text(0, path.get_file()); diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 832a0cb859..44d6dffc85 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -37,161 +37,56 @@ #include "scene/main/scene_tree.h" -const String init_symbol = "godot_gdnative_init"; -const String terminate_symbol = "godot_gdnative_terminate"; +const String init_symbol = "gdnative_init"; +const String terminate_symbol = "gdnative_terminate"; +const String default_symbol_prefix = "godot_"; // Defined in gdnative_api_struct.gen.cpp extern const godot_gdnative_core_api_struct api_struct; -String GDNativeLibrary::platform_names[NUM_PLATFORMS + 1] = { - "X11_32bit", - "X11_64bit", - "Windows_32bit", - "Windows_64bit", - "OSX", - - "Android", - - "iOS_32bit", - "iOS_64bit", - - "WebAssembly", - - "" -}; -String GDNativeLibrary::platform_lib_ext[NUM_PLATFORMS + 1] = { - "so", - "so", - "dll", - "dll", - "dylib", - - "so", - - "dylib", - "dylib", - - "wasm", - - "" -}; - -GDNativeLibrary::Platform GDNativeLibrary::current_platform = -#if defined(X11_ENABLED) - (sizeof(void *) == 8 ? X11_64BIT : X11_32BIT); -#elif defined(WINDOWS_ENABLED) - (sizeof(void *) == 8 ? WINDOWS_64BIT : WINDOWS_32BIT); -#elif defined(OSX_ENABLED) - OSX; -#elif defined(IPHONE_ENABLED) - (sizeof(void *) == 8 ? IOS_64BIT : IOS_32BIT); -#elif defined(ANDROID_ENABLED) - ANDROID; -#elif defined(JAVASCRIPT_ENABLED) - WASM; -#else - NUM_PLATFORMS; -#endif - -GDNativeLibrary::GDNativeLibrary() - : library_paths(), singleton_gdnative(false) { -} +Map<String, Vector<Ref<GDNative> > > *GDNativeLibrary::loaded_libraries = NULL; -GDNativeLibrary::~GDNativeLibrary() { -} - -void GDNativeLibrary::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_library_path", "platform", "path"), &GDNativeLibrary::set_library_path); - ClassDB::bind_method(D_METHOD("get_library_path", "platform"), &GDNativeLibrary::get_library_path); - ClassDB::bind_method(D_METHOD("get_active_library_path"), &GDNativeLibrary::get_active_library_path); +GDNativeLibrary::GDNativeLibrary() { + config_file.instance(); - ClassDB::bind_method(D_METHOD("is_singleton_gdnative"), &GDNativeLibrary::is_singleton_gdnative); - ClassDB::bind_method(D_METHOD("set_singleton_gdnative", "singleton"), &GDNativeLibrary::set_singleton_gdnative); + symbol_prefix = default_symbol_prefix; - ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "singleton_gdnative"), "set_singleton_gdnative", "is_singleton_gdnative"); -} - -bool GDNativeLibrary::_set(const StringName &p_name, const Variant &p_value) { - String name = p_name; - if (name.begins_with("platform/")) { - set_library_path(name.get_slice("/", 1), p_value); - return true; - } - return false; -} - -bool GDNativeLibrary::_get(const StringName &p_name, Variant &r_ret) const { - String name = p_name; - if (name.begins_with("platform/")) { - r_ret = get_library_path(name.get_slice("/", 1)); - return true; + if (GDNativeLibrary::loaded_libraries == NULL) { + GDNativeLibrary::loaded_libraries = memnew((Map<String, Vector<Ref<GDNative> > >)); } - return false; } -void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const { - for (int i = 0; i < NUM_PLATFORMS; i++) { - p_list->push_back(PropertyInfo(Variant::STRING, - "platform/" + platform_names[i], - PROPERTY_HINT_FILE, - "*." + platform_lib_ext[i])); - } +GDNativeLibrary::~GDNativeLibrary() { } -void GDNativeLibrary::set_library_path(StringName p_platform, String p_path) { - int i; - for (i = 0; i <= NUM_PLATFORMS; i++) { - if (i == NUM_PLATFORMS) break; - if (platform_names[i] == p_platform) { - break; - } - } - - if (i == NUM_PLATFORMS) { - ERR_EXPLAIN(String("No such platform: ") + p_platform); - ERR_FAIL(); - } +void GDNativeLibrary::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_config_file"), &GDNativeLibrary::get_config_file); - library_paths[i] = p_path; -} + ClassDB::bind_method(D_METHOD("get_current_library_path"), &GDNativeLibrary::get_current_library_path); + ClassDB::bind_method(D_METHOD("get_current_dependencies"), &GDNativeLibrary::get_current_dependencies); + ClassDB::bind_method(D_METHOD("is_current_library_statically_linked"), &GDNativeLibrary::is_current_library_statically_linked); -String GDNativeLibrary::get_library_path(StringName p_platform) const { - int i; - for (i = 0; i <= NUM_PLATFORMS; i++) { - if (i == NUM_PLATFORMS) break; - if (platform_names[i] == p_platform) { - break; - } - } + ClassDB::bind_method(D_METHOD("should_load_once"), &GDNativeLibrary::should_load_once); + ClassDB::bind_method(D_METHOD("is_singleton"), &GDNativeLibrary::is_singleton); + ClassDB::bind_method(D_METHOD("get_symbol_prefix"), &GDNativeLibrary::get_symbol_prefix); - if (i == NUM_PLATFORMS) { - ERR_EXPLAIN(String("No such platform: ") + p_platform); - ERR_FAIL_V(""); - } + ClassDB::bind_method(D_METHOD("set_load_once", "load_once"), &GDNativeLibrary::set_load_once); + ClassDB::bind_method(D_METHOD("set_singleton", "singleton"), &GDNativeLibrary::set_singleton); + ClassDB::bind_method(D_METHOD("set_symbol_prefix", "symbol_prefix"), &GDNativeLibrary::set_symbol_prefix); - return library_paths[i]; -} - -String GDNativeLibrary::get_active_library_path() const { - if (GDNativeLibrary::current_platform != NUM_PLATFORMS) { - return library_paths[GDNativeLibrary::current_platform]; - } - return ""; + ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "load_once"), "set_load_once", "should_load_once"); + ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "singleton"), "set_singleton", "is_singleton"); + ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "symbol_prefix"), "set_symbol_prefix", "get_symbol_prefix"); } GDNative::GDNative() { native_handle = NULL; + initialized = false; } GDNative::~GDNative() { } -extern "C" void _api_anchor(); - -void GDNative::_compile_dummy_for_api() { - _api_anchor(); -} - void GDNative::_bind_methods() { ClassDB::bind_method(D_METHOD("set_library", "library"), &GDNative::set_library); ClassDB::bind_method(D_METHOD("get_library"), &GDNative::get_library); @@ -220,8 +115,8 @@ bool GDNative::initialize() { return false; } - String lib_path = library->get_active_library_path(); - if (lib_path.empty()) { + String lib_path = library->get_current_library_path(); + if (lib_path.empty() && !library->is_current_library_statically_linked()) { ERR_PRINT("No library set for this platform"); return false; } @@ -230,16 +125,34 @@ bool GDNative::initialize() { #else String path = ProjectSettings::get_singleton()->globalize_path(lib_path); #endif + + if (library->should_load_once()) { + if (GDNativeLibrary::loaded_libraries->has(lib_path)) { + // already loaded. Don't load again. + // copy some of the stuff instead + this->native_handle = (*GDNativeLibrary::loaded_libraries)[lib_path][0]->native_handle; + initialized = true; + return true; + } + } + Error err = OS::get_singleton()->open_dynamic_library(path, native_handle); - if (err != OK) { + if (err != OK && !library->is_current_library_statically_linked()) { return false; } void *library_init; - err = get_symbol(init_symbol, library_init); + + // we cheat here a little bit. you saw nothing + initialized = true; + + err = get_symbol(library->get_symbol_prefix() + init_symbol, library_init); + + initialized = false; if (err || !library_init) { - OS::get_singleton()->close_dynamic_library(native_handle); + if (!library->is_current_library_statically_linked()) + OS::get_singleton()->close_dynamic_library(native_handle); native_handle = NULL; ERR_PRINT("Failed to obtain godot_gdnative_init symbol"); return false; @@ -260,18 +173,42 @@ bool GDNative::initialize() { library_init_fpointer(&options); + initialized = true; + + if (library->should_load_once() && !GDNativeLibrary::loaded_libraries->has(lib_path)) { + Vector<Ref<GDNative> > gdnatives; + gdnatives.resize(1); + gdnatives[0] = Ref<GDNative>(this); + GDNativeLibrary::loaded_libraries->insert(lib_path, gdnatives); + } + return true; } bool GDNative::terminate() { - if (native_handle == NULL) { + if (!initialized) { ERR_PRINT("No valid library handle, can't terminate GDNative object"); return false; } + if (library->should_load_once()) { + Vector<Ref<GDNative> > *gdnatives = &(*GDNativeLibrary::loaded_libraries)[library->get_current_library_path()]; + if (gdnatives->size() > 1) { + // there are other GDNative's still using this library, so we actually don't terminte + gdnatives->erase(Ref<GDNative>(this)); + initialized = false; + return true; + } else if (gdnatives->size() == 1) { + // we're the last one, terminate! + gdnatives->clear(); + // wew this looks scary, but all it does is remove the entry completely + GDNativeLibrary::loaded_libraries->erase(GDNativeLibrary::loaded_libraries->find(library->get_current_library_path())); + } + } + void *library_terminate; - Error error = get_symbol(terminate_symbol, library_terminate); + Error error = get_symbol(library->get_symbol_prefix() + terminate_symbol, library_terminate); if (error || !library_terminate) { OS::get_singleton()->close_dynamic_library(native_handle); native_handle = NULL; @@ -281,13 +218,13 @@ bool GDNative::terminate() { godot_gdnative_terminate_fn library_terminate_pointer; library_terminate_pointer = (godot_gdnative_terminate_fn)library_terminate; - // TODO(karroffel): remove this? Should be part of NativeScript, not - // GDNative IMO godot_gdnative_terminate_options options; options.in_editor = Engine::get_singleton()->is_editor_hint(); library_terminate_pointer(&options); + initialized = false; + // GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path); OS::get_singleton()->close_dynamic_library(native_handle); @@ -297,7 +234,7 @@ bool GDNative::terminate() { } bool GDNative::is_initialized() { - return (native_handle != NULL); + return initialized; } void GDNativeCallRegistry::register_native_call_type(StringName p_call_type, native_call_cb p_callback) { @@ -342,7 +279,7 @@ Variant GDNative::call_native(StringName p_native_call_type, StringName p_proced Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle) { - if (native_handle == NULL) { + if (!initialized) { ERR_PRINT("No valid library handle, can't get symbol from GDNative object"); return ERR_CANT_OPEN; } @@ -355,3 +292,159 @@ Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle) { return result; } + +RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error) { + Ref<GDNativeLibrary> lib; + lib.instance(); + + Ref<ConfigFile> config = lib->get_config_file(); + + Error err = config->load(p_path); + + if (r_error) { + *r_error = err; + } + + lib->set_singleton(config->get_value("general", "singleton", false)); + lib->set_load_once(config->get_value("general", "load_once", true)); + lib->set_symbol_prefix(config->get_value("general", "symbol_prefix", default_symbol_prefix)); + + String entry_lib_path; + { + + List<String> entry_keys; + config->get_section_keys("entry", &entry_keys); + + for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) { + String key = E->get(); + + Vector<String> tags = key.split("."); + + bool skip = false; + for (int i = 0; i < tags.size(); i++) { + bool has_feature = OS::get_singleton()->has_feature(tags[i]); + + if (!has_feature) { + skip = true; + break; + } + } + + if (skip) { + continue; + } + + entry_lib_path = config->get_value("entry", key); + break; + } + } + + Vector<String> dependency_paths; + { + + List<String> dependency_keys; + config->get_section_keys("dependencies", &dependency_keys); + + for (List<String>::Element *E = dependency_keys.front(); E; E = E->next()) { + String key = E->get(); + + Vector<String> tags = key.split("."); + + bool skip = false; + for (int i = 0; i < tags.size(); i++) { + bool has_feature = OS::get_singleton()->has_feature(tags[i]); + + if (!has_feature) { + skip = true; + break; + } + } + + if (skip) { + continue; + } + + dependency_paths = config->get_value("dependencies", key); + break; + } + } + + bool is_statically_linked = false; + { + + List<String> static_linking_keys; + config->get_section_keys("static_linking", &static_linking_keys); + + for (List<String>::Element *E = static_linking_keys.front(); E; E = E->next()) { + String key = E->get(); + + Vector<String> tags = key.split("."); + + bool skip = false; + + for (int i = 0; i < tags.size(); i++) { + bool has_feature = OS::get_singleton()->has_feature(tags[i]); + + if (!has_feature) { + skip = true; + break; + } + } + + if (skip) { + continue; + } + + is_statically_linked = config->get_value("static_linking", key); + break; + } + } + + lib->current_library_path = entry_lib_path; + lib->current_dependencies = dependency_paths; + lib->current_library_statically_linked = is_statically_linked; + + return lib; +} + +void GDNativeLibraryResourceLoader::get_recognized_extensions(List<String> *p_extensions) const { + p_extensions->push_back("gdnlib"); +} + +bool GDNativeLibraryResourceLoader::handles_type(const String &p_type) const { + return p_type == "GDNativeLibrary"; +} + +String GDNativeLibraryResourceLoader::get_resource_type(const String &p_path) const { + String el = p_path.get_extension().to_lower(); + if (el == "gdnlib") + return "GDNativeLibrary"; + return ""; +} + +Error GDNativeLibraryResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { + + Ref<GDNativeLibrary> lib = p_resource; + + if (lib.is_null()) { + return ERR_INVALID_DATA; + } + + Ref<ConfigFile> config = lib->get_config_file(); + + config->set_value("general", "singleton", lib->is_singleton()); + config->set_value("general", "load_once", lib->should_load_once()); + config->set_value("general", "symbol_prefix", lib->get_symbol_prefix()); + + return config->save(p_path); +} + +bool GDNativeLibraryResourceSaver::recognize(const RES &p_resource) const { + return Object::cast_to<GDNativeLibrary>(*p_resource) != NULL; +} + +void GDNativeLibraryResourceSaver::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const { + if (Object::cast_to<GDNativeLibrary>(*p_resource) != NULL) { + p_extensions->push_back("gdnlib"); + } +} diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index e44cc55a79..061dff9267 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -38,66 +38,69 @@ #include "gdnative/gdnative.h" #include "gdnative_api_struct.gen.h" -class GDNativeLibrary : public Resource { - GDCLASS(GDNativeLibrary, Resource) - - enum Platform { - X11_32BIT, - X11_64BIT, - WINDOWS_32BIT, - WINDOWS_64BIT, - // NOTE(karroffel): I heard OSX 32 bit is dead, so 64 only - OSX, - - // Android .so files must be located in directories corresponding to Android ABI names: - // https://developer.android.com/ndk/guides/abis.html - // Android runtime will select the matching library depending on the device. - // The value here must simply point to the .so name, for example: - // "res://libmy_gdnative.so" or "libmy_gdnative.so", - // while in the project the actual paths can be "lib/android/armeabi-v7a/libmy_gdnative.so", - // "lib/android/arm64-v8a/libmy_gdnative.so". - ANDROID, - - IOS_32BIT, - IOS_64BIT, - - // TODO(karroffel): figure out how to deal with web stuff at all... - WASM, - - // TODO(karroffel): does UWP have different libs?? - // UWP, +#include "io/config_file.h" - NUM_PLATFORMS +class GDNativeLibraryResourceLoader; +class GDNative; - }; +class GDNativeLibrary : public Resource { + GDCLASS(GDNativeLibrary, Resource) - static String platform_names[NUM_PLATFORMS + 1]; - static String platform_lib_ext[NUM_PLATFORMS + 1]; + static Map<String, Vector<Ref<GDNative> > > *loaded_libraries; - static Platform current_platform; + friend class GDNativeLibraryResourceLoader; + friend class GDNative; - String library_paths[NUM_PLATFORMS]; + Ref<ConfigFile> config_file; - bool singleton_gdnative; + String current_library_path; + Vector<String> current_dependencies; + bool current_library_statically_linked; -protected: - bool _set(const StringName &p_name, const Variant &p_value); - bool _get(const StringName &p_name, Variant &r_ret) const; - void _get_property_list(List<PropertyInfo> *p_list) const; + bool singleton; + bool load_once; + String symbol_prefix; public: GDNativeLibrary(); ~GDNativeLibrary(); - static void _bind_methods(); + _FORCE_INLINE_ Ref<ConfigFile> get_config_file() { return config_file; } + + // things that change per-platform + // so there are no setters for this + _FORCE_INLINE_ String get_current_library_path() const { + return current_library_path; + } + _FORCE_INLINE_ Vector<String> get_current_dependencies() const { + return current_dependencies; + } + _FORCE_INLINE_ bool is_current_library_statically_linked() const { + return current_library_statically_linked; + } - void set_library_path(StringName p_platform, String p_path); - String get_library_path(StringName p_platform) const; + // things that are a property of the library itself, not platform specific + _FORCE_INLINE_ bool should_load_once() const { + return load_once; + } + _FORCE_INLINE_ bool is_singleton() const { + return singleton; + } + _FORCE_INLINE_ String get_symbol_prefix() const { + return symbol_prefix; + } - String get_active_library_path() const; + _FORCE_INLINE_ void set_load_once(bool p_load_once) { + load_once = p_load_once; + } + _FORCE_INLINE_ void set_singleton(bool p_singleton) { + singleton = p_singleton; + } + _FORCE_INLINE_ void set_symbol_prefix(String p_symbol_prefix) { + symbol_prefix = p_symbol_prefix; + } - _FORCE_INLINE_ bool is_singleton_gdnative() const { return singleton_gdnative; } - _FORCE_INLINE_ void set_singleton_gdnative(bool p_singleton) { singleton_gdnative = p_singleton; } + static void _bind_methods(); }; typedef godot_variant (*native_call_cb)(void *, godot_array *); @@ -124,10 +127,9 @@ class GDNative : public Reference { Ref<GDNativeLibrary> library; - // TODO(karroffel): different platforms? WASM???? void *native_handle; - void _compile_dummy_for_api(); + bool initialized; public: GDNative(); @@ -148,4 +150,19 @@ public: Error get_symbol(StringName p_procedure_name, void *&r_handle); }; +class GDNativeLibraryResourceLoader : public ResourceFormatLoader { +public: + virtual RES load(const String &p_path, const String &p_original_path, Error *r_error); + virtual void get_recognized_extensions(List<String> *p_extensions) const; + virtual bool handles_type(const String &p_type) const; + virtual String get_resource_type(const String &p_path) const; +}; + +class GDNativeLibraryResourceSaver : public ResourceFormatSaver { +public: + virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags); + virtual bool recognize(const RES &p_resource) const; + virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const; +}; + #endif // GDNATIVE_H diff --git a/modules/gdnative/gdnative/aabb.cpp b/modules/gdnative/gdnative/aabb.cpp new file mode 100644 index 0000000000..6c89bcdceb --- /dev/null +++ b/modules/gdnative/gdnative/aabb.cpp @@ -0,0 +1,217 @@ +/*************************************************************************/ +/* aabb.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "gdnative/aabb.h" + +#include "core/math/aabb.h" +#include "core/variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) { + const Vector3 *pos = (const Vector3 *)p_pos; + const Vector3 *size = (const Vector3 *)p_size; + AABB *dest = (AABB *)r_dest; + *dest = AABB(*pos, *size); +} + +godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self) { + godot_vector3 raw_ret; + const AABB *self = (const AABB *)p_self; + Vector3 *ret = (Vector3 *)&raw_ret; + *ret = self->position; + return raw_ret; +} + +void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v) { + AABB *self = (AABB *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + self->position = *v; +} + +godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self) { + godot_vector3 raw_ret; + const AABB *self = (const AABB *)p_self; + Vector3 *ret = (Vector3 *)&raw_ret; + *ret = self->size; + return raw_ret; +} + +void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v) { + AABB *self = (AABB *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + self->size = *v; +} + +godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self) { + godot_string ret; + const AABB *self = (const AABB *)p_self; + memnew_placement(&ret, String(*self)); + return ret; +} + +godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->get_area(); +} + +godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->has_no_area(); +} + +godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->has_no_surface(); +} + +godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with) { + const AABB *self = (const AABB *)p_self; + const AABB *with = (const AABB *)p_with; + return self->intersects(*with); +} + +godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with) { + const AABB *self = (const AABB *)p_self; + const AABB *with = (const AABB *)p_with; + return self->encloses(*with); +} + +godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with) { + godot_aabb dest; + const AABB *self = (const AABB *)p_self; + const AABB *with = (const AABB *)p_with; + *((AABB *)&dest) = self->merge(*with); + return dest; +} + +godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with) { + godot_aabb dest; + const AABB *self = (const AABB *)p_self; + const AABB *with = (const AABB *)p_with; + *((AABB *)&dest) = self->intersection(*with); + return dest; +} + +godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane) { + const AABB *self = (const AABB *)p_self; + const Plane *plane = (const Plane *)p_plane; + return self->intersects_plane(*plane); +} + +godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) { + const AABB *self = (const AABB *)p_self; + const Vector3 *from = (const Vector3 *)p_from; + const Vector3 *to = (const Vector3 *)p_to; + return self->intersects_segment(*from, *to); +} + +godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point) { + const AABB *self = (const AABB *)p_self; + const Vector3 *point = (const Vector3 *)p_point; + return self->has_point(*point); +} + +godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir) { + godot_vector3 dest; + const AABB *self = (const AABB *)p_self; + const Vector3 *dir = (const Vector3 *)p_dir; + *((Vector3 *)&dest) = self->get_support(*dir); + return dest; +} + +godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self) { + godot_vector3 dest; + const AABB *self = (const AABB *)p_self; + *((Vector3 *)&dest) = self->get_longest_axis(); + return dest; +} + +godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->get_longest_axis_index(); +} + +godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->get_longest_axis_size(); +} + +godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self) { + godot_vector3 dest; + const AABB *self = (const AABB *)p_self; + *((Vector3 *)&dest) = self->get_shortest_axis(); + return dest; +} + +godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->get_shortest_axis_index(); +} + +godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self) { + const AABB *self = (const AABB *)p_self; + return self->get_shortest_axis_size(); +} + +godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point) { + godot_aabb dest; + const AABB *self = (const AABB *)p_self; + const Vector3 *to_point = (const Vector3 *)p_to_point; + *((AABB *)&dest) = self->expand(*to_point); + return dest; +} + +godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by) { + godot_aabb dest; + const AABB *self = (const AABB *)p_self; + + *((AABB *)&dest) = self->grow(p_by); + return dest; +} + +godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx) { + godot_vector3 dest; + const AABB *self = (const AABB *)p_self; + + *((Vector3 *)&dest) = self->get_endpoint(p_idx); + return dest; +} + +godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b) { + const AABB *self = (const AABB *)p_self; + const AABB *b = (const AABB *)p_b; + return *self == *b; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp index 90bc4dc031..e0d9514985 100644 --- a/modules/gdnative/gdnative/array.cpp +++ b/modules/gdnative/gdnative/array.cpp @@ -41,9 +41,6 @@ extern "C" { #endif -void _array_api_anchor() { -} - void GDAPI godot_array_new(godot_array *r_dest) { Array *dest = (Array *)r_dest; memnew_placement(dest, Array); diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp index 28af93f942..39ca754dc7 100644 --- a/modules/gdnative/gdnative/basis.cpp +++ b/modules/gdnative/gdnative/basis.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _basis_api_anchor() {} - void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis) { const Vector3 *x_axis = (const Vector3 *)p_x_axis; const Vector3 *y_axis = (const Vector3 *)p_y_axis; diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp index 2a5c0887a1..281a4c416f 100644 --- a/modules/gdnative/gdnative/color.cpp +++ b/modules/gdnative/gdnative/color.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _color_api_anchor() {} - void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a) { Color *dest = (Color *)r_dest; diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp index 7f8320622d..8363416946 100644 --- a/modules/gdnative/gdnative/dictionary.cpp +++ b/modules/gdnative/gdnative/dictionary.cpp @@ -38,8 +38,6 @@ extern "C" { #endif -void _dictionary_api_anchor() {} - void GDAPI godot_dictionary_new(godot_dictionary *r_dest) { Dictionary *dest = (Dictionary *)r_dest; memnew_placement(dest, Dictionary); diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp index 64a7c33cf8..6dfa7ec20b 100644 --- a/modules/gdnative/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative/gdnative.cpp @@ -30,57 +30,16 @@ #include "gdnative/gdnative.h" #include "class_db.h" +#include "engine.h" #include "error_macros.h" #include "global_constants.h" #include "os/os.h" -#include "project_settings.h" #include "variant.h" #ifdef __cplusplus extern "C" { #endif -extern "C" void _string_api_anchor(); -extern "C" void _string_name_api_anchor(); -extern "C" void _vector2_api_anchor(); -extern "C" void _rect2_api_anchor(); -extern "C" void _vector3_api_anchor(); -extern "C" void _transform2d_api_anchor(); -extern "C" void _plane_api_anchor(); -extern "C" void _quat_api_anchor(); -extern "C" void _basis_api_anchor(); -extern "C" void _rect3_api_anchor(); -extern "C" void _transform_api_anchor(); -extern "C" void _color_api_anchor(); -extern "C" void _node_path_api_anchor(); -extern "C" void _rid_api_anchor(); -extern "C" void _dictionary_api_anchor(); -extern "C" void _array_api_anchor(); -extern "C" void _pool_arrays_api_anchor(); -extern "C" void _variant_api_anchor(); - -void _api_anchor() { - - _string_api_anchor(); - _string_name_api_anchor(); - _vector2_api_anchor(); - _rect2_api_anchor(); - _vector3_api_anchor(); - _transform2d_api_anchor(); - _plane_api_anchor(); - _quat_api_anchor(); - _rect3_api_anchor(); - _basis_api_anchor(); - _transform_api_anchor(); - _color_api_anchor(); - _node_path_api_anchor(); - _rid_api_anchor(); - _dictionary_api_anchor(); - _array_api_anchor(); - _pool_arrays_api_anchor(); - _variant_api_anchor(); -} - void GDAPI godot_object_destroy(godot_object *p_o) { memdelete((Object *)p_o); } @@ -88,7 +47,7 @@ void GDAPI godot_object_destroy(godot_object *p_o) { // Singleton API godot_object GDAPI *godot_global_get_singleton(char *p_name) { - return (godot_object *)ProjectSettings::get_singleton()->get_singleton_object(String(p_name)); + return (godot_object *)Engine::get_singleton()->get_singleton_object(String(p_name)); } // result shouldn't be freed void GDAPI *godot_get_stack_bottom() { @@ -133,14 +92,6 @@ godot_variant GDAPI godot_method_bind_call(godot_method_bind *p_method_bind, god return ret; } -// @Todo -/* -void GDAPI godot_method_bind_varcall(godot_method_bind *p_method_bind) -{ - -} -*/ - godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname) { ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(StringName(p_classname)); if (class_info) diff --git a/modules/gdnative/gdnative/node_path.cpp b/modules/gdnative/gdnative/node_path.cpp index 50fade5b94..2bd278e050 100644 --- a/modules/gdnative/gdnative/node_path.cpp +++ b/modules/gdnative/gdnative/node_path.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _node_path_api_anchor() {} - void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from) { NodePath *dest = (NodePath *)r_dest; const String *from = (const String *)p_from; diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp index a5e05ffa6b..c92efb8d99 100644 --- a/modules/gdnative/gdnative/plane.cpp +++ b/modules/gdnative/gdnative/plane.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _plane_api_anchor() {} - void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) { Plane *dest = (Plane *)r_dest; diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp index 731e930908..562cc344a9 100644 --- a/modules/gdnative/gdnative/pool_arrays.cpp +++ b/modules/gdnative/gdnative/pool_arrays.cpp @@ -41,9 +41,6 @@ extern "C" { #endif -void _pool_arrays_api_anchor() { -} - #define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr) // byte diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp index 7db7847da1..2d012c069f 100644 --- a/modules/gdnative/gdnative/quat.cpp +++ b/modules/gdnative/gdnative/quat.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _quat_api_anchor() {} - void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w) { Quat *dest = (Quat *)r_dest; diff --git a/modules/gdnative/gdnative/rect2.cpp b/modules/gdnative/gdnative/rect2.cpp index ecd8cce9ca..b0b0e28138 100644 --- a/modules/gdnative/gdnative/rect2.cpp +++ b/modules/gdnative/gdnative/rect2.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _rect2_api_anchor() {} - void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) { const Vector2 *position = (const Vector2 *)p_pos; const Vector2 *size = (const Vector2 *)p_size; diff --git a/modules/gdnative/gdnative/rect3.cpp b/modules/gdnative/gdnative/rect3.cpp deleted file mode 100644 index d34d964db9..0000000000 --- a/modules/gdnative/gdnative/rect3.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/*************************************************************************/ -/* rect3.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "gdnative/rect3.h" - -#include "core/math/rect3.h" -#include "core/variant.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _rect3_api_anchor() {} - -void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) { - const Vector3 *pos = (const Vector3 *)p_pos; - const Vector3 *size = (const Vector3 *)p_size; - Rect3 *dest = (Rect3 *)r_dest; - *dest = Rect3(*pos, *size); -} - -godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self) { - godot_vector3 raw_ret; - const Rect3 *self = (const Rect3 *)p_self; - Vector3 *ret = (Vector3 *)&raw_ret; - *ret = self->position; - return raw_ret; -} - -void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v) { - Rect3 *self = (Rect3 *)p_self; - const Vector3 *v = (const Vector3 *)p_v; - self->position = *v; -} - -godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self) { - godot_vector3 raw_ret; - const Rect3 *self = (const Rect3 *)p_self; - Vector3 *ret = (Vector3 *)&raw_ret; - *ret = self->size; - return raw_ret; -} - -void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v) { - Rect3 *self = (Rect3 *)p_self; - const Vector3 *v = (const Vector3 *)p_v; - self->size = *v; -} - -godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self) { - godot_string ret; - const Rect3 *self = (const Rect3 *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self) { - const Rect3 *self = (const Rect3 *)p_self; - return self->get_area(); -} - -godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self) { - const Rect3 *self = (const Rect3 *)p_self; - return self->has_no_area(); -} - -godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self) { - const Rect3 *self = (const Rect3 *)p_self; - return self->has_no_surface(); -} - -godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with) { - const Rect3 *self = (const Rect3 *)p_self; - const Rect3 *with = (const Rect3 *)p_with; - return self->intersects(*with); -} - -godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with) { - const Rect3 *self = (const Rect3 *)p_self; - const Rect3 *with = (const Rect3 *)p_with; - return self->encloses(*with); -} - -godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with) { - godot_rect3 dest; - const Rect3 *self = (const Rect3 *)p_self; - const Rect3 *with = (const Rect3 *)p_with; - *((Rect3 *)&dest) = self->merge(*with); - return dest; -} - -godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with) { - godot_rect3 dest; - const Rect3 *self = (const Rect3 *)p_self; - const Rect3 *with = (const Rect3 *)p_with; - *((Rect3 *)&dest) = self->intersection(*with); - return dest; -} - -godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane) { - const Rect3 *self = (const Rect3 *)p_self; - const Plane *plane = (const Plane *)p_plane; - return self->intersects_plane(*plane); -} - -godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) { - const Rect3 *self = (const Rect3 *)p_self; - const Vector3 *from = (const Vector3 *)p_from; - const Vector3 *to = (const Vector3 *)p_to; - return self->intersects_segment(*from, *to); -} - -godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point) { - const Rect3 *self = (const Rect3 *)p_self; - const Vector3 *point = (const Vector3 *)p_point; - return self->has_point(*point); -} - -godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir) { - godot_vector3 dest; - const Rect3 *self = (const Rect3 *)p_self; - const Vector3 *dir = (const Vector3 *)p_dir; - *((Vector3 *)&dest) = self->get_support(*dir); - return dest; -} - -godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self) { - godot_vector3 dest; - const Rect3 *self = (const Rect3 *)p_self; - *((Vector3 *)&dest) = self->get_longest_axis(); - return dest; -} - -godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self) { - const Rect3 *self = (const Rect3 *)p_self; - return self->get_longest_axis_index(); -} - -godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self) { - const Rect3 *self = (const Rect3 *)p_self; - return self->get_longest_axis_size(); -} - -godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self) { - godot_vector3 dest; - const Rect3 *self = (const Rect3 *)p_self; - *((Vector3 *)&dest) = self->get_shortest_axis(); - return dest; -} - -godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self) { - const Rect3 *self = (const Rect3 *)p_self; - return self->get_shortest_axis_index(); -} - -godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self) { - const Rect3 *self = (const Rect3 *)p_self; - return self->get_shortest_axis_size(); -} - -godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point) { - godot_rect3 dest; - const Rect3 *self = (const Rect3 *)p_self; - const Vector3 *to_point = (const Vector3 *)p_to_point; - *((Rect3 *)&dest) = self->expand(*to_point); - return dest; -} - -godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by) { - godot_rect3 dest; - const Rect3 *self = (const Rect3 *)p_self; - - *((Rect3 *)&dest) = self->grow(p_by); - return dest; -} - -godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx) { - godot_vector3 dest; - const Rect3 *self = (const Rect3 *)p_self; - - *((Vector3 *)&dest) = self->get_endpoint(p_idx); - return dest; -} - -godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b) { - const Rect3 *self = (const Rect3 *)p_self; - const Rect3 *b = (const Rect3 *)p_b; - return *self == *b; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/rid.cpp b/modules/gdnative/gdnative/rid.cpp index f05c39906c..c6e8d82494 100644 --- a/modules/gdnative/gdnative/rid.cpp +++ b/modules/gdnative/gdnative/rid.cpp @@ -37,8 +37,6 @@ extern "C" { #endif -void _rid_api_anchor() {} - void GDAPI godot_rid_new(godot_rid *r_dest) { RID *dest = (RID *)r_dest; memnew_placement(dest, RID); diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp index 619003083d..781b8754bd 100644 --- a/modules/gdnative/gdnative/string.cpp +++ b/modules/gdnative/gdnative/string.cpp @@ -39,9 +39,6 @@ extern "C" { #endif -void _string_api_anchor() { -} - void GDAPI godot_string_new(godot_string *r_dest) { String *dest = (String *)r_dest; memnew_placement(dest, String); diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp index 5c00fdfc2f..5c79e0acbd 100644 --- a/modules/gdnative/gdnative/string_name.cpp +++ b/modules/gdnative/gdnative/string_name.cpp @@ -38,9 +38,6 @@ extern "C" { #endif -void _string_name_api_anchor() { -} - void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name) { StringName *dest = (StringName *)r_dest; const String *name = (const String *)p_name; diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp index d7a3e78d3f..b07fcffcb6 100644 --- a/modules/gdnative/gdnative/transform.cpp +++ b/modules/gdnative/gdnative/transform.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _transform_api_anchor() {} - void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin) { const Vector3 *x_axis = (const Vector3 *)p_x_axis; const Vector3 *y_axis = (const Vector3 *)p_y_axis; @@ -200,20 +198,20 @@ godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_s return raw_dest; } -godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v) { - godot_rect3 raw_dest; - Rect3 *dest = (Rect3 *)&raw_dest; +godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v) { + godot_aabb raw_dest; + AABB *dest = (AABB *)&raw_dest; const Transform *self = (const Transform *)p_self; - const Rect3 *v = (const Rect3 *)p_v; + const AABB *v = (const AABB *)p_v; *dest = self->xform(*v); return raw_dest; } -godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v) { - godot_rect3 raw_dest; - Rect3 *dest = (Rect3 *)&raw_dest; +godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v) { + godot_aabb raw_dest; + AABB *dest = (AABB *)&raw_dest; const Transform *self = (const Transform *)p_self; - const Rect3 *v = (const Rect3 *)p_v; + const AABB *v = (const AABB *)p_v; *dest = self->xform_inv(*v); return raw_dest; } diff --git a/modules/gdnative/gdnative/transform2d.cpp b/modules/gdnative/gdnative/transform2d.cpp index dcb54f7a53..0a6334516b 100644 --- a/modules/gdnative/gdnative/transform2d.cpp +++ b/modules/gdnative/gdnative/transform2d.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _transform2d_api_anchor() {} - void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos) { const Vector2 *pos = (const Vector2 *)p_pos; Transform2D *dest = (Transform2D *)r_dest; diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index 9ba4166c1d..6483d19d74 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _variant_api_anchor() {} - #define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr) // Constructors @@ -120,10 +118,10 @@ void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_qua memnew_placement_custom(dest, Variant, Variant(*quat)); } -void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3) { +void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb) { Variant *dest = (Variant *)r_dest; - Rect3 *rect3 = (Rect3 *)p_rect3; - memnew_placement_custom(dest, Variant, Variant(*rect3)); + AABB *aabb = (AABB *)p_aabb; + memnew_placement_custom(dest, Variant, Variant(*aabb)); } void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis) { @@ -306,10 +304,10 @@ godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self) { return raw_dest; } -godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self) { - godot_rect3 raw_dest; +godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self) { + godot_aabb raw_dest; const Variant *self = (const Variant *)p_self; - Rect3 *dest = (Rect3 *)&raw_dest; + AABB *dest = (AABB *)&raw_dest; *dest = *self; return raw_dest; } diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp index 67f858997f..7a5b29e0c4 100644 --- a/modules/gdnative/gdnative/vector2.cpp +++ b/modules/gdnative/gdnative/vector2.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _vector2_api_anchor() {} - void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y) { Vector2 *dest = (Vector2 *)r_dest; diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp index c85a3f1c08..11ffb3320b 100644 --- a/modules/gdnative/gdnative/vector3.cpp +++ b/modules/gdnative/gdnative/vector3.cpp @@ -36,8 +36,6 @@ extern "C" { #endif -void _vector3_api_anchor() {} - void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z) { Vector3 *dest = (Vector3 *)r_dest; diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 770fb429c7..877c65dfb9 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -3221,209 +3221,209 @@ ] }, { - "name": "godot_rect3_new", + "name": "godot_aabb_new", "return_type": "void", "arguments": [ - ["godot_rect3 *", "r_dest"], + ["godot_aabb *", "r_dest"], ["const godot_vector3 *", "p_pos"], ["const godot_vector3 *", "p_size"] ] }, { - "name": "godot_rect3_get_position", + "name": "godot_aabb_get_position", "return_type": "godot_vector3", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_set_position", + "name": "godot_aabb_set_position", "return_type": "void", "arguments": [ - ["const godot_rect3 *", "p_self"], + ["const godot_aabb *", "p_self"], ["const godot_vector3 *", "p_v"] ] }, { - "name": "godot_rect3_get_size", + "name": "godot_aabb_get_size", "return_type": "godot_vector3", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_set_size", + "name": "godot_aabb_set_size", "return_type": "void", "arguments": [ - ["const godot_rect3 *", "p_self"], + ["const godot_aabb *", "p_self"], ["const godot_vector3 *", "p_v"] ] }, { - "name": "godot_rect3_as_string", + "name": "godot_aabb_as_string", "return_type": "godot_string", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_get_area", + "name": "godot_aabb_get_area", "return_type": "godot_real", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_has_no_area", + "name": "godot_aabb_has_no_area", "return_type": "godot_bool", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_has_no_surface", + "name": "godot_aabb_has_no_surface", "return_type": "godot_bool", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_intersects", + "name": "godot_aabb_intersects", "return_type": "godot_bool", "arguments": [ - ["const godot_rect3 *", "p_self"], - ["const godot_rect3 *", "p_with"] + ["const godot_aabb *", "p_self"], + ["const godot_aabb *", "p_with"] ] }, { - "name": "godot_rect3_encloses", + "name": "godot_aabb_encloses", "return_type": "godot_bool", "arguments": [ - ["const godot_rect3 *", "p_self"], - ["const godot_rect3 *", "p_with"] + ["const godot_aabb *", "p_self"], + ["const godot_aabb *", "p_with"] ] }, { - "name": "godot_rect3_merge", - "return_type": "godot_rect3", + "name": "godot_aabb_merge", + "return_type": "godot_aabb", "arguments": [ - ["const godot_rect3 *", "p_self"], - ["const godot_rect3 *", "p_with"] + ["const godot_aabb *", "p_self"], + ["const godot_aabb *", "p_with"] ] }, { - "name": "godot_rect3_intersection", - "return_type": "godot_rect3", + "name": "godot_aabb_intersection", + "return_type": "godot_aabb", "arguments": [ - ["const godot_rect3 *", "p_self"], - ["const godot_rect3 *", "p_with"] + ["const godot_aabb *", "p_self"], + ["const godot_aabb *", "p_with"] ] }, { - "name": "godot_rect3_intersects_plane", + "name": "godot_aabb_intersects_plane", "return_type": "godot_bool", "arguments": [ - ["const godot_rect3 *", "p_self"], + ["const godot_aabb *", "p_self"], ["const godot_plane *", "p_plane"] ] }, { - "name": "godot_rect3_intersects_segment", + "name": "godot_aabb_intersects_segment", "return_type": "godot_bool", "arguments": [ - ["const godot_rect3 *", "p_self"], + ["const godot_aabb *", "p_self"], ["const godot_vector3 *", "p_from"], ["const godot_vector3 *", "p_to"] ] }, { - "name": "godot_rect3_has_point", + "name": "godot_aabb_has_point", "return_type": "godot_bool", "arguments": [ - ["const godot_rect3 *", "p_self"], + ["const godot_aabb *", "p_self"], ["const godot_vector3 *", "p_point"] ] }, { - "name": "godot_rect3_get_support", + "name": "godot_aabb_get_support", "return_type": "godot_vector3", "arguments": [ - ["const godot_rect3 *", "p_self"], + ["const godot_aabb *", "p_self"], ["const godot_vector3 *", "p_dir"] ] }, { - "name": "godot_rect3_get_longest_axis", + "name": "godot_aabb_get_longest_axis", "return_type": "godot_vector3", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_get_longest_axis_index", + "name": "godot_aabb_get_longest_axis_index", "return_type": "godot_int", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_get_longest_axis_size", + "name": "godot_aabb_get_longest_axis_size", "return_type": "godot_real", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_get_shortest_axis", + "name": "godot_aabb_get_shortest_axis", "return_type": "godot_vector3", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_get_shortest_axis_index", + "name": "godot_aabb_get_shortest_axis_index", "return_type": "godot_int", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_get_shortest_axis_size", + "name": "godot_aabb_get_shortest_axis_size", "return_type": "godot_real", "arguments": [ - ["const godot_rect3 *", "p_self"] + ["const godot_aabb *", "p_self"] ] }, { - "name": "godot_rect3_expand", - "return_type": "godot_rect3", + "name": "godot_aabb_expand", + "return_type": "godot_aabb", "arguments": [ - ["const godot_rect3 *", "p_self"], + ["const godot_aabb *", "p_self"], ["const godot_vector3 *", "p_to_point"] ] }, { - "name": "godot_rect3_grow", - "return_type": "godot_rect3", + "name": "godot_aabb_grow", + "return_type": "godot_aabb", "arguments": [ - ["const godot_rect3 *", "p_self"], + ["const godot_aabb *", "p_self"], ["const godot_real", "p_by"] ] }, { - "name": "godot_rect3_get_endpoint", + "name": "godot_aabb_get_endpoint", "return_type": "godot_vector3", "arguments": [ - ["const godot_rect3 *", "p_self"], + ["const godot_aabb *", "p_self"], ["const godot_int", "p_idx"] ] }, { - "name": "godot_rect3_operator_equal", + "name": "godot_aabb_operator_equal", "return_type": "godot_bool", "arguments": [ - ["const godot_rect3 *", "p_self"], - ["const godot_rect3 *", "p_b"] + ["const godot_aabb *", "p_self"], + ["const godot_aabb *", "p_b"] ] }, { @@ -3632,19 +3632,19 @@ ] }, { - "name": "godot_transform_xform_rect3", - "return_type": "godot_rect3", + "name": "godot_transform_xform_aabb", + "return_type": "godot_aabb", "arguments": [ ["const godot_transform *", "p_self"], - ["const godot_rect3 *", "p_v"] + ["const godot_aabb *", "p_v"] ] }, { - "name": "godot_transform_xform_inv_rect3", - "return_type": "godot_rect3", + "name": "godot_transform_xform_inv_aabb", + "return_type": "godot_aabb", "arguments": [ ["const godot_transform *", "p_self"], - ["const godot_rect3 *", "p_v"] + ["const godot_aabb *", "p_v"] ] }, { @@ -3930,11 +3930,11 @@ ] }, { - "name": "godot_variant_new_rect3", + "name": "godot_variant_new_aabb", "return_type": "void", "arguments": [ ["godot_variant *", "r_dest"], - ["const godot_rect3 *", "p_rect3"] + ["const godot_aabb *", "p_aabb"] ] }, { @@ -4135,8 +4135,8 @@ ] }, { - "name": "godot_variant_as_rect3", - "return_type": "godot_rect3", + "name": "godot_variant_as_aabb", + "return_type": "godot_aabb", "arguments": [ ["const godot_variant *", "p_self"] ] diff --git a/modules/gdnative/include/gdnative/aabb.h b/modules/gdnative/include/gdnative/aabb.h new file mode 100644 index 0000000000..34339fa242 --- /dev/null +++ b/modules/gdnative/include/gdnative/aabb.h @@ -0,0 +1,117 @@ +/*************************************************************************/ +/* aabb.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_AABB_H +#define GODOT_AABB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#define GODOT_AABB_SIZE 24 + +#ifndef GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_AABB_SIZE]; +} godot_aabb; +#endif + +// reduce extern "C" nesting for VS2013 +#ifdef __cplusplus +} +#endif + +#include <gdnative/gdnative.h> +#include <gdnative/plane.h> +#include <gdnative/vector3.h> + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size); + +godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self); +void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v); + +godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self); +void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v); + +godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self); + +godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self); + +godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self); + +godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self); + +godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with); + +godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with); + +godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with); + +godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with); + +godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane); + +godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to); + +godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point); + +godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir); + +godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self); + +godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self); + +godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self); + +godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self); + +godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self); + +godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self); + +godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point); + +godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by); + +godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx); + +godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_AABB_H diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 8fa96fd3af..38a42ab658 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -53,7 +53,7 @@ extern "C" { // This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!! #ifdef _WIN32 -#define GDN_EXPORT __declspec(dllexport) +#define GDN_EXPORT #else #define GDN_EXPORT #endif @@ -169,9 +169,9 @@ typedef void godot_object; #include <gdnative/quat.h> -/////// Rect3 +/////// AABB -#include <gdnative/rect3.h> +#include <gdnative/aabb.h> /////// Basis diff --git a/modules/gdnative/include/gdnative/rect3.h b/modules/gdnative/include/gdnative/rect3.h deleted file mode 100644 index f603a9268a..0000000000 --- a/modules/gdnative/include/gdnative/rect3.h +++ /dev/null @@ -1,117 +0,0 @@ -/*************************************************************************/ -/* rect3.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_RECT3_H -#define GODOT_RECT3_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#define GODOT_RECT3_SIZE 24 - -#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_RECT3_SIZE]; -} godot_rect3; -#endif - -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - -#include <gdnative/gdnative.h> -#include <gdnative/plane.h> -#include <gdnative/vector3.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size); - -godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self); -void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v); - -godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self); -void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v); - -godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self); - -godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self); - -godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self); - -godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self); - -godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with); - -godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with); - -godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with); - -godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with); - -godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane); - -godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to); - -godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point); - -godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir); - -godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self); - -godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self); - -godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self); - -godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self); - -godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self); - -godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self); - -godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point); - -godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by); - -godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx); - -godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_RECT3_H diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h index 29510313c9..cca3eb2672 100644 --- a/modules/gdnative/include/gdnative/string.h +++ b/modules/gdnative/include/gdnative/string.h @@ -51,6 +51,7 @@ typedef struct { } #endif +#include <gdnative/array.h> #include <gdnative/gdnative.h> #include <gdnative/variant.h> diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h index 8f50b01fb5..3b5c189bdf 100644 --- a/modules/gdnative/include/gdnative/transform.h +++ b/modules/gdnative/include/gdnative/transform.h @@ -98,9 +98,9 @@ godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self, godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v); -godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v); +godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v); -godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v); +godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h index 3d744ef1f2..06cafcfa63 100644 --- a/modules/gdnative/include/gdnative/variant.h +++ b/modules/gdnative/include/gdnative/variant.h @@ -62,7 +62,7 @@ typedef enum godot_variant_type { GODOT_VARIANT_TYPE_TRANSFORM2D, GODOT_VARIANT_TYPE_PLANE, GODOT_VARIANT_TYPE_QUAT, // 10 - GODOT_VARIANT_TYPE_RECT3, + GODOT_VARIANT_TYPE_AABB, GODOT_VARIANT_TYPE_BASIS, GODOT_VARIANT_TYPE_TRANSFORM, @@ -104,6 +104,7 @@ typedef struct godot_variant_call_error { } #endif +#include <gdnative/aabb.h> #include <gdnative/array.h> #include <gdnative/basis.h> #include <gdnative/color.h> @@ -113,7 +114,6 @@ typedef struct godot_variant_call_error { #include <gdnative/pool_arrays.h> #include <gdnative/quat.h> #include <gdnative/rect2.h> -#include <gdnative/rect3.h> #include <gdnative/rid.h> #include <gdnative/string.h> #include <gdnative/transform.h> @@ -145,7 +145,7 @@ void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d); void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane); void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat); -void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3); +void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb); void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis); void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans); void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color); @@ -173,7 +173,7 @@ godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self); godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self); godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self); godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self); -godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self); +godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self); godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self); godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self); godot_color GDAPI godot_variant_as_color(const godot_variant *p_self); diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index 63fb71feb6..f9d699fb59 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -32,9 +32,9 @@ #ifdef TOOLS_ENABLED #include "core/class_db.h" +#include "core/engine.h" #include "core/global_constants.h" #include "core/pair.h" -#include "core/project_settings.h" #include "os/file_access.h" // helper stuff @@ -177,7 +177,7 @@ List<ClassAPI> generate_c_api_classes() { if (name.begins_with("_")) { name.remove(0); } - class_api.is_singleton = ProjectSettings::get_singleton()->has_singleton(name); + class_api.is_singleton = Engine::get_singleton()->has_singleton(name); } class_api.is_instanciable = !class_api.is_singleton && ClassDB::can_instance(class_name); diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index c1df7def2e..c2c7c27f25 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -40,6 +40,8 @@ #include "scene/main/scene_tree.h" #include "scene/resources/scene_format_text.h" +#include <stdlib.h> + #ifndef NO_THREADS #include "os/thread.h" #endif @@ -52,7 +54,11 @@ #include "editor/editor_node.h" #endif -////// Script stuff +// +// +// Script stuff +// +// void NativeScript::_bind_methods() { ClassDB::bind_method(D_METHOD("set_class_name", "class_name"), &NativeScript::set_class_name); @@ -108,7 +114,7 @@ void NativeScript::set_library(Ref<GDNativeLibrary> p_library) { return; } library = p_library; - lib_path = library->get_active_library_path(); + lib_path = library->get_current_library_path(); #ifndef NO_THREADS if (Thread::get_caller_id() != Thread::get_main_id()) { @@ -414,7 +420,6 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Variant::Call } } -// TODO(karroffel): implement this NativeScript::NativeScript() { library = Ref<GDNative>(); lib_path = ""; @@ -424,7 +429,6 @@ NativeScript::NativeScript() { #endif } -// TODO(karroffel): implement this NativeScript::~NativeScript() { NSL->unregister_script(this); @@ -433,7 +437,11 @@ NativeScript::~NativeScript() { #endif } -////// ScriptInstance stuff +// +// +// ScriptInstance stuff +// +// #define GET_SCRIPT_DESC() script->get_script_desc() @@ -691,7 +699,6 @@ NativeScriptInstance::RPCMode NativeScriptInstance::get_rpc_mode(const StringNam return RPC_MODE_DISABLED; } -// TODO(karroffel): implement this NativeScriptInstance::RPCMode NativeScriptInstance::get_rset_mode(const StringName &p_variable) const { NativeScriptDesc *script_data = GET_SCRIPT_DESC(); @@ -774,15 +781,14 @@ NativeScriptInstance::~NativeScriptInstance() { } } -////// ScriptingLanguage stuff +// +// +// ScriptingLanguage stuff +// +// NativeScriptLanguage *NativeScriptLanguage::singleton; -extern "C" void _native_script_hook(); -void NativeScriptLanguage::_hacky_api_anchor() { - _native_script_hook(); -} - void NativeScriptLanguage::_unload_stuff() { for (Map<String, Map<StringName, NativeScriptDesc> >::Element *L = library_classes.front(); L; L = L->next()) { for (Map<StringName, NativeScriptDesc>::Element *C = L->get().front(); C; C = C->next()) { @@ -819,9 +825,7 @@ NativeScriptLanguage::NativeScriptLanguage() { #endif } -// TODO(karroffel): implement this NativeScriptLanguage::~NativeScriptLanguage() { - // _unload_stuff(); // NOTE(karroffel): This gets called in ::finish() for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) { @@ -847,7 +851,6 @@ void _add_reload_node() { #endif } -// TODO(karroffel): implement this void NativeScriptLanguage::init() { #if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED) @@ -860,6 +863,7 @@ void NativeScriptLanguage::init() { if (generate_c_api(E->next()->get()) != OK) { ERR_PRINT("Failed to generate C API\n"); } + exit(0); } #endif @@ -886,11 +890,9 @@ void NativeScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) co void NativeScriptLanguage::get_string_delimiters(List<String> *p_delimiters) const { } -// TODO(karroffel): implement this Ref<Script> NativeScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const { NativeScript *s = memnew(NativeScript); s->set_class_name(p_class_name); - // TODO(karroffel): use p_base_class_name return Ref<NativeScript>(s); } bool NativeScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const { @@ -988,7 +990,7 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) { MutexLock lock(mutex); #endif // See if this library was "registered" already. - const String &lib_path = lib->get_active_library_path(); + const String &lib_path = lib->get_current_library_path(); ERR_EXPLAIN(lib->get_name() + " does not have a library for the current platform"); ERR_FAIL_COND(lib_path.length() == 0); Map<String, Ref<GDNative> >::Element *E = library_gdnatives.find(lib_path); @@ -998,7 +1000,7 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) { gdn.instance(); gdn->set_library(lib); - // TODO(karroffel): check the return value? + // TODO check the return value? gdn->initialize(); library_gdnatives.insert(lib_path, gdn); @@ -1010,7 +1012,7 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) { void *proc_ptr; - Error err = gdn->get_symbol(_init_call_name, proc_ptr); + Error err = gdn->get_symbol(lib->get_symbol_prefix() + _init_call_name, proc_ptr); if (err != OK) { ERR_PRINT(String("No " + _init_call_name + " in \"" + lib_path + "\" found").utf8().get_data()); @@ -1051,7 +1053,7 @@ void NativeScriptLanguage::call_libraries_cb(const StringName &name) { if (L->get()->is_initialized()) { void *proc_ptr; - Error err = L->get()->get_symbol(name, proc_ptr); + Error err = L->get()->get_symbol(L->get()->get_library()->get_symbol_prefix() + name, proc_ptr); if (!err) { ((void (*)())proc_ptr)(); @@ -1140,7 +1142,7 @@ void NativeReloadNode::_notification(int p_what) { // here the library registers all the classes and stuff. void *proc_ptr; - Error err = L->get()->get_symbol("godot_nativescript_init", proc_ptr); + Error err = L->get()->get_symbol(L->get()->get_library()->get_symbol_prefix() + "nativescript_init", proc_ptr); if (err != OK) { ERR_PRINT(String("No godot_nativescript_init in \"" + L->key() + "\" found").utf8().get_data()); } else { diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index e8fc9e6880..f0f14e2f30 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -229,15 +229,15 @@ public: Map<String, Set<NativeScript *> > library_script_users; const StringName _init_call_type = "nativescript_init"; - const StringName _init_call_name = "godot_nativescript_init"; + const StringName _init_call_name = "nativescript_init"; const StringName _noarg_call_type = "nativescript_no_arg"; - const StringName _frame_call_name = "godot_nativescript_frame"; + const StringName _frame_call_name = "nativescript_frame"; #ifndef NO_THREADS - const StringName _thread_enter_call_name = "godot_nativescript_thread_enter"; - const StringName _thread_exit_call_name = "godot_nativescript_thread_exit"; + const StringName _thread_enter_call_name = "nativescript_thread_enter"; + const StringName _thread_exit_call_name = "nativescript_thread_exit"; #endif NativeScriptLanguage(); diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 19a62b9c4f..8af643df50 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -48,7 +48,7 @@ #include "gd_native_library_editor.h" // Class used to discover singleton gdnative files -void actual_discoverer_handler(); +static void actual_discoverer_handler(); class GDNativeSingletonDiscover : public Object { // GDCLASS(GDNativeSingletonDiscover, Object) @@ -66,7 +66,7 @@ class GDNativeSingletonDiscover : public Object { } }; -Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) { +static Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) { Set<String> file_paths; @@ -81,7 +81,7 @@ Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) { } Ref<GDNativeLibrary> lib = ResourceLoader::load(p_dir->get_file_path(i)); - if (lib.is_valid() && lib->is_singleton_gdnative()) { + if (lib.is_valid() && lib->is_singleton()) { file_paths.insert(p_dir->get_file_path(i)); } } @@ -98,7 +98,7 @@ Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) { return file_paths; } -void actual_discoverer_handler() { +static void actual_discoverer_handler() { EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem(); Set<String> file_paths = get_gdnative_singletons(dir); @@ -115,7 +115,125 @@ void actual_discoverer_handler() { ProjectSettings::get_singleton()->save(); } -GDNativeSingletonDiscover *discoverer = NULL; +static GDNativeSingletonDiscover *discoverer = NULL; + +class GDNativeExportPlugin : public EditorExportPlugin { + +protected: + virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features); +}; + +void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_type, const Set<String> &p_features) { + if (p_type != "GDNativeLibrary") { + return; + } + + Ref<GDNativeLibrary> lib = ResourceLoader::load(p_path); + + if (lib.is_null()) { + return; + } + + Ref<ConfigFile> config = lib->get_config_file(); + + String entry_lib_path; + { + + List<String> entry_keys; + config->get_section_keys("entry", &entry_keys); + + for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) { + String key = E->get(); + + Vector<String> tags = key.split("."); + + bool skip = false; + for (int i = 0; i < tags.size(); i++) { + bool has_feature = p_features.has(tags[i]); + + if (!has_feature) { + skip = true; + break; + } + } + + if (skip) { + continue; + } + + entry_lib_path = config->get_value("entry", key); + break; + } + } + + Vector<String> dependency_paths; + { + + List<String> dependency_keys; + config->get_section_keys("dependencies", &dependency_keys); + + for (List<String>::Element *E = dependency_keys.front(); E; E = E->next()) { + String key = E->get(); + + Vector<String> tags = key.split("."); + + bool skip = false; + for (int i = 0; i < tags.size(); i++) { + bool has_feature = p_features.has(tags[i]); + + if (!has_feature) { + skip = true; + break; + } + } + + if (skip) { + continue; + } + + dependency_paths = config->get_value("dependencies", key); + break; + } + } + + bool is_statically_linked = false; + { + + List<String> static_linking_keys; + config->get_section_keys("static_linking", &static_linking_keys); + + for (List<String>::Element *E = static_linking_keys.front(); E; E = E->next()) { + String key = E->get(); + + Vector<String> tags = key.split("."); + + bool skip = false; + + for (int i = 0; i < tags.size(); i++) { + bool has_feature = p_features.has(tags[i]); + + if (!has_feature) { + skip = true; + break; + } + } + + if (skip) { + continue; + } + + is_statically_linked = config->get_value("static_linking", key); + break; + } + } + + if (!is_statically_linked) + add_shared_object(entry_lib_path); + + for (int i = 0; i < dependency_paths.size(); i++) { + add_shared_object(dependency_paths[i]); + } +} static void editor_init_callback() { @@ -125,11 +243,16 @@ static void editor_init_callback() { discoverer = memnew(GDNativeSingletonDiscover); EditorFileSystem::get_singleton()->connect("filesystem_changed", discoverer, "get_class"); + + Ref<GDNativeExportPlugin> export_plugin; + export_plugin.instance(); + + EditorExport::get_singleton()->add_export_plugin(export_plugin); } #endif -godot_variant cb_standard_varcall(void *p_procedure_handle, godot_array *p_args) { +static godot_variant cb_standard_varcall(void *p_procedure_handle, godot_array *p_args) { godot_gdnative_procedure_fn proc; proc = (godot_gdnative_procedure_fn)p_procedure_handle; @@ -141,6 +264,9 @@ GDNativeCallRegistry *GDNativeCallRegistry::singleton; Vector<Ref<GDNative> > singleton_gdnatives; +GDNativeLibraryResourceLoader *resource_loader_gdnlib = NULL; +GDNativeLibraryResourceSaver *resource_saver_gdnlib = NULL; + void register_gdnative_types() { #ifdef TOOLS_ENABLED @@ -153,6 +279,12 @@ void register_gdnative_types() { ClassDB::register_class<GDNativeLibrary>(); ClassDB::register_class<GDNative>(); + resource_loader_gdnlib = memnew(GDNativeLibraryResourceLoader); + resource_saver_gdnlib = memnew(GDNativeLibraryResourceSaver); + + ResourceLoader::add_resource_format_loader(resource_loader_gdnlib); + ResourceSaver::add_resource_format_saver(resource_saver_gdnlib); + GDNativeCallRegistry::singleton = memnew(GDNativeCallRegistry); GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall); @@ -185,11 +317,11 @@ void register_gdnative_types() { void *proc_ptr; Error err = singleton_gdnatives[i]->get_symbol( - "godot_gdnative_singleton", + lib->get_symbol_prefix() + "gdnative_singleton", proc_ptr); if (err != OK) { - ERR_PRINT((String("No godot_gdnative_singleton in \"" + singleton_gdnatives[i]->get_library()->get_active_library_path()) + "\" found").utf8().get_data()); + ERR_PRINT((String("No godot_gdnative_singleton in \"" + singleton_gdnatives[i]->get_library()->get_current_library_path()) + "\" found").utf8().get_data()); } else { ((void (*)())proc_ptr)(); } @@ -224,6 +356,9 @@ void unregister_gdnative_types() { } #endif + memdelete(resource_loader_gdnlib); + memdelete(resource_saver_gdnlib); + // This is for printing out the sizes of the core types /* @@ -236,7 +371,7 @@ void unregister_gdnative_types() { print_line(String("poolarray:\t") + itos(sizeof(PoolByteArray))); print_line(String("quat:\t") + itos(sizeof(Quat))); print_line(String("rect2:\t") + itos(sizeof(Rect2))); - print_line(String("rect3:\t") + itos(sizeof(Rect3))); + print_line(String("aabb:\t") + itos(sizeof(AABB))); print_line(String("rid:\t") + itos(sizeof(RID))); print_line(String("string:\t") + itos(sizeof(String))); print_line(String("transform:\t") + itos(sizeof(Transform))); diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py index 5698a37295..6496b59d75 100644 --- a/modules/gdscript/config.py +++ b/modules/gdscript/config.py @@ -1,8 +1,15 @@ - - def can_build(platform): return True - def configure(env): pass + +def get_doc_classes(): + return [ + "GDScript", + "GDScriptFunctionState", + "GDScriptNativeClass", + ] + +def get_doc_path(): + return "doc_classes" diff --git a/doc/classes/GDScript.xml b/modules/gdscript/doc_classes/GDScript.xml index 2faa0ff968..13d45aa520 100644 --- a/doc/classes/GDScript.xml +++ b/modules/gdscript/doc_classes/GDScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDScript" inherits="Script" category="Core" version="3.0.alpha.custom_build"> +<class name="GDScript" inherits="Script" category="Core" version="3.0-alpha"> <brief_description> A script implemented in the GDScript programming language. </brief_description> diff --git a/doc/classes/GDFunctionState.xml b/modules/gdscript/doc_classes/GDScriptFunctionState.xml index 801ca718e7..2df4e7c217 100644 --- a/doc/classes/GDFunctionState.xml +++ b/modules/gdscript/doc_classes/GDScriptFunctionState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDFunctionState" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="GDScriptFunctionState" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> State of a function call after yielding. </brief_description> @@ -18,7 +18,7 @@ </argument> <description> Check whether the function call may be resumed. This is not the case if the function state was already resumed. - If [code]extended_check[/code] is enabled, it also checks if the associated script and object still exist. The extended check is done in debug mode as part of [method GDFunctionState.resume], but you can use this if you know you may be trying to resume without knowing for sure the object and/or script have survived up to that point. + If [code]extended_check[/code] is enabled, it also checks if the associated script and object still exist. The extended check is done in debug mode as part of [method GDScriptFunctionState.resume], but you can use this if you know you may be trying to resume without knowing for sure the object and/or script have survived up to that point. </description> </method> <method name="resume"> diff --git a/doc/classes/GDNativeClass.xml b/modules/gdscript/doc_classes/GDScriptNativeClass.xml index 5a3f353720..4514a78469 100644 --- a/doc/classes/GDNativeClass.xml +++ b/modules/gdscript/doc_classes/GDScriptNativeClass.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDNativeClass" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="GDScriptNativeClass" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gdscript.cpp index e5016c59bd..55ea8a5f24 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_script.cpp */ +/* gdscript.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,9 +27,10 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "gd_script.h" +#include "gdscript.h" -#include "gd_compiler.h" +#include "engine.h" +#include "gdscript_compiler.h" #include "global_constants.h" #include "io/file_access_encrypted.h" #include "os/file_access.h" @@ -38,12 +39,12 @@ /////////////////////////// -GDNativeClass::GDNativeClass(const StringName &p_name) { +GDScriptNativeClass::GDScriptNativeClass(const StringName &p_name) { name = p_name; } -bool GDNativeClass::_get(const StringName &p_name, Variant &r_ret) const { +bool GDScriptNativeClass::_get(const StringName &p_name, Variant &r_ret) const { bool ok; int v = ClassDB::get_integer_constant(name, p_name, &ok); @@ -56,12 +57,12 @@ bool GDNativeClass::_get(const StringName &p_name, Variant &r_ret) const { } } -void GDNativeClass::_bind_methods() { +void GDScriptNativeClass::_bind_methods() { - ClassDB::bind_method(D_METHOD("new"), &GDNativeClass::_new); + ClassDB::bind_method(D_METHOD("new"), &GDScriptNativeClass::_new); } -Variant GDNativeClass::_new() { +Variant GDScriptNativeClass::_new() { Object *o = instance(); if (!o) { @@ -77,16 +78,16 @@ Variant GDNativeClass::_new() { } } -Object *GDNativeClass::instance() { +Object *GDScriptNativeClass::instance() { return ClassDB::instance(name); } -GDInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error) { +GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error) { /* STEP 1, CREATE */ - GDInstance *instance = memnew(GDInstance); + GDScriptInstance *instance = memnew(GDScriptInstance); instance->base_ref = p_isref; instance->members.resize(member_indices.size()); instance->script = Ref<GDScript>(this); @@ -162,7 +163,7 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Variant::CallErro ref = REF(r); } - GDInstance *instance = _create_instance(p_args, p_argcount, owner, r != NULL, r_error); + GDScriptInstance *instance = _create_instance(p_args, p_argcount, owner, r != NULL, r_error); if (!instance) { if (ref.is_null()) { memdelete(owner); //no owner, sorry @@ -217,7 +218,7 @@ void GDScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) { void GDScript::get_script_method_list(List<MethodInfo> *p_list) const { - for (const Map<StringName, GDFunction *>::Element *E = member_functions.front(); E; E = E->next()) { + for (const Map<StringName, GDScriptFunction *>::Element *E = member_functions.front(); E; E = E->next()) { MethodInfo mi; mi.name = E->key(); for (int i = 0; i < E->get()->get_argument_count(); i++) { @@ -271,7 +272,7 @@ bool GDScript::has_method(const StringName &p_method) const { MethodInfo GDScript::get_method_info(const StringName &p_method) const { - const Map<StringName, GDFunction *>::Element *E = member_functions.find(p_method); + const Map<StringName, GDScriptFunction *>::Element *E = member_functions.find(p_method); if (!E) return MethodInfo(); @@ -419,15 +420,15 @@ bool GDScript::_update_exports() { if (basedir != "") basedir = basedir.get_base_dir(); - GDParser parser; + GDScriptParser parser; Error err = parser.parse(source, basedir, true, path); if (err == OK) { - const GDParser::Node *root = parser.get_parse_tree(); - ERR_FAIL_COND_V(root->type != GDParser::Node::TYPE_CLASS, false); + const GDScriptParser::Node *root = parser.get_parse_tree(); + ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, false); - const GDParser::ClassNode *c = static_cast<const GDParser::ClassNode *>(root); + const GDScriptParser::ClassNode *c = static_cast<const GDScriptParser::ClassNode *>(root); if (base_cache.is_valid()) { base_cache->inheriters_cache.erase(get_instance_id()); @@ -571,7 +572,7 @@ Error GDScript::reload(bool p_keep_state) { } valid = false; - GDParser parser; + GDScriptParser parser; Error err = parser.parse(source, basedir, false, path); if (err) { if (ScriptDebugger::get_singleton()) { @@ -583,7 +584,7 @@ Error GDScript::reload(bool p_keep_state) { bool can_run = ScriptServer::is_scripting_enabled() || parser.is_tool_script(); - GDCompiler compiler; + GDScriptCompiler compiler; err = compiler.compile(&parser, this, p_keep_state); if (err) { @@ -619,7 +620,7 @@ Variant GDScript::call(const StringName &p_method, const Variant **p_args, int p GDScript *top = this; while (top) { - Map<StringName, GDFunction *>::Element *E = top->member_functions.find(p_method); + Map<StringName, GDScriptFunction *>::Element *E = top->member_functions.find(p_method); if (E) { if (!E->get()->is_static()) { @@ -698,7 +699,7 @@ void GDScript::_bind_methods() { Vector<uint8_t> GDScript::get_as_byte_code() const { - GDTokenizerBuffer tokenizer; + GDScriptTokenizerBuffer tokenizer; return tokenizer.parse_code_string(source); }; @@ -738,14 +739,14 @@ Error GDScript::load_byte_code(const String &p_path) { basedir = basedir.get_base_dir(); valid = false; - GDParser parser; + GDScriptParser parser; Error err = parser.parse_bytecode(bytecode, basedir, get_path()); if (err) { _err_print_error("GDScript::load_byte_code", path.empty() ? "built-in" : (const char *)path.utf8().get_data(), parser.get_error_line(), ("Parse Error: " + parser.get_error()).utf8().get_data(), ERR_HANDLER_SCRIPT); ERR_FAIL_V(ERR_PARSE_ERROR); } - GDCompiler compiler; + GDScriptCompiler compiler; err = compiler.compile(&parser, this); if (err) { @@ -798,7 +799,7 @@ Error GDScript::load_source_code(const String &p_path) { return OK; } -const Map<StringName, GDFunction *> &GDScript::debug_get_member_functions() const { +const Map<StringName, GDScriptFunction *> &GDScript::debug_get_member_functions() const { return member_functions; } @@ -885,7 +886,7 @@ GDScript::GDScript() } GDScript::~GDScript() { - for (Map<StringName, GDFunction *>::Element *E = member_functions.front(); E; E = E->next()) { + for (Map<StringName, GDScriptFunction *>::Element *E = member_functions.front(); E; E = E->next()) { memdelete(E->get()); } @@ -909,7 +910,7 @@ GDScript::~GDScript() { // INSTANCE // ////////////////////////////// -bool GDInstance::set(const StringName &p_name, const Variant &p_value) { +bool GDScriptInstance::set(const StringName &p_name, const Variant &p_value) { //member { @@ -931,7 +932,7 @@ bool GDInstance::set(const StringName &p_name, const Variant &p_value) { GDScript *sptr = script.ptr(); while (sptr) { - Map<StringName, GDFunction *>::Element *E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._set); + Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._set); if (E) { Variant name = p_name; @@ -948,7 +949,7 @@ bool GDInstance::set(const StringName &p_name, const Variant &p_value) { return false; } -bool GDInstance::get(const StringName &p_name, Variant &r_ret) const { +bool GDScriptInstance::get(const StringName &p_name, Variant &r_ret) const { const GDScript *sptr = script.ptr(); while (sptr) { @@ -958,7 +959,7 @@ bool GDInstance::get(const StringName &p_name, Variant &r_ret) const { if (E) { if (E->get().getter) { Variant::CallError err; - r_ret = const_cast<GDInstance *>(this)->call(E->get().getter, NULL, 0, err); + r_ret = const_cast<GDScriptInstance *>(this)->call(E->get().getter, NULL, 0, err); if (err.error == Variant::CallError::CALL_OK) { return true; } @@ -982,14 +983,14 @@ bool GDInstance::get(const StringName &p_name, Variant &r_ret) const { } { - const Map<StringName, GDFunction *>::Element *E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._get); + const Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._get); if (E) { Variant name = p_name; const Variant *args[1] = { &name }; Variant::CallError err; - Variant ret = const_cast<GDFunction *>(E->get())->call(const_cast<GDInstance *>(this), (const Variant **)args, 1, err); + Variant ret = const_cast<GDScriptFunction *>(E->get())->call(const_cast<GDScriptInstance *>(this), (const Variant **)args, 1, err); if (err.error == Variant::CallError::CALL_OK && ret.get_type() != Variant::NIL) { r_ret = ret; return true; @@ -1002,7 +1003,7 @@ bool GDInstance::get(const StringName &p_name, Variant &r_ret) const { return false; } -Variant::Type GDInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const { +Variant::Type GDScriptInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const { const GDScript *sptr = script.ptr(); while (sptr) { @@ -1020,7 +1021,7 @@ Variant::Type GDInstance::get_property_type(const StringName &p_name, bool *r_is return Variant::NIL; } -void GDInstance::get_property_list(List<PropertyInfo> *p_properties) const { +void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const { // exported members, not doen yet! const GDScript *sptr = script.ptr(); @@ -1028,11 +1029,11 @@ void GDInstance::get_property_list(List<PropertyInfo> *p_properties) const { while (sptr) { - const Map<StringName, GDFunction *>::Element *E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._get_property_list); + const Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._get_property_list); if (E) { Variant::CallError err; - Variant ret = const_cast<GDFunction *>(E->get())->call(const_cast<GDInstance *>(this), NULL, 0, err); + Variant ret = const_cast<GDScriptFunction *>(E->get())->call(const_cast<GDScriptInstance *>(this), NULL, 0, err); if (err.error == Variant::CallError::CALL_OK) { if (ret.get_type() != Variant::ARRAY) { @@ -1091,12 +1092,12 @@ void GDInstance::get_property_list(List<PropertyInfo> *p_properties) const { } } -void GDInstance::get_method_list(List<MethodInfo> *p_list) const { +void GDScriptInstance::get_method_list(List<MethodInfo> *p_list) const { const GDScript *sptr = script.ptr(); while (sptr) { - for (Map<StringName, GDFunction *>::Element *E = sptr->member_functions.front(); E; E = E->next()) { + for (Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.front(); E; E = E->next()) { MethodInfo mi; mi.name = E->key(); @@ -1109,11 +1110,11 @@ void GDInstance::get_method_list(List<MethodInfo> *p_list) const { } } -bool GDInstance::has_method(const StringName &p_method) const { +bool GDScriptInstance::has_method(const StringName &p_method) const { const GDScript *sptr = script.ptr(); while (sptr) { - const Map<StringName, GDFunction *>::Element *E = sptr->member_functions.find(p_method); + const Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(p_method); if (E) return true; sptr = sptr->_base; @@ -1121,13 +1122,13 @@ bool GDInstance::has_method(const StringName &p_method) const { return false; } -Variant GDInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant GDScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { //printf("calling %ls:%i method %ls\n", script->get_path().c_str(), -1, String(p_method).c_str()); GDScript *sptr = script.ptr(); while (sptr) { - Map<StringName, GDFunction *>::Element *E = sptr->member_functions.find(p_method); + Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(p_method); if (E) { return E->get()->call(this, p_args, p_argcount, r_error); } @@ -1137,13 +1138,13 @@ Variant GDInstance::call(const StringName &p_method, const Variant **p_args, int return Variant(); } -void GDInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { +void GDScriptInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { GDScript *sptr = script.ptr(); Variant::CallError ce; while (sptr) { - Map<StringName, GDFunction *>::Element *E = sptr->member_functions.find(p_method); + Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(p_method); if (E) { E->get()->call(this, p_args, p_argcount, ce); } @@ -1151,27 +1152,27 @@ void GDInstance::call_multilevel(const StringName &p_method, const Variant **p_a } } -void GDInstance::_ml_call_reversed(GDScript *sptr, const StringName &p_method, const Variant **p_args, int p_argcount) { +void GDScriptInstance::_ml_call_reversed(GDScript *sptr, const StringName &p_method, const Variant **p_args, int p_argcount) { if (sptr->_base) _ml_call_reversed(sptr->_base, p_method, p_args, p_argcount); Variant::CallError ce; - Map<StringName, GDFunction *>::Element *E = sptr->member_functions.find(p_method); + Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(p_method); if (E) { E->get()->call(this, p_args, p_argcount, ce); } } -void GDInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) { +void GDScriptInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) { if (script.ptr()) { _ml_call_reversed(script.ptr(), p_method, p_args, p_argcount); } } -void GDInstance::notification(int p_notification) { +void GDScriptInstance::notification(int p_notification) { //notification is not virtual, it gets called at ALL levels just like in C. Variant value = p_notification; @@ -1179,7 +1180,7 @@ void GDInstance::notification(int p_notification) { GDScript *sptr = script.ptr(); while (sptr) { - Map<StringName, GDFunction *>::Element *E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._notification); + Map<StringName, GDScriptFunction *>::Element *E = sptr->member_functions.find(GDScriptLanguage::get_singleton()->strings._notification); if (E) { Variant::CallError err; E->get()->call(this, args, 1, err); @@ -1191,22 +1192,22 @@ void GDInstance::notification(int p_notification) { } } -Ref<Script> GDInstance::get_script() const { +Ref<Script> GDScriptInstance::get_script() const { return script; } -ScriptLanguage *GDInstance::get_language() { +ScriptLanguage *GDScriptInstance::get_language() { return GDScriptLanguage::get_singleton(); } -GDInstance::RPCMode GDInstance::get_rpc_mode(const StringName &p_method) const { +GDScriptInstance::RPCMode GDScriptInstance::get_rpc_mode(const StringName &p_method) const { const GDScript *cscript = script.ptr(); while (cscript) { - const Map<StringName, GDFunction *>::Element *E = cscript->member_functions.find(p_method); + const Map<StringName, GDScriptFunction *>::Element *E = cscript->member_functions.find(p_method); if (E) { if (E->get()->get_rpc_mode() != RPC_MODE_DISABLED) { @@ -1219,7 +1220,7 @@ GDInstance::RPCMode GDInstance::get_rpc_mode(const StringName &p_method) const { return RPC_MODE_DISABLED; } -GDInstance::RPCMode GDInstance::get_rset_mode(const StringName &p_variable) const { +GDScriptInstance::RPCMode GDScriptInstance::get_rset_mode(const StringName &p_variable) const { const GDScript *cscript = script.ptr(); @@ -1237,7 +1238,7 @@ GDInstance::RPCMode GDInstance::get_rset_mode(const StringName &p_variable) cons return RPC_MODE_DISABLED; } -void GDInstance::reload_members() { +void GDScriptInstance::reload_members() { #ifdef DEBUG_ENABLED @@ -1268,12 +1269,12 @@ void GDInstance::reload_members() { #endif } -GDInstance::GDInstance() { +GDScriptInstance::GDScriptInstance() { owner = NULL; base_ref = false; } -GDInstance::~GDInstance() { +GDScriptInstance::~GDScriptInstance() { if (script.is_valid() && owner) { #ifndef NO_THREADS GDScriptLanguage::singleton->lock->lock(); @@ -1341,15 +1342,15 @@ void GDScriptLanguage::init() { if (globals.has(n)) continue; - Ref<GDNativeClass> nc = memnew(GDNativeClass(E->get())); + Ref<GDScriptNativeClass> nc = memnew(GDScriptNativeClass(E->get())); _add_global(n, nc); } //populate singletons - List<ProjectSettings::Singleton> singletons; - ProjectSettings::get_singleton()->get_singletons(&singletons); - for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) { + List<Engine::Singleton> singletons; + Engine::get_singleton()->get_singletons(&singletons); + for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) { _add_global(E->get().name, E->get().ptr); } @@ -1378,7 +1379,7 @@ void GDScriptLanguage::profiling_start() { lock->lock(); } - SelfList<GDFunction> *elem = function_list.first(); + SelfList<GDScriptFunction> *elem = function_list.first(); while (elem) { elem->self()->profile.call_count = 0; elem->self()->profile.self_time = 0; @@ -1423,7 +1424,7 @@ int GDScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_arr, lock->lock(); } - SelfList<GDFunction> *elem = function_list.first(); + SelfList<GDScriptFunction> *elem = function_list.first(); while (elem) { if (current >= p_info_max) break; @@ -1453,7 +1454,7 @@ int GDScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_ lock->lock(); } - SelfList<GDFunction> *elem = function_list.first(); + SelfList<GDScriptFunction> *elem = function_list.first(); while (elem) { if (current >= p_info_max) break; @@ -1598,17 +1599,18 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so Object *obj = E->get()->placeholders.front()->get()->get_owner(); //save instance info - List<Pair<StringName, Variant> > state; if (obj->get_script_instance()) { + map.insert(obj->get_instance_id(), List<Pair<StringName, Variant> >()); + List<Pair<StringName, Variant> > &state = map[obj->get_instance_id()]; obj->get_script_instance()->get_property_state(state); - map[obj->get_instance_id()] = state; obj->set_script(RefPtr()); } else { // no instance found. Let's remove it so we don't loop forever E->get()->placeholders.erase(E->get()->placeholders.front()->get()); } } + #endif for (Map<ObjectID, List<Pair<StringName, Variant> > >::Element *F = E->get()->pending_reload_state.front(); F; F = F->next()) { @@ -1666,7 +1668,7 @@ void GDScriptLanguage::frame() { lock->lock(); } - SelfList<GDFunction> *elem = function_list.first(); + SelfList<GDScriptFunction> *elem = function_list.first(); while (elem) { elem->self()->profile.last_frame_call_count = elem->self()->profile.frame_call_count; elem->self()->profile.last_frame_self_time = elem->self()->profile.frame_self_time; @@ -1751,8 +1753,8 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const { w++; } - for (int i = 0; i < GDFunctions::FUNC_MAX; i++) { - p_words->push_back(GDFunctions::get_func_name(GDFunctions::Function(i))); + for (int i = 0; i < GDScriptFunctions::FUNC_MAX; i++) { + p_words->push_back(GDScriptFunctions::get_func_name(GDScriptFunctions::Function(i))); } } diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gdscript.h index e0d142014a..3f6f431938 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gdscript.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_script.h */ +/* gdscript.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,16 +27,17 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GD_SCRIPT_H -#define GD_SCRIPT_H +#ifndef GDSCRIPT_H +#define GDSCRIPT_H -#include "gd_function.h" +#include "gdscript_function.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "script_language.h" -class GDNativeClass : public Reference { - GDCLASS(GDNativeClass, Reference); +class GDScriptNativeClass : public Reference { + + GDCLASS(GDScriptNativeClass, Reference); StringName name; @@ -48,7 +49,7 @@ public: _FORCE_INLINE_ const StringName &get_name() const { return name; } Variant _new(); Object *instance(); - GDNativeClass(const StringName &p_name); + GDScriptNativeClass(const StringName &p_name); }; class GDScript : public Script { @@ -64,21 +65,21 @@ class GDScript : public Script { ScriptInstance::RPCMode rpc_mode; }; - friend class GDInstance; - friend class GDFunction; - friend class GDCompiler; - friend class GDFunctions; + friend class GDScriptInstance; + friend class GDScriptFunction; + friend class GDScriptCompiler; + friend class GDScriptFunctions; friend class GDScriptLanguage; Variant _static_ref; //used for static call - Ref<GDNativeClass> native; + Ref<GDScriptNativeClass> native; Ref<GDScript> base; GDScript *_base; //fast pointer access GDScript *_owner; //for subclasses Set<StringName> members; //members are just indices to the instanced script. Map<StringName, Variant> constants; - Map<StringName, GDFunction *> member_functions; + Map<StringName, GDScriptFunction *> member_functions; Map<StringName, MemberInfo> member_indices; //members are just indices to the instanced script. Map<StringName, Ref<GDScript> > subclasses; Map<StringName, Vector<StringName> > _signals; @@ -99,7 +100,7 @@ class GDScript : public Script { #endif Map<StringName, PropertyInfo> member_info; - GDFunction *initializer; //direct pointer to _init , faster to locate + GDScriptFunction *initializer; //direct pointer to _init , faster to locate int subclass_count; Set<Object *> instances; @@ -109,7 +110,7 @@ class GDScript : public Script { String name; SelfList<GDScript> script_list; - GDInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error); + GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error); void _set_subclass_path(Ref<GDScript> &p_sc, const String &p_path); @@ -143,8 +144,8 @@ public: const Map<StringName, Ref<GDScript> > &get_subclasses() const { return subclasses; } const Map<StringName, Variant> &get_constants() const { return constants; } const Set<StringName> &get_members() const { return members; } - const Map<StringName, GDFunction *> &get_member_functions() const { return member_functions; } - const Ref<GDNativeClass> &get_native() const { return native; } + const Map<StringName, GDScriptFunction *> &get_member_functions() const { return member_functions; } + const Ref<GDScriptNativeClass> &get_native() const { return native; } virtual bool has_script_signal(const StringName &p_signal) const; virtual void get_script_signal_list(List<MethodInfo> *r_signals) const; @@ -153,7 +154,7 @@ public: Ref<GDScript> get_base() const; const Map<StringName, MemberInfo> &debug_get_member_indices() const { return member_indices; } - const Map<StringName, GDFunction *> &debug_get_member_functions() const; //this is debug only + const Map<StringName, GDScriptFunction *> &debug_get_member_functions() const; //this is debug only StringName debug_get_member_by_index(int p_idx) const; Variant _new(const Variant **p_args, int p_argcount, Variant::CallError &r_error); @@ -201,11 +202,11 @@ public: ~GDScript(); }; -class GDInstance : public ScriptInstance { +class GDScriptInstance : public ScriptInstance { friend class GDScript; - friend class GDFunction; - friend class GDFunctions; - friend class GDCompiler; + friend class GDScriptFunction; + friend class GDScriptFunctions; + friend class GDScriptCompiler; Object *owner; Ref<GDScript> script; @@ -246,8 +247,8 @@ public: virtual RPCMode get_rpc_mode(const StringName &p_method) const; virtual RPCMode get_rset_mode(const StringName &p_variable) const; - GDInstance(); - ~GDInstance(); + GDScriptInstance(); + ~GDScriptInstance(); }; class GDScriptLanguage : public ScriptLanguage { @@ -261,8 +262,8 @@ class GDScriptLanguage : public ScriptLanguage { struct CallLevel { Variant *stack; - GDFunction *function; - GDInstance *instance; + GDScriptFunction *function; + GDScriptInstance *instance; int *ip; int *line; }; @@ -276,16 +277,16 @@ class GDScriptLanguage : public ScriptLanguage { void _add_global(const StringName &p_name, const Variant &p_value); - friend class GDInstance; + friend class GDScriptInstance; Mutex *lock; friend class GDScript; SelfList<GDScript>::List script_list; - friend class GDFunction; + friend class GDScriptFunction; - SelfList<GDFunction>::List function_list; + SelfList<GDScriptFunction>::List function_list; bool profiling; uint64_t script_frame_time; @@ -295,7 +296,7 @@ public: bool debug_break(const String &p_error, bool p_allow_continue = true); bool debug_break_parse(const String &p_file, int p_line, const String &p_error); - _FORCE_INLINE_ void enter_function(GDInstance *p_instance, GDFunction *p_function, Variant *p_stack, int *p_ip, int *p_line) { + _FORCE_INLINE_ void enter_function(GDScriptInstance *p_instance, GDScriptFunction *p_function, Variant *p_stack, int *p_ip, int *p_line) { if (Thread::get_main_id() != Thread::get_caller_id()) return; //no support for other threads than main for now @@ -446,4 +447,4 @@ public: virtual bool recognize(const RES &p_resource) const; }; -#endif // GD_SCRIPT_H +#endif // GDSCRIPT_H diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 7036a708e5..3121a61436 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_compiler.cpp */ +/* gdscript_compiler.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,10 +27,11 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "gd_compiler.h" -#include "gd_script.h" +#include "gdscript_compiler.h" -bool GDCompiler::_is_class_member_property(CodeGen &codegen, const StringName &p_name) { +#include "gdscript.h" + +bool GDScriptCompiler::_is_class_member_property(CodeGen &codegen, const StringName &p_name) { if (!codegen.function_node || codegen.function_node->_static) return false; @@ -38,10 +39,10 @@ bool GDCompiler::_is_class_member_property(CodeGen &codegen, const StringName &p return _is_class_member_property(codegen.script, p_name); } -bool GDCompiler::_is_class_member_property(GDScript *owner, const StringName &p_name) { +bool GDScriptCompiler::_is_class_member_property(GDScript *owner, const StringName &p_name) { GDScript *scr = owner; - GDNativeClass *nc = NULL; + GDScriptNativeClass *nc = NULL; while (scr) { if (scr->native.is_valid()) @@ -54,7 +55,7 @@ bool GDCompiler::_is_class_member_property(GDScript *owner, const StringName &p_ return ClassDB::has_property(nc->get_name(), p_name); } -void GDCompiler::_set_error(const String &p_error, const GDParser::Node *p_node) { +void GDScriptCompiler::_set_error(const String &p_error, const GDScriptParser::Node *p_node) { if (error != "") return; @@ -69,7 +70,7 @@ void GDCompiler::_set_error(const String &p_error, const GDParser::Node *p_node) } } -bool GDCompiler::_create_unary_operator(CodeGen &codegen, const GDParser::OperatorNode *on, Variant::Operator op, int p_stack_level) { +bool GDScriptCompiler::_create_unary_operator(CodeGen &codegen, const GDScriptParser::OperatorNode *on, Variant::Operator op, int p_stack_level) { ERR_FAIL_COND_V(on->arguments.size() != 1, false); @@ -77,29 +78,29 @@ bool GDCompiler::_create_unary_operator(CodeGen &codegen, const GDParser::Operat if (src_address_a < 0) return false; - codegen.opcodes.push_back(GDFunction::OPCODE_OPERATOR); // perform operator + codegen.opcodes.push_back(GDScriptFunction::OPCODE_OPERATOR); // perform operator codegen.opcodes.push_back(op); //which operator codegen.opcodes.push_back(src_address_a); // argument 1 codegen.opcodes.push_back(src_address_a); // argument 2 (repeated) - //codegen.opcodes.push_back(GDFunction::ADDR_TYPE_NIL); // argument 2 (unary only takes one parameter) + //codegen.opcodes.push_back(GDScriptFunction::ADDR_TYPE_NIL); // argument 2 (unary only takes one parameter) return true; } -bool GDCompiler::_create_binary_operator(CodeGen &codegen, const GDParser::OperatorNode *on, Variant::Operator op, int p_stack_level, bool p_initializer) { +bool GDScriptCompiler::_create_binary_operator(CodeGen &codegen, const GDScriptParser::OperatorNode *on, Variant::Operator op, int p_stack_level, bool p_initializer) { ERR_FAIL_COND_V(on->arguments.size() != 2, false); int src_address_a = _parse_expression(codegen, on->arguments[0], p_stack_level, false, p_initializer); if (src_address_a < 0) return false; - if (src_address_a & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) + if (src_address_a & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) p_stack_level++; //uses stack for return, increase stack int src_address_b = _parse_expression(codegen, on->arguments[1], p_stack_level, false, p_initializer); if (src_address_b < 0) return false; - codegen.opcodes.push_back(GDFunction::OPCODE_OPERATOR); // perform operator + codegen.opcodes.push_back(GDScriptFunction::OPCODE_OPERATOR); // perform operator codegen.opcodes.push_back(op); //which operator codegen.opcodes.push_back(src_address_a); // argument 1 codegen.opcodes.push_back(src_address_b); // argument 2 (unary only takes one parameter) @@ -107,14 +108,14 @@ bool GDCompiler::_create_binary_operator(CodeGen &codegen, const GDParser::Opera } /* -int GDCompiler::_parse_subexpression(CodeGen& codegen,const GDParser::Node *p_expression) { +int GDScriptCompiler::_parse_subexpression(CodeGen& codegen,const GDScriptParser::Node *p_expression) { int ret = _parse_expression(codegen,p_expression); if (ret<0) return ret; - if (ret&(GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS)) { + if (ret&(GDScriptFunction::ADDR_TYPE_STACK<<GDScriptFunction::ADDR_BITS)) { codegen.stack_level++; codegen.check_max_stack_level(); //stack was used, keep value @@ -124,24 +125,24 @@ int GDCompiler::_parse_subexpression(CodeGen& codegen,const GDParser::Node *p_ex } */ -int GDCompiler::_parse_assign_right_expression(CodeGen &codegen, const GDParser::OperatorNode *p_expression, int p_stack_level) { +int GDScriptCompiler::_parse_assign_right_expression(CodeGen &codegen, const GDScriptParser::OperatorNode *p_expression, int p_stack_level) { Variant::Operator var_op = Variant::OP_MAX; switch (p_expression->op) { - case GDParser::OperatorNode::OP_ASSIGN_ADD: var_op = Variant::OP_ADD; break; - case GDParser::OperatorNode::OP_ASSIGN_SUB: var_op = Variant::OP_SUBTRACT; break; - case GDParser::OperatorNode::OP_ASSIGN_MUL: var_op = Variant::OP_MULTIPLY; break; - case GDParser::OperatorNode::OP_ASSIGN_DIV: var_op = Variant::OP_DIVIDE; break; - case GDParser::OperatorNode::OP_ASSIGN_MOD: var_op = Variant::OP_MODULE; break; - case GDParser::OperatorNode::OP_ASSIGN_SHIFT_LEFT: var_op = Variant::OP_SHIFT_LEFT; break; - case GDParser::OperatorNode::OP_ASSIGN_SHIFT_RIGHT: var_op = Variant::OP_SHIFT_RIGHT; break; - case GDParser::OperatorNode::OP_ASSIGN_BIT_AND: var_op = Variant::OP_BIT_AND; break; - case GDParser::OperatorNode::OP_ASSIGN_BIT_OR: var_op = Variant::OP_BIT_OR; break; - case GDParser::OperatorNode::OP_ASSIGN_BIT_XOR: var_op = Variant::OP_BIT_XOR; break; - case GDParser::OperatorNode::OP_INIT_ASSIGN: - case GDParser::OperatorNode::OP_ASSIGN: { + case GDScriptParser::OperatorNode::OP_ASSIGN_ADD: var_op = Variant::OP_ADD; break; + case GDScriptParser::OperatorNode::OP_ASSIGN_SUB: var_op = Variant::OP_SUBTRACT; break; + case GDScriptParser::OperatorNode::OP_ASSIGN_MUL: var_op = Variant::OP_MULTIPLY; break; + case GDScriptParser::OperatorNode::OP_ASSIGN_DIV: var_op = Variant::OP_DIVIDE; break; + case GDScriptParser::OperatorNode::OP_ASSIGN_MOD: var_op = Variant::OP_MODULE; break; + case GDScriptParser::OperatorNode::OP_ASSIGN_SHIFT_LEFT: var_op = Variant::OP_SHIFT_LEFT; break; + case GDScriptParser::OperatorNode::OP_ASSIGN_SHIFT_RIGHT: var_op = Variant::OP_SHIFT_RIGHT; break; + case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_AND: var_op = Variant::OP_BIT_AND; break; + case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_OR: var_op = Variant::OP_BIT_OR; break; + case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_XOR: var_op = Variant::OP_BIT_XOR; break; + case GDScriptParser::OperatorNode::OP_INIT_ASSIGN: + case GDScriptParser::OperatorNode::OP_ASSIGN: { //none } break; @@ -151,7 +152,7 @@ int GDCompiler::_parse_assign_right_expression(CodeGen &codegen, const GDParser: } } - bool initializer = p_expression->op == GDParser::OperatorNode::OP_INIT_ASSIGN; + bool initializer = p_expression->op == GDScriptParser::OperatorNode::OP_INIT_ASSIGN; if (var_op == Variant::OP_MAX) { @@ -161,32 +162,32 @@ int GDCompiler::_parse_assign_right_expression(CodeGen &codegen, const GDParser: if (!_create_binary_operator(codegen, p_expression, var_op, p_stack_level, initializer)) return -1; - int dst_addr = (p_stack_level) | (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); + int dst_addr = (p_stack_level) | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); codegen.opcodes.push_back(dst_addr); // append the stack level as destination address of the opcode codegen.alloc_stack(p_stack_level); return dst_addr; } -int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expression, int p_stack_level, bool p_root, bool p_initializer) { +int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::Node *p_expression, int p_stack_level, bool p_root, bool p_initializer) { switch (p_expression->type) { //should parse variable declaration and adjust stack accordingly... - case GDParser::Node::TYPE_IDENTIFIER: { + case GDScriptParser::Node::TYPE_IDENTIFIER: { //return identifier //wait, identifier could be a local variable or something else... careful here, must reference properly //as stack may be more interesting to work with //This could be made much simpler by just indexing "self", but done this way (with custom self-addressing modes) increases peformance a lot. - const GDParser::IdentifierNode *in = static_cast<const GDParser::IdentifierNode *>(p_expression); + const GDScriptParser::IdentifierNode *in = static_cast<const GDScriptParser::IdentifierNode *>(p_expression); StringName identifier = in->name; if (_is_class_member_property(codegen, identifier)) { //get property - codegen.opcodes.push_back(GDFunction::OPCODE_GET_MEMBER); // perform operator + codegen.opcodes.push_back(GDScriptFunction::OPCODE_GET_MEMBER); // perform operator codegen.opcodes.push_back(codegen.get_name_map_pos(identifier)); // argument 2 (unary only takes one parameter) - int dst_addr = (p_stack_level) | (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); + int dst_addr = (p_stack_level) | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); codegen.opcodes.push_back(dst_addr); // append the stack level as destination address of the opcode codegen.alloc_stack(p_stack_level); return dst_addr; @@ -196,7 +197,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (!p_initializer && codegen.stack_identifiers.has(identifier)) { int pos = codegen.stack_identifiers[identifier]; - return pos | (GDFunction::ADDR_TYPE_STACK_VARIABLE << GDFunction::ADDR_BITS); + return pos | (GDScriptFunction::ADDR_TYPE_STACK_VARIABLE << GDScriptFunction::ADDR_BITS); } //TRY MEMBERS! if (!codegen.function_node || !codegen.function_node->_static) { @@ -206,7 +207,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (codegen.script->member_indices.has(identifier)) { int idx = codegen.script->member_indices[identifier].index; - return idx | (GDFunction::ADDR_TYPE_MEMBER << GDFunction::ADDR_BITS); //argument (stack root) + return idx | (GDScriptFunction::ADDR_TYPE_MEMBER << GDScriptFunction::ADDR_BITS); //argument (stack root) } } @@ -216,14 +217,14 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr while (owner) { GDScript *scr = owner; - GDNativeClass *nc = NULL; + GDScriptNativeClass *nc = NULL; while (scr) { if (scr->constants.has(identifier)) { //int idx=scr->constants[identifier]; int idx = codegen.get_name_map_pos(identifier); - return idx | (GDFunction::ADDR_TYPE_CLASS_CONSTANT << GDFunction::ADDR_BITS); //argument (stack root) + return idx | (GDScriptFunction::ADDR_TYPE_CLASS_CONSTANT << GDScriptFunction::ADDR_BITS); //argument (stack root) } if (scr->native.is_valid()) nc = scr->native.ptr(); @@ -249,7 +250,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr idx = codegen.constant_map[key]; } - return idx | (GDFunction::ADDR_TYPE_LOCAL_CONSTANT << GDFunction::ADDR_BITS); //make it a local constant (faster access) + return idx | (GDScriptFunction::ADDR_TYPE_LOCAL_CONSTANT << GDScriptFunction::ADDR_BITS); //make it a local constant (faster access) } } @@ -261,14 +262,14 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (codegen.script->subclasses.has(identifier)) { //same with a subclass, make it a local constant. int idx = codegen.get_constant_pos(codegen.script->subclasses[identifier]); - return idx|(GDFunction::ADDR_TYPE_LOCAL_CONSTANT<<GDFunction::ADDR_BITS); //make it a local constant (faster access) + return idx|(GDScriptFunction::ADDR_TYPE_LOCAL_CONSTANT<<GDScriptFunction::ADDR_BITS); //make it a local constant (faster access) }*/ if (GDScriptLanguage::get_singleton()->get_global_map().has(identifier)) { int idx = GDScriptLanguage::get_singleton()->get_global_map()[identifier]; - return idx | (GDFunction::ADDR_TYPE_GLOBAL << GDFunction::ADDR_BITS); //argument (stack root) + return idx | (GDScriptFunction::ADDR_TYPE_GLOBAL << GDScriptFunction::ADDR_BITS); //argument (stack root) } //not found, error @@ -278,9 +279,9 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr return -1; } break; - case GDParser::Node::TYPE_CONSTANT: { + case GDScriptParser::Node::TYPE_CONSTANT: { //return constant - const GDParser::ConstantNode *cn = static_cast<const GDParser::ConstantNode *>(p_expression); + const GDScriptParser::ConstantNode *cn = static_cast<const GDScriptParser::ConstantNode *>(p_expression); int idx; @@ -293,20 +294,20 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr idx = codegen.constant_map[cn->value]; } - return idx | (GDFunction::ADDR_TYPE_LOCAL_CONSTANT << GDFunction::ADDR_BITS); //argument (stack root) + return idx | (GDScriptFunction::ADDR_TYPE_LOCAL_CONSTANT << GDScriptFunction::ADDR_BITS); //argument (stack root) } break; - case GDParser::Node::TYPE_SELF: { + case GDScriptParser::Node::TYPE_SELF: { //return constant if (codegen.function_node && codegen.function_node->_static) { _set_error("'self' not present in static function!", p_expression); return -1; } - return (GDFunction::ADDR_TYPE_SELF << GDFunction::ADDR_BITS); + return (GDScriptFunction::ADDR_TYPE_SELF << GDScriptFunction::ADDR_BITS); } break; - case GDParser::Node::TYPE_ARRAY: { + case GDScriptParser::Node::TYPE_ARRAY: { - const GDParser::ArrayNode *an = static_cast<const GDParser::ArrayNode *>(p_expression); + const GDScriptParser::ArrayNode *an = static_cast<const GDScriptParser::ArrayNode *>(p_expression); Vector<int> values; int slevel = p_stack_level; @@ -316,7 +317,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr int ret = _parse_expression(codegen, an->elements[i], slevel); if (ret < 0) return ret; - if (ret & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -324,20 +325,20 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr values.push_back(ret); } - codegen.opcodes.push_back(GDFunction::OPCODE_CONSTRUCT_ARRAY); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_CONSTRUCT_ARRAY); codegen.opcodes.push_back(values.size()); for (int i = 0; i < values.size(); i++) codegen.opcodes.push_back(values[i]); - int dst_addr = (p_stack_level) | (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); + int dst_addr = (p_stack_level) | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); codegen.opcodes.push_back(dst_addr); // append the stack level as destination address of the opcode codegen.alloc_stack(p_stack_level); return dst_addr; } break; - case GDParser::Node::TYPE_DICTIONARY: { + case GDScriptParser::Node::TYPE_DICTIONARY: { - const GDParser::DictionaryNode *dn = static_cast<const GDParser::DictionaryNode *>(p_expression); + const GDScriptParser::DictionaryNode *dn = static_cast<const GDScriptParser::DictionaryNode *>(p_expression); Vector<int> values; int slevel = p_stack_level; @@ -347,7 +348,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr int ret = _parse_expression(codegen, dn->elements[i].key, slevel); if (ret < 0) return ret; - if (ret & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -357,7 +358,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr ret = _parse_expression(codegen, dn->elements[i].value, slevel); if (ret < 0) return ret; - if (ret & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -365,29 +366,29 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr values.push_back(ret); } - codegen.opcodes.push_back(GDFunction::OPCODE_CONSTRUCT_DICTIONARY); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_CONSTRUCT_DICTIONARY); codegen.opcodes.push_back(dn->elements.size()); for (int i = 0; i < values.size(); i++) codegen.opcodes.push_back(values[i]); - int dst_addr = (p_stack_level) | (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); + int dst_addr = (p_stack_level) | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); codegen.opcodes.push_back(dst_addr); // append the stack level as destination address of the opcode codegen.alloc_stack(p_stack_level); return dst_addr; } break; - case GDParser::Node::TYPE_OPERATOR: { + case GDScriptParser::Node::TYPE_OPERATOR: { //hell breaks loose - const GDParser::OperatorNode *on = static_cast<const GDParser::OperatorNode *>(p_expression); + const GDScriptParser::OperatorNode *on = static_cast<const GDScriptParser::OperatorNode *>(p_expression); switch (on->op) { //call/constructor operator - case GDParser::OperatorNode::OP_PARENT_CALL: { + case GDScriptParser::OperatorNode::OP_PARENT_CALL: { ERR_FAIL_COND_V(on->arguments.size() < 1, -1); - const GDParser::IdentifierNode *in = (const GDParser::IdentifierNode *)on->arguments[0]; + const GDScriptParser::IdentifierNode *in = (const GDScriptParser::IdentifierNode *)on->arguments[0]; Vector<int> arguments; int slevel = p_stack_level; @@ -396,7 +397,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr int ret = _parse_expression(codegen, on->arguments[i], slevel); if (ret < 0) return ret; - if (ret & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -404,7 +405,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr } //push call bytecode - codegen.opcodes.push_back(GDFunction::OPCODE_CALL_SELF_BASE); // basic type constructor + codegen.opcodes.push_back(GDScriptFunction::OPCODE_CALL_SELF_BASE); // basic type constructor codegen.opcodes.push_back(codegen.get_name_map_pos(in->name)); //instance codegen.opcodes.push_back(arguments.size()); //argument count @@ -413,13 +414,13 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr codegen.opcodes.push_back(arguments[i]); //arguments } break; - case GDParser::OperatorNode::OP_CALL: { + case GDScriptParser::OperatorNode::OP_CALL: { - if (on->arguments[0]->type == GDParser::Node::TYPE_TYPE) { + if (on->arguments[0]->type == GDScriptParser::Node::TYPE_TYPE) { //construct a basic type ERR_FAIL_COND_V(on->arguments.size() < 1, -1); - const GDParser::TypeNode *tn = (const GDParser::TypeNode *)on->arguments[0]; + const GDScriptParser::TypeNode *tn = (const GDScriptParser::TypeNode *)on->arguments[0]; int vtype = tn->vtype; Vector<int> arguments; @@ -429,7 +430,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr int ret = _parse_expression(codegen, on->arguments[i], slevel); if (ret < 0) return ret; - if (ret & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -437,14 +438,14 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr } //push call bytecode - codegen.opcodes.push_back(GDFunction::OPCODE_CONSTRUCT); // basic type constructor + codegen.opcodes.push_back(GDScriptFunction::OPCODE_CONSTRUCT); // basic type constructor codegen.opcodes.push_back(vtype); //instance codegen.opcodes.push_back(arguments.size()); //argument count codegen.alloc_call(arguments.size()); for (int i = 0; i < arguments.size(); i++) codegen.opcodes.push_back(arguments[i]); //arguments - } else if (on->arguments[0]->type == GDParser::Node::TYPE_BUILT_IN_FUNCTION) { + } else if (on->arguments[0]->type == GDScriptParser::Node::TYPE_BUILT_IN_FUNCTION) { //built in function ERR_FAIL_COND_V(on->arguments.size() < 1, -1); @@ -457,7 +458,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (ret < 0) return ret; - if (ret & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -465,8 +466,8 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr arguments.push_back(ret); } - codegen.opcodes.push_back(GDFunction::OPCODE_CALL_BUILT_IN); - codegen.opcodes.push_back(static_cast<const GDParser::BuiltInFunctionNode *>(on->arguments[0])->function); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_CALL_BUILT_IN); + codegen.opcodes.push_back(static_cast<const GDScriptParser::BuiltInFunctionNode *>(on->arguments[0])->function); codegen.opcodes.push_back(on->arguments.size() - 1); codegen.alloc_call(on->arguments.size() - 1); for (int i = 0; i < arguments.size(); i++) @@ -476,9 +477,9 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr //regular function ERR_FAIL_COND_V(on->arguments.size() < 2, -1); - const GDParser::Node *instance = on->arguments[0]; + const GDScriptParser::Node *instance = on->arguments[0]; - if (instance->type == GDParser::Node::TYPE_SELF) { + if (instance->type == GDScriptParser::Node::TYPE_SELF) { //room for optimization } @@ -489,16 +490,16 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr int ret; - if (i == 0 && on->arguments[i]->type == GDParser::Node::TYPE_SELF && codegen.function_node && codegen.function_node->_static) { + if (i == 0 && on->arguments[i]->type == GDScriptParser::Node::TYPE_SELF && codegen.function_node && codegen.function_node->_static) { //static call to self - ret = (GDFunction::ADDR_TYPE_CLASS << GDFunction::ADDR_BITS); + ret = (GDScriptFunction::ADDR_TYPE_CLASS << GDScriptFunction::ADDR_BITS); } else if (i == 1) { - if (on->arguments[i]->type != GDParser::Node::TYPE_IDENTIFIER) { + if (on->arguments[i]->type != GDScriptParser::Node::TYPE_IDENTIFIER) { _set_error("Attempt to call a non-identifier.", on); return -1; } - GDParser::IdentifierNode *id = static_cast<GDParser::IdentifierNode *>(on->arguments[i]); + GDScriptParser::IdentifierNode *id = static_cast<GDScriptParser::IdentifierNode *>(on->arguments[i]); ret = codegen.get_name_map_pos(id->name); } else { @@ -506,7 +507,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr ret = _parse_expression(codegen, on->arguments[i], slevel); if (ret < 0) return ret; - if (ret & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -514,14 +515,14 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr arguments.push_back(ret); } - codegen.opcodes.push_back(p_root ? GDFunction::OPCODE_CALL : GDFunction::OPCODE_CALL_RETURN); // perform operator + codegen.opcodes.push_back(p_root ? GDScriptFunction::OPCODE_CALL : GDScriptFunction::OPCODE_CALL_RETURN); // perform operator codegen.opcodes.push_back(on->arguments.size() - 2); codegen.alloc_call(on->arguments.size() - 2); for (int i = 0; i < arguments.size(); i++) codegen.opcodes.push_back(arguments[i]); } } break; - case GDParser::OperatorNode::OP_YIELD: { + case GDScriptParser::OperatorNode::OP_YIELD: { ERR_FAIL_COND_V(on->arguments.size() && on->arguments.size() != 2, -1); @@ -532,7 +533,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr int ret = _parse_expression(codegen, on->arguments[i], slevel); if (ret < 0) return ret; - if (ret & (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS)) { + if (ret & (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS)) { slevel++; codegen.alloc_stack(slevel); } @@ -540,22 +541,22 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr } //push call bytecode - codegen.opcodes.push_back(arguments.size() == 0 ? GDFunction::OPCODE_YIELD : GDFunction::OPCODE_YIELD_SIGNAL); // basic type constructor + codegen.opcodes.push_back(arguments.size() == 0 ? GDScriptFunction::OPCODE_YIELD : GDScriptFunction::OPCODE_YIELD_SIGNAL); // basic type constructor for (int i = 0; i < arguments.size(); i++) codegen.opcodes.push_back(arguments[i]); //arguments - codegen.opcodes.push_back(GDFunction::OPCODE_YIELD_RESUME); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_YIELD_RESUME); //next will be where to place the result :) } break; //indexing operator - case GDParser::OperatorNode::OP_INDEX: - case GDParser::OperatorNode::OP_INDEX_NAMED: { + case GDScriptParser::OperatorNode::OP_INDEX: + case GDScriptParser::OperatorNode::OP_INDEX_NAMED: { ERR_FAIL_COND_V(on->arguments.size() != 2, -1); int slevel = p_stack_level; - bool named = (on->op == GDParser::OperatorNode::OP_INDEX_NAMED); + bool named = (on->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED); int from = _parse_expression(codegen, on->arguments[0], slevel); if (from < 0) @@ -563,14 +564,14 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr int index; if (named) { - if (on->arguments[0]->type == GDParser::Node::TYPE_SELF && codegen.script && codegen.function_node && !codegen.function_node->_static) { + if (on->arguments[0]->type == GDScriptParser::Node::TYPE_SELF && codegen.script && codegen.function_node && !codegen.function_node->_static) { - GDParser::IdentifierNode *identifier = static_cast<GDParser::IdentifierNode *>(on->arguments[1]); + GDScriptParser::IdentifierNode *identifier = static_cast<GDScriptParser::IdentifierNode *>(on->arguments[1]); const Map<StringName, GDScript::MemberInfo>::Element *MI = codegen.script->member_indices.find(identifier->name); #ifdef DEBUG_ENABLED if (MI && MI->get().getter == codegen.function_node->name) { - String n = static_cast<GDParser::IdentifierNode *>(on->arguments[1])->name; + String n = static_cast<GDScriptParser::IdentifierNode *>(on->arguments[1])->name; _set_error("Must use '" + n + "' instead of 'self." + n + "' in getter.", on); return -1; } @@ -578,23 +579,23 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (MI && MI->get().getter == "") { // Faster than indexing self (as if no self. had been used) - return (MI->get().index) | (GDFunction::ADDR_TYPE_MEMBER << GDFunction::ADDR_BITS); + return (MI->get().index) | (GDScriptFunction::ADDR_TYPE_MEMBER << GDScriptFunction::ADDR_BITS); } } - index = codegen.get_name_map_pos(static_cast<GDParser::IdentifierNode *>(on->arguments[1])->name); + index = codegen.get_name_map_pos(static_cast<GDScriptParser::IdentifierNode *>(on->arguments[1])->name); } else { - if (on->arguments[1]->type == GDParser::Node::TYPE_CONSTANT && static_cast<const GDParser::ConstantNode *>(on->arguments[1])->value.get_type() == Variant::STRING) { + if (on->arguments[1]->type == GDScriptParser::Node::TYPE_CONSTANT && static_cast<const GDScriptParser::ConstantNode *>(on->arguments[1])->value.get_type() == Variant::STRING) { //also, somehow, named (speed up anyway) - StringName name = static_cast<const GDParser::ConstantNode *>(on->arguments[1])->value; + StringName name = static_cast<const GDScriptParser::ConstantNode *>(on->arguments[1])->value; index = codegen.get_name_map_pos(name); named = true; } else { //regular indexing - if (from & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (from & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -605,19 +606,19 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr } } - codegen.opcodes.push_back(named ? GDFunction::OPCODE_GET_NAMED : GDFunction::OPCODE_GET); // perform operator + codegen.opcodes.push_back(named ? GDScriptFunction::OPCODE_GET_NAMED : GDScriptFunction::OPCODE_GET); // perform operator codegen.opcodes.push_back(from); // argument 1 codegen.opcodes.push_back(index); // argument 2 (unary only takes one parameter) } break; - case GDParser::OperatorNode::OP_AND: { + case GDScriptParser::OperatorNode::OP_AND: { // AND operator with early out on failure int res = _parse_expression(codegen, on->arguments[0], p_stack_level); if (res < 0) return res; - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF_NOT); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF_NOT); codegen.opcodes.push_back(res); int jump_fail_pos = codegen.opcodes.size(); codegen.opcodes.push_back(0); @@ -626,31 +627,31 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (res < 0) return res; - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF_NOT); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF_NOT); codegen.opcodes.push_back(res); int jump_fail_pos2 = codegen.opcodes.size(); codegen.opcodes.push_back(0); codegen.alloc_stack(p_stack_level); //it will be used.. - codegen.opcodes.push_back(GDFunction::OPCODE_ASSIGN_TRUE); - codegen.opcodes.push_back(p_stack_level | GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSIGN_TRUE); + codegen.opcodes.push_back(p_stack_level | GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(codegen.opcodes.size() + 3); codegen.opcodes[jump_fail_pos] = codegen.opcodes.size(); codegen.opcodes[jump_fail_pos2] = codegen.opcodes.size(); - codegen.opcodes.push_back(GDFunction::OPCODE_ASSIGN_FALSE); - codegen.opcodes.push_back(p_stack_level | GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); - return p_stack_level | GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS; + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSIGN_FALSE); + codegen.opcodes.push_back(p_stack_level | GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); + return p_stack_level | GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS; } break; - case GDParser::OperatorNode::OP_OR: { + case GDScriptParser::OperatorNode::OP_OR: { // OR operator with early out on success int res = _parse_expression(codegen, on->arguments[0], p_stack_level); if (res < 0) return res; - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF); codegen.opcodes.push_back(res); int jump_success_pos = codegen.opcodes.size(); codegen.opcodes.push_back(0); @@ -659,32 +660,32 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (res < 0) return res; - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF); codegen.opcodes.push_back(res); int jump_success_pos2 = codegen.opcodes.size(); codegen.opcodes.push_back(0); codegen.alloc_stack(p_stack_level); //it will be used.. - codegen.opcodes.push_back(GDFunction::OPCODE_ASSIGN_FALSE); - codegen.opcodes.push_back(p_stack_level | GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSIGN_FALSE); + codegen.opcodes.push_back(p_stack_level | GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(codegen.opcodes.size() + 3); codegen.opcodes[jump_success_pos] = codegen.opcodes.size(); codegen.opcodes[jump_success_pos2] = codegen.opcodes.size(); - codegen.opcodes.push_back(GDFunction::OPCODE_ASSIGN_TRUE); - codegen.opcodes.push_back(p_stack_level | GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); - return p_stack_level | GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS; + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSIGN_TRUE); + codegen.opcodes.push_back(p_stack_level | GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); + return p_stack_level | GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS; } break; // ternary operators - case GDParser::OperatorNode::OP_TERNARY_IF: { + case GDScriptParser::OperatorNode::OP_TERNARY_IF: { // x IF a ELSE y operator with early out on failure int res = _parse_expression(codegen, on->arguments[0], p_stack_level); if (res < 0) return res; - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF_NOT); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF_NOT); codegen.opcodes.push_back(res); int jump_fail_pos = codegen.opcodes.size(); codegen.opcodes.push_back(0); @@ -694,10 +695,10 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr return res; codegen.alloc_stack(p_stack_level); //it will be used.. - codegen.opcodes.push_back(GDFunction::OPCODE_ASSIGN); - codegen.opcodes.push_back(p_stack_level | GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSIGN); + codegen.opcodes.push_back(p_stack_level | GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); codegen.opcodes.push_back(res); - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); int jump_past_pos = codegen.opcodes.size(); codegen.opcodes.push_back(0); @@ -706,116 +707,116 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (res < 0) return res; - codegen.opcodes.push_back(GDFunction::OPCODE_ASSIGN); - codegen.opcodes.push_back(p_stack_level | GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSIGN); + codegen.opcodes.push_back(p_stack_level | GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); codegen.opcodes.push_back(res); codegen.opcodes[jump_past_pos] = codegen.opcodes.size(); - return p_stack_level | GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS; + return p_stack_level | GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS; } break; //unary operators - case GDParser::OperatorNode::OP_NEG: { + case GDScriptParser::OperatorNode::OP_NEG: { if (!_create_unary_operator(codegen, on, Variant::OP_NEGATE, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_NOT: { + case GDScriptParser::OperatorNode::OP_NOT: { if (!_create_unary_operator(codegen, on, Variant::OP_NOT, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_BIT_INVERT: { + case GDScriptParser::OperatorNode::OP_BIT_INVERT: { if (!_create_unary_operator(codegen, on, Variant::OP_BIT_NEGATE, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_PREINC: { + case GDScriptParser::OperatorNode::OP_PREINC: { } break; //? - case GDParser::OperatorNode::OP_PREDEC: { + case GDScriptParser::OperatorNode::OP_PREDEC: { } break; - case GDParser::OperatorNode::OP_INC: { + case GDScriptParser::OperatorNode::OP_INC: { } break; - case GDParser::OperatorNode::OP_DEC: { + case GDScriptParser::OperatorNode::OP_DEC: { } break; //binary operators (in precedence order) - case GDParser::OperatorNode::OP_IN: { + case GDScriptParser::OperatorNode::OP_IN: { if (!_create_binary_operator(codegen, on, Variant::OP_IN, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_EQUAL: { + case GDScriptParser::OperatorNode::OP_EQUAL: { if (!_create_binary_operator(codegen, on, Variant::OP_EQUAL, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_NOT_EQUAL: { + case GDScriptParser::OperatorNode::OP_NOT_EQUAL: { if (!_create_binary_operator(codegen, on, Variant::OP_NOT_EQUAL, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_LESS: { + case GDScriptParser::OperatorNode::OP_LESS: { if (!_create_binary_operator(codegen, on, Variant::OP_LESS, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_LESS_EQUAL: { + case GDScriptParser::OperatorNode::OP_LESS_EQUAL: { if (!_create_binary_operator(codegen, on, Variant::OP_LESS_EQUAL, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_GREATER: { + case GDScriptParser::OperatorNode::OP_GREATER: { if (!_create_binary_operator(codegen, on, Variant::OP_GREATER, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_GREATER_EQUAL: { + case GDScriptParser::OperatorNode::OP_GREATER_EQUAL: { if (!_create_binary_operator(codegen, on, Variant::OP_GREATER_EQUAL, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_ADD: { + case GDScriptParser::OperatorNode::OP_ADD: { if (!_create_binary_operator(codegen, on, Variant::OP_ADD, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_SUB: { + case GDScriptParser::OperatorNode::OP_SUB: { if (!_create_binary_operator(codegen, on, Variant::OP_SUBTRACT, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_MUL: { + case GDScriptParser::OperatorNode::OP_MUL: { if (!_create_binary_operator(codegen, on, Variant::OP_MULTIPLY, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_DIV: { + case GDScriptParser::OperatorNode::OP_DIV: { if (!_create_binary_operator(codegen, on, Variant::OP_DIVIDE, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_MOD: { + case GDScriptParser::OperatorNode::OP_MOD: { if (!_create_binary_operator(codegen, on, Variant::OP_MODULE, p_stack_level)) return -1; } break; - //case GDParser::OperatorNode::OP_SHIFT_LEFT: { if (!_create_binary_operator(codegen,on,Variant::OP_SHIFT_LEFT,p_stack_level)) return -1;} break; - //case GDParser::OperatorNode::OP_SHIFT_RIGHT: { if (!_create_binary_operator(codegen,on,Variant::OP_SHIFT_RIGHT,p_stack_level)) return -1;} break; - case GDParser::OperatorNode::OP_BIT_AND: { + //case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: { if (!_create_binary_operator(codegen,on,Variant::OP_SHIFT_LEFT,p_stack_level)) return -1;} break; + //case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: { if (!_create_binary_operator(codegen,on,Variant::OP_SHIFT_RIGHT,p_stack_level)) return -1;} break; + case GDScriptParser::OperatorNode::OP_BIT_AND: { if (!_create_binary_operator(codegen, on, Variant::OP_BIT_AND, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_BIT_OR: { + case GDScriptParser::OperatorNode::OP_BIT_OR: { if (!_create_binary_operator(codegen, on, Variant::OP_BIT_OR, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_BIT_XOR: { + case GDScriptParser::OperatorNode::OP_BIT_XOR: { if (!_create_binary_operator(codegen, on, Variant::OP_BIT_XOR, p_stack_level)) return -1; } break; //shift - case GDParser::OperatorNode::OP_SHIFT_LEFT: { + case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: { if (!_create_binary_operator(codegen, on, Variant::OP_SHIFT_LEFT, p_stack_level)) return -1; } break; - case GDParser::OperatorNode::OP_SHIFT_RIGHT: { + case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: { if (!_create_binary_operator(codegen, on, Variant::OP_SHIFT_RIGHT, p_stack_level)) return -1; } break; //assignment operators - case GDParser::OperatorNode::OP_ASSIGN_ADD: - case GDParser::OperatorNode::OP_ASSIGN_SUB: - case GDParser::OperatorNode::OP_ASSIGN_MUL: - case GDParser::OperatorNode::OP_ASSIGN_DIV: - case GDParser::OperatorNode::OP_ASSIGN_MOD: - case GDParser::OperatorNode::OP_ASSIGN_SHIFT_LEFT: - case GDParser::OperatorNode::OP_ASSIGN_SHIFT_RIGHT: - case GDParser::OperatorNode::OP_ASSIGN_BIT_AND: - case GDParser::OperatorNode::OP_ASSIGN_BIT_OR: - case GDParser::OperatorNode::OP_ASSIGN_BIT_XOR: - case GDParser::OperatorNode::OP_INIT_ASSIGN: - case GDParser::OperatorNode::OP_ASSIGN: { + case GDScriptParser::OperatorNode::OP_ASSIGN_ADD: + case GDScriptParser::OperatorNode::OP_ASSIGN_SUB: + case GDScriptParser::OperatorNode::OP_ASSIGN_MUL: + case GDScriptParser::OperatorNode::OP_ASSIGN_DIV: + case GDScriptParser::OperatorNode::OP_ASSIGN_MOD: + case GDScriptParser::OperatorNode::OP_ASSIGN_SHIFT_LEFT: + case GDScriptParser::OperatorNode::OP_ASSIGN_SHIFT_RIGHT: + case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_AND: + case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_OR: + case GDScriptParser::OperatorNode::OP_ASSIGN_BIT_XOR: + case GDScriptParser::OperatorNode::OP_INIT_ASSIGN: + case GDScriptParser::OperatorNode::OP_ASSIGN: { ERR_FAIL_COND_V(on->arguments.size() != 2, -1); - if (on->arguments[0]->type == GDParser::Node::TYPE_OPERATOR && (static_cast<GDParser::OperatorNode *>(on->arguments[0])->op == GDParser::OperatorNode::OP_INDEX || static_cast<GDParser::OperatorNode *>(on->arguments[0])->op == GDParser::OperatorNode::OP_INDEX_NAMED)) { + if (on->arguments[0]->type == GDScriptParser::Node::TYPE_OPERATOR && (static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX || static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED)) { //SET (chained) MODE!! #ifdef DEBUG_ENABLED - if (static_cast<GDParser::OperatorNode *>(on->arguments[0])->op == GDParser::OperatorNode::OP_INDEX_NAMED) { - const GDParser::OperatorNode *inon = static_cast<GDParser::OperatorNode *>(on->arguments[0]); + if (static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) { + const GDScriptParser::OperatorNode *inon = static_cast<GDScriptParser::OperatorNode *>(on->arguments[0]); - if (inon->arguments[0]->type == GDParser::Node::TYPE_SELF && codegen.script && codegen.function_node && !codegen.function_node->_static) { + if (inon->arguments[0]->type == GDScriptParser::Node::TYPE_SELF && codegen.script && codegen.function_node && !codegen.function_node->_static) { - const Map<StringName, GDScript::MemberInfo>::Element *MI = codegen.script->member_indices.find(static_cast<GDParser::IdentifierNode *>(inon->arguments[1])->name); + const Map<StringName, GDScript::MemberInfo>::Element *MI = codegen.script->member_indices.find(static_cast<GDScriptParser::IdentifierNode *>(inon->arguments[1])->name); if (MI && MI->get().setter == codegen.function_node->name) { - String n = static_cast<GDParser::IdentifierNode *>(inon->arguments[1])->name; + String n = static_cast<GDScriptParser::IdentifierNode *>(inon->arguments[1])->name; _set_error("Must use '" + n + "' instead of 'self." + n + "' in setter.", inon); return -1; } @@ -825,34 +826,34 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr int slevel = p_stack_level; - GDParser::OperatorNode *op = static_cast<GDParser::OperatorNode *>(on->arguments[0]); + GDScriptParser::OperatorNode *op = static_cast<GDScriptParser::OperatorNode *>(on->arguments[0]); /* Find chain of sets */ StringName assign_property; - List<GDParser::OperatorNode *> chain; + List<GDScriptParser::OperatorNode *> chain; { //create get/set chain - GDParser::OperatorNode *n = op; + GDScriptParser::OperatorNode *n = op; while (true) { chain.push_back(n); - if (n->arguments[0]->type != GDParser::Node::TYPE_OPERATOR) { + if (n->arguments[0]->type != GDScriptParser::Node::TYPE_OPERATOR) { //check for a built-in property - if (n->arguments[0]->type == GDParser::Node::TYPE_IDENTIFIER) { + if (n->arguments[0]->type == GDScriptParser::Node::TYPE_IDENTIFIER) { - GDParser::IdentifierNode *identifier = static_cast<GDParser::IdentifierNode *>(n->arguments[0]); + GDScriptParser::IdentifierNode *identifier = static_cast<GDScriptParser::IdentifierNode *>(n->arguments[0]); if (_is_class_member_property(codegen, identifier->name)) { assign_property = identifier->name; } } break; } - n = static_cast<GDParser::OperatorNode *>(n->arguments[0]); - if (n->op != GDParser::OperatorNode::OP_INDEX && n->op != GDParser::OperatorNode::OP_INDEX_NAMED) + n = static_cast<GDScriptParser::OperatorNode *>(n->arguments[0]); + if (n->op != GDScriptParser::OperatorNode::OP_INDEX && n->op != GDScriptParser::OperatorNode::OP_INDEX_NAMED) break; } } @@ -867,7 +868,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr //print_line("retval: "+itos(retval)); - if (retval & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (retval & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -881,30 +882,30 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr // in Node2D setchain.push_back(prev_pos); setchain.push_back(codegen.get_name_map_pos(assign_property)); - setchain.push_back(GDFunction::OPCODE_SET_MEMBER); + setchain.push_back(GDScriptFunction::OPCODE_SET_MEMBER); } - for (List<GDParser::OperatorNode *>::Element *E = chain.back(); E; E = E->prev()) { + for (List<GDScriptParser::OperatorNode *>::Element *E = chain.back(); E; E = E->prev()) { if (E == chain.front()) //ignore first break; - bool named = E->get()->op == GDParser::OperatorNode::OP_INDEX_NAMED; + bool named = E->get()->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED; int key_idx; if (named) { - key_idx = codegen.get_name_map_pos(static_cast<const GDParser::IdentifierNode *>(E->get()->arguments[1])->name); + key_idx = codegen.get_name_map_pos(static_cast<const GDScriptParser::IdentifierNode *>(E->get()->arguments[1])->name); //printf("named key %x\n",key_idx); } else { - if (prev_pos & (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS)) { + if (prev_pos & (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS)) { slevel++; codegen.alloc_stack(slevel); } - GDParser::Node *key = E->get()->arguments[1]; + GDScriptParser::Node *key = E->get()->arguments[1]; key_idx = _parse_expression(codegen, key, slevel); //printf("expr key %x\n",key_idx); @@ -914,12 +915,12 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (key_idx < 0) //error return key_idx; - codegen.opcodes.push_back(named ? GDFunction::OPCODE_GET_NAMED : GDFunction::OPCODE_GET); + codegen.opcodes.push_back(named ? GDScriptFunction::OPCODE_GET_NAMED : GDScriptFunction::OPCODE_GET); codegen.opcodes.push_back(prev_pos); codegen.opcodes.push_back(key_idx); slevel++; codegen.alloc_stack(slevel); - int dst_pos = (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) | slevel; + int dst_pos = (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) | slevel; codegen.opcodes.push_back(dst_pos); @@ -928,7 +929,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr setchain.push_back(dst_pos); setchain.push_back(key_idx); setchain.push_back(prev_pos); - setchain.push_back(named ? GDFunction::OPCODE_SET_NAMED : GDFunction::OPCODE_SET); + setchain.push_back(named ? GDScriptFunction::OPCODE_SET_NAMED : GDScriptFunction::OPCODE_SET); prev_pos = dst_pos; } @@ -938,9 +939,9 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr int set_index; bool named = false; - if (static_cast<const GDParser::OperatorNode *>(op)->op == GDParser::OperatorNode::OP_INDEX_NAMED) { + if (static_cast<const GDScriptParser::OperatorNode *>(op)->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) { - set_index = codegen.get_name_map_pos(static_cast<const GDParser::IdentifierNode *>(op->arguments[1])->name); + set_index = codegen.get_name_map_pos(static_cast<const GDScriptParser::IdentifierNode *>(op->arguments[1])->name); named = true; } else { @@ -951,7 +952,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (set_index < 0) //error return set_index; - if (set_index & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (set_index & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -960,7 +961,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (set_value < 0) //error return set_value; - codegen.opcodes.push_back(named ? GDFunction::OPCODE_SET_NAMED : GDFunction::OPCODE_SET); + codegen.opcodes.push_back(named ? GDScriptFunction::OPCODE_SET_NAMED : GDScriptFunction::OPCODE_SET); codegen.opcodes.push_back(prev_pos); codegen.opcodes.push_back(set_index); codegen.opcodes.push_back(set_value); @@ -972,7 +973,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr return retval; - } else if (on->arguments[0]->type == GDParser::Node::TYPE_IDENTIFIER && _is_class_member_property(codegen, static_cast<GDParser::IdentifierNode *>(on->arguments[0])->name)) { + } else if (on->arguments[0]->type == GDScriptParser::Node::TYPE_IDENTIFIER && _is_class_member_property(codegen, static_cast<GDScriptParser::IdentifierNode *>(on->arguments[0])->name)) { //assignment to member property int slevel = p_stack_level; @@ -981,24 +982,24 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (src_address < 0) return -1; - StringName name = static_cast<GDParser::IdentifierNode *>(on->arguments[0])->name; + StringName name = static_cast<GDScriptParser::IdentifierNode *>(on->arguments[0])->name; - codegen.opcodes.push_back(GDFunction::OPCODE_SET_MEMBER); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_SET_MEMBER); codegen.opcodes.push_back(codegen.get_name_map_pos(name)); codegen.opcodes.push_back(src_address); - return GDFunction::ADDR_TYPE_NIL << GDFunction::ADDR_BITS; + return GDScriptFunction::ADDR_TYPE_NIL << GDScriptFunction::ADDR_BITS; } else { //REGULAR ASSIGNMENT MODE!! int slevel = p_stack_level; - int dst_address_a = _parse_expression(codegen, on->arguments[0], slevel, false, on->op == GDParser::OperatorNode::OP_INIT_ASSIGN); + int dst_address_a = _parse_expression(codegen, on->arguments[0], slevel, false, on->op == GDScriptParser::OperatorNode::OP_INIT_ASSIGN); if (dst_address_a < 0) return -1; - if (dst_address_a & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) { + if (dst_address_a & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) { slevel++; codegen.alloc_stack(slevel); } @@ -1007,14 +1008,14 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (src_address_b < 0) return -1; - codegen.opcodes.push_back(GDFunction::OPCODE_ASSIGN); // perform operator + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSIGN); // perform operator codegen.opcodes.push_back(dst_address_a); // argument 1 codegen.opcodes.push_back(src_address_b); // argument 2 (unary only takes one parameter) return dst_address_a; //if anything, returns wathever was assigned or correct stack position } } break; - case GDParser::OperatorNode::OP_IS: { + case GDScriptParser::OperatorNode::OP_IS: { ERR_FAIL_COND_V(on->arguments.size() != 2, false); @@ -1024,14 +1025,14 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr if (src_address_a < 0) return -1; - if (src_address_a & GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) + if (src_address_a & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) slevel++; //uses stack for return, increase stack int src_address_b = _parse_expression(codegen, on->arguments[1], slevel); if (src_address_b < 0) return -1; - codegen.opcodes.push_back(GDFunction::OPCODE_EXTENDS_TEST); // perform operator + codegen.opcodes.push_back(GDScriptFunction::OPCODE_EXTENDS_TEST); // perform operator codegen.opcodes.push_back(src_address_a); // argument 1 codegen.opcodes.push_back(src_address_b); // argument 2 (unary only takes one parameter) @@ -1044,7 +1045,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr } break; } - int dst_addr = (p_stack_level) | (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); + int dst_addr = (p_stack_level) | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); codegen.opcodes.push_back(dst_addr); // append the stack level as destination address of the opcode codegen.alloc_stack(p_stack_level); return dst_addr; @@ -1060,7 +1061,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr ERR_FAIL_V(-1); //unreachable code } -Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_block, int p_stack_level, int p_break_addr, int p_continue_addr) { +Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::BlockNode *p_block, int p_stack_level, int p_break_addr, int p_continue_addr) { codegen.push_stack_identifiers(); int new_identifiers = 0; @@ -1068,28 +1069,28 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl for (int i = 0; i < p_block->statements.size(); i++) { - const GDParser::Node *s = p_block->statements[i]; + const GDScriptParser::Node *s = p_block->statements[i]; switch (s->type) { - case GDParser::Node::TYPE_NEWLINE: { + case GDScriptParser::Node::TYPE_NEWLINE: { #ifdef DEBUG_ENABLED - const GDParser::NewLineNode *nl = static_cast<const GDParser::NewLineNode *>(s); - codegen.opcodes.push_back(GDFunction::OPCODE_LINE); + const GDScriptParser::NewLineNode *nl = static_cast<const GDScriptParser::NewLineNode *>(s); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_LINE); codegen.opcodes.push_back(nl->line); codegen.current_line = nl->line; #endif } break; - case GDParser::Node::TYPE_CONTROL_FLOW: { + case GDScriptParser::Node::TYPE_CONTROL_FLOW: { // try subblocks - const GDParser::ControlFlowNode *cf = static_cast<const GDParser::ControlFlowNode *>(s); + const GDScriptParser::ControlFlowNode *cf = static_cast<const GDScriptParser::ControlFlowNode *>(s); switch (cf->cf_type) { - case GDParser::ControlFlowNode::CF_MATCH: { - GDParser::MatchNode *match = cf->match; + case GDScriptParser::ControlFlowNode::CF_MATCH: { + GDScriptParser::MatchNode *match = cf->match; - GDParser::IdentifierNode *id = memnew(GDParser::IdentifierNode); + GDScriptParser::IdentifierNode *id = memnew(GDScriptParser::IdentifierNode); id->name = "#match_value"; // var #match_value @@ -1098,8 +1099,8 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl codegen.alloc_stack(p_stack_level); new_identifiers++; - GDParser::OperatorNode *op = memnew(GDParser::OperatorNode); - op->op = GDParser::OperatorNode::OP_ASSIGN; + GDScriptParser::OperatorNode *op = memnew(GDScriptParser::OperatorNode); + op->op = GDScriptParser::OperatorNode::OP_ASSIGN; op->arguments.push_back(id); op->arguments.push_back(match->val_to_match); @@ -1109,14 +1110,14 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl } // break address - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(codegen.opcodes.size() + 3); int break_addr = codegen.opcodes.size(); - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(0); // break addr for (int j = 0; j < match->compiled_pattern_branches.size(); j++) { - GDParser::MatchNode::CompiledPatternBranch branch = match->compiled_pattern_branches[j]; + GDScriptParser::MatchNode::CompiledPatternBranch branch = match->compiled_pattern_branches[j]; // jump over continue // jump unconditionally @@ -1127,11 +1128,11 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl return ERR_PARSE_ERROR; } - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF); codegen.opcodes.push_back(ret); codegen.opcodes.push_back(codegen.opcodes.size() + 3); int continue_addr = codegen.opcodes.size(); - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(0); Error err = _parse_block(codegen, branch.body, p_stack_level, p_break_addr, continue_addr); @@ -1139,7 +1140,7 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl return ERR_PARSE_ERROR; } - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(break_addr); codegen.opcodes[continue_addr + 1] = codegen.opcodes.size(); @@ -1149,10 +1150,10 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl } break; - case GDParser::ControlFlowNode::CF_IF: { + case GDScriptParser::ControlFlowNode::CF_IF: { #ifdef DEBUG_ENABLED - codegen.opcodes.push_back(GDFunction::OPCODE_LINE); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_LINE); codegen.opcodes.push_back(cf->line); codegen.current_line = cf->line; #endif @@ -1160,7 +1161,7 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl if (ret < 0) return ERR_PARSE_ERROR; - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF_NOT); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF_NOT); codegen.opcodes.push_back(ret); int else_addr = codegen.opcodes.size(); codegen.opcodes.push_back(0); //temporary @@ -1171,7 +1172,7 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl if (cf->body_else) { - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); int end_addr = codegen.opcodes.size(); codegen.opcodes.push_back(0); codegen.opcodes[else_addr] = codegen.opcodes.size(); @@ -1187,42 +1188,42 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl } } break; - case GDParser::ControlFlowNode::CF_FOR: { + case GDScriptParser::ControlFlowNode::CF_FOR: { int slevel = p_stack_level; int iter_stack_pos = slevel; - int iterator_pos = (slevel++) | (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); - int counter_pos = (slevel++) | (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); - int container_pos = (slevel++) | (GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS); + int iterator_pos = (slevel++) | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); + int counter_pos = (slevel++) | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); + int container_pos = (slevel++) | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); codegen.alloc_stack(slevel); codegen.push_stack_identifiers(); - codegen.add_stack_identifier(static_cast<const GDParser::IdentifierNode *>(cf->arguments[0])->name, iter_stack_pos); + codegen.add_stack_identifier(static_cast<const GDScriptParser::IdentifierNode *>(cf->arguments[0])->name, iter_stack_pos); int ret = _parse_expression(codegen, cf->arguments[1], slevel, false); if (ret < 0) return ERR_COMPILATION_FAILED; //assign container - codegen.opcodes.push_back(GDFunction::OPCODE_ASSIGN); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSIGN); codegen.opcodes.push_back(container_pos); codegen.opcodes.push_back(ret); //begin loop - codegen.opcodes.push_back(GDFunction::OPCODE_ITERATE_BEGIN); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ITERATE_BEGIN); codegen.opcodes.push_back(counter_pos); codegen.opcodes.push_back(container_pos); codegen.opcodes.push_back(codegen.opcodes.size() + 4); codegen.opcodes.push_back(iterator_pos); - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); //skip code for next + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); //skip code for next codegen.opcodes.push_back(codegen.opcodes.size() + 8); //break loop int break_pos = codegen.opcodes.size(); - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); //skip code for next + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); //skip code for next codegen.opcodes.push_back(0); //skip code for next //next loop int continue_pos = codegen.opcodes.size(); - codegen.opcodes.push_back(GDFunction::OPCODE_ITERATE); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ITERATE); codegen.opcodes.push_back(counter_pos); codegen.opcodes.push_back(container_pos); codegen.opcodes.push_back(break_pos); @@ -1232,52 +1233,52 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl if (err) return err; - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(continue_pos); codegen.opcodes[break_pos + 1] = codegen.opcodes.size(); codegen.pop_stack_identifiers(); } break; - case GDParser::ControlFlowNode::CF_WHILE: { + case GDScriptParser::ControlFlowNode::CF_WHILE: { - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(codegen.opcodes.size() + 3); int break_addr = codegen.opcodes.size(); - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(0); int continue_addr = codegen.opcodes.size(); int ret = _parse_expression(codegen, cf->arguments[0], p_stack_level, false); if (ret < 0) return ERR_PARSE_ERROR; - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_IF_NOT); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_IF_NOT); codegen.opcodes.push_back(ret); codegen.opcodes.push_back(break_addr); Error err = _parse_block(codegen, cf->body, p_stack_level, break_addr, continue_addr); if (err) return err; - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(continue_addr); codegen.opcodes[break_addr + 1] = codegen.opcodes.size(); } break; - case GDParser::ControlFlowNode::CF_SWITCH: { + case GDScriptParser::ControlFlowNode::CF_SWITCH: { } break; - case GDParser::ControlFlowNode::CF_BREAK: { + case GDScriptParser::ControlFlowNode::CF_BREAK: { if (p_break_addr < 0) { _set_error("'break'' not within loop", cf); return ERR_COMPILATION_FAILED; } - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(p_break_addr); } break; - case GDParser::ControlFlowNode::CF_CONTINUE: { + case GDScriptParser::ControlFlowNode::CF_CONTINUE: { if (p_continue_addr < 0) { @@ -1285,11 +1286,11 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl return ERR_COMPILATION_FAILED; } - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP); codegen.opcodes.push_back(p_continue_addr); } break; - case GDParser::ControlFlowNode::CF_RETURN: { + case GDScriptParser::ControlFlowNode::CF_RETURN: { int ret; @@ -1301,38 +1302,38 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl } else { - ret = GDFunction::ADDR_TYPE_NIL << GDFunction::ADDR_BITS; + ret = GDScriptFunction::ADDR_TYPE_NIL << GDScriptFunction::ADDR_BITS; } - codegen.opcodes.push_back(GDFunction::OPCODE_RETURN); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_RETURN); codegen.opcodes.push_back(ret); } break; } } break; - case GDParser::Node::TYPE_ASSERT: { + case GDScriptParser::Node::TYPE_ASSERT: { #ifdef DEBUG_ENABLED // try subblocks - const GDParser::AssertNode *as = static_cast<const GDParser::AssertNode *>(s); + const GDScriptParser::AssertNode *as = static_cast<const GDScriptParser::AssertNode *>(s); int ret = _parse_expression(codegen, as->condition, p_stack_level, false); if (ret < 0) return ERR_PARSE_ERROR; - codegen.opcodes.push_back(GDFunction::OPCODE_ASSERT); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_ASSERT); codegen.opcodes.push_back(ret); #endif } break; - case GDParser::Node::TYPE_BREAKPOINT: { + case GDScriptParser::Node::TYPE_BREAKPOINT: { #ifdef DEBUG_ENABLED // try subblocks - codegen.opcodes.push_back(GDFunction::OPCODE_BREAKPOINT); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_BREAKPOINT); #endif } break; - case GDParser::Node::TYPE_LOCAL_VAR: { + case GDScriptParser::Node::TYPE_LOCAL_VAR: { - const GDParser::LocalVarNode *lv = static_cast<const GDParser::LocalVarNode *>(s); + const GDScriptParser::LocalVarNode *lv = static_cast<const GDScriptParser::LocalVarNode *>(s); if (_is_class_member_property(codegen, lv->name)) { _set_error("Name for local variable '" + String(lv->name) + "' can't shadow class property of the same name.", lv); @@ -1356,7 +1357,7 @@ Error GDCompiler::_parse_block(CodeGen &codegen, const GDParser::BlockNode *p_bl return OK; } -Error GDCompiler::_parse_function(GDScript *p_script, const GDParser::ClassNode *p_class, const GDParser::FunctionNode *p_func, bool p_for_ready) { +Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser::ClassNode *p_class, const GDScriptParser::FunctionNode *p_func, bool p_for_ready) { Vector<int> bytecode; CodeGen codegen; @@ -1397,10 +1398,10 @@ Error GDCompiler::_parse_function(GDScript *p_script, const GDParser::ClassNode if (!p_func && p_class->extends_used && p_script->native.is_null()) { //call implicit parent constructor - codegen.opcodes.push_back(GDFunction::OPCODE_CALL_SELF_BASE); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_CALL_SELF_BASE); codegen.opcodes.push_back(codegen.get_name_map_pos("_init")); codegen.opcodes.push_back(0); - codegen.opcodes.push_back((GDFunction::ADDR_TYPE_STACK << GDFunction::ADDR_BITS) | 0); + codegen.opcodes.push_back((GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) | 0); } Error err = _parse_block(codegen, p_class->initializer, stack_level); if (err) @@ -1426,7 +1427,7 @@ Error GDCompiler::_parse_function(GDScript *p_script, const GDParser::ClassNode if (p_func->default_values.size()) { - codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_TO_DEF_ARGUMENT); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_JUMP_TO_DEF_ARGUMENT); defarg_addr.push_back(codegen.opcodes.size()); for (int i = 0; i < p_func->default_values.size(); i++) { @@ -1449,15 +1450,15 @@ Error GDCompiler::_parse_function(GDScript *p_script, const GDParser::ClassNode func_name = "_init"; } - codegen.opcodes.push_back(GDFunction::OPCODE_END); + codegen.opcodes.push_back(GDScriptFunction::OPCODE_END); /* if (String(p_func->name)=="") { //initializer func gdfunc = &p_script->initializer; */ //} else { //regular func - p_script->member_functions[func_name] = memnew(GDFunction); - GDFunction *gdfunc = p_script->member_functions[func_name]; + p_script->member_functions[func_name] = memnew(GDScriptFunction); + GDScriptFunction *gdfunc = p_script->member_functions[func_name]; //} if (p_func) { @@ -1579,7 +1580,7 @@ Error GDCompiler::_parse_function(GDScript *p_script, const GDParser::ClassNode return OK; } -Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDParser::ClassNode *p_class, bool p_keep_state) { +Error GDScriptCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDScriptParser::ClassNode *p_class, bool p_keep_state) { Map<StringName, Ref<GDScript> > old_subclasses; @@ -1587,12 +1588,12 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa old_subclasses = p_script->subclasses; } - p_script->native = Ref<GDNativeClass>(); + p_script->native = Ref<GDScriptNativeClass>(); p_script->base = Ref<GDScript>(); p_script->_base = NULL; p_script->members.clear(); p_script->constants.clear(); - for (Map<StringName, GDFunction *>::Element *E = p_script->member_functions.front(); E; E = E->next()) { + for (Map<StringName, GDScriptFunction *>::Element *E = p_script->member_functions.front(); E; E = E->next()) { memdelete(E->get()); } p_script->member_functions.clear(); @@ -1606,7 +1607,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa p_script->tool = p_class->tool; p_script->name = p_class->name; - Ref<GDNativeClass> native; + Ref<GDScriptNativeClass> native; if (p_class->extends_used) { //do inheritance @@ -1801,14 +1802,14 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa for (int i = 0; i < p_class->constant_expressions.size(); i++) { StringName name = p_class->constant_expressions[i].identifier; - ERR_CONTINUE(p_class->constant_expressions[i].expression->type != GDParser::Node::TYPE_CONSTANT); + ERR_CONTINUE(p_class->constant_expressions[i].expression->type != GDScriptParser::Node::TYPE_CONSTANT); if (_is_class_member_property(p_script, name)) { _set_error("Member '" + name + "' already exists as a class property.", p_class); return ERR_ALREADY_EXISTS; } - GDParser::ConstantNode *constant = static_cast<GDParser::ConstantNode *>(p_class->constant_expressions[i].expression); + GDScriptParser::ConstantNode *constant = static_cast<GDScriptParser::ConstantNode *>(p_class->constant_expressions[i].expression); p_script->constants.insert(name, constant->value); //p_script->constants[constant->value].make_const(); @@ -1917,7 +1918,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa for (int i = 0; i < p_class->variables.size(); i++) { if (p_class->variables[i].setter) { - const Map<StringName, GDFunction *>::Element *E = p_script->get_member_functions().find(p_class->variables[i].setter); + const Map<StringName, GDScriptFunction *>::Element *E = p_script->get_member_functions().find(p_class->variables[i].setter); if (!E) { _set_error("Setter function '" + String(p_class->variables[i].setter) + "' not found in class.", NULL); err_line = p_class->variables[i].line; @@ -1934,7 +1935,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa } } if (p_class->variables[i].getter) { - const Map<StringName, GDFunction *>::Element *E = p_script->get_member_functions().find(p_class->variables[i].getter); + const Map<StringName, GDScriptFunction *>::Element *E = p_script->get_member_functions().find(p_class->variables[i].getter); if (!E) { _set_error("Getter function '" + String(p_class->variables[i].getter) + "' not found in class.", NULL); err_line = p_class->variables[i].line; @@ -1970,7 +1971,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa //re-create as an instance p_script->placeholders.erase(psi); //remove placeholder - GDInstance *instance = memnew(GDInstance); + GDScriptInstance *instance = memnew(GDScriptInstance); instance->base_ref = Object::cast_to<Reference>(E->get()); instance->members.resize(p_script->member_indices.size()); instance->script = Ref<GDScript>(p_script); @@ -1994,7 +1995,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa #endif } else { - GDInstance *gi = static_cast<GDInstance *>(si); + GDScriptInstance *gi = static_cast<GDScriptInstance *>(si); gi->reload_members(); } @@ -2007,18 +2008,18 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa return OK; } -Error GDCompiler::compile(const GDParser *p_parser, GDScript *p_script, bool p_keep_state) { +Error GDScriptCompiler::compile(const GDScriptParser *p_parser, GDScript *p_script, bool p_keep_state) { err_line = -1; err_column = -1; error = ""; parser = p_parser; - const GDParser::Node *root = parser->get_parse_tree(); - ERR_FAIL_COND_V(root->type != GDParser::Node::TYPE_CLASS, ERR_INVALID_DATA); + const GDScriptParser::Node *root = parser->get_parse_tree(); + ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, ERR_INVALID_DATA); source = p_script->get_path(); - Error err = _parse_class(p_script, NULL, static_cast<const GDParser::ClassNode *>(root), p_keep_state); + Error err = _parse_class(p_script, NULL, static_cast<const GDScriptParser::ClassNode *>(root), p_keep_state); if (err) return err; @@ -2026,18 +2027,18 @@ Error GDCompiler::compile(const GDParser *p_parser, GDScript *p_script, bool p_k return OK; } -String GDCompiler::get_error() const { +String GDScriptCompiler::get_error() const { return error; } -int GDCompiler::get_error_line() const { +int GDScriptCompiler::get_error_line() const { return err_line; } -int GDCompiler::get_error_column() const { +int GDScriptCompiler::get_error_column() const { return err_column; } -GDCompiler::GDCompiler() { +GDScriptCompiler::GDScriptCompiler() { } diff --git a/modules/gdscript/gd_compiler.h b/modules/gdscript/gdscript_compiler.h index ac713ae75b..6e0457ba30 100644 --- a/modules/gdscript/gd_compiler.h +++ b/modules/gdscript/gdscript_compiler.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_compiler.h */ +/* gdscript_compiler.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,26 +27,26 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GD_COMPILER_H -#define GD_COMPILER_H +#ifndef GDSCRIPT_COMPILER_H +#define GDSCRIPT_COMPILER_H -#include "gd_parser.h" -#include "gd_script.h" +#include "gdscript.h" +#include "gdscript_parser.h" -class GDCompiler { +class GDScriptCompiler { - const GDParser *parser; + const GDScriptParser *parser; struct CodeGen { GDScript *script; - const GDParser::ClassNode *class_node; - const GDParser::FunctionNode *function_node; + const GDScriptParser::ClassNode *class_node; + const GDScriptParser::FunctionNode *function_node; bool debug_stack; List<Map<StringName, int> > stack_id_stack; Map<StringName, int> stack_identifiers; - List<GDFunction::StackDebug> stack_debug; + List<GDScriptFunction::StackDebug> stack_debug; List<Map<StringName, int> > block_identifier_stack; Map<StringName, int> block_identifiers; @@ -54,7 +54,7 @@ class GDCompiler { stack_identifiers[p_id] = p_stackpos; if (debug_stack) { block_identifiers[p_id] = p_stackpos; - GDFunction::StackDebug sd; + GDScriptFunction::StackDebug sd; sd.added = true; sd.line = current_line; sd.identifier = p_id; @@ -79,7 +79,7 @@ class GDCompiler { if (debug_stack) { for (Map<StringName, int>::Element *E = block_identifiers.front(); E; E = E->next()) { - GDFunction::StackDebug sd; + GDScriptFunction::StackDebug sd; sd.added = false; sd.identifier = E->key(); sd.line = current_line; @@ -129,29 +129,29 @@ class GDCompiler { bool _is_class_member_property(CodeGen &codegen, const StringName &p_name); bool _is_class_member_property(GDScript *owner, const StringName &p_name); - void _set_error(const String &p_error, const GDParser::Node *p_node); + void _set_error(const String &p_error, const GDScriptParser::Node *p_node); - bool _create_unary_operator(CodeGen &codegen, const GDParser::OperatorNode *on, Variant::Operator op, int p_stack_level); - bool _create_binary_operator(CodeGen &codegen, const GDParser::OperatorNode *on, Variant::Operator op, int p_stack_level, bool p_initializer = false); + bool _create_unary_operator(CodeGen &codegen, const GDScriptParser::OperatorNode *on, Variant::Operator op, int p_stack_level); + bool _create_binary_operator(CodeGen &codegen, const GDScriptParser::OperatorNode *on, Variant::Operator op, int p_stack_level, bool p_initializer = false); - int _parse_assign_right_expression(CodeGen &codegen, const GDParser::OperatorNode *p_expression, int p_stack_level); - int _parse_expression(CodeGen &codegen, const GDParser::Node *p_expression, int p_stack_level, bool p_root = false, bool p_initializer = false); - Error _parse_block(CodeGen &codegen, const GDParser::BlockNode *p_block, int p_stack_level = 0, int p_break_addr = -1, int p_continue_addr = -1); - Error _parse_function(GDScript *p_script, const GDParser::ClassNode *p_class, const GDParser::FunctionNode *p_func, bool p_for_ready = false); - Error _parse_class(GDScript *p_script, GDScript *p_owner, const GDParser::ClassNode *p_class, bool p_keep_state); + int _parse_assign_right_expression(CodeGen &codegen, const GDScriptParser::OperatorNode *p_expression, int p_stack_level); + int _parse_expression(CodeGen &codegen, const GDScriptParser::Node *p_expression, int p_stack_level, bool p_root = false, bool p_initializer = false); + Error _parse_block(CodeGen &codegen, const GDScriptParser::BlockNode *p_block, int p_stack_level = 0, int p_break_addr = -1, int p_continue_addr = -1); + Error _parse_function(GDScript *p_script, const GDScriptParser::ClassNode *p_class, const GDScriptParser::FunctionNode *p_func, bool p_for_ready = false); + Error _parse_class(GDScript *p_script, GDScript *p_owner, const GDScriptParser::ClassNode *p_class, bool p_keep_state); int err_line; int err_column; StringName source; String error; public: - Error compile(const GDParser *p_parser, GDScript *p_script, bool p_keep_state = false); + Error compile(const GDScriptParser *p_parser, GDScript *p_script, bool p_keep_state = false); String get_error() const; int get_error_line() const; int get_error_column() const; - GDCompiler(); + GDScriptCompiler(); }; -#endif // COMPILER_H +#endif // GDSCRIPT_COMPILER_H diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 655e785174..a74b8a8483 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_editor.cpp */ +/* gdscript_editor.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,10 +27,10 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "gd_script.h" +#include "gdscript.h" #include "editor/editor_settings.h" -#include "gd_compiler.h" +#include "gdscript_compiler.h" #include "global_constants.h" #include "os/file_access.h" #include "project_settings.h" @@ -92,7 +92,7 @@ void GDScriptLanguage::make_template(const String &p_class_name, const String &p bool GDScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const { - GDParser parser; + GDScriptParser parser; Error err = parser.parse(p_script, p_path.get_base_dir(), true, p_path); if (err) { @@ -102,10 +102,10 @@ bool GDScriptLanguage::validate(const String &p_script, int &r_line_error, int & return false; } else { - const GDParser::Node *root = parser.get_parse_tree(); - ERR_FAIL_COND_V(root->type != GDParser::Node::TYPE_CLASS, false); + const GDScriptParser::Node *root = parser.get_parse_tree(); + ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, false); - const GDParser::ClassNode *cl = static_cast<const GDParser::ClassNode *>(root); + const GDScriptParser::ClassNode *cl = static_cast<const GDScriptParser::ClassNode *>(root); Map<int, String> funcs; for (int i = 0; i < cl->functions.size(); i++) { @@ -138,16 +138,16 @@ bool GDScriptLanguage::supports_builtin_mode() const { int GDScriptLanguage::find_function(const String &p_function, const String &p_code) const { - GDTokenizerText tokenizer; + GDScriptTokenizerText tokenizer; tokenizer.set_code(p_code); int indent = 0; - while (tokenizer.get_token() != GDTokenizer::TK_EOF && tokenizer.get_token() != GDTokenizer::TK_ERROR) { + while (tokenizer.get_token() != GDScriptTokenizer::TK_EOF && tokenizer.get_token() != GDScriptTokenizer::TK_ERROR) { - if (tokenizer.get_token() == GDTokenizer::TK_NEWLINE) { + if (tokenizer.get_token() == GDScriptTokenizer::TK_NEWLINE) { indent = tokenizer.get_token_line_indent(); } - //print_line("TOKEN: "+String(GDTokenizer::get_token_name(tokenizer.get_token()))); - if (indent == 0 && tokenizer.get_token() == GDTokenizer::TK_PR_FUNCTION && tokenizer.get_token(1) == GDTokenizer::TK_IDENTIFIER) { + //print_line("TOKEN: "+String(GDScriptTokenizer::get_token_name(tokenizer.get_token()))); + if (indent == 0 && tokenizer.get_token() == GDScriptTokenizer::TK_PR_FUNCTION && tokenizer.get_token(1) == GDScriptTokenizer::TK_IDENTIFIER) { String identifier = tokenizer.get_token_identifier(1); if (identifier == p_function) { @@ -155,7 +155,7 @@ int GDScriptLanguage::find_function(const String &p_function, const String &p_co } } tokenizer.advance(); - //print_line("NEXT: "+String(GDTokenizer::get_token_name(tokenizer.get_token()))); + //print_line("NEXT: "+String(GDScriptTokenizer::get_token_name(tokenizer.get_token()))); } return -1; } @@ -245,7 +245,7 @@ void GDScriptLanguage::debug_get_stack_level_locals(int p_level, List<String> *p ERR_FAIL_INDEX(p_level, _debug_call_stack_pos); int l = _debug_call_stack_pos - p_level - 1; - GDFunction *f = _call_stack[l].function; + GDScriptFunction *f = _call_stack[l].function; List<Pair<StringName, int> > locals; @@ -264,7 +264,7 @@ void GDScriptLanguage::debug_get_stack_level_members(int p_level, List<String> * ERR_FAIL_INDEX(p_level, _debug_call_stack_pos); int l = _debug_call_stack_pos - p_level - 1; - GDInstance *instance = _call_stack[l].instance; + GDScriptInstance *instance = _call_stack[l].instance; if (!instance) return; @@ -298,9 +298,9 @@ void GDScriptLanguage::get_recognized_extensions(List<String> *p_extensions) con void GDScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const { - for (int i = 0; i < GDFunctions::FUNC_MAX; i++) { + for (int i = 0; i < GDScriptFunctions::FUNC_MAX; i++) { - p_functions->push_back(GDFunctions::get_info(GDFunctions::Function(i))); + p_functions->push_back(GDScriptFunctions::get_info(GDScriptFunctions::Function(i))); } //not really "functions", but.. @@ -318,7 +318,7 @@ void GDScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const mi.arguments.push_back(PropertyInfo(Variant::STRING, "signal")); mi.default_arguments.push_back(Variant::NIL); mi.default_arguments.push_back(Variant::STRING); - mi.return_val = PropertyInfo(Variant::OBJECT, "", PROPERTY_HINT_RESOURCE_TYPE, "GDFunctionState"); + mi.return_val = PropertyInfo(Variant::OBJECT, "", PROPERTY_HINT_RESOURCE_TYPE, "GDScriptFunctionState"); p_functions->push_back(mi); } { @@ -372,7 +372,7 @@ String GDScriptLanguage::make_function(const String &p_class, const String &p_na #if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED) -struct GDCompletionIdentifier { +struct GDScriptCompletionIdentifier { String enumeration; StringName obj_type; @@ -381,17 +381,17 @@ struct GDCompletionIdentifier { Variant value; //im case there is a value, also return it }; -static GDCompletionIdentifier _get_type_from_variant(const Variant &p_variant, bool p_allow_gdnative_class = false) { +static GDScriptCompletionIdentifier _get_type_from_variant(const Variant &p_variant, bool p_allow_gdnative_class = false) { - GDCompletionIdentifier t; + GDScriptCompletionIdentifier t; t.type = p_variant.get_type(); t.value = p_variant; if (p_variant.get_type() == Variant::OBJECT) { Object *obj = p_variant; if (obj) { - if (p_allow_gdnative_class && Object::cast_to<GDNativeClass>(obj)) { - t.obj_type = Object::cast_to<GDNativeClass>(obj)->get_name(); + if (p_allow_gdnative_class && Object::cast_to<GDScriptNativeClass>(obj)) { + t.obj_type = Object::cast_to<GDScriptNativeClass>(obj)->get_name(); t.value = Variant(); } else { @@ -402,9 +402,9 @@ static GDCompletionIdentifier _get_type_from_variant(const Variant &p_variant, b return t; } -static GDCompletionIdentifier _get_type_from_pinfo(const PropertyInfo &p_info) { +static GDScriptCompletionIdentifier _get_type_from_pinfo(const PropertyInfo &p_info) { - GDCompletionIdentifier t; + GDScriptCompletionIdentifier t; t.type = p_info.type; if (p_info.hint == PROPERTY_HINT_RESOURCE_TYPE) { t.obj_type = p_info.hint_string; @@ -412,23 +412,23 @@ static GDCompletionIdentifier _get_type_from_pinfo(const PropertyInfo &p_info) { return t; } -struct GDCompletionContext { +struct GDScriptCompletionContext { - const GDParser::ClassNode *_class; - const GDParser::FunctionNode *function; - const GDParser::BlockNode *block; + const GDScriptParser::ClassNode *_class; + const GDScriptParser::FunctionNode *function; + const GDScriptParser::BlockNode *block; Object *base; String base_path; }; -static Ref<Reference> _get_parent_class(GDCompletionContext &context) { +static Ref<Reference> _get_parent_class(GDScriptCompletionContext &context) { if (context._class->extends_used) { //do inheritance String path = context._class->extends_file; Ref<GDScript> script; - Ref<GDNativeClass> native; + Ref<GDScriptNativeClass> native; if (path != "") { //path (and optionally subclasses) @@ -498,17 +498,17 @@ static Ref<Reference> _get_parent_class(GDCompletionContext &context) { return Ref<Reference>(); } -static GDCompletionIdentifier _get_native_class(GDCompletionContext &context) { +static GDScriptCompletionIdentifier _get_native_class(GDScriptCompletionContext &context) { //eeh... - GDCompletionIdentifier id; + GDScriptCompletionIdentifier id; id.type = Variant::NIL; REF pc = _get_parent_class(context); if (!pc.is_valid()) { return id; } - Ref<GDNativeClass> nc = pc; + Ref<GDScriptNativeClass> nc = pc; Ref<GDScript> s = pc; if (s.is_null() && nc.is_null()) { @@ -529,28 +529,28 @@ static GDCompletionIdentifier _get_native_class(GDCompletionContext &context) { return id; } -static bool _guess_identifier_type(GDCompletionContext &context, int p_line, const StringName &p_identifier, GDCompletionIdentifier &r_type, bool p_for_indexing); +static bool _guess_identifier_type(GDScriptCompletionContext &context, int p_line, const StringName &p_identifier, GDScriptCompletionIdentifier &r_type, bool p_for_indexing); -static bool _guess_expression_type(GDCompletionContext &context, const GDParser::Node *p_node, int p_line, GDCompletionIdentifier &r_type, bool p_for_indexing = false) { +static bool _guess_expression_type(GDScriptCompletionContext &context, const GDScriptParser::Node *p_node, int p_line, GDScriptCompletionIdentifier &r_type, bool p_for_indexing = false) { - if (p_node->type == GDParser::Node::TYPE_CONSTANT) { + if (p_node->type == GDScriptParser::Node::TYPE_CONSTANT) { - const GDParser::ConstantNode *cn = static_cast<const GDParser::ConstantNode *>(p_node); + const GDScriptParser::ConstantNode *cn = static_cast<const GDScriptParser::ConstantNode *>(p_node); r_type = _get_type_from_variant(cn->value); return true; - } else if (p_node->type == GDParser::Node::TYPE_DICTIONARY) { + } else if (p_node->type == GDScriptParser::Node::TYPE_DICTIONARY) { r_type.type = Variant::DICTIONARY; //what the heck, fill it anyway - const GDParser::DictionaryNode *an = static_cast<const GDParser::DictionaryNode *>(p_node); + const GDScriptParser::DictionaryNode *an = static_cast<const GDScriptParser::DictionaryNode *>(p_node); Dictionary d; for (int i = 0; i < an->elements.size(); i++) { - GDCompletionIdentifier k; + GDScriptCompletionIdentifier k; if (_guess_expression_type(context, an->elements[i].key, p_line, k) && k.value.get_type() != Variant::NIL) { - GDCompletionIdentifier v; + GDScriptCompletionIdentifier v; if (_guess_expression_type(context, an->elements[i].value, p_line, v)) { d[k.value] = v.value; } @@ -558,15 +558,15 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: } r_type.value = d; return true; - } else if (p_node->type == GDParser::Node::TYPE_ARRAY) { + } else if (p_node->type == GDScriptParser::Node::TYPE_ARRAY) { r_type.type = Variant::ARRAY; //what the heck, fill it anyway - const GDParser::ArrayNode *an = static_cast<const GDParser::ArrayNode *>(p_node); + const GDScriptParser::ArrayNode *an = static_cast<const GDScriptParser::ArrayNode *>(p_node); Array arr; arr.resize(an->elements.size()); for (int i = 0; i < an->elements.size(); i++) { - GDCompletionIdentifier ci; + GDScriptCompletionIdentifier ci; if (_guess_expression_type(context, an->elements[i], p_line, ci)) { arr[i] = ci.value; } @@ -574,44 +574,44 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: r_type.value = arr; return true; - } else if (p_node->type == GDParser::Node::TYPE_BUILT_IN_FUNCTION) { + } else if (p_node->type == GDScriptParser::Node::TYPE_BUILT_IN_FUNCTION) { - MethodInfo mi = GDFunctions::get_info(static_cast<const GDParser::BuiltInFunctionNode *>(p_node)->function); + MethodInfo mi = GDScriptFunctions::get_info(static_cast<const GDScriptParser::BuiltInFunctionNode *>(p_node)->function); r_type = _get_type_from_pinfo(mi.return_val); return true; - } else if (p_node->type == GDParser::Node::TYPE_IDENTIFIER) { + } else if (p_node->type == GDScriptParser::Node::TYPE_IDENTIFIER) { - return _guess_identifier_type(context, p_line - 1, static_cast<const GDParser::IdentifierNode *>(p_node)->name, r_type, p_for_indexing); - } else if (p_node->type == GDParser::Node::TYPE_SELF) { + return _guess_identifier_type(context, p_line - 1, static_cast<const GDScriptParser::IdentifierNode *>(p_node)->name, r_type, p_for_indexing); + } else if (p_node->type == GDScriptParser::Node::TYPE_SELF) { //eeh... r_type = _get_native_class(context); return r_type.type != Variant::NIL; - } else if (p_node->type == GDParser::Node::TYPE_OPERATOR) { + } else if (p_node->type == GDScriptParser::Node::TYPE_OPERATOR) { - const GDParser::OperatorNode *op = static_cast<const GDParser::OperatorNode *>(p_node); - if (op->op == GDParser::OperatorNode::OP_CALL) { + const GDScriptParser::OperatorNode *op = static_cast<const GDScriptParser::OperatorNode *>(p_node); + if (op->op == GDScriptParser::OperatorNode::OP_CALL) { - if (op->arguments[0]->type == GDParser::Node::TYPE_TYPE) { + if (op->arguments[0]->type == GDScriptParser::Node::TYPE_TYPE) { - const GDParser::TypeNode *tn = static_cast<const GDParser::TypeNode *>(op->arguments[0]); + const GDScriptParser::TypeNode *tn = static_cast<const GDScriptParser::TypeNode *>(op->arguments[0]); r_type.type = tn->vtype; return true; - } else if (op->arguments[0]->type == GDParser::Node::TYPE_BUILT_IN_FUNCTION) { + } else if (op->arguments[0]->type == GDScriptParser::Node::TYPE_BUILT_IN_FUNCTION) { - const GDParser::BuiltInFunctionNode *bin = static_cast<const GDParser::BuiltInFunctionNode *>(op->arguments[0]); + const GDScriptParser::BuiltInFunctionNode *bin = static_cast<const GDScriptParser::BuiltInFunctionNode *>(op->arguments[0]); return _guess_expression_type(context, bin, p_line, r_type); - } else if (op->arguments.size() > 1 && op->arguments[1]->type == GDParser::Node::TYPE_IDENTIFIER) { + } else if (op->arguments.size() > 1 && op->arguments[1]->type == GDScriptParser::Node::TYPE_IDENTIFIER) { - StringName id = static_cast<const GDParser::IdentifierNode *>(op->arguments[1])->name; + StringName id = static_cast<const GDScriptParser::IdentifierNode *>(op->arguments[1])->name; - if (op->arguments[0]->type == GDParser::Node::TYPE_IDENTIFIER && String(id) == "new") { + if (op->arguments[0]->type == GDScriptParser::Node::TYPE_IDENTIFIER && String(id) == "new") { //shortcut - StringName identifier = static_cast<const GDParser::IdentifierNode *>(op->arguments[0])->name; + StringName identifier = static_cast<const GDScriptParser::IdentifierNode *>(op->arguments[0])->name; if (ClassDB::class_exists(identifier)) { r_type.type = Variant::OBJECT; @@ -621,7 +621,7 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: } } - GDCompletionIdentifier base; + GDScriptCompletionIdentifier base; if (!_guess_expression_type(context, op->arguments[0], p_line, base)) return false; @@ -630,8 +630,8 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: if (id.operator String() == "new" && base.value.get_type() == Variant::OBJECT) { Object *obj = base.value; - if (obj && Object::cast_to<GDNativeClass>(obj)) { - GDNativeClass *gdnc = Object::cast_to<GDNativeClass>(obj); + if (obj && Object::cast_to<GDScriptNativeClass>(obj)) { + GDScriptNativeClass *gdnc = Object::cast_to<GDScriptNativeClass>(obj); r_type.type = Variant::OBJECT; r_type.value = Variant(); r_type.obj_type = gdnc->get_name(); @@ -662,7 +662,7 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: bool all_valid = true; Vector<Variant> args; for (int i = 2; i < op->arguments.size(); i++) { - GDCompletionIdentifier arg; + GDScriptCompletionIdentifier arg; if (_guess_expression_type(context, op->arguments[i], p_line, arg)) { if (arg.value.get_type() != Variant::NIL && arg.value.get_type() != Variant::OBJECT) { // calling with object seems dangerous, i don' t know @@ -785,15 +785,15 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: } } } - } else if (op->op == GDParser::OperatorNode::OP_INDEX || op->op == GDParser::OperatorNode::OP_INDEX_NAMED) { + } else if (op->op == GDScriptParser::OperatorNode::OP_INDEX || op->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) { - GDCompletionIdentifier p1; - GDCompletionIdentifier p2; + GDScriptCompletionIdentifier p1; + GDScriptCompletionIdentifier p2; - if (op->op == GDParser::OperatorNode::OP_INDEX_NAMED) { + if (op->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) { - if (op->arguments[1]->type == GDParser::Node::TYPE_IDENTIFIER) { - String id = static_cast<const GDParser::IdentifierNode *>(op->arguments[1])->name; + if (op->arguments[1]->type == GDScriptParser::Node::TYPE_IDENTIFIER) { + String id = static_cast<const GDScriptParser::IdentifierNode *>(op->arguments[1])->name; p2.type = Variant::STRING; p2.value = id; } @@ -807,9 +807,9 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: } } - if (op->arguments[0]->type == GDParser::Node::TYPE_ARRAY) { + if (op->arguments[0]->type == GDScriptParser::Node::TYPE_ARRAY) { - const GDParser::ArrayNode *an = static_cast<const GDParser::ArrayNode *>(op->arguments[0]); + const GDScriptParser::ArrayNode *an = static_cast<const GDScriptParser::ArrayNode *>(op->arguments[0]); if (p2.value.is_num()) { int index = p2.value; if (index < 0 || index >= an->elements.size()) @@ -817,16 +817,16 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: return _guess_expression_type(context, an->elements[index], p_line, r_type); } - } else if (op->arguments[0]->type == GDParser::Node::TYPE_DICTIONARY) { + } else if (op->arguments[0]->type == GDScriptParser::Node::TYPE_DICTIONARY) { - const GDParser::DictionaryNode *dn = static_cast<const GDParser::DictionaryNode *>(op->arguments[0]); + const GDScriptParser::DictionaryNode *dn = static_cast<const GDScriptParser::DictionaryNode *>(op->arguments[0]); if (p2.value.get_type() == Variant::NIL) return false; for (int i = 0; i < dn->elements.size(); i++) { - GDCompletionIdentifier k; + GDScriptCompletionIdentifier k; if (!_guess_expression_type(context, dn->elements[i].key, p_line, k)) { @@ -858,9 +858,9 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: StringName base_type = p1.obj_type; - if (p1.obj_type == "GDNativeClass") { + if (p1.obj_type == "GDScriptNativeClass") { //native enum - Ref<GDNativeClass> gdn = p1.value; + Ref<GDScriptNativeClass> gdn = p1.value; if (gdn.is_valid()) { base_type = gdn->get_name(); @@ -921,24 +921,24 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: Variant::Operator vop = Variant::OP_MAX; switch (op->op) { - case GDParser::OperatorNode::OP_ADD: vop = Variant::OP_ADD; break; - case GDParser::OperatorNode::OP_SUB: vop = Variant::OP_SUBTRACT; break; - case GDParser::OperatorNode::OP_MUL: vop = Variant::OP_MULTIPLY; break; - case GDParser::OperatorNode::OP_DIV: vop = Variant::OP_DIVIDE; break; - case GDParser::OperatorNode::OP_MOD: vop = Variant::OP_MODULE; break; - case GDParser::OperatorNode::OP_SHIFT_LEFT: vop = Variant::OP_SHIFT_LEFT; break; - case GDParser::OperatorNode::OP_SHIFT_RIGHT: vop = Variant::OP_SHIFT_RIGHT; break; - case GDParser::OperatorNode::OP_BIT_AND: vop = Variant::OP_BIT_AND; break; - case GDParser::OperatorNode::OP_BIT_OR: vop = Variant::OP_BIT_OR; break; - case GDParser::OperatorNode::OP_BIT_XOR: vop = Variant::OP_BIT_XOR; break; + case GDScriptParser::OperatorNode::OP_ADD: vop = Variant::OP_ADD; break; + case GDScriptParser::OperatorNode::OP_SUB: vop = Variant::OP_SUBTRACT; break; + case GDScriptParser::OperatorNode::OP_MUL: vop = Variant::OP_MULTIPLY; break; + case GDScriptParser::OperatorNode::OP_DIV: vop = Variant::OP_DIVIDE; break; + case GDScriptParser::OperatorNode::OP_MOD: vop = Variant::OP_MODULE; break; + case GDScriptParser::OperatorNode::OP_SHIFT_LEFT: vop = Variant::OP_SHIFT_LEFT; break; + case GDScriptParser::OperatorNode::OP_SHIFT_RIGHT: vop = Variant::OP_SHIFT_RIGHT; break; + case GDScriptParser::OperatorNode::OP_BIT_AND: vop = Variant::OP_BIT_AND; break; + case GDScriptParser::OperatorNode::OP_BIT_OR: vop = Variant::OP_BIT_OR; break; + case GDScriptParser::OperatorNode::OP_BIT_XOR: vop = Variant::OP_BIT_XOR; break; default: {} } if (vop == Variant::OP_MAX) return false; - GDCompletionIdentifier p1; - GDCompletionIdentifier p2; + GDScriptCompletionIdentifier p1; + GDScriptCompletionIdentifier p2; if (op->arguments[0]) { if (!_guess_expression_type(context, op->arguments[0], p_line, p1)) { @@ -985,15 +985,15 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: return false; } -static bool _guess_identifier_type_in_block(GDCompletionContext &context, int p_line, const StringName &p_identifier, GDCompletionIdentifier &r_type) { +static bool _guess_identifier_type_in_block(GDScriptCompletionContext &context, int p_line, const StringName &p_identifier, GDScriptCompletionIdentifier &r_type) { - if (context.block->if_condition && context.block->if_condition->type == GDParser::Node::TYPE_OPERATOR && static_cast<const GDParser::OperatorNode *>(context.block->if_condition)->op == GDParser::OperatorNode::OP_IS) { + if (context.block->if_condition && context.block->if_condition->type == GDScriptParser::Node::TYPE_OPERATOR && static_cast<const GDScriptParser::OperatorNode *>(context.block->if_condition)->op == GDScriptParser::OperatorNode::OP_IS) { //is used, check if identifier is in there! this helps resolve in blocks that are (if (identifier is value)): which are very common.. //super dirty hack, but very useful //credit: Zylann //TODO: this could be hacked to detect ANDed conditions too.. - const GDParser::OperatorNode *op = static_cast<const GDParser::OperatorNode *>(context.block->if_condition); - if (op->arguments[0]->type == GDParser::Node::TYPE_IDENTIFIER && static_cast<const GDParser::IdentifierNode *>(op->arguments[0])->name == p_identifier) { + const GDScriptParser::OperatorNode *op = static_cast<const GDScriptParser::OperatorNode *>(context.block->if_condition); + if (op->arguments[0]->type == GDScriptParser::Node::TYPE_IDENTIFIER && static_cast<const GDScriptParser::IdentifierNode *>(op->arguments[0])->name == p_identifier) { //bingo if (_guess_expression_type(context, op->arguments[1], op->line, r_type)) { return true; @@ -1001,7 +1001,7 @@ static bool _guess_identifier_type_in_block(GDCompletionContext &context, int p_ } } - GDCompletionIdentifier gdi = _get_native_class(context); + GDScriptCompletionIdentifier gdi = _get_native_class(context); if (gdi.obj_type != StringName()) { bool valid; Variant::Type t = ClassDB::get_property_type(gdi.obj_type, p_identifier, &valid); @@ -1027,7 +1027,7 @@ static bool _guess_identifier_type_in_block(GDCompletionContext &context, int p_ } } - const GDParser::Node *last_assign = NULL; + const GDScriptParser::Node *last_assign = NULL; int last_assign_line = -1; for (int i = 0; i < context.block->statements.size(); i++) { @@ -1035,9 +1035,9 @@ static bool _guess_identifier_type_in_block(GDCompletionContext &context, int p_ if (context.block->statements[i]->line > p_line) continue; - if (context.block->statements[i]->type == GDParser::BlockNode::TYPE_LOCAL_VAR) { + if (context.block->statements[i]->type == GDScriptParser::BlockNode::TYPE_LOCAL_VAR) { - const GDParser::LocalVarNode *lv = static_cast<const GDParser::LocalVarNode *>(context.block->statements[i]); + const GDScriptParser::LocalVarNode *lv = static_cast<const GDScriptParser::LocalVarNode *>(context.block->statements[i]); if (lv->assign && lv->name == p_identifier) { @@ -1046,13 +1046,13 @@ static bool _guess_identifier_type_in_block(GDCompletionContext &context, int p_ } } - if (context.block->statements[i]->type == GDParser::BlockNode::TYPE_OPERATOR) { - const GDParser::OperatorNode *op = static_cast<const GDParser::OperatorNode *>(context.block->statements[i]); - if (op->op == GDParser::OperatorNode::OP_ASSIGN) { + if (context.block->statements[i]->type == GDScriptParser::BlockNode::TYPE_OPERATOR) { + const GDScriptParser::OperatorNode *op = static_cast<const GDScriptParser::OperatorNode *>(context.block->statements[i]); + if (op->op == GDScriptParser::OperatorNode::OP_ASSIGN) { - if (op->arguments.size() && op->arguments[0]->type == GDParser::Node::TYPE_IDENTIFIER) { + if (op->arguments.size() && op->arguments[0]->type == GDScriptParser::Node::TYPE_IDENTIFIER) { - const GDParser::IdentifierNode *id = static_cast<const GDParser::IdentifierNode *>(op->arguments[0]); + const GDScriptParser::IdentifierNode *id = static_cast<const GDScriptParser::IdentifierNode *>(op->arguments[0]); if (id->name == p_identifier) { @@ -1073,9 +1073,9 @@ static bool _guess_identifier_type_in_block(GDCompletionContext &context, int p_ return false; } -static bool _guess_identifier_from_assignment_in_function(GDCompletionContext &context, int p_src_line, const StringName &p_identifier, const StringName &p_function, GDCompletionIdentifier &r_type) { +static bool _guess_identifier_from_assignment_in_function(GDScriptCompletionContext &context, int p_src_line, const StringName &p_identifier, const StringName &p_function, GDScriptCompletionIdentifier &r_type) { - const GDParser::FunctionNode *func = NULL; + const GDScriptParser::FunctionNode *func = NULL; for (int i = 0; i < context._class->functions.size(); i++) { if (context._class->functions[i]->name == p_function) { func = context._class->functions[i]; @@ -1092,13 +1092,13 @@ static bool _guess_identifier_from_assignment_in_function(GDCompletionContext &c break; } - if (func->body->statements[i]->type == GDParser::BlockNode::TYPE_OPERATOR) { - const GDParser::OperatorNode *op = static_cast<const GDParser::OperatorNode *>(func->body->statements[i]); - if (op->op == GDParser::OperatorNode::OP_ASSIGN) { + if (func->body->statements[i]->type == GDScriptParser::BlockNode::TYPE_OPERATOR) { + const GDScriptParser::OperatorNode *op = static_cast<const GDScriptParser::OperatorNode *>(func->body->statements[i]); + if (op->op == GDScriptParser::OperatorNode::OP_ASSIGN) { - if (op->arguments.size() && op->arguments[0]->type == GDParser::Node::TYPE_IDENTIFIER) { + if (op->arguments.size() && op->arguments[0]->type == GDScriptParser::Node::TYPE_IDENTIFIER) { - const GDParser::IdentifierNode *id = static_cast<const GDParser::IdentifierNode *>(op->arguments[0]); + const GDScriptParser::IdentifierNode *id = static_cast<const GDScriptParser::IdentifierNode *>(op->arguments[0]); if (id->name == p_identifier) { @@ -1112,15 +1112,15 @@ static bool _guess_identifier_from_assignment_in_function(GDCompletionContext &c return false; } -static bool _guess_identifier_type(GDCompletionContext &context, int p_line, const StringName &p_identifier, GDCompletionIdentifier &r_type, bool p_for_indexing) { +static bool _guess_identifier_type(GDScriptCompletionContext &context, int p_line, const StringName &p_identifier, GDScriptCompletionIdentifier &r_type, bool p_for_indexing) { //go to block first - const GDParser::BlockNode *block = context.block; + const GDScriptParser::BlockNode *block = context.block; while (block) { - GDCompletionContext c = context; + GDScriptCompletionContext c = context; c.block = block; if (_guess_identifier_type_in_block(c, p_line, p_identifier, r_type)) { @@ -1144,7 +1144,7 @@ static bool _guess_identifier_type(GDCompletionContext &context, int p_line, con } if (argindex != -1) { - GDCompletionIdentifier id = _get_native_class(context); + GDScriptCompletionIdentifier id = _get_native_class(context); if (id.type == Variant::OBJECT && id.obj_type != StringName()) { //this kinda sucks but meh @@ -1182,8 +1182,8 @@ static bool _guess_identifier_type(GDCompletionContext &context, int p_line, con if (context._class->constant_expressions[i].identifier == p_identifier) { - ERR_FAIL_COND_V(context._class->constant_expressions[i].expression->type != GDParser::Node::TYPE_CONSTANT, false); - r_type = _get_type_from_variant(static_cast<const GDParser::ConstantNode *>(context._class->constant_expressions[i].expression)->value); + ERR_FAIL_COND_V(context._class->constant_expressions[i].expression->type != GDScriptParser::Node::TYPE_CONSTANT, false); + r_type = _get_type_from_variant(static_cast<const GDScriptParser::ConstantNode *>(context._class->constant_expressions[i].expression)->value); return true; } } @@ -1275,7 +1275,7 @@ static bool _guess_identifier_type(GDCompletionContext &context, int p_line, con return false; } -static void _find_identifiers_in_block(GDCompletionContext &context, int p_line, bool p_only_functions, Set<String> &result) { +static void _find_identifiers_in_block(GDScriptCompletionContext &context, int p_line, bool p_only_functions, Set<String> &result) { if (p_only_functions) return; @@ -1285,15 +1285,15 @@ static void _find_identifiers_in_block(GDCompletionContext &context, int p_line, if (context.block->statements[i]->line > p_line) continue; - if (context.block->statements[i]->type == GDParser::BlockNode::TYPE_LOCAL_VAR) { + if (context.block->statements[i]->type == GDScriptParser::BlockNode::TYPE_LOCAL_VAR) { - const GDParser::LocalVarNode *lv = static_cast<const GDParser::LocalVarNode *>(context.block->statements[i]); + const GDScriptParser::LocalVarNode *lv = static_cast<const GDScriptParser::LocalVarNode *>(context.block->statements[i]); result.insert(lv->name.operator String()); } } } -static void _find_identifiers_in_class(GDCompletionContext &context, bool p_static, bool p_only_functions, Set<String> &result) { +static void _find_identifiers_in_class(GDScriptCompletionContext &context, bool p_static, bool p_only_functions, Set<String> &result) { if (!p_static && !p_only_functions) { @@ -1336,7 +1336,7 @@ static void _find_identifiers_in_class(GDCompletionContext &context, bool p_stat while (true) { Ref<GDScript> script = base; - Ref<GDNativeClass> nc = base; + Ref<GDScriptNativeClass> nc = base; if (script.is_valid()) { if (!p_static && !p_only_functions) { @@ -1351,7 +1351,7 @@ static void _find_identifiers_in_class(GDCompletionContext &context, bool p_stat } } - for (const Map<StringName, GDFunction *>::Element *E = script->get_member_functions().front(); E; E = E->next()) { + for (const Map<StringName, GDScriptFunction *>::Element *E = script->get_member_functions().front(); E; E = E->next()) { if (!p_static || E->get()->is_static()) { if (E->get()->get_argument_count()) result.insert(E->key().operator String() + "("); @@ -1410,13 +1410,13 @@ static void _find_identifiers_in_class(GDCompletionContext &context, bool p_stat } } -static void _find_identifiers(GDCompletionContext &context, int p_line, bool p_only_functions, Set<String> &result) { +static void _find_identifiers(GDScriptCompletionContext &context, int p_line, bool p_only_functions, Set<String> &result) { - const GDParser::BlockNode *block = context.block; + const GDScriptParser::BlockNode *block = context.block; if (context.function) { - const GDParser::FunctionNode *f = context.function; + const GDScriptParser::FunctionNode *f = context.function; for (int i = 0; i < f->arguments.size(); i++) { result.insert(f->arguments[i].operator String()); @@ -1425,19 +1425,19 @@ static void _find_identifiers(GDCompletionContext &context, int p_line, bool p_o while (block) { - GDCompletionContext c = context; + GDScriptCompletionContext c = context; c.block = block; _find_identifiers_in_block(c, p_line, p_only_functions, result); block = block->parent_block; } - const GDParser::ClassNode *clss = context._class; + const GDScriptParser::ClassNode *clss = context._class; bool _static = context.function && context.function->_static; while (clss) { - GDCompletionContext c = context; + GDScriptCompletionContext c = context; c._class = clss; c.block = NULL; c.function = NULL; @@ -1445,9 +1445,9 @@ static void _find_identifiers(GDCompletionContext &context, int p_line, bool p_o clss = clss->owner; } - for (int i = 0; i < GDFunctions::FUNC_MAX; i++) { + for (int i = 0; i < GDScriptFunctions::FUNC_MAX; i++) { - result.insert(GDFunctions::get_func_name(GDFunctions::Function(i))); + result.insert(GDScriptFunctions::get_func_name(GDScriptFunctions::Function(i))); } static const char *_type_names[Variant::VARIANT_MAX] = { @@ -1501,7 +1501,7 @@ static String _get_visual_datatype(const PropertyInfo &p_info, bool p_isarg = tr return Variant::get_type_name(p_info.type); } -static void _make_function_hint(const GDParser::FunctionNode *p_func, int p_argidx, String &arghint) { +static void _make_function_hint(const GDScriptParser::FunctionNode *p_func, int p_argidx, String &arghint) { arghint = "func " + p_func->name + "("; for (int i = 0; i < p_func->arguments.size(); i++) { @@ -1521,11 +1521,11 @@ static void _make_function_hint(const GDParser::FunctionNode *p_func, int p_argi if (defidx >= 0 && defidx < p_func->default_values.size()) { - if (p_func->default_values[defidx]->type == GDParser::Node::TYPE_OPERATOR) { + if (p_func->default_values[defidx]->type == GDScriptParser::Node::TYPE_OPERATOR) { - const GDParser::OperatorNode *op = static_cast<const GDParser::OperatorNode *>(p_func->default_values[defidx]); - if (op->op == GDParser::OperatorNode::OP_ASSIGN) { - const GDParser::ConstantNode *cn = static_cast<const GDParser::ConstantNode *>(op->arguments[1]); + const GDScriptParser::OperatorNode *op = static_cast<const GDScriptParser::OperatorNode *>(p_func->default_values[defidx]); + if (op->op == GDScriptParser::OperatorNode::OP_ASSIGN) { + const GDScriptParser::ConstantNode *cn = static_cast<const GDScriptParser::ConstantNode *>(op->arguments[1]); arghint += "=" + cn->value.get_construct_string(); } } else { @@ -1553,7 +1553,7 @@ void get_directory_contents(EditorFileSystemDirectory *p_dir, Set<String> &r_lis } } -static void _find_type_arguments(GDCompletionContext &context, const GDParser::Node *p_node, int p_line, const StringName &p_method, const GDCompletionIdentifier &id, int p_argidx, Set<String> &result, bool &r_forced, String &arghint) { +static void _find_type_arguments(GDScriptCompletionContext &context, const GDScriptParser::Node *p_node, int p_line, const StringName &p_method, const GDScriptCompletionIdentifier &id, int p_argidx, Set<String> &result, bool &r_forced, String &arghint) { //print_line("find type arguments?"); if (id.type == Variant::OBJECT && id.obj_type != StringName()) { @@ -1572,7 +1572,7 @@ static void _find_type_arguments(GDCompletionContext &context, const GDParser::N if (scr) { while (scr) { - for (const Map<StringName, GDFunction *>::Element *E = scr->get_member_functions().front(); E; E = E->next()) { + for (const Map<StringName, GDScriptFunction *>::Element *E = scr->get_member_functions().front(); E; E = E->next()) { if (E->get()->is_static() && p_method == E->get()->get_name()) { arghint = "static func " + String(p_method) + "("; for (int i = 0; i < E->get()->get_argument_count(); i++) { @@ -1629,7 +1629,7 @@ static void _find_type_arguments(GDCompletionContext &context, const GDParser::N if (code != "") { //if there is code, parse it. This way is slower but updates in real-time - GDParser p; + GDScriptParser p; //Error parse(const String& p_code, const String& p_base_path="", bool p_just_validate=false,const String& p_self_path="",bool p_for_completion=false); Error err = p.parse(scr->get_source_code(), scr->get_path().get_base_dir(), true, "", false); @@ -1637,13 +1637,13 @@ static void _find_type_arguments(GDCompletionContext &context, const GDParser::N if (err == OK) { //print_line("checking the functions..."); //only if ok, otherwise use what is cached on the script - //GDParser::ClassNode *base = p. - const GDParser::Node *root = p.get_parse_tree(); - ERR_FAIL_COND(root->type != GDParser::Node::TYPE_CLASS); + //GDScriptParser::ClassNode *base = p. + const GDScriptParser::Node *root = p.get_parse_tree(); + ERR_FAIL_COND(root->type != GDScriptParser::Node::TYPE_CLASS); - const GDParser::ClassNode *cl = static_cast<const GDParser::ClassNode *>(root); + const GDScriptParser::ClassNode *cl = static_cast<const GDScriptParser::ClassNode *>(root); - const GDParser::FunctionNode *func = NULL; + const GDScriptParser::FunctionNode *func = NULL; bool st = false; for (int i = 0; i < cl->functions.size(); i++) { @@ -1681,10 +1681,10 @@ static void _find_type_arguments(GDCompletionContext &context, const GDParser::N int defidx = deffrom - i; - if (defidx >= 0 && defidx < func->default_values.size() && func->default_values[defidx]->type == GDParser::Node::TYPE_OPERATOR) { - const GDParser::OperatorNode *op = static_cast<const GDParser::OperatorNode *>(func->default_values[defidx]); - if (op->op == GDParser::OperatorNode::OP_ASSIGN) { - const GDParser::ConstantNode *cn = static_cast<const GDParser::ConstantNode *>(op->arguments[1]); + if (defidx >= 0 && defidx < func->default_values.size() && func->default_values[defidx]->type == GDScriptParser::Node::TYPE_OPERATOR) { + const GDScriptParser::OperatorNode *op = static_cast<const GDScriptParser::OperatorNode *>(func->default_values[defidx]); + if (op->op == GDScriptParser::OperatorNode::OP_ASSIGN) { + const GDScriptParser::ConstantNode *cn = static_cast<const GDScriptParser::ConstantNode *>(op->arguments[1]); arghint += "=" + cn->value.get_construct_string(); } } @@ -1705,7 +1705,7 @@ static void _find_type_arguments(GDCompletionContext &context, const GDParser::N if (code == "") { - for (const Map<StringName, GDFunction *>::Element *E = scr->get_member_functions().front(); E; E = E->next()) { + for (const Map<StringName, GDScriptFunction *>::Element *E = scr->get_member_functions().front(); E; E = E->next()) { if (p_method == E->get()->get_name()) { arghint = "func " + String(p_method) + "("; for (int i = 0; i < E->get()->get_argument_count(); i++) { @@ -1814,8 +1814,8 @@ static void _find_type_arguments(GDCompletionContext &context, const GDParser::N } /*if (p_argidx==2) { - ERR_FAIL_COND(p_node->type!=GDParser::Node::TYPE_OPERATOR); - const GDParser::OperatorNode *op=static_cast<const GDParser::OperatorNode *>(p_node); + ERR_FAIL_COND(p_node->type!=GDScriptParser::Node::TYPE_OPERATOR); + const GDScriptParser::OperatorNode *op=static_cast<const GDScriptParser::OperatorNode *>(p_node); if (op->arguments.size()>) }*/ @@ -1890,30 +1890,30 @@ static void _find_type_arguments(GDCompletionContext &context, const GDParser::N } } -static void _find_call_arguments(GDCompletionContext &context, const GDParser::Node *p_node, int p_line, int p_argidx, Set<String> &result, bool &r_forced, String &arghint) { +static void _find_call_arguments(GDScriptCompletionContext &context, const GDScriptParser::Node *p_node, int p_line, int p_argidx, Set<String> &result, bool &r_forced, String &arghint) { - if (!p_node || p_node->type != GDParser::Node::TYPE_OPERATOR) { + if (!p_node || p_node->type != GDScriptParser::Node::TYPE_OPERATOR) { return; } - const GDParser::OperatorNode *op = static_cast<const GDParser::OperatorNode *>(p_node); + const GDScriptParser::OperatorNode *op = static_cast<const GDScriptParser::OperatorNode *>(p_node); - if (op->op != GDParser::OperatorNode::OP_CALL) { + if (op->op != GDScriptParser::OperatorNode::OP_CALL) { return; } - if (op->arguments[0]->type == GDParser::Node::TYPE_BUILT_IN_FUNCTION) { + if (op->arguments[0]->type == GDScriptParser::Node::TYPE_BUILT_IN_FUNCTION) { //complete built-in function - const GDParser::BuiltInFunctionNode *fn = static_cast<const GDParser::BuiltInFunctionNode *>(op->arguments[0]); - MethodInfo mi = GDFunctions::get_info(fn->function); + const GDScriptParser::BuiltInFunctionNode *fn = static_cast<const GDScriptParser::BuiltInFunctionNode *>(op->arguments[0]); + MethodInfo mi = GDScriptFunctions::get_info(fn->function); if (mi.name == "load" && bool(EditorSettings::get_singleton()->get("text_editor/completion/complete_file_paths"))) { get_directory_contents(EditorFileSystem::get_singleton()->get_filesystem(), result); } - arghint = _get_visual_datatype(mi.return_val, false) + " " + GDFunctions::get_func_name(fn->function) + String("("); + arghint = _get_visual_datatype(mi.return_val, false) + " " + GDScriptFunctions::get_func_name(fn->function) + String("("); for (int i = 0; i < mi.arguments.size(); i++) { if (i > 0) arghint += ", "; @@ -1931,9 +1931,9 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N arghint += " "; arghint += ")"; - } else if (op->arguments[0]->type == GDParser::Node::TYPE_TYPE) { + } else if (op->arguments[0]->type == GDScriptParser::Node::TYPE_TYPE) { //complete constructor - const GDParser::TypeNode *tn = static_cast<const GDParser::TypeNode *>(op->arguments[0]); + const GDScriptParser::TypeNode *tn = static_cast<const GDScriptParser::TypeNode *>(op->arguments[0]); List<MethodInfo> mil; Variant::get_constructor_list(tn->vtype, &mil); @@ -1964,11 +1964,11 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N arghint += ")"; } - } else if (op->arguments.size() >= 2 && op->arguments[1]->type == GDParser::Node::TYPE_IDENTIFIER) { + } else if (op->arguments.size() >= 2 && op->arguments[1]->type == GDScriptParser::Node::TYPE_IDENTIFIER) { //make sure identifier exists... - const GDParser::IdentifierNode *id = static_cast<const GDParser::IdentifierNode *>(op->arguments[1]); - if (op->arguments[0]->type == GDParser::Node::TYPE_SELF) { + const GDScriptParser::IdentifierNode *id = static_cast<const GDScriptParser::IdentifierNode *>(op->arguments[1]); + if (op->arguments[0]->type == GDScriptParser::Node::TYPE_SELF) { //self, look up for (int i = 0; i < context._class->static_functions.size(); i++) { @@ -1993,10 +1993,10 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N while (true) { Ref<GDScript> script = base; - Ref<GDNativeClass> nc = base; + Ref<GDScriptNativeClass> nc = base; if (script.is_valid()) { - for (const Map<StringName, GDFunction *>::Element *E = script->get_member_functions().front(); E; E = E->next()) { + for (const Map<StringName, GDScriptFunction *>::Element *E = script->get_member_functions().front(); E; E = E->next()) { if (E->key() == id->name) { @@ -2038,7 +2038,7 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N if (!(context.function && context.function->_static)) { - GDCompletionIdentifier ci; + GDScriptCompletionIdentifier ci; ci.type = Variant::OBJECT; ci.obj_type = nc->get_name(); if (!context._class->owner) @@ -2063,7 +2063,7 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N } else { //indexed lookup - GDCompletionIdentifier ci; + GDScriptCompletionIdentifier ci; if (_guess_expression_type(context, op->arguments[0], p_line, ci)) { _find_type_arguments(context, p_node, p_line, id->name, ci, p_argidx, result, r_forced, arghint); @@ -2075,13 +2075,13 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, bool &r_forced, String &r_call_hint) { - GDParser p; + GDScriptParser p; p.parse(p_code, p_base_path, false, "", true); bool isfunction = false; Set<String> options; r_forced = false; - GDCompletionContext context; + GDScriptCompletionContext context; context._class = p.get_completion_class(); context.block = p.get_completion_block(); context.function = p.get_completion_function(); @@ -2090,9 +2090,9 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base switch (p.get_completion_type()) { - case GDParser::COMPLETION_NONE: { + case GDScriptParser::COMPLETION_NONE: { } break; - case GDParser::COMPLETION_BUILT_IN_TYPE_CONSTANT: { + case GDScriptParser::COMPLETION_BUILT_IN_TYPE_CONSTANT: { List<StringName> constants; Variant::get_numeric_constants_for_type(p.get_completion_built_in_constant(), &constants); for (List<StringName>::Element *E = constants.front(); E; E = E->next()) { @@ -2100,16 +2100,16 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base } } break; - case GDParser::COMPLETION_FUNCTION: + case GDScriptParser::COMPLETION_FUNCTION: isfunction = true; - case GDParser::COMPLETION_IDENTIFIER: { + case GDScriptParser::COMPLETION_IDENTIFIER: { _find_identifiers(context, p.get_completion_line(), isfunction, options); } break; - case GDParser::COMPLETION_PARENT_FUNCTION: { + case GDScriptParser::COMPLETION_PARENT_FUNCTION: { } break; - case GDParser::COMPLETION_GET_NODE: { + case GDScriptParser::COMPLETION_GET_NODE: { if (p_owner) { List<String> opts; @@ -2130,20 +2130,20 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base } } } break; - case GDParser::COMPLETION_METHOD: + case GDScriptParser::COMPLETION_METHOD: isfunction = true; - case GDParser::COMPLETION_INDEX: { + case GDScriptParser::COMPLETION_INDEX: { - const GDParser::Node *node = p.get_completion_node(); - if (node->type != GDParser::Node::TYPE_OPERATOR) + const GDScriptParser::Node *node = p.get_completion_node(); + if (node->type != GDScriptParser::Node::TYPE_OPERATOR) break; - GDCompletionIdentifier t; - if (_guess_expression_type(context, static_cast<const GDParser::OperatorNode *>(node)->arguments[0], p.get_completion_line(), t, true)) { + GDScriptCompletionIdentifier t; + if (_guess_expression_type(context, static_cast<const GDScriptParser::OperatorNode *>(node)->arguments[0], p.get_completion_line(), t, true)) { - if (t.type == Variant::OBJECT && t.obj_type == "GDNativeClass") { + if (t.type == Variant::OBJECT && t.obj_type == "GDScriptNativeClass") { //native enum - Ref<GDNativeClass> gdn = t.value; + Ref<GDScriptNativeClass> gdn = t.value; if (gdn.is_valid()) { StringName cn = gdn->get_name(); List<String> cnames; @@ -2179,7 +2179,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base options.insert(E->key()); } } - for (const Map<StringName, GDFunction *>::Element *E = scr->get_member_functions().front(); E; E = E->next()) { + for (const Map<StringName, GDScriptFunction *>::Element *E = scr->get_member_functions().front(); E; E = E->next()) { if (E->get()->is_static()) options.insert(E->key()); } @@ -2210,17 +2210,17 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base if (code != "") { //if there is code, parse it. This way is slower but updates in real-time - GDParser p; + GDScriptParser p; Error err = p.parse(scr->get_source_code(), scr->get_path().get_base_dir(), true, "", false); if (err == OK) { //only if ok, otherwise use what is cached on the script - //GDParser::ClassNode *base = p. - const GDParser::Node *root = p.get_parse_tree(); - ERR_FAIL_COND_V(root->type != GDParser::Node::TYPE_CLASS, ERR_PARSE_ERROR); + //GDScriptParser::ClassNode *base = p. + const GDScriptParser::Node *root = p.get_parse_tree(); + ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, ERR_PARSE_ERROR); - const GDParser::ClassNode *cl = static_cast<const GDParser::ClassNode *>(root); + const GDScriptParser::ClassNode *cl = static_cast<const GDScriptParser::ClassNode *>(root); for (int i = 0; i < cl->functions.size(); i++) { @@ -2262,7 +2262,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base options.insert(E->key()); } } - for (const Map<StringName, GDFunction *>::Element *E = scr->get_member_functions().front(); E; E = E->next()) { + for (const Map<StringName, GDScriptFunction *>::Element *E = scr->get_member_functions().front(); E; E = E->next()) { if (E->get()->get_argument_count()) options.insert(String(E->key()) + "()"); else @@ -2341,13 +2341,13 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base } } break; - case GDParser::COMPLETION_CALL_ARGUMENTS: { + case GDScriptParser::COMPLETION_CALL_ARGUMENTS: { _find_call_arguments(context, p.get_completion_node(), p.get_completion_line(), p.get_completion_argument_index(), options, r_forced, r_call_hint); } break; - case GDParser::COMPLETION_VIRTUAL_FUNC: { + case GDScriptParser::COMPLETION_VIRTUAL_FUNC: { - GDCompletionIdentifier cid = _get_native_class(context); + GDScriptCompletionIdentifier cid = _get_native_class(context); if (cid.obj_type != StringName()) { List<MethodInfo> vm; @@ -2376,11 +2376,11 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base } } } break; - case GDParser::COMPLETION_YIELD: { + case GDScriptParser::COMPLETION_YIELD: { - const GDParser::Node *node = p.get_completion_node(); + const GDScriptParser::Node *node = p.get_completion_node(); - GDCompletionIdentifier t; + GDScriptCompletionIdentifier t; if (!_guess_expression_type(context, node, p.get_completion_line(), t)) break; @@ -2395,15 +2395,15 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base } } break; - case GDParser::COMPLETION_RESOURCE_PATH: { + case GDScriptParser::COMPLETION_RESOURCE_PATH: { if (EditorSettings::get_singleton()->get("text_editor/completion/complete_file_paths")) get_directory_contents(EditorFileSystem::get_singleton()->get_filesystem(), options); } break; - case GDParser::COMPLETION_ASSIGN: { + case GDScriptParser::COMPLETION_ASSIGN: { #if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED) - GDCompletionIdentifier ci; + GDScriptCompletionIdentifier ci; if (_guess_expression_type(context, p.get_completion_node(), p.get_completion_line(), ci)) { String enumeration = ci.enumeration; @@ -2556,8 +2556,8 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } } - for (int i = 0; i < GDFunctions::FUNC_MAX; i++) { - if (GDFunctions::get_func_name(GDFunctions::Function(i)) == p_symbol) { + for (int i = 0; i < GDScriptFunctions::FUNC_MAX; i++) { + if (GDScriptFunctions::get_func_name(GDScriptFunctions::Function(i)) == p_symbol) { r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_METHOD; r_result.class_name = "@GDScript"; r_result.class_member = p_symbol; @@ -2565,13 +2565,13 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } } - GDParser p; + GDScriptParser p; p.parse(p_code, p_base_path, false, "", true); - if (p.get_completion_type() == GDParser::COMPLETION_NONE) + if (p.get_completion_type() == GDScriptParser::COMPLETION_NONE) return ERR_CANT_RESOLVE; - GDCompletionContext context; + GDScriptCompletionContext context; context._class = p.get_completion_class(); context.block = p.get_completion_block(); @@ -2582,10 +2582,10 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol switch (p.get_completion_type()) { - case GDParser::COMPLETION_GET_NODE: - case GDParser::COMPLETION_NONE: { + case GDScriptParser::COMPLETION_GET_NODE: + case GDScriptParser::COMPLETION_NONE: { } break; - case GDParser::COMPLETION_BUILT_IN_TYPE_CONSTANT: { + case GDScriptParser::COMPLETION_BUILT_IN_TYPE_CONSTANT: { r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; r_result.class_name = Variant::get_type_name(p.get_completion_built_in_constant()); @@ -2593,7 +2593,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol return OK; } break; - case GDParser::COMPLETION_FUNCTION: { + case GDScriptParser::COMPLETION_FUNCTION: { if (context._class && context._class->functions.size()) { for (int i = 0; i < context._class->functions.size(); i++) { @@ -2618,7 +2618,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol parent = parent->get_base(); } - GDCompletionIdentifier identifier = _get_native_class(context); + GDScriptCompletionIdentifier identifier = _get_native_class(context); print_line("identifier: " + String(identifier.obj_type)); if (ClassDB::has_method(identifier.obj_type, p_symbol)) { @@ -2630,7 +2630,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } } break; - case GDParser::COMPLETION_IDENTIFIER: { + case GDScriptParser::COMPLETION_IDENTIFIER: { //check if a function if (p.get_completion_identifier_is_function()) { @@ -2657,7 +2657,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol parent = parent->get_base(); } - GDCompletionIdentifier identifier = _get_native_class(context); + GDScriptCompletionIdentifier identifier = _get_native_class(context); if (ClassDB::has_method(identifier.obj_type, p_symbol)) { @@ -2668,7 +2668,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } } else { - GDCompletionIdentifier gdi = _get_native_class(context); + GDScriptCompletionIdentifier gdi = _get_native_class(context); if (gdi.obj_type != StringName()) { bool valid; Variant::Type t = ClassDB::get_property_type(gdi.obj_type, p_symbol, &valid); @@ -2680,7 +2680,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } } - const GDParser::BlockNode *block = context.block; + const GDScriptParser::BlockNode *block = context.block; //search in blocks going up (local var?) while (block) { @@ -2689,9 +2689,9 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol if (block->statements[i]->line > p.get_completion_line()) continue; - if (block->statements[i]->type == GDParser::BlockNode::TYPE_LOCAL_VAR) { + if (block->statements[i]->type == GDScriptParser::BlockNode::TYPE_LOCAL_VAR) { - const GDParser::LocalVarNode *lv = static_cast<const GDParser::LocalVarNode *>(block->statements[i]); + const GDScriptParser::LocalVarNode *lv = static_cast<const GDScriptParser::LocalVarNode *>(block->statements[i]); if (lv->assign && lv->name == p_symbol) { @@ -2782,9 +2782,9 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol if (value.get_type() == Variant::OBJECT) { Object *obj = value; if (obj) { - if (Object::cast_to<GDNativeClass>(obj)) { + if (Object::cast_to<GDScriptNativeClass>(obj)) { r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS; - r_result.class_name = Object::cast_to<GDNativeClass>(obj)->get_name(); + r_result.class_name = Object::cast_to<GDScriptNativeClass>(obj)->get_name(); } else { r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS; r_result.class_name = obj->get_class(); @@ -2798,7 +2798,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } } else { r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; - r_result.class_name = "@Global Scope"; + r_result.class_name = "@GlobalScope"; r_result.class_member = p_symbol; return OK; } @@ -2806,23 +2806,23 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } } break; - case GDParser::COMPLETION_PARENT_FUNCTION: { + case GDScriptParser::COMPLETION_PARENT_FUNCTION: { } break; - case GDParser::COMPLETION_METHOD: + case GDScriptParser::COMPLETION_METHOD: isfunction = true; - case GDParser::COMPLETION_INDEX: { + case GDScriptParser::COMPLETION_INDEX: { - const GDParser::Node *node = p.get_completion_node(); - if (node->type != GDParser::Node::TYPE_OPERATOR) + const GDScriptParser::Node *node = p.get_completion_node(); + if (node->type != GDScriptParser::Node::TYPE_OPERATOR) break; - GDCompletionIdentifier t; - if (_guess_expression_type(context, static_cast<const GDParser::OperatorNode *>(node)->arguments[0], p.get_completion_line(), t)) { + GDScriptCompletionIdentifier t; + if (_guess_expression_type(context, static_cast<const GDScriptParser::OperatorNode *>(node)->arguments[0], p.get_completion_line(), t)) { - if (t.type == Variant::OBJECT && t.obj_type == "GDNativeClass") { + if (t.type == Variant::OBJECT && t.obj_type == "GDScriptNativeClass") { //native enum - Ref<GDNativeClass> gdn = t.value; + Ref<GDScriptNativeClass> gdn = t.value; if (gdn.is_valid()) { r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT; r_result.class_name = gdn->get_name(); @@ -2914,13 +2914,13 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } } break; - case GDParser::COMPLETION_CALL_ARGUMENTS: { + case GDScriptParser::COMPLETION_CALL_ARGUMENTS: { return ERR_CANT_RESOLVE; } break; - case GDParser::COMPLETION_VIRTUAL_FUNC: { + case GDScriptParser::COMPLETION_VIRTUAL_FUNC: { - GDCompletionIdentifier cid = _get_native_class(context); + GDScriptCompletionIdentifier cid = _get_native_class(context); if (cid.obj_type != StringName()) { List<MethodInfo> vm; @@ -2937,7 +2937,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } } } break; - case GDParser::COMPLETION_YIELD: { + case GDScriptParser::COMPLETION_YIELD: { return ERR_CANT_RESOLVE; diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gdscript_function.cpp index 1a46ad324a..765a76fec4 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_function.cpp */ +/* gdscript_function.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,13 +27,13 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "gd_function.h" +#include "gdscript_function.h" -#include "gd_functions.h" -#include "gd_script.h" +#include "gdscript.h" +#include "gdscript_functions.h" #include "os/os.h" -Variant *GDFunction::_get_variant(int p_address, GDInstance *p_instance, GDScript *p_script, Variant &self, Variant *p_stack, String &r_error) const { +Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant *p_stack, String &r_error) const { int address = p_address & ADDR_MASK; @@ -85,7 +85,7 @@ Variant *GDFunction::_get_variant(int p_address, GDInstance *p_instance, GDScrip o = o->_owner; } - ERR_EXPLAIN("GDCompiler bug.."); + ERR_EXPLAIN("GDScriptCompiler bug.."); ERR_FAIL_V(NULL); } break; case ADDR_TYPE_LOCAL_CONSTANT: { @@ -117,7 +117,7 @@ Variant *GDFunction::_get_variant(int p_address, GDInstance *p_instance, GDScrip return NULL; } -String GDFunction::_get_call_error(const Variant::CallError &p_err, const String &p_where, const Variant **argptrs) const { +String GDScriptFunction::_get_call_error(const Variant::CallError &p_err, const String &p_where, const Variant **argptrs) const { String err_text; @@ -231,7 +231,7 @@ static String _get_var_type(const Variant *p_type) { #define OPCODE_OUT break #endif -Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state) { +Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state) { OPCODES_TABLE; @@ -479,7 +479,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a } else { - GDNativeClass *nc = Object::cast_to<GDNativeClass>(obj_B); + GDScriptNativeClass *nc = Object::cast_to<GDScriptNativeClass>(obj_B); #ifdef DEBUG_ENABLED if (!nc) { @@ -851,7 +851,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a CHECK_SPACE(4); - GDFunctions::Function func = GDFunctions::Function(_code_ptr[ip + 1]); + GDScriptFunctions::Function func = GDScriptFunctions::Function(_code_ptr[ip + 1]); int argc = _code_ptr[ip + 2]; GD_ERR_BREAK(argc < 0); @@ -868,12 +868,12 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a Variant::CallError err; - GDFunctions::call(func, (const Variant **)argptrs, argc, *dst, err); + GDScriptFunctions::call(func, (const Variant **)argptrs, argc, *dst, err); #ifdef DEBUG_ENABLED if (err.error != Variant::CallError::CALL_OK) { - String methodstr = GDFunctions::get_func_name(func); + String methodstr = GDScriptFunctions::get_func_name(func); if (dst->get_type() == Variant::STRING) { //call provided error string err_text = "Error calling built-in function '" + methodstr + "': " + String(*dst); @@ -921,7 +921,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a const GDScript *gds = _script; - const Map<StringName, GDFunction *>::Element *E = NULL; + const Map<StringName, GDScriptFunction *>::Element *E = NULL; while (gds->base.ptr()) { gds = gds->base.ptr(); E = gds->member_functions.find(*methodname); @@ -979,7 +979,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a CHECK_SPACE(2); } - Ref<GDFunctionState> gdfs = memnew(GDFunctionState); + Ref<GDScriptFunctionState> gdfs = memnew(GDScriptFunctionState); gdfs->function = this; gdfs->state.stack.resize(alloca_size); @@ -1321,43 +1321,43 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a return retvalue; } -const int *GDFunction::get_code() const { +const int *GDScriptFunction::get_code() const { return _code_ptr; } -int GDFunction::get_code_size() const { +int GDScriptFunction::get_code_size() const { return _code_size; } -Variant GDFunction::get_constant(int p_idx) const { +Variant GDScriptFunction::get_constant(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, constants.size(), "<errconst>"); return constants[p_idx]; } -StringName GDFunction::get_global_name(int p_idx) const { +StringName GDScriptFunction::get_global_name(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, global_names.size(), "<errgname>"); return global_names[p_idx]; } -int GDFunction::get_default_argument_count() const { +int GDScriptFunction::get_default_argument_count() const { return default_arguments.size(); } -int GDFunction::get_default_argument_addr(int p_idx) const { +int GDScriptFunction::get_default_argument_addr(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, default_arguments.size(), -1); return default_arguments[p_idx]; } -StringName GDFunction::get_name() const { +StringName GDScriptFunction::get_name() const { return name; } -int GDFunction::get_max_stack_size() const { +int GDScriptFunction::get_max_stack_size() const { return _stack_size; } @@ -1380,7 +1380,7 @@ struct _GDFKCS { } }; -void GDFunction::debug_get_stack_member_state(int p_line, List<Pair<StringName, int> > *r_stackvars) const { +void GDScriptFunction::debug_get_stack_member_state(int p_line, List<Pair<StringName, int> > *r_stackvars) const { int oc = 0; Map<StringName, _GDFKC> sdmap; @@ -1432,7 +1432,7 @@ void GDFunction::debug_get_stack_member_state(int p_line, List<Pair<StringName, } } -GDFunction::GDFunction() +GDScriptFunction::GDScriptFunction() : function_list(this) { _stack_size = 0; @@ -1464,7 +1464,7 @@ GDFunction::GDFunction() #endif } -GDFunction::~GDFunction() { +GDScriptFunction::~GDScriptFunction() { #ifdef DEBUG_ENABLED if (GDScriptLanguage::get_singleton()->lock) { GDScriptLanguage::get_singleton()->lock->lock(); @@ -1479,7 +1479,7 @@ GDFunction::~GDFunction() { ///////////////////// -Variant GDFunctionState::_signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant GDScriptFunctionState::_signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { #ifdef DEBUG_ENABLED if (state.instance_id && !ObjectDB::get_instance(state.instance_id)) { @@ -1514,7 +1514,7 @@ Variant GDFunctionState::_signal_callback(const Variant **p_args, int p_argcount arg = extra_args; } - Ref<GDFunctionState> self = *p_args[p_argcount - 1]; + Ref<GDScriptFunctionState> self = *p_args[p_argcount - 1]; if (self.is_null()) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; @@ -1528,10 +1528,10 @@ Variant GDFunctionState::_signal_callback(const Variant **p_args, int p_argcount bool completed = true; - // If the return value is a GDFunctionState reference, + // If the return value is a GDScriptFunctionState reference, // then the function did yield again after resuming. if (ret.is_ref()) { - GDFunctionState *gdfs = Object::cast_to<GDFunctionState>(ret); + GDScriptFunctionState *gdfs = Object::cast_to<GDScriptFunctionState>(ret); if (gdfs && gdfs->function == function) completed = false; } @@ -1546,7 +1546,7 @@ Variant GDFunctionState::_signal_callback(const Variant **p_args, int p_argcount return ret; } -bool GDFunctionState::is_valid(bool p_extended_check) const { +bool GDScriptFunctionState::is_valid(bool p_extended_check) const { if (function == NULL) return false; @@ -1563,7 +1563,7 @@ bool GDFunctionState::is_valid(bool p_extended_check) const { return true; } -Variant GDFunctionState::resume(const Variant &p_arg) { +Variant GDScriptFunctionState::resume(const Variant &p_arg) { ERR_FAIL_COND_V(!function, Variant()); #ifdef DEBUG_ENABLED @@ -1584,10 +1584,10 @@ Variant GDFunctionState::resume(const Variant &p_arg) { bool completed = true; - // If the return value is a GDFunctionState reference, + // If the return value is a GDScriptFunctionState reference, // then the function did yield again after resuming. if (ret.is_ref()) { - GDFunctionState *gdfs = Object::cast_to<GDFunctionState>(ret); + GDScriptFunctionState *gdfs = Object::cast_to<GDScriptFunctionState>(ret); if (gdfs && gdfs->function == function) completed = false; } @@ -1602,21 +1602,21 @@ Variant GDFunctionState::resume(const Variant &p_arg) { return ret; } -void GDFunctionState::_bind_methods() { +void GDScriptFunctionState::_bind_methods() { - ClassDB::bind_method(D_METHOD("resume", "arg"), &GDFunctionState::resume, DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("is_valid", "extended_check"), &GDFunctionState::is_valid, DEFVAL(false)); - ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &GDFunctionState::_signal_callback, MethodInfo("_signal_callback")); + ClassDB::bind_method(D_METHOD("resume", "arg"), &GDScriptFunctionState::resume, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("is_valid", "extended_check"), &GDScriptFunctionState::is_valid, DEFVAL(false)); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &GDScriptFunctionState::_signal_callback, MethodInfo("_signal_callback")); ADD_SIGNAL(MethodInfo("completed", PropertyInfo(Variant::NIL, "result", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT))); } -GDFunctionState::GDFunctionState() { +GDScriptFunctionState::GDScriptFunctionState() { function = NULL; } -GDFunctionState::~GDFunctionState() { +GDScriptFunctionState::~GDScriptFunctionState() { if (function != NULL) { //never called, deinitialize stack diff --git a/modules/gdscript/gd_function.h b/modules/gdscript/gdscript_function.h index bf5ff5f8da..03fd5d52dc 100644 --- a/modules/gdscript/gd_function.h +++ b/modules/gdscript/gdscript_function.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_function.h */ +/* gdscript_function.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,8 +27,8 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GD_FUNCTION_H -#define GD_FUNCTION_H +#ifndef GDSCRIPT_FUNCTION_H +#define GDSCRIPT_FUNCTION_H #include "os/thread.h" #include "pair.h" @@ -38,10 +38,10 @@ #include "string_db.h" #include "variant.h" -class GDInstance; +class GDScriptInstance; class GDScript; -class GDFunction { +class GDScriptFunction { public: enum Opcode { OPCODE_OPERATOR, @@ -111,7 +111,7 @@ public: }; private: - friend class GDCompiler; + friend class GDScriptCompiler; StringName source; @@ -145,12 +145,12 @@ private: List<StackDebug> stack_debug; - _FORCE_INLINE_ Variant *_get_variant(int p_address, GDInstance *p_instance, GDScript *p_script, Variant &self, Variant *p_stack, String &r_error) const; + _FORCE_INLINE_ Variant *_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant *p_stack, String &r_error) const; _FORCE_INLINE_ String _get_call_error(const Variant::CallError &p_err, const String &p_where, const Variant **argptrs) const; friend class GDScriptLanguage; - SelfList<GDFunction> function_list; + SelfList<GDScriptFunction> function_list; #ifdef DEBUG_ENABLED CharString func_cname; const char *_func_cname; @@ -176,7 +176,7 @@ public: ObjectID instance_id; //by debug only ObjectID script_id; - GDInstance *instance; + GDScriptInstance *instance; Vector<uint8_t> stack; int stack_size; Variant self; @@ -219,19 +219,19 @@ public: return default_arguments[p_idx]; } - Variant call(GDInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state = NULL); + Variant call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state = NULL); _FORCE_INLINE_ ScriptInstance::RPCMode get_rpc_mode() const { return rpc_mode; } - GDFunction(); - ~GDFunction(); + GDScriptFunction(); + ~GDScriptFunction(); }; -class GDFunctionState : public Reference { +class GDScriptFunctionState : public Reference { - GDCLASS(GDFunctionState, Reference); - friend class GDFunction; - GDFunction *function; - GDFunction::CallState state; + GDCLASS(GDScriptFunctionState, Reference); + friend class GDScriptFunction; + GDScriptFunction *function; + GDScriptFunction::CallState state; Variant _signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error); protected: @@ -240,8 +240,8 @@ protected: public: bool is_valid(bool p_extended_check = false) const; Variant resume(const Variant &p_arg = Variant()); - GDFunctionState(); - ~GDFunctionState(); + GDScriptFunctionState(); + ~GDScriptFunctionState(); }; -#endif // GD_FUNCTION_H +#endif // GDSCRIPT_FUNCTION_H diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gdscript_functions.cpp index b43ec409a1..c6066ceefb 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_functions.cpp */ +/* gdscript_functions.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,10 +27,11 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "gd_functions.h" +#include "gdscript_functions.h" + #include "class_db.h" #include "func_ref.h" -#include "gd_script.h" +#include "gdscript.h" #include "io/json.h" #include "io/marshalls.h" #include "math_funcs.h" @@ -38,7 +39,7 @@ #include "reference.h" #include "variant_parser.h" -const char *GDFunctions::get_func_name(Function p_func) { +const char *GDScriptFunctions::get_func_name(Function p_func) { ERR_FAIL_INDEX_V(p_func, FUNC_MAX, ""); @@ -123,7 +124,7 @@ const char *GDFunctions::get_func_name(Function p_func) { return _names[p_func]; } -void GDFunctions::call(Function p_func, const Variant **p_args, int p_arg_count, Variant &r_ret, Variant::CallError &r_error) { +void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_count, Variant &r_ret, Variant::CallError &r_error) { r_error.error = Variant::CallError::CALL_OK; #ifdef DEBUG_ENABLED @@ -641,7 +642,7 @@ void GDFunctions::call(Function p_func, const Variant **p_args, int p_arg_count, } //str+="\n"; - OS::get_singleton()->printerr("%s\n", str.utf8().get_data()); + print_error(str); r_ret = Variant(); } break; @@ -899,7 +900,7 @@ void GDFunctions::call(Function p_func, const Variant **p_args, int p_arg_count, return; } else { - GDInstance *ins = static_cast<GDInstance *>(obj->get_script_instance()); + GDScriptInstance *ins = static_cast<GDScriptInstance *>(obj->get_script_instance()); Ref<GDScript> base = ins->get_script(); if (base.is_null()) { @@ -1030,7 +1031,7 @@ void GDFunctions::call(Function p_func, const Variant **p_args, int p_arg_count, r_ret = gdscr->_new(NULL, 0, r_error); - GDInstance *ins = static_cast<GDInstance *>(static_cast<Object *>(r_ret)->get_script_instance()); + GDScriptInstance *ins = static_cast<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance()); Ref<GDScript> gd_ref = ins->get_script(); for (Map<StringName, GDScript::MemberInfo>::Element *E = gd_ref->member_indices.front(); E; E = E->next()) { @@ -1254,7 +1255,7 @@ void GDFunctions::call(Function p_func, const Variant **p_args, int p_arg_count, } } -bool GDFunctions::is_deterministic(Function p_func) { +bool GDScriptFunctions::is_deterministic(Function p_func) { //man i couldn't have chosen a worse function name, //way too controversial.. @@ -1317,7 +1318,7 @@ bool GDFunctions::is_deterministic(Function p_func) { return false; } -MethodInfo GDFunctions::get_info(Function p_func) { +MethodInfo GDScriptFunctions::get_info(Function p_func) { #ifdef TOOLS_ENABLED //using a switch, so the compiler generates a jumptable diff --git a/modules/gdscript/gd_functions.h b/modules/gdscript/gdscript_functions.h index 0de09f2e71..ecbede83a8 100644 --- a/modules/gdscript/gd_functions.h +++ b/modules/gdscript/gdscript_functions.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_functions.h */ +/* gdscript_functions.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,12 +27,12 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GD_FUNCTIONS_H -#define GD_FUNCTIONS_H +#ifndef GDSCRIPT_FUNCTIONS_H +#define GDSCRIPT_FUNCTIONS_H #include "variant.h" -class GDFunctions { +class GDScriptFunctions { public: enum Function { MATH_SIN, @@ -120,4 +120,4 @@ public: static MethodInfo get_info(Function p_func); }; -#endif // GD_FUNCTIONS_H +#endif // GDSCRIPT_FUNCTIONS_H diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gdscript_parser.cpp index d7e83c3a33..29b9865b1d 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_parser.cpp */ +/* gdscript_parser.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,15 +27,16 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "gd_parser.h" -#include "gd_script.h" +#include "gdscript_parser.h" + +#include "gdscript.h" #include "io/resource_loader.h" #include "os/file_access.h" #include "print_string.h" #include "script_language.h" template <class T> -T *GDParser::alloc_node() { +T *GDScriptParser::alloc_node() { T *t = memnew(T); @@ -50,21 +51,21 @@ T *GDParser::alloc_node() { return t; } -bool GDParser::_end_statement() { +bool GDScriptParser::_end_statement() { - if (tokenizer->get_token() == GDTokenizer::TK_SEMICOLON) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_SEMICOLON) { tokenizer->advance(); return true; //handle next - } else if (tokenizer->get_token() == GDTokenizer::TK_NEWLINE || tokenizer->get_token() == GDTokenizer::TK_EOF) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE || tokenizer->get_token() == GDScriptTokenizer::TK_EOF) { return true; //will be handled properly } return false; } -bool GDParser::_enter_indent_block(BlockNode *p_block) { +bool GDScriptParser::_enter_indent_block(BlockNode *p_block) { - if (tokenizer->get_token() != GDTokenizer::TK_COLON) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_COLON) { // report location at the previous token (on the previous line) int error_line = tokenizer->get_token_line(-1); int error_column = tokenizer->get_token_column(-1); @@ -73,7 +74,7 @@ bool GDParser::_enter_indent_block(BlockNode *p_block) { } tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_NEWLINE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_NEWLINE) { // be more python-like int current = tab_level.back()->get(); @@ -85,10 +86,10 @@ bool GDParser::_enter_indent_block(BlockNode *p_block) { while (true) { - if (tokenizer->get_token() != GDTokenizer::TK_NEWLINE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_NEWLINE) { return false; //wtf - } else if (tokenizer->get_token(1) != GDTokenizer::TK_NEWLINE) { + } else if (tokenizer->get_token(1) != GDScriptTokenizer::TK_NEWLINE) { int indent = tokenizer->get_token_line_indent(); int current = tab_level.back()->get(); @@ -113,9 +114,9 @@ bool GDParser::_enter_indent_block(BlockNode *p_block) { } } -bool GDParser::_parse_arguments(Node *p_parent, Vector<Node *> &p_args, bool p_static, bool p_can_codecomplete) { +bool GDScriptParser::_parse_arguments(Node *p_parent, Vector<Node *> &p_args, bool p_static, bool p_can_codecomplete) { - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { tokenizer->advance(); } else { @@ -124,10 +125,10 @@ bool GDParser::_parse_arguments(Node *p_parent, Vector<Node *> &p_args, bool p_s while (true) { - if (tokenizer->get_token() == GDTokenizer::TK_CURSOR) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CURSOR) { _make_completable_call(argidx); completion_node = p_parent; - } else if (tokenizer->get_token() == GDTokenizer::TK_CONSTANT && tokenizer->get_token_constant().get_type() == Variant::STRING && tokenizer->get_token(1) == GDTokenizer::TK_CURSOR) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CONSTANT && tokenizer->get_token_constant().get_type() == Variant::STRING && tokenizer->get_token(1) == GDScriptTokenizer::TK_CURSOR) { //completing a string argument.. completion_cursor = tokenizer->get_token_constant(); @@ -143,13 +144,13 @@ bool GDParser::_parse_arguments(Node *p_parent, Vector<Node *> &p_args, bool p_s p_args.push_back(arg); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { tokenizer->advance(); break; - } else if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { - if (tokenizer->get_token(1) == GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token(1) == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expression expected"); return false; @@ -169,7 +170,7 @@ bool GDParser::_parse_arguments(Node *p_parent, Vector<Node *> &p_args, bool p_s return true; } -void GDParser::_make_completable_call(int p_arg) { +void GDScriptParser::_make_completable_call(int p_arg) { completion_cursor = StringName(); completion_type = COMPLETION_CALL_ARGUMENTS; @@ -182,14 +183,14 @@ void GDParser::_make_completable_call(int p_arg) { tokenizer->advance(); } -bool GDParser::_get_completable_identifier(CompletionType p_type, StringName &identifier) { +bool GDScriptParser::_get_completable_identifier(CompletionType p_type, StringName &identifier) { identifier = StringName(); if (tokenizer->is_token_literal()) { identifier = tokenizer->get_token_literal(); tokenizer->advance(); } - if (tokenizer->get_token() == GDTokenizer::TK_CURSOR) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CURSOR) { completion_cursor = identifier; completion_type = p_type; @@ -206,7 +207,7 @@ bool GDParser::_get_completable_identifier(CompletionType p_type, StringName &id tokenizer->advance(); } - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_OPEN) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_OPEN) { completion_ident_is_call = true; } return true; @@ -215,7 +216,7 @@ bool GDParser::_get_completable_identifier(CompletionType p_type, StringName &id return false; } -GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool p_allow_assign, bool p_parsing_constant) { +GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_static, bool p_allow_assign, bool p_parsing_constant) { //Vector<Node*> expressions; //Vector<OperatorNode::Operator> operators; @@ -234,12 +235,12 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool if (parenthesis > 0) { //remove empty space (only allowed if inside parenthesis - while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { + while (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) { tokenizer->advance(); } } - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_OPEN) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_OPEN) { //subexpression () tokenizer->advance(); parenthesis++; @@ -248,7 +249,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool if (!subexpr) return NULL; - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ')' in expression"); return NULL; @@ -256,7 +257,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool tokenizer->advance(); expr = subexpr; - } else if (tokenizer->get_token() == GDTokenizer::TK_DOLLAR) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_DOLLAR) { tokenizer->advance(); String path; @@ -267,7 +268,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool while (!done) { switch (tokenizer->get_token()) { - case GDTokenizer::TK_CURSOR: { + case GDScriptTokenizer::TK_CURSOR: { completion_cursor = StringName(); completion_type = COMPLETION_GET_NODE; completion_class = current_class; @@ -279,7 +280,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool completion_found = true; tokenizer->advance(); } break; - case GDTokenizer::TK_CONSTANT: { + case GDScriptTokenizer::TK_CONSTANT: { if (!need_identifier) { done = true; @@ -296,7 +297,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool need_identifier = false; } break; - case GDTokenizer::TK_OP_DIV: { + case GDScriptTokenizer::TK_OP_DIV: { if (need_identifier) { done = true; @@ -344,56 +345,56 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool expr = op; - } else if (tokenizer->get_token() == GDTokenizer::TK_CURSOR) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CURSOR) { tokenizer->advance(); continue; //no point in cursor in the middle of expression - } else if (tokenizer->get_token() == GDTokenizer::TK_CONSTANT) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CONSTANT) { //constant defined by tokenizer ConstantNode *constant = alloc_node<ConstantNode>(); constant->value = tokenizer->get_token_constant(); tokenizer->advance(); expr = constant; - } else if (tokenizer->get_token() == GDTokenizer::TK_CONST_PI) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CONST_PI) { //constant defined by tokenizer ConstantNode *constant = alloc_node<ConstantNode>(); constant->value = Math_PI; tokenizer->advance(); expr = constant; - } else if (tokenizer->get_token() == GDTokenizer::TK_CONST_TAU) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CONST_TAU) { //constant defined by tokenizer ConstantNode *constant = alloc_node<ConstantNode>(); constant->value = Math_TAU; tokenizer->advance(); expr = constant; - } else if (tokenizer->get_token() == GDTokenizer::TK_CONST_INF) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CONST_INF) { //constant defined by tokenizer ConstantNode *constant = alloc_node<ConstantNode>(); constant->value = Math_INF; tokenizer->advance(); expr = constant; - } else if (tokenizer->get_token() == GDTokenizer::TK_CONST_NAN) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CONST_NAN) { //constant defined by tokenizer ConstantNode *constant = alloc_node<ConstantNode>(); constant->value = Math_NAN; tokenizer->advance(); expr = constant; - } else if (tokenizer->get_token() == GDTokenizer::TK_PR_PRELOAD) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_PR_PRELOAD) { //constant defined by tokenizer tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_OPEN) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) { _set_error("Expected '(' after 'preload'"); return NULL; } tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_CURSOR) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CURSOR) { completion_cursor = StringName(); completion_node = p_parent; completion_type = COMPLETION_RESOURCE_PATH; @@ -473,7 +474,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool } } - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ')' after 'preload' path"); return NULL; } @@ -483,12 +484,12 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool constant->value = res; expr = constant; - } else if (tokenizer->get_token() == GDTokenizer::TK_PR_YIELD) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_PR_YIELD) { //constant defined by tokenizer tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_OPEN) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) { _set_error("Expected '(' after 'yield'"); return NULL; } @@ -498,11 +499,11 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool OperatorNode *yield = alloc_node<OperatorNode>(); yield->op = OperatorNode::OP_YIELD; - while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { + while (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) { tokenizer->advance(); } - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { expr = yield; tokenizer->advance(); } else { @@ -514,14 +515,14 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool return NULL; yield->arguments.push_back(object); - if (tokenizer->get_token() != GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) { _set_error("Expected ',' after first argument of 'yield'"); return NULL; } tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_CURSOR) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CURSOR) { completion_cursor = StringName(); completion_node = object; @@ -540,7 +541,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool return NULL; yield->arguments.push_back(signal); - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ')' after second argument of 'yield'"); return NULL; } @@ -552,7 +553,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool expr = yield; } - } else if (tokenizer->get_token() == GDTokenizer::TK_SELF) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_SELF) { if (p_static) { _set_error("'self'' not allowed in static function or constant expression"); @@ -562,7 +563,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool SelfNode *self = alloc_node<SelfNode>(); tokenizer->advance(); expr = self; - } else if (tokenizer->get_token() == GDTokenizer::TK_BUILT_IN_TYPE && tokenizer->get_token(1) == GDTokenizer::TK_PERIOD) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE && tokenizer->get_token(1) == GDScriptTokenizer::TK_PERIOD) { Variant::Type bi_type = tokenizer->get_token_type(); tokenizer->advance(2); @@ -589,20 +590,20 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool cn->value = Variant::get_numeric_constant_value(bi_type, identifier); expr = cn; - } else if (tokenizer->get_token(1) == GDTokenizer::TK_PARENTHESIS_OPEN && tokenizer->is_token_literal()) { + } else if (tokenizer->get_token(1) == GDScriptTokenizer::TK_PARENTHESIS_OPEN && tokenizer->is_token_literal()) { // We check with is_token_literal, as this allows us to use match/sync/etc. as a name //function or constructor OperatorNode *op = alloc_node<OperatorNode>(); op->op = OperatorNode::OP_CALL; - if (tokenizer->get_token() == GDTokenizer::TK_BUILT_IN_TYPE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) { TypeNode *tn = alloc_node<TypeNode>(); tn->vtype = tokenizer->get_token_type(); op->arguments.push_back(tn); tokenizer->advance(2); - } else if (tokenizer->get_token() == GDTokenizer::TK_BUILT_IN_FUNC) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_FUNC) { BuiltInFunctionNode *bn = alloc_node<BuiltInFunctionNode>(); bn->function = tokenizer->get_token_built_in_func(); @@ -623,7 +624,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool tokenizer->advance(1); } - if (tokenizer->get_token() == GDTokenizer::TK_CURSOR) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CURSOR) { _make_completable_call(0); completion_node = op; } @@ -668,7 +669,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool expr = id; } - } else if (tokenizer->get_token() == GDTokenizer::TK_OP_ADD || tokenizer->get_token() == GDTokenizer::TK_OP_SUB || tokenizer->get_token() == GDTokenizer::TK_OP_NOT || tokenizer->get_token() == GDTokenizer::TK_OP_BIT_INVERT) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ADD || tokenizer->get_token() == GDScriptTokenizer::TK_OP_SUB || tokenizer->get_token() == GDScriptTokenizer::TK_OP_NOT || tokenizer->get_token() == GDScriptTokenizer::TK_OP_BIT_INVERT) { //single prefix operators like !expr +expr -expr ++expr --expr alloc_node<OperatorNode>(); @@ -676,16 +677,16 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool e.is_op = true; switch (tokenizer->get_token()) { - case GDTokenizer::TK_OP_ADD: e.op = OperatorNode::OP_POS; break; - case GDTokenizer::TK_OP_SUB: e.op = OperatorNode::OP_NEG; break; - case GDTokenizer::TK_OP_NOT: e.op = OperatorNode::OP_NOT; break; - case GDTokenizer::TK_OP_BIT_INVERT: e.op = OperatorNode::OP_BIT_INVERT; break; + case GDScriptTokenizer::TK_OP_ADD: e.op = OperatorNode::OP_POS; break; + case GDScriptTokenizer::TK_OP_SUB: e.op = OperatorNode::OP_NEG; break; + case GDScriptTokenizer::TK_OP_NOT: e.op = OperatorNode::OP_NOT; break; + case GDScriptTokenizer::TK_OP_BIT_INVERT: e.op = OperatorNode::OP_BIT_INVERT; break; default: {} } tokenizer->advance(); - if (e.op != OperatorNode::OP_NOT && tokenizer->get_token() == GDTokenizer::TK_OP_NOT) { + if (e.op != OperatorNode::OP_NOT && tokenizer->get_token() == GDScriptTokenizer::TK_OP_NOT) { _set_error("Misplaced 'not'."); return NULL; } @@ -700,7 +701,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool op->arguments.push_back(subexpr); expr=op;*/ - } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_OPEN) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_BRACKET_OPEN) { // array tokenizer->advance(); @@ -709,18 +710,18 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool while (true) { - if (tokenizer->get_token() == GDTokenizer::TK_EOF) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_EOF) { _set_error("Unterminated array"); return NULL; - } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_BRACKET_CLOSE) { tokenizer->advance(); break; - } else if (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) { tokenizer->advance(); //ignore newline - } else if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { if (!expecting_comma) { _set_error("expression or ']' expected"); return NULL; @@ -743,7 +744,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool } expr = arr; - } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_OPEN) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CURLY_BRACKET_OPEN) { // array tokenizer->advance(); @@ -765,12 +766,12 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool while (true) { - if (tokenizer->get_token() == GDTokenizer::TK_EOF) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_EOF) { _set_error("Unterminated dictionary"); return NULL; - } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CURLY_BRACKET_CLOSE) { if (expecting == DICT_EXPECT_COLON) { _set_error("':' expected"); @@ -782,10 +783,10 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool } tokenizer->advance(); break; - } else if (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) { tokenizer->advance(); //ignore newline - } else if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { if (expecting == DICT_EXPECT_KEY) { _set_error("key or '}' expected"); @@ -803,7 +804,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool expecting = DICT_EXPECT_KEY; tokenizer->advance(); //ignore newline - } else if (tokenizer->get_token() == GDTokenizer::TK_COLON) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) { if (expecting == DICT_EXPECT_KEY) { _set_error("key or '}' expected"); @@ -833,7 +834,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool if (expecting == DICT_EXPECT_KEY) { - if (tokenizer->is_token_literal() && tokenizer->get_token(1) == GDTokenizer::TK_OP_ASSIGN) { + if (tokenizer->is_token_literal() && tokenizer->get_token(1) == GDScriptTokenizer::TK_OP_ASSIGN) { // We check with is_token_literal, as this allows us to use match/sync/etc. as a name //lua style identifier, easier to write ConstantNode *cn = alloc_node<ConstantNode>(); @@ -856,8 +857,8 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool return NULL; expecting = DICT_EXPECT_COMMA; - if (key->type == GDParser::Node::TYPE_CONSTANT) { - Variant const &keyName = static_cast<const GDParser::ConstantNode *>(key)->value; + if (key->type == GDScriptParser::Node::TYPE_CONSTANT) { + Variant const &keyName = static_cast<const GDScriptParser::ConstantNode *>(key)->value; if (keys.has(keyName)) { _set_error("Duplicate key found in Dictionary literal"); @@ -877,7 +878,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool expr = dict; - } else if (tokenizer->get_token() == GDTokenizer::TK_PERIOD && (tokenizer->is_token_literal(1) || tokenizer->get_token(1) == GDTokenizer::TK_CURSOR) && tokenizer->get_token(2) == GDTokenizer::TK_PARENTHESIS_OPEN) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_PERIOD && (tokenizer->is_token_literal(1) || tokenizer->get_token(1) == GDScriptTokenizer::TK_CURSOR) && tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_OPEN) { // We check with is_token_literal, as this allows us to use match/sync/etc. as a name // parent call @@ -914,7 +915,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool } if (!expr) { - ERR_EXPLAIN("GDParser bug, couldn't figure out what expression is.."); + ERR_EXPLAIN("GDScriptParser bug, couldn't figure out what expression is.."); ERR_FAIL_COND_V(!expr, NULL); } @@ -926,15 +927,15 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool //expressions can be indexed any number of times - if (tokenizer->get_token() == GDTokenizer::TK_PERIOD) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PERIOD) { //indexing using "." - if (tokenizer->get_token(1) != GDTokenizer::TK_CURSOR && !tokenizer->is_token_literal(1)) { + if (tokenizer->get_token(1) != GDScriptTokenizer::TK_CURSOR && !tokenizer->is_token_literal(1)) { // We check with is_token_literal, as this allows us to use match/sync/etc. as a name _set_error("Expected identifier as member"); return NULL; - } else if (tokenizer->get_token(2) == GDTokenizer::TK_PARENTHESIS_OPEN) { + } else if (tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_OPEN) { //call!! OperatorNode *op = alloc_node<OperatorNode>(); op->op = OperatorNode::OP_CALL; @@ -942,10 +943,10 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool tokenizer->advance(); IdentifierNode *id = alloc_node<IdentifierNode>(); - if (tokenizer->get_token() == GDTokenizer::TK_BUILT_IN_FUNC) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_FUNC) { //small hack so built in funcs don't obfuscate methods - id->name = GDFunctions::get_func_name(tokenizer->get_token_built_in_func()); + id->name = GDScriptFunctions::get_func_name(tokenizer->get_token_built_in_func()); tokenizer->advance(); } else { @@ -962,7 +963,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool op->arguments.push_back(id); // call func //get arguments tokenizer->advance(1); - if (tokenizer->get_token() == GDTokenizer::TK_CURSOR) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CURSOR) { _make_completable_call(0); completion_node = op; } @@ -997,7 +998,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool expr = op; } - } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_OPEN) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_BRACKET_OPEN) { //indexing using "[]" OperatorNode *op = alloc_node<OperatorNode>(); op->op = OperatorNode::OP_INDEX; @@ -1009,7 +1010,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool return NULL; } - if (tokenizer->get_token() != GDTokenizer::TK_BRACKET_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_BRACKET_CLOSE) { _set_error("Expected ']'"); return NULL; } @@ -1029,7 +1030,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool if (parenthesis > 0) { //remove empty space (only allowed if inside parenthesis - while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { + while (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) { tokenizer->advance(); } } @@ -1054,29 +1055,29 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool switch (tokenizer->get_token()) { //see operator - case GDTokenizer::TK_OP_IN: op = OperatorNode::OP_IN; break; - case GDTokenizer::TK_OP_EQUAL: op = OperatorNode::OP_EQUAL; break; - case GDTokenizer::TK_OP_NOT_EQUAL: op = OperatorNode::OP_NOT_EQUAL; break; - case GDTokenizer::TK_OP_LESS: op = OperatorNode::OP_LESS; break; - case GDTokenizer::TK_OP_LESS_EQUAL: op = OperatorNode::OP_LESS_EQUAL; break; - case GDTokenizer::TK_OP_GREATER: op = OperatorNode::OP_GREATER; break; - case GDTokenizer::TK_OP_GREATER_EQUAL: op = OperatorNode::OP_GREATER_EQUAL; break; - case GDTokenizer::TK_OP_AND: op = OperatorNode::OP_AND; break; - case GDTokenizer::TK_OP_OR: op = OperatorNode::OP_OR; break; - case GDTokenizer::TK_OP_ADD: op = OperatorNode::OP_ADD; break; - case GDTokenizer::TK_OP_SUB: op = OperatorNode::OP_SUB; break; - case GDTokenizer::TK_OP_MUL: op = OperatorNode::OP_MUL; break; - case GDTokenizer::TK_OP_DIV: op = OperatorNode::OP_DIV; break; - case GDTokenizer::TK_OP_MOD: + case GDScriptTokenizer::TK_OP_IN: op = OperatorNode::OP_IN; break; + case GDScriptTokenizer::TK_OP_EQUAL: op = OperatorNode::OP_EQUAL; break; + case GDScriptTokenizer::TK_OP_NOT_EQUAL: op = OperatorNode::OP_NOT_EQUAL; break; + case GDScriptTokenizer::TK_OP_LESS: op = OperatorNode::OP_LESS; break; + case GDScriptTokenizer::TK_OP_LESS_EQUAL: op = OperatorNode::OP_LESS_EQUAL; break; + case GDScriptTokenizer::TK_OP_GREATER: op = OperatorNode::OP_GREATER; break; + case GDScriptTokenizer::TK_OP_GREATER_EQUAL: op = OperatorNode::OP_GREATER_EQUAL; break; + case GDScriptTokenizer::TK_OP_AND: op = OperatorNode::OP_AND; break; + case GDScriptTokenizer::TK_OP_OR: op = OperatorNode::OP_OR; break; + case GDScriptTokenizer::TK_OP_ADD: op = OperatorNode::OP_ADD; break; + case GDScriptTokenizer::TK_OP_SUB: op = OperatorNode::OP_SUB; break; + case GDScriptTokenizer::TK_OP_MUL: op = OperatorNode::OP_MUL; break; + case GDScriptTokenizer::TK_OP_DIV: op = OperatorNode::OP_DIV; break; + case GDScriptTokenizer::TK_OP_MOD: op = OperatorNode::OP_MOD; break; - //case GDTokenizer::TK_OP_NEG: op=OperatorNode::OP_NEG ; break; - case GDTokenizer::TK_OP_SHIFT_LEFT: op = OperatorNode::OP_SHIFT_LEFT; break; - case GDTokenizer::TK_OP_SHIFT_RIGHT: op = OperatorNode::OP_SHIFT_RIGHT; break; - case GDTokenizer::TK_OP_ASSIGN: { + //case GDScriptTokenizer::TK_OP_NEG: op=OperatorNode::OP_NEG ; break; + case GDScriptTokenizer::TK_OP_SHIFT_LEFT: op = OperatorNode::OP_SHIFT_LEFT; break; + case GDScriptTokenizer::TK_OP_SHIFT_RIGHT: op = OperatorNode::OP_SHIFT_RIGHT; break; + case GDScriptTokenizer::TK_OP_ASSIGN: { _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN; - if (tokenizer->get_token(1) == GDTokenizer::TK_CURSOR) { + if (tokenizer->get_token(1) == GDScriptTokenizer::TK_CURSOR) { //code complete assignment completion_type = COMPLETION_ASSIGN; completion_node = expr; @@ -1089,22 +1090,22 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool } } break; - case GDTokenizer::TK_OP_ASSIGN_ADD: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_ADD; break; - case GDTokenizer::TK_OP_ASSIGN_SUB: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SUB; break; - case GDTokenizer::TK_OP_ASSIGN_MUL: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_MUL; break; - case GDTokenizer::TK_OP_ASSIGN_DIV: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_DIV; break; - case GDTokenizer::TK_OP_ASSIGN_MOD: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_MOD; break; - case GDTokenizer::TK_OP_ASSIGN_SHIFT_LEFT: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SHIFT_LEFT; break; - case GDTokenizer::TK_OP_ASSIGN_SHIFT_RIGHT: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SHIFT_RIGHT; break; - case GDTokenizer::TK_OP_ASSIGN_BIT_AND: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_AND; break; - case GDTokenizer::TK_OP_ASSIGN_BIT_OR: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_OR; break; - case GDTokenizer::TK_OP_ASSIGN_BIT_XOR: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_XOR; break; - case GDTokenizer::TK_OP_BIT_AND: op = OperatorNode::OP_BIT_AND; break; - case GDTokenizer::TK_OP_BIT_OR: op = OperatorNode::OP_BIT_OR; break; - case GDTokenizer::TK_OP_BIT_XOR: op = OperatorNode::OP_BIT_XOR; break; - case GDTokenizer::TK_PR_IS: op = OperatorNode::OP_IS; break; - case GDTokenizer::TK_CF_IF: op = OperatorNode::OP_TERNARY_IF; break; - case GDTokenizer::TK_CF_ELSE: op = OperatorNode::OP_TERNARY_ELSE; break; + case GDScriptTokenizer::TK_OP_ASSIGN_ADD: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_ADD; break; + case GDScriptTokenizer::TK_OP_ASSIGN_SUB: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SUB; break; + case GDScriptTokenizer::TK_OP_ASSIGN_MUL: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_MUL; break; + case GDScriptTokenizer::TK_OP_ASSIGN_DIV: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_DIV; break; + case GDScriptTokenizer::TK_OP_ASSIGN_MOD: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_MOD; break; + case GDScriptTokenizer::TK_OP_ASSIGN_SHIFT_LEFT: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SHIFT_LEFT; break; + case GDScriptTokenizer::TK_OP_ASSIGN_SHIFT_RIGHT: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_SHIFT_RIGHT; break; + case GDScriptTokenizer::TK_OP_ASSIGN_BIT_AND: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_AND; break; + case GDScriptTokenizer::TK_OP_ASSIGN_BIT_OR: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_OR; break; + case GDScriptTokenizer::TK_OP_ASSIGN_BIT_XOR: _VALIDATE_ASSIGN op = OperatorNode::OP_ASSIGN_BIT_XOR; break; + case GDScriptTokenizer::TK_OP_BIT_AND: op = OperatorNode::OP_BIT_AND; break; + case GDScriptTokenizer::TK_OP_BIT_OR: op = OperatorNode::OP_BIT_OR; break; + case GDScriptTokenizer::TK_OP_BIT_XOR: op = OperatorNode::OP_BIT_XOR; break; + case GDScriptTokenizer::TK_PR_IS: op = OperatorNode::OP_IS; break; + case GDScriptTokenizer::TK_CF_IF: op = OperatorNode::OP_TERNARY_IF; break; + case GDScriptTokenizer::TK_CF_ELSE: op = OperatorNode::OP_TERNARY_ELSE; break; default: valid = false; break; } @@ -1212,7 +1213,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool case OperatorNode::OP_ASSIGN_BIT_XOR: priority = 15; break; default: { - _set_error("GDParser bug, invalid operator in expression: " + itos(expression[i].op)); + _set_error("GDScriptParser bug, invalid operator in expression: " + itos(expression[i].op)); return NULL; } } @@ -1358,7 +1359,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool return expression[0].node; } -GDParser::Node *GDParser::_reduce_expression(Node *p_node, bool p_to_const) { +GDScriptParser::Node *GDScriptParser::_reduce_expression(Node *p_node, bool p_to_const) { switch (p_node->type) { @@ -1455,7 +1456,7 @@ GDParser::Node *GDParser::_reduce_expression(Node *p_node, bool p_to_const) { } else if (op->op == OperatorNode::OP_CALL) { //can reduce base type constructors - if ((op->arguments[0]->type == Node::TYPE_TYPE || (op->arguments[0]->type == Node::TYPE_BUILT_IN_FUNCTION && GDFunctions::is_deterministic(static_cast<BuiltInFunctionNode *>(op->arguments[0])->function))) && last_not_constant == 0) { + if ((op->arguments[0]->type == Node::TYPE_TYPE || (op->arguments[0]->type == Node::TYPE_BUILT_IN_FUNCTION && GDScriptFunctions::is_deterministic(static_cast<BuiltInFunctionNode *>(op->arguments[0])->function))) && last_not_constant == 0) { //native type constructor or intrinsic function const Variant **vptr = NULL; @@ -1480,8 +1481,8 @@ GDParser::Node *GDParser::_reduce_expression(Node *p_node, bool p_to_const) { v = Variant::construct(tn->vtype, vptr, ptrs.size(), ce); } else { - GDFunctions::Function func = static_cast<BuiltInFunctionNode *>(op->arguments[0])->function; - GDFunctions::call(func, vptr, ptrs.size(), v, ce); + GDScriptFunctions::Function func = static_cast<BuiltInFunctionNode *>(op->arguments[0])->function; + GDScriptFunctions::call(func, vptr, ptrs.size(), v, ce); } if (ce.error != Variant::CallError::CALL_OK) { @@ -1492,8 +1493,8 @@ GDParser::Node *GDParser::_reduce_expression(Node *p_node, bool p_to_const) { errwhere = "'" + Variant::get_type_name(tn->vtype) + "'' constructor"; } else { - GDFunctions::Function func = static_cast<BuiltInFunctionNode *>(op->arguments[0])->function; - errwhere = String("'") + GDFunctions::get_func_name(func) + "'' intrinsic function"; + GDScriptFunctions::Function func = static_cast<BuiltInFunctionNode *>(op->arguments[0])->function; + errwhere = String("'") + GDScriptFunctions::get_func_name(func) + "'' intrinsic function"; } switch (ce.error) { @@ -1743,7 +1744,7 @@ GDParser::Node *GDParser::_reduce_expression(Node *p_node, bool p_to_const) { } } -GDParser::Node *GDParser::_parse_and_reduce_expression(Node *p_parent, bool p_static, bool p_reduce_const, bool p_allow_assign) { +GDScriptParser::Node *GDScriptParser::_parse_and_reduce_expression(Node *p_parent, bool p_static, bool p_reduce_const, bool p_allow_assign) { Node *expr = _parse_expression(p_parent, p_static, p_allow_assign, p_reduce_const); if (!expr || error_set) @@ -1754,58 +1755,58 @@ GDParser::Node *GDParser::_parse_and_reduce_expression(Node *p_parent, bool p_st return expr; } -bool GDParser::_recover_from_completion() { +bool GDScriptParser::_recover_from_completion() { if (!completion_found) { return false; //can't recover if no completion } //skip stuff until newline - while (tokenizer->get_token() != GDTokenizer::TK_NEWLINE && tokenizer->get_token() != GDTokenizer::TK_EOF && tokenizer->get_token() != GDTokenizer::TK_ERROR) { + while (tokenizer->get_token() != GDScriptTokenizer::TK_NEWLINE && tokenizer->get_token() != GDScriptTokenizer::TK_EOF && tokenizer->get_token() != GDScriptTokenizer::TK_ERROR) { tokenizer->advance(); } completion_found = false; error_set = false; - if (tokenizer->get_token() == GDTokenizer::TK_ERROR) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_ERROR) { error_set = true; } return true; } -GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) { +GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) { PatternNode *pattern = alloc_node<PatternNode>(); - GDTokenizer::Token token = tokenizer->get_token(); + GDScriptTokenizer::Token token = tokenizer->get_token(); if (error_set) return NULL; - if (token == GDTokenizer::TK_EOF) { + if (token == GDScriptTokenizer::TK_EOF) { return NULL; } switch (token) { // array - case GDTokenizer::TK_BRACKET_OPEN: { + case GDScriptTokenizer::TK_BRACKET_OPEN: { tokenizer->advance(); - pattern->pt_type = GDParser::PatternNode::PT_ARRAY; + pattern->pt_type = GDScriptParser::PatternNode::PT_ARRAY; while (true) { - if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_BRACKET_CLOSE) { tokenizer->advance(); break; } - if (tokenizer->get_token() == GDTokenizer::TK_PERIOD && tokenizer->get_token(1) == GDTokenizer::TK_PERIOD) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PERIOD && tokenizer->get_token(1) == GDScriptTokenizer::TK_PERIOD) { // match everything tokenizer->advance(2); PatternNode *sub_pattern = alloc_node<PatternNode>(); - sub_pattern->pt_type = GDParser::PatternNode::PT_IGNORE_REST; + sub_pattern->pt_type = GDScriptParser::PatternNode::PT_IGNORE_REST; pattern->array.push_back(sub_pattern); - if (tokenizer->get_token() == GDTokenizer::TK_COMMA && tokenizer->get_token(1) == GDTokenizer::TK_BRACKET_CLOSE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA && tokenizer->get_token(1) == GDScriptTokenizer::TK_BRACKET_CLOSE) { tokenizer->advance(2); break; - } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_BRACKET_CLOSE) { tokenizer->advance(1); break; } else { @@ -1821,10 +1822,10 @@ GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) { pattern->array.push_back(sub_pattern); - if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); continue; - } else if (tokenizer->get_token() == GDTokenizer::TK_BRACKET_CLOSE) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_BRACKET_CLOSE) { tokenizer->advance(); break; } else { @@ -1834,33 +1835,33 @@ GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) { } } break; // bind - case GDTokenizer::TK_PR_VAR: { + case GDScriptTokenizer::TK_PR_VAR: { tokenizer->advance(); - pattern->pt_type = GDParser::PatternNode::PT_BIND; + pattern->pt_type = GDScriptParser::PatternNode::PT_BIND; pattern->bind = tokenizer->get_token_identifier(); tokenizer->advance(); } break; // dictionary - case GDTokenizer::TK_CURLY_BRACKET_OPEN: { + case GDScriptTokenizer::TK_CURLY_BRACKET_OPEN: { tokenizer->advance(); - pattern->pt_type = GDParser::PatternNode::PT_DICTIONARY; + pattern->pt_type = GDScriptParser::PatternNode::PT_DICTIONARY; while (true) { - if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CURLY_BRACKET_CLOSE) { tokenizer->advance(); break; } - if (tokenizer->get_token() == GDTokenizer::TK_PERIOD && tokenizer->get_token(1) == GDTokenizer::TK_PERIOD) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PERIOD && tokenizer->get_token(1) == GDScriptTokenizer::TK_PERIOD) { // match everything tokenizer->advance(2); PatternNode *sub_pattern = alloc_node<PatternNode>(); sub_pattern->pt_type = PatternNode::PT_IGNORE_REST; pattern->array.push_back(sub_pattern); - if (tokenizer->get_token() == GDTokenizer::TK_COMMA && tokenizer->get_token(1) == GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA && tokenizer->get_token(1) == GDScriptTokenizer::TK_CURLY_BRACKET_CLOSE) { tokenizer->advance(2); break; - } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CURLY_BRACKET_CLOSE) { tokenizer->advance(1); break; } else { @@ -1875,12 +1876,12 @@ GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) { return NULL; } - if (key->type != GDParser::Node::TYPE_CONSTANT) { + if (key->type != GDScriptParser::Node::TYPE_CONSTANT) { _set_error("Not a constant expression as key"); return NULL; } - if (tokenizer->get_token() == GDTokenizer::TK_COLON) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) { tokenizer->advance(); PatternNode *value = _parse_pattern(p_static); @@ -1894,10 +1895,10 @@ GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) { pattern->dictionary.insert(static_cast<ConstantNode *>(key), NULL); } - if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); continue; - } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CURLY_BRACKET_CLOSE) { tokenizer->advance(); break; } else { @@ -1906,7 +1907,7 @@ GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) { } } } break; - case GDTokenizer::TK_WILDCARD: { + case GDScriptTokenizer::TK_WILDCARD: { tokenizer->advance(); pattern->pt_type = PatternNode::PT_WILDCARD; } break; @@ -1950,15 +1951,15 @@ GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) { return pattern; } -void GDParser::_parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode *> &p_branches, bool p_static) { +void GDScriptParser::_parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode *> &p_branches, bool p_static) { int indent_level = tab_level.back()->get(); while (true) { - while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE && _parse_newline()) + while (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE && _parse_newline()) ; - // GDTokenizer::Token token = tokenizer->get_token(); + // GDScriptTokenizer::Token token = tokenizer->get_token(); if (error_set) return; @@ -1977,7 +1978,7 @@ void GDParser::_parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode return; } - while (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + while (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); branch->patterns.push_back(_parse_pattern(p_static)); if (!branch->patterns[branch->patterns.size() - 1]) { @@ -2003,13 +2004,13 @@ void GDParser::_parse_pattern_block(BlockNode *p_block, Vector<PatternBranchNode } } -void GDParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, Node *&p_resulting_node, Map<StringName, Node *> &p_bindings) { +void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, Node *&p_resulting_node, Map<StringName, Node *> &p_bindings) { switch (p_pattern->pt_type) { case PatternNode::PT_CONSTANT: { // typecheck BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>(); - typeof_node->function = GDFunctions::TYPE_OF; + typeof_node->function = GDScriptFunctions::TYPE_OF; OperatorNode *typeof_match_value = alloc_node<OperatorNode>(); typeof_match_value->op = OperatorNode::OP_CALL; @@ -2064,7 +2065,7 @@ void GDParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, { // typecheck BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>(); - typeof_node->function = GDFunctions::TYPE_OF; + typeof_node->function = GDScriptFunctions::TYPE_OF; OperatorNode *typeof_match_value = alloc_node<OperatorNode>(); typeof_match_value->op = OperatorNode::OP_CALL; @@ -2143,7 +2144,7 @@ void GDParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, { // typecheck BuiltInFunctionNode *typeof_node = alloc_node<BuiltInFunctionNode>(); - typeof_node->function = GDFunctions::TYPE_OF; + typeof_node->function = GDScriptFunctions::TYPE_OF; OperatorNode *typeof_match_value = alloc_node<OperatorNode>(); typeof_match_value->op = OperatorNode::OP_CALL; @@ -2241,7 +2242,7 @@ void GDParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_match, } } -void GDParser::_transform_match_statment(BlockNode *p_block, MatchNode *p_match_statement) { +void GDScriptParser::_transform_match_statment(BlockNode *p_block, MatchNode *p_match_statement) { IdentifierNode *id = alloc_node<IdentifierNode>(); id->name = "#match_value"; @@ -2305,7 +2306,7 @@ void GDParser::_transform_match_statment(BlockNode *p_block, MatchNode *p_match_ } } -void GDParser::_parse_block(BlockNode *p_block, bool p_static) { +void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { int indent_level = tab_level.back()->get(); @@ -2328,7 +2329,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { } is_first_line = false; - GDTokenizer::Token token = tokenizer->get_token(); + GDScriptTokenizer::Token token = tokenizer->get_token(); if (error_set) return; @@ -2347,15 +2348,15 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { switch (token) { - case GDTokenizer::TK_EOF: + case GDScriptTokenizer::TK_EOF: p_block->end_line = tokenizer->get_token_line(); - case GDTokenizer::TK_ERROR: { + case GDScriptTokenizer::TK_ERROR: { return; //go back //end of file! } break; - case GDTokenizer::TK_NEWLINE: { + case GDScriptTokenizer::TK_NEWLINE: { if (!_parse_newline()) { if (!error_set) { @@ -2370,19 +2371,19 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { p_block->statements.push_back(nl); } break; - case GDTokenizer::TK_CF_PASS: { - if (tokenizer->get_token(1) != GDTokenizer::TK_SEMICOLON && tokenizer->get_token(1) != GDTokenizer::TK_NEWLINE && tokenizer->get_token(1) != GDTokenizer::TK_EOF) { + case GDScriptTokenizer::TK_CF_PASS: { + if (tokenizer->get_token(1) != GDScriptTokenizer::TK_SEMICOLON && tokenizer->get_token(1) != GDScriptTokenizer::TK_NEWLINE && tokenizer->get_token(1) != GDScriptTokenizer::TK_EOF) { _set_error("Expected ';' or <NewLine>."); return; } tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_SEMICOLON) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_SEMICOLON) { // Ignore semicolon after 'pass' tokenizer->advance(); } } break; - case GDTokenizer::TK_PR_VAR: { + case GDScriptTokenizer::TK_PR_VAR: { //variale declaration and (eventual) initialization tokenizer->advance(); @@ -2421,7 +2422,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { Node *assigned = NULL; - if (tokenizer->get_token() == GDTokenizer::TK_OP_ASSIGN) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) { tokenizer->advance(); Node *subexpr = _parse_and_reduce_expression(p_block, p_static); @@ -2459,7 +2460,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { } } break; - case GDTokenizer::TK_CF_IF: { + case GDScriptTokenizer::TK_CF_IF: { tokenizer->advance(); @@ -2498,7 +2499,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { while (true) { - while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE && _parse_newline()) + while (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE && _parse_newline()) ; if (tab_level.back()->get() < indent_level) { //not at current indent level @@ -2506,7 +2507,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { return; } - if (tokenizer->get_token() == GDTokenizer::TK_CF_ELIF) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CF_ELIF) { if (tab_level.back()->get() > indent_level) { @@ -2552,7 +2553,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { if (error_set) return; - } else if (tokenizer->get_token() == GDTokenizer::TK_CF_ELSE) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CF_ELSE) { if (tab_level.back()->get() > indent_level) { _set_error("Invalid indent"); @@ -2582,7 +2583,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { } } break; - case GDTokenizer::TK_CF_WHILE: { + case GDScriptTokenizer::TK_CF_WHILE: { tokenizer->advance(); Node *condition = _parse_and_reduce_expression(p_block, p_static); @@ -2615,7 +2616,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { return; p_block->statements.push_back(cf_while); } break; - case GDTokenizer::TK_CF_FOR: { + case GDScriptTokenizer::TK_CF_FOR: { tokenizer->advance(); @@ -2629,7 +2630,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_OP_IN) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_OP_IN) { _set_error("'in' expected after identifier"); return; } @@ -2647,7 +2648,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { if (container->type == Node::TYPE_OPERATOR) { OperatorNode *op = static_cast<OperatorNode *>(container); - if (op->op == OperatorNode::OP_CALL && op->arguments[0]->type == Node::TYPE_BUILT_IN_FUNCTION && static_cast<BuiltInFunctionNode *>(op->arguments[0])->function == GDFunctions::GEN_RANGE) { + if (op->op == OperatorNode::OP_CALL && op->arguments[0]->type == Node::TYPE_BUILT_IN_FUNCTION && static_cast<BuiltInFunctionNode *>(op->arguments[0])->function == GDScriptFunctions::GEN_RANGE) { //iterating a range, so see if range() can be optimized without allocating memory, by replacing it by vectors (which can work as iterable too!) Vector<Node *> args; @@ -2733,7 +2734,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { return; p_block->statements.push_back(cf_for); } break; - case GDTokenizer::TK_CF_CONTINUE: { + case GDScriptTokenizer::TK_CF_CONTINUE: { tokenizer->advance(); ControlFlowNode *cf_continue = alloc_node<ControlFlowNode>(); @@ -2744,7 +2745,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { return; } } break; - case GDTokenizer::TK_CF_BREAK: { + case GDScriptTokenizer::TK_CF_BREAK: { tokenizer->advance(); ControlFlowNode *cf_break = alloc_node<ControlFlowNode>(); @@ -2755,13 +2756,13 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { return; } } break; - case GDTokenizer::TK_CF_RETURN: { + case GDScriptTokenizer::TK_CF_RETURN: { tokenizer->advance(); ControlFlowNode *cf_return = alloc_node<ControlFlowNode>(); cf_return->cf_type = ControlFlowNode::CF_RETURN; - if (tokenizer->get_token() == GDTokenizer::TK_SEMICOLON || tokenizer->get_token() == GDTokenizer::TK_NEWLINE || tokenizer->get_token() == GDTokenizer::TK_EOF) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_SEMICOLON || tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE || tokenizer->get_token() == GDScriptTokenizer::TK_EOF) { //expect end of statement p_block->statements.push_back(cf_return); if (!_end_statement()) { @@ -2785,7 +2786,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { } } break; - case GDTokenizer::TK_CF_MATCH: { + case GDScriptTokenizer::TK_CF_MATCH: { tokenizer->advance(); @@ -2825,7 +2826,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { _end_statement(); } break; - case GDTokenizer::TK_PR_ASSERT: { + case GDScriptTokenizer::TK_PR_ASSERT: { tokenizer->advance(); Node *condition = _parse_and_reduce_expression(p_block, p_static); @@ -2844,7 +2845,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { return; } } break; - case GDTokenizer::TK_PR_BREAKPOINT: { + case GDScriptTokenizer::TK_PR_BREAKPOINT: { tokenizer->advance(); BreakpointNode *bn = alloc_node<BreakpointNode>(); @@ -2872,9 +2873,9 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { } break; /* - case GDTokenizer::TK_CF_LOCAL: { + case GDScriptTokenizer::TK_CF_LOCAL: { - if (tokenizer->get_token(1)!=GDTokenizer::TK_SEMICOLON && tokenizer->get_token(1)!=GDTokenizer::TK_NEWLINE ) { + if (tokenizer->get_token(1)!=GDScriptTokenizer::TK_SEMICOLON && tokenizer->get_token(1)!=GDScriptTokenizer::TK_NEWLINE ) { _set_error("Expected ';' or <NewLine>."); } @@ -2885,9 +2886,9 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { } } -bool GDParser::_parse_newline() { +bool GDScriptParser::_parse_newline() { - if (tokenizer->get_token(1) != GDTokenizer::TK_EOF && tokenizer->get_token(1) != GDTokenizer::TK_NEWLINE) { + if (tokenizer->get_token(1) != GDScriptTokenizer::TK_EOF && tokenizer->get_token(1) != GDScriptTokenizer::TK_NEWLINE) { int indent = tokenizer->get_token_line_indent(); int current_indent = tab_level.back()->get(); @@ -2926,7 +2927,7 @@ bool GDParser::_parse_newline() { return true; } -void GDParser::_parse_extends(ClassNode *p_class) { +void GDScriptParser::_parse_extends(ClassNode *p_class) { if (p_class->extends_used) { @@ -2944,14 +2945,14 @@ void GDParser::_parse_extends(ClassNode *p_class) { tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_BUILT_IN_TYPE && tokenizer->get_token_type() == Variant::OBJECT) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE && tokenizer->get_token_type() == Variant::OBJECT) { p_class->extends_class.push_back(Variant::get_type_name(Variant::OBJECT)); tokenizer->advance(); return; } // see if inheritance happens from a file - if (tokenizer->get_token() == GDTokenizer::TK_CONSTANT) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CONSTANT) { Variant constant = tokenizer->get_token_constant(); if (constant.get_type() != Variant::STRING) { @@ -2963,14 +2964,14 @@ void GDParser::_parse_extends(ClassNode *p_class) { p_class->extends_file = constant; tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PERIOD) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PERIOD) { return; } else tokenizer->advance(); } while (true) { - if (tokenizer->get_token() != GDTokenizer::TK_IDENTIFIER) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_IDENTIFIER) { _set_error("Invalid 'extends' syntax, expected string constant (path) and/or identifier (parent class)."); return; @@ -2980,18 +2981,18 @@ void GDParser::_parse_extends(ClassNode *p_class) { p_class->extends_class.push_back(identifier); tokenizer->advance(1); - if (tokenizer->get_token() != GDTokenizer::TK_PERIOD) + if (tokenizer->get_token() != GDScriptTokenizer::TK_PERIOD) return; } } -void GDParser::_parse_class(ClassNode *p_class) { +void GDScriptParser::_parse_class(ClassNode *p_class) { int indent_level = tab_level.back()->get(); while (true) { - GDTokenizer::Token token = tokenizer->get_token(); + GDScriptTokenizer::Token token = tokenizer->get_token(); if (error_set) return; @@ -3002,13 +3003,13 @@ void GDParser::_parse_class(ClassNode *p_class) { switch (token) { - case GDTokenizer::TK_EOF: + case GDScriptTokenizer::TK_EOF: p_class->end_line = tokenizer->get_token_line(); - case GDTokenizer::TK_ERROR: { + case GDScriptTokenizer::TK_ERROR: { return; //go back //end of file! } break; - case GDTokenizer::TK_NEWLINE: { + case GDScriptTokenizer::TK_NEWLINE: { if (!_parse_newline()) { if (!error_set) { p_class->end_line = tokenizer->get_token_line(); @@ -3016,7 +3017,7 @@ void GDParser::_parse_class(ClassNode *p_class) { return; } } break; - case GDTokenizer::TK_PR_EXTENDS: { + case GDScriptTokenizer::TK_PR_EXTENDS: { _parse_extends(p_class); if (error_set) @@ -3027,7 +3028,7 @@ void GDParser::_parse_class(ClassNode *p_class) { } } break; - case GDTokenizer::TK_PR_TOOL: { + case GDScriptTokenizer::TK_PR_TOOL: { if (p_class->tool) { @@ -3039,13 +3040,13 @@ void GDParser::_parse_class(ClassNode *p_class) { tokenizer->advance(); } break; - case GDTokenizer::TK_PR_CLASS: { + case GDScriptTokenizer::TK_PR_CLASS: { //class inside class :D StringName name; StringName extends; - if (tokenizer->get_token(1) != GDTokenizer::TK_IDENTIFIER) { + if (tokenizer->get_token(1) != GDScriptTokenizer::TK_IDENTIFIER) { _set_error("'class' syntax: 'class <Name>:' or 'class <Name> extends <BaseClass>:'"); return; @@ -3063,7 +3064,7 @@ void GDParser::_parse_class(ClassNode *p_class) { p_class->subclasses.push_back(newclass); - if (tokenizer->get_token() == GDTokenizer::TK_PR_EXTENDS) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PR_EXTENDS) { _parse_extends(newclass); if (error_set) @@ -3081,26 +3082,26 @@ void GDParser::_parse_class(ClassNode *p_class) { } break; /* this is for functions.... - case GDTokenizer::TK_CF_PASS: { + case GDScriptTokenizer::TK_CF_PASS: { tokenizer->advance(1); } break; */ - case GDTokenizer::TK_PR_STATIC: { + case GDScriptTokenizer::TK_PR_STATIC: { tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PR_FUNCTION) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_FUNCTION) { _set_error("Expected 'func'."); return; } }; //fallthrough to function - case GDTokenizer::TK_PR_FUNCTION: { + case GDScriptTokenizer::TK_PR_FUNCTION: { bool _static = false; pending_newline = -1; - if (tokenizer->get_token(-1) == GDTokenizer::TK_PR_STATIC) { + if (tokenizer->get_token(-1) == GDScriptTokenizer::TK_PR_STATIC) { _static = true; } @@ -3128,7 +3129,7 @@ void GDParser::_parse_class(ClassNode *p_class) { } } - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_OPEN) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) { _set_error("Expected '(' after identifier (syntax: 'func <identifier>([arguments]):' )."); return; @@ -3141,17 +3142,17 @@ void GDParser::_parse_class(ClassNode *p_class) { int fnline = tokenizer->get_token_line(); - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { //has arguments bool defaulting = false; while (true) { - if (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) { tokenizer->advance(); continue; } - if (tokenizer->get_token() == GDTokenizer::TK_PR_VAR) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PR_VAR) { tokenizer->advance(); //var before the identifier is allowed } @@ -3167,7 +3168,7 @@ void GDParser::_parse_class(ClassNode *p_class) { tokenizer->advance(); - if (defaulting && tokenizer->get_token() != GDTokenizer::TK_OP_ASSIGN) { + if (defaulting && tokenizer->get_token() != GDScriptTokenizer::TK_OP_ASSIGN) { _set_error("Default parameter expected."); return; @@ -3175,7 +3176,7 @@ void GDParser::_parse_class(ClassNode *p_class) { //tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_OP_ASSIGN) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) { defaulting = true; tokenizer->advance(1); Node *defval = _parse_and_reduce_expression(p_class, _static); @@ -3199,14 +3200,14 @@ void GDParser::_parse_class(ClassNode *p_class) { default_values.push_back(on); } - while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { + while (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) { tokenizer->advance(); } - if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); continue; - } else if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + } else if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ',' or ')'."); return; @@ -3233,14 +3234,14 @@ void GDParser::_parse_class(ClassNode *p_class) { id->name = "_init"; cparent->arguments.push_back(id); - if (tokenizer->get_token() == GDTokenizer::TK_PERIOD) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PERIOD) { tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_OPEN) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) { _set_error("expected '(' for parent constructor arguments."); } tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { //has arguments parenthesis++; while (true) { @@ -3248,10 +3249,10 @@ void GDParser::_parse_class(ClassNode *p_class) { Node *arg = _parse_and_reduce_expression(p_class, _static); cparent->arguments.push_back(arg); - if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); continue; - } else if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + } else if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ',' or ')'."); return; @@ -3266,7 +3267,7 @@ void GDParser::_parse_class(ClassNode *p_class) { } } else { - if (tokenizer->get_token() == GDTokenizer::TK_PERIOD) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PERIOD) { _set_error("Parent constructor call found for a class without inheritance."); return; @@ -3303,7 +3304,7 @@ void GDParser::_parse_class(ClassNode *p_class) { //arguments } break; - case GDTokenizer::TK_PR_SIGNAL: { + case GDScriptTokenizer::TK_PR_SIGNAL: { tokenizer->advance(); if (!tokenizer->is_token_literal()) { @@ -3315,15 +3316,15 @@ void GDParser::_parse_class(ClassNode *p_class) { sig.name = tokenizer->get_token_identifier(); tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_OPEN) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_OPEN) { tokenizer->advance(); while (true) { - if (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) { tokenizer->advance(); continue; } - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { tokenizer->advance(); break; } @@ -3336,13 +3337,13 @@ void GDParser::_parse_class(ClassNode *p_class) { sig.arguments.push_back(tokenizer->get_token_identifier()); tokenizer->advance(); - while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { + while (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) { tokenizer->advance(); } - if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); - } else if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + } else if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ',' or ')' after signal parameter identifier."); return; } @@ -3356,14 +3357,14 @@ void GDParser::_parse_class(ClassNode *p_class) { return; } } break; - case GDTokenizer::TK_PR_EXPORT: { + case GDScriptTokenizer::TK_PR_EXPORT: { tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_OPEN) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_OPEN) { tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_BUILT_IN_TYPE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) { Variant::Type type = tokenizer->get_token_type(); if (type == Variant::NIL) { @@ -3376,17 +3377,17 @@ void GDParser::_parse_class(ClassNode *p_class) { String hint_prefix = ""; - if (type == Variant::ARRAY && tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (type == Variant::ARRAY && tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); - while (tokenizer->get_token() == GDTokenizer::TK_BUILT_IN_TYPE) { + while (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) { type = tokenizer->get_token_type(); tokenizer->advance(); if (type == Variant::ARRAY) { hint_prefix += itos(Variant::ARRAY) + ":"; - if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); } } else { @@ -3396,7 +3397,7 @@ void GDParser::_parse_class(ClassNode *p_class) { } } - if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { // hint expected next! tokenizer->advance(); @@ -3404,15 +3405,15 @@ void GDParser::_parse_class(ClassNode *p_class) { case Variant::INT: { - if (tokenizer->get_token() == GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "FLAGS") { + if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "FLAGS") { //current_export.hint=PROPERTY_HINT_ALL_FLAGS; tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { break; } - if (tokenizer->get_token() != GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) { _set_error("Expected ')' or ',' in bit flags hint."); return; } @@ -3423,7 +3424,7 @@ void GDParser::_parse_class(ClassNode *p_class) { bool first = true; while (true) { - if (tokenizer->get_token() != GDTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type() != Variant::STRING) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type() != Variant::STRING) { current_export = PropertyInfo(); _set_error("Expected a string constant in named bit flags hint."); return; @@ -3438,10 +3439,10 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export.hint_string += c.xml_escape(); tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) break; - if (tokenizer->get_token() != GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) { current_export = PropertyInfo(); _set_error("Expected ')' or ',' in named bit flags hint."); return; @@ -3452,13 +3453,13 @@ void GDParser::_parse_class(ClassNode *p_class) { break; } - if (tokenizer->get_token() == GDTokenizer::TK_CONSTANT && tokenizer->get_token_constant().get_type() == Variant::STRING) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CONSTANT && tokenizer->get_token_constant().get_type() == Variant::STRING) { //enumeration current_export.hint = PROPERTY_HINT_ENUM; bool first = true; while (true) { - if (tokenizer->get_token() != GDTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type() != Variant::STRING) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type() != Variant::STRING) { current_export = PropertyInfo(); _set_error("Expected a string constant in enumeration hint."); @@ -3474,10 +3475,10 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export.hint_string += c.xml_escape(); tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) break; - if (tokenizer->get_token() != GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) { current_export = PropertyInfo(); _set_error("Expected ')' or ',' in enumeration hint."); return; @@ -3492,10 +3493,10 @@ void GDParser::_parse_class(ClassNode *p_class) { }; //fallthrough to use the same case Variant::REAL: { - if (tokenizer->get_token() == GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "EASE") { + if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "EASE") { current_export.hint = PROPERTY_HINT_EXP_EASING; tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ')' in hint."); return; } @@ -3503,14 +3504,14 @@ void GDParser::_parse_class(ClassNode *p_class) { } // range - if (tokenizer->get_token() == GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "EXP") { + if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "EXP") { current_export.hint = PROPERTY_HINT_EXP_RANGE; tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) break; - else if (tokenizer->get_token() != GDTokenizer::TK_COMMA) { + else if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) { _set_error("Expected ')' or ',' in exponential range hint."); return; } @@ -3520,11 +3521,11 @@ void GDParser::_parse_class(ClassNode *p_class) { float sign = 1.0; - if (tokenizer->get_token() == GDTokenizer::TK_OP_SUB) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_SUB) { sign = -1; tokenizer->advance(); } - if (tokenizer->get_token() != GDTokenizer::TK_CONSTANT || !tokenizer->get_token_constant().is_num()) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_CONSTANT || !tokenizer->get_token_constant().is_num()) { current_export = PropertyInfo(); _set_error("Expected a range in numeric hint."); @@ -3534,12 +3535,12 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export.hint_string = rtos(sign * double(tokenizer->get_token_constant())); tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { current_export.hint_string = "0," + current_export.hint_string; break; } - if (tokenizer->get_token() != GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) { current_export = PropertyInfo(); _set_error("Expected ',' or ')' in numeric range hint."); @@ -3549,12 +3550,12 @@ void GDParser::_parse_class(ClassNode *p_class) { tokenizer->advance(); sign = 1.0; - if (tokenizer->get_token() == GDTokenizer::TK_OP_SUB) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_SUB) { sign = -1; tokenizer->advance(); } - if (tokenizer->get_token() != GDTokenizer::TK_CONSTANT || !tokenizer->get_token_constant().is_num()) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_CONSTANT || !tokenizer->get_token_constant().is_num()) { current_export = PropertyInfo(); _set_error("Expected a number as upper bound in numeric range hint."); @@ -3564,10 +3565,10 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export.hint_string += "," + rtos(sign * double(tokenizer->get_token_constant())); tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) break; - if (tokenizer->get_token() != GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) { current_export = PropertyInfo(); _set_error("Expected ',' or ')' in numeric range hint."); @@ -3576,12 +3577,12 @@ void GDParser::_parse_class(ClassNode *p_class) { tokenizer->advance(); sign = 1.0; - if (tokenizer->get_token() == GDTokenizer::TK_OP_SUB) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_SUB) { sign = -1; tokenizer->advance(); } - if (tokenizer->get_token() != GDTokenizer::TK_CONSTANT || !tokenizer->get_token_constant().is_num()) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_CONSTANT || !tokenizer->get_token_constant().is_num()) { current_export = PropertyInfo(); _set_error("Expected a number as step in numeric range hint."); @@ -3594,13 +3595,13 @@ void GDParser::_parse_class(ClassNode *p_class) { } break; case Variant::STRING: { - if (tokenizer->get_token() == GDTokenizer::TK_CONSTANT && tokenizer->get_token_constant().get_type() == Variant::STRING) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_CONSTANT && tokenizer->get_token_constant().get_type() == Variant::STRING) { //enumeration current_export.hint = PROPERTY_HINT_ENUM; bool first = true; while (true) { - if (tokenizer->get_token() != GDTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type() != Variant::STRING) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type() != Variant::STRING) { current_export = PropertyInfo(); _set_error("Expected a string constant in enumeration hint."); @@ -3615,10 +3616,10 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export.hint_string += c.xml_escape(); tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) break; - if (tokenizer->get_token() != GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) { current_export = PropertyInfo(); _set_error("Expected ')' or ',' in enumeration hint."); return; @@ -3629,17 +3630,17 @@ void GDParser::_parse_class(ClassNode *p_class) { break; } - if (tokenizer->get_token() == GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "DIR") { + if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "DIR") { tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) current_export.hint = PROPERTY_HINT_DIR; - else if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + else if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_IDENTIFIER || !(tokenizer->get_token_identifier() == "GLOBAL")) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_IDENTIFIER || !(tokenizer->get_token_identifier() == "GLOBAL")) { _set_error("Expected 'GLOBAL' after comma in directory hint."); return; } @@ -3650,7 +3651,7 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export.hint = PROPERTY_HINT_GLOBAL_DIR; tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ')' in hint."); return; } @@ -3661,16 +3662,16 @@ void GDParser::_parse_class(ClassNode *p_class) { break; } - if (tokenizer->get_token() == GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "FILE") { + if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "FILE") { current_export.hint = PROPERTY_HINT_FILE; tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "GLOBAL") { + if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "GLOBAL") { if (!p_class->tool) { _set_error("Global filesystem hints may only be used in tool scripts."); @@ -3679,9 +3680,9 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export.hint = PROPERTY_HINT_GLOBAL_FILE; tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_PARENTHESIS_CLOSE) + if (tokenizer->get_token() == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) break; - else if (tokenizer->get_token() == GDTokenizer::TK_COMMA) + else if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) tokenizer->advance(); else { _set_error("Expected ')' or ',' in hint."); @@ -3689,7 +3690,7 @@ void GDParser::_parse_class(ClassNode *p_class) { } } - if (tokenizer->get_token() != GDTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type() != Variant::STRING) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type() != Variant::STRING) { if (current_export.hint == PROPERTY_HINT_GLOBAL_FILE) _set_error("Expected string constant with filter"); @@ -3701,18 +3702,18 @@ void GDParser::_parse_class(ClassNode *p_class) { tokenizer->advance(); } - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ')' in hint."); return; } break; } - if (tokenizer->get_token() == GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "MULTILINE") { + if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "MULTILINE") { current_export.hint = PROPERTY_HINT_MULTILINE_TEXT; tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { _set_error("Expected ')' in hint."); return; } @@ -3721,7 +3722,7 @@ void GDParser::_parse_class(ClassNode *p_class) { } break; case Variant::COLOR: { - if (tokenizer->get_token() != GDTokenizer::TK_IDENTIFIER) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_IDENTIFIER) { current_export = PropertyInfo(); _set_error("Color type hint expects RGB or RGBA as hints"); @@ -3757,7 +3758,7 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export.hint = PROPERTY_HINT_NONE; } - } else if (tokenizer->get_token() == GDTokenizer::TK_IDENTIFIER) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER) { String identifier = tokenizer->get_token_identifier(); if (!ClassDB::is_parent_class(identifier, "Resource")) { @@ -3775,7 +3776,7 @@ void GDParser::_parse_class(ClassNode *p_class) { tokenizer->advance(); } - if (tokenizer->get_token() != GDTokenizer::TK_PARENTHESIS_CLOSE) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) { current_export = PropertyInfo(); _set_error("Expected ')' or ',' after export hint."); @@ -3785,7 +3786,7 @@ void GDParser::_parse_class(ClassNode *p_class) { tokenizer->advance(); } - if (tokenizer->get_token() != GDTokenizer::TK_PR_VAR && tokenizer->get_token() != GDTokenizer::TK_PR_ONREADY && tokenizer->get_token() != GDTokenizer::TK_PR_REMOTE && tokenizer->get_token() != GDTokenizer::TK_PR_MASTER && tokenizer->get_token() != GDTokenizer::TK_PR_SLAVE && tokenizer->get_token() != GDTokenizer::TK_PR_SYNC) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_ONREADY && tokenizer->get_token() != GDScriptTokenizer::TK_PR_REMOTE && tokenizer->get_token() != GDScriptTokenizer::TK_PR_MASTER && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SLAVE && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SYNC) { current_export = PropertyInfo(); _set_error("Expected 'var', 'onready', 'remote', 'master', 'slave' or 'sync'."); @@ -3794,29 +3795,29 @@ void GDParser::_parse_class(ClassNode *p_class) { continue; } break; - case GDTokenizer::TK_PR_ONREADY: { + case GDScriptTokenizer::TK_PR_ONREADY: { //may be fallthrough from export, ignore if so tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PR_VAR) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR) { _set_error("Expected 'var'."); return; } continue; } break; - case GDTokenizer::TK_PR_REMOTE: { + case GDScriptTokenizer::TK_PR_REMOTE: { //may be fallthrough from export, ignore if so tokenizer->advance(); if (current_export.type) { - if (tokenizer->get_token() != GDTokenizer::TK_PR_VAR) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR) { _set_error("Expected 'var'."); return; } } else { - if (tokenizer->get_token() != GDTokenizer::TK_PR_VAR && tokenizer->get_token() != GDTokenizer::TK_PR_FUNCTION) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_FUNCTION) { _set_error("Expected 'var' or 'func'."); return; } @@ -3825,18 +3826,18 @@ void GDParser::_parse_class(ClassNode *p_class) { continue; } break; - case GDTokenizer::TK_PR_MASTER: { + case GDScriptTokenizer::TK_PR_MASTER: { //may be fallthrough from export, ignore if so tokenizer->advance(); if (current_export.type) { - if (tokenizer->get_token() != GDTokenizer::TK_PR_VAR) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR) { _set_error("Expected 'var'."); return; } } else { - if (tokenizer->get_token() != GDTokenizer::TK_PR_VAR && tokenizer->get_token() != GDTokenizer::TK_PR_FUNCTION) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_FUNCTION) { _set_error("Expected 'var' or 'func'."); return; } @@ -3845,18 +3846,18 @@ void GDParser::_parse_class(ClassNode *p_class) { rpc_mode = ScriptInstance::RPC_MODE_MASTER; continue; } break; - case GDTokenizer::TK_PR_SLAVE: { + case GDScriptTokenizer::TK_PR_SLAVE: { //may be fallthrough from export, ignore if so tokenizer->advance(); if (current_export.type) { - if (tokenizer->get_token() != GDTokenizer::TK_PR_VAR) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR) { _set_error("Expected 'var'."); return; } } else { - if (tokenizer->get_token() != GDTokenizer::TK_PR_VAR && tokenizer->get_token() != GDTokenizer::TK_PR_FUNCTION) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_FUNCTION) { _set_error("Expected 'var' or 'func'."); return; } @@ -3865,11 +3866,11 @@ void GDParser::_parse_class(ClassNode *p_class) { rpc_mode = ScriptInstance::RPC_MODE_SLAVE; continue; } break; - case GDTokenizer::TK_PR_SYNC: { + case GDScriptTokenizer::TK_PR_SYNC: { //may be fallthrough from export, ignore if so tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_PR_VAR && tokenizer->get_token() != GDTokenizer::TK_PR_FUNCTION) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_FUNCTION) { if (current_export.type) _set_error("Expected 'var'."); else @@ -3880,17 +3881,17 @@ void GDParser::_parse_class(ClassNode *p_class) { rpc_mode = ScriptInstance::RPC_MODE_SYNC; continue; } break; - case GDTokenizer::TK_PR_VAR: { + case GDScriptTokenizer::TK_PR_VAR: { //variale declaration and (eventual) initialization ClassNode::Member member; - bool autoexport = tokenizer->get_token(-1) == GDTokenizer::TK_PR_EXPORT; + bool autoexport = tokenizer->get_token(-1) == GDScriptTokenizer::TK_PR_EXPORT; if (current_export.type != Variant::NIL) { member._export = current_export; current_export = PropertyInfo(); } - bool onready = tokenizer->get_token(-1) == GDTokenizer::TK_PR_ONREADY; + bool onready = tokenizer->get_token(-1) == GDScriptTokenizer::TK_PR_ONREADY; tokenizer->advance(); if (!tokenizer->is_token_literal(0, true)) { @@ -3909,7 +3910,7 @@ void GDParser::_parse_class(ClassNode *p_class) { rpc_mode = ScriptInstance::RPC_MODE_DISABLED; - if (tokenizer->get_token() == GDTokenizer::TK_OP_ASSIGN) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) { #ifdef DEBUG_ENABLED int line = tokenizer->get_token_line(); @@ -4017,11 +4018,11 @@ void GDParser::_parse_class(ClassNode *p_class) { } } - if (tokenizer->get_token() == GDTokenizer::TK_PR_SETGET) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_PR_SETGET) { tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) { //just comma means using only getter if (!tokenizer->is_token_literal()) { _set_error("Expected identifier for setter function after 'setget'."); @@ -4032,7 +4033,7 @@ void GDParser::_parse_class(ClassNode *p_class) { tokenizer->advance(); } - if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { //there is a getter tokenizer->advance(); @@ -4052,7 +4053,7 @@ void GDParser::_parse_class(ClassNode *p_class) { return; } } break; - case GDTokenizer::TK_PR_CONST: { + case GDScriptTokenizer::TK_PR_CONST: { //variale declaration and (eventual) initialization ClassNode::Constant constant; @@ -4067,7 +4068,7 @@ void GDParser::_parse_class(ClassNode *p_class) { constant.identifier = tokenizer->get_token_literal(); tokenizer->advance(); - if (tokenizer->get_token() != GDTokenizer::TK_OP_ASSIGN) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_OP_ASSIGN) { _set_error("Constant expects assignment."); return; } @@ -4095,7 +4096,7 @@ void GDParser::_parse_class(ClassNode *p_class) { } } break; - case GDTokenizer::TK_PR_ENUM: { + case GDScriptTokenizer::TK_PR_ENUM: { //mutiple constant declarations.. int last_assign = -1; // Incremented by 1 right before the assingment. @@ -4107,26 +4108,26 @@ void GDParser::_parse_class(ClassNode *p_class) { enum_name = tokenizer->get_token_literal(); tokenizer->advance(); } - if (tokenizer->get_token() != GDTokenizer::TK_CURLY_BRACKET_OPEN) { + if (tokenizer->get_token() != GDScriptTokenizer::TK_CURLY_BRACKET_OPEN) { _set_error("Expected '{' in enum declaration"); return; } tokenizer->advance(); while (true) { - if (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_NEWLINE) { tokenizer->advance(); // Ignore newlines - } else if (tokenizer->get_token() == GDTokenizer::TK_CURLY_BRACKET_CLOSE) { + } else if (tokenizer->get_token() == GDScriptTokenizer::TK_CURLY_BRACKET_CLOSE) { tokenizer->advance(); break; // End of enum } else if (!tokenizer->is_token_literal(0, true)) { - if (tokenizer->get_token() == GDTokenizer::TK_EOF) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_EOF) { _set_error("Unexpected end of file."); } else { - _set_error(String("Unexpected ") + GDTokenizer::get_token_name(tokenizer->get_token()) + ", expected identifier"); + _set_error(String("Unexpected ") + GDScriptTokenizer::get_token_name(tokenizer->get_token()) + ", expected identifier"); } return; @@ -4137,7 +4138,7 @@ void GDParser::_parse_class(ClassNode *p_class) { tokenizer->advance(); - if (tokenizer->get_token() == GDTokenizer::TK_OP_ASSIGN) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) { tokenizer->advance(); Node *subexpr = _parse_and_reduce_expression(p_class, true, true); @@ -4169,7 +4170,7 @@ void GDParser::_parse_class(ClassNode *p_class) { constant.expression = cn; } - if (tokenizer->get_token() == GDTokenizer::TK_COMMA) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) { tokenizer->advance(); } @@ -4198,7 +4199,7 @@ void GDParser::_parse_class(ClassNode *p_class) { } break; - case GDTokenizer::TK_CONSTANT: { + case GDScriptTokenizer::TK_CONSTANT: { if (tokenizer->get_token_constant().get_type() == Variant::STRING) { tokenizer->advance(); // Ignore @@ -4218,7 +4219,7 @@ void GDParser::_parse_class(ClassNode *p_class) { } } -void GDParser::_set_error(const String &p_error, int p_line, int p_column) { +void GDScriptParser::_set_error(const String &p_error, int p_line, int p_column) { if (error_set) return; //allow no further errors @@ -4229,21 +4230,21 @@ void GDParser::_set_error(const String &p_error, int p_line, int p_column) { error_set = true; } -String GDParser::get_error() const { +String GDScriptParser::get_error() const { return error; } -int GDParser::get_error_line() const { +int GDScriptParser::get_error_line() const { return error_line; } -int GDParser::get_error_column() const { +int GDScriptParser::get_error_column() const { return error_column; } -Error GDParser::_parse(const String &p_base_path) { +Error GDScriptParser::_parse(const String &p_base_path) { base_path = p_base_path; @@ -4259,7 +4260,7 @@ Error GDParser::_parse(const String &p_base_path) { _parse_class(main_class); - if (tokenizer->get_token() == GDTokenizer::TK_ERROR) { + if (tokenizer->get_token() == GDScriptTokenizer::TK_ERROR) { error_set = false; _set_error("Parse Error: " + tokenizer->get_token_error()); } @@ -4271,7 +4272,7 @@ Error GDParser::_parse(const String &p_base_path) { return OK; } -Error GDParser::parse_bytecode(const Vector<uint8_t> &p_bytecode, const String &p_base_path, const String &p_self_path) { +Error GDScriptParser::parse_bytecode(const Vector<uint8_t> &p_bytecode, const String &p_base_path, const String &p_self_path) { for_completion = false; validating = false; @@ -4286,7 +4287,7 @@ Error GDParser::parse_bytecode(const Vector<uint8_t> &p_bytecode, const String & current_function = NULL; self_path = p_self_path; - GDTokenizerBuffer *tb = memnew(GDTokenizerBuffer); + GDScriptTokenizerBuffer *tb = memnew(GDScriptTokenizerBuffer); tb->set_code_buffer(p_bytecode); tokenizer = tb; Error ret = _parse(p_base_path); @@ -4295,7 +4296,7 @@ Error GDParser::parse_bytecode(const Vector<uint8_t> &p_bytecode, const String & return ret; } -Error GDParser::parse(const String &p_code, const String &p_base_path, bool p_just_validate, const String &p_self_path, bool p_for_completion) { +Error GDScriptParser::parse(const String &p_code, const String &p_base_path, bool p_just_validate, const String &p_self_path, bool p_for_completion) { completion_type = COMPLETION_NONE; completion_node = NULL; @@ -4309,7 +4310,7 @@ Error GDParser::parse(const String &p_code, const String &p_base_path, bool p_ju current_function = NULL; self_path = p_self_path; - GDTokenizerText *tt = memnew(GDTokenizerText); + GDScriptTokenizerText *tt = memnew(GDScriptTokenizerText); tt->set_code(p_code); validating = p_just_validate; @@ -4321,17 +4322,17 @@ Error GDParser::parse(const String &p_code, const String &p_base_path, bool p_ju return ret; } -bool GDParser::is_tool_script() const { +bool GDScriptParser::is_tool_script() const { return (head && head->type == Node::TYPE_CLASS && static_cast<const ClassNode *>(head)->tool); } -const GDParser::Node *GDParser::get_parse_tree() const { +const GDScriptParser::Node *GDScriptParser::get_parse_tree() const { return head; } -void GDParser::clear() { +void GDScriptParser::clear() { while (list) { @@ -4369,57 +4370,57 @@ void GDParser::clear() { error = ""; } -GDParser::CompletionType GDParser::get_completion_type() { +GDScriptParser::CompletionType GDScriptParser::get_completion_type() { return completion_type; } -StringName GDParser::get_completion_cursor() { +StringName GDScriptParser::get_completion_cursor() { return completion_cursor; } -int GDParser::get_completion_line() { +int GDScriptParser::get_completion_line() { return completion_line; } -Variant::Type GDParser::get_completion_built_in_constant() { +Variant::Type GDScriptParser::get_completion_built_in_constant() { return completion_built_in_constant; } -GDParser::Node *GDParser::get_completion_node() { +GDScriptParser::Node *GDScriptParser::get_completion_node() { return completion_node; } -GDParser::BlockNode *GDParser::get_completion_block() { +GDScriptParser::BlockNode *GDScriptParser::get_completion_block() { return completion_block; } -GDParser::ClassNode *GDParser::get_completion_class() { +GDScriptParser::ClassNode *GDScriptParser::get_completion_class() { return completion_class; } -GDParser::FunctionNode *GDParser::get_completion_function() { +GDScriptParser::FunctionNode *GDScriptParser::get_completion_function() { return completion_function; } -int GDParser::get_completion_argument_index() { +int GDScriptParser::get_completion_argument_index() { return completion_argument; } -int GDParser::get_completion_identifier_is_function() { +int GDScriptParser::get_completion_identifier_is_function() { return completion_ident_is_call; } -GDParser::GDParser() { +GDScriptParser::GDScriptParser() { head = NULL; list = NULL; @@ -4428,7 +4429,7 @@ GDParser::GDParser() { clear(); } -GDParser::~GDParser() { +GDScriptParser::~GDScriptParser() { clear(); } diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gdscript_parser.h index 7e88fd9746..3c9c5ea02c 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_parser.h */ +/* gdscript_parser.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,16 +27,16 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GD_PARSER_H -#define GD_PARSER_H +#ifndef GDSCRIPT_PARSER_H +#define GDSCRIPT_PARSER_H -#include "gd_functions.h" -#include "gd_tokenizer.h" +#include "gdscript_functions.h" +#include "gdscript_tokenizer.h" #include "map.h" #include "object.h" #include "script_language.h" -class GDParser { +class GDScriptParser { public: struct Node { @@ -166,7 +166,7 @@ public: TypeNode() { type = TYPE_TYPE; } }; struct BuiltInFunctionNode : public Node { - GDFunctions::Function function; + GDScriptFunctions::Function function; BuiltInFunctionNode() { type = TYPE_BUILT_IN_FUNCTION; } }; @@ -448,7 +448,7 @@ public: }; private: - GDTokenizer *tokenizer; + GDScriptTokenizer *tokenizer; Node *head; Node *list; @@ -540,8 +540,8 @@ public: int get_completion_identifier_is_function(); void clear(); - GDParser(); - ~GDParser(); + GDScriptParser(); + ~GDScriptParser(); }; -#endif // PARSER_H +#endif // GDSCRIPT_PARSER_H diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index 98ac0f473d..e3a0af8ee6 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_tokenizer.cpp */ +/* gdscript_tokenizer.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,14 +27,14 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "gd_tokenizer.h" +#include "gdscript_tokenizer.h" -#include "gd_functions.h" +#include "gdscript_functions.h" #include "io/marshalls.h" #include "map.h" #include "print_string.h" -const char *GDTokenizer::token_names[TK_MAX] = { +const char *GDScriptTokenizer::token_names[TK_MAX] = { "Empty", "Identifier", "Constant", @@ -148,7 +148,7 @@ static const _bit _type_list[] = { { Variant::RECT2, "Rect2" }, { Variant::TRANSFORM2D, "Transform2D" }, { Variant::VECTOR3, "Vector3" }, - { Variant::RECT3, "Rect3" }, + { Variant::AABB, "AABB" }, { Variant::PLANE, "Plane" }, { Variant::QUAT, "Quat" }, { Variant::BASIS, "Basis" }, @@ -170,68 +170,68 @@ static const _bit _type_list[] = { }; struct _kws { - GDTokenizer::Token token; + GDScriptTokenizer::Token token; const char *text; }; static const _kws _keyword_list[] = { //ops - { GDTokenizer::TK_OP_IN, "in" }, - { GDTokenizer::TK_OP_NOT, "not" }, - { GDTokenizer::TK_OP_OR, "or" }, - { GDTokenizer::TK_OP_AND, "and" }, + { GDScriptTokenizer::TK_OP_IN, "in" }, + { GDScriptTokenizer::TK_OP_NOT, "not" }, + { GDScriptTokenizer::TK_OP_OR, "or" }, + { GDScriptTokenizer::TK_OP_AND, "and" }, //func - { GDTokenizer::TK_PR_FUNCTION, "func" }, - { GDTokenizer::TK_PR_CLASS, "class" }, - { GDTokenizer::TK_PR_EXTENDS, "extends" }, - { GDTokenizer::TK_PR_IS, "is" }, - { GDTokenizer::TK_PR_ONREADY, "onready" }, - { GDTokenizer::TK_PR_TOOL, "tool" }, - { GDTokenizer::TK_PR_STATIC, "static" }, - { GDTokenizer::TK_PR_EXPORT, "export" }, - { GDTokenizer::TK_PR_SETGET, "setget" }, - { GDTokenizer::TK_PR_VAR, "var" }, - { GDTokenizer::TK_PR_PRELOAD, "preload" }, - { GDTokenizer::TK_PR_ASSERT, "assert" }, - { GDTokenizer::TK_PR_YIELD, "yield" }, - { GDTokenizer::TK_PR_SIGNAL, "signal" }, - { GDTokenizer::TK_PR_BREAKPOINT, "breakpoint" }, - { GDTokenizer::TK_PR_REMOTE, "remote" }, - { GDTokenizer::TK_PR_MASTER, "master" }, - { GDTokenizer::TK_PR_SLAVE, "slave" }, - { GDTokenizer::TK_PR_SYNC, "sync" }, - { GDTokenizer::TK_PR_CONST, "const" }, - { GDTokenizer::TK_PR_ENUM, "enum" }, + { GDScriptTokenizer::TK_PR_FUNCTION, "func" }, + { GDScriptTokenizer::TK_PR_CLASS, "class" }, + { GDScriptTokenizer::TK_PR_EXTENDS, "extends" }, + { GDScriptTokenizer::TK_PR_IS, "is" }, + { GDScriptTokenizer::TK_PR_ONREADY, "onready" }, + { GDScriptTokenizer::TK_PR_TOOL, "tool" }, + { GDScriptTokenizer::TK_PR_STATIC, "static" }, + { GDScriptTokenizer::TK_PR_EXPORT, "export" }, + { GDScriptTokenizer::TK_PR_SETGET, "setget" }, + { GDScriptTokenizer::TK_PR_VAR, "var" }, + { GDScriptTokenizer::TK_PR_PRELOAD, "preload" }, + { GDScriptTokenizer::TK_PR_ASSERT, "assert" }, + { GDScriptTokenizer::TK_PR_YIELD, "yield" }, + { GDScriptTokenizer::TK_PR_SIGNAL, "signal" }, + { GDScriptTokenizer::TK_PR_BREAKPOINT, "breakpoint" }, + { GDScriptTokenizer::TK_PR_REMOTE, "remote" }, + { GDScriptTokenizer::TK_PR_MASTER, "master" }, + { GDScriptTokenizer::TK_PR_SLAVE, "slave" }, + { GDScriptTokenizer::TK_PR_SYNC, "sync" }, + { GDScriptTokenizer::TK_PR_CONST, "const" }, + { GDScriptTokenizer::TK_PR_ENUM, "enum" }, //controlflow - { GDTokenizer::TK_CF_IF, "if" }, - { GDTokenizer::TK_CF_ELIF, "elif" }, - { GDTokenizer::TK_CF_ELSE, "else" }, - { GDTokenizer::TK_CF_FOR, "for" }, - { GDTokenizer::TK_CF_WHILE, "while" }, - { GDTokenizer::TK_CF_DO, "do" }, - { GDTokenizer::TK_CF_SWITCH, "switch" }, - { GDTokenizer::TK_CF_CASE, "case" }, - { GDTokenizer::TK_CF_BREAK, "break" }, - { GDTokenizer::TK_CF_CONTINUE, "continue" }, - { GDTokenizer::TK_CF_RETURN, "return" }, - { GDTokenizer::TK_CF_MATCH, "match" }, - { GDTokenizer::TK_CF_PASS, "pass" }, - { GDTokenizer::TK_SELF, "self" }, - { GDTokenizer::TK_CONST_PI, "PI" }, - { GDTokenizer::TK_CONST_TAU, "TAU" }, - { GDTokenizer::TK_WILDCARD, "_" }, - { GDTokenizer::TK_CONST_INF, "INF" }, - { GDTokenizer::TK_CONST_NAN, "NAN" }, - { GDTokenizer::TK_ERROR, NULL } + { GDScriptTokenizer::TK_CF_IF, "if" }, + { GDScriptTokenizer::TK_CF_ELIF, "elif" }, + { GDScriptTokenizer::TK_CF_ELSE, "else" }, + { GDScriptTokenizer::TK_CF_FOR, "for" }, + { GDScriptTokenizer::TK_CF_WHILE, "while" }, + { GDScriptTokenizer::TK_CF_DO, "do" }, + { GDScriptTokenizer::TK_CF_SWITCH, "switch" }, + { GDScriptTokenizer::TK_CF_CASE, "case" }, + { GDScriptTokenizer::TK_CF_BREAK, "break" }, + { GDScriptTokenizer::TK_CF_CONTINUE, "continue" }, + { GDScriptTokenizer::TK_CF_RETURN, "return" }, + { GDScriptTokenizer::TK_CF_MATCH, "match" }, + { GDScriptTokenizer::TK_CF_PASS, "pass" }, + { GDScriptTokenizer::TK_SELF, "self" }, + { GDScriptTokenizer::TK_CONST_PI, "PI" }, + { GDScriptTokenizer::TK_CONST_TAU, "TAU" }, + { GDScriptTokenizer::TK_WILDCARD, "_" }, + { GDScriptTokenizer::TK_CONST_INF, "INF" }, + { GDScriptTokenizer::TK_CONST_NAN, "NAN" }, + { GDScriptTokenizer::TK_ERROR, NULL } }; -const char *GDTokenizer::get_token_name(Token p_token) { +const char *GDScriptTokenizer::get_token_name(Token p_token) { ERR_FAIL_INDEX_V(p_token, TK_MAX, "<error>"); return token_names[p_token]; } -bool GDTokenizer::is_token_literal(int p_offset, bool variable_safe) const { +bool GDScriptTokenizer::is_token_literal(int p_offset, bool variable_safe) const { switch (get_token(p_offset)) { // Can always be literal: case TK_IDENTIFIER: @@ -253,9 +253,9 @@ bool GDTokenizer::is_token_literal(int p_offset, bool variable_safe) const { case TK_BUILT_IN_FUNC: case TK_OP_IN: - //case TK_OP_NOT: - //case TK_OP_OR: - //case TK_OP_AND: + //case TK_OP_NOT: + //case TK_OP_OR: + //case TK_OP_AND: case TK_PR_CLASS: case TK_PR_CONST: @@ -303,7 +303,7 @@ bool GDTokenizer::is_token_literal(int p_offset, bool variable_safe) const { } } -StringName GDTokenizer::get_token_literal(int p_offset) const { +StringName GDScriptTokenizer::get_token_literal(int p_offset) const { Token token = get_token(p_offset); switch (token) { case TK_IDENTIFIER: @@ -320,7 +320,7 @@ StringName GDTokenizer::get_token_literal(int p_offset) const { } } break; // Shouldn't get here, stuff happens case TK_BUILT_IN_FUNC: - return GDFunctions::get_func_name(get_token_built_in_func(p_offset)); + return GDScriptFunctions::get_func_name(get_token_built_in_func(p_offset)); case TK_CONSTANT: { const Variant value = get_token_constant(p_offset); @@ -365,7 +365,7 @@ static bool _is_hex(CharType c) { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } -void GDTokenizerText::_make_token(Token p_type) { +void GDScriptTokenizerText::_make_token(Token p_type) { TokenData &tk = tk_rb[tk_rb_pos]; @@ -375,7 +375,7 @@ void GDTokenizerText::_make_token(Token p_type) { tk_rb_pos = (tk_rb_pos + 1) % TK_RB_SIZE; } -void GDTokenizerText::_make_identifier(const StringName &p_identifier) { +void GDScriptTokenizerText::_make_identifier(const StringName &p_identifier) { TokenData &tk = tk_rb[tk_rb_pos]; @@ -387,7 +387,7 @@ void GDTokenizerText::_make_identifier(const StringName &p_identifier) { tk_rb_pos = (tk_rb_pos + 1) % TK_RB_SIZE; } -void GDTokenizerText::_make_built_in_func(GDFunctions::Function p_func) { +void GDScriptTokenizerText::_make_built_in_func(GDScriptFunctions::Function p_func) { TokenData &tk = tk_rb[tk_rb_pos]; @@ -398,7 +398,7 @@ void GDTokenizerText::_make_built_in_func(GDFunctions::Function p_func) { tk_rb_pos = (tk_rb_pos + 1) % TK_RB_SIZE; } -void GDTokenizerText::_make_constant(const Variant &p_constant) { +void GDScriptTokenizerText::_make_constant(const Variant &p_constant) { TokenData &tk = tk_rb[tk_rb_pos]; @@ -410,7 +410,7 @@ void GDTokenizerText::_make_constant(const Variant &p_constant) { tk_rb_pos = (tk_rb_pos + 1) % TK_RB_SIZE; } -void GDTokenizerText::_make_type(const Variant::Type &p_type) { +void GDScriptTokenizerText::_make_type(const Variant::Type &p_type) { TokenData &tk = tk_rb[tk_rb_pos]; @@ -422,7 +422,7 @@ void GDTokenizerText::_make_type(const Variant::Type &p_type) { tk_rb_pos = (tk_rb_pos + 1) % TK_RB_SIZE; } -void GDTokenizerText::_make_error(const String &p_error) { +void GDScriptTokenizerText::_make_error(const String &p_error) { error_flag = true; last_error = p_error; @@ -435,7 +435,7 @@ void GDTokenizerText::_make_error(const String &p_error) { tk_rb_pos = (tk_rb_pos + 1) % TK_RB_SIZE; } -void GDTokenizerText::_make_newline(int p_spaces) { +void GDScriptTokenizerText::_make_newline(int p_spaces) { TokenData &tk = tk_rb[tk_rb_pos]; tk.type = TK_NEWLINE; @@ -445,7 +445,7 @@ void GDTokenizerText::_make_newline(int p_spaces) { tk_rb_pos = (tk_rb_pos + 1) % TK_RB_SIZE; } -void GDTokenizerText::_advance() { +void GDScriptTokenizerText::_advance() { if (error_flag) { //parser broke @@ -885,6 +885,9 @@ void GDTokenizerText::_advance() { return; } sign_found = true; + } else if (GETCHAR(i) == '_') { + i++; + continue; // Included for readability, shouldn't be a part of the string } else break; @@ -897,7 +900,7 @@ void GDTokenizerText::_advance() { return; } - INCPOS(str.length()); + INCPOS(i); if (hexa_found) { int64_t val = str.hex_to_int64(); _make_constant(val); @@ -963,11 +966,11 @@ void GDTokenizerText::_advance() { //built in func? - for (int i = 0; i < GDFunctions::FUNC_MAX; i++) { + for (int i = 0; i < GDScriptFunctions::FUNC_MAX; i++) { - if (str == GDFunctions::get_func_name(GDFunctions::Function(i))) { + if (str == GDScriptFunctions::get_func_name(GDScriptFunctions::Function(i))) { - _make_built_in_func(GDFunctions::Function(i)); + _make_built_in_func(GDScriptFunctions::Function(i)); found = true; break; } @@ -1013,7 +1016,7 @@ void GDTokenizerText::_advance() { } } -void GDTokenizerText::set_code(const String &p_code) { +void GDScriptTokenizerText::set_code(const String &p_code) { code = p_code; len = p_code.length(); @@ -1032,7 +1035,7 @@ void GDTokenizerText::set_code(const String &p_code) { _advance(); } -GDTokenizerText::Token GDTokenizerText::get_token(int p_offset) const { +GDScriptTokenizerText::Token GDScriptTokenizerText::get_token(int p_offset) const { ERR_FAIL_COND_V(p_offset <= -MAX_LOOKAHEAD, TK_ERROR); ERR_FAIL_COND_V(p_offset >= MAX_LOOKAHEAD, TK_ERROR); @@ -1040,7 +1043,7 @@ GDTokenizerText::Token GDTokenizerText::get_token(int p_offset) const { return tk_rb[ofs].type; } -int GDTokenizerText::get_token_line(int p_offset) const { +int GDScriptTokenizerText::get_token_line(int p_offset) const { ERR_FAIL_COND_V(p_offset <= -MAX_LOOKAHEAD, -1); ERR_FAIL_COND_V(p_offset >= MAX_LOOKAHEAD, -1); @@ -1048,7 +1051,7 @@ int GDTokenizerText::get_token_line(int p_offset) const { return tk_rb[ofs].line; } -int GDTokenizerText::get_token_column(int p_offset) const { +int GDScriptTokenizerText::get_token_column(int p_offset) const { ERR_FAIL_COND_V(p_offset <= -MAX_LOOKAHEAD, -1); ERR_FAIL_COND_V(p_offset >= MAX_LOOKAHEAD, -1); @@ -1056,7 +1059,7 @@ int GDTokenizerText::get_token_column(int p_offset) const { return tk_rb[ofs].col; } -const Variant &GDTokenizerText::get_token_constant(int p_offset) const { +const Variant &GDScriptTokenizerText::get_token_constant(int p_offset) const { ERR_FAIL_COND_V(p_offset <= -MAX_LOOKAHEAD, tk_rb[0].constant); ERR_FAIL_COND_V(p_offset >= MAX_LOOKAHEAD, tk_rb[0].constant); @@ -1065,7 +1068,7 @@ const Variant &GDTokenizerText::get_token_constant(int p_offset) const { return tk_rb[ofs].constant; } -StringName GDTokenizerText::get_token_identifier(int p_offset) const { +StringName GDScriptTokenizerText::get_token_identifier(int p_offset) const { ERR_FAIL_COND_V(p_offset <= -MAX_LOOKAHEAD, StringName()); ERR_FAIL_COND_V(p_offset >= MAX_LOOKAHEAD, StringName()); @@ -1075,17 +1078,17 @@ StringName GDTokenizerText::get_token_identifier(int p_offset) const { return tk_rb[ofs].identifier; } -GDFunctions::Function GDTokenizerText::get_token_built_in_func(int p_offset) const { +GDScriptFunctions::Function GDScriptTokenizerText::get_token_built_in_func(int p_offset) const { - ERR_FAIL_COND_V(p_offset <= -MAX_LOOKAHEAD, GDFunctions::FUNC_MAX); - ERR_FAIL_COND_V(p_offset >= MAX_LOOKAHEAD, GDFunctions::FUNC_MAX); + ERR_FAIL_COND_V(p_offset <= -MAX_LOOKAHEAD, GDScriptFunctions::FUNC_MAX); + ERR_FAIL_COND_V(p_offset >= MAX_LOOKAHEAD, GDScriptFunctions::FUNC_MAX); int ofs = (TK_RB_SIZE + tk_rb_pos + p_offset - MAX_LOOKAHEAD - 1) % TK_RB_SIZE; - ERR_FAIL_COND_V(tk_rb[ofs].type != TK_BUILT_IN_FUNC, GDFunctions::FUNC_MAX); + ERR_FAIL_COND_V(tk_rb[ofs].type != TK_BUILT_IN_FUNC, GDScriptFunctions::FUNC_MAX); return tk_rb[ofs].func; } -Variant::Type GDTokenizerText::get_token_type(int p_offset) const { +Variant::Type GDScriptTokenizerText::get_token_type(int p_offset) const { ERR_FAIL_COND_V(p_offset <= -MAX_LOOKAHEAD, Variant::NIL); ERR_FAIL_COND_V(p_offset >= MAX_LOOKAHEAD, Variant::NIL); @@ -1095,7 +1098,7 @@ Variant::Type GDTokenizerText::get_token_type(int p_offset) const { return tk_rb[ofs].vtype; } -int GDTokenizerText::get_token_line_indent(int p_offset) const { +int GDScriptTokenizerText::get_token_line_indent(int p_offset) const { ERR_FAIL_COND_V(p_offset <= -MAX_LOOKAHEAD, 0); ERR_FAIL_COND_V(p_offset >= MAX_LOOKAHEAD, 0); @@ -1105,7 +1108,7 @@ int GDTokenizerText::get_token_line_indent(int p_offset) const { return tk_rb[ofs].constant; } -String GDTokenizerText::get_token_error(int p_offset) const { +String GDScriptTokenizerText::get_token_error(int p_offset) const { ERR_FAIL_COND_V(p_offset <= -MAX_LOOKAHEAD, String()); ERR_FAIL_COND_V(p_offset >= MAX_LOOKAHEAD, String()); @@ -1115,18 +1118,18 @@ String GDTokenizerText::get_token_error(int p_offset) const { return tk_rb[ofs].constant; } -void GDTokenizerText::advance(int p_amount) { +void GDScriptTokenizerText::advance(int p_amount) { ERR_FAIL_COND(p_amount <= 0); for (int i = 0; i < p_amount; i++) _advance(); } -////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////// #define BYTECODE_VERSION 12 -Error GDTokenizerBuffer::set_code_buffer(const Vector<uint8_t> &p_buffer) { +Error GDScriptTokenizerBuffer::set_code_buffer(const Vector<uint8_t> &p_buffer) { const uint8_t *buf = p_buffer.ptr(); int total_len = p_buffer.size(); @@ -1214,7 +1217,7 @@ Error GDTokenizerBuffer::set_code_buffer(const Vector<uint8_t> &p_buffer) { return OK; } -Vector<uint8_t> GDTokenizerBuffer::parse_code_string(const String &p_code) { +Vector<uint8_t> GDScriptTokenizerBuffer::parse_code_string(const String &p_code) { Vector<uint8_t> buf; @@ -1223,7 +1226,7 @@ Vector<uint8_t> GDTokenizerBuffer::parse_code_string(const String &p_code) { Map<uint32_t, int> line_map; Vector<uint32_t> token_array; - GDTokenizerText tt; + GDScriptTokenizerText tt; tt.set_code(p_code); int line = -1; @@ -1372,17 +1375,17 @@ Vector<uint8_t> GDTokenizerBuffer::parse_code_string(const String &p_code) { return buf; } -GDTokenizerBuffer::Token GDTokenizerBuffer::get_token(int p_offset) const { +GDScriptTokenizerBuffer::Token GDScriptTokenizerBuffer::get_token(int p_offset) const { int offset = token + p_offset; if (offset < 0 || offset >= tokens.size()) return TK_EOF; - return GDTokenizerBuffer::Token(tokens[offset] & TOKEN_MASK); + return GDScriptTokenizerBuffer::Token(tokens[offset] & TOKEN_MASK); } -StringName GDTokenizerBuffer::get_token_identifier(int p_offset) const { +StringName GDScriptTokenizerBuffer::get_token_identifier(int p_offset) const { int offset = token + p_offset; @@ -1393,14 +1396,14 @@ StringName GDTokenizerBuffer::get_token_identifier(int p_offset) const { return identifiers[identifier]; } -GDFunctions::Function GDTokenizerBuffer::get_token_built_in_func(int p_offset) const { +GDScriptFunctions::Function GDScriptTokenizerBuffer::get_token_built_in_func(int p_offset) const { int offset = token + p_offset; - ERR_FAIL_INDEX_V(offset, tokens.size(), GDFunctions::FUNC_MAX); - return GDFunctions::Function(tokens[offset] >> TOKEN_BITS); + ERR_FAIL_INDEX_V(offset, tokens.size(), GDScriptFunctions::FUNC_MAX); + return GDScriptFunctions::Function(tokens[offset] >> TOKEN_BITS); } -Variant::Type GDTokenizerBuffer::get_token_type(int p_offset) const { +Variant::Type GDScriptTokenizerBuffer::get_token_type(int p_offset) const { int offset = token + p_offset; ERR_FAIL_INDEX_V(offset, tokens.size(), Variant::NIL); @@ -1408,7 +1411,7 @@ Variant::Type GDTokenizerBuffer::get_token_type(int p_offset) const { return Variant::Type(tokens[offset] >> TOKEN_BITS); } -int GDTokenizerBuffer::get_token_line(int p_offset) const { +int GDScriptTokenizerBuffer::get_token_line(int p_offset) const { int offset = token + p_offset; int pos = lines.find_nearest(offset); @@ -1421,7 +1424,7 @@ int GDTokenizerBuffer::get_token_line(int p_offset) const { uint32_t l = lines.getv(pos); return l & TOKEN_LINE_MASK; } -int GDTokenizerBuffer::get_token_column(int p_offset) const { +int GDScriptTokenizerBuffer::get_token_column(int p_offset) const { int offset = token + p_offset; int pos = lines.find_nearest(offset); @@ -1433,13 +1436,13 @@ int GDTokenizerBuffer::get_token_column(int p_offset) const { uint32_t l = lines.getv(pos); return l >> TOKEN_LINE_BITS; } -int GDTokenizerBuffer::get_token_line_indent(int p_offset) const { +int GDScriptTokenizerBuffer::get_token_line_indent(int p_offset) const { int offset = token + p_offset; ERR_FAIL_INDEX_V(offset, tokens.size(), 0); return tokens[offset] >> TOKEN_BITS; } -const Variant &GDTokenizerBuffer::get_token_constant(int p_offset) const { +const Variant &GDScriptTokenizerBuffer::get_token_constant(int p_offset) const { int offset = token + p_offset; ERR_FAIL_INDEX_V(offset, tokens.size(), nil); @@ -1447,17 +1450,17 @@ const Variant &GDTokenizerBuffer::get_token_constant(int p_offset) const { ERR_FAIL_INDEX_V(constant, (uint32_t)constants.size(), nil); return constants[constant]; } -String GDTokenizerBuffer::get_token_error(int p_offset) const { +String GDScriptTokenizerBuffer::get_token_error(int p_offset) const { ERR_FAIL_V(String()); } -void GDTokenizerBuffer::advance(int p_amount) { +void GDScriptTokenizerBuffer::advance(int p_amount) { ERR_FAIL_INDEX(p_amount + token, tokens.size()); token += p_amount; } -GDTokenizerBuffer::GDTokenizerBuffer() { +GDScriptTokenizerBuffer::GDScriptTokenizerBuffer() { token = 0; } diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h index f4b579def4..d19367177b 100644 --- a/modules/gdscript/gd_tokenizer.h +++ b/modules/gdscript/gdscript_tokenizer.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gd_tokenizer.h */ +/* gdscript_tokenizer.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,16 +27,16 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GD_TOKENIZER_H -#define GD_TOKENIZER_H +#ifndef GDSCRIPT_TOKENIZER_H +#define GDSCRIPT_TOKENIZER_H -#include "gd_functions.h" +#include "gdscript_functions.h" #include "string_db.h" #include "ustring.h" #include "variant.h" #include "vmap.h" -class GDTokenizer { +class GDScriptTokenizer { public: enum Token { @@ -156,7 +156,7 @@ public: virtual const Variant &get_token_constant(int p_offset = 0) const = 0; virtual Token get_token(int p_offset = 0) const = 0; virtual StringName get_token_identifier(int p_offset = 0) const = 0; - virtual GDFunctions::Function get_token_built_in_func(int p_offset = 0) const = 0; + virtual GDScriptFunctions::Function get_token_built_in_func(int p_offset = 0) const = 0; virtual Variant::Type get_token_type(int p_offset = 0) const = 0; virtual int get_token_line(int p_offset = 0) const = 0; virtual int get_token_column(int p_offset = 0) const = 0; @@ -164,10 +164,10 @@ public: virtual String get_token_error(int p_offset = 0) const = 0; virtual void advance(int p_amount = 1) = 0; - virtual ~GDTokenizer(){}; + virtual ~GDScriptTokenizer(){}; }; -class GDTokenizerText : public GDTokenizer { +class GDScriptTokenizerText : public GDScriptTokenizer { enum { MAX_LOOKAHEAD = 4, @@ -181,7 +181,7 @@ class GDTokenizerText : public GDTokenizer { Variant constant; //for constant types union { Variant::Type vtype; //for type types - GDFunctions::Function func; //function for built in functions + GDScriptFunctions::Function func; //function for built in functions }; int line, col; TokenData() { @@ -194,7 +194,7 @@ class GDTokenizerText : public GDTokenizer { void _make_token(Token p_type); void _make_newline(int p_spaces = 0); void _make_identifier(const StringName &p_identifier); - void _make_built_in_func(GDFunctions::Function p_func); + void _make_built_in_func(GDScriptFunctions::Function p_func); void _make_constant(const Variant &p_constant); void _make_type(const Variant::Type &p_type); void _make_error(const String &p_error); @@ -216,7 +216,7 @@ public: void set_code(const String &p_code); virtual Token get_token(int p_offset = 0) const; virtual StringName get_token_identifier(int p_offset = 0) const; - virtual GDFunctions::Function get_token_built_in_func(int p_offset = 0) const; + virtual GDScriptFunctions::Function get_token_built_in_func(int p_offset = 0) const; virtual Variant::Type get_token_type(int p_offset = 0) const; virtual int get_token_line(int p_offset = 0) const; virtual int get_token_column(int p_offset = 0) const; @@ -226,7 +226,7 @@ public: virtual void advance(int p_amount = 1); }; -class GDTokenizerBuffer : public GDTokenizer { +class GDScriptTokenizerBuffer : public GDScriptTokenizer { enum { @@ -249,7 +249,7 @@ public: static Vector<uint8_t> parse_code_string(const String &p_code); virtual Token get_token(int p_offset = 0) const; virtual StringName get_token_identifier(int p_offset = 0) const; - virtual GDFunctions::Function get_token_built_in_func(int p_offset = 0) const; + virtual GDScriptFunctions::Function get_token_built_in_func(int p_offset = 0) const; virtual Variant::Type get_token_type(int p_offset = 0) const; virtual int get_token_line(int p_offset = 0) const; virtual int get_token_column(int p_offset = 0) const; @@ -257,7 +257,7 @@ public: virtual const Variant &get_token_constant(int p_offset = 0) const; virtual String get_token_error(int p_offset = 0) const; virtual void advance(int p_amount = 1); - GDTokenizerBuffer(); + GDScriptTokenizerBuffer(); }; -#endif // TOKENIZER_H +#endif // GDSCRIPT_TOKENIZER_H diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 036274c8f2..1e007ddb0f 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "register_types.h" -#include "gd_script.h" +#include "gdscript.h" #include "io/file_access_encrypted.h" #include "io/resource_loader.h" #include "os/file_access.h" @@ -41,10 +41,9 @@ ResourceFormatSaverGDScript *resource_saver_gd = NULL; void register_gdscript_types() { ClassDB::register_class<GDScript>(); - ClassDB::register_virtual_class<GDFunctionState>(); + ClassDB::register_virtual_class<GDScriptFunctionState>(); script_language_gd = memnew(GDScriptLanguage); - //script_language_gd->init(); ScriptServer::register_language(script_language_gd); resource_loader_gd = memnew(ResourceFormatLoaderGDScript); ResourceLoader::add_resource_format_loader(resource_loader_gd); diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py index b3dbb9f46a..a93f4edb81 100644 --- a/modules/gridmap/config.py +++ b/modules/gridmap/config.py @@ -1,14 +1,13 @@ - - def can_build(platform): return True - def configure(env): pass def get_doc_classes(): - return ["GridMap"] + return [ + "GridMap", + ] def get_doc_path(): - return "doc_classes" + return "doc_classes" diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml index 5b0fe56f25..ee8ecfff66 100644 --- a/modules/gridmap/doc_classes/GridMap.xml +++ b/modules/gridmap/doc_classes/GridMap.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GridMap" inherits="Spatial" category="Core" version="3.0.alpha.custom_build"> +<class name="GridMap" inherits="Spatial" category="Core" version="3.0-alpha"> <brief_description> Node for 3D tile-based maps. </brief_description> diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index cb14a5ee9c..b3a1947647 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -747,7 +747,6 @@ void GridMap::_update_octants_callback() { } while (to_delete.front()) { - memdelete(octant_map[to_delete.front()->get()]); octant_map.erase(to_delete.front()->get()); to_delete.pop_back(); } diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index f6a76ad2a1..491adb31ee 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -28,8 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "grid_map_editor_plugin.h" +#include "editor/editor_scale.h" #include "editor/editor_settings.h" #include "editor/plugins/spatial_editor_plugin.h" +#include "os/input.h" #include "scene/3d/camera.h" #include "geometry.h" @@ -56,6 +58,14 @@ void GridMapEditor::_menu_option(int p_option) { switch (p_option) { + case MENU_OPTION_PREV_LEVEL: { + floor->set_value(floor->get_value() - 1); + } break; + + case MENU_OPTION_NEXT_LEVEL: { + floor->set_value(floor->get_value() + 1); + } break; + case MENU_OPTION_CONFIGURE: { } break; @@ -94,6 +104,7 @@ void GridMapEditor::_menu_option(int p_option) { } break; case MENU_OPTION_CURSOR_ROTATE_Y: { + Basis r; if (input_action == INPUT_DUPLICATE) { @@ -109,6 +120,7 @@ void GridMapEditor::_menu_option(int p_option) { _update_cursor_transform(); } break; case MENU_OPTION_CURSOR_ROTATE_X: { + Basis r; if (input_action == INPUT_DUPLICATE) { @@ -125,6 +137,7 @@ void GridMapEditor::_menu_option(int p_option) { _update_cursor_transform(); } break; case MENU_OPTION_CURSOR_ROTATE_Z: { + Basis r; if (input_action == INPUT_DUPLICATE) { @@ -141,6 +154,7 @@ void GridMapEditor::_menu_option(int p_option) { _update_cursor_transform(); } break; case MENU_OPTION_CURSOR_BACK_ROTATE_Y: { + Basis r; r.set_orthogonal_index(cursor_rot); r.rotate(Vector3(0, 1, 0), Math_PI / 2.0); @@ -148,6 +162,7 @@ void GridMapEditor::_menu_option(int p_option) { _update_cursor_transform(); } break; case MENU_OPTION_CURSOR_BACK_ROTATE_X: { + Basis r; r.set_orthogonal_index(cursor_rot); r.rotate(Vector3(1, 0, 0), Math_PI / 2.0); @@ -155,6 +170,7 @@ void GridMapEditor::_menu_option(int p_option) { _update_cursor_transform(); } break; case MENU_OPTION_CURSOR_BACK_ROTATE_Z: { + Basis r; r.set_orthogonal_index(cursor_rot); r.rotate(Vector3(0, 0, 1), Math_PI / 2.0); @@ -184,6 +200,9 @@ void GridMapEditor::_menu_option(int p_option) { if (last_mouseover == Vector3(-1, -1, -1)) //nono mouseovering anythin break; + last_mouseover = selection.begin; + VS::get_singleton()->instance_set_transform(grid_instance[edit_axis], Transform(Basis(), grid_ofs)); + input_action = INPUT_DUPLICATE; selection.click = last_mouseover; selection.current = last_mouseover; @@ -198,7 +217,7 @@ void GridMapEditor::_menu_option(int p_option) { } break; case MENU_OPTION_GRIDMAP_SETTINGS: { - settings_dialog->popup_centered(settings_vbc->get_combined_minimum_size() + Size2(50, 50)); + settings_dialog->popup_centered(settings_vbc->get_combined_minimum_size() + Size2(50, 50) * EDSCALE); } break; } } @@ -551,12 +570,11 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu input_action = INPUT_NONE; _update_duplicate_indicator(); - } else { + } else if (mb->get_shift()) { input_action = INPUT_ERASE; set_items.clear(); - } - else - return false; + } else + return false; return do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true); } else { @@ -829,70 +847,77 @@ void GridMapEditor::update_grid() { void GridMapEditor::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { + switch (p_what) { - theme_pallete->connect("item_selected", this, "_item_selected_cbk"); - for (int i = 0; i < 3; i++) { + case NOTIFICATION_ENTER_TREE: { + theme_pallete->connect("item_selected", this, "_item_selected_cbk"); + for (int i = 0; i < 3; i++) { - grid[i] = VS::get_singleton()->mesh_create(); - grid_instance[i] = VS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario()); - selection_level_instance[i] = VisualServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world()->get_scenario()); - } + grid[i] = VS::get_singleton()->mesh_create(); + grid_instance[i] = VS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario()); + selection_level_instance[i] = VisualServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world()->get_scenario()); + } - selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario()); - duplicate_instance = VisualServer::get_singleton()->instance_create2(duplicate_mesh, get_tree()->get_root()->get_world()->get_scenario()); + selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario()); + duplicate_instance = VisualServer::get_singleton()->instance_create2(duplicate_mesh, get_tree()->get_root()->get_world()->get_scenario()); - _update_selection_transform(); - _update_duplicate_indicator(); - - } else if (p_what == NOTIFICATION_EXIT_TREE) { + _update_selection_transform(); + _update_duplicate_indicator(); + } break; - for (int i = 0; i < 3; i++) { + case NOTIFICATION_EXIT_TREE: { + for (int i = 0; i < 3; i++) { - VS::get_singleton()->free(grid_instance[i]); - VS::get_singleton()->free(grid[i]); - grid_instance[i] = RID(); - grid[i] = RID(); - VisualServer::get_singleton()->free(selection_level_instance[i]); - } + VS::get_singleton()->free(grid_instance[i]); + VS::get_singleton()->free(grid[i]); + grid_instance[i] = RID(); + grid[i] = RID(); + VisualServer::get_singleton()->free(selection_level_instance[i]); + } - VisualServer::get_singleton()->free(selection_instance); - VisualServer::get_singleton()->free(duplicate_instance); - selection_instance = RID(); - duplicate_instance = RID(); + VisualServer::get_singleton()->free(selection_instance); + VisualServer::get_singleton()->free(duplicate_instance); + selection_instance = RID(); + duplicate_instance = RID(); + } break; - } else if (p_what == NOTIFICATION_PROCESS) { - if (!node) { - return; - } + case NOTIFICATION_PROCESS: { + if (!node) { + return; + } - Transform xf = node->get_global_transform(); + Transform xf = node->get_global_transform(); - if (xf != grid_xform) { - for (int i = 0; i < 3; i++) { + if (xf != grid_xform) { + for (int i = 0; i < 3; i++) { - VS::get_singleton()->instance_set_transform(grid_instance[i], xf * edit_grid_xform); + VS::get_singleton()->instance_set_transform(grid_instance[i], xf * edit_grid_xform); + } + grid_xform = xf; } - grid_xform = xf; - } - Ref<MeshLibrary> cgmt = node->get_theme(); - if (cgmt.operator->() != last_theme) - update_pallete(); + Ref<MeshLibrary> cgmt = node->get_theme(); + if (cgmt.operator->() != last_theme) + update_pallete(); - if (lock_view) { + if (lock_view) { - EditorNode *editor = Object::cast_to<EditorNode>(get_tree()->get_root()->get_child(0)); + EditorNode *editor = Object::cast_to<EditorNode>(get_tree()->get_root()->get_child(0)); - Plane p; - p.normal[edit_axis] = 1.0; - p.d = edit_floor[edit_axis] * node->get_cell_size()[edit_axis]; - p = node->get_transform().xform(p); // plane to snap + Plane p; + p.normal[edit_axis] = 1.0; + p.d = edit_floor[edit_axis] * node->get_cell_size()[edit_axis]; + p = node->get_transform().xform(p); // plane to snap - SpatialEditorPlugin *sep = Object::cast_to<SpatialEditorPlugin>(editor->get_editor_plugin_screen()); - if (sep) - sep->snap_cursor_to_plane(p); - //editor->get_editor_plugin_screen()->call("snap_cursor_to_plane",p); - } + SpatialEditorPlugin *sep = Object::cast_to<SpatialEditorPlugin>(editor->get_editor_plugin_screen()); + if (sep) + sep->snap_cursor_to_plane(p); + //editor->get_editor_plugin_screen()->call("snap_cursor_to_plane",p); + } + } break; + + case NOTIFICATION_THEME_CHANGED: { + options->set_icon(get_icon("GridMap", "EditorIcons")); + } break; } } @@ -954,20 +979,38 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { int mw = EDITOR_DEF("editors/grid_map/palette_min_width", 230); Control *ec = memnew(Control); - ec->set_custom_minimum_size(Size2(mw, 0)); + ec->set_custom_minimum_size(Size2(mw, 0) * EDSCALE); add_child(ec); spatial_editor_hb = memnew(HBoxContainer); + spatial_editor_hb->set_h_size_flags(SIZE_EXPAND_FILL); + spatial_editor_hb->set_alignment(BoxContainer::ALIGN_END); SpatialEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb); + + Label *fl = memnew(Label); + fl->set_text(TTR("Floor:")); + spatial_editor_hb->add_child(fl); + + floor = memnew(SpinBox); + floor->set_min(-32767); + floor->set_max(32767); + floor->set_step(1); + floor->get_line_edit()->add_constant_override("minimum_spaces", 16); + + spatial_editor_hb->add_child(floor); + floor->connect("value_changed", this, "_floor_changed"); + + spatial_editor_hb->add_child(memnew(VSeparator)); + options = memnew(MenuButton); spatial_editor_hb->add_child(options); spatial_editor_hb->hide(); - options->set_text("Grid"); + options->set_text(TTR("Grid Map")); options->get_popup()->add_check_item(TTR("Snap View"), MENU_OPTION_LOCK_VIEW); options->get_popup()->add_separator(); - options->get_popup()->add_item(vformat(TTR("Prev Level (%sDown Wheel)"), keycode_get_string(KEY_MASK_CMD)), MENU_OPTION_PREV_LEVEL); - options->get_popup()->add_item(vformat(TTR("Next Level (%sUp Wheel)"), keycode_get_string(KEY_MASK_CMD)), MENU_OPTION_NEXT_LEVEL); + options->get_popup()->add_item(TTR("Previous Floor"), MENU_OPTION_PREV_LEVEL, KEY_Q); + options->get_popup()->add_item(TTR("Next Floor"), MENU_OPTION_NEXT_LEVEL, KEY_E); options->get_popup()->add_separator(); options->get_popup()->add_check_item(TTR("Clip Disabled"), MENU_OPTION_CLIP_DISABLED); options->get_popup()->set_item_checked(options->get_popup()->get_item_index(MENU_OPTION_CLIP_DISABLED), true); @@ -993,8 +1036,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { options->get_popup()->add_item(TTR("Create Exterior Connector"), MENU_OPTION_SELECTION_MAKE_EXTERIOR_CONNECTOR); options->get_popup()->add_item(TTR("Erase Area"), MENU_OPTION_REMOVE_AREA); options->get_popup()->add_separator(); - options->get_popup()->add_item(TTR("Selection -> Duplicate"), MENU_OPTION_SELECTION_DUPLICATE, KEY_MASK_SHIFT + KEY_INSERT); - options->get_popup()->add_item(TTR("Selection -> Clear"), MENU_OPTION_SELECTION_CLEAR, KEY_MASK_SHIFT + KEY_DELETE); + options->get_popup()->add_item(TTR("Duplicate Selection"), MENU_OPTION_SELECTION_DUPLICATE, KEY_MASK_SHIFT + KEY_C); + options->get_popup()->add_item(TTR("Clear Selection"), MENU_OPTION_SELECTION_CLEAR, KEY_MASK_SHIFT + KEY_X); options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("Settings"), MENU_OPTION_GRIDMAP_SETTINGS); @@ -1003,7 +1046,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { settings_dialog->set_title(TTR("GridMap Settings")); add_child(settings_dialog); settings_vbc = memnew(VBoxContainer); - settings_vbc->set_custom_minimum_size(Size2(200, 0)); + settings_vbc->set_custom_minimum_size(Size2(200, 0) * EDSCALE); settings_dialog->add_child(settings_vbc); settings_pick_distance = memnew(SpinBox); @@ -1042,20 +1085,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { add_child(theme_pallete); theme_pallete->set_v_size_flags(SIZE_EXPAND_FILL); - spatial_editor_hb->add_child(memnew(VSeparator)); - Label *fl = memnew(Label); - fl->set_text(" Floor: "); - spatial_editor_hb->add_child(fl); - - floor = memnew(SpinBox); - floor->set_min(-32767); - floor->set_max(32767); - floor->set_step(1); - floor->get_line_edit()->add_constant_override("minimum_spaces", 16); - - spatial_editor_hb->add_child(floor); - floor->connect("value_changed", this, "_floor_changed"); - edit_axis = Vector3::AXIS_Y; edit_floor[0] = -1; edit_floor[1] = -1; @@ -1108,7 +1137,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { for (int i = 0; i < 12; i++) { - Rect3 base(Vector3(0, 0, 0), Vector3(1, 1, 1)); + AABB base(Vector3(0, 0, 0), Vector3(1, 1, 1)); Vector3 a, b; base.get_edge(i, a, b); lines.push_back(a); @@ -1250,7 +1279,9 @@ GridMapEditorPlugin::GridMapEditorPlugin(EditorNode *p_node) { gridmap_editor = memnew(GridMapEditor(editor)); SpatialEditor::get_singleton()->get_palette_split()->add_child(gridmap_editor); - SpatialEditor::get_singleton()->get_palette_split()->move_child(gridmap_editor, 0); + // TODO: make this configurable, so the user can choose were to put this, it makes more sense + // on the right, but some people might find it strange. + SpatialEditor::get_singleton()->get_palette_split()->move_child(gridmap_editor, 1); gridmap_editor->hide(); } diff --git a/modules/hdr/config.py b/modules/hdr/config.py index fb920482f5..5f133eba90 100644 --- a/modules/hdr/config.py +++ b/modules/hdr/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/jpg/config.py b/modules/jpg/config.py index fb920482f5..5f133eba90 100644 --- a/modules/jpg/config.py +++ b/modules/jpg/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/mobile_vr/config.py b/modules/mobile_vr/config.py index cf96c66125..4e1155f0c6 100644 --- a/modules/mobile_vr/config.py +++ b/modules/mobile_vr/config.py @@ -1,12 +1,14 @@ def can_build(platform): - # should probably change this to only be true on iOS and Android - return True + # should probably change this to only be true on iOS and Android + return True def configure(env): - pass + pass def get_doc_classes(): - return ["MobileVRInterface"] + return [ + "MobileVRInterface", + ] def get_doc_path(): - return "doc_classes" + return "doc_classes" diff --git a/modules/mobile_vr/doc_classes/MobileVRInterface.xml b/modules/mobile_vr/doc_classes/MobileVRInterface.xml index c945a99a9a..c99934aea9 100644 --- a/modules/mobile_vr/doc_classes/MobileVRInterface.xml +++ b/modules/mobile_vr/doc_classes/MobileVRInterface.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MobileVRInterface" inherits="ARVRInterface" category="Core" version="3.0.alpha.custom_build"> +<class name="MobileVRInterface" inherits="ARVRInterface" category="Core" version="3.0-alpha"> <brief_description> Generic mobile VR implementation </brief_description> diff --git a/modules/mono/config.py b/modules/mono/config.py index 7ad135e0b9..b4e6433256 100644 --- a/modules/mono/config.py +++ b/modules/mono/config.py @@ -177,7 +177,11 @@ def configure(env): def get_doc_classes(): - return ["@C#", "CSharpScript", "GodotSharp"] + return [ + "@C#", + "CSharpScript", + "GodotSharp", + ] def get_doc_path(): diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 161e130a07..dfa5e720ae 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -346,7 +346,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { Variant::TRANSFORM2D, Variant::PLANE, Variant::QUAT, - Variant::RECT3, + Variant::AABB, Variant::BASIS, Variant::TRANSFORM, Variant::COLOR, diff --git a/modules/mono/doc_classes/@C#.xml b/modules/mono/doc_classes/@C#.xml index 487ba9835f..5d27b32200 100644 --- a/modules/mono/doc_classes/@C#.xml +++ b/modules/mono/doc_classes/@C#.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="@C#" category="Core" version="3.0.alpha.custom_build"> +<class name="@C#" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/modules/mono/doc_classes/CSharpScript.xml b/modules/mono/doc_classes/CSharpScript.xml index 5f21c9774d..ccc24b832c 100644 --- a/modules/mono/doc_classes/CSharpScript.xml +++ b/modules/mono/doc_classes/CSharpScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="CSharpScript" inherits="Script" category="Core" version="3.0.alpha.custom_build"> +<class name="CSharpScript" inherits="Script" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/modules/mono/doc_classes/GodotSharp.xml b/modules/mono/doc_classes/GodotSharp.xml index e7e06ddd8f..9edbd18fc1 100644 --- a/modules/mono/doc_classes/GodotSharp.xml +++ b/modules/mono/doc_classes/GodotSharp.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GodotSharp" inherits="Object" category="Core" version="3.0.alpha.custom_build"> +<class name="GodotSharp" inherits="Object" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index eb504ec021..59a2b73dbc 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -31,12 +31,12 @@ #ifdef DEBUG_METHODS_ENABLED +#include "engine.h" #include "global_constants.h" #include "io/compression.h" #include "os/dir_access.h" #include "os/file_access.h" #include "os/os.h" -#include "project_settings.h" #include "ucaps.h" #include "../glue/cs_compressed.gen.h" @@ -320,9 +320,9 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_output_dir, bo int global_constants_count = GlobalConstants::get_global_constant_count(); if (global_constants_count > 0) { - Map<String, DocData::ClassDoc>::Element *match = EditorHelp::get_doc_data()->class_list.find("@Global Scope"); + Map<String, DocData::ClassDoc>::Element *match = EditorHelp::get_doc_data()->class_list.find("@GlobalScope"); - ERR_EXPLAIN("Could not find `@Global Scope` in DocData"); + ERR_EXPLAIN("Could not find `@GlobalScope` in DocData"); ERR_FAIL_COND_V(!match, ERR_BUG); const DocData::ClassDoc &global_scope_doc = match->value(); @@ -1169,7 +1169,7 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) { output.push_back("Object* "); output.push_back(singleton_icall_name); - output.push_back("() " OPEN_BLOCK "\treturn ProjectSettings::get_singleton()->get_singleton_object(\""); + output.push_back("() " OPEN_BLOCK "\treturn Engine::get_singleton()->get_singleton_object(\""); output.push_back(itype.proxy_name); output.push_back("\");\n" CLOSE_BLOCK "\n"); } @@ -1505,7 +1505,7 @@ void BindingsGenerator::_populate_object_type_interfaces() { TypeInterface itype = TypeInterface::create_object_type(type_cname, api_type); itype.base_name = ClassDB::get_parent_class(type_cname); - itype.is_singleton = ProjectSettings::get_singleton()->has_singleton(itype.proxy_name); + itype.is_singleton = Engine::get_singleton()->has_singleton(itype.proxy_name); itype.is_instantiable = ClassDB::can_instance(type_cname) && !itype.is_singleton; itype.is_reference = ClassDB::is_parent_class(type_cname, refclass_name); itype.memory_own = itype.is_reference; @@ -1721,7 +1721,7 @@ void BindingsGenerator::_default_argument_from_variant(const Variant &p_val, Arg r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL; break; case Variant::PLANE: - case Variant::RECT3: + case Variant::AABB: case Variant::COLOR: r_iarg.default_argument = "new Color(1, 1, 1, 1)"; r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL; @@ -1793,7 +1793,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { INSERT_STRUCT_TYPE(Basis, "real_t*") INSERT_STRUCT_TYPE(Quat, "real_t*") INSERT_STRUCT_TYPE(Transform, "real_t*") - INSERT_STRUCT_TYPE(Rect3, "real_t*") + INSERT_STRUCT_TYPE(AABB, "real_t*") INSERT_STRUCT_TYPE(Color, "real_t*") INSERT_STRUCT_TYPE(Plane, "real_t*") diff --git a/modules/mono/glue/cs_files/Rect3.cs b/modules/mono/glue/cs_files/AABB.cs index 617d33e7fd..6ee3bbe53a 100644 --- a/modules/mono/glue/cs_files/Rect3.cs +++ b/modules/mono/glue/cs_files/AABB.cs @@ -1,15 +1,15 @@ using System; -// file: core/math/rect3.h +// file: core/math/aabb.h // commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451 -// file: core/math/rect3.cpp +// file: core/math/aabb.cpp // commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0 // file: core/variant_call.cpp // commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685 namespace Godot { - public struct Rect3 : IEquatable<Rect3> + public struct AABB : IEquatable<AABB> { private Vector3 position; private Vector3 size; @@ -38,7 +38,7 @@ namespace Godot } } - public bool encloses(Rect3 with) + public bool encloses(AABB with) { Vector3 src_min = position; Vector3 src_max = position + size; @@ -53,7 +53,7 @@ namespace Godot (src_max.z > dst_max.z)); } - public Rect3 expand(Vector3 to_point) + public AABB expand(Vector3 to_point) { Vector3 begin = position; Vector3 end = position + size; @@ -72,7 +72,7 @@ namespace Godot if (to_point.z > end.z) end.z = to_point.z; - return new Rect3(begin, end - begin); + return new AABB(begin, end - begin); } public float get_area() @@ -222,9 +222,9 @@ namespace Godot (dir.z > 0f) ? -half_extents.z : half_extents.z); } - public Rect3 grow(float by) + public AABB grow(float by) { - Rect3 res = this; + AABB res = this; res.position.x -= by; res.position.y -= by; @@ -264,7 +264,7 @@ namespace Godot return true; } - public Rect3 intersection(Rect3 with) + public AABB intersection(AABB with) { Vector3 src_min = position; Vector3 src_max = position + size; @@ -275,7 +275,7 @@ namespace Godot if (src_min.x > dst_max.x || src_max.x < dst_min.x) { - return new Rect3(); + return new AABB(); } else { @@ -285,7 +285,7 @@ namespace Godot if (src_min.y > dst_max.y || src_max.y < dst_min.y) { - return new Rect3(); + return new AABB(); } else { @@ -295,7 +295,7 @@ namespace Godot if (src_min.z > dst_max.z || src_max.z < dst_min.z) { - return new Rect3(); + return new AABB(); } else { @@ -303,10 +303,10 @@ namespace Godot max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z; } - return new Rect3(min, max - min); + return new AABB(min, max - min); } - public bool intersects(Rect3 with) + public bool intersects(AABB with) { if (position.x >= (with.position.x + with.size.x)) return false; @@ -398,7 +398,7 @@ namespace Godot return true; } - public Rect3 merge(Rect3 with) + public AABB merge(AABB with) { Vector3 beg_1 = position; Vector3 beg_2 = with.position; @@ -417,36 +417,36 @@ namespace Godot (end_1.z > end_2.z) ? end_1.z : end_2.z ); - return new Rect3(min, max - min); + return new AABB(min, max - min); } - public Rect3(Vector3 position, Vector3 size) + public AABB(Vector3 position, Vector3 size) { this.position = position; this.size = size; } - public static bool operator ==(Rect3 left, Rect3 right) + public static bool operator ==(AABB left, AABB right) { return left.Equals(right); } - public static bool operator !=(Rect3 left, Rect3 right) + public static bool operator !=(AABB left, AABB right) { return !left.Equals(right); } public override bool Equals(object obj) { - if (obj is Rect3) + if (obj is AABB) { - return Equals((Rect3)obj); + return Equals((AABB)obj); } return false; } - public bool Equals(Rect3 other) + public bool Equals(AABB other) { return position == other.position && size == other.size; } diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h index 0751a0160f..75a4eb2b40 100644 --- a/modules/mono/glue/glue_header.h +++ b/modules/mono/glue/glue_header.h @@ -35,10 +35,10 @@ #include "bind/core_bind.h" #include "class_db.h" +#include "engine.h" #include "io/marshalls.h" #include "object.h" #include "os/os.h" -#include "project_settings.h" #include "reference.h" #include "variant_parser.h" diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 1643f8cfc5..eb34f9dd3f 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -41,7 +41,7 @@ void GDMonoField::set_value_raw(MonoObject *p_object, void *p_ptr) { void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { #define SET_FROM_STRUCT_AND_BREAK(m_type) \ { \ - const m_type &val = p_value.operator m_type(); \ + const m_type &val = p_value.operator ::m_type(); \ MARSHALLED_OUT(m_type, val, raw); \ mono_field_set_value(p_object, mono_field, raw); \ break; \ @@ -129,8 +129,8 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { if (tclass == CACHED_CLASS(Transform)) SET_FROM_STRUCT_AND_BREAK(Transform); - if (tclass == CACHED_CLASS(Rect3)) - SET_FROM_STRUCT_AND_BREAK(Rect3); + if (tclass == CACHED_CLASS(AABB)) + SET_FROM_STRUCT_AND_BREAK(AABB); if (tclass == CACHED_CLASS(Color)) SET_FROM_STRUCT_AND_BREAK(Color); @@ -229,7 +229,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { case Variant::TRANSFORM2D: SET_FROM_STRUCT_AND_BREAK(Transform2D); case Variant::PLANE: SET_FROM_STRUCT_AND_BREAK(Plane); case Variant::QUAT: SET_FROM_STRUCT_AND_BREAK(Quat); - case Variant::RECT3: SET_FROM_STRUCT_AND_BREAK(Rect3); + case Variant::AABB: SET_FROM_STRUCT_AND_BREAK(AABB); case Variant::BASIS: SET_FROM_STRUCT_AND_BREAK(Basis); case Variant::TRANSFORM: SET_FROM_STRUCT_AND_BREAK(Transform); case Variant::COLOR: SET_FROM_STRUCT_AND_BREAK(Color); diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 01392447f3..8bc2bb5096 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -36,7 +36,7 @@ namespace GDMonoMarshal { #define RETURN_BOXED_STRUCT(m_t, m_var_in) \ { \ - const m_t &m_in = m_var_in->operator m_t(); \ + const m_t &m_in = m_var_in->operator ::m_t(); \ MARSHALLED_OUT(m_t, m_in, raw); \ return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(m_t), raw); \ } @@ -104,8 +104,8 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { if (tclass == CACHED_CLASS(Transform)) return Variant::TRANSFORM; - if (tclass == CACHED_CLASS(Rect3)) - return Variant::RECT3; + if (tclass == CACHED_CLASS(AABB)) + return Variant::AABB; if (tclass == CACHED_CLASS(Color)) return Variant::COLOR; @@ -297,8 +297,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty if (tclass == CACHED_CLASS(Transform)) RETURN_BOXED_STRUCT(Transform, p_var); - if (tclass == CACHED_CLASS(Rect3)) - RETURN_BOXED_STRUCT(Rect3, p_var); + if (tclass == CACHED_CLASS(AABB)) + RETURN_BOXED_STRUCT(AABB, p_var); if (tclass == CACHED_CLASS(Color)) RETURN_BOXED_STRUCT(Color, p_var); @@ -394,8 +394,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty RETURN_BOXED_STRUCT(Plane, p_var); case Variant::QUAT: RETURN_BOXED_STRUCT(Quat, p_var); - case Variant::RECT3: - RETURN_BOXED_STRUCT(Rect3, p_var); + case Variant::AABB: + RETURN_BOXED_STRUCT(AABB, p_var); case Variant::BASIS: RETURN_BOXED_STRUCT(Basis, p_var); case Variant::TRANSFORM: @@ -518,8 +518,8 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) { if (tclass == CACHED_CLASS(Transform)) RETURN_UNBOXED_STRUCT(Transform, p_obj); - if (tclass == CACHED_CLASS(Rect3)) - RETURN_UNBOXED_STRUCT(Rect3, p_obj); + if (tclass == CACHED_CLASS(AABB)) + RETURN_UNBOXED_STRUCT(AABB, p_obj); if (tclass == CACHED_CLASS(Color)) RETURN_UNBOXED_STRUCT(Color, p_obj); diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index 9f403b787f..443e947fb5 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -197,10 +197,10 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict); Basis(m_in[0], m_in[1], m_in[2], m_in[3], m_in[4], m_in[5], m_in[6], m_in[7], m_in[8]), \ Vector3(m_in[9], m_in[10], m_in[11])); -// Rect3 +// AABB -#define MARSHALLED_OUT_Rect3(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z }; -#define MARSHALLED_IN_Rect3(m_in, m_out) Rect3 m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5])); +#define MARSHALLED_OUT_AABB(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z }; +#define MARSHALLED_IN_AABB(m_in, m_out) AABB m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5])); // Color @@ -214,6 +214,6 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict); #endif -} // GDMonoMarshal +} // namespace GDMonoMarshal #endif // GDMONOMARSHAL_H diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp index 53e45002c4..1cccd0ad9d 100644 --- a/modules/mono/mono_gd/gd_mono_utils.cpp +++ b/modules/mono/mono_gd/gd_mono_utils.cpp @@ -80,7 +80,7 @@ void MonoCache::clear_members() { class_Basis = NULL; class_Quat = NULL; class_Transform = NULL; - class_Rect3 = NULL; + class_AABB = NULL; class_Color = NULL; class_Plane = NULL; class_NodePath = NULL; @@ -147,7 +147,7 @@ void update_godot_api_cache() { CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis)); CACHE_CLASS_AND_CHECK(Quat, GODOT_API_CLASS(Quat)); CACHE_CLASS_AND_CHECK(Transform, GODOT_API_CLASS(Transform)); - CACHE_CLASS_AND_CHECK(Rect3, GODOT_API_CLASS(Rect3)); + CACHE_CLASS_AND_CHECK(AABB, GODOT_API_CLASS(AABB)); CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color)); CACHE_CLASS_AND_CHECK(Plane, GODOT_API_CLASS(Plane)); CACHE_CLASS_AND_CHECK(NodePath, GODOT_API_CLASS(NodePath)); @@ -364,4 +364,4 @@ String get_exception_name_and_message(MonoObject *p_ex) { return res; } -} +} // namespace GDMonoUtils diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h index ebb5d28e4d..c38f8c5af5 100644 --- a/modules/mono/mono_gd/gd_mono_utils.h +++ b/modules/mono/mono_gd/gd_mono_utils.h @@ -82,7 +82,7 @@ struct MonoCache { GDMonoClass *class_Basis; GDMonoClass *class_Quat; GDMonoClass *class_Transform; - GDMonoClass *class_Rect3; + GDMonoClass *class_AABB; GDMonoClass *class_Color; GDMonoClass *class_Plane; GDMonoClass *class_NodePath; @@ -166,7 +166,7 @@ MonoDomain *create_domain(const String &p_friendly_name); String get_exception_name_and_message(MonoObject *p_ex); -} // GDMonoUtils +} // namespace GDMonoUtils #define NATIVE_GDMONOCLASS_NAME(m_class) (GDMonoMarshal::mono_string_to_godot((MonoString *)m_class->get_field(BINDINGS_NATIVE_NAME_FIELD)->get_value(NULL))) diff --git a/modules/mono/register_types.cpp b/modules/mono/register_types.cpp index 2656de5b14..217460a439 100644 --- a/modules/mono/register_types.cpp +++ b/modules/mono/register_types.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "register_types.h" -#include "project_settings.h" +#include "engine.h" #include "csharp_script.h" @@ -45,7 +45,7 @@ void register_mono_types() { _godotsharp = memnew(_GodotSharp); ClassDB::register_class<_GodotSharp>(); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("GodotSharp", _GodotSharp::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("GodotSharp", _GodotSharp::get_singleton())); script_language_cs = memnew(CSharpLanguage); script_language_cs->set_language_index(ScriptServer::get_language_count()); diff --git a/modules/ogg/config.py b/modules/ogg/config.py index fb920482f5..5f133eba90 100644 --- a/modules/ogg/config.py +++ b/modules/ogg/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/openssl/config.py b/modules/openssl/config.py index fb920482f5..5f133eba90 100644 --- a/modules/openssl/config.py +++ b/modules/openssl/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/opus/config.py b/modules/opus/config.py index fb920482f5..60f8d838d6 100644 --- a/modules/opus/config.py +++ b/modules/opus/config.py @@ -1,7 +1,13 @@ - def can_build(platform): return True - def configure(env): pass + +def get_doc_classes(): + return [ + "AudioStreamOpus", + ] + +def get_doc_path(): + return "doc_classes" diff --git a/modules/pbm/config.py b/modules/pbm/config.py index fb920482f5..5f133eba90 100644 --- a/modules/pbm/config.py +++ b/modules/pbm/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/pvr/config.py b/modules/pvr/config.py index fb920482f5..5f133eba90 100644 --- a/modules/pvr/config.py +++ b/modules/pvr/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/recast/config.py b/modules/recast/config.py index d42f07b2a9..fc074cf661 100644 --- a/modules/recast/config.py +++ b/modules/recast/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return platform != "android" - def configure(env): pass diff --git a/modules/regex/config.py b/modules/regex/config.py index 5347cfd243..cb2da26738 100644 --- a/modules/regex/config.py +++ b/modules/regex/config.py @@ -1,9 +1,14 @@ -#!/usr/bin/env python - - def can_build(platform): return True - def configure(env): pass + +def get_doc_classes(): + return [ + "RegEx", + "RegExMatch", + ] + +def get_doc_path(): + return "doc_classes" diff --git a/modules/regex/doc_classes/RegEx.xml b/modules/regex/doc_classes/RegEx.xml new file mode 100644 index 0000000000..4cf272fe8c --- /dev/null +++ b/modules/regex/doc_classes/RegEx.xml @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="RegEx" inherits="Reference" category="Core" version="3.0-alpha"> + <brief_description> + Class for searching text for patterns using regular expressions. + </brief_description> + <description> + Regular Expression (or regex) is a compact programming language that can be used to recognise strings that follow a specific pattern, such as URLs, email addresses, complete sentences, etc. For instance, a regex of [code]ab[0-9][/code] would find any string that is [code]ab[/code] followed by any number from [code]0[/code] to [code]9[/code]. For a more in-depth look, you can easily find various tutorials and detailed explainations on the Internet. + To begin, the RegEx object needs to be compiled with the search pattern using [method compile] before it can be used. + [codeblock] + var regex = RegEx.new() + regex.compile("\\w-(\\d+)") + [/codeblock] + The search pattern must be escaped first for gdscript before it is escaped for the expression. For example, [code]compile("\\d+")[/code] would be read by RegEx as [code]\d+[/code]. Similarly, [code]compile("\"(?:\\\\.|[^\"])*\"")[/code] would be read as [code]"(?:\\.|[^"])*"[/code] + Using [method search] you can find the pattern within the given text. If a pattern is found, [RegExMatch] is returned and you can retrieve details of the results using fuctions such as [method RegExMatch.get_string] and [method RegExMatch.get_start]. + [codeblock] + var regex = RegEx.new() + regex.compile("\\w-(\\d+)") + var result = regex.search("abc n-0123") + if result: + print(result.get_string()) # Would print n-0123 + [/codeblock] + The results of capturing groups [code]()[/code] can be retrieved by passing the group number to the various functions in [RegExMatch]. Group 0 is the default and would always refer to the entire pattern. In the above example, calling [code]result.get_string(1)[/code] would give you [code]0123[/code]. + This version of RegEx also supports named capturing groups, and the names can be used to retrieve the results. If two or more groups have the same name, the name would only refer to the first one with a match. + [codeblock] + var regex = RegEx.new() + regex.compile("d(?<digit>[0-9]+)|x(?<digit>[0-9a-f]+)") + var result = regex.search("the number is x2f") + if result: + print(result.get_string("digit")) # Would print 2f + [/codeblock] + If you need to process multiple results, [method search_all] generates a list of all non-overlapping results. This can be combined with a for-loop for convenience. + [codeblock] + for result in regex.search_all("d01, d03, d0c, x3f and x42"): + print(result.get_string("digit")) + # Would print 01 03 3f 42 + # Note that d0c would not match + [/codeblock] + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="clear"> + <return type="void"> + </return> + <description> + This method resets the state of the object, as it was freshly created. Namely, it unassigns the regular expression of this object. + </description> + </method> + <method name="compile"> + <return type="int" enum="Error"> + </return> + <argument index="0" name="pattern" type="String"> + </argument> + <description> + Compiles and assign the search pattern to use. Returns OK if the compilation is successful. If an error is encountered the details are printed to STDOUT and FAILED is returned. + </description> + </method> + <method name="get_group_count" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns the number of capturing groups in compiled pattern. + </description> + </method> + <method name="get_names" qualifiers="const"> + <return type="Array"> + </return> + <description> + Returns an array of names of named capturing groups in the compiled pattern. They are ordered by appearance. + </description> + </method> + <method name="get_pattern" qualifiers="const"> + <return type="String"> + </return> + <description> + Returns the original search pattern that was compiled. + </description> + </method> + <method name="is_valid" qualifiers="const"> + <return type="bool"> + </return> + <description> + Returns whether this object has a valid search pattern assigned. + </description> + </method> + <method name="search" qualifiers="const"> + <return type="RegExMatch"> + </return> + <argument index="0" name="subject" type="String"> + </argument> + <argument index="1" name="offset" type="int" default="0"> + </argument> + <argument index="2" name="end" type="int" default="-1"> + </argument> + <description> + Searches the text for the compiled pattern. Returns a [RegExMatch] container of the first matching result if found, otherwise null. The region to search within can be specified without modifying where the start and end anchor would be. + </description> + </method> + <method name="search_all" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="subject" type="String"> + </argument> + <argument index="1" name="offset" type="int" default="0"> + </argument> + <argument index="2" name="end" type="int" default="-1"> + </argument> + <description> + Searches the text for the compiled pattern. Returns an array of [RegExMatch] containers for each non-overlapping result. If no results were found an empty array is returned instead. The region to search within can be specified without modifying where the start and end anchor would be. + </description> + </method> + <method name="sub" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="subject" type="String"> + </argument> + <argument index="1" name="replacement" type="String"> + </argument> + <argument index="2" name="all" type="bool" default="false"> + </argument> + <argument index="3" name="offset" type="int" default="0"> + </argument> + <argument index="4" name="end" type="int" default="-1"> + </argument> + <description> + Searches the text for the compiled pattern and replaces it with the specified string. Escapes and backreferences such as [code]\1[/code] and [code]\g<name>[/code] expanded and resolved. By default only the first instance is replaced but it can be changed for all instances (global replacement). The region to search within can be specified without modifying where the start and end anchor would be. + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/modules/regex/doc_classes/RegExMatch.xml b/modules/regex/doc_classes/RegExMatch.xml new file mode 100644 index 0000000000..8c6951fea2 --- /dev/null +++ b/modules/regex/doc_classes/RegExMatch.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="RegExMatch" inherits="Reference" category="Core" version="3.0-alpha"> + <brief_description> + Contains the results of a regex search. + </brief_description> + <description> + Contains the results of a single regex match returned by [method RegEx.search] and [method RegEx.search_all]. It can be used to find the position and range of the match and its capturing groups, and it can extract its sub-string for you. + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_end" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="Variant" default="0"> + </argument> + <description> + Returns the end position of the match within the source string. The end position of capturing groups can be retrieved by providing its group number as an integer or its string name (if it's a named group). The default value of 0 refers to the whole pattern. + Returns -1 if the group did not match or doesn't exist. + </description> + </method> + <method name="get_group_count" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns the number of capturing groups. + </description> + </method> + <method name="get_names" qualifiers="const"> + <return type="Dictionary"> + </return> + <description> + Returns a dictionary of named groups and its corresponding group number. Only groups with that were matched are included. If multiple groups have the same name, that name would refer to the first matching one. + </description> + </method> + <method name="get_start" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="name" type="Variant" default="0"> + </argument> + <description> + Returns the starting position of the match within the source string. The starting position of capturing groups can be retrieved by providing its group number as an integer or its string name (if it's a named group). The default value of 0 refers to the whole pattern. + Returns -1 if the group did not match or doesn't exist. + </description> + </method> + <method name="get_string" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="name" type="Variant" default="0"> + </argument> + <description> + Returns the substring of the match from the source string. Capturing groups can be retrieved by providing its group number as an integer or its string name (if it's a named group). The default value of 0 refers to the whole pattern. + Returns an empty string if the group did not match or doesn't exist. + </description> + </method> + <method name="get_strings" qualifiers="const"> + <return type="Array"> + </return> + <description> + Returns an [Array] of the match and its capturing groups. + </description> + </method> + <method name="get_subject" qualifiers="const"> + <return type="String"> + </return> + <description> + Returns the source string used with the search pattern to find this matching result. + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index 00e8ce0f54..daadfcc659 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -324,6 +324,21 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end) return result; } +Array RegEx::search_all(const String &p_subject, int p_offset, int p_end) const { + + int last_end = -1; + Array result; + Ref<RegExMatch> match = search(p_subject, p_offset, p_end); + while (match.is_valid()) { + if (last_end == match->get_end(0)) + break; + result.push_back(match); + last_end = match->get_end(0); + match = search(p_subject, match->get_end(0), p_end); + } + return result; +} + String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_all, int p_offset, int p_end) const { ERR_FAIL_COND_V(!is_valid(), String()); @@ -489,6 +504,7 @@ void RegEx::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &RegEx::clear); ClassDB::bind_method(D_METHOD("compile", "pattern"), &RegEx::compile); ClassDB::bind_method(D_METHOD("search", "subject", "offset", "end"), &RegEx::search, DEFVAL(0), DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("search_all", "subject", "offset", "end"), &RegEx::search_all, DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("sub", "subject", "replacement", "all", "offset", "end"), &RegEx::sub, DEFVAL(false), DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("is_valid"), &RegEx::is_valid); ClassDB::bind_method(D_METHOD("get_pattern"), &RegEx::get_pattern); diff --git a/modules/regex/regex.h b/modules/regex/regex.h index bfa9c84042..21387222f2 100644 --- a/modules/regex/regex.h +++ b/modules/regex/regex.h @@ -88,6 +88,7 @@ public: void _init(const String &p_pattern = ""); Ref<RegExMatch> search(const String &p_subject, int p_offset = 0, int p_end = -1) const; + Array search_all(const String &p_subject, int p_offset = 0, int p_end = -1) const; String sub(const String &p_subject, const String &p_replacement, bool p_all = false, int p_offset = 0, int p_end = -1) const; bool is_valid() const; diff --git a/modules/squish/config.py b/modules/squish/config.py index 9b7729bda4..97c95999c8 100644 --- a/modules/squish/config.py +++ b/modules/squish/config.py @@ -1,8 +1,6 @@ - def can_build(platform): return True - def configure(env): # Tools only, disabled for non-tools # TODO: Find a cleaner way to achieve that diff --git a/modules/stb_vorbis/config.py b/modules/stb_vorbis/config.py index fb920482f5..defe8d0c94 100644 --- a/modules/stb_vorbis/config.py +++ b/modules/stb_vorbis/config.py @@ -1,7 +1,14 @@ - def can_build(platform): return True - def configure(env): pass + +def get_doc_classes(): + return [ + "AudioStreamOGGVorbis", + "ResourceImporterOGGVorbis", + ] + +def get_doc_path(): + return "doc_classes" diff --git a/doc/classes/AudioStreamOGGVorbis.xml b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml index 679438b66b..ee6c28c36a 100644 --- a/doc/classes/AudioStreamOGGVorbis.xml +++ b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="AudioStreamOGGVorbis" inherits="AudioStream" category="Core" version="3.0.alpha.custom_build"> +<class name="AudioStreamOGGVorbis" inherits="AudioStream" category="Core" version="3.0-alpha"> <brief_description> OGG Vorbis audio stream driver. </brief_description> diff --git a/doc/classes/ResourceImporterOGGVorbis.xml b/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml index eef626cee7..ce16632d6e 100644 --- a/doc/classes/ResourceImporterOGGVorbis.xml +++ b/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceImporterOGGVorbis" inherits="ResourceImporter" category="Core" version="3.0.alpha.custom_build"> +<class name="ResourceImporterOGGVorbis" inherits="ResourceImporter" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/modules/svg/config.py b/modules/svg/config.py index fb920482f5..5f133eba90 100644 --- a/modules/svg/config.py +++ b/modules/svg/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/tga/config.py b/modules/tga/config.py index fb920482f5..5f133eba90 100644 --- a/modules/tga/config.py +++ b/modules/tga/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/theora/config.py b/modules/theora/config.py index fb920482f5..34d34f8be2 100644 --- a/modules/theora/config.py +++ b/modules/theora/config.py @@ -1,7 +1,14 @@ - def can_build(platform): return True - def configure(env): pass + +def get_doc_classes(): + return [ + "ResourceImporterTheora", + "VideoStreamTheora", + ] + +def get_doc_path(): + return "doc_classes" diff --git a/modules/theora/doc_classes/ResourceImporterTheora.xml b/modules/theora/doc_classes/ResourceImporterTheora.xml new file mode 100644 index 0000000000..497c938826 --- /dev/null +++ b/modules/theora/doc_classes/ResourceImporterTheora.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceImporterTheora" inherits="ResourceImporter" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/theora/doc_classes/VideoStreamTheora.xml b/modules/theora/doc_classes/VideoStreamTheora.xml new file mode 100644 index 0000000000..8f155b786f --- /dev/null +++ b/modules/theora/doc_classes/VideoStreamTheora.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VideoStreamTheora" inherits="VideoStream" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_file"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_file"> + <return type="void"> + </return> + <argument index="0" name="file" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="file" type="String" setter="set_file" getter="get_file"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/tinyexr/config.py b/modules/tinyexr/config.py index 3e16fd725e..e12bb398ce 100644 --- a/modules/tinyexr/config.py +++ b/modules/tinyexr/config.py @@ -1,8 +1,6 @@ - def can_build(platform): return True - def configure(env): # Tools only, disabled for non-tools # TODO: Find a cleaner way to achieve that diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py index 5698a37295..6b1ce41014 100644 --- a/modules/visual_script/config.py +++ b/modules/visual_script/config.py @@ -1,8 +1,57 @@ - - def can_build(platform): return True - def configure(env): pass + +def get_doc_classes(): + return [ + "VisualScriptBasicTypeConstant", + "VisualScriptBuiltinFunc", + "VisualScriptClassConstant", + "VisualScriptComment", + "VisualScriptCondition", + "VisualScriptConstant", + "VisualScriptConstructor", + "VisualScriptCustomNode", + "VisualScriptDeconstruct", + "VisualScriptEditor", + "VisualScriptEmitSignal", + "VisualScriptEngineSingleton", + "VisualScriptExpression", + "VisualScriptFunctionCall", + "VisualScriptFunctionState", + "VisualScriptFunction", + "VisualScriptGlobalConstant", + "VisualScriptIndexGet", + "VisualScriptIndexSet", + "VisualScriptInputAction", + "VisualScriptIterator", + "VisualScriptLocalVarSet", + "VisualScriptLocalVar", + "VisualScriptMathConstant", + "VisualScriptNode", + "VisualScriptOperator", + "VisualScriptPreload", + "VisualScriptPropertyGet", + "VisualScriptPropertySet", + "VisualScriptResourcePath", + "VisualScriptReturn", + "VisualScriptSceneNode", + "VisualScriptSceneTree", + "VisualScriptSelect", + "VisualScriptSelf", + "VisualScriptSequence", + "VisualScriptSubCall", + "VisualScriptSwitch", + "VisualScriptTypeCast", + "VisualScriptVariableGet", + "VisualScriptVariableSet", + "VisualScriptWhile", + "VisualScript", + "VisualScriptYieldSignal", + "VisualScriptYield", + ] + +def get_doc_path(): + return "doc_classes" diff --git a/doc/classes/VisualScript.xml b/modules/visual_script/doc_classes/VisualScript.xml index 8961ff1564..80b1ed86d7 100644 --- a/doc/classes/VisualScript.xml +++ b/modules/visual_script/doc_classes/VisualScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScript" inherits="Script" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScript" inherits="Script" category="Core" version="3.0-alpha"> <brief_description> A script implemented in the Visual Script programming environment. </brief_description> diff --git a/doc/classes/VisualScriptBasicTypeConstant.xml b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml index cc09815481..6c028e5f28 100644 --- a/doc/classes/VisualScriptBasicTypeConstant.xml +++ b/modules/visual_script/doc_classes/VisualScriptBasicTypeConstant.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptBasicTypeConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> A Visual Script node representing a constant from the base types. </brief_description> diff --git a/doc/classes/VisualScriptBuiltinFunc.xml b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml index c896ff6410..27231574d7 100644 --- a/doc/classes/VisualScriptBuiltinFunc.xml +++ b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptBuiltinFunc" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> A Visual Script node used to call built-in functions. </brief_description> diff --git a/doc/classes/VisualScriptClassConstant.xml b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml index 0377fa8f09..e6498e92ad 100644 --- a/doc/classes/VisualScriptClassConstant.xml +++ b/modules/visual_script/doc_classes/VisualScriptClassConstant.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptClassConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Gets a constant from a given class. </brief_description> diff --git a/doc/classes/VisualScriptComment.xml b/modules/visual_script/doc_classes/VisualScriptComment.xml index 69126052d0..ea4545f8ef 100644 --- a/doc/classes/VisualScriptComment.xml +++ b/modules/visual_script/doc_classes/VisualScriptComment.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptComment" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> A Visual Script node used to annotate the script. </brief_description> diff --git a/doc/classes/VisualScriptCondition.xml b/modules/visual_script/doc_classes/VisualScriptCondition.xml index a776c9bc9b..2a30c604a5 100644 --- a/doc/classes/VisualScriptCondition.xml +++ b/modules/visual_script/doc_classes/VisualScriptCondition.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptCondition" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptCondition" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> A Visual Script node which branches the flow. </brief_description> diff --git a/doc/classes/VisualScriptConstant.xml b/modules/visual_script/doc_classes/VisualScriptConstant.xml index 2a704adecf..51c6d19238 100644 --- a/doc/classes/VisualScriptConstant.xml +++ b/modules/visual_script/doc_classes/VisualScriptConstant.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Gets a contant's value. </brief_description> diff --git a/doc/classes/VisualScriptConstructor.xml b/modules/visual_script/doc_classes/VisualScriptConstructor.xml index 3b1fc5e385..91df52e893 100644 --- a/doc/classes/VisualScriptConstructor.xml +++ b/modules/visual_script/doc_classes/VisualScriptConstructor.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptConstructor" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptConstructor" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> A Visual Script node which calls a base type constructor. </brief_description> diff --git a/doc/classes/VisualScriptCustomNode.xml b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml index e321c8854a..38c325cfb7 100644 --- a/doc/classes/VisualScriptCustomNode.xml +++ b/modules/visual_script/doc_classes/VisualScriptCustomNode.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptCustomNode" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptCustomNode" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> A scripted Visual Script node. </brief_description> diff --git a/doc/classes/VisualScriptDeconstruct.xml b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml index cd7d79ae56..cbed3ba22c 100644 --- a/doc/classes/VisualScriptDeconstruct.xml +++ b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptDeconstruct" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> A Visual Script node which deconstructs a base type instance into its parts. </brief_description> diff --git a/modules/visual_script/doc_classes/VisualScriptEditor.xml b/modules/visual_script/doc_classes/VisualScriptEditor.xml new file mode 100644 index 0000000000..70d52b2bd7 --- /dev/null +++ b/modules/visual_script/doc_classes/VisualScriptEditor.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualScriptEditor" inherits="Object" category="Core" version="3.0.alpha.custom_build"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="add_custom_node"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="category" type="String"> + </argument> + <argument index="2" name="script" type="Script"> + </argument> + <description> + Add a custom Visual Script node to the editor. It'll be placed under "Custom Nodes" with the [code]category[/code] as the parameter. + </description> + </method> + <method name="remove_custom_node"> + <return type="void"> + </return> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="category" type="String"> + </argument> + <description> + Remove a custom Visual Script node from the editor. Custom nodes already placed on scripts won't be removed. + </description> + </method> + </methods> + <signals> + <signal name="custom_nodes_updated"> + <description> + Emitted when a custom Visual Script node is added or removed. + </description> + </signal> + </signals> + <constants> + </constants> +</class> diff --git a/doc/classes/VisualScriptEmitSignal.xml b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml index 8d132ed321..669276f0d0 100644 --- a/doc/classes/VisualScriptEmitSignal.xml +++ b/modules/visual_script/doc_classes/VisualScriptEmitSignal.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptEmitSignal" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Emits a specified signal. </brief_description> diff --git a/doc/classes/VisualScriptEngineSingleton.xml b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml index 6606f10f11..6703ff4eda 100644 --- a/doc/classes/VisualScriptEngineSingleton.xml +++ b/modules/visual_script/doc_classes/VisualScriptEngineSingleton.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptEngineSingleton" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> A Visual Script node returning a singleton from [@GlobalScope] </brief_description> diff --git a/doc/classes/VisualScriptExpression.xml b/modules/visual_script/doc_classes/VisualScriptExpression.xml index 1ca943a8a8..fb3b6ef19d 100644 --- a/doc/classes/VisualScriptExpression.xml +++ b/modules/visual_script/doc_classes/VisualScriptExpression.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptExpression" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptExpression" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptFunction.xml b/modules/visual_script/doc_classes/VisualScriptFunction.xml index 946231eaad..d77169679b 100644 --- a/doc/classes/VisualScriptFunction.xml +++ b/modules/visual_script/doc_classes/VisualScriptFunction.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptFunction" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptFunction" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptFunctionCall.xml b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml index 36c808afce..7a0a7c9f55 100644 --- a/doc/classes/VisualScriptFunctionCall.xml +++ b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptFunctionCall" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptFunctionState.xml b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml index d5c06682ef..9b30f62236 100644 --- a/doc/classes/VisualScriptFunctionState.xml +++ b/modules/visual_script/doc_classes/VisualScriptFunctionState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptFunctionState" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptFunctionState" inherits="Reference" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptGlobalConstant.xml b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml index 52bf8c2821..961244fe88 100644 --- a/doc/classes/VisualScriptGlobalConstant.xml +++ b/modules/visual_script/doc_classes/VisualScriptGlobalConstant.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptGlobalConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptIndexGet.xml b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml index c0226b6677..c5229f7678 100644 --- a/doc/classes/VisualScriptIndexGet.xml +++ b/modules/visual_script/doc_classes/VisualScriptIndexGet.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptIndexGet" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptIndexGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptIndexSet.xml b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml index 440b4801b4..27646b4a5f 100644 --- a/doc/classes/VisualScriptIndexSet.xml +++ b/modules/visual_script/doc_classes/VisualScriptIndexSet.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptIndexSet" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptIndexSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptInputAction.xml b/modules/visual_script/doc_classes/VisualScriptInputAction.xml index b555a0228b..7f6d13264e 100644 --- a/doc/classes/VisualScriptInputAction.xml +++ b/modules/visual_script/doc_classes/VisualScriptInputAction.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptInputAction" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptInputAction" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptIterator.xml b/modules/visual_script/doc_classes/VisualScriptIterator.xml index 1f9a4fddde..fc905d6c39 100644 --- a/doc/classes/VisualScriptIterator.xml +++ b/modules/visual_script/doc_classes/VisualScriptIterator.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptIterator" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptIterator" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Steps through items in a given input. </brief_description> diff --git a/doc/classes/VisualScriptLocalVar.xml b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml index 3101b3e34b..ff77dfac0d 100644 --- a/doc/classes/VisualScriptLocalVar.xml +++ b/modules/visual_script/doc_classes/VisualScriptLocalVar.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptLocalVar" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptLocalVar" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Gets a local variable's value. </brief_description> diff --git a/doc/classes/VisualScriptLocalVarSet.xml b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml index e039a7204e..07b01d4576 100644 --- a/doc/classes/VisualScriptLocalVarSet.xml +++ b/modules/visual_script/doc_classes/VisualScriptLocalVarSet.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptLocalVarSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Changes a local variable's value. </brief_description> diff --git a/doc/classes/VisualScriptMathConstant.xml b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml index c753c16218..817bcb5ce2 100644 --- a/doc/classes/VisualScriptMathConstant.xml +++ b/modules/visual_script/doc_classes/VisualScriptMathConstant.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptMathConstant" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptMathConstant" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Commonly used mathematical constants. </brief_description> diff --git a/doc/classes/VisualScriptNode.xml b/modules/visual_script/doc_classes/VisualScriptNode.xml index 74ec9bdc2e..f6f2867172 100644 --- a/doc/classes/VisualScriptNode.xml +++ b/modules/visual_script/doc_classes/VisualScriptNode.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptNode" inherits="Resource" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptNode" inherits="Resource" category="Core" version="3.0-alpha"> <brief_description> A node which is part of a [VisualScript]. </brief_description> diff --git a/doc/classes/VisualScriptOperator.xml b/modules/visual_script/doc_classes/VisualScriptOperator.xml index de08075af2..bf4032c09c 100644 --- a/doc/classes/VisualScriptOperator.xml +++ b/modules/visual_script/doc_classes/VisualScriptOperator.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptOperator" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptOperator" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptPreload.xml b/modules/visual_script/doc_classes/VisualScriptPreload.xml index b683439751..4a71e23809 100644 --- a/doc/classes/VisualScriptPreload.xml +++ b/modules/visual_script/doc_classes/VisualScriptPreload.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptPreload" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptPreload" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Creates a new [Resource] or loads one from the filesystem. </brief_description> diff --git a/doc/classes/VisualScriptPropertyGet.xml b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml index c790a59b0c..eb5c52f4be 100644 --- a/doc/classes/VisualScriptPropertyGet.xml +++ b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptPropertyGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptPropertySet.xml b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml index 88d47a7463..794caa2518 100644 --- a/doc/classes/VisualScriptPropertySet.xml +++ b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptPropertySet" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptPropertySet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptResourcePath.xml b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml index e4b881b659..274a852c3e 100644 --- a/doc/classes/VisualScriptResourcePath.xml +++ b/modules/visual_script/doc_classes/VisualScriptResourcePath.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptResourcePath" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptResourcePath" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptReturn.xml b/modules/visual_script/doc_classes/VisualScriptReturn.xml index ad18e96230..4ac586a02c 100644 --- a/doc/classes/VisualScriptReturn.xml +++ b/modules/visual_script/doc_classes/VisualScriptReturn.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptReturn" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptReturn" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Exits a function and returns an optional value. </brief_description> diff --git a/doc/classes/VisualScriptSceneNode.xml b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml index b71bd9adfb..e8fdb69c6a 100644 --- a/doc/classes/VisualScriptSceneNode.xml +++ b/modules/visual_script/doc_classes/VisualScriptSceneNode.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptSceneNode" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Node reference. </brief_description> diff --git a/doc/classes/VisualScriptSceneTree.xml b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml index 55e27460ab..e74c330623 100644 --- a/doc/classes/VisualScriptSceneTree.xml +++ b/modules/visual_script/doc_classes/VisualScriptSceneTree.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptSceneTree" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptSceneTree" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptSelect.xml b/modules/visual_script/doc_classes/VisualScriptSelect.xml index f265c57645..6a62e364f3 100644 --- a/doc/classes/VisualScriptSelect.xml +++ b/modules/visual_script/doc_classes/VisualScriptSelect.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptSelect" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptSelect" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Chooses between two input values. </brief_description> diff --git a/doc/classes/VisualScriptSelf.xml b/modules/visual_script/doc_classes/VisualScriptSelf.xml index 723b138722..f39a02bf84 100644 --- a/doc/classes/VisualScriptSelf.xml +++ b/modules/visual_script/doc_classes/VisualScriptSelf.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptSelf" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptSelf" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Outputs a reference to the current instance. </brief_description> diff --git a/doc/classes/VisualScriptSequence.xml b/modules/visual_script/doc_classes/VisualScriptSequence.xml index 845da4e50b..51238070d5 100644 --- a/doc/classes/VisualScriptSequence.xml +++ b/modules/visual_script/doc_classes/VisualScriptSequence.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptSequence" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptSequence" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Executes a series of Sequence ports. </brief_description> diff --git a/doc/classes/VisualScriptSubCall.xml b/modules/visual_script/doc_classes/VisualScriptSubCall.xml index 297ec96781..381095f49b 100644 --- a/doc/classes/VisualScriptSubCall.xml +++ b/modules/visual_script/doc_classes/VisualScriptSubCall.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptSubCall" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptSubCall" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptSwitch.xml b/modules/visual_script/doc_classes/VisualScriptSwitch.xml index 2540ae54cc..3c8a79f686 100644 --- a/doc/classes/VisualScriptSwitch.xml +++ b/modules/visual_script/doc_classes/VisualScriptSwitch.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptSwitch" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptSwitch" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Branches program flow based on a given input's value. </brief_description> diff --git a/doc/classes/VisualScriptTypeCast.xml b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml index 3008426900..417c0a5159 100644 --- a/doc/classes/VisualScriptTypeCast.xml +++ b/modules/visual_script/doc_classes/VisualScriptTypeCast.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptTypeCast" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptTypeCast" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptVariableGet.xml b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml index 5b45dd0cc4..1cad4480a6 100644 --- a/doc/classes/VisualScriptVariableGet.xml +++ b/modules/visual_script/doc_classes/VisualScriptVariableGet.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptVariableGet" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptVariableGet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Gets a variable's value. </brief_description> diff --git a/doc/classes/VisualScriptVariableSet.xml b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml index 51f85f6881..fa3befa21d 100644 --- a/doc/classes/VisualScriptVariableSet.xml +++ b/modules/visual_script/doc_classes/VisualScriptVariableSet.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptVariableSet" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptVariableSet" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Changes a variable's value. </brief_description> diff --git a/doc/classes/VisualScriptWhile.xml b/modules/visual_script/doc_classes/VisualScriptWhile.xml index 60bf161339..f948660997 100644 --- a/doc/classes/VisualScriptWhile.xml +++ b/modules/visual_script/doc_classes/VisualScriptWhile.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptWhile" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptWhile" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> Conditional loop. </brief_description> diff --git a/doc/classes/VisualScriptYield.xml b/modules/visual_script/doc_classes/VisualScriptYield.xml index a0d95f151a..5474ee8b78 100644 --- a/doc/classes/VisualScriptYield.xml +++ b/modules/visual_script/doc_classes/VisualScriptYield.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptYield" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptYield" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/doc/classes/VisualScriptYieldSignal.xml b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml index f4202edf2b..a3b6982075 100644 --- a/doc/classes/VisualScriptYieldSignal.xml +++ b/modules/visual_script/doc_classes/VisualScriptYieldSignal.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" category="Core" version="3.0.alpha.custom_build"> +<class name="VisualScriptYieldSignal" inherits="VisualScriptNode" category="Core" version="3.0-alpha"> <brief_description> </brief_description> <description> diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp index c50ba17c35..b6ce10381d 100644 --- a/modules/visual_script/register_types.cpp +++ b/modules/visual_script/register_types.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "register_types.h" +#include "core/engine.h" #include "io/resource_loader.h" #include "visual_script.h" #include "visual_script_builtin_funcs.h" @@ -40,6 +41,9 @@ #include "visual_script_yield_nodes.h" VisualScriptLanguage *visual_script_language = NULL; +#ifdef TOOLS_ENABLED +static _VisualScriptEditor *vs_editor_singleton = NULL; +#endif void register_visual_script_types() { @@ -107,6 +111,10 @@ void register_visual_script_types() { register_visual_script_expression_node(); #ifdef TOOLS_ENABLED + ClassDB::register_class<_VisualScriptEditor>(); + vs_editor_singleton = memnew(_VisualScriptEditor); + Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", _VisualScriptEditor::get_singleton())); + VisualScriptEditor::register_editor(); #endif } @@ -119,6 +127,9 @@ void unregister_visual_script_types() { #ifdef TOOLS_ENABLED VisualScriptEditor::free_clipboard(); + if (vs_editor_singleton) { + memdelete(vs_editor_singleton); + } #endif if (visual_script_language) memdelete(visual_script_language); diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 765fe4c2f2..0834bc81d9 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -2644,6 +2644,11 @@ void VisualScriptLanguage::add_register_func(const String &p_name, VisualScriptN register_funcs[p_name] = p_func; } +void VisualScriptLanguage::remove_register_func(const String &p_name) { + ERR_FAIL_COND(!register_funcs.has(p_name)); + register_funcs.erase(p_name); +} + Ref<VisualScriptNode> VisualScriptLanguage::create_node_from_name(const String &p_name) { ERR_FAIL_COND_V(!register_funcs.has(p_name), Ref<VisualScriptNode>()); diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index 0f60b103c9..3e31876941 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -600,6 +600,7 @@ public: virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max); void add_register_func(const String &p_name, VisualScriptNodeRegisterFunc p_func); + void remove_register_func(const String &p_name); Ref<VisualScriptNode> create_node_from_name(const String &p_name); void get_registered_node_names(List<String> *r_names); diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 7c9d306831..8f7fe58bee 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -1109,7 +1109,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in String str = *p_inputs[0]; //str+="\n"; - OS::get_singleton()->printerr("%s\n", str.utf8().get_data()); + print_error(str); } break; case VisualScriptBuiltinFunc::TEXT_PRINTRAW: { diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 15e20effc0..83b8d8da2d 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "visual_script_editor.h" +#include "core/script_language.h" #include "editor/editor_node.h" #include "editor/editor_resource_preview.h" #include "os/input.h" @@ -348,7 +349,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::TRANSFORM2D: color = Color::html("#c4ec69"); break; case Variant::PLANE: color = Color::html("#f77070"); break; case Variant::QUAT: color = Color::html("#ec69a3"); break; - case Variant::RECT3: color = Color::html("#ee7991"); break; + case Variant::AABB: color = Color::html("#ee7991"); break; case Variant::BASIS: color = Color::html("#e3ec69"); break; case Variant::TRANSFORM: color = Color::html("#f6a86e"); break; @@ -385,7 +386,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::TRANSFORM2D: color = Color::html("#96ce1a"); break; case Variant::PLANE: color = Color::html("#f77070"); break; case Variant::QUAT: color = Color::html("#ec69a3"); break; - case Variant::RECT3: color = Color::html("#ee7991"); break; + case Variant::AABB: color = Color::html("#ee7991"); break; case Variant::BASIS: color = Color::html("#b2bb19"); break; case Variant::TRANSFORM: color = Color::html("#f49047"); break; @@ -3258,6 +3259,8 @@ void VisualScriptEditor::_bind_methods() { ClassDB::bind_method("_member_rmb_selected", &VisualScriptEditor::_member_rmb_selected); ClassDB::bind_method("_member_option", &VisualScriptEditor::_member_option); + + ClassDB::bind_method("_update_available_nodes", &VisualScriptEditor::_update_available_nodes); } VisualScriptEditor::VisualScriptEditor() { @@ -3442,6 +3445,8 @@ VisualScriptEditor::VisualScriptEditor() { members->connect("item_rmb_selected", this, "_member_rmb_selected"); members->set_allow_rmb_select(true); member_popup->connect("id_pressed", this, "_member_option"); + + _VisualScriptEditor::get_singleton()->connect("custom_nodes_updated", this, "_update_available_nodes"); } VisualScriptEditor::~VisualScriptEditor() { @@ -3485,4 +3490,42 @@ void VisualScriptEditor::register_editor() { EditorNode::add_plugin_init_callback(register_editor_callback); } +Ref<VisualScriptNode> _VisualScriptEditor::create_node_custom(const String &p_name) { + + Ref<VisualScriptCustomNode> node; + node.instance(); + node->set_script(singleton->custom_nodes[p_name]); + return node; +} + +_VisualScriptEditor *_VisualScriptEditor::singleton = NULL; +Map<String, RefPtr> _VisualScriptEditor::custom_nodes; + +_VisualScriptEditor::_VisualScriptEditor() { + singleton = this; +} + +_VisualScriptEditor::~_VisualScriptEditor() { + custom_nodes.clear(); +} + +void _VisualScriptEditor::add_custom_node(const String &p_name, const String &p_category, const Ref<Script> &p_script) { + String node_name = "custom/" + p_category + "/" + p_name; + custom_nodes.insert(node_name, p_script.get_ref_ptr()); + VisualScriptLanguage::singleton->add_register_func(node_name, &_VisualScriptEditor::create_node_custom); + emit_signal("custom_nodes_updated"); +} + +void _VisualScriptEditor::remove_custom_node(const String &p_name, const String &p_category) { + String node_name = "custom/" + p_category + "/" + p_name; + custom_nodes.erase(node_name); + VisualScriptLanguage::singleton->remove_register_func(node_name); + emit_signal("custom_nodes_updated"); +} + +void _VisualScriptEditor::_bind_methods() { + ClassDB::bind_method(D_METHOD("add_custom_node", "name", "category", "script"), &_VisualScriptEditor::add_custom_node); + ClassDB::bind_method(D_METHOD("remove_custom_node", "name", "category"), &_VisualScriptEditor::remove_custom_node); + ADD_SIGNAL(MethodInfo("custom_nodes_updated")); +} #endif diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index db54d10300..3d037e82ea 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -278,6 +278,29 @@ public: VisualScriptEditor(); ~VisualScriptEditor(); }; + +// Singleton +class _VisualScriptEditor : public Object { + GDCLASS(_VisualScriptEditor, Object); + + friend class VisualScriptLanguage; + +protected: + static void _bind_methods(); + static _VisualScriptEditor *singleton; + + static Map<String, RefPtr> custom_nodes; + static Ref<VisualScriptNode> create_node_custom(const String &p_name); + +public: + static _VisualScriptEditor *get_singleton() { return singleton; } + + void add_custom_node(const String &p_name, const String &p_category, const Ref<Script> &p_script); + void remove_custom_node(const String &p_name, const String &p_category); + + _VisualScriptEditor(); + ~_VisualScriptEditor(); +}; #endif #endif // VISUALSCRIPT_EDITOR_H diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index a5dc6ffc13..cbe4438cdf 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -29,9 +29,9 @@ /*************************************************************************/ #include "visual_script_func_nodes.h" +#include "engine.h" #include "io/resource_loader.h" #include "os/os.h" -#include "project_settings.h" #include "scene/main/node.h" #include "scene/main/scene_tree.h" #include "visual_script_nodes.h" @@ -344,7 +344,7 @@ void VisualScriptFunctionCall::set_singleton(const StringName &p_type) { return; singleton = p_type; - Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); + Object *obj = Engine::get_singleton()->get_singleton_object(singleton); if (obj) { base_type = obj->get_class(); } @@ -380,7 +380,7 @@ void VisualScriptFunctionCall::_update_method_cache() { } else if (call_mode == CALL_MODE_SINGLETON) { - Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); + Object *obj = Engine::get_singleton()->get_singleton_object(singleton); if (obj) { type = obj->get_class(); script = obj->get_script(); @@ -565,11 +565,11 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const if (call_mode != CALL_MODE_SINGLETON) { property.usage = 0; } else { - List<ProjectSettings::Singleton> names; - ProjectSettings::get_singleton()->get_singletons(&names); + List<Engine::Singleton> names; + Engine::get_singleton()->get_singletons(&names); property.hint = PROPERTY_HINT_ENUM; String sl; - for (List<ProjectSettings::Singleton>::Element *E = names.front(); E; E = E->next()) { + for (List<Engine::Singleton>::Element *E = names.front(); E; E = E->next()) { if (sl != String()) sl += ","; sl += E->get().name; @@ -603,7 +603,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const property.hint_string = itos(get_visual_script()->get_instance_id()); } else if (call_mode == CALL_MODE_SINGLETON) { - Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); + Object *obj = Engine::get_singleton()->get_singleton_object(singleton); if (obj) { property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; property.hint_string = itos(obj->get_instance_id()); @@ -879,7 +879,7 @@ public: } break; case VisualScriptFunctionCall::CALL_MODE_SINGLETON: { - Object *object = ProjectSettings::get_singleton()->get_singleton_object(singleton); + Object *object = Engine::get_singleton()->get_singleton_object(singleton); if (!object) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; r_error_str = "Invalid singleton name: '" + String(singleton) + "'"; diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 3863fa7e1c..05ff629d1b 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "visual_script_nodes.h" +#include "engine.h" #include "global_constants.h" #include "os/input.h" #include "os/os.h" @@ -1976,13 +1977,13 @@ public: VisualScriptNodeInstance *VisualScriptEngineSingleton::instance(VisualScriptInstance *p_instance) { VisualScriptNodeInstanceEngineSingleton *instance = memnew(VisualScriptNodeInstanceEngineSingleton); - instance->singleton = ProjectSettings::get_singleton()->get_singleton_object(singleton); + instance->singleton = Engine::get_singleton()->get_singleton_object(singleton); return instance; } VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output_type(TypeGuess *p_inputs, int p_output) const { - Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); + Object *obj = Engine::get_singleton()->get_singleton_object(singleton); TypeGuess tg; tg.type = Variant::OBJECT; if (obj) { @@ -2000,11 +2001,11 @@ void VisualScriptEngineSingleton::_bind_methods() { String cc; - List<ProjectSettings::Singleton> singletons; + List<Engine::Singleton> singletons; - ProjectSettings::get_singleton()->get_singletons(&singletons); + Engine::get_singleton()->get_singletons(&singletons); - for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) { + for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) { if (E->get().name == "VS" || E->get().name == "PS" || E->get().name == "PS2D" || E->get().name == "AS" || E->get().name == "TS" || E->get().name == "SS" || E->get().name == "SS2D") continue; //skip these, too simple named diff --git a/modules/vorbis/config.py b/modules/vorbis/config.py index fb920482f5..5f133eba90 100644 --- a/modules/vorbis/config.py +++ b/modules/vorbis/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/modules/webm/config.py b/modules/webm/config.py index fb920482f5..0374bb36f7 100644 --- a/modules/webm/config.py +++ b/modules/webm/config.py @@ -1,7 +1,14 @@ - def can_build(platform): return True - def configure(env): pass + +def get_doc_classes(): + return [ + "ResourceImporterWebm", + "VideoStreamWebm", + ] + +def get_doc_path(): + return "doc_classes" diff --git a/modules/webm/doc_classes/ResourceImporterWebm.xml b/modules/webm/doc_classes/ResourceImporterWebm.xml new file mode 100644 index 0000000000..dcba351e37 --- /dev/null +++ b/modules/webm/doc_classes/ResourceImporterWebm.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ResourceImporterWebm" inherits="ResourceImporter" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/webm/doc_classes/VideoStreamWebm.xml b/modules/webm/doc_classes/VideoStreamWebm.xml new file mode 100644 index 0000000000..9a430f6b0d --- /dev/null +++ b/modules/webm/doc_classes/VideoStreamWebm.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VideoStreamWebm" inherits="VideoStream" category="Core" version="3.0-alpha"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_file"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_file"> + <return type="void"> + </return> + <argument index="0" name="file" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="file" type="String" setter="set_file" getter="get_file"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/webp/config.py b/modules/webp/config.py index fb920482f5..5f133eba90 100644 --- a/modules/webp/config.py +++ b/modules/webp/config.py @@ -1,7 +1,5 @@ - def can_build(platform): return True - def configure(env): pass diff --git a/platform/SCsub b/platform/SCsub new file mode 100644 index 0000000000..4ef23ab053 --- /dev/null +++ b/platform/SCsub @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +from compat import open_utf8 + +Import('env') +platform_sources = [] + +# Register platform-exclusive APIs +reg_apis_inc = '#include "register_platform_apis.h"\n' +reg_apis = 'void register_platform_apis() {\n' +unreg_apis = 'void unregister_platform_apis() {\n' +for platform in env.platform_apis: + platform_dir = env.Dir(platform) + platform_sources.append(platform_dir.File('api/api.cpp')) + reg_apis += '\tregister_' + platform + '_api();\n' + unreg_apis += '\tunregister_' + platform + '_api();\n' + reg_apis_inc += '#include "' + platform + '/api/api.h"\n' +reg_apis_inc += '\n' +reg_apis += '}\n\n' +unreg_apis += '}\n' +f = open_utf8('register_platform_apis.gen.cpp', 'w') +f.write(reg_apis_inc) +f.write(reg_apis) +f.write(unreg_apis) +f.close() +platform_sources.append('register_platform_apis.gen.cpp') + +env.Prepend(LIBS=env.Library('platform', platform_sources)) + +Export('env') diff --git a/platform/android/detect.py b/platform/android/detect.py index a3ada5cf51..bc67f6e6dc 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -205,7 +205,7 @@ def configure(env): env.Append(CPPFLAGS=["-isystem", lib_sysroot + "/usr/include"]) env.Append(CPPFLAGS='-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing'.split()) - env.Append(CPPFLAGS='-DNO_STATVFS -DGLES2_ENABLED'.split()) + env.Append(CPPFLAGS='-DNO_STATVFS -DGLES_ENABLED'.split()) env['neon_enabled'] = False if env['android_arch'] == 'x86': diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 79be1501a7..9945dc599b 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -945,16 +945,17 @@ public: public: virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) { - int api = p_preset->get("graphics/api"); + // Reenable when a GLES 2.0 backend is readded + /*int api = p_preset->get("graphics/api"); if (api == 0) r_features->push_back("etc"); - else - r_features->push_back("etc2"); + else*/ + r_features->push_back("etc2"); } virtual void get_export_options(List<ExportOption> *r_options) { - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "graphics/api", PROPERTY_HINT_ENUM, "OpenGL ES 2.0,OpenGL ES 3.0"), 1)); + /*r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "graphics/api", PROPERTY_HINT_ENUM, "OpenGL ES 2.0,OpenGL ES 3.0"), 1));*/ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/32_bits_framebuffer"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "one_click_deploy/clear_previous_install"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "apk"), "")); diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp index c73b578154..0e1c17e9c8 100644 --- a/platform/android/globals/global_defaults.cpp +++ b/platform/android/globals/global_defaults.cpp @@ -31,12 +31,4 @@ #include "project_settings.h" void register_android_global_defaults() { - - /* GLOBAL_DEF("rasterizer.Android/use_fragment_lighting",false); - GLOBAL_DEF("rasterizer.Android/fp16_framebuffer",false); - GLOBAL_DEF("display.Android/driver","GLES2"); - //GLOBAL_DEF("rasterizer.Android/trilinear_mipmap_filter",false); - - ProjectSettings::get_singleton()->set_custom_property_info("display.Android/driver",PropertyInfo(Variant::STRING,"display.Android/driver",PROPERTY_HINT_ENUM,"GLES2")); - */ } diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index abe5e3b77a..f9bcbadc24 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -29,23 +29,23 @@ /*************************************************************************/ #ifdef ANDROID_NATIVE_ACTIVITY -#include <errno.h> -#include <jni.h> - -#include <EGL/egl.h> -#include <GLES2/gl2.h> - +#include "engine.h" #include "file_access_android.h" #include "main/main.h" #include "os_android.h" #include "project_settings.h" + +#include <EGL/egl.h> #include <android/log.h> #include <android/sensor.h> #include <android/window.h> #include <android_native_app_glue.h> +#include <errno.h> +#include <jni.h> #include <stdlib.h> #include <string.h> #include <unistd.h> + #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "godot", __VA_ARGS__)) #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "godot", __VA_ARGS__)) @@ -842,7 +842,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerSingleton(JNIEnv s->set_instance(env->NewGlobalRef(p_object)); jni_singletons[singname] = s; - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton(singname, s)); + Engine::get_singleton()->add_singleton(Engine::Singleton(singname, s)); } static Variant::Type get_jni_type(const String &p_type) { diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 87f20bee91..90144d9b4d 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -34,6 +34,7 @@ #include "audio_driver_jandroid.h" #include "core/os/keyboard.h" #include "dir_access_jandroid.h" +#include "engine.h" #include "file_access_android.h" #include "file_access_jandroid.h" #include "java_class_wrapper.h" @@ -953,7 +954,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo __android_log_print(ANDROID_LOG_INFO, "godot", "*****SETUP OK"); java_class_wrapper = memnew(JavaClassWrapper(_godot_instance)); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JavaClassWrapper", java_class_wrapper)); + Engine::get_singleton()->add_singleton(Engine::Singleton("JavaClassWrapper", java_class_wrapper)); _initialize_java_modules(); } @@ -1426,7 +1427,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv *env s->set_instance(env->NewGlobalRef(p_object)); jni_singletons[singname] = s; - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton(singname, s)); + Engine::get_singleton()->add_singleton(Engine::Singleton(singname, s)); ProjectSettings::get_singleton()->set(singname, s); } diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index a36df0675c..2578bd6d96 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -641,7 +641,7 @@ String OS_Android::get_data_dir() const { } return "."; - //return ProjectSettings::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); + //return Engine::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); } void OS_Android::set_screen_orientation(ScreenOrientation p_orientation) { diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py index 50f9783dd2..7c62654ef6 100644 --- a/platform/haiku/detect.py +++ b/platform/haiku/detect.py @@ -67,7 +67,7 @@ def configure(env): ## Flags env.Append(CPPPATH=['#platform/haiku']) - env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL']) + env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED', '-DGLES_OVER_GL']) env.Append(CPPFLAGS=['-DMEDIA_KIT_ENABLED']) # env.Append(CCFLAGS=['-DFREETYPE_ENABLED']) env.Append(CPPFLAGS=['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp index 0c34e39655..3af111faf3 100644 --- a/platform/haiku/os_haiku.cpp +++ b/platform/haiku/os_haiku.cpp @@ -76,7 +76,7 @@ int OS_Haiku::get_video_driver_count() const { } const char *OS_Haiku::get_video_driver_name(int p_driver) const { - return "GLES2"; + return "GLES3"; } void OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { @@ -106,7 +106,9 @@ void OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_ context_gl->initialize(); context_gl->make_current(); - rasterizer = memnew(RasterizerGLES2); + /* Port to GLES 3 rasterizer */ + //rasterizer = memnew(RasterizerGLES2); + #endif visual_server = memnew(VisualServerRaster(rasterizer)); diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index d426b478bf..4ea358f871 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -163,7 +163,7 @@ def configure(env): env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate' env.Append(CPPPATH=['#platform/iphone']) - env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT', '-DCOREAUDIO_ENABLED']) + env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DMPC_FIXED_POINT', '-DCOREAUDIO_ENABLED']) # TODO: Move that to opus module's config if 'module_opus_enabled' in env and env['module_opus_enabled']: diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp index 4bdc716d6e..b81e6def3b 100644 --- a/platform/iphone/globals/global_defaults.cpp +++ b/platform/iphone/globals/global_defaults.cpp @@ -31,11 +31,4 @@ #include "project_settings.h" void register_iphone_global_defaults() { - - /*GLOBAL_DEF("rasterizer.iOS/use_fragment_lighting",false); - GLOBAL_DEF("rasterizer.iOS/fp16_framebuffer",false); - GLOBAL_DEF("display.iOS/driver","GLES2"); - ProjectSettings::get_singleton()->set_custom_property_info("display.iOS/driver",PropertyInfo(Variant::STRING,"display.iOS/driver",PROPERTY_HINT_ENUM,"GLES1,GLES2")); - GLOBAL_DEF("display.iOS/use_cadisplaylink",true); - */ } diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm index 9efd4b9891..25f4e1e166 100644 --- a/platform/iphone/in_app_store.mm +++ b/platform/iphone/in_app_store.mm @@ -92,6 +92,7 @@ void InAppStore::_bind_methods() { PoolRealArray prices; PoolStringArray ids; PoolStringArray localized_prices; + PoolStringArray currency_codes; for (int i = 0; i < [products count]; i++) { @@ -105,12 +106,14 @@ void InAppStore::_bind_methods() { prices.push_back([product.price doubleValue]); ids.push_back(String::utf8([product.productIdentifier UTF8String])); localized_prices.push_back(String::utf8([product.localizedPrice UTF8String])); + currency_codes.push_back(String::utf8([[[product priceLocale] objectForKey:NSLocaleCurrencyCode] UTF8String])); }; ret["titles"] = titles; ret["descriptions"] = descriptions; ret["prices"] = prices; ret["ids"] = ids; ret["localized_prices"] = localized_prices; + ret["currency_codes"] = currency_codes; PoolStringArray invalid_ids; diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index 0685e961c3..62b7d93968 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -54,7 +54,7 @@ int OSIPhone::get_video_driver_count() const { const char *OSIPhone::get_video_driver_name(int p_driver) const { - return "GLES2"; + return "GLES3"; }; OSIPhone *OSIPhone::get_singleton() { @@ -138,28 +138,28 @@ void OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_ /* #ifdef IOS_SCORELOOP_ENABLED scoreloop = memnew(ScoreloopIOS); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Scoreloop", scoreloop)); + Engine::get_singleton()->add_singleton(Engine::Singleton("Scoreloop", scoreloop)); scoreloop->connect(); #endif */ #ifdef GAME_CENTER_ENABLED game_center = memnew(GameCenter); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("GameCenter", game_center)); + Engine::get_singleton()->add_singleton(Engine::Singleton("GameCenter", game_center)); game_center->connect(); #endif #ifdef STOREKIT_ENABLED store_kit = memnew(InAppStore); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("InAppStore", store_kit)); + Engine::get_singleton()->add_singleton(Engine::Singleton("InAppStore", store_kit)); #endif #ifdef ICLOUD_ENABLED icloud = memnew(ICloud); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ICloud", icloud)); + Engine::get_singleton()->add_singleton(Engine::Singleton("ICloud", icloud)); //icloud->connect(); #endif - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("iOS", memnew(iOS))); + Engine::get_singleton()->add_singleton(Engine::Singleton("iOS", memnew(iOS))); }; MainLoop *OSIPhone::get_main_loop() const { diff --git a/platform/iphone/platform_config.h b/platform/iphone/platform_config.h index 54de66082e..7ff6e7a9a9 100644 --- a/platform/iphone/platform_config.h +++ b/platform/iphone/platform_config.h @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include <alloca.h> -// #define GLES2_INCLUDE_H <ES2/gl.h> + #define GLES3_INCLUDE_H <ES3/gl.h> #define PLATFORM_REFCOUNT diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub index e3015d87b9..8d505a5829 100644 --- a/platform/javascript/SCsub +++ b/platform/javascript/SCsub @@ -21,37 +21,21 @@ for x in javascript_files: env.Append(LINKFLAGS=["-s", "EXPORTED_FUNCTIONS=\"['_main','_main_after_fs_sync','_send_notification']\""]) -# output file name without file extension -basename = "godot" + env["PROGSUFFIX"] target_dir = env.Dir("#bin") - -zip_dir = target_dir.Dir('.javascript_zip') -zip_files = env.InstallAs(zip_dir.File('godot.html'), '#misc/dist/html/default.html') - -implicit_targets = [] -if env['wasm']: - wasm = target_dir.File(basename + '.wasm') - implicit_targets.append(wasm) - zip_files.append(InstallAs(zip_dir.File('godot.wasm'), wasm)) - prejs = env.File('pre_wasm.js') -else: - asmjs_files = [target_dir.File(basename + '.asm.js'), target_dir.File(basename + '.js.mem')] - implicit_targets.extend(asmjs_files) - zip_files.append(InstallAs([zip_dir.File('godot.asm.js'), zip_dir.File('godot.mem')], asmjs_files)) - prejs = env.File('pre_asmjs.js') - -js = env.Program(['#bin/godot'] + implicit_targets, javascript_objects, PROGSUFFIX=env['PROGSUFFIX'] + '.js')[0]; -zip_files.append(InstallAs(zip_dir.File('godot.js'), js)) +build = env.Program(['#bin/godot', target_dir.File('godot' + env['PROGSUFFIX'] + '.wasm')], javascript_objects, PROGSUFFIX=env['PROGSUFFIX'] + '.js'); js_libraries = [] js_libraries.append(env.File('http_request.js')) for lib in js_libraries: env.Append(LINKFLAGS=['--js-library', lib.path]) -env.Depends(js, js_libraries) +env.Depends(build, js_libraries) +prejs = env.File('pre.js') postjs = env.File('engine.js') -env.Depends(js, [prejs, postjs]) env.Append(LINKFLAGS=['--pre-js', prejs.path]) env.Append(LINKFLAGS=['--post-js', postjs.path]) +env.Depends(build, [prejs, postjs]) +zip_dir = target_dir.Dir('.javascript_zip') +zip_files = env.InstallAs([zip_dir.File('godot.js'), zip_dir.File('godot.wasm'), zip_dir.File('godot.html')], build + ['#misc/dist/html/default.html']) Zip('#bin/godot', zip_files, ZIPSUFFIX=env['PROGSUFFIX'] + env['ZIPSUFFIX'], ZIPROOT=zip_dir, ZIPCOMSTR="Archving $SOURCES as $TARGET") diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp new file mode 100644 index 0000000000..f2b2ca40bf --- /dev/null +++ b/platform/javascript/api/api.cpp @@ -0,0 +1,73 @@ +/*************************************************************************/ +/* api.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "api.h" +#include "engine.h" +#include "javascript_eval.h" + +static JavaScript *javascript_eval; + +void register_javascript_api() { + + ClassDB::register_virtual_class<JavaScript>(); + javascript_eval = memnew(JavaScript); + Engine::get_singleton()->add_singleton(Engine::Singleton("JavaScript", javascript_eval)); +} + +void unregister_javascript_api() { + + memdelete(javascript_eval); +} + +JavaScript *JavaScript::singleton = NULL; + +JavaScript *JavaScript::get_singleton() { + + return singleton; +} + +JavaScript::JavaScript() { + + ERR_FAIL_COND(singleton != NULL); + singleton = this; +} + +JavaScript::~JavaScript() {} + +void JavaScript::_bind_methods() { + + ClassDB::bind_method(D_METHOD("eval", "code", "use_global_execution_context"), &JavaScript::eval, DEFVAL(false)); +} + +#if !defined(JAVASCRIPT_ENABLED) || !defined(JAVASCRIPT_EVAL_ENABLED) +Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { + + return Variant(); +} +#endif diff --git a/platform/javascript/api/api.h b/platform/javascript/api/api.h new file mode 100644 index 0000000000..53cd9239fc --- /dev/null +++ b/platform/javascript/api/api.h @@ -0,0 +1,31 @@ +/*************************************************************************/ +/* api.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +void register_javascript_api(); +void unregister_javascript_api(); diff --git a/platform/javascript/javascript_eval.h b/platform/javascript/api/javascript_eval.h index ed7cf383da..4d0b0b21ff 100644 --- a/platform/javascript/javascript_eval.h +++ b/platform/javascript/api/javascript_eval.h @@ -27,8 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef JAVASCRIPT_EVAL_ENABLED - #ifndef JAVASCRIPT_EVAL_H #define JAVASCRIPT_EVAL_H @@ -52,4 +50,3 @@ public: }; #endif // JAVASCRIPT_EVAL_H -#endif // JAVASCRIPT_EVAL_ENABLED diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index a2988d9c60..8472c3ccab 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -19,7 +19,6 @@ def can_build(): def get_opts(): from SCons.Variables import BoolVariable return [ - BoolVariable('wasm', 'Compile to WebAssembly', False), BoolVariable('javascript_eval', 'Enable JavaScript eval interface', True), ] @@ -103,20 +102,13 @@ def configure(env): ## Link flags - env.Append(LINKFLAGS=['-s', 'EXTRA_EXPORTED_RUNTIME_METHODS="[\'FS\']"']) + env.Append(LINKFLAGS=['-s', 'BINARYEN=1']) + env.Append(LINKFLAGS=['-s', 'ALLOW_MEMORY_GROWTH=1']) env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1']) + env.Append(LINKFLAGS=['-s', 'EXTRA_EXPORTED_RUNTIME_METHODS="[\'FS\']"']) - if env['wasm']: - env.Append(LINKFLAGS=['-s', 'BINARYEN=1']) - # In contrast to asm.js, enabling memory growth on WebAssembly has no - # major performance impact, and causes only a negligible increase in - # memory size. - env.Append(LINKFLAGS=['-s', 'ALLOW_MEMORY_GROWTH=1']) - env.extra_suffix = '.webassembly' + env.extra_suffix - else: - env.Append(LINKFLAGS=['-s', 'ASM_JS=1']) - env.Append(LINKFLAGS=['--separate-asm']) - env.Append(LINKFLAGS=['--memory-init-file', '1']) + env.Append(LINKFLAGS=['-s', 'INVOKE_RUN=0']) + env.Append(LINKFLAGS=['-s', 'NO_EXIT_RUNTIME=1']) # TODO: Move that to opus module's config if 'module_opus_enabled' in env and env['module_opus_enabled']: diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js index 99d1c20bbd..dc4bdc7efb 100644 --- a/platform/javascript/engine.js +++ b/platform/javascript/engine.js @@ -5,7 +5,6 @@ (function() { var engine = Engine; - var USING_WASM = engine.USING_WASM; var DOWNLOAD_ATTEMPTS_MAX = 4; var basePath = null; @@ -32,87 +31,101 @@ this.rtenv = null; - var gameInitPromise = null; + var initPromise = null; var unloadAfterInit = true; - var memorySize = 268435456; + var preloadedFiles = []; + + var resizeCanvasOnStart = true; var progressFunc = null; - var pckProgressTracker = {}; + var preloadProgressTracker = {}; var lastProgress = { loaded: 0, total: 0 }; var canvas = null; + var executableName = null; + var locale = null; var stdout = null; var stderr = null; - this.initGame = function(mainPack) { - - if (!gameInitPromise) { + this.init = function(newBasePath) { - if (mainPack === undefined) { - if (basePath !== null) { - mainPack = basePath + '.pck'; - } else { - return Promise.reject(new Error("No main pack to load specified")); - } - } - if (basePath === null) - basePath = getBasePath(mainPack); - - gameInitPromise = Engine.initEngine().then( + if (!initPromise) { + initPromise = Engine.load(newBasePath).then( instantiate.bind(this) ); - var gameLoadPromise = loadPromise(mainPack, pckProgressTracker).then(function(xhr) { return xhr.response; }); - gameInitPromise = Promise.all([gameLoadPromise, gameInitPromise]).then(function(values) { - // resolve with pck - return new Uint8Array(values[0]); - }); - if (unloadAfterInit) - gameInitPromise.then(Engine.unloadEngine); requestAnimationFrame(animateProgress); + if (unloadAfterInit) + initPromise.then(Engine.unloadEngine); } - return gameInitPromise; + return initPromise; }; - function instantiate(initializer) { + function instantiate(wasmBuf) { - var rtenvOpts = { - noInitialRun: true, - thisProgram: getBaseName(basePath), + var rtenvProps = { engine: this, + ENV: {}, }; if (typeof stdout === 'function') - rtenvOpts.print = stdout; + rtenvProps.print = stdout; if (typeof stderr === 'function') - rtenvOpts.printErr = stderr; - if (typeof WebAssembly === 'object' && initializer instanceof ArrayBuffer) { - rtenvOpts.instantiateWasm = function(imports, onSuccess) { - WebAssembly.instantiate(initializer, imports).then(function(result) { - onSuccess(result.instance); - }); - return {}; - }; - } else if (initializer.asm && initializer.mem) { - rtenvOpts.asm = initializer.asm; - rtenvOpts.memoryInitializerRequest = initializer.mem; - rtenvOpts.TOTAL_MEMORY = memorySize; - } else { - throw new Error("Invalid initializer"); - } + rtenvProps.printErr = stderr; + rtenvProps.instantiateWasm = function(imports, onSuccess) { + WebAssembly.instantiate(wasmBuf, imports).then(function(result) { + onSuccess(result.instance); + }); + return {}; + }; return new Promise(function(resolve, reject) { - rtenvOpts.onRuntimeInitialized = resolve; - rtenvOpts.onAbort = reject; - rtenvOpts.engine.rtenv = Engine.RuntimeEnvironment(rtenvOpts); + rtenvProps.onRuntimeInitialized = resolve; + rtenvProps.onAbort = reject; + rtenvProps.engine.rtenv = Engine.RuntimeEnvironment(rtenvProps); }); } - this.start = function(mainPack) { + this.preloadFile = function(pathOrBuffer, bufferFilename) { + + if (pathOrBuffer instanceof ArrayBuffer) { + pathOrBuffer = new Uint8Array(pathOrBuffer); + } else if (ArrayBuffer.isView(pathOrBuffer)) { + pathOrBuffer = new Uint8Array(pathOrBuffer.buffer); + } + if (pathOrBuffer instanceof Uint8Array) { + preloadedFiles.push({ + name: bufferFilename, + buffer: pathOrBuffer + }); + return Promise.resolve(); + } else if (typeof pathOrBuffer === 'string') { + return loadPromise(pathOrBuffer, preloadProgressTracker).then(function(xhr) { + preloadedFiles.push({ + name: pathOrBuffer, + buffer: xhr.response + }); + }); + } else { + throw Promise.reject("Invalid object for preloading"); + } + }; + + this.start = function() { + + return this.init().then( + Function.prototype.apply.bind(synchronousStart, this, arguments) + ); + }; + + this.startGame = function(mainPack) { - return this.initGame(mainPack).then(synchronousStart.bind(this)); + executableName = getBaseName(mainPack); + return Promise.all([this.init(getBasePath(mainPack)), this.preloadFile(mainPack)]).then( + Function.prototype.apply.bind(synchronousStart, this, []) + ); }; - function synchronousStart(pckView) { - // TODO don't expect canvas when runninng as cli tool + function synchronousStart() { + if (canvas instanceof HTMLCanvasElement) { this.rtenv.canvas = canvas; } else { @@ -147,15 +160,33 @@ ev.preventDefault(); }, false); - this.rtenv.FS.createDataFile('/', this.rtenv.thisProgram + '.pck', pckView, true, true, true); - gameInitPromise = null; - this.rtenv.callMain(); + if (locale) { + this.rtenv.locale = locale; + } else { + this.rtenv.locale = navigator.languages ? navigator.languages[0] : navigator.language; + } + this.rtenv.locale = this.rtenv.locale.split('.')[0]; + this.rtenv.resizeCanvasOnStart = resizeCanvasOnStart; + + this.rtenv.thisProgram = executableName || getBaseName(basePath); + + preloadedFiles.forEach(function(file) { + this.rtenv.FS.createDataFile('/', file.name, new Uint8Array(file.buffer), true, true, true); + }, this); + + preloadedFiles = null; + initPromise = null; + this.rtenv.callMain(arguments); } this.setProgressFunc = function(func) { progressFunc = func; }; + this.setResizeCanvasOnStart = function(enabled) { + resizeCanvasOnStart = enabled; + }; + function animateProgress() { var loaded = 0; @@ -163,7 +194,7 @@ var totalIsValid = true; var progressIsFinal = true; - [loadingFiles, pckProgressTracker].forEach(function(tracker) { + [loadingFiles, preloadProgressTracker].forEach(function(tracker) { Object.keys(tracker).forEach(function(file) { if (!tracker[file].final) progressIsFinal = false; @@ -190,14 +221,20 @@ canvas = elem; }; - this.setAsmjsMemorySize = function(size) { - memorySize = size; + this.setExecutableName = function(newName) { + + executableName = newName; + }; + + this.setLocale = function(newLocale) { + + locale = newLocale; }; this.setUnloadAfterInit = function(enabled) { - if (enabled && !unloadAfterInit && gameInitPromise) { - gameInitPromise.then(Engine.unloadEngine); + if (enabled && !unloadAfterInit && initPromise) { + initPromise.then(Engine.unloadEngine); } unloadAfterInit = enabled; }; @@ -232,26 +269,16 @@ Engine.RuntimeEnvironment = engine.RuntimeEnvironment; - Engine.initEngine = function(newBasePath) { + Engine.load = function(newBasePath) { if (newBasePath !== undefined) basePath = getBasePath(newBasePath); if (engineLoadPromise === null) { - if (USING_WASM) { - if (typeof WebAssembly !== 'object') - return Promise.reject(new Error("Browser doesn't support WebAssembly")); - // TODO cache/retrieve module to/from idb - engineLoadPromise = loadPromise(basePath + '.wasm').then(function(xhr) { - return xhr.response; - }); - } else { - var asmjsPromise = loadPromise(basePath + '.asm.js').then(function(xhr) { - return asmjsModulePromise(xhr.response); - }); - var memPromise = loadPromise(basePath + '.mem'); - engineLoadPromise = Promise.all([asmjsPromise, memPromise]).then(function(values) { - return { asm: values[0], mem: values[1] }; - }); - } + if (typeof WebAssembly !== 'object') + return Promise.reject(new Error("Browser doesn't support WebAssembly")); + // TODO cache/retrieve module to/from idb + engineLoadPromise = loadPromise(basePath + '.wasm').then(function(xhr) { + return xhr.response; + }); engineLoadPromise = engineLoadPromise.catch(function(err) { engineLoadPromise = null; throw err; @@ -260,34 +287,7 @@ return engineLoadPromise; }; - function asmjsModulePromise(module) { - var elem = document.createElement('script'); - var script = new Blob([ - 'Engine.asm = (function() { var Module = {};', - module, - 'return Module.asm; })();' - ]); - var url = URL.createObjectURL(script); - elem.src = url; - return new Promise(function(resolve, reject) { - elem.addEventListener('load', function() { - URL.revokeObjectURL(url); - var asm = Engine.asm; - Engine.asm = undefined; - setTimeout(function() { - // delay to reclaim compilation memory - resolve(asm); - }, 1); - }); - elem.addEventListener('error', function() { - URL.revokeObjectURL(url); - reject("asm.js faiilure"); - }); - document.body.appendChild(elem); - }); - } - - Engine.unloadEngine = function() { + Engine.unload = function() { engineLoadPromise = null; }; @@ -306,7 +306,7 @@ if (!file.endsWith('.js')) { xhr.responseType = 'arraybuffer'; } - ['loadstart', 'progress', 'load', 'error', 'timeout', 'abort'].forEach(function(ev) { + ['loadstart', 'progress', 'load', 'error', 'abort'].forEach(function(ev) { xhr.addEventListener(ev, onXHREvent.bind(xhr, resolve, reject, file, tracker)); }); xhr.send(); @@ -321,7 +321,7 @@ this.abort(); return; } else { - loadXHR(resolve, reject, file); + setTimeout(loadXHR.bind(null, resolve, reject, file, tracker), 1000); } } @@ -348,12 +348,11 @@ break; case 'error': - case 'timeout': if (++tracker[file].attempts >= DOWNLOAD_ATTEMPTS_MAX) { tracker[file].final = true; reject(new Error("Failed loading file '" + file + "'")); } else { - loadXHR(resolve, reject, file); + setTimeout(loadXHR.bind(null, resolve, reject, file, tracker), 1000); } break; diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 4a97bf4c32..d0d4b17874 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -35,8 +35,6 @@ #define EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE "webassembly_release.zip" #define EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG "webassembly_debug.zip" -#define EXPORT_TEMPLATE_ASMJS_RELEASE "javascript_release.zip" -#define EXPORT_TEMPLATE_ASMJS_DEBUG "javascript_debug.zip" class EditorExportPlatformJavaScript : public EditorExportPlatform { @@ -47,18 +45,11 @@ class EditorExportPlatformJavaScript : public EditorExportPlatform { bool runnable_when_last_polled; void _fix_html(Vector<uint8_t> &p_html, const Ref<EditorExportPreset> &p_preset, const String &p_name, bool p_debug); - void _fix_fsloader_js(Vector<uint8_t> &p_js, const String &p_pack_name, uint64_t p_pack_size); public: - enum Target { - TARGET_WEBASSEMBLY, - TARGET_ASMJS - }; - virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features); virtual void get_export_options(List<ExportOption> *r_options); - virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; virtual String get_name() const; virtual String get_os_name() const; @@ -90,17 +81,9 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Re String str_export; Vector<String> lines = str_template.split("\n"); - int memory_mb; - if (p_preset->get("options/target").operator int() != TARGET_ASMJS) - // WebAssembly allows memory growth, so start with a reasonable default - memory_mb = 1 << 4; - else - memory_mb = 1 << (p_preset->get("options/memory_size").operator int() + 5); - for (int i = 0; i < lines.size(); i++) { String current_line = lines[i]; - current_line = current_line.replace("$GODOT_TOTAL_MEMORY", itos(memory_mb * 1024 * 1024)); current_line = current_line.replace("$GODOT_BASENAME", p_name); current_line = current_line.replace("$GODOT_HEAD_INCLUDE", p_preset->get("html/head_include")); current_line = current_line.replace("$GODOT_DEBUG_ENABLED", p_debug ? "true" : "false"); @@ -129,8 +112,6 @@ void EditorExportPlatformJavaScript::get_preset_features(const Ref<EditorExportP void EditorExportPlatformJavaScript::get_export_options(List<ExportOption> *r_options) { - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "options/target", PROPERTY_HINT_ENUM, "WebAssembly,asm.js"), TARGET_WEBASSEMBLY)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "options/memory_size", PROPERTY_HINT_ENUM, "32 MB,64 MB,128 MB,256 MB,512 MB,1 GB"), 3)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false)); @@ -139,14 +120,6 @@ void EditorExportPlatformJavaScript::get_export_options(List<ExportOption> *r_op r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "zip"), "")); } -bool EditorExportPlatformJavaScript::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const { - - if (p_option == "options/memory_size") { - return p_options["options/target"].operator int() == TARGET_ASMJS; - } - return true; -} - String EditorExportPlatformJavaScript::get_name() const { return "HTML5"; @@ -166,17 +139,10 @@ bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p r_missing_templates = false; - if (p_preset->get("options/target").operator int() == TARGET_WEBASSEMBLY) { - if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE) == String()) - r_missing_templates = true; - else if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG) == String()) - r_missing_templates = true; - } else { - if (find_export_template(EXPORT_TEMPLATE_ASMJS_RELEASE) == String()) - r_missing_templates = true; - else if (find_export_template(EXPORT_TEMPLATE_ASMJS_DEBUG) == String()) - r_missing_templates = true; - } + if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE) == String()) + r_missing_templates = true; + else if (find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG) == String()) + r_missing_templates = true; return !r_missing_templates; } @@ -197,17 +163,10 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese if (template_path == String()) { - if (p_preset->get("options/target").operator int() == TARGET_WEBASSEMBLY) { - if (p_debug) - template_path = find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG); - else - template_path = find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE); - } else { - if (p_debug) - template_path = find_export_template(EXPORT_TEMPLATE_ASMJS_DEBUG); - else - template_path = find_export_template(EXPORT_TEMPLATE_ASMJS_RELEASE); - } + if (p_debug) + template_path = find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG); + else + template_path = find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE); } if (template_path != String() && !FileAccess::exists(template_path)) { @@ -270,12 +229,6 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese } else if (file == "godot.wasm") { file = p_path.get_file().get_basename() + ".wasm"; - } else if (file == "godot.asm.js") { - - file = p_path.get_file().get_basename() + ".asm.js"; - } else if (file == "godot.mem") { - - file = p_path.get_file().get_basename() + ".mem"; } String dst = p_path.get_base_dir().plus_file(file); diff --git a/platform/javascript/http_request.h b/platform/javascript/http_request.h index 80ff3f0ba8..06d9239004 100644 --- a/platform/javascript/http_request.h +++ b/platform/javascript/http_request.h @@ -34,6 +34,8 @@ extern "C" { #endif +#include "stddef.h" + typedef enum { XHR_READY_STATE_UNSENT = 0, XHR_READY_STATE_OPENED = 1, diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp index 1d737879f6..a755dcb5c4 100644 --- a/platform/javascript/javascript_eval.cpp +++ b/platform/javascript/javascript_eval.cpp @@ -29,16 +29,9 @@ /*************************************************************************/ #ifdef JAVASCRIPT_EVAL_ENABLED -#include "javascript_eval.h" +#include "api/javascript_eval.h" #include "emscripten.h" -JavaScript *JavaScript::singleton = NULL; - -JavaScript *JavaScript::get_singleton() { - - return singleton; -} - extern "C" EMSCRIPTEN_KEEPALIVE uint8_t *resize_poolbytearray_and_open_write(PoolByteArray *p_arr, PoolByteArray::Write *r_write, int p_len) { p_arr->resize(p_len); @@ -182,18 +175,4 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { return Variant(); } -void JavaScript::_bind_methods() { - - ClassDB::bind_method(D_METHOD("eval", "code", "use_global_execution_context"), &JavaScript::eval, false); -} - -JavaScript::JavaScript() { - - ERR_FAIL_COND(singleton != NULL); - singleton = this; -} - -JavaScript::~JavaScript() { -} - #endif // JAVASCRIPT_EVAL_ENABLED diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index ed4f416cfd..5c5d608524 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -61,7 +61,6 @@ int main(int argc, char *argv[]) { // run the 'main_after_fs_sync' function /* clang-format off */ EM_ASM( - Module.noExitRuntime = true; FS.mkdir('/userfs'); FS.mount(IDBFS, {}, '/userfs'); FS.syncfs(true, function(err) { diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 389d5d206e..54c0e81421 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -29,8 +29,8 @@ /*************************************************************************/ #include "os_javascript.h" +#include "core/engine.h" #include "core/io/file_access_buffered_fa.h" -#include "core/project_settings.h" #include "dom_keys.h" #include "drivers/gles3/rasterizer_gles3.h" #include "drivers/unix/dir_access_unix.h" @@ -438,25 +438,23 @@ void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, i video_mode = p_desired; // can't fulfil fullscreen request due to browser security video_mode.fullscreen = false; - set_window_size(Size2(p_desired.width, p_desired.height)); + /* clang-format off */ + bool resize_canvas_on_start = EM_ASM_INT_V( + return Module.resizeCanvasOnStart; + ); + /* clang-format on */ + if (resize_canvas_on_start) { + set_window_size(Size2(video_mode.width, video_mode.height)); + } else { + Size2 canvas_size = get_window_size(); + video_mode.width = canvas_size.width; + video_mode.height = canvas_size.height; + } - // find locale, emscripten only sets "C" char locale_ptr[16]; /* clang-format off */ - EM_ASM_({ - var locale = ""; - if (Module.locale) { - // best case: server-side script reads Accept-Language early and - // defines the locale to be read here - locale = Module.locale; - } else { - // no luck, use what the JS engine can tell us - // if this turns out not compatible enough, add tests for - // browserLanguage, systemLanguage and userLanguage - locale = navigator.languages ? navigator.languages[0] : navigator.language; - } - locale = locale.split('.')[0]; - stringToUTF8(locale, $0, 16); + EM_ASM_ARGS({ + stringToUTF8(Module.locale, $0, 16); }, locale_ptr); /* clang-format on */ setenv("LANG", locale_ptr, true); @@ -512,11 +510,6 @@ void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, i #undef SET_EM_CALLBACK #undef EM_CHECK -#ifdef JAVASCRIPT_EVAL_ENABLED - javascript_eval = memnew(JavaScript); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JavaScript", javascript_eval)); -#endif - visual_server->init(); } @@ -896,7 +889,6 @@ String OS_JavaScript::get_data_dir() const { return get_data_dir_func(); */ return "/userfs"; - //return ProjectSettings::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); }; String OS_JavaScript::get_executable_path() const { diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index f478f95dd2..85c185c10f 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -32,7 +32,6 @@ #include "audio_driver_javascript.h" #include "drivers/unix/os_unix.h" -#include "javascript_eval.h" #include "main/input_default.h" #include "os/input.h" #include "os/main_loop.h" @@ -67,10 +66,6 @@ class OS_JavaScript : public OS_Unix { PowerJavascript *power_manager; -#ifdef JAVASCRIPT_EVAL_ENABLED - JavaScript *javascript_eval; -#endif - static void _close_notification_funcs(const String &p_file, int p_flags); void process_joypads(); diff --git a/platform/javascript/pre_wasm.js b/platform/javascript/pre.js index be4383c8c9..311aa44fda 100644 --- a/platform/javascript/pre_wasm.js +++ b/platform/javascript/pre.js @@ -1,3 +1,2 @@ var Engine = { - USING_WASM: true, RuntimeEnvironment: function(Module) { diff --git a/platform/javascript/pre_asmjs.js b/platform/javascript/pre_asmjs.js deleted file mode 100644 index 3c497721b6..0000000000 --- a/platform/javascript/pre_asmjs.js +++ /dev/null @@ -1,3 +0,0 @@ -var Engine = { - USING_WASM: false, - RuntimeEnvironment: function(Module) { diff --git a/platform/osx/detect.py b/platform/osx/detect.py index c24bd98bf6..ff7cf2ad2f 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -110,7 +110,7 @@ def configure(env): ## Flags env.Append(CPPPATH=['#platform/osx']) - env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED']) + env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED']) env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback']) env.Append(LIBS=['pthread']) diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 53f45511f9..1df847eb79 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -226,6 +226,12 @@ public: virtual Error move_to_trash(const String &p_path); OS_OSX(); + +private: + Point2 get_native_screen_position(int p_screen) const; + Point2 get_native_window_position() const; + void set_native_window_position(const Point2 &p_position); + Point2 get_screens_origin() const; }; #endif diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 6faa8e12ed..8703b8ff16 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -896,7 +896,7 @@ int OS_OSX::get_video_driver_count() const { const char *OS_OSX::get_video_driver_name(int p_driver) const { - return "GLES2"; + return "GLES3"; } void OS_OSX::initialize_core() { @@ -913,10 +913,15 @@ void OS_OSX::initialize_core() { } static bool keyboard_layout_dirty = true; -static void keyboardLayoutChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { +static void keyboard_layout_changed(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef user_info) { keyboard_layout_dirty = true; } +static bool displays_arrangement_dirty = true; +static void displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplayChangeSummaryFlags flags, void *user_info) { + displays_arrangement_dirty = true; +} + void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { /*** OSX INITIALIZATION ***/ @@ -924,13 +929,17 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au /*** OSX INITIALIZATION ***/ keyboard_layout_dirty = true; + displays_arrangement_dirty = true; // Register to be notified on keyboard layout changes CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), - NULL, keyboardLayoutChanged, + NULL, keyboard_layout_changed, kTISNotifySelectedKeyboardInputSourceChanged, NULL, CFNotificationSuspensionBehaviorDeliverImmediately); + // Register to be notified on displays arrangement changes + CGDisplayRegisterReconfigurationCallback(displays_arrangement_changed, NULL); + window_delegate = [[GodotWindowDelegate alloc] init]; // Don't use accumulation buffer support; it's not accelerated @@ -1057,8 +1066,6 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au zoomed = true; /*** END OSX INITIALIZATION ***/ - /*** END OSX INITIALIZATION ***/ - /*** END OSX INITIALIZATION ***/ bool use_gl2 = p_video_driver != 1; @@ -1068,16 +1075,12 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au RasterizerGLES3::register_config(); RasterizerGLES3::make_current(); - //rasterizer = instance_RasterizerGLES2(); - //visual_server = memnew( VisualServerRaster(rasterizer) ); - visual_server = memnew(VisualServerRaster); if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD)); } visual_server->init(); - // visual_server->cursor_set_visible(false, 0); AudioDriverManager::initialize(p_audio_driver); @@ -1094,6 +1097,8 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au void OS_OSX::finalize() { CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL); + CGDisplayRemoveReconfigurationCallback(displays_arrangement_changed, NULL); + delete_main_loop(); memdelete(joypad_osx); @@ -1456,6 +1461,32 @@ int OS_OSX::get_screen_count() const { return [screenArray count]; }; +// Returns the native top-left screen coordinate of the smallest rectangle +// that encompasses all screens. Needed in get_screen_position(), +// get_window_position, and set_window_position() +// to convert between OS X native screen coordinates and the ones expected by Godot +Point2 OS_OSX::get_screens_origin() const { + static Point2 origin; + + if (displays_arrangement_dirty) { + origin = Point2(); + + for (int i = 0; i < get_screen_count(); i++) { + Point2 position = get_native_screen_position(i); + if (position.x < origin.x) { + origin.x = position.x; + } + if (position.y > origin.y) { + origin.y = position.y; + } + } + + displays_arrangement_dirty = false; + } + + return origin; +} + static int get_screen_index(NSScreen *screen) { const NSUInteger index = [[NSScreen screens] indexOfObject:screen]; return index == NSNotFound ? 0 : index; @@ -1474,21 +1505,30 @@ void OS_OSX::set_current_screen(int p_screen) { set_window_position(wpos + get_screen_position(p_screen)); }; -Point2 OS_OSX::get_screen_position(int p_screen) const { +Point2 OS_OSX::get_native_screen_position(int p_screen) const { if (p_screen == -1) { p_screen = get_current_screen(); } NSArray *screenArray = [NSScreen screens]; if (p_screen < [screenArray count]) { - float displayScale = _display_scale([screenArray objectAtIndex:p_screen]); + float display_scale = _display_scale([screenArray objectAtIndex:p_screen]); NSRect nsrect = [[screenArray objectAtIndex:p_screen] frame]; - return Point2(nsrect.origin.x, nsrect.origin.y) * displayScale; + // Return the top-left corner of the screen, for OS X the y starts at the bottom + return Point2(nsrect.origin.x, nsrect.origin.y + nsrect.size.height) * display_scale; } return Point2(); } +Point2 OS_OSX::get_screen_position(int p_screen) const { + Point2 position = get_native_screen_position(p_screen) - get_screens_origin(); + // OS X native y-coordinate relative to get_screens_origin() is negative, + // Godot expects a positive value + position.y *= -1; + return position; +} + int OS_OSX::get_screen_dpi(int p_screen) const { if (p_screen == -1) { p_screen = get_current_screen(); @@ -1567,28 +1607,48 @@ float OS_OSX::_display_scale(id screen) const { } } -Point2 OS_OSX::get_window_position() const { +Point2 OS_OSX::get_native_window_position() const { + + NSRect nsrect = [window_object frame]; + Point2 pos; + float display_scale = _display_scale(); + + // Return the position of the top-left corner, for OS X the y starts at the bottom + pos.x = nsrect.origin.x * display_scale; + pos.y = (nsrect.origin.y + nsrect.size.height) * display_scale; - Size2 wp([window_object frame].origin.x, [window_object frame].origin.y); - wp *= _display_scale(); - return wp; + return pos; }; -void OS_OSX::set_window_position(const Point2 &p_position) { +Point2 OS_OSX::get_window_position() const { + Point2 position = get_native_window_position() - get_screens_origin(); + // OS X native y-coordinate relative to get_screens_origin() is negative, + // Godot expects a positive value + position.y *= -1; + return position; +} + +void OS_OSX::set_native_window_position(const Point2 &p_position) { - Size2 scr = get_screen_size(); NSPoint pos; float displayScale = _display_scale(); pos.x = p_position.x / displayScale; - // For OS X the y starts at the bottom - pos.y = (scr.height - p_position.y) / displayScale; + pos.y = p_position.y / displayScale; [window_object setFrameTopLeftPoint:pos]; _update_window(); }; +void OS_OSX::set_window_position(const Point2 &p_position) { + Point2 position = p_position; + // OS X native y-coordinate relative to get_screens_origin() is negative, + // Godot passes a positive value + position.y *= -1; + set_native_window_position(get_screens_origin() + position); +}; + Size2 OS_OSX::get_window_size() const { return window_size; diff --git a/platform/register_platform_apis.h b/platform/register_platform_apis.h new file mode 100644 index 0000000000..37f98f6cd3 --- /dev/null +++ b/platform/register_platform_apis.h @@ -0,0 +1,36 @@ +/*************************************************************************/ +/* register_platform_apis.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef REGISTER_APIS_H +#define REGISTER_APIS_H + +void register_platform_apis(); +void unregister_platform_apis(); + +#endif diff --git a/platform/uwp/app.h b/platform/uwp/app.h index e079fa9c9d..b812512a98 100644 --- a/platform/uwp/app.h +++ b/platform/uwp/app.h @@ -33,6 +33,7 @@ #include <wrl.h> +// ANGLE doesn't provide a specific lib for GLES3, so we keep using GLES2 #include "GLES2/gl2.h" #include "os_uwp.h" diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index 434c597449..7cc8afff06 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -136,7 +136,7 @@ def configure(env): env.Append(CPPPATH=['#platform/uwp', '#drivers/windows']) env.Append(CCFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND']) - env.Append(CCFLAGS=['/DGLES2_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED']) + env.Append(CCFLAGS=['/DGLES_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED']) winver = "0x0602" # Windows 8 is the minimum target for UWP build env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver]) diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index acb0ba4bca..978a56f64f 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -69,7 +69,7 @@ int OSUWP::get_video_driver_count() const { } const char *OSUWP::get_video_driver_name(int p_driver) const { - return "GLES2"; + return "GLES3"; } Size2 OSUWP::get_window_size() const { diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index 8571f0dc65..81aa18dd23 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -27,25 +27,12 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) - -// -// C++ Implementation: context_gl_x11 -// -// Description: -// -// +#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED) + // Author: Juan Linietsky <reduzio@gmail.com>, (C) 2008 -// -// Copyright: See COPYING file that comes with this distribution -// -// #include "context_gl_win.h" -//#include "drivers/opengl/glwrapper.h" -//#include "ctxgl_procaddr.h" - #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 #define WGL_CONTEXT_FLAGS_ARB 0x2094 diff --git a/platform/windows/context_gl_win.h b/platform/windows/context_gl_win.h index 0059cbc311..5a280b0d08 100644 --- a/platform/windows/context_gl_win.h +++ b/platform/windows/context_gl_win.h @@ -27,18 +27,9 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) -// -// C++ Interface: context_gl_x11 -// -// Description: -// -// +#if defined(OPENGL_ENABLED) || defined(GLES_ENABLED) + // Author: Juan Linietsky <reduzio@gmail.com>, (C) 2008 -// -// Copyright: See COPYING file that comes with this distribution -// -// #ifndef CONTEXT_GL_WIN_H #define CONTEXT_GL_WIN_H diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 0f62dbb9e8..97a3198d10 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -143,7 +143,7 @@ int OS_Windows::get_video_driver_count() const { } const char *OS_Windows::get_video_driver_name(int p_driver) const { - return "GLES2"; + return "GLES3"; } int OS_Windows::get_audio_driver_count() const { diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 6bd0ac8317..3d07851c4f 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -236,7 +236,7 @@ def configure(env): env.ParseConfig('pkg-config zlib --cflags --libs') env.Append(CPPPATH=['#platform/x11']) - env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL']) + env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED', '-DGLES_OVER_GL']) env.Append(LIBS=['GL', 'pthread']) if (platform.system() == "Linux"): diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index 5982556c18..4865858b7d 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -247,16 +247,16 @@ SpriteFrames::SpriteFrames() { add_animation(SceneStringNames::get_singleton()->_default); } -void AnimatedSprite::edit_set_pivot(const Point2 &p_pivot) { +void AnimatedSprite::_edit_set_pivot(const Point2 &p_pivot) { set_offset(p_pivot); } -Point2 AnimatedSprite::edit_get_pivot() const { +Point2 AnimatedSprite::_edit_get_pivot() const { return get_offset(); } -bool AnimatedSprite::edit_has_pivot() const { +bool AnimatedSprite::_edit_use_pivot() const { return true; } @@ -509,17 +509,17 @@ bool AnimatedSprite::is_flipped_v() const { return vflip; } -Rect2 AnimatedSprite::get_item_rect() const { +Rect2 AnimatedSprite::_edit_get_rect() const { if (!frames.is_valid() || !frames->has_animation(animation) || frame < 0 || frame >= frames->get_frame_count(animation)) { - return Node2D::get_item_rect(); + return Node2D::_edit_get_rect(); } Ref<Texture> t; if (animation) t = frames->get_frame(animation, frame); if (t.is_null()) - return Node2D::get_item_rect(); + return Node2D::_edit_get_rect(); Size2i s = t->get_size(); Point2 ofs = offset; diff --git a/scene/2d/animated_sprite.h b/scene/2d/animated_sprite.h index 6c660d0381..a8d0db021a 100644 --- a/scene/2d/animated_sprite.h +++ b/scene/2d/animated_sprite.h @@ -149,9 +149,9 @@ protected: virtual void _validate_property(PropertyInfo &property) const; public: - virtual void edit_set_pivot(const Point2 &p_pivot); - virtual Point2 edit_get_pivot() const; - virtual bool edit_has_pivot() const; + virtual void _edit_set_pivot(const Point2 &p_pivot); + virtual Point2 _edit_get_pivot() const; + virtual bool _edit_use_pivot() const; void set_sprite_frames(const Ref<SpriteFrames> &p_frames); Ref<SpriteFrames> get_sprite_frames() const; @@ -181,7 +181,7 @@ public: void set_modulate(const Color &p_color); Color get_modulate() const; - virtual Rect2 get_item_rect() const; + virtual Rect2 _edit_get_rect() const; virtual String get_configuration_warning() const; AnimatedSprite(); diff --git a/scene/2d/back_buffer_copy.cpp b/scene/2d/back_buffer_copy.cpp index 2858ddaad5..e4f52a227a 100644 --- a/scene/2d/back_buffer_copy.cpp +++ b/scene/2d/back_buffer_copy.cpp @@ -49,7 +49,7 @@ void BackBufferCopy::_update_copy_mode() { } } -Rect2 BackBufferCopy::get_item_rect() const { +Rect2 BackBufferCopy::_edit_get_rect() const { return rect; } diff --git a/scene/2d/back_buffer_copy.h b/scene/2d/back_buffer_copy.h index 2424dd7b19..cfd632d755 100644 --- a/scene/2d/back_buffer_copy.h +++ b/scene/2d/back_buffer_copy.h @@ -52,14 +52,14 @@ protected: static void _bind_methods(); public: + Rect2 _edit_get_rect() const; + void set_rect(const Rect2 &p_rect); Rect2 get_rect() const; void set_copy_mode(CopyMode p_mode); CopyMode get_copy_mode() const; - Rect2 get_item_rect() const; - BackBufferCopy(); ~BackBufferCopy(); }; diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index b41ba7f590..66abe1baa8 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -178,6 +178,12 @@ CanvasItemMaterial::LightMode CanvasItemMaterial::get_light_mode() const { void CanvasItemMaterial::_validate_property(PropertyInfo &property) const { } +RID CanvasItemMaterial::get_shader_rid() const { + + ERR_FAIL_COND_V(!shader_map.has(current_key), RID()); + return shader_map[current_key].shader; +} + void CanvasItemMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_blend_mode", "blend_mode"), &CanvasItemMaterial::set_blend_mode); @@ -300,22 +306,7 @@ void CanvasItem::hide() { _change_notify("visible"); } -Variant CanvasItem::edit_get_state() const { - - return Variant(); -} -void CanvasItem::edit_set_state(const Variant &p_state) { -} - -void CanvasItem::edit_set_rect(const Rect2 &p_edit_rect) { - - //used by editors, implement at will -} - -void CanvasItem::edit_rotate(float p_rot) { -} - -Size2 CanvasItem::edit_get_minimum_size() const { +Size2 CanvasItem::_edit_get_minimum_size() const { return Size2(-1, -1); //no limit } @@ -935,15 +926,22 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("_toplevel_raise_self"), &CanvasItem::_toplevel_raise_self); ClassDB::bind_method(D_METHOD("_update_callback"), &CanvasItem::_update_callback); - - ClassDB::bind_method(D_METHOD("edit_set_state", "state"), &CanvasItem::edit_set_state); - ClassDB::bind_method(D_METHOD("edit_get_state"), &CanvasItem::edit_get_state); - ClassDB::bind_method(D_METHOD("edit_set_rect", "rect"), &CanvasItem::edit_set_rect); - ClassDB::bind_method(D_METHOD("edit_rotate", "degrees"), &CanvasItem::edit_rotate); - - ClassDB::bind_method(D_METHOD("get_item_rect"), &CanvasItem::get_item_rect); - ClassDB::bind_method(D_METHOD("get_item_and_children_rect"), &CanvasItem::get_item_and_children_rect); - //ClassDB::bind_method(D_METHOD("get_transform"),&CanvasItem::get_transform); + ClassDB::bind_method(D_METHOD("_edit_set_state", "state"), &CanvasItem::_edit_set_state); + ClassDB::bind_method(D_METHOD("_edit_get_state"), &CanvasItem::_edit_get_state); + + ClassDB::bind_method(D_METHOD("_edit_set_position", "position"), &CanvasItem::_edit_set_position); + ClassDB::bind_method(D_METHOD("_edit_get_position"), &CanvasItem::_edit_get_position); + ClassDB::bind_method(D_METHOD("_edit_use_position"), &CanvasItem::_edit_use_position); + ClassDB::bind_method(D_METHOD("_edit_set_rect", "rect"), &CanvasItem::_edit_set_rect); + ClassDB::bind_method(D_METHOD("_edit_get_rect"), &CanvasItem::_edit_get_rect); + ClassDB::bind_method(D_METHOD("_edit_use_rect"), &CanvasItem::_edit_use_rect); + ClassDB::bind_method(D_METHOD("_edit_get_item_and_children_rect"), &CanvasItem::_edit_get_item_and_children_rect); + ClassDB::bind_method(D_METHOD("_edit_set_rotation", "degrees"), &CanvasItem::_edit_set_rotation); + ClassDB::bind_method(D_METHOD("_edit_get_rotation"), &CanvasItem::_edit_get_rotation); + ClassDB::bind_method(D_METHOD("_edit_use_rotation"), &CanvasItem::_edit_use_rotation); + ClassDB::bind_method(D_METHOD("_edit_set_pivot", "pivot"), &CanvasItem::_edit_set_pivot); + ClassDB::bind_method(D_METHOD("_edit_get_pivot"), &CanvasItem::_edit_get_pivot); + ClassDB::bind_method(D_METHOD("_edit_use_pivot"), &CanvasItem::_edit_use_pivot); ClassDB::bind_method(D_METHOD("get_canvas_item"), &CanvasItem::get_canvas_item); @@ -1113,14 +1111,14 @@ int CanvasItem::get_canvas_layer() const { return 0; } -Rect2 CanvasItem::get_item_and_children_rect() const { +Rect2 CanvasItem::_edit_get_item_and_children_rect() const { - Rect2 rect = get_item_rect(); + Rect2 rect = _edit_get_rect(); for (int i = 0; i < get_child_count(); i++) { CanvasItem *c = Object::cast_to<CanvasItem>(get_child(i)); if (c) { - Rect2 sir = c->get_transform().xform(c->get_item_and_children_rect()); + Rect2 sir = c->get_transform().xform(c->_edit_get_item_and_children_rect()); rect = rect.merge(sir); } } diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index cb8ee761e6..c877a94755 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -121,6 +121,8 @@ public: static void finish_shaders(); static void flush_changes(); + RID get_shader_rid() const; + CanvasItemMaterial(); virtual ~CanvasItemMaterial(); }; @@ -214,11 +216,31 @@ public: /* EDITOR */ - virtual Variant edit_get_state() const; - virtual void edit_set_state(const Variant &p_state); - virtual void edit_set_rect(const Rect2 &p_edit_rect); - virtual void edit_rotate(float p_rot); - virtual Size2 edit_get_minimum_size() const; + virtual void _edit_set_state(const Dictionary &p_state){}; + virtual Dictionary _edit_get_state() const { return Dictionary(); }; + + // Used to move/select the node + virtual void _edit_set_position(const Point2 &p_position){}; + virtual Point2 _edit_get_position() const { return Point2(); }; + virtual bool _edit_use_position() const { return false; }; + + // Used to resize/move/select the node + virtual void _edit_set_rect(const Rect2 &p_rect){}; + virtual Rect2 _edit_get_rect() const { return Rect2(-32, -32, 64, 64); }; + Rect2 _edit_get_item_and_children_rect() const; + virtual bool _edit_use_rect() const { return false; }; + + // Used to rotate the node + virtual void _edit_set_rotation(float p_rotation){}; + virtual float _edit_get_rotation() const { return 0.0; }; + virtual bool _edit_use_rotation() const { return false; }; + + // Used to set a pivot + virtual void _edit_set_pivot(const Point2 &p_pivot){}; + virtual Point2 _edit_get_pivot() const { return Point2(); }; + virtual bool _edit_use_pivot() const { return false; }; + + virtual Size2 _edit_get_minimum_size() const; /* VISIBILITY */ @@ -270,14 +292,11 @@ public: CanvasItem *get_parent_item() const; - virtual Rect2 get_item_rect() const = 0; virtual Transform2D get_transform() const = 0; virtual Transform2D get_global_transform() const; virtual Transform2D get_global_transform_with_canvas() const; - Rect2 get_item_and_children_rect() const; - CanvasItem *get_toplevel() const; _FORCE_INLINE_ RID get_canvas_item() const { return canvas_item; } diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index a840744c78..92855299ae 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -243,7 +243,7 @@ CollisionPolygon2D::BuildMode CollisionPolygon2D::get_build_mode() const { return build_mode; } -Rect2 CollisionPolygon2D::get_item_rect() const { +Rect2 CollisionPolygon2D::_edit_get_rect() const { return aabb; } diff --git a/scene/2d/collision_polygon_2d.h b/scene/2d/collision_polygon_2d.h index c9ec860e36..2fb08a4599 100644 --- a/scene/2d/collision_polygon_2d.h +++ b/scene/2d/collision_polygon_2d.h @@ -69,7 +69,7 @@ public: void set_polygon(const Vector<Point2> &p_polygon); Vector<Point2> get_polygon() const; - virtual Rect2 get_item_rect() const; + virtual Rect2 _edit_get_rect() const; virtual String get_configuration_warning() const; diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index 0758f4a9bf..f7cb5473e3 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -158,7 +158,7 @@ Ref<Shape2D> CollisionShape2D::get_shape() const { return shape; } -Rect2 CollisionShape2D::get_item_rect() const { +Rect2 CollisionShape2D::_edit_get_rect() const { return rect; } diff --git a/scene/2d/collision_shape_2d.h b/scene/2d/collision_shape_2d.h index 04203a75b4..4745c659c8 100644 --- a/scene/2d/collision_shape_2d.h +++ b/scene/2d/collision_shape_2d.h @@ -51,9 +51,10 @@ protected: static void _bind_methods(); public: + virtual Rect2 _edit_get_rect() const; + void set_shape(const Ref<Shape2D> &p_shape); Ref<Shape2D> get_shape() const; - virtual Rect2 get_item_rect() const; void set_disabled(bool p_disabled); bool is_disabled() const; diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 516acefe2a..d2b987e037 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -32,21 +32,21 @@ #include "engine.h" #include "servers/visual_server.h" -void Light2D::edit_set_pivot(const Point2 &p_pivot) { +void Light2D::_edit_set_pivot(const Point2 &p_pivot) { set_texture_offset(p_pivot); } -Point2 Light2D::edit_get_pivot() const { +Point2 Light2D::_edit_get_pivot() const { return get_texture_offset(); } -bool Light2D::edit_has_pivot() const { +bool Light2D::_edit_use_pivot() const { return true; } -Rect2 Light2D::get_item_rect() const { +Rect2 Light2D::_edit_get_rect() const { if (texture.is_null()) return Rect2(0, 0, 1, 1); diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h index f6bc943adb..9b9da8379f 100644 --- a/scene/2d/light_2d.h +++ b/scene/2d/light_2d.h @@ -84,9 +84,10 @@ protected: static void _bind_methods(); public: - virtual void edit_set_pivot(const Point2 &p_pivot); - virtual Point2 edit_get_pivot() const; - virtual bool edit_has_pivot() const; + virtual void _edit_set_pivot(const Point2 &p_pivot); + virtual Point2 _edit_get_pivot() const; + virtual bool _edit_use_pivot() const; + virtual Rect2 _edit_get_rect() const; void set_enabled(bool p_enabled); bool is_enabled() const; @@ -151,8 +152,6 @@ public: void set_shadow_smooth(float p_amount); float get_shadow_smooth() const; - virtual Rect2 get_item_rect() const; - String get_configuration_warning() const; Light2D(); diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index c562a4652d..36fbf5fda6 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -34,35 +34,22 @@ #include "scene/main/viewport.h" #include "servers/visual_server.h" -void Node2D::edit_set_pivot(const Point2 &p_pivot) { -} - -Point2 Node2D::edit_get_pivot() const { - - return Point2(); -} -bool Node2D::edit_has_pivot() const { - - return false; -} +Dictionary Node2D::_edit_get_state() const { -Variant Node2D::edit_get_state() const { - - Array state; - state.push_back(get_position()); - state.push_back(get_rotation()); - state.push_back(get_scale()); + Dictionary state; + state["position"] = get_position(); + state["rotation"] = get_rotation(); + state["scale"] = get_scale(); return state; } -void Node2D::edit_set_state(const Variant &p_state) { +void Node2D::_edit_set_state(const Dictionary &p_state) { - Array state = p_state; - ERR_FAIL_COND(state.size() != 3); + Dictionary state = p_state; + pos = state["position"]; + angle = state["rotation"]; + _scale = state["scale"]; - pos = state[0]; - angle = state[1]; - _scale = state[2]; _update_transform(); _change_notify("rotation"); _change_notify("rotation_degrees"); @@ -70,9 +57,16 @@ void Node2D::edit_set_state(const Variant &p_state) { _change_notify("position"); } -void Node2D::edit_set_rect(const Rect2 &p_edit_rect) { +void Node2D::_edit_set_position(const Point2 &p_position) { + pos = p_position; +} + +Point2 Node2D::_edit_get_position() const { + return pos; +} - Rect2 r = get_item_rect(); +void Node2D::_edit_set_rect(const Rect2 &p_edit_rect) { + Rect2 r = _edit_get_rect(); Vector2 zero_offset; if (r.size.x != 0) @@ -101,14 +95,25 @@ void Node2D::edit_set_rect(const Rect2 &p_edit_rect) { _change_notify("position"); } -void Node2D::edit_rotate(float p_rot) { +bool Node2D::_edit_use_rect() const { + return true; +} - angle += p_rot; +void Node2D::_edit_set_rotation(float p_rotation) { + angle = p_rotation; _update_transform(); _change_notify("rotation"); _change_notify("rotation_degrees"); } +float Node2D::_edit_get_rotation() const { + return angle; +} + +bool Node2D::_edit_use_rotation() const { + return true; +} + void Node2D::_update_xform_values() { pos = _mat.elements[2]; @@ -205,17 +210,6 @@ Transform2D Node2D::get_transform() const { return _mat; } -Rect2 Node2D::get_item_rect() const { - - if (get_script_instance()) { - Variant::CallError err; - Rect2 r = get_script_instance()->call("_get_item_rect", NULL, 0, err); - if (err.error == Variant::CallError::CALL_OK) - return r; - } - return Rect2(Point2(-32, -32), Size2(64, 64)); -} - void Node2D::rotate(float p_radians) { set_rotation(get_rotation() + p_radians); @@ -439,7 +433,7 @@ void Node2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_z_as_relative", "enable"), &Node2D::set_z_as_relative); ClassDB::bind_method(D_METHOD("is_z_relative"), &Node2D::is_z_relative); - ClassDB::bind_method(D_METHOD("edit_set_pivot", "pivot"), &Node2D::edit_set_pivot); + ClassDB::bind_method(D_METHOD("_edit_set_pivot", "pivot"), &Node2D::_edit_set_pivot); ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent"), &Node2D::get_relative_transform_to_parent); diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index eca1e96c82..e1e07f2895 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -56,13 +56,16 @@ protected: static void _bind_methods(); public: - virtual Variant edit_get_state() const; - virtual void edit_set_state(const Variant &p_state); - virtual void edit_set_rect(const Rect2 &p_edit_rect); - virtual void edit_rotate(float p_rot); - virtual void edit_set_pivot(const Point2 &p_pivot); - virtual Point2 edit_get_pivot() const; - virtual bool edit_has_pivot() const; + virtual Dictionary _edit_get_state() const; + virtual void _edit_set_state(const Dictionary &p_state); + + virtual void _edit_set_position(const Point2 &p_position); + virtual Point2 _edit_get_position() const; + virtual void _edit_set_rect(const Rect2 &p_edit_rect); + virtual bool _edit_use_rect() const; + virtual void _edit_set_rotation(float p_rotation); + virtual float _edit_get_rotation() const; + virtual bool _edit_use_rotation() const; void set_position(const Point2 &p_pos); void set_rotation(float p_radians); @@ -85,7 +88,6 @@ public: float get_global_rotation() const; float get_global_rotation_degrees() const; Size2 get_global_scale() const; - virtual Rect2 get_item_rect() const; void set_transform(const Transform2D &p_transform); void set_global_transform(const Transform2D &p_transform); diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index c146ac08c2..aee5d89150 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -77,7 +77,7 @@ void Particles2D::set_randomness_ratio(float p_ratio) { void Particles2D::set_visibility_rect(const Rect2 &p_aabb) { visibility_rect = p_aabb; - Rect3 aabb; + AABB aabb; aabb.position.x = p_aabb.position.x; aabb.position.y = p_aabb.position.y; aabb.size.x = p_aabb.size.x; @@ -223,7 +223,7 @@ String Particles2D::get_configuration_warning() const { Rect2 Particles2D::capture_rect() const { - Rect3 aabb = VS::get_singleton()->particles_get_current_aabb(particles); + AABB aabb = VS::get_singleton()->particles_get_current_aabb(particles); Rect2 r; r.position.x = aabb.position.x; r.position.y = aabb.position.y; @@ -378,7 +378,7 @@ void Particles2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta"); ADD_GROUP("Drawing", ""); - ADD_PROPERTY(PropertyInfo(Variant::RECT3, "visibility_rect"), "set_visibility_rect", "get_visibility_rect"); + ADD_PROPERTY(PropertyInfo(Variant::AABB, "visibility_rect"), "set_visibility_rect", "get_visibility_rect"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates"); ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime"), "set_draw_order", "get_draw_order"); ADD_GROUP("Process Material", "process_"); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index b5b5445684..3f2ad19e51 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "polygon_2d.h" -Rect2 Polygon2D::get_item_rect() const { +Rect2 Polygon2D::_edit_get_rect() const { if (rect_cache_dirty) { int l = polygon.size(); @@ -49,16 +49,16 @@ Rect2 Polygon2D::get_item_rect() const { return item_rect; } -void Polygon2D::edit_set_pivot(const Point2 &p_pivot) { +void Polygon2D::_edit_set_pivot(const Point2 &p_pivot) { set_offset(p_pivot); } -Point2 Polygon2D::edit_get_pivot() const { +Point2 Polygon2D::_edit_get_pivot() const { return get_offset(); } -bool Polygon2D::edit_has_pivot() const { +bool Polygon2D::_edit_use_pivot() const { return true; } diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index 0c2c049c18..d09e22f5ff 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -99,11 +99,11 @@ public: //editor stuff - virtual void edit_set_pivot(const Point2 &p_pivot); - virtual Point2 edit_get_pivot() const; - virtual bool edit_has_pivot() const; + virtual void _edit_set_pivot(const Point2 &p_pivot); + virtual Point2 _edit_get_pivot() const; + virtual bool _edit_use_pivot() const; - virtual Rect2 get_item_rect() const; + virtual Rect2 _edit_get_rect() const; Polygon2D(); }; diff --git a/scene/2d/position_2d.cpp b/scene/2d/position_2d.cpp index cde665d422..1e729bc179 100644 --- a/scene/2d/position_2d.cpp +++ b/scene/2d/position_2d.cpp @@ -38,7 +38,7 @@ void Position2D::_draw_cross() { draw_line(Point2(0, -10), Point2(0, +10), Color(0.5, 1, 0.5)); } -Rect2 Position2D::get_item_rect() const { +Rect2 Position2D::_edit_get_rect() const { return Rect2(Point2(-10, -10), Size2(20, 20)); } diff --git a/scene/2d/position_2d.h b/scene/2d/position_2d.h index af54fb919a..5961e447df 100644 --- a/scene/2d/position_2d.h +++ b/scene/2d/position_2d.h @@ -42,7 +42,7 @@ protected: void _notification(int p_what); public: - virtual Rect2 get_item_rect() const; + virtual Rect2 _edit_get_rect() const; Position2D(); }; diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index bf7c5a3ba4..d5fcda90d5 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -133,7 +133,7 @@ void TouchScreenButton::_notification(int p_what) { return; if (shape.is_valid()) { Color draw_col = get_tree()->get_debug_collisions_color(); - Vector2 pos = shape_centered ? get_item_rect().size * 0.5f : Vector2(); + Vector2 pos = shape_centered ? _edit_get_rect().size * 0.5f : Vector2(); draw_set_transform_matrix(get_canvas_transform().translated(pos)); shape->draw(get_canvas_item(), draw_col); } @@ -251,7 +251,7 @@ void TouchScreenButton::_input(const Ref<InputEvent> &p_event) { bool TouchScreenButton::_is_point_inside(const Point2 &p_point) { Point2 coord = (get_global_transform_with_canvas()).affine_inverse().xform(p_point); - Rect2 item_rect = get_item_rect(); + Rect2 item_rect = _edit_get_rect(); bool touched = false; bool check_rect = true; @@ -322,13 +322,13 @@ void TouchScreenButton::_release(bool p_exiting_tree) { } } -Rect2 TouchScreenButton::get_item_rect() const { +Rect2 TouchScreenButton::_edit_get_rect() const { if (texture.is_null()) return Rect2(0, 0, 1, 1); /* if (texture.is_null()) - return CanvasItem::get_item_rect(); + return CanvasItem::_edit_get_rect(); */ return Rect2(Size2(), texture->get_size()); diff --git a/scene/2d/screen_button.h b/scene/2d/screen_button.h index 7647070b26..2e674c20b4 100644 --- a/scene/2d/screen_button.h +++ b/scene/2d/screen_button.h @@ -102,7 +102,7 @@ public: bool is_pressed() const; - Rect2 get_item_rect() const; + Rect2 _edit_get_rect() const; TouchScreenButton(); }; diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index c53faab5f9..df2265aae9 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -33,16 +33,16 @@ #include "scene/main/viewport.h" #include "scene/scene_string_names.h" -void Sprite::edit_set_pivot(const Point2 &p_pivot) { +void Sprite::_edit_set_pivot(const Point2 &p_pivot) { set_offset(p_pivot); } -Point2 Sprite::edit_get_pivot() const { +Point2 Sprite::_edit_get_pivot() const { return get_offset(); } -bool Sprite::edit_has_pivot() const { +bool Sprite::_edit_use_pivot() const { return true; } @@ -257,13 +257,13 @@ int Sprite::get_hframes() const { return hframes; } -Rect2 Sprite::get_item_rect() const { +Rect2 Sprite::_edit_get_rect() const { if (texture.is_null()) return Rect2(0, 0, 1, 1); /* if (texture.is_null()) - return CanvasItem::get_item_rect(); + return CanvasItem::_edit_get_rect(); */ Size2i s; @@ -368,224 +368,3 @@ Sprite::Sprite() { vframes = 1; hframes = 1; } - -//////////////////////////// VPSPRITE -/// -/// -/// - -#if 0 -void ViewportSprite::edit_set_pivot(const Point2& p_pivot) { - - set_offset(p_pivot); -} - -Point2 ViewportSprite::edit_get_pivot() const { - - return get_offset(); -} -bool ViewportSprite::edit_has_pivot() const { - - return true; -} - -void ViewportSprite::_notification(int p_what) { - - switch(p_what) { - - case NOTIFICATION_ENTER_TREE: { - - if (!viewport_path.is_empty()) { - - Node *n = get_node(viewport_path); - ERR_FAIL_COND(!n); - Viewport *vp=Object::cast_to<Viewport>(n); - ERR_FAIL_COND(!vp); - - Ref<RenderTargetTexture> rtt = vp->get_render_target_texture(); - texture=rtt; - texture->connect("changed",this,"update"); - item_rect_changed(); - } - } break; - case NOTIFICATION_EXIT_TREE: { - - if (texture.is_valid()) { - - texture->disconnect("changed",this,"update"); - texture=Ref<Texture>(); - } - } break; - case NOTIFICATION_DRAW: { - - if (texture.is_null()) - return; - - RID ci = get_canvas_item(); - - /* - texture->draw(ci,Point2()); - break; - */ - - Size2i s; - Rect2i src_rect; - - s = texture->get_size(); - - src_rect.size=s; - - Point2 ofs=offset; - if (centered) - ofs-=s/2; - - if (OS::get_singleton()->get_use_pixel_snap()) { - ofs=ofs.floor(); - } - Rect2 dst_rect(ofs,s); - texture->draw_rect_region(ci,dst_rect,src_rect,modulate); - - } break; - } -} - -void ViewportSprite::set_viewport_path(const NodePath& p_viewport) { - - viewport_path=p_viewport; - update(); - if (!is_inside_tree()) - return; - - if (texture.is_valid()) { - texture->disconnect("changed",this,"update"); - texture=Ref<Texture>(); - } - - if (viewport_path.is_empty()) - return; - - - Node *n = get_node(viewport_path); - ERR_FAIL_COND(!n); - Viewport *vp=Object::cast_to<Viewport>(n); - ERR_FAIL_COND(!vp); - - Ref<RenderTargetTexture> rtt = vp->get_render_target_texture(); - texture=rtt; - - if (texture.is_valid()) { - texture->connect("changed",this,"update"); - } - - item_rect_changed(); - -} - -NodePath ViewportSprite::get_viewport_path() const { - - return viewport_path; -} - -void ViewportSprite::set_centered(bool p_center) { - - centered=p_center; - update(); - item_rect_changed(); -} - -bool ViewportSprite::is_centered() const { - - return centered; -} - -void ViewportSprite::set_offset(const Point2& p_offset) { - - offset=p_offset; - update(); - item_rect_changed(); -} -Point2 ViewportSprite::get_offset() const { - - return offset; -} -void ViewportSprite::set_modulate(const Color& p_color) { - - modulate=p_color; - update(); -} - -Color ViewportSprite::get_modulate() const{ - - return modulate; -} - - -Rect2 ViewportSprite::get_item_rect() const { - - if (texture.is_null()) - return Rect2(0,0,1,1); - /* - if (texture.is_null()) - return CanvasItem::get_item_rect(); - */ - - Size2i s; - - s = texture->get_size(); - Point2 ofs=offset; - if (centered) - ofs-=s/2; - - if (s==Size2(0,0)) - s=Size2(1,1); - - return Rect2(ofs,s); -} - -String ViewportSprite::get_configuration_warning() const { - - if (!has_node(viewport_path) || !Object::cast_to<Viewport>(get_node(viewport_path))) { - return TTR("Path property must point to a valid Viewport node to work. Such Viewport must be set to 'render target' mode."); - } else { - - Node *n = get_node(viewport_path); - if (n) { - Viewport *vp = Object::cast_to<Viewport>(n); - if (!vp->is_set_as_render_target()) { - - return TTR("The Viewport set in the path property must be set as 'render target' in order for this sprite to work."); - } - } - } - - return String(); - -} - -void ViewportSprite::_bind_methods() { - - ClassDB::bind_method(D_METHOD("set_viewport_path","path"),&ViewportSprite::set_viewport_path); - ClassDB::bind_method(D_METHOD("get_viewport_path"),&ViewportSprite::get_viewport_path); - - ClassDB::bind_method(D_METHOD("set_centered","centered"),&ViewportSprite::set_centered); - ClassDB::bind_method(D_METHOD("is_centered"),&ViewportSprite::is_centered); - - ClassDB::bind_method(D_METHOD("set_offset","offset"),&ViewportSprite::set_offset); - ClassDB::bind_method(D_METHOD("get_offset"),&ViewportSprite::get_offset); - - ClassDB::bind_method(D_METHOD("set_modulate","modulate"),&ViewportSprite::set_modulate); - ClassDB::bind_method(D_METHOD("get_modulate"),&ViewportSprite::get_modulate); - - ADD_PROPERTYNZ( PropertyInfo( Variant::NODE_PATH, "viewport"), "set_viewport_path","get_viewport_path"); - ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "centered"), "set_centered","is_centered"); - ADD_PROPERTYNZ( PropertyInfo( Variant::VECTOR2, "offset"), "set_offset","get_offset"); - ADD_PROPERTYNO( PropertyInfo( Variant::COLOR, "modulate"), "set_modulate","get_modulate"); - -} - -ViewportSprite::ViewportSprite() { - - centered=true; - modulate=Color(1,1,1,1); -} -#endif diff --git a/scene/2d/sprite.h b/scene/2d/sprite.h index 64d30325f2..1bef73c0a5 100644 --- a/scene/2d/sprite.h +++ b/scene/2d/sprite.h @@ -62,9 +62,10 @@ protected: virtual void _validate_property(PropertyInfo &property) const; public: - virtual void edit_set_pivot(const Point2 &p_pivot); - virtual Point2 edit_get_pivot() const; - virtual bool edit_has_pivot() const; + virtual void _edit_set_pivot(const Point2 &p_pivot); + virtual Point2 _edit_get_pivot() const; + virtual bool _edit_use_pivot() const; + virtual Rect2 _edit_get_rect() const; void set_texture(const Ref<Texture> &p_texture); Ref<Texture> get_texture() const; @@ -102,53 +103,7 @@ public: void set_hframes(int p_amount); int get_hframes() const; - virtual Rect2 get_item_rect() const; - Sprite(); }; -#if 0 -class ViewportSprite : public Node2D { - - GDCLASS( ViewportSprite, Node2D ); - - Ref<Texture> texture; - NodePath viewport_path; - - bool centered; - Point2 offset; - Color modulate; - -protected: - - void _notification(int p_what); - - static void _bind_methods(); - -public: - - virtual void edit_set_pivot(const Point2& p_pivot); - virtual Point2 edit_get_pivot() const; - virtual bool edit_has_pivot() const; - - void set_viewport_path(const NodePath& p_viewport); - NodePath get_viewport_path() const; - - void set_centered(bool p_center); - bool is_centered() const; - - void set_offset(const Point2& p_offset); - Point2 get_offset() const; - - void set_modulate(const Color& p_color); - Color get_modulate() const; - - virtual Rect2 get_item_rect() const; - - virtual String get_configuration_warning() const; - - ViewportSprite(); -}; - -#endif #endif // SPRITE_H diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 5fb9e3f527..f067b5a187 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -459,9 +459,9 @@ void TileMap::_update_dirty_quadrants() { Transform2D xform; xform.set_origin(offset.floor()); - _fix_cell_transform(xform, c, center_ofs, s); + Vector2 shape_ofs = tile_set->tile_get_shape_offset(c.id, i); - xform *= shapes[i].shape_transform; + _fix_cell_transform(xform, c, shape_ofs + center_ofs, s); if (debug_canvas_item.is_valid()) { vs->canvas_item_add_set_transform(debug_canvas_item, xform); @@ -883,7 +883,7 @@ PoolVector<int> TileMap::_get_tile_data() const { return data; } -Rect2 TileMap::get_item_rect() const { +Rect2 TileMap::_edit_get_rect() const { const_cast<TileMap *>(this)->_update_dirty_quadrants(); return rect_cache; diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 706b87cec3..9e14ec838a 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -229,7 +229,7 @@ public: void set_cellv(const Vector2 &p_pos, int p_tile, bool p_flip_x = false, bool p_flip_y = false, bool p_transpose = false); int get_cellv(const Vector2 &p_pos) const; - Rect2 get_item_rect() const; + Rect2 _edit_get_rect() const; void set_collision_layer(uint32_t p_layer); uint32_t get_collision_layer() const; diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index b0fd57baf5..298bc2649e 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -83,7 +83,7 @@ void VisibilityNotifier2D::set_rect(const Rect2 &p_rect) { _change_notify("rect"); } -Rect2 VisibilityNotifier2D::get_item_rect() const { +Rect2 VisibilityNotifier2D::_edit_get_rect() const { return rect; } diff --git a/scene/2d/visibility_notifier_2d.h b/scene/2d/visibility_notifier_2d.h index ee5152978b..6e06833912 100644 --- a/scene/2d/visibility_notifier_2d.h +++ b/scene/2d/visibility_notifier_2d.h @@ -54,13 +54,13 @@ protected: static void _bind_methods(); public: + virtual Rect2 _edit_get_rect() const; + void set_rect(const Rect2 &p_rect); Rect2 get_rect() const; bool is_on_screen() const; - virtual Rect2 get_item_rect() const; - VisibilityNotifier2D(); }; diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index 382cbb8f38..a6d812efec 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -117,7 +117,7 @@ Vector<Point2> CollisionPolygon::get_polygon() const { return polygon; } -Rect3 CollisionPolygon::get_item_rect() const { +AABB CollisionPolygon::get_item_rect() const { return aabb; } @@ -176,7 +176,7 @@ void CollisionPolygon::_bind_methods() { CollisionPolygon::CollisionPolygon() { - aabb = Rect3(Vector3(-1, -1, -1), Vector3(2, 2, 2)); + aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2)); depth = 1.0; set_notify_local_transform(true); parent = NULL; diff --git a/scene/3d/collision_polygon.h b/scene/3d/collision_polygon.h index dbed1d7154..14d8c3aba6 100644 --- a/scene/3d/collision_polygon.h +++ b/scene/3d/collision_polygon.h @@ -40,7 +40,7 @@ class CollisionPolygon : public Spatial { protected: float depth; - Rect3 aabb; + AABB aabb; Vector<Point2> polygon; uint32_t owner_id; @@ -64,7 +64,7 @@ public: void set_disabled(bool p_disabled); bool is_disabled() const; - virtual Rect3 get_item_rect() const; + virtual AABB get_item_rect() const; String get_configuration_warning() const; diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index c0ca358717..05d5d52d28 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -31,12 +31,12 @@ #include "mesh_instance.h" -void GIProbeData::set_bounds(const Rect3 &p_bounds) { +void GIProbeData::set_bounds(const AABB &p_bounds) { VS::get_singleton()->gi_probe_set_bounds(probe, p_bounds); } -Rect3 GIProbeData::get_bounds() const { +AABB GIProbeData::get_bounds() const { return VS::get_singleton()->gi_probe_get_bounds(probe); } @@ -180,7 +180,7 @@ void GIProbeData::_bind_methods() { ClassDB::bind_method(D_METHOD("set_compress", "compress"), &GIProbeData::set_compress); ClassDB::bind_method(D_METHOD("is_compressed"), &GIProbeData::is_compressed); - ADD_PROPERTY(PropertyInfo(Variant::RECT3, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds"); + ADD_PROPERTY(PropertyInfo(Variant::AABB, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_size", "get_cell_size"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "to_cell_xform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_to_cell_xform", "get_to_cell_xform"); @@ -410,7 +410,7 @@ static bool planeBoxOverlap(Vector3 normal, float d, Vector3 maxbox) { rad = fa * boxhalfsize.x + fb * boxhalfsize.z; \ if (min > rad || max < -rad) return false; -/*======================== Z-tests ========================*/ + /*======================== Z-tests ========================*/ #define AXISTEST_Z12(a, b, fa, fb) \ p1 = a * v1.x - b * v1.y; \ @@ -542,7 +542,7 @@ static _FORCE_INLINE_ Vector2 get_uv(const Vector3 &p_pos, const Vector3 *p_vtx, return p_uv[0] * u + p_uv[1] * v + p_uv[2] * w; } -void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const Rect3 &p_aabb, Baker *p_baker) { +void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const AABB &p_aabb, Baker *p_baker) { if (p_level == p_baker->cell_subdiv - 1) { //plot the face by guessing it's albedo and emission value @@ -702,7 +702,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons int half = (1 << (p_baker->cell_subdiv - 1)) >> (p_level + 1); for (int i = 0; i < 8; i++) { - Rect3 aabb = p_aabb; + AABB aabb = p_aabb; aabb.size *= 0.5; int nx = p_x; @@ -726,7 +726,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons continue; { - Rect3 test_aabb = aabb; + AABB test_aabb = aabb; //test_aabb.grow_by(test_aabb.get_longest_axis_size()*0.05); //grow a bit to avoid numerical error in real-time Vector3 qsize = test_aabb.size * 0.5; //quarter size, for fast aabb test @@ -891,7 +891,7 @@ void GIProbe::_fixup_plot(int p_idx, int p_level, int p_x, int p_y, int p_z, Bak } } -Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_color) { +Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_color_mul, const Color &p_color_add) { Vector<Color> ret; @@ -899,7 +899,7 @@ Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_colo ret.resize(bake_texture_size * bake_texture_size); for (int i = 0; i < bake_texture_size * bake_texture_size; i++) { - ret[i] = p_color; + ret[i] = p_color_add; } return ret; @@ -919,9 +919,10 @@ Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_colo for (int i = 0; i < bake_texture_size * bake_texture_size; i++) { Color c; - c.r = (r[i * 4 + 0] / 255.0) * p_color.r; - c.g = (r[i * 4 + 1] / 255.0) * p_color.g; - c.b = (r[i * 4 + 2] / 255.0) * p_color.b; + c.r = (r[i * 4 + 0] / 255.0) * p_color_mul.r + p_color_add.r; + c.g = (r[i * 4 + 1] / 255.0) * p_color_mul.g + p_color_add.g; + c.b = (r[i * 4 + 2] / 255.0) * p_color_mul.b + p_color_add.b; + c.a = r[i * 4 + 3] / 255.0; ret[i] = c; @@ -951,17 +952,15 @@ GIProbe::Baker::MaterialCache GIProbe::_get_material_cache(Ref<Material> p_mater if (albedo_tex.is_valid()) { img_albedo = albedo_tex->get_data(); + mc.albedo = _get_bake_texture(img_albedo, mat->get_albedo(), Color(0, 0, 0)); // albedo texture, color is multiplicative } else { + mc.albedo = _get_bake_texture(img_albedo, Color(1, 1, 1), mat->get_albedo()); // no albedo texture, color is additive } - mc.albedo = _get_bake_texture(img_albedo, mat->get_albedo()); - - Ref<ImageTexture> emission_tex = mat->get_texture(SpatialMaterial::TEXTURE_EMISSION); + Ref<Texture> emission_tex = mat->get_texture(SpatialMaterial::TEXTURE_EMISSION); Color emission_col = mat->get_emission(); - emission_col.r *= mat->get_emission_energy(); - emission_col.g *= mat->get_emission_energy(); - emission_col.b *= mat->get_emission_energy(); + float emission_energy = mat->get_emission_energy(); Ref<Image> img_emission; @@ -970,13 +969,17 @@ GIProbe::Baker::MaterialCache GIProbe::_get_material_cache(Ref<Material> p_mater img_emission = emission_tex->get_data(); } - mc.emission = _get_bake_texture(img_emission, emission_col); + if (mat->get_emission_operator() == SpatialMaterial::EMISSION_OP_ADD) { + mc.emission = _get_bake_texture(img_emission, Color(1, 1, 1) * emission_energy, emission_col * emission_energy); + } else { + mc.emission = _get_bake_texture(img_emission, emission_col * emission_energy, Color(0, 0, 0)); + } } else { Ref<Image> empty; - mc.albedo = _get_bake_texture(empty, Color(0.7, 0.7, 0.7)); - mc.emission = _get_bake_texture(empty, Color(0, 0, 0)); + mc.albedo = _get_bake_texture(empty, Color(0, 0, 0), Color(1, 1, 1)); + mc.emission = _get_bake_texture(empty, Color(0, 0, 0), Color(0, 0, 0)); } p_baker->material_cache[p_material] = mc; @@ -1080,11 +1083,11 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) { Ref<Mesh> mesh = mi->get_mesh(); if (mesh.is_valid()) { - Rect3 aabb = mesh->get_aabb(); + AABB aabb = mesh->get_aabb(); Transform xf = get_global_transform().affine_inverse() * mi->get_global_transform(); - if (Rect3(-extents, extents * 2).intersects(xf.xform(aabb))) { + if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) { Baker::PlotMesh pm; pm.local_xform = xf; pm.mesh = mesh; @@ -1110,11 +1113,11 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) { if (!mesh.is_valid()) continue; - Rect3 aabb = mesh->get_aabb(); + AABB aabb = mesh->get_aabb(); Transform xf = get_global_transform().affine_inverse() * (s->get_global_transform() * mxf); - if (Rect3(-extents, extents * 2).intersects(xf.xform(aabb))) { + if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) { Baker::PlotMesh pm; pm.local_xform = xf; pm.mesh = mesh; @@ -1148,7 +1151,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) { baker.bake_cells.resize(1); //find out the actual real bounds, power of 2, which gets the highest subdivision - baker.po2_bounds = Rect3(-extents, extents * 2.0); + baker.po2_bounds = AABB(-extents, extents * 2.0); int longest_axis = baker.po2_bounds.get_longest_axis_index(); baker.axis_cell_size[longest_axis] = (1 << (baker.cell_subdiv - 1)); baker.leaf_voxel_count = 0; @@ -1283,7 +1286,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) { Ref<GIProbeData> probe_data; probe_data.instance(); - probe_data->set_bounds(Rect3(-extents, extents * 2.0)); + probe_data->set_bounds(AABB(-extents, extents * 2.0)); probe_data->set_cell_size(baker.po2_bounds.size[longest_axis] / baker.axis_cell_size[longest_axis]); probe_data->set_dynamic_data(data); probe_data->set_dynamic_range(dynamic_range); @@ -1303,7 +1306,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) { } } -void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker) { +void GIProbe::_debug_mesh(int p_idx, int p_level, const AABB &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker) { if (p_level == p_baker->cell_subdiv - 1) { @@ -1325,7 +1328,7 @@ void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<Multi if (p_baker->bake_cells[p_idx].childs[i] == Baker::CHILD_EMPTY) continue; - Rect3 aabb = p_aabb; + AABB aabb = p_aabb; aabb.size *= 0.5; if (i & 1) @@ -1437,9 +1440,9 @@ void GIProbe::_debug_bake() { bake(NULL, true); } -Rect3 GIProbe::get_aabb() const { +AABB GIProbe::get_aabb() const { - return Rect3(-extents, extents * 2); + return AABB(-extents, extents * 2); } PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index 50d0c33d4f..324ff8e917 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -43,8 +43,8 @@ protected: static void _bind_methods(); public: - void set_bounds(const Rect3 &p_bounds); - Rect3 get_bounds() const; + void set_bounds(const AABB &p_bounds); + AABB get_bounds() const; void set_cell_size(float p_size); float get_cell_size() const; @@ -146,7 +146,7 @@ private: MaterialCache _get_material_cache(Ref<Material> p_material); int leaf_voxel_count; - Rect3 po2_bounds; + AABB po2_bounds; int axis_cell_size[3]; struct PlotMesh { @@ -178,14 +178,14 @@ private: int color_scan_cell_width; int bake_texture_size; - Vector<Color> _get_bake_texture(Ref<Image> p_image, const Color &p_color); + Vector<Color> _get_bake_texture(Ref<Image> p_image, const Color &p_color_mul, const Color &p_color_add); Baker::MaterialCache _get_material_cache(Ref<Material> p_material, Baker *p_baker); - void _plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const Rect3 &p_aabb, Baker *p_baker); + void _plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const AABB &p_aabb, Baker *p_baker); void _plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, Baker *p_baker, const Vector<Ref<Material> > &p_materials, const Ref<Material> &p_override_material); void _find_meshes(Node *p_at_node, Baker *p_baker); void _fixup_plot(int p_idx, int p_level, int p_x, int p_y, int p_z, Baker *p_baker); - void _debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker); + void _debug_mesh(int p_idx, int p_level, const AABB &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker); void _create_debug_mesh(Baker *p_baker); void _debug_bake(); @@ -230,7 +230,7 @@ public: void bake(Node *p_from_node = NULL, bool p_create_visual_debug = false); - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; GIProbe(); diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp index 11f7efe066..092ed8f0b2 100644 --- a/scene/3d/immediate_geometry.cpp +++ b/scene/3d/immediate_geometry.cpp @@ -85,7 +85,7 @@ void ImmediateGeometry::clear() { cached_textures.clear(); } -Rect3 ImmediateGeometry::get_aabb() const { +AABB ImmediateGeometry::get_aabb() const { return aabb; } diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index 93ef726c6d..1ff4e05e82 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -42,7 +42,7 @@ class ImmediateGeometry : public GeometryInstance { // in VisualServer from becoming invalid if the texture is no longer used List<Ref<Texture> > cached_textures; bool empty; - Rect3 aabb; + AABB aabb; protected: static void _bind_methods(); @@ -62,7 +62,7 @@ public: void add_sphere(int p_lats, int p_lons, float p_radius, bool p_add_uv = true); - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; ImmediateGeometry(); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 389d87cd90..324411c5cc 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -117,24 +117,24 @@ bool Light::get_shadow_reverse_cull_face() const { return reverse_cull; } -Rect3 Light::get_aabb() const { +AABB Light::get_aabb() const { if (type == VisualServer::LIGHT_DIRECTIONAL) { - return Rect3(Vector3(-1, -1, -1), Vector3(2, 2, 2)); + return AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2)); } else if (type == VisualServer::LIGHT_OMNI) { - return Rect3(Vector3(-1, -1, -1) * param[PARAM_RANGE], Vector3(2, 2, 2) * param[PARAM_RANGE]); + return AABB(Vector3(-1, -1, -1) * param[PARAM_RANGE], Vector3(2, 2, 2) * param[PARAM_RANGE]); } else if (type == VisualServer::LIGHT_SPOT) { float len = param[PARAM_RANGE]; float size = Math::tan(Math::deg2rad(param[PARAM_SPOT_ANGLE])) * len; - return Rect3(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len)); + return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len)); } - return Rect3(); + return AABB(); } PoolVector<Face3> Light::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/light.h b/scene/3d/light.h index 2f3ac8a5e7..37c17cbbe3 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -113,7 +113,7 @@ public: void set_shadow_reverse_cull_face(bool p_enable); bool get_shadow_reverse_cull_face() const; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; Light(); diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index c8215971c4..1e52ccc6e0 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -165,12 +165,12 @@ NodePath MeshInstance::get_skeleton_path() { return skeleton_path; } -Rect3 MeshInstance::get_aabb() const { +AABB MeshInstance::get_aabb() const { if (!mesh.is_null()) return mesh->get_aabb(); - return Rect3(); + return AABB(); } PoolVector<Face3> MeshInstance::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h index 8e8c12a592..970a10aaf3 100644 --- a/scene/3d/mesh_instance.h +++ b/scene/3d/mesh_instance.h @@ -85,7 +85,7 @@ public: void create_debug_tangents(); - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; MeshInstance(); diff --git a/scene/3d/multimesh_instance.cpp b/scene/3d/multimesh_instance.cpp index f90489f1f0..ce7b97be7f 100644 --- a/scene/3d/multimesh_instance.cpp +++ b/scene/3d/multimesh_instance.cpp @@ -55,10 +55,10 @@ PoolVector<Face3> MultiMeshInstance::get_faces(uint32_t p_usage_flags) const { return PoolVector<Face3>(); } -Rect3 MultiMeshInstance::get_aabb() const { +AABB MultiMeshInstance::get_aabb() const { if (multimesh.is_null()) - return Rect3(); + return AABB(); else return multimesh->get_aabb(); } diff --git a/scene/3d/multimesh_instance.h b/scene/3d/multimesh_instance.h index cd0e7b463c..9b2b1ff9a7 100644 --- a/scene/3d/multimesh_instance.h +++ b/scene/3d/multimesh_instance.h @@ -52,7 +52,7 @@ public: void set_multimesh(const Ref<MultiMesh> &p_multimesh); Ref<MultiMesh> get_multimesh() const; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; MultiMeshInstance(); ~MultiMeshInstance(); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 6ac6e52367..915a10328b 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -31,9 +31,9 @@ #include "scene/resources/surface_tool.h" #include "servers/visual_server.h" -Rect3 Particles::get_aabb() const { +AABB Particles::get_aabb() const { - return Rect3(); + return AABB(); } PoolVector<Face3> Particles::get_faces(uint32_t p_usage_flags) const { @@ -82,7 +82,7 @@ void Particles::set_randomness_ratio(float p_ratio) { randomness_ratio = p_ratio; VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio); } -void Particles::set_visibility_aabb(const Rect3 &p_aabb) { +void Particles::set_visibility_aabb(const AABB &p_aabb) { visibility_aabb = p_aabb; VS::get_singleton()->particles_set_custom_aabb(particles, visibility_aabb); @@ -140,7 +140,7 @@ float Particles::get_randomness_ratio() const { return randomness_ratio; } -Rect3 Particles::get_visibility_aabb() const { +AABB Particles::get_visibility_aabb() const { return visibility_aabb; } @@ -252,7 +252,7 @@ void Particles::restart() { VisualServer::get_singleton()->particles_restart(particles); } -Rect3 Particles::capture_aabb() const { +AABB Particles::capture_aabb() const { return VS::get_singleton()->particles_get_current_aabb(particles); } @@ -335,7 +335,7 @@ void Particles::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta"); ADD_GROUP("Drawing", ""); - ADD_PROPERTY(PropertyInfo(Variant::RECT3, "visibility_aabb"), "set_visibility_aabb", "get_visibility_aabb"); + ADD_PROPERTY(PropertyInfo(Variant::AABB, "visibility_aabb"), "set_visibility_aabb", "get_visibility_aabb"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates"); ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime,View Depth"), "set_draw_order", "get_draw_order"); ADD_GROUP("Process Material", ""); @@ -367,7 +367,7 @@ Particles::Particles() { set_pre_process_time(0); set_explosiveness_ratio(0); set_randomness_ratio(0); - set_visibility_aabb(Rect3(Vector3(-4, -4, -4), Vector3(8, 8, 8))); + set_visibility_aabb(AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8))); set_use_local_coordinates(true); set_draw_passes(1); set_draw_order(DRAW_ORDER_INDEX); diff --git a/scene/3d/particles.h b/scene/3d/particles.h index e3109f470f..30080360bb 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -65,7 +65,7 @@ private: float explosiveness_ratio; float randomness_ratio; float speed_scale; - Rect3 visibility_aabb; + AABB visibility_aabb; bool local_coords; int fixed_fps; bool fractional_delta; @@ -82,7 +82,7 @@ protected: virtual void _validate_property(PropertyInfo &property) const; public: - Rect3 get_aabb() const; + AABB get_aabb() const; PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_emitting(bool p_emitting); @@ -92,7 +92,7 @@ public: void set_pre_process_time(float p_time); void set_explosiveness_ratio(float p_ratio); void set_randomness_ratio(float p_ratio); - void set_visibility_aabb(const Rect3 &p_aabb); + void set_visibility_aabb(const AABB &p_aabb); void set_use_local_coordinates(bool p_enable); void set_process_material(const Ref<Material> &p_material); void set_speed_scale(float p_scale); @@ -104,7 +104,7 @@ public: float get_pre_process_time() const; float get_explosiveness_ratio() const; float get_randomness_ratio() const; - Rect3 get_visibility_aabb() const; + AABB get_visibility_aabb() const; bool get_use_local_coordinates() const; Ref<Material> get_process_material() const; float get_speed_scale() const; @@ -128,7 +128,7 @@ public: void restart(); - Rect3 capture_aabb() const; + AABB capture_aabb() const; Particles(); ~Particles(); }; diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp index 6c14f7dbc9..4fde29aab9 100644 --- a/scene/3d/portal.cpp +++ b/scene/3d/portal.cpp @@ -98,7 +98,7 @@ void Portal::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::REAL, "connect_range", PROPERTY_HINT_RANGE, "0.1,4096,0.01")); } -Rect3 Portal::get_aabb() const { +AABB Portal::get_aabb() const { return aabb; } diff --git a/scene/3d/portal.h b/scene/3d/portal.h index 6de3df8553..4ea208a718 100644 --- a/scene/3d/portal.h +++ b/scene/3d/portal.h @@ -53,7 +53,7 @@ class Portal : public VisualInstance { Color disabled_color; float connect_range; - Rect3 aabb; + AABB aabb; protected: bool _set(const StringName &p_name, const Variant &p_value); @@ -63,7 +63,7 @@ protected: static void _bind_methods(); public: - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_enabled(bool p_enabled); diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index 46b105cd21..0e575ec152 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -178,9 +178,9 @@ ReflectionProbe::UpdateMode ReflectionProbe::get_update_mode() const { return update_mode; } -Rect3 ReflectionProbe::get_aabb() const { +AABB ReflectionProbe::get_aabb() const { - Rect3 aabb; + AABB aabb; aabb.position = -origin_offset; aabb.size = origin_offset + extents; return aabb; diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h index 7c328a8f16..26f17fdcf9 100644 --- a/scene/3d/reflection_probe.h +++ b/scene/3d/reflection_probe.h @@ -101,7 +101,7 @@ public: void set_update_mode(UpdateMode p_mode); UpdateMode get_update_mode() const; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; ReflectionProbe(); diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 439b6bfdf8..47a7b8bfb9 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -66,12 +66,12 @@ void Room::_notification(int p_what) { } } -Rect3 Room::get_aabb() const { +AABB Room::get_aabb() const { if (room.is_null()) - return Rect3(); + return AABB(); - return Rect3(); + return AABB(); } PoolVector<Face3> Room::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h index b9a64b6670..3069ea2eba 100644 --- a/scene/3d/room_instance.h +++ b/scene/3d/room_instance.h @@ -71,7 +71,7 @@ public: NOTIFICATION_AREA_CHANGED = 60 }; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_room(const Ref<RoomBounds> &p_room); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 49a3205f21..18ebc22c8b 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -188,7 +188,7 @@ void SpriteBase3D::_queue_update() { call_deferred(SceneStringNames::get_singleton()->_im_update); } -Rect3 SpriteBase3D::get_aabb() const { +AABB SpriteBase3D::get_aabb() const { return aabb; } @@ -407,7 +407,7 @@ void Sprite3D::_draw() { } } - Rect3 aabb; + AABB aabb; for (int i = 0; i < 4; i++) { VS::get_singleton()->immediate_normal(immediate, normal); @@ -698,7 +698,7 @@ void AnimatedSprite3D::_draw() { } } - Rect3 aabb; + AABB aabb; for (int i = 0; i < 4; i++) { VS::get_singleton()->immediate_normal(immediate, normal); diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index 1165392cb2..d18553a504 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -71,7 +71,7 @@ private: Vector3::Axis axis; float pixel_size; - Rect3 aabb; + AABB aabb; RID immediate; @@ -87,7 +87,7 @@ protected: void _notification(int p_what); static void _bind_methods(); virtual void _draw() = 0; - _FORCE_INLINE_ void set_aabb(const Rect3 &p_aabb) { aabb = p_aabb; } + _FORCE_INLINE_ void set_aabb(const AABB &p_aabb) { aabb = p_aabb; } _FORCE_INLINE_ RID &get_immediate() { return immediate; } void _queue_update(); @@ -130,7 +130,7 @@ public: virtual Rect2 get_item_rect() const = 0; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; SpriteBase3D(); diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index e60b32a92a..47144c4b78 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -60,7 +60,7 @@ void VisibilityNotifier::_exit_camera(Camera *p_camera) { } } -void VisibilityNotifier::set_aabb(const Rect3 &p_aabb) { +void VisibilityNotifier::set_aabb(const AABB &p_aabb) { if (aabb == p_aabb) return; @@ -74,7 +74,7 @@ void VisibilityNotifier::set_aabb(const Rect3 &p_aabb) { update_gizmo(); } -Rect3 VisibilityNotifier::get_aabb() const { +AABB VisibilityNotifier::get_aabb() const { return aabb; } @@ -108,7 +108,7 @@ void VisibilityNotifier::_bind_methods() { ClassDB::bind_method(D_METHOD("get_aabb"), &VisibilityNotifier::get_aabb); ClassDB::bind_method(D_METHOD("is_on_screen"), &VisibilityNotifier::is_on_screen); - ADD_PROPERTY(PropertyInfo(Variant::RECT3, "aabb"), "set_aabb", "get_aabb"); + ADD_PROPERTY(PropertyInfo(Variant::AABB, "aabb"), "set_aabb", "get_aabb"); ADD_SIGNAL(MethodInfo("camera_entered", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"))); ADD_SIGNAL(MethodInfo("camera_exited", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"))); @@ -118,7 +118,7 @@ void VisibilityNotifier::_bind_methods() { VisibilityNotifier::VisibilityNotifier() { - aabb = Rect3(Vector3(-1, -1, -1), Vector3(2, 2, 2)); + aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2)); set_notify_transform(true); } diff --git a/scene/3d/visibility_notifier.h b/scene/3d/visibility_notifier.h index 0b83e0534e..fc06cf5aec 100644 --- a/scene/3d/visibility_notifier.h +++ b/scene/3d/visibility_notifier.h @@ -39,7 +39,7 @@ class VisibilityNotifier : public Spatial { Set<Camera *> cameras; - Rect3 aabb; + AABB aabb; protected: virtual void _screen_enter() {} @@ -53,8 +53,8 @@ protected: void _exit_camera(Camera *p_camera); public: - void set_aabb(const Rect3 &p_aabb); - Rect3 get_aabb() const; + void set_aabb(const AABB &p_aabb); + AABB get_aabb() const; bool is_on_screen() const; VisibilityNotifier(); diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index fa35d982eb..b92e7ead04 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -33,7 +33,7 @@ #include "servers/visual_server.h" #include "skeleton.h" -Rect3 VisualInstance::get_transformed_aabb() const { +AABB VisualInstance::get_transformed_aabb() const { return get_global_transform().xform(get_aabb()); } diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index c405236d2c..5827f1e1fb 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -62,10 +62,10 @@ public: }; RID get_instance() const; - virtual Rect3 get_aabb() const = 0; + virtual AABB get_aabb() const = 0; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const = 0; - virtual Rect3 get_transformed_aabb() const; // helper + virtual AABB get_transformed_aabb() const; // helper void set_base(const RID &p_base); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 80b7748078..6be3ff88d9 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -545,7 +545,14 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f } else { - next_pos = Math::fposmod(next_pos, len); + float looped_next_pos = Math::fposmod(next_pos, len); + if (looped_next_pos == 0 && next_pos != 0) { + // Loop multiples of the length to it, rather than 0 + // so state at time=length is previewable in the editor + next_pos = len; + } else { + next_pos = looped_next_pos; + } } cd.pos = next_pos; diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index e0508cf147..40d06dc756 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -416,10 +416,10 @@ Variant Tween::_run_equation(InterpolateData &p_data) { result = r; } break; - case Variant::RECT3: { - Rect3 i = initial_val; - Rect3 d = delta_val; - Rect3 r; + case Variant::AABB: { + AABB i = initial_val; + AABB d = delta_val; + AABB r; APPLY_EQUATION(position.x); APPLY_EQUATION(position.y); @@ -956,10 +956,10 @@ bool Tween::_calc_delta_val(const Variant &p_initial_val, const Variant &p_final case Variant::QUAT: delta_val = final_val.operator Quat() - initial_val.operator Quat(); break; - case Variant::RECT3: { - Rect3 i = initial_val; - Rect3 f = final_val; - delta_val = Rect3(f.position - i.position, f.size - i.size); + case Variant::AABB: { + AABB i = initial_val; + AABB f = final_val; + delta_val = AABB(f.position - i.position, f.size - i.size); } break; case Variant::TRANSFORM: { Transform i = initial_val; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index e73ada9f31..adca78d1d4 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -45,7 +45,7 @@ #endif #include <stdio.h> -Variant Control::edit_get_state() const { +Dictionary Control::_edit_get_state() const { Dictionary s; s["rect"] = get_rect(); @@ -59,22 +59,78 @@ Variant Control::edit_get_state() const { s["anchors"] = anchors; return s; } -void Control::edit_set_state(const Variant &p_state) { +void Control::_edit_set_state(const Dictionary &p_state) { - Dictionary s = p_state; + Dictionary state = p_state; - Rect2 state = s["rect"]; - set_position(state.position); - set_size(state.size); - set_rotation(s["rotation"]); - set_scale(s["scale"]); - Array anchors = s["anchors"]; + Rect2 rect = state["rect"]; + set_position(rect.position); + set_size(rect.size); + set_rotation(state["rotation"]); + set_scale(state["scale"]); + Array anchors = state["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::_edit_set_position(const Point2 &p_position) { + set_position(p_position); +}; + +Point2 Control::_edit_get_position() const { + return get_position(); +}; + +void Control::_edit_set_rect(const Rect2 &p_edit_rect) { + + Transform2D xform = _get_internal_transform(); + + Vector2 new_pos = xform.basis_xform(p_edit_rect.position); + + Vector2 pos = get_position() + new_pos; + + Rect2 new_rect = get_rect(); + new_rect.position = pos.snapped(Vector2(1, 1)); + new_rect.size = p_edit_rect.size.snapped(Vector2(1, 1)); + + set_position(new_rect.position); + set_size(new_rect.size); +} + +Rect2 Control::_edit_get_rect() const { + return Rect2(Point2(), get_size()); +} + +bool Control::_edit_use_rect() const { + return true; +} + +void Control::_edit_set_rotation(float p_rotation) { + set_rotation(p_rotation); +} + +float Control::_edit_get_rotation() const { + return get_rotation(); +} + +bool Control::_edit_use_rotation() const { + return true; +} + +void Control::_edit_set_pivot(const Point2 &p_pivot) { + set_pivot_offset(p_pivot); +} + +Point2 Control::_edit_get_pivot() const { + return get_pivot_offset(); +} + +bool Control::_edit_use_pivot() const { + return true; +} + void Control::set_custom_minimum_size(const Size2 &p_custom) { if (p_custom == data.custom_minimum_size) @@ -96,7 +152,7 @@ Size2 Control::get_combined_minimum_size() const { return minsize; } -Size2 Control::edit_get_minimum_size() const { +Size2 Control::_edit_get_minimum_size() const { return get_combined_minimum_size(); } @@ -110,23 +166,6 @@ Transform2D Control::_get_internal_transform() const { return offset.affine_inverse() * (rot_scale * offset); } -void Control::edit_set_rect(const Rect2 &p_edit_rect) { - - Transform2D xform = _get_internal_transform(); - - // xform[2] += get_position(); - - Vector2 new_pos = xform.basis_xform(p_edit_rect.position); - - Vector2 pos = get_position() + new_pos; - - Rect2 new_rect = get_rect(); - new_rect.position = pos.snapped(Vector2(1, 1)); - new_rect.size = p_edit_rect.size.snapped(Vector2(1, 1)); - - set_position(new_rect.position); - set_size(new_rect.size); -} bool Control::_set(const StringName &p_name, const Variant &p_value) { @@ -1210,7 +1249,7 @@ Size2 Control::get_parent_area_size() const { if (data.parent_canvas_item) { - parent_size = data.parent_canvas_item->get_item_rect().size; + parent_size = data.parent_canvas_item->_edit_get_rect().size; } else { parent_size = get_viewport()->get_visible_rect().size; @@ -1289,7 +1328,7 @@ float Control::_get_parent_range(int p_idx) const { } if (data.parent_canvas_item) { - return data.parent_canvas_item->get_item_rect().size[p_idx & 1]; + return data.parent_canvas_item->_edit_get_rect().size[p_idx & 1]; } else { return get_viewport()->get_visible_rect().size[p_idx & 1]; } @@ -1751,11 +1790,6 @@ Rect2 Control::get_rect() const { return Rect2(get_position(), get_size()); } -Rect2 Control::get_item_rect() const { - - return Rect2(Point2(), get_size()); -} - void Control::add_icon_override(const StringName &p_name, const Ref<Texture> &p_icon) { ERR_FAIL_COND(p_icon.is_null()); @@ -1847,6 +1881,25 @@ Control *Control::find_next_valid_focus() const { while (true) { + // If the focus property is manually overwritten, attempt to use it. + + if (!data.focus_next.is_empty()) { + Node *n = get_node(data.focus_next); + if (n) { + from = Object::cast_to<Control>(n); + + if (!from) { + + ERR_EXPLAIN("Next focus node is not a control: " + n->get_name()); + ERR_FAIL_V(NULL); + } + } else { + return NULL; + } + if (from->is_visible() && from->get_focus_mode() != FOCUS_NONE) + return from; + } + // find next child Control *next_child = NULL; @@ -1926,6 +1979,25 @@ Control *Control::find_prev_valid_focus() const { while (true) { + // If the focus property is manually overwritten, attempt to use it. + + if (!data.focus_prev.is_empty()) { + Node *n = get_node(data.focus_prev); + if (n) { + from = Object::cast_to<Control>(n); + + if (!from) { + + ERR_EXPLAIN("Prev focus node is not a control: " + n->get_name()); + ERR_FAIL_V(NULL); + } + } else { + return NULL; + } + if (from->is_visible() && from->get_focus_mode() != FOCUS_NONE) + return from; + } + // find prev child Control *prev_child = NULL; @@ -2157,6 +2229,26 @@ NodePath Control::get_focus_neighbour(Margin p_margin) const { return data.focus_neighbour[p_margin]; } +void Control::set_focus_next(const NodePath &p_next) { + + data.focus_next = p_next; +} + +NodePath Control::get_focus_next() const { + + return data.focus_next; +} + +void Control::set_focus_previous(const NodePath &p_prev) { + + data.focus_prev = p_prev; +} + +NodePath Control::get_focus_previous() const { + + return data.focus_prev; +} + #define MAX_NEIGHBOUR_SEARCH_COUNT 512 Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) { @@ -2172,7 +2264,7 @@ Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) { if (!c) { - ERR_EXPLAIN("Next focus node is not a control: " + n->get_name()); + ERR_EXPLAIN("Neighbour focus node is not a control: " + n->get_name()); ERR_FAIL_V(NULL); } } else { @@ -2196,7 +2288,7 @@ Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) { Point2 points[4]; Transform2D xform = get_global_transform(); - Rect2 rect = get_item_rect(); + Rect2 rect = _edit_get_rect(); points[0] = xform.xform(rect.position); points[1] = xform.xform(rect.position + Point2(rect.size.x, 0)); @@ -2255,7 +2347,7 @@ void Control::_window_find_focus_neighbour(const Vector2 &p_dir, Node *p_at, con Point2 points[4]; Transform2D xform = c->get_global_transform(); - Rect2 rect = c->get_item_rect(); + Rect2 rect = c->_edit_get_rect(); points[0] = xform.xform(rect.position); points[1] = xform.xform(rect.position + Point2(rect.size.x, 0)); @@ -2677,6 +2769,12 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("set_focus_neighbour", "margin", "neighbour"), &Control::set_focus_neighbour); ClassDB::bind_method(D_METHOD("get_focus_neighbour", "margin"), &Control::get_focus_neighbour); + ClassDB::bind_method(D_METHOD("set_focus_next", "next"), &Control::set_focus_next); + ClassDB::bind_method(D_METHOD("get_focus_next"), &Control::get_focus_next); + + ClassDB::bind_method(D_METHOD("set_focus_previous", "previous"), &Control::set_focus_previous); + ClassDB::bind_method(D_METHOD("get_focus_previous"), &Control::get_focus_previous); + ClassDB::bind_method(D_METHOD("force_drag", "data", "preview"), &Control::force_drag); ClassDB::bind_method(D_METHOD("set_mouse_filter", "filter"), &Control::set_mouse_filter); @@ -2737,6 +2835,8 @@ void Control::_bind_methods() { ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_top"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_TOP); ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_right"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_RIGHT); ADD_PROPERTYINZ(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_bottom"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_BOTTOM); + ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "focus_next"), "set_focus_next", "get_focus_next"); + ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "focus_previous"), "set_focus_previous", "get_focus_previous"); ADD_GROUP("Mouse", "mouse_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_filter", PROPERTY_HINT_ENUM, "Stop,Pass,Ignore"), "set_mouse_filter", "get_mouse_filter"); diff --git a/scene/gui/control.h b/scene/gui/control.h index 4d0e3934ad..92d1c969fc 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -191,6 +191,8 @@ private: ObjectID modal_prev_focus_owner; NodePath focus_neighbour[4]; + NodePath focus_next; + NodePath focus_prev; HashMap<StringName, Ref<Texture>, StringNameHasher> icon_override; HashMap<StringName, Ref<Shader>, StringNameHasher> shader_override; @@ -269,10 +271,25 @@ public: }; - virtual Variant edit_get_state() const; - virtual void edit_set_state(const Variant &p_state); - virtual void edit_set_rect(const Rect2 &p_edit_rect); - virtual Size2 edit_get_minimum_size() const; + virtual Dictionary _edit_get_state() const; + virtual void _edit_set_state(const Dictionary &p_state); + + virtual void _edit_set_position(const Point2 &p_position); + virtual Point2 _edit_get_position() const; + + virtual void _edit_set_rect(const Rect2 &p_edit_rect); + virtual Rect2 _edit_get_rect() const; + virtual bool _edit_use_rect() const; + + virtual void _edit_set_rotation(float p_rotation); + virtual float _edit_get_rotation() const; + virtual bool _edit_use_rotation() const; + + virtual void _edit_set_pivot(const Point2 &p_pivot); + virtual Point2 _edit_get_pivot() const; + virtual bool _edit_use_pivot() const; + + virtual Size2 _edit_get_minimum_size() const; void accept_event(); @@ -374,6 +391,11 @@ public: void set_focus_neighbour(Margin p_margin, const NodePath &p_neighbour); NodePath get_focus_neighbour(Margin p_margin) const; + void set_focus_next(const NodePath &p_next); + NodePath get_focus_next() const; + void set_focus_previous(const NodePath &p_prev); + NodePath get_focus_previous() const; + Control *get_focus_owner() const; void set_mouse_filter(MouseFilter p_filter); @@ -420,7 +442,6 @@ public: CursorShape get_default_cursor_shape() const; virtual CursorShape get_cursor_shape(const Point2 &p_pos = Point2i()) const; - virtual Rect2 get_item_rect() const; virtual Transform2D get_transform() const; bool is_toplevel_control() const; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 5d3e5ec0e8..f7bf1cd9ea 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1309,6 +1309,7 @@ void LineEdit::set_expand_to_text_length(bool p_enabled) { expand_to_text_length = p_enabled; minimum_size_changed(); + set_window_pos(0); } bool LineEdit::get_expand_to_text_length() const { @@ -1428,7 +1429,7 @@ void LineEdit::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "max_length"), "set_max_length", "get_max_length"); ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "editable"), "set_editable", "is_editable"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "secret"), "set_secret", "is_secret"); - ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "expand_to_len"), "set_expand_to_text_length", "get_expand_to_text_length"); + ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "expand_to_text_length"), "set_expand_to_text_length", "get_expand_to_text_length"); ADD_PROPERTY(PropertyInfo(Variant::INT, "focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_focus_mode", "get_focus_mode"); ADD_GROUP("Placeholder", "placeholder_"); ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "placeholder_text"), "set_placeholder", "get_placeholder"); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 5d429f9f91..a1ecf291c1 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -274,6 +274,7 @@ void TextEdit::Text::insert(int p_at, const String &p_text) { Line line; line.marked = false; line.breakpoint = false; + line.hidden = false; line.width_cache = -1; line.data = p_text; text.insert(p_at, line); @@ -297,9 +298,11 @@ void TextEdit::_update_scrollbars() { int hscroll_rows = ((hmin.height - 1) / get_row_height()) + 1; int visible_rows = get_visible_rows(); - int total_rows = text.size(); + int num_rows = MAX(visible_rows, num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(visible_rows, text.size() - 1 - cursor.line_ofs))); + + int total_rows = (is_hiding_enabled() ? get_total_unhidden_rows() : text.size()); if (scroll_past_end_of_file_enabled) { - total_rows += get_visible_rows() - 1; + total_rows += visible_rows - 1; } int vscroll_pixels = v_scroll->get_combined_minimum_size().width; @@ -313,6 +316,10 @@ void TextEdit::_update_scrollbars() { total_width += cache.breakpoint_gutter_width; } + if (draw_fold_gutter) { + total_width += cache.fold_gutter_width; + } + bool use_hscroll = true; bool use_vscroll = true; @@ -347,12 +354,11 @@ void TextEdit::_update_scrollbars() { v_scroll->set_step(1); } - if (fabs(v_scroll->get_value() - (double)cursor.line_ofs) >= 1) { - v_scroll->set_value(cursor.line_ofs); - } - + update_line_scroll_pos(); } else { cursor.line_ofs = 0; + line_scroll_pos = 0; + v_scroll->set_value(0); v_scroll->hide(); } @@ -551,6 +557,13 @@ void TextEdit::_notification(int p_what) { cache.breakpoint_gutter_width = 0; } + if (draw_fold_gutter) { + fold_gutter_width = (get_row_height() * 55) / 100; + cache.fold_gutter_width = fold_gutter_width; + } else { + cache.fold_gutter_width = 0; + } + int line_number_char_count = 0; { @@ -573,7 +586,7 @@ void TextEdit::_notification(int p_what) { RID ci = get_canvas_item(); VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true); - int xmargin_beg = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width; + int xmargin_beg = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width; int xmargin_end = cache.size.width - cache.style_normal->get_margin(MARGIN_RIGHT); //let's do it easy for now: cache.style_normal->draw(ci, Rect2(Point2(), cache.size)); @@ -780,10 +793,22 @@ void TextEdit::_notification(int p_what) { String highlighted_text = get_selection_text(); String line_num_padding = line_numbers_zero_padded ? "0" : " "; + update_line_scroll_pos(); + int line = cursor.line_ofs - 1; for (int i = 0; i < visible_rows; i++) { - int line = i + cursor.line_ofs; + line++; + + if (line < 0 || line >= (int)text.size()) + continue; + + while (is_line_hidden(line)) { + line++; + if (line < 0 || line >= (int)text.size()) { + break; + } + } if (line < 0 || line >= (int)text.size()) continue; @@ -794,7 +819,7 @@ void TextEdit::_notification(int p_what) { int char_ofs = 0; int ofs_y = (i * get_row_height() + cache.line_spacing / 2); if (smooth_scroll_enabled) { - ofs_y -= (v_scroll->get_value() - cursor.line_ofs) * get_row_height(); + ofs_y -= (v_scroll->get_value() - get_line_scroll_pos()) * get_row_height(); } bool prev_is_char = false; @@ -857,6 +882,21 @@ void TextEdit::_notification(int p_what) { } } + // draw fold markers + if (draw_fold_gutter) { + int horizontal_gap = (cache.fold_gutter_width * 30) / 100; + int gutter_left = cache.style_normal->get_margin(MARGIN_LEFT) + cache.breakpoint_gutter_width + cache.line_number_w; + if (is_folded(line)) { + int xofs = horizontal_gap - (cache.can_fold_icon->get_width()) / 2; + int yofs = (get_row_height() - cache.folded_icon->get_height()) / 2; + cache.folded_icon->draw(ci, Point2(gutter_left + xofs, ofs_y + yofs), Color(0.8f, 0.8f, 0.8f, 0.8f)); + } else if (can_fold(line)) { + int xofs = -cache.can_fold_icon->get_width() / 2 - horizontal_gap + 3; + int yofs = (get_row_height() - cache.can_fold_icon->get_height()) / 2; + cache.can_fold_icon->draw(ci, Point2(gutter_left + xofs, ofs_y + yofs), Color(0.8f, 0.8f, 0.8f, 0.8f)); + } + } + if (cache.line_number_w) { String fc = String::num(line + 1); while (fc.length() < line_number_char_count) { @@ -894,17 +934,18 @@ void TextEdit::_notification(int p_what) { is_hex_notation = false; } - // check for dot or 'x' for hex notation in floating point number - if ((str[j] == '.' || str[j] == 'x') && !in_word && prev_is_number && !is_number) { + // check for dot or underscore or 'x' for hex notation in floating point number + if ((str[j] == '.' || str[j] == 'x' || str[j] == '_') && !in_word && prev_is_number && !is_number) { is_number = true; is_symbol = false; + is_char = false; if (str[j] == 'x' && str[j - 1] == '0') { is_hex_notation = true; } } - if (!in_word && _is_char(str[j])) { + if (!in_word && _is_char(str[j]) && !is_number) { in_word = true; } @@ -1195,6 +1236,10 @@ void TextEdit::_notification(int p_what) { } char_ofs += char_w; + + if (j == str.length() - 1 && is_folded(line)) { + cache.folded_eol_icon->draw(ci, Point2(char_ofs + char_margin, ofs_y), Color(1, 1, 1, 1), true); + } } if (cursor.column == str.length() && cursor.line == line && (char_ofs + char_margin) >= xmargin_beg) { @@ -1537,6 +1582,12 @@ void TextEdit::backspace_at_cursor() { int prev_line = cursor.column ? cursor.line : cursor.line - 1; int prev_column = cursor.column ? (cursor.column - 1) : (text[cursor.line - 1].length()); + + if (is_line_hidden(cursor.line)) + set_line_as_hidden(prev_line, true); + if (is_line_set_as_breakpoint(cursor.line)) + set_line_as_breakpoint(prev_line, true); + if (auto_brace_completion_enabled && cursor.column > 0 && _is_pair_left_symbol(text[cursor.line][cursor.column - 1])) { @@ -1576,7 +1627,7 @@ void TextEdit::backspace_at_cursor() { } } - cursor_set_line(prev_line); + cursor_set_line(prev_line, true, true); cursor_set_column(prev_column); } @@ -1650,10 +1701,18 @@ void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) co float rows = p_mouse.y; rows -= cache.style_normal->get_margin(MARGIN_TOP); rows /= get_row_height(); - int row = cursor.line_ofs + (rows + (v_scroll->get_value() - cursor.line_ofs)); + int lsp = get_line_scroll_pos(true); + int row = cursor.line_ofs + (rows + (v_scroll->get_value() - lsp)); + + if (is_hiding_enabled()) { + // row will be offset by the hidden rows + int f_ofs = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(rows + 1, text.size() - cursor.line_ofs)) - 1; + row = cursor.line_ofs + (f_ofs + (v_scroll->get_value() - lsp)); + row = CLAMP(row, 0, text.size() - num_lines_from(text.size() - 1, -1)); + } if (row < 0) - row = 0; + row = 0; //todo int col = 0; @@ -1663,7 +1722,7 @@ void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) co col = text[row].size(); } else { - col = p_mouse.x - (cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width); + col = p_mouse.x - (cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width); col += cursor.x_ofs; col = get_char_pos_for(col, get_line(row)); } @@ -1716,10 +1775,11 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (mb->is_pressed()) { if (mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) { + float scroll_factor = 3 * mb->get_factor(); if (scrolling) { - target_v_scroll = (target_v_scroll - (3 * mb->get_factor())); + target_v_scroll = (target_v_scroll - scroll_factor); } else { - target_v_scroll = (v_scroll->get_value() - (3 * mb->get_factor())); + target_v_scroll = (v_scroll->get_value() - scroll_factor); } if (smooth_scroll_enabled) { @@ -1733,16 +1793,18 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } } if (mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) { + float scroll_factor = 3 * mb->get_factor(); if (scrolling) { - target_v_scroll = (target_v_scroll + (3 * mb->get_factor())); + target_v_scroll = (target_v_scroll + scroll_factor); } else { - target_v_scroll = (v_scroll->get_value() + (3 * mb->get_factor())); + target_v_scroll = (v_scroll->get_value() + scroll_factor); } if (smooth_scroll_enabled) { - int max_v_scroll = get_line_count() - 1; + int max_v_scroll = get_total_unhidden_rows(); if (!scroll_past_end_of_file_enabled) { - max_v_scroll -= get_visible_rows() - 1; + max_v_scroll -= get_visible_rows(); + max_v_scroll = CLAMP(max_v_scroll, 0, get_total_unhidden_rows()); } if (target_v_scroll > max_v_scroll) { @@ -1765,6 +1827,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { _reset_caret_blink_timer(); int row, col; + update_line_scroll_pos(); _get_mouse_pos(Point2i(mb->get_position().x, mb->get_position().y), row, col); if (mb->get_command() && highlighted_word != String()) { @@ -1783,10 +1846,35 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } } + // toggle fold on gutter click if can + if (draw_fold_gutter) { + + int left_margin = cache.style_normal->get_margin(MARGIN_LEFT); + int gutter_left = left_margin + cache.breakpoint_gutter_width + cache.line_number_w; + if (mb->get_position().x > gutter_left - 6 && mb->get_position().x <= gutter_left + cache.fold_gutter_width - 3) { + if (is_folded(row)) { + unfold_line(row); + } else if (can_fold(row)) { + fold_line(row); + } + return; + } + } + + // unfold on folded icon click + if (is_folded(row)) { + int line_width = text.get_line_width(row); + line_width += cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width - cursor.x_ofs; + if (mb->get_position().x > line_width - 3 && mb->get_position().x <= line_width + cache.folded_eol_icon->get_width() + 3) { + unfold_line(row); + return; + } + } + int prev_col = cursor.column; int prev_line = cursor.line; - cursor_set_line(row); + cursor_set_line(row, true, false); cursor_set_column(col); if (mb->get_shift() && (cursor.column != prev_col || cursor.line != prev_line)) { @@ -2025,17 +2113,6 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { return; } - if (k->get_scancode() == KEY_DOWN) { - - if (completion_index < completion_options.size() - 1) { - completion_index++; - completion_current = completion_options[completion_index]; - update(); - } - accept_event(); - return; - } - if (k->get_scancode() == KEY_KP_ENTER || k->get_scancode() == KEY_ENTER || k->get_scancode() == KEY_TAB) { _confirm_completion(); @@ -2189,7 +2266,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { selection.active = false; update(); _remove_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column); - cursor_set_line(selection.from_line); + cursor_set_line(selection.from_line, true, false); cursor_set_column(selection.from_column); update(); } @@ -2239,6 +2316,9 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } } + if (is_folded(cursor.line)) + unfold_line(cursor.line); + bool brace_indent = false; // no need to indent if we are going upwards. @@ -2389,6 +2469,8 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { cursor_set_column(column); } else { + if (cursor.line > 0 && is_line_hidden(cursor.line - 1)) + unfold_line(cursor.line - 1); backspace_at_cursor(); } @@ -2447,7 +2529,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } else if (cursor.column == 0) { if (cursor.line > 0) { - cursor_set_line(cursor.line - 1); + cursor_set_line(cursor.line - num_lines_from(CLAMP(cursor.line - 1, 0, text.size() - 1), -1)); cursor_set_column(text[cursor.line].length()); } } else { @@ -2510,7 +2592,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } else if (cursor.column == text[cursor.line].length()) { if (cursor.line < text.size() - 1) { - cursor_set_line(cursor.line + 1); + cursor_set_line(cursor_get_line() + num_lines_from(CLAMP(cursor.line + 1, 0, text.size() - 1), 1), true, false); cursor_set_column(0); } } else { @@ -2551,7 +2633,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { cursor_set_line(0); else #endif - cursor_set_line(cursor_get_line() - 1); + cursor_set_line(cursor_get_line() - num_lines_from(CLAMP(cursor.line - 1, 0, text.size() - 1), -1)); if (k->get_shift()) _post_shift_selection(); @@ -2585,10 +2667,10 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } if (k->get_command()) - cursor_set_line(text.size() - 1); + cursor_set_line(text.size() - 1, true, false); else #endif - cursor_set_line(cursor_get_line() + 1); + cursor_set_line(cursor_get_line() + num_lines_from(CLAMP(cursor.line + 1, 0, text.size() - 1), 1), true, false); if (k->get_shift()) _post_shift_selection(); @@ -2735,7 +2817,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (k->get_shift()) _pre_shift_selection(); - cursor_set_line(text.size() - 1); + cursor_set_line(text.size() - 1, true, false); if (k->get_shift()) _post_shift_selection(); @@ -2750,7 +2832,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { _pre_shift_selection(); if (k->get_command()) - cursor_set_line(text.size() - 1); + cursor_set_line(text.size() - 1, true, false); cursor_set_column(text[cursor.line].length()); if (k->get_shift()) @@ -2775,7 +2857,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (k->get_shift()) _pre_shift_selection(); - cursor_set_line(cursor_get_line() - get_visible_rows()); + cursor_set_line(cursor_get_line() - num_lines_from(cursor.line, -get_visible_rows()), true, false); if (k->get_shift()) _post_shift_selection(); @@ -2796,7 +2878,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (k->get_shift()) _pre_shift_selection(); - cursor_set_line(cursor_get_line() + get_visible_rows()); + cursor_set_line(cursor_get_line() + num_lines_from(cursor.line, get_visible_rows()), true, false); if (k->get_shift()) _post_shift_selection(); @@ -3014,8 +3096,9 @@ void TextEdit::_scroll_lines_up() { } // adjust the cursor - if (cursor_get_line() >= (get_visible_rows() + get_v_scroll()) && !selection.active) { - cursor_set_line((get_visible_rows() + get_v_scroll()) - 1, false); + int num_lines = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), get_visible_rows()) - 1; + if (cursor.line >= cursor.line_ofs + num_lines && !selection.active) { + cursor_set_line(cursor.line_ofs + num_lines, false, false); } } @@ -3023,9 +3106,10 @@ void TextEdit::_scroll_lines_down() { scrolling = false; // calculate the maximum vertical scroll position - int max_v_scroll = get_line_count() - 1; + int max_v_scroll = get_total_unhidden_rows(); if (!scroll_past_end_of_file_enabled) { - max_v_scroll -= get_visible_rows() - 1; + max_v_scroll -= get_visible_rows(); + max_v_scroll = CLAMP(max_v_scroll, 0, get_total_unhidden_rows()); } // adjust the vertical scroll @@ -3034,8 +3118,8 @@ void TextEdit::_scroll_lines_down() { } // adjust the cursor - if ((cursor_get_line()) <= get_v_scroll() - 1 && !selection.active) { - cursor_set_line(get_v_scroll(), false); + if (cursor.line <= cursor.line_ofs - 1 && !selection.active) { + cursor_set_line(cursor.line_ofs, false, false); } } @@ -3080,6 +3164,15 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i } } + // if we are just making a new empty line, reset breakpoints and hidden status + if (p_char == 0 && p_text.replace("\r", "") == "\n") { + + text.set_breakpoint(p_line + 1, text.is_breakpoint(p_line)); + text.set_hidden(p_line + 1, text.is_hidden(p_line)); + text.set_breakpoint(p_line, false); + text.set_hidden(p_line, false); + } + r_end_line = p_line + substrings.size() - 1; r_end_column = text[r_end_line].length() - postinsert_text.length(); @@ -3278,6 +3371,7 @@ Size2 TextEdit::get_minimum_size() const { return cache.style_normal->get_minimum_size(); } + int TextEdit::get_visible_rows() const { int total = cache.size.height; @@ -3285,31 +3379,81 @@ int TextEdit::get_visible_rows() const { total /= get_row_height(); return total; } + +int TextEdit::get_total_unhidden_rows() const { + if (!is_hiding_enabled()) + return text.size(); + + int total_unhidden = 0; + for (int i = 0; i < text.size(); i++) { + if (!text.is_hidden(i)) + total_unhidden++; + } + return total_unhidden; +} + +double TextEdit::get_line_scroll_pos(bool p_recalculate) const { + + if (!is_hiding_enabled()) + return cursor.line_ofs; + if (!p_recalculate) + return line_scroll_pos; + + // count num unhidden lines to the cursor line ofs + double new_line_scroll_pos = 0; + int to = CLAMP(cursor.line_ofs, 0, text.size() - 1); + for (int i = 0; i < to; i++) { + if (!text.is_hidden(i)) + new_line_scroll_pos++; + } + return new_line_scroll_pos; +} + +void TextEdit::update_line_scroll_pos() { + + if (!is_hiding_enabled()) { + line_scroll_pos = cursor.line_ofs; + return; + } + + // count num unhidden lines to the cursor line ofs + double new_line_scroll_pos = 0; + int to = CLAMP(cursor.line_ofs, 0, text.size() - 1); + for (int i = 0; i < to; i++) { + if (!text.is_hidden(i)) + new_line_scroll_pos++; + } + line_scroll_pos = new_line_scroll_pos; +} + void TextEdit::adjust_viewport_to_cursor() { scrolling = false; - if (cursor.line_ofs > cursor.line) + if (cursor.line_ofs > cursor.line) { cursor.line_ofs = cursor.line; + } - int visible_width = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width; + int visible_width = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width; if (v_scroll->is_visible_in_tree()) visible_width -= v_scroll->get_combined_minimum_size().width; visible_width -= 20; // give it a little more space - //printf("rowofs %i, visrows %i, cursor.line %i\n",cursor.line_ofs,get_visible_rows(),cursor.line); - int visible_rows = get_visible_rows(); if (h_scroll->is_visible_in_tree()) visible_rows -= ((h_scroll->get_combined_minimum_size().height - 1) / get_row_height()); + int num_rows = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(visible_rows, text.size() - 1 - cursor.line_ofs)); - if (cursor.line >= (cursor.line_ofs + visible_rows)) - cursor.line_ofs = cursor.line - visible_rows; - if (cursor.line < cursor.line_ofs) + // if the cursor is off the screen + if (cursor.line >= (cursor.line_ofs + MAX(num_rows, visible_rows))) { + cursor.line_ofs = cursor.line - (num_lines_from(CLAMP(cursor.line, 0, text.size() - 1), -visible_rows) - 1); + } + if (cursor.line < cursor.line_ofs) { cursor.line_ofs = cursor.line; + } - if (cursor.line_ofs + visible_rows > text.size() && !scroll_past_end_of_file_enabled) { - cursor.line_ofs = text.size() - visible_rows; - v_scroll->set_value(text.size() - visible_rows); + // fixes deleting lines from moving the line ofs in a bad way + if (!scroll_past_end_of_file_enabled && get_total_unhidden_rows() > visible_rows && num_rows < visible_rows) { + cursor.line_ofs = text.size() - 1 - (num_lines_from(text.size() - 1, -visible_rows) - 1); } int cursor_x = get_column_x_offset(cursor.column, text[cursor.line]); @@ -3320,6 +3464,8 @@ void TextEdit::adjust_viewport_to_cursor() { if (cursor_x < cursor.x_ofs) cursor.x_ofs = cursor_x; + update_line_scroll_pos(); + v_scroll->set_value(get_line_scroll_pos() + 1); update(); /* get_range()->set_max(text.size()); @@ -3336,7 +3482,10 @@ void TextEdit::center_viewport_to_cursor() { if (cursor.line_ofs > cursor.line) cursor.line_ofs = cursor.line; - int visible_width = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width; + if (is_line_hidden(cursor.line)) + unfold_line(cursor.line); + + int visible_width = cache.size.width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width; if (v_scroll->is_visible_in_tree()) visible_width -= v_scroll->get_combined_minimum_size().width; visible_width -= 20; // give it a little more space @@ -3345,9 +3494,8 @@ void TextEdit::center_viewport_to_cursor() { if (h_scroll->is_visible_in_tree()) visible_rows -= ((h_scroll->get_combined_minimum_size().height - 1) / get_row_height()); - int max_ofs = text.size() - (scroll_past_end_of_file_enabled ? 1 : visible_rows); - cursor.line_ofs = CLAMP(cursor.line - (visible_rows / 2), 0, max_ofs); - + int max_ofs = text.size() - (scroll_past_end_of_file_enabled ? 1 : num_lines_from(text.size() - 1, -visible_rows)); + cursor.line_ofs = CLAMP(cursor.line - num_lines_from(cursor.line - visible_rows / 2, -visible_rows / 2), 0, max_ofs); int cursor_x = get_column_x_offset(cursor.column, text[cursor.line]); if (cursor_x > (cursor.x_ofs + visible_width)) @@ -3356,6 +3504,9 @@ void TextEdit::center_viewport_to_cursor() { if (cursor_x < cursor.x_ofs) cursor.x_ofs = cursor_x; + update_line_scroll_pos(); + v_scroll->set_value(get_line_scroll_pos()); + update(); } @@ -3380,7 +3531,7 @@ void TextEdit::cursor_set_column(int p_col, bool p_adjust_viewport) { } } -void TextEdit::cursor_set_line(int p_row, bool p_adjust_viewport) { +void TextEdit::cursor_set_line(int p_row, bool p_adjust_viewport, bool p_can_be_hidden) { if (setting_row) return; @@ -3392,6 +3543,21 @@ void TextEdit::cursor_set_line(int p_row, bool p_adjust_viewport) { if (p_row >= (int)text.size()) p_row = (int)text.size() - 1; + if (!p_can_be_hidden) { + if (is_line_hidden(CLAMP(p_row, 0, text.size() - 1))) { + int move_down = num_lines_from(p_row, 1) - 1; + if (p_row + move_down <= text.size() - 1 && !is_line_hidden(p_row + move_down)) { + p_row += move_down; + } else { + int move_up = num_lines_from(p_row, -1) - 1; + if (p_row - move_up > 0 && !is_line_hidden(p_row - move_up)) { + p_row -= move_up; + } else { + WARN_PRINTS(("Cursor set to hidden line " + itos(p_row) + " and there are no nonhidden lines.")); + } + } + } + } cursor.line = p_row; cursor.column = get_char_pos_for(cursor.last_fit_x, get_line(cursor.line)); @@ -3461,8 +3627,11 @@ void TextEdit::_scroll_moved(double p_to_val) { if (h_scroll->is_visible_in_tree()) cursor.x_ofs = h_scroll->get_value(); - if (v_scroll->is_visible_in_tree()) - cursor.line_ofs = v_scroll->get_value(); + if (v_scroll->is_visible_in_tree()) { + double val = v_scroll->get_value(); + cursor.line_ofs = num_lines_from(0, (int)floor(val)) - 1; + line_scroll_pos = (int)floor(val); + } update(); } @@ -3551,10 +3720,43 @@ Control::CursorShape TextEdit::get_cursor_shape(const Point2 &p_pos) const { if (highlighted_word != String()) return CURSOR_POINTING_HAND; - int gutter = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width; - if ((completion_active && completion_rect.has_point(p_pos)) || p_pos.x < gutter) { + int gutter = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width; + if ((completion_active && completion_rect.has_point(p_pos))) { + return CURSOR_ARROW; + } + if (p_pos.x < gutter) { + + int row, col; + _get_mouse_pos(p_pos, row, col); + int left_margin = cache.style_normal->get_margin(MARGIN_LEFT); + + // breakpoint icon + if (draw_breakpoint_gutter && p_pos.x > left_margin && p_pos.x <= left_margin + cache.breakpoint_gutter_width + 3) { + return CURSOR_POINTING_HAND; + } + + // fold icon + int gutter_left = left_margin + cache.breakpoint_gutter_width + cache.line_number_w; + if (draw_fold_gutter && p_pos.x > gutter_left - 6 && p_pos.x <= gutter_left + cache.fold_gutter_width - 3) { + if (is_folded(row) || can_fold(row)) + return CURSOR_POINTING_HAND; + else + return CURSOR_ARROW; + } return CURSOR_ARROW; + } else { + int row, col; + _get_mouse_pos(p_pos, row, col); + // eol fold icon + if (is_folded(row)) { + int line_width = text.get_line_width(row); + line_width += cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width - cursor.x_ofs; + if (p_pos.x > line_width - 3 && p_pos.x <= line_width + cache.folded_eol_icon->get_width() + 3) { + return CURSOR_POINTING_HAND; + } + } } + return CURSOR_IBEAM; } @@ -3568,6 +3770,7 @@ void TextEdit::set_text(String p_text) { cursor.line = 0; cursor.x_ofs = 0; cursor.line_ofs = 0; + line_scroll_pos = 0; cursor.last_fit_x = 0; cursor_set_line(0); cursor_set_column(0); @@ -3653,6 +3856,7 @@ void TextEdit::_clear() { cursor.line = 0; cursor.x_ofs = 0; cursor.line_ofs = 0; + line_scroll_pos = 0; cursor.last_fit_x = 0; } @@ -3731,6 +3935,9 @@ void TextEdit::_update_caches() { cache.line_spacing = get_constant("line_spacing"); cache.row_height = cache.font->get_height() + cache.line_spacing; cache.tab_icon = get_icon("tab"); + cache.folded_icon = get_icon("GuiTreeArrowRight", "EditorIcons"); + cache.can_fold_icon = get_icon("GuiTreeArrowDown", "EditorIcons"); + cache.folded_eol_icon = get_icon("GuiTabMenu", "EditorIcons"); text.set_font(cache.font); } @@ -4177,6 +4384,198 @@ void TextEdit::get_breakpoints(List<int> *p_breakpoints) const { } } +void TextEdit::set_line_as_hidden(int p_line, bool p_hidden) { + + ERR_FAIL_INDEX(p_line, text.size()); + if (is_hiding_enabled() || !p_hidden) + text.set_hidden(p_line, p_hidden); + update(); +} + +bool TextEdit::is_line_hidden(int p_line) const { + + ERR_FAIL_INDEX_V(p_line, text.size(), false); + return text.is_hidden(p_line); +} + +void TextEdit::fold_all_lines() { + + for (int i = 0; i < text.size(); i++) { + fold_line(i); + } + _update_scrollbars(); + update(); +} + +void TextEdit::unhide_all_lines() { + + for (int i = 0; i < text.size(); i++) { + text.set_hidden(i, false); + } + _update_scrollbars(); + update(); +} + +int TextEdit::num_lines_from(int p_line_from, int unhidden_amount) const { + + // returns the number of hidden and unhidden lines from p_line_from to p_line_from + amount of visible lines + ERR_FAIL_INDEX_V(p_line_from, text.size(), ABS(unhidden_amount)); + + if (!is_hiding_enabled()) + return unhidden_amount; + int num_visible = 0; + int num_total = 0; + if (unhidden_amount >= 0) { + for (int i = p_line_from; i < text.size(); i++) { + num_total++; + if (!is_line_hidden(i)) + num_visible++; + if (num_visible >= unhidden_amount) + break; + } + } else { + unhidden_amount = ABS(unhidden_amount); + for (int i = p_line_from; i >= 0; i--) { + num_total++; + if (!is_line_hidden(i)) + num_visible++; + if (num_visible >= unhidden_amount) + break; + } + } + return num_total; +} + +int TextEdit::get_whitespace_level(int p_line) const { + + ERR_FAIL_INDEX_V(p_line, text.size(), 0); + + // counts number of tabs and spaces before line starts + int whitespace_count = 0; + int line_length = text[p_line].size(); + for (int i = 0; i < line_length - 1; i++) { + if (text[p_line][i] == '\t') { + whitespace_count++; + } else if (text[p_line][i] == ' ') { + whitespace_count++; + } else if (text[p_line][i] == '#') { + break; + } else { + break; + } + } + return whitespace_count; +} + +bool TextEdit::can_fold(int p_line) const { + + ERR_FAIL_INDEX_V(p_line, text.size(), false); + if (!is_hiding_enabled()) + return false; + if (p_line + 1 >= text.size()) + return false; + if (text[p_line].size() == 0) + return false; + if (is_folded(p_line)) + return false; + if (is_line_hidden(p_line)) + return false; + + int start_indent = get_whitespace_level(p_line); + + for (int i = p_line + 1; i < text.size(); i++) { + if (text[i].size() == 0) + continue; + int next_indent = get_whitespace_level(i); + if (next_indent > start_indent) + return true; + else + return false; + } + + return false; +} + +bool TextEdit::is_folded(int p_line) const { + + ERR_FAIL_INDEX_V(p_line, text.size(), false); + if (p_line + 1 >= text.size() - 1) + return false; + if (!is_line_hidden(p_line) && is_line_hidden(p_line + 1)) + return true; + return false; +} + +void TextEdit::fold_line(int p_line) { + + ERR_FAIL_INDEX(p_line, text.size()); + if (!is_hiding_enabled()) + return; + if (!can_fold(p_line)) + return; + + // hide lines below this one + int start_indent = get_whitespace_level(p_line); + for (int i = p_line + 1; i < text.size(); i++) { + int cur_indent = get_whitespace_level(i); + if (text[i].size() == 0 || cur_indent > start_indent) { + set_line_as_hidden(i, true); + } else { + // exclude trailing empty lines + for (int trail_i = i - 1; trail_i > p_line; trail_i--) { + if (text[trail_i].size() == 0) + set_line_as_hidden(trail_i, false); + else + break; + } + break; + } + } + + // fix selection + if (is_selection_active()) { + if (is_line_hidden(selection.from_line) && is_line_hidden(selection.to_line)) { + deselect(); + } else if (is_line_hidden(selection.from_line)) { + select(p_line, 9999, selection.to_line, selection.to_column); + } else if (is_line_hidden(selection.to_line)) { + select(selection.from_line, selection.from_column, p_line, 9999); + } + } + + // reset cursor + if (is_line_hidden(cursor.line)) { + cursor_set_line(p_line, false, false); + cursor_set_column(get_line(p_line).length(), false); + } + _update_scrollbars(); + update(); +} + +void TextEdit::unfold_line(int p_line) { + + ERR_FAIL_INDEX(p_line, text.size()); + + if (!is_folded(p_line) && !is_line_hidden(p_line)) + return; + int fold_start = p_line; + for (fold_start = p_line; fold_start > 0; fold_start--) { + if (is_folded(fold_start)) + break; + } + fold_start = is_folded(fold_start) ? fold_start : p_line; + + for (int i = fold_start + 1; i < text.size(); i++) { + if (is_line_hidden(i)) { + set_line_as_hidden(i, false); + } else { + break; + } + } + _update_scrollbars(); + update(); +} + int TextEdit::get_line_count() const { return text.size(); @@ -4403,12 +4802,14 @@ void TextEdit::set_v_scroll(int p_scroll) { p_scroll = 0; } if (!scroll_past_end_of_file_enabled) { - if (p_scroll + get_visible_rows() > get_line_count()) { - p_scroll = get_line_count() - get_visible_rows(); + if (p_scroll + get_visible_rows() > get_total_unhidden_rows()) { + int num_rows = num_lines_from(CLAMP(p_scroll, 0, text.size() - 1), MIN(get_visible_rows(), text.size() - 1 - p_scroll)); + p_scroll = text.size() - num_rows; } } v_scroll->set_value(p_scroll); - cursor.line_ofs = p_scroll; + cursor.line_ofs = num_lines_from(0, p_scroll); + line_scroll_pos = p_scroll; } int TextEdit::get_h_scroll() const { @@ -4770,7 +5171,7 @@ void TextEdit::set_line(int line, String new_text) { void TextEdit::insert_at(const String &p_text, int at) { cursor_set_column(0); - cursor_set_line(at); + cursor_set_line(at, false, true); _insert_text(at, 0, p_text + "\n"); } @@ -4818,6 +5219,35 @@ int TextEdit::get_breakpoint_gutter_width() const { return cache.breakpoint_gutter_width; } +void TextEdit::set_draw_fold_gutter(bool p_draw) { + draw_fold_gutter = p_draw; + update(); +} + +bool TextEdit::is_drawing_fold_gutter() const { + return draw_fold_gutter; +} + +void TextEdit::set_fold_gutter_width(int p_gutter_width) { + fold_gutter_width = p_gutter_width; + update(); +} + +int TextEdit::get_fold_gutter_width() const { + return cache.fold_gutter_width; +} + +void TextEdit::set_hiding_enabled(int p_enabled) { + if (!p_enabled) + unhide_all_lines(); + hiding_enabled = p_enabled; + update(); +} + +int TextEdit::is_hiding_enabled() const { + return hiding_enabled; +} + void TextEdit::set_highlight_current_line(bool p_enabled) { highlight_current_line = p_enabled; update(); @@ -4912,7 +5342,7 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("get_line", "line"), &TextEdit::get_line); ClassDB::bind_method(D_METHOD("cursor_set_column", "column", "adjust_viewport"), &TextEdit::cursor_set_column, DEFVAL(true)); - ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport"), &TextEdit::cursor_set_line, DEFVAL(true)); + ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport, can_be_hidden"), &TextEdit::cursor_set_line, DEFVAL(true), DEFVAL(true)); ClassDB::bind_method(D_METHOD("cursor_get_column"), &TextEdit::cursor_get_column); ClassDB::bind_method(D_METHOD("cursor_get_line"), &TextEdit::cursor_get_line); @@ -4953,6 +5383,17 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("set_show_line_numbers", "enable"), &TextEdit::set_show_line_numbers); ClassDB::bind_method(D_METHOD("is_show_line_numbers_enabled"), &TextEdit::is_show_line_numbers_enabled); + ClassDB::bind_method(D_METHOD("set_hiding_enabled", "enable"), &TextEdit::set_hiding_enabled); + ClassDB::bind_method(D_METHOD("is_hiding_enabled"), &TextEdit::is_hiding_enabled); + ClassDB::bind_method(D_METHOD("set_line_as_hidden", "line", "enable"), &TextEdit::set_line_as_hidden); + ClassDB::bind_method(D_METHOD("is_line_hidden"), &TextEdit::is_line_hidden); + ClassDB::bind_method(D_METHOD("fold_all_lines"), &TextEdit::fold_all_lines); + ClassDB::bind_method(D_METHOD("unhide_all_lines"), &TextEdit::unhide_all_lines); + ClassDB::bind_method(D_METHOD("fold_line", "line"), &TextEdit::fold_line); + ClassDB::bind_method(D_METHOD("unfold_line", "line"), &TextEdit::unfold_line); + ClassDB::bind_method(D_METHOD("can_fold", "line"), &TextEdit::can_fold); + ClassDB::bind_method(D_METHOD("is_folded", "line"), &TextEdit::is_folded); + ClassDB::bind_method(D_METHOD("set_highlight_all_occurrences", "enable"), &TextEdit::set_highlight_all_occurrences); ClassDB::bind_method(D_METHOD("is_highlight_all_occurrences_enabled"), &TextEdit::is_highlight_all_occurrences_enabled); @@ -4986,6 +5427,7 @@ void TextEdit::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "context_menu_enabled"), "set_context_menu_enabled", "is_context_menu_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_scrolling"), "set_smooth_scroll_enable", "is_smooth_scroll_enabled"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_scroll_speed"), "set_v_scroll_speed", "get_v_scroll_speed"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hiding_enabled"), "set_hiding_enabled", "is_hiding_enabled"); ADD_GROUP("Caret", "caret_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret_block_mode"), "cursor_set_block_mode", "cursor_is_block_mode"); @@ -5027,6 +5469,8 @@ TextEdit::TextEdit() { cache.line_number_w = 1; cache.breakpoint_gutter_width = 0; breakpoint_gutter_width = 0; + cache.fold_gutter_width = 0; + fold_gutter_width = 0; indent_size = 4; text.set_indent_size(indent_size); @@ -5096,6 +5540,8 @@ TextEdit::TextEdit() { line_length_guideline = false; line_length_guideline_col = 80; draw_breakpoint_gutter = false; + draw_fold_gutter = false; + hiding_enabled = false; next_operation_is_complex = false; scroll_past_end_of_file_enabled = false; auto_brace_completion_enabled = false; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 50f005ed6a..b1c7b14e58 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -73,6 +73,9 @@ class TextEdit : public Control { struct Cache { Ref<Texture> tab_icon; + Ref<Texture> can_fold_icon; + Ref<Texture> folded_icon; + Ref<Texture> folded_eol_icon; Ref<StyleBox> style_normal; Ref<StyleBox> style_focus; Ref<Font> font; @@ -105,6 +108,7 @@ class TextEdit : public Control { int line_spacing; int line_number_w; int breakpoint_gutter_width; + int fold_gutter_width; Size2 size; } cache; @@ -136,6 +140,7 @@ class TextEdit : public Control { int width_cache : 24; bool marked : 1; bool breakpoint : 1; + bool hidden : 1; Map<int, ColorRegionInfo> region_info; String data; }; @@ -160,6 +165,8 @@ class TextEdit : public Control { 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; } bool is_breakpoint(int p_line) const { return text[p_line].breakpoint; } + void set_hidden(int p_line, bool p_hidden) { text[p_line].hidden = p_hidden; } + bool is_hidden(int p_line) const { return text[p_line].hidden; } void insert(int p_at, const String &p_text); void remove(int p_at); int size() const { return text.size(); } @@ -251,6 +258,9 @@ class TextEdit : public Control { int line_length_guideline_col; bool draw_breakpoint_gutter; int breakpoint_gutter_width; + bool draw_fold_gutter; + int fold_gutter_width; + bool hiding_enabled; bool highlight_all_occurrences; bool scroll_past_end_of_file_enabled; @@ -293,9 +303,14 @@ class TextEdit : public Control { int search_result_line; int search_result_col; + double line_scroll_pos; + bool context_menu_enabled; int get_visible_rows() const; + int get_total_unhidden_rows() const; + double get_line_scroll_pos(bool p_recalculate = false) const; + void update_line_scroll_pos(); int get_char_count(); @@ -303,6 +318,7 @@ class TextEdit : public Control { int get_column_x_offset(int p_char, String p_str); void adjust_viewport_to_cursor(); + double get_scroll_line_diff() const; void _scroll_moved(double); void _update_scrollbars(); void _v_scroll_input(); @@ -405,6 +421,18 @@ public: void set_line_as_breakpoint(int p_line, bool p_breakpoint); bool is_line_set_as_breakpoint(int p_line) const; void get_breakpoints(List<int> *p_breakpoints) const; + + void set_line_as_hidden(int p_line, bool p_hidden); + bool is_line_hidden(int p_line) const; + void fold_all_lines(); + void unhide_all_lines(); + int num_lines_from(int p_line_from, int unhidden_amount) const; + int get_whitespace_level(int p_line) const; + bool can_fold(int p_line) const; + bool is_folded(int p_line) const; + void fold_line(int p_line); + void unfold_line(int p_line); + String get_text(); String get_line(int line) const; void set_line(int line, String new_text); @@ -433,7 +461,7 @@ public: void center_viewport_to_cursor(); void cursor_set_column(int p_col, bool p_adjust_viewport = true); - void cursor_set_line(int p_row, bool p_adjust_viewport = true); + void cursor_set_line(int p_row, bool p_adjust_viewport = true, bool p_can_be_hidden = true); int cursor_get_column() const; int cursor_get_line() const; @@ -538,6 +566,15 @@ public: void set_breakpoint_gutter_width(int p_gutter_width); int get_breakpoint_gutter_width() const; + void set_draw_fold_gutter(bool p_draw); + bool is_drawing_fold_gutter() const; + + void set_fold_gutter_width(int p_gutter_width); + int get_fold_gutter_width() const; + + void set_hiding_enabled(int p_enabled); + int is_hiding_enabled() const; + void set_tooltip_request_func(Object *p_obj, const StringName &p_function, const Variant &p_udata); void set_completion(bool p_enabled, const Vector<String> &p_prefixes); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index d38c688241..2bf45f1189 100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2067,7 +2067,7 @@ int Node::get_position_in_parent() const { return data.pos; } -Node *Node::duplicate(int p_flags) const { +Node *Node::_duplicate(int p_flags) const { Node *node = NULL; @@ -2147,9 +2147,6 @@ Node *Node::duplicate(int p_flags) const { } } - if (p_flags & DUPLICATE_SIGNALS) - _duplicate_signals(this, node); - for (int i = 0; i < get_child_count(); i++) { if (get_child(i)->data.parent_owned) @@ -2170,6 +2167,17 @@ Node *Node::duplicate(int p_flags) const { return node; } +Node *Node::duplicate(int p_flags) const { + + Node *dupe = _duplicate(p_flags); + + if (dupe && (p_flags & DUPLICATE_SIGNALS)) { + _duplicate_signals(this, dupe); + } + + return dupe; +} + void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p_reown_map) const { if (get_owner() != get_parent()->get_owner()) @@ -2240,6 +2248,9 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p } } +// Duplication of signals must happen after all the node descendants have been copied, +// because re-targeting of connections from some descendant to another is not possible +// if the emitter node comes later in tree order than the receiver void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const { if (this != p_original && (get_owner() != p_original && get_owner() != p_original->get_owner())) @@ -2262,6 +2273,12 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const { NodePath ptarget = p_original->get_path_to(target); Node *copytarget = p_copy->get_node(ptarget); + // Cannot find a path to the duplicate target, so it seems it's not part + // of the duplicated and not yet parented hierarchy, so at least try to connect + // to the same target as the original + if (!copytarget) + copytarget = target; + if (copy && copytarget) { copy->connect(E->get().signal, copytarget, E->get().method, E->get().binds, CONNECT_PERSIST); } diff --git a/scene/main/node.h b/scene/main/node.h index e8901f7b6e..c43e96063f 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -169,6 +169,7 @@ private: void _duplicate_signals(const Node *p_original, Node *p_copy) const; void _duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p_reown_map) const; + Node *_duplicate(int p_flags) const; Array _get_children() const; Array _get_groups() const; diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 21e4a85cd1..8192074c17 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1125,14 +1125,14 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a return a.cubic_slerp(b, pa, pb, p_c); } break; - case Variant::RECT3: { + case Variant::AABB: { - Rect3 a = p_a; - Rect3 b = p_b; - Rect3 pa = p_pre_a; - Rect3 pb = p_post_b; + AABB a = p_a; + AABB b = p_b; + AABB pa = p_pre_a; + AABB pb = p_post_b; - return Rect3( + return AABB( a.position.cubic_interpolate(b.position, pa.position, pb.position, p_c), a.size.cubic_interpolate(b.size, pa.size, pb.size, p_c)); } break; diff --git a/scene/resources/box_shape.cpp b/scene/resources/box_shape.cpp index bbc85ce0f6..4b9843f3f5 100644 --- a/scene/resources/box_shape.cpp +++ b/scene/resources/box_shape.cpp @@ -33,7 +33,7 @@ Vector<Vector3> BoxShape::_gen_debug_mesh_lines() { Vector<Vector3> lines; - Rect3 aabb; + AABB aabb; aabb.position = -get_extents(); aabb.size = aabb.position * -2; diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index ce439fece6..cd28c9d203 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -836,39 +836,6 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_constant("autohide", "HSplitContainer", 1 * scale); theme->set_constant("autohide", "VSplitContainer", 1 * scale); - // HButtonArray - theme->set_stylebox("normal", "HButtonArray", sb_button_normal); - theme->set_stylebox("selected", "HButtonArray", sb_button_pressed); - theme->set_stylebox("hover", "HButtonArray", sb_button_hover); - - theme->set_font("font", "HButtonArray", default_font); - theme->set_font("font_selected", "HButtonArray", default_font); - - theme->set_color("font_color", "HButtonArray", control_font_color_low); - theme->set_color("font_color_selected", "HButtonArray", control_font_color_hover); - - theme->set_constant("icon_separator", "HButtonArray", 2 * scale); - theme->set_constant("button_separator", "HButtonArray", 4 * scale); - - theme->set_stylebox("focus", "HButtonArray", focus); - - // VButtonArray - - theme->set_stylebox("normal", "VButtonArray", sb_button_normal); - theme->set_stylebox("selected", "VButtonArray", sb_button_pressed); - theme->set_stylebox("hover", "VButtonArray", sb_button_hover); - - theme->set_font("font", "VButtonArray", default_font); - theme->set_font("font_selected", "VButtonArray", default_font); - - theme->set_color("font_color", "VButtonArray", control_font_color_low); - theme->set_color("font_color_selected", "VButtonArray", control_font_color_hover); - - theme->set_constant("icon_separator", "VButtonArray", 2 * scale); - theme->set_constant("button_separator", "VButtonArray", 4 * scale); - - theme->set_stylebox("focus", "VButtonArray", focus); - // ReferenceRect Ref<StyleBoxTexture> ttnc = make_stylebox(full_panel_bg_png, 8, 8, 8, 8); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 12434b39fa..286840656b 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -723,7 +723,11 @@ void SpatialMaterial::_update_shader() { } else { code += "\tvec3 emission_tex = texture(texture_emission,base_uv).rgb;\n"; } - code += "\tEMISSION = (emission.rgb+emission_tex)*emission_energy;\n"; + if (emission_op == EMISSION_OP_ADD) { + code += "\tEMISSION = (emission.rgb+emission_tex)*emission_energy;\n"; + } else { + code += "\tEMISSION = (emission.rgb*emission_tex)*emission_energy;\n"; + } } if (features[FEATURE_REFRACTION] && !flags[FLAG_UV1_USE_TRIPLANAR]) { //refraction not supported with triplanar @@ -1635,6 +1639,19 @@ float SpatialMaterial::get_distance_fade_min_distance() const { return distance_fade_min_distance; } +void SpatialMaterial::set_emission_operator(EmissionOperator p_op) { + + if (emission_op == p_op) + return; + emission_op = p_op; + _queue_shader_change(); +} + +SpatialMaterial::EmissionOperator SpatialMaterial::get_emission_operator() const { + + return emission_op; +} + RID SpatialMaterial::get_shader_rid() const { ERR_FAIL_COND_V(!shader_map.has(current_key), RID()); @@ -1769,6 +1786,9 @@ void SpatialMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_grow", "amount"), &SpatialMaterial::set_grow); ClassDB::bind_method(D_METHOD("get_grow"), &SpatialMaterial::get_grow); + ClassDB::bind_method(D_METHOD("set_emission_operator", "operator"), &SpatialMaterial::set_emission_operator); + ClassDB::bind_method(D_METHOD("get_emission_operator"), &SpatialMaterial::get_emission_operator); + ClassDB::bind_method(D_METHOD("set_ao_light_affect", "amount"), &SpatialMaterial::set_ao_light_affect); ClassDB::bind_method(D_METHOD("get_ao_light_affect"), &SpatialMaterial::get_ao_light_affect); @@ -1854,6 +1874,7 @@ void SpatialMaterial::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "emission_enabled"), "set_feature", "get_feature", FEATURE_EMISSION); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "emission", PROPERTY_HINT_COLOR_NO_ALPHA), "set_emission", "get_emission"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_emission_energy", "get_emission_energy"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_operator", PROPERTY_HINT_ENUM, "Add,Multiply"), "set_emission_operator", "get_emission_operator"); ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "emission_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_EMISSION); ADD_GROUP("NormalMap", "normal_"); @@ -2022,6 +2043,9 @@ void SpatialMaterial::_bind_methods() { BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_BLUE); BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_ALPHA); BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_GRAYSCALE); + + BIND_ENUM_CONSTANT(EMISSION_OP_ADD); + BIND_ENUM_CONSTANT(EMISSION_OP_MULTIPLY); } SpatialMaterial::SpatialMaterial() @@ -2057,6 +2081,7 @@ SpatialMaterial::SpatialMaterial() set_particles_anim_v_frames(1); set_particles_anim_loop(false); set_alpha_scissor_threshold(0.98); + emission_op = EMISSION_OP_ADD; proximity_fade_enabled = false; distance_fade_enabled = false; diff --git a/scene/resources/material.h b/scene/resources/material.h index 2425f1a174..877d4dfd41 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -215,6 +215,11 @@ public: TEXTURE_CHANNEL_GRAYSCALE }; + enum EmissionOperator { + EMISSION_OP_ADD, + EMISSION_OP_MULTIPLY + }; + private: union MaterialKey { @@ -234,6 +239,7 @@ private: uint64_t grow : 1; uint64_t proximity_fade : 1; uint64_t distance_fade : 1; + uint64_t emission_op : 1; }; uint64_t key; @@ -278,6 +284,7 @@ private: mk.grow = grow_enabled; mk.proximity_fade = proximity_fade_enabled; mk.distance_fade = distance_fade_enabled; + mk.emission_op = emission_op; return mk; } @@ -394,6 +401,7 @@ private: SpecularMode specular_mode; DiffuseMode diffuse_mode; BillboardMode billboard_mode; + EmissionOperator emission_op; TextureChannel metallic_texture_channel; TextureChannel roughness_texture_channel; @@ -571,6 +579,9 @@ public: void set_distance_fade_min_distance(float p_distance); float get_distance_fade_min_distance() const; + void set_emission_operator(EmissionOperator p_op); + EmissionOperator get_emission_operator() const; + void set_metallic_texture_channel(TextureChannel p_channel); TextureChannel get_metallic_texture_channel() const; void set_roughness_texture_channel(TextureChannel p_channel); @@ -603,6 +614,7 @@ VARIANT_ENUM_CAST(SpatialMaterial::DiffuseMode) VARIANT_ENUM_CAST(SpatialMaterial::SpecularMode) VARIANT_ENUM_CAST(SpatialMaterial::BillboardMode) VARIANT_ENUM_CAST(SpatialMaterial::TextureChannel) +VARIANT_ENUM_CAST(SpatialMaterial::EmissionOperator) ////////////////////// diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 26f5deae1d..0a886c25b1 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -594,9 +594,9 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) { } ERR_FAIL_COND_V(!d.has("aabb"), false); - Rect3 aabb = d["aabb"]; + AABB aabb = d["aabb"]; - Vector<Rect3> bone_aabb; + Vector<AABB> bone_aabb; if (d.has("skeleton_aabb")) { Array baabb = d["skeleton_aabb"]; bone_aabb.resize(baabb.size()); @@ -676,7 +676,7 @@ bool ArrayMesh::_get(const StringName &p_name, Variant &r_ret) const { d["format"] = VS::get_singleton()->mesh_surface_get_format(mesh, idx); d["aabb"] = VS::get_singleton()->mesh_surface_get_aabb(mesh, idx); - Vector<Rect3> skel_aabb = VS::get_singleton()->mesh_surface_get_skeleton_aabb(mesh, idx); + Vector<AABB> skel_aabb = VS::get_singleton()->mesh_surface_get_skeleton_aabb(mesh, idx); Array arr; for (int i = 0; i < skel_aabb.size(); i++) { arr[i] = skel_aabb[i]; @@ -725,13 +725,13 @@ void ArrayMesh::_get_property_list(List<PropertyInfo> *p_list) const { } } - p_list->push_back(PropertyInfo(Variant::RECT3, "custom_aabb/custom_aabb")); + p_list->push_back(PropertyInfo(Variant::AABB, "custom_aabb/custom_aabb")); } void ArrayMesh::_recompute_aabb() { // regenerate AABB - aabb = Rect3(); + aabb = AABB(); for (int i = 0; i < surfaces.size(); i++) { @@ -742,7 +742,7 @@ void ArrayMesh::_recompute_aabb() { } } -void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<Rect3> &p_bone_aabbs) { +void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<AABB> &p_bone_aabbs) { Surface s; s.aabb = p_aabb; @@ -772,7 +772,7 @@ void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array & const Vector3 *vtx = r.ptr(); // check AABB - Rect3 aabb; + AABB aabb; for (int i = 0; i < len; i++) { if (i == 0) @@ -920,7 +920,13 @@ String ArrayMesh::surface_get_name(int p_idx) const { return surfaces[p_idx].name; } -void ArrayMesh::surface_set_custom_aabb(int p_idx, const Rect3 &p_aabb) { +void ArrayMesh::surface_update_region(int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) { + + ERR_FAIL_INDEX(p_surface, surfaces.size()); + VS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data); +} + +void ArrayMesh::surface_set_custom_aabb(int p_idx, const AABB &p_aabb) { ERR_FAIL_INDEX(p_idx, surfaces.size()); surfaces[p_idx].aabb = p_aabb; @@ -936,7 +942,7 @@ Ref<Material> ArrayMesh::surface_get_material(int p_idx) const { void ArrayMesh::add_surface_from_mesh_data(const Geometry::MeshData &p_mesh_data) { VisualServer::get_singleton()->mesh_add_surface_from_mesh_data(mesh, p_mesh_data); - Rect3 aabb; + AABB aabb; for (int i = 0; i < p_mesh_data.vertices.size(); i++) { if (i == 0) @@ -964,18 +970,18 @@ RID ArrayMesh::get_rid() const { return mesh; } -Rect3 ArrayMesh::get_aabb() const { +AABB ArrayMesh::get_aabb() const { return aabb; } -void ArrayMesh::set_custom_aabb(const Rect3 &p_custom) { +void ArrayMesh::set_custom_aabb(const AABB &p_custom) { custom_aabb = p_custom; VS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb); } -Rect3 ArrayMesh::get_custom_aabb() const { +AABB ArrayMesh::get_custom_aabb() const { return custom_aabb; } @@ -1041,6 +1047,7 @@ void ArrayMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("add_surface_from_arrays", "primitive", "arrays", "blend_shapes", "compress_flags"), &ArrayMesh::add_surface_from_arrays, DEFVAL(Array()), DEFVAL(ARRAY_COMPRESS_DEFAULT)); ClassDB::bind_method(D_METHOD("get_surface_count"), &ArrayMesh::get_surface_count); ClassDB::bind_method(D_METHOD("surface_remove", "surf_idx"), &ArrayMesh::surface_remove); + ClassDB::bind_method(D_METHOD("surface_update_region", "surf_idx", "offset", "data"), &ArrayMesh::surface_update_region); ClassDB::bind_method(D_METHOD("surface_get_array_len", "surf_idx"), &ArrayMesh::surface_get_array_len); ClassDB::bind_method(D_METHOD("surface_get_array_index_len", "surf_idx"), &ArrayMesh::surface_get_array_index_len); ClassDB::bind_method(D_METHOD("surface_get_format", "surf_idx"), &ArrayMesh::surface_get_format); @@ -1090,11 +1097,13 @@ void ArrayMesh::_bind_methods() { } void ArrayMesh::reload_from_file() { - for (int i = 0; i < get_surface_count(); i++) { - surface_remove(i); - } + VisualServer::get_singleton()->mesh_clear(mesh); + surfaces.clear(); + clear_blend_shapes(); + Resource::reload_from_file(); - String path = get_path(); + + _change_notify(); } ArrayMesh::ArrayMesh() { diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index b11adf50b9..b85a6a84af 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -95,6 +95,7 @@ public: ARRAY_FLAG_USE_2D_VERTICES = ARRAY_COMPRESS_INDEX << 1, ARRAY_FLAG_USE_16_BIT_BONES = ARRAY_COMPRESS_INDEX << 2, + ARRAY_FLAG_USE_DYNAMIC_UPDATE = ARRAY_COMPRESS_INDEX << 3, ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_VERTEX | ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS @@ -135,7 +136,7 @@ public: Ref<Mesh> create_outline(float p_margin) const; - virtual Rect3 get_aabb() const = 0; + virtual AABB get_aabb() const = 0; Mesh(); }; @@ -148,16 +149,16 @@ class ArrayMesh : public Mesh { private: struct Surface { String name; - Rect3 aabb; + AABB aabb; Ref<Material> material; bool is_2d; }; Vector<Surface> surfaces; RID mesh; - Rect3 aabb; + AABB aabb; BlendShapeMode blend_shape_mode; Vector<StringName> blend_shapes; - Rect3 custom_aabb; + AABB custom_aabb; void _recompute_aabb(); @@ -172,7 +173,7 @@ protected: public: void add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), uint32_t p_flags = ARRAY_COMPRESS_DEFAULT); - void add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<Rect3> &p_bone_aabbs = Vector<Rect3>()); + void add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()); Array surface_get_arrays(int p_surface) const; Array surface_get_blend_shape_arrays(int p_surface) const; @@ -185,10 +186,12 @@ public: void set_blend_shape_mode(BlendShapeMode p_mode); BlendShapeMode get_blend_shape_mode() const; + void surface_update_region(int p_surface, int p_offset, const PoolVector<uint8_t> &p_data); + int get_surface_count() const; void surface_remove(int p_idx); - void surface_set_custom_aabb(int p_idx, const Rect3 &p_aabb); //only recognized by driver + void surface_set_custom_aabb(int p_idx, const AABB &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; @@ -204,10 +207,10 @@ public: void add_surface_from_mesh_data(const Geometry::MeshData &p_mesh_data); - void set_custom_aabb(const Rect3 &p_custom); - Rect3 get_custom_aabb() const; + void set_custom_aabb(const AABB &p_custom); + AABB get_custom_aabb() const; - Rect3 get_aabb() const; + AABB get_aabb() const; virtual RID get_rid() const; void center_geometry(); diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 15f1e15542..ee6efa6e85 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -155,7 +155,7 @@ Color MultiMesh::get_instance_color(int p_instance) const { return VisualServer::get_singleton()->multimesh_instance_get_color(multimesh, p_instance); } -Rect3 MultiMesh::get_aabb() const { +AABB MultiMesh::get_aabb() const { return VisualServer::get_singleton()->multimesh_get_aabb(multimesh); } diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h index 7ca66b0b46..0a5310f641 100644 --- a/scene/resources/multimesh.h +++ b/scene/resources/multimesh.h @@ -84,7 +84,7 @@ public: void set_instance_color(int p_instance, const Color &p_color); Color get_instance_color(int p_instance) const; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual RID get_rid() const; diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 8e3899315c..3b80db291c 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -42,7 +42,7 @@ void PrimitiveMesh::_update() const { PoolVector<Vector3> points = arr[VS::ARRAY_VERTEX]; - aabb = Rect3(); + aabb = AABB(); int pc = points.size(); ERR_FAIL_COND(pc == 0); @@ -141,7 +141,7 @@ StringName PrimitiveMesh::get_blend_shape_name(int p_index) const { return StringName(); } -Rect3 PrimitiveMesh::get_aabb() const { +AABB PrimitiveMesh::get_aabb() const { if (pending_request) { _update(); } diff --git a/scene/resources/primitive_meshes.h b/scene/resources/primitive_meshes.h index f0c8935261..b38c247827 100644 --- a/scene/resources/primitive_meshes.h +++ b/scene/resources/primitive_meshes.h @@ -47,7 +47,7 @@ class PrimitiveMesh : public Mesh { private: RID mesh; - mutable Rect3 aabb; + mutable AABB aabb; Ref<Material> material; @@ -73,7 +73,7 @@ public: virtual Ref<Material> surface_get_material(int p_idx) const; virtual int get_blend_shape_count() const; virtual StringName get_blend_shape_name(int p_index) const; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual RID get_rid() const; void set_material(const Ref<Material> &p_material); diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index f0304bfaa5..fe23fbf6b3 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -33,7 +33,7 @@ #include "project_settings.h" #include "version.h" -//version 2: changed names for basis, rect3, poolvectors, etc. +//version 2: changed names for basis, aabb, poolvectors, etc. #define FORMAT_VERSION 2 #include "os/dir_access.h" diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 50e8c28c22..29ac7852bf 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -57,11 +57,9 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { tile_set_region(id, p_value); else if (what == "shape") tile_set_shape(id, 0, p_value); - else if (what == "shape_offset") { - Transform2D xform = tile_get_shape_transform(id, 0); - xform.set_origin(p_value); - tile_set_shape_transform(id, 0, xform); - } else if (what == "shape_transform") + else if (what == "shape_offset") + tile_set_shape_offset(id, 0, p_value); + else if (what == "shape_transform") tile_set_shape_transform(id, 0, p_value); else if (what == "shape_one_way") tile_set_shape_one_way(id, 0, p_value); @@ -110,7 +108,7 @@ bool TileSet::_get(const StringName &p_name, Variant &r_ret) const { else if (what == "shape") r_ret = tile_get_shape(id, 0); else if (what == "shape_offset") - r_ret = tile_get_shape_transform(id, 0).get_origin(); + r_ret = tile_get_shape_offset(id, 0); else if (what == "shape_transform") r_ret = tile_get_shape_transform(id, 0); else if (what == "shape_one_way") @@ -313,6 +311,16 @@ Transform2D TileSet::tile_get_shape_transform(int p_id, int p_shape_id) const { return Transform2D(); } +void TileSet::tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset) { + Transform2D transform = tile_get_shape_transform(p_id, p_shape_id); + transform.set_origin(p_offset); + tile_set_shape_transform(p_id, p_shape_id, transform); +} + +Vector2 TileSet::tile_get_shape_offset(int p_id, int p_shape_id) const { + return tile_get_shape_transform(p_id, p_shape_id).get_origin(); +} + void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) { ERR_FAIL_COND(!tile_map.has(p_id)); diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index fe782ff987..3ef3f00cef 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -108,6 +108,9 @@ public: 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_offset(int p_id, int p_shape_id, const Vector2 &p_offset); + Vector2 tile_get_shape_offset(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); bool tile_get_shape_one_way(int p_id, int p_shape_id) const; diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index af159975ca..86b32a5cdd 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -41,7 +41,7 @@ struct SpatialIndexer { struct NotifierData { - Rect3 aabb; + AABB aabb; OctreeElementID id; }; @@ -63,7 +63,7 @@ struct SpatialIndexer { uint64_t pass; uint64_t last_frame; - void _notifier_add(VisibilityNotifier *p_notifier, const Rect3 &p_rect) { + void _notifier_add(VisibilityNotifier *p_notifier, const AABB &p_rect) { ERR_FAIL_COND(notifiers.has(p_notifier)); notifiers[p_notifier].aabb = p_rect; @@ -71,7 +71,7 @@ struct SpatialIndexer { changed = true; } - void _notifier_update(VisibilityNotifier *p_notifier, const Rect3 &p_rect) { + void _notifier_update(VisibilityNotifier *p_notifier, const AABB &p_rect) { Map<VisibilityNotifier *, NotifierData>::Element *E = notifiers.find(p_notifier); ERR_FAIL_COND(!E); @@ -229,14 +229,14 @@ void World::_remove_camera(Camera *p_camera) { #endif } -void World::_register_notifier(VisibilityNotifier *p_notifier, const Rect3 &p_rect) { +void World::_register_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) { #ifndef _3D_DISABLED indexer->_notifier_add(p_notifier, p_rect); #endif } -void World::_update_notifier(VisibilityNotifier *p_notifier, const Rect3 &p_rect) { +void World::_update_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) { #ifndef _3D_DISABLED indexer->_notifier_update(p_notifier, p_rect); diff --git a/scene/resources/world.h b/scene/resources/world.h index 767d1b5b6e..e0f1de1fd0 100644 --- a/scene/resources/world.h +++ b/scene/resources/world.h @@ -60,8 +60,8 @@ protected: void _update_camera(Camera *p_camera); void _remove_camera(Camera *p_camera); - void _register_notifier(VisibilityNotifier *p_notifier, const Rect3 &p_rect); - void _update_notifier(VisibilityNotifier *p_notifier, const Rect3 &p_rect); + void _register_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect); + void _update_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect); void _remove_notifier(VisibilityNotifier *p_notifier); friend class Viewport; void _update(uint64_t p_frame); diff --git a/servers/physics/broad_phase_basic.cpp b/servers/physics/broad_phase_basic.cpp index c6565ac2e9..e4eae09c61 100644 --- a/servers/physics/broad_phase_basic.cpp +++ b/servers/physics/broad_phase_basic.cpp @@ -46,7 +46,7 @@ BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object, int p_subi return current; } -void BroadPhaseBasic::move(ID p_id, const Rect3 &p_aabb) { +void BroadPhaseBasic::move(ID p_id, const AABB &p_aabb) { Map<ID, Element>::Element *E = element_map.find(p_id); ERR_FAIL_COND(!E); @@ -109,7 +109,7 @@ int BroadPhaseBasic::cull_point(const Vector3 &p_point, CollisionObjectSW **p_re for (Map<ID, Element>::Element *E = element_map.front(); E; E = E->next()) { - const Rect3 aabb = E->get().aabb; + const AABB aabb = E->get().aabb; if (aabb.has_point(p_point)) { p_results[rc] = E->get().owner; @@ -129,7 +129,7 @@ int BroadPhaseBasic::cull_segment(const Vector3 &p_from, const Vector3 &p_to, Co for (Map<ID, Element>::Element *E = element_map.front(); E; E = E->next()) { - const Rect3 aabb = E->get().aabb; + const AABB aabb = E->get().aabb; if (aabb.intersects_segment(p_from, p_to)) { p_results[rc] = E->get().owner; @@ -142,13 +142,13 @@ int BroadPhaseBasic::cull_segment(const Vector3 &p_from, const Vector3 &p_to, Co return rc; } -int BroadPhaseBasic::cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) { +int BroadPhaseBasic::cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) { int rc = 0; for (Map<ID, Element>::Element *E = element_map.front(); E; E = E->next()) { - const Rect3 aabb = E->get().aabb; + const AABB aabb = E->get().aabb; if (aabb.intersects(p_aabb)) { p_results[rc] = E->get().owner; diff --git a/servers/physics/broad_phase_basic.h b/servers/physics/broad_phase_basic.h index 5c124c1792..ee683ed840 100644 --- a/servers/physics/broad_phase_basic.h +++ b/servers/physics/broad_phase_basic.h @@ -39,7 +39,7 @@ class BroadPhaseBasic : public BroadPhaseSW { CollisionObjectSW *owner; bool _static; - Rect3 aabb; + AABB aabb; int subindex; }; @@ -83,7 +83,7 @@ class BroadPhaseBasic : public BroadPhaseSW { public: // 0 is an invalid ID virtual ID create(CollisionObjectSW *p_object, int p_subindex = 0); - virtual void move(ID p_id, const Rect3 &p_aabb); + virtual void move(ID p_id, const AABB &p_aabb); virtual void set_static(ID p_id, bool p_static); virtual void remove(ID p_id); @@ -93,7 +93,7 @@ public: virtual int cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL); virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL); - virtual int cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL); + virtual int cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL); virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata); virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata); diff --git a/servers/physics/broad_phase_octree.cpp b/servers/physics/broad_phase_octree.cpp index e7111d9580..3b18a270f0 100644 --- a/servers/physics/broad_phase_octree.cpp +++ b/servers/physics/broad_phase_octree.cpp @@ -32,11 +32,11 @@ BroadPhaseSW::ID BroadPhaseOctree::create(CollisionObjectSW *p_object, int p_subindex) { - ID oid = octree.create(p_object, Rect3(), p_subindex, false, 1 << p_object->get_type(), 0); + ID oid = octree.create(p_object, AABB(), p_subindex, false, 1 << p_object->get_type(), 0); return oid; } -void BroadPhaseOctree::move(ID p_id, const Rect3 &p_aabb) { +void BroadPhaseOctree::move(ID p_id, const AABB &p_aabb) { octree.move(p_id, p_aabb); } @@ -76,7 +76,7 @@ int BroadPhaseOctree::cull_segment(const Vector3 &p_from, const Vector3 &p_to, C return octree.cull_segment(p_from, p_to, p_results, p_max_results, p_result_indices); } -int BroadPhaseOctree::cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) { +int BroadPhaseOctree::cull_aabb(const AABB &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); } diff --git a/servers/physics/broad_phase_octree.h b/servers/physics/broad_phase_octree.h index d28f2da13f..f894d6ca5a 100644 --- a/servers/physics/broad_phase_octree.h +++ b/servers/physics/broad_phase_octree.h @@ -48,7 +48,7 @@ class BroadPhaseOctree : public BroadPhaseSW { public: // 0 is an invalid ID virtual ID create(CollisionObjectSW *p_object, int p_subindex = 0); - virtual void move(ID p_id, const Rect3 &p_aabb); + virtual void move(ID p_id, const AABB &p_aabb); virtual void set_static(ID p_id, bool p_static); virtual void remove(ID p_id); @@ -58,7 +58,7 @@ public: virtual int cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL); virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL); - virtual int cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL); + virtual int cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL); virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata); virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata); diff --git a/servers/physics/broad_phase_sw.h b/servers/physics/broad_phase_sw.h index 2b5ed629fe..5ad3f9a261 100644 --- a/servers/physics/broad_phase_sw.h +++ b/servers/physics/broad_phase_sw.h @@ -30,8 +30,8 @@ #ifndef BROAD_PHASE_SW_H #define BROAD_PHASE_SW_H +#include "aabb.h" #include "math_funcs.h" -#include "rect3.h" class CollisionObjectSW; @@ -49,7 +49,7 @@ public: // 0 is an invalid ID virtual ID create(CollisionObjectSW *p_object_, int p_subindex = 0) = 0; - virtual void move(ID p_id, const Rect3 &p_aabb) = 0; + virtual void move(ID p_id, const AABB &p_aabb) = 0; virtual void set_static(ID p_id, bool p_static) = 0; virtual void remove(ID p_id) = 0; @@ -59,7 +59,7 @@ public: virtual int cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0; virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0; - virtual int cull_aabb(const Rect3 &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0; + virtual int cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0; virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata) = 0; virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) = 0; diff --git a/servers/physics/collision_object_sw.cpp b/servers/physics/collision_object_sw.cpp index 3af8b542fa..126f8141ff 100644 --- a/servers/physics/collision_object_sw.cpp +++ b/servers/physics/collision_object_sw.cpp @@ -149,7 +149,7 @@ void CollisionObjectSW::_update_shapes() { } //not quite correct, should compute the next matrix.. - Rect3 shape_aabb = s.shape->get_aabb(); + AABB shape_aabb = s.shape->get_aabb(); Transform xform = transform * s.xform; shape_aabb = xform.xform(shape_aabb); s.aabb_cache = shape_aabb; @@ -176,10 +176,10 @@ void CollisionObjectSW::_update_shapes_with_motion(const Vector3 &p_motion) { } //not quite correct, should compute the next matrix.. - Rect3 shape_aabb = s.shape->get_aabb(); + AABB shape_aabb = s.shape->get_aabb(); Transform xform = transform * s.xform; shape_aabb = xform.xform(shape_aabb); - shape_aabb = shape_aabb.merge(Rect3(shape_aabb.position + p_motion, shape_aabb.size)); //use motion + shape_aabb = shape_aabb.merge(AABB(shape_aabb.position + p_motion, shape_aabb.size)); //use motion s.aabb_cache = shape_aabb; space->get_broadphase()->move(s.bpid, shape_aabb); diff --git a/servers/physics/collision_object_sw.h b/servers/physics/collision_object_sw.h index 67a8a44944..254947060b 100644 --- a/servers/physics/collision_object_sw.h +++ b/servers/physics/collision_object_sw.h @@ -61,7 +61,7 @@ private: Transform xform; Transform xform_inv; BroadPhaseSW::ID bpid; - Rect3 aabb_cache; //for rayqueries + AABB aabb_cache; //for rayqueries real_t area_cache; ShapeSW *shape; bool disabled; @@ -123,7 +123,7 @@ public: _FORCE_INLINE_ ShapeSW *get_shape(int p_index) const { return shapes[p_index].shape; } _FORCE_INLINE_ const Transform &get_shape_transform(int p_index) const { return shapes[p_index].xform; } _FORCE_INLINE_ const Transform &get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; } - _FORCE_INLINE_ const Rect3 &get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; } + _FORCE_INLINE_ const AABB &get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; } _FORCE_INLINE_ const real_t get_shape_area(int p_index) const { return shapes[p_index].area_cache; } _FORCE_INLINE_ Transform get_transform() const { return transform; } diff --git a/servers/physics/collision_solver_sw.cpp b/servers/physics/collision_solver_sw.cpp index 7bef208237..a9431dc6d8 100644 --- a/servers/physics/collision_solver_sw.cpp +++ b/servers/physics/collision_solver_sw.cpp @@ -152,7 +152,7 @@ bool CollisionSolverSW::solve_concave(const ShapeSW *p_shape_A, const Transform //quickly compute a local AABB - Rect3 local_aabb; + AABB local_aabb; for (int i = 0; i < 3; i++) { Vector3 axis(p_transform_B.basis.get_axis(i)); @@ -291,7 +291,7 @@ bool CollisionSolverSW::solve_distance_plane(const ShapeSW *p_shape_A, const Tra return collided; } -bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const Rect3 &p_concave_hint, Vector3 *r_sep_axis) { +bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis) { if (p_shape_A->is_concave()) return false; @@ -328,14 +328,14 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform //quickly compute a local AABB - bool use_cc_hint = p_concave_hint != Rect3(); - Rect3 cc_hint_aabb; + bool use_cc_hint = p_concave_hint != AABB(); + AABB cc_hint_aabb; if (use_cc_hint) { cc_hint_aabb = p_concave_hint; cc_hint_aabb.position -= p_transform_B.origin; } - Rect3 local_aabb; + AABB local_aabb; for (int i = 0; i < 3; i++) { Vector3 axis(p_transform_B.basis.get_axis(i)); diff --git a/servers/physics/collision_solver_sw.h b/servers/physics/collision_solver_sw.h index 1e38b1b54e..a40b665ff0 100644 --- a/servers/physics/collision_solver_sw.h +++ b/servers/physics/collision_solver_sw.h @@ -46,7 +46,7 @@ private: public: static bool solve_static(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, Vector3 *r_sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0); - static bool solve_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const Rect3 &p_concave_hint, Vector3 *r_sep_axis = NULL); + static bool solve_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis = NULL); }; #endif // COLLISION_SOLVER__SW_H diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index 6dafaac115..b204ff7a33 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -37,7 +37,7 @@ #define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.0002 #define _FACE_IS_VALID_SUPPORT_THRESHOLD 0.9998 -void ShapeSW::configure(const Rect3 &p_aabb) { +void ShapeSW::configure(const AABB &p_aabb) { aabb = p_aabb; configured = true; for (Map<ShapeOwnerSW *, int>::Element *E = owners.front(); E; E = E->next()) { @@ -141,7 +141,7 @@ Vector3 PlaneShapeSW::get_moment_of_inertia(real_t p_mass) const { void PlaneShapeSW::_setup(const Plane &p_plane) { plane = p_plane; - configure(Rect3(Vector3(-1e4, -1e4, -1e4), Vector3(1e4 * 2, 1e4 * 2, 1e4 * 2))); + configure(AABB(Vector3(-1e4, -1e4, -1e4), Vector3(1e4 * 2, 1e4 * 2, 1e4 * 2))); } void PlaneShapeSW::set_data(const Variant &p_data) { @@ -223,7 +223,7 @@ Vector3 RayShapeSW::get_moment_of_inertia(real_t p_mass) const { void RayShapeSW::_setup(real_t p_length) { length = p_length; - configure(Rect3(Vector3(0, 0, 0), Vector3(0.1, 0.1, length))); + configure(AABB(Vector3(0, 0, 0), Vector3(0.1, 0.1, length))); } void RayShapeSW::set_data(const Variant &p_data) { @@ -299,7 +299,7 @@ Vector3 SphereShapeSW::get_moment_of_inertia(real_t p_mass) const { void SphereShapeSW::_setup(real_t p_radius) { radius = p_radius; - configure(Rect3(Vector3(-radius, -radius, -radius), Vector3(radius * 2.0, radius * 2.0, radius * 2.0))); + configure(AABB(Vector3(-radius, -radius, -radius), Vector3(radius * 2.0, radius * 2.0, radius * 2.0))); } void SphereShapeSW::set_data(const Variant &p_data) { @@ -430,7 +430,7 @@ void BoxShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_sup bool BoxShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const { - Rect3 aabb(-half_extents, half_extents * 2.0); + AABB aabb(-half_extents, half_extents * 2.0); return aabb.intersects_segment(p_begin, p_end, &r_result, &r_normal); } @@ -504,7 +504,7 @@ void BoxShapeSW::_setup(const Vector3 &p_half_extents) { half_extents = p_half_extents.abs(); - configure(Rect3(-half_extents, half_extents * 2)); + configure(AABB(-half_extents, half_extents * 2)); } void BoxShapeSW::set_data(const Variant &p_data) { @@ -684,7 +684,7 @@ void CapsuleShapeSW::_setup(real_t p_height, real_t p_radius) { height = p_height; radius = p_radius; - configure(Rect3(Vector3(-radius, -radius, -height * 0.5 - radius), Vector3(radius * 2, radius * 2, height + radius * 2.0))); + configure(AABB(Vector3(-radius, -radius, -height * 0.5 - radius), Vector3(radius * 2, radius * 2, height + radius * 2.0))); } void CapsuleShapeSW::set_data(const Variant &p_data) { @@ -957,7 +957,7 @@ void ConvexPolygonShapeSW::_setup(const Vector<Vector3> &p_vertices) { if (err != OK) ERR_PRINT("Failed to build QuickHull"); - Rect3 _aabb; + AABB _aabb; for (int i = 0; i < mesh.vertices.size(); i++) { @@ -1102,7 +1102,7 @@ Vector3 FaceShapeSW::get_moment_of_inertia(real_t p_mass) const { FaceShapeSW::FaceShapeSW() { - configure(Rect3()); + configure(AABB()); } PoolVector<Vector3> ConcavePolygonShapeSW::get_faces() const { @@ -1300,13 +1300,13 @@ void ConcavePolygonShapeSW::_cull(int p_idx, _CullParams *p_params) const { } } -void ConcavePolygonShapeSW::cull(const Rect3 &p_local_aabb, Callback p_callback, void *p_userdata) const { +void ConcavePolygonShapeSW::cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const { // make matrix local to concave if (faces.size() == 0) return; - Rect3 local_aabb = p_local_aabb; + AABB local_aabb = p_local_aabb; // unlock data PoolVector<Face>::Read fr = faces.read(); @@ -1341,7 +1341,7 @@ Vector3 ConcavePolygonShapeSW::get_moment_of_inertia(real_t p_mass) const { struct _VolumeSW_BVH_Element { - Rect3 aabb; + AABB aabb; Vector3 center; int face_index; }; @@ -1372,7 +1372,7 @@ struct _VolumeSW_BVH_CompareZ { struct _VolumeSW_BVH { - Rect3 aabb; + AABB aabb; _VolumeSW_BVH *left; _VolumeSW_BVH *right; @@ -1396,7 +1396,7 @@ _VolumeSW_BVH *_volume_sw_build_bvh(_VolumeSW_BVH_Element *p_elements, int p_siz bvh->face_index = -1; } - Rect3 aabb; + AABB aabb; for (int i = 0; i < p_size; i++) { if (i == 0) @@ -1467,7 +1467,7 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { int src_face_count = p_faces.size(); if (src_face_count == 0) { - configure(Rect3()); + configure(AABB()); return; } ERR_FAIL_COND(src_face_count % 3); @@ -1491,7 +1491,7 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { PoolVector<Vector3>::Write vw = vertices.write(); Vector3 *verticesw = vw.ptr(); - Rect3 _aabb; + AABB _aabb; for (int i = 0; i < src_face_count; i++) { @@ -1588,7 +1588,7 @@ Vector3 HeightMapShapeSW::get_closest_point_to(const Vector3 &p_point) const { return Vector3(); } -void HeightMapShapeSW::cull(const Rect3 &p_local_aabb, Callback p_callback, void *p_userdata) const { +void HeightMapShapeSW::cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const { } Vector3 HeightMapShapeSW::get_moment_of_inertia(real_t p_mass) const { @@ -1611,7 +1611,7 @@ void HeightMapShapeSW::_setup(PoolVector<real_t> p_heights, int p_width, int p_d PoolVector<real_t>::Read r = heights.read(); - Rect3 aabb; + AABB aabb; for (int i = 0; i < depth; i++) { diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h index 151b84c054..48832affc9 100644 --- a/servers/physics/shape_sw.h +++ b/servers/physics/shape_sw.h @@ -58,14 +58,14 @@ public: class ShapeSW : public RID_Data { RID self; - Rect3 aabb; + AABB aabb; bool configured; real_t custom_bias; Map<ShapeOwnerSW *, int> owners; protected: - void configure(const Rect3 &p_aabb); + void configure(const AABB &p_aabb); public: enum { @@ -79,7 +79,7 @@ public: virtual PhysicsServer::ShapeType get_type() const = 0; - _FORCE_INLINE_ Rect3 get_aabb() const { return aabb; } + _FORCE_INLINE_ AABB get_aabb() const { return aabb; } _FORCE_INLINE_ bool is_configured() const { return configured; } virtual bool is_concave() const { return false; } @@ -114,7 +114,7 @@ public: typedef void (*Callback)(void *p_userdata, ShapeSW *p_convex); virtual void get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const { r_amount = 0; } - virtual void cull(const Rect3 &p_local_aabb, Callback p_callback, void *p_userdata) const = 0; + virtual void cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const = 0; ConcaveShapeSW() {} }; @@ -299,7 +299,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { struct BVH { - Rect3 aabb; + AABB aabb; int left; int right; @@ -310,7 +310,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW { struct _CullParams { - Rect3 aabb; + AABB aabb; Callback callback; void *userdata; const Face *faces; @@ -353,7 +353,7 @@ public: virtual bool intersect_point(const Vector3 &p_point) const; virtual Vector3 get_closest_point_to(const Vector3 &p_point) const; - virtual void cull(const Rect3 &p_local_aabb, Callback p_callback, void *p_userdata) const; + virtual void cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const; virtual Vector3 get_moment_of_inertia(real_t p_mass) const; @@ -389,7 +389,7 @@ public: virtual bool intersect_point(const Vector3 &p_point) const; virtual Vector3 get_closest_point_to(const Vector3 &p_point) const; - virtual void cull(const Rect3 &p_local_aabb, Callback p_callback, void *p_userdata) const; + virtual void cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const; virtual Vector3 get_moment_of_inertia(real_t p_mass) const; @@ -462,7 +462,7 @@ struct MotionShapeSW : public ShapeSW { virtual void set_data(const Variant &p_data) {} virtual Variant get_data() const { return Variant(); } - MotionShapeSW() { configure(Rect3()); } + MotionShapeSW() { configure(AABB()); } }; struct _ShapeTestConvexBSPSW { diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index 7fac56f3d7..a6426b7ee0 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -176,7 +176,7 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transfo ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape); ERR_FAIL_COND_V(!shape, 0); - Rect3 aabb = p_xform.xform(shape->get_aabb()); + AABB aabb = p_xform.xform(shape->get_aabb()); int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results); @@ -224,8 +224,8 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape); ERR_FAIL_COND_V(!shape, false); - Rect3 aabb = p_xform.xform(shape->get_aabb()); - aabb = aabb.merge(Rect3(aabb.position + p_motion, aabb.size)); //motion + AABB aabb = p_xform.xform(shape->get_aabb()); + aabb = aabb.merge(AABB(aabb.position + p_motion, aabb.size)); //motion aabb = aabb.grow(p_margin); /* @@ -341,7 +341,7 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_sh ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape); ERR_FAIL_COND_V(!shape, 0); - Rect3 aabb = p_shape_xform.xform(shape->get_aabb()); + AABB aabb = p_shape_xform.xform(shape->get_aabb()); aabb = aabb.grow(p_margin); int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results); @@ -417,7 +417,7 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_ ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.get(p_shape); ERR_FAIL_COND_V(!shape, 0); - Rect3 aabb = p_shape_xform.xform(shape->get_aabb()); + AABB aabb = p_shape_xform.xform(shape->get_aabb()); aabb = aabb.grow(p_margin); int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results); @@ -514,7 +514,7 @@ PhysicsDirectSpaceStateSW::PhysicsDirectSpaceStateSW() { //////////////////////////////////////////////////////////////////////////////////////////////////////////// -int SpaceSW::_cull_aabb_for_body(BodySW *p_body, const Rect3 &p_aabb) { +int SpaceSW::_cull_aabb_for_body(BodySW *p_body, const AABB &p_aabb) { int amount = broadphase->cull_aabb(p_aabb, intersection_query_results, INTERSECTION_QUERY_MAX, intersection_query_subindex_results); @@ -561,7 +561,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve r_result->collider_id = 0; r_result->collider_shape = 0; } - Rect3 body_aabb; + AABB body_aabb; for (int i = 0; i < p_body->get_shape_count(); i++) { @@ -648,7 +648,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve { // STEP 2 ATTEMPT MOTION - Rect3 motion_aabb = body_aabb; + AABB motion_aabb = body_aabb; motion_aabb.position += p_motion; motion_aabb = motion_aabb.merge(body_aabb); diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h index 270e4ef1bd..fd7e6d16a9 100644 --- a/servers/physics/space_sw.h +++ b/servers/physics/space_sw.h @@ -122,7 +122,7 @@ private: friend class PhysicsDirectSpaceStateSW; - int _cull_aabb_for_body(BodySW *p_body, const Rect3 &p_aabb); + int _cull_aabb_for_body(BodySW *p_body, const AABB &p_aabb); public: _FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; } diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index 1ba9e7b174..99493afc40 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "register_server_types.h" +#include "engine.h" #include "project_settings.h" #include "arvr/arvr_interface.h" @@ -171,9 +172,9 @@ void unregister_server_types() { } void register_server_singletons() { - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("VisualServer", VisualServer::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("AudioServer", AudioServer::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("PhysicsServer", PhysicsServer::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Physics2DServer", Physics2DServer::get_singleton())); - ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ARVRServer", ARVRServer::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("VisualServer", VisualServer::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("AudioServer", AudioServer::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer", PhysicsServer::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("Physics2DServer", Physics2DServer::get_singleton())); + Engine::get_singleton()->add_singleton(Engine::Singleton("ARVRServer", ARVRServer::get_singleton())); } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 164baa8c9b..21d059c48e 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -234,7 +234,7 @@ public: virtual RID mesh_create() = 0; - virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<Rect3> &p_bone_aabbs = Vector<Rect3>()) = 0; + virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) = 0; virtual void mesh_set_blend_shape_count(RID p_mesh, int p_amount) = 0; virtual int mesh_get_blend_shape_count(RID p_mesh) const = 0; @@ -242,6 +242,8 @@ public: virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) = 0; virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0; + virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) = 0; + virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0; @@ -254,17 +256,17 @@ public: virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const = 0; virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const = 0; - virtual Rect3 mesh_surface_get_aabb(RID p_mesh, int p_surface) const = 0; + virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const = 0; virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const = 0; - virtual Vector<Rect3> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const = 0; + virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const = 0; virtual void mesh_remove_surface(RID p_mesh, int p_index) = 0; virtual int mesh_get_surface_count(RID p_mesh) const = 0; - virtual void mesh_set_custom_aabb(RID p_mesh, const Rect3 &p_aabb) = 0; - virtual Rect3 mesh_get_custom_aabb(RID p_mesh) const = 0; + virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) = 0; + virtual AABB mesh_get_custom_aabb(RID p_mesh) const = 0; - virtual Rect3 mesh_get_aabb(RID p_mesh, RID p_skeleton) const = 0; + virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const = 0; virtual void mesh_clear(RID p_mesh) = 0; /* MULTIMESH API */ @@ -288,7 +290,7 @@ public: virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible) = 0; virtual int multimesh_get_visible_instances(RID p_multimesh) const = 0; - virtual Rect3 multimesh_get_aabb(RID p_multimesh) const = 0; + virtual AABB multimesh_get_aabb(RID p_multimesh) const = 0; /* IMMEDIATE API */ @@ -304,7 +306,7 @@ public: virtual void immediate_clear(RID p_immediate) = 0; virtual void immediate_set_material(RID p_immediate, RID p_material) = 0; virtual RID immediate_get_material(RID p_immediate) const = 0; - virtual Rect3 immediate_get_aabb(RID p_immediate) const = 0; + virtual AABB immediate_get_aabb(RID p_immediate) const = 0; /* SKELETON API */ @@ -348,7 +350,7 @@ public: virtual bool light_has_shadow(RID p_light) const = 0; virtual VS::LightType light_get_type(RID p_light) const = 0; - virtual Rect3 light_get_aabb(RID p_light) const = 0; + virtual AABB light_get_aabb(RID p_light) const = 0; virtual float light_get_param(RID p_light, VS::LightParam p_param) = 0; virtual Color light_get_color(RID p_light) = 0; virtual uint64_t light_get_version(RID p_light) const = 0; @@ -370,7 +372,7 @@ public: virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable) = 0; virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) = 0; - virtual Rect3 reflection_probe_get_aabb(RID p_probe) const = 0; + virtual AABB reflection_probe_get_aabb(RID p_probe) const = 0; virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const = 0; virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const = 0; virtual Vector3 reflection_probe_get_extents(RID p_probe) const = 0; @@ -388,8 +390,8 @@ public: virtual RID gi_probe_create() = 0; - virtual void gi_probe_set_bounds(RID p_probe, const Rect3 &p_bounds) = 0; - virtual Rect3 gi_probe_get_bounds(RID p_probe) const = 0; + virtual void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) = 0; + virtual AABB gi_probe_get_bounds(RID p_probe) const = 0; virtual void gi_probe_set_cell_size(RID p_probe, float p_range) = 0; virtual float gi_probe_get_cell_size(RID p_probe) const = 0; @@ -444,7 +446,7 @@ public: virtual void particles_set_pre_process_time(RID p_particles, float p_time) = 0; virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio) = 0; virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio) = 0; - virtual void particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb) = 0; + virtual void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) = 0; virtual void particles_set_speed_scale(RID p_particles, float p_scale) = 0; virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable) = 0; virtual void particles_set_process_material(RID p_particles, RID p_material) = 0; @@ -458,8 +460,8 @@ public: virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) = 0; virtual void particles_request_process(RID p_particles) = 0; - virtual Rect3 particles_get_current_aabb(RID p_particles) = 0; - virtual Rect3 particles_get_aabb(RID p_particles) const = 0; + virtual AABB particles_get_current_aabb(RID p_particles) = 0; + virtual AABB particles_get_aabb(RID p_particles) const = 0; virtual void particles_set_emission_transform(RID p_particles, const Transform &p_transform) = 0; @@ -880,7 +882,7 @@ public: case Item::Command::TYPE_MESH: { const Item::CommandMesh *mesh = static_cast<const Item::CommandMesh *>(c); - Rect3 aabb = RasterizerStorage::base_singleton->mesh_get_aabb(mesh->mesh, mesh->skeleton); + AABB aabb = RasterizerStorage::base_singleton->mesh_get_aabb(mesh->mesh, mesh->skeleton); r = Rect2(aabb.position.x, aabb.position.y, aabb.size.x, aabb.size.y); @@ -888,7 +890,7 @@ public: case Item::Command::TYPE_MULTIMESH: { const Item::CommandMultiMesh *multimesh = static_cast<const Item::CommandMultiMesh *>(c); - Rect3 aabb = RasterizerStorage::base_singleton->multimesh_get_aabb(multimesh->multimesh); + AABB aabb = RasterizerStorage::base_singleton->multimesh_get_aabb(multimesh->multimesh); r = Rect2(aabb.position.x, aabb.position.y, aabb.size.x, aabb.size.y); @@ -897,7 +899,7 @@ public: const Item::CommandParticles *particles_cmd = static_cast<const Item::CommandParticles *>(c); if (particles_cmd->particles.is_valid()) { - Rect3 aabb = RasterizerStorage::base_singleton->particles_get_aabb(particles_cmd->particles); + AABB aabb = RasterizerStorage::base_singleton->particles_get_aabb(particles_cmd->particles); r = Rect2(aabb.position.x, aabb.position.y, aabb.size.x, aabb.size.y); } diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 69e2d1c162..9432d3fdd9 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -120,6 +120,8 @@ void VisualServerRaster::draw() { frame_drawn_callbacks.pop_front(); } + + emit_signal("frame_drawn_in_thread"); } void VisualServerRaster::sync() { } diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index b579f4032f..08a0cfa269 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -73,527 +73,12 @@ class VisualServerRaster : public VisualServer { List<FrameDrawnCallbacks> frame_drawn_callbacks; -// FIXME: Kept as reference for future implementation -#if 0 - struct Room { - - bool occlude_exterior; - BSP_Tree bounds; - Room() { occlude_exterior=true; } - }; - - - BalloonAllocator<> octree_allocator; - - struct OctreeAllocator { - - static BalloonAllocator<> *allocator; - - _FORCE_INLINE_ static void *alloc(size_t p_size) { return allocator->alloc(p_size); } - _FORCE_INLINE_ static void free(void *p_ptr) { return allocator->free(p_ptr); } - - }; - - struct Portal { - - bool enabled; - float disable_distance; - Color disable_color; - float connect_range; - Vector<Point2> shape; - Rect2 bounds; - - - Portal() { enabled=true; disable_distance=50; disable_color=Color(); connect_range=0.8; } - }; - - struct BakedLight { - - Rasterizer::BakedLightData data; - PoolVector<int> sampler; - Rect3 octree_aabb; - Size2i octree_tex_size; - Size2i light_tex_size; - - }; - - struct BakedLightSampler { - - float params[BAKED_LIGHT_SAMPLER_MAX]; - int resolution; - Vector<Vector3> dp_cache; - - BakedLightSampler() { - params[BAKED_LIGHT_SAMPLER_STRENGTH]=1.0; - params[BAKED_LIGHT_SAMPLER_ATTENUATION]=1.0; - params[BAKED_LIGHT_SAMPLER_RADIUS]=1.0; - params[BAKED_LIGHT_SAMPLER_DETAIL_RATIO]=0.1; - resolution=16; - } - }; - - void _update_baked_light_sampler_dp_cache(BakedLightSampler * blsamp); - struct Camera { - - enum Type { - PERSPECTIVE, - ORTHOGONAL - }; - Type type; - float fov; - float znear,zfar; - float size; - uint32_t visible_layers; - bool vaspect; - RID env; - - Transform transform; - - Camera() { - - visible_layers=0xFFFFFFFF; - fov=60; - type=PERSPECTIVE; - znear=0.1; zfar=100; - size=1.0; - vaspect=false; - - } - }; - - - struct Instance; - typedef Set<Instance*,Comparator<Instance*>,OctreeAllocator> InstanceSet; - struct Scenario; - - struct Instance { - - enum { - - MAX_LIGHTS=4 - }; - - RID self; - OctreeElementID octree_id; - Scenario *scenario; - bool update; - bool update_aabb; - bool update_materials; - Instance *update_next; - InstanceType base_type; - - RID base_rid; - - Rect3 aabb; - Rect3 transformed_aabb; - uint32_t object_ID; - bool visible; - bool visible_in_all_rooms; - uint32_t layer_mask; - float draw_range_begin; - float draw_range_end; - float extra_margin; - - - - Rasterizer::InstanceData data; - - - Set<Instance*> auto_rooms; - Set<Instance*> valid_auto_rooms; - Instance *room; - List<Instance*>::Element *RE; - Instance *baked_light; - List<Instance*>::Element *BLE; - Instance *sampled_light; - bool exterior; - - uint64_t last_render_pass; - uint64_t last_frame_pass; - - uint64_t version; // changes to this, and changes to base increase version - - InstanceSet lights; - bool light_cache_dirty; - - - - struct RoomInfo { - - Transform affine_inverse; - Room *room; - List<Instance*> owned_geometry_instances; - List<Instance*> owned_portal_instances; - List<Instance*> owned_room_instances; - List<Instance*> owned_light_instances; //not used, but just for the sake of it - Set<Instance*> disconnected_child_portals; - Set<Instance*> owned_autoroom_geometry; - uint64_t last_visited_pass; - RoomInfo() { last_visited_pass=0; } - - }; - - struct PortalInfo { - - Portal *portal; - Set<Instance*> candidate_set; - Instance *connected; - uint64_t last_visited_pass; - - Plane plane_cache; - Vector<Vector3> transformed_point_cache; - - - PortalInfo() { connected=NULL; last_visited_pass=0;} - }; - - struct LightInfo { - - RID instance; - int light_set_index; - uint64_t last_version; - uint64_t last_add_pass; - List<RID>::Element *D; // directional light in scenario - InstanceSet affected; - bool enabled; - float dtc; //distance to camera, used for sorting - - - LightInfo() { - - D=NULL; - light_set_index=-1; - last_add_pass=0; - enabled=true; - } - }; - - struct BakedLightInfo { - - BakedLight *baked_light; - Transform affine_inverse; - List<Instance*> owned_instances; - }; - - struct BakedLightSamplerInfo { - - Set<Instance*> baked_lights; - Set<Instance*> owned_instances; - BakedLightSampler *sampler; - int resolution; - Vector<Color> light_buffer; - RID sampled_light; - uint64_t last_pass; - Transform xform; // viewspace normal to lightspace, might not use one. - BakedLightSamplerInfo() { - sampler=NULL; - last_pass=0; - resolution=0; - } - }; - - struct ParticlesInfo { - - RID instance; - }; - - - RoomInfo *room_info; - LightInfo *light_info; - ParticlesInfo *particles_info; - PortalInfo * portal_info; - BakedLightInfo * baked_light_info; - BakedLightSamplerInfo * baked_light_sampler_info; - - - Instance() { - octree_id=0; - update_next=0; - object_ID=0; - last_render_pass=0; - last_frame_pass=0; - light_info=0; - particles_info=0; - update_next=NULL; - update=false; - visible=true; - data.cast_shadows=SHADOW_CASTING_SETTING_ON; - data.receive_shadows=true; - data.depth_scale=false; - data.billboard=false; - data.billboard_y=false; - data.baked_light=NULL; - data.baked_light_octree_xform=NULL; - data.baked_lightmap_id=-1; - version=1; - room_info=NULL; - room=NULL; - RE=NULL; - portal_info=NULL; - exterior=false; - layer_mask=1; - draw_range_begin=0; - draw_range_end=0; - extra_margin=0; - visible_in_all_rooms=false; - update_aabb=false; - update_materials=false; - - baked_light=NULL; - baked_light_info=NULL; - baked_light_sampler_info=NULL; - sampled_light=NULL; - BLE=NULL; - - light_cache_dirty=true; - - } - - ~Instance() { - - if (light_info) - memdelete(light_info); - if (particles_info) - memdelete(particles_info); - if (room_info) - memdelete(room_info); - if (portal_info) - memdelete(portal_info); - if (baked_light_info) - memdelete(baked_light_info); - }; - }; - - struct _InstanceLightsort { - - bool operator()(const Instance* p_A, const Instance* p_B) const { return p_A->light_info->dtc < p_B->light_info->dtc; } - }; - - struct Scenario { - - - ScenarioDebugMode debug; - RID self; - // well wtf, balloon allocator is slower? - typedef ::Octree<Instance,true> Octree; - - Octree octree; - - List<RID> directional_lights; - RID environment; - RID fallback_environment; - - Instance *dirty_instances; - - Scenario() { dirty_instances=NULL; debug=SCENARIO_DEBUG_DISABLED; } - }; - - - - mutable RID_Owner<Rasterizer::ShaderMaterial> canvas_item_material_owner; - - - - struct Viewport { - - RID self; - RID parent; - - VisualServer::ViewportRect rect; - RID camera; - RID scenario; - RID viewport_data; - - RenderTargetUpdateMode render_target_update_mode; - RID render_target; - RID render_target_texture; - - Rect2 rt_to_screen_rect; - - bool hide_scenario; - bool hide_canvas; - bool transparent_bg; - bool queue_capture; - bool render_target_vflip; - bool render_target_clear_on_new_frame; - bool render_target_clear; - bool disable_environment; - - Image capture; - - bool rendered_in_prev_frame; - - struct CanvasKey { - - int layer; - RID canvas; - bool operator<(const CanvasKey& p_canvas) const { if (layer==p_canvas.layer) return canvas < p_canvas.canvas; return layer<p_canvas.layer; } - CanvasKey() { layer=0; } - CanvasKey(const RID& p_canvas, int p_layer) { canvas=p_canvas; layer=p_layer; } - }; - - struct CanvasData { - - Canvas *canvas; - Transform2D transform; - int layer; - }; - - Transform2D global_transform; - - Map<RID,CanvasData> canvas_map; - - SelfList<Viewport> update_list; - - Viewport() : update_list(this) { transparent_bg=false; render_target_update_mode=RENDER_TARGET_UPDATE_WHEN_VISIBLE; queue_capture=false; rendered_in_prev_frame=false; render_target_vflip=false; render_target_clear_on_new_frame=true; render_target_clear=true; disable_environment=false; } - }; - - SelfList<Viewport>::List viewport_update_list; - - Map<RID,int> screen_viewports; - - struct CullRange { - - Plane nearp; - float min,max; - float z_near,z_far; - - void add_aabb(const Rect3& p_aabb) { - - - } - }; - - struct Cursor { - - Point2 pos; - float rot; - RID texture; - Point2 center; - bool visible; - Rect2 region; - Cursor() { - - rot = 0; - visible = false; - region = Rect2(); - }; - }; - - Rect2 canvas_clip; - Color clear_color; - Cursor cursors[MAX_CURSORS]; - RID default_cursor_texture; - - static void* instance_pair(void *p_self, OctreeElementID,Instance *p_A,int, OctreeElementID,Instance *p_B,int); - static void instance_unpair(void *p_self, OctreeElementID,Instance *p_A,int, OctreeElementID,Instance *p_B,int,void*); - - Instance *instance_cull_result[MAX_INSTANCE_CULL]; - Instance *instance_shadow_cull_result[MAX_INSTANCE_CULL]; //used for generating shadowmaps - Instance *light_cull_result[MAX_LIGHTS_CULLED]; - int light_cull_count; - - Instance *exterior_portal_cull_result[MAX_EXTERIOR_PORTALS]; - int exterior_portal_cull_count; - bool exterior_visited; - - Instance *light_sampler_cull_result[MAX_LIGHT_SAMPLERS]; - int light_samplers_culled; - - Instance *room_cull_result[MAX_ROOM_CULL]; - int room_cull_count; - bool room_cull_enabled; - bool light_discard_enabled; - bool shadows_enabled; - int black_margin[4]; - RID black_image[4]; - - Vector<Vector3> aabb_random_points; - Vector<Vector3> transformed_aabb_random_points; - - void _instance_validate_autorooms(Instance *p_geometry); - - void _portal_disconnect(Instance *p_portal,bool p_cleanup=false); - void _portal_attempt_connect(Instance *p_portal); - void _dependency_queue_update(RID p_rid, bool p_update_aabb=false, bool p_update_materials=false); - _FORCE_INLINE_ void _instance_queue_update(Instance *p_instance,bool p_update_aabb=false,bool p_update_materials=false); - void _update_instances(); - void _update_instance_aabb(Instance *p_instance); - void _update_instance(Instance *p_instance); - void _free_attached_instances(RID p_rid,bool p_free_scenario=false); - void _clean_up_owner(RID_OwnerBase *p_owner,String p_type); - - Instance *instance_update_list; - - //RID default_scenario; - //RID default_viewport; - - RID test_cube; - - - mutable RID_Owner<Room> room_owner; - mutable RID_Owner<Portal> portal_owner; - - mutable RID_Owner<BakedLight> baked_light_owner; - mutable RID_Owner<BakedLightSampler> baked_light_sampler_owner; - - mutable RID_Owner<Camera> camera_owner; - mutable RID_Owner<Viewport> viewport_owner; - - mutable RID_Owner<Scenario> scenario_owner; - mutable RID_Owner<Instance> instance_owner; - - mutable RID_Owner<Canvas> canvas_owner; - mutable RID_Owner<CanvasItem> canvas_item_owner; - - Map< RID, Set<RID> > instance_dependency_map; - Map< RID, Set<Instance*> > skeleton_dependency_map; - - - ViewportRect viewport_rect; - _FORCE_INLINE_ void _instance_draw(Instance *p_instance); - - bool _test_portal_cull(Camera *p_camera, Instance *p_portal_from, Instance *p_portal_to); - void _cull_portal(Camera *p_camera, Instance *p_portal,Instance *p_from_portal); - void _cull_room(Camera *p_camera, Instance *p_room,Instance *p_from_portal=NULL); - void _process_sampled_light(const Transform &p_camera, Instance *p_sampled_light, bool p_linear_colorspace); - - void _render_no_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario); - void _render_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario); - static void _render_canvas_item_viewport(VisualServer* p_self,void *p_vp,const Rect2& p_rect); - void _render_canvas_item_tree(CanvasItem *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, Rasterizer::CanvasLight *p_lights); - void _render_canvas_item(CanvasItem *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, float p_opacity, int p_z, Rasterizer::CanvasItem **z_list, Rasterizer::CanvasItem **z_last_list, CanvasItem *p_canvas_clip, CanvasItem *p_material_owner); - void _render_canvas(Canvas *p_canvas, const Transform2D &p_transform, Rasterizer::CanvasLight *p_lights, Rasterizer::CanvasLight *p_masked_lights); - void _light_mask_canvas_items(int p_z,Rasterizer::CanvasItem *p_canvas_item,Rasterizer::CanvasLight *p_masked_lights); - - Vector<Vector3> _camera_generate_endpoints(Instance *p_light,Camera *p_camera,float p_range_min, float p_range_max); - Vector<Plane> _camera_generate_orthogonal_planes(Instance *p_light,Camera *p_camera,float p_range_min, float p_range_max); - - void _light_instance_update_lispsm_shadow(Instance *p_light,Scenario *p_scenario,Camera *p_camera,const CullRange& p_cull_range); - void _light_instance_update_pssm_shadow(Instance *p_light,Scenario *p_scenario,Camera *p_camera,const CullRange& p_cull_range); - - void _light_instance_update_shadow(Instance *p_light,Scenario *p_scenario,Camera *p_camera,const CullRange& p_cull_range); - - uint64_t render_pass; - int changes; - bool draw_extra_frame; - - void _draw_viewport_camera(Viewport *p_viewport, bool p_ignore_camera); - void _draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ofs_y,int p_parent_w,int p_parent_h); - void _draw_viewports(); - void _draw_cursors_and_margins(); - - - Rasterizer *rasterizer; - -#endif - void _draw_margins(); static void _changes_changed() {} public: -//if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed() -//#define DEBUG_CHANGES + //if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed() + //#define DEBUG_CHANGES #ifdef DEBUG_CHANGES _FORCE_INLINE_ static void redraw_request() { @@ -611,7 +96,7 @@ public: #define DISPLAY_CHANGED \ changes++; #endif -// print_line(String("CHANGED: ") + __FUNCTION__); + // print_line(String("CHANGED: ") + __FUNCTION__); #define BIND0R(m_r, m_name) \ m_r m_name() { return BINDBASE->m_name(); } @@ -718,7 +203,7 @@ public: BIND0R(RID, mesh_create) - BIND10(mesh_add_surface, RID, uint32_t, PrimitiveType, const PoolVector<uint8_t> &, int, const PoolVector<uint8_t> &, int, const Rect3 &, const Vector<PoolVector<uint8_t> > &, const Vector<Rect3> &) + BIND10(mesh_add_surface, RID, uint32_t, PrimitiveType, const PoolVector<uint8_t> &, int, const PoolVector<uint8_t> &, int, const AABB &, const Vector<PoolVector<uint8_t> > &, const Vector<AABB> &) BIND2(mesh_set_blend_shape_count, RID, int) BIND1RC(int, mesh_get_blend_shape_count, RID) @@ -726,6 +211,8 @@ public: BIND2(mesh_set_blend_shape_mode, RID, BlendShapeMode) BIND1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID) + BIND4(mesh_surface_update_region, RID, int, int, const PoolVector<uint8_t> &) + BIND3(mesh_surface_set_material, RID, int, RID) BIND2RC(RID, mesh_surface_get_material, RID, int) @@ -738,15 +225,15 @@ public: BIND2RC(uint32_t, mesh_surface_get_format, RID, int) BIND2RC(PrimitiveType, mesh_surface_get_primitive_type, RID, int) - BIND2RC(Rect3, mesh_surface_get_aabb, RID, int) + BIND2RC(AABB, mesh_surface_get_aabb, RID, int) BIND2RC(Vector<PoolVector<uint8_t> >, mesh_surface_get_blend_shapes, RID, int) - BIND2RC(Vector<Rect3>, mesh_surface_get_skeleton_aabb, RID, int) + BIND2RC(Vector<AABB>, mesh_surface_get_skeleton_aabb, RID, int) BIND2(mesh_remove_surface, RID, int) BIND1RC(int, mesh_get_surface_count, RID) - BIND2(mesh_set_custom_aabb, RID, const Rect3 &) - BIND1RC(Rect3, mesh_get_custom_aabb, RID) + BIND2(mesh_set_custom_aabb, RID, const AABB &) + BIND1RC(AABB, mesh_get_custom_aabb, RID) BIND1(mesh_clear, RID) @@ -763,7 +250,7 @@ public: BIND3(multimesh_instance_set_color, RID, int, const Color &) BIND1RC(RID, multimesh_get_mesh, RID) - BIND1RC(Rect3, multimesh_get_aabb, RID) + BIND1RC(AABB, multimesh_get_aabb, RID) BIND2RC(Transform, multimesh_instance_get_transform, RID, int) BIND2RC(Transform2D, multimesh_instance_get_transform_2d, RID, int) @@ -840,8 +327,8 @@ public: BIND0R(RID, gi_probe_create) - BIND2(gi_probe_set_bounds, RID, const Rect3 &) - BIND1RC(Rect3, gi_probe_get_bounds, RID) + BIND2(gi_probe_set_bounds, RID, const AABB &) + BIND1RC(AABB, gi_probe_get_bounds, RID) BIND2(gi_probe_set_cell_size, RID, float) BIND1RC(float, gi_probe_get_cell_size, RID) @@ -884,7 +371,7 @@ public: BIND2(particles_set_pre_process_time, RID, float) BIND2(particles_set_explosiveness_ratio, RID, float) BIND2(particles_set_randomness_ratio, RID, float) - BIND2(particles_set_custom_aabb, RID, const Rect3 &) + BIND2(particles_set_custom_aabb, RID, const AABB &) BIND2(particles_set_speed_scale, RID, float) BIND2(particles_set_use_local_coordinates, RID, bool) BIND2(particles_set_process_material, RID, RID) @@ -897,7 +384,7 @@ public: BIND2(particles_set_draw_passes, RID, int) BIND3(particles_set_draw_pass_mesh, RID, int, RID) - BIND1R(Rect3, particles_get_current_aabb, RID) + BIND1R(AABB, particles_get_current_aabb, RID) BIND2(particles_set_emission_transform, RID, const Transform &) #undef BINDBASE @@ -962,7 +449,7 @@ public: BIND2R(int, viewport_get_render_info, RID, ViewportRenderInfo) BIND2(viewport_set_debug_draw, RID, ViewportDebugDraw) -/* ENVIRONMENT API */ + /* ENVIRONMENT API */ #undef BINDBASE //from now on, calls forwarded to this singleton @@ -992,7 +479,7 @@ public: BIND6(environment_set_fog_depth, RID, bool, float, float, bool, float) BIND5(environment_set_fog_height, RID, bool, float, float, float) -/* SCENARIO API */ + /* SCENARIO API */ #undef BINDBASE #define BINDBASE VSG::scene @@ -1023,7 +510,7 @@ public: BIND2(instance_set_extra_visibility_margin, RID, real_t) // don't use these in a game! - BIND2RC(Vector<ObjectID>, instances_cull_aabb, const Rect3 &, RID) + BIND2RC(Vector<ObjectID>, instances_cull_aabb, const AABB &, RID) BIND3RC(Vector<ObjectID>, instances_cull_ray, const Vector3 &, const Vector3 &, RID) BIND2RC(Vector<ObjectID>, instances_cull_convex, const Vector<Plane> &, RID) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index e49baf0763..3e46705ff8 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -614,7 +614,7 @@ void VisualServerScene::instance_set_exterior(RID p_instance, bool p_enabled) { void VisualServerScene::instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) { } -Vector<ObjectID> VisualServerScene::instances_cull_aabb(const Rect3 &p_aabb, RID p_scenario) const { +Vector<ObjectID> VisualServerScene::instances_cull_aabb(const AABB &p_aabb, RID p_scenario) const { Vector<ObjectID> instances; Scenario *scenario = scenario_owner.get(p_scenario); @@ -772,7 +772,7 @@ void VisualServerScene::_update_instance(Instance *p_instance) { p_instance->mirror = p_instance->transform.basis.determinant() < 0.0; - Rect3 new_aabb; + AABB new_aabb; new_aabb = p_instance->transform.xform(p_instance->aabb); @@ -817,7 +817,7 @@ void VisualServerScene::_update_instance(Instance *p_instance) { void VisualServerScene::_update_instance_aabb(Instance *p_instance) { - Rect3 new_aabb; + AABB new_aabb; ERR_FAIL_COND(p_instance->base_type != VS::INSTANCE_NONE && !p_instance->base.is_valid()); @@ -1279,7 +1279,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario, Size2 p_view camera->zfar, camera->vaspect - ); + ); ortho = true; } break; case Camera::PERSPECTIVE: { @@ -1291,7 +1291,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario, Size2 p_view camera->zfar, camera->vaspect - ); + ); ortho = false; } break; @@ -1863,7 +1863,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.enabled = true; Transform cell_to_xform = VSG::storage->gi_probe_get_to_cell_xform(p_instance->base); - Rect3 bounds = VSG::storage->gi_probe_get_bounds(p_instance->base); + AABB bounds = VSG::storage->gi_probe_get_bounds(p_instance->base); float cell_size = VSG::storage->gi_probe_get_cell_size(p_instance->base); probe->dynamic.light_to_cell_xform = cell_to_xform * p_instance->transform.affine_inverse(); diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index d30a2108a5..2738fa058d 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -195,8 +195,8 @@ public: SelfList<Instance> update_item; - Rect3 aabb; - Rect3 transformed_aabb; + AABB aabb; + AABB transformed_aabb; float extra_margin; uint32_t object_ID; @@ -466,7 +466,7 @@ public: virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin); // don't use these in a game! - virtual Vector<ObjectID> instances_cull_aabb(const Rect3 &p_aabb, RID p_scenario = RID()) const; + virtual Vector<ObjectID> instances_cull_aabb(const AABB &p_aabb, RID p_scenario = RID()) const; virtual Vector<ObjectID> instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const; virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario = RID()) const; diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 80a1ef3879..509b77cf9c 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -63,7 +63,7 @@ class VisualServerWrapMT : public VisualServer { int pool_max_size; -//#define DEBUG_SYNC + //#define DEBUG_SYNC #ifdef DEBUG_SYNC #define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__)); @@ -136,7 +136,7 @@ public: FUNCRID(mesh) - FUNC10(mesh_add_surface, RID, uint32_t, PrimitiveType, const PoolVector<uint8_t> &, int, const PoolVector<uint8_t> &, int, const Rect3 &, const Vector<PoolVector<uint8_t> > &, const Vector<Rect3> &) + FUNC10(mesh_add_surface, RID, uint32_t, PrimitiveType, const PoolVector<uint8_t> &, int, const PoolVector<uint8_t> &, int, const AABB &, const Vector<PoolVector<uint8_t> > &, const Vector<AABB> &) FUNC2(mesh_set_blend_shape_count, RID, int) FUNC1RC(int, mesh_get_blend_shape_count, RID) @@ -144,6 +144,8 @@ public: FUNC2(mesh_set_blend_shape_mode, RID, BlendShapeMode) FUNC1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID) + FUNC4(mesh_surface_update_region, RID, int, int, const PoolVector<uint8_t> &) + FUNC3(mesh_surface_set_material, RID, int, RID) FUNC2RC(RID, mesh_surface_get_material, RID, int) @@ -156,15 +158,15 @@ public: FUNC2RC(uint32_t, mesh_surface_get_format, RID, int) FUNC2RC(PrimitiveType, mesh_surface_get_primitive_type, RID, int) - FUNC2RC(Rect3, mesh_surface_get_aabb, RID, int) + FUNC2RC(AABB, mesh_surface_get_aabb, RID, int) FUNC2RC(Vector<PoolVector<uint8_t> >, mesh_surface_get_blend_shapes, RID, int) - FUNC2RC(Vector<Rect3>, mesh_surface_get_skeleton_aabb, RID, int) + FUNC2RC(Vector<AABB>, mesh_surface_get_skeleton_aabb, RID, int) FUNC2(mesh_remove_surface, RID, int) FUNC1RC(int, mesh_get_surface_count, RID) - FUNC2(mesh_set_custom_aabb, RID, const Rect3 &) - FUNC1RC(Rect3, mesh_get_custom_aabb, RID) + FUNC2(mesh_set_custom_aabb, RID, const AABB &) + FUNC1RC(AABB, mesh_get_custom_aabb, RID) FUNC1(mesh_clear, RID) @@ -181,7 +183,7 @@ public: FUNC3(multimesh_instance_set_color, RID, int, const Color &) FUNC1RC(RID, multimesh_get_mesh, RID) - FUNC1RC(Rect3, multimesh_get_aabb, RID) + FUNC1RC(AABB, multimesh_get_aabb, RID) FUNC2RC(Transform, multimesh_instance_get_transform, RID, int) FUNC2RC(Transform2D, multimesh_instance_get_transform_2d, RID, int) @@ -258,8 +260,8 @@ public: FUNCRID(gi_probe) - FUNC2(gi_probe_set_bounds, RID, const Rect3 &) - FUNC1RC(Rect3, gi_probe_get_bounds, RID) + FUNC2(gi_probe_set_bounds, RID, const AABB &) + FUNC1RC(AABB, gi_probe_get_bounds, RID) FUNC2(gi_probe_set_cell_size, RID, float) FUNC1RC(float, gi_probe_get_cell_size, RID) @@ -302,7 +304,7 @@ public: FUNC2(particles_set_pre_process_time, RID, float) FUNC2(particles_set_explosiveness_ratio, RID, float) FUNC2(particles_set_randomness_ratio, RID, float) - FUNC2(particles_set_custom_aabb, RID, const Rect3 &) + FUNC2(particles_set_custom_aabb, RID, const AABB &) FUNC2(particles_set_speed_scale, RID, float) FUNC2(particles_set_use_local_coordinates, RID, bool) FUNC2(particles_set_process_material, RID, RID) @@ -316,7 +318,7 @@ public: FUNC3(particles_set_draw_pass_mesh, RID, int, RID) FUNC2(particles_set_emission_transform, RID, const Transform &) - FUNC1R(Rect3, particles_get_current_aabb, RID) + FUNC1R(AABB, particles_get_current_aabb, RID) /* CAMERA API */ @@ -429,7 +431,7 @@ public: FUNC2(instance_set_extra_visibility_margin, RID, real_t) // don't use these in a game! - FUNC2RC(Vector<ObjectID>, instances_cull_aabb, const Rect3 &, RID) + FUNC2RC(Vector<ObjectID>, instances_cull_aabb, const AABB &, RID) FUNC3RC(Vector<ObjectID>, instances_cull_ray, const Vector3 &, const Vector3 &, RID) FUNC2RC(Vector<ObjectID>, instances_cull_convex, const Vector<Plane> &, RID) diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 2234ddda0d..10f350d667 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -308,7 +308,7 @@ RID VisualServer::get_white_texture() { #define SMALL_VEC2 Vector2(0.00001, 0.00001) #define SMALL_VEC3 Vector3(0.00001, 0.00001, 0.00001) -Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, Rect3 &r_aabb, Vector<Rect3> r_bone_aabb) { +Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> r_bone_aabb) { PoolVector<uint8_t>::Write vw = r_vertex_array.write(); @@ -373,7 +373,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ } } - r_aabb = Rect3(Vector3(aabb.position.x, aabb.position.y, 0), Vector3(aabb.size.x, aabb.size.y, 0)); + r_aabb = AABB(Vector3(aabb.position.x, aabb.position.y, 0), Vector3(aabb.size.x, aabb.size.y, 0)); } else { PoolVector<Vector3> array = p_arrays[ai]; @@ -383,7 +383,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ const Vector3 *src = read.ptr(); // setting vertices means regenerating the AABB - Rect3 aabb; + AABB aabb; if (p_format & ARRAY_COMPRESS_VERTEX) { @@ -395,7 +395,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (i == 0) { - aabb = Rect3(src[i], SMALL_VEC3); + aabb = AABB(src[i], SMALL_VEC3); } else { aabb.expand_to(src[i]); @@ -411,7 +411,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (i == 0) { - aabb = Rect3(src[i], SMALL_VEC3); + aabb = AABB(src[i], SMALL_VEC3); } else { aabb.expand_to(src[i]); @@ -728,7 +728,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ PoolVector<int>::Read rb = bones.read(); PoolVector<float>::Read rw = weights.read(); - Rect3 *bptr = r_bone_aabb.ptr(); + AABB *bptr = r_bone_aabb.ptr(); for (int i = 0; i < vs; i++) { @@ -743,7 +743,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (bptr->size.x < 0) { //first - bptr[idx] = Rect3(v, SMALL_VEC3); + bptr[idx] = AABB(v, SMALL_VEC3); any_valid = true; } else { bptr[idx].expand_to(v); @@ -975,8 +975,8 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim PoolVector<uint8_t> index_array; index_array.resize(index_array_size); - Rect3 aabb; - Vector<Rect3> bone_aabb; + AABB aabb; + Vector<AABB> bone_aabb; Error err = _surface_set_data(p_arrays, format, offsets, total_elem_size, vertex_array, array_len, index_array, index_array_len, aabb, bone_aabb); @@ -993,7 +993,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim vertex_array_shape.resize(array_size); PoolVector<uint8_t> noindex; - Rect3 laabb; + AABB laabb; Error err = _surface_set_data(p_blend_shapes[i], format & ~ARRAY_FORMAT_INDEX, offsets, total_elem_size, vertex_array_shape, array_len, noindex, 0, laabb, bone_aabb); aabb.merge_with(laabb); if (err) { @@ -1470,7 +1470,7 @@ Array VisualServer::mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surfac Array VisualServer::_mesh_surface_get_skeleton_aabb_bind(RID p_mesh, int p_surface) const { - Vector<Rect3> vec = VS::get_singleton()->mesh_surface_get_skeleton_aabb(p_mesh, p_surface); + Vector<AABB> vec = VS::get_singleton()->mesh_surface_get_skeleton_aabb(p_mesh, p_surface); Array arr; for (int i = 0; i < vec.size(); i++) { arr[i] = vec[i]; @@ -1856,6 +1856,8 @@ void VisualServer::_bind_methods() { BIND_ENUM_CONSTANT(FEATURE_SHADERS); BIND_ENUM_CONSTANT(FEATURE_MULTITHREADED); + + ADD_SIGNAL(MethodInfo("frame_drawn_in_thread")); } void VisualServer::_canvas_item_add_style_box(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector<float> &p_margins, const Color &p_modulate) { diff --git a/servers/visual_server.h b/servers/visual_server.h index 7b0976b100..4e43d0bd17 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -60,7 +60,7 @@ protected: RID white_texture; RID test_material; - Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, Rect3 &r_aabb, Vector<Rect3> r_bone_aabb); + Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> r_bone_aabb); static VisualServer *(*create_func)(); static void _bind_methods(); @@ -227,6 +227,7 @@ public: ARRAY_FLAG_USE_2D_VERTICES = ARRAY_COMPRESS_INDEX << 1, ARRAY_FLAG_USE_16_BIT_BONES = ARRAY_COMPRESS_INDEX << 2, + ARRAY_FLAG_USE_DYNAMIC_UPDATE = ARRAY_COMPRESS_INDEX << 3, ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_VERTEX | ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS @@ -246,7 +247,7 @@ public: virtual RID mesh_create() = 0; virtual void mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), uint32_t p_compress_format = ARRAY_COMPRESS_DEFAULT); - virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<Rect3> &p_bone_aabbs = Vector<Rect3>()) = 0; + virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) = 0; virtual void mesh_set_blend_shape_count(RID p_mesh, int p_amount) = 0; virtual int mesh_get_blend_shape_count(RID p_mesh) const = 0; @@ -259,6 +260,8 @@ public: virtual void mesh_set_blend_shape_mode(RID p_mesh, BlendShapeMode p_mode) = 0; virtual BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0; + virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) = 0; + virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0; @@ -274,16 +277,16 @@ public: virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const = 0; virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const = 0; - virtual Rect3 mesh_surface_get_aabb(RID p_mesh, int p_surface) const = 0; + virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const = 0; virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const = 0; - virtual Vector<Rect3> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const = 0; + virtual Vector<AABB> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const = 0; Array _mesh_surface_get_skeleton_aabb_bind(RID p_mesh, int p_surface) const; virtual void mesh_remove_surface(RID p_mesh, int p_index) = 0; virtual int mesh_get_surface_count(RID p_mesh) const = 0; - virtual void mesh_set_custom_aabb(RID p_mesh, const Rect3 &p_aabb) = 0; - virtual Rect3 mesh_get_custom_aabb(RID p_mesh) const = 0; + virtual void mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) = 0; + virtual AABB mesh_get_custom_aabb(RID p_mesh) const = 0; virtual void mesh_clear(RID p_mesh) = 0; @@ -311,7 +314,7 @@ public: virtual void multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color) = 0; virtual RID multimesh_get_mesh(RID p_multimesh) const = 0; - virtual Rect3 multimesh_get_aabb(RID p_multimesh) const = 0; + virtual AABB multimesh_get_aabb(RID p_multimesh) const = 0; virtual Transform multimesh_instance_get_transform(RID p_multimesh, int p_index) const = 0; virtual Transform2D multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const = 0; @@ -446,8 +449,8 @@ public: virtual RID gi_probe_create() = 0; - virtual void gi_probe_set_bounds(RID p_probe, const Rect3 &p_bounds) = 0; - virtual Rect3 gi_probe_get_bounds(RID p_probe) const = 0; + virtual void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) = 0; + virtual AABB gi_probe_get_bounds(RID p_probe) const = 0; virtual void gi_probe_set_cell_size(RID p_probe, float p_range) = 0; virtual float gi_probe_get_cell_size(RID p_probe) const = 0; @@ -490,7 +493,7 @@ public: virtual void particles_set_pre_process_time(RID p_particles, float p_time) = 0; virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio) = 0; virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio) = 0; - virtual void particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb) = 0; + virtual void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) = 0; virtual void particles_set_speed_scale(RID p_particles, float p_scale) = 0; virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable) = 0; virtual void particles_set_process_material(RID p_particles, RID p_material) = 0; @@ -509,7 +512,7 @@ public: virtual void particles_set_draw_passes(RID p_particles, int p_count) = 0; virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) = 0; - virtual Rect3 particles_get_current_aabb(RID p_particles) = 0; + virtual AABB particles_get_current_aabb(RID p_particles) = 0; virtual void particles_set_emission_transform(RID p_particles, const Transform &p_transform) = 0; //this is only used for 2D, in 3D it's automatic @@ -755,7 +758,7 @@ public: virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) = 0; // don't use these in a game! - virtual Vector<ObjectID> instances_cull_aabb(const Rect3 &p_aabb, RID p_scenario = RID()) const = 0; + virtual Vector<ObjectID> instances_cull_aabb(const AABB &p_aabb, RID p_scenario = RID()) const = 0; virtual Vector<ObjectID> instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const = 0; virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario = RID()) const = 0; |