From ac9cd38650d112488dcdb1743e2c9fd62edf1fba Mon Sep 17 00:00:00 2001 From: furti Date: Sat, 15 Jun 2019 17:11:40 +0200 Subject: [PATCH] Add support for PartDesign:Body colors When the tip of a PartDesign:Body is colorized, the colors are stored on tip level. But when the shape of the whole body is changed the information is stored on body level. To account for this we check if the tip has more than one DiffuseColor set. When not, we use the shape color of the body. --- src/Mod/Arch/ArchFence.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Mod/Arch/ArchFence.py b/src/Mod/Arch/ArchFence.py index 0aa87a08a9..94d70cb96e 100644 --- a/src/Mod/Arch/ArchFence.py +++ b/src/Mod/Arch/ArchFence.py @@ -317,6 +317,18 @@ class _ViewProviderFence(ArchComponent.ViewProviderComponent): def normalizeColors(self, obj, numberOfFaces): colors = obj.ViewObject.DiffuseColor + + if obj.TypeId == 'PartDesign::Body': + # When colorizing a PartDesign Body we have two options + # 1. The whole body got a shape color, that means the tip has only a single diffuse color set + # so we use the shape color of the body + # 2. "Set colors" was called on the tip and the individual faces where colorized. + # We use the diffuseColors of the tip in that case + tipColors = obj.Tip.ViewObject.DiffuseColor + + if len(tipColors) > 1: + colors = tipColors + numberOfColors = len(colors) if numberOfColors == 1: