Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_math.c
| Context not available. | |||||
| { -1, 0, "" } | { -1, 0, "" } | ||||
| }; | }; | ||||
| static void node_composite_update_math(bNodeTree *UNUSED(ntree), bNode *node) | |||||
| { | |||||
| bNodeSocket *sock; | |||||
| int operation = node->custom1; | |||||
| // There are only two sockets, you want to always toggle the second one on/off | |||||
kevindietrich: Avoid C++ style comment in the C code. | |||||
| sock = node->inputs.last; | |||||
| // All of the following are one socket operations | |||||
| if (operation == NODE_MATH_SIN || | |||||
| operation == NODE_MATH_COS || | |||||
| operation == NODE_MATH_TAN || | |||||
| operation == NODE_MATH_ASIN || | |||||
| operation == NODE_MATH_ACOS || | |||||
| operation == NODE_MATH_ATAN || | |||||
| operation == NODE_MATH_ROUND || | |||||
| operation == NODE_MATH_ABS | |||||
kevindietrichUnsubmitted Not Done Inline ActionsCould use the ELEM macro: https://developer.blender.org/diffusion/B/browse/master/source/blender/blenlib/BLI_utildefines.h$221 e.g.: if (ELEM(operation, NODE_MATH_SIN, NODE_MATH_COS, ..)) {
sock->flag |= SOCK_UNAVAIL;
}
else {
sock->flag &= ~SOCK_UNAVAIL;
}kevindietrich: Could use the ELEM macro: https://developer.blender. | |||||
| ) | |||||
| sock->flag |= SOCK_UNAVAIL; | |||||
| else | |||||
| sock->flag &= ~SOCK_UNAVAIL; | |||||
| } | |||||
| void register_node_type_cmp_math(void) | void register_node_type_cmp_math(void) | ||||
| { | { | ||||
| Context not available. | |||||
| cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, 0); | cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, 0); | ||||
| node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out); | node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out); | ||||
| node_type_label(&ntype, node_math_label); | node_type_label(&ntype, node_math_label); | ||||
| node_type_update(&ntype, node_composite_update_math, NULL); | |||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||
| Context not available. | |||||
Avoid C++ style comment in the C code.