diff --git a/modules/terraman_2d/areas/terrain_2d_world_area.h b/modules/terraman_2d/areas/terrain_2d_world_area.h index fd694224d..caf1d262a 100644 --- a/modules/terraman_2d/areas/terrain_2d_world_area.h +++ b/modules/terraman_2d/areas/terrain_2d_world_area.h @@ -22,21 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/object/ref_counted.h" -#ifndef Reference -#define Reference RefCounted -#endif -#include "core/string/ustring.h" -#else #include "core/reference.h" #include "core/ustring.h" -#endif #include "core/math/aabb.h" diff --git a/modules/terraman_2d/data/terrain_2d_light.h b/modules/terraman_2d/data/terrain_2d_light.h index 391b297e4..ec1dff919 100644 --- a/modules/terraman_2d/data/terrain_2d_light.h +++ b/modules/terraman_2d/data/terrain_2d_light.h @@ -22,24 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/object/ref_counted.h" -#ifndef Reference -#define Reference RefCounted -#endif -#include "core/templates/vector.h" -#include "core/math/color.h" -#else +#include "core/color.h" #include "core/reference.h" #include "core/vector.h" -#include "core/color.h" -#endif - class Terrain2DLight : public Reference { GDCLASS(Terrain2DLight, Reference); diff --git a/modules/terraman_2d/defines.h b/modules/terraman_2d/defines.h index 6d701016b..a1945651f 100644 --- a/modules/terraman_2d/defines.h +++ b/modules/terraman_2d/defines.h @@ -2,32 +2,6 @@ #ifndef TERRAIN_2D_DEFINES_H #define TERRAIN_2D_DEFINES_H -#include "core/version.h" - -#if VERSION_MAJOR >= 4 -#define GODOT4 true -#endif - -//includes -#if GODOT4 -#define core_input_h "core/input/input_event.h" -#define spatial_editor_plugin_h "editor/plugins/node_3d_editor_plugin.h" -#define camera_h "scene/3d/camera_3d.h" -#define spatial_h "scene/3d/node_3d.h" -#define navigation_h "scene/3d/node_3d.h" -#define Navigation3D Node3D -#define light_h "scene/3d/light_3d.h" -#define visual_server_h "servers/rendering_server.h" -#define mesh_instance_h "scene/3d/mesh_instance_3d.h" -#define pool_vector_h "core/templates/vector.h" -#define physics_server_h "servers/physics_server_3d.h" -#define immediate_geometry_h "scene/3d/immediate_geometry_3d.h" -#define include_pool_vector \ - template \ - class Vector; \ - template \ - using PoolVector = Vector; -#else #define core_input_h "core/os/input.h" #define spatial_editor_plugin_h "editor/plugins/spatial_editor_plugin.h" #define camera_h "scene/3d/camera.h" @@ -40,57 +14,6 @@ #define physics_server_h "servers/physics_server.h" #define immediate_geometry_h "scene/3d/immediate_geometry.h" #define include_pool_vector -#endif - -//Type Defines -#if GODOT4 -#define PhysicsDirectSpaceState PhysicsDirectSpaceState3D -#define SpatialEditor Node3DEditor -#define SpatialEditorPlugin Node3DEditorPlugin -#define SpatialEditorViewport Node3DEditorViewport -#define PoolStringArray PackedStringArray -#define REAL FLOAT -#define POOL_STRING_ARRAY PACKED_STRING_ARRAY -#define POOL_BYTE_ARRAY PACKED_BYTE_ARRAY -#define Spatial Node3D -#define SpatialMaterial StandardMaterial3D -#define PoolVector3Array PackedVector3Array -#define PoolVector2Array PackedVector2Array -#define PoolColorArray PackedColorArray -#define PoolIntArray PackedInt64Array -#define PoolRealArray PackedFloat32Array -#define PoolByteArray PackedByteArray -#define MeshInstance MeshInstance3D -#define Camera Camera3D -#define ToolButton Button -#define Shape Shape3D -#define Reference RefCounted - -typedef class World3D World; - -#define DirectionalLight DirectionalLight3D - -typedef class ImmediateGeometry3D ImmediateGeometry; -typedef class Navigation3D Navigation; -typedef class PhysicsServer3D PhysicsServer; -typedef class RenderingServer VisualServer; -typedef class RenderingServer VS; -//typedef class StandardMaterial3D SpatialMaterial; - -//toodo figure out a way to have this -//#define Variant::CallError Callable::CallError -#endif - -#if GODOT4 - -#define VARIANT_ARRAY_GET(arr) \ - Vector r; \ - for (int i = 0; i < arr.size(); i++) { \ - r.push_back(arr[i]); \ - } \ - return r; - -#else #define VARIANT_ARRAY_GET(arr) \ Vector r; \ @@ -99,8 +22,6 @@ typedef class RenderingServer VS; } \ return r; -#endif - #define VARIANT_ARRAY_SET(arr, arr_into, type) \ arr_into.clear(); \ for (int i = 0; i < arr.size(); i++) { \ @@ -108,58 +29,6 @@ typedef class RenderingServer VS; arr_into.push_back(e); \ } -#if GODOT4 -//TODO do this properly -#define INSTANCE_VALIDATE(var) var -#define CONNECT(sig, obj, target_method_class, method) connect(sig, callable_mp(obj, &target_method_class::method)) -#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, callable_mp(obj, &target_method_class::method)) -#define INSTANCE instantiate -#define VREMOVE remove_at - -#define CALL(func, ...) \ - _gdvirtual_##func##_call(__VA_ARGS__) - -#define RETURN_CALL(ret_type, func) \ - ret_type _return_call_ret_var; \ - _gdvirtual_##func##_call(_return_call_ret_var); \ - return _return_call_ret_var; - -#define RETURN_CALLP(ret_type, func, ...) \ - ret_type _return_call_ret_var; \ - _gdvirtual_##func##_call(__VA_ARGS__, _return_call_ret_var); \ - return _return_call_ret_var; - -#define GET_CALL(ret_type, ret_var, func) \ - _gdvirtual_##func##_call(ret_var); - -#define GET_CALLP(ret_type, ret_var, func, ...) \ - _gdvirtual_##func##_call(__VA_ARGS__, ret_var); - -#define RETURN_CALLD(ret_type, def_val, func) \ - ret_type _return_call_ret_var = def_val; \ - if (_gdvirtual_##func##_call(_return_call_ret_var)) { \ - return _return_call_ret_var; \ - } \ - return def_val; - -#define RETURN_CALLPD(ret_type, def_val, func, ...) \ - ret_type _return_call_ret_var = def_val; \ - if (_gdvirtual_##func##_call(__VA_ARGS__, _return_call_ret_var)) { \ - return _return_call_ret_var; \ - } \ - return def_val; - -#define GET_CALLD(ret_type, def_val, ret_var, func) \ - if (!_gdvirtual_##func##_call(ret_var)) { \ - ret_var = def_val; \ - } - -#define GET_CALLPD(ret_type, def_val, ret_var, func, ...) \ - if (!_gdvirtual_##func##_call(__VA_ARGS__, ret_var)) { \ - ret_var = def_val; \ - } - -#else #define INSTANCE_VALIDATE(var) ObjectDB::instance_validate(var) #define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method) #define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method) @@ -194,5 +63,3 @@ typedef class RenderingServer VS; return call(#func, ##__VA_ARGS__); #endif - -#endif diff --git a/modules/terraman_2d/level_generator/terrain_2d_level_generator.h b/modules/terraman_2d/level_generator/terrain_2d_level_generator.h index cf32d24b8..48a526141 100644 --- a/modules/terraman_2d/level_generator/terrain_2d_level_generator.h +++ b/modules/terraman_2d/level_generator/terrain_2d_level_generator.h @@ -22,16 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#else #include "core/resource.h" -#endif class Terrain2DChunk; diff --git a/modules/terraman_2d/level_generator/terrain_2d_level_generator_flat.h b/modules/terraman_2d/level_generator/terrain_2d_level_generator_flat.h index 445dc83ba..437017d6e 100644 --- a/modules/terraman_2d/level_generator/terrain_2d_level_generator_flat.h +++ b/modules/terraman_2d/level_generator/terrain_2d_level_generator_flat.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_2d_level_generator.h" class Terrain2DChunk; diff --git a/modules/terraman_2d/library/terrain_2d_library.cpp b/modules/terraman_2d/library/terrain_2d_library.cpp index 7c12ee6e6..c8bc4e379 100644 --- a/modules/terraman_2d/library/terrain_2d_library.cpp +++ b/modules/terraman_2d/library/terrain_2d_library.cpp @@ -34,117 +34,6 @@ SOFTWARE. #include "../defines.h" -#if VERSION_MAJOR > 3 - -#define TMCGDVIRTUAL1(m_class, m_name, m_type1) \ - bool m_class::_gdvirtual_##m_name##_call(m_type1 arg1) { \ - ScriptInstance *script_instance = ((Object *)(this))->get_script_instance(); \ - if (script_instance) { \ - Callable::CallError ce; \ - Variant vargs[1] = { Variant(arg1) }; \ - const Variant *vargptrs[1] = { &vargs[0] }; \ - \ - script_instance->call(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs, 1, ce); \ - if (ce.error == Callable::CallError::CALL_OK) { \ - return true; \ - } \ - } \ - if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) { \ - _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, #m_name) : (GDNativeExtensionClassCallVirtual) nullptr; \ - _gdvirtual_##m_name##_initialized = true; \ - } \ - if (_gdvirtual_##m_name) { \ - PtrToArg::EncodeT argval1 = arg1; \ - const GDNativeTypePtr argptrs[1] = { &argval1 }; \ - \ - _gdvirtual_##m_name(_get_extension_instance(), (const GDNativeTypePtr *)argptrs, nullptr); \ - \ - return true; \ - } \ - \ - return false; \ - } \ - bool m_class::_gdvirtual_##m_name##_overridden() const { \ - ScriptInstance *script_instance = ((Object *)(this))->get_script_instance(); \ - if (script_instance) { \ - return script_instance->has_method(_gdvirtual_##m_name##_sn); \ - } \ - if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) { \ - _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, #m_name) : (GDNativeExtensionClassCallVirtual) nullptr; \ - _gdvirtual_##m_name##_initialized = true; \ - } \ - if (_gdvirtual_##m_name) { \ - return true; \ - } \ - return false; \ - } \ - \ - MethodInfo m_class::_gdvirtual_##m_name##_get_method_info() { \ - MethodInfo method_info; \ - method_info.name = #m_name; \ - method_info.flags = METHOD_FLAG_VIRTUAL; \ - method_info.arguments.push_back(GetTypeInfo::get_class_info()); \ - \ - return method_info; \ - } - -#define TMCGDVIRTUAL1R(m_class, m_ret, m_name, m_type1) \ - bool m_class::_gdvirtual_##m_name##_call(m_type1 arg1, m_ret &r_ret) { \ - ScriptInstance *script_instance = ((Object *)(this))->get_script_instance(); \ - if (script_instance) { \ - Callable::CallError ce; \ - Variant vargs[1] = { Variant(arg1) }; \ - const Variant *vargptrs[1] = { &vargs[0] }; \ - \ - Variant ret = script_instance->call(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs, 1, ce); \ - if (ce.error == Callable::CallError::CALL_OK) { \ - r_ret = VariantCaster::cast(ret); \ - return true; \ - } \ - } \ - if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) { \ - _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, #m_name) : (GDNativeExtensionClassCallVirtual) nullptr; \ - _gdvirtual_##m_name##_initialized = true; \ - } \ - if (_gdvirtual_##m_name) { \ - PtrToArg::EncodeT argval1 = arg1; \ - const GDNativeTypePtr argptrs[1] = { &argval1 }; \ - \ - PtrToArg::EncodeT ret; \ - _gdvirtual_##m_name(_get_extension_instance(), (const GDNativeTypePtr *)argptrs, &ret); \ - r_ret = (m_ret)ret; \ - return true; \ - } \ - \ - return false; \ - } \ - bool m_class::_gdvirtual_##m_name##_overridden() const { \ - ScriptInstance *script_instance = ((Object *)(this))->get_script_instance(); \ - if (script_instance) { \ - return script_instance->has_method(_gdvirtual_##m_name##_sn); \ - } \ - if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) { \ - _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, #m_name) : (GDNativeExtensionClassCallVirtual) nullptr; \ - _gdvirtual_##m_name##_initialized = true; \ - } \ - if (_gdvirtual_##m_name) { \ - return true; \ - } \ - return false; \ - } \ - \ - MethodInfo m_class::_gdvirtual_##m_name##_get_method_info() { \ - MethodInfo method_info; \ - method_info.name = #m_name; \ - method_info.flags = METHOD_FLAG_VIRTUAL; \ - method_info.return_val = GetTypeInfo::get_class_info(); \ - method_info.arguments.push_back(GetTypeInfo::get_class_info()); \ - \ - return method_info; \ - } - -#endif - bool Terrain2DLibrary::get_initialized() const { return _initialized; } @@ -350,30 +239,12 @@ Terrain2DLibrary::~Terrain2DLibrary() { _prop_material.unref(); } -#if VERSION_MAJOR >= 4 -TMCGDVIRTUAL1(Terrain2DLibrary, _material_cache_get_key, Ref); -TMCGDVIRTUAL1R(Terrain2DLibrary, Ref, _material_cache_get, int); -TMCGDVIRTUAL1(Terrain2DLibrary, _material_cache_unref, int); - -TMCGDVIRTUAL1(Terrain2DLibrary, _liquid_material_cache_get_key, Ref); -TMCGDVIRTUAL1R(Terrain2DLibrary, Ref, _liquid_material_cache_get, int); -TMCGDVIRTUAL1(Terrain2DLibrary, _liquid_material_cache_unref, int); - -TMCGDVIRTUAL1(Terrain2DLibrary, _prop_material_cache_get_key, Ref); -TMCGDVIRTUAL1R(Terrain2DLibrary, Ref, _prop_material_cache_get, int); -TMCGDVIRTUAL1(Terrain2DLibrary, _prop_material_cache_unref, int); -#endif - void Terrain2DLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("get_initialized"), &Terrain2DLibrary::get_initialized); ClassDB::bind_method(D_METHOD("set_initialized", "value"), &Terrain2DLibrary::set_initialized); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "initialized", PROPERTY_HINT_NONE, "", 0), "set_initialized", "get_initialized"); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::BOOL, "ret"), "_supports_caching")); -#else - GDVIRTUAL_BIND(_supports_caching); -#endif ClassDB::bind_method(D_METHOD("_supports_caching"), &Terrain2DLibrary::_supports_caching); ClassDB::bind_method(D_METHOD("supports_caching"), &Terrain2DLibrary::supports_caching); @@ -390,21 +261,11 @@ void Terrain2DLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("prop_texture_set", "value"), &Terrain2DLibrary::prop_texture_set); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "prop_texture_set", "prop_texture_get"); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_setup_material_albedo", PropertyInfo(Variant::INT, "material_index"), PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"))); -#else - GDVIRTUAL_BIND(_setup_material_albedo, "material_index", "texture"); -#endif -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_material_cache_get_key", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DMaterialCache"), "_material_cache_get", PropertyInfo(Variant::INT, "key"))); BIND_VMETHOD(MethodInfo("_material_cache_unref", PropertyInfo(Variant::INT, "key"))); -#else - GDVIRTUAL_BIND(_material_cache_get_key, "chunk", "texture"); - GDVIRTUAL_BIND(_material_cache_get, "key"); - GDVIRTUAL_BIND(_material_cache_unref, "key"); -#endif ClassDB::bind_method(D_METHOD("material_cache_get_key", "chunk"), &Terrain2DLibrary::material_cache_get_key); ClassDB::bind_method(D_METHOD("_material_cache_get_key", "chunk"), &Terrain2DLibrary::_material_cache_get_key); @@ -417,15 +278,9 @@ void Terrain2DLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("material_set", "value"), &Terrain2DLibrary::material_set); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "material_set", "material_get"); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_liquid_material_cache_get_key", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DMaterialCache"), "_liquid_material_cache_get", PropertyInfo(Variant::INT, "key"))); BIND_VMETHOD(MethodInfo("_liquid_material_cache_unref", PropertyInfo(Variant::INT, "key"))); -#else - GDVIRTUAL_BIND(_liquid_material_cache_get_key, "chunk", "texture"); - GDVIRTUAL_BIND(_liquid_material_cache_get, "key"); - GDVIRTUAL_BIND(_liquid_material_cache_unref, "key"); -#endif ClassDB::bind_method(D_METHOD("liquid_material_cache_get_key", "chunk"), &Terrain2DLibrary::liquid_material_cache_get_key); ClassDB::bind_method(D_METHOD("_liquid_material_cache_get_key", "chunk"), &Terrain2DLibrary::_liquid_material_cache_get_key); @@ -438,15 +293,9 @@ void Terrain2DLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("liquid_material_set", "value"), &Terrain2DLibrary::liquid_material_set); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "liquid_material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "liquid_material_set", "liquid_material_get"); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_prop_material_cache_get_key", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DMaterialCache"), "_prop_material_cache_get", PropertyInfo(Variant::INT, "key"))); BIND_VMETHOD(MethodInfo("_prop_material_cache_unref", PropertyInfo(Variant::INT, "key"))); -#else - GDVIRTUAL_BIND(_prop_material_cache_get_key, "chunk", "texture"); - GDVIRTUAL_BIND(_prop_material_cache_get, "key"); - GDVIRTUAL_BIND(_prop_material_cache_unref, "key"); -#endif ClassDB::bind_method(D_METHOD("prop_material_cache_get_key", "chunk"), &Terrain2DLibrary::prop_material_cache_get_key); ClassDB::bind_method(D_METHOD("_prop_material_cache_get_key", "chunk"), &Terrain2DLibrary::_prop_material_cache_get_key); diff --git a/modules/terraman_2d/library/terrain_2d_library.h b/modules/terraman_2d/library/terrain_2d_library.h index 576cc9f36..ef4e92503 100644 --- a/modules/terraman_2d/library/terrain_2d_library.h +++ b/modules/terraman_2d/library/terrain_2d_library.h @@ -22,35 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" - -// These are needed here to use incomplete classes as vmethod arguments (godot4) - -#define TMHGDVIRTUAL1(m_name, m_type1) \ - StringName _gdvirtual_##m_name##_sn = #m_name; \ - mutable bool _gdvirtual_##m_name##_initialized = false; \ - mutable GDNativeExtensionClassCallVirtual _gdvirtual_##m_name = nullptr; \ - bool _gdvirtual_##m_name##_call(m_type1 arg1); \ - bool _gdvirtual_##m_name##_overridden() const; \ - static MethodInfo _gdvirtual_##m_name##_get_method_info(); - -#define TMHGDVIRTUAL1R(m_ret, m_name, m_type1) \ - StringName _gdvirtual_##m_name##_sn = #m_name; \ - mutable bool _gdvirtual_##m_name##_initialized = false; \ - mutable GDNativeExtensionClassCallVirtual _gdvirtual_##m_name = nullptr; \ - bool _gdvirtual_##m_name##_call(m_type1 arg1, m_ret &r_ret); \ - bool _gdvirtual_##m_name##_overridden() const; \ - static MethodInfo _gdvirtual_##m_name##_get_method_info(); - -#else #include "core/resource.h" -#endif #include "core/math/rect2.h" #include "scene/resources/material.h" @@ -60,10 +32,6 @@ SOFTWARE. #include "../defines.h" -#if GODOT4 -#define Texture Texture2D -#endif - class Terrain2DMaterialCache; class Terrain2DSurface; class Terrain2DMesher; @@ -159,24 +127,6 @@ public: void setup_material_albedo(int material_index, Ref texture); -#if VERSION_MAJOR >= 4 - GDVIRTUAL0R(bool, _supports_caching); - - GDVIRTUAL2(_setup_material_albedo, int, Ref); - - TMHGDVIRTUAL1(_material_cache_get_key, Ref); - TMHGDVIRTUAL1R(Ref, _material_cache_get, int); - TMHGDVIRTUAL1(_material_cache_unref, int); - - TMHGDVIRTUAL1(_liquid_material_cache_get_key, Ref); - TMHGDVIRTUAL1R(Ref, _liquid_material_cache_get, int); - TMHGDVIRTUAL1(_liquid_material_cache_unref, int); - - TMHGDVIRTUAL1(_prop_material_cache_get_key, Ref); - TMHGDVIRTUAL1R(Ref, _prop_material_cache_get, int); - TMHGDVIRTUAL1(_prop_material_cache_unref, int); -#endif - Terrain2DLibrary(); ~Terrain2DLibrary(); diff --git a/modules/terraman_2d/library/terrain_2d_library_merger.cpp b/modules/terraman_2d/library/terrain_2d_library_merger.cpp index fa2cd327d..3698b98c8 100644 --- a/modules/terraman_2d/library/terrain_2d_library_merger.cpp +++ b/modules/terraman_2d/library/terrain_2d_library_merger.cpp @@ -321,11 +321,7 @@ void Terrain2DLibraryMerger::_setup_material_albedo(const int material_index, co Terrain2DLibraryMerger::Terrain2DLibraryMerger() { _packer.instance(); -#if GODOT4 -#warning implement -#else _packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif _packer->set_max_atlas_size(1024); _packer->set_keep_original_atlases(false); @@ -333,11 +329,7 @@ Terrain2DLibraryMerger::Terrain2DLibraryMerger() { _prop_packer.instance(); -#if GODOT4 -#warning implement -#else _prop_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif _prop_packer->set_max_atlas_size(1024); _prop_packer->set_keep_original_atlases(false); diff --git a/modules/terraman_2d/library/terrain_2d_library_merger.h b/modules/terraman_2d/library/terrain_2d_library_merger.h index c9958a0d4..ad10ef3ff 100644 --- a/modules/terraman_2d/library/terrain_2d_library_merger.h +++ b/modules/terraman_2d/library/terrain_2d_library_merger.h @@ -22,18 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/templates/map.h" -#else -#include "core/resource.h" #include "core/map.h" -#endif +#include "core/resource.h" #include "terrain_2d_library.h" @@ -106,9 +96,9 @@ protected: static void _bind_methods(); - Vector > _terra_surfaces; + Vector> _terra_surfaces; #ifdef PROPS_2D_PRESENT - Vector > _props; + Vector> _props; #endif Ref _packer; diff --git a/modules/terraman_2d/library/terrain_2d_library_merger_pcm.cpp b/modules/terraman_2d/library/terrain_2d_library_merger_pcm.cpp index 0e5ba3b98..2aa806d62 100644 --- a/modules/terraman_2d/library/terrain_2d_library_merger_pcm.cpp +++ b/modules/terraman_2d/library/terrain_2d_library_merger_pcm.cpp @@ -696,11 +696,7 @@ void Terrain2DLibraryMergerPCM::_setup_material_albedo(const int material_index, Terrain2DLibraryMergerPCM::Terrain2DLibraryMergerPCM() { _packer.instance(); -#if GODOT4 -#warning implement -#else _packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif _packer->set_max_atlas_size(1024); _packer->set_keep_original_atlases(false); @@ -708,11 +704,7 @@ Terrain2DLibraryMergerPCM::Terrain2DLibraryMergerPCM() { _prop_packer.instance(); -#if GODOT4 -#warning implement -#else _prop_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif _prop_packer->set_max_atlas_size(1024); _prop_packer->set_keep_original_atlases(false); diff --git a/modules/terraman_2d/library/terrain_2d_library_merger_pcm.h b/modules/terraman_2d/library/terrain_2d_library_merger_pcm.h index d197d4d38..132994365 100644 --- a/modules/terraman_2d/library/terrain_2d_library_merger_pcm.h +++ b/modules/terraman_2d/library/terrain_2d_library_merger_pcm.h @@ -22,18 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/templates/map.h" -#else -#include "core/resource.h" #include "core/map.h" -#endif +#include "core/resource.h" #include "terrain_2d_library.h" @@ -121,12 +111,12 @@ protected: static void _bind_methods(); - Map > _material_cache; - Map > _prop_material_cache; + Map> _material_cache; + Map> _prop_material_cache; - Vector > _terra_surfaces; + Vector> _terra_surfaces; #ifdef PROPS_2D_PRESENT - Vector > _props; + Vector> _props; #endif //todo remove these diff --git a/modules/terraman_2d/library/terrain_2d_library_simple.h b/modules/terraman_2d/library/terrain_2d_library_simple.h index 528c55232..b8219f29d 100644 --- a/modules/terraman_2d/library/terrain_2d_library_simple.h +++ b/modules/terraman_2d/library/terrain_2d_library_simple.h @@ -22,16 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#else #include "core/resource.h" -#endif #include "terrain_2d_library.h" @@ -72,7 +63,7 @@ protected: static void _bind_methods(); private: - Vector > _terra_surfaces; + Vector> _terra_surfaces; //atlas int _atlas_columns; diff --git a/modules/terraman_2d/library/terrain_2d_material_cache.cpp b/modules/terraman_2d/library/terrain_2d_material_cache.cpp index 4a1a926c2..1ed475b56 100644 --- a/modules/terraman_2d/library/terrain_2d_material_cache.cpp +++ b/modules/terraman_2d/library/terrain_2d_material_cache.cpp @@ -219,13 +219,9 @@ void Terrain2DMaterialCache::refresh_rects() { } void Terrain2DMaterialCache::setup_material_albedo(Ref texture) { -#if VERSION_MAJOR < 4 if (has_method("_setup_material_albedo")) { call("_setup_material_albedo", texture); } -#else - GDVIRTUAL_CALL(_setup_material_albedo, texture); -#endif } Terrain2DMaterialCache::Terrain2DMaterialCache() { @@ -249,11 +245,7 @@ void Terrain2DMaterialCache::_bind_methods() { ClassDB::bind_method(D_METHOD("inc_ref_count"), &Terrain2DMaterialCache::inc_ref_count); ClassDB::bind_method(D_METHOD("dec_ref_count"), &Terrain2DMaterialCache::dec_ref_count); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_setup_material_albedo", PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"))); -#else - GDVIRTUAL_BIND(_setup_material_albedo, "texture"); -#endif ClassDB::bind_method(D_METHOD("material_get"), &Terrain2DMaterialCache::material_get); ClassDB::bind_method(D_METHOD("material_set", "value"), &Terrain2DMaterialCache::material_set); diff --git a/modules/terraman_2d/library/terrain_2d_material_cache.h b/modules/terraman_2d/library/terrain_2d_material_cache.h index 9bb2f68d4..9c397203d 100644 --- a/modules/terraman_2d/library/terrain_2d_material_cache.h +++ b/modules/terraman_2d/library/terrain_2d_material_cache.h @@ -22,20 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/math/color.h" -#include "core/templates/vector.h" -#else #include "core/color.h" #include "core/resource.h" #include "core/vector.h" -#endif #include "core/math/rect2.h" #include "scene/resources/material.h" @@ -94,10 +83,6 @@ public: void setup_material_albedo(Ref texture); -#if VERSION_MAJOR >= 4 - GDVIRTUAL1(_setup_material_albedo, Ref); -#endif - Terrain2DMaterialCache(); ~Terrain2DMaterialCache(); diff --git a/modules/terraman_2d/library/terrain_2d_material_cache_pcm.cpp b/modules/terraman_2d/library/terrain_2d_material_cache_pcm.cpp index 3211e986e..caae02fbe 100644 --- a/modules/terraman_2d/library/terrain_2d_material_cache_pcm.cpp +++ b/modules/terraman_2d/library/terrain_2d_material_cache_pcm.cpp @@ -172,11 +172,7 @@ void Terrain2DMaterialCachePCM::_setup_material_albedo(Ref texture) { Terrain2DMaterialCachePCM::Terrain2DMaterialCachePCM() { _packer.instance(); -#if GODOT4 -#warning implement -#else _packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); -#endif _packer->set_max_atlas_size(1024); _packer->set_keep_original_atlases(false); diff --git a/modules/terraman_2d/library/terrain_2d_material_cache_pcm.h b/modules/terraman_2d/library/terrain_2d_material_cache_pcm.h index ec77c936f..8c6500ef0 100644 --- a/modules/terraman_2d/library/terrain_2d_material_cache_pcm.h +++ b/modules/terraman_2d/library/terrain_2d_material_cache_pcm.h @@ -22,22 +22,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_2d_material_cache.h" -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/math/color.h" -#include "core/templates/vector.h" -#else #include "core/color.h" #include "core/resource.h" #include "core/vector.h" -#endif #include "core/math/rect2.h" #include "scene/resources/material.h" diff --git a/modules/terraman_2d/library/terrain_2d_surface.h b/modules/terraman_2d/library/terrain_2d_surface.h index dbe4ab8cf..b6d4e8082 100644 --- a/modules/terraman_2d/library/terrain_2d_surface.h +++ b/modules/terraman_2d/library/terrain_2d_surface.h @@ -22,21 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/templates/vector.h" -#include "core/math/color.h" -#else +#include "core/color.h" #include "core/resource.h" #include "core/vector.h" -#include "core/color.h" -#endif #include "core/math/rect2.h" #include "scene/resources/material.h" diff --git a/modules/terraman_2d/library/terrain_2d_surface_merger.cpp b/modules/terraman_2d/library/terrain_2d_surface_merger.cpp index 2ba4a3592..9b2cb9f6a 100644 --- a/modules/terraman_2d/library/terrain_2d_surface_merger.cpp +++ b/modules/terraman_2d/library/terrain_2d_surface_merger.cpp @@ -26,10 +26,6 @@ SOFTWARE. #include "../defines.h" -#if GODOT4 -#define Texture Texture2D -#endif - Ref Terrain2DSurfaceMerger::get_region() { return _region; } diff --git a/modules/terraman_2d/library/terrain_2d_surface_merger.h b/modules/terraman_2d/library/terrain_2d_surface_merger.h index 6b520651b..0f47fcdd8 100644 --- a/modules/terraman_2d/library/terrain_2d_surface_merger.h +++ b/modules/terraman_2d/library/terrain_2d_surface_merger.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_2d_surface.h" #include "scene/resources/texture.h" @@ -33,9 +30,6 @@ SOFTWARE. #include "../defines.h" -#if GODOT4 -#define Texture Texture2D -#endif class Terrain2DSurfaceMerger : public Terrain2DSurface { GDCLASS(Terrain2DSurfaceMerger, Terrain2DSurface) diff --git a/modules/terraman_2d/library/terrain_2d_surface_simple.h b/modules/terraman_2d/library/terrain_2d_surface_simple.h index d8c3cad2b..1283c0699 100644 --- a/modules/terraman_2d/library/terrain_2d_surface_simple.h +++ b/modules/terraman_2d/library/terrain_2d_surface_simple.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_2d_surface.h" class Terrain2DSurfaceSimple : public Terrain2DSurface { diff --git a/modules/terraman_2d/meshers/default/terrain_2d_mesher_default.h b/modules/terraman_2d/meshers/default/terrain_2d_mesher_default.h index 2b4b3e226..5c54ec95a 100644 --- a/modules/terraman_2d/meshers/default/terrain_2d_mesher_default.h +++ b/modules/terraman_2d/meshers/default/terrain_2d_mesher_default.h @@ -22,16 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/math/color.h" -#else #include "core/color.h" -#endif #include "core/math/vector2.h" #include "core/math/vector3.h" diff --git a/modules/terraman_2d/meshers/isometric/terrain_2d_mesher_isometric.h b/modules/terraman_2d/meshers/isometric/terrain_2d_mesher_isometric.h index 2f02d5b03..92fa9bdc3 100644 --- a/modules/terraman_2d/meshers/isometric/terrain_2d_mesher_isometric.h +++ b/modules/terraman_2d/meshers/isometric/terrain_2d_mesher_isometric.h @@ -22,22 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/math/color.h" -#else #include "core/color.h" -#endif #include "core/math/vector2.h" #include "core/math/vector3.h" -#include "../default/terrain_2d_mesher_default.h" #include "../../world/default/terrain_2d_chunk_default.h" +#include "../default/terrain_2d_mesher_default.h" class Terrain2DMesherIsometric : public Terrain2DMesherDefault { GDCLASS(Terrain2DMesherIsometric, Terrain2DMesherDefault); diff --git a/modules/terraman_2d/meshers/simple/terrain_2d_mesher_simple.h b/modules/terraman_2d/meshers/simple/terrain_2d_mesher_simple.h index e35afbdf4..d31829163 100644 --- a/modules/terraman_2d/meshers/simple/terrain_2d_mesher_simple.h +++ b/modules/terraman_2d/meshers/simple/terrain_2d_mesher_simple.h @@ -22,22 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/math/color.h" -#else #include "core/color.h" -#endif #include "core/math/vector2.h" #include "core/math/vector3.h" -#include "../default/terrain_2d_mesher_default.h" #include "../../world/default/terrain_2d_chunk_default.h" +#include "../default/terrain_2d_mesher_default.h" class Terrain2DMesherSimple : public Terrain2DMesherDefault { GDCLASS(Terrain2DMesherSimple, Terrain2DMesherDefault); diff --git a/modules/terraman_2d/meshers/terrain_2d_mesher.cpp b/modules/terraman_2d/meshers/terrain_2d_mesher.cpp index baa846f8d..0d3af915e 100644 --- a/modules/terraman_2d/meshers/terrain_2d_mesher.cpp +++ b/modules/terraman_2d/meshers/terrain_2d_mesher.cpp @@ -155,21 +155,13 @@ Array Terrain2DMesher::build_mesh() { { PoolVector array; array.resize(_vertices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < _vertices.size(); ++i) { -#if !GODOT4 w[i] = _vertices[i].vertex; -#else - array.set(i, _vertices[i].vertex); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_VERTEX] = array; } @@ -177,42 +169,27 @@ Array Terrain2DMesher::build_mesh() { if ((_format & VisualServer::ARRAY_FORMAT_COLOR) != 0) { PoolVector array; array.resize(_vertices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < _vertices.size(); ++i) { -#if !GODOT4 w[i] = _vertices[i].color; -#else - array.set(i, _vertices[i].color); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_COLOR] = array; } if ((_format & VisualServer::ARRAY_FORMAT_TEX_UV) != 0) { PoolVector array; array.resize(_vertices.size()); -#if !GODOT4 + PoolVector::Write w = array.write(); -#endif for (int i = 0; i < _vertices.size(); ++i) { -#if !GODOT4 w[i] = _vertices[i].uv; -#else - array.set(i, _vertices[i].uv); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_TEX_UV] = array; } @@ -220,21 +197,13 @@ Array Terrain2DMesher::build_mesh() { if (_indices.size() > 0) { PoolVector array; array.resize(_indices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < _indices.size(); ++i) { -#if !GODOT4 w[i] = _indices[i]; -#else - array.set(i, _indices[i]); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_INDEX] = array; } @@ -387,21 +356,14 @@ Array Terrain2DMesher::build_stored_mesh(const int index) { { PoolVector array; array.resize(md.vertices.size()); -#if !GODOT4 + PoolVector::Write w = array.write(); -#endif for (int i = 0; i < md.vertices.size(); ++i) { -#if !GODOT4 w[i] = md.vertices[i].vertex; -#else - array.set(i, md.vertices[i].vertex); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_VERTEX] = array; } @@ -409,64 +371,40 @@ Array Terrain2DMesher::build_stored_mesh(const int index) { if ((_format & VisualServer::ARRAY_FORMAT_COLOR) != 0) { PoolVector array; array.resize(md.vertices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < md.vertices.size(); ++i) { -#if !GODOT4 w[i] = md.vertices[i].color; -#else - array.set(i, md.vertices[i].color); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_COLOR] = array; } if ((_format & VisualServer::ARRAY_FORMAT_TEX_UV) != 0) { PoolVector array; array.resize(md.vertices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < md.vertices.size(); ++i) { -#if !GODOT4 w[i] = md.vertices[i].uv; -#else array.set(i, md.vertices[i].uv); -#endif } -#if !GODOT4 w.release(); -#endif - a[VisualServer::ARRAY_TEX_UV] = array; } if (md.indices.size() > 0) { PoolVector array; array.resize(md.indices.size()); -#if !GODOT4 PoolVector::Write w = array.write(); -#endif for (int i = 0; i < md.indices.size(); ++i) { -#if !GODOT4 w[i] = md.indices[i]; -#else - array.set(i, md.indices[i]); -#endif } -#if !GODOT4 w.release(); -#endif a[VisualServer::ARRAY_INDEX] = array; } @@ -935,15 +873,9 @@ Terrain2DMesher::~Terrain2DMesher() { } void Terrain2DMesher::_bind_methods() { -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_add_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); BIND_VMETHOD(MethodInfo("_bake_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); BIND_VMETHOD(MethodInfo("_bake_liquid_colors", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); -#else - GDVIRTUAL_BIND(_add_chunk, "chunk"); - GDVIRTUAL_BIND(_bake_colors, "chunk"); - GDVIRTUAL_BIND(_bake_liquid_colors, "chunk"); -#endif ClassDB::bind_method(D_METHOD("get_channel_index_type"), &Terrain2DMesher::get_channel_index_type); ClassDB::bind_method(D_METHOD("set_channel_index_type", "value"), &Terrain2DMesher::set_channel_index_type); @@ -997,11 +929,7 @@ void Terrain2DMesher::_bind_methods() { ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform_colored", "mesh", "transform", "colors", "uv_rect"), &Terrain2DMesher::add_mesh_data_resource_transform_colored, DEFVAL(Rect2(0, 0, 1, 1))); #endif -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_add_mesher", PropertyInfo(Variant::OBJECT, "mesher", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DMesher"))); -#else - GDVIRTUAL_BIND(_add_mesher, "mesher"); -#endif ClassDB::bind_method(D_METHOD("add_mesher", "mesher"), &Terrain2DMesher::add_mesher); ClassDB::bind_method(D_METHOD("_add_mesher", "mesher"), &Terrain2DMesher::_add_mesher); diff --git a/modules/terraman_2d/meshers/terrain_2d_mesher.h b/modules/terraman_2d/meshers/terrain_2d_mesher.h index 65f93d837..733bb9917 100644 --- a/modules/terraman_2d/meshers/terrain_2d_mesher.h +++ b/modules/terraman_2d/meshers/terrain_2d_mesher.h @@ -22,23 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/object/ref_counted.h" -#ifndef Reference -#define Reference RefCounted -#endif -#include "core/math/color.h" -#include "core/templates/vector.h" -#else #include "core/color.h" #include "core/reference.h" #include "core/vector.h" -#endif #include "../defines.h" @@ -190,13 +176,6 @@ public: void remove_index(const int idx); void add_indices(const int index); -#if VERSION_MAJOR >= 4 - GDVIRTUAL1(_add_chunk, Ref); - GDVIRTUAL1(_bake_colors, Ref); - GDVIRTUAL1(_bake_liquid_colors, Ref); - GDVIRTUAL1(_add_mesher, Ref); -#endif - Terrain2DMesher(const Ref &library); Terrain2DMesher(); ~Terrain2DMesher(); diff --git a/modules/terraman_2d/nodes/terrain_2d_light_node.h b/modules/terraman_2d/nodes/terrain_2d_light_node.h index 4839c5fa5..a4cb5511e 100644 --- a/modules/terraman_2d/nodes/terrain_2d_light_node.h +++ b/modules/terraman_2d/nodes/terrain_2d_light_node.h @@ -22,18 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR < 4 #include "scene/3d/spatial.h" -#else -#include "scene/3d/node_3d.h" - -#define Spatial Node3D -#endif #include "core/math/vector3.h" diff --git a/modules/terraman_2d/register_types.h b/modules/terraman_2d/register_types.h index 752eb74cb..86df1a2ae 100644 --- a/modules/terraman_2d/register_types.h +++ b/modules/terraman_2d/register_types.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - void register_terraman_2d_types(); void unregister_terraman_2d_types(); diff --git a/modules/terraman_2d/world/block_terrain_2d_structure.cpp b/modules/terraman_2d/world/block_terrain_2d_structure.cpp index 7daecfc58..e8c2e47d6 100644 --- a/modules/terraman_2d/world/block_terrain_2d_structure.cpp +++ b/modules/terraman_2d/world/block_terrain_2d_structure.cpp @@ -43,7 +43,6 @@ int BlockTerrain2DStructure::get_voxel_type(int p_x, int p_y) const { return 0; } - void BlockTerrain2DStructure::set_voxel(int p_x, int p_y, int p_type, int p_isolevel) { DataEntry p; p.x = p_x; diff --git a/modules/terraman_2d/world/block_terrain_2d_structure.h b/modules/terraman_2d/world/block_terrain_2d_structure.h index dd54faf36..75e63d70a 100644 --- a/modules/terraman_2d/world/block_terrain_2d_structure.h +++ b/modules/terraman_2d/world/block_terrain_2d_structure.h @@ -22,16 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/templates/vector.h" -#else #include "core/vector.h" -#endif #include "terrain_2d_structure.h" diff --git a/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp b/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp index bcd73fbd8..a59f6ae73 100644 --- a/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp +++ b/modules/terraman_2d/world/default/terrain_2d_chunk_default.cpp @@ -38,9 +38,9 @@ SOFTWARE. #include "../jobs/terrain_2d_light_job.h" #include "../jobs/terrain_2d_prop_job.h" #include "../jobs/terrain_2d_terrain_job.h" -#include "servers/physics_2d_server.h" #include "scene/resources/world.h" #include "scene/resources/world_2d.h" +#include "servers/physics_2d_server.h" const String Terrain2DChunkDefault::BINDING_STRING_BUILD_FLAGS = "Use Lighting,Use AO,Use RAO,Generate AO,Generate RAO,Bake Lights,Create Collider"; @@ -85,13 +85,8 @@ RID Terrain2DChunkDefault::mesh_rid_get(const int mesh_index, const int mesh_typ Variant v = m[mesh_type_index]; -#if VERSION_MAJOR > 3 - if (v.get_type() != Variant::RID) - return RID(); -#else if (v.get_type() != Variant::_RID) return RID(); -#endif return v; } @@ -109,11 +104,7 @@ void Terrain2DChunkDefault::mesh_rid_set(const int mesh_index, const int mesh_ty Variant v = m[mesh_type_index]; -#if VERSION_MAJOR > 3 - ERR_FAIL_COND(v.get_type() != Variant::RID); -#else ERR_FAIL_COND(v.get_type() != Variant::_RID); -#endif m[mesh_type_index] = value; _rids[mesh_index] = m; diff --git a/modules/terraman_2d/world/default/terrain_2d_chunk_default.h b/modules/terraman_2d/world/default/terrain_2d_chunk_default.h index 5c7779071..c49ae5547 100644 --- a/modules/terraman_2d/world/default/terrain_2d_chunk_default.h +++ b/modules/terraman_2d/world/default/terrain_2d_chunk_default.h @@ -22,20 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/config/engine.h" -#include "core/string/ustring.h" -#include "core/variant/array.h" -#else #include "core/array.h" #include "core/engine.h" #include "core/ustring.h" -#endif #include "../terrain_2d_chunk.h" diff --git a/modules/terraman_2d/world/default/terrain_2d_world_default.h b/modules/terraman_2d/world/default/terrain_2d_world_default.h index b70572e34..9b7f4d6df 100644 --- a/modules/terraman_2d/world/default/terrain_2d_world_default.h +++ b/modules/terraman_2d/world/default/terrain_2d_world_default.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "../terrain_2d_world.h" class Terrain2DWorldDefault : public Terrain2DWorld { diff --git a/modules/terraman_2d/world/isometric/terrain_2d_chunk_isometric.h b/modules/terraman_2d/world/isometric/terrain_2d_chunk_isometric.h index c5bc4187a..41a5f3b4f 100644 --- a/modules/terraman_2d/world/isometric/terrain_2d_chunk_isometric.h +++ b/modules/terraman_2d/world/isometric/terrain_2d_chunk_isometric.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "../default/terrain_2d_chunk_default.h" class Terrain2DChunkIsometric : public Terrain2DChunkDefault { diff --git a/modules/terraman_2d/world/isometric/terrain_2d_world_isometric.h b/modules/terraman_2d/world/isometric/terrain_2d_world_isometric.h index 92a981c47..b87390894 100644 --- a/modules/terraman_2d/world/isometric/terrain_2d_world_isometric.h +++ b/modules/terraman_2d/world/isometric/terrain_2d_world_isometric.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "../default/terrain_2d_world_default.h" class Terrain2DWorldIsometric : public Terrain2DWorldDefault { diff --git a/modules/terraman_2d/world/jobs/terrain_2d_job.cpp b/modules/terraman_2d/world/jobs/terrain_2d_job.cpp index 5e1d2f906..1c02b48f6 100644 --- a/modules/terraman_2d/world/jobs/terrain_2d_job.cpp +++ b/modules/terraman_2d/world/jobs/terrain_2d_job.cpp @@ -72,7 +72,6 @@ void Terrain2DJob::_reset() { } void Terrain2DJob::_execute() { - ActiveBuildPhaseType origpt = _build_phase_type; while (!get_cancelled() && _in_tree && !_build_done && origpt == _build_phase_type && !should_return()) { @@ -259,7 +258,6 @@ Array Terrain2DJob::bake_mesh_array_uv(Array arr, Ref tex, const float } void Terrain2DJob::chunk_exit_tree() { - _in_tree = false; if (get_complete()) { diff --git a/modules/terraman_2d/world/jobs/terrain_2d_job.h b/modules/terraman_2d/world/jobs/terrain_2d_job.h index aaf1bfe80..0b769cdb5 100644 --- a/modules/terraman_2d/world/jobs/terrain_2d_job.h +++ b/modules/terraman_2d/world/jobs/terrain_2d_job.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "scene/resources/texture.h" #if THREAD_POOL_PRESENT @@ -32,21 +29,12 @@ SOFTWARE. #else #include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/object/reference.h" -#else #include "core/reference.h" -#endif #endif #include "../../defines.h" -#if GODOT4 -#define Texture Texture2D -#endif - class Terrain2DChunk; #if THREAD_POOL_PRESENT diff --git a/modules/terraman_2d/world/jobs/terrain_2d_light_job.h b/modules/terraman_2d/world/jobs/terrain_2d_light_job.h index c3348dbf0..8aa4d171a 100644 --- a/modules/terraman_2d/world/jobs/terrain_2d_light_job.h +++ b/modules/terraman_2d/world/jobs/terrain_2d_light_job.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_2d_job.h" class Terrain2DMesher; diff --git a/modules/terraman_2d/world/jobs/terrain_2d_prop_job.h b/modules/terraman_2d/world/jobs/terrain_2d_prop_job.h index c1218345d..bded659ce 100644 --- a/modules/terraman_2d/world/jobs/terrain_2d_prop_job.h +++ b/modules/terraman_2d/world/jobs/terrain_2d_prop_job.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_2d_job.h" class Terrain2DMesher; diff --git a/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.h b/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.h index 436938794..9e17bb88f 100644 --- a/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.h +++ b/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "terrain_2d_job.h" #include "../../defines.h" diff --git a/modules/terraman_2d/world/simple/terrain_2d_chunk_simple.h b/modules/terraman_2d/world/simple/terrain_2d_chunk_simple.h index 60ac81861..2d0e615dd 100644 --- a/modules/terraman_2d/world/simple/terrain_2d_chunk_simple.h +++ b/modules/terraman_2d/world/simple/terrain_2d_chunk_simple.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "../default/terrain_2d_chunk_default.h" class Terrain2DChunkSimple : public Terrain2DChunkDefault { diff --git a/modules/terraman_2d/world/simple/terrain_2d_world_simple.h b/modules/terraman_2d/world/simple/terrain_2d_world_simple.h index 80d9315b6..63a404dd2 100644 --- a/modules/terraman_2d/world/simple/terrain_2d_world_simple.h +++ b/modules/terraman_2d/world/simple/terrain_2d_world_simple.h @@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - #include "../default/terrain_2d_world_default.h" class Terrain2DWorldSimple : public Terrain2DWorldDefault { diff --git a/modules/terraman_2d/world/terrain_2d_chunk.h b/modules/terraman_2d/world/terrain_2d_chunk.h index 818a52665..7645be6e6 100644 --- a/modules/terraman_2d/world/terrain_2d_chunk.h +++ b/modules/terraman_2d/world/terrain_2d_chunk.h @@ -22,22 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/config/engine.h" -#include "core/io/resource.h" -#include "core/string/ustring.h" -#include "core/variant/array.h" -#else #include "core/array.h" #include "core/engine.h" #include "core/resource.h" #include "core/ustring.h" -#endif #include "../defines.h" @@ -60,12 +48,6 @@ include_pool_vector #include "../../props_2d/props/prop_2d_data.h" #endif -#include "core/version.h" - -#if VERSION_MAJOR >= 4 -#define Texture Texture2D -#endif - #include "scene/resources/shape_2d.h" #include "../library/terrain_2d_library.h" diff --git a/modules/terraman_2d/world/terrain_2d_environment_data.cpp b/modules/terraman_2d/world/terrain_2d_environment_data.cpp index 00514f1d1..241c88f92 100644 --- a/modules/terraman_2d/world/terrain_2d_environment_data.cpp +++ b/modules/terraman_2d/world/terrain_2d_environment_data.cpp @@ -87,11 +87,7 @@ Terrain2DEnvironmentData::~Terrain2DEnvironmentData() { } void Terrain2DEnvironmentData::_bind_methods() { -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_setup", PropertyInfo(Variant::OBJECT, "world_environment", PROPERTY_HINT_RESOURCE_TYPE, "WorldEnvironment"), PropertyInfo(Variant::OBJECT, "primary_light", PROPERTY_HINT_RESOURCE_TYPE, "DirectionalLight"), PropertyInfo(Variant::OBJECT, "secondary_light", PROPERTY_HINT_RESOURCE_TYPE, "DirectionalLight"))); -#else - GDVIRTUAL_BIND(_setup, "world_environment", "primary_light", "secondary_light"); -#endif ClassDB::bind_method(D_METHOD("get_environment"), &Terrain2DEnvironmentData::get_environment); ClassDB::bind_method(D_METHOD("set_environment", "value"), &Terrain2DEnvironmentData::set_environment); diff --git a/modules/terraman_2d/world/terrain_2d_environment_data.h b/modules/terraman_2d/world/terrain_2d_environment_data.h index 49fce24aa..e7e413eb2 100644 --- a/modules/terraman_2d/world/terrain_2d_environment_data.h +++ b/modules/terraman_2d/world/terrain_2d_environment_data.h @@ -22,18 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/math/color.h" -#else #include "core/color.h" #include "core/resource.h" -#endif #include "../defines.h" @@ -59,10 +49,6 @@ public: void setup(WorldEnvironment *world_environment, DirectionalLight *primary_light, DirectionalLight *secondary_light); void setup_bind(Node *world_environment, Node *primary_light, Node *secondary_light); -#if VERSION_MAJOR >= 4 - GDVIRTUAL3(_setup, WorldEnvironment *, DirectionalLight *, DirectionalLight *); -#endif - Terrain2DEnvironmentData(); ~Terrain2DEnvironmentData(); diff --git a/modules/terraman_2d/world/terrain_2d_structure.cpp b/modules/terraman_2d/world/terrain_2d_structure.cpp index 97ab7c5ca..df99b90a4 100644 --- a/modules/terraman_2d/world/terrain_2d_structure.cpp +++ b/modules/terraman_2d/world/terrain_2d_structure.cpp @@ -73,11 +73,7 @@ Terrain2DStructure::~Terrain2DStructure() { } void Terrain2DStructure::_bind_methods() { -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_write_to_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); -#else - GDVIRTUAL_BIND(_write_to_chunk, "chunk"); -#endif ClassDB::bind_method(D_METHOD("get_use_rect"), &Terrain2DStructure::get_use_rect); ClassDB::bind_method(D_METHOD("set_use_rect", "value"), &Terrain2DStructure::set_use_rect); diff --git a/modules/terraman_2d/world/terrain_2d_structure.h b/modules/terraman_2d/world/terrain_2d_structure.h index 3f95bf6e3..af0315dd3 100644 --- a/modules/terraman_2d/world/terrain_2d_structure.h +++ b/modules/terraman_2d/world/terrain_2d_structure.h @@ -22,18 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/io/resource.h" -#include "core/templates/hash_map.h" -#else #include "core/hash_map.h" #include "core/resource.h" -#endif #include "../defines.h" @@ -62,10 +52,6 @@ public: void write_to_chunk(Ref chunk); -#if VERSION_MAJOR >= 4 - GDVIRTUAL1(_write_to_chunk, Ref); -#endif - Terrain2DStructure(); ~Terrain2DStructure(); diff --git a/modules/terraman_2d/world/terrain_2d_world.cpp b/modules/terraman_2d/world/terrain_2d_world.cpp index 7da92496e..4bf5710af 100644 --- a/modules/terraman_2d/world/terrain_2d_world.cpp +++ b/modules/terraman_2d/world/terrain_2d_world.cpp @@ -22,8 +22,6 @@ SOFTWARE. #include "terrain_2d_world.h" -#include "core/version.h" - #include "core/message_queue.h" #include "terrain_2d_chunk.h" #include "terrain_2d_structure.h" @@ -449,12 +447,7 @@ Ref Terrain2DWorld::chunk_create(const int x, const int z) { void Terrain2DWorld::chunk_setup(Ref chunk) { ERR_FAIL_COND(!chunk.is_valid()); -#if VERSION_MAJOR < 4 call("_create_chunk", chunk->get_position_x(), chunk->get_position_y(), chunk); -#else - Ref c; - GDVIRTUAL_CALL(_create_chunk, chunk->get_position_x(), chunk->get_position_y(), chunk, c); -#endif } Ref Terrain2DWorld::_create_chunk(const int x, const int y, Ref chunk) { @@ -1039,11 +1032,7 @@ void Terrain2DWorld::_notification(int p_what) { } } -#if VERSION_MAJOR > 3 - if (_is_priority_generation && _generation_queue.is_empty() && _generating.is_empty()) { -#else if (_is_priority_generation && _generation_queue.empty() && _generating.empty()) { -#endif _is_priority_generation = false; CALL(_generation_finished); @@ -1249,11 +1238,7 @@ void Terrain2DWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("voxel_structures_set"), &Terrain2DWorld::voxel_structures_set); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_structures", PROPERTY_HINT_NONE, "17/17:Terrain2DStructure", PROPERTY_USAGE_DEFAULT, "Terrain2DStructure"), "voxel_structures_set", "voxel_structures_get"); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_chunk_added", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); -#else - GDVIRTUAL_BIND(_chunk_added, "chunk"); -#endif ClassDB::bind_method(D_METHOD("chunk_add", "chunk", "x", "y"), &Terrain2DWorld::chunk_add); ClassDB::bind_method(D_METHOD("chunk_has", "x", "y"), &Terrain2DWorld::chunk_has); @@ -1282,18 +1267,11 @@ void Terrain2DWorld::_bind_methods() { ADD_SIGNAL(MethodInfo("generation_finished")); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_generation_finished")); BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::OBJECT, "ret", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"), "_create_chunk", PropertyInfo(Variant::INT, "x"), PropertyInfo(Variant::INT, "y"), PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); BIND_VMETHOD(MethodInfo("_prepare_chunk_for_generation", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); BIND_VMETHOD(MethodInfo("_generate_chunk", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DChunk"))); -#else - GDVIRTUAL_BIND(_generation_finished); - GDVIRTUAL_BIND(_create_chunk, "chunk", "x", "y", "chunk", "ret"); - GDVIRTUAL_BIND(_prepare_chunk_for_generation, "chunk"); - GDVIRTUAL_BIND(_generate_chunk, "chunk"); -#endif ClassDB::bind_method(D_METHOD("chunk_get_or_create", "x", "y"), &Terrain2DWorld::chunk_get_or_create); ClassDB::bind_method(D_METHOD("chunk_create", "x", "y"), &Terrain2DWorld::chunk_create); @@ -1325,24 +1303,16 @@ void Terrain2DWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("get_chunk_at_world_position", "world_position"), &Terrain2DWorld::get_chunk_at_world_position); ClassDB::bind_method(D_METHOD("get_or_create_chunk_at_world_position", "world_position"), &Terrain2DWorld::get_or_create_chunk_at_world_position); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::INT, "ret"), "_get_channel_index_info", PropertyInfo(Variant::INT, "channel_type", PROPERTY_HINT_ENUM, BINDING_STRING_CHANNEL_TYPE_INFO))); -#else - GDVIRTUAL_BIND(_get_channel_index_info, "channel_type", "ret"); -#endif ClassDB::bind_method(D_METHOD("get_channel_index_info", "channel_type"), &Terrain2DWorld::get_channel_index_info); ClassDB::bind_method(D_METHOD("_get_channel_index_info", "channel_type"), &Terrain2DWorld::_get_channel_index_info); -#if VERSION_MAJOR < 4 BIND_VMETHOD(MethodInfo("_set_voxel_with_tool", PropertyInfo(Variant::BOOL, "mode_add"), PropertyInfo(Variant::VECTOR2, "hit_position"), PropertyInfo(Variant::INT, "selected_voxel"), PropertyInfo(Variant::INT, "isolevel"))); -#else - GDVIRTUAL_BIND(_set_voxel_with_tool, "mode_add", "hit_position", "selected_voxel", "isolevel"); -#endif ClassDB::bind_method(D_METHOD("set_voxel_with_tool", "mode_add", "hit_position", "selected_voxel", "isolevel"), &Terrain2DWorld::set_voxel_with_tool); ClassDB::bind_method(D_METHOD("_set_voxel_with_tool", "mode_add", "hit_position", "selected_voxel", "isolevel"), &Terrain2DWorld::_set_voxel_with_tool); diff --git a/modules/terraman_2d/world/terrain_2d_world.h b/modules/terraman_2d/world/terrain_2d_world.h index e17bf20e6..601d0a334 100644 --- a/modules/terraman_2d/world/terrain_2d_world.h +++ b/modules/terraman_2d/world/terrain_2d_world.h @@ -22,18 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - - -#include "core/version.h" - -#if VERSION_MAJOR > 3 -#include "core/config/engine.h" -#include "core/templates/hash_map.h" -#else #include "core/engine.h" #include "core/hash_map.h" -#endif #include "../defines.h" @@ -209,20 +199,6 @@ public: int get_channel_index_info(const ChannelTypeInfo channel_type); -#if VERSION_MAJOR >= 4 - GDVIRTUAL1(_chunk_added, Ref); - - GDVIRTUAL0(_generation_finished); - - GDVIRTUAL3R(Ref, _create_chunk, int, int, Ref); - GDVIRTUAL1(_prepare_chunk_for_generation, Ref); - GDVIRTUAL1(_generate_chunk, Ref); - - GDVIRTUAL1R(int, _get_channel_index_info, int); - - GDVIRTUAL5(_set_voxel_with_tool, bool, Vector3, Vector3, int, int); -#endif - Terrain2DWorld(); ~Terrain2DWorld(); diff --git a/modules/terraman_2d/world/terrain_2d_world_editor.cpp b/modules/terraman_2d/world/terrain_2d_world_editor.cpp index aa76c13b6..01c475595 100644 --- a/modules/terraman_2d/world/terrain_2d_world_editor.cpp +++ b/modules/terraman_2d/world/terrain_2d_world_editor.cpp @@ -33,8 +33,8 @@ SOFTWARE. #include "terrain_2d_chunk.h" -#include "../library/terrain_2d_surface.h" #include "../library/terrain_2d_library.h" +#include "../library/terrain_2d_surface.h" #include "../defines.h" @@ -42,7 +42,6 @@ SOFTWARE. #include spatial_editor_plugin_h #include camera_h -#if VERSION_MAJOR < 4 bool Terrain2DWorldEditor::forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { if (!_world || !_world->get_editable()) { return false; @@ -69,39 +68,6 @@ bool Terrain2DWorldEditor::forward_spatial_input_event(Camera *p_camera, const R return false; } -#else -EditorPlugin::AfterGUIInput Terrain2DWorldEditor::forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { - if (!_world || !_world->get_editable()) { - return EditorPlugin::AFTER_GUI_INPUT_PASS; - } - - Ref mb = p_event; - - if (mb.is_valid()) { - if (mb->is_pressed()) { - Ref lib = _world->get_library(); - - if (!lib.is_valid()) - return EditorPlugin::AFTER_GUI_INPUT_PASS; - - if (mb->get_button_index() == MouseButton::LEFT) { - if (do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true)) { - return EditorPlugin::AFTER_GUI_INPUT_STOP; - } else { - return EditorPlugin::AFTER_GUI_INPUT_PASS; - } - } else { - return EditorPlugin::AFTER_GUI_INPUT_PASS; - } - - //return do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true); - } - } - - return EditorPlugin::AFTER_GUI_INPUT_PASS; -} - -#endif bool Terrain2DWorldEditor::do_input_action(Camera *p_camera, const Point2 &p_point, bool p_click) { /* @@ -343,14 +309,14 @@ void Terrain2DWorldEditor::_on_insert_block_at_camera_button_pressed() { Vector3 pos = cam->get_transform().origin; selected_voxel = _selected_type + 1; */ -/* - if (_channel_isolevel == -1) { - _world->set_voxel_at_world_position(pos, selected_voxel, channel); - } else { - _world->set_voxel_at_world_position(pos, selected_voxel, channel, false); - _world->set_voxel_at_world_position(pos, _current_isolevel, _channel_isolevel); - } - */ + /* + if (_channel_isolevel == -1) { + _world->set_voxel_at_world_position(pos, selected_voxel, channel); + } else { + _world->set_voxel_at_world_position(pos, selected_voxel, channel, false); + _world->set_voxel_at_world_position(pos, _current_isolevel, _channel_isolevel); + } + */ } void Terrain2DWorldEditor::_on_isolevel_slider_value_changed(float value) { @@ -368,21 +334,12 @@ void Terrain2DWorldEditor::_bind_methods() { void Terrain2DWorldEditorPlugin::_notification(int p_what) { if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { switch ((int)EditorSettings::get_singleton()->get("editors/voxelman/editor_side")) { -#if VERSION_MAJOR <= 3 && VERSION_MINOR < 5 - case 0: { // Left. - SpatialEditor::get_singleton()->get_palette_split()->move_child(voxel_world_editor, 0); - } break; - case 1: { // Right. - SpatialEditor::get_singleton()->get_palette_split()->move_child(voxel_world_editor, 1); - } break; -#else case 0: { // Left. SpatialEditor::get_singleton()->move_control_to_left_panel(voxel_world_editor); } break; case 1: { // Right. SpatialEditor::get_singleton()->move_control_to_right_panel(voxel_world_editor); } break; -#endif } } } diff --git a/modules/terraman_2d/world/terrain_2d_world_editor.h b/modules/terraman_2d/world/terrain_2d_world_editor.h index 8473fa939..be1e2a0e5 100644 --- a/modules/terraman_2d/world/terrain_2d_world_editor.h +++ b/modules/terraman_2d/world/terrain_2d_world_editor.h @@ -30,11 +30,6 @@ SOFTWARE. #include "../defines.h" -#if VERSION_MAJOR > 3 -#include "core/math/transform_3d.h" -typedef class Transform3D Transform; -#endif - class Terrain2DWorld; class SpatialEditorPlugin; @@ -48,11 +43,7 @@ public: }; public: -#if VERSION_MAJOR < 4 bool forward_spatial_input_event(Camera *p_camera, const Ref &p_event); -#else - EditorPlugin::AfterGUIInput forward_spatial_input_event(Camera *p_camera, const Ref &p_event); -#endif void edit(Terrain2DWorld *p_world); bool do_input_action(Camera *p_camera, const Point2 &p_point, bool p_click); @@ -102,13 +93,8 @@ protected: void _notification(int p_what); public: -#if VERSION_MAJOR < 4 bool forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { return voxel_world_editor->forward_spatial_input_event(p_camera, p_event); } virtual bool forward_spatial_gui_input(int p_index, Camera *p_camera, const Ref &p_event) { return voxel_world_editor->forward_spatial_input_event(p_camera, p_event); } -#else - EditorPlugin::AfterGUIInput forward_spatial_input_event(Camera *p_camera, const Ref &p_event) { return voxel_world_editor->forward_spatial_input_event(p_camera, p_event); } - virtual EditorPlugin::AfterGUIInput forward_spatial_gui_input(int p_index, Camera *p_camera, const Ref &p_event) { return voxel_world_editor->forward_spatial_input_event(p_camera, p_event); } -#endif virtual String get_name() const { return "Terrain2DWorldEditor"; } bool has_main_screen() const { return false; } virtual void edit(Object *p_object);