mirror of
https://github.com/Relintai/props_2d.git
synced 2025-02-10 16:40:11 +01:00
Clean up Prop2DSceneInstance.
This commit is contained in:
parent
4eb6cf82de
commit
2efb03b6d2
@ -20,20 +20,6 @@ void Prop2DSceneInstance::set_scene(const Ref<PackedScene> &data) {
|
||||
build();
|
||||
}
|
||||
|
||||
bool Prop2DSceneInstance::get_snap_to_mesh() const {
|
||||
return _snap_to_mesh;
|
||||
}
|
||||
void Prop2DSceneInstance::set_snap_to_mesh(const bool value) {
|
||||
_snap_to_mesh = value;
|
||||
}
|
||||
|
||||
Vector3 Prop2DSceneInstance::get_snap_axis() const {
|
||||
return _snap_axis;
|
||||
}
|
||||
void Prop2DSceneInstance::set_snap_axis(const Vector3 &value) {
|
||||
_snap_axis = value;
|
||||
}
|
||||
|
||||
void Prop2DSceneInstance::build() {
|
||||
if (!is_inside_tree()) {
|
||||
return;
|
||||
@ -60,8 +46,6 @@ void Prop2DSceneInstance::build() {
|
||||
}
|
||||
|
||||
Prop2DSceneInstance::Prop2DSceneInstance() {
|
||||
_snap_to_mesh = false;
|
||||
_snap_axis = Vector3(0, -1, 0);
|
||||
}
|
||||
Prop2DSceneInstance::~Prop2DSceneInstance() {
|
||||
_scene.unref();
|
||||
@ -79,14 +63,6 @@ void Prop2DSceneInstance::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_scene"), &Prop2DSceneInstance::get_scene);
|
||||
ClassDB::bind_method(D_METHOD("set_scene", "value"), &Prop2DSceneInstance::set_scene);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "scene", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_scene", "get_scene");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_snap_to_mesh"), &Prop2DSceneInstance::get_snap_to_mesh);
|
||||
ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &Prop2DSceneInstance::set_snap_to_mesh);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "snap_to_mesh"), "set_snap_to_mesh", "get_snap_to_mesh");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_snap_axis"), &Prop2DSceneInstance::get_snap_axis);
|
||||
ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &Prop2DSceneInstance::set_snap_axis);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis");
|
||||
|
||||
|
||||
ClassDB::bind_method(D_METHOD("build"), &Prop2DSceneInstance::build);
|
||||
}
|
||||
|
@ -25,32 +25,18 @@ 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"
|
||||
#include "scene/2d/node_2d.h"
|
||||
|
||||
#include "props/prop_2d_data.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
class Prop2DSceneInstance : public Spatial {
|
||||
GDCLASS(Prop2DSceneInstance, Spatial);
|
||||
class Prop2DSceneInstance : public Node2D {
|
||||
GDCLASS(Prop2DSceneInstance, Node2D);
|
||||
|
||||
public:
|
||||
Ref<PackedScene> get_scene();
|
||||
void set_scene(const Ref<PackedScene> &data);
|
||||
|
||||
bool get_snap_to_mesh() const;
|
||||
void set_snap_to_mesh(const bool value);
|
||||
|
||||
Vector3 get_snap_axis() const;
|
||||
void set_snap_axis(const Vector3 &value);
|
||||
|
||||
void build();
|
||||
|
||||
Prop2DSceneInstance();
|
||||
@ -62,8 +48,6 @@ protected:
|
||||
|
||||
private:
|
||||
Ref<PackedScene> _scene;
|
||||
bool _snap_to_mesh;
|
||||
Vector3 _snap_axis;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user