Skip to content

Commit

Permalink
Change material_appearance such it is possible to specify only RGB to…
Browse files Browse the repository at this point in the history
… not breaking existing code.

If only RGB is specified existing transparency is used.
  • Loading branch information
amichel0205 committed Feb 25, 2024
1 parent ab43d2d commit 013f3a3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pyaedt/modules/Material.py
Original file line number Diff line number Diff line change
Expand Up @@ -1381,8 +1381,13 @@ def material_appearance(self):
def material_appearance(self, appearance_props):
if not isinstance(appearance_props, (list, tuple)):
raise TypeError("`material_appearance` must be a list or tuple")
if len(appearance_props) != 4:
if len(appearance_props) != 3 and len(appearance_props) != 4:
raise ValueError("`material_appearance` must be four items (R, G, B, transparency)")
elif len(appearance_props) == 3:
transparency_value = self.material_appearance[3]
msg = "Only RGB specified, transparency is set to " + str(transparency_value)
self.logger.info(msg)
appearance_props.append(transparency_value)
value = []
for i in range(len(appearance_props)):
if i < 3:
Expand Down

0 comments on commit 013f3a3

Please sign in to comment.