Cleaned up props_2d's version checks.

This commit is contained in:
Relintai 2022-03-18 02:55:27 +01:00
parent 3039645b4a
commit 441f7a3694
41 changed files with 31 additions and 469 deletions

View File

@ -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
#ifdef TEXTURE_PACKER_PRESENT
#include "../../texture_packer/texture_packer.h"

View File

@ -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 "ground_clutter_2d.h"
@ -53,7 +44,7 @@ private:
static void _bind_methods();
private:
Vector<Ref<Texture> > _textures;
Vector<Ref<Texture>> _textures;
};
#endif

View File

@ -26,21 +26,11 @@ SOFTWARE.
#include "../singleton/prop_2d_utils.h"
#include "core/os/keyboard.h"
#include "core/version.h"
#if VERSION_MAJOR < 4
#include "core/os/input.h"
#define CONNECT(sig, obj, target_method_class, method) connect(sig, obj, #method)
#define DISCONNECT(sig, obj, target_method_class, method) disconnect(sig, obj, #method)
#else
#include "core/input/input.h"
#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))
#endif
void Prop2DEditorPlugin::convert_active_scene_to_prop_data() {
SceneTree *st = SceneTree::get_singleton();
@ -109,14 +99,9 @@ void Prop2DEditorPlugin::_convert_selected_scene_to_prop_data(Variant param) {
Prop2DEditorPlugin::Prop2DEditorPlugin(EditorNode *p_node) {
editor = p_node;
#if VERSION_MAJOR < 4
editor->add_tool_menu_item("Convert active scene to Prop2DData", this, "convert_active_scene_to_prop_data");
editor->add_tool_menu_item("Convert selected scene(s) to Prop2DData", this, "convert_selected_scene_to_prop_data");
#if VERSION_MINOR >= 4
editor->add_tool_menu_item("(Prop2D) Find room points.", this, "find_room_points");
#endif
#else
#endif
Button *b = memnew(Button);

View File

@ -22,16 +22,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "core/version.h"
class Prop2DEditorPlugin : public EditorPlugin {
GDCLASS(Prop2DEditorPlugin, EditorPlugin);
EditorNode *editor;

View File

@ -22,23 +22,13 @@ 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
#include "../../thread_pool/thread_pool_job.h"
#endif
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/object/reference.h"
#define Texture Texture2D
#else
#include "core/reference.h"
#endif
#if TEXTURE_PACKER_PRESENT
class TexturePacker;

View File

@ -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/object/reference.h"
#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 Prop2DLight : public Reference {
GDCLASS(Prop2DLight, Reference);

View File

@ -35,17 +35,6 @@ SOFTWARE.
#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h"
#endif
#if VERSION_MAJOR > 3
#define VARIANT_ARRAY_GET(arr) \
Vector<Variant> r; \
for (int i = 0; i < arr.size(); i++) { \
r.push_back(arr[i]); \
} \
return r;
#else
#define VARIANT_ARRAY_GET(arr) \
Vector<Variant> r; \
for (int i = 0; i < arr.size(); i++) { \
@ -53,8 +42,6 @@ SOFTWARE.
} \
return r;
#endif
bool Prop2DMaterialCache::get_initialized() {
return _initialized;
}

View File

@ -22,24 +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/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"
#include "core/os/mutex.h"
#include "scene/resources/material.h"
class Prop2DData;

View File

@ -158,11 +158,7 @@ void Prop2DMaterialCachePCM::_setup_material_albedo(Ref<Texture> texture) {
Prop2DMaterialCachePCM::Prop2DMaterialCachePCM() {
_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);

View File

@ -22,22 +22,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "prop_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"

View File

@ -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"

View File

@ -2,15 +2,7 @@
#include "../mesh_data_resource/nodes/mesh_data_instance.h"
#include "core/version.h"
#if VERSION_MAJOR < 4
#include "scene/3d/light.h"
#else
#include "scene/3d/light_3d.h"
#define OmniLight OmniLight3D
#define Light Light3D
#endif
#if MESH_DATA_RESOURCE_PRESENT
//define PROPS_PRESENT, so things compile. That module's scsub will define this too while compiling,

View File

@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "core/version.h"
#include "scene/2d/node_2d.h"

View File

@ -22,23 +22,13 @@ 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
#include "../thread_pool/thread_pool_job.h"
#else
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/object/reference.h"
#define Texture Texture2D
#else
#include "core/reference.h"
#endif
#endif

View File

@ -5,22 +5,7 @@
//#include "../thread_pool/thread_pool.h"
#include "servers/physics_server.h"
#include "scene/resources/world_2d.h"
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/config/engine.h"
#define VARIANT_ARRAY_GET(arr) \
Vector<Variant> r; \
for (int i = 0; i < arr.size(); i++) { \
r.push_back(arr[i]); \
} \
return r;
#include "servers/rendering_server.h"
typedef class RenderingServer VS;
#else
#include "core/engine.h"
#define VARIANT_ARRAY_GET(arr) \
@ -32,8 +17,6 @@ typedef class RenderingServer VS;
#include "servers/visual_server.h"
#endif
#if MESH_DATA_RESOURCE_PRESENT
//define PROPS_PRESENT, so things compile. That module's scsub will define this too while compiling,
//but not when included from here.

View File

@ -22,13 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "prop_2d_instance.h"
#include "core/version.h"
#include "scene/2d/node_2d.h"
#include "scene/resources/shape_2d.h"

View File

@ -22,8 +22,6 @@ SOFTWARE.
#include "prop_2d_instance_prop_job.h"
#include "core/version.h"
#include "lights/prop_2d_light.h"
#include "material_cache/prop_2d_material_cache.h"
#include "prop_2d_instance.h"
@ -188,35 +186,35 @@ void Prop2DInstanceProp2DJob::phase_physics_process() {
_prop_instace->free_colliders();
_prop_instace->colliders_clear();
/*
for (int i = 0; i < _collision_shapes.size(); ++i) {
CollisionShapeEntry &e = _collision_shapes.write[i];
/*
for (int i = 0; i < _collision_shapes.size(); ++i) {
CollisionShapeEntry &e = _collision_shapes.write[i];
if (!e.shape.is_valid()) {
continue;
}
RID body = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC);
PhysicsServer::get_singleton()->body_add_shape(body, e.shape->get_rid());
//TODO store the layer mask somewhere
PhysicsServer::get_singleton()->body_set_collision_layer(body, _prop_instace->get_collision_layer());
PhysicsServer::get_singleton()->body_set_collision_mask(body, _prop_instace->get_collision_mask());
if (_prop_instace->is_inside_tree() && _prop_instace->is_inside_world()) {
Ref<World2D> world = _prop_instace->get_world_2d();
if (world.is_valid() && world->get_space() != RID()) {
PhysicsServer::get_singleton()->body_set_space(body, world->get_space());
if (!e.shape.is_valid()) {
continue;
}
RID body = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC);
PhysicsServer::get_singleton()->body_add_shape(body, e.shape->get_rid());
//TODO store the layer mask somewhere
PhysicsServer::get_singleton()->body_set_collision_layer(body, _prop_instace->get_collision_layer());
PhysicsServer::get_singleton()->body_set_collision_mask(body, _prop_instace->get_collision_mask());
if (_prop_instace->is_inside_tree() && _prop_instace->is_inside_world()) {
Ref<World2D> world = _prop_instace->get_world_2d();
if (world.is_valid() && world->get_space() != RID()) {
PhysicsServer::get_singleton()->body_set_space(body, world->get_space());
}
}
//PhysicsServer::get_singleton()->body_set_state(body, PhysicsServer::BODY_STATE_TRANSFORM, e.transform);
_prop_instace->collider_add(e.transform, e.shape, e.shape->get_rid(), body, e.owns_shape);
}
//PhysicsServer::get_singleton()->body_set_state(body, PhysicsServer::BODY_STATE_TRANSFORM, e.transform);
_prop_instace->collider_add(e.transform, e.shape, e.shape->get_rid(), body, e.owns_shape);
}
*/
*/
#if TOOLS_ENABLED
/*
@ -355,11 +353,7 @@ void Prop2DInstanceProp2DJob::phase_steps() {
RID mesh_rid = _prop_instace->mesh_get(i);
if (VS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0)
#if !GODOT4
VS::get_singleton()->mesh_remove_surface(mesh_rid, 0);
#else
VS::get_singleton()->mesh_clear(mesh_rid);
#endif
}
}
}
@ -468,9 +462,7 @@ Array Prop2DInstanceProp2DJob::bake_mesh_array_uv(Array arr, Ref<Texture> tex, c
if (colors.size() < uvs.size())
colors.resize(uvs.size());
#if !GODOT4
img->lock();
#endif
for (int i = 0; i < uvs.size(); ++i) {
Vector2 uv = uvs[i];
@ -484,9 +476,7 @@ Array Prop2DInstanceProp2DJob::bake_mesh_array_uv(Array arr, Ref<Texture> tex, c
colors.set(i, colors[i] * c * mul_color);
}
#if !GODOT4
img->unlock();
#endif
arr[VisualServer::ARRAY_COLOR] = colors;
@ -506,11 +496,7 @@ void Prop2DInstanceProp2DJob::reset_meshes() {
RID mesh_rid = _prop_instace->mesh_get(i);
if (VS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0)
#if !GODOT4
VS::get_singleton()->mesh_remove_surface(mesh_rid, 0);
#else
VS::get_singleton()->mesh_clear(mesh_rid);
#endif
}
}
}

View File

@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "prop_2d_instance_job.h"
#include "scene/resources/shape_2d.h"

View File

@ -147,21 +147,13 @@ Array Prop2DMesher::build_mesh() {
{
PoolVector<Vector2> array;
array.resize(_vertices.size());
#if !GODOT4
PoolVector<Vector2>::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;
}
@ -169,42 +161,26 @@ Array Prop2DMesher::build_mesh() {
if ((_format & VisualServer::ARRAY_FORMAT_COLOR) != 0) {
PoolVector<Color> array;
array.resize(_vertices.size());
#if !GODOT4
PoolVector<Color>::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<Vector2> array;
array.resize(_vertices.size());
#if !GODOT4
PoolVector<Vector2>::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;
}
@ -212,21 +188,13 @@ Array Prop2DMesher::build_mesh() {
if (_indices.size() > 0) {
PoolVector<int> array;
array.resize(_indices.size());
#if !GODOT4
PoolVector<int>::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;
}

View File

@ -22,30 +22,11 @@ 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"
#include "core/object/reference.h"
#include "core/templates/vector.h"
template <class N>
class Vector;
template <class N>
using PoolVector = Vector<N>;
#include "scene/3d/mesh_instance_3d.h"
#else
#include "core/color.h"
#include "core/pool_vector.h"
#include "core/reference.h"
#include "core/vector.h"
#include "scene/3d/mesh_instance.h"
#endif
#include "core/math/rect2.h"
#include "core/math/vector2.h"

View File

@ -1,12 +1,6 @@
#include "prop_2d_scene_instance.h"
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/config/engine.h"
#else
#include "core/engine.h"
#endif
Ref<PackedScene> Prop2DSceneInstance::get_scene() {
return _scene;

View File

@ -22,11 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "core/version.h"
#include "scene/2d/node_2d.h"
#include "props/prop_2d_data.h"

View File

@ -26,13 +26,7 @@ SOFTWARE.
#include "prop_2d_data_light.h"
#include "prop_2d_data_prop.h"
#if VERSION_MAJOR < 4
#include "servers/physics_server.h"
#else
#include "servers/physics_server_3d.h"
#define Shape Shape3D
#endif
int Prop2DData::get_id() const {
return _id;
@ -41,7 +35,6 @@ void Prop2DData::set_id(const int value) {
_id = value;
}
Ref<Prop2DDataEntry> Prop2DData::get_prop(const int index) const {
ERR_FAIL_INDEX_V(index, _props.size(), Ref<Prop2DDataEntry>());
@ -68,11 +61,7 @@ int Prop2DData::get_prop_count() const {
Vector<Variant> Prop2DData::get_props() {
Vector<Variant> r;
for (int i = 0; i < _props.size(); i++) {
#if VERSION_MAJOR < 4
r.push_back(_props[i].get_ref_ptr());
#else
r.push_back(_props[i]);
#endif
}
return r;
}

View File

@ -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/transform_3d.h"
#include "core/templates/vector.h"
#else
#include "core/math/transform.h"
#include "core/reference.h"
#include "core/vector.h"
#include "core/math/transform.h"
#endif
#include "core/math/rect2.h"
#include "core/math/vector2.h"

View File

@ -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/io/resource.h"
#include "core/math/transform_3d.h"
#ifndef Transform
#define Transform Transform3D
#endif
#else
#include "core/math/transform.h"
#include "core/math/transform_2d.h"
#include "core/resource.h"
#endif
#include "scene/resources/material.h"

View File

@ -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 "prop_2d_data_entry.h"

View File

@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "core/version.h"
#include "prop_2d_data_entry.h"

View File

@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "core/math/vector3.h"
#include "prop_2d_data_entry.h"

View File

@ -65,7 +65,6 @@ Node *Prop2DDataScene::_processor_get_node_for(const Transform2D &transform, Nod
i = Object::cast_to<Prop2DSceneInstance>(node);
}
i->set_scene(get_scene());
return Prop2DDataEntry::_processor_get_node_for(transform, i);

View File

@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "core/math/vector3.h"
#include "prop_2d_data_entry.h"

View File

@ -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 "scene/resources/texture.h"

View File

@ -22,13 +22,7 @@ SOFTWARE.
#include "register_types.h"
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/config/engine.h"
#else
#include "core/engine.h"
#endif
#include "tiled_wall/tiled_wall_2d.h"
#include "tiled_wall/tiled_wall_2d_data.h"
@ -41,9 +35,7 @@ SOFTWARE.
#include "props/prop_2d_data_sprite.h"
#include "props/prop_2d_data_tiled_wall_2d.h"
#if VERSION_MINOR >= 4
#include "props/prop_2d_data_portal.h"
#endif
#include "clutter/ground_clutter_2d.h"
#include "clutter/ground_clutter_2d_foliage.h"
@ -91,9 +83,7 @@ void register_props_2d_types() {
ClassDB::register_class<Prop2DDataTiledWall2D>();
ClassDB::register_class<Prop2DDataSprite>();
#if VERSION_MINOR >= 4
ClassDB::register_class<Prop2DDataPortal>();
#endif
ClassDB::register_class<GroundClutter2D>();
ClassDB::register_class<GroundClutter2DFoliage>();
@ -135,10 +125,8 @@ void register_props_2d_types() {
Ref<Prop2DDataScene> scene_processor = Ref<Prop2DDataScene>(memnew(Prop2DDataScene));
Prop2DUtils::add_processor(scene_processor);
#if VERSION_MINOR >= 4
Ref<Prop2DDataPortal> portal_processor = Ref<Prop2DDataPortal>(memnew(Prop2DDataPortal));
Prop2DUtils::add_processor(portal_processor);
#endif
Ref<Prop2DDataTiledWall2D> tiled_wall_processor = Ref<Prop2DDataTiledWall2D>(memnew(Prop2DDataTiledWall2D));
Prop2DUtils::add_processor(tiled_wall_processor);

View File

@ -22,9 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
void register_props_2d_types();
void unregister_props_2d_types();

View File

@ -25,15 +25,8 @@ SOFTWARE.
#include "../props/prop_2d_data.h"
#include "../props/prop_2d_data_entry.h"
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/config/engine.h"
#include "core/config/project_settings.h"
#else
#include "core/engine.h"
#include "core/project_settings.h"
#endif
#include "../jobs/prop_2d_texture_job.h"
@ -46,17 +39,6 @@ SOFTWARE.
#include "core/hashfuncs.h"
#if VERSION_MAJOR > 3
#define VARIANT_ARRAY_GET(arr) \
Vector<Variant> r; \
for (int i = 0; i < arr.size(); i++) { \
r.push_back(arr[i]); \
} \
return r;
#else
#define VARIANT_ARRAY_GET(arr) \
Vector<Variant> r; \
for (int i = 0; i < arr.size(); i++) { \
@ -64,8 +46,6 @@ SOFTWARE.
} \
return r;
#endif
Prop2DCache *Prop2DCache::_instance;
Prop2DCache *Prop2DCache::get_singleton() {
@ -323,7 +303,6 @@ void Prop2DCache::material_cache_custom_key_unref(const uint64_t key) {
Ref<Resource> Prop2DCache::load_resource(const String &path, const String &type_hint) {
_ResourceLoader *rl = _ResourceLoader::get_singleton();
#if VERSION_MAJOR < 4
Ref<ResourceInteractiveLoader> resl = rl->load_interactive(path, type_hint);
ERR_FAIL_COND_V(!resl.is_valid(), Ref<Resource>());
@ -331,9 +310,6 @@ Ref<Resource> Prop2DCache::load_resource(const String &path, const String &type_
resl->wait();
return resl->get_resource();
#else
return rl->load(path, type_hint);
#endif
}
Prop2DCache::Prop2DCache() {
@ -348,11 +324,7 @@ Prop2DCache::Prop2DCache() {
#endif
#ifdef TEXTURE_PACKER_PRESENT
#if VERSION_MAJOR < 4
_texture_flags = GLOBAL_DEF("props_2d/texture_flags", Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER);
#else
_texture_flags = GLOBAL_DEF("props_2d/texture_flags", 0);
#endif
_max_atlas_size = GLOBAL_DEF("props_2d/max_atlas_size", 1024);
_keep_original_atlases = GLOBAL_DEF("props_2d/keep_original_atlases", false);

View File

@ -22,26 +22,12 @@ 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/core_bind.h"
#include "core/math/color.h"
#include "core/object/object.h"
#include "core/object/reference.h"
#include "core/templates/hash_map.h"
#include "core/templates/vector.h"
#else
#include "core/bind/core_bind.h"
#include "core/color.h"
#include "core/hash_map.h"
#include "core/object.h"
#include "core/reference.h"
#include "core/vector.h"
#endif
#include "scene/resources/material.h"

View File

@ -25,14 +25,10 @@ SOFTWARE.
#include "../props/prop_2d_data.h"
#include "../props/prop_2d_data_entry.h"
#include "core/version.h"
#if VERSION_MINOR >= 4
#include "core/math/quick_hull.h"
#include "scene/3d/portal.h"
#include "scene/3d/room.h"
#include "scene/3d/room_manager.h"
#endif
#include "scene/3d/mesh_instance.h"
@ -40,25 +36,19 @@ SOFTWARE.
#include "../../mesh_data_resource/nodes/mesh_data_instance.h"
#endif
#if VERSION_MAJOR > 3
#include "core/config/engine.h"
#else
#include "core/engine.h"
#endif
#include "scene/2d/node_2d.h"
Prop2DUtils *Prop2DUtils::_instance;
Vector<Ref<Prop2DDataEntry> > Prop2DUtils::_processors;
Vector<Ref<Prop2DDataEntry>> Prop2DUtils::_processors;
Prop2DUtils *Prop2DUtils::get_singleton() {
return _instance;
}
Ref<Prop2DData> Prop2DUtils::convert_tree(Node *root) {
#if VERSION_MAJOR < 4
ERR_FAIL_COND_V(!ObjectDB::instance_validate(root), Ref<Prop2DData>());
#endif
Ref<Prop2DData> data;
data.instance();
@ -70,9 +60,7 @@ Ref<Prop2DData> Prop2DUtils::convert_tree(Node *root) {
}
void Prop2DUtils::_convert_tree(Ref<Prop2DData> prop_data, Node *node, const Transform2D &transform) {
#if VERSION_MAJOR < 4
ERR_FAIL_COND(!ObjectDB::instance_validate(node));
#endif
for (int i = 0; i < Prop2DUtils::_processors.size(); ++i) {
Ref<Prop2DDataEntry> proc = Prop2DUtils::_processors.get(i);
@ -109,7 +97,6 @@ void Prop2DUtils::_convert_tree(Ref<Prop2DData> prop_data, Node *node, const Tra
}
}
} else {
for (int i = 0; i < node->get_child_count(); ++i) {
Node *child = node->get_child(i);

View File

@ -22,31 +22,17 @@ 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/object.h"
#include "core/object/reference.h"
#include "core/templates/vector.h"
#include "scene/3d/node_3d.h"
#else
#include "core/object.h"
#include "core/reference.h"
#include "core/vector.h"
#include "scene/3d/spatial.h"
#endif
#include "scene/main/node.h"
class Prop2DData;
class Prop2DDataEntry;
#if VERSION_MINOR >= 4
class Room;
#endif
class Prop2DUtils : public Object {
GDCLASS(Prop2DUtils, Object);

View File

@ -1,18 +1,10 @@
#include "tiled_wall_2d.h"
#include "core/version.h"
#include "scene/resources/texture.h"
#if VERSION_MAJOR < 4
#include "core/image.h"
#define GET_WORLD get_world
#else
#include "core/io/image.h"
#define GET_WORLD get_world_3d
#endif
#if TEXTURE_PACKER_PRESENT
#include "../../texture_packer/texture_resource/packer_image_resource.h"
@ -240,11 +232,7 @@ void TiledWall2D::clear_mesh() {
if (_mesh_rid != RID()) {
if (VS::get_singleton()->mesh_get_surface_count(_mesh_rid) > 0)
#if VERSION_MAJOR < 4
VS::get_singleton()->mesh_remove_surface(_mesh_rid, 0);
#else
VS::get_singleton()->mesh_clear(_mesh_rid);
#endif
}
}

View File

@ -22,16 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "core/version.h"
#include "scene/resources/texture.h"
#if VERSION_MAJOR >= 4
#define Texture Texture2D
#endif
#include "scene/2d/node_2d.h"
#include "core/math/vector3.h"

View File

@ -22,15 +22,7 @@ SOFTWARE.
#include "tiled_wall_2d_data.h"
#if VERSION_MAJOR < 4
#include "servers/physics_server.h"
#else
#include "servers/physics_server_3d.h"
#define Shape Shape3D
#endif
#if VERSION_MAJOR <= 3
#define VARIANT_ARRAY_GET(arr) \
Vector<Variant> r; \
@ -39,17 +31,6 @@ SOFTWARE.
} \
return r;
#else
#define VARIANT_ARRAY_GET(arr) \
Vector<Variant> r; \
for (int i = 0; i < arr.size(); i++) { \
r.push_back(arr[i].get_ref_ptr()); \
} \
return r;
#endif
#define VARIANT_ARRAY_SET(arr, arr_into, type) \
arr_into.clear(); \
for (int i = 0; i < arr.size(); i++) { \
@ -100,11 +81,7 @@ int TiledWall2DData::get_texture_count() const {
Vector<Variant> TiledWall2DData::get_textures() {
Vector<Variant> r;
for (int i = 0; i < _textures.size(); i++) {
#if VERSION_MAJOR < 4
r.push_back(_textures[i].get_ref_ptr());
#else
r.push_back(_textures[i]);
#endif
}
return r;
}
@ -148,11 +125,7 @@ int TiledWall2DData::get_flavour_texture_count() const {
Vector<Variant> TiledWall2DData::get_flavour_textures() {
Vector<Variant> r;
for (int i = 0; i < _flavour_textures.size(); i++) {
#if VERSION_MAJOR < 4
r.push_back(_flavour_textures[i].get_ref_ptr());
#else
r.push_back(_flavour_textures[i]);
#endif
}
return r;
}

View File

@ -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/object/reference.h"
#include "core/templates/vector.h"
#else
#include "core/reference.h"
#include "core/vector.h"
#endif
#include "core/math/rect2.h"
#include "core/math/transform.h"