Skip to content

Commit

Permalink
blender: Partially convert ShaderNodeLayerWeight
Browse files Browse the repository at this point in the history
Just to get the node graph propagating, I'm adding this ugly thing. It's
a weird node to begin with, made even weirder by the ambiguous "blend"
input. For now it's just fresnel, or a constant 0.0
  • Loading branch information
vkoskiv committed Jul 1, 2024
1 parent fec8c25 commit b83fe33
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bindings/nodes/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@ def parse_value(input, group_inputs):
case 'ShaderNodeValToRGB':
color = parse_color(input, group_inputs)
return NodeValueGrayscale(color)
case 'ShaderNodeLayerWeight':
# FIXME: Ignoring blend
blend = parse_value(input.inputs[0], group_inputs)
normal = parse_vector(input.inputs[1], group_inputs)
# FIXME: If both are linked, will always take this first one
if input.outputs['Fresnel'].is_linked:
return NodeValueFresnel(NodeValueConstant(1.0), normal)
if input.outputs['Facing'].is_linked:
# TODO
return NodeValueConstant(0.0)
case _:
print("Unknown value node of type {}, maybe fix.".format(input.bl_idname))
return NodeValueConstant(0.0)
Expand Down Expand Up @@ -392,6 +402,7 @@ def parse_vector(input, group_inputs):
op = map_vec_op(input.operation)
return NodeVectorVecMath(a, b, c, f, op)
case 'ShaderNodeTexCoord':
# FIXME: I doubt this will work
if input.outputs['UV'].is_linked:
return NodeVectorUV()
if input.outputs['Normal'].is_linked:
Expand Down

0 comments on commit b83fe33

Please sign in to comment.