Renamed VoxelmanProp to PropData.

This commit is contained in:
Relintai 2019-11-07 21:32:31 +01:00
parent 1881eea313
commit 2c49d2e8d9
27 changed files with 434 additions and 434 deletions

14
SCsub
View File

@ -26,12 +26,12 @@ env.add_source_files(env.modules_sources,"world/voxel_chunk_prop_data.cpp")
env.add_source_files(env.modules_sources,"meshers/cubic_mesher/voxel_mesher_cubic.cpp") env.add_source_files(env.modules_sources,"meshers/cubic_mesher/voxel_mesher_cubic.cpp")
env.add_source_files(env.modules_sources,"meshers/cubic_mesher/voxel_cube_points.cpp") env.add_source_files(env.modules_sources,"meshers/cubic_mesher/voxel_cube_points.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop.cpp") env.add_source_files(env.modules_sources,"props/prop_data.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop_entry.cpp") env.add_source_files(env.modules_sources,"props/prop_data_entry.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop_scene.cpp") env.add_source_files(env.modules_sources,"props/prop_data_scene.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop_mesh.cpp") env.add_source_files(env.modules_sources,"props/prop_data_mesh.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop_light.cpp") env.add_source_files(env.modules_sources,"props/prop_data_light.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop_prop.cpp") env.add_source_files(env.modules_sources,"props/prop_data_prop.cpp")
env.add_source_files(env.modules_sources,"props/voxelman_prop_entity.cpp") env.add_source_files(env.modules_sources,"props/prop_data_entity.cpp")
env.add_source_files(env.modules_sources,"level_generator/voxelman_level_generator.cpp") env.add_source_files(env.modules_sources,"level_generator/voxelman_level_generator.cpp")

83
props/prop_data.cpp Normal file
View File

@ -0,0 +1,83 @@
#include "prop_data.h"
bool PropData::get_snap_to_mesh() {
return _snap_to_mesh;
}
void PropData::set_snap_to_mesh(bool value) {
_snap_to_mesh = value;
}
Vector3 PropData::get_snap_axis() {
return _snap_axis;
}
void PropData::set_snap_axis(Vector3 value) {
_snap_axis = value;
}
Ref<PropDataEntry> PropData::get_prop(const int index) const {
ERR_FAIL_INDEX_V(index, _props.size(), Ref<PropDataEntry>());
return _props.get(index);
}
void PropData::set_prop(const int index, const Ref<PropDataEntry> prop) {
ERR_FAIL_INDEX(index, _props.size());
_props.set(index, prop);
}
void PropData::add_prop(const Ref<PropDataEntry> prop) {
_props.push_back(prop);
}
void PropData::remove_prop(const int index) {
ERR_FAIL_INDEX(index, _props.size());
_props.remove(index);
}
int PropData::get_prop_count() const {
return _props.size();
}
Vector<Variant> PropData::get_props() {
Vector<Variant> r;
for (int i = 0; i < _props.size(); i++) {
r.push_back(_props[i].get_ref_ptr());
}
return r;
}
void PropData::set_props(const Vector<Variant> &props) {
_props.clear();
for (int i = 0; i < props.size(); i++) {
Ref<PropDataEntry> prop = Ref<PropDataEntry>(props[i]);
_props.push_back(prop);
}
}
PropData::PropData() {
_snap_to_mesh = false;
_snap_axis = Vector3(0, -1, 0);
}
PropData::~PropData() {
_props.clear();
}
void PropData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_snap_to_mesh"), &PropData::get_snap_to_mesh);
ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &PropData::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"), &PropData::get_snap_axis);
ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &PropData::set_snap_axis);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis");
ClassDB::bind_method(D_METHOD("get_prop", "index"), &PropData::get_prop);
ClassDB::bind_method(D_METHOD("set_prop", "index", "spell"), &PropData::set_prop);
ClassDB::bind_method(D_METHOD("add_prop", "prop"), &PropData::add_prop);
ClassDB::bind_method(D_METHOD("remove_prop", "index"), &PropData::remove_prop);
ClassDB::bind_method(D_METHOD("get_prop_count"), &PropData::get_prop_count);
ClassDB::bind_method(D_METHOD("get_props"), &PropData::get_props);
ClassDB::bind_method(D_METHOD("set_props", "props"), &PropData::set_props);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "17/17:PropDataEntry", PROPERTY_USAGE_DEFAULT, "PropDataEntry"), "set_props", "get_props");
}

View File

