from lnx.logicnode.lnx_nodes import *


class CombineColorNode(LnxLogicTreeNode):
    """Combines the given RGBA (red, green, blue, and alpha) components to a color value.
    If any input is `null`, the respective channel of the output color is set to `0.0`.
    """
    bl_idname = 'LNCombineColorNode'
    bl_label = 'Combine RGBA'
    lnx_section = 'color'
    lnx_version = 1

    def lnx_init(self, context):
        self.add_input('LnxFloatSocket', 'R', default_value=0.0)
        self.add_input('LnxFloatSocket', 'G', default_value=0.0)
        self.add_input('LnxFloatSocket', 'B', default_value=0.0)
        self.add_input('LnxFloatSocket', 'A', default_value=1.0)

        self.add_output('LnxColorSocket', 'Color', default_value=[1.0, 1.0, 1.0, 1.0])