Repository navigation
Conversation
getRotation/getTranslation returned Camera::object_rot/object_trans internal coordinates, which disagree with the values every other interface exposes ($vpr/$vpt, Viewport Control, Copy viewport values). Use Camera::getVpr()/getVpt() so the D-Bus getters agree with the UI. translateTo()/rotateTo() now speak the same user-facing dialect: absolute translate events were scaled by 0.001*zoom on X/Z in MainWindow::onTranslateEvent, so they never round-tripped. Absolute events now go through QGLView::setVpt/setVpr (new, mirroring zoomFov) which also emit cameraChanged so Viewport Control refreshes. Add getDistance/getFov/getProjection for the remaining viewport state, honor registerObject/registerService failures so a second instance reports not-open instead of a bogus open, and name getTranslation's out arg correctly in the introspection xml. Issue openscad#6940 (viewport state part; window identity and packaging stay open there)
jordanbrown0
left a comment
There was a problem hiding this comment.
I am a little worried about the potential compatibility hits here.
It is not clear to me how many real DBus consumers there are, or what their usage looks like. It might be good to get feedback from @MichaelPFrey and @Lenbok, who seem to be DBus users.
If the compatibility hit is too large, the workaround does not seem onerous: deprecate the existing methods and introduce new methods with new names - probably with "2" appended.
In theory this is a compatibility hit for InputEventTranslate with viewPortRelative=false and relative=false, and for InputEventRotate with relative=false. We need to inspect other input event drivers to see if they can ever use those variants.
|
This seems fine in terms of not impacting my existing use at all, which to date has only been setters rather than getters. |
|
Built and tested PR 7035 at commit Viewport GettersLive D-Bus introspection exposed all expected methods, including the new getters:
The initial viewport returned: The absolute setter/getter round trip succeeded exactly: The viewport was then restored to translation A manually rotated and translated viewport was also compared directly with Window > Viewport Control: The translation difference is only display rounding; all values agree at the precision shown in the UI. This verifies on Windows that the PR fixes the old absolute translation scaling problem, uses the user-facing viewport representation, and supplies the missing distance, FOV, and projection getters. Process RegistrationTwo independent PR-build processes were then started. A second process left at the startup chooser was not a valid test: the source shows that the chooser completes before The second process was therefore launched with a SCAD file so it initialized fully. The first process retained ownership of In the initialized second process, Edit > Preferences > Axes is expected to show: The console-captured error was: Qt supplied no detail after the colon. The registration failure and object cleanup are verified on Windows; the missing error detail is a remaining diagnostic limitation. No message appeared in the GUI Console or Error Log, which is consistent with the startup order. |

extends the existing D-Bus input driver so the viewport state it reports is actually usable from outside, following the direction in #6940.
getters now speak the user-facing dialect. getRotation()/getTranslation() used to return Camera::object_rot/object_trans, the internal camera coordinates. the values Viewport Control, $vpr/$vpt and the Copy viewport values menu entries show are Camera::getVpr()/getVpt(), a different representation. so a getter and the ui could disagree about the same viewport, which is exactly the confusion reported in the issue (Viewport Control [33.30, 0, 148.20] vs dbus [56.7, 0, 211.8]). the getters now return the same values every other interface exposes.
rotateTo/translateTo now take the same values the getters return. translateTo had a worse problem: MainWindow::onTranslateEvent scaled X and Z by 0.001 * zoomValue() before applying, so translateTo(10, 20, 30) at distance 140 landed at vpt [1.4, 20, 4.2] and never round-tripped. that scaling is right for relative device motion but wrong for an absolute target, so absolute events now go through Camera::setVpt()/setVpr() (via new QGLView::setVpt/setVpr, which emit cameraChanged like the other view mutators so Viewport Control refreshes). relative translate/rotate behavior is unchanged.
missing data items: getDistance() (vpd), getFov() (vpf) and getProjection() ("PERSPECTIVE"/"ORTHOGONAL") through the same chain, plus getTranslation's out arg is now actually named translation in the introspection xml.
registration failures are honored. the driver ignored the return of registerObject()/registerService() and reported open either way, so a second OpenSCAD process showed "DBusInputDriver open" in Axes while being unreachable through the well-known name. open() now returns false and logs the reason. multi-session identity itself is deliberately not addressed here, that design question is still open in the issue.
Related to #6940. This covers viewport state; window identity and packaging remain open.
Testing
built on macOS (qt 6.11, ENABLE_QTDBUS on) and exercised the live service over the session bus with dbus-send:
this is gui/session-bus behavior so there is no unit test seam for it in this repo (tests are cmdline .scad based and dont reach MainWindow/QGLView). the mechanical half (xml generates a matching adaptor/proxy, clang-format clean) is covered by the Beautify check.
Scope