/* Copyright (c) 2019-2020 Péter Magyar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MODEL_VISUAL_ENTRY_H #define MODEL_VISUAL_ENTRY_H #include "core/color.h" #include "core/resource.h" #include "core/ustring.h" #include "scene/resources/texture.h" #include "../../entity_enums.h" #include "../../item_enums.h" #include "scene/resources/mesh.h" #include "scene/resources/packed_scene.h" #ifdef MESH_DATA_RESOURCE_PRESENT #include "../../../mesh_data_resource/mesh_data_resource.h" #endif class ModelVisualEntry : public Resource { GDCLASS(ModelVisualEntry, Resource); public: int get_override_layer() const; void set_override_layer(const int layer); int get_entity_type() const; void set_entity_type(const int value); int get_bone() const; void set_bone(const int value); int get_group() const; void set_group(const int value); #ifdef MESH_DATA_RESOURCE_PRESENT Ref get_mesh(const int index); void set_mesh(const int index, const Ref &mesh); #endif Ref get_texture(const int index); void set_texture(const int index, const Ref &texture); Color get_color(const int index) const; void set_color(const int index, const Color &color); Ref get_attachment(const int index); void set_attachment(const int index, const Ref &attachment); Transform get_transform(const int index) const; void set_transform(const int index, const Transform &transform); int get_size() const; void set_size(const int value); ModelVisualEntry(); ~ModelVisualEntry(); protected: struct MVEE { #ifdef MESH_DATA_RESOURCE_PRESENT Ref mesh; #endif Ref texture; Color color; Ref attachment; Transform transform; MVEE() { color = Color(1, 1, 1, 1); } ~MVEE() { #ifdef MESH_DATA_RESOURCE_PRESENT mesh.unref(); #endif texture.unref(); attachment.unref(); } }; protected: bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; void _get_property_list(List *p_list) const; void _validate_property(PropertyInfo &property) const; static void _bind_methods(); private: int _override_layer; int _entity_type; int _bone; int _group; Vector _entries; }; #endif