3D editing

Involved development of the OpenMW construction set.
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: 3D editing

Post 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?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: 3D editing

Post 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.
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: 3D editing

Post 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.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: 3D editing

Post 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.
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: 3D editing

Post by cc9cii »

EDIT: scratch some rubbish written earlier

This line in PosColumn::set() overwrites the modified record

Code: Select all

record.setModified (record2);
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
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: 3D editing

Post 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?
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: 3D editing

Post 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.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: 3D editing

Post 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.
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: 3D editing

Post 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.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: 3D editing

Post by Zini »

Alright. What are we missing then? Mouse picking of pathgrid elements? And filtering of what is selectable based on the edit mode?
Post Reply