Fix compile for 4.0.

This commit is contained in:
Relintai 2021-02-06 11:51:02 +01:00
parent b852ab0e52
commit 5b9617bfaa
10 changed files with 90 additions and 13 deletions

View File

@ -49,6 +49,7 @@ If you want Godot 3.2:
If you want Godot 4.0:
```git clone https://github.com/godotengine/godot.git godot```
[last tested commit for 4.0](https://github.com/godotengine/godot/commit/b7e10141197fdd9b0dbc4cfa7890329510d36540)
2. Go into Godot's modules directory.

View File

@ -23,8 +23,16 @@ SOFTWARE.
#ifndef MESH_DATA_REOURCE_H
#define MESH_DATA_REOURCE_H
#include "core/array.h"
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/io/resource.h"
#include "core/variant/array.h"
#else
#include "core/resource.h"
#include "core/array.h"
#endif
#include "core/version.h"
#include "scene/resources/mesh.h"

View File

@ -23,9 +23,15 @@ SOFTWARE.
#ifndef MESH_DATA_REOURCE_COLLECTION_H
#define MESH_DATA_REOURCE_COLLECTION_H
#include "core/resource.h"
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/io/resource.h"
#include "core/templates/vector.h"
#else
#include "core/resource.h"
#include "core/vector.h"
#endif
#include "mesh_data_resource.h"

View File

@ -2,11 +2,20 @@
#include "core/version.h"
#include "core/version.h"
#include "scene/resources/texture.h"
#if VERSION_MAJOR < 4
#include "core/image.h"
#else
#include "core/io/image.h"
#endif
#if TEXTURE_PACKER_PRESENT
#include "../../texture_packer/texture_resource/packer_image_resource.h"
#endif
#include "core/image.h"
bool MeshDataInstance::get_snap_to_mesh() const {
return _snap_to_mesh;

View File

@ -281,7 +281,7 @@ Ref<MeshDataResource> MDRImportPluginBase::get_mesh(MeshInstance *mi, const Map<
m.instance();
m->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, mdr->get_array());
Vector<Ref<Shape> > shapes = mesh->convex_decompose();
Vector<Ref<Shape>> shapes = mesh->convex_decompose();
for (int j = 0; j < shapes.size(); ++j) {
scale_shape(shapes[j], scale);
@ -301,7 +301,11 @@ Ref<MeshDataResource> MDRImportPluginBase::get_mesh(MeshInstance *mi, const Map<
AABB aabb = m->get_aabb();
Vector3 size = aabb.get_size();
#if VERSION_MAJOR > 3
shape->set_size(size * 0.5);
#else
shape->set_extents(size * 0.5);
#endif
Vector3 pos = aabb.position;
pos += size / 2.0;
@ -420,7 +424,7 @@ Ref<MeshDataResource> MDRImportPluginBase::get_mesh_arrays(Array &arrs, const Ma
m.instance();
m->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, mdr->get_array());
Vector<Ref<Shape> > shapes = mesh->convex_decompose();
Vector<Ref<Shape>> shapes = mesh->convex_decompose();
for (int j = 0; j < shapes.size(); ++j) {
scale_shape(shapes[j], scale);
@ -440,7 +444,11 @@ Ref<MeshDataResource> MDRImportPluginBase::get_mesh_arrays(Array &arrs, const Ma
AABB aabb = m->get_aabb();
Vector3 size = aabb.get_size();
#if VERSION_MAJOR > 3
shape->set_size(size * 0.5);
#else
shape->set_extents(size * 0.5);
#endif
Vector3 pos = aabb.position;
pos += size / 2.0;
@ -746,7 +754,11 @@ Ref<Shape> MDRImportPluginBase::scale_shape(Ref<Shape> shape, const Vector3 &sca
if (Object::cast_to<BoxShape>(*shape)) {
Ref<BoxShape> bs = shape;
#if VERSION_MAJOR > 3
bs->set_size(bs->get_size() * scale);
#else
bs->set_extents(bs->get_extents() * scale);
#endif
}
if (Object::cast_to<CapsuleShape>(*shape)) {

View File

@ -23,18 +23,26 @@ SOFTWARE.
#ifndef MDR_IMPORT_PLUGIN_BASE
#define MDR_IMPORT_PLUGIN_BASE
#include "../mesh_data_resource_collection.h"
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/string/ustring.h"
#include "core/variant/array.h"
#else
#include "core/ustring.h"
#include "core/array.h"
#endif
#include "../mesh_data_resource_collection.h"
#include "core/io/resource_saver.h"
#include "core/math/basis.h"
#include "core/math/transform.h"
#include "core/ustring.h"
#include "editor/import/editor_import_plugin.h"
#include "scene/main/node.h"
#include "scene/resources/mesh.h"
#include "../mesh_data_resource.h"
#include "editor/import/editor_scene_importer_gltf.h"
#include "core/math/transform.h"
@ -42,8 +50,10 @@ SOFTWARE.
#if VERSION_MAJOR < 4
#include "scene/3d/mesh_instance.h"
#include "editor/import/editor_scene_importer_gltf.h"
#else
#include "scene/3d/mesh_instance_3d.h"
#include "../../gltf/editor_scene_importer_gltf.h"
#define MeshInstance MeshInstance3D
#endif

View File

@ -23,13 +23,21 @@ SOFTWARE.
#ifndef EDITOR_IMPORT_COLLADA_MDR
#define EDITOR_IMPORT_COLLADA_MDR
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/string/ustring.h"
#include "core/variant/array.h"
#else
#include "core/ustring.h"
#include "core/array.h"
#endif
#include "../plugin/mdr_import_plugin_base.h"
#include "core/array.h"
#include "core/io/resource_saver.h"
#include "core/math/basis.h"
#include "core/math/transform.h"
#include "core/ustring.h"
#include "editor/import/editor_import_plugin.h"
#include "scene/main/node.h"
#include "scene/resources/mesh.h"

View File

@ -23,7 +23,14 @@ SOFTWARE.
#ifndef EDITOR_PLUGIN_COLLADA_MDR
#define EDITOR_PLUGIN_COLLADA_MDR
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/string/ustring.h"
#else
#include "core/ustring.h"
#endif
#include "editor/editor_plugin.h"
#include "editor_import_collada_mdr.h"

View File

@ -23,26 +23,35 @@ SOFTWARE.
#ifndef EDITOR_IMPORT_GLTF_MDR
#define EDITOR_IMPORT_GLTF_MDR
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/string/ustring.h"
#include "core/variant/array.h"
#else
#include "core/ustring.h"
#include "core/array.h"
#endif
#include "../plugin/mdr_import_plugin_base.h"
#include "core/array.h"
#include "core/io/resource_saver.h"
#include "core/math/basis.h"
#include "core/math/transform.h"
#include "core/ustring.h"
#include "scene/main/node.h"
#include "scene/resources/mesh.h"
#include "../mesh_data_resource.h"
#include "editor/import/editor_scene_importer_gltf.h"
#include "core/math/transform.h"
#include "core/version.h"
#if VERSION_MAJOR < 4
#include "editor/import/editor_scene_importer_gltf.h"
#include "scene/3d/mesh_instance.h"
#else
#include "../../gltf/editor_scene_importer_gltf.h"
#include "scene/3d/mesh_instance_3d.h"
#define MeshInstance MeshInstance3D

View File

@ -23,7 +23,14 @@ SOFTWARE.
#ifndef EDITOR_PLUGIN_GLTF_MDR
#define EDITOR_PLUGIN_GLTF_MDR
#include "core/version.h"
#if VERSION_MAJOR > 3
#include "core/string/ustring.h"
#else
#include "core/ustring.h"
#endif
#include "editor/editor_plugin.h"
#include "editor_import_gltf_mdr.h"