Adding doormarkers to OpnMW CS

Involved development of the OpenMW construction set.
Post Reply
User avatar
bwhaines
Posts: 6
Joined: 01 May 2017, 18:18
Location: East Coast US

Adding doormarkers to OpnMW CS

Post by bwhaines »

I've started looking though code and playing with the CS, and I've had a couple of ideas on how to add doormarkers.

1) Adding a "Doormarker" record object

It would have probably have a boolean to determine if it's active, a door, and destination coordinates as attributes.

2) Adding doormarker attributes to the "Door" record object

It would need a boolean for if it has a marker and a destination. This would probably take a little more backend work, but keep things a little simpler for users.

I don't have a good grasp on how the whole project is structured, so maybe someone with more experience can say what would fit into the project best.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Adding doormarkers to OpnMW CS

Post by Zini »

First, wrong forum. This belongs into Editor Development. Can someone move it please?

Anyway, this is a difficult one. The main problem here is that the door marker data exists as a part of the door instance and not as a separate entity in the editor.

We could add fake door-marker instances. But that is an awful amount of special code (mostly during loading and saving, but probably also in a few other cases).

And then we need to figure out how to implement the editor functions for door markers. We don't really want a separate editing mode for them. Making the marker a fake instance would allow normal editing functions for movement to work. But we would have to disable scaling. Deleting is probably another issue. And I have no idea how to do adding within the current GUI.

Sorry, that is all I got for now. Very tricky problem.

btw. please take a look at the function Door::activate in apps/openmw/mwclass/door.cpp, if you haven't done so yet.
User avatar
Jyby
Posts: 408
Joined: 10 Dec 2013, 04:16

Re: Adding doormarkers to OpnMW CS

Post by Jyby »

Moved to Editor Development
User avatar
bwhaines
Posts: 6
Joined: 01 May 2017, 18:18
Location: East Coast US

Re: Adding doormarkers to OpnMW CS

Post by bwhaines »

I've read through door.cpp a couple of times, but I'm not seeing where the marker data is stored in the class, unless I'm misunderstanding the point of the ContainerStore object.

The GUI issue is tricky. I'm not seeing any way to edit the door's data from the Scene view, but it seems like adding a column in the Objects view wouldn't be difficult.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Adding doormarkers to OpnMW CS

Post by Zini »

I've read through door.cpp a couple of times, but I'm not seeing where the marker data is stored in the class, unless I'm misunderstanding the point of the ContainerStore object.
The Door class does not have any state. It just handles instances of the door type. Like all instance data the door marker information is stored in the LiveCellRef (more specificly in the CellRef part of that).
The GUI issue is tricky. I'm not seeing any way to edit the door's data from the Scene view, but it seems like adding a column in the Objects view wouldn't be difficult.
Instance (a.k.a. references) table, not object. Object (a.k.a. IDs or referencables) don't have door marker data. And this feature already exists. You can edit the door markers from within the instance tables.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Adding doormarkers to OpnMW CS

Post by Zini »

Gave the issue some more thought.

Enabling door markers from the instance table (or the instance dialogue subview) should be sufficient for now. Same for setting the cell.

If we are going with my original concept, this will require the following steps:
- Load-code: Identify all instances that are have mTeleport set. For this implicitly add a second instance that references the same ID with the string $doormarker appended to it.
- Save-code: Ignore all instances that have IDs ending on $doormarker but set teleport information (location/rotation) of the door according to the values of the ignored instance.
- Strip out the teleport location/rotation columns from the instance table. These fields will from now on stay unused (except during loading/saving) because otherwise we would store the data twice.
- Merge-code: Not quite sure. May work out of the box. Requires testing.
- Rendering-code: When rendering an instance with an ID ending on $doormarker render the door marker mesh.

Here comes the difficult part:
We still need to keep door marker instance records and door instances in sync. Points to consider:
- Deleting/Creating (both door and door marker).
- Changes to the teleport flag and teleport cell columns.
We will either need custom commands or modify the command generation process.
Post Reply