mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-22 17:18:12 +01:00
Added layer_colors to SpeciesModelData.
This commit is contained in:
parent
740f3e1c99
commit
31c00cf3b2
@ -24,6 +24,8 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
|
|
||||||
|
#include "../../singletons/ess.h"
|
||||||
|
|
||||||
int SpeciesModelData::get_id() {
|
int SpeciesModelData::get_id() {
|
||||||
return _id;
|
return _id;
|
||||||
}
|
}
|
||||||
@ -94,6 +96,47 @@ void SpeciesModelData::set_visuals(const int bone_index, const Vector<Variant> &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Layer Colors
|
||||||
|
|
||||||
|
Color SpeciesModelData::get_layer_color(const int index) const {
|
||||||
|
ERR_FAIL_INDEX_V(index, _layer_colors.size(), Color());
|
||||||
|
|
||||||
|
return _layer_colors.get(index);
|
||||||
|
}
|
||||||
|
void SpeciesModelData::set_layer_color(const int index, const Color &layer_color) {
|
||||||
|
ERR_FAIL_INDEX(index, _layer_colors.size());
|
||||||
|
|
||||||
|
_layer_colors.set(index, layer_color);
|
||||||
|
}
|
||||||
|
void SpeciesModelData::add_layer_color(const Color &layer_color) {
|
||||||
|
_layer_colors.push_back(layer_color);
|
||||||
|
}
|
||||||
|
void SpeciesModelData::remove_layer_color(const int index) {
|
||||||
|
ERR_FAIL_INDEX(index, _layer_colors.size());
|
||||||
|
|
||||||
|
_layer_colors.remove(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int SpeciesModelData::get_layer_color_count() const {
|
||||||
|
return _layer_colors.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector<Variant> SpeciesModelData::get_layer_colors() {
|
||||||
|
Vector<Variant> r;
|
||||||
|
for (int i = 0; i < _layer_colors.size(); i++) {
|
||||||
|
r.push_back(_layer_colors[i]);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
void SpeciesModelData::set_layer_colors(const Vector<Variant> &layer_colors) {
|
||||||
|
_layer_colors.clear();
|
||||||
|
for (int i = 0; i < layer_colors.size(); i++) {
|
||||||
|
Color layer_color = Color(layer_colors[i]);
|
||||||
|
|
||||||
|
_layer_colors.push_back(layer_color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//SkinColors
|
//SkinColors
|
||||||
|
|
||||||
Color SpeciesModelData::get_skin_color(const int index) const {
|
Color SpeciesModelData::get_skin_color(const int index) const {
|
||||||
@ -293,6 +336,18 @@ void SpeciesModelData::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_body", "value"), &SpeciesModelData::set_body);
|
ClassDB::bind_method(D_METHOD("set_body", "value"), &SpeciesModelData::set_body);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_body", "get_body");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_body", "get_body");
|
||||||
|
|
||||||
|
//Layer Colors
|
||||||
|
ClassDB::bind_method(D_METHOD("get_layer_color", "index"), &SpeciesModelData::get_layer_color);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_layer_color", "index", "data"), &SpeciesModelData::set_layer_color);
|
||||||
|
ClassDB::bind_method(D_METHOD("add_layer_color", "layer_color"), &SpeciesModelData::add_layer_color);
|
||||||
|
ClassDB::bind_method(D_METHOD("remove_layer_color", "index"), &SpeciesModelData::remove_layer_color);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_layer_color_count"), &SpeciesModelData::get_layer_color_count);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_layer_colors"), &SpeciesModelData::get_layer_colors);
|
||||||
|
ClassDB::bind_method(D_METHOD("set_layer_colors", "layer_colors"), &SpeciesModelData::set_layer_colors);
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "layer_colors", PROPERTY_HINT_NONE, "17/17:Color", PROPERTY_USAGE_DEFAULT, "Color"), "set_layer_colors", "get_layer_colors");
|
||||||
|
|
||||||
//Entries
|
//Entries
|
||||||
ClassDB::bind_method(D_METHOD("get_visual", "bone_index", "index"), &SpeciesModelData::get_visual);
|
ClassDB::bind_method(D_METHOD("get_visual", "bone_index", "index"), &SpeciesModelData::get_visual);
|
||||||
ClassDB::bind_method(D_METHOD("set_visual", "bone_index", "index", "data"), &SpeciesModelData::set_visual);
|
ClassDB::bind_method(D_METHOD("set_visual", "bone_index", "index", "data"), &SpeciesModelData::set_visual);
|
||||||
|
@ -57,6 +57,17 @@ public:
|
|||||||
Vector<Variant> get_visuals(const int bone_index);
|
Vector<Variant> get_visuals(const int bone_index);
|
||||||
void set_visuals(const int bone_index, const Vector<Variant> &visuals);
|
void set_visuals(const int bone_index, const Vector<Variant> &visuals);
|
||||||
|
|
||||||
|
//Layer Colors
|
||||||
|
Color get_layer_color(const int index) const;
|
||||||
|
void set_layer_color(const int index, const Color &layer_color);
|
||||||
|
void add_layer_color(const Color &layer_color);
|
||||||
|
void remove_layer_color(const int index);
|
||||||
|
|
||||||
|
int get_layer_color_count() const;
|
||||||
|
|
||||||
|
Vector<Variant> get_layer_colors();
|
||||||
|
void set_layer_colors(const Vector<Variant> &layer_colors);
|
||||||
|
|
||||||
//SkinColors
|
//SkinColors
|
||||||
Color get_skin_color(const int index) const;
|
Color get_skin_color(const int index) const;
|
||||||
void set_skin_color(const int index, const Color skin_color);
|
void set_skin_color(const int index, const Color skin_color);
|
||||||
@ -113,6 +124,8 @@ private:
|
|||||||
Ref<PackedScene> _body;
|
Ref<PackedScene> _body;
|
||||||
|
|
||||||
Vector<Ref<ModelVisualEntry> > _visuals[EntityEnums::SKELETON_POINTS_MAX];
|
Vector<Ref<ModelVisualEntry> > _visuals[EntityEnums::SKELETON_POINTS_MAX];
|
||||||
|
Vector<Color> _layer_colors;
|
||||||
|
|
||||||
Vector<Color> _skin_colors;
|
Vector<Color> _skin_colors;
|
||||||
Vector<Ref<ModelVisualEntry> > _hair_styles;
|
Vector<Ref<ModelVisualEntry> > _hair_styles;
|
||||||
Vector<Color> _hair_colors;
|
Vector<Color> _hair_colors;
|
||||||
|
Loading…
Reference in New Issue
Block a user