Skip to content

Fixed an issue related to Wings3D not saving objects' status#637

Open
Micheus wants to merge 1 commit into
dgud:masterfrom
Micheus:mv/v2.4.1-fix-unsaved-properties
Open

Fixed an issue related to Wings3D not saving objects' status#637
Micheus wants to merge 1 commit into
dgud:masterfrom
Micheus:mv/v2.4.1-fix-unsaved-properties

Conversation

@Micheus

@Micheus Micheus commented Jan 22, 2026

Copy link
Copy Markdown
Collaborator

It was noticed that changes to visibility, lock, wire, and selection in the Geometry Graph window were not being stored when the file had already been saved. To fix this, these actions now mark the file as needing to be saved.

Note:
Fixed some objects' properties (like visibility) not been saved. Thanks to ozylot

It was noticed that changes to visibility, lock, wire, and selection in the
Geometry Graph window were not being stored when the file had already been
saved. To fix this, these actions now mark the file as needing to be saved.

Note:
Fixed some objects' properties (like visibility) not been saved. Thanks to ozylot
@dgud

dgud commented Apr 23, 2026

Copy link
Copy Markdown
Owner

Issues:

  1. need_save is sent unconditionally, even for selection changes. col_name(0) returns fun selection/3.
    Selecting/deselecting an object is not a saveable state change — it's a transient UI state. Yet this code will mark
    the file as modified when the user merely clicks an object in the list to select it. That's a false positive: the
    user gets prompted "Save changes?" on close even though nothing saveable changed.

    The other actions (visibility/col 2, lock/col 3, wire/col 4) do modify persistent object state and legitimately
    need the save flag. But selection (col 0) does not.

    Fix: Either send need_save conditionally based on Col, or move the need_save into the individual action functions
    (visibility/3, lock/3) rather than the generic dispatch point. For example:

    Apply = fun(St) ->
    Action(Id, Op, St),
    case Col of
    0 -> keep; %% selection change, not saveable
    _ -> wings_wm:psend(geom, need_save)
    end
    end,

  2. wire/3 is also debatable. Looking at the wire/3 function (line 193), wireframe display is a per-window property
    stored in wings_wm:set_prop(Client, wireframed_objects, W) — it's a view property, not part of the saved .wings file
    data. Sending need_save for wire toggle changes would also be a false positive.

    So really, only visibility/3 (col 2) and lock/3 (col 3) modify persistent state (they change perm on the object
    via wings_obj:hide/unhide/lock/unlock).

  3. No undo interaction. The actions like visibility/3 and lock/3 call send_client({update_state, St}) which bypasses
    the undo system (it's not {new_state, St} with undo push). This means the user can't undo a visibility toggle, but
    the file is now marked dirty. That's a pre-existing design choice, but worth noting: if the user accidentally hides
    an object and then "undoes" it manually, the save flag stays dirty. Not a regression from this PR, just an

  4. Return value is correct. wings_wm:psend/2 returns keep, matching the old code's explicit keep. The forward_event
    dispatch for {apply, false, Fun} uses the return value directly, so this is safe.

@Micheus

Micheus commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator Author

The issue was reported on Discord:

When I save and close, the objects that were set to wireframe are not saved, requiring extra steps on resuming a project with various internal parts. It might be nice to come back exactly where you left off.

I understand that, because with a lot of elements in a scene, sometimes at the end of the day reviewing, we may just show something previously hidden and turn it back and leave the project losing that information.

  1. Yet this code will mark the file as modified when the user merely clicks an object in the list to select it. That's a false positive: the user gets prompted "Save changes?" on close even though nothing saveable changed.

It's already works this way. You can check.
But, it does nothing for hiding, locking or wire mode which may be useful to keep they saved in case the user wants to start this way next time.

  1. wire/3 is also debatable.
    Indeed. That may be reported and I also agree because despite it be a per-window state I'm not sure most the users work on other than the default Geometry window. I'm one that don't use. Since the commands cannot be ran across the windows. If I'm not wrong, in the past, you already had recommended me avoid to use many geoms at once.

What we could do to improve this instead of tell the user: you will need to select and deselect anything before you leave the program - this way the hide/lock option will be stored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants