mirror of
https://github.com/Relintai/props.git
synced 2024-11-12 10:15:25 +01:00
Fix compile for 4.0.
This commit is contained in:
parent
969f3796d6
commit
0ed644e4a4
@ -24,9 +24,23 @@ SOFTWARE.
|
||||
|
||||
#include "../props/prop_data.h"
|
||||
#include "../singleton/prop_utils.h"
|
||||
#include "core/os/input.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 PropEditorPlugin::convert_active_scene_to_prop_data() {
|
||||
SceneTree *st = SceneTree::get_singleton();
|
||||
|
||||
@ -74,7 +88,6 @@ void PropEditorPlugin::_convert_selected_scene_to_prop_data(Variant param) {
|
||||
}
|
||||
|
||||
PropEditorPlugin::PropEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
editor = p_node;
|
||||
|
||||
editor->add_tool_menu_item("Convert active scene to PropData", this, "convert_active_scene_to_prop_data");
|
||||
@ -88,7 +101,7 @@ PropEditorPlugin::PropEditorPlugin(EditorNode *p_node) {
|
||||
container->add_child(b);
|
||||
b->set_flat(true);
|
||||
|
||||
b->connect("pressed", this, "_quick_convert_button_pressed");
|
||||
b->CONNECT("pressed", this, PropEditorPlugin, _quick_convert_button_pressed);
|
||||
b->set_text("To Prop");
|
||||
b->set_shortcut(ED_SHORTCUT("spatial_editor/quick_prop_convert", "Quick convert scene to PropData.", KEY_MASK_ALT + KEY_U));
|
||||
|
||||
|
@ -40,7 +40,7 @@ void PropInstance::set_snap_axis(const Vector3 &value) {
|
||||
}
|
||||
|
||||
void PropInstance::register_prop_mesh_data_instance(MeshDataInstance *instance) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(instance));
|
||||
//ERR_FAIL_COND(!ObjectDB::instance_validate(instance));
|
||||
|
||||
_mesh_data_instances.push_back(instance);
|
||||
|
||||
@ -49,7 +49,7 @@ void PropInstance::register_prop_mesh_data_instance(MeshDataInstance *instance)
|
||||
}
|
||||
|
||||
void PropInstance::unregister_prop_mesh_data_instance(MeshDataInstance *instance) {
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(instance));
|
||||
//ERR_FAIL_COND(!ObjectDB::instance_validate(instance));
|
||||
|
||||
_mesh_data_instances.erase(instance);
|
||||
|
||||
@ -66,7 +66,7 @@ void PropInstance::bake() {
|
||||
for (int i = 0; i < _mesh_data_instances.size(); ++i) {
|
||||
MeshDataInstance *md = _mesh_data_instances.get(i);
|
||||
|
||||
ERR_CONTINUE(!ObjectDB::instance_validate(md));
|
||||
//ERR_CONTINUE(!ObjectDB::instance_validate(md));
|
||||
|
||||
Ref<MeshDataResource> mdr = md->get_mesh();
|
||||
|
||||
@ -149,7 +149,7 @@ PropInstance::PropInstance() {
|
||||
_snap_to_mesh = false;
|
||||
_snap_axis = Vector3(0, -1, 0);
|
||||
_job.instance();
|
||||
_job->connect("completed", this, "bake_finished", Vector<Variant>(), Object::CONNECT_DEFERRED);
|
||||
//_job->connect("completed", this, "bake_finished", Vector<Variant>(), Object::CONNECT_DEFERRED);
|
||||
}
|
||||
PropInstance::~PropInstance() {
|
||||
_mesh_data_instances.clear();
|
||||
|
@ -26,6 +26,14 @@ SOFTWARE.
|
||||
#include "prop_data_light.h"
|
||||
#include "prop_data_prop.h"
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#include "servers/physics_server.h"
|
||||
#else
|
||||
#include "servers/physics_server_3d.h"
|
||||
|
||||
#define Shape Shape3D
|
||||
#endif
|
||||
|
||||
int PropData::get_id() const {
|
||||
return _id;
|
||||
}
|
||||
@ -73,7 +81,11 @@ int PropData::get_prop_count() const {
|
||||
Vector<Variant> PropData::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;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ SOFTWARE.
|
||||
#include "core/reference.h"
|
||||
#include "core/vector.h"
|
||||
|
||||
#include "servers/physics_server.h"
|
||||
#include "core/version.h"
|
||||
|
||||
#include "prop_data_entry.h"
|
||||
|
||||
@ -78,7 +78,7 @@ private:
|
||||
bool _snap_to_mesh;
|
||||
Vector3 _snap_axis;
|
||||
|
||||
Vector<Ref<PropDataEntry> > _props;
|
||||
Vector<Ref<PropDataEntry>> _props;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -23,7 +23,15 @@ SOFTWARE.
|
||||
#include "prop_data_entry.h"
|
||||
|
||||
#include "prop_data.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#include "scene/3d/spatial.h"
|
||||
#else
|
||||
#include "scene/3d/node_3d.h"
|
||||
#define Spatial Node3D
|
||||
#endif
|
||||
|
||||
Transform PropDataEntry::get_transform() const {
|
||||
return _transform;
|
||||
|
@ -23,7 +23,14 @@ SOFTWARE.
|
||||
#include "prop_data_light.h"
|
||||
|
||||
#include "prop_data.h"
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#include "scene/3d/light.h"
|
||||
#else
|
||||
#include "scene/3d/light_3d.h"
|
||||
#define OmniLight OmniLight3D
|
||||
#define Light Light3D
|
||||
#endif
|
||||
|
||||
Color PropDataLight::get_light_color() const {
|
||||
return _light_color;
|
||||
|
@ -26,15 +26,19 @@ SOFTWARE.
|
||||
#include "../props/prop_data_entry.h"
|
||||
#include "core/engine.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
PropUtils *PropUtils::_instance;
|
||||
Vector<Ref<PropDataEntry> > PropUtils::_processors;
|
||||
Vector<Ref<PropDataEntry>> PropUtils::_processors;
|
||||
|
||||
PropUtils *PropUtils::get_singleton() {
|
||||
return _instance;
|
||||
}
|
||||
|
||||
Ref<PropData> PropUtils::convert_tree(Node *root) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND_V(!ObjectDB::instance_validate(root), Ref<PropData>());
|
||||
#endif
|
||||
|
||||
Ref<PropData> data;
|
||||
data.instance();
|
||||
@ -46,7 +50,9 @@ Ref<PropData> PropUtils::convert_tree(Node *root) {
|
||||
}
|
||||
|
||||
void PropUtils::_convert_tree(Ref<PropData> prop_data, Node *node, const Transform &transform) {
|
||||
#if VERSION_MAJOR < 4
|
||||
ERR_FAIL_COND(!ObjectDB::instance_validate(node));
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < PropUtils::_processors.size(); ++i) {
|
||||
Ref<PropDataEntry> proc = PropUtils::_processors.get(i);
|
||||
@ -84,7 +90,6 @@ void PropUtils::_convert_tree(Ref<PropData> prop_data, Node *node, const Transfo
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < node->get_child_count(); ++i) {
|
||||
|
||||
Node *child = node->get_child(i);
|
||||
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
|
Loading…
Reference in New Issue
Block a user