Skip to content
Browse files

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.
  • Loading branch information...
furti authored and yorikvanhavre committed Jun 15, 2019
1 parent 3429299 commit 88d16c149588cde0e2d84a765d25d56ecfea5ae6
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/Mod/Arch/
@@ -317,6 +317,18 @@ def applyColors(self, obj):

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:

0 comments on commit 88d16c1

Please sign in to comment.
You can’t perform that action at this time.