diff options
Diffstat (limited to 'scene')
35 files changed, 103 insertions, 101 deletions
diff --git a/scene/2d/physical_bone_2d.h b/scene/2d/physical_bone_2d.h index d650a0426f..46a2772bad 100644 --- a/scene/2d/physical_bone_2d.h +++ b/scene/2d/physical_bone_2d.h @@ -44,7 +44,7 @@ protected: static void _bind_methods(); private: - Skeleton2D *parent_skeleton; + Skeleton2D *parent_skeleton = nullptr; int bone2d_index = -1; NodePath bone2d_nodepath; bool follow_bone_when_simulating = false; diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index cd39a1996c..423f792132 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -338,8 +338,8 @@ public: ~CharacterBody2D(); }; -class KinematicCollision2D : public Reference { - GDCLASS(KinematicCollision2D, Reference); +class KinematicCollision2D : public RefCounted { + GDCLASS(KinematicCollision2D, RefCounted); PhysicsBody2D *owner = nullptr; friend class PhysicsBody2D; diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp index cc1177d541..a3f681e53c 100644 --- a/scene/3d/lightmap_gi.cpp +++ b/scene/3d/lightmap_gi.cpp @@ -31,11 +31,11 @@ #include "lightmap_gi.h" #include "core/io/config_file.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/resource_saver.h" #include "core/math/camera_matrix.h" #include "core/math/delaunay_3d.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" #include "core/os/os.h" #include "core/templates/sort_array.h" #include "lightmap_probe.h" diff --git a/scene/3d/lightmapper.h b/scene/3d/lightmapper.h index f63515f666..3a6a88d435 100644 --- a/scene/3d/lightmapper.h +++ b/scene/3d/lightmapper.h @@ -44,8 +44,8 @@ #endif -class LightmapDenoiser : public Reference { - GDCLASS(LightmapDenoiser, Reference) +class LightmapDenoiser : public RefCounted { + GDCLASS(LightmapDenoiser, RefCounted) protected: static LightmapDenoiser *(*create_function)(); @@ -54,8 +54,8 @@ public: static Ref<LightmapDenoiser> create(); }; -class LightmapRaycaster : public Reference { - GDCLASS(LightmapRaycaster, Reference) +class LightmapRaycaster : public RefCounted { + GDCLASS(LightmapRaycaster, RefCounted) protected: static LightmapRaycaster *(*create_function)(); @@ -121,8 +121,8 @@ public: static Ref<LightmapRaycaster> create(); }; -class Lightmapper : public Reference { - GDCLASS(Lightmapper, Reference) +class Lightmapper : public RefCounted { + GDCLASS(Lightmapper, RefCounted) public: enum GenerateProbes { GENERATE_PROBES_DISABLED, diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h index 09a96bf8ca..5f076ceb12 100644 --- a/scene/3d/node_3d.h +++ b/scene/3d/node_3d.h @@ -34,8 +34,8 @@ #include "scene/main/node.h" #include "scene/main/scene_tree.h" -class Node3DGizmo : public Reference { - GDCLASS(Node3DGizmo, Reference); +class Node3DGizmo : public RefCounted { + GDCLASS(Node3DGizmo, RefCounted); public: virtual void create() = 0; diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h index a25cb06bc3..8df3635be0 100644 --- a/scene/3d/physics_body_3d.h +++ b/scene/3d/physics_body_3d.h @@ -339,8 +339,8 @@ public: ~CharacterBody3D(); }; -class KinematicCollision3D : public Reference { - GDCLASS(KinematicCollision3D, Reference); +class KinematicCollision3D : public RefCounted { + GDCLASS(KinematicCollision3D, RefCounted); PhysicsBody3D *owner = nullptr; friend class PhysicsBody3D; diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h index 9be7dce5d2..2f6e416c8c 100644 --- a/scene/3d/skeleton_3d.h +++ b/scene/3d/skeleton_3d.h @@ -40,8 +40,8 @@ typedef int BoneId; class PhysicalBone3D; class Skeleton3D; -class SkinReference : public Reference { - GDCLASS(SkinReference, Reference) +class SkinReference : public RefCounted { + GDCLASS(SkinReference, RefCounted) friend class Skeleton3D; Skeleton3D *skeleton_node; diff --git a/scene/3d/velocity_tracker_3d.h b/scene/3d/velocity_tracker_3d.h index e971f4755a..827c3f5bd8 100644 --- a/scene/3d/velocity_tracker_3d.h +++ b/scene/3d/velocity_tracker_3d.h @@ -33,8 +33,8 @@ #include "scene/3d/node_3d.h" -class VelocityTracker3D : public Reference { - GDCLASS(VelocityTracker3D, Reference); +class VelocityTracker3D : public RefCounted { + GDCLASS(VelocityTracker3D, RefCounted); struct PositionHistory { uint64_t frame = 0; diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 7922635438..7cd9de1fa1 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -37,8 +37,8 @@ #include "scene/resources/animation.h" #ifdef TOOLS_ENABLED -class AnimatedValuesBackup : public Reference { - GDCLASS(AnimatedValuesBackup, Reference); +class AnimatedValuesBackup : public RefCounted { + GDCLASS(AnimatedValuesBackup, RefCounted); struct Entry { Object *object = nullptr; diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 7369713e69..6fac70bdd5 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -37,7 +37,7 @@ void AnimationNode::get_parameter_list(List<PropertyInfo> *r_list) const { if (get_script_instance()) { - Array parameters = get_script_instance()->call("get_parameter_list"); + Array parameters = get_script_instance()->call("_get_parameter_list"); for (int i = 0; i < parameters.size(); i++) { Dictionary d = parameters[i]; ERR_CONTINUE(d.is_empty()); @@ -48,7 +48,7 @@ void AnimationNode::get_parameter_list(List<PropertyInfo> *r_list) const { Variant AnimationNode::get_parameter_default_value(const StringName &p_parameter) const { if (get_script_instance()) { - return get_script_instance()->call("get_parameter_default_value", p_parameter); + return get_script_instance()->call("_get_parameter_default_value", p_parameter); } return Variant(); } @@ -73,7 +73,7 @@ Variant AnimationNode::get_parameter(const StringName &p_name) const { void AnimationNode::get_child_nodes(List<ChildNode> *r_child_nodes) { if (get_script_instance()) { - Dictionary cn = get_script_instance()->call("get_child_nodes"); + Dictionary cn = get_script_instance()->call("_get_child_nodes"); List<Variant> keys; cn.get_key_list(&keys); for (List<Variant>::Element *E = keys.front(); E; E = E->next()) { @@ -299,7 +299,7 @@ String AnimationNode::get_input_name(int p_input) { String AnimationNode::get_caption() const { if (get_script_instance()) { - return get_script_instance()->call("get_caption"); + return get_script_instance()->call("_get_caption"); } return "Node"; @@ -330,7 +330,7 @@ void AnimationNode::remove_input(int p_index) { float AnimationNode::process(float p_time, bool p_seek) { if (get_script_instance()) { - return get_script_instance()->call("process", p_time, p_seek); + return get_script_instance()->call("_process", p_time, p_seek); } return 0; @@ -357,6 +357,10 @@ bool AnimationNode::is_path_filtered(const NodePath &p_path) const { } bool AnimationNode::has_filter() const { + if (get_script_instance()) { + return get_script_instance()->call("_has_filter"); + } + return false; } @@ -387,7 +391,7 @@ void AnimationNode::_validate_property(PropertyInfo &property) const { Ref<AnimationNode> AnimationNode::get_child_by_name(const StringName &p_name) { if (get_script_instance()) { - return get_script_instance()->call("get_child_by_name", p_name); + return get_script_instance()->call("_get_child_by_name", p_name); } return Ref<AnimationNode>(); } @@ -418,17 +422,17 @@ void AnimationNode::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_filter_enabled", "is_filter_enabled"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "filters", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_filters", "_get_filters"); - BIND_VMETHOD(MethodInfo(Variant::DICTIONARY, "get_child_nodes")); - BIND_VMETHOD(MethodInfo(Variant::ARRAY, "get_parameter_list")); - BIND_VMETHOD(MethodInfo(Variant::OBJECT, "get_child_by_name", PropertyInfo(Variant::STRING, "name"))); + BIND_VMETHOD(MethodInfo(Variant::DICTIONARY, "_get_child_nodes")); + BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_parameter_list")); + BIND_VMETHOD(MethodInfo(Variant::OBJECT, "_get_child_by_name", PropertyInfo(Variant::STRING, "name"))); { - MethodInfo mi = MethodInfo(Variant::NIL, "get_parameter_default_value", PropertyInfo(Variant::STRING_NAME, "name")); + MethodInfo mi = MethodInfo(Variant::NIL, "_get_parameter_default_value", PropertyInfo(Variant::STRING_NAME, "name")); mi.return_val.usage = PROPERTY_USAGE_NIL_IS_VARIANT; BIND_VMETHOD(mi); } - BIND_VMETHOD(MethodInfo("process", PropertyInfo(Variant::FLOAT, "time"), PropertyInfo(Variant::BOOL, "seek"))); - BIND_VMETHOD(MethodInfo(Variant::STRING, "get_caption")); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_filter")); + BIND_VMETHOD(MethodInfo("_process", PropertyInfo(Variant::FLOAT, "time"), PropertyInfo(Variant::BOOL, "seek"))); + BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_caption")); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_filter")); ADD_SIGNAL(MethodInfo("removed_from_graph")); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 5afe813ee0..c84627c21e 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -662,7 +662,7 @@ bool Control::has_point(const Point2 &p_point) const { Variant v = p_point; const Variant *p = &v; Callable::CallError ce; - Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->has_point, &p, 1, ce); + Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_has_point, &p, 1, ce); if (ce.error == Callable::CallError::CALL_OK) { return ret; } @@ -687,7 +687,7 @@ Variant Control::get_drag_data(const Point2 &p_point) { Object *obj = ObjectDB::get_instance(data.drag_owner); if (obj) { Control *c = Object::cast_to<Control>(obj); - return c->call("get_drag_data_fw", p_point, this); + return c->call("_get_drag_data_fw", p_point, this); } } @@ -695,7 +695,7 @@ Variant Control::get_drag_data(const Point2 &p_point) { Variant v = p_point; const Variant *p = &v; Callable::CallError ce; - Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->get_drag_data, &p, 1, ce); + Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_get_drag_data, &p, 1, ce); if (ce.error == Callable::CallError::CALL_OK) { return ret; } @@ -709,7 +709,7 @@ bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const Object *obj = ObjectDB::get_instance(data.drag_owner); if (obj) { Control *c = Object::cast_to<Control>(obj); - return c->call("can_drop_data_fw", p_point, p_data, this); + return c->call("_can_drop_data_fw", p_point, p_data, this); } } @@ -717,7 +717,7 @@ bool Control::can_drop_data(const Point2 &p_point, const Variant &p_data) const Variant v = p_point; const Variant *p[2] = { &v, &p_data }; Callable::CallError ce; - Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->can_drop_data, p, 2, ce); + Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_can_drop_data, p, 2, ce); if (ce.error == Callable::CallError::CALL_OK) { return ret; } @@ -731,7 +731,7 @@ void Control::drop_data(const Point2 &p_point, const Variant &p_data) { Object *obj = ObjectDB::get_instance(data.drag_owner); if (obj) { Control *c = Object::cast_to<Control>(obj); - c->call("drop_data_fw", p_point, p_data, this); + c->call("_drop_data_fw", p_point, p_data, this); return; } } @@ -740,7 +740,7 @@ void Control::drop_data(const Point2 &p_point, const Variant &p_data) { Variant v = p_point; const Variant *p[2] = { &v, &p_data }; Callable::CallError ce; - Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->drop_data, p, 2, ce); + Variant ret = get_script_instance()->call(SceneStringNames::get_singleton()->_drop_data, p, 2, ce); if (ce.error == Callable::CallError::CALL_OK) { return; } @@ -2775,12 +2775,12 @@ void Control::_bind_methods() { BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size")); - MethodInfo get_drag_data = MethodInfo("get_drag_data", PropertyInfo(Variant::VECTOR2, "position")); + MethodInfo get_drag_data = MethodInfo("_get_drag_data", PropertyInfo(Variant::VECTOR2, "position")); get_drag_data.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; BIND_VMETHOD(get_drag_data); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data"))); - BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_can_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data"))); + BIND_VMETHOD(MethodInfo("_drop_data", PropertyInfo(Variant::VECTOR2, "position"), PropertyInfo(Variant::NIL, "data"))); BIND_VMETHOD(MethodInfo( PropertyInfo(Variant::OBJECT, "control", PROPERTY_HINT_RESOURCE_TYPE, "Control"), "_make_custom_tooltip", PropertyInfo(Variant::STRING, "for_text"))); @@ -2940,5 +2940,5 @@ void Control::_bind_methods() { ADD_SIGNAL(MethodInfo("minimum_size_changed")); ADD_SIGNAL(MethodInfo("theme_changed")); - BIND_VMETHOD(MethodInfo(Variant::BOOL, "has_point", PropertyInfo(Variant::VECTOR2, "point"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_has_point", PropertyInfo(Variant::VECTOR2, "point"))); } diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index 4996f00cb3..55774b488c 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -32,7 +32,7 @@ #define FILE_DIALOG_H #include "box_container.h" -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "scene/gui/dialogs.h" #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" diff --git a/scene/gui/rich_text_effect.h b/scene/gui/rich_text_effect.h index f2e2823eff..d809fd502f 100644 --- a/scene/gui/rich_text_effect.h +++ b/scene/gui/rich_text_effect.h @@ -47,8 +47,8 @@ public: RichTextEffect(); }; -class CharFXTransform : public Reference { - GDCLASS(CharFXTransform, Reference); +class CharFXTransform : public RefCounted { + GDCLASS(CharFXTransform, RefCounted); protected: static void _bind_methods(); diff --git a/scene/main/http_request.h b/scene/main/http_request.h index 92b0ff28e9..22e822253f 100644 --- a/scene/main/http_request.h +++ b/scene/main/http_request.h @@ -31,8 +31,8 @@ #ifndef HTTPREQUEST_H #define HTTPREQUEST_H +#include "core/io/file_access.h" #include "core/io/http_client.h" -#include "core/os/file_access.h" #include "core/os/thread.h" #include "core/templates/safe_refcount.h" #include "node.h" diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 3e08f86fc9..e4ba93feec 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -33,10 +33,10 @@ #include "core/config/project_settings.h" #include "core/debugger/engine_debugger.h" #include "core/input/input.h" +#include "core/io/dir_access.h" #include "core/io/marshalls.h" #include "core/io/resource_loader.h" #include "core/object/message_queue.h" -#include "core/os/dir_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" #include "core/string/print_string.h" diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index a2f2adb8f8..78c4c14e97 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -48,8 +48,8 @@ class Material; class Mesh; class SceneDebugger; -class SceneTreeTimer : public Reference { - GDCLASS(SceneTreeTimer, Reference); +class SceneTreeTimer : public RefCounted { + GDCLASS(SceneTreeTimer, RefCounted); float time_left = 0.0; bool process_always = true; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 17c0023b09..5369792194 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2547,6 +2547,8 @@ void Viewport::_gui_remove_control(Control *p_control) { } Window *Viewport::get_base_window() const { + ERR_FAIL_COND_V(!is_inside_tree(), nullptr); + Viewport *v = const_cast<Viewport *>(this); Window *w = Object::cast_to<Window>(v); while (!w) { @@ -3336,6 +3338,7 @@ bool Viewport::is_input_handled() const { return local_input_handled; } else { const Viewport *vp = this; + ERR_FAIL_COND_V(!is_inside_tree(), false); while (true) { if (Object::cast_to<Window>(vp)) { break; diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index 9a9f019dda..81062feb46 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -30,8 +30,8 @@ #include "audio_stream_sample.h" +#include "core/io/file_access.h" #include "core/io/marshalls.h" -#include "core/os/file_access.h" void AudioStreamPlaybackSample::start(float p_from_pos) { if (base->format == AudioStreamSample::FORMAT_IMA_ADPCM) { diff --git a/scene/resources/mesh_data_tool.h b/scene/resources/mesh_data_tool.h index f5c8f11437..b0ebfba7ee 100644 --- a/scene/resources/mesh_data_tool.h +++ b/scene/resources/mesh_data_tool.h @@ -33,8 +33,8 @@ #include "scene/resources/mesh.h" -class MeshDataTool : public Reference { - GDCLASS(MeshDataTool, Reference); +class MeshDataTool : public RefCounted { + GDCLASS(MeshDataTool, RefCounted); int format = 0; struct Vertex { diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index 78a0aeaa9a..e85b933439 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -34,8 +34,8 @@ #include "core/io/resource.h" #include "scene/main/node.h" -class SceneState : public Reference { - GDCLASS(SceneState, Reference); +class SceneState : public RefCounted { + GDCLASS(SceneState, RefCounted); Vector<StringName> names; Vector<Variant> variants; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 2414704a57..2a60f54fdd 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -31,14 +31,14 @@ #include "resource_format_text.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" #include "core/io/resource_format_binary.h" -#include "core/os/dir_access.h" #include "core/version.h" //version 2: changed names for basis, aabb, Vectors, etc. #define FORMAT_VERSION 2 -#include "core/os/dir_access.h" +#include "core/io/dir_access.h" #include "core/version.h" #define _printerr() ERR_PRINT(String(res_path + ":" + itos(lines) + " - Parse Error: " + error_text).utf8().get_data()); diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h index 2dc683415d..f5d9cca859 100644 --- a/scene/resources/resource_format_text.h +++ b/scene/resources/resource_format_text.h @@ -31,9 +31,9 @@ #ifndef RESOURCE_FORMAT_TEXT_H #define RESOURCE_FORMAT_TEXT_H +#include "core/io/file_access.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/os/file_access.h" #include "core/variant/variant_parser.h" #include "scene/resources/packed_scene.h" diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index 0ad21b0f0f..cbd44315b7 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -30,7 +30,7 @@ #include "shader.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "scene/scene_string_names.h" #include "servers/rendering/shader_language.h" #include "servers/rendering_server.h" diff --git a/scene/resources/skeleton_modification_stack_2d.cpp b/scene/resources/skeleton_modification_stack_2d.cpp index d12ec4add3..72c1c330ef 100644 --- a/scene/resources/skeleton_modification_stack_2d.cpp +++ b/scene/resources/skeleton_modification_stack_2d.cpp @@ -160,6 +160,8 @@ Ref<SkeletonModification2D> SkeletonModificationStack2D::get_modification(int p_ } void SkeletonModificationStack2D::add_modification(Ref<SkeletonModification2D> p_mod) { + ERR_FAIL_COND(!p_mod.is_valid()); + p_mod->_setup_modification(this); modifications.push_back(p_mod); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index f728376310..1e78561bec 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -370,13 +370,13 @@ Array SurfaceTool::commit_to_arrays() { for (uint32_t idx = 0; idx < vertex_array.size(); idx++) { const Vertex &v = vertex_array[idx]; - w[idx + 0] = v.tangent.x; - w[idx + 1] = v.tangent.y; - w[idx + 2] = v.tangent.z; + w[idx * 4 + 0] = v.tangent.x; + w[idx * 4 + 1] = v.tangent.y; + w[idx * 4 + 2] = v.tangent.z; //float d = v.tangent.dot(v.binormal,v.normal); float d = v.binormal.dot(v.normal.cross(v.tangent)); - w[idx + 3] = d < 0 ? -1 : 1; + w[idx * 4 + 3] = d < 0 ? -1 : 1; } a[i] = array; diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h index 4674f0cc69..bde6702759 100644 --- a/scene/resources/surface_tool.h +++ b/scene/resources/surface_tool.h @@ -35,8 +35,8 @@ #include "scene/resources/mesh.h" #include "thirdparty/misc/mikktspace.h" -class SurfaceTool : public Reference { - GDCLASS(SurfaceTool, Reference); +class SurfaceTool : public RefCounted { + GDCLASS(SurfaceTool, RefCounted); public: struct Vertex { diff --git a/scene/resources/text_file.cpp b/scene/resources/text_file.cpp index 564c65adb9..33bb0a83e9 100644 --- a/scene/resources/text_file.cpp +++ b/scene/resources/text_file.cpp @@ -30,7 +30,7 @@ #include "text_file.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" bool TextFile::has_text() const { return text != ""; diff --git a/scene/resources/text_line.h b/scene/resources/text_line.h index 74d4f2c32c..1b5c1a3123 100644 --- a/scene/resources/text_line.h +++ b/scene/resources/text_line.h @@ -36,8 +36,8 @@ /*************************************************************************/ -class TextLine : public Reference { - GDCLASS(TextLine, Reference); +class TextLine : public RefCounted { + GDCLASS(TextLine, RefCounted); RID rid; int spacing_top = 0; diff --git a/scene/resources/text_paragraph.h b/scene/resources/text_paragraph.h index 4396b07130..a34e745090 100644 --- a/scene/resources/text_paragraph.h +++ b/scene/resources/text_paragraph.h @@ -36,8 +36,8 @@ /*************************************************************************/ -class TextParagraph : public Reference { - GDCLASS(TextParagraph, Reference); +class TextParagraph : public RefCounted { + GDCLASS(TextParagraph, RefCounted); RID dropcap_rid; int dropcap_lines = 0; diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 4475179431..064563d4b5 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -327,7 +327,7 @@ Ref<Image> StreamTexture2D::load_image_from_file(FileAccess *f, int p_size_limit uint32_t mipmaps = f->get_32(); Image::Format format = Image::Format(f->get_32()); - if (data_format == DATA_FORMAT_LOSSLESS || data_format == DATA_FORMAT_LOSSY || data_format == DATA_FORMAT_BASIS_UNIVERSAL) { + if (data_format == DATA_FORMAT_PNG || data_format == DATA_FORMAT_WEBP || data_format == DATA_FORMAT_BASIS_UNIVERSAL) { //look for a PNG or WEBP file inside int sw = w; @@ -360,10 +360,10 @@ Ref<Image> StreamTexture2D::load_image_from_file(FileAccess *f, int p_size_limit Ref<Image> img; if (data_format == DATA_FORMAT_BASIS_UNIVERSAL) { img = Image::basis_universal_unpacker(pv); - } else if (data_format == DATA_FORMAT_LOSSLESS) { - img = Image::lossless_unpacker(pv); + } else if (data_format == DATA_FORMAT_PNG) { + img = Image::png_unpacker(pv); } else { - img = Image::lossy_unpacker(pv); + img = Image::webp_unpacker(pv); } if (img.is_null() || img->is_empty()) { diff --git a/scene/resources/texture.h b/scene/resources/texture.h index df8c00f8ff..3b1815266d 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -31,10 +31,10 @@ #ifndef TEXTURE_H #define TEXTURE_H +#include "core/io/file_access.h" #include "core/io/resource.h" #include "core/io/resource_loader.h" #include "core/math/rect2.h" -#include "core/os/file_access.h" #include "core/os/mutex.h" #include "core/os/rw_lock.h" #include "core/os/thread_safe.h" @@ -136,8 +136,8 @@ class StreamTexture2D : public Texture2D { public: enum DataFormat { DATA_FORMAT_IMAGE, - DATA_FORMAT_LOSSLESS, - DATA_FORMAT_LOSSY, + DATA_FORMAT_PNG, + DATA_FORMAT_WEBP, DATA_FORMAT_BASIS_UNIVERSAL, }; @@ -146,9 +146,6 @@ public: }; enum FormatBits { - FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1, - FORMAT_BIT_LOSSLESS = 1 << 20, - FORMAT_BIT_LOSSY = 1 << 21, FORMAT_BIT_STREAM = 1 << 22, FORMAT_BIT_HAS_MIPMAPS = 1 << 23, FORMAT_BIT_DETECT_3D = 1 << 24, @@ -389,8 +386,8 @@ class StreamTextureLayered : public TextureLayered { public: enum DataFormat { DATA_FORMAT_IMAGE, - DATA_FORMAT_LOSSLESS, - DATA_FORMAT_LOSSY, + DATA_FORMAT_PNG, + DATA_FORMAT_WEBP, DATA_FORMAT_BASIS_UNIVERSAL, }; @@ -399,9 +396,6 @@ public: }; enum FormatBits { - FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1, - FORMAT_BIT_LOSSLESS = 1 << 20, - FORMAT_BIT_LOSSY = 1 << 21, FORMAT_BIT_STREAM = 1 << 22, FORMAT_BIT_HAS_MIPMAPS = 1 << 23, }; @@ -532,8 +526,8 @@ class StreamTexture3D : public Texture3D { public: enum DataFormat { DATA_FORMAT_IMAGE, - DATA_FORMAT_LOSSLESS, - DATA_FORMAT_LOSSY, + DATA_FORMAT_PNG, + DATA_FORMAT_WEBP, DATA_FORMAT_BASIS_UNIVERSAL, }; @@ -542,9 +536,6 @@ public: }; enum FormatBits { - FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1, - FORMAT_BIT_LOSSLESS = 1 << 20, - FORMAT_BIT_LOSSY = 1 << 21, FORMAT_BIT_STREAM = 1 << 22, FORMAT_BIT_HAS_MIPMAPS = 1 << 23, }; diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 12309f7488..d6a6f31fad 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "theme.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/string/print_string.h" void Theme::_emit_theme_changed() { diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 2220df06f6..0d6f3c07f0 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -2454,6 +2454,7 @@ int TileData::get_terrain_set() const { } void TileData::set_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit, int p_terrain_index) { + ERR_FAIL_INDEX(p_peering_bit, TileSet::CELL_NEIGHBOR_MAX); ERR_FAIL_COND(p_terrain_index < -1); if (tile_set) { ERR_FAIL_COND(p_terrain_index >= tile_set->get_terrains_count(terrain_set)); @@ -2464,6 +2465,7 @@ void TileData::set_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit, int } int TileData::get_peering_bit_terrain(TileSet::CellNeighbor p_peering_bit) const { + ERR_FAIL_INDEX_V(p_peering_bit, TileSet::CELL_NEIGHBOR_MAX, -1); return terrain_peering_bits[p_peering_bit]; } diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 7575ccd5c3..8e5f271cc7 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -155,13 +155,13 @@ SceneStringNames::SceneStringNames() { area_entered = StaticCString::create("area_entered"); area_exited = StaticCString::create("area_exited"); - has_point = StaticCString::create("has_point"); + _has_point = StaticCString::create("_has_point"); line_separation = StaticCString::create("line_separation"); - get_drag_data = StaticCString::create("get_drag_data"); - drop_data = StaticCString::create("drop_data"); - can_drop_data = StaticCString::create("can_drop_data"); + _get_drag_data = StaticCString::create("_get_drag_data"); + _drop_data = StaticCString::create("_drop_data"); + _can_drop_data = StaticCString::create("_can_drop_data"); _im_update = StaticCString::create("_im_update"); // Sprite3D diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index a5b489eddc..10b0707cab 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -138,10 +138,10 @@ public: StringName grouped; StringName ungrouped; - StringName has_point; - StringName get_drag_data; - StringName can_drop_data; - StringName drop_data; + StringName _has_point; + StringName _get_drag_data; + StringName _can_drop_data; + StringName _drop_data; StringName screen_entered; StringName screen_exited; |