@ -1,13 +1,13 @@
#ifndef VOXELMAN_PROP_H #ifndef PROP_DATA_H
#define VOXELMAN_PROP_H #define PROP_DATA_H
#include "core/reference.h" #include "core/reference.h"
#include "core/vector.h" #include "core/vector.h"
#include "voxelman_prop_entry.h" #include "prop_data_entry.h"
class VoxelmanProp : public Resource { class PropData : public Resource {
GDCLASS(VoxelmanProp, Resource); GDCLASS(PropData, Resource);
public: public:
bool get_snap_to_mesh(); bool get_snap_to_mesh();
@ -16,9 +16,9 @@ public:
Vector3 get_snap_axis(); Vector3 get_snap_axis();
void set_snap_axis(Vector3 value); void set_snap_axis(Vector3 value);
Ref<VoxelmanPropEntry> get_prop(const int index) const; Ref<PropDataEntry> get_prop(const int index) const;
void set_prop(const int index, const Ref<VoxelmanPropEntry> prop); void set_prop(const int index, const Ref<PropDataEntry> prop);
void add_prop(const Ref<VoxelmanPropEntry> prop); void add_prop(const Ref<PropDataEntry> prop);
void remove_prop(const int index); void remove_prop(const int index);
int get_prop_count() const; int get_prop_count() const;
@ -26,8 +26,8 @@ public:
Vector<Variant> get_props(); Vector<Variant> get_props();
void set_props(const Vector<Variant> &props); void set_props(const Vector<Variant> &props);
VoxelmanProp(); PropData();
~VoxelmanProp(); ~PropData();
protected: protected:
static void _bind_methods(); static void _bind_methods();
@ -36,7 +36,7 @@ private:
bool _snap_to_mesh; bool _snap_to_mesh;
Vector3 _snap_axis; Vector3 _snap_axis;
Vector<Ref<VoxelmanPropEntry> > _props; Vector<Ref<PropDataEntry> > _props;
}; };
#endif #endif

View File

@ -0,0 +1,33 @@
#include "prop_data_entity.h"
int PropDataEntity::get_entity_data_id() const {
return _entity_data_id;
}
void PropDataEntity::set_entity_data_id(const int value) {
_entity_data_id = value;
}
int PropDataEntity::get_level() const {
return _level;
}
void PropDataEntity::set_level(const int value) {
_level = value;
}
PropDataEntity::PropDataEntity() {
_entity_data_id = 0;
_level = 1;
}
PropDataEntity::~PropDataEntity() {
}
void PropDataEntity::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_entity_data_id"), &PropDataEntity::get_entity_data_id);
ClassDB::bind_method(D_METHOD("set_entity_data_id", "value"), &PropDataEntity::set_entity_data_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "entity_data_id"), "set_entity_data_id", "get_entity_data_id");
ClassDB::bind_method(D_METHOD("get_level"), &PropDataEntity::get_level);
ClassDB::bind_method(D_METHOD("set_level", "value"), &PropDataEntity::set_level);
ADD_PROPERTY(PropertyInfo(Variant::INT, "level"), "set_level", "get_level");
}

View File

@ -1,10 +1,10 @@
#ifndef VOXELMAN_PROP_ENTITY_H #ifndef PROP_DATA_ENTITY_H
#define VOXELMAN_PROP_ENTITY_H #define PROP_DATA_ENTITY_H
#include "voxelman_prop_entry.h" #include "prop_data_entry.h"
class VoxelmanPropEntity : public VoxelmanPropEntry { class PropDataEntity : public PropDataEntry {
GDCLASS(VoxelmanPropEntity, VoxelmanPropEntry); GDCLASS(PropDataEntity, PropDataEntry);
public: public:
int get_entity_data_id() const; int get_entity_data_id() const;
@ -13,8 +13,8 @@ public:
int get_level() const; int get_level() const;
void set_level(const int value); void set_level(const int value);
VoxelmanPropEntity(); PropDataEntity();
~VoxelmanPropEntity(); ~PropDataEntity();
protected: protected:
static void _bind_methods(); static void _bind_methods();

21
props/prop_data_entry.cpp Normal file
View File

@ -0,0 +1,21 @@
#include "prop_data_entry.h"
Transform PropDataEntry::get_transform() const {
return _transform;
}
void PropDataEntry::set_transform(const Transform value) {
_transform = value;
}
PropDataEntry::PropDataEntry() {
}
PropDataEntry::~PropDataEntry() {
}
void PropDataEntry::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_transform"), &PropDataEntry::get_transform);
ClassDB::bind_method(D_METHOD("set_transform", "value"), &PropDataEntry::set_transform);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
}

View File

@ -1,19 +1,19 @@
#ifndef VOXELMAN_PROP_DATA_H #ifndef PROP_DATA_DATA_H
#define VOXELMAN_PROP_DATA_H #define PROP_DATA_DATA_H
#include "core/resource.h" #include "core/resource.h"
#include "core/math/transform.h" #include "core/math/transform.h"
class VoxelmanPropEntry : public Resource { class PropDataEntry : public Resource {
GDCLASS(VoxelmanPropEntry, Resource); GDCLASS(PropDataEntry, Resource);
public: public:
Transform get_transform() const; Transform get_transform() const;
void set_transform(const Transform value); void set_transform(const Transform value);
VoxelmanPropEntry(); PropDataEntry();
~VoxelmanPropEntry(); ~PropDataEntry();
protected: protected:
static void _bind_methods(); static void _bind_methods();

32
props/prop_data_light.cpp Normal file
View File

@ -0,0 +1,32 @@
#include "prop_data_light.h"
Color PropDataLight::get_light_color() const {
return _light_color;
}
void PropDataLight::set_light_color(const Color value) {
_light_color = value;
}
int PropDataLight::get_light_size() const {
return _light_size;
}
void PropDataLight::set_light_size(const int value) {
_light_size = value;
}
PropDataLight::PropDataLight() {
_light_size = 5;
}
PropDataLight::~PropDataLight() {
}
void PropDataLight::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_light_color"), &PropDataLight::get_light_color);
ClassDB::bind_method(D_METHOD("set_light_color", "value"), &PropDataLight::set_light_color);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "light_color"), "set_light_color", "get_light_color");
ClassDB::bind_method(D_METHOD("get_light_size"), &PropDataLight::get_light_size);
ClassDB::bind_method(D_METHOD("set_light_size", "value"), &PropDataLight::set_light_size);
ADD_PROPERTY(PropertyInfo(Variant::INT, "light_size"), "set_light_size", "get_light_size");
}

View File

@ -1,12 +1,12 @@
#ifndef VOXELMAN_PROP_LIGHT_H #ifndef PROP_DATA_LIGHT_H
#define VOXELMAN_PROP_LIGHT_H #define PROP_DATA_LIGHT_H
#include "voxelman_prop_entry.h" #include "prop_data_entry.h"
#include "core/color.h" #include "core/color.h"
class VoxelmanPropLight : public VoxelmanPropEntry { class PropDataLight : public PropDataEntry {
GDCLASS(VoxelmanPropLight, VoxelmanPropEntry); GDCLASS(PropDataLight, PropDataEntry);
public: public:
Color get_light_color() const; Color get_light_color() const;
@ -15,8 +15,8 @@ public:
int get_light_size() const; int get_light_size() const;
void set_light_size(const int value); void set_light_size(const int value);
VoxelmanPropLight(); PropDataLight();
~VoxelmanPropLight(); ~PropDataLight();
protected: protected:
static void _bind_methods(); static void _bind_methods();

56
props/prop_data_mesh.cpp Normal file
View File

@ -0,0 +1,56 @@
#include "prop_data_mesh.h"
Ref<MeshDataResource> PropDataMesh::get_mesh() const {
return _mesh;
}
void PropDataMesh::set_mesh(const Ref<MeshDataResource> mesh) {
_mesh = mesh;
}
Ref<Texture> PropDataMesh::get_texture() const {
return _texture;
}
void PropDataMesh::set_texture(const Ref<Texture> texture) {
_texture = texture;
}
bool PropDataMesh::get_snap_to_mesh() {
return _snap_to_mesh;
}
void PropDataMesh::set_snap_to_mesh(bool value) {
_snap_to_mesh = value;
}
Vector3 PropDataMesh::get_snap_axis() {
return _snap_axis;
}
void PropDataMesh::set_snap_axis(Vector3 value) {
_snap_axis = value;
}
PropDataMesh::PropDataMesh() {
_snap_to_mesh = true;
_snap_axis = Vector3(0, 1, 0);
}
PropDataMesh::~PropDataMesh() {
if (_mesh.is_valid())
_mesh.unref();
}
void PropDataMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_mesh"), &PropDataMesh::get_mesh);
ClassDB::bind_method(D_METHOD("set_mesh", "value"), &PropDataMesh::set_mesh);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "MeshDataResource"), "set_mesh", "get_mesh");
ClassDB::bind_method(D_METHOD("get_texture"), &PropDataMesh::get_texture);
ClassDB::bind_method(D_METHOD("set_texture", "value"), &PropDataMesh::set_texture);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture");
ClassDB::bind_method(D_METHOD("get_snap_to_mesh"), &PropDataMesh::get_snap_to_mesh);
ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &PropDataMesh::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"), &PropDataMesh::get_snap_axis);
ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &PropDataMesh::set_snap_axis);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis");
}

View File

@ -1,15 +1,15 @@
#ifndef VOXELMAN_PROP_MESH_H #ifndef PROP_DATA_MESH_H
#define VOXELMAN_PROP_MESH_H #define PROP_DATA_MESH_H
#include "voxelman_prop_entry.h" #include "prop_data_entry.h"
#include "core/math/vector3.h" #include "core/math/vector3.h"
#include "scene/resources/texture.h" #include "scene/resources/texture.h"
#include "../../entity_spell_system/meshes/mesh_data_resource.h" #include "../../entity_spell_system/meshes/mesh_data_resource.h"
class VoxelmanPropMesh : public VoxelmanPropEntry { class PropDataMesh : public PropDataEntry {
GDCLASS(VoxelmanPropMesh, VoxelmanPropEntry); GDCLASS(PropDataMesh, PropDataEntry);
public: public:
Ref<MeshDataResource> get_mesh() const; Ref<MeshDataResource> get_mesh() const;
@ -24,8 +24,8 @@ public:
Vector3 get_snap_axis(); Vector3 get_snap_axis();
void set_snap_axis(Vector3 value); void set_snap_axis(Vector3 value);
VoxelmanPropMesh(); PropDataMesh();
~VoxelmanPropMesh(); ~PropDataMesh();
protected: protected:
static void _bind_methods(); static void _bind_methods();

45
props/prop_data_prop.cpp Normal file
View File

@ -0,0 +1,45 @@
#include "prop_data_prop.h"
Ref<PropData> PropDataProp::get_prop() const {
return _prop;
}
void PropDataProp::set_prop(const Ref<PropData> value) {
_prop = value;
}
bool PropDataProp::get_snap_to_mesh() {
return _snap_to_mesh;
}
void PropDataProp::set_snap_to_mesh(bool value) {
_snap_to_mesh = value;
}
Vector3 PropDataProp::get_snap_axis() {
return _snap_axis;
}
void PropDataProp::set_snap_axis(Vector3 value) {
_snap_axis = value;
}
PropDataProp::PropDataProp() {
_snap_to_mesh = false;
_snap_axis = Vector3(0, 1, 0);
}
PropDataProp::~PropDataProp() {
if (_prop.is_valid())
_prop.unref();
}
void PropDataProp::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_prop"), &PropDataProp::get_prop);
ClassDB::bind_method(D_METHOD("set_prop", "value"), &PropDataProp::set_prop);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop", PROPERTY_HINT_RESOURCE_TYPE, "PropData"), "set_prop", "get_prop");
ClassDB::bind_method(D_METHOD("get_snap_to_mesh"), &PropDataProp::get_snap_to_mesh);
ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &PropDataProp::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"), &PropDataProp::get_snap_axis);
ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &PropDataProp::set_snap_axis);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis");
}

34
props/prop_data_prop.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef PROP_DATA_PROP_H
#define PROP_DATA_PROP_H
#include "prop_data_entry.h"
#include "core/math/vector3.h"
#include "prop_data.h"
class PropDataProp : public PropDataEntry {
GDCLASS(PropDataProp, PropDataEntry);
public:
Ref<PropData> get_prop() const;
void set_prop(const Ref<PropData> value);
bool get_snap_to_mesh();
void set_snap_to_mesh(bool value);
Vector3 get_snap_axis();
void set_snap_axis(Vector3 value);
PropDataProp();
~PropDataProp();
protected:
static void _bind_methods();
private:
bool _snap_to_mesh;
Vector3 _snap_axis;
Ref<PropData> _prop;
};
#endif

45
props/prop_data_scene.cpp Normal file
View File

@ -0,0 +1,45 @@
#include "prop_data_scene.h"
Ref<PackedScene> PropDataScene::get_scene() const {
return _scene;
}
void PropDataScene::set_scene(const Ref<PackedScene> value) {
_scene = value;
}
bool PropDataScene::get_snap_to_mesh() {
return _snap_to_mesh;
}
void PropDataScene::set_snap_to_mesh(bool value) {
_snap_to_mesh = value;
}
Vector3 PropDataScene::get_snap_axis() {
return _snap_axis;
}
void PropDataScene::set_snap_axis(Vector3 value) {
_snap_axis = value;
}
PropDataScene::PropDataScene() {
_snap_to_mesh = true;
_snap_axis = Vector3(0, 1, 0);
}
PropDataScene::~PropDataScene() {
if (_scene.is_valid())
_scene.unref();
}
void PropDataScene::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_scene"), &PropDataScene::get_scene);
ClassDB::bind_method(D_METHOD("set_scene", "value"), &PropDataScene::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"), &PropDataScene::get_snap_to_mesh);
ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &PropDataScene::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"), &PropDataScene::get_snap_axis);
ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &PropDataScene::set_snap_axis);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis");
}

View File

