@@ -3948,6 +3948,9 @@ bool TileSetAtlasSource::_set(const StringName &p_name, const Variant &p_value)
39483948 } else if (components[1 ] == " animation_speed" ) {
39493949 set_tile_animation_speed (coords, p_value);
39503950 return true ;
3951+ } else if (components[1 ] == " animation_mode" ) {
3952+ set_tile_animation_mode (coords, VariantCaster<TileSetAtlasSource::TileAnimationMode>::cast (p_value));
3953+ return true ;
39513954 } else if (components[1 ] == " animation_frames_count" ) {
39523955 set_tile_animation_frames_count (coords, p_value);
39533956 return true ;
@@ -4015,6 +4018,9 @@ bool TileSetAtlasSource::_get(const StringName &p_name, Variant &r_ret) const {
40154018 } else if (components[1 ] == " animation_speed" ) {
40164019 r_ret = get_tile_animation_speed (coords);
40174020 return true ;
4021+ } else if (components[1 ] == " animation_mode" ) {
4022+ r_ret = get_tile_animation_mode (coords);
4023+ return true ;
40184024 } else if (components[1 ] == " animation_frames_count" ) {
40194025 r_ret = get_tile_animation_frames_count (coords);
40204026 return true ;
@@ -4090,6 +4096,13 @@ void TileSetAtlasSource::_get_property_list(List<PropertyInfo> *p_list) const {
40904096 }
40914097 tile_property_list.push_back (property_info);
40924098
4099+ // animation_mode.
4100+ property_info = PropertyInfo (Variant::INT , " animation_mode" , PROPERTY_HINT_NONE , " " , PROPERTY_USAGE_NO_EDITOR );
4101+ if (E_tile.value .animation_mode == TILE_ANIMATION_MODE_DEFAULT ) {
4102+ property_info.usage ^= PROPERTY_USAGE_STORAGE ;
4103+ }
4104+ tile_property_list.push_back (property_info);
4105+
40934106 // animation_frames_count.
40944107 tile_property_list.push_back (PropertyInfo (Variant::INT , " animation_frames_count" , PROPERTY_HINT_NONE , " " , PROPERTY_USAGE_NONE ));
40954108
@@ -4252,6 +4265,20 @@ real_t TileSetAtlasSource::get_tile_animation_speed(const Vector2i p_atlas_coord
42524265 return tiles[p_atlas_coords].animation_speed ;
42534266}
42544267
4268+ void TileSetAtlasSource::set_tile_animation_mode (const Vector2i p_atlas_coords, TileSetAtlasSource::TileAnimationMode p_mode) {
4269+ ERR_FAIL_COND_MSG (!tiles.has (p_atlas_coords), vformat (" TileSetAtlasSource has no tile at %s." , Vector2i (p_atlas_coords)));
4270+
4271+ tiles[p_atlas_coords].animation_mode = p_mode;
4272+
4273+ emit_signal (SNAME (" changed" ));
4274+ }
4275+
4276+ TileSetAtlasSource::TileAnimationMode TileSetAtlasSource::get_tile_animation_mode (const Vector2i p_atlas_coords) const {
4277+ ERR_FAIL_COND_V_MSG (!tiles.has (p_atlas_coords), TILE_ANIMATION_MODE_DEFAULT , vformat (" TileSetAtlasSource has no tile at %s." , Vector2i (p_atlas_coords)));
4278+
4279+ return tiles[p_atlas_coords].animation_mode ;
4280+ }
4281+
42554282void TileSetAtlasSource::set_tile_animation_frames_count (const Vector2i p_atlas_coords, int p_frames_count) {
42564283 ERR_FAIL_COND_MSG (!tiles.has (p_atlas_coords), vformat (" TileSetAtlasSource has no tile at %s." , Vector2i (p_atlas_coords)));
42574284 ERR_FAIL_COND (p_frames_count < 1 );
@@ -4577,6 +4604,8 @@ void TileSetAtlasSource::_bind_methods() {
45774604 ClassDB::bind_method (D_METHOD (" get_tile_animation_separation" , " atlas_coords" ), &TileSetAtlasSource::get_tile_animation_separation);
45784605 ClassDB::bind_method (D_METHOD (" set_tile_animation_speed" , " atlas_coords" , " speed" ), &TileSetAtlasSource::set_tile_animation_speed);
45794606 ClassDB::bind_method (D_METHOD (" get_tile_animation_speed" , " atlas_coords" ), &TileSetAtlasSource::get_tile_animation_speed);
4607+ ClassDB::bind_method (D_METHOD (" set_tile_animation_mode" , " atlas_coords" , " mode" ), &TileSetAtlasSource::set_tile_animation_mode);
4608+ ClassDB::bind_method (D_METHOD (" get_tile_animation_mode" , " atlas_coords" ), &TileSetAtlasSource::get_tile_animation_mode);
45804609 ClassDB::bind_method (D_METHOD (" set_tile_animation_frames_count" , " atlas_coords" , " frames_count" ), &TileSetAtlasSource::set_tile_animation_frames_count);
45814610 ClassDB::bind_method (D_METHOD (" get_tile_animation_frames_count" , " atlas_coords" ), &TileSetAtlasSource::get_tile_animation_frames_count);
45824611 ClassDB::bind_method (D_METHOD (" set_tile_animation_frame_duration" , " atlas_coords" , " frame_index" , " duration" ), &TileSetAtlasSource::set_tile_animation_frame_duration);
@@ -4599,6 +4628,10 @@ void TileSetAtlasSource::_bind_methods() {
45994628 ClassDB::bind_method (D_METHOD (" _update_padded_texture" ), &TileSetAtlasSource::_update_padded_texture);
46004629 ClassDB::bind_method (D_METHOD (" get_runtime_texture" ), &TileSetAtlasSource::get_runtime_texture);
46014630 ClassDB::bind_method (D_METHOD (" get_runtime_tile_texture_region" , " atlas_coords" , " frame" ), &TileSetAtlasSource::get_runtime_tile_texture_region);
4631+
4632+ BIND_ENUM_CONSTANT (TILE_ANIMATION_MODE_DEFAULT )
4633+ BIND_ENUM_CONSTANT (TILE_ANIMATION_MODE_RANDOM_START_TIMES )
4634+ BIND_ENUM_CONSTANT (TILE_ANIMATION_MODE_MAX )
46024635}
46034636
46044637TileSetAtlasSource::~TileSetAtlasSource () {
0 commit comments