FreeCAD_FastenersWB icon indicating copy to clipboard operation
FreeCAD_FastenersWB copied to clipboard

DefaultFastenerColor is 100 % transparent.

Open berberic2 opened this issue 1 year ago • 4 comments

If DefaultFastenerColor is set in the preferences, the created screw has the property Transparency set to 100 %. Only the lines are visible.

The problem is that FSParam.GetUnsigned("DefaultFastenerColor", 0xcccccc00) returns a value with the lowest 8 bits set to 1 (0x??????FF), so having an alpha Value of 0xFF. It is not possible to set the alpha-value in the color-selection-dialog.

workaround:

diff --git a/FastenersCmd.py b/FastenersCmd.py
index 4e49727..8b7c4ba 100644
--- a/FastenersCmd.py
+++ b/FastenersCmd.py
@@ -885,7 +885,7 @@ class FSScrewCommand:
             FSScrewObject(a, self.Type, selObj)
             a.Label = a.Proxy.familyType
             if FSParam.GetBool("DefaultFastenerColorActive", False):
-                a.ViewObject.DiffuseColor = FSParam.GetUnsigned("DefaultFastenerColor", 0xcccccc00)
+                a.ViewObject.DiffuseColor = FSParam.GetUnsigned("DefaultFastenerColor", 0xcccccc00) & 0xFFFFFF00
             if FSParam.GetBool("DefaultLineWidthActive", False):
                 a.ViewObject.LineWidth = FSParam.GetFloat("DefaultLineWidth", 1.0)
             if FSParam.GetBool("DefaultVertexSizeActive", False):


OS: Debian GNU/Linux 12 (bookworm) (KDE/plasma/xcb)
Architecture: x86_64
Version: 1.1.0dev.39153 +4 (Git)
Build type: Release
Branch: Meins
Hash: 571ae7f9732bc78fc5777abba8ab5b6a5bfced3c
Python 3.11.2, Qt 5.15.8, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: German/Germany (de_DE)
Stylesheet/Theme/QtStyle: unset/FreeCAD Classic/Qt default

berberic2 avatar Nov 10 '24 21:11 berberic2

Wow this is so strange. An alpha value of 0xFF should be fully opaque (in all standards that I know of) why is it opposite in freecad?

shaise avatar Nov 11 '24 09:11 shaise

I have DefaultFastenerColorActive set since at least June and I’m quite sure it worked until recently. DefaultFastenerColor had a value of 0xE6E6FAFF then (in user.cfg).

berberic2 avatar Nov 11 '24 12:11 berberic2

I KNOW it used to work before. So something must have changed. Anyway at least your change seems to be backward compatible

shaise avatar Nov 11 '24 13:11 shaise

is this issue still relevant with the changes in main?

maxwxyz avatar Feb 04 '25 20:02 maxwxyz