Self-introduction and a WIP patch to make the chosen display material persist across save/load cycles

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!
Post Reply
dajt
Posts: 5
Joined: Fri Dec 30, 2022 4:23 am

Self-introduction and a WIP patch to make the chosen display material persist across save/load cycles

Post by dajt »

I've been writing Free software since before RMS wrote the GPL, so when something bugs me enough, I can usually dig into the source code and (sometimes) fix it.

It bothered me that when I set the material for a Body under the Appearance submenu, it reverted to "Default" when the project was saved and reloaded, even though the color of the body did not revert. This turned into a somewhat larger patch than I intended, but it made it possible to also read the list of predefined materials from a file at startup, rather than having them compiled-in (but that part is very hacky and not at all merge-ready).

But now I'm up to a bug. When the user manually changes the color properties of a body, the Material changes to "User Defined", but the selector in the GUI still lists the old value, and it doesn't change until the pane is closed and reopened. Can someone who knows Qt help me fix that?
Attachments
material-patch.txt
(34.02 KiB) Downloaded 15 times
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Self-introduction and a WIP patch to make the chosen display material persist across save/load cycles

Post by adrianinsaval »

It's better if you link to a git branch rather than just posting a patch
dajt
Posts: 5
Joined: Fri Dec 30, 2022 4:23 am

Re: Self-introduction and a WIP patch to make the chosen display material persist across save/load cycles

Post by dajt »

I set up a git repo at https://www.afal.party/git/FreeCAD.git where you can check out the display-material branch.
Post Reply