Thanks again Zini, made some small progress.
I was now able to get some data out of CSMWorld::UniversalId::Type_LandTextures. I decided to just cout everything to understand what's in there.
Code: Select all
//Load Land Texture Data
CSMDoc::Document& document = getWorldspaceWidget().getDocument();
CSMWorld::IdTable& ltexs = dynamic_cast<CSMWorld::IdTable&> (
*document.getData().getTableModel (CSMWorld::UniversalId::Type_LandTextures));
//Temporary code for debugging purposes
std::cout << "rowCount: " << ltexs.rowCount() << std::endl;
std::cout << "columnCount: " << ltexs.columnCount() << std::endl;
for( int i = 0; i < ltexs.rowCount(); i = i + 1 ) {
for( int j = 0; j < ltexs.columnCount(); j = j + 1 ) {
QModelIndex index = ltexs.index(i,j);
QVariant qv = ltexs.data(index, 0); //return mColumns.at (column)->get (mRecords.at (index));
QString qs = qv.toString();
std::string utf8_text = qs.toUtf8().constData();
std::cout << "Typename: " << qv.typeName() << ", i = " << i << ", j = " << j << ", value = "<< utf8_text << std::endl;;
}
}
The result is something like this:
Code: Select all
Typename: QString, i = 0, j = 0, value = L0#0
Typename: int, i = 0, j = 1, value = 2
Typename: int, i = 0, j = 2, value = 90
Typename: QString, i = 0, j = 3, value = Sand
Typename: int, i = 0, j = 4, value = 0
Typename: int, i = 0, j = 5, value = 0
Typename: QString, i = 0, j = 6, value = Tx_sand_01.tga
Typename: QString, i = 1, j = 0, value = L0#1
Typename: int, i = 1, j = 1, value = 2
Typename: int, i = 1, j = 2, value = 90
Typename: QString, i = 1, j = 3, value = Rock_Coastal
Typename: int, i = 1, j = 4, value = 0
Typename: int, i = 1, j = 5, value = 1
Typename: QString, i = 1, j = 6, value = Tx_coastal_rock_01.tga
Typename: QString, i = 2, j = 0, value = L0#2
Typename: int, i = 2, j = 1, value = 2
Typename: int, i = 2, j = 2, value = 90
Typename: QString, i = 2, j = 3, value = Road Dirt
Typename: int, i = 2, j = 4, value = 0
Typename: int, i = 2, j = 5, value = 2
Typename: QString, i = 2, j = 6, value = Tx_dirtroad_01.tga
...
So it seems to be in order:
1 = L0#[TEXTURENUMBER]
2 = 2
3 = 90
4 = [NICKNAME]
5 = 0
6 = [INT] (is this the one used as id in land texture grids?)
7 = [FILENAME]
Zinnslagh at Github: "There is also CSMWorld::UniversalId::Type_Textures, which lists all bitmap resources via their filename." That would be the next data structure to understand, does it have all textures loaded as bitmaps?
I also tried to get my brush buttons (that are modebuttons, submode) to accept drag&drop, but was unable to do so. For debugging, I tested setAcceptDrops(true) to almost every constructor I could think of and tried making new dropEvent's and dragEnterEvent's with event->acceptProposedAction() under CSVWidget::ModeButton, CSVWidget::BrushButton (new class I briefly tried to create), and to CSVRender::TerrainTextureMode. Nothing seemed to work, there is something blocking the drag somewhere. On the other hand, I was able to enable dragging to TerrainTextureMode via worldspacewidget, but that doesn't really provide the functionality of dragging texture to brush.