Skip to content

Commit

Permalink
Add support for PartDesign:Body colors
Browse files Browse the repository at this point in the history
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 88d16c1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Mod/Arch/ArchFence.py
Expand Up @@ -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:
Expand Down

0 comments on commit 88d16c1

Please sign in to comment.