[ Solved ] Quickly switch background color

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
flachyjoe
Veteran
Posts: 1891
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

[ Solved ] Quickly switch background color

Post by flachyjoe »

Hi
Does exist a way to switch the 3D view background color without opening user preference panel?

I ask this because I use a white background for screenshot and the blue gradients one for modeling.

Thanks!
Last edited by flachyjoe on Thu Jul 19, 2018 9:07 am, edited 1 time in total.
- Flachy Joe -
Image
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Quickly switch background color

Post by microelly2 »

you can write your macro
just look, what are the roght color value for your case

rGrp=FreeCAD.ParamGet('User parameter:BaseApp/Preferences/View')
atr="HeadlightIntensity"
rGrp.SetInt(atr,100)
rGrp=FreeCAD.ParamGet('User parameter:BaseApp/Preferences/View')
atr="BackgroundColor"
rGrp.SetUnsigned(atr,1437270015)
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: Quickly switch background color

Post by chrisb »

flachyjoe wrote: Thu Jul 19, 2018 7:26 am I ask this because I use a white background for screenshot and the blue gradients one for modeling.
I recently worked on the wiki and would have appreciated such a whitening function.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
efyx
Posts: 280
Joined: Fri Sep 26, 2014 7:36 pm

Re: Quickly switch background color

Post by efyx »

chrisb wrote: Thu Jul 19, 2018 7:56 am I recently worked on the wiki and would have appreciated such a whitening function.
Good idea, but I wouldn't create new icons, maybe implement it into navi cube? Also I posted to add there option for draw styles (as whireframe, shaded etc..)
User avatar
flachyjoe
Veteran
Posts: 1891
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: Quickly switch background color

Post by flachyjoe »

Thank you !
Solved with :

Code: Select all

rGrp=FreeCAD.ParamGet('User parameter:BaseApp/Preferences/View')
attr = 'Gradient'
curval = rGrp.GetBool(attr)
rGrp.SetBool(attr, not curval)
Gui.activeView().redraw()
I manually set the simple color as white in user pref.
- Flachy Joe -
Image
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: [ Solved ] Quickly switch background color

Post by chrisb »

Could not get microelly2's code working. flachyjoe's works.

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13976 (Git)
Build type: Release
Branch: (HEAD detached at fae0de5)
Hash: fae0de58581694157a97d567c151bdce75d387dc
Python version: 2.7.15
Qt version: 5.11.0
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Germany (de_DE)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: [ Solved ] Quickly switch background color

Post by bejant »

flachyjoe wrote: Thu Jul 19, 2018 7:26 am I use a white background for screenshot
Tools > Save Picture > Extended button > Background = White (and result here with Insert Watermark ticked to True):
20180719a.png
20180719a.png (25.97 KiB) Viewed 3285 times
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: [ Solved ] Quickly switch background color

Post by chrisb »

The built-in save picture doesn't work on some Macs since mid 0.17 times. That's not really an issue for me, because the standard screenshot tool serves the purpose very well; I can select the rectangle to be shot making the screenshots smaller and usually more focused on the matter.

Message is:

Code: Select all

<unknown exception traceback><type 'exceptions.RuntimeError'>: Cannot save null image.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
flachyjoe
Veteran
Posts: 1891
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: [ Solved ] Quickly switch background color

Post by flachyjoe »

bejant wrote: Thu Jul 19, 2018 11:18 am Tools > Save Picture > Extended button > Background = White (and result here with Insert Watermark ticked to True):
You're right but as the settings are not saved between Save Picture calls, it's not as quick as a macro button in toolbar.
- Flachy Joe -
Image
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: [ Solved ] Quickly switch background color

Post by bejant »

flachyjoe wrote: Thu Jul 19, 2018 4:43 pm the settings are not saved between Save Picture calls
Maybe they should be? I think I'd like to re-use my Extended settings, instead of having to change some each time.
Post Reply