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.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user