disabling selection highlighting in the preferences breaks FC

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

disabling selection highlighting in the preferences breaks FC

Post by uwestoehr »

While playing with the preferences, I broke my FreeCAD. It took me a while to figure out what happened since first resetting the preferences to standard fixed it.

The issue is the option to enable the selection highlighting: In the preferences under Display -> Colors, uncheck "Enable section highlighting"

Then you can no longer attach objects, select edges for measurements and even more as other users reported:
https://forum.freecadweb.org/viewtopic. ... 95#p608895

I had a look because this should be fixed for 0.20.1 because as user you will be lost and FC is kind of unusable. You guessed it ;) - I could not yet find out what is happening. I haven't yet worked with the selection code. Therefore any help is appreciated.
Syres
Veteran
Posts: 2902
Joined: Thu Aug 09, 2018 11:14 am

Re: disabling selection highlighting in the preferences breaks FC

Post by Syres »

Seeing as there's not been a reply here, this is an educated guess but have you looked in src\Gui\SoFCSelectionContext.cpp ?

I'm not completely on the same page as you with your goal as I've always (probably incorrectly) been of the understanding that if the user can't see the selected edges clearly with a different colour then would/should the user be carrying out the selection in the first place, maybe I'm not understanding what you have in mind.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: disabling selection highlighting in the preferences breaks FC

Post by openBrain »

Had a (very) quick look into a code but can't find anything obvious. Admittedly the selection mechanism is a complex beast. :)
Will see if I can get more time on this.
Probably @wmayer has the best knowledge of it here.
vm4dim
Posts: 130
Joined: Tue Nov 23, 2021 1:05 am

Re: disabling selection highlighting in the preferences breaks FC

Post by vm4dim »

This checkbox state is saved with the name "EnableSelection" not as "EnableSelection_Highlighting" or "EnableSelection_Color"
and seems it really used in the code as Enable/Disable Selection not as Enable/Disable Highlighting.
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: disabling selection highlighting in the preferences breaks FC

Post by wmayer »

In the preferences we have these two options:
Enable preselection highlighting and Enable selection highlighting

In order to find the object underneath the current mouse position a SoRayPickAction must be performed on the scene graph and the shape nodes must deliver each point, line segment or triangle in order to find the intersection points. This is a very expensive operation and for objects with 100,000 or millions of triangles this can be very slow. For the pre-selection this is even worse because the operation is performed for every little mouse move event.

That's why the options have been implemented to disable the pre-selection or selection completely.

Now some users might be confused about the options because they think it's only about to disable the visual feedback, i.e. not to show the (pre-)selected geometry but this expectation is wrong.

The options directly affect the settings of the SoFCUnifiedSelection class that takes care of them in its handleEvent() method.

Now each view provider has a property called Selectable and it uses the same parameter (EnableSelection) as SoFCUnifiedSelection to initialize its default value. Maybe using a different parameter here would be good to better distinguish between the selection per 3D view and per object in the document.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: disabling selection highlighting in the preferences breaks FC

Post by Zolko »

wmayer wrote: Mon Jul 18, 2022 11:01 am For the pre-selection this is even worse because the operation is performed for every little mouse move event.
yes, I've experienced that also: for very large assemblies, I have to disable pre-selection highlighting because the systems becomes so slow as to be close to un-usable when simply rotating and moving the model in the 3D window. Unfortunately, the selection itself becomes much more difficult when the pre-selection is not available.

Would it be possible to add a slight delay so that the objects under the mouse are highlighted only after some time ? Something like 0.1s of still mouse might make a huge difference, or even a setting in the preferences.
try the Assembly4 workbench for FreCAD — tutorials here and here
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: disabling selection highlighting in the preferences breaks FC

Post by wmayer »

Zolko wrote: Mon Jul 18, 2022 11:21 am Would it be possible to add a slight delay so that the objects under the mouse are highlighted only after some time ? Something like 0.1s of still mouse might make a huge difference, or even a setting in the preferences.
Yes, this should be doable. And yes there should be a setting in the preferences. Can you open a ticket, please?
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: disabling selection highlighting in the preferences breaks FC

Post by Zolko »

wmayer wrote: Mon Jul 18, 2022 1:06 pm Can you open a ticket, please?
thank-you, done : #7214
try the Assembly4 workbench for FreCAD — tutorials here and here
user1234
Veteran
Posts: 3512
Joined: Mon Jul 11, 2016 5:08 pm

Re: disabling selection highlighting in the preferences breaks FC

Post by user1234 »

jfyi: itis a long kniwn issue, see https://forum.freecad.org/viewtopic.php?f=3&t=32251.

i also sugesstet the same here, see https://forum.freecad.org/viewtopic.php ... 10#p269607.

Thanks for working on it!


Greetings
user1234
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: disabling selection highlighting in the preferences breaks FC

Post by openBrain »

wmayer wrote: Mon Jul 18, 2022 11:01 am Now some users might be confused about the options because they think it's only about to disable the visual feedback, i.e. not to show the (pre-)selected geometry but this expectation is wrong.
I think we can improve a bit the UI of the preferences to make it clearer. ;) I have to admit there is some room for improvement there.
Maybe using a different parameter here would be good to better distinguish between the selection per 3D view and per object in the document.
Agree, but not of high priority IMO as I think only a handful of users actually disable the selection.
Zolko wrote: Mon Jul 18, 2022 11:21 am yes, I've experienced that also: for very large assemblies, I have to disable pre-selection highlighting because the systems becomes so slow as to be close to un-usable when simply rotating and moving the model in the 3D window. Unfortunately, the selection itself becomes much more difficult when the pre-selection is not available.
First thing here is probably that (if not the case yet, this is what I understand from your experience) pre-selection computation should not happen when rotation/panning the view (with the mouse). It's totally useless.
wmayer wrote: Mon Jul 18, 2022 1:06 pm
Zolko wrote: Mon Jul 18, 2022 11:21 am Would it be possible to add a slight delay so that the objects under the mouse are highlighted only after some time ? Something like 0.1s of still mouse might make a huge difference, or even a setting in the preferences.
Yes, this should be doable. And yes there should be a setting in the preferences. Can you open a ticket, please?
Do you think it would be possible to have an auto-adaptive mechanism ? It may be based on number of topological objects on the model/screen, or even better based on the actual time of computation of the pre-selection.
Post Reply