@ -1,13 +1,13 @@
#ifndef VOXELMAN_PROP_SCENE_H #ifndef PROP_DATA_SCENE_H
#define VOXELMAN_PROP_SCENE_H #define PROP_DATA_SCENE_H
#include "voxelman_prop_entry.h" #include "prop_data_entry.h"
#include "core/math/vector3.h" #include "core/math/vector3.h"
#include "scene/resources/packed_scene.h" #include "scene/resources/packed_scene.h"
class VoxelmanPropScene : public VoxelmanPropEntry { class PropDataScene : public PropDataEntry {
GDCLASS(VoxelmanPropScene, VoxelmanPropEntry); GDCLASS(PropDataScene, PropDataEntry);
public: public:
Ref<PackedScene> get_scene() const; Ref<PackedScene> get_scene() const;
@ -19,8 +19,8 @@ public:
Vector3 get_snap_axis(); Vector3 get_snap_axis();
void set_snap_axis(Vector3 value); void set_snap_axis(Vector3 value);
VoxelmanPropScene(); PropDataScene();
~VoxelmanPropScene(); ~PropDataScene();
protected: protected:
static void _bind_methods(); static void _bind_methods();

View File

@ -1,83 +0,0 @@
#include "voxelman_prop.h"
bool VoxelmanProp::get_snap_to_mesh() {
return _snap_to_mesh;
}
void VoxelmanProp::set_snap_to_mesh(bool value) {
_snap_to_mesh = value;
}
Vector3 VoxelmanProp::get_snap_axis() {
return _snap_axis;
}
void VoxelmanProp::set_snap_axis(Vector3 value) {
_snap_axis = value;
}
Ref<VoxelmanPropEntry> VoxelmanProp::get_prop(const int index) const {
ERR_FAIL_INDEX_V(index, _props.size(), Ref<VoxelmanPropEntry>());
return _props.get(index);
}
void VoxelmanProp::set_prop(const int index, const Ref<VoxelmanPropEntry> prop) {
ERR_FAIL_INDEX(index, _props.size());
_props.set(index, prop);
}
void VoxelmanProp::add_prop(const Ref<VoxelmanPropEntry> prop) {
_props.push_back(prop);
}
void VoxelmanProp::remove_prop(const int index) {
ERR_FAIL_INDEX(index, _props.size());
_props.remove(index);
}
int VoxelmanProp::get_prop_count() const {
return _props.size();
}
Vector<Variant> VoxelmanProp::get_props() {
Vector<Variant> r;
for (int i = 0; i < _props.size(); i++) {
r.push_back(_props[i].get_ref_ptr());
}
return r;
}
void VoxelmanProp::set_props(const Vector<Variant> &props) {
_props.clear();
for (int i = 0; i < props.size(); i++) {
Ref<VoxelmanPropEntry> prop = Ref<VoxelmanPropEntry>(props[i]);
_props.push_back(prop);
}
}
VoxelmanProp::VoxelmanProp() {
_snap_to_mesh = false;
_snap_axis = Vector3(0, -1, 0);
}
VoxelmanProp::~VoxelmanProp() {
_props.clear();
}
void VoxelmanProp::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_snap_to_mesh"), &VoxelmanProp::get_snap_to_mesh);
ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &VoxelmanProp::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"), &VoxelmanProp::get_snap_axis);
ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &VoxelmanProp::set_snap_axis);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis");
ClassDB::bind_method(D_METHOD("get_prop", "index"), &VoxelmanProp::get_prop);
ClassDB::bind_method(D_METHOD("set_prop", "index", "spell"), &VoxelmanProp::set_prop);
ClassDB::bind_method(D_METHOD("add_prop", "prop"), &VoxelmanProp::add_prop);
ClassDB::bind_method(D_METHOD("remove_prop", "index"), &VoxelmanProp::remove_prop);
ClassDB::bind_method(D_METHOD("get_prop_count"), &VoxelmanProp::get_prop_count);
ClassDB::bind_method(D_METHOD("get_props"), &VoxelmanProp::get_props);
ClassDB::bind_method(D_METHOD("set_props", "props"), &VoxelmanProp::set_props);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "17/17:VoxelmanPropEntry", PROPERTY_USAGE_DEFAULT, "VoxelmanPropEntry"), "set_props", "get_props");
}

View File

@ -1,33 +0,0 @@
#include "voxelman_prop_entity.h"
int VoxelmanPropEntity::get_entity_data_id() const {
return _entity_data_id;
}
void VoxelmanPropEntity::set_entity_data_id(const int value) {
_entity_data_id = value;
}
int VoxelmanPropEntity::get_level() const {
return _level;
}
void VoxelmanPropEntity::set_level(const int value) {
_level = value;
}
VoxelmanPropEntity::VoxelmanPropEntity() {
_entity_data_id = 0;
_level = 1;
}
VoxelmanPropEntity::~VoxelmanPropEntity() {
}
void VoxelmanPropEntity::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_entity_data_id"), &VoxelmanPropEntity::get_entity_data_id);
ClassDB::bind_method(D_METHOD("set_entity_data_id", "value"), &VoxelmanPropEntity::set_entity_data_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "entity_data_id"), "set_entity_data_id", "get_entity_data_id");
ClassDB::bind_method(D_METHOD("get_level"), &VoxelmanPropEntity::get_level);
ClassDB::bind_method(D_METHOD("set_level", "value"), &VoxelmanPropEntity::set_level);
ADD_PROPERTY(PropertyInfo(Variant::INT, "level"), "set_level", "get_level");
}

View File

@ -1,21 +0,0 @@
#include "voxelman_prop_entry.h"
Transform VoxelmanPropEntry::get_transform() const {
return _transform;
}
void VoxelmanPropEntry::set_transform(const Transform value) {
_transform = value;
}
VoxelmanPropEntry::VoxelmanPropEntry() {
}
VoxelmanPropEntry::~VoxelmanPropEntry() {
}
void VoxelmanPropEntry::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_transform"), &VoxelmanPropEntry::get_transform);
ClassDB::bind_method(D_METHOD("set_transform", "value"), &VoxelmanPropEntry::set_transform);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
}

