TileMapLayer's set_cell() not working properly from GDExtension.

Godot Version

4.3

Question

Hi! I’m using GDExtension to create a function that gets a TileMapLayer and should set some cells at specific coordinates:

void OverlappingModel::PaintFullPattern(gd::TileMapLayer* patternMap, int nodeX, int nodeY, int patternID) {
    int xmax = 3; // patternSize
    int ymax = 3; // patternSize

    for (int y = 0; y < ymax; ++y) {
        for (int x = 0; x < xmax; ++x) {
            int16_t tileID = patterns[patternID][x + y * patternSize];
            if (tileID < -1) {
                gd::UtilityFunctions::print(patternID, " - Source ID: ", groundProp.SourceID);
                gd::UtilityFunctions::print(patternID, " - Atlas X: ", groundProp.AtlasX);
                gd::UtilityFunctions::print(patternID, " - Atlas Y: ", groundProp.AtlasY);
                gd::UtilityFunctions::print(patternID, " - Alter ID: ", groundProp.AlterID);
                patternMap->set_cell(gd::Vector2i(nodeX + x, nodeY + y), groundProp.SourceID, gd::Vector2i(groundProp.AtlasX, groundProp.AtlasY), groundProp.AlterID);
            }
        }
    }
}

With the prints I get SourceID = 0, AtlasX = 1, AtlasY = 1 and AlterID = 0. When I use this function in Godot, the cells printed have both AtlasX and AtlasY = 0, but they’re printed at the right location. I don’t know why the Atlas coordinates change, because in my TileSet I can see that they exist (there is a tile in the TileSet with the properties seen before).

Any help would be much appreciated, I’m a bit in a hurry and I’ve been working on this all day with no results. Thanks!