bug in set hsv ?

   325   1   0
User Avatar
Member
193 posts
Joined: 12月 2016
Offline
Hello i have been hitting this wal in mutple places and was assuming i am doing something wrong.
No matter how i look at it though it seems like im not making a mistake.
below you can find my code and error

CODE:
avg_hsv_filtered = [float(24),float(0.999),float(0.029)]

am_tuple = tuple(avg_hsv_filtered)
res = type(am_tuple) is tuple
res_1 = type(am_tuple[0]) is float
res_2 = type(am_tuple[1]) is float
res_3 = type(am_tuple[2]) is float
print("Is variable tuple ? : " + str(res))
print("\nIs variable float ? : " + str(res_1)+ str(res_2) + str(res_3)  )

hsv = hou.Color((1.0, 0, 0))
hsv = hsv.setHSV(am_tuple)
if hsv is None:
    print('Error: Could not setHSV')
else:
    rgb = hsv.rgb()
    print( f"rgb: {rgb}\n")
# it stil seems off ?
# Display the results
print(f"hsv : {avg_hsv_filtered}\n")
ERROR:
Is variable tuple ? : True

Is variable float ? : TrueTrueTrue
Error: Could not setHSV
hsv : [24.0, 0.999, 0.029]
Edited by NicTanghe - 2023年10月3日 19:17:32
User Avatar
Member
8554 posts
Joined: 7月 2007
Offline
This line
hsv = hsv.setHSV(am_tuple)
Should most likely be just
hsv.setHSV(am_tuple)

As that function doesn't return anything, just sets color in-place from HSV tuple
Edited by tamte - 2023年10月3日 19:50:58
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links