View File

@ -1,32 +0,0 @@
#include "voxelman_prop_light.h"
Color VoxelmanPropLight::get_light_color() const {
return _light_color;
}
void VoxelmanPropLight::set_light_color(const Color value) {
_light_color = value;
}
int VoxelmanPropLight::get_light_size() const {
return _light_size;
}
void VoxelmanPropLight::set_light_size(const int value) {
_light_size = value;
}
VoxelmanPropLight::VoxelmanPropLight() {
_light_size = 5;
}
VoxelmanPropLight::~VoxelmanPropLight() {
}
void VoxelmanPropLight::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_light_color"), &VoxelmanPropLight::get_light_color);
ClassDB::bind_method(D_METHOD("set_light_color", "value"), &VoxelmanPropLight::set_light_color);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "light_color"), "set_light_color", "get_light_color");
ClassDB::bind_method(D_METHOD("get_light_size"), &VoxelmanPropLight::get_light_size);
ClassDB::bind_method(D_METHOD("set_light_size", "value"), &VoxelmanPropLight::set_light_size);
ADD_PROPERTY(PropertyInfo(Variant::INT, "light_size"), "set_light_size", "get_light_size");
}

View File

@ -1,56 +0,0 @@
#include "voxelman_prop_mesh.h"
Ref<MeshDataResource> VoxelmanPropMesh::get_mesh() const {
return _mesh;
}
void VoxelmanPropMesh::set_mesh(const Ref<MeshDataResource> mesh) {
_mesh = mesh;
}
Ref<Texture> VoxelmanPropMesh::get_texture() const {
return _texture;
}
void VoxelmanPropMesh::set_texture(const Ref<Texture> texture) {
_texture = texture;
}
bool VoxelmanPropMesh::get_snap_to_mesh() {
return _snap_to_mesh;
}
void VoxelmanPropMesh::set_snap_to_mesh(bool value) {
_snap_to_mesh = value;
}
Vector3 VoxelmanPropMesh::get_snap_axis() {
return _snap_axis;
}
void VoxelmanPropMesh::set_snap_axis(Vector3 value) {
_snap_axis = value;
}
VoxelmanPropMesh::VoxelmanPropMesh() {
_snap_to_mesh = true;
_snap_axis = Vector3(0, 1, 0);
}
VoxelmanPropMesh::~VoxelmanPropMesh() {
if (_mesh.is_valid())
_mesh.unref();
}
void VoxelmanPropMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_mesh"), &VoxelmanPropMesh::get_mesh);
ClassDB::bind_method(D_METHOD("set_mesh", "value"), &VoxelmanPropMesh::set_mesh);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "MeshDataResource"), "set_mesh", "get_mesh");
ClassDB::bind_method(D_METHOD("get_texture"), &VoxelmanPropMesh::get_texture);
ClassDB::bind_method(D_METHOD("set_texture", "value"), &VoxelmanPropMesh::set_texture);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture");
ClassDB::bind_method(D_METHOD("get_snap_to_mesh"), &VoxelmanPropMesh::get_snap_to_mesh);
ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &VoxelmanPropMesh::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"), &VoxelmanPropMesh::get_snap_axis);
ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &VoxelmanPropMesh::set_snap_axis);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis");
}

View File

@ -1,45 +0,0 @@
#include "voxelman_prop_prop.h"
Ref<VoxelmanProp> VoxelmanPropProp::get_prop() const {
return _prop;
}
void VoxelmanPropProp::set_prop(const Ref<VoxelmanProp> value) {
_prop = value;
}
bool VoxelmanPropProp::get_snap_to_mesh() {
return _snap_to_mesh;
}
void VoxelmanPropProp::set_snap_to_mesh(bool value) {
_snap_to_mesh = value;
}
Vector3 VoxelmanPropProp::get_snap_axis() {
return _snap_axis;
}
void VoxelmanPropProp::set_snap_axis(Vector3 value) {
_snap_axis = value;
}
VoxelmanPropProp::VoxelmanPropProp() {
_snap_to_mesh = false;
_snap_axis = Vector3(0, 1, 0);
}
VoxelmanPropProp::~VoxelmanPropProp() {
if (_prop.is_valid())
_prop.unref();
}
void VoxelmanPropProp::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_prop"), &VoxelmanPropProp::get_prop);
ClassDB::bind_method(D_METHOD("set_prop", "value"), &VoxelmanPropProp::set_prop);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanProp"), "set_prop", "get_prop");
ClassDB::bind_method(D_METHOD("get_snap_to_mesh"), &VoxelmanPropProp::get_snap_to_mesh);
ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &VoxelmanPropProp::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"), &VoxelmanPropProp::get_snap_axis);
ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &VoxelmanPropProp::set_snap_axis);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis");
}

View File

