-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix desaturation check with new mix node #368
Comments
I've isolated it down to this section: elif engine == 'CYCLES' or engine == 'BLENDER_EEVEE':
sat_node = None
for node in mat.node_tree.nodes:
if "SATURATE" not in node:
continue
sat_node = node
break
if not sat_node:
return # requires regenerating material to add back
if len(desat_color) == 3:
desat_color += [1] # add in alpha
sat_node.inputs[2].default_value = desat_color |
Ahh I see, desat_color = conf.json_data['blocks']['desaturated'][canon] "blocks" : {
"desaturated": {
"acacia_leaves": [
0.227161,
0.614651,
0.089036
],
"attached_melon_stem": [
0.227161,
0.614651,
0.089036
],
"attached_pumpkin_stem": [
0.227161,
0.614651,
0.089036
],
// So on so forth
}
} Later on, an extra element is added: if len(desat_color) == 3:
desat_color += [1] # add in alpha In other words, the edge cases we're seeing is related to this list being used to assign a value. |
So I decided to perform a test. I added the following: try:
print("Float")
print(desat_color)
sat_node.inputs[2].default_value = desat_color
except Exception:
print(desat_color) It seems like every time we desaturate colors, we're doing so with a list. I think we have the wrong input then |
Ok, the issue is we're using the wrong index I made a simple script that prints out the inputs with their index and input type, and this is what I got (with one material that only had a Mix node): 0
<bpy_struct, NodeSocketFloatFactor("Factor") at 0x7f63ba65dc08>
1
<bpy_struct, NodeSocketVector("Factor") at 0x7f63abc83008>
2
<bpy_struct, NodeSocketFloat("A") at 0x7f63abcdd408>
3
<bpy_struct, NodeSocketFloat("B") at 0x7f63d8df2608>
4
<bpy_struct, NodeSocketVector("A") at 0x7f63d8df2808>
5
<bpy_struct, NodeSocketVector("B") at 0x7f63d8df2a08>
6
<bpy_struct, NodeSocketColor("A") at 0x7f63d8df2c08>
7
<bpy_struct, NodeSocketColor("B") at 0x7f63d8df2e08> We're currently trying to set input 2, but input 2 is a |
This is confirmed when I directly access the index. <bpy_struct, NodeSocketFloat("A") at 0x7f31d2b36e08>
<bpy_struct, NodeSocketColor("A") at 0x7f31d2b5b608> The top happens when I directly print |
This does not affect prod, only our current dev build.
The recent update to support the new and legacy mix rgb node missed an edge case where we prep/generate materials on a water shader AND "Animate textures" is enabled, it yields this error:
This seems specific to the generate materials function when animate textures is on. We should define a new test that ensures a material is created and then properly desaturation checks. Oddly enough, even with this error, the end result actually seems to look ok.
The text was updated successfully, but these errors were encountered: