Skip to content

Commit

Permalink
Arch: Allow to turn off material color and object color syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Aug 12, 2019
1 parent 641d946 commit 683397b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/Mod/Arch/ArchComponent.py
Expand Up @@ -741,12 +741,19 @@ def __init__(self,vobj):

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']:
Expand Down
15 changes: 14 additions & 1 deletion src/Mod/Arch/Resources/ui/preferences-arch.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>446</width>
<height>792</height>
<height>811</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -217,6 +217,19 @@
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBox_6">
<property name="toolTip">
<string>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.</string>
</property>
<property name="text">
<string>Use material color as shape color</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
Expand Down

0 comments on commit 683397b

Please sign in to comment.