diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/tile_set.cpp | 19 | ||||
-rw-r--r-- | scene/resources/tile_set.h | 3 |
2 files changed, 14 insertions, 8 deletions
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 5256803d56..e2704316e8 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -3359,6 +3359,10 @@ void TileSetAtlasSource::set_tile_set(const TileSet *p_tile_set) { } } +const TileSet *TileSetAtlasSource::get_tile_set() const { + return tile_set; +} + void TileSetAtlasSource::notify_tile_data_properties_should_change() { // Set the TileSet on all TileData. for (KeyValue<Vector2i, TileAlternativesData> &E_tile : tiles) { @@ -3932,13 +3936,17 @@ void TileSetAtlasSource::set_tile_animation_frames_count(const Vector2i p_atlas_ ERR_FAIL_COND_MSG(!tiles.has(p_atlas_coords), vformat("TileSetAtlasSource has no tile at %s.", Vector2i(p_atlas_coords))); ERR_FAIL_COND(p_frames_count < 1); + int old_size = tiles[p_atlas_coords].animation_frames_durations.size(); + if (p_frames_count == old_size) { + return; + } + TileAlternativesData &tad = tiles[p_atlas_coords]; bool room_for_tile = has_room_for_tile(p_atlas_coords, tad.size_in_atlas, tad.animation_columns, tad.animation_separation, p_frames_count, p_atlas_coords); ERR_FAIL_COND_MSG(!room_for_tile, "Cannot set animation columns count, tiles are already present in the space the tile would cover."); _clear_coords_mapping_cache(p_atlas_coords); - int old_size = tiles[p_atlas_coords].animation_frames_durations.size(); tiles[p_atlas_coords].animation_frames_durations.resize(p_frames_count); for (int i = old_size; i < p_frames_count; i++) { tiles[p_atlas_coords].animation_frames_durations[i] = 1.0; @@ -4858,6 +4866,9 @@ real_t TileData::get_constant_angular_velocity(int p_layer_id) const { void TileData::set_collision_polygons_count(int p_layer_id, int p_polygons_count) { ERR_FAIL_INDEX(p_layer_id, physics.size()); ERR_FAIL_COND(p_polygons_count < 0); + if (p_polygons_count == physics.write[p_layer_id].polygons.size()) { + return; + } physics.write[p_layer_id].polygons.resize(p_polygons_count); notify_property_list_changed(); emit_signal(SNAME("changed")); @@ -5063,9 +5074,6 @@ bool TileData::_set(const StringName &p_name, const Variant &p_value) { ERR_FAIL_COND_V(layer_index < 0, false); if (components[1] == "polygon") { Ref<OccluderPolygon2D> polygon = p_value; - if (!polygon.is_valid()) { - return false; - } if (layer_index >= occluders.size()) { if (tile_set) { @@ -5137,9 +5145,6 @@ bool TileData::_set(const StringName &p_name, const Variant &p_value) { ERR_FAIL_COND_V(layer_index < 0, false); if (components[1] == "polygon") { Ref<NavigationPolygon> polygon = p_value; - if (!polygon.is_valid()) { - return false; - } if (layer_index >= navigation.size()) { if (tile_set) { diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 71559074e7..756d235090 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -613,6 +613,7 @@ protected: public: // Not exposed. virtual void set_tile_set(const TileSet *p_tile_set) override; + const TileSet *get_tile_set() const; virtual void notify_tile_data_properties_should_change() override; virtual void add_occlusion_layer(int p_index) override; virtual void move_occlusion_layer(int p_from_index, int p_to_pos) override; @@ -766,7 +767,7 @@ private: }; Vector2 linear_velocity; - float angular_velocity = 0.0; + double angular_velocity = 0.0; Vector<PolygonShapeTileData> polygons; }; Vector<PhysicsLayerTileData> physics; |