From 722a0d552cc2c065596f40607cfb8016b0ab9844 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 12 Aug 2019 19:22:58 -0300 Subject: [PATCH] Arch: Allow to turn off material color and object color syncing --- src/Mod/Arch/ArchComponent.py | 9 ++++++++- src/Mod/Arch/Resources/ui/preferences-arch.ui | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 4aaab11d87..f442560b23 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -741,12 +741,19 @@ class ViewProviderComponent: vobj.Proxy = self self.Object = vobj.Object + self.setProperties(self,vobj) + + def setProperties(self,vobj): + + if not "UseMaterialColor" in vobj.PropertiesList: + vobj.addProperty("App::PropertyBool","UseMaterialColor","Component",QT_TRANSLATE_NOOP("App::Property","Use the material color as this object's shape color, if available")) + vobj.UseMaterialColor = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetBool("UseMaterialColor",True) def updateData(self,obj,prop): #print(obj.Name," : updating ",prop) if prop == "Material": - if obj.Material: + if obj.Material and ( (not hasattr(obj.ViewObject,"UseMaterialColor")) or obj.ViewObject.UseMaterialColor): if hasattr(obj.Material,"Material"): if 'DiffuseColor' in obj.Material.Material: if "(" in obj.Material.Material['DiffuseColor']: diff --git a/src/Mod/Arch/Resources/ui/preferences-arch.ui b/src/Mod/Arch/Resources/ui/preferences-arch.ui index 8b070cd0da..59c8603a90 100644 --- a/src/Mod/Arch/Resources/ui/preferences-arch.ui +++ b/src/Mod/Arch/Resources/ui/preferences-arch.ui @@ -7,7 +7,7 @@ 0 0 446 - 792 + 811 @@ -217,6 +217,19 @@ + + + + If this is checked, when an Arch object has a material, the object will take the color of the material. This can be overridden for each object. + + + Use material color as shape color + + + true + + +