Page 2 of 4
Re: 3D editing
Posted: 02 Nov 2014, 10:38
by cc9cii
Getting stuck on the command stuff atm. I've got something like this (referenceId I'm testing is "ref#89954" without the quotes - is that string in the correct format?):
Code: Select all
QAbstractItemModel *model = mDocument.getData().getTableModel(CSMWorld::UniversalId::Type_Reference);
const CSMWorld::RefCollection& references = mDocument.getData().getReferences();
int columnIndexPosX = references.findColumnIndex(CSMWorld::Columns::ColumnId_PositionXPos);
mDocument.getUndoStack().push(new CSMWorld::ModifyCommand(*model,
static_cast<CSMWorld::IdTable *>(model)->getModelIndex(referenceId, columnIndexPosX),
result.second.x));
Three issues:
* If I have the References table open, the document seems to be locked. How do I unlock it? (actually I don't really know if it is locked, just guessing)
* Without above unlocking, how can I test to see if my code is making the correct change to the document?
* Am I meant to update each entry separately? (i.e. x, y, z) of is there a way to update all three at once?
Re: 3D editing
Posted: 02 Nov 2014, 11:04
by Zini
* If I have the References table open, the document seems to be locked. How do I unlock it?
* Without above unlocking, how can I test to see if my code is making the correct change to the document?
Don't know what you mean by that. If you mean the edit lock, that shouldn't be triggered in this case.
Am I meant to update each entry separately? (i.e. x, y, z) of is there a way to update all three at once?
You need to use separate commands, but you can group them up with the beginMacro/endMacro function of the undo stack.
Re: 3D editing
Posted: 02 Nov 2014, 11:23
by cc9cii
Zini wrote:* If I have the References table open, the document seems to be locked. How do I unlock it?
* Without above unlocking, how can I test to see if my code is making the correct change to the document?
Don't know what you mean by that. If you mean the edit lock, that shouldn't be triggered in this case.
I think I got confused because the value wouldn't change. For some reason I can't manually edit the position of the reference from the References table, either. The one I'm using to test is "Gold_025" in Cell "#-2 -10" (the one inside the tree stump next to a goblet)
EDIT: it looks like Object::referenceDataChanged() is calling update() and adjust() and overwriting the changes. For some reason reference.mPos.pos[0], etc, do not change and hence the original position is set each time.
Re: 3D editing
Posted: 02 Nov 2014, 19:53
by Zini
I can confirm this bug. Coordinate editing in the table does not work. Unless you manage to fix it before that, I will have a look at the problem tomorrow.
Re: 3D editing
Posted: 02 Nov 2014, 21:11
by cc9cii
EDIT: scratch some rubbish written earlier
This line in PosColumn::set() overwrites the modified record
Gut feeling says there is a typo:
Code: Select all
ESM::Position& position = record.get().*mPosition;
should be record2 I think.
Just tested it. It should be as below (also similar change for rotation)
Code: Select all
ESM::Position& position = record2.*mPosition;
EDIT: fix pushed as part of the mouse-picking change set
Re: 3D editing
Posted: 03 Nov 2014, 10:21
by Zini
Yeah. That was the problem. Can you please file that as an issue on the tracker (set to closed state), so we have that problem on file?
Re: 3D editing
Posted: 04 Nov 2014, 07:04
by cc9cii
Zini wrote:Yeah. That was the problem. Can you please file that as an issue on the tracker (set to closed state), so we have that problem on file?
Done
About terrain editing - how is this intended to work? Is the idea to pick a vertex and move it? If so it would be tedious chore for anything other than a minor edit/fix.
Re: 3D editing
Posted: 04 Nov 2014, 09:32
by Zini
We will have a selection of tools for terrain editing. I haven't worked out the details yet. For now we only need the ability to detect clicks on terrain when in one of the terrain editing modes.
Re: 3D editing
Posted: 04 Nov 2014, 10:48
by cc9cii
Zini wrote:For now we only need the ability to detect clicks on terrain when in one of the terrain editing modes.
We already have that.
I'll get on with moving physics out of OEngine. It looks like "dropping" will require some physics code and I'd rather not touch OEngine lest I break OpenMW.
Re: 3D editing
Posted: 04 Nov 2014, 18:46
by Zini
Alright. What are we missing then? Mouse picking of pathgrid elements? And filtering of what is selectable based on the edit mode?