@ -1,34 +0,0 @@
#ifndef VOXELMAN_PROP_PROP_H
#define VOXELMAN_PROP_PROP_H
#include "voxelman_prop_entry.h"
#include "core/math/vector3.h"
#include "voxelman_prop.h"
class VoxelmanPropProp : public VoxelmanPropEntry {
GDCLASS(VoxelmanPropProp, VoxelmanPropEntry);
public:
Ref<VoxelmanProp> get_prop() const;
void set_prop(const Ref<VoxelmanProp> value);
bool get_snap_to_mesh();
void set_snap_to_mesh(bool value);
Vector3 get_snap_axis();
void set_snap_axis(Vector3 value);
VoxelmanPropProp();
~VoxelmanPropProp();
protected:
static void _bind_methods();
private:
bool _snap_to_mesh;
Vector3 _snap_axis;
Ref<VoxelmanProp> _prop;
};
#endif

View File

@ -1,45 +0,0 @@
#include "voxelman_prop_scene.h"
Ref<PackedScene> VoxelmanPropScene::get_scene() const {
return _scene;
}
void VoxelmanPropScene::set_scene(const Ref<PackedScene> value) {
_scene = value;
}
bool VoxelmanPropScene::get_snap_to_mesh() {
return _snap_to_mesh;
}
void VoxelmanPropScene::set_snap_to_mesh(bool value) {
_snap_to_mesh = value;
}
Vector3 VoxelmanPropScene::get_snap_axis() {
return _snap_axis;
}
void VoxelmanPropScene::set_snap_axis(Vector3 value) {
_snap_axis = value;
}
VoxelmanPropScene::VoxelmanPropScene() {
_snap_to_mesh = true;
_snap_axis = Vector3(0, 1, 0);
}
VoxelmanPropScene::~VoxelmanPropScene() {
if (_scene.is_valid())
_scene.unref();
}
void VoxelmanPropScene::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_scene"), &VoxelmanPropScene::get_scene);
ClassDB::bind_method(D_METHOD("set_scene", "value"), &VoxelmanPropScene::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"), &VoxelmanPropScene::get_snap_to_mesh);
ClassDB::bind_method(D_METHOD("set_snap_to_mesh", "value"), &VoxelmanPropScene::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"), &VoxelmanPropScene::get_snap_axis);
ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &VoxelmanPropScene::set_snap_axis);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis");
}

View File

@ -19,13 +19,13 @@
#include "meshers/cubic_mesher/voxel_mesher_cubic.h" #include "meshers/cubic_mesher/voxel_mesher_cubic.h"
#include "meshers/cubic_mesher/voxel_cube_points.h" #include "meshers/cubic_mesher/voxel_cube_points.h"
#include "props/voxelman_prop.h" #include "props/prop_data.h"
#include "props/voxelman_prop_entry.h" #include "props/prop_data_entry.h"
#include "props/voxelman_prop_scene.h" #include "props/prop_data_scene.h"
#include "props/voxelman_prop_mesh.h" #include "props/prop_data_mesh.h"
#include "props/voxelman_prop_light.h" #include "props/prop_data_light.h"
#include "props/voxelman_prop_prop.h" #include "props/prop_data_prop.h"
#include "props/voxelman_prop_entity.h" #include "props/prop_data_entity.h"
#include "level_generator/voxelman_level_generator.h" #include "level_generator/voxelman_level_generator.h"
@ -50,13 +50,13 @@ void register_voxelman_types() {
ClassDB::register_class<VoxelMesherCubic>(); ClassDB::register_class<VoxelMesherCubic>();
ClassDB::register_class<VoxelCubePoints>(); ClassDB::register_class<VoxelCubePoints>();
ClassDB::register_class<VoxelmanProp>(); ClassDB::register_class<PropDataProp>();
ClassDB::register_class<VoxelmanPropEntry>(); ClassDB::register_class<PropDataEntry>();
ClassDB::register_class<VoxelmanPropScene>(); ClassDB::register_class<PropDataScene>();
ClassDB::register_class<VoxelmanPropMesh>(); ClassDB::register_class<PropDataMesh>();
ClassDB::register_class<VoxelmanPropLight>(); ClassDB::register_class<PropDataLight>();
ClassDB::register_class<VoxelmanPropProp>(); ClassDB::register_class<PropDataProp>();
ClassDB::register_class<VoxelmanPropEntity>(); ClassDB::register_class<PropDataEntity>();
ClassDB::register_class<VoxelmanLevelGenerator>(); ClassDB::register_class<VoxelmanLevelGenerator>();
} }

View File

@ -26,11 +26,11 @@
#include "voxel_buffer.h" #include "voxel_buffer.h"
#include "../../entity_spell_system/meshes/mesh_data_resource.h" #include "../../entity_spell_system/meshes/mesh_data_resource.h"
#include "../props/voxelman_prop.h" #include "../props/prop_data.h"
#include "../props/voxelman_prop_entry.h" #include "../props/prop_data_entry.h"
#include "../props/voxelman_prop_scene.h" #include "../props/prop_data_scene.h"
#include "../props/voxelman_prop_mesh.h" #include "../props/prop_data_mesh.h"
#include "../props/voxelman_prop_light.h" #include "../props/prop_data_light.h"
#include "voxel_chunk_prop_data.h" #include "voxel_chunk_prop_data.h"
class VoxelWorld; class VoxelWorld;

View File

@ -63,17 +63,17 @@ void VoxelChunkPropData::set_mesh_texture(const Ref<Texture> value) {
_texture = value; _texture = value;
} }
Ref<VoxelmanPropLight> VoxelChunkPropData::get_light() const { Ref<PropDataLight> VoxelChunkPropData::get_light() const {
return _light; return _light;
} }
void VoxelChunkPropData::set_light(const Ref<VoxelmanPropLight> value) { void VoxelChunkPropData::set_light(const Ref<PropDataLight> value) {
_light = value; _light = value;
} }
Ref<VoxelmanProp> VoxelChunkPropData::get_prop() const { Ref<PropData> VoxelChunkPropData::get_prop() const {
return _prop; return _prop;
} }
void VoxelChunkPropData::set_prop(const Ref<VoxelmanProp> value) { void VoxelChunkPropData::set_prop(const Ref<PropData> value) {
_prop = value; _prop = value;
} }
@ -139,11 +139,11 @@ void VoxelChunkPropData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_light"), &VoxelChunkPropData::get_light); ClassDB::bind_method(D_METHOD("get_light"), &VoxelChunkPropData::get_light);
ClassDB::bind_method(D_METHOD("set_light", "value"), &VoxelChunkPropData::set_light); ClassDB::bind_method(D_METHOD("set_light", "value"), &VoxelChunkPropData::set_light);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "light", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanPropLight"), "set_light", "get_light"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "light", PROPERTY_HINT_RESOURCE_TYPE, "PropDataLight"), "set_light", "get_light");
ClassDB::bind_method(D_METHOD("get_prop"), &VoxelChunkPropData::get_prop); ClassDB::bind_method(D_METHOD("get_prop"), &VoxelChunkPropData::get_prop);
ClassDB::bind_method(D_METHOD("set_prop", "value"), &VoxelChunkPropData::set_prop); ClassDB::bind_method(D_METHOD("set_prop", "value"), &VoxelChunkPropData::set_prop);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop", PROPERTY_HINT_RESOURCE_TYPE, "VoxelmanProp"), "set_prop", "get_prop"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop", PROPERTY_HINT_RESOURCE_TYPE, "PropData"), "set_prop", "get_prop");
ClassDB::bind_method(D_METHOD("get_scene"), &VoxelChunkPropData::get_scene); ClassDB::bind_method(D_METHOD("get_scene"), &VoxelChunkPropData::get_scene);
ClassDB::bind_method(D_METHOD("set_scene", "value"), &VoxelChunkPropData::set_scene); ClassDB::bind_method(D_METHOD("set_scene", "value"), &VoxelChunkPropData::set_scene);

View File

@ -6,8 +6,8 @@
#include "scene/resources/texture.h" #include "scene/resources/texture.h"
#include "scene/resources/packed_scene.h" #include "scene/resources/packed_scene.h"
#include "../props/voxelman_prop.h" #include "../props/prop_data.h"
#include "../props/voxelman_prop_light.h" #include "../props/prop_data_light.h"
#include "../../entity_spell_system/meshes/mesh_data_resource.h" #include "../../entity_spell_system/meshes/mesh_data_resource.h"
class VoxelChunkPropData : public Reference { class VoxelChunkPropData : public Reference {
@ -41,11 +41,11 @@ public:
Ref<Texture> get_mesh_texture() const; Ref<Texture> get_mesh_texture() const;
void set_mesh_texture(const Ref<Texture> value); void set_mesh_texture(const Ref<Texture> value);
Ref<VoxelmanPropLight> get_light() const; Ref<PropDataLight> get_light() const;
void set_light(const Ref<VoxelmanPropLight> value); void set_light(const Ref<PropDataLight> value);
Ref<VoxelmanProp> get_prop() const; Ref<PropData> get_prop() const;
void set_prop(const Ref<VoxelmanProp> value); void set_prop(const Ref<PropData> value);
Ref<PackedScene> get_scene() const; Ref<PackedScene> get_scene() const;
void set_scene(const Ref<PackedScene> value); void set_scene(const Ref<PackedScene> value);
@ -68,8 +68,8 @@ private:
Ref<MeshDataResource> _mesh; Ref<MeshDataResource> _mesh;
Ref<Texture> _texture; Ref<Texture> _texture;
Ref<VoxelmanPropLight> _light; Ref<PropDataLight> _light;
Ref<VoxelmanProp> _prop; Ref<PropData> _prop;
Ref<PackedScene> _scene; Ref<PackedScene> _scene;
}; };