Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_mapping.c
| Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| static const char *names[] = { | static const char *names[] = { | ||||
| [NODE_MAPPING_TYPE_POINT] = "mapping_point", | [NODE_MAPPING_TYPE_POINT] = "mapping_point", | ||||
| [NODE_MAPPING_TYPE_TEXTURE] = "mapping_texture", | [NODE_MAPPING_TYPE_TEXTURE] = "mapping_texture", | ||||
| [NODE_MAPPING_TYPE_VECTOR] = "mapping_vector", | [NODE_MAPPING_TYPE_VECTOR] = "mapping_vector", | ||||
| [NODE_MAPPING_TYPE_NORMAL] = "mapping_normal", | [NODE_MAPPING_TYPE_NORMAL] = "mapping_normal", | ||||
| }; | }; | ||||
| if (node->custom1 < ARRAY_SIZE(names) && names[node->custom1]) { | |||||
| return GPU_stack_link(mat, node, names[node->custom1], in, out); | return GPU_stack_link(mat, node, names[node->custom1], in, out); | ||||
| } | } | ||||
| else { | |||||
| return 0; | |||||
| } | |||||
| } | |||||
| static void node_shader_update_mapping(bNodeTree *UNUSED(ntree), bNode *node) | static void node_shader_update_mapping(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| bNodeSocket *sock = nodeFindSocket(node, SOCK_IN, "Location"); | bNodeSocket *sock = nodeFindSocket(node, SOCK_IN, "Location"); | ||||
| nodeSetSocketAvailability( | nodeSetSocketAvailability( | ||||
| sock, ELEM(node->custom1, NODE_MAPPING_TYPE_POINT, NODE_MAPPING_TYPE_TEXTURE)); | sock, ELEM(node->custom1, NODE_MAPPING_TYPE_POINT, NODE_MAPPING_TYPE_TEXTURE)); | ||||
| } | } | ||||
| Show All 11 Lines | |||||