Skip to content

allow returned camera params to be set back#3408

Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:camera-params
Nov 15, 2025
Merged

allow returned camera params to be set back#3408
j9ac9k merged 1 commit intopyqtgraph:masterfrom
pijyoi:camera-params

Conversation

@pijyoi
Copy link
Copy Markdown
Contributor

@pijyoi pijyoi commented Nov 2, 2025

The return value of cameraParams() should be usable to restore the camera state.

Before this PR, the following would need to be done

win = GLViewWidget(rotationMethod='quaternion')
cp = win.cameraParams()
del cp['elevation']
del cp['azimuth']
win.setCameraParams(**cp)

After this PR, the following will work

win = GLViewWidget(rotationMethod='quaternion')
cp = win.cameraParams()
win.setCameraParams(**cp)

fixes #3407

Additional fixes:

  1. reset() did not reset the default in quaternion mode.

NOTES:

  1. Irrespective of the rotationMode, either rotation or (elevation, azimuth) can be used to modify camera params. However, rotationMode determines which internal state gets modified.

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Nov 15, 2025

Love to see the 3D stuff get some attention, thanks @pijyoi

@j9ac9k j9ac9k merged commit eb2ae11 into pyqtgraph:master Nov 15, 2025
36 checks passed
@pijyoi pijyoi deleted the camera-params branch November 15, 2025 15:45
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.

GLViewMixin.setCameraParams is incompatible with GLViewMixin.cameraParams

2 participants