Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gui: Added FreeTurntable orbit style #8048

Merged
merged 4 commits into from
Dec 20, 2022

Conversation

nab-os
Copy link
Contributor

@nab-os nab-os commented Dec 15, 2022

Adding a second Turntable orbit style but without primary rotation selection.
This aims to offer an environment similar to Blender.

Thank you for creating a pull request to contribute to FreeCAD! Place an "X" in between the brackets below to "check off" to confirm that you have satisfied the requirement, or ask for help in the FreeCAD forum if there is something you don't understand.

  • Your Pull Request meets the requirements outlined in section 5 of CONTRIBUTING.md for a Valid PR

Please remember to update the Wiki with the features added or changed once this PR is merged.
Note: If you don't have wiki access, then please mention your contribution on the 1.0 Changelog Forum Thread.


@github-actions github-actions bot added the Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD label Dec 15, 2022
@freecadci
Copy link

pipeline status for feature branch PR_8048. Pipeline 723462308 was triggered at 664aca7. All CI branches and pipelines.

@luzpaz luzpaz changed the title Added FreeTurntable orbit style Gui: Added FreeTurntable orbit style Dec 15, 2022
@luzpaz
Copy link
Contributor

luzpaz commented Dec 15, 2022

I'm pretty sure the .ts file gets overwrittem when it's generated from Qt's lupdate command.

src/Gui/Language/FreeCAD.ts Outdated Show resolved Hide resolved
@freecadci
Copy link

pipeline status for feature branch PR_8048. Pipeline 725915507 was triggered at d7b8402. All CI branches and pipelines.

@donovaly
Copy link
Member

Many thanks for your PR. I tested it but need a brief description what the difference of this style to the Trackball style is.

@nab-os
Copy link
Contributor Author

nab-os commented Dec 19, 2022

Yeah sure.
A Turntable is used to keep the world's Z axis collinear with the screen's Y axis.
The already existing Turntable orbit mode is only rotating on the X or Z axis depending on how you moved your mouse/controller.

SbVec3f dif = point1 - point2;
if (fabs(dif[1]) > fabs(dif[0])) {
[...] //rotate around the Z axis
} else {
[...] //rotate around the X axis
}

This is useful to create rotating animations of your object as you are sure to make a perfect circle around it.
Using it to work on an object is frustrating because if you move your mouse diagonally only one axis will be transformed.

The FreeTurntable that I added does not select an axis before applying transformations, both mouse's X and Y movements are taken into account. The goal is to replicate Blender's orbit style.

So the difference to the Trackball is the need for the world's Z axis to stay aligned with the screen's Y axis.
The FreeTurntable has a slight drift and it looses the alignment after some transformations but I couldn't do better.
But after using it for about a month almost everyday, it is not that annoying because each time we get perpendicular to a face, it realigns the Z axis.

@nab-os
Copy link
Contributor Author

nab-os commented Dec 19, 2022

For example,
Here, I started from the same face each time, and I rotated the object by moving my mouse diagonally for the same distance for both.

With the Trackball orbit style we can see that the Z axis is not aligned with the screen's Y axis:
2022-12-19-07_23_42

And with the FreeTurntable orbit style, it still is:
2022-12-19-07_24_06

That's because the Trackball takes the direct transformation between the last and current mouse position whereas for the FreeTurntable the transformation is divided into two movements: around the object and up/down movement both being relative to the screen's referential.

Copy link
Member

@donovaly donovaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I only encounter an issue when setting the orbit style via the footer in the FreeCAD main Window

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>500</width>
<height>391</height>
<height>472</height>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

80 pixels more for one additional setting seems strange

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qt Designer modified this.
That's the first time I use it, so maybe I touched something I shouldn't have.
Should I revert this directly by editing the .ui file ?

if (zaxis[1] < 0) {
if (dif[0] < 0)
else if (orbit == Turntable) {
// 0000333: Turntable camera rotation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the 0000333 mean? I know this is not your code but maybe you have an idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, it was there before so I didn't want to touch it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the old.ticket numbering format for the mantis bug tracker. It's linking to ticket: https://tracker.freecadweb.org/view.php?id=333

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh great, so now that we have both possibilities, should we remove this comment ?

aTurntable.setChecked(True)
else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see an issue here because when using the menu, I don't get the orbit style I want (I cannot set Turntable). Why not set an if, elif, elif to catch all possible 3 orbit styles?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this ?

@donovaly
Copy link
Member

That's because the Trackball takes the direct transformation between the last and current mouse position whereas for the FreeTurntable the transformation is divided into two movements: around the object and up/down movement both being relative to the screen's referential.

Thanks. I understand now. In general, we need to improve the Wiki to explain the differences better. Let's do this after this PR is merged.

@freecadci
Copy link

pipeline status for feature branch PR_8048. Pipeline 726614332 was triggered at 2121a98. All CI branches and pipelines.

@freecadci
Copy link

pipeline status for feature branch PR_8048. Pipeline 726621831 was triggered at df20075. All CI branches and pipelines.

@donovaly donovaly merged commit 9cda82c into FreeCAD:master Dec 20, 2022
@donovaly
Copy link
Member

Many thanks. I merged and fixed the remaining issue that you changed the default orbit style: 83a7c57

donovaly added a commit that referenced this pull request Dec 20, 2022
- the submenu ordering must be coherent to the one in the preferences combobox otherwise one gets the wrong orbit style displayed in the preferences dialog
@donovaly
Copy link
Member

There was another issue, I fixed now: 8b6797e

@donovaly
Copy link
Member

Finally, the docs must be updated. Can you please add your feature addition to our release notes, see the info text in your initial PR comment?

@donovaly
Copy link
Member

OK, I added it now to the release notes:
https://wiki.freecadweb.org/Release_notes_1.0#Further_user_interface_improvements

@donovaly
Copy link
Member

There was a further bug that the currently active orbit style was not correctly displayed in the status bar. I could fix this: #8072

@ifohancroft
Copy link
Contributor

ifohancroft commented Aug 2, 2023

Sorry for commenting on an already merged PR, but I wanted to thank you for implementing this.
Thank you! Now FreeCAD navigation is perfect for me (What I'm used to is the Revit navigation style and the Free Turntable. FreeCAD had the Revit navigation style ever since I started using it, but up until now I had to use the Turntable and it wasn't pleasant. Now it's perfect with the presence of the Free Turntable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mod: Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants