Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_node_graph.c
| Show First 20 Lines • Show All 349 Lines • ▼ Show 20 Lines | |||||
| /* Attributes and Textures */ | /* Attributes and Textures */ | ||||
| /** Add a new varying attribute of given type and name. Returns NULL if out of slots. */ | /** Add a new varying attribute of given type and name. Returns NULL if out of slots. */ | ||||
| static GPUMaterialAttribute *gpu_node_graph_add_attribute(GPUNodeGraph *graph, | static GPUMaterialAttribute *gpu_node_graph_add_attribute(GPUNodeGraph *graph, | ||||
| CustomDataType type, | CustomDataType type, | ||||
| const char *name) | const char *name) | ||||
| { | { | ||||
| /* Fall back to the UV layer, which matches old behavior. */ | |||||
| if (type == CD_AUTO_FROM_NAME && name[0] == '\0') { | |||||
| type = CD_MTFACE; | |||||
| } | |||||
| /* Find existing attribute. */ | /* Find existing attribute. */ | ||||
| int num_attributes = 0; | int num_attributes = 0; | ||||
| GPUMaterialAttribute *attr = graph->attributes.first; | GPUMaterialAttribute *attr = graph->attributes.first; | ||||
| for (; attr; attr = attr->next) { | for (; attr; attr = attr->next) { | ||||
| if (attr->type == type && STREQ(attr->name, name)) { | if (attr->type == type && STREQ(attr->name, name)) { | ||||
| break; | break; | ||||
| } | } | ||||
| num_attributes++; | num_attributes++; | ||||
| ▲ Show 20 Lines • Show All 526 Lines • Show Last 20 Lines | |||||