Esempio n. 1
0
    def _operation_update(node, context):
        binary_ops = {'ADD', 'SUB', 'MUL', 'DIV', 'ATAN2', 'POW', 'LOG', 'MIN', 'MAX'}
        unary_ops = {'SIN', 'COS', 'TAN', 'ASIN', 'ACOS', 'ATAN', 'ROUND', 'FLOOR', 'CEIL'}
        compare_ops = {'GREATER', 'LESS'}

        op = node.operation
        if op in binary_ops:
            used_sockets = {'a', 'b', 'rf'}
        elif op in unary_ops:
            used_sockets = {'a', 'rf'}
        elif op in compare_ops:
            used_sockets = {'a', 'b', 'rb'}
        else:
            used_sockets = set()

        names = {
            'a'  : 'Value',
            'b'  : 'Value',
            'rf' : 'Result',
            'rb' : 'Result',
            }
        if op == 'pow':
            names['b'] = 'Exponent'
        elif op == 'log':
            names['b'] = 'Base'

        for socket in chain(node.inputs, node.outputs):
            socket.enabled = (socket.identifier in used_sockets)
            socket.name = names[socket.identifier]

        update_socket_value(node, context)
Esempio n. 2
0
    def _fit_type_update(node, context):
        fit_type = node.fit_type
        if fit_type == 'FIXED_COUNT':
            unused_sockets = {'fit_length', 'curve'}
        elif fit_type == 'FIT_LENGTH':
            unused_sockets = {'count', 'curve'}
        elif fit_type == 'FIT_CURVE':
            unused_sockets = {'count', 'fit_length'}
        else:
            unused_sockets = {'count', 'fit_length', 'curve'}

        for socket in chain(node.inputs, node.outputs):
            socket.enabled = (socket.identifier not in unused_sockets)

        update_socket_value(node, context)
Esempio n. 3
0
    def _fit_type_update(node, context):
        fit_type = node.fit_type
        if fit_type == 'FIXED_COUNT':
            unused_sockets = {'fit_length', 'curve'}
        elif fit_type == 'FIT_LENGTH':
            unused_sockets = {'count', 'curve'}
        elif fit_type == 'FIT_CURVE':
            unused_sockets = {'count', 'fit_length'}
        else:
            unused_sockets = {'count', 'fit_length', 'curve'}

        for socket in chain(node.inputs, node.outputs):
            socket.enabled = (socket.identifier not in unused_sockets)

        update_socket_value(node, context)
Esempio n. 4
0
    def _operation_update(node, context):
        op = node.operation
        if op in {'DOT', 'DISTANCE'}:
            used_sockets = {'a', 'b', 'rf'}
        elif op in {'LENGTH'}:
            used_sockets = {'a', 'rf'}
        elif op in {'ADD', 'SUB', 'MUL', 'DIV', 'CROSS'}:
            used_sockets = {'a', 'b', 'rv'}
        elif op in {'SEPARATE'}:
            used_sockets = {'a', 'rx', 'ry', 'rz'}
        elif op in {'COMBINE'}:
            used_sockets = {'x', 'y', 'z', 'rv'}
        else:
            used_sockets = set()

        for socket in chain(node.inputs, node.outputs):
            socket.enabled = (socket.identifier in used_sockets)

        update_socket_value(node, context)