mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-21 15:14:31 +01:00
Added to_dict() and from_dict() methods to TerrainLight/
This commit is contained in:
parent
601185c2bd
commit
6786193010
@ -114,6 +114,43 @@ void TerrainLight::set_specular(const real_t value) {
|
|||||||
_specular = value;
|
_specular = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dictionary TerrainLight::to_dict() {
|
||||||
|
Dictionary data;
|
||||||
|
|
||||||
|
data["owner_type"] = _owner_type;
|
||||||
|
|
||||||
|
data["has_owner_chunk"] = _has_owner_chunk;
|
||||||
|
data["owner_chunk_position"] = _owner_chunk_position;
|
||||||
|
|
||||||
|
data["world_data_position"] = _world_data_position;
|
||||||
|
|
||||||
|
data["range"] = _range;
|
||||||
|
data["attenuation"] = _attenuation;
|
||||||
|
data["color"] = _color;
|
||||||
|
data["energy"] = _energy;
|
||||||
|
data["indirect_energy"] = _indirect_energy;
|
||||||
|
data["negative"] = _negative;
|
||||||
|
data["specular"] = _specular;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
void TerrainLight::from_dict(const Dictionary &p_data) {
|
||||||
|
_owner_type = (OwnerType)((int)p_data["owner_type"]);
|
||||||
|
|
||||||
|
_has_owner_chunk = p_data["has_owner_chunk"];
|
||||||
|
_owner_chunk_position = p_data["owner_chunk_position"];
|
||||||
|
|
||||||
|
_world_data_position = p_data["world_data_position"];
|
||||||
|
|
||||||
|
_range = p_data["range"];
|
||||||
|
_attenuation = p_data["attenuation"];
|
||||||
|
_color = p_data["color"];
|
||||||
|
_energy = p_data["energy"];
|
||||||
|
_indirect_energy = p_data["indirect_energy"];
|
||||||
|
_negative = p_data["negative"];
|
||||||
|
_specular = p_data["specular"];
|
||||||
|
}
|
||||||
|
|
||||||
TerrainLight::TerrainLight() {
|
TerrainLight::TerrainLight() {
|
||||||
_owner_type = OWNER_TYPE_NONE;
|
_owner_type = OWNER_TYPE_NONE;
|
||||||
_has_owner_chunk = false;
|
_has_owner_chunk = false;
|
||||||
@ -184,6 +221,9 @@ void TerrainLight::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_specular", "value"), &TerrainLight::set_specular);
|
ClassDB::bind_method(D_METHOD("set_specular", "value"), &TerrainLight::set_specular);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "light_specular"), "set_specular", "get_specular");
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "light_specular"), "set_specular", "get_specular");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("to_dict"), &TerrainLight::to_dict);
|
||||||
|
ClassDB::bind_method(D_METHOD("from_dict", "data"), &TerrainLight::from_dict);
|
||||||
|
|
||||||
BIND_ENUM_CONSTANT(OWNER_TYPE_NONE);
|
BIND_ENUM_CONSTANT(OWNER_TYPE_NONE);
|
||||||
#ifdef MODULE_PROPS_ENABLED
|
#ifdef MODULE_PROPS_ENABLED
|
||||||
BIND_ENUM_CONSTANT(OWNER_TYPE_PROP);
|
BIND_ENUM_CONSTANT(OWNER_TYPE_PROP);
|
||||||
|
@ -85,6 +85,9 @@ public:
|
|||||||
real_t get_specular() const;
|
real_t get_specular() const;
|
||||||
void set_specular(const real_t value);
|
void set_specular(const real_t value);
|
||||||
|
|
||||||
|
Dictionary to_dict();
|
||||||
|
void from_dict(const Dictionary &p_data);
|
||||||
|
|
||||||
TerrainLight();
|
TerrainLight();
|
||||||
~TerrainLight();
|
~TerrainLight();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user