From b83fe33f12bdbf1c5a361daedbb1198282321c39 Mon Sep 17 00:00:00 2001 From: Valtteri Koskivuori Date: Mon, 1 Jul 2024 23:56:06 +0300 Subject: [PATCH] blender: Partially convert ShaderNodeLayerWeight 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 --- bindings/nodes/convert.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bindings/nodes/convert.py b/bindings/nodes/convert.py index 570cabf0..d60449fe 100644 --- a/bindings/nodes/convert.py +++ b/bindings/nodes/convert.py @@ -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) @@